Tag codec2-0.4 and fdmdv2-0.99-Beta
authorhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 8 Aug 2015 02:05:43 +0000 (02:05 +0000)
committerhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 8 Aug 2015 02:05:43 +0000 (02:05 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2262 01035d8c-6547-0410-b346-abe4f91aad63

412 files changed:
codec2/tags/.gitignore [deleted file]
codec2/tags/0.4/AUTHORS [new file with mode: 0644]
codec2/tags/0.4/CMakeLists.txt [new file with mode: 0644]
codec2/tags/0.4/COPYING [new file with mode: 0644]
codec2/tags/0.4/ChangeLog [new file with mode: 0644]
codec2/tags/0.4/INSTALL [new file with mode: 0644]
codec2/tags/0.4/NEWS [new file with mode: 0644]
codec2/tags/0.4/README [new file with mode: 0644]
codec2/tags/0.4/README_fdmdv.txt [new file with mode: 0644]
codec2/tags/0.4/cmake/GetDependencies.cmake.in [new file with mode: 0644]
codec2/tags/0.4/cmake/config.h.in [new file with mode: 0644]
codec2/tags/0.4/raw/b0067.raw [new file with mode: 0644]
codec2/tags/0.4/raw/cq_ref.raw [new file with mode: 0644]
codec2/tags/0.4/raw/cross.raw [new file with mode: 0644]
codec2/tags/0.4/raw/cross_melp2400.raw [new file with mode: 0644]
codec2/tags/0.4/raw/f2400.raw [new file with mode: 0644]
codec2/tags/0.4/raw/forig.raw [new file with mode: 0644]
codec2/tags/0.4/raw/forig_ambe2000.raw [new file with mode: 0644]
codec2/tags/0.4/raw/forig_g729a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/forig_gsm13k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/forig_speex_8k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/g3plx.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1a_ambe2000.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1a_g729a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1a_gsm13k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1a_melp.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts1a_speex_8k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2a_ambe2000.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2a_g729a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2a_gsm13k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2a_melp.raw [new file with mode: 0644]
codec2/tags/0.4/raw/hts2a_speex_8k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/k6hx.raw [new file with mode: 0644]
codec2/tags/0.4/raw/kristoff.raw [new file with mode: 0644]
codec2/tags/0.4/raw/m2400.raw [new file with mode: 0644]
codec2/tags/0.4/raw/mmt1.raw [new file with mode: 0644]
codec2/tags/0.4/raw/mmt1_ambe2000.raw [new file with mode: 0644]
codec2/tags/0.4/raw/mmt1_g729a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/mmt1_gsm13k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/mmt1_speex_8k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/morig.raw [new file with mode: 0644]
codec2/tags/0.4/raw/morig_ambe2000.raw [new file with mode: 0644]
codec2/tags/0.4/raw/morig_g729a.raw [new file with mode: 0644]
codec2/tags/0.4/raw/morig_gsm13k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/morig_speex_8k.raw [new file with mode: 0644]
codec2/tags/0.4/raw/sine1k_2Hz_spread.raw [new file with mode: 0644]
codec2/tags/0.4/raw/sine1k_2ms_delay_2Hz_spread.raw [new file with mode: 0644]
codec2/tags/0.4/raw/ve9qrp.raw [new file with mode: 0644]
codec2/tags/0.4/raw/ve9qrp_10s.raw [new file with mode: 0644]
codec2/tags/0.4/src/CMakeLists.txt [new file with mode: 0644]
codec2/tags/0.4/src/_kiss_fft_guts.h [new file with mode: 0644]
codec2/tags/0.4/src/ampexp.c [new file with mode: 0644]
codec2/tags/0.4/src/ampexp.h [new file with mode: 0644]
codec2/tags/0.4/src/bpf.h [new file with mode: 0644]
codec2/tags/0.4/src/c2dec.c [new file with mode: 0644]
codec2/tags/0.4/src/c2demo.c [new file with mode: 0644]
codec2/tags/0.4/src/c2enc.c [new file with mode: 0644]
codec2/tags/0.4/src/c2sim.c [new file with mode: 0644]
codec2/tags/0.4/src/codebook.c [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp10.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp4.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp5.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp6.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp7.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp8.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/dlsp9.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/gecb.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp10.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp4.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp5.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp6.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp7.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp8.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp8910.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lsp9.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt1-10.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt1-4.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt10.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt4.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt5-10.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt5.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt6.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt7.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt8.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspdt9.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspjvm1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspjvm2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspjvm3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspres_bw1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspres_bw2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspres_centre1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspres_centre2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqanssi1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqanssi2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqanssi3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqanssi4.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqexp1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqexp2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/lspvqexp3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/mel1.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/mel2.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/mel3.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/mel4.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/mel5.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebook/mel6.txt [new file with mode: 0644]
codec2/tags/0.4/src/codebookd.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookdt.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookge.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookjnd.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookjvm.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookres.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookvq.c [new file with mode: 0644]
codec2/tags/0.4/src/codebookvqanssi.c [new file with mode: 0644]
codec2/tags/0.4/src/codec2.c [new file with mode: 0644]
codec2/tags/0.4/src/codec2.h [new file with mode: 0644]
codec2/tags/0.4/src/codec2_cohpsk.h [new file with mode: 0644]
codec2/tags/0.4/src/codec2_fdmdv.h [new file with mode: 0644]
codec2/tags/0.4/src/codec2_fifo.h [new file with mode: 0644]
codec2/tags/0.4/src/codec2_fm.h [new file with mode: 0644]
codec2/tags/0.4/src/codec2_internal.h [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk.c [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_ch.c [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_defs.h [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_demod.c [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_get_test_bits.c [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_internal.h [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_mod.c [new file with mode: 0644]
codec2/tags/0.4/src/cohpsk_put_test_bits.c [new file with mode: 0644]
codec2/tags/0.4/src/comp.h [new file with mode: 0644]
codec2/tags/0.4/src/comp_prim.h [new file with mode: 0644]
codec2/tags/0.4/src/defines.h [new file with mode: 0644]
codec2/tags/0.4/src/dump.c [new file with mode: 0644]
codec2/tags/0.4/src/dump.h [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv.c [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_channel.c [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_demod.c [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_get_test_bits.c [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_interleave.c [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_internal.h [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_mod.c [new file with mode: 0644]
codec2/tags/0.4/src/fdmdv_put_test_bits.c [new file with mode: 0644]
codec2/tags/0.4/src/fec_dec.c [new file with mode: 0644]
codec2/tags/0.4/src/fec_enc.c [new file with mode: 0644]
codec2/tags/0.4/src/fifo.c [new file with mode: 0644]
codec2/tags/0.4/src/fm.c [new file with mode: 0644]
codec2/tags/0.4/src/fm_demod.c [new file with mode: 0644]
codec2/tags/0.4/src/fm_fir_coeff.h [new file with mode: 0644]
codec2/tags/0.4/src/fq20.sh [new file with mode: 0755]
codec2/tags/0.4/src/freedv_api.c [new file with mode: 0644]
codec2/tags/0.4/src/freedv_api.h [new file with mode: 0644]
codec2/tags/0.4/src/freedv_api_internal.h [new file with mode: 0644]
codec2/tags/0.4/src/freedv_rx.c [new file with mode: 0644]
codec2/tags/0.4/src/freedv_tx.c [new file with mode: 0644]
codec2/tags/0.4/src/generate_codebook.c [new file with mode: 0644]
codec2/tags/0.4/src/genlspdtcb.c [new file with mode: 0644]
codec2/tags/0.4/src/golay23.c [new file with mode: 0644]
codec2/tags/0.4/src/golay23.h [new file with mode: 0644]
codec2/tags/0.4/src/golaydectable.h [new file with mode: 0644]
codec2/tags/0.4/src/golayenctable.h [new file with mode: 0644]
codec2/tags/0.4/src/hanning.h [new file with mode: 0644]
codec2/tags/0.4/src/ht_coeff.h [new file with mode: 0644]
codec2/tags/0.4/src/insert_errors.c [new file with mode: 0644]
codec2/tags/0.4/src/interp.c [new file with mode: 0644]
codec2/tags/0.4/src/interp.h [new file with mode: 0644]
codec2/tags/0.4/src/kiss_fft.c [new file with mode: 0644]
codec2/tags/0.4/src/kiss_fft.h [new file with mode: 0644]
codec2/tags/0.4/src/linreg.c [new file with mode: 0644]
codec2/tags/0.4/src/linreg.h [new file with mode: 0644]
codec2/tags/0.4/src/listensim.sh [new file with mode: 0755]
codec2/tags/0.4/src/lpc.c [new file with mode: 0644]
codec2/tags/0.4/src/lpc.h [new file with mode: 0644]
codec2/tags/0.4/src/lsp.c [new file with mode: 0644]
codec2/tags/0.4/src/lsp.h [new file with mode: 0644]
codec2/tags/0.4/src/machdep.h [new file with mode: 0644]
codec2/tags/0.4/src/modem_stats.c [new file with mode: 0644]
codec2/tags/0.4/src/modem_stats.h [new file with mode: 0644]
codec2/tags/0.4/src/nlp.c [new file with mode: 0644]
codec2/tags/0.4/src/nlp.h [new file with mode: 0644]
codec2/tags/0.4/src/octave.c [new file with mode: 0644]
codec2/tags/0.4/src/octave.h [new file with mode: 0644]
codec2/tags/0.4/src/os.h [new file with mode: 0644]
codec2/tags/0.4/src/pack.c [new file with mode: 0644]
codec2/tags/0.4/src/phase.c [new file with mode: 0644]
codec2/tags/0.4/src/phase.h [new file with mode: 0644]
codec2/tags/0.4/src/phaseexp.c [new file with mode: 0644]
codec2/tags/0.4/src/phaseexp.h [new file with mode: 0644]
codec2/tags/0.4/src/pilot_coeff.h [new file with mode: 0644]
codec2/tags/0.4/src/pilots_coh.h [new file with mode: 0644]
codec2/tags/0.4/src/postfilter.c [new file with mode: 0644]
codec2/tags/0.4/src/postfilter.h [new file with mode: 0644]
codec2/tags/0.4/src/quantise.c [new file with mode: 0644]
codec2/tags/0.4/src/quantise.h [new file with mode: 0644]
codec2/tags/0.4/src/rn.h [new file with mode: 0644]
codec2/tags/0.4/src/rn_coh.h [new file with mode: 0644]
codec2/tags/0.4/src/rxdec_coeff.h [new file with mode: 0644]
codec2/tags/0.4/src/sim.sh [new file with mode: 0755]
codec2/tags/0.4/src/sine.c [new file with mode: 0644]
codec2/tags/0.4/src/sine.h [new file with mode: 0644]
codec2/tags/0.4/src/ssbfilt_coeff.h [new file with mode: 0644]
codec2/tags/0.4/src/test_bits.h [new file with mode: 0644]
codec2/tags/0.4/src/test_bits_coh.h [new file with mode: 0644]
codec2/tags/0.4/src/varicode.c [new file with mode: 0644]
codec2/tags/0.4/src/varicode.h [new file with mode: 0644]
codec2/tags/0.4/src/varicode_table.h [new file with mode: 0644]
codec2/tags/0.4/stm32/Makefile [new file with mode: 0644]
codec2/tags/0.4/stm32/README.txt [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/debugblinky.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/gdb_stdio.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/iir_duc.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/iir_tuner.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/sm1000_leds_switches.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/stm32f4_adc.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/stm32f4_adc_tuner.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/stm32f4_dac.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/stm32f4_dacduc.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/stm32f4_usb_vcp.h [new file with mode: 0644]
codec2/tags/0.4/stm32/inc/stm32f4xx_conf.h [new file with mode: 0644]
codec2/tags/0.4/stm32/src/adc_rec.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/adc_sd.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/adcdac_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/codec2_profile.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/dac_it.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/dac_play.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/dac_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/debugblinky.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/fast_dac_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/fdmdv_dump_rt.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/fdmdv_profile.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/fft_test.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/freedv_rx_profile.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/freedv_tx_profile.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/gdb_stdio.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/iir_duc.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/iir_tuner.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/init.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/power_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/sine.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/sine.h [new file with mode: 0644]
codec2/tags/0.4/stm32/src/sm1000_leds_switches.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/sm1000_leds_switches_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/sm1000_main.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/startup_stm32f4xx.s [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_adc.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_adc_tuner.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_dac.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_dacduc.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_machdep.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_pwm.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/stm32f4_usb_vcp.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/system_stm32f4xx.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/timer_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/tuner_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/usb_vcp_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/src/usb_vsp_ut.c [new file with mode: 0644]
codec2/tags/0.4/stm32/stlink/elfsym.c [new file with mode: 0644]
codec2/tags/0.4/stm32/stlink/elfsym.h [new file with mode: 0644]
codec2/tags/0.4/stm32/stlink/stlink.patch [new file with mode: 0644]
codec2/tags/0.4/stm32/stm32_flash.ld [new file with mode: 0644]
codec2/tags/0.4/stm32/stm32_ram.ld [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usb_bsp.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usb_bsp.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usb_conf.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usbd_conf.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usbd_desc.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usbd_desc.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_conf/usbd_usr.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_core.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_core.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_vcp.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_vcp.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_core.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_core.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_def.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_ioreq.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_ioreq.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_req.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_req.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/core/usbd_usr.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_core.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_core.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd_int.c [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd_int.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_defines.h [new file with mode: 0644]
codec2/tags/0.4/stm32/usb_lib/otg/usb_regs.h [new file with mode: 0644]
codec2/tags/0.4/wav/all.wav [new file with mode: 0644]
codec2/tags/0.4/wav/cross.wav [new file with mode: 0644]
codec2/tags/0.4/wav/cross_melp2400.wav [new file with mode: 0644]
codec2/tags/0.4/wav/f2400.wav [new file with mode: 0644]
codec2/tags/0.4/wav/forig.wav [new file with mode: 0644]
codec2/tags/0.4/wav/forig_ambe2000.wav [new file with mode: 0644]
codec2/tags/0.4/wav/forig_speex_8k.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a_ambe2000.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a_c2_v0.1.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a_c2_v0.1a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a_g729a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a_lpc10.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts1a_speex_8k.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a_ambe2000.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a_c2_v0.1.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a_c2_v0.1a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a_g729a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a_lpc10.wav [new file with mode: 0644]
codec2/tags/0.4/wav/hts2a_speex_8k.wav [new file with mode: 0644]
codec2/tags/0.4/wav/m2400.wav [new file with mode: 0644]
codec2/tags/0.4/wav/mmt1.wav [new file with mode: 0644]
codec2/tags/0.4/wav/mmt1_ambe2000.wav [new file with mode: 0644]
codec2/tags/0.4/wav/mmt1_c2_v01a.wav [new file with mode: 0644]
codec2/tags/0.4/wav/mmt1_lpc10.wav [new file with mode: 0644]
codec2/tags/0.4/wav/mmt1_speex_8k.wav [new file with mode: 0644]
codec2/tags/0.4/wav/morig.wav [new file with mode: 0644]
codec2/tags/0.4/wav/morig_ambe2000.wav [new file with mode: 0644]
codec2/tags/0.4/wav/morig_speex_8k.wav [new file with mode: 0644]
codec2/tags/0.4/wav/ve9qrp.wav [new file with mode: 0644]
codec2/tags/0.4/wav/vk5qi.wav [new file with mode: 0644]
codec2/tags/0.4/wav/x200_ext.wav [new file with mode: 0644]
codec2/tags/0.4/wav/x200_int.wav [new file with mode: 0644]
fdmdv2/tags/.gitignore [deleted file]
fdmdv2/tags/0.99-Beta/.clang/.gitignore [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/CMakeLists.txt [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/COPYING [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/README.txt [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildCodec2.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildPortaudio.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildSamplerate.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildSndfile.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildSox.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildSpeex.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/BuildWxWidgets.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/FindPortaudio.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/GetDependencies.cmake.in [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/MinGW.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/Toolchain-Ubuntu-mingw32.cmake [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/config.h.in [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/cmake/version.h.in [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/CMakeLists.txt [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/LICENSE [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv.desktop [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv.ico [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv.rc [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv128x128.png [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv256x256.png [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv48x48.png [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/contrib/freedv64x64.png [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/credits.txt [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/current [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/format [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/fs-type [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/fsfs.conf [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/min-unpacked-rev [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/rep-cache.db [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/revprops/0/0 [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/revprops/0/1 [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/revs/0/0 [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/revs/0/1 [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/transactions/.gitignore [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/txn-current [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/txn-current-lock [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/txn-protorevs/.gitignore [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/uuid [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/db/write-lock [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/CMakeLists.txt [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/Makefile.win32 [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/comp.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_audiooptions.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_audiooptions.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_filter.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_filter.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_options.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_options.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_ptt.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/dlg_ptt.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_defines.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_main.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_main.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_pa_wrapper.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_pa_wrapper.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scalar.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scalar.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scatter.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scatter.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_spectrum.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_spectrum.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_waterfall.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_waterfall.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/hamlib.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/hamlib.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/sox.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/sox_biquad.c [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/sox_biquad.h [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/topFrame.cpp [new file with mode: 0644]
fdmdv2/tags/0.99-Beta/src/topFrame.h [new file with mode: 0644]

diff --git a/codec2/tags/.gitignore b/codec2/tags/.gitignore
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/codec2/tags/0.4/AUTHORS b/codec2/tags/0.4/AUTHORS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/codec2/tags/0.4/CMakeLists.txt b/codec2/tags/0.4/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ba58003
--- /dev/null
@@ -0,0 +1,205 @@
+#
+# Codec2 - Next-Generation Digital Voice for Two-Way Radio
+#
+# CMake configuration contributed by Richard Shaw (KF5OIM)
+# Please report questions, comments, problems, or patches to the freetel
+# mailing list: https://lists.sourceforge.net/lists/listinfo/freetel-codec2
+#
+project(codec2)
+
+cmake_minimum_required(VERSION 2.8)
+
+include(GNUInstallDirs)
+mark_as_advanced(CLEAR
+    CMAKE_INSTALL_BINDIR
+    CMAKE_INSTALL_INCLUDEDIR
+    CMAKE_INSTALL_LIBDIR
+)
+
+#
+# Prevent in-source builds
+# If an in-source build is attempted, you will still need to clean up a few
+# files manually.
+#
+set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+  message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not "
+   "allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a "
+   "separate build directory and run cmake from there.")
+endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+
+
+#
+# Set project version information. This should probably be done via external
+# file at some point.
+#
+set(CODEC2_VERSION_MAJOR 0)
+set(CODEC2_VERSION_MINOR 4)
+# Set to patch level if needed, otherwise leave FALSE.
+set(CODEC2_VERSION_PATCH FALSE)
+set(CODEC2_VERSION "${CODEC2_VERSION_MAJOR}.${CODEC2_VERSION_MINOR}")
+# Patch level version bumps should not change API/ABI.
+set(SOVERSION "${CODEC2_VERSION_MAJOR}.${CODEC2_VERSION_MINOR}")
+if(CODEC2_VERSION_PATCH)
+    set(CODEC2_VERSION "${CODEC2_VERSION}.${CODEC2_VERSION_PATCH}")
+endif()
+message(STATUS "codec2 version: ${CODEC2_VERSION}")
+
+# Set default build type
+if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "Release")
+endif()
+
+# Set default C++ flags.
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O2")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS}")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS}")
+
+# -fPIC is implied on MinGW...
+if(NOT WIN32)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+endif()
+
+message(STATUS "Build type is: " ${CMAKE_BUILD_TYPE})
+string(TOUPPER ${CMAKE_BUILD_TYPE} _FLAGS)
+if(NOT "_FLAGS" STREQUAL "NONE")
+    set(BUILD_FLAGS "${CMAKE_C_FLAGS_${_FLAGS}}")
+endif()
+message(STATUS "Compiler Flags: " ${BUILD_FLAGS})
+
+#
+# Setup Windows/MinGW specifics here.
+#
+if(MINGW)
+    message(STATUS "System is MinGW.")
+endif(MINGW)
+
+
+#
+# Find the svn revision if this is a working copy.
+# WORK IN PROGRESS
+# Works ok if it is a working copy but errors out if not.
+#
+#find_package(Subversion)
+#if(Subversion_FOUND)
+#   Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} CODEC2)
+#   message(STATUS "codec2 svn revision: ${CODEC2_WC_REVISION}")
+#else(SUBVERSION_FOUND)
+#   message(WARNING "Subversion not found. Can not determine svn revision.")
+#endif(SUBVERSION_FOUND)
+
+
+#
+# Default options
+#
+option(BUILD_SHARED_LIBS
+    "Build shared library. Set to OFF for static library." ON)
+# Unittest should be on for dev builds and off for releases.
+option(UNITTEST "Build unittest binaries." OFF)
+option(INSTALL_EXAMPLES "Install example code." OFF)
+if(INSTALL_EXAMPLES)
+    install(DIRECTORY octave raw script wav
+        USE_SOURCE_PERMISSIONS
+        DESTINATION ${CMAKE_INSTALL_DATADIR}/codec2)
+endif()
+
+
+# Math library is automatic on windows
+if(UNIX)
+    set(CMAKE_REQUIRED_INCLUDES math.h)
+    set(CMAKE_REQUIRED_LIBRARIES m)
+endif(UNIX)
+
+include(CheckIncludeFiles)
+check_include_files("stdlib.h" HAVE_STDLIB_H)
+check_include_files("string.h" HAVE_STRING_H)
+
+include(CheckFunctionExists)
+check_function_exists(floor  HAVE_FLOOR)
+check_function_exists(ceil   HAVE_CEIL)
+check_function_exists(pow    HAVE_POW)
+check_function_exists(sqrt   HAVE_SQRT)
+check_function_exists(sin    HAVE_SIN)
+check_function_exists(cos    HAVE_COS)
+check_function_exists(atan2  HAVE_ATAN2)
+check_function_exists(log10  HAVE_LOG10)
+check_function_exists(round  HAVE_ROUND)
+check_function_exists(getopt HAVE_GETOPT)
+
+configure_file ("${PROJECT_SOURCE_DIR}/cmake/config.h.in"
+                "${PROJECT_BINARY_DIR}/config.h" )
+include_directories(${PROJECT_BINARY_DIR})
+
+# CMake Package setup
+#include(CMakePackageConfigHelpers)
+#configure_package_config_file(cmake/codec2-config.cmake.in
+#    ${CMAKE_CURRENT_BINARY_DIR}/codec2-config.cmake
+#    INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/codec2
+#    PATH_VARS CMAKE_INSTALL_INCLUDEDIR
+#)
+
+#
+# codec2 library
+#
+add_subdirectory(src)
+
+if(UNITTEST)
+    # Pthread Library
+    find_package(Threads REQUIRED)
+    message(STATUS "Threads library flags: ${CMAKE_THREAD_LIBS_INIT}")
+
+    #
+    # Find speex library
+    #
+    message(STATUS "Looking for Speex DSP library.")
+    find_path(SPEEXDSP_INCLUDE_DIR speex/speex.h)
+    find_library(SPEEXDSP_LIBRARY speexdsp)
+    message(STATUS "  Speex DSP headers: ${SPEEXDSP_INCLUDE_DIR}")
+    message(STATUS "  Speex DSP library: ${SPEEXDSP_LIBRARY}")
+    if(NOT SPEEXDSP_INCLUDE_DIR AND NOT SPEEXDSP_LIBRARY)
+        message(FATAL_ERROR "Speex DSP library not found!")
+    endif()
+
+    add_subdirectory(unittest)
+endif(UNITTEST)
+
+#
+# Cpack NSIS installer configuration for Windows.
+# See: http://nsis.sourceforge.net/Download
+#
+# *nix systems should use "make install" and/or appropriate
+# distribution packaging tools.
+#
+if(WIN32)
+    # Detect if we're doing a 32-bit or 64-bit windows build.
+    if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+        set(CMAKE_CL_64 TRUE)
+    endif()
+
+    configure_file(cmake/GetDependencies.cmake.in cmake/GetDependencies.cmake
+        @ONLY
+    )
+    install(SCRIPT ${CMAKE_BINARY_DIR}/cmake/GetDependencies.cmake)
+    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Next-Generation Digital Voice for Two-Way Radio")
+    set(CPACK_PACKAGE_VENDOR "CMake")
+    set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+    set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
+    set(CPACK_PACKAGE_VERSION_MAJOR ${CODEC2_VERSION_MAJOR})
+    set(CPACK_PACKAGE_VERSION_MINOR ${CODEC2_VERSION_MINOR})
+    if(CODEC2_VERSION_PATCH)
+        set(CPACK_PACKAGE_VERSION_PATCH ${CODEC2_VERSION_PATCH})
+    else()
+        set(CPACK_PACKAGE_VERSION_PATCH 0)
+    endif()
+    set(CPACK_PACKAGE_INSTALL_DIRECTORY "Codec2")
+    set(CPACK_CREATE_DESKTOP_LINKS "")
+    set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+    set(CPACK_NSIS_URL_INFO_ABOUT "http://codec2.org")
+    set(CPACK_NSIS_MODIFY_PATH ON)
+    include(CPack)
+endif(WIN32)
diff --git a/codec2/tags/0.4/COPYING b/codec2/tags/0.4/COPYING
new file mode 100644 (file)
index 0000000..cc40a46
--- /dev/null
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, see 
+    <http://www.gnu.org/licenses/>. 
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/codec2/tags/0.4/ChangeLog b/codec2/tags/0.4/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/codec2/tags/0.4/INSTALL b/codec2/tags/0.4/INSTALL
new file mode 100644 (file)
index 0000000..4500c4c
--- /dev/null
@@ -0,0 +1,47 @@
+==========================
+ Building and Installing
+==========================
+
+NOTES:
+  - Builds against system libraries by default.
+  - Has NSIS packaing support for Windows (WIN32) targets. *nix systems should
+    rely on 'make install' as the packages (RPM & DEB) created by CPack are
+    questionable.
+
+To test the cmake build make a directory anywhere underneath (or outside of)
+the source directory.
+
+Linux command line example:
+
+$ cd /path/to/codec2
+$ mkdir build_linux
+$ cd build_linux
+$ cmake ../ 
+
+Install prefix defaults to /usr/local, use CMAKE_INSTALL_PREFIX to override.
+
+(if no errors)
+$ make
+(as root)
+$ make install
+
+=====================
+ Windows
+=====================
+
+Unlike FreeDV (fdmdv2), codec2 is not currently provided as a separate
+installer, instead the windows version uses a static build of codec2.
+
+Additionally, while MSYS2+MinGW should work, windows builds are produces by 
+cross compiling from linux.
+
+Install MinGW & the mysys shell
+   + pwd -W prints true Win32 directory
+   + I also installed emacs, "tortise svn", and "cmake", and built and installed speex
+
+$ cd codec2-dev
+$ mkdir build_win32
+$ cd build_win32
+$ cmake -DSPEEXDSP_INCLUDE_DIR=/usr/local/include/ -G "MSYS Makefiles" ..
+$ make
+$ make package
diff --git a/codec2/tags/0.4/NEWS b/codec2/tags/0.4/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/codec2/tags/0.4/README b/codec2/tags/0.4/README
new file mode 100644 (file)
index 0000000..a2a822d
--- /dev/null
@@ -0,0 +1,134 @@
+Codec 2 README
+--------------
+
+Codec 2 is an open source (LGPL licensed) speech codec for 3200 bit/s
+and below.  For more information please see:
+
+    http://rowetel.com/codec2.html
+
+Also included is a FDMDV modem (README_fdmdv.txt), a coherent PSK
+modem and an API for embedding FreeDV in other programs (see example
+below).  For more information on building Codec 2 see README.cmake
+
+SVN Repository
+--------------
+
+Check out the latest (development branch) code using:
+
+  $ svn co https://svn.code.sf.net/p/freetel/code/codec2-dev codec2-dev
+
+There are 3rd party GIT mirrors of Codec2 and FreeDV. Use Git at your
+own risk.
+
+  GIT IS NOT SUPPORTED!!!
+
+All patches, support questions etc, need to be against the SVN
+repository above.
+
+Please do not email me (David), or the codec2-dev mailing list
+suggesting we change to Git.  I get these emails every week.  Really,
+I understand the arguments, but am content with SVN for now.
+
+Quickstart
+----------
+
+Refer to INSTALL for more general building and installing instructions.
+
+NOTE: You may not have the necessary speex libraries installed. Some
+      distributions may have packages available 
+      i.e. sudo apt-get install speex-*
+      alternatively, visit http://www.speex.org and follow the instructions
+
+1/ Listen to Codec 2:
+
+   $ cd codec2-dev
+   $ mkdir build_linux
+   $ cd build_linux
+   $ cmake ..
+   $ make
+   $ ./src/c2demo ../raw/hts1a.raw hts1a_c2.raw
+   $ play -t raw -r 8000 -e signed-integer -b 16 ../raw/hts1a.raw
+   $ play -t raw -r 8000 -e signed-integer -b 16 ./hts1a_c2.raw
+
+2/ Compress, Decompress and then play a file:
+
+   using 2400 bps bit rate encoding
+
+   $ ./src/c2enc 2400 ../raw/hts1a.raw hts1a_c2.bit
+   $ ./src/c2dec 2400 hts1a_c2.bit hts1a_c2_2400.raw 
+
+   which can be played with
+
+   $ play -t raw -r 8000 -e signed-integer -b 16 ./hts1a_c2_2400.raw
+
+   using 700 bps bit rate encoding
+
+   $ ./src/c2enc 700 ../raw/hts1a.raw hts1a_c2.bit
+   $ ./src/c2dec 700 hts1a_c2.bit hts1a_c2_700.raw
+
+   which can be played with
+
+   $ play -t raw -r 8000 -e signed-integer -b 16 ./hts1a_c2_700.raw
+
+3/ Same thing with pipes:
+
+   $ ./src/c2enc 1300 ../raw/hts1a.raw - | ./src/c2dec 1300 - - | play -t raw -r 8000 -s -2 -
+
+Embedded FreeDV API
+-------------------
+
+See freedv_api.h and freedv_api.c, and the demo programs freedv_tx &
+freedv_rx.  Quickstart:
+
+  $ ./freedv_tx 1600 ../../raw/hts1.raw - | ./freedv_rx 1600 - - | play -t raw -r 8000 -s -2 -q -
+  $ cat freedv_rx_log.txt
+
+Programs
+--------
+1/ c2demo encodes a file of speech samples, then decodes them and
+saves the result.
+
+2/ c2enc encodes a file of speech samples to a compressed file of
+encoded bits.
+
+3/ c2dec decodes a compressed file of bits to a file of speech
+samples.
+
+4/ c2sim is a simulation/development version of Codec 2.  It allows
+selective use of the various Codec 2 algorithms.  For example
+switching phase modelling or LSP quantisation on and off.
+
+Debugging
+---------
+
+1/ To compile with debug symbols for using gdb:
+
+  $ cd ~/codec2
+  $ rm -Rf build_linux && mkdir build_linux
+  $ cd build_linux
+  $ CFLAGS=-g cmake ..
+  $ make
+
+2/ For dump file support:
+
+  $ cd ~/codec2
+  $ rm -Rf build_linux && mkdir build_linux
+  $ cd build_linux
+  $ CFLAGS=-DDUMP cmake ..
+  $ make
+
+Directories
+-----------
+
+  asterisk &  - unmaintained Asterisk support
+  asterisk-11 
+  cmake       - cmake support files
+  octave      - Octave scripts used to support development
+  script      - shell scripts for playing and converting raw files
+  src         - C source code for Codec 2, FDMDV modem, COHPSK modem, FreeDV API
+  raw         - speech files in raw format (16 bits signed linear 8 kHz)
+  stm32       - Support for the STM32F4 microcontroller and SM1000 FreeDV Adaptor
+  unittest    - unit test source code
+  wav         - speech files in wave file format
+
diff --git a/codec2/tags/0.4/README_fdmdv.txt b/codec2/tags/0.4/README_fdmdv.txt
new file mode 100644 (file)
index 0000000..0aec27f
--- /dev/null
@@ -0,0 +1,201 @@
+
+README_fdmdv.txt
+David Rowe
+Created March 2012
+
+Introduction
+------------
+
+A 1400 bit/s (nominal) Frequency Division Multiplexed Digital Voice
+(FDMDV) modem based on [1].  Used for digital audio over HF SSB.
+                     
+The FDMDV modem was first implemented in GNU Octave, then ported to C.
+Algorithm development is generally easier in Octave, but for real time
+work we need the C version.  Automated units tests ensure the
+operation of the Octave and C versions are identical.
+
+Quickstart
+----------
+
+Built as part of codec2-dev, see README for build instructions.
+
+1. Generate some test bits and modulate them:
+
+    $ ./fdmdv_get_test_bits test.c2 1400
+    $ ./fdmdv_mod test.c2 test.raw
+    $ play -r 8000 -s -2 test.raw
+    
+2. Two seconds of test frame data modulated and sent out of sound device: 
+    
+    $ ./fdmdv_get_test_bits - 2800 | ./fdmdv_mod - - | play -t raw -r 8000 -s -2 -
+3. Send 14000 modulated bits (10 seconds) to the demod and count errors:
+
+    $  ./fdmdv_get_test_bits - 14000 | ./fdmdv_mod - - | ./fdmdv_demod - - 14 demod_dump.txt | ./fdmdv_put_test_bits -
+
+    Use Octave to look at plots of 1 second (1400 bits) of modem operation:
+
+    $ cd ../octave
+    $ octave
+    octave:1> fdmdv_demod_c("../src/demod_dump.txt",1400)
+
+4. Run Octave simulation of entire modem and AWGN channel:
+
+    $ cd ../octave
+    $ octave
+    octave:1> fdmdv_ut
+
+5. NOTE: If you would like to play modem samples over the air please
+   convert the 8 kHz samples to 48 kHz.  Many PC sound cards have
+   wildly inaccurate sample clock rates when set to 8 kHz, but seem to
+   perform OK when set for 48 kHz.  If playing and recording files you
+   can use the sox utility:
+
+   $ sox -r 8000 -s -2 modem_sample_8kHz.raw -r 48000 modem_sample_48kHz.wav
+
+   For real time applications, the fdmdv.[ch] library includes functions to
+   convert between 48 and 8 kHz sample rates.
+
+6. Send 20 seconds at 2000 bit/s (20 carriers) to demod and count errors:
+
+   $ ./fdmdv_get_test_bits - 20000 20 | ./fdmdv_mod - - 20 | ./fdmdv_demod - - 20 | ./fdmdv_put_test_bits - 20
+
+References
+----------
+
+[1] http://n1su.com/fdmdv/FDMDV_Docs_Rel_1_4b.pdf
+[2] http://n1su.com/fdmdv/
+[3] http://www.rowetel.com/blog/?p=2433 "Testing a FDMDV Modem"
+[4] http://www.rowetel.com/blog/?p=2458 "FDMDV Modem Page" on David's web site
+
+C Code
+------
+
+src/fdmdv_mod.c - C version of modulator that takes a file of bits and
+                  converts it to a raw file of modulated samples.
+
+src/fdmdv_demod.c - C version of demodulator that takes a raw file of
+                    modulated samples and outputs a file of bits.
+                    Optionally dumps demod states to a text file which
+                    can be plotted using the Octave script
+                    fdmdv_demod_c.m
+
+src/fdmdv.h - Header file that exposes FDMDV C API functions.  Include
+              this file in your application program.
+
+src/fdmdv.c - C functions that implement the FDMDV modem.
+
+src/fdmdv-internal.h - internal states and constants for FDMDV modem,
+                       shouldn't be exposed to application program.
+
+
+unittest/tfdmdv.c - Used to conjunction with unittest/tfdmdv.m to
+                    automatically test C FDMDV functions against
+                    Octave versions.
+
+Octave Scripts
+--------------
+
+(Note these require some Octave packages to be installed, see
+octave/README.txt).
+
+fdmdv.m - Functions and variables that implement the Octave version of
+          the FDMDV modem.
+
+fdmdv_ut.m - Unit test for fdmdv Octave code, useful while
+             developing algorithm.  Includes tx/rx plus basic channel
+             simulation.
+
+             Typical run:
+
+               octave:6> fdmdv_ut
+               Eb/No (meas): 7.30 (8.29) dB
+               bits........: 2464
+               errors......: 20
+               BER.........: 0.0081
+               PAPR........: 13.54 dB
+               SNR.........: 4.0 dB
+
+               It also outputs lots of nice plots that show the
+              operation of the modem.
+
+               For a 1400 bit/s DQPSK modem we expect about 1% BER for
+               Eb/No = 7.3dB, which corresponds to SNR = 4dB (3kHz
+               noise BW). The extra dB of measured power is due to the
+               DBPSK pilot. Currently the noise generation code
+               doesn't take the pilot power into account, so in this
+               example the real SNR is actually 5dB.
+             
+fdmdv_mod.m - Octave version of modulator that outputs a raw file.
+              The modulator is driven by a test frame of bits.  This
+              can then be played over a real channel or through a
+              channel simulator like PathSim.  The sample rate can be
+              changed using "sox" to simulate differences in tx/rx
+              sample clocks.
+
+             To generate 10 seconds of modulated signal:
+                
+                octave:8> fdmdv_mod("test.raw",1400*10);
+
+fdmdv_demod.m - Demodulator program that takes a raw file as input,
+                and works out the bit error rate using the known test
+                frame.  Can be used to test the demod performs with
+                off-air signals, or signals that have been passed
+                through a channel simulator.
+
+               To demodulate 2 seconds of the test.raw file generated
+               above:
+
+                octave:9> fdmdv_demod("test.raw",1400*2);
+                2464 bits  0 errors  BER: 0.0000
+
+                It also produces several plots showing the internal
+               states of the demod.  Useful for debugging and
+               observing what happens with various channels.
+
+fdmdv_demod_c.m - Takes an output text file from the C demod
+                  fdmdv_demod.c and produces plots and measures BER.
+                  Useful for evaluating fdmdv_demod.c performance.
+                  The plots produced are identical to the Octave
+                  version fdmdv_demod.m, allowing direct comparison of
+                  the C and Octave versions.
+
+tfdmdv.m - Automatic tests that compare the Octave and C versions of
+           the FDMDV modem functions.  First run unittest/tfdmdv, this
+           will generate a text file with test vectors from the C
+           version.  Then run the Octave script tfdmdv and it will
+           generate Octave versions of the test vectors and compare
+           each vector with the C equivalent.  Its plots the vectors
+           and and errors (green).  Its also produces an automatic
+           check list based on test results.  If the Octave or C modem
+           code is changed, this script should be used to ensure the
+           C and Octave versions remain identical.
+
+Modelling sample clock errors using sox
+---------------------------------------
+
+This introduces a simulated 1000ppm error:
+
+  sox -r 8000 -s -2 mod_dqpsk.raw -s -2 mod_dqpsk_8008hz.raw rate -h 8008
+
+TODO
+----
+
+[ ] implement ppm measurements in fdmdv_get_demod_stats()
+[ ] try interfering sine wave
+    + maybe swept
+    + does modem fall over?
+[ ] try non-flat channel, e.g. 3dB difference between hi and low tones
+    + make sure all estimators keep working
+[ ] test rx level sensitivity, i.e. 0 to 20dB attenuation
+[ ] make fine freq indep of amplitude
+    + use angle rather than imag coord
+[ ] document use of fdmdv_ut and fdmdv_demod + PathSim
+[ ] more positive form of sync reqd for DV frames?
+    + like using coarse_fine==1 to decode valid DV frame bit?
+    + when should we start decoding?
+[ ] more robust track/acquite state machine?
+    + e.g. hang on thru the fades?
+[ ] PAPR idea
+    + automatically tweak phases to reduce PAPR, e.g. slow variations in freq...
+[ ] why is pilot noise_est twice as big as other carriers
diff --git a/codec2/tags/0.4/cmake/GetDependencies.cmake.in b/codec2/tags/0.4/cmake/GetDependencies.cmake.in
new file mode 100644 (file)
index 0000000..067ad5e
--- /dev/null
@@ -0,0 +1,24 @@
+# As this script is run in a new cmake instance, it does not have access to
+# the existing cache variables. Pass them in via the configure_file command.
+set(CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@)
+set(CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@)
+set(UNIX @UNIX@)
+set(WIN32 @WIN32@)
+set(CMAKE_CROSSCOMPILING @CMAKE_CROSSCOMPILING@)
+set(CMAKE_FIND_LIBRARY_SUFFIXES @CMAKE_FIND_LIBRARY_SUFFIXES@)
+set(CMAKE_FIND_LIBRARY_PREFIXES @CMAKE_FIND_LIBRARY_PREFIXES@)
+set(CMAKE_SYSTEM_LIBRARY_PATH @CMAKE_SYSTEM_LIBRARY_PATH@)
+set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@)
+set(CODEC2_DLL ${CMAKE_BINARY_DIR}/src/libcodec2.dll)
+
+include(GetPrerequisites)
+get_prerequisites(${CODEC2_DLL} _deps 1 1 "" "")
+foreach(_runtime ${_deps})
+    message("Looking for ${_runtime}")
+    find_library(RUNTIME_${_runtime} ${_runtime})
+    message("${RUNTIME_${_runtime}}")
+    if(RUNTIME_${_runtime})
+        file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
+        TYPE EXECUTABLE FILES "${RUNTIME_${_runtime}}")
+    endif()
+endforeach()
diff --git a/codec2/tags/0.4/cmake/config.h.in b/codec2/tags/0.4/cmake/config.h.in
new file mode 100644 (file)
index 0000000..60ee7d6
--- /dev/null
@@ -0,0 +1,23 @@
+/*--------------------------------------------------------------------------
+ ** This file is autogenerated from config.h.in 
+ ** during the cmake configuration of your project. If you need to make changes
+ ** edit the original file NOT THIS FILE.
+ ** --------------------------------------------------------------------------*/
+#ifndef _CONFIGURATION_HEADER_GUARD_H_
+#define _CONFIGURATION_HEADER_GUARD_H_
+
+#define SIZEOF_INT @SIZEOF_INT@
+#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@
+#cmakedefine HAVE_STRING_H @HAVE_STRING_H@
+#cmakedefine HAVE_FLOOR    @HAVE_FLOOR@
+#cmakedefine HAVE_CEIL     @HAVE_CEIL@
+#cmakedefine HAVE_MEMSET   @HAVE_MEMSET@
+#cmakedefine HAVE_POW      @HAVE_POW@
+#cmakedefine HAVE_SQRT     @HAVE_SQRT@
+#cmakedefine HAVE_SIN      @HAVE_SIN@
+#cmakedefine HAVE_COS      @HAVE_COS@
+#cmakedefine HAVE_ATAN2    @HAVE_ATAN2@
+#cmakedefine HAVE_LOG10    @HAVE_LOG10@
+#cmakedefine HAVE_ROUND    @HAVE_ROUND@
+#cmakedefine HAVE_GETOPT   @HAVE_GETOPT@
+#endif
diff --git a/codec2/tags/0.4/raw/b0067.raw b/codec2/tags/0.4/raw/b0067.raw
new file mode 100644 (file)
index 0000000..3aea9cd
Binary files /dev/null and b/codec2/tags/0.4/raw/b0067.raw differ
diff --git a/codec2/tags/0.4/raw/cq_ref.raw b/codec2/tags/0.4/raw/cq_ref.raw
new file mode 100644 (file)
index 0000000..485703d
Binary files /dev/null and b/codec2/tags/0.4/raw/cq_ref.raw differ
diff --git a/codec2/tags/0.4/raw/cross.raw b/codec2/tags/0.4/raw/cross.raw
new file mode 100644 (file)
index 0000000..1b2af6a
Binary files /dev/null and b/codec2/tags/0.4/raw/cross.raw differ
diff --git a/codec2/tags/0.4/raw/cross_melp2400.raw b/codec2/tags/0.4/raw/cross_melp2400.raw
new file mode 100644 (file)
index 0000000..439012c
Binary files /dev/null and b/codec2/tags/0.4/raw/cross_melp2400.raw differ
diff --git a/codec2/tags/0.4/raw/f2400.raw b/codec2/tags/0.4/raw/f2400.raw
new file mode 100644 (file)
index 0000000..5f4427f
Binary files /dev/null and b/codec2/tags/0.4/raw/f2400.raw differ
diff --git a/codec2/tags/0.4/raw/forig.raw b/codec2/tags/0.4/raw/forig.raw
new file mode 100644 (file)
index 0000000..4ba294d
Binary files /dev/null and b/codec2/tags/0.4/raw/forig.raw differ
diff --git a/codec2/tags/0.4/raw/forig_ambe2000.raw b/codec2/tags/0.4/raw/forig_ambe2000.raw
new file mode 100644 (file)
index 0000000..9114357
Binary files /dev/null and b/codec2/tags/0.4/raw/forig_ambe2000.raw differ
diff --git a/codec2/tags/0.4/raw/forig_g729a.raw b/codec2/tags/0.4/raw/forig_g729a.raw
new file mode 100644 (file)
index 0000000..fbca567
Binary files /dev/null and b/codec2/tags/0.4/raw/forig_g729a.raw differ
diff --git a/codec2/tags/0.4/raw/forig_gsm13k.raw b/codec2/tags/0.4/raw/forig_gsm13k.raw
new file mode 100644 (file)
index 0000000..71cbe6f
Binary files /dev/null and b/codec2/tags/0.4/raw/forig_gsm13k.raw differ
diff --git a/codec2/tags/0.4/raw/forig_speex_8k.raw b/codec2/tags/0.4/raw/forig_speex_8k.raw
new file mode 100644 (file)
index 0000000..e95302e
Binary files /dev/null and b/codec2/tags/0.4/raw/forig_speex_8k.raw differ
diff --git a/codec2/tags/0.4/raw/g3plx.raw b/codec2/tags/0.4/raw/g3plx.raw
new file mode 100644 (file)
index 0000000..9970c3f
Binary files /dev/null and b/codec2/tags/0.4/raw/g3plx.raw differ
diff --git a/codec2/tags/0.4/raw/hts.raw b/codec2/tags/0.4/raw/hts.raw
new file mode 100644 (file)
index 0000000..79f869a
Binary files /dev/null and b/codec2/tags/0.4/raw/hts.raw differ
diff --git a/codec2/tags/0.4/raw/hts1.raw b/codec2/tags/0.4/raw/hts1.raw
new file mode 100644 (file)
index 0000000..3369387
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1.raw differ
diff --git a/codec2/tags/0.4/raw/hts1a.raw b/codec2/tags/0.4/raw/hts1a.raw
new file mode 100644 (file)
index 0000000..7332f93
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1a.raw differ
diff --git a/codec2/tags/0.4/raw/hts1a_ambe2000.raw b/codec2/tags/0.4/raw/hts1a_ambe2000.raw
new file mode 100644 (file)
index 0000000..ab72ba2
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1a_ambe2000.raw differ
diff --git a/codec2/tags/0.4/raw/hts1a_g729a.raw b/codec2/tags/0.4/raw/hts1a_g729a.raw
new file mode 100644 (file)
index 0000000..130f1dd
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1a_g729a.raw differ
diff --git a/codec2/tags/0.4/raw/hts1a_gsm13k.raw b/codec2/tags/0.4/raw/hts1a_gsm13k.raw
new file mode 100644 (file)
index 0000000..dd102f5
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1a_gsm13k.raw differ
diff --git a/codec2/tags/0.4/raw/hts1a_melp.raw b/codec2/tags/0.4/raw/hts1a_melp.raw
new file mode 100644 (file)
index 0000000..a4040d2
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1a_melp.raw differ
diff --git a/codec2/tags/0.4/raw/hts1a_speex_8k.raw b/codec2/tags/0.4/raw/hts1a_speex_8k.raw
new file mode 100644 (file)
index 0000000..9289e1c
Binary files /dev/null and b/codec2/tags/0.4/raw/hts1a_speex_8k.raw differ
diff --git a/codec2/tags/0.4/raw/hts2.raw b/codec2/tags/0.4/raw/hts2.raw
new file mode 100644 (file)
index 0000000..0bb9df1
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2.raw differ
diff --git a/codec2/tags/0.4/raw/hts2a.raw b/codec2/tags/0.4/raw/hts2a.raw
new file mode 100644 (file)
index 0000000..6d9cf17
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2a.raw differ
diff --git a/codec2/tags/0.4/raw/hts2a_ambe2000.raw b/codec2/tags/0.4/raw/hts2a_ambe2000.raw
new file mode 100644 (file)
index 0000000..7225f60
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2a_ambe2000.raw differ
diff --git a/codec2/tags/0.4/raw/hts2a_g729a.raw b/codec2/tags/0.4/raw/hts2a_g729a.raw
new file mode 100644 (file)
index 0000000..9199b0a
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2a_g729a.raw differ
diff --git a/codec2/tags/0.4/raw/hts2a_gsm13k.raw b/codec2/tags/0.4/raw/hts2a_gsm13k.raw
new file mode 100644 (file)
index 0000000..f0a5850
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2a_gsm13k.raw differ
diff --git a/codec2/tags/0.4/raw/hts2a_melp.raw b/codec2/tags/0.4/raw/hts2a_melp.raw
new file mode 100644 (file)
index 0000000..5138e49
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2a_melp.raw differ
diff --git a/codec2/tags/0.4/raw/hts2a_speex_8k.raw b/codec2/tags/0.4/raw/hts2a_speex_8k.raw
new file mode 100644 (file)
index 0000000..c421bb4
Binary files /dev/null and b/codec2/tags/0.4/raw/hts2a_speex_8k.raw differ
diff --git a/codec2/tags/0.4/raw/k6hx.raw b/codec2/tags/0.4/raw/k6hx.raw
new file mode 100644 (file)
index 0000000..35e6df7
Binary files /dev/null and b/codec2/tags/0.4/raw/k6hx.raw differ
diff --git a/codec2/tags/0.4/raw/kristoff.raw b/codec2/tags/0.4/raw/kristoff.raw
new file mode 100644 (file)
index 0000000..9b0b465
Binary files /dev/null and b/codec2/tags/0.4/raw/kristoff.raw differ
diff --git a/codec2/tags/0.4/raw/m2400.raw b/codec2/tags/0.4/raw/m2400.raw
new file mode 100644 (file)
index 0000000..1c0956d
Binary files /dev/null and b/codec2/tags/0.4/raw/m2400.raw differ
diff --git a/codec2/tags/0.4/raw/mmt1.raw b/codec2/tags/0.4/raw/mmt1.raw
new file mode 100644 (file)
index 0000000..40638a5
Binary files /dev/null and b/codec2/tags/0.4/raw/mmt1.raw differ
diff --git a/codec2/tags/0.4/raw/mmt1_ambe2000.raw b/codec2/tags/0.4/raw/mmt1_ambe2000.raw
new file mode 100644 (file)
index 0000000..e38955c
Binary files /dev/null and b/codec2/tags/0.4/raw/mmt1_ambe2000.raw differ
diff --git a/codec2/tags/0.4/raw/mmt1_g729a.raw b/codec2/tags/0.4/raw/mmt1_g729a.raw
new file mode 100644 (file)
index 0000000..196716e
Binary files /dev/null and b/codec2/tags/0.4/raw/mmt1_g729a.raw differ
diff --git a/codec2/tags/0.4/raw/mmt1_gsm13k.raw b/codec2/tags/0.4/raw/mmt1_gsm13k.raw
new file mode 100644 (file)
index 0000000..a9965af
Binary files /dev/null and b/codec2/tags/0.4/raw/mmt1_gsm13k.raw differ
diff --git a/codec2/tags/0.4/raw/mmt1_speex_8k.raw b/codec2/tags/0.4/raw/mmt1_speex_8k.raw
new file mode 100644 (file)
index 0000000..769a49c
Binary files /dev/null and b/codec2/tags/0.4/raw/mmt1_speex_8k.raw differ
diff --git a/codec2/tags/0.4/raw/morig.raw b/codec2/tags/0.4/raw/morig.raw
new file mode 100644 (file)
index 0000000..4af0e8f
Binary files /dev/null and b/codec2/tags/0.4/raw/morig.raw differ
diff --git a/codec2/tags/0.4/raw/morig_ambe2000.raw b/codec2/tags/0.4/raw/morig_ambe2000.raw
new file mode 100644 (file)
index 0000000..9964275
Binary files /dev/null and b/codec2/tags/0.4/raw/morig_ambe2000.raw differ
diff --git a/codec2/tags/0.4/raw/morig_g729a.raw b/codec2/tags/0.4/raw/morig_g729a.raw
new file mode 100644 (file)
index 0000000..636ecfd
Binary files /dev/null and b/codec2/tags/0.4/raw/morig_g729a.raw differ
diff --git a/codec2/tags/0.4/raw/morig_gsm13k.raw b/codec2/tags/0.4/raw/morig_gsm13k.raw
new file mode 100644 (file)
index 0000000..660368f
Binary files /dev/null and b/codec2/tags/0.4/raw/morig_gsm13k.raw differ
diff --git a/codec2/tags/0.4/raw/morig_speex_8k.raw b/codec2/tags/0.4/raw/morig_speex_8k.raw
new file mode 100644 (file)
index 0000000..ab667a1
Binary files /dev/null and b/codec2/tags/0.4/raw/morig_speex_8k.raw differ
diff --git a/codec2/tags/0.4/raw/sine1k_2Hz_spread.raw b/codec2/tags/0.4/raw/sine1k_2Hz_spread.raw
new file mode 100644 (file)
index 0000000..1b8ad9c
Binary files /dev/null and b/codec2/tags/0.4/raw/sine1k_2Hz_spread.raw differ
diff --git a/codec2/tags/0.4/raw/sine1k_2ms_delay_2Hz_spread.raw b/codec2/tags/0.4/raw/sine1k_2ms_delay_2Hz_spread.raw
new file mode 100644 (file)
index 0000000..4d3e09e
Binary files /dev/null and b/codec2/tags/0.4/raw/sine1k_2ms_delay_2Hz_spread.raw differ
diff --git a/codec2/tags/0.4/raw/ve9qrp.raw b/codec2/tags/0.4/raw/ve9qrp.raw
new file mode 100644 (file)
index 0000000..489e942
Binary files /dev/null and b/codec2/tags/0.4/raw/ve9qrp.raw differ
diff --git a/codec2/tags/0.4/raw/ve9qrp_10s.raw b/codec2/tags/0.4/raw/ve9qrp_10s.raw
new file mode 100644 (file)
index 0000000..0d3bd3b
Binary files /dev/null and b/codec2/tags/0.4/raw/ve9qrp_10s.raw differ
diff --git a/codec2/tags/0.4/src/CMakeLists.txt b/codec2/tags/0.4/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..89e228f
--- /dev/null
@@ -0,0 +1,333 @@
+#
+# Generated sources
+#
+
+set(D ${CMAKE_CURRENT_SOURCE_DIR}/codebook)
+
+# lsp quantisers
+
+set(CODEBOOKS
+    ${D}/lsp1.txt
+    ${D}/lsp2.txt
+    ${D}/lsp3.txt
+    ${D}/lsp4.txt
+    ${D}/lsp5.txt
+    ${D}/lsp6.txt
+    ${D}/lsp7.txt
+    ${D}/lsp8.txt
+    ${D}/lsp9.txt
+    ${D}/lsp10.txt
+)
+
+# lspd quantisers
+
+set(CODEBOOKSD
+    ${D}/dlsp1.txt
+    ${D}/dlsp2.txt
+    ${D}/dlsp3.txt
+    ${D}/dlsp4.txt
+    ${D}/dlsp5.txt
+    ${D}/dlsp6.txt
+    ${D}/dlsp7.txt
+    ${D}/dlsp8.txt
+    ${D}/dlsp9.txt
+    ${D}/dlsp10.txt
+)
+
+# lspd VQ quantisers
+
+set(CODEBOOKSVQ
+    ${D}/lsp1.txt
+    ${D}/lsp2.txt
+    ${D}/lsp3.txt
+    ${D}/lsp4.txt
+    ${CMAKE_SOURCE_DIR}/unittest/lsp45678910.txt
+)
+
+set(CODEBOOKSJND
+    ${D}/lsp1.txt
+    ${D}/lsp2.txt
+    ${D}/lsp3.txt
+    ${D}/lsp4.txt
+    ${CMAKE_SOURCE_DIR}/unittest/lspjnd5-10.txt
+)
+
+set(CODEBOOKSDT
+    ${D}/lspdt1.txt
+    ${D}/lspdt2.txt
+    ${D}/lspdt3.txt
+    ${D}/lspdt4.txt
+    ${D}/lspdt5.txt
+    ${D}/lspdt6.txt
+    ${D}/lspdt7.txt
+    ${D}/lspdt8.txt
+    ${D}/lspdt9.txt
+    ${D}/lspdt10.txt
+)
+
+set(CODEBOOKSJVM
+    ${D}/lspjvm1.txt
+    ${D}/lspjvm2.txt
+    ${D}/lspjvm3.txt
+)
+
+set(CODEBOOKSVQANSSI
+    ${D}/lspvqanssi1.txt
+    ${D}/lspvqanssi2.txt
+    ${D}/lspvqanssi3.txt
+    ${D}/lspvqanssi4.txt
+)
+
+set(CODEBOOKSMEL
+    ${D}/mel1.txt
+    ${D}/mel2.txt
+    ${D}/mel3.txt
+    ${D}/mel4.txt
+    ${D}/mel5.txt
+    ${D}/mel6.txt
+)
+
+set(CODEBOOKSGE ${D}/gecb.txt)
+
+# when crosscompiling we need a native executable
+if(CMAKE_CROSSCOMPILING)
+    include(ExternalProject)
+    ExternalProject_Add(codec2_native
+       SOURCE_DIR ${CMAKE_SOURCE_DIR}
+       BUILD_COMMAND $(MAKE) generate_codebook
+       INSTALL_COMMAND ${CMAKE_COMMAND} -E copy src/generate_codebook ${CMAKE_CURRENT_BINARY_DIR}
+    )
+    add_executable(generate_codebook IMPORTED)
+    set_target_properties(generate_codebook PROPERTIES
+        IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/generate_codebook)
+    add_dependencies(generate_codebook codec2_native)
+else(CMAKE_CROSSCOMPILING)
+# Build code generator binaries. These do not get installed.
+    # generate_codebook
+    add_executable(generate_codebook generate_codebook.c)
+    target_link_libraries(generate_codebook ${CMAKE_REQUIRED_LIBRARIES})
+    # genlspdtcb
+    add_executable(genlspdtcb genlspdtcb.c)
+    target_link_libraries(genlspdtcb ${CMAKE_REQUIRED_LIBRARIES})
+    # Make native builds available for cross-compiling.
+    export(TARGETS generate_codebook genlspdtcb
+        FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake)
+endif(CMAKE_CROSSCOMPILING)
+
+
+# codebook.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebook.c
+    COMMAND generate_codebook lsp_cb ${CODEBOOKS} > ${CMAKE_CURRENT_BINARY_DIR}/codebook.c
+    DEPENDS generate_codebook ${CODEBOOKS}
+)
+
+# codebookd.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c
+    COMMAND generate_codebook lsp_cbd ${CODEBOOKSD} > ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c
+    DEPENDS generate_codebook ${CODEBOOKSD}
+)
+
+# codebookdt.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookdt.c
+    COMMAND generate_codebook lsp_cbdt ${CODEBOOKSDT} > ${CMAKE_CURRENT_BINARY_DIR}/codebookdt.c
+    DEPENDS generate_codebook ${CODEBOOKSDT}
+)
+
+# codebookvq.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookvq.c
+    COMMAND generate_codebook lsp_cbvq ${CODEBOOKSVQ} > ${CMAKE_CURRENT_BINARY_DIR}/codebookvq.c
+    DEPENDS generate_codebook ${CODEBOOKSVQ}
+)
+
+# codebookjnd.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookjnd.c
+    COMMAND generate_codebook lsp_cbjnd ${CODEBOOKSJND} > ${CMAKE_CURRENT_BINARY_DIR}/codebookjnd.c
+    DEPENDS generate_codebook ${CODEBOOKSJND}
+)
+
+# codebookjvm.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookjvm.c
+    COMMAND generate_codebook lsp_cbjvm ${CODEBOOKSJVM} > ${CMAKE_CURRENT_BINARY_DIR}/codebookjvm.c
+    DEPENDS generate_codebook ${CODEBOOKSJVM}
+)
+
+# codebookvqanssi.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookvqanssi.c
+    COMMAND generate_codebook lsp_cbvqanssi ${CODEBOOKSVQANSSI} > ${CMAKE_CURRENT_BINARY_DIR}/codebookvqanssi.c
+    DEPENDS generate_codebook ${CODEBOOKSVQANSSI}
+)
+
+# codebookmel.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookmel.c
+    COMMAND generate_codebook mel_cb ${CODEBOOKSMEL} > ${CMAKE_CURRENT_BINARY_DIR}/codebookmel.c
+    DEPENDS generate_codebook ${CODEBOOKSMEL}
+)
+
+# codebookge.c
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookge.c
+    COMMAND generate_codebook ge_cb ${CODEBOOKSGE} > ${CMAKE_CURRENT_BINARY_DIR}/codebookge.c
+    DEPENDS generate_codebook ${CODEBOOKSGE}
+)
+
+#
+# codec2 library sources
+#
+
+set(CODEC2_SRCS
+    dump.c
+    lpc.c
+    nlp.c
+    postfilter.c
+    sine.c
+    codec2.c
+    cohpsk.c
+    fifo.c
+    fdmdv.c
+    fm.c
+    kiss_fft.c
+    linreg.c
+    interp.c
+    lsp.c
+    phase.c
+    quantise.c
+    pack.c
+    codebook.c
+    codebookd.c
+    codebookvq.c
+    codebookjnd.c
+    codebookjvm.c
+    codebookvqanssi.c
+    codebookdt.c
+    codebookmel.c
+    codebookge.c
+    golay23.c
+    freedv_api.c
+    varicode.c
+    modem_stats.c
+)
+
+set(CODEC2_PUBLIC_HEADERS
+    golay23.h
+    codec2.h
+    codec2_fdmdv.h
+    codec2_cohpsk.h
+    codec2_fm.h
+    codec2_fifo.h
+    comp.h
+    modem_stats.h
+    kiss_fft.h
+    freedv_api.h
+    varicode.h
+
+)
+
+#
+# Setup the codec2 library
+#
+add_library(codec2 ${CODEC2_SRCS})
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+target_link_libraries(codec2 ${CMAKE_REQUIRED_LIBRARIES})
+set_target_properties(codec2 PROPERTIES
+    SOVERSION ${SOVERSION}
+    PUBLIC_HEADER "${CODEC2_PUBLIC_HEADERS}"
+)
+
+add_executable(c2demo c2demo.c)
+target_link_libraries(c2demo ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(c2enc c2enc.c)
+target_link_libraries(c2enc ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(c2dec c2dec.c)
+target_link_libraries(c2dec ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(c2sim c2sim.c ampexp.c phaseexp.c)
+target_link_libraries(c2sim ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(fdmdv_get_test_bits fdmdv_get_test_bits.c fdmdv.c kiss_fft.c)
+target_link_libraries(fdmdv_get_test_bits ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(fdmdv_mod fdmdv_mod.c fdmdv.c kiss_fft.c)
+target_link_libraries(fdmdv_mod ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(fdmdv_demod fdmdv_demod.c fdmdv.c kiss_fft.c octave.c modem_stats.c)
+target_link_libraries(fdmdv_demod ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(fdmdv_put_test_bits fdmdv_put_test_bits.c fdmdv.c kiss_fft.c)
+target_link_libraries(fdmdv_put_test_bits ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(fdmdv_channel fdmdv_channel.c)
+target_link_libraries(fdmdv_channel ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(fdmdv_interleave fdmdv_interleave.c)
+target_link_libraries(fdmdv_interleave ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(insert_errors insert_errors.c)
+target_link_libraries(insert_errors ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(fec_enc fec_enc.c golay23.c)
+target_link_libraries(fec_enc ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(fec_dec fec_dec.c golay23.c)
+target_link_libraries(fec_dec ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(freedv_tx freedv_tx.c)
+target_link_libraries(freedv_tx ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(freedv_rx freedv_rx.c)
+target_link_libraries(freedv_rx ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(fm_demod fm_demod.c fm.c)
+target_link_libraries(fm_demod ${CMAKE_REQUIRED_LIBRARIES})
+
+add_executable(cohpsk_mod cohpsk_mod.c)
+target_link_libraries(cohpsk_mod ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(cohpsk_demod cohpsk_demod.c octave.c)
+target_link_libraries(cohpsk_demod ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(cohpsk_get_test_bits cohpsk_get_test_bits.c)
+target_link_libraries(cohpsk_get_test_bits ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(cohpsk_put_test_bits cohpsk_put_test_bits.c octave.c)
+target_link_libraries(cohpsk_put_test_bits ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+add_executable(cohpsk_ch cohpsk_ch.c)
+target_link_libraries(cohpsk_ch ${CMAKE_REQUIRED_LIBRARIES} codec2)
+
+install(TARGETS codec2 EXPORT codec2-config
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/codec2
+)
+
+#install(EXPORT codec2-config
+#    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/codec2
+#)
+
+install(TARGETS
+    c2demo
+    c2demo
+    c2enc
+    c2dec
+    c2sim
+    fdmdv_get_test_bits
+    fdmdv_mod fdmdv_demod
+    fm_demod
+    fdmdv_put_test_bits
+    fdmdv_interleave
+    insert_errors
+    fec_enc
+    fec_dec
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
diff --git a/codec2/tags/0.4/src/_kiss_fft_guts.h b/codec2/tags/0.4/src/_kiss_fft_guts.h
new file mode 100644 (file)
index 0000000..64bc1d1
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+Copyright (c) 2003-2010, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* kiss_fft.h
+   defines kiss_fft_scalar as either short or a float type
+   and defines
+   typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
+#include "kiss_fft.h"
+#include <limits.h>
+
+#define MAXFACTORS 32
+/* e.g. an fft of length 128 has 4 factors 
+ as far as kissfft is concerned
+ 4*4*4*2
+ */
+
+struct kiss_fft_state{
+    int nfft;
+    int inverse;
+    int factors[2*MAXFACTORS];
+    kiss_fft_cpx twiddles[1];
+};
+
+/*
+  Explanation of macros dealing with complex math:
+
+   C_MUL(m,a,b)         : m = a*b
+   C_FIXDIV( c , div )  : if a fixed point impl., c /= div. noop otherwise
+   C_SUB( res, a,b)     : res = a - b
+   C_SUBFROM( res , a)  : res -= a
+   C_ADDTO( res , a)    : res += a
+ * */
+#ifdef FIXED_POINT
+#if (FIXED_POINT==32)
+# define FRACBITS 31
+# define SAMPPROD int64_t
+#define SAMP_MAX 2147483647
+#else
+# define FRACBITS 15
+# define SAMPPROD int32_t 
+#define SAMP_MAX 32767
+#endif
+
+#define SAMP_MIN -SAMP_MAX
+
+#if defined(CHECK_OVERFLOW)
+#  define CHECK_OVERFLOW_OP(a,op,b)  \
+       if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
+               fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) );  }
+#endif
+
+
+#   define smul(a,b) ( (SAMPPROD)(a)*(b) )
+#   define sround( x )  (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
+
+#   define S_MUL(a,b) sround( smul(a,b) )
+
+#   define C_MUL(m,a,b) \
+      do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
+          (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
+
+#   define DIVSCALAR(x,k) \
+       (x) = sround( smul(  x, SAMP_MAX/k ) )
+
+#   define C_FIXDIV(c,div) \
+       do {    DIVSCALAR( (c).r , div);  \
+               DIVSCALAR( (c).i  , div); }while (0)
+
+#   define C_MULBYSCALAR( c, s ) \
+    do{ (c).r =  sround( smul( (c).r , s ) ) ;\
+        (c).i =  sround( smul( (c).i , s ) ) ; }while(0)
+
+#else  /* not FIXED_POINT*/
+
+#   define S_MUL(a,b) ( (a)*(b) )
+#define C_MUL(m,a,b) \
+    do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
+        (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
+#   define C_FIXDIV(c,div) /* NOOP */
+#   define C_MULBYSCALAR( c, s ) \
+    do{ (c).r *= (s);\
+        (c).i *= (s); }while(0)
+#endif
+
+#ifndef CHECK_OVERFLOW_OP
+#  define CHECK_OVERFLOW_OP(a,op,b) /* noop */
+#endif
+
+#define  C_ADD( res, a,b)\
+    do { \
+           CHECK_OVERFLOW_OP((a).r,+,(b).r)\
+           CHECK_OVERFLOW_OP((a).i,+,(b).i)\
+           (res).r=(a).r+(b).r;  (res).i=(a).i+(b).i; \
+    }while(0)
+#define  C_SUB( res, a,b)\
+    do { \
+           CHECK_OVERFLOW_OP((a).r,-,(b).r)\
+           CHECK_OVERFLOW_OP((a).i,-,(b).i)\
+           (res).r=(a).r-(b).r;  (res).i=(a).i-(b).i; \
+    }while(0)
+#define C_ADDTO( res , a)\
+    do { \
+           CHECK_OVERFLOW_OP((res).r,+,(a).r)\
+           CHECK_OVERFLOW_OP((res).i,+,(a).i)\
+           (res).r += (a).r;  (res).i += (a).i;\
+    }while(0)
+
+#define C_SUBFROM( res , a)\
+    do {\
+           CHECK_OVERFLOW_OP((res).r,-,(a).r)\
+           CHECK_OVERFLOW_OP((res).i,-,(a).i)\
+           (res).r -= (a).r;  (res).i -= (a).i; \
+    }while(0)
+
+
+#ifdef FIXED_POINT
+#  define KISS_FFT_COS(phase)  floorf(.5+SAMP_MAX * cosf (phase))
+#  define KISS_FFT_SIN(phase)  floorf(.5+SAMP_MAX * sinf (phase))
+#  define HALF_OF(x) ((x)>>1)
+#elif defined(USE_SIMD)
+#  define KISS_FFT_COS(phase) _mm_set1_ps( cosf(phase) )
+#  define KISS_FFT_SIN(phase) _mm_set1_ps( sinf(phase) )
+#  define HALF_OF(x) ((x)*_mm_set1_ps(.5))
+#else
+#  define KISS_FFT_COS(phase) (kiss_fft_scalar) cosf(phase)
+#  define KISS_FFT_SIN(phase) (kiss_fft_scalar) sinf(phase)
+#  define HALF_OF(x) ((x)*.5)
+#endif
+
+#define  kf_cexp(x,phase) \
+       do{ \
+               (x)->r = KISS_FFT_COS(phase);\
+               (x)->i = KISS_FFT_SIN(phase);\
+       }while(0)
+
+
+/* a debugging function */
+#define pcpx(c)\
+    fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
+
+
+#ifdef KISS_FFT_USE_ALLOCA
+// define this to allow use of alloca instead of malloc for temporary buffers
+// Temporary buffers are used in two case: 
+// 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5
+// 2. "in-place" FFTs.  Notice the quotes, since kissfft does not really do an in-place transform.
+#include <alloca.h>
+#define  KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes)
+#define  KISS_FFT_TMP_FREE(ptr) 
+#else
+#define  KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes)
+#define  KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr)
+#endif
diff --git a/codec2/tags/0.4/src/ampexp.c b/codec2/tags/0.4/src/ampexp.c
new file mode 100644 (file)
index 0000000..94e2184
--- /dev/null
@@ -0,0 +1,1093 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: ampexp.c                                
+  AUTHOR......: David Rowe                                             
+  DATE CREATED: 7 August 2012
+                                                                             
+  Functions for experimenting with amplitude quantisation.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 <assert.h>
+#include <ctype.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ampexp.h"
+
+
+#define PRED_COEFF 0.9
+
+/* states for amplitude experiments */
+
+struct codebook {
+    unsigned int        k;
+    unsigned int        log2m;
+    unsigned int        m;
+    float               *cb;
+    unsigned int         offset; 
+};
+
+struct AEXP {
+    float            A_prev[MAX_AMP];
+    int              frames;
+    float            snr;
+    int              snr_n;
+    float            var;
+    int              var_n;
+    float            vq_var;
+    int              vq_var_n;
+    struct codebook *vq1,*vq2,*vq3,*vq4,*vq5;
+
+    int              indexes[5][3];
+    MODEL            model[3];
+    float            mag[3];
+    MODEL            model_uq[3];
+};
+
+
+/*---------------------------------------------------------------------------*\
+
+  Bruce Perens' funcs to load codebook files
+
+\*---------------------------------------------------------------------------*/
+
+
+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";
+
+static 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;
+
+    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 = (float *)malloc(size * sizeof(float));
+
+    for ( i = 0; i < size; i++ ) {
+       b->cb[i] = get_float(file, name, &cursor, line, sizeof(line));
+    }
+
+    fclose(file);
+
+    return b;
+}
+
+
+/*---------------------------------------------------------------------------* \
+
+  amp_experiment_create()
+
+  Inits states for amplitude quantisation experiments.
+
+\*---------------------------------------------------------------------------*/
+
+struct AEXP *amp_experiment_create() {
+    struct AEXP *aexp;
+    int i,j,m;
+
+    aexp = (struct AEXP *)malloc(sizeof(struct AEXP));
+    assert (aexp != NULL);
+
+    for(i=0; i<MAX_AMP; i++)
+       aexp->A_prev[i] = 1.0;
+    aexp->frames = 0;
+    aexp->snr = 0.0;
+    aexp->snr_n = 0;
+    aexp->var = 0.0;
+    aexp->var_n = 0;
+    aexp->vq_var = 0.0;
+    aexp->vq_var_n = 0;
+
+    //aexp->vq1 = load("amp_1_80_1024a.txt");
+    //aexp->vq1 = load("../unittest/st1_10_1024.txt");
+    //aexp->vq1 = load("../unittest/amp41_80_1024.txt");
+    //aexp->vq1->offset = 40;
+    aexp->vq1 = load("../unittest/amp1_10_1024.txt");
+    aexp->vq1->offset = 0;
+    aexp->vq2 = load("../unittest/amp11_20_1024.txt");
+    aexp->vq2->offset = 10;
+
+    aexp->vq3 = load("../unittest/amp21_40_1024.txt");
+    aexp->vq3->offset = 20;
+    aexp->vq4 = load("../unittest/amp41_60_1024.txt");
+    aexp->vq4->offset = 40;
+    aexp->vq5 = load("../unittest/amp61_80_256.txt");
+    aexp->vq5->offset = 60;
+
+    #ifdef CAND2_GS
+    //aexp->vq1 = load("../unittest/t1_amp1_20_1024.txt");
+    //aexp->vq1 = load("../unittest/t2_amp1_20_1024.txt");
+    aexp->vq1 = load("../unittest/amp1_20_1024.txt");
+    aexp->vq1->offset = 0;
+    aexp->vq2 = load("../unittest/amp21_40_1024.txt");
+    aexp->vq2->offset = 20;
+    aexp->vq3 = load("../unittest/amp41_60_1024.txt");
+    aexp->vq3->offset = 40;
+    aexp->vq4 = load("../unittest/amp61_80_32.txt");
+    aexp->vq4->offset = 60;
+    #endif
+
+    //#define CAND2_GS
+    #ifdef CAND2_GS
+    aexp->vq1 = load("../unittest/amp1_20_1024.txt");
+    aexp->vq2 = load("../unittest/amp21_40_1024.txt");
+    aexp->vq3 = load("../unittest/amp41_80_1024.txt");
+    aexp->vq4 = load("../unittest/amp61_80_32.txt");
+    aexp->vq1->offset = 0;
+    aexp->vq2->offset = 20;
+    aexp->vq3->offset = 40;
+    aexp->vq4->offset = 60;
+    #endif
+
+    //#define CAND1
+    #ifdef CAND1
+    aexp->vq1 = load("../unittest/amp1_10_128.txt");
+    aexp->vq2 = load("../unittest/amp11_20_512.txt");
+    aexp->vq3 = load("../unittest/amp21_40_1024.txt");
+    aexp->vq4 = load("../unittest/amp41_60_1024.txt");
+    aexp->vq5 = load("../unittest/amp61_80_32.txt");
+    aexp->vq1->offset = 0;
+    aexp->vq2->offset = 10;
+    aexp->vq3->offset = 20;
+    aexp->vq4->offset = 40;
+    aexp->vq5->offset = 60;
+    #endif
+
+    for(i=0; i<3; i++) {
+       for(j=0; j<5; j++)
+           aexp->indexes[j][i] = 0;
+       aexp->mag[i] = 1.0;
+       aexp->model[i].Wo = TWO_PI*100.0/8000.0;
+       aexp->model[i].L = floor(PI/aexp->model[i].Wo); 
+       for(m=1; m<=MAX_AMP; m++)
+           aexp->model[i].A[m] = 10.0;
+       aexp->model_uq[i] = aexp->model[i];
+    }
+
+    return aexp;
+}
+
+
+/*---------------------------------------------------------------------------* \
+
+  amp_experiment_destroy()
+
+\*---------------------------------------------------------------------------*/
+
+void amp_experiment_destroy(struct AEXP *aexp) {
+    assert(aexp != NULL);
+    if (aexp->snr != 0.0)
+       printf("snr: %4.2f dB\n", aexp->snr/aexp->snr_n);
+    if (aexp->var != 0.0)
+       printf("var...: %4.3f  std dev...: %4.3f (%d amplitude samples)\n", 
+              aexp->var/aexp->var_n, sqrt(aexp->var/aexp->var_n), aexp->var_n);
+    if (aexp->vq_var != 0.0)
+       printf("vq var: %4.3f  std dev...: %4.3f (%d amplitude samples)\n", 
+              aexp->vq_var/aexp->vq_var_n, sqrt(aexp->vq_var/aexp->vq_var_n), aexp->vq_var_n);
+    free(aexp);
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  Various test and experimental functions ................
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Quantisation noise simulation.  Assume noise on amplitudes is a uniform
+  distribution, of +/- x dB.  This means x = sqrt(3)*sigma.
+
+  Note: for uniform distribution var = = sigma * sigma = (b-a)*(b-a)/12. 
+*/
+
+static void add_quant_noise(struct AEXP *aexp, MODEL *model, int start, int end, float sigma_dB)
+{
+    int   m;
+    float x_dB;
+    float noise_sam_dB;
+    float noise_sam_lin;
+
+    x_dB = sqrt(3.0) * sigma_dB;
+
+    for(m=start; m<=end; m++) {
+       noise_sam_dB = x_dB*(1.0 - 2.0*rand()/RAND_MAX);
+       //printf("%f\n", noise_sam_dB);
+       noise_sam_lin = pow(10.0, noise_sam_dB/20.0);
+       model->A[m] *= noise_sam_lin;
+       aexp->var += noise_sam_dB*noise_sam_dB;
+       aexp->var_n++;
+    }
+
+}
+
+/*
+  void print_sparse_pred_error()
+
+  use to check pred error stats (e.g. of first 1kHz) in Octave:
+
+     $ ./c2sim ../raw/hts1a.raw --ampexp > amppe.txt
+
+     octave> load ../src/amppe.txt
+     octave> std(nonzeros(amppe(:,1:20)))
+     octave> hist(nonzeros(amppe(:,1:20)),20);
+
+ */
+
+
+static void print_sparse_pred_error(struct AEXP *aexp, MODEL *model, float mag_thresh)
+{
+    int    m, index;
+    float  mag, error;
+    float  sparse_pe[MAX_AMP];
+
+    mag = 0.0;
+    for(m=1; m<=model->L; m++)
+       mag += model->A[m]*model->A[m];
+    mag = 10*log10(mag/model->L);
+
+    if (mag > mag_thresh) {
+       for(m=0; m<MAX_AMP; m++) {
+           sparse_pe[m] = 0.0;
+       }
+
+       for(m=1; m<=model->L; m++) {
+           assert(model->A[m] > 0.0);
+           error = PRED_COEFF*20.0*log10(aexp->A_prev[m]) - 20.0*log10(model->A[m]);
+           //error = 20.0*log10(model->A[m]) - mag;
+
+           index = MAX_AMP*m*model->Wo/PI;
+           assert(index < MAX_AMP);
+           sparse_pe[index] = error;
+       }
+
+       /* dump sparse amp vector */
+
+       for(m=0; m<MAX_AMP; m++)
+           printf("%f ", sparse_pe[m]);
+       printf("\n");
+    }
+}
+
+
+static float frame_energy(MODEL *model, float *enormdB) {
+    int   m;
+    float e, edB;
+
+    e = 0.0;
+    for(m=1; m<=model->L; m++)
+       e += model->A[m]*model->A[m];
+    edB = 10*log10(e);
+
+    #define VER_E0
+
+    #ifdef VER_E0
+    *enormdB = 10*log10(e/model->L); /* make high and low pitches have similar amps */
+    #endif
+
+    #ifdef VER_E1
+    e = 0.0;
+    for(m=1; m<=model->L; m++)
+       e += 10*log10(model->A[m]*model->A[m]);
+    *enormdB = e;
+    #endif
+
+    #ifdef VER_E2
+    e = 0.0;
+    for(m=1; m<=model->L; m++)
+       e += 10*log10(model->A[m]*model->A[m]);
+    *enormdB = e/model->L;
+    #endif
+    //printf("%f\n", enormdB);
+
+    return edB;
+}
+
+static void print_sparse_amp_error(struct AEXP *aexp, MODEL *model, float edB_thresh)
+{
+    int    m, index;
+    float  edB, enormdB, error, dWo;
+    float  sparse_pe[MAX_AMP];
+
+    edB = frame_energy(model, &enormdB);
+    //printf("%f\n", enormdB);
+    dWo = fabs((aexp->model_uq[2].Wo - aexp->model_uq[1].Wo)/aexp->model_uq[2].Wo);
+    
+    if ((edB > edB_thresh) && (dWo < 0.1)) {
+       for(m=0; m<MAX_AMP; m++) {
+           sparse_pe[m] = 0.0;
+       }
+
+       for(m=1; m<=model->L; m++) {
+           assert(model->A[m] > 0.0);
+           error = 20.0*log10(model->A[m]) - enormdB;
+
+           index = MAX_AMP*m*model->Wo/PI;
+           assert(index < MAX_AMP);
+           sparse_pe[index] = error;
+       }
+
+       /* dump sparse amp vector */
+       
+       for(m=0; m<MAX_AMP; m++)
+           printf("%f ", sparse_pe[m]);
+       printf("\n");
+    }
+}
+
+
+int vq_amp(float cb[], float 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;
+   float   diff, metric, best_metric;
+
+   besti = 0;
+   best_metric = best_error = 1E32;
+   for(j=0; j<e; j++) {
+       metric = error = 0.0;
+       for(i=0; i<d; i++) {
+          if (vec[i] != 0.0) {
+              diff = (cb[j*d+i] - vec[i]);
+              error += diff*diff;
+              metric += weights[i]*diff*diff;
+          }
+       }
+       if (metric < best_metric) {
+          best_error = error;
+          best_metric = metric;
+          besti = j;
+       }
+   }
+
+   *se += best_error;
+
+   return(besti);
+}
+
+
+static int split_vq(float sparse_pe_out[], struct AEXP *aexp, struct codebook *vq, float weights[], float sparse_pe_in[])
+{
+    int i, j, non_zero, vq_ind;
+    float se;
+
+    vq_ind = vq_amp(vq->cb, &sparse_pe_in[vq->offset], &weights[vq->offset], vq->k, vq->m, &se);
+    printf("\n offset %d k %d m %d vq_ind %d j: ", vq->offset, vq->k, vq->m, vq_ind);
+    
+    non_zero = 0;
+    for(i=0, j=vq->offset; i<vq->k; i++,j++) {
+       if (sparse_pe_in[j] != 0.0) {
+           printf("%d ", j);
+           sparse_pe_in[j]  -= vq->cb[vq->k * vq_ind + i];
+           sparse_pe_out[j] += vq->cb[vq->k * vq_ind + i];
+           non_zero++;
+       }
+    }
+    aexp->vq_var_n += non_zero;
+    return vq_ind;
+}
+
+
+static void sparse_vq_pred_error(struct AEXP *aexp, 
+                                MODEL       *model 
+)
+{
+    int    m, index;
+    float  error, amp_dB, edB, enormdB;
+    float  sparse_pe_in[MAX_AMP];
+    float  sparse_pe_out[MAX_AMP];
+    float  weights[MAX_AMP];
+
+    edB = frame_energy(model, &enormdB);
+
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_in[m] = 0.0;
+       sparse_pe_out[m] = 0.0;
+    }
+
+    for(m=1; m<=model->L; m++) {
+       assert(model->A[m] > 0.0);
+       error = PRED_COEFF*20.0*log10(aexp->A_prev[m]) - 20.0*log10(model->A[m]);
+
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       sparse_pe_in[index] = error;
+       weights[index] = model->A[m];
+    }
+
+    /* vector quantise */
+        
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_out[m] = sparse_pe_in[m];
+    }
+
+    //#define SIM_VQ
+    #ifndef SIM_VQ
+    split_vq(sparse_pe_out, aexp, aexp->vq1, weights, sparse_pe_in);
+    #else
+    for(m=aexp->vq->offset; m<aexp->vq->offset+aexp->vq->k; m++) {
+       if (sparse_pe_in[m] != 0.0) {
+           float error = 8*(1.0 - 2.0*rand()/RAND_MAX);
+           aexp->vq_var += error*error;
+           aexp->vq_var_n++;
+           sparse_pe_out[m] = sparse_pe_in[m] + error;
+       }
+    }
+    #endif
+
+    if (edB > -100.0)
+       for(m=0; m<MAX_AMP; m++) {
+           if (sparse_pe_in[m] != 0.0)
+               aexp->vq_var += pow(sparse_pe_out[m] - sparse_pe_in[m], 2.0);
+       }
+    
+    /* transform quantised amps back */
+
+    for(m=1; m<=model->L; m++) {
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       amp_dB = PRED_COEFF*20.0*log10(aexp->A_prev[m]) - sparse_pe_out[index];
+       //printf("in: %f  out: %f\n", sparse_pe_in[index], sparse_pe_out[index]);
+       //printf("amp_dB: %f A[m] (dB) %f\n", amp_dB, 20.0*log10(model->A[m]));
+       model->A[m] = pow(10.0, amp_dB/20.0);
+    }
+    //exit(0);
+}
+
+
+static void split_error(struct AEXP *aexp, struct codebook *vq, float sparse_pe_in[], int ind)
+{
+    int i, j;
+
+    for(i=0, j=vq->offset; i<vq->k; i++,j++) {
+       if (sparse_pe_in[j] != 0.0) {
+           sparse_pe_in[j] -= vq->cb[vq->k * ind + i];
+       }
+    }
+}
+
+
+static void sparse_vq_amp(struct AEXP *aexp, MODEL *model)
+{
+    int    m, index;
+    float  error, amp_dB, enormdB;
+    float  sparse_pe_in[MAX_AMP];
+    float  sparse_pe_out[MAX_AMP];
+    float  weights[MAX_AMP];
+
+    frame_energy(model, &enormdB);
+
+    aexp->mag[2] = enormdB;
+   
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_in[m] = 0.0;
+       sparse_pe_out[m] = 0.0;
+    }
+
+    for(m=1; m<=model->L; m++) {
+       assert(model->A[m] > 0.0);
+       error = 20.0*log10(model->A[m]) - enormdB;
+
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       sparse_pe_in[index] = error;
+       weights[index] = pow(model->A[m],0.8);
+    }
+
+    /* vector quantise */
+        
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_out[m] = sparse_pe_in[m];
+    }
+    
+    for(m=0; m<80; m++)
+       sparse_pe_out[m] = 0;
+    
+    #define SPLIT
+    #ifdef SPLIT
+    aexp->indexes[0][2] = split_vq(sparse_pe_out, aexp, aexp->vq1, weights, sparse_pe_in);
+    
+    aexp->indexes[1][2] = split_vq(sparse_pe_out, aexp, aexp->vq2, weights, sparse_pe_in);
+    aexp->indexes[2][2] = split_vq(sparse_pe_out, aexp, aexp->vq3, weights, sparse_pe_in);
+    aexp->indexes[3][2] = split_vq(sparse_pe_out, aexp, aexp->vq4, weights, sparse_pe_in);
+    aexp->indexes[4][2] = split_vq(sparse_pe_out, aexp, aexp->vq5, weights, sparse_pe_in);
+    #endif
+    //#define MULTISTAGE
+    #ifdef MULTISTAGE
+    aexp->indexes[0][2] = split_vq(sparse_pe_out, aexp, aexp->vq1, weights, sparse_pe_in);
+    aexp->indexes[1][2] = split_vq(sparse_pe_out, aexp, aexp->vq2, weights, sparse_pe_in);
+    aexp->indexes[2][2] = split_vq(sparse_pe_out, aexp, aexp->vq3, weights, sparse_pe_in);
+    //aexp->indexes[3][2] = split_vq(sparse_pe_out, aexp, aexp->vq4, weights, sparse_pe_in);
+    #endif
+
+    for(m=0; m<MAX_AMP; m++) {
+       if (sparse_pe_in[m] != 0.0)
+           aexp->vq_var += pow(sparse_pe_out[m] - sparse_pe_in[m], 2.0);
+    }
+    
+    /* transform quantised amps back */
+
+    for(m=1; m<=model->L; m++) {
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       amp_dB = sparse_pe_out[index] + enormdB;
+       model->A[m] = pow(10.0, amp_dB/20.0);
+    }
+    //exit(0);
+}
+
+
+static void update_snr_calc(struct AEXP *aexp, MODEL *m1, MODEL *m2)
+{
+    int m;
+    float signal, noise, signal_dB;
+
+    assert(m1->L == m2->L);
+
+    signal = 0.0; noise = 1E-32;
+    for(m=1; m<=m1->L; m++) {      
+       signal += m1->A[m]*m1->A[m];
+       noise  += pow(m1->A[m] - m2->A[m], 2.0);
+       //printf("%f %f\n", before[m], model->phi[m]);
+    }
+    signal_dB = 10*log10(signal);
+    if (signal_dB > -100.0) {
+       aexp->snr += 10.0*log10(signal/noise);
+       aexp->snr_n++;
+    }
+}
+
+
+/* gain/shape vq search.  Returns index of best gain.  Gain is additive (as we use log quantisers) */
+
+int gain_shape_vq_amp(float cb[], float vec[], float weights[], 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 += weights[i]*diff*diff;
+          }
+       }
+       if (metric < best_metric) {
+          best_error = error;
+          best_metric = metric;
+          *best_gain = gain;
+          besti = j;
+       }
+   }
+
+   *se += best_error;
+
+   return(besti);
+}
+
+
+static void gain_shape_split_vq(float sparse_pe_out[], struct AEXP *aexp, struct codebook *vq, float weights[], float sparse_pe_in[], float *best_gain)
+{
+    int i, j, non_zero, vq_ind;
+    float se;
+
+    vq_ind = gain_shape_vq_amp(vq->cb, &sparse_pe_in[vq->offset], &weights[vq->offset], vq->k, vq->m, &se, best_gain);
+    //printf("\n offset %d k %d m %d vq_ind %d gain: %4.2f j: ", vq->offset, vq->k, vq->m, vq_ind, *best_gain);
+  
+    non_zero = 0;
+    for(i=0, j=vq->offset; i<vq->k; i++,j++) {
+       if (sparse_pe_in[j] != 0.0) {
+           //printf("%d ", j);
+           sparse_pe_out[j] = vq->cb[vq->k * vq_ind + i] + *best_gain;
+           non_zero++;
+       }
+    }
+    aexp->vq_var_n += non_zero;
+}
+
+
+static void gain_shape_sparse_vq_amp(struct AEXP *aexp, MODEL *model)
+{
+    int    m, index;
+    float  amp_dB, best_gain;
+    float  sparse_pe_in[MAX_AMP];
+    float  sparse_pe_out[MAX_AMP];
+    float  weights[MAX_AMP];
+
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_in[m] = 0.0;
+       sparse_pe_out[m] = 0.0;
+    }
+
+    for(m=1; m<=model->L; m++) {
+       assert(model->A[m] > 0.0);
+
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       sparse_pe_in[index] = 20.0*log10(model->A[m]);
+       weights[index] = model->A[m];
+    }
+
+    /* vector quantise */
+        
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_out[m] = sparse_pe_in[m];
+    }
+
+    gain_shape_split_vq(sparse_pe_out, aexp, aexp->vq1, weights, sparse_pe_in, &best_gain);
+    gain_shape_split_vq(sparse_pe_out, aexp, aexp->vq2, weights, sparse_pe_in, &best_gain);
+    gain_shape_split_vq(sparse_pe_out, aexp, aexp->vq3, weights, sparse_pe_in, &best_gain);
+    gain_shape_split_vq(sparse_pe_out, aexp, aexp->vq4, weights, sparse_pe_in, &best_gain);
+
+    for(m=0; m<MAX_AMP; m++) {
+       if (sparse_pe_in[m] != 0.0)
+           aexp->vq_var += pow(sparse_pe_out[m] - sparse_pe_in[m], 2.0);
+    }
+    
+    /* transform quantised amps back */
+
+    for(m=1; m<=model->L; m++) {
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       amp_dB = sparse_pe_out[index];
+       model->A[m] = pow(10.0, amp_dB/20.0);
+    }
+    //exit(0);
+}
+
+
+static void interp_split_vq(float sparse_pe_out[], struct AEXP *aexp, struct codebook *vq, float sparse_pe_in[], int ind)
+{
+    int   i, j;
+    float amp_dB;
+  
+    for(i=0, j=vq->offset; i<vq->k; i++,j++) {
+       if (sparse_pe_in[j] != 0.0) {
+           amp_dB  = 0.5*(aexp->mag[0] + vq->cb[vq->k * aexp->indexes[ind][0] + i]);
+           amp_dB += 0.5*(aexp->mag[2] + vq->cb[vq->k * aexp->indexes[ind][2] + i]);
+           sparse_pe_out[j] = amp_dB;
+       }
+    }
+}
+
+
+static void vq_interp(struct AEXP *aexp, MODEL *model, int on)
+{
+    int              i, j, m, index;
+    float            amp_dB;
+    //struct codebook *vq = aexp->vq1;
+    float  sparse_pe_in[MAX_AMP];
+    float  sparse_pe_out[MAX_AMP];
+    /* replace odd frames with interp */
+    /* once we get an even input frame we can interpolate and output odd */
+    /* using VQ to interpolate.  This assumes some correlation in
+       adjacent VQ samples */
+
+    memcpy(&aexp->model[2], model, sizeof(MODEL));
+
+    /* once we get an even input frame we have enough information to
+      replace prev odd frame with interpolated version */
+
+    if (on && ((aexp->frames % 2) == 0)) {
+
+       /* copy Wo, L, and phases */
+
+       memcpy(model, &aexp->model[1], sizeof(MODEL));
+       //printf("mags: %4.2f %4.2f %4.2f Am: \n", aexp->mag[0], aexp->mag[1], aexp->mag[2]);
+
+       /* now replace Am by interpolation, use similar design to VQ
+          to handle different bands  */
+
+       for(m=1; m<=model->L; m++) {
+           assert(model->A[m] > 0.0);
+
+           index = MAX_AMP*m*model->Wo/PI;
+           assert(index < MAX_AMP);
+           sparse_pe_in[index] = 20.0*log10(model->A[m]);
+       }
+
+       /* this can be used for when just testing partial interpolation */
+
+       for(m=0; m<MAX_AMP; m++) {
+           //sparse_pe_out[m] = sparse_pe_in[m];
+           sparse_pe_out[m] = 0;
+       }
+       
+       interp_split_vq(sparse_pe_out, aexp, aexp->vq1, sparse_pe_in, 0);
+       interp_split_vq(sparse_pe_out, aexp, aexp->vq2, sparse_pe_in, 1);
+       interp_split_vq(sparse_pe_out, aexp, aexp->vq3, sparse_pe_in, 2);
+       interp_split_vq(sparse_pe_out, aexp, aexp->vq4, sparse_pe_in, 3);
+       interp_split_vq(sparse_pe_out, aexp, aexp->vq5, sparse_pe_in, 4);
+
+       for(m=1; m<=model->L; m++) {
+           index = MAX_AMP*m*model->Wo/PI;
+           assert(index < MAX_AMP);
+           amp_dB = sparse_pe_out[index];
+           //printf("  %4.2f", 10.0*log10(model->A[m]));
+           model->A[m] = pow(10.0, amp_dB/20.0);
+           //printf("  %4.2f\n", 10.0*log10(model->A[m]));
+       }
+        #ifdef INITIAL_VER
+        
+       for(m=1; m<=model->L; m++) {
+           index = MAX_AMP*m*model->Wo/PI;
+           assert(index < MAX_AMP);
+
+           if (index < vq->k) {
+               amp_dB  = 0.5*(aexp->mag[0] + vq->cb[vq->k * aexp->indexes[0] + index]);
+               amp_dB += 0.5*(aexp->mag[2] + vq->cb[vq->k * aexp->indexes[2] + index]);
+               //printf("  %4.2f", 10.0*log10(model->A[m]));
+               //amp_dB = 10;
+               model->A[m] = pow(10.0, amp_dB/20.0);
+               printf("  %4.2f\n", 10.0*log10(model->A[m]));
+           }
+       }
+       
+       #endif
+    }
+    else
+       memcpy(model, &aexp->model[1], sizeof(MODEL));
+
+    /* update memories */
+
+    for(i=0; i<2; i++) {
+       memcpy(&aexp->model[i], &aexp->model[i+1], sizeof(MODEL));
+       for(j=0; j<5; j++)
+           aexp->indexes[j][i] = aexp->indexes[j][i+1];
+       aexp->mag[i] = aexp->mag[i+1];
+    }
+
+}
+
+
+/*
+  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_samples(struct AEXP *aexp, MODEL *model, int mode)
+{
+    int    m, i, j, index, step, nav, v, en;
+    float  sparse_pe_in[MAX_AMP], av, amp_dB;
+    float  sparse_pe_out[MAX_AMP];
+    float  smoothed[MAX_AMP], smoothed_out[MAX_AMP];
+    float  weights[MAX_AMP];
+    float  enormdB;
+
+    frame_energy(model, &enormdB);
+    
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_in[m] = 0.0;
+       sparse_pe_out[m] = 0.0;
+    }
+
+    /* set up sparse array */
+
+    for(m=1; m<=model->L; m++) {
+       assert(model->A[m] > 0.0);
+
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       sparse_pe_out[index] = sparse_pe_in[index] = 20.0*log10(model->A[m]) - enormdB;
+    }
+
+    /* now combine samples at high frequencies to reduce dimension */
+
+    step=4;
+    for(i=MAX_AMP/2,v=0; i<MAX_AMP; i+=step,v++) {
+
+       /* average over one band */
+
+       av = 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] != 0.0) {
+               av += sparse_pe_in[j];
+               nav++;
+           }
+       }
+       if (nav) {
+           av /= nav;
+           smoothed[v] = av;
+           weights[v] = pow(10.0,av/20.0);
+           //weights[v] = 1.0;
+       }
+       else
+           smoothed[v] = 0.0;
+
+    }
+
+    if (mode == 1) {
+       for(i=0; i<v; i++)
+           printf("%5.2f ", smoothed[i]);
+       printf("\n");
+    }
+
+    if (mode == 2) {
+       for(i=0; i<v; i++)
+           smoothed_out[i] = 0;
+       split_vq(smoothed_out, aexp, aexp->vq1, weights, smoothed);
+       for(i=0; i<v; i++)
+           smoothed[i] = smoothed_out[i];
+    }
+       
+    /* set all samples to smoothed average */
+
+    step = 4;
+    for(i=MAX_AMP/2,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];
+    }
+         
+    /* convert back to Am */
+    
+    for(m=1; m<=model->L; m++) {
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       amp_dB = sparse_pe_out[index] + enormdB;
+       //printf("%d %4.2f %4.2f\n", m, 10.0*log10(model->A[m]), amp_dB);
+       model->A[m] = pow(10.0, amp_dB/20.0);
+    }
+    
+}
+
+#define MAX_BINS 40
+static float bins[] = {
+    /*1000.0, 1200.0, 1400.0, 1600.0, 1800,*/
+    2000.0, 2400.0, 2800.0,
+    3000.0, 3400.0, 3600.0, 4000.0};
+
+void smooth_amp(struct AEXP *aexp, MODEL *model) {
+    int    m, i;
+    int    nbins;
+    int    b;
+    float  f;
+    float  av[MAX_BINS];
+    int    nav[MAX_BINS];
+
+    nbins = sizeof(bins)/sizeof(float);
+
+    /* clear all bins */
+
+    for(i=0; i<MAX_BINS; i++) {
+       av[i] = 0.0;
+       nav[i] = 0;
+    }
+
+    /* add amps 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);
+
+           av[b] += model->A[m]*model->A[m];
+           nav[b]++;
+       }
+           
+    }
+
+    /* use averages to est amps */
+
+    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);
+
+           printf(" %d: %4.3f -> ", m, 20*log10(model->A[m])); 
+           model->A[m] = sqrt(av[b]/nav[b]);
+           printf("%4.3f\n", 20*log10(model->A[m])); 
+       }
+    }
+    printf("\n");
+}
+
+/*---------------------------------------------------------------------------* \
+
+  amp_experiment()
+
+  Amplitude quantisation experiments.
+
+\*---------------------------------------------------------------------------*/
+
+void amp_experiment(struct AEXP *aexp, MODEL *model, char *arg) {
+    int m,i;
+    
+    memcpy(&aexp->model_uq[2], model, sizeof(MODEL));
+
+    if (strcmp(arg, "qn") == 0) {
+       add_quant_noise(aexp, model, 1, model->L, 1);
+       update_snr_calc(aexp, &aexp->model_uq[2], model);
+   }
+
+    /* print training samples that can be > train.txt for training VQ */
+
+    if (strcmp(arg, "train") == 0) 
+       print_sparse_amp_error(aexp, model, 00.0);
+
+    /* VQ of amplitudes, no interpolation (ie 10ms rate) */
+
+    if (strcmp(arg, "vq") == 0) {
+       sparse_vq_amp(aexp, model);
+       vq_interp(aexp, model, 0);
+       update_snr_calc(aexp, &aexp->model_uq[1], model);
+    }
+
+    /* VQ of amplitudes, interpolation (ie 20ms rate) */
+
+    if (strcmp(arg, "vqi") == 0) {
+       sparse_vq_amp(aexp, model);
+       vq_interp(aexp, model, 1);
+       update_snr_calc(aexp, &aexp->model_uq[1], model);
+    }
+
+    /* gain/shape VQ of amplitudes, 10ms rate (doesn't work that well) */
+
+    if (strcmp(arg, "gsvq") == 0) {
+       gain_shape_sparse_vq_amp(aexp, model);
+       vq_interp(aexp, model, 0);
+       update_snr_calc(aexp, &aexp->model_uq[1], model);
+    }
+
+    if (strcmp(arg, "smooth") == 0) {
+       smooth_samples(aexp, model, 0);
+       update_snr_calc(aexp, &aexp->model_uq[2], model);
+    }
+
+    if (strcmp(arg, "smoothtrain") == 0) {
+       smooth_samples(aexp, model, 1);
+       //update_snr_calc(aexp, &aexp->model_uq[2], model);
+    }
+
+    if (strcmp(arg, "smoothvq") == 0) {
+       smooth_samples(aexp, model, 2);
+       update_snr_calc(aexp, &aexp->model_uq[2], model);
+    }
+
+    if (strcmp(arg, "smoothamp") == 0) {
+       smooth_amp(aexp, model);
+       update_snr_calc(aexp, &aexp->model_uq[2], model);
+    }
+
+    /* update states */
+
+    for(m=1; m<=model->L; m++)
+       aexp->A_prev[m] = model->A[m];      
+    aexp->frames++;
+    for(i=0; i<3; i++)
+       aexp->model_uq[i] = aexp->model_uq[i+1];
+}
+
diff --git a/codec2/tags/0.4/src/ampexp.h b/codec2/tags/0.4/src/ampexp.h
new file mode 100644 (file)
index 0000000..313abb1
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: ampexp.h                                     
+  AUTHOR......: David Rowe                                             
+  DATE CREATED: & August 2012
+                                                                             
+  Functions for experimenting with amplitude quantisation.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __AMPEX__
+#define __AMPEXP__
+
+#include "defines.h"
+
+struct AEXP;
+
+struct AEXP *amp_experiment_create();
+void amp_experiment_destroy(struct AEXP *aexp);
+void amp_experiment(struct AEXP *aexp, MODEL *model, char *arg);
+
+#endif
diff --git a/codec2/tags/0.4/src/bpf.h b/codec2/tags/0.4/src/bpf.h
new file mode 100644 (file)
index 0000000..0b0a6e2
--- /dev/null
@@ -0,0 +1,106 @@
+#define BPF_N 101
+
+float bpf[]={
+  0.002174,
+  0.003245,
+  0.002147,
+  0.001866,
+  0.002764,
+  0.000567,
+  -0.001641,
+  -0.000565,
+  -0.002415,
+  -0.005837,
+  -0.003620,
+  -0.002828,
+  -0.006268,
+  -0.002787,
+  0.001963,
+  -0.001234,
+  0.001446,
+  0.009200,
+  0.005331,
+  0.003521,
+  0.011821,
+  0.006951,
+  -0.002015,
+  0.005137,
+  0.001828,
+  -0.013390,
+  -0.007058,
+  -0.003273,
+  -0.020458,
+  -0.014321,
+  0.001751,
+  -0.012891,
+  -0.009730,
+  0.018993,
+  0.008544,
+  0.000534,
+  0.035755,
+  0.029074,
+  -0.001192,
+  0.030852,
+  0.030983,
+  -0.029834,
+  -0.009550,
+  0.011945,
+  -0.081971,
+  -0.082875,
+  0.000423,
+  -0.133526,
+  -0.211778,
+  0.182628,
+  0.514906,
+  0.182628,
+  -0.211778,
+  -0.133526,
+  0.000423,
+  -0.082875,
+  -0.081971,
+  0.011945,
+  -0.009550,
+  -0.029834,
+  0.030983,
+  0.030852,
+  -0.001192,
+  0.029074,
+  0.035755,
+  0.000534,
+  0.008544,
+  0.018993,
+  -0.009730,
+  -0.012891,
+  0.001751,
+  -0.014321,
+  -0.020458,
+  -0.003273,
+  -0.007058,
+  -0.013390,
+  0.001828,
+  0.005137,
+  -0.002015,
+  0.006951,
+  0.011821,
+  0.003521,
+  0.005331,
+  0.009200,
+  0.001446,
+  -0.001234,
+  0.001963,
+  -0.002787,
+  -0.006268,
+  -0.002828,
+  -0.003620,
+  -0.005837,
+  -0.002415,
+  -0.000565,
+  -0.001641,
+  0.000567,
+  0.002764,
+  0.001866,
+  0.002147,
+  0.003245,
+  0.002174
+};
+
diff --git a/codec2/tags/0.4/src/c2dec.c b/codec2/tags/0.4/src/c2dec.c
new file mode 100644 (file)
index 0000000..8d18638
--- /dev/null
@@ -0,0 +1,325 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: c2dec.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 23/8/2010
+
+  Decodes a file of bits to a file of raw speech samples using codec2.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2010 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 "codec2.h"
+#include "dump.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+
+#define NONE          0  /* no bit errors                          */
+#define UNIFORM       1  /* random bit errors                      */
+#define TWO_STATE     2  /* Two state error model                  */
+#define UNIFORM_RANGE 3  /* random bit errors over a certain range */
+
+void print_help(const struct option *long_options, int num_opts, char* argv[]);
+
+int main(int argc, char *argv[])
+{
+    int            mode;
+    void          *codec2;
+    FILE          *fin;
+    FILE          *fout;
+    FILE          *fber = NULL;
+    short         *buf;
+    unsigned char *bits;
+    float         *softdec_bits;
+    int            nsam, nbit, nbyte, i, byte, frames, bits_proc, bit_errors, error_mode;
+    int            nstart_bit, nend_bit, bit_rate;
+    int            state, next_state;
+    float          ber, r, burst_length, burst_period, burst_timer, ber_est;
+    unsigned char  mask;
+    int            natural, dump, softdec, bit, ret;
+
+    char* opt_string = "h:";
+    struct option long_options[] = {
+        { "ber", required_argument, NULL, 0 },
+        { "startbit", required_argument, NULL, 0 },
+        { "endbit", required_argument, NULL, 0 },
+        { "berfile", required_argument, NULL, 0 },
+        { "natural", no_argument, &natural, 1 },
+        { "softdec", no_argument, &softdec, 1 },
+        #ifdef DUMP
+        { "dump", required_argument, &dump, 1 },
+        #endif
+        { "help", no_argument, NULL, 'h' },
+        { NULL, no_argument, NULL, 0 }
+    };
+    int num_opts=sizeof(long_options)/sizeof(struct option);
+    if (argc < 4)
+        print_help(long_options, num_opts, argv);
+    
+    if (strcmp(argv[1],"3200") == 0)
+       mode = CODEC2_MODE_3200;
+    else if (strcmp(argv[1],"2400") == 0)
+       mode = CODEC2_MODE_2400;
+    else if (strcmp(argv[1],"1600") == 0)
+       mode = CODEC2_MODE_1600;
+    else if (strcmp(argv[1],"1400") == 0)
+       mode = CODEC2_MODE_1400;
+    else if (strcmp(argv[1],"1300") == 0)
+       mode = CODEC2_MODE_1300;
+    else if (strcmp(argv[1],"1200") == 0)
+       mode = CODEC2_MODE_1200;
+    else if (strcmp(argv[1],"700") == 0)
+       mode = CODEC2_MODE_700;
+    else {
+       fprintf(stderr, "Error in mode: %s.  Must be 3200, 2400, 1600, 1400, 1300, 1200, or 700\n", argv[1]);
+       exit(1);
+    }
+    bit_rate = atoi(argv[1]);
+
+    if (strcmp(argv[2], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[2],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[3], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[3],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+
+    error_mode = NONE;
+    ber = 0.0;
+    burst_length = burst_period = 0.0;
+    burst_timer = 0.0;
+    dump = natural = softdec = 0;
+
+    codec2 = codec2_create(mode);
+    nsam = codec2_samples_per_frame(codec2);
+    nbit = codec2_bits_per_frame(codec2);
+    buf = (short*)malloc(nsam*sizeof(short));
+    nbyte = (nbit + 7) / 8;
+    bits = (unsigned char*)malloc(nbyte*sizeof(char));
+    softdec_bits = (float*)malloc(nbit*sizeof(float));
+    frames = bit_errors = bits_proc = 0;
+    nstart_bit = 0;
+    nend_bit = nbit-1;
+
+    while(1) {
+        int option_index = 0;
+        int opt = getopt_long(argc, argv, opt_string, 
+                    long_options, &option_index);
+        if (opt == -1)
+            break;
+
+        switch (opt) {
+        case 0:
+            if(strcmp(long_options[option_index].name, "ber") == 0) {
+                ber = atof(optarg);
+                error_mode = UNIFORM;
+            } else if(strcmp(long_options[option_index].name, "startbit") == 0) {
+               nstart_bit = atoi(optarg);
+            } else if(strcmp(long_options[option_index].name, "endbit") == 0) {
+               nend_bit = atoi(optarg);
+             } else if(strcmp(long_options[option_index].name, "berfile") == 0) {
+               if ((fber = fopen(optarg,"wt")) == NULL) {
+                   fprintf(stderr, "Error opening BER file: %s %s.\n",
+                            optarg, strerror(errno));
+                    exit(1);
+                }
+            
+            } 
+            #ifdef DUMP
+            else if(strcmp(long_options[option_index].name, "dump") == 0) {
+                if (dump) 
+                   dump_on(optarg);
+            }
+            #endif
+            break;
+
+        case 'h':
+            print_help(long_options, num_opts, argv);
+            break;
+
+        default:
+            /* This will never be reached */
+            break;
+        }
+    }
+    assert(nend_bit <= nbit);
+    codec2_set_natural_or_gray(codec2, !natural);
+    //printf("%d %d\n", nstart_bit, nend_bit);
+    //fprintf(stderr, "softdec: %d natural: %d\n", softdec, natural);
+    if (softdec)
+        ret = (fread(softdec_bits, sizeof(float), nbit, fin) == (size_t)nbit);
+    else
+        ret = (fread(bits, sizeof(char), nbyte, fin) == (size_t)nbyte);
+      
+    while(ret) {
+       frames++;
+
+        // apply bit errors, MSB of byte 0 is bit 0 in frame, only works in packed mode
+        
+       if ((error_mode == UNIFORM) || (error_mode == UNIFORM_RANGE)) {
+            assert(softdec == 0);
+           for(i=nstart_bit; i<nend_bit+1; i++) {
+               r = (float)rand()/RAND_MAX;
+               if (r < ber) {
+                   byte = i/8;
+                   //printf("nbyte %d nbit %d i %d byte %d bits[%d] 0x%0x ", nbyte, nbit, i, byte, byte, bits[byte]);
+                   mask = 1 << (7 - i + byte*8);
+                    bits[byte] ^= mask;
+                   //printf("shift: %d mask: 0x%0x bits[%d] 0x%0x\n", 7 - i + byte*8, mask, byte, bits[byte] );
+                   bit_errors++;
+               }
+                bits_proc++;
+           }
+       }
+
+       if (error_mode == TWO_STATE) {
+            assert(softdec == 0);
+            burst_timer += (float)nbit/bit_rate;
+            fprintf(stderr, "burst_timer: %f  state: %d\n", burst_timer, state);
+
+            next_state = state;
+            switch(state) {
+            case 0:
+
+                /* clear channel state - no bit errors */
+
+                if (burst_timer > (burst_period - burst_length))
+                    next_state = 1;
+                break;
+
+            case 1:
+                
+                /* burst error state - 50% bit error rate */
+
+                for(i=nstart_bit; i<nend_bit+1; i++) {
+                    r = (float)rand()/RAND_MAX;
+                    if (r < 0.5) {
+                        byte = i/8;
+                        bits[byte] ^= 1 << (7 - i + byte*8);
+                        bit_errors++;
+                    }
+                    bits_proc++;
+               }
+
+                if (burst_timer > burst_period) {
+                    burst_timer = 0.0;
+                    next_state = 0;
+                }
+                break;
+
+           }
+               
+            state = next_state;
+        }
+
+        if (fber != NULL) {
+            if (fread(&ber_est, sizeof(float), 1, fber) != 1) {
+                fprintf(stderr, "ran out of BER estimates!\n");
+                exit(1);
+            }
+            //fprintf(stderr, "ber_est: %f\n", ber_est);
+        }
+        else
+            ber_est = 0.0;
+            
+        if (softdec) {
+            /* pack bits, MSB received first  */
+
+            bit = 7; byte = 0;
+            memset(bits, 0, nbyte);
+            for(i=0; i<nbit; i++) {
+                bits[byte] |= ((softdec_bits[i] < 0.0) << bit);
+                bit--;
+                if (bit < 0) {
+                    bit = 7;
+                    byte++;
+                }
+            }
+            codec2_set_softdec(codec2, softdec_bits);
+        }
+
+       codec2_decode_ber(codec2, buf, bits, ber_est);
+       fwrite(buf, sizeof(short), nsam, fout);
+
+       //if this is in a pipeline, we probably don't want the usual
+        //buffering to occur
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+
+        if (softdec)
+            ret = (fread(softdec_bits, sizeof(float), nbit, fin) == (size_t)nbit);
+        else
+            ret = (fread(bits, sizeof(char), nbyte, fin) == (size_t)nbyte);
+    }
+
+    if (error_mode)
+       fprintf(stderr, "actual BER: %1.3f\n", (float)bit_errors/bits_proc);
+
+    codec2_destroy(codec2);
+
+    free(buf);
+    free(bits);
+    free(softdec_bits);
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
+
+void print_help(const struct option* long_options, int num_opts, char* argv[])
+{
+       int i;
+       char *option_parameters;
+       fprintf(stderr, "\nc2dec - Codec 2 decoder and bit error simulation program\n"
+               "usage: %s 3200|2400|1400}1300|1200 InputFile OutputRawFile [OPTIONS]\n\n"
+                "Options:\n", argv[0]);
+        for(i=0; i<num_opts-1; i++) {
+               if(long_options[i].has_arg == no_argument) {
+                       option_parameters="";
+               } else if (strcmp("ber", long_options[i].name) == 0) {
+                       option_parameters = " BER";
+               } else if (strcmp("startbit", long_options[i].name) == 0) {
+                       option_parameters = " startBit";
+               } else if (strcmp("endbit", long_options[i].name) == 0) {
+                       option_parameters = " endBit";
+               } else if (strcmp("berfile", long_options[i].name) == 0) {
+                       option_parameters = " berFileName";
+               } else if (strcmp("dump", long_options[i].name) == 0) {
+                       option_parameters = " dumpFilePrefix";
+               } else {
+                       option_parameters = " <UNDOCUMENTED parameter>";
+               }
+               fprintf(stderr, "\t--%s%s\n", long_options[i].name, option_parameters);
+       }
+       exit(1);
+}
diff --git a/codec2/tags/0.4/src/c2demo.c b/codec2/tags/0.4/src/c2demo.c
new file mode 100644 (file)
index 0000000..7014baa
--- /dev/null
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: c2demo.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 15/11/2010
+
+  Encodes and decodes a file of raw speech samples using Codec 2.
+  Demonstrates use of Codec 2 function API.
+
+  Note to convert a wave file to raw and vice-versa:
+
+    $ sox file.wav -r 8000 -s -2 file.raw
+    $ sox -r 8000 -s -2 file.raw file.wav
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2010 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 "codec2.h"
+#include "sine.h"
+#include "dump.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+    struct CODEC2 *codec2;
+    FILE          *fin;
+    FILE          *fout;
+    short         *buf;
+    unsigned char *bits;
+    int            nsam, nbit, i, r;
+
+    for(i=0; i<10; i++) {
+        r = codec2_rand();
+        printf("[%d] r = %d\n", i, r);
+    }
+
+    if (argc != 3) {
+       printf("usage: %s InputRawSpeechFile OutputRawSpeechFile\n", argv[0]);
+       exit(1);
+    }
+    if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input speech file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    #ifdef DUMP
+    dump_on("c2demo");
+    #endif
+
+    /* Note only one set of Codec 2 states is required for an encoder
+       and decoder pair. */
+
+    codec2 = codec2_create(CODEC2_MODE_1300);
+    nsam = codec2_samples_per_frame(codec2);
+    buf = (short*)malloc(nsam*sizeof(short));
+    nbit = codec2_bits_per_frame(codec2);
+    bits = (unsigned char*)malloc(nbit*sizeof(char));
+
+    while(fread(buf, sizeof(short), nsam, fin) == (size_t)nsam) {
+       codec2_encode(codec2, bits, buf);
+       codec2_decode(codec2, buf, bits);
+       fwrite(buf, sizeof(short), nsam, fout);
+    }
+
+    free(buf);
+    free(bits);
+    codec2_destroy(codec2);
+
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/c2enc.c b/codec2/tags/0.4/src/c2enc.c
new file mode 100644 (file)
index 0000000..5a000b8
--- /dev/null
@@ -0,0 +1,147 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: c2enc.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 23/8/2010
+
+  Encodes a file of raw speech samples using codec2 and outputs a file
+  of bits.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2010 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 "codec2.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+    int            mode;
+    void          *codec2;
+    FILE          *fin;
+    FILE          *fout;
+    short         *buf;
+    unsigned char *bits;
+    int            nsam, nbit, nbyte, gray, softdec;
+    float         *unpacked_bits;
+    int            bit, byte,i;
+
+    if (argc < 4) {
+       printf("usage: c2enc 3200|2400|1600|1400|1300|1200|700 InputRawspeechFile OutputBitFile [--natural] [--softdec]\n");
+       printf("e.g    c2enc 1400 ../raw/hts1a.raw hts1a.c2\n");
+       printf("e.g    c2enc 1300 ../raw/hts1a.raw hts1a.c2 --natural\n");
+       exit(1);
+    }
+    if (strcmp(argv[1],"3200") == 0)
+       mode = CODEC2_MODE_3200;
+    else if (strcmp(argv[1],"2400") == 0)
+       mode = CODEC2_MODE_2400;
+    else if (strcmp(argv[1],"1600") == 0)
+       mode = CODEC2_MODE_1600;
+    else if (strcmp(argv[1],"1400") == 0)
+       mode = CODEC2_MODE_1400;
+    else if (strcmp(argv[1],"1300") == 0)
+       mode = CODEC2_MODE_1300;
+    else if (strcmp(argv[1],"1200") == 0)
+       mode = CODEC2_MODE_1200;
+    else if (strcmp(argv[1],"700") == 0)
+       mode = CODEC2_MODE_700;
+    else {
+       fprintf(stderr, "Error in mode: %s.  Must be 3200, 2400, 1600, 1400, 1300, 1200 or 700\n", argv[1]);
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[2],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input speech file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[3], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[3],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output compressed bit file: %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+
+    codec2 = codec2_create(mode);
+    nsam = codec2_samples_per_frame(codec2);
+    nbit = codec2_bits_per_frame(codec2);
+    buf = (short*)malloc(nsam*sizeof(short));
+    nbyte = (nbit + 7) / 8;
+
+    bits = (unsigned char*)malloc(nbyte*sizeof(char));
+    unpacked_bits = (float*)malloc(nbit*sizeof(float));
+    
+    gray = 1;
+    softdec = 0;
+    for (i=4; i<argc; i++) {
+        if (strcmp(argv[i], "--natural") == 0) {
+            gray = 0;
+        }
+        if (strcmp(argv[i], "--softdec") == 0) {
+            softdec = 1;
+        }
+    }
+    codec2_set_natural_or_gray(codec2, gray);
+    //fprintf(stderr,"gray: %d softdec: %d\n", gray, softdec);
+
+    while(fread(buf, sizeof(short), nsam, fin) == (size_t)nsam) {
+
+       codec2_encode(codec2, bits, buf);
+
+       if (softdec) {
+            /* unpack bits, MSB first, send as soft decision float */
+
+            bit = 7; byte = 0;
+            for(i=0; i<nbit; i++) {
+                unpacked_bits[i] = 1.0 - 2.0*((bits[byte] >> bit) & 0x1);
+                bit--;
+                if (bit < 0) {
+                    bit = 7;
+                    byte++;
+                }
+            }
+            fwrite(unpacked_bits, sizeof(float), nbit, fout);
+        }
+        else
+            fwrite(bits, sizeof(char), nbyte, fout);
+
+       // if this is in a pipeline, we probably don't want the usual
+        // buffering to occur
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);
+    }
+
+    codec2_destroy(codec2);
+
+    free(buf);
+    free(bits);
+    free(unpacked_bits);
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/c2sim.c b/codec2/tags/0.4/src/c2sim.c
new file mode 100644 (file)
index 0000000..814a030
--- /dev/null
@@ -0,0 +1,844 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: c2sim.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 20/8/2010
+
+  Codec2 simulation.  Combines encoder and decoder and allows
+  switching in and out various algorithms and quantisation steps. Used
+  for algorithm development.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+#include <unistd.h>
+#include <getopt.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "nlp.h"
+#include "dump.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "quantise.h"
+#include "phase.h"
+#include "postfilter.h"
+#include "interp.h"
+#include "ampexp.h"
+#include "phaseexp.h"
+#include "bpf.h"
+
+void synth_one_frame(kiss_fft_cfg fft_inv_cfg, short buf[], MODEL *model, float Sn_[], float Pn[], int prede, float *de_mem, float gain);
+void print_help(const struct option *long_options, int num_opts, char* argv[]);
+
+
+/*---------------------------------------------------------------------------*\
+                                                                          
+                               MAIN                                        
+                                                                         
+\*---------------------------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    FILE *fout = NULL; /* output speech file                    */
+    FILE *fin;         /* input speech file                     */
+    short buf[N];      /* input/output buffer                   */
+    float buf_float[N];
+    float Sn[M];       /* float input speech samples            */
+    float Sn_pre[N];   /* pre-emphasised input speech samples   */
+    COMP  Sw[FFT_ENC]; /* DFT of Sn[]                           */
+    kiss_fft_cfg  fft_fwd_cfg;
+    kiss_fft_cfg  fft_inv_cfg;
+    float w[M];                /* time domain hamming window            */
+    COMP  W[FFT_ENC];  /* DFT of w[]                            */
+    MODEL model;
+    float Pn[2*N];     /* trapezoidal synthesis window          */
+    float Sn_[2*N];    /* synthesised speech */
+    int   i,m;         /* loop variable                         */
+    int   frames;
+    float prev_Wo, prev__Wo, prev_uq_Wo;
+    float pitch;
+    char  out_file[MAX_STR];
+    char  ampexp_arg[MAX_STR];
+    char  phaseexp_arg[MAX_STR];
+    float snr;
+    float sum_snr;
+    int orderi;
+    int lpc_model = 0, order = LPC_ORD;
+    int lsp = 0, lspd = 0, lspvq = 0;
+    int lspres = 0;
+    int lspjvm = 0, lspjnd = 0, lspmel = 0;
+    #ifdef __EXPERIMENTAL__
+    int lspanssi = 0, 
+    #endif
+    int prede = 0;
+    float pre_mem = 0.0, de_mem = 0.0;
+    float ak[order];
+    COMP  Sw_[FFT_ENC];
+    COMP  Ew[FFT_ENC]; 
+    int phase0 = 0;
+    float ex_phase[MAX_AMP+1];
+
+    int   postfilt;
+
+    int   hand_voicing = 0, phaseexp = 0, ampexp = 0, hi = 0, simlpcpf = 0, lspmelread = 0;
+    int   lpcpf = 0;
+    FILE *fvoicing = 0;
+    FILE *flspmel = 0;
+
+    MODEL prev_model;
+    int dec;
+    int decimate = 1;
+    float lsps[order];
+    float e, prev_e;
+    int   lsp_indexes[order];
+    float lsps_[order];
+    float Woe_[2];
+
+    float lsps_dec[4][LPC_ORD], e_dec[4], weight, weight_inc, ak_dec[4][LPC_ORD];
+    MODEL model_dec[4], prev_model_dec;
+    float prev_lsps_dec[order], prev_e_dec;
+
+    void *nlp_states;
+    float hpf_states[2];
+    int   scalar_quant_Wo_e = 0;
+    int   vector_quant_Wo_e = 0;
+    int   dump_pitch_e = 0;
+    FILE *fjvm = NULL;
+    #ifdef DUMP
+    int   dump;
+    #endif
+    struct PEXP *pexp = NULL;
+    struct AEXP *aexp = NULL;
+    float gain = 1.0;
+    int   bpf_en = 0;
+    float bpf_buf[BPF_N+N];
+
+    char* opt_string = "ho:";
+    struct option long_options[] = {
+        { "lpc", required_argument, &lpc_model, 1 },
+        { "lspjnd", no_argument, &lspjnd, 1 },
+        { "lspmel", no_argument, &lspmel, 1 },
+        { "lspmelread", required_argument, &lspmelread, 1 },
+        { "lsp", no_argument, &lsp, 1 },
+        { "lspd", no_argument, &lspd, 1 },
+        { "lspvq", no_argument, &lspvq, 1 },
+        { "lspres", no_argument, &lspres, 1 },
+        { "lspjvm", no_argument, &lspjvm, 1 },
+        #ifdef __EXPERIMENTAL__
+        { "lspanssi", no_argument, &lspanssi, 1 },
+        #endif
+        { "phase0", no_argument, &phase0, 1 },
+        { "phaseexp", required_argument, &phaseexp, 1 },
+        { "ampexp", required_argument, &ampexp, 1 },
+        { "postfilter", no_argument, &postfilt, 1 },
+        { "hand_voicing", required_argument, &hand_voicing, 1 },
+        { "dec", required_argument, &dec, 1 },
+        { "hi", no_argument, &hi, 1 },
+        { "simlpcpf", no_argument, &simlpcpf, 1 },
+        { "lpcpf", no_argument, &lpcpf, 1 },
+        { "prede", no_argument, &prede, 1 },
+        { "dump_pitch_e", required_argument, &dump_pitch_e, 1 },
+        { "sq_pitch_e", no_argument, &scalar_quant_Wo_e, 1 },
+        { "vq_pitch_e", no_argument, &vector_quant_Wo_e, 1 },
+        { "rate", required_argument, NULL, 0 },
+        { "gain", required_argument, NULL, 0 },
+        { "bpf", no_argument, &bpf_en, 1 },
+        #ifdef DUMP
+        { "dump", required_argument, &dump, 1 },
+        #endif
+        { "help", no_argument, NULL, 'h' },
+        { NULL, no_argument, NULL, 0 }
+    };
+    int num_opts=sizeof(long_options)/sizeof(struct option);
+    COMP Aw[FFT_ENC];
+
+    for(i=0; i<M; i++) {
+       Sn[i] = 1.0;
+       Sn_pre[i] = 1.0;
+    }
+    for(i=0; i<2*N; i++)
+       Sn_[i] = 0;
+
+    prev_uq_Wo = prev_Wo = prev__Wo = TWO_PI/P_MAX;
+
+    prev_model.Wo = TWO_PI/P_MIN;
+    prev_model.L = floor(PI/prev_model.Wo);
+    for(i=1; i<=prev_model.L; i++) {
+       prev_model.A[i] = 0.0;
+       prev_model.phi[i] = 0.0;
+    }
+    for(i=1; i<=MAX_AMP; i++) {
+       //ex_phase[i] = (PI/3)*(float)rand()/RAND_MAX;
+       ex_phase[i] = 0.0;
+    }
+    e = prev_e = 1;
+    hpf_states[0] = hpf_states[1] = 0.0;
+
+    nlp_states = nlp_create(M);
+
+    if (argc < 2) {
+        print_help(long_options, num_opts, argv);
+    }
+
+    /*----------------------------------------------------------------*\
+
+                     Interpret Command Line Arguments
+
+    \*----------------------------------------------------------------*/
+
+    while(1) {
+        int option_index = 0;
+        int opt = getopt_long(argc, argv, opt_string, 
+                    long_options, &option_index);
+        if (opt == -1)
+            break;
+        switch (opt) {
+         case 0:
+            if(strcmp(long_options[option_index].name, "lpc") == 0) {
+                orderi = atoi(optarg);
+                if((orderi < 4) || (orderi > order)) {
+                    fprintf(stderr, "Error in LPC order (4 to %d): %s\n", order, optarg);
+                    exit(1);
+                }
+                order = orderi;
+            #ifdef DUMP
+            } else if(strcmp(long_options[option_index].name, "dump") == 0) {
+                if (dump) 
+                   dump_on(optarg);
+            #endif
+            } else if(strcmp(long_options[option_index].name, "lsp") == 0
+                  || strcmp(long_options[option_index].name, "lspd") == 0
+                  || strcmp(long_options[option_index].name, "lspvq") == 0) {
+               assert(order == LPC_ORD);
+            } else if(strcmp(long_options[option_index].name, "dec") == 0) {
+               
+                decimate = atoi(optarg);
+               if ((decimate != 2) && (decimate != 3) && (decimate != 4)) {
+                   fprintf(stderr, "Error in --dec, must be 2, 3, or 4\n");
+                   exit(1);
+               }
+
+                if (!phase0) {
+                    printf("needs --phase0 to resample phase when using --dec\n");
+                    exit(1);
+                }
+                if (!lpc_model) {
+                    printf("needs --lpc [order] to resample amplitudes when using --dec\n");
+                    exit(1);
+                }
+            } else if(strcmp(long_options[option_index].name, "hand_voicing") == 0) {
+               if ((fvoicing = fopen(optarg,"rt")) == NULL) {
+                   fprintf(stderr, "Error opening voicing file: %s: %s.\n",
+                       optarg, strerror(errno));
+                    exit(1);
+                }
+            } else if(strcmp(long_options[option_index].name, "lspmelread") == 0) {
+               if ((flspmel = fopen(optarg,"rb")) == NULL) {
+                   fprintf(stderr, "Error opening float lspmel file: %s: %s.\n",
+                       optarg, strerror(errno));
+                    exit(1);
+                }
+           } else if(strcmp(long_options[option_index].name, "dump_pitch_e") == 0) {
+               if ((fjvm = fopen(optarg,"wt")) == NULL) {
+                   fprintf(stderr, "Error opening pitch & energy dump file: %s: %s.\n",
+                       optarg, strerror(errno));
+                    exit(1);
+                }
+           } else if(strcmp(long_options[option_index].name, "phaseexp") == 0) {
+               strcpy(phaseexp_arg, optarg);
+           } else if(strcmp(long_options[option_index].name, "ampexp") == 0) {
+               strcpy(ampexp_arg, optarg);
+           } else if(strcmp(long_options[option_index].name, "gain") == 0) {
+               gain = atof(optarg);
+           } else if(strcmp(long_options[option_index].name, "rate") == 0) {
+                if(strcmp(optarg,"3200") == 0) {
+                   lpc_model = 1;
+                   scalar_quant_Wo_e = 1;
+                   lspd = 1;
+                   phase0 = 1;
+                   postfilt = 1;
+                   decimate = 1;
+                   lpcpf = 1;
+               } else if(strcmp(optarg,"2400") == 0) {
+                   lpc_model = 1;
+                   vector_quant_Wo_e = 1;
+                   lsp = 1;
+                   phase0 = 1;
+                   postfilt = 1;
+                   decimate = 2;
+                   lpcpf = 1;
+               } else if(strcmp(optarg,"1400") == 0) {
+                   lpc_model = 1;
+                   vector_quant_Wo_e = 1;
+                   lsp = 1;
+                   phase0 = 1;
+                   postfilt = 1;
+                   decimate = 4;
+                   lpcpf = 1;
+               } else if(strcmp(optarg,"1300") == 0) {
+                   lpc_model = 1;
+                   scalar_quant_Wo_e = 1;
+                   lsp = 1;
+                   phase0 = 1;
+                   postfilt = 1;
+                   decimate = 4;
+                   lpcpf = 1;
+               } else if(strcmp(optarg,"1200") == 0) {
+                   lpc_model = 1;
+                   scalar_quant_Wo_e = 1;
+                   lspjvm = 1;
+                   phase0 = 1;
+                   postfilt = 1;
+                   decimate = 4;
+                   lpcpf = 1;
+                } else {
+                    fprintf(stderr, "Error: invalid output rate (3200|2400|1400|1200) %s\n", optarg);
+                    exit(1);
+                }
+            }
+            break;
+
+         case 'h':
+            print_help(long_options, num_opts, argv);
+            break;
+
+         case 'o':
+            if (strcmp(optarg, "-") == 0) fout = stdout;
+            else if ((fout = fopen(optarg,"wb")) == NULL) {
+               fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+                   optarg, strerror(errno));
+               exit(1);
+            }
+            strcpy(out_file,optarg);
+            break;
+
+         default:
+            /* This will never be reached */
+            break;
+        }
+    }
+
+    /* Input file */
+
+    if (strcmp(argv[optind], "-")  == 0) fin = stdin;
+    else if ((fin = fopen(argv[optind],"rb")) == NULL) {
+       fprintf(stderr, "Error opening input speech file: %s: %s.\n",
+               argv[optind], strerror(errno));
+       exit(1);
+    }
+
+    ex_phase[0] = 0;
+    Woe_[0] = Woe_[1] = 1.0;
+
+    /*
+      printf("lspd: %d lspdt: %d lspdt_mode: %d  phase0: %d postfilt: %d "
+          "decimate: %d dt: %d\n",lspd,lspdt,lspdt_mode,phase0,postfilt,
+          decimate,dt);
+    */
+
+    /* Initialise ------------------------------------------------------------*/
+
+    fft_fwd_cfg = kiss_fft_alloc(FFT_ENC, 0, NULL, NULL); /* fwd FFT,used in several places   */
+    fft_inv_cfg = kiss_fft_alloc(FFT_DEC, 1, NULL, NULL); /* inverse FFT, used just for synth */
+    make_analysis_window(fft_fwd_cfg, w, W);
+    make_synthesis_window(Pn);
+    quantise_init();
+    if (phaseexp)
+       pexp = phase_experiment_create();
+    if (ampexp)
+       aexp = amp_experiment_create();
+
+    if (bpf_en) {
+        for(i=0; i<BPF_N; i++)
+            bpf_buf[i] = 0.0;
+    }
+
+    for(i=0; i<LPC_ORD; i++) {
+        prev_lsps_dec[i] = i*PI/(LPC_ORD+1);
+    }
+    prev_e_dec = 1;
+    for(m=1; m<=MAX_AMP; m++)
+       prev_model_dec.A[m] = 0.0;
+    prev_model_dec.Wo = TWO_PI/P_MAX;
+    prev_model_dec.L = PI/prev_model_dec.Wo;
+    prev_model_dec.voiced = 0;
+
+    /*----------------------------------------------------------------* \
+
+                            Main Loop
+
+    \*----------------------------------------------------------------*/
+
+    frames = 0;
+    sum_snr = 0;
+    while(fread(buf,sizeof(short),N,fin)) {
+       frames++;
+
+       for(i=0; i<N; i++)
+           buf_float[i] = buf[i];
+
+       /* optionally filter input speech */
+       
+        if (prede) {
+           pre_emp(Sn_pre, buf_float, &pre_mem, N);
+           for(i=0; i<N; i++)
+                buf_float[i] = Sn_pre[i];
+        }
+         
+        if (bpf_en) {
+            for(i=0; i<BPF_N; i++)
+                bpf_buf[i] =  bpf_buf[N+i];
+            for(i=0; i<N; i++)
+                bpf_buf[BPF_N+i] = buf_float[i];
+            inverse_filter(&bpf_buf[BPF_N], bpf, N, buf_float, BPF_N);
+       }
+
+        /* shift buffer of input samples, and insert new samples */
+
+       for(i=0; i<M-N; i++) {
+           Sn[i] = Sn[i+N];
+       }
+       for(i=0; i<N; i++)
+           Sn[i+M-N] = buf_float[i];
+
+       /*------------------------------------------------------------*\
+
+                      Estimate Sinusoidal Model Parameters
+
+       \*------------------------------------------------------------*/
+
+       nlp(nlp_states,Sn,N,P_MIN,P_MAX,&pitch,Sw,W,&prev_uq_Wo);
+       model.Wo = TWO_PI/pitch;
+
+       dft_speech(fft_fwd_cfg, Sw, Sn, w);
+       two_stage_pitch_refinement(&model, Sw);
+       estimate_amplitudes(&model, Sw, W, 1);
+        #ifdef DUMP 
+       dump_Sn(Sn); dump_Sw(Sw); dump_model(&model);
+        #endif
+
+       if (ampexp)
+           amp_experiment(aexp, &model, ampexp_arg);
+
+       if (phaseexp) {
+            #ifdef DUMP
+           dump_phase(&model.phi[0], model.L);
+            #endif
+           phase_experiment(pexp, &model, phaseexp_arg);
+            #ifdef DUMP
+           dump_phase_(&model.phi[0], model.L);
+            #endif
+       }
+       
+       if (hi) {
+           int m;
+           for(m=1; m<model.L/2; m++)
+               model.A[m] = 0.0;
+           for(m=3*model.L/4; m<=model.L; m++)
+               model.A[m] = 0.0;
+       }
+
+       /*------------------------------------------------------------*\
+
+                            Zero-phase modelling
+
+       \*------------------------------------------------------------*/
+
+       if (phase0) {
+           float Wn[M];                        /* windowed speech samples */
+           float Rk[order+1];                  /* autocorrelation coeffs  */
+            COMP a[FFT_ENC];                   
+
+            #ifdef DUMP
+           dump_phase(&model.phi[0], model.L);
+            #endif
+
+           /* find aks here, these are overwritten if LPC modelling is enabled */
+
+            for(i=0; i<M; i++)
+                Wn[i] = Sn[i]*w[i];
+           autocorrelate(Wn,Rk,M,order);
+           levinson_durbin(Rk,ak,order);
+
+           /* determine voicing */
+
+           snr = est_voicing_mbe(&model, Sw, W, Sw_, Ew);
+
+           if (dump_pitch_e)
+               fprintf(fjvm, "%f %f %d ", model.Wo, snr, model.voiced);
+
+           //printf("snr %3.2f v: %d Wo: %f prev_Wo: %f\n", snr, model.voiced,
+           //     model.Wo, prev_uq_Wo);
+            #ifdef DUMP
+           dump_Sw_(Sw_);
+           dump_Ew(Ew);
+           dump_snr(snr);
+            #endif
+
+           /* just to make sure we are not cheating - kill all phases */
+
+           for(i=0; i<=MAX_AMP; i++)
+               model.phi[i] = 0;
+       
+            /* Determine DFT of A(exp(jw)), which is needed for phase0 model when
+               LPC is not used, e.g. indecimate=1 (10ms) frames with no LPC */
+
+            for(i=0; i<FFT_ENC; i++) {
+                a[i].real = 0.0;
+                a[i].imag = 0.0; 
+            }
+
+            for(i=0; i<=order; i++)
+                a[i].real = ak[i];
+            kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)a, (kiss_fft_cpx *)Aw);
+
+           if (hand_voicing) {
+               fscanf(fvoicing,"%d\n",&model.voiced);
+           }
+       }
+
+       /*------------------------------------------------------------*\
+
+               LPC model amplitudes and LSP quantisation 
+
+       \*------------------------------------------------------------*/
+
+       if (lpc_model) {
+           
+            e = speech_to_uq_lsps(lsps, ak, Sn, w, order);
+            for(i=0; i<LPC_ORD; i++)
+                lsps_[i] = lsps[i];
+
+            #ifdef DUMP
+           dump_ak(ak, order);
+            dump_E(e);
+            #endif
+       
+           /* tracking down -ve energy values with BW expansion */
+           /*
+           if (e < 0.0) {
+               int i;
+               FILE*f=fopen("x.txt","wt");
+               for(i=0; i<M; i++)
+                   fprintf(f,"%f\n", Sn[i]);
+               fclose(f);
+               printf("e = %f frames = %d\n", e, frames);
+               for(i=0; i<order; i++)
+                   printf("%f ", ak[i]);
+               exit(0);
+           }
+           */
+
+           if (dump_pitch_e)
+               fprintf(fjvm, "%f\n", e);
+
+            #ifdef DUMP
+            dump_lsp(lsps);
+            #endif
+
+           /* various LSP quantisation schemes */
+
+           if (lsp) {
+               encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD);
+               decode_lsps_scalar(lsps_, lsp_indexes, LPC_ORD);
+               bw_expand_lsps(lsps_, LPC_ORD, 50.0, 100.0);
+               lsp_to_lpc(lsps_, ak, LPC_ORD);
+           }
+
+           if (lspd) {
+               encode_lspds_scalar(lsp_indexes, lsps, LPC_ORD);
+               decode_lspds_scalar(lsps_, lsp_indexes, LPC_ORD);
+               lsp_to_lpc(lsps_, ak, LPC_ORD);
+           }
+
+#ifdef __EXPERIMENTAL__
+           if (lspvq) {
+               lspvq_quantise(lsps, lsps_, LPC_ORD);
+               bw_expand_lsps(lsps_, LPC_ORD, 50.0, 100.0);
+               lsp_to_lpc(lsps_, ak, LPC_ORD);
+           }
+#endif
+
+           if (lspjvm) {
+               /* Jean-Marc's multi-stage, split VQ */
+               lspjvm_quantise(lsps, lsps_, LPC_ORD);
+               { 
+                   float lsps_bw[LPC_ORD];
+                   memcpy(lsps_bw, lsps_, sizeof(float)*LPC_ORD);
+                   bw_expand_lsps(lsps_bw, LPC_ORD, 50.0, 100.0);                          
+                   lsp_to_lpc(lsps_bw, ak, LPC_ORD);
+               }
+           }
+
+#ifdef __EXPERIMENTAL__
+           if (lspanssi) {
+               /*  multi-stage VQ from Anssi Ramo OH3GDD */
+
+               lspanssi_quantise(lsps, lsps_, LPC_ORD, 5);
+               bw_expand_lsps(lsps_, LPC_ORD, 50.0, 100.0);                        
+               lsp_to_lpc(lsps_, ak, LPC_ORD);
+           }
+#endif
+
+           /* experimenting with non-linear LSP spacing to see if
+              it's just noticable */
+
+           if (lspjnd) {
+               for(i=0; i<LPC_ORD; i++)
+                   lsps_[i] = lsps[i];
+               locate_lsps_jnd_steps(lsps_, LPC_ORD);
+               lsp_to_lpc(lsps_, ak, LPC_ORD);
+           }
+
+           /* Another experiment with non-linear LSP spacing, this
+              time using a scaled version of mel frequency axis
+              warping.  The scaling is such that the integer output
+              can be directly sent over the channel.
+           */
+
+           if (lspmel) {
+               float f, f_;
+               float mel[LPC_ORD];
+               int   mel_indexes[LPC_ORD];
+
+               for(i=0; i<order; i++) {
+                   f = (4000.0/PI)*lsps[i];
+                   mel[i] = floor(2595.0*log10(1.0 + f/700.0) + 0.5);
+               }
+
+                #ifdef DUMP
+                dump_mel(mel, order);
+                #endif
+
+               encode_mels_scalar(mel_indexes, mel, 6);
+                #ifdef DUMP
+                dump_mel_indexes(mel_indexes, 6);
+                #endif
+               //decode_mels_scalar(mel, mel_indexes, 6);
+                
+                /* read in VQed lsp-mels from octave/melvq.m */
+
+                if (lspmelread) {
+                    int ret = fread(mel, sizeof(float), order, flspmel);
+                    assert(ret == order);
+                }
+                                
+                /* ensure no unstable filters after quantisation */
+
+                #define MEL_ROUND 50
+               for(i=1; i<order; i++) {
+                   if (mel[i] <= mel[i-1]) {
+                       mel[i]+=MEL_ROUND/2;
+                       mel[i-1]-=MEL_ROUND/2;
+                        i = 1;
+                    }
+               }
+                
+               for(i=0; i<order; i++) {
+                   f_ = 700.0*( pow(10.0, mel[i]/2595.0) - 1.0);
+                   lsps_[i] = f_*(PI/4000.0);
+               }
+               lsp_to_lpc(lsps_, ak, order);
+           }
+       
+           if (scalar_quant_Wo_e) {
+
+               e = decode_energy(encode_energy(e, E_BITS), E_BITS);
+                model.Wo = decode_Wo(encode_Wo(model.Wo, WO_BITS), WO_BITS);
+               model.L  = PI/model.Wo; /* if we quantise Wo re-compute L */
+           }
+
+           if (vector_quant_Wo_e) {
+
+               /* JVM's experimental joint Wo & LPC energy quantiser */
+
+               quantise_WoE(&model, &e, Woe_);
+           }
+            
+       }
+
+       /*------------------------------------------------------------*\
+
+          Synthesise and optional decimation to 20 or 40ms frame rate
+
+       \*------------------------------------------------------------*/
+
+        /* 
+           if decimate == 2, we interpolate frame n from frame n-1 and n+1
+           if decimate == 4, we interpolate frames n, n+1, n+2, from frames n-1 and n+3
+
+           This is meant to give identical results to the implementations of various modes
+           in codec2.c
+        */
+
+        /* delay line to keep frame by frame voicing decisions */
+
+        for(i=0; i<decimate-1; i++)
+            model_dec[i] = model_dec[i+1];
+        model_dec[decimate-1] = model;
+
+        if ((frames % decimate) == 0) {
+            for(i=0; i<order; i++)
+                lsps_dec[decimate-1][i] = lsps_[i];
+            e_dec[decimate-1] = e;
+            model_dec[decimate-1] = model;
+
+            /* interpolate the model parameters */
+
+            weight_inc = 1.0/decimate;
+            for(i=0, weight=weight_inc; i<decimate-1; i++, weight += weight_inc) {
+                //model_dec[i].voiced = model_dec[decimate-1].voiced;
+                interpolate_lsp_ver2(&lsps_dec[i][0], prev_lsps_dec, &lsps_dec[decimate-1][0], weight, order);
+                interp_Wo2(&model_dec[i], &prev_model_dec, &model_dec[decimate-1], weight);
+                e_dec[i] = interp_energy2(prev_e_dec, e_dec[decimate-1],weight);
+            }
+
+            /* then recover spectral amplitudes and synthesise */    
+
+            for(i=0; i<decimate; i++) {
+                if (lpc_model) {
+                    lsp_to_lpc(&lsps_dec[i][0], &ak_dec[i][0], order);                
+                    aks_to_M2(fft_fwd_cfg, &ak_dec[i][0], order, &model_dec[i], e_dec[i], 
+                              &snr, 0, simlpcpf, lpcpf, 1, LPCPF_BETA, LPCPF_GAMMA, Aw);
+                    apply_lpc_correction(&model_dec[i]);
+                    sum_snr += snr;
+                    #ifdef DUMP
+                    dump_lsp_(&lsps_dec[i][0]);
+                    dump_ak_(&ak_dec[i][0], order);
+                    dump_quantised_model(&model_dec[i]);
+                    #endif
+                }
+
+                if (phase0)
+                    phase_synth_zero_order(fft_fwd_cfg, &model_dec[i], ex_phase, Aw);  
+                synth_one_frame(fft_inv_cfg, buf, &model_dec[i], Sn_, Pn, prede, &de_mem, gain);
+                if (fout != NULL) fwrite(buf,sizeof(short),N,fout);
+            }
+                    /*
+            for(i=0; i<decimate; i++) {
+                    printf("%d Wo: %f L: %d v: %d\n", frames, model_dec[i].Wo, model_dec[i].L, model_dec[i].voiced);
+            }
+            if (frames == 4*50)
+                exit(0);
+                    */
+            /* update memories for next frame ----------------------------*/
+
+            prev_model_dec = model_dec[decimate-1];
+            prev_e_dec = e_dec[decimate-1];
+            for(i=0; i<LPC_ORD; i++)
+                prev_lsps_dec[i] = lsps_dec[decimate-1][i];        
+       }
+
+    }
+
+    /*----------------------------------------------------------------*\
+
+                            End Main Loop
+
+    \*----------------------------------------------------------------*/
+
+    fclose(fin);
+
+    if (fout != NULL)
+       fclose(fout);
+
+    if (lpc_model)
+       fprintf(stderr, "SNR av = %5.2f dB\n", sum_snr/frames);
+
+    if (phaseexp)
+       phase_experiment_destroy(pexp);
+    if (ampexp)
+       amp_experiment_destroy(aexp);
+    #ifdef DUMP
+    if (dump)
+       dump_off();
+    #endif
+
+    if (hand_voicing)
+       fclose(fvoicing);
+
+    nlp_destroy(nlp_states);
+
+    return 0;
+}
+
+void synth_one_frame(kiss_fft_cfg fft_inv_cfg, short buf[], MODEL *model, float Sn_[], float Pn[], int prede, float *de_mem, float gain)
+{
+    int     i;
+
+    synthesise(fft_inv_cfg, Sn_, model, Pn, 1);
+    if (prede)
+        de_emp(Sn_, Sn_, de_mem, N);   
+
+    for(i=0; i<N; i++) {
+       Sn_[i] *= gain;
+       if (Sn_[i] > 32767.0)
+           buf[i] = 32767;
+       else if (Sn_[i] < -32767.0)
+           buf[i] = -32767;
+       else
+           buf[i] = Sn_[i];
+    }
+
+}
+
+void print_help(const struct option* long_options, int num_opts, char* argv[])
+{
+       int i;
+       char *option_parameters;
+
+       fprintf(stderr, "\nCodec2 - low bit rate speech codec - Simulation Program\n"
+               "\thttp://rowetel.com/codec2.html\n\n"
+               "usage: %s [OPTIONS] <InputFile>\n\n"
+                "Options:\n"
+                "\t-o <OutputFile>\n", argv[0]);
+        for(i=0; i<num_opts-1; i++) {
+               if(long_options[i].has_arg == no_argument) {
+                       option_parameters="";
+               } else if (strcmp("lpc", long_options[i].name) == 0) {
+                       option_parameters = " <Order>";
+               } else if (strcmp("dec", long_options[i].name) == 0) {
+                       option_parameters = " <2|4>";
+               } else if (strcmp("hand_voicing", long_options[i].name) == 0) {
+                       option_parameters = " <VoicingFile>";
+               } else if (strcmp("dump_pitch_e", long_options[i].name) == 0) {
+                       option_parameters = " <Dump File>";
+               } else if (strcmp("rate", long_options[i].name) == 0) {
+                       option_parameters = " <3200|2400|1400|1300|1200>";
+               } else if (strcmp("dump", long_options[i].name) == 0) {
+                       option_parameters = " <DumpFilePrefix>";
+               } else {
+                       option_parameters = " <UNDOCUMENTED parameter>";
+               }
+               fprintf(stderr, "\t--%s%s\n", long_options[i].name, option_parameters);
+       }
+       exit(1);
+}
+
diff --git a/codec2/tags/0.4/src/codebook.c b/codec2/tags/0.4/src/codebook.c
new file mode 100644 (file)
index 0000000..70e1d2a
--- /dev/null
@@ -0,0 +1,245 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/lsp1.txt */
+static const float codes0[] = {
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600
+};
+  /* codebook/lsp2.txt */
+static const float codes1[] = {
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700
+};
+  /* codebook/lsp3.txt */
+static const float codes2[] = {
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250
+};
+  /* codebook/lsp4.txt */
+static const float codes3[] = {
+  700,
+  800,
+  900,
+  1000,
+  1100,
+  1200,
+  1300,
+  1400,
+  1500,
+  1600,
+  1700,
+  1800,
+  1900,
+  2000,
+  2100,
+  2200
+};
+  /* codebook/lsp5.txt */
+static const float codes4[] = {
+  950,
+  1050,
+  1150,
+  1250,
+  1350,
+  1450,
+  1550,
+  1650,
+  1750,
+  1850,
+  1950,
+  2050,
+  2150,
+  2250,
+  2350,
+  2450
+};
+  /* codebook/lsp6.txt */
+static const float codes5[] = {
+  1100,
+  1200,
+  1300,
+  1400,
+  1500,
+  1600,
+  1700,
+  1800,
+  1900,
+  2000,
+  2100,
+  2200,
+  2300,
+  2400,
+  2500,
+  2600
+};
+  /* codebook/lsp7.txt */
+static const float codes6[] = {
+  1500,
+  1600,
+  1700,
+  1800,
+  1900,
+  2000,
+  2100,
+  2200,
+  2300,
+  2400,
+  2500,
+  2600,
+  2700,
+  2800,
+  2900,
+  3000
+};
+  /* codebook/lsp8.txt */
+static const float codes7[] = {
+  2300,
+  2400,
+  2500,
+  2600,
+  2700,
+  2800,
+  2900,
+  3000
+};
+  /* codebook/lsp9.txt */
+static const float codes8[] = {
+  2500,
+  2600,
+  2700,
+  2800,
+  2900,
+  3000,
+  3100,
+  3200
+};
+  /* codebook/lsp10.txt */
+static const float codes9[] = {
+  2900,
+  3100,
+  3300,
+  3500
+};
+
+const struct lsp_codebook lsp_cb[] = {
+  /* codebook/lsp1.txt */
+  {
+    1,
+    4,
+    16,
+    codes0
+  },
+  /* codebook/lsp2.txt */
+  {
+    1,
+    4,
+    16,
+    codes1
+  },
+  /* codebook/lsp3.txt */
+  {
+    1,
+    4,
+    16,
+    codes2
+  },
+  /* codebook/lsp4.txt */
+  {
+    1,
+    4,
+    16,
+    codes3
+  },
+  /* codebook/lsp5.txt */
+  {
+    1,
+    4,
+    16,
+    codes4
+  },
+  /* codebook/lsp6.txt */
+  {
+    1,
+    4,
+    16,
+    codes5
+  },
+  /* codebook/lsp7.txt */
+  {
+    1,
+    4,
+    16,
+    codes6
+  },
+  /* codebook/lsp8.txt */
+  {
+    1,
+    3,
+    8,
+    codes7
+  },
+  /* codebook/lsp9.txt */
+  {
+    1,
+    3,
+    8,
+    codes8
+  },
+  /* codebook/lsp10.txt */
+  {
+    1,
+    2,
+    4,
+    codes9
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebook/dlsp1.txt b/codec2/tags/0.4/src/codebook/dlsp1.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp10.txt b/codec2/tags/0.4/src/codebook/dlsp10.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp2.txt b/codec2/tags/0.4/src/codebook/dlsp2.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp3.txt b/codec2/tags/0.4/src/codebook/dlsp3.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp4.txt b/codec2/tags/0.4/src/codebook/dlsp4.txt
new file mode 100644 (file)
index 0000000..4a5e990
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+250
+300
+350
+400
+450
+500
+550
+600
+650
+700
+750
+800
+850
+900
+950
+1000
+1050
+1100
+1150
+1200
+1250
+1300
+1350
+1400
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp5.txt b/codec2/tags/0.4/src/codebook/dlsp5.txt
new file mode 100644 (file)
index 0000000..4a5e990
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+250
+300
+350
+400
+450
+500
+550
+600
+650
+700
+750
+800
+850
+900
+950
+1000
+1050
+1100
+1150
+1200
+1250
+1300
+1350
+1400
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp6.txt b/codec2/tags/0.4/src/codebook/dlsp6.txt
new file mode 100644 (file)
index 0000000..4a5e990
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+250
+300
+350
+400
+450
+500
+550
+600
+650
+700
+750
+800
+850
+900
+950
+1000
+1050
+1100
+1150
+1200
+1250
+1300
+1350
+1400
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp7.txt b/codec2/tags/0.4/src/codebook/dlsp7.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp8.txt b/codec2/tags/0.4/src/codebook/dlsp8.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/dlsp9.txt b/codec2/tags/0.4/src/codebook/dlsp9.txt
new file mode 100644 (file)
index 0000000..058d048
--- /dev/null
@@ -0,0 +1,35 @@
+1 32
+25
+50
+75
+100
+125
+150
+175
+200
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
+725
+750
+775
+800
+
+
diff --git a/codec2/tags/0.4/src/codebook/gecb.txt b/codec2/tags/0.4/src/codebook/gecb.txt
new file mode 100644 (file)
index 0000000..4bd18e8
--- /dev/null
@@ -0,0 +1,257 @@
+2 256
+2.709998 12.018395 
+0.046750 -2.738813 
+0.120993 8.388947 
+-1.580275 -0.892307 
+1.193065 -1.915609 
+0.187101 -3.276788 
+0.332251 -7.664550 
+-1.479436 31.246122 
+1.527612 27.709463 
+-0.524379 5.250122 
+0.553330 7.438797 
+-0.843451 -1.952987 
+2.263885 8.610286 
+0.143143 2.365493 
+0.616506 1.284268 
+-1.711327 22.096672 
+1.008128 17.396519 
+-0.106718 1.418905 
+-0.136246 14.273605 
+-1.709087 -20.531881 
+1.657866 -3.391068 
+0.138049 -4.957845 
+0.536729 -1.943748 
+0.196307 36.851948 
+1.272479 22.556494 
+-0.670219 -1.906045 
+0.382092 6.401132 
+-0.756911 -4.901017 
+1.829313 4.613800 
+0.318794 0.736830 
+0.612815 -2.075045 
+-0.410151 24.787077 
+1.776016 13.190924 
+0.106457 -0.104492 
+0.192206 10.183844 
+-1.824423 -7.715654 
+0.931346 4.348355 
+0.308813 -4.086001 
+0.397143 -11.808859 
+-0.048715 41.227314 
+0.877342 35.850311 
+-0.759794 0.476634 
+0.978593 7.674673 
+-1.195056 3.038826 
+2.639894 -3.411063 
+0.191127 3.603507 
+0.402932 1.084298 
+-2.152022 18.107616 
+1.546802 8.322713 
+-0.143089 -4.075922 
+-0.150142 5.866741 
+-1.408444 -3.250696 
+1.566148 -10.413164 
+0.178171 -10.226697 
+0.362164 -0.028556 
+-0.070125 24.390722 
+0.594752 17.482765 
+-0.286980 -6.904069 
+0.464818 10.205451 
+-1.006841 -14.357209 
+2.329569 -3.691613 
+0.335745 2.407139 
+1.019658 -3.155647 
+-1.259455 7.991899 
+2.383695 19.680567 
+-0.094947 -2.413742 
+0.209330 6.664768 
+-2.221034 1.379860 
+1.292387 2.046333 
+0.243626 -0.890741 
+0.428773 -7.193658 
+-1.113744 41.341354 
+2.609799 31.140514 
+-0.446468 2.534188 
+0.490104 4.627575 
+-1.117226 -3.241744 
+1.791562 8.414926 
+0.156012 0.183336 
+0.532447 3.154545 
+-0.764484 18.513958 
+0.952395 11.771298 
+-0.332567 0.346987 
+0.202165 14.716752 
+-2.129240 -15.558954 
+1.353583 -1.926790 
+-0.010963 -16.336386 
+0.399053 -2.790569 
+0.750657 31.148336 
+0.655743 24.481859 
+-0.453210 -0.735879 
+0.286900 6.546703 
+-0.715673 -12.357815 
+1.548488 3.872171 
+0.271874 0.802339 
+0.502073 -4.854850 
+-0.497037 17.761904 
+1.191161 13.954446 
+0.015630 1.331566 
+0.341867 8.935369 
+-2.316009 -5.395058 
+0.758610 1.964505 
+0.241320 -3.237686 
+0.267151 -11.234388 
+-0.273126 32.624771 
+1.753523 40.431995 
+-0.784011 3.045757 
+0.705987 5.661178 
+-1.386400 1.353557 
+2.376458 1.674851 
+0.242973 4.732178 
+0.491227 0.354061 
+-1.606762 8.658955 
+1.167111 5.987103 
+-0.137601 -12.041750 
+-0.251375 10.397204 
+-1.431514 -8.904108 
+0.988280 -13.208963 
+0.261484 -6.354970 
+0.395932 -0.702529 
+0.283704 26.899563 
+0.420959 15.441778 
+-0.355804 -13.727784 
+0.527372 12.398515 
+-1.169559 -15.998457 
+1.906688 -5.816055 
+0.354492 3.851572 
+0.825760 -4.162642 
+-0.490190 13.057229 
+2.255773 13.526449 
+-0.004956 -3.237127 
+0.026709 7.866448 
+-1.810372 -0.451183 
+1.083827 -0.183620 
+0.135836 -2.266582 
+0.375812 -5.512248 
+-1.966443 38.682854 
+1.977988 24.565481 
+-0.704656 6.358810 
+0.480786 7.051749 
+-0.976417 -2.422727 
+2.502148 6.759346 
+0.083588 3.258795 
+0.543629 0.910013 
+-1.231959 23.091507 
+0.785492 14.807000 
+-0.213554 1.688002 
+0.004748 18.171820 
+-1.547192 -16.116837 
+1.501045 -3.281141 
+0.080133 -4.634724 
+0.476592 -2.180929 
+0.442470 40.303989 
+1.072766 27.592009 
+-0.594738 -4.166807 
+0.422480 7.616091 
+-0.927521 -7.274406 
+1.991623 1.296359 
+0.291307 2.398781 
+0.721081 -1.950625 
+-0.804256 24.929474 
+1.648388 19.119692 
+0.060852 -0.590639 
+0.266085 9.103249 
+-1.957399 -2.884607 
+1.116929 2.672397 
+0.354580 -2.748541 
+0.330733 -14.156131 
+-0.527851 39.575626 
+0.991152 43.194984 
+-0.589619 1.269186 
+0.787401 8.730713 
+-1.013800 1.025075 
+2.825403 1.895381 
+0.240890 2.745566 
+0.427195 2.544456 
+-1.953109 12.243958 
+1.448616 12.060747 
+-0.210492 -3.379058 
+-0.056713 10.204020 
+-1.652370 -5.102737 
+1.294748 -12.270802 
+0.111608 -8.675921 
+0.326634 -1.167627 
+0.021781 31.125782 
+0.455335 21.468430 
+-0.375440 -3.371207 
+0.393620 11.301987 
+-0.851456 -19.414892 
+2.107030 -2.228865 
+0.373233 1.924056 
+0.884438 -1.720581 
+-0.975127 9.840128 
+2.003303 17.395407 
+-0.036915 -1.111372 
+0.148456 5.399970 
+-1.914412 4.773819 
+1.447907 0.537122 
+0.194979 -1.038179 
+0.495771 -9.955025 
+-1.058987 32.947052 
+2.011222 32.454418 
+-0.309650 4.719106 
+0.436082 4.635524 
+-1.237105 -1.254284 
+2.022740 9.428345 
+0.190342 1.460767 
+0.479017 2.484788 
+-1.078483 16.221748 
+1.207642 9.654212 
+-0.258087 -1.672358 
+0.071852 13.415978 
+-1.877228 -16.072031 
+1.289568 -4.871185 
+0.067713 -13.442700 
+0.435551 -4.165503 
+0.466140 30.589535 
+0.904895 21.597990 
+-0.518369 -2.532048 
+0.337363 5.637264 
+-0.554975 -17.400511 
+1.691879 1.145742 
+0.227934 0.889297 
+0.587303 -5.729732 
+-0.262133 18.666620 
+1.395048 17.002878 
+-0.019090 4.308379 
+0.304235 12.669943 
+-2.074059 -6.460845 
+0.920546 1.212957 
+0.284927 -1.785466 
+0.209724 -16.023964 
+-0.636067 31.576820 
+1.349887 34.677502 
+-0.971625 5.300859 
+0.590249 4.449709 
+-1.567867 3.602385 
+2.145497 4.516663 
+0.296022 4.120170 
+0.445299 0.868772 
+-1.441931 14.128431 
+1.355752 6.007401 
+-0.012814 -7.496573 
+-0.430000 8.500124 
+-1.204693 -7.113256 
+1.101018 -6.836818 
+0.196463 -6.234002 
+0.436747 -1.129788 
+0.141052 22.854876 
+0.290821 18.811443 
+-0.529536 -7.732510 
+0.634280 10.789847 
+-1.334721 -20.325773 
+1.815645 -1.903316 
+0.394778 3.797577 
+0.732682 -8.183819 
+-0.741244 11.768337 
diff --git a/codec2/tags/0.4/src/codebook/lsp1.txt b/codec2/tags/0.4/src/codebook/lsp1.txt
new file mode 100644 (file)
index 0000000..d126be7
--- /dev/null
@@ -0,0 +1,17 @@
+1 16
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
diff --git a/codec2/tags/0.4/src/codebook/lsp10.txt b/codec2/tags/0.4/src/codebook/lsp10.txt
new file mode 100644 (file)
index 0000000..39aab7c
--- /dev/null
@@ -0,0 +1,6 @@
+1 4
+2900
+3100
+3300
+3500
+
diff --git a/codec2/tags/0.4/src/codebook/lsp2.txt b/codec2/tags/0.4/src/codebook/lsp2.txt
new file mode 100644 (file)
index 0000000..597f149
--- /dev/null
@@ -0,0 +1,17 @@
+1 16
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
diff --git a/codec2/tags/0.4/src/codebook/lsp3.txt b/codec2/tags/0.4/src/codebook/lsp3.txt
new file mode 100644 (file)
index 0000000..36a64b1
--- /dev/null
@@ -0,0 +1,17 @@
+1 16
+500
+550
+600
+650
+700
+750
+800
+850
+900
+950
+1000
+1050
+1100
+1150
+1200
+1250
diff --git a/codec2/tags/0.4/src/codebook/lsp4.txt b/codec2/tags/0.4/src/codebook/lsp4.txt
new file mode 100644 (file)
index 0000000..53a90bd
--- /dev/null
@@ -0,0 +1,17 @@
+1 16
+700
+800
+900
+1000
+1100
+1200
+1300
+1400
+1500
+1600
+1700
+1800
+1900
+2000
+2100
+2200
diff --git a/codec2/tags/0.4/src/codebook/lsp5.txt b/codec2/tags/0.4/src/codebook/lsp5.txt
new file mode 100644 (file)
index 0000000..94739b5
--- /dev/null
@@ -0,0 +1,19 @@
+1 16
+ 950
+1050
+1150
+1250
+1350
+1450
+1550
+1650
+1750
+1850
+1950
+2050
+2150
+2250
+2350
+2450
+
+
diff --git a/codec2/tags/0.4/src/codebook/lsp6.txt b/codec2/tags/0.4/src/codebook/lsp6.txt
new file mode 100644 (file)
index 0000000..992ea25
--- /dev/null
@@ -0,0 +1,19 @@
+1 16
+1100
+1200
+1300
+1400
+1500
+1600
+1700
+1800
+1900
+2000
+2100
+2200
+2300
+2400
+2500
+2600
+
+
diff --git a/codec2/tags/0.4/src/codebook/lsp7.txt b/codec2/tags/0.4/src/codebook/lsp7.txt
new file mode 100644 (file)
index 0000000..839cbfd
--- /dev/null
@@ -0,0 +1,19 @@
+1 16
+1500
+1600
+1700
+1800
+1900
+2000
+2100
+2200
+2300
+2400
+2500
+2600
+2700
+2800
+2900
+3000
+
+
diff --git a/codec2/tags/0.4/src/codebook/lsp8.txt b/codec2/tags/0.4/src/codebook/lsp8.txt
new file mode 100644 (file)
index 0000000..d9880c9
--- /dev/null
@@ -0,0 +1,11 @@
+1 8
+2300
+2400
+2500
+2600
+2700
+2800
+2900
+3000
+
+
diff --git a/codec2/tags/0.4/src/codebook/lsp8910.txt b/codec2/tags/0.4/src/codebook/lsp8910.txt
new file mode 100644 (file)
index 0000000..93cfdd8
--- /dev/null
@@ -0,0 +1,65 @@
+3 64
+2.048073  2.534502  2.645915  
+2.019670  2.269744  2.605462  
+1.961101  2.329646  2.562857  
+1.968573  2.532712  2.616918  
+2.183480  2.514381  2.629582  
+2.259379  2.516615  2.620410  
+2.172791  2.462460  2.567064  
+2.097666  2.303933  2.421685  
+2.052990  2.353242  2.546992  
+2.043642  2.232362  2.499262  
+2.106151  2.393131  2.488401  
+2.099167  2.437862  2.558655  
+2.013877  2.422875  2.530071  
+2.033848  2.483776  2.584598  
+2.114474  2.516856  2.602372  
+2.229214  2.584056  2.678855  
+2.131151  2.584299  2.674845  
+1.472721  2.477091  2.630241  
+2.010907  2.598415  2.682989  
+2.353653  2.524066  2.619773  
+2.419897  2.623938  2.699605  
+2.319080  2.602148  2.689044  
+1.860342  2.503881  2.616576  
+1.910517  2.386693  2.610126  
+1.748689  2.371809  2.496542  
+1.618495  2.403425  2.554956  
+1.844073  2.437026  2.533443  
+1.924810  2.388543  2.502698  
+1.937227  2.258363  2.501697  
+1.687554  2.209123  2.545239  
+1.851950  2.278628  2.565632  
+1.868154  2.330150  2.444883  
+1.874180  2.213118  2.351940  
+1.757311  2.030626  2.433836  
+1.650306  2.152371  2.243421  
+1.612794  1.884686  2.339313  
+1.745431  2.278895  2.389449  
+1.590923  2.304155  2.408510  
+1.475982  2.275548  2.509897  
+1.508695  2.045463  2.455520  
+1.872054  2.061777  2.246202  
+1.983947  2.159155  2.445535  
+1.745180  2.483765  2.593698  
+1.900116  2.079600  2.407479  
+1.841672  2.167042  2.486827  
+1.932912  2.148464  2.569850  
+2.134174  2.363673  2.584252  
+2.106094  2.450645  2.638417  
+1.954135  2.460313  2.666512  
+1.907634  2.573801  2.674025  
+1.625579  2.539569  2.656363  
+1.785866  2.572616  2.676082  
+1.798447  2.376454  2.624298  
+2.020033  2.397244  2.619868  
+1.946581  2.468791  2.564185  
+2.008920  2.342400  2.469132  
+1.983846  2.271044  2.395408  
+1.988039  2.154150  2.317920  
+2.077197  2.216622  2.389101  
+2.117255  2.283907  2.512242  
+2.177233  2.334622  2.458268  
+2.214655  2.425510  2.620013  
+2.199931  2.390272  2.520731  
+2.271755  2.448682  2.552649  
diff --git a/codec2/tags/0.4/src/codebook/lsp9.txt b/codec2/tags/0.4/src/codebook/lsp9.txt
new file mode 100644 (file)
index 0000000..7e159af
--- /dev/null
@@ -0,0 +1,11 @@
+1 8
+2500
+2600
+2700
+2800
+2900
+3000
+3100
+3200
+
+
diff --git a/codec2/tags/0.4/src/codebook/lspdt.txt b/codec2/tags/0.4/src/codebook/lspdt.txt
new file mode 100644 (file)
index 0000000..60ec9b6
--- /dev/null
@@ -0,0 +1,1025 @@
+10 1024
+0.030214  0.087393  0.142625  0.204661  0.257804  -0.327911  -0.183571  -0.089661  -0.082036  0.025268  
+-0.033840  -0.025382  -0.057646  -0.130479  -0.015028  0.079375  0.023958  -0.042556  0.025167  0.021076  
+-0.073420  -0.085623  -0.081920  -0.021710  0.198196  0.213754  0.075391  0.063551  0.148094  0.083181  
+-0.041674  -0.061116  0.004116  0.233349  0.204616  0.256279  0.009337  0.091744  0.269872  0.132698  
+0.052679  0.067955  -0.025147  -0.235718  -0.347647  -0.215019  -0.083526  -0.130404  -0.047058  -0.054917  
+0.092221  0.063837  -0.170673  -0.451538  -0.521231  -0.416413  -0.184510  -0.192721  -0.288125  -0.164375  
+0.006250  0.010339  0.023315  0.024258  0.142234  -0.023847  -0.063944  -0.036040  -0.024266  -0.035798  
+-0.020755  -0.016434  0.023770  0.104903  0.239031  0.135658  0.065827  0.089679  0.036949  0.038796  
+0.001522  -0.000005  -0.007255  0.023717  0.061706  0.088603  0.132864  0.102913  0.070440  0.039429  
+0.001258  0.000603  0.009813  -0.001694  0.005052  0.011061  0.010448  0.056755  0.026658  0.027529  
+0.004858  0.005431  0.002243  0.029427  0.009784  -0.059830  -0.056032  -0.073592  -0.040853  -0.021115  
+-0.002325  -0.002455  -0.001604  -0.003935  0.006266  -0.017584  -0.006597  -0.081987  -0.029412  -0.020403  
+0.003736  0.007595  0.003562  0.002215  0.038401  0.037702  0.057607  0.034182  0.061992  0.048736  
+0.004115  0.003260  0.006737  0.006828  0.006008  0.017779  0.052389  0.095893  0.035851  0.020458  
+0.004843  0.003379  -0.002271  0.004288  -0.016977  -0.071627  0.001830  -0.009209  -0.058428  -0.015245  
+0.003678  0.005406  -0.012417  -0.039528  -0.027589  -0.087800  -0.041500  -0.100739  -0.090422  -0.098089  
+-0.006186  -0.001434  -0.000199  0.014062  -0.004642  -0.003832  -0.055350  -0.074491  -0.108642  -0.095712  
+-0.062269  -0.084747  -0.093203  0.112714  0.168813  0.101357  -0.009236  0.035940  0.011374  0.010907  
+-0.038490  -0.040302  -0.031450  0.072307  0.185540  0.151074  0.158257  0.172376  0.166965  0.130124  
+0.024048  0.030137  0.067105  0.160669  0.280202  0.278831  -0.002242  -0.103298  -0.003234  -0.000831  
+0.008185  -0.000241  -0.014130  -0.061306  -0.110704  -0.109917  -0.202806  -0.452824  -0.041963  -0.019083  
+-0.033700  -0.101513  -0.377325  -0.378713  -0.270962  -0.241062  0.104950  0.068237  -0.095025  -0.089500  
+-0.183828  -0.244672  -0.355586  -0.243172  -0.240034  -0.087034  0.217483  0.165276  -0.008586  0.016224  
+0.060764  0.066368  0.055613  0.148443  0.151302  0.049670  -0.047198  -0.126028  0.102264  0.107377  
+0.140469  0.157391  0.161672  0.291984  0.153641  0.206359  0.231297  -0.073781  -0.033312  0.032766  
+0.037540  0.039307  0.047739  0.107267  0.132807  0.107693  0.042636  -0.020420  -0.007591  0.008364  
+0.002125  0.003080  0.000635  0.016240  0.059410  -0.006820  -0.024315  0.045605  0.005290  0.013830  
+0.001139  0.003902  -0.012139  -0.035295  -0.049090  -0.084221  -0.087992  0.088975  -0.009197  -0.025713  
+0.001317  -0.001288  0.003646  -0.006079  -0.003929  -0.018558  -0.039808  -0.029046  -0.076413  -0.005992  
+-0.001049  -0.001621  0.017015  -0.009393  -0.008427  0.037335  0.028549  0.022359  0.064850  0.021301  
+0.002963  -0.003009  0.009769  0.088745  0.016440  0.046255  0.050722  0.016491  0.102227  0.050278  
+0.000385  0.004489  -0.005224  0.040397  0.015902  -0.044661  -0.134052  -0.164920  -0.013437  0.018856  
+0.000290  -0.014145  -0.104000  -0.098790  -0.086725  -0.130471  -0.147043  -0.075812  -0.148688  -0.129942  
+0.003604  -0.001264  -0.025302  -0.034198  -0.106991  0.017613  0.131491  0.142840  -0.079925  -0.049736  
+0.017871  0.046436  0.144657  0.014979  0.031321  0.118093  0.144907  0.171921  -0.007429  0.020121  
+0.142113  0.303403  0.318919  -0.068887  0.044887  0.169177  0.174048  0.135839  0.202516  0.173113  
+-0.029056  -0.028800  0.024667  0.151956  0.143322  0.182400  0.182489  0.061789  0.433122  0.337578  
+-0.028250  -0.053393  -0.035536  0.350750  0.353500  -0.226571  -0.259464  0.038214  -0.015607  -0.023786  
+0.046375  0.008135  -0.162187  -0.193417  0.024875  -0.111500  -0.262979  -0.088667  -0.355750  -0.246906  
+-0.009274  0.006357  0.017345  -0.232327  -0.217667  -0.057851  -0.091655  -0.007185  -0.045440  -0.041536  
+-0.012885  -0.008218  -0.020385  -0.037269  -0.156679  0.011269  0.055346  -0.146987  0.100295  0.142756  
+0.005348  -0.001366  -0.027875  0.004330  -0.023464  -0.004911  -0.020777  -0.216223  -0.080589  -0.144991  
+0.009843  0.011329  0.028114  -0.003471  0.016571  0.057543  0.073629  -0.089014  0.018186  -0.106900  
+-0.001929  -0.013671  0.019657  0.021129  0.096800  0.106571  0.054843  0.074429  0.010871  0.280614  
+-0.014482  -0.008564  -0.019482  -0.051300  -0.020509  -0.035591  0.020536  0.039991  0.078036  0.278591  
+0.000642  -0.000081  -0.000885  -0.022764  -0.011689  0.014764  -0.015169  -0.002595  0.001311  -0.189811  
+0.002994  0.009073  0.002983  -0.006096  -0.004567  -0.008534  -0.067904  -0.029798  -0.104129  -0.246034  
+0.032685  0.027630  0.024074  0.079759  0.095704  -0.028565  0.018815  0.037528  -0.002676  0.038213  
+0.009344  0.011533  0.016039  0.052300  0.033783  0.042361  0.019544  0.017133  0.100200  0.159617  
+-0.001124  0.002658  0.005416  0.011698  0.014386  -0.031792  -0.046644  -0.050950  0.071530  0.002807  
+0.008698  0.022123  -0.003025  0.021395  -0.003148  -0.121864  -0.001346  -0.023710  0.186920  0.047278  
+-0.006202  -0.000833  -0.039193  -0.118149  -0.047640  -0.050868  0.046018  0.032368  0.254702  0.106246  
+-0.027820  -0.044190  0.017040  -0.094260  -0.087840  0.088060  0.009070  -0.032400  -0.270150  -0.055890  
+-0.011581  -0.025468  0.025290  -0.017984  0.153194  0.222645  0.073710  0.045758  -0.472597  -0.306532  
+-0.014798  -0.020808  -0.008481  0.007394  -0.031663  0.104115  0.064538  0.072702  -0.218635  -0.153481  
+0.027705  0.091167  0.045423  0.146718  0.020526  -0.143910  0.073154  0.128346  0.529487  0.308731  
+0.030128  0.035233  -0.070384  -0.018698  -0.075535  -0.220372  -0.079291  -0.111209  0.256581  0.101105  
+-0.004150  -0.008144  -0.006750  0.004239  0.028372  -0.001983  -0.040928  -0.019661  -0.338700  -0.169967  
+-0.004707  -0.006595  0.004500  0.026767  -0.029819  0.169034  -0.002560  0.033819  -0.088190  -0.050612  
+-0.006173  0.002647  -0.001513  -0.015320  0.010533  0.053747  0.082887  0.059393  0.183313  0.057387  
+-0.000616  -0.004636  0.006606  0.024414  0.051409  0.021773  0.060692  -0.006798  -0.043394  -0.038828  
+-0.008696  -0.000618  0.042500  0.037216  0.071137  -0.060206  0.015157  -0.015108  -0.045157  -0.016010  
+0.007144  0.005253  0.010336  0.010548  0.009610  -0.013199  -0.071445  0.067541  -0.007733  -0.059884  
+0.000036  0.002778  -0.003443  -0.009706  -0.047371  -0.014098  -0.101768  -0.080778  -0.068814  -0.051469  
+0.003981  0.007944  0.004537  -0.030662  -0.110694  -0.136056  -0.114219  -0.178281  -0.146781  -0.054756  
+0.018125  0.014090  -0.006389  0.069208  -0.085715  -0.056646  0.058569  0.044424  0.070618  0.039938  
+0.003460  0.000508  0.014437  0.031119  -0.038722  0.008254  0.073587  0.122825  0.189159  0.163968  
+-0.008440  -0.013664  -0.024448  -0.034284  -0.116739  0.058746  -0.085433  -0.144358  -0.008843  0.005045  
+-0.014613  -0.019969  -0.015219  -0.052462  0.007394  0.052406  -0.003019  0.003319  -0.151588  -0.158712  
+-0.005918  -0.001090  0.014866  -0.032642  0.009075  -0.008806  0.190575  0.273537  -0.036231  -0.026127  
+0.012026  0.021332  0.014184  0.012795  0.060216  0.034547  0.069368  0.168979  0.131626  0.105816  
+-0.003224  0.001730  -0.013697  -0.012401  0.010480  0.043882  -0.202132  -0.213039  -0.017875  -0.005474  
+0.002079  -0.002329  -0.014679  0.042800  -0.053314  -0.068564  -0.097750  -0.222214  -0.053271  -0.046371  
+0.002171  0.004986  0.011274  0.009952  0.005562  -0.001692  0.073185  -0.143664  0.102568  0.088301  
+-0.012564  0.010821  -0.012821  -0.029090  0.047154  0.091513  -0.049474  0.180192  0.086333  0.017423  
+0.002909  -0.028327  -0.148755  -0.080791  -0.206173  -0.356100  -0.022609  -0.061236  -0.157227  -0.113336  
+-0.079046  -0.172583  -0.199454  -0.048157  -0.225296  -0.309278  -0.112435  -0.235102  -0.046222  0.006269  
+-0.045984  0.018047  0.164258  0.202680  0.263172  0.566937  0.206742  0.329023  0.292391  0.123086  
+0.019192  0.112609  0.335853  0.302641  0.400333  0.472173  0.329000  0.377808  0.018436  0.015635  
+0.026673  0.004462  -0.162096  0.037442  0.079019  -0.215942  -0.060442  -0.189962  -0.162654  -0.052058  
+0.022508  -0.090762  -0.239238  -0.171444  -0.440913  -0.380135  -0.159310  -0.258468  -0.129913  -0.088238  
+-0.028069  -0.014437  -0.010850  -0.050656  -0.285669  -0.268906  -0.101344  -0.029094  -0.023888  -0.023181  
+0.004862  0.006414  0.001345  -0.063621  -0.052741  -0.180931  -0.238224  0.173172  -0.092862  -0.104207  
+0.004697  0.026947  0.086934  0.072974  0.262303  0.283618  -0.096250  0.027066  0.188803  0.149026  
+-0.030421  -0.042868  -0.039697  -0.017447  0.021250  0.061789  0.107342  -0.302829  0.010276  0.037605  
+-0.002333  0.000385  -0.012577  -0.066256  -0.013564  -0.019269  -0.036936  -0.418756  -0.123474  -0.102654  
+0.008575  0.004952  0.005500  0.052904  0.022890  -0.023158  0.154486  0.176897  -0.002651  0.045822  
+-0.010061  -0.004970  0.027457  0.013524  0.049537  0.110189  0.103811  0.291598  0.041030  0.020659  
+-0.010786  0.000000  -0.026364  -0.123214  -0.022757  -0.047179  -0.121571  -0.019329  -0.032657  0.011214  
+-0.011300  -0.010793  -0.028993  -0.133667  -0.052173  -0.109933  -0.172947  -0.209893  -0.044780  0.033867  
+-0.000296  0.002438  0.000217  0.048783  -0.025752  -0.011934  0.048301  0.018323  -0.006841  -0.006119  
+-0.019991  -0.026871  0.043069  0.164517  0.080086  0.197466  0.212026  0.240767  0.076388  -0.010440  
+0.021657  0.030662  0.048081  0.141298  0.130939  0.132485  0.191273  0.032157  -0.015273  -0.007192  
+0.007325  0.011669  -0.012494  -0.100969  -0.153569  -0.106119  -0.121781  -0.157719  0.033100  0.027981  
+-0.020244  -0.020987  0.002609  -0.130609  -0.150897  -0.197853  -0.238596  -0.012750  -0.034442  -0.025506  
+0.003443  0.006460  0.003278  0.014966  0.037915  0.007864  -0.006432  0.067182  -0.049813  -0.092665  
+-0.007296  -0.004959  0.010561  0.022714  0.059469  0.054949  0.248225  -0.023347  -0.184122  -0.075653  
+-0.076207  -0.095685  -0.078185  0.012696  0.049402  0.032489  0.050826  0.081348  0.123554  0.104446  
+0.033461  0.077447  0.156368  0.110447  0.152500  0.047816  -0.081474  0.154829  0.174026  0.149316  
+-0.015549  0.010430  0.074415  0.118507  0.195859  0.269563  -0.010204  0.049169  0.015049  -0.026859  
+0.040961  0.062588  0.039324  0.109118  0.247696  0.324627  0.319804  -0.049529  -0.021539  -0.003265  
+0.043783  0.026833  0.085183  0.210517  -0.340767  -0.259850  0.112733  0.034617  0.036000  0.067850  
+0.083529  0.079779  0.005183  -0.208740  -0.354154  -0.443635  -0.417827  0.039221  -0.039269  -0.078413  
+0.021417  0.026286  0.001595  -0.051750  -0.054988  -0.357821  -0.359548  -0.067250  -0.058357  -0.043310  
+-0.018575  -0.013198  0.025019  0.058547  0.056660  0.223057  -0.061415  0.017830  0.007094  -0.060821  
+0.001306  -0.001291  0.017164  0.053478  -0.007545  0.118478  0.178015  0.100440  -0.004933  -0.053530  
+-0.001737  -0.002491  0.000614  0.058211  0.043728  0.023728  0.111026  0.098482  -0.078500  -0.067474  
+0.004230  0.005440  0.003488  0.008855  -0.008145  -0.014681  -0.009133  0.045972  0.163347  0.068315  
+-0.010959  -0.005849  -0.007315  -0.014390  0.006158  0.090856  -0.012445  0.022890  0.158986  0.056925  
+0.000749  -0.001213  -0.006018  -0.004422  -0.009865  -0.007207  -0.017749  -0.000249  -0.092991  -0.109251  
+0.005029  -0.005757  -0.004360  -0.009669  -0.008691  -0.071544  -0.097934  -0.110368  -0.185699  0.011404  
+-0.007715  0.003778  -0.031069  -0.036444  -0.025951  -0.044931  -0.047000  -0.135299  0.146458  0.088236  
+0.001761  0.000421  0.007793  0.012389  0.010661  0.025464  0.009525  0.012075  0.122568  0.020621  
+0.001769  0.004204  0.008458  0.013602  -0.004023  0.019630  0.023745  0.041588  -0.088407  -0.073875  
+0.004633  0.004633  0.020223  -0.006181  0.021078  0.115759  0.078301  0.039090  -0.092398  -0.076898  
+-0.002416  -0.001845  0.000173  -0.038956  0.011274  0.029049  0.065712  0.009987  0.029796  0.005615  
+-0.002492  -0.004292  -0.031175  -0.060358  -0.026058  -0.109742  -0.029850  -0.074383  -0.080908  0.042942  
+-0.002215  -0.002694  -0.002368  0.008698  -0.017256  -0.012021  -0.009492  0.009773  -0.044764  0.018318  
+-0.023070  -0.002325  -0.026219  0.008693  -0.018991  0.021789  0.004035  0.107798  0.332026  0.079456  
+0.000155  -0.001041  -0.008629  -0.012809  -0.005175  0.001830  -0.000088  0.085892  0.085634  0.039732  
+-0.008221  -0.024926  -0.014309  0.013941  -0.022912  -0.097382  -0.000265  -0.141250  -0.313073  0.018647  
+0.002872  -0.003733  -0.009488  0.016860  -0.040814  -0.091547  0.116430  -0.175616  -0.024884  0.040326  
+-0.008020  0.021970  0.088080  0.111170  0.057580  0.171240  0.092760  0.302830  0.373290  0.143470  
+-0.016063  -0.022650  0.036400  -0.175538  -0.357975  -0.198500  -0.256112  -0.126062  0.144225  0.100450  
+0.075009  0.047603  -0.037655  -0.129095  -0.251948  -0.360069  -0.312207  -0.445293  -0.496000  -0.212534  
+-0.032464  -0.028929  -0.006339  0.207125  0.557589  0.518964  0.543321  0.249214  -0.000589  0.026018  
+-0.054765  0.032643  0.199878  0.324673  0.502725  0.640980  0.604908  0.581459  0.316602  0.184429  
+0.115611  0.119583  -0.062069  -0.135861  -0.395542  -0.371653  -0.019708  -0.018028  0.313139  0.152028  
+0.054066  0.018539  -0.058382  -0.216724  -0.636342  -0.630671  -0.271105  -0.194711  0.044303  0.016355  
+0.060100  0.045158  0.113933  0.056442  0.023808  -0.021950  -0.399325  -0.126858  -0.111158  -0.110000  
+0.025462  0.025667  0.060218  0.078923  0.231410  0.120885  -0.330885  -0.370833  -0.307731  -0.152218  
+-0.010160  -0.013991  -0.024783  -0.012509  0.003821  0.062425  0.184236  -0.088340  -0.045774  -0.025868  
+-0.027839  -0.005367  0.082450  0.116321  0.161436  0.232105  0.309069  0.377041  0.202248  0.091963  
+-0.028529  -0.008750  -0.003904  -0.076702  0.130596  0.250337  0.239163  0.413154  0.135740  0.016308  
+-0.032553  -0.029079  0.012000  -0.010605  0.068842  0.005237  -0.262474  0.205684  -0.058632  -0.013079  
+0.038676  0.039985  0.026735  0.179235  0.105368  -0.038294  -0.291868  -0.364471  0.002426  0.050265  
+0.082714  0.051690  0.067024  0.003524  -0.244452  0.071381  0.217595  -0.169405  0.056619  0.101190  
+-0.014476  -0.009119  -0.074310  -0.216810  -0.273786  -0.212286  0.358714  0.308857  -0.015429  0.012619  
+0.055256  0.077333  0.025308  0.062231  0.184090  -0.211680  0.056308  0.154897  0.052615  0.041731  
+0.016750  -0.006848  -0.039634  0.201089  0.167759  0.022482  0.016536  0.019232  0.241009  0.112500  
+-0.031711  -0.053316  -0.067474  -0.301500  -0.215763  0.395053  0.006316  -0.019132  -0.259737  -0.234632  
+-0.033432  -0.059386  0.019295  -0.121341  -0.094205  0.239114  -0.043330  -0.044818  -0.353034  -0.236864  
+0.089880  0.101220  0.058980  0.407420  0.200060  -0.299180  -0.042020  -0.004800  0.348860  0.226780  
+0.063535  0.105081  -0.007512  0.121267  0.036744  -0.301674  0.020547  0.087756  0.279884  0.140686  
+-0.036721  -0.075988  -0.116081  -0.208663  -0.207733  0.048419  0.044802  -0.027035  -0.141651  -0.105349  
+-0.028942  -0.024733  -0.114267  -0.168860  0.001767  0.024430  -0.182547  0.006686  0.003116  0.012442  
+-0.010038  -0.007665  -0.017722  -0.016968  -0.001627  -0.027013  -0.216025  -0.041468  0.037778  0.051987  
+0.002445  0.000783  0.004083  0.035189  0.009283  -0.014559  0.097984  -0.008587  0.066528  0.081354  
+-0.001479  0.004418  0.038329  0.046507  0.011096  0.003842  0.252521  0.015459  0.023130  0.096048  
+0.000695  -0.002314  0.000295  -0.005229  -0.000771  0.037271  -0.112343  0.036733  -0.082638  -0.066776  
+0.005429  -0.000423  -0.015468  0.016917  0.006423  0.007667  -0.216154  -0.041026  -0.113365  -0.150474  
+0.002106  0.000589  0.001199  0.014114  -0.001144  0.009093  -0.022373  -0.010568  -0.001915  -0.092614  
+-0.007700  -0.009280  0.004070  0.005150  0.014830  0.006340  0.147690  0.018210  0.104050  0.000040  
+-0.018965  -0.031535  -0.027744  -0.002988  -0.064337  -0.003465  0.084384  0.036512  0.074326  -0.066721  
+-0.001037  0.001463  -0.032152  -0.024066  -0.009885  -0.038361  -0.027086  -0.071250  0.012451  -0.019582  
+0.000221  -0.003004  0.008726  -0.003018  0.005336  0.011566  0.030712  0.007863  0.038854  0.107819  
+-0.001273  -0.002756  0.004256  0.000318  -0.005261  0.040545  0.000835  0.036057  -0.047239  0.077119  
+-0.001737  -0.003442  -0.007500  -0.003781  -0.017844  -0.035866  -0.074321  -0.000629  -0.064170  -0.047701  
+-0.000865  -0.001496  0.000354  -0.007527  0.041396  -0.031923  -0.006762  -0.033335  -0.018812  -0.025296  
+0.004362  0.001993  0.008519  0.001571  0.017772  -0.017836  0.074396  0.044884  0.014146  0.013418  
+0.005041  0.003486  0.002358  0.030174  0.004454  -0.017583  0.066216  0.011294  -0.018147  0.049486  
+0.098609  0.056130  -0.083848  0.065065  0.035913  -0.070478  0.000326  -0.083761  0.033696  0.087087  
+-0.006835  -0.006643  -0.002096  0.013983  -0.004148  0.007100  -0.049617  -0.069874  0.144304  0.050204  
+-0.036358  -0.027594  0.042113  0.034425  0.020057  0.114915  -0.039651  -0.027500  0.117424  0.033953  
+-0.036453  -0.048538  -0.012575  -0.072726  0.092472  0.117302  0.013311  -0.088906  -0.205519  -0.027972  
+0.080906  0.049094  -0.253469  -0.093781  0.050094  0.012375  0.052594  -0.018031  -0.266562  -0.083219  
+0.037921  0.053237  0.031947  0.055237  -0.065842  -0.081947  -0.089368  0.034605  0.020500  -0.208053  
+0.051783  0.166457  0.347870  0.082783  -0.110196  -0.038891  0.095239  0.377783  0.013913  -0.021783  
+-0.000538  0.005625  0.035154  -0.008760  0.017404  0.027721  0.112288  0.256471  0.104548  0.212971  
+-0.026529  -0.052029  -0.034824  0.046559  0.129794  0.208882  -0.038324  -0.364971  0.089353  0.164235  
+-0.088931  -0.130208  -0.082486  -0.052222  -0.003667  0.174014  -0.141236  -0.257597  -0.115292  -0.141833  
+0.002280  0.010667  0.014080  -0.006000  -0.023200  -0.172953  0.117553  0.058087  -0.019380  -0.005773  
+0.101485  0.125258  0.048667  0.014303  -0.150364  -0.389121  -0.019788  0.181545  0.030909  0.035652  
+-0.021477  -0.026577  -0.008262  -0.001515  0.036408  -0.184946  -0.200123  -0.032215  -0.062277  -0.037985  
+-0.030958  -0.037604  -0.002083  -0.009073  -0.000729  0.256958  0.014604  -0.118438  -0.055438  -0.000802  
+-0.027083  -0.051708  -0.031653  -0.091722  -0.062014  0.324194  0.196431  0.120806  0.034556  -0.031875  
+0.009636  0.010093  0.017856  -0.005153  0.040102  0.040983  -0.066271  -0.099381  0.058881  0.007881  
+0.132500  0.150554  0.177839  0.235321  -0.002214  -0.252696  -0.331750  -0.136554  0.123411  0.067375  
+0.023070  0.035640  0.053767  0.124349  0.040721  0.026500  0.116186  0.271256  0.194547  0.035500  
+0.001511  0.030878  0.008922  -0.003600  -0.014778  -0.022233  0.320467  0.462356  0.113289  0.039033  
+-0.002833  0.002567  -0.035367  -0.121433  0.120900  -0.298700  -0.125667  0.031267  0.204133  0.227500  
+-0.087482  -0.144643  -0.111518  -0.391786  -0.326607  -0.065250  -0.175911  -0.304214  -0.538625  -0.389071  
+-0.028617  -0.069150  -0.040133  -0.101550  -0.441367  0.076333  -0.076517  -0.169083  -0.356467  -0.191600  
+-0.037909  -0.026932  -0.005739  -0.064750  0.012568  0.065080  0.130000  0.049648  0.036273  0.180920  
+0.020429  0.047571  0.156480  0.491847  0.329459  0.164786  0.201163  0.245724  0.411480  0.191173  
+0.046603  0.153465  0.329621  0.480948  0.254552  -0.051948  0.006879  0.124345  0.195052  0.064207  
+0.064943  0.049343  -0.109214  -0.169521  -0.139050  -0.326821  -0.120729  -0.222421  -0.199921  -0.054193  
+0.097793  0.029086  -0.172138  -0.229103  -0.186569  -0.017190  -0.131138  -0.189759  -0.084310  -0.040586  
+-0.028429  -0.033558  -0.010962  -0.037135  0.003635  0.259936  0.076269  0.121449  0.158077  0.029449  
+-0.002591  -0.002159  0.034122  0.053927  0.035512  0.072043  0.003890  0.079787  -0.038762  -0.037805  
+-0.007474  -0.005542  -0.016305  -0.025963  -0.010647  -0.028416  -0.005437  -0.082868  -0.089074  -0.016589  
+0.007697  -0.002359  -0.008169  0.015887  0.022697  0.031535  0.046972  -0.041028  -0.012831  0.021176  
+-0.003731  0.003090  0.059583  0.103763  0.022141  0.115519  0.029179  0.083558  0.049718  0.018327  
+-0.008056  0.004766  -0.027331  -0.029758  -0.110411  -0.045073  -0.045476  -0.005403  -0.023113  -0.110976  
+-0.059971  -0.081745  -0.041696  -0.042245  -0.137373  -0.157725  -0.148039  -0.236588  -0.112608  -0.111529  
+-0.019759  -0.023935  -0.006306  0.012102  -0.020259  0.011241  0.091259  -0.050176  -0.004454  0.092991  
+-0.001988  0.003628  0.075360  0.059779  0.041337  0.052640  0.055174  0.421140  0.029523  0.020570  
+-0.005745  -0.007896  0.008038  0.007830  0.020094  0.003302  -0.112208  0.117764  -0.012943  0.025623  
+-0.002147  -0.003566  -0.004250  0.013301  -0.034485  -0.005022  -0.046176  -0.214603  0.102353  0.015221  
+0.004726  0.003258  0.006605  0.011677  0.020250  0.045435  0.033323  -0.045040  0.079436  0.047145  
+-0.003679  -0.016330  -0.003062  0.005607  -0.008018  0.005491  -0.074223  -0.197536  -0.323250  -0.114929  
+-0.008114  -0.048614  -0.099018  -0.037044  -0.049912  -0.124193  -0.164088  -0.363325  -0.310351  -0.216658  
+-0.019828  -0.024500  -0.046828  -0.065414  -0.234859  -0.152266  -0.080797  -0.063445  0.169914  0.076594  
+-0.051619  -0.044857  -0.015643  -0.088929  -0.162429  0.028500  0.197690  0.432952  0.321357  0.112452  
+-0.021411  -0.009625  0.035554  0.044625  0.280000  0.367500  0.594429  0.622232  0.012473  -0.010839  
+0.065200  0.025433  -0.185200  0.034333  0.172600  0.112033  0.257900  -0.247667  -0.057967  -0.027133  
+0.052604  -0.015573  -0.146427  -0.089854  -0.148490  -0.284812  -0.383000  -0.623250  -0.117167  -0.030635  
+0.010178  0.001711  0.074167  0.051633  -0.081333  -0.014689  -0.139767  0.036767  0.011200  -0.029811  
+-0.011123  -0.013965  0.041360  -0.006649  0.107246  0.104482  0.001956  0.101281  0.048351  0.086842  
+-0.008518  -0.006877  -0.014095  -0.045659  -0.011573  -0.014714  0.010405  -0.025550  -0.044900  -0.090964  
+-0.006465  -0.003227  -0.017219  -0.067123  -0.000727  -0.022958  -0.029050  -0.029381  -0.045496  -0.028827  
+0.002947  0.000654  0.007673  0.014638  0.011365  -0.007292  0.023487  -0.006947  0.063934  0.020057  
+0.010012  0.006801  0.018313  0.044687  0.014964  0.002892  0.129042  0.031343  -0.116873  -0.021072  
+0.003000  -0.006600  0.001167  0.005844  -0.004389  -0.007944  0.020622  0.008278  -0.087733  0.134178  
+0.021690  0.021905  -0.002034  -0.020750  -0.060767  -0.101422  -0.137379  0.037319  0.169293  0.090086  
+0.010665  0.024394  0.007065  -0.032147  -0.152188  -0.073382  -0.073171  -0.038235  0.107412  -0.021276  
+-0.010141  -0.007592  -0.000345  0.009176  -0.030162  -0.013493  0.092930  -0.046155  -0.122746  -0.100711  
+-0.019129  -0.019053  -0.007300  -0.056406  -0.006559  -0.009906  0.096847  -0.014329  -0.057535  -0.002618  
+-0.006023  -0.003099  -0.007942  -0.055076  -0.022442  -0.017302  -0.024372  0.024244  -0.052012  -0.020442  
+-0.001764  -0.002947  0.012634  0.007509  -0.001444  0.040596  -0.029075  -0.010115  -0.013671  -0.020975  
+0.004643  0.003214  0.033058  0.038091  0.032539  0.186831  0.011903  0.050208  0.084909  0.043773  
+0.011918  0.006448  0.019332  0.038603  0.008931  0.023879  0.000966  -0.007513  -0.060487  -0.017276  
+0.000802  -0.003381  -0.057722  -0.102310  -0.043278  -0.232444  -0.004675  -0.075857  0.067659  0.048516  
+0.022830  0.036489  -0.018523  -0.039295  -0.088034  -0.234284  0.067557  0.032761  0.157216  0.140830  
+-0.027531  -0.031500  -0.009347  -0.015867  -0.129592  -0.069816  0.041286  0.139673  0.075357  0.036143  
+-0.058598  -0.085457  -0.062185  -0.035750  0.018500  0.338848  0.211783  0.151435  0.306717  0.144859  
+0.003990  -0.014490  0.030125  0.200990  0.394031  0.336115  0.020583  -0.001042  -0.193021  -0.130427  
+0.065655  0.064369  0.066869  0.063988  0.025500  -0.247405  -0.359155  -0.222571  -0.383119  -0.206083  
+0.011047  0.014733  0.009627  -0.060247  -0.208713  -0.198127  -0.266340  -0.261493  -0.012473  0.008893  
+0.000814  0.006486  -0.013586  -0.057714  -0.089071  0.008514  0.357029  0.222214  0.421671  0.320100  
+-0.024246  -0.015106  -0.024444  -0.022761  -0.016366  0.051380  0.213641  0.222944  0.118190  0.062296  
+0.012047  -0.000609  -0.036078  -0.112906  -0.110055  -0.154563  -0.341305  -0.163672  -0.308563  -0.154023  
+-0.011217  -0.041671  -0.037184  0.044184  -0.038086  -0.072882  -0.274671  -0.294520  -0.121211  -0.088862  
+0.014457  0.007743  -0.028314  0.002743  0.020600  0.112271  0.258557  -0.115857  0.143500  0.099457  
+-0.018966  -0.050190  -0.014914  0.014000  -0.078241  0.058759  0.087776  0.027276  -0.022517  -0.286052  
+0.015717  0.022902  -0.000717  0.002457  -0.024989  -0.124141  0.054065  0.056543  -0.092696  -0.160391  
+-0.018395  -0.021302  0.012070  0.068942  0.108314  0.043151  0.198256  0.135686  0.181523  0.310233  
+0.017176  0.022135  0.008282  0.029400  0.007165  -0.004400  0.194371  0.056929  0.140588  0.187412  
+0.007560  -0.003000  -0.013083  -0.030560  -0.112345  -0.029583  -0.192048  -0.133107  -0.013190  -0.218952  
+-0.087780  -0.085585  0.018256  -0.057634  -0.070061  0.047000  -0.109598  0.010146  -0.034585  -0.054207  
+-0.051962  -0.034558  0.115365  -0.047654  -0.014750  0.280192  0.086308  0.151019  0.024577  0.069750  
+-0.027452  -0.034437  0.079937  0.016984  0.081587  0.218762  0.005008  0.020849  -0.120206  -0.055198  
+0.004566  -0.000187  -0.024777  0.003825  -0.020386  -0.010813  -0.061428  -0.323717  -0.024928  0.002482  
+0.048830  0.060170  -0.076182  -0.000045  -0.007886  -0.244114  -0.021636  -0.240284  -0.042909  -0.004136  
+0.124042  0.152875  -0.058896  0.011563  -0.048792  -0.169938  -0.016604  0.114979  -0.079646  -0.131375  
+-0.005101  0.002550  0.028239  0.061706  0.167417  0.108211  0.158606  0.204560  -0.032014  -0.016528  
+-0.038852  -0.045639  0.037361  0.013083  0.067556  0.111167  0.102907  0.062259  -0.053231  0.045361  
+-0.020021  -0.007264  0.011107  -0.120686  0.005171  0.012750  -0.022007  -0.000193  0.053871  0.038593  
+-0.003418  -0.000870  0.003767  -0.016205  0.009301  0.030007  -0.081452  -0.011801  0.083904  0.127952  
+0.000346  0.000453  0.005026  -0.005474  0.004017  -0.003761  -0.021564  -0.075017  0.036103  0.086560  
+-0.034250  -0.043723  -0.035518  -0.196161  -0.024098  0.035554  -0.110509  -0.210902  -0.186991  -0.051268  
+0.012764  0.008126  0.008109  -0.002046  -0.022787  -0.052557  -0.209782  -0.120937  -0.224333  -0.158891  
+0.010952  0.033119  0.035786  0.219857  0.015119  0.029857  0.223833  0.355214  0.024310  -0.017286  
+-0.000092  0.021000  0.008250  -0.044566  0.023566  0.268224  0.521763  0.535605  0.388184  0.227566  
+-0.013077  0.028327  -0.022212  -0.192231  0.035212  0.011481  -0.091385  -0.101538  0.238673  0.096962  
+0.052638  0.034319  -0.011468  0.007266  -0.038830  -0.332064  -0.312585  -0.389660  -0.121340  -0.025660  
+0.118404  0.100558  -0.021212  -0.149231  -0.007327  -0.069269  -0.021673  -0.087750  -0.178423  -0.135250  
+-0.020158  -0.019921  0.034553  0.035342  0.041197  0.112684  0.119158  0.372250  -0.188487  -0.175645  
+0.009542  -0.006500  0.088917  0.264896  0.208250  0.193687  0.060438  0.370917  -0.009708  -0.054688  
+-0.036500  -0.065600  -0.040133  0.217689  0.211800  0.110133  -0.132022  -0.159067  0.053744  0.049333  
+0.019846  0.034692  -0.009000  -0.265538  -0.207288  -0.026212  0.159212  -0.120192  -0.015558  0.029442  
+0.050740  0.074144  0.038712  -0.225173  -0.276789  -0.197058  0.093067  0.116760  0.000808  -0.011702  
+0.030008  0.008515  0.023062  0.188315  0.023023  -0.036569  -0.101577  -0.046085  -0.050469  -0.045662  
+-0.033362  -0.046569  0.035672  0.297517  0.059879  0.119259  0.006293  -0.102759  -0.091948  -0.052207  
+-0.009295  -0.013779  -0.002689  0.024770  -0.124943  0.050484  0.016631  -0.048434  -0.051221  -0.055205  
+-0.021381  -0.004356  -0.017932  -0.165839  -0.110102  -0.156237  -0.077500  0.032195  0.062280  0.028907  
+0.011200  0.031329  0.044343  -0.183014  -0.021386  -0.073743  0.035114  0.074343  0.024471  0.016714  
+0.013485  0.009005  0.040668  0.041327  0.034569  0.041351  0.092342  0.116787  -0.012881  -0.017673  
+-0.019654  -0.039154  -0.091423  0.022833  0.086179  0.182603  0.128141  0.112397  0.013538  0.021000  
+-0.065336  -0.074533  -0.121320  -0.077869  0.148352  0.126754  -0.035475  -0.113885  0.049049  0.030705  
+0.024107  0.010918  0.027951  0.044869  -0.121607  -0.118828  -0.242148  -0.189000  0.028582  0.021770  
+0.023872  0.047262  0.046549  0.005067  -0.293226  -0.291049  -0.271433  -0.214348  -0.183579  -0.102561  
+0.012484  -0.006500  -0.007079  0.120468  0.217817  -0.002683  -0.057643  0.018405  -0.153659  -0.152460  
+0.142986  0.313500  0.476458  0.442840  0.482167  0.624812  0.582910  0.538771  0.336389  0.201347  
+-0.049764  -0.092333  -0.072125  -0.281236  -0.221861  0.191694  0.130875  0.063153  0.080097  0.113542  
+-0.143675  -0.325431  -0.482415  -0.520117  -0.633729  -0.644894  -0.440042  -0.386516  -0.237027  -0.134096  
+0.049981  0.057904  0.073192  0.216423  -0.097250  -0.204596  0.123404  0.179192  0.008981  -0.027846  
+0.189562  0.333948  0.483245  0.451479  0.402672  0.534490  0.260958  0.228979  0.238719  0.114005  
+0.009744  -0.011674  0.040244  0.030721  0.099302  0.246837  -0.268360  -0.150756  0.014640  -0.031849  
+0.028585  -0.047754  -0.212185  -0.249115  -0.331231  -0.572423  -0.377815  -0.407792  -0.291192  -0.139769  
+0.029125  0.030860  0.021838  0.048794  -0.356581  -0.334713  -0.102846  -0.126493  0.021529  0.017331  
+0.008423  0.007803  0.059577  0.046535  0.095923  0.272373  0.105317  0.193465  -0.000585  -0.022070  
+-0.028200  -0.006645  0.083791  0.101918  0.135282  0.456100  0.205891  0.271345  0.095273  0.030127  
+-0.003351  0.001805  -0.011325  -0.016610  0.153532  -0.001558  -0.005188  -0.002500  0.014169  0.028279  
+0.003327  0.020806  0.019949  0.042990  0.076490  -0.180796  -0.098388  -0.148622  -0.013745  0.001633  
+-0.014939  -0.007015  0.098061  0.096152  -0.035152  0.046121  0.008667  -0.080515  0.034773  0.025439  
+-0.001100  -0.012933  -0.008000  0.021400  -0.102578  0.221611  0.041311  0.021922  0.035689  -0.009189  
+0.020726  0.027538  -0.100972  0.003717  -0.026566  -0.263981  0.021925  -0.011066  -0.129868  -0.062557  
+-0.003357  -0.008946  -0.091304  -0.030321  -0.046393  -0.497393  0.038268  -0.002196  0.020571  0.075518  
+0.020074  0.056882  0.067912  -0.120279  -0.029618  -0.070912  -0.107279  -0.048206  0.089441  0.100324  
+-0.004276  -0.007303  0.050382  -0.032487  0.017658  0.424921  -0.019737  0.071132  -0.025013  -0.061316  
+-0.012562  -0.035937  0.045531  -0.018875  -0.038406  0.317609  0.178125  0.036094  -0.150219  -0.102594  
+-0.010892  -0.008142  -0.057378  -0.114912  -0.003628  0.040439  0.057885  0.073581  0.097520  0.062514  
+-0.005542  -0.002734  -0.009177  -0.065479  0.051271  0.022156  0.032417  0.027151  0.053104  0.053203  
+0.005500  0.004373  0.074582  0.033036  0.012164  0.015755  -0.024100  -0.048709  -0.045209  -0.050855  
+0.037098  0.067561  0.160220  0.069171  -0.050866  -0.075659  -0.068476  -0.093012  -0.027000  0.001512  
+0.013098  0.023991  0.016509  0.013482  -0.006179  -0.173857  -0.054759  0.003250  0.075143  0.098875  
+0.013380  0.019296  -0.055333  0.074389  0.100991  -0.141583  0.006722  0.047019  0.097398  0.068009  
+-0.000488  -0.004612  0.002853  0.083282  0.044488  0.071588  0.070453  0.025218  0.022459  -0.007506  
+0.001106  -0.006149  -0.061340  0.013436  0.109213  0.196851  0.042681  -0.040819  -0.015234  0.002713  
+-0.023723  -0.026089  -0.062732  -0.009125  0.100804  -0.032598  0.022000  0.004759  -0.048571  -0.027768  
+-0.037734  -0.019141  -0.053297  -0.069688  -0.013141  -0.161938  0.006508  0.014953  -0.021930  0.018398  
+-0.008436  -0.000300  0.000800  -0.082777  -0.106409  -0.048686  -0.054459  -0.027023  -0.018545  -0.036991  
+0.008468  0.003195  0.000357  0.020013  -0.013039  0.082942  -0.105091  -0.023987  -0.010760  -0.026318  
+0.005458  0.004168  0.015821  0.039747  0.017921  0.092763  0.000974  -0.020484  -0.014053  -0.012868  
+0.006193  0.001489  0.009850  0.032904  0.008698  0.011497  0.041382  0.011556  0.023425  0.014374  
+-0.004102  -0.002455  -0.010353  -0.012098  -0.017985  -0.025086  0.022368  0.086789  0.005064  0.007782  
+-0.000397  -0.003799  0.042552  -0.024362  -0.041161  -0.000241  -0.003184  0.051287  -0.005006  -0.009580  
+0.001854  0.002447  -0.008000  -0.004841  -0.067664  -0.044239  -0.054770  -0.125885  -0.008558  -0.021283  
+-0.015254  -0.033918  -0.138082  -0.072388  -0.059799  -0.075716  -0.080448  -0.263463  0.001754  -0.026284  
+-0.025086  -0.034121  -0.044036  -0.132057  0.050836  0.059671  0.135036  0.156807  -0.006500  0.003193  
+-0.023875  -0.019229  0.010583  -0.187063  -0.095271  0.093729  0.126042  0.369333  -0.070667  -0.019625  
+-0.000728  -0.024404  0.001368  -0.119507  -0.199412  0.009294  -0.080794  -0.107662  -0.199618  -0.151544  
+-0.014456  -0.018971  0.024868  0.371015  0.417897  0.095632  0.024279  -0.120103  0.245000  0.158015  
+0.023479  0.084135  -0.001677  0.199719  0.384448  -0.046490  0.141104  0.161542  0.431865  0.293594  
+-0.048895  -0.050093  -0.024453  -0.280000  -0.163663  -0.059430  -0.127930  -0.152698  -0.420093  -0.139023  
+-0.052188  -0.084297  -0.056375  -0.181516  -0.119547  0.100719  -0.001922  -0.035578  -0.517734  -0.364969  
+0.065688  0.079708  0.107937  0.061750  -0.027833  -0.065687  -0.012500  0.079833  0.216271  -0.156896  
+0.050583  0.076278  0.032264  0.111264  0.001042  -0.193764  -0.082722  -0.009042  0.382167  0.140597  
+-0.003895  -0.000193  -0.020368  0.014982  -0.018886  -0.052632  -0.007096  -0.149544  0.283219  0.177982  
+-0.052750  -0.075625  -0.107028  -0.224958  -0.082514  0.252764  -0.017250  -0.033361  0.004014  -0.027750  
+-0.089171  -0.101886  -0.016229  -0.004857  0.086171  0.235314  0.042943  0.001543  -0.241571  -0.192371  
+0.033000  0.050067  0.044300  0.148450  0.139633  -0.171150  0.108600  0.164217  -0.116817  -0.069700  
+0.055811  0.090962  0.176698  0.103745  -0.010472  -0.028047  0.114170  0.093208  0.096255  0.107679  
+-0.014517  -0.005948  -0.004707  -0.156362  -0.051879  0.098741  0.009569  -0.013810  0.071828  0.140379  
+0.001036  -0.017274  -0.146881  -0.029333  -0.077607  -0.003607  -0.094214  -0.051012  -0.064060  -0.051881  
+0.007267  -0.005802  -0.047914  0.016966  -0.033509  -0.054647  -0.244233  -0.272862  0.090940  0.054897  
+-0.042609  -0.042609  -0.008707  -0.012446  0.074109  0.089543  -0.127141  -0.197533  0.129913  0.082674  
+-0.035304  -0.025990  0.042500  0.060882  0.174804  0.201549  0.357157  0.347628  -0.177549  -0.097196  
+-0.002926  0.019485  0.044250  -0.034868  -0.018544  0.024926  0.434294  0.403897  -0.136132  -0.096353  
+0.098830  0.073045  0.041591  0.005239  -0.230159  -0.369841  -0.508295  -0.304511  0.196443  0.138216  
+0.022670  -0.002180  -0.001750  -0.040810  -0.087830  -0.082820  -0.467400  -0.381280  0.107830  0.036940  
+-0.032533  -0.030956  -0.010000  -0.070633  0.054422  0.195256  0.156244  0.065278  -0.029356  -0.062533  
+-0.037480  -0.013531  -0.047735  -0.040173  0.019459  0.070755  0.220153  0.205541  0.233082  0.215306  
+-0.009748  -0.011446  -0.019824  -0.027234  -0.011108  -0.058743  0.012644  -0.020450  0.095869  0.114248  
+-0.007333  -0.004402  0.010470  0.004386  0.001992  -0.013348  -0.010455  0.113848  -0.145909  -0.136402  
+-0.002235  -0.001000  0.020549  -0.001284  0.085392  0.077382  -0.009951  0.056412  -0.122529  -0.029598  
+-0.000090  -0.003082  0.009806  0.036597  0.054761  0.006851  0.019373  -0.187672  -0.004948  0.021313  
+0.044766  0.037032  0.101573  0.149363  0.044653  0.009363  0.001702  0.009363  0.078992  -0.000089  
+0.015833  0.034056  -0.037431  -0.028292  -0.085750  -0.015042  -0.023750  0.276000  -0.039722  -0.108667  
+-0.108808  -0.129333  -0.209717  -0.241283  -0.072617  -0.074900  0.016717  -0.019583  -0.056658  -0.058058  
+-0.023478  -0.015957  -0.092217  -0.246380  -0.086587  -0.065478  -0.005989  -0.003315  0.133859  0.144533  
+0.006000  0.072367  0.224641  0.100898  0.104313  0.133883  0.095148  0.072195  0.104383  0.087195  
+0.022337  0.010255  0.162867  0.431622  0.262061  0.276571  0.245133  0.184388  -0.028082  -0.073020  
+-0.002388  -0.017632  0.045447  0.235447  0.068171  0.089658  0.063520  0.054263  0.017487  -0.017789  
+-0.006012  -0.030640  -0.154591  -0.167134  -0.169988  -0.159677  -0.113323  -0.100750  -0.044299  -0.027274  
+-0.011145  -0.099819  -0.233217  -0.408703  -0.200130  -0.256406  -0.241739  -0.119841  -0.102986  -0.042029  
+0.000442  0.005175  -0.004433  -0.184242  -0.006300  -0.015142  -0.093867  -0.127725  -0.064842  -0.023842  
+0.000261  0.002142  0.039343  0.151194  0.024627  0.065239  -0.030216  -0.017552  -0.008485  -0.015448  
+0.015540  0.015605  0.045194  0.146218  0.052056  0.033758  0.064355  0.136742  0.012565  0.018710  
+0.006541  0.001245  0.017755  0.085132  -0.012736  -0.007455  0.024095  0.042541  0.049459  0.013164  
+-0.004965  -0.008015  -0.010050  -0.008663  -0.010743  0.012332  0.013970  -0.151876  -0.030074  -0.052188  
+-0.011272  -0.020935  -0.007826  -0.081978  0.071978  -0.001326  -0.030196  -0.113239  -0.064663  -0.050217  
+-0.007769  -0.002093  0.025357  0.008813  0.038231  0.029434  0.080357  0.199863  -0.094269  -0.030852  
+-0.054650  -0.050129  -0.015471  0.023621  0.062579  0.096657  0.276857  0.182300  -0.096236  -0.030571  
+0.159857  0.216964  0.108768  0.097179  -0.065161  -0.043714  -0.020000  -0.079179  0.104875  0.115661  
+0.147474  0.163263  0.082158  -0.095711  -0.070895  -0.050921  -0.303079  -0.135632  0.144447  0.049474  
+-0.081539  -0.091237  -0.097039  -0.159276  0.058882  0.052566  -0.076934  0.020303  -0.090092  -0.112605  
+-0.052706  -0.082221  -0.040250  0.112338  0.092118  0.123544  0.134838  -0.057618  -0.184397  -0.081912  
+0.008912  -0.000158  0.024662  0.082759  -0.002399  0.034890  0.019311  0.002570  -0.003991  0.009579  
+0.001253  -0.000900  -0.014013  -0.092000  -0.020560  -0.054600  -0.045020  0.033647  0.042680  0.044447  
+-0.027895  -0.017352  -0.031593  -0.111932  -0.003302  -0.050636  0.063272  0.054759  0.013926  -0.000210  
+-0.011859  -0.020359  -0.031672  0.125234  0.104125  0.026672  -0.007656  -0.071680  -0.076211  -0.035086  
+0.019305  -0.003085  -0.006110  0.117049  0.164902  0.026780  -0.195354  -0.191366  -0.119122  -0.109829  
+0.001032  -0.017809  -0.049894  -0.007862  -0.059926  -0.083543  -0.188362  0.033000  -0.021404  0.081862  
+0.001869  0.028344  0.051402  -0.099607  -0.251615  -0.108869  0.036008  0.040697  0.147270  0.070336  
+-0.014261  -0.012870  -0.044793  -0.128293  -0.191674  0.087891  0.320554  0.198924  -0.012087  -0.013011  
+-0.017946  -0.026674  -0.067315  0.000685  0.246217  0.095761  0.168565  0.086750  -0.077326  -0.029370  
+-0.000175  0.017008  0.023992  0.016050  0.374000  0.110758  0.076983  0.110992  0.178383  0.098492  
+-0.017779  -0.020195  -0.014379  0.008800  0.060747  0.032474  0.281953  0.107000  0.056689  0.048711  
+0.094692  0.099417  0.077733  0.069758  -0.339492  -0.437242  -0.122958  -0.068417  -0.180900  -0.080242  
+0.066095  0.038776  -0.041397  -0.073914  -0.306983  -0.429483  -0.640009  -0.541293  -0.247250  -0.224586  
+-0.069660  -0.155860  -0.149080  -0.028500  0.149940  0.021300  -0.261240  -0.389000  0.054540  0.011040  
+-0.050097  -0.050370  -0.015006  0.033403  0.184851  0.176234  0.174084  -0.092351  -0.002916  0.042364  
+-0.004410  0.005560  -0.020980  -0.006750  -0.030710  -0.067060  0.087660  0.144290  0.014320  -0.054800  
+0.004478  0.012311  0.025511  -0.049722  -0.088778  -0.046578  0.068767  0.340800  0.123489  0.061233  
+-0.027567  0.000462  0.013163  -0.007615  0.106692  0.079731  0.305923  0.303750  -0.004221  0.115029  
+0.024243  0.033676  0.045270  0.051230  0.089243  0.077973  -0.008311  -0.236973  -0.121730  -0.007959  
+0.071810  0.053220  0.019940  -0.019150  -0.096820  -0.091230  -0.408370  -0.376440  -0.245770  -0.276870  
+-0.090048  -0.103548  -0.126365  -0.174381  -0.176016  -0.176111  -0.221778  -0.032262  -0.119159  -0.164921  
+-0.098912  -0.105426  -0.049324  0.014956  0.112559  0.079456  0.456485  0.287412  0.234147  0.253794  
+-0.028986  -0.015732  0.135261  0.207979  0.062486  0.089472  0.288324  0.102627  0.200120  0.171085  
+0.037500  0.048085  -0.058793  0.093171  0.046646  0.045939  0.082073  -0.101427  0.019171  -0.008427  
+0.188586  0.286828  0.285431  0.114500  0.178397  0.139776  -0.098879  -0.022172  -0.170172  -0.151155  
+0.175304  0.259761  0.124152  -0.095413  0.042717  -0.002326  -0.211413  0.028957  -0.145935  -0.193978  
+-0.196676  -0.352027  -0.517730  -0.501878  -0.552041  -0.314851  -0.214257  -0.241351  0.011122  -0.021689  
+-0.106619  -0.214214  -0.182429  -0.180714  -0.432619  -0.223214  -0.045000  -0.206048  0.155500  0.187643  
+0.026014  0.034401  0.082042  0.175282  0.266606  0.122937  0.044141  -0.014535  -0.164218  -0.067162  
+0.067250  0.115797  0.060031  -0.069016  0.212391  0.112188  -0.072734  0.094281  -0.130578  -0.181391  
+0.001891  -0.004475  0.011847  -0.026153  -0.001079  0.040045  0.012970  0.111069  -0.009569  -0.035421  
+0.003003  0.000083  0.013473  0.013286  0.017607  0.020054  0.008690  0.183232  0.003307  0.005357  
+0.000694  0.000519  0.001344  0.007860  0.003341  0.000545  -0.020854  0.068433  -0.009080  0.005962  
+-0.003118  -0.001682  -0.011497  0.013417  -0.009242  0.008860  -0.002408  -0.116850  0.012780  0.002223  
+0.002542  0.001380  -0.026739  -0.013859  -0.033704  -0.143937  -0.042655  -0.180211  0.051394  0.031824  
+-0.002743  0.030600  0.147771  -0.020200  0.034200  -0.030086  0.065214  -0.029629  -0.023686  -0.000686  
+0.008250  -0.034781  0.206031  -0.026250  -0.107406  0.028000  -0.096156  -0.003125  -0.048094  -0.004531  
+-0.067492  -0.114339  -0.195585  -0.200754  -0.210483  -0.198322  -0.067288  -0.053678  0.075780  0.062254  
+-0.046803  -0.092682  -0.360727  -0.252758  -0.081288  -0.214833  0.006106  -0.068561  -0.048727  0.051030  
+0.093023  0.162731  0.192623  0.221300  0.367115  0.283808  0.098715  0.096223  0.037615  -0.009154  
+0.029810  0.048464  0.210024  0.289214  0.215607  0.100798  -0.169012  -0.039881  -0.053107  -0.040333  
+0.000112  -0.002762  0.024100  -0.011475  -0.297662  -0.096187  0.118425  0.150825  0.046250  -0.002100  
+-0.047788  -0.060750  -0.053856  -0.202508  -0.244606  -0.023576  -0.000523  0.120159  0.061348  -0.008864  
+-0.011912  -0.041103  -0.162544  -0.187074  0.129485  -0.103500  -0.108353  -0.187500  -0.137074  -0.061956  
+0.001868  0.004029  -0.046132  0.016676  0.217603  -0.030706  0.031985  -0.111397  -0.069926  -0.004000  
+0.079500  0.136266  0.248989  0.244202  -0.086138  0.044543  -0.025096  0.017245  0.076532  0.026213  
+0.010151  0.008212  0.007486  -0.004589  -0.142397  0.005610  -0.071363  -0.039425  0.043856  0.028993  
+-0.004537  -0.002079  -0.072732  0.005256  0.000207  0.012433  -0.005213  -0.050896  -0.015884  -0.015848  
+0.001773  -0.002472  0.001756  0.170892  0.023318  0.037676  0.022580  0.018523  0.034784  0.021159  
+-0.027390  -0.025220  -0.092707  -0.132122  0.107817  -0.012707  0.109171  -0.004341  0.058268  0.094402  
+-0.038530  -0.034348  -0.144621  -0.380091  0.075500  0.048258  0.017318  -0.014348  -0.004833  0.029061  
+0.115036  0.182357  0.231018  -0.042161  -0.187393  -0.101000  -0.146375  -0.183411  -0.038964  -0.029661  
+0.038790  0.073403  0.214645  0.075774  -0.205597  -0.184710  -0.276790  0.024000  -0.066742  -0.097742  
+-0.093382  -0.148882  -0.187412  -0.113029  -0.029824  -0.004882  0.037588  0.290559  0.065029  0.059941  
+-0.114557  -0.107830  -0.125545  -0.152989  0.026057  0.127011  0.272739  0.125693  0.015716  -0.013955  
+0.008712  0.019250  0.084865  0.150673  0.261442  0.280327  -0.126404  -0.325058  -0.083712  -0.015827  
+0.172133  0.258767  0.400000  0.301100  0.141767  0.112233  -0.320100  -0.218267  0.018700  0.019733  
+0.007398  0.017531  -0.009776  -0.029480  0.013786  -0.149745  0.158735  0.185582  0.053449  0.065816  
+-0.003563  0.004663  0.017050  -0.099087  -0.068825  -0.104000  0.010575  0.174112  -0.038550  -0.019738  
+-0.002526  -0.002626  0.014300  -0.069979  -0.027142  -0.053632  0.011121  0.018368  -0.003011  -0.014842  
+0.021558  0.023151  -0.087512  -0.055081  -0.052640  -0.067942  0.019744  0.023535  0.010244  0.009186  
+0.003184  0.004194  -0.001378  0.031214  -0.050888  0.040944  -0.020918  0.014939  -0.031587  -0.011985  
+0.062032  0.048479  0.089202  0.060160  -0.064394  0.061766  0.004032  0.008915  0.042926  -0.006521  
+0.009985  -0.000085  0.082154  0.041854  0.026115  0.023977  -0.015277  0.017085  0.013346  -0.007938  
+0.012921  0.006393  0.021517  0.122023  -0.017354  -0.031933  0.012983  -0.022017  0.008326  0.020573  
+-0.001250  -0.019276  -0.102013  -0.014500  -0.031250  -0.056605  -0.046842  -0.028224  -0.214974  -0.037132  
+-0.028898  -0.024608  -0.088823  -0.244753  -0.021253  -0.018392  -0.066672  -0.035457  -0.108403  -0.021296  
+-0.016841  -0.008205  0.018530  0.036197  0.106326  0.052515  0.025515  0.083576  0.152848  0.034735  
+0.009542  0.003873  0.023763  0.124195  0.065602  0.117466  0.018356  0.005661  -0.078093  -0.104508  
+-0.006559  0.001068  0.005780  -0.049517  0.023949  0.005136  0.011161  -0.011186  0.049695  -0.054873  
+-0.009385  -0.002230  -0.012500  0.027203  -0.010304  -0.007588  0.172182  0.052459  0.350649  0.128791  
+-0.014190  -0.010332  -0.030185  -0.069957  -0.024016  -0.011717  -0.015614  -0.015413  0.043326  0.024087  
+-0.008397  -0.014801  0.000412  -0.038801  0.025934  0.051412  -0.101618  -0.068199  -0.198618  -0.136853  
+0.010333  -0.002402  0.026713  0.085644  0.026006  0.014598  0.021684  0.041305  -0.026621  -0.039724  
+0.024034  0.028836  0.027671  0.067192  0.079678  0.018925  0.064027  0.064877  0.059274  0.058637  
+0.002885  -0.001236  -0.002791  -0.028358  0.036669  0.019466  -0.049554  -0.015723  -0.045595  0.069203  
+-0.009005  -0.005563  0.003353  -0.084011  -0.017358  0.009132  -0.084547  -0.065921  -0.024316  -0.024711  
+-0.001307  0.000214  -0.004532  0.001257  -0.013046  -0.011639  0.075671  -0.044261  -0.003350  -0.014146  
+0.011852  0.000074  0.031287  0.229352  -0.016602  -0.035500  0.124963  0.028185  0.036769  0.011056  
+0.016628  0.005686  0.058163  0.172674  -0.035570  -0.058442  -0.075337  -0.065209  0.117500  0.043163  
+-0.019224  -0.024612  -0.091629  -0.383698  -0.106388  -0.149259  -0.097284  -0.057983  0.020379  0.060336  
+0.027871  -0.018000  -0.186290  -0.101468  -0.127371  -0.114161  0.019371  0.154742  0.013048  -0.038645  
+0.012705  -0.017090  0.126692  0.414872  0.029603  0.003256  0.032526  0.002026  0.004346  0.008218  
+-0.009635  0.075625  0.356531  0.297427  0.201344  0.316500  0.073385  0.068719  0.157010  0.099708  
+0.048153  0.121226  0.176565  0.135839  0.228694  0.345887  0.572903  0.345911  0.199734  0.165798  
+0.093352  0.125296  0.003056  -0.331815  -0.284611  -0.124907  0.109722  0.062167  -0.282741  -0.185019  
+-0.002518  -0.130693  -0.287851  -0.337254  -0.528404  -0.675640  -0.742026  -0.683816  -0.344833  -0.202307  
+0.045010  -0.057010  -0.064927  -0.087333  -0.189885  -0.290615  -0.623375  -0.238927  -0.063406  -0.088417  
+-0.040113  -0.025662  0.109620  0.293458  0.253099  0.350099  0.416338  0.097000  0.213627  0.191373  
+-0.005240  0.012444  0.042480  0.084730  0.177520  0.235995  0.337612  0.216842  -0.010964  0.004878  
+-0.005946  -0.003804  0.019824  -0.012108  -0.139189  -0.093209  -0.110635  -0.003709  -0.139378  -0.098041  
+-0.020409  -0.016795  0.028102  0.035330  0.067602  -0.133170  0.031852  -0.022864  -0.223261  -0.083750  
+-0.033507  -0.030629  -0.027136  0.072679  0.238193  0.211593  0.346021  0.159629  0.146929  0.165193  
+-0.021422  0.018017  0.078233  0.154638  0.209267  0.303845  0.326776  0.346914  0.508569  0.245431  
+-0.018264  -0.005791  -0.007245  -0.230009  -0.400064  -0.202227  -0.349655  -0.276064  -0.091736  -0.074800  
+0.090320  0.058795  -0.073402  -0.271451  -0.231238  -0.323393  -0.373082  -0.215262  -0.307975  -0.247582  
+0.003605  0.006149  0.015570  0.095105  0.188009  -0.003851  0.099368  0.050842  -0.061930  0.011289  
+-0.062364  -0.090761  -0.048193  0.138273  0.063977  0.056352  0.194182  -0.003034  0.080386  0.109886  
+0.002359  0.003590  0.005237  0.031667  0.005083  0.026256  0.011660  0.092378  0.021885  0.094513  
+-0.004858  -0.006421  0.025384  -0.000053  -0.004389  0.013195  0.056000  0.081874  0.087158  0.099484  
+-0.008455  -0.002980  -0.000145  -0.035610  0.005050  -0.038490  0.032485  -0.019125  0.064110  0.019120  
+-0.003113  -0.003158  -0.002698  -0.021797  -0.005622  -0.022122  -0.037910  0.018198  0.005649  -0.023221  
+-0.000570  0.001000  -0.001164  -0.019055  -0.016094  0.065539  -0.037219  0.042672  -0.007789  -0.055961  
+-0.002731  -0.001594  -0.009623  -0.001142  -0.078104  0.020104  0.000712  -0.012165  0.021009  -0.023028  
+0.005598  0.008422  -0.041554  -0.014848  -0.026250  -0.096490  -0.025103  -0.054093  0.068103  0.033324  
+-0.001569  -0.000693  -0.004020  -0.002980  -0.008936  -0.027124  -0.017842  -0.001149  -0.000465  0.086936  
+0.003681  0.002007  -0.006785  0.003938  0.041812  -0.005319  -0.000931  0.004042  -0.084340  0.032410  
+0.005540  0.002391  0.003866  0.023144  0.059005  0.031540  -0.007995  -0.025718  -0.141505  -0.061990  
+0.010007  0.013187  0.009792  0.005375  0.029618  -0.046701  -0.070368  -0.022514  -0.041403  -0.137090  
+-0.021724  -0.013053  -0.068671  -0.039197  -0.111105  -0.210276  -0.045329  0.058908  0.072711  0.059750  
+0.002197  -0.002426  -0.002164  0.001295  -0.262311  0.036418  0.048148  -0.049033  0.003844  -0.009328  
+-0.010382  0.015816  0.186697  0.052947  0.139013  0.455539  -0.009605  0.006039  -0.164539  -0.120921  
+-0.013022  -0.010846  0.043015  0.270757  0.508669  0.237706  0.165213  0.141588  0.174507  0.149235  
+-0.010500  -0.017111  -0.157611  0.007722  0.023556  -0.435278  0.191333  0.087778  0.258833  0.241833  
+0.073236  0.099403  0.078028  -0.129958  -0.218799  -0.195993  -0.094597  -0.084444  -0.069986  -0.000181  
+0.130550  0.129175  0.126900  -0.138112  -0.117313  0.074750  -0.025625  -0.023600  -0.057462  -0.058050  
+-0.011613  -0.012006  -0.030232  -0.061155  -0.025756  -0.037565  -0.056220  -0.121155  0.034030  0.035690  
+-0.004011  -0.023356  0.005133  0.122922  -0.067767  0.026356  -0.051067  -0.091889  -0.001122  -0.021167  
+-0.080174  -0.080000  0.016717  0.098304  0.039804  0.220348  -0.034957  0.196435  0.070717  -0.019304  
+-0.014048  -0.009766  0.007234  -0.112210  -0.039500  0.059363  0.016435  0.166290  0.020371  -0.002363  
+-0.001434  -0.000481  -0.040981  -0.015264  0.009491  -0.122425  0.110613  -0.054972  -0.021151  -0.005962  
+0.077793  0.061183  0.052085  0.151207  -0.015037  -0.061549  0.083317  -0.081061  -0.085598  -0.039732  
+0.007553  0.010513  -0.011167  0.064127  -0.045333  -0.044533  -0.035913  -0.041113  -0.052140  -0.118633  
+-0.037845  -0.033491  -0.081690  -0.054991  -0.008250  -0.031828  0.020552  0.065310  -0.065595  -0.057966  
+-0.012241  -0.020907  -0.038102  -0.123074  0.166685  0.134157  0.060509  0.022963  -0.030435  0.006417  
+-0.013462  -0.007424  0.017304  -0.008804  0.223215  0.149854  -0.048506  0.012778  0.014873  0.013076  
+-0.003212  -0.000075  -0.001325  -0.055775  -0.087013  -0.016425  -0.164825  0.158112  0.113312  0.040162  
+0.008300  -0.007829  -0.019143  -0.052400  -0.492514  0.001143  0.062271  0.033586  0.083129  0.038386  
+-0.016588  -0.047020  -0.007804  0.009725  -0.386882  -0.100078  -0.100274  -0.151559  -0.099461  -0.048039  
+-0.024750  0.047500  -0.060417  0.081083  0.410000  -0.025167  0.077750  0.000000  -0.299333  0.027833  
+-0.072250  -0.082500  0.037142  0.042267  0.287967  0.259775  0.137267  0.163967  -0.219200  -0.121500  
+0.007739  -0.031630  -0.079304  0.031826  -0.329304  -0.263587  0.118043  0.209022  0.351804  0.159152  
+0.136744  0.158395  -0.130919  -0.045116  -0.246628  -0.168733  -0.087640  0.032895  0.200070  0.029674  
+0.210487  0.322649  0.359987  0.278189  0.323324  0.271095  -0.012716  -0.002432  0.019230  0.000338  
+0.024413  0.069087  0.116522  0.320000  0.422000  -0.036130  -0.201565  -0.169391  -0.248152  -0.165957  
+-0.189829  -0.322632  -0.303039  -0.195026  -0.315789  -0.126697  -0.094592  -0.085592  -0.072132  -0.092184  
+-0.087553  -0.128500  -0.197829  -0.022474  -0.037184  -0.023724  0.098092  0.037579  0.228263  0.142289  
+0.070338  0.061779  -0.060838  -0.076103  0.134088  0.037515  0.199647  0.122279  0.057000  0.096838  
+-0.024842  0.005724  0.027500  -0.255066  0.081382  0.142487  0.011789  0.056776  -0.165974  -0.082329  
+0.007213  0.011638  0.007415  -0.012074  0.060628  0.126160  -0.149330  -0.012032  -0.051277  -0.130574  
+0.014458  0.024764  0.090458  0.229833  -0.143486  -0.167722  -0.013292  -0.092833  -0.041069  0.049736  
+0.020702  0.022574  -0.028117  -0.021745  -0.053543  -0.143564  -0.103840  -0.270638  0.157787  0.136223  
+-0.041216  -0.058635  -0.055919  -0.108541  -0.008770  0.151703  -0.083014  0.024554  0.078108  0.025892  
+-0.019974  -0.027205  -0.014756  -0.109872  0.002974  0.111577  0.016885  0.173718  -0.110795  -0.118128  
+-0.008900  -0.008864  0.015391  -0.051927  0.050464  0.022073  0.062855  -0.044773  -0.124482  -0.030273  
+-0.006979  0.002830  0.050915  0.193989  0.086415  -0.029426  0.079702  0.027234  0.139043  0.180394  
+0.042280  0.047682  -0.014333  0.146848  -0.020045  -0.091841  0.021871  0.085780  0.153985  0.041561  
+0.001812  0.003266  0.003836  0.026734  -0.062641  -0.031695  0.009680  0.062492  -0.041258  -0.065008  
+0.002273  -0.005155  0.030736  0.019973  0.010773  0.126136  0.075636  -0.072855  -0.039882  0.008673  
+-0.041420  -0.054340  0.019700  -0.063000  0.016500  0.098860  0.010500  -0.133340  0.001780  0.144800  
+-0.003470  0.001590  -0.038888  -0.158731  -0.046873  -0.092007  -0.055873  -0.066194  0.037933  0.010933  
+-0.019340  -0.015902  -0.034881  -0.126351  -0.070732  -0.186660  -0.067732  -0.064129  -0.100015  -0.019711  
+0.011367  0.005117  -0.052820  0.130594  -0.008641  0.012094  0.000398  0.010211  -0.017539  -0.006461  
+-0.067569  -0.172216  -0.228010  0.059059  0.000392  -0.055373  -0.072549  -0.173255  0.041549  0.061333  
+-0.091788  -0.138627  -0.138458  -0.048534  -0.094415  -0.052390  -0.040763  -0.096568  -0.080042  -0.016492  
+0.161488  0.316233  0.399895  0.054605  0.046291  0.170767  0.394640  0.421651  0.036012  0.014872  
+0.185316  0.356816  0.450551  0.196331  0.242581  0.316169  0.238235  0.305051  0.058838  0.014721  
+-0.127400  -0.285619  -0.417350  -0.354163  -0.332456  -0.404900  -0.522600  -0.477613  -0.430612  -0.269838  
+-0.185608  -0.329823  -0.356438  -0.085746  -0.197985  -0.292939  -0.328438  -0.329485  -0.148654  -0.117508  
+0.098071  0.193390  0.193630  0.153506  0.194338  0.171344  0.274519  0.244766  0.243669  0.109812  
+0.082905  0.135484  0.094770  0.056738  0.109270  0.135056  0.148690  0.104230  0.153365  0.151937  
+-0.025256  -0.022488  -0.047360  0.114988  0.018302  -0.020930  -0.083965  -0.062314  0.006419  -0.014663  
+-0.006808  -0.001894  0.006394  0.054173  0.183038  0.068817  -0.041202  0.007442  0.112692  0.057183  
+-0.009323  0.017435  -0.071500  -0.224903  0.166081  0.238984  0.172726  0.127919  0.179548  0.101371  
+-0.003368  -0.018382  -0.037824  -0.175985  -0.366103  -0.133294  -0.093074  -0.038721  -0.219147  -0.155279  
+-0.006917  -0.012528  0.105639  0.117028  -0.260944  -0.071667  0.004972  -0.094944  -0.339500  -0.202694  
+-0.031095  -0.049310  0.066988  0.041845  0.099571  0.044060  0.018738  -0.023226  0.013893  0.035833  
+0.011600  0.037467  0.002178  0.002078  0.202000  -0.037689  -0.041144  0.031722  0.164822  0.150378  
+-0.004696  0.014393  0.035527  0.017679  0.003938  -0.100411  0.043938  0.055634  0.089429  0.163107  
+-0.032000  -0.034742  -0.094806  -0.327903  -0.116710  -0.038065  0.123500  0.148855  0.044081  0.054435  
+-0.132575  -0.269633  -0.506317  -0.532825  -0.117367  -0.132350  -0.228183  -0.185775  -0.127425  -0.109908  
+0.032868  0.005515  -0.004132  0.236221  0.017074  0.031471  -0.092324  -0.269868  0.012824  -0.032147  
+0.180188  0.289237  0.484300  0.527987  0.271637  0.162050  0.125200  0.118675  0.004350  0.008600  
+-0.010043  -0.001574  0.000862  -0.000117  0.044574  -0.006479  0.018734  0.132521  -0.230277  -0.062223  
+-0.021023  -0.043341  -0.100750  -0.107875  -0.205670  0.067375  0.130898  0.059955  0.187500  0.090386  
+-0.009800  -0.006822  -0.014144  0.010489  -0.032133  0.042200  -0.051344  0.006611  0.218067  -0.042522  
+0.017066  0.026789  -0.007921  -0.020553  0.122013  -0.028053  -0.168592  0.047632  -0.023605  -0.050289  
+-0.004894  -0.013830  0.007543  0.013553  0.010468  0.015138  0.061979  -0.000894  -0.191128  0.075904  
+-0.045868  -0.054640  0.020158  0.002088  -0.071833  0.114825  0.215333  0.057588  0.150211  0.115158  
+-0.000649  0.028189  -0.021230  -0.128905  0.147716  0.045162  -0.024811  0.065284  0.129689  0.003662  
+0.001171  0.002614  0.002014  0.039371  0.002614  -0.056214  -0.163300  0.071257  -0.168100  -0.063371  
+-0.037750  -0.054917  0.104048  0.161226  0.033631  0.153857  0.071095  0.074524  -0.098190  -0.031893  
+-0.068062  -0.145812  -0.232984  -0.215625  -0.235625  0.086375  0.043391  -0.126578  0.009672  0.023609  
+0.004924  -0.024253  -0.147506  -0.208265  -0.192882  -0.347318  -0.276406  -0.265653  -0.051482  -0.021741  
+0.081432  0.106041  0.139432  0.326838  0.035257  -0.179513  -0.029027  0.029811  0.052041  0.022811  
+0.004523  0.064314  0.166091  0.160559  0.206491  0.226773  0.129095  0.168732  0.104768  0.067664  
+-0.008586  -0.007093  0.000123  -0.030698  -0.009753  0.106623  0.016389  -0.000685  -0.039969  -0.021500  
+-0.035319  -0.031379  -0.067690  -0.019569  -0.014776  -0.009716  -0.019940  -0.037871  -0.099767  -0.065871  
+-0.004134  -0.005069  -0.000178  -0.060327  0.055421  0.000233  -0.026193  0.027495  -0.024589  0.009916  
+-0.003634  -0.001919  -0.005221  -0.016930  0.118355  0.001058  0.060320  0.062686  0.012523  0.028453  
+0.013780  -0.001305  -0.060263  0.132042  0.070788  0.067856  0.082610  0.053508  0.098839  0.026864  
+0.020060  0.011600  0.189640  0.069440  -0.065620  0.185640  -0.049860  -0.013000  0.245020  0.117580  
+-0.093754  -0.124203  -0.147619  -0.185127  -0.112644  -0.212754  -0.035339  -0.095203  -0.181178  -0.031229  
+-0.009285  -0.018023  -0.048669  -0.174485  -0.038008  -0.133385  -0.072654  -0.098015  -0.316592  -0.048769  
+0.128483  0.130379  -0.033483  0.094190  0.143155  0.078655  0.066569  0.110759  0.006552  0.004655  
+-0.017352  -0.000195  0.045133  0.063578  0.047805  0.143891  0.058859  0.080555  0.299711  0.023484  
+-0.006931  -0.002621  0.015569  0.033560  -0.011293  -0.067000  -0.096629  -0.093543  0.101466  0.178862  
+-0.041358  -0.051403  -0.041164  -0.050172  -0.004336  -0.083000  -0.211179  -0.093500  -0.069470  -0.069896  
+-0.003583  -0.002500  -0.021962  -0.025841  -0.054674  -0.049500  -0.061811  -0.022417  -0.250371  -0.333000  
+-0.002953  0.003818  -0.014277  -0.019270  -0.007473  -0.023264  0.260892  0.051345  -0.054581  -0.047095  
+-0.036862  -0.045362  -0.026569  -0.079086  0.074983  0.066259  0.172655  0.049707  0.205190  0.299655  
+0.009602  0.007220  0.002585  0.008987  0.008924  -0.003263  -0.001148  0.009780  0.218932  0.175991  
+0.051917  0.046300  0.024000  0.127383  0.059467  0.060967  -0.141233  0.094567  0.144383  -0.002017  
+0.036573  0.030371  0.008621  0.075782  0.032315  -0.052194  -0.070661  0.006242  -0.061508  -0.021194  
+-0.000047  -0.002041  -0.006169  -0.030432  0.013736  -0.016709  -0.049318  -0.018628  -0.238399  -0.037973  
+-0.003013  0.000458  -0.001000  -0.014042  -0.005623  -0.009865  0.063800  0.022652  -0.034729  -0.025268  
+-0.003426  0.007303  0.008057  0.001098  0.020533  -0.029910  0.102869  0.013992  0.186352  0.117041  
+0.002862  0.001424  0.006865  0.020429  -0.012318  -0.001071  0.000359  -0.020094  0.015694  0.023368  
+-0.010474  -0.006716  -0.007608  -0.056379  -0.015004  -0.021466  -0.107909  -0.040405  -0.125884  -0.066207  
+0.001787  0.003128  -0.044574  -0.093447  -0.001351  -0.007617  -0.089340  -0.023170  0.128223  0.036064  
+-0.001844  0.002754  -0.001492  0.082852  0.005270  0.023287  0.070230  0.053607  0.163377  0.003803  
+0.014962  0.008449  -0.013397  0.159090  -0.002513  -0.004256  0.070487  0.050077  -0.115692  -0.107064  
+0.009945  0.004571  0.028934  0.068467  0.019495  0.024731  -0.038418  -0.012148  -0.208923  -0.128445  
+-0.042800  -0.062075  0.035050  -0.096800  -0.005425  0.097750  -0.103200  -0.040075  -0.169750  0.051550  
+-0.076047  -0.094438  -0.133813  -0.114297  0.027766  0.091641  -0.011391  -0.043828  0.206672  0.197063  
+-0.005171  -0.003276  -0.061342  -0.013776  -0.066342  0.019421  0.028724  0.164434  0.173250  -0.003605  
+0.012258  0.017275  -0.058942  -0.198558  0.018250  0.042883  -0.140675  -0.051450  -0.179533  -0.162567  
+-0.073746  -0.092841  -0.176444  -0.228436  -0.150476  -0.182603  -0.253278  -0.232786  -0.185627  -0.114032  
+0.047689  0.058933  0.058589  0.300344  0.252044  0.029778  0.314300  0.112933  0.043989  0.046744  
+0.101493  0.259416  0.435592  0.465500  0.168838  0.246937  0.377289  0.210000  0.209739  0.161197  
+-0.038057  -0.036321  -0.068632  -0.139641  -0.172679  -0.043726  -0.116925  0.047208  0.054792  0.030896  
+-0.053153  -0.057235  -0.047857  -0.162969  -0.246847  0.012163  -0.139510  -0.099765  0.008235  -0.028133  
+-0.069488  -0.075988  0.155402  0.087963  0.187256  0.098207  0.015890  0.004915  -0.049049  -0.023561  
+-0.011185  0.022913  0.161761  0.199609  0.151511  0.013620  -0.000293  0.101424  -0.032413  0.005750  
+0.028889  0.025824  -0.037481  0.088019  0.006287  -0.078722  -0.127324  -0.038500  0.074037  0.005972  
+-0.074831  -0.147608  -0.260008  -0.200785  -0.068392  -0.090877  -0.199277  -0.173569  0.036277  0.038800  
+-0.053474  -0.032447  -0.018184  -0.411737  -0.070224  0.042434  -0.030553  -0.062303  -0.198566  -0.103763  
+0.012852  0.100389  0.247648  -0.029167  -0.026481  -0.007981  0.087648  0.151815  0.016167  0.016148  
+0.052000  0.044094  0.037179  0.385462  0.104915  0.018123  0.097717  0.116953  0.218283  0.041491  
+-0.014217  -0.040983  -0.046667  0.283317  0.129633  0.108317  0.135617  0.180033  -0.012267  -0.048100  
+-0.027250  -0.008597  -0.016847  -0.202597  0.009569  0.105333  0.155361  0.021833  -0.057681  0.023458  
+0.037775  0.035125  -0.080200  -0.482250  -0.350850  -0.219100  -0.186850  -0.272300  0.087800  0.064750  
+0.012099  0.013645  -0.024678  -0.047829  -0.050329  -0.096691  -0.255757  -0.105145  0.030368  -0.012934  
+0.069385  0.051692  0.120519  0.257423  -0.051288  -0.027058  -0.053385  0.132596  -0.067615  -0.096000  
+0.013500  0.028914  0.116971  0.085200  -0.090843  -0.020200  0.043929  0.117429  -0.001614  -0.043086  
+-0.009279  -0.010651  0.048151  -0.028581  -0.147767  0.084802  -0.000419  0.052953  -0.102814  -0.101116  
+-0.028956  -0.036149  0.001886  -0.081684  -0.063965  0.176333  -0.015912  -0.029202  -0.054061  -0.114781  
+-0.024234  -0.008285  -0.056095  -0.087810  -0.055272  -0.036475  0.003443  -0.101241  -0.024000  -0.024443  
+-0.041276  -0.027966  -0.071276  -0.055397  0.037276  -0.037345  -0.006466  -0.079879  -0.136655  0.195672  
+0.003592  0.002282  0.002099  0.011134  0.023204  -0.018817  0.030479  0.024965  0.004190  0.159859  
+0.006156  0.005484  0.000812  0.007022  0.028613  -0.007495  0.033409  0.249484  0.049070  0.025070  
+0.005434  0.006566  -0.001730  0.020984  -0.005648  -0.088082  0.011320  0.005738  0.048500  -0.063541  
+0.031023  0.081114  0.154818  0.119045  0.050705  0.056477  0.050523  -0.240568  0.065250  0.051568  
+0.009300  -0.025214  -0.043257  0.177843  0.059086  0.067500  -0.062129  -0.129514  0.233200  0.107529  
+-0.017946  -0.012375  -0.076411  -0.221964  -0.184036  -0.091536  0.004339  0.174500  -0.154393  -0.114696  
+0.015296  0.044204  0.113130  -0.095704  -0.163037  -0.077574  0.065796  0.317833  -0.289241  -0.157389  
+0.016413  0.032946  0.120348  0.068761  0.037326  0.067304  -0.136174  -0.135304  -0.103826  -0.077641  
+0.027253  0.018089  0.014880  0.124342  0.198133  0.079506  0.210177  0.142316  0.120867  0.091348  
+-0.022413  -0.030613  0.027413  0.234987  0.441475  0.318300  0.424813  0.394662  0.215425  0.155400  
+-0.013829  -0.053573  -0.171354  -0.112049  -0.083073  -0.067829  -0.259671  -0.221000  0.206976  0.129037  
+-0.054054  -0.148464  -0.316071  -0.276375  -0.365161  -0.458705  -0.583929  -0.521964  0.056830  0.046312  
+0.017833  -0.000206  0.017500  0.008500  -0.265775  -0.065176  0.067951  0.000167  -0.172392  -0.113529  
+0.044409  0.118664  0.176600  0.147755  0.199918  0.188382  0.260191  0.368555  -0.045273  -0.020145  
+0.007352  0.005932  0.022685  0.015475  0.116809  0.056062  -0.017432  0.023852  -0.003759  -0.001173  
+-0.004315  -0.003948  -0.021310  -0.015887  -0.012992  -0.021778  -0.030177  -0.192298  -0.001540  0.008734  
+0.005403  0.001990  0.003260  -0.012255  -0.012776  -0.144515  0.014383  -0.001423  -0.034418  -0.032173  
+0.001422  -0.000709  0.001384  0.001922  0.002969  -0.007860  0.007283  0.109911  -0.054740  -0.029326  
+0.003028  0.003506  -0.001676  0.009631  -0.006460  0.102097  0.033199  0.047932  -0.004017  -0.001415  
+-0.007667  -0.007523  0.003316  -0.003287  0.015270  0.118529  0.033477  0.059466  0.055632  0.047414  
+0.002559  0.000697  -0.003928  0.002855  0.003414  0.096651  -0.011684  -0.059026  0.044645  0.040559  
+-0.024068  -0.037318  -0.002568  -0.022148  -0.110898  -0.059625  0.002625  -0.182534  -0.110852  0.008000  
+0.004233  -0.005100  0.001053  0.009087  -0.036020  -0.224273  -0.031660  -0.119833  -0.124653  -0.056727  
+0.029000  0.041643  0.025929  0.023560  -0.012690  -0.100786  -0.062369  0.129774  0.076083  0.011500  
+0.007040  0.011581  -0.017331  -0.008379  0.030548  -0.014669  -0.113895  0.082629  0.083306  0.054484  
+-0.001044  -0.001246  0.005261  -0.011335  -0.000831  0.038493  0.003827  -0.051268  -0.033471  -0.021790  
+0.014247  0.003123  0.029918  0.010603  0.012959  0.254212  0.053877  0.029452  0.003541  0.005719  
+0.036492  0.044943  -0.031811  -0.355262  -0.465680  -0.206779  -0.031549  0.049279  0.015730  -0.020607  
+0.057756  0.094802  0.107628  -0.090093  -0.406977  -0.401058  -0.116744  0.076407  0.136291  0.024151  
+0.184270  0.321010  0.437260  0.537590  0.672380  0.371880  0.219380  0.218040  0.086710  0.042220  
+-0.006141  -0.050234  0.026828  0.351906  0.663781  0.448031  0.146781  -0.067063  0.027359  0.028078  
+-0.000453  -0.044814  -0.143884  -0.478547  -0.661070  -0.213326  -0.227988  -0.217686  -0.057291  -0.051488  
+0.050242  0.012606  0.065576  -0.120121  -0.331712  0.178015  -0.025712  0.017197  -0.031864  -0.083106  
+0.001820  0.007205  0.018344  0.041992  0.363943  0.023861  0.022123  0.036016  -0.007336  -0.008139  
+-0.020678  -0.013911  -0.057767  -0.074444  -0.060878  -0.406222  -0.072511  -0.087256  -0.024867  0.016333  
+0.085190  0.061707  0.004086  0.265138  -0.094397  -0.355828  -0.119431  -0.060569  0.053931  0.001931  
+0.025722  0.013784  0.103531  0.273228  0.124395  0.248630  0.149617  0.117679  0.180691  0.045951  
+0.004470  0.002333  0.096091  0.086303  0.053038  0.390848  0.035159  0.032636  0.093045  0.023598  
+-0.006891  -0.000768  -0.005681  -0.117862  0.090957  0.074688  -0.052370  -0.023435  -0.046326  -0.023087  
+-0.007547  -0.003682  -0.011964  -0.126047  -0.014229  -0.034224  -0.021479  -0.041240  -0.092328  -0.021333  
+0.004316  0.017032  0.007380  -0.139114  -0.104013  -0.084608  0.014304  0.014203  -0.050013  -0.032943  
+0.041707  0.052026  0.004509  -0.003224  -0.138707  -0.046379  -0.000474  0.076552  0.001759  -0.001888  
+0.008398  0.007949  0.012720  0.035457  0.021665  0.053701  0.035630  0.076055  0.010276  0.003217  
+-0.026354  -0.021948  -0.005302  -0.087740  0.063323  0.174583  -0.003562  0.008146  0.039583  0.029010  
+-0.096891  -0.094709  -0.039027  -0.079791  -0.091573  -0.026427  -0.043564  -0.090300  0.094164  0.060500  
+-0.010027  -0.011345  -0.030554  0.007311  -0.164926  -0.189155  -0.072358  -0.134331  0.026473  0.008230  
+0.013559  0.014428  0.006757  0.043599  0.007145  0.013849  -0.007954  -0.116625  -0.049026  -0.064059  
+0.009093  0.020465  0.005419  0.050965  0.033721  0.040105  -0.059872  0.193477  -0.099046  -0.076023  
+-0.032074  -0.032766  -0.002362  -0.008713  0.005447  -0.093138  -0.072606  0.211777  -0.032574  -0.006915  
+-0.029674  -0.022849  -0.003512  0.003337  0.193477  0.033721  0.050058  0.191500  0.018512  0.045047  
+-0.051433  -0.051010  -0.005010  -0.018798  0.060490  0.264760  0.066865  -0.069692  0.123125  0.116183  
+0.110907  0.078759  -0.000111  0.097500  -0.255778  -0.092833  -0.062185  -0.233796  0.044574  0.002741  
+0.267000  0.312354  0.135188  0.138083  0.048500  -0.002604  0.028521  -0.031063  -0.053750  -0.016563  
+0.004336  0.006486  0.004829  0.022893  0.123921  0.050321  0.001886  0.123750  -0.030557  -0.006279  
+-0.023226  -0.024381  0.043131  -0.005167  0.065774  -0.008524  -0.018083  0.108488  0.040726  0.028143  
+-0.006643  -0.010955  -0.022026  0.005896  -0.070558  -0.158740  0.019929  -0.001195  0.041208  0.019929  
+-0.000862  -0.001147  -0.000839  -0.009321  -0.015339  -0.078193  0.037647  0.048922  -0.002885  0.007596  
+0.001797  0.001769  0.006734  -0.004589  0.009929  0.047054  -0.003269  0.026554  -0.002089  0.002026  
+0.005743  0.002605  0.014819  0.010671  0.027881  0.051524  -0.062695  0.015943  -0.024871  0.009971  
+-0.001884  -0.001869  -0.003037  -0.015687  0.007897  -0.002422  -0.095312  -0.020094  -0.017834  -0.022597  
+-0.009531  -0.004000  -0.010382  -0.021316  -0.024333  -0.009294  -0.060930  -0.040588  -0.014276  -0.078110  
+-0.004457  0.003506  0.004346  -0.001401  0.026870  0.096599  0.154481  0.004784  0.043827  0.019914  
+-0.004714  0.000145  -0.004559  -0.007000  -0.018759  -0.018914  0.177318  0.064973  0.027618  0.047991  
+0.001250  -0.006436  -0.019203  -0.009855  -0.040657  -0.106558  -0.090930  -0.029971  -0.061610  -0.052593  
+-0.003919  -0.002265  0.004015  0.008415  0.000958  -0.014715  -0.174146  -0.048227  -0.030269  -0.049696  
+0.009301  0.005724  0.033612  0.016872  0.034755  0.163311  0.040597  0.030643  0.007929  -0.021357  
+0.001819  0.008112  0.022675  0.023606  0.072575  0.012969  0.143281  0.055044  -0.002894  0.041800  
+0.001732  0.010375  -0.033420  -0.004205  -0.030116  -0.145205  0.054795  0.091134  0.027902  0.053554  
+-0.016948  -0.009078  -0.059905  -0.030440  -0.067129  -0.062483  -0.020164  0.044578  0.091138  0.054103  
+-0.004038  -0.002604  0.007075  0.019849  0.016953  0.017113  -0.227019  -0.114925  0.165689  0.053500  
+-0.002102  -0.005102  -0.000046  0.013676  0.030991  0.098704  -0.041315  -0.161444  0.036278  0.008630  
+-0.053149  -0.090541  0.055568  -0.041703  0.010986  0.129108  0.052041  -0.011811  -0.450000  -0.153851  
+0.011750  -0.011845  -0.019774  -0.045774  -0.027155  -0.066095  -0.080667  -0.088607  -0.501571  -0.277548  
+0.003011  0.023174  -0.005478  -0.065033  -0.178457  -0.108989  -0.037707  -0.020620  0.363869  0.201261  
+-0.013268  -0.009963  -0.030744  -0.044415  0.037598  0.070720  0.012085  0.029098  0.485976  0.203061  
+-0.022900  -0.028083  0.059483  -0.049200  0.020750  0.288100  0.109267  0.149533  -0.161417  -0.236367  
+0.009394  -0.015926  0.081362  0.078372  0.116702  0.102340  0.035585  0.056670  -0.341851  -0.037660  
+-0.043394  -0.022333  0.033909  0.056561  0.217742  -0.121273  -0.031652  0.032485  0.004136  0.088136  
+-0.016239  -0.023813  -0.031396  -0.004030  -0.105821  -0.134328  0.149007  0.007134  0.096910  0.120806  
+-0.013833  -0.014689  -0.023750  -0.015894  -0.217394  -0.148378  0.026511  -0.013489  -0.001978  -0.004594  
+0.004176  0.008507  -0.009155  -0.028423  -0.090944  -0.046444  -0.209056  0.010190  -0.023711  -0.069197  
+0.004243  0.008191  0.004647  0.022390  -0.008618  0.077206  -0.263176  -0.039728  -0.002551  -0.047360  
+0.006581  0.004157  0.010657  0.000329  0.036519  0.035329  -0.134257  0.005543  0.025862  0.015605  
+0.003385  0.002622  0.004392  0.023395  0.012941  0.024976  0.020909  0.020287  0.025944  0.057612  
+-0.006261  -0.000565  0.000935  0.011609  -0.018804  -0.026812  0.113384  0.015580  -0.024101  -0.082036  
+-0.032761  -0.058967  0.000076  0.012272  0.010739  0.063978  0.040793  -0.140304  -0.191467  -0.244424  
+-0.002402  -0.001880  0.014185  -0.016707  -0.018054  0.063989  -0.007359  -0.163293  -0.148370  -0.054946  
+0.021384  0.027638  0.041775  0.089065  0.079225  0.059703  0.059638  0.065913  0.289029  0.269761  
+0.075389  0.101153  0.145347  0.145028  0.004681  -0.022000  0.208639  0.262195  0.361389  0.269556  
+0.012109  0.014406  -0.039937  -0.100656  -0.056906  -0.215984  0.154828  0.104578  -0.191875  -0.091812  
+-0.000317  -0.010667  -0.026133  -0.012800  -0.099792  0.012017  -0.042700  -0.048692  -0.121483  -0.156817  
+-0.045480  -0.039539  0.037971  -0.006529  0.015863  0.117157  -0.148598  -0.090706  0.020343  0.011206  
+-0.001388  -0.000044  -0.006131  0.002694  -0.024898  -0.051694  -0.100243  -0.002738  0.034801  0.021825  
+-0.003100  -0.001300  -0.012485  -0.005774  -0.024096  0.003226  0.040259  0.022730  0.001189  0.014856  
+0.001557  -0.004116  0.020582  -0.010698  -0.001491  0.063230  -0.000013  -0.016097  0.002330  0.007843  
+0.012824  0.007808  0.037907  -0.001225  0.017956  -0.026434  -0.003813  0.010368  -0.023445  -0.009621  
+-0.001600  0.003753  -0.015384  0.019568  0.036889  -0.108195  -0.002295  -0.012789  -0.022484  0.002863  
+-0.021278  -0.010460  -0.084167  0.026619  0.003929  -0.065016  -0.026992  -0.015397  -0.019246  0.004532  
+-0.008147  -0.011787  0.073073  0.004127  -0.001120  0.102687  -0.023867  0.024340  -0.033773  -0.030347  
+0.033000  0.059336  0.144721  0.037025  0.064525  0.113582  -0.034164  0.015418  0.065361  0.014287  
+-0.005375  0.002111  -0.024181  0.036326  0.095736  -0.032271  0.006799  -0.029951  0.034576  0.015326  
+0.008000  -0.013762  -0.100437  0.071925  0.057312  -0.034862  0.125025  0.034387  -0.003413  0.000612  
+0.093821  0.084244  -0.089256  -0.024192  -0.107885  -0.257423  0.045821  0.051000  0.029333  -0.007410  
+0.007302  0.016965  -0.075163  -0.083500  -0.143570  -0.392186  -0.133686  -0.113895  0.152128  0.107802  
+-0.175771  -0.213958  0.063396  -0.122792  0.076354  0.314167  -0.022271  -0.074417  -0.167542  -0.027479  
+0.045853  0.160647  0.481941  0.485559  0.613853  0.415618  -0.153412  -0.085382  -0.029618  -0.006000  
+0.039571  0.011768  -0.067500  0.054018  0.073946  0.186786  0.101964  0.023464  -0.018982  -0.225375  
+-0.099618  -0.251368  -0.413412  -0.432735  -0.560662  -0.521265  0.001191  0.029397  -0.050441  -0.003000  
+0.042980  -0.031235  -0.116133  -0.161255  -0.385214  -0.455133  0.136490  0.029276  0.012010  0.068990  
+-0.009442  -0.012135  -0.127692  -0.227135  0.243269  0.060096  -0.078577  0.027058  -0.009827  -0.050058  
+-0.004410  -0.009885  -0.041654  -0.025308  0.328051  0.385487  -0.115628  -0.045167  0.038179  -0.048372  
+0.214181  0.354104  0.541776  0.457078  0.069233  0.039155  0.069078  0.109621  0.231603  0.166741  
+0.160830  0.341574  0.416734  0.136096  -0.034138  -0.067149  0.131862  0.159160  -0.034872  -0.042968  
+-0.112851  -0.198311  -0.173595  -0.125459  -0.034257  0.026351  -0.132405  -0.106500  -0.161892  -0.160392  
+-0.096607  -0.157393  -0.092845  -0.027714  0.067476  0.054929  -0.007857  0.018143  -0.008750  -0.037524  
+0.077854  0.147677  0.056573  -0.070865  0.000979  0.012771  0.013594  0.054260  0.055385  0.031885  
+-0.003318  -0.001693  -0.000159  -0.037918  -0.022625  -0.030503  -0.009554  -0.036841  -0.019616  -0.008378  
+0.003737  0.009435  -0.041291  0.026025  0.004493  0.003705  0.010076  0.016568  -0.006795  -0.005094  
+0.003355  -0.001776  -0.146711  0.014934  -0.014776  0.025921  0.007671  0.050776  0.014855  0.010987  
+-0.045019  -0.023991  -0.022925  -0.025566  -0.024415  -0.003953  0.000358  -0.002717  0.009698  -0.014981  
+-0.046216  -0.050830  0.051989  -0.043989  -0.001614  0.014875  -0.028409  -0.047239  -0.028182  -0.005466  
+-0.017721  -0.023279  0.041827  -0.050885  0.079538  0.037654  0.035298  0.017769  -0.006058  0.008942  
+0.000029  -0.000511  0.001004  -0.004445  0.049191  0.012618  -0.031136  -0.021614  0.019529  0.024107  
+0.003830  0.008610  -0.008632  0.075022  -0.059489  -0.041330  -0.036291  -0.011269  0.005060  -0.016165  
+0.007312  0.003279  0.023558  0.048968  -0.129370  -0.048318  0.018162  -0.013084  -0.043377  0.012227  
+0.001801  0.000012  0.006349  0.002398  -0.067253  0.035633  0.034018  0.013361  0.023054  0.047265  
+-0.042630  -0.056100  -0.097790  -0.010760  -0.033250  0.125790  0.099250  0.011160  0.084780  0.058650  
+-0.019973  0.022662  -0.139068  -0.171041  -0.000230  -0.229122  -0.003743  0.020757  -0.087216  0.012486  
+0.053818  0.129045  0.081477  -0.068773  0.112682  -0.247727  -0.063682  0.002568  -0.160068  -0.089932  
+0.010377  -0.003331  0.142546  0.298108  0.151223  0.161177  0.005838  -0.010708  0.076200  0.016446  
+-0.085900  -0.151300  -0.057520  0.121000  -0.050900  0.139740  -0.063560  -0.101160  0.078460  -0.004840  
+0.050750  0.014933  -0.132117  -0.324917  -0.346233  0.137817  0.165217  0.019550  -0.052717  -0.083317  
+0.136606  0.141106  0.047455  -0.064045  -0.171561  -0.111212  0.096333  0.151000  -0.103121  -0.043061  
+0.008115  0.018656  0.026500  0.180531  0.147271  -0.167552  -0.046750  -0.065781  -0.035312  -0.020823  
+-0.075940  -0.094400  0.025850  0.056480  0.176060  0.040370  -0.046940  -0.092550  -0.013380  0.023520  
+-0.002714  -0.003187  -0.001313  -0.015011  0.025687  0.120121  -0.060648  -0.027819  0.008341  -0.009280  
+-0.004375  -0.001625  -0.012362  -0.007506  -0.006588  -0.143100  -0.017769  0.028500  0.014188  0.011200  
+-0.002634  0.005128  -0.038977  0.025535  -0.016279  -0.065273  0.033395  0.007006  -0.002965  -0.017017  
+0.006018  0.004974  0.004287  0.009669  0.006989  0.048140  0.068379  0.019904  -0.010853  -0.008096  
+0.006892  -0.000575  0.051986  0.020429  0.018042  0.070943  0.028108  0.041382  0.014146  0.017264  
+-0.001965  0.000791  -0.006287  0.018858  -0.017626  0.046098  -0.015035  -0.004606  0.031154  0.009268  
+-0.000570  -0.001705  -0.003311  -0.007500  -0.000036  -0.043606  -0.005964  0.006831  -0.035742  -0.052692  
+-0.002836  -0.006388  -0.018280  -0.007056  -0.004346  -0.105981  -0.018668  -0.028019  -0.104234  -0.044388  
+0.017152  0.008455  0.030015  0.073985  0.054455  0.022182  -0.014553  -0.065144  -0.019659  0.009629  
+-0.002798  -0.003921  0.046545  0.139225  0.090118  0.177197  0.066539  -0.016657  0.131331  0.061472  
+0.011862  0.027687  0.003125  0.146787  0.239913  -0.138588  -0.171450  -0.115838  0.118200  0.087762  
+-0.009185  -0.012352  -0.024759  0.210852  0.268852  -0.341074  -0.371537  -0.369759  -0.147926  -0.069278  
+0.018933  0.007017  -0.067800  -0.480050  -0.567567  0.057200  0.195300  0.199500  0.064417  0.075600  
+-0.004214  -0.026143  -0.011571  -0.217881  -0.161476  0.337000  0.475857  0.415452  0.074048  0.038548  
+0.008514  0.005020  0.014385  0.320196  0.392453  0.029324  0.033851  0.017689  -0.005791  0.015095  
+0.010763  0.015816  0.031500  0.249092  0.276237  -0.051803  -0.013224  -0.151118  -0.101750  -0.044421  
+0.006668  -0.003826  0.060804  0.003234  -0.034375  -0.021832  -0.000967  -0.019250  -0.008935  -0.003609  
+-0.002211  -0.000725  -0.005763  -0.005243  0.000632  -0.066836  -0.014348  0.002357  0.000591  0.001690  
+-0.005605  0.000880  -0.040275  -0.032645  -0.017135  -0.082090  0.011020  -0.017120  0.003110  0.008130  
+-0.001875  -0.000208  -0.006584  -0.005323  -0.004818  0.006117  0.006784  0.001483  0.012628  0.010504  
+-0.000615  -0.002010  0.002647  -0.009829  0.005752  0.094371  0.006986  0.008042  0.022350  0.017822  
+-0.002955  -0.002721  -0.000805  -0.016006  0.004377  0.017864  -0.043104  -0.047383  -0.000471  0.005455  
+0.003698  0.002401  0.004843  0.007519  -0.004472  -0.022173  -0.033515  -0.033599  -0.003870  -0.007966  
+-0.003271  -0.003602  0.000071  0.010410  -0.049564  -0.029519  -0.008301  -0.049128  0.055455  0.033857  
+-0.001424  -0.005076  -0.024946  -0.020087  -0.118783  -0.147848  -0.013478  -0.071717  0.025239  0.137413  
+-0.003856  0.002040  -0.007057  -0.031000  -0.050080  -0.106523  0.029856  0.020063  -0.127149  -0.039592  
+0.009808  0.016400  0.020692  0.036100  0.080000  0.033583  0.041275  0.052942  -0.108642  -0.141492  
+-0.013506  -0.004801  0.048712  0.004801  0.169462  0.163064  0.086705  0.064981  0.085577  0.044346  
+0.005885  0.010123  -0.002269  -0.042831  -0.135677  0.000177  0.009254  -0.008862  0.086708  0.114177  
+-0.007121  -0.005667  -0.052201  -0.087454  -0.229046  -0.073264  -0.028615  -0.063874  -0.074523  -0.056109  
+-0.049612  -0.043776  0.005633  0.066908  0.386949  0.207245  -0.096153  -0.087255  -0.098551  -0.042122  
+0.007417  -0.004810  0.098393  0.386179  0.592643  0.214940  -0.196488  -0.131786  -0.034714  -0.011512  
+-0.039753  -0.068063  -0.044139  0.172696  0.291297  0.231494  0.037006  -0.003000  0.069677  0.040101  
+-0.076897  -0.115192  -0.164244  -0.048462  0.125154  0.015103  -0.129820  -0.152833  -0.040231  0.013064  
+0.062543  0.092000  -0.038529  -0.456600  -0.711672  -0.453143  0.028471  0.066129  -0.045057  -0.016129  
+0.085650  0.118983  0.076150  -0.181017  -0.532267  -0.311950  0.212300  0.227583  0.068900  0.055150  
+-0.079574  -0.110382  -0.103191  -0.004721  0.383971  0.480191  0.223912  0.217191  0.221441  0.080250  
+-0.203395  -0.298263  -0.258947  0.024289  0.287579  0.237789  0.158868  0.104632  -0.021763  -0.043158  
+0.100903  0.133161  0.124935  0.148613  0.067919  -0.139726  -0.092081  -0.154000  -0.233113  -0.111645  
+0.057020  0.070461  0.096275  0.126186  0.191559  -0.048108  -0.080873  -0.009735  -0.077059  -0.021010  
+0.007764  0.002397  0.008580  0.006713  -0.019385  0.072724  -0.019971  0.058310  0.057144  0.011172  
+-0.004052  -0.006414  0.079121  -0.038759  -0.023328  -0.018448  0.011302  -0.021043  0.053802  0.051198  
+-0.001127  0.003290  -0.031571  -0.010067  -0.020996  -0.146488  -0.024313  -0.085897  -0.010869  -0.014409  
+-0.019683  -0.027793  -0.107317  -0.037238  -0.071628  -0.157994  -0.036585  -0.098585  -0.043610  -0.030537  
+-0.001324  -0.002370  -0.015639  -0.006954  -0.026880  0.109000  -0.019648  0.111333  0.004102  -0.002296  
+0.005493  0.011118  0.054603  0.038809  0.015132  0.141662  0.049132  0.167103  0.102971  0.048066  
+-0.001552  0.001035  -0.004058  0.001924  0.022355  -0.071901  0.076360  -0.006669  0.002762  0.016634  
+-0.007608  -0.000366  -0.014414  -0.029247  0.020247  0.002349  0.039441  -0.079769  0.022602  0.010742  
+-0.001919  -0.009517  0.010587  -0.045250  -0.037279  0.051634  -0.036988  -0.028669  0.035593  0.021134  
+-0.004728  -0.003076  -0.007008  -0.015100  -0.046736  0.001164  -0.079296  -0.003848  -0.002736  0.002888  
+0.010773  0.006101  -0.028490  0.059348  0.067010  0.037364  -0.014722  0.009318  -0.014894  -0.020753  
+-0.001348  -0.009366  -0.005304  -0.083795  -0.148420  0.090857  0.111509  0.016080  0.045036  0.042446  
+-0.027104  -0.020348  -0.047616  -0.170732  -0.205262  -0.218146  0.019841  0.037591  -0.059543  -0.023366  
+0.037714  0.034929  -0.031821  0.084036  0.091500  -0.331589  -0.048232  -0.067607  -0.199339  -0.148946  
+0.101633  0.096117  0.068233  0.244700  0.213000  0.075525  0.067242  0.043400  0.074900  0.077475  
+-0.048125  -0.009080  0.114107  0.048491  0.141161  0.373170  0.118625  0.161348  0.290830  0.153545  
+0.000514  0.023458  0.085486  -0.112431  0.008097  0.088736  0.038972  0.075417  0.064833  0.056292  
+-0.010239  -0.007261  0.026193  0.153080  0.028375  -0.105784  0.014091  0.026852  0.011250  0.002659  
+0.034875  0.033429  -0.149875  0.012982  -0.109929  -0.059018  0.009964  -0.029286  -0.068214  0.009161  
+-0.031942  -0.088212  -0.278423  -0.359308  -0.066317  -0.033404  -0.091423  -0.136019  -0.255087  -0.170135  
+-0.008269  -0.005857  -0.024891  -0.139597  -0.014122  -0.013319  -0.013336  -0.008626  -0.026655  -0.011374  
+0.043679  0.072538  0.216085  0.246538  0.023538  0.087802  0.134132  0.202340  0.090613  0.045934  
+-0.032072  -0.054289  0.007902  0.253350  0.324722  0.247443  0.209340  0.128644  0.000160  -0.000515  
+-0.112767  -0.219667  -0.350700  -0.217950  0.125500  0.046783  0.049683  -0.030217  -0.252500  -0.136333  
+0.064419  0.061927  0.054710  -0.161734  -0.606532  -0.406718  -0.192944  -0.139742  -0.167177  -0.115710  
+0.178280  0.306480  0.410660  0.100420  -0.313060  -0.213480  -0.003460  0.165680  0.231740  0.118580  
+-0.014806  0.004917  0.063046  0.220991  0.495796  0.494759  0.068194  0.073806  0.064870  0.000398  
+-0.112880  -0.263100  -0.433440  -0.176090  0.011180  -0.127630  -0.204240  -0.209740  -0.221260  -0.105410  
+-0.104924  -0.232169  -0.436907  -0.334288  -0.310110  -0.502729  -0.240212  -0.297670  -0.090415  -0.034559  
+0.005170  0.027740  0.076850  0.087880  0.104610  0.165770  0.085110  0.150810  0.133040  -0.051800  
+0.041011  0.066130  0.132815  0.128141  0.136815  0.221848  0.144435  0.132793  -0.133435  -0.082902  
+-0.000008  -0.001043  -0.000791  0.003189  0.010795  0.014925  -0.003732  0.028343  -0.063405  -0.013760  
+0.006713  0.003713  0.004262  0.032354  -0.019659  0.021939  -0.088531  0.010799  0.074707  0.019165  
+0.001586  0.000657  0.005131  0.004123  -0.002724  0.017817  0.017194  -0.058593  0.031269  0.010526  
+0.000142  -0.001939  0.002835  -0.002830  0.001222  -0.008038  0.023458  -0.035939  -0.041778  0.030915  
+-0.004182  -0.004482  -0.001158  -0.020227  0.001848  -0.009094  0.014106  -0.002021  -0.077539  -0.035212  
+0.000746  0.000717  -0.003783  0.000402  0.000610  0.006292  0.006237  0.011543  -0.029697  -0.047113  
+0.003366  0.002763  0.006305  0.014268  -0.004097  0.008347  -0.012582  0.019737  0.028305  0.016358  
+0.001207  0.000553  -0.002813  0.002957  0.012697  -0.010987  -0.016720  -0.008860  0.064260  0.059973  
+0.006075  0.004595  0.001972  0.008115  0.023706  -0.038964  0.013794  0.040556  0.052433  0.053036  
+0.010793  0.014598  0.025674  0.034000  0.039022  0.037065  0.078924  0.080630  0.055902  -0.111283  
+0.002763  -0.000026  0.001612  0.014599  0.017428  0.075914  0.030697  -0.001882  -0.057717  -0.087605  
+-0.006159  -0.008971  -0.001376  0.014824  0.047600  0.077153  -0.061418  -0.099406  -0.054382  -0.007141  
+-0.002724  -0.005586  -0.003810  -0.018448  -0.021974  -0.031517  -0.075543  -0.072026  -0.057638  0.056345  
+0.001583  0.003090  -0.009226  0.005545  -0.011274  -0.066996  0.002981  -0.006143  0.058823  0.033195  
+-0.001360  -0.000728  -0.000664  -0.004356  0.010088  0.015076  -0.038940  -0.007928  0.026688  -0.015752  
+0.001356  0.000406  -0.002772  -0.000722  0.001000  0.042639  0.014472  0.041439  -0.151728  -0.027711  
+-0.002087  -0.001855  0.000855  -0.012326  -0.001831  -0.027888  0.082831  0.085479  -0.068719  -0.011095  
+0.006795  0.010609  -0.014205  0.001532  -0.020141  -0.064622  0.099942  0.071673  0.128462  0.037840  
+-0.005100  -0.002653  -0.002141  0.004865  -0.013000  -0.026224  0.008359  -0.009406  0.147859  -0.014576  
+0.000990  0.000720  -0.019890  0.015520  0.015780  0.065610  0.009120  -0.005060  0.024090  -0.068260  
+-0.015131  -0.017619  -0.006091  -0.002415  0.035392  0.099494  -0.032011  -0.043045  -0.082557  -0.069989  
+-0.001912  -0.002494  0.000967  -0.013158  0.015645  0.027661  -0.039448  -0.011015  -0.068873  -0.040970  
+-0.008172  -0.007994  0.016374  -0.005770  0.013971  0.143707  0.057782  0.154667  -0.024489  -0.032862  
+-0.002478  -0.002809  -0.003743  -0.013043  0.006426  0.026222  0.108548  0.113922  -0.014513  0.044670  
+-0.013655  -0.011474  -0.035052  -0.023284  -0.064345  -0.294302  -0.123112  -0.162991  -0.028440  0.046147  
+0.042238  0.039548  -0.039762  0.061893  -0.027595  -0.481012  -0.170083  -0.182405  -0.015714  0.016083  
+0.021930  -0.002260  0.002730  0.025490  -0.144510  -0.221450  0.210810  0.117630  -0.005800  0.001040  
+0.011939  -0.020348  -0.020152  -0.094227  -0.074727  0.544258  0.376879  0.151182  0.043212  0.012591  
+-0.009926  0.005296  0.130278  0.127019  0.390537  0.736463  0.079185  -0.016667  0.047204  0.031722  
+0.024109  0.098793  0.157228  0.160630  0.305587  0.077500  -0.044663  -0.021565  0.041826  0.058217  
+0.098042  0.118000  0.095875  0.132083  -0.367792  -0.595708  0.016625  0.114667  -0.016917  0.037125  
+0.050713  -0.005981  -0.160546  -0.155537  -0.266611  -0.589306  -0.117787  -0.133130  -0.226731  -0.129278  
+-0.030696  -0.050411  -0.078143  -0.150036  0.166679  0.285929  -0.030393  -0.076875  -0.187661  -0.067750  
+-0.040712  -0.055515  0.014053  0.008727  0.204599  0.354780  0.142651  0.053394  -0.010598  0.010515  
+-0.018292  -0.014177  0.062723  0.075662  -0.012054  0.053954  0.138308  0.083154  0.107300  0.035738  
+-0.005433  -0.004732  0.000970  -0.081140  -0.009726  -0.014518  -0.006689  -0.016537  0.153177  0.056726  
+-0.014786  -0.010464  -0.004429  -0.127274  -0.020435  -0.002827  -0.018167  -0.028780  -0.179607  -0.097238  
+-0.004944  -0.012112  -0.000851  0.012478  -0.019549  -0.018810  -0.004642  0.002545  -0.190019  -0.073746  
+0.004615  0.001797  -0.001236  0.002152  0.003787  0.003118  0.029959  -0.004713  0.116226  0.084135  
+-0.003201  0.001244  -0.021671  -0.050680  -0.011709  -0.020637  -0.023419  -0.010748  -0.000081  0.005551  
+0.004291  0.004296  0.001937  0.049985  -0.010927  -0.020927  0.027223  -0.019282  -0.057456  -0.035053  
+0.006867  0.013171  0.052506  0.127089  -0.004405  0.010785  0.030981  0.055316  0.200930  0.084462  
+0.000332  0.000889  -0.000630  -0.011712  -0.012842  0.002582  -0.027323  -0.016494  0.061006  0.013437  
+-0.017842  -0.010411  -0.016856  -0.113084  -0.051505  -0.074698  -0.049980  0.002624  -0.147995  -0.060614  
+-0.036365  -0.026548  -0.080905  -0.116810  -0.079563  -0.062937  0.068413  0.000675  0.060825  0.078468  
+-0.000642  0.003167  0.017556  0.009951  0.019716  0.121920  0.045111  0.036506  0.213420  0.138839  
+0.015230  0.063257  0.209189  0.063743  0.028608  0.086784  -0.036811  0.032635  -0.111338  -0.090189  
+-0.071484  -0.125459  -0.151557  -0.104164  -0.156861  -0.199836  -0.116467  -0.145934  -0.331148  -0.258279  
+-0.104328  -0.205948  -0.366345  -0.163638  0.097328  0.103603  0.062069  0.003328  0.134397  0.047690  
+0.142062  0.272494  0.418216  0.402957  0.239265  0.361722  0.400809  0.415210  0.490099  0.290463  
+0.062518  0.060625  0.029625  -0.063321  -0.003339  -0.180411  -0.167482  -0.188821  -0.273036  -0.022661  
+-0.098154  -0.250231  -0.414452  -0.373673  -0.194779  -0.231692  -0.294962  -0.453923  -0.319865  -0.125365  
+-0.007230  0.011836  0.064033  0.217025  0.035811  0.101779  0.161926  0.146148  0.373197  0.127779  
+-0.268893  -0.217893  0.036429  -0.093786  -0.039250  -0.032214  0.048214  0.063964  0.121286  0.025714  
+-0.043619  -0.076964  0.029607  -0.094726  -0.067964  0.057976  -0.259952  -0.170345  -0.354250  -0.393679  
+0.062336  0.095031  0.158016  0.156297  0.124312  0.194844  0.027148  0.027156  -0.003141  -0.022398  
+0.156955  0.173545  -0.024455  0.053136  -0.065152  -0.107318  0.172803  0.131045  0.169530  0.098833  
+0.008745  -0.001968  -0.184989  -0.030074  -0.031723  -0.156160  -0.077532  -0.024628  0.109638  0.068340  
+-0.080500  -0.098097  -0.008274  -0.001597  0.079984  -0.033097  0.035452  -0.032226  0.062032  0.050161  
+-0.033098  -0.046461  -0.038627  -0.045686  -0.064078  0.112255  0.157373  0.012951  -0.013814  -0.034716  
+-0.002198  -0.001299  0.001858  -0.008096  -0.008864  -0.015204  -0.005824  -0.006364  -0.128488  -0.025062  
+0.005184  0.012857  0.086684  0.007449  0.045592  -0.040571  -0.117163  -0.018327  0.014398  0.046449  
+0.011670  0.005106  0.024638  0.024482  0.001963  0.051353  -0.008679  0.007950  0.065385  0.069147  
+-0.000672  -0.000181  -0.011690  -0.029422  -0.094440  0.020103  0.127216  0.013000  -0.017690  -0.034957  
+-0.014961  -0.018844  -0.017000  -0.074578  -0.100883  0.000786  0.059623  0.070883  0.022045  0.008584  
+-0.087510  -0.108625  -0.099010  -0.093779  -0.084548  -0.116423  -0.082865  0.037308  -0.028875  -0.039702  
+-0.002520  -0.008364  -0.030081  -0.003540  -0.056641  -0.099884  -0.014818  -0.049288  -0.198687  -0.157838  
+0.014619  0.018000  0.015774  0.005071  0.089286  0.002226  -0.110857  -0.062500  -0.145190  0.041226  
+0.011560  0.014190  0.036976  0.061286  0.038405  0.131119  -0.091048  -0.062786  0.205964  0.233048  
+0.001085  0.009457  0.006646  0.006585  0.006970  -0.004061  -0.033701  -0.034732  0.287866  0.050652  
+0.002116  0.010488  -0.016663  -0.016360  -0.036047  -0.131337  -0.038581  -0.072116  0.051326  -0.118605  
+-0.039740  -0.027894  0.002385  -0.025692  -0.095519  -0.084798  -0.054308  -0.020077  -0.014587  0.053596  
+-0.028877  -0.029500  -0.004877  -0.072575  0.063085  0.133991  0.072311  0.060868  -0.173170  -0.008858  
+-0.007779  0.000314  0.015860  0.002360  0.076140  0.014070  0.151907  0.156849  -0.270023  -0.163279  
+0.115757  0.153176  0.100703  0.036608  0.027851  -0.111297  0.059257  0.088878  -0.027365  0.003689  
+0.005651  0.005314  0.013628  0.085128  -0.029733  -0.023942  -0.016215  -0.014733  0.099430  0.086942  
+-0.007665  -0.008813  -0.007659  -0.007500  0.015352  0.045126  -0.018769  0.006297  0.070022  0.052429  
+-0.002822  -0.000780  -0.009629  -0.000171  0.009027  -0.026959  -0.001551  -0.028615  0.019800  0.012029  
+-0.001954  -0.001802  0.000660  -0.003731  -0.015753  -0.035785  0.020177  0.008323  -0.000228  -0.003408  
+-0.002350  0.000324  -0.014718  -0.030510  0.010503  -0.024710  0.015715  0.018826  -0.008987  -0.000044  
+-0.004361  -0.003962  -0.002820  -0.055244  0.005589  0.031332  -0.002908  0.005184  -0.002968  -0.007528  
+-0.001146  -0.000782  -0.001478  0.003246  -0.028160  -0.003854  0.001311  -0.028498  0.000378  -0.009242  
+0.004580  0.003674  -0.005045  0.055969  0.002444  -0.005507  -0.006308  -0.009596  -0.001379  -0.004007  
+0.006414  0.001939  0.010273  0.019871  0.013050  0.041842  -0.000032  -0.003403  0.010273  0.014187  
+0.002212  -0.005414  0.023106  -0.008332  0.012479  0.008702  -0.010493  -0.009637  0.001695  0.006010  
+-0.009308  -0.004902  -0.016013  -0.001363  0.011299  -0.044590  -0.053124  -0.038372  -0.001936  0.012419  
+-0.000102  0.000734  -0.003380  0.011482  0.028570  0.003627  0.006918  -0.002998  -0.002077  -0.006086  
+0.004382  0.002838  0.008794  0.003917  0.038285  0.014772  0.019513  0.038794  -0.013570  -0.013781  
+0.006551  0.004193  0.009784  0.063635  0.027517  0.035959  0.006872  0.004429  0.040520  0.007429  
+-0.004698  0.004864  -0.039346  0.032673  0.012821  0.017525  -0.002451  -0.019333  0.035525  0.032802  
+-0.000776  0.016872  -0.053128  -0.031244  0.012321  0.012840  -0.010603  -0.005186  -0.007372  -0.005462  
+-0.014492  -0.015811  -0.018432  -0.057538  -0.088614  0.042636  -0.024530  -0.022364  -0.077364  -0.009705  
+-0.037273  -0.056791  0.010691  0.033900  -0.158409  -0.052882  -0.049991  -0.083382  0.024091  0.016627  
+-0.003157  -0.001150  -0.006483  0.004017  -0.014930  -0.073450  -0.003423  -0.054793  -0.009897  -0.014997  
+0.014386  0.010920  -0.034102  -0.047693  0.082648  -0.058148  -0.015705  0.007443  -0.147352  -0.122011  
+0.002500  0.001875  0.024760  -0.016708  0.061958  -0.056042  0.034615  0.108573  -0.007490  0.024563  
+0.012351  0.010014  0.007973  0.024291  -0.019041  -0.043709  -0.012095  0.121439  0.036466  0.049230  
+0.000342  -0.000125  0.000776  0.030243  -0.027276  -0.005605  0.006342  -0.026217  0.046211  -0.066461  
+-0.003454  0.004880  -0.054972  -0.038722  -0.088667  0.051815  0.014176  -0.070306  0.071944  -0.007667  
+-0.008877  -0.018849  -0.016255  -0.100170  -0.144396  0.187594  0.039142  0.078123  0.016160  -0.023142  
+0.012598  0.000902  0.022484  0.006311  -0.010484  0.184672  -0.039934  -0.033164  0.040221  0.051902  
+-0.000157  -0.000491  0.000109  -0.001157  -0.022535  -0.032426  -0.024443  0.041774  0.042700  0.022378  
+0.000731  0.002894  0.002750  0.016692  -0.009606  -0.304721  0.004077  0.106317  -0.040837  -0.032433  
+0.008609  0.013482  0.010973  0.051173  0.078527  -0.173145  -0.047255  0.006055  -0.091164  -0.053864  
+0.016363  0.016157  0.033588  0.075637  0.102637  0.065765  -0.162118  -0.059931  -0.050814  -0.041520  
+0.004143  -0.000714  0.027850  0.108086  0.137864  0.168607  -0.114871  -0.078593  0.042264  0.012364  
+-0.001169  -0.007077  -0.012261  0.119070  0.095099  -0.001958  -0.023824  -0.031310  0.093606  0.054282  
+-0.112548  -0.105355  0.047371  0.147452  0.069323  0.047242  0.084258  0.088790  0.062032  0.030806  
+-0.018911  -0.003573  -0.015879  -0.245605  -0.005565  0.003339  -0.007403  0.014379  -0.003153  0.006710  
+0.001047  0.019102  -0.123906  -0.161578  -0.133852  -0.041984  0.001398  -0.022477  0.024969  0.002875  
+0.151359  0.136875  0.153422  0.150484  0.008484  0.038781  0.214688  0.096250  -0.102266  -0.085531  
+0.013304  0.012837  0.096924  0.142239  0.005913  0.003272  -0.019750  -0.008076  -0.127609  -0.040565  
+-0.010875  -0.004243  -0.049396  -0.138590  -0.077472  -0.059028  -0.418618  -0.122486  -0.080278  -0.135271  
+-0.008542  -0.004621  -0.001826  -0.039784  0.015626  0.005153  -0.097305  -0.013795  0.057232  -0.032000  
+0.028654  0.026654  0.026269  -0.017513  -0.078115  0.057179  0.510628  0.158269  0.092321  0.133692  
+-0.015689  -0.021613  -0.049745  -0.018491  -0.062717  -0.039151  0.229198  -0.049377  0.018453  0.029877  
+-0.022100  -0.033433  0.046650  0.159933  0.111100  -0.107133  -0.188417  0.076250  0.060567  0.046183  
+0.022317  0.008769  0.035423  0.035952  -0.016567  -0.103587  -0.377731  0.013683  0.075269  0.005096  
+-0.010863  -0.018443  -0.020137  -0.095571  -0.120325  -0.048316  -0.158090  -0.123802  -0.078557  -0.083217  
+0.009895  0.031018  0.059974  0.107088  0.088939  0.144623  0.377421  0.013728  -0.001535  0.000816  
+0.014911  0.040911  0.033060  0.070518  0.073375  0.198756  0.254149  0.091732  0.088583  0.072976  
+-0.029500  -0.019702  -0.059714  -0.027310  0.045095  0.050702  -0.061143  -0.012667  0.033417  0.067500  
+-0.019462  -0.018863  -0.011104  -0.041066  -0.024286  -0.113115  -0.123242  -0.059560  0.033538  0.013110  
+-0.004582  -0.003159  0.002644  -0.022000  0.000577  -0.091260  -0.062649  -0.004428  -0.029139  -0.006457  
+-0.009761  -0.020489  0.108693  -0.003614  0.033273  -0.001443  -0.007227  0.061182  -0.081250  -0.036227  
+0.002879  0.001188  0.008374  0.009087  -0.008248  0.022235  0.020351  -0.001260  -0.009347  -0.011696  
+0.001505  0.003924  -0.004460  0.008475  0.002298  0.002242  0.007455  0.019995  0.054848  -0.034742  
+0.004005  0.003559  -0.012050  -0.000658  0.013964  0.005748  -0.065086  0.026680  -0.006144  -0.006982  
+-0.007611  -0.007382  -0.007046  -0.011918  -0.024854  -0.007818  -0.125982  -0.096900  0.032779  -0.000204  
+0.000788  -0.000888  0.006073  -0.004958  0.001085  -0.026469  -0.030473  -0.090969  0.022712  0.013408  
+-0.000191  0.001113  0.000907  0.027758  0.021428  0.011454  0.140706  -0.003613  -0.004825  0.004711  
+0.007053  0.004000  0.008876  0.012920  0.010690  0.030664  0.043597  0.041093  -0.053562  0.012332  
+-0.003291  -0.004170  0.021635  -0.053326  0.003170  -0.006486  -0.016149  0.001355  0.001730  0.007968  
+-0.000113  -0.000435  0.008659  -0.005267  0.001118  0.003918  0.006401  0.016138  0.002400  -0.001376  
+0.000301  0.000564  -0.002722  0.008336  -0.007193  0.001900  -0.022967  -0.005035  0.000973  0.000444  
+0.001097  0.005055  -0.004500  -0.000024  -0.071517  -0.048776  -0.006762  0.004786  0.011883  -0.000155  
+-0.003252  -0.000345  -0.007000  -0.005248  -0.032965  -0.019226  0.093310  0.015168  0.036695  0.039195  
+0.002221  0.000884  -0.021471  0.027773  0.081360  0.082134  -0.016448  0.007401  0.064064  0.014727  
+-0.000250  -0.003789  0.004500  0.014852  0.123883  0.069969  0.050391  -0.010133  0.034609  0.116531  
+-0.081438  -0.132734  -0.121688  -0.060547  -0.115609  -0.053234  0.240844  0.008266  -0.147344  -0.025813  
+-0.030973  -0.018108  -0.017000  -0.084365  -0.073959  -0.123311  0.034581  0.009784  -0.317514  -0.202459  
+0.009861  -0.017306  0.063944  0.228806  0.226694  0.057333  -0.632389  -0.398083  -0.032667  -0.074139  
+0.067204  0.028481  0.055148  0.144704  -0.117722  -0.015944  -0.265167  -0.164741  0.361519  0.218222  
+-0.013508  -0.006525  -0.049347  -0.111754  -0.120322  -0.097568  0.197381  0.087068  0.021729  0.041686  
+-0.022805  -0.014208  -0.048188  -0.098214  -0.011883  -0.017617  0.149987  0.057383  -0.156922  -0.078208  
+-0.000310  -0.008580  0.028971  -0.080109  -0.005517  0.029184  0.009534  0.024931  -0.052086  -0.053115  
+0.000418  -0.001366  -0.014228  -0.055767  -0.059996  0.048978  0.030185  0.036983  -0.000711  0.006487  
+-0.007821  -0.005150  -0.009073  -0.030996  0.025394  0.021012  0.038065  0.059358  -0.004679  0.004785  
+-0.022178  -0.020747  -0.033086  -0.006236  0.112184  0.088333  0.024655  -0.028759  -0.020874  -0.011971  
+-0.000537  0.000945  -0.019799  0.034640  -0.010470  0.070128  -0.019110  -0.073213  0.013030  -0.005274  
+0.052197  0.053227  0.054106  0.093258  -0.165136  -0.204417  -0.040000  -0.025205  0.080470  0.037159  
+-0.002116  0.004306  -0.010926  0.000926  -0.016278  -0.260074  -0.021583  -0.022000  -0.015727  -0.004690  
+0.003129  -0.001082  0.001314  0.008206  0.039387  0.145510  -0.006959  0.032474  -0.015474  0.006119  
+-0.000679  0.009962  0.035972  -0.052443  0.108255  0.271255  -0.011736  0.030972  0.014038  0.010783  
+0.000118  -0.005253  -0.008446  -0.050000  0.060849  0.071817  0.018253  0.017984  -0.014731  -0.015134  
+-0.000931  -0.003356  -0.013600  0.002400  -0.090169  -0.031413  0.026006  -0.067425  -0.007369  -0.015650  
+0.009578  0.014375  0.061492  0.030234  -0.151516  -0.143352  -0.033188  0.011844  -0.041852  -0.056078  
+0.010290  0.012466  0.031500  0.049949  0.022648  -0.091051  -0.012261  -0.008489  0.022920  0.019398  
+0.002930  0.003994  -0.011576  0.052740  0.037962  -0.148203  -0.000063  -0.083582  0.023089  0.033424  
+0.026090  0.037634  0.028933  0.043896  -0.083530  -0.141007  -0.054851  -0.058037  0.018731  0.039052  
+-0.008333  0.001096  -0.124939  -0.084833  0.036719  -0.020377  -0.092868  -0.083518  -0.001351  -0.000474  
+-0.072463  -0.048667  -0.051972  -0.038944  0.179315  0.152667  -0.154870  -0.091018  -0.127444  -0.093093  
+-0.023201  -0.038718  -0.021356  0.015034  0.191230  0.160759  0.032052  0.042908  -0.086609  -0.048845  
+0.032660  0.022500  0.086021  0.168069  0.058806  0.057368  0.129528  0.095965  0.141097  0.083097  
+0.028906  0.062302  0.181566  0.260613  -0.115170  -0.100415  0.103387  0.034594  0.228151  0.148509  
+-0.007206  0.000882  -0.017581  -0.046426  -0.101493  -0.047897  0.062581  -0.040309  0.026324  0.011176  
+-0.021840  -0.016360  -0.139930  -0.184890  0.042730  -0.043850  0.081070  -0.000750  -0.074710  -0.017290  
+-0.025636  -0.009791  -0.063827  -0.096209  0.052973  0.028055  0.022736  0.032509  -0.015855  -0.026173  
+0.008083  0.004481  0.022526  0.062571  0.027295  0.012904  -0.046974  -0.007346  0.013615  0.047147  
+-0.063062  -0.084677  -0.128521  -0.133771  0.248875  0.309917  0.079062  0.060417  -0.035750  -0.006000  
+-0.035389  -0.064722  -0.112444  -0.102708  0.250903  0.348833  0.334000  0.181806  -0.081458  -0.066958  
+0.196828  0.304891  0.394312  0.185578  -0.172781  -0.311922  -0.165938  -0.110766  -0.141313  -0.045609  
+0.049304  0.066235  0.057745  -0.057539  -0.478784  -0.518245  -0.457784  -0.401853  0.041029  0.052176  
+-0.215232  -0.372821  -0.503357  -0.402196  -0.094429  0.080214  0.064946  -0.022000  -0.024125  -0.035571  
+0.031287  0.061550  0.034500  -0.011600  0.378344  0.343594  0.182544  0.233300  0.066463  0.019875  
+0.078412  0.126684  0.140368  0.083833  0.148386  0.075070  0.071588  0.153947  -0.020860  -0.017070  
+-0.012571  -0.010048  -0.069936  -0.006063  0.014492  -0.032087  -0.059865  -0.132778  -0.052754  -0.052254  
+0.011247  0.013521  0.003521  0.028699  0.023842  -0.073527  0.004178  0.092274  -0.029678  -0.021856  
+0.007302  0.014167  0.088468  0.020881  0.023278  0.014484  0.028524  0.111770  0.017849  0.031413  
+-0.010462  -0.016330  0.014849  0.000877  0.079708  0.074057  0.066698  -0.087868  0.022236  0.007472  
+0.005718  0.001076  0.004672  0.008794  0.064248  0.030328  0.029727  0.011664  0.013803  0.021239  
+-0.010291  -0.000664  -0.045530  0.047284  0.030799  0.005560  0.042515  0.077672  0.048612  0.026590  
+-0.002549  -0.001993  -0.008345  -0.025069  -0.004023  -0.012214  0.020914  0.001046  0.013234  0.043602  
+-0.012025  -0.006348  -0.004696  -0.091377  0.019564  -0.007250  0.027686  -0.012740  0.000010  0.013956  
+-0.004826  -0.003963  -0.014659  -0.004307  0.008578  0.024811  -0.002893  -0.029663  -0.000885  -0.001778  
+0.004443  0.005004  0.006916  0.038592  -0.013126  0.006218  -0.061294  -0.063542  -0.013172  -0.013206  
+0.005406  0.003194  0.002928  0.025270  -0.016712  -0.005115  -0.039640  -0.002165  -0.038496  -0.021619  
+0.003625  0.001327  0.010344  0.020050  -0.000505  0.004615  0.015089  0.040858  -0.005901  -0.007690  
+-0.001634  -0.000171  -0.000049  -0.010739  0.021666  0.012590  0.009888  0.009773  0.029907  0.028388  
+-0.000422  -0.000967  0.000594  -0.016157  0.003204  0.006825  -0.013016  -0.005873  -0.028749  -0.010878  
+-0.000617  0.000162  -0.008543  0.002525  -0.017168  -0.008345  -0.019513  -0.030891  -0.034013  -0.044150  
+-0.000729  -0.000051  -0.007470  -0.000436  -0.005617  -0.015837  0.001477  -0.003394  -0.012528  -0.013152  
+0.000965  -0.000105  0.006930  -0.010845  0.000073  -0.028816  -0.005041  -0.003307  0.005307  0.013374  
+0.001742  0.001509  0.001773  0.027170  0.000170  -0.038142  0.015288  0.016573  0.018052  0.010894  
+0.003766  0.005500  0.008172  0.022156  0.013258  0.054641  0.025641  0.050242  0.116070  -0.069453  
+0.001413  -0.004971  0.015616  0.008233  0.005977  0.094279  0.079192  0.011983  0.094453  0.092570  
+0.088679  0.110083  0.077655  -0.037679  -0.029762  -0.119024  -0.133440  -0.004714  -0.083762  -0.028417  
+0.015284  0.014784  -0.039060  -0.035043  -0.043172  -0.221310  -0.091103  -0.049414  -0.257957  -0.108966  
+-0.125500  -0.141045  -0.110545  0.047758  0.067258  -0.086015  -0.076197  -0.045561  -0.124576  -0.110030  
+-0.202641  -0.210422  -0.122672  -0.091016  -0.107922  -0.096672  -0.251766  -0.055625  0.013422  -0.017750  
+0.034361  0.005583  0.011153  -0.199556  -0.239333  0.191097  0.059236  0.111458  0.252347  0.063792  
+0.087687  0.088979  0.053458  -0.098812  -0.154812  0.228188  0.348062  0.145396  0.277583  0.182979  
+0.045933  0.049167  0.007767  0.136717  0.118083  -0.294317  0.055150  -0.065883  0.103700  0.124733  
+-0.046137  -0.041975  0.011087  0.095025  0.077200  -0.097212  -0.192937  -0.093737  -0.196788  -0.178563  
+0.031244  0.009633  0.042856  0.106978  0.120600  0.173856  -0.140756  -0.133022  -0.293156  -0.227689  
+-0.060940  -0.059520  -0.037930  -0.019450  0.054650  0.090280  0.081460  0.069270  -0.048150  -0.108680  
+0.023337  0.038477  -0.022384  -0.108930  -0.156349  -0.175465  0.237535  0.129151  0.195698  0.203360  
+-0.041489  -0.027362  0.084543  0.021723  0.089798  0.090213  0.032862  0.058319  0.166862  0.162117  
+-0.033176  -0.027882  0.078941  -0.084382  -0.081794  0.225485  -0.154750  -0.008044  0.080103  0.043088  
+0.039200  0.031838  0.026546  0.123977  -0.115923  -0.186231  -0.195354  -0.111400  -0.092485  -0.091885  
+0.105263  0.128645  0.092289  -0.024132  -0.193303  -0.287118  -0.122645  -0.101132  -0.319566  -0.245329  
+0.021955  -0.002205  -0.036000  -0.044432  0.066386  -0.104455  0.027341  0.047614  0.033909  -0.040545  
+0.016083  0.049202  0.012119  0.055429  0.046810  -0.080143  0.004726  0.021857  0.320440  0.337369  
+-0.015130  -0.019050  -0.008980  -0.014840  0.071910  0.002050  0.023410  -0.053970  0.123670  0.238070  
+-0.012875  -0.002104  0.068312  0.157250  0.052896  0.140771  0.011271  0.007021  -0.286354  -0.268750  
+-0.009167  0.002833  0.127267  0.245767  0.038667  0.057167  0.038167  0.036733  -0.090267  -0.283567  
+-0.111673  -0.135865  -0.179144  -0.031587  -0.000356  -0.077615  0.089760  0.019260  0.026135  0.020587  
+-0.095335  -0.245500  -0.413513  -0.452595  -0.267405  -0.350696  -0.306392  -0.165956  -0.365291  -0.259848  
+0.017043  0.074424  -0.018924  -0.361609  -0.203250  -0.240739  -0.145098  -0.086500  -0.210696  -0.137598  
+0.124238  0.207238  0.284440  0.252714  0.202845  0.164381  0.010536  0.089786  0.383036  0.251000  
diff --git a/codec2/tags/0.4/src/codebook/lspdt1-10.txt b/codec2/tags/0.4/src/codebook/lspdt1-10.txt
new file mode 100644 (file)
index 0000000..a470b66
--- /dev/null
@@ -0,0 +1,513 @@
+10 512
+-8.250528  28.414351  28.947056  -22.260431  -20.641552  -23.655972  33.499699  29.162037  -26.777473  20.152264  
+-13.087674  -29.244776  28.531864  1.223712  -17.642572  -29.978474  10.884624  -23.874582  29.987656  30.394098  
+-29.912476  16.450739  -17.856684  21.637835  -26.373550  28.072887  -28.736387  -30.523342  -26.430317  5.712189  
+26.232023  17.242741  24.208025  29.041113  23.456097  26.209288  -20.043627  4.131552  30.379368  -30.294384  
+29.174519  26.290936  -26.386543  26.420618  30.329287  -27.889307  1.440385  -29.503519  -25.965733  13.266431  
+26.815336  21.980131  -23.962013  26.248177  22.603453  -26.797499  24.757118  24.917711  -21.201101  -31.104151  
+26.990334  30.932030  29.902292  -26.111679  10.720449  27.045002  -30.309986  -25.548256  -12.764328  15.942853  
+-27.131104  7.627721  -23.845989  -24.196527  31.534019  21.284435  2.196042  26.895460  -29.873121  31.457081  
+23.783720  31.103455  -16.321165  28.371029  27.756580  -22.705223  28.902239  12.486597  -24.326632  17.364750  
+26.624371  29.318468  12.003039  22.658562  28.986195  18.075884  -27.618345  27.107302  -24.388067  -22.760424  
+13.515237  -26.350586  25.129314  -30.786650  32.847569  -30.016973  -24.524342  -22.618462  25.237829  -11.466196  
+-7.106867  17.136097  3.030111  -16.934315  -29.622986  26.248684  24.710110  -9.607081  34.604813  -28.588524  
+15.662686  -27.542521  28.252190  -29.866125  -33.910301  27.976837  6.867967  -28.312788  -10.601373  -21.302893  
+-10.193929  14.391588  24.278387  -28.975214  28.665323  30.877426  25.230631  22.649166  34.657333  12.617115  
+27.801043  -6.528720  29.821329  -26.306427  31.756905  19.847202  -28.467939  -21.040308  26.433147  22.401430  
+30.631275  24.535563  31.284803  9.835046  -9.955822  -21.007423  -28.907034  -6.312805  31.747091  -20.082104  
+-23.180269  27.280735  -1.648219  18.616158  -28.962486  16.385414  27.848301  30.031059  -2.877421  30.454214  
+28.448109  19.146063  30.305185  -21.223429  -28.729210  4.121464  -32.124985  16.542374  26.426540  25.656050  
+-17.137257  29.191708  30.093775  15.418388  -26.740789  4.192141  30.161688  -20.539837  -27.132601  30.135859  
+-25.917549  -22.641289  24.594221  13.821900  -22.764513  34.653595  25.676662  -2.283436  -28.713104  21.475290  
+-34.803772  16.627371  24.532631  0.507513  -0.351332  -29.709391  -11.731549  26.970554  30.765701  -17.942686  
+-21.305920  16.795202  -8.171767  4.816957  -32.731911  29.083702  -15.778113  27.838266  -35.286331  -2.821167  
+25.230614  8.306693  30.379696  9.017179  -27.834126  24.510019  29.685558  -29.855885  -24.964121  22.693756  
+-24.019381  -24.911600  29.932642  26.527115  24.229420  -25.979359  -24.631037  -26.388783  26.211708  9.389849  
+-18.861231  -33.228931  29.733133  30.216154  29.167511  15.435679  25.305086  19.504105  -25.545568  17.099970  
+-28.352892  21.202972  -28.220776  -25.223660  -27.102163  -27.997780  -15.985667  -31.684175  8.520580  32.364357  
+27.376833  -20.802015  20.907457  30.482269  30.754896  -28.857952  12.509435  13.060081  -28.310965  18.305183  
+25.157576  25.038042  -21.250418  28.748077  30.768257  26.917866  7.294786  -21.357422  -20.052004  29.755259  
+-24.358604  29.996195  10.147661  15.117146  -25.059454  26.876207  29.655886  1.598995  -31.368891  -24.860382  
+-23.087124  -30.624411  26.872061  -25.430162  -27.082129  20.720413  -28.692017  30.691967  -21.279165  -2.551623  
+-24.353456  -31.981487  21.236629  -24.626516  28.659883  -25.651659  17.860260  22.199923  -20.723352  31.429373  
+-25.257303  31.413050  2.180641  -21.803225  31.604710  26.447760  -3.937415  17.640810  6.967419  29.346401  
+-26.361465  -29.989614  6.612124  23.398020  28.787786  26.224808  -32.942394  23.286501  -19.532110  24.959354  
+-27.878630  29.734219  19.966755  30.198826  19.773518  -17.789425  -27.085190  31.225122  -28.529303  1.141312  
+-30.901060  0.391270  -2.896986  30.007690  27.838476  26.702936  11.228483  25.069935  35.403259  -18.549868  
+24.425106  30.878494  -14.288082  -28.314743  30.358965  16.484238  18.017254  -16.166327  -30.419704  -28.554745  
+2.113087  19.104361  24.900944  -27.797613  2.455245  -30.316483  -31.873756  -29.685768  25.493534  -25.001156  
+12.640694  27.439734  31.413740  28.351887  28.250576  -31.200777  -1.919832  -25.808199  -17.301651  27.257868  
+24.302240  -31.663763  -8.108189  31.926470  26.079449  -17.886381  -5.920022  -31.881042  29.882542  9.564315  
+26.885803  28.647747  -30.219711  25.136871  28.128950  21.675436  -28.413626  8.504551  15.025225  -19.844286  
+-25.595650  -27.307159  25.095547  -7.531783  17.902473  -24.060442  -29.581953  21.509615  -19.275269  -29.422474  
+-32.989773  -24.240007  26.426277  26.318930  -30.240437  -30.340971  9.496776  -0.216958  -30.049471  26.236687  
+25.384636  -6.275255  -18.597488  -32.691147  29.291729  -27.610168  -21.210382  -30.417465  -17.904039  -27.208693  
+-22.291912  13.350454  -28.847847  -27.335732  -24.619164  -25.186035  -31.240126  25.411316  27.413515  26.526279  
+-11.963379  -31.066198  9.782462  33.931267  29.914045  33.128548  6.134001  26.757753  24.343744  12.870527  
+-25.266705  28.371819  -17.242594  -0.061756  -23.222466  25.648582  -29.380426  -25.207943  30.648054  25.205875  
+-28.429790  29.742310  -29.492258  24.673662  -5.577706  -30.121881  24.641495  -5.271527  -28.554474  -25.347298  
+30.674225  23.665363  26.509443  -28.156471  -19.652834  -30.558514  3.050400  22.467127  -12.157305  25.608335  
+28.007099  -23.921940  -28.883001  16.383432  30.184158  5.257059  -27.107363  -18.662508  30.094419  29.672953  
+-4.148671  32.244709  -31.177191  -3.107982  30.788345  -19.094992  -17.701006  21.321257  -28.870909  -22.307236  
+-27.787346  21.979095  -28.086067  27.094601  -22.926842  -26.618746  -25.764585  30.389841  9.124823  -20.803688  
+-28.622871  14.273782  -18.527746  32.811272  28.237886  26.638952  -29.631285  -21.763582  29.762817  23.678711  
+28.507240  -28.432800  24.060392  0.475232  33.547039  10.758526  -3.632491  -28.713354  -29.390940  -21.657669  
+-8.461226  -20.445940  20.312346  1.126397  27.891205  -8.802555  29.181444  -33.473057  -24.317173  27.094810  
+18.385647  -18.681868  -34.019363  -16.016193  32.892334  30.348473  -18.076117  -17.677099  29.281147  -6.462004  
+-27.232441  29.584328  25.616709  -7.832103  22.537663  27.604885  -24.377760  -26.233315  23.746206  -26.995077  
+23.928440  27.366444  31.684374  -26.476540  -2.046179  -28.640903  17.716154  -28.665686  20.821653  19.822582  
+29.407177  -29.962450  -25.928570  -20.161171  -21.076260  -26.830011  -23.238630  -28.696051  -26.628510  11.198109  
+23.762690  -3.135408  -10.013238  -25.964376  31.742970  -25.495323  23.754967  27.876976  23.058678  -27.804108  
+-29.595732  -26.108103  -32.855850  -0.777961  26.280220  4.676180  -21.124659  -30.380817  9.198297  -31.738487  
+-18.257301  -29.640936  -30.950096  3.669302  -26.327230  -27.560867  -28.221474  21.425386  -23.974077  -27.058352  
+22.203074  27.736471  28.689638  -30.763041  18.591822  18.732649  28.202400  21.263161  -14.076660  -28.537773  
+24.311007  -19.661934  -30.559019  27.831297  23.832487  23.034298  -19.796577  25.609159  -28.970860  21.383129  
+-25.099157  -25.529819  5.853761  -6.068099  -7.706121  11.039868  -8.481035  21.795696  -28.756374  29.722593  
+-30.324696  -26.820206  -2.094729  -20.414989  -28.300838  29.801680  25.661100  22.089428  12.858266  -23.677881  
+-28.310026  24.394686  26.970953  -19.291451  18.713287  31.958241  20.112799  25.449312  6.026050  -31.284294  
+29.731031  -7.458796  -2.055046  -9.766047  -24.399158  25.549126  -17.113363  23.141628  -33.150452  -28.483871  
+-28.091705  28.946104  26.639599  26.441015  -5.776271  -31.776129  3.699637  3.309000  -27.088848  28.434065  
+24.877413  24.131851  -28.485380  -23.670988  26.915024  -18.530895  22.305233  29.780357  -21.399794  23.557825  
+27.733376  -23.716413  -21.622772  30.487514  -7.450827  14.006124  -27.437721  29.446697  18.505186  32.935650  
+-24.420240  -22.155836  30.738674  -30.658985  -25.938389  -18.666609  -4.351988  19.271080  27.065073  -24.776644  
+29.156111  -28.483194  26.807344  -32.169819  32.677620  -18.160120  -22.820723  19.154898  -25.966934  -15.867821  
+-32.402512  28.791231  -19.376459  -33.458790  -4.591619  -2.483457  -26.426649  -11.451970  -3.489601  26.589520  
+17.709406  28.119827  -9.284810  33.072849  -3.393136  -13.898425  33.350590  -30.098577  -25.904646  -23.073343  
+24.880932  -25.761850  -28.084831  22.513605  -31.395102  -29.289019  26.686272  -6.293370  -24.953367  -14.749125  
+16.803219  22.737221  28.072466  -30.104748  -33.386768  -29.029961  -21.493002  -17.387140  -1.687227  -26.739874  
+-8.849285  -8.653768  32.022827  -22.359735  29.513790  24.547321  28.248760  -29.673279  -20.694735  -23.920599  
+18.995764  -32.690716  -24.981482  31.671928  -22.609871  -27.155401  1.049363  -27.188822  24.030592  30.201191  
+-20.475941  26.728388  20.333851  -5.874790  -25.067295  -29.538239  -22.953407  -26.601837  -31.151222  25.098551  
+-11.856617  4.262431  -28.877539  26.230621  -30.327372  27.634954  10.315826  -32.939442  -24.725647  -27.897846  
+-5.141058  -0.384487  27.112600  15.110576  -11.309449  32.180965  -30.647289  -27.716377  -34.215122  -25.215185  
+-28.122921  -28.624094  -8.308435  -27.449034  -31.472042  -27.381563  -21.243340  -18.023628  -22.585512  27.566639  
+28.504580  22.803720  21.843224  -27.465639  25.226137  -26.931309  -29.118799  8.342940  19.081705  30.757061  
+-16.422394  27.782209  -29.507763  27.667814  -25.478991  15.812572  -31.803295  -8.327382  12.915374  -26.977285  
+-13.047698  -24.075064  18.757490  30.889606  13.036374  31.280357  34.008266  -2.397495  27.773239  -4.738329  
+-28.075832  31.486786  9.875986  -12.495639  28.213650  20.669672  -20.154669  -27.666166  -29.830408  28.754074  
+-20.817934  25.465155  21.660789  30.018974  -33.024593  -26.851126  22.427879  -18.918964  27.513636  -13.117702  
+32.712883  20.105747  11.499645  11.480800  -31.893333  -33.761261  26.434597  -16.045656  28.441851  16.275194  
+25.468031  -27.301338  14.702893  -21.335854  -22.459711  -32.798584  -27.640146  22.849913  21.499794  12.194662  
+27.247601  27.541500  -28.059675  21.635532  11.560982  -27.964947  9.155243  14.273994  28.268442  28.711775  
+28.157682  24.629513  -25.688036  -20.681528  27.016497  27.786137  3.006814  -24.266685  26.347130  28.307236  
+33.590897  26.544954  -13.754819  10.255233  -8.044541  30.658283  25.738869  -22.977711  8.164171  -24.753832  
+31.092783  13.342126  -7.211920  -2.049561  30.282135  -30.253843  -23.966923  -21.516727  32.113659  6.814880  
+23.287216  18.627256  -0.295165  -32.785515  1.387961  -33.989265  33.773190  -8.199713  17.003393  -17.363035  
+25.101440  28.455503  -8.158275  30.860847  -29.289976  -25.225998  -23.423073  -9.182380  26.093452  -30.787434  
+-24.068687  28.119608  -10.572042  23.238905  -30.614655  -23.620752  -22.369682  -24.210314  -24.525866  -28.179277  
+-29.210775  9.336824  -27.031591  -29.950668  -22.957783  -28.333061  -14.290992  30.638340  -9.514547  -18.259357  
+29.051676  29.304520  -27.803989  20.112759  -23.854359  26.400883  -22.467255  31.361710  24.536663  11.645331  
+25.958706  28.463490  -24.367929  10.579311  -25.545280  -29.809126  20.846022  -29.060047  -27.663929  23.973812  
+9.121296  30.801323  26.039162  -16.843090  15.986970  -27.447987  1.624425  32.649300  31.067707  28.746941  
+27.518221  -30.770910  -21.445694  -25.869053  31.146349  29.838579  -24.894156  16.136885  -18.003977  -7.402350  
+-27.305534  -21.246096  -26.871511  27.852213  -11.644767  -31.164965  -30.935816  -26.874981  -30.399879  16.253309  
+-6.632153  8.097020  -31.116461  -29.224577  1.844677  33.240108  -17.944588  27.793501  22.504580  -2.187771  
+28.788109  24.887934  -12.195354  -26.807501  -18.840614  12.666108  29.015575  30.759928  -26.548164  26.759972  
+7.593760  -23.918388  31.474106  -21.832027  23.403120  -29.994598  21.056564  25.481445  28.109774  24.279013  
+22.547098  -30.332420  30.663147  22.894178  15.532843  24.273546  -29.101322  12.098467  26.230379  28.198549  
+-29.239477  -21.581753  27.146959  30.019226  -6.244174  29.899210  28.713047  -26.166416  -8.515326  -29.176779  
+28.122040  -21.038881  23.960810  -16.589050  28.675232  27.318020  26.743977  5.758596  22.055302  23.182400  
+-18.961840  -10.698790  -28.763069  28.437471  -35.400574  24.652515  22.043573  14.510972  -23.194159  -30.208973  
+-31.020939  22.423620  -30.354576  27.677849  21.787552  24.156179  25.448776  6.797812  23.857073  -10.583152  
+28.035105  -8.365502  23.218433  28.703245  29.323349  31.770390  4.667182  -30.053162  19.615248  22.585283  
+20.907743  32.282700  20.469995  -2.092622  32.593643  -28.172235  17.193794  -13.688399  23.971102  -29.084644  
+-27.821463  -23.167927  -20.422800  -32.688595  20.012943  -5.708320  25.155785  -25.669615  -31.714989  10.813772  
+21.059443  22.325644  8.813952  -31.869465  -25.340435  -22.912552  25.651350  -30.096390  -12.251925  27.824656  
+33.124298  24.970509  -22.883692  -24.787495  20.120363  27.808098  -24.764261  29.295557  -20.974461  18.732210  
+27.873919  13.170330  26.616785  30.360901  23.720774  -28.773775  -32.039742  14.245504  10.406815  23.114937  
+-29.642006  21.243027  28.496279  -29.954308  16.027828  28.209349  24.253197  -15.291070  -24.008448  21.691130  
+-30.420097  21.261686  23.687590  -29.134315  26.098228  -23.065153  24.013599  11.358426  27.619350  19.153673  
+-28.520651  -20.618023  23.632936  20.879873  -28.919048  -27.908325  -29.355772  -29.885509  0.446875  -13.041409  
+-23.555792  -30.753073  26.267303  6.488521  22.797260  -26.167721  16.045740  -24.451176  -29.071766  -21.936409  
+-2.366049  24.333763  -21.207254  26.385887  32.747791  25.520645  -30.213165  15.314766  -24.096134  30.081877  
+27.522026  -25.469622  24.750177  -31.094889  -12.456142  -5.652915  -26.168478  -29.880280  -23.040524  -25.145845  
+31.086567  0.399763  -27.909199  -27.119717  12.772094  25.539625  30.645590  19.174603  -7.188969  -17.428612  
+-25.660950  -27.140112  -10.629828  -27.045063  -27.010494  -28.772854  -19.600899  -28.375753  -25.870188  -30.110542  
+-21.292349  -21.289106  -21.501253  21.520546  15.719978  15.368153  31.115133  23.528603  -29.798271  -28.217384  
+-26.340864  -30.756704  25.837341  22.221676  -17.646425  17.593237  -22.739998  -27.202002  -27.505981  23.860538  
+11.569932  28.003872  -25.262947  31.434067  -22.080194  7.423393  30.620216  -12.076071  28.589949  30.061836  
+-30.388857  24.292381  26.421072  30.324377  20.356447  9.037641  -28.085680  17.950548  25.793188  28.759373  
+-23.263527  18.627926  -30.141863  7.740365  22.029932  28.499783  30.285429  -26.274853  -20.482277  23.133362  
+32.813244  -20.900084  -24.991117  16.317175  25.896717  -30.170595  -20.606852  -4.947311  -27.353762  -17.023895  
+28.343552  -27.288149  -24.964575  32.622482  15.900583  28.223110  -4.864933  -12.131302  -28.233732  -30.439581  
+-24.307573  -30.622923  -27.477850  -28.684631  30.428198  -28.051462  -9.877420  19.513367  21.287836  -22.723270  
+29.043144  22.876682  -27.117975  30.219616  -26.863281  -17.694811  -23.721672  -30.955458  -23.429083  -10.684244  
+11.060363  -26.773920  -22.583313  27.121037  25.142149  23.520163  -35.005611  -30.745600  -23.574781  8.635379  
+11.357567  30.427563  20.701384  24.337975  26.384836  26.677534  -7.507456  -30.599634  -28.048975  -28.365108  
+23.339508  20.602566  -33.920498  -10.787850  -27.863245  -21.197025  24.051607  -29.691181  28.696939  -16.355665  
+27.156740  16.964241  5.571268  -27.733831  -30.067137  21.884510  -21.251928  -30.481337  30.485355  24.729668  
+-26.687622  23.605410  -20.949074  24.506336  22.576454  -28.776810  28.682386  8.076501  30.059227  -23.765211  
+19.499861  19.529318  31.583889  25.157722  -26.286268  -34.550621  -23.867632  26.800932  -6.820005  12.327001  
+-17.908678  -15.761912  23.849796  25.471844  -27.772625  -23.331366  23.346025  -20.287111  -19.387089  -21.679003  
+-29.713295  -7.165277  25.469320  -32.656456  -31.675169  -20.736795  22.852297  -27.023853  28.455851  -4.415093  
+-31.419279  28.685366  -25.388046  29.722818  15.015548  25.824671  0.442656  25.495337  -24.566687  -24.969934  
+27.788668  23.789171  -15.574149  -23.203178  -29.012049  32.678471  25.480368  11.069133  22.169937  17.818844  
+27.556049  -14.146981  27.893488  -0.205255  -29.667313  27.449438  -27.657949  -30.545671  -24.696152  24.537466  
+22.982018  33.590633  21.231791  19.734377  17.219254  7.570241  20.145592  33.318871  27.775024  -16.882725  
+15.009192  29.450502  4.686261  -3.324030  -34.471027  -33.349808  25.874115  5.478483  -20.379084  -5.739206  
+13.428425  -26.141970  20.602623  14.879295  -27.248064  -28.260799  -31.781689  -25.459976  -25.936277  -28.731651  
+-21.017727  25.616560  32.629795  29.306215  -23.032677  27.910164  -23.108871  19.208513  -30.069599  -23.484737  
+-23.726578  -29.088511  16.016588  12.965228  -26.729847  -29.126991  25.498001  25.654112  -29.098560  -28.284170  
+-27.480677  5.697550  -30.919975  32.190777  11.537769  -30.228153  26.874218  32.551582  16.837023  12.355412  
+-25.134735  28.210272  -28.118145  -27.915285  -31.248295  -29.046194  24.636982  -18.550402  11.327372  -20.042549  
+-27.592712  -26.467159  -30.820688  -12.226371  25.467739  28.521854  3.692282  15.284110  14.373300  31.233538  
+7.177904  11.423222  -25.810898  -26.818068  35.479370  -25.740366  -30.163752  15.037313  -12.527069  25.534302  
+-2.638413  30.585152  25.912683  -18.014620  33.231594  -16.783199  -17.315958  28.074158  -25.544659  29.678978  
+26.285452  26.749672  -33.995316  26.974787  -8.064065  21.458660  32.709496  -30.895699  0.037257  2.178612  
+28.732716  -23.296423  -18.691906  -31.023714  -23.567375  27.788317  -26.552231  19.305607  27.235626  19.013712  
+-28.392611  -29.439262  28.464724  -19.999983  29.721647  21.496183  3.553029  -24.798029  23.571009  -25.178368  
+-25.590965  19.625475  32.139542  12.308794  -33.614574  -24.932693  -12.018950  14.945961  -28.347635  -11.778281  
+-23.936697  -30.939325  8.649321  -24.380640  -21.523420  24.172867  -21.442892  -28.130402  -26.865345  -18.526720  
+23.959433  -15.302689  -28.791048  12.541603  28.438076  -25.868076  31.533470  -28.832186  -25.802338  -18.020861  
+29.430056  -13.753139  -30.351770  -19.868355  28.745502  16.640471  -14.774107  26.327574  16.127264  31.980478  
+-29.641502  -17.705847  24.447769  -24.623304  -16.330515  26.228224  29.003815  -31.477066  14.041460  -27.526264  
+-15.739707  28.716131  2.340807  26.645828  13.053572  -23.754354  17.074375  -34.384674  27.854647  -31.704470  
+-27.404348  -28.118250  -33.941959  -30.466818  -11.816746  25.685192  -18.100304  -30.087223  22.637438  13.770916  
+30.122972  -29.118546  24.532595  7.057877  30.036701  29.099798  -7.071823  24.592756  11.401652  -26.073618  
+-28.692404  -27.009842  11.905396  -28.387501  21.222261  25.882669  31.801846  -29.021738  22.581629  22.886696  
+-23.964380  -30.042795  11.303555  -25.320282  27.864023  32.828209  28.997120  16.339516  -28.981457  20.930676  
+18.626646  -29.582371  -27.551277  -27.697216  12.197803  18.428934  24.812458  -26.544010  28.405891  -19.468340  
+-26.839275  29.005001  -26.756369  -24.117373  25.626078  -5.748903  -33.437027  31.553396  16.725538  -7.001272  
+-28.237995  29.670803  6.692709  17.942415  -30.868332  29.001917  -14.060006  23.688519  26.160295  -24.409889  
+-17.979515  30.931259  25.636486  -31.712921  -25.322096  30.303371  19.788139  -14.276178  -5.861047  -31.922964  
+29.199034  -28.819431  -12.205784  -31.307295  -6.876378  -7.332343  25.940901  31.060841  -32.258877  -20.013409  
+6.463464  -32.547859  28.319059  28.421572  -20.190582  33.658432  -17.270596  16.164312  -22.368608  -26.789709  
+-27.753912  25.124001  -24.065769  31.459173  -25.951307  -0.960714  22.520782  -28.286674  -23.691193  25.823711  
+-32.022495  32.072910  -24.703007  -29.224352  -27.904415  28.083996  -5.967274  27.038555  18.721811  3.493615  
+-24.128891  -22.292822  -12.250476  -23.735218  -31.929567  -25.620970  28.912012  27.308689  9.154576  -27.708202  
+-2.529298  -27.601696  -29.463570  -36.215473  16.249651  -17.557255  -29.444719  -11.908958  -6.184426  23.358080  
+22.185682  28.216541  24.036819  19.887381  -31.464809  -26.278393  -26.571669  -31.595316  7.374464  20.975615  
+-19.376390  -12.690674  28.849831  -25.717209  -15.535289  35.125530  -7.713222  23.484344  28.977058  23.431211  
+33.227535  -27.833324  24.351425  25.713518  -28.399006  -17.730026  -1.729472  27.119209  -21.333033  -21.328016  
+-26.771830  -28.014515  32.189442  -25.928280  20.033003  13.710388  -26.982601  -3.500313  -1.506497  32.057953  
+-15.927268  -14.658901  -31.679316  -22.644035  -30.882013  25.508205  -3.187066  10.148254  12.417383  34.725166  
+-22.061447  28.227926  -18.534262  -30.699667  15.779271  -29.329414  28.158079  29.011202  19.597822  -26.136396  
+-12.276376  15.892327  -13.182528  33.299500  10.344028  -27.171360  -28.183661  -29.153164  2.250963  23.829035  
+31.585875  -12.671778  27.297150  26.335220  -31.710556  25.913471  -8.017223  -21.332951  -17.157022  -30.292700  
+29.741533  29.534622  26.601515  -25.145164  -24.681961  15.980844  9.520965  -27.243650  -19.263262  -22.375216  
+25.433943  -24.467484  -28.143906  25.495886  -14.842226  27.493128  24.425079  -18.644470  22.826246  -24.302608  
+-11.835747  30.136255  19.106735  30.824072  24.703981  27.172768  30.038048  29.186287  14.920562  -25.028795  
+-24.752653  12.587847  -24.860634  -29.029341  -27.967066  25.020454  29.418030  27.942430  -30.215551  -5.299477  
+30.899067  10.949029  30.686211  1.537882  -29.977716  -26.814390  27.016579  -25.541710  -11.079510  -30.835358  
+-23.126663  25.899948  -17.426580  -17.390171  -30.503218  26.251877  27.270002  -22.473648  18.283787  30.123409  
+26.261578  28.262335  -11.489004  25.436064  -26.994009  -12.419476  -31.502707  29.040253  -27.648924  -25.962418  
+-23.910925  -25.429150  32.867672  -24.749254  -7.415473  -30.704737  -21.911823  -22.141689  -15.827194  16.446846  
+32.822388  -26.108095  23.612616  -26.657368  8.439564  24.641146  -6.179613  33.014786  10.439384  29.579102  
+28.725666  -33.654274  22.856649  22.741859  25.022173  -5.115507  19.444532  -21.232260  26.221478  -29.678156  
+11.633716  -25.277298  28.206738  19.001387  -18.242786  -17.984953  26.639774  29.904631  -25.861620  30.963205  
+26.100559  -31.884655  -24.972794  20.931379  4.227546  -17.869324  30.058016  32.515915  -28.206936  12.626034  
+-32.133125  -16.602737  20.367025  -31.185806  -19.106474  22.728912  -8.192968  -31.767912  11.123755  24.181980  
+-28.589380  29.538591  22.653214  -0.282040  -20.724344  -27.879545  21.328064  -28.110569  25.765228  29.024187  
+30.860882  -36.364681  32.781525  3.949558  11.079511  5.537791  -25.393511  -25.208115  22.980810  3.930116  
+-27.158617  -31.621920  -30.083405  5.409239  28.529272  29.010754  10.388368  -1.306479  -30.552919  23.308531  
+30.734177  -11.201901  26.037382  -29.200989  19.392895  28.737637  21.011969  -10.357248  21.548880  -32.679043  
+-30.674662  27.818089  -29.203140  -19.854593  17.044485  20.876467  -25.747786  -28.878233  24.511505  -23.141962  
+15.673603  23.288090  -27.818857  -32.513565  12.726074  -23.733049  6.036387  -27.862049  31.193783  28.119864  
+-25.304333  -10.877955  -31.227898  -16.382595  -28.835913  25.393698  -28.896641  30.803068  10.476258  -26.465452  
+23.626778  23.357811  -21.206614  -29.721647  -28.852413  -21.211292  23.961103  28.441339  28.036560  14.108786  
+-30.235542  -16.326653  27.562990  18.357885  -28.368156  25.471575  31.773487  3.734513  26.049023  27.969463  
+16.980251  9.390479  -26.069489  7.320188  -28.113647  -23.642582  -30.748701  -23.248289  30.193817  29.133545  
+-15.223531  29.817465  25.503374  26.672890  -30.908064  19.442265  -24.689878  -2.461775  -11.962740  30.012175  
+26.024065  -28.097883  28.531002  -26.941986  -9.108933  -23.738096  26.942194  -32.118740  -21.525244  0.961816  
+-21.030514  -29.363424  -29.957251  -3.642823  25.494364  -27.320837  29.038359  20.022373  -21.875433  -12.396379  
+-2.554545  -19.473997  -29.914202  -25.034857  28.580915  22.604307  34.856983  9.326077  32.951740  22.441561  
+24.712944  -26.632645  -28.892635  -31.333563  -14.416006  4.310412  -0.897436  25.962732  24.652559  -30.673096  
+6.788627  -21.653187  -6.069960  12.866386  -27.860754  -26.680700  30.156889  30.329958  30.810295  29.371235  
+21.382395  -22.684311  23.297520  33.335854  -27.297352  -17.233984  -31.350203  13.568316  -24.140413  28.863089  
+31.643314  27.707121  -29.477461  -9.803405  -3.628554  -7.854528  -23.128674  -24.773476  2.337460  -32.242786  
+-28.357882  -29.080982  27.726603  -32.353439  -22.851774  17.860350  26.096420  12.912831  -27.845894  -11.446677  
+-17.905165  -28.183750  19.077509  18.199484  -28.807766  -32.092926  -22.621668  26.957857  23.457119  -25.195761  
+29.155462  -25.485563  -30.272305  -16.998955  15.935428  -27.434748  16.272764  32.845551  25.275352  20.979900  
+32.467125  2.939564  -31.076166  27.574575  30.052773  16.918018  29.306002  23.624807  19.740393  19.112986  
+-8.465060  31.190577  -19.820602  25.919401  25.398651  -25.740845  -29.263819  26.071243  16.005625  20.981049  
+26.799908  31.759245  13.203218  30.501919  -30.048819  27.405413  -20.117563  -24.532503  -17.605293  -1.400979  
+25.599031  -25.007303  -23.524038  -23.979019  11.082253  26.192183  -31.115137  -30.058470  2.727974  -27.772297  
+-24.374161  -27.365503  19.043154  30.259495  26.966307  24.007391  -26.921694  -27.449593  -0.693423  -26.959122  
+-16.835014  26.655935  -29.384642  -20.400610  16.875422  -9.288965  24.921650  28.477253  27.882397  31.178291  
+-27.775560  11.304965  -30.917141  -23.896084  -27.252436  -5.768191  24.565573  25.989275  30.708174  -27.192362  
+-21.059984  29.560249  11.736514  6.236456  -22.555840  -11.700287  29.706589  -32.870235  -30.064922  -32.728569  
+29.824356  27.638718  -26.119389  -25.752388  -7.091943  29.872379  -25.563438  -20.491268  -15.487212  28.308151  
+25.054296  -31.876778  -9.431026  20.878891  11.869048  -26.002031  -29.155945  -26.587269  21.408344  -27.389734  
+13.360140  -28.607838  17.558054  29.380537  -31.186047  26.913769  -29.970146  -22.124077  15.529097  28.936937  
+-26.935667  -27.751474  -25.886803  24.869987  29.632679  4.262222  26.330482  27.695890  20.406704  26.952892  
+27.773643  27.070660  29.386000  -15.045194  29.023048  -14.664932  -26.053480  -28.607267  -29.265291  19.901291  
+25.224318  30.863043  -7.171692  -26.044735  25.731773  7.060417  24.963589  -31.946568  -24.867212  23.922573  
+-24.416780  -3.127780  26.428778  -31.601528  -28.607794  -32.702267  -30.195272  19.899616  -32.712517  -13.622476  
+23.834667  -20.505260  18.961716  -27.534723  19.927999  -27.138330  31.404387  10.160913  -26.514894  28.471298  
+-32.579205  -29.109819  -23.370672  0.175204  4.152793  26.609514  -30.408527  20.083223  30.345333  -30.777744  
+-25.165133  26.590651  15.164800  34.035385  24.890318  27.121458  -30.423645  6.241826  -13.916649  -20.982605  
+24.287477  -4.930229  -29.895758  31.450027  -18.431036  -30.184004  -14.347340  -25.172152  25.120384  -5.390819  
+34.449562  -26.830839  -22.914642  26.217722  16.639507  1.244331  33.186203  -28.394007  -10.429307  18.779203  
+27.026775  24.603586  -27.057831  -28.173298  -25.732758  21.497812  -24.456360  25.356434  -5.640959  -28.189854  
+28.458910  26.698551  10.737266  -30.727051  -14.385382  -3.846819  20.652956  -28.468721  32.331146  -34.411369  
+29.262314  -32.190617  26.086044  28.936239  -25.675840  -22.062592  -5.182319  -31.989595  9.402879  6.248139  
+28.646204  -26.018677  21.673767  30.117731  -24.644100  -25.889296  30.692308  -22.026123  -28.589268  4.404716  
+-22.393431  -21.427132  -31.853867  16.146013  -24.506269  27.188745  30.711731  -34.057224  27.288538  14.982982  
+20.574594  -15.383286  20.906435  -28.355043  32.379101  -12.020234  28.393415  -29.822983  31.416735  17.007446  
+-25.502262  -9.228008  -3.837359  12.872238  -26.151907  -25.499598  -32.324112  29.786247  -25.967714  28.234489  
+-23.084305  -13.282383  19.637316  -28.958052  32.728695  24.140638  -25.476992  -10.069501  -29.599485  -28.257629  
+-25.001698  -25.255516  -32.657532  24.237925  -20.142313  -31.082474  16.980850  -25.324553  -24.850039  -22.198929  
+-30.783539  21.704845  22.750927  -26.120293  28.412706  -29.031534  25.596516  -13.815741  -21.302029  28.485952  
+-11.812229  -23.016167  23.444263  31.846100  -23.763472  -24.157795  30.420347  27.766439  22.159620  -26.217464  
+-30.269299  23.074360  -17.584850  -24.882748  -28.447580  -9.149231  -28.034163  -20.211983  28.957960  -28.144926  
+-28.273239  31.753962  -31.849707  -24.950897  29.024555  -30.823227  24.291180  -20.824249  -22.976759  9.613055  
+-19.141724  -18.903481  33.267681  -29.076090  22.744261  -21.670807  20.176722  21.742088  -27.476349  -20.208090  
+-21.814678  26.229355  -22.394960  -23.985876  -22.850430  -11.157884  25.720003  -11.150975  -29.975357  20.922470  
+-24.818188  -27.971861  -24.304016  33.115723  -7.687469  18.482296  25.003521  -28.380758  -27.353703  10.670769  
+34.711102  18.940998  -8.904346  -29.782681  17.538698  28.884752  -30.254866  -7.674024  26.520487  -22.265539  
+20.902689  8.025566  18.674671  -14.390745  34.189243  25.087580  -26.964514  -30.336157  29.974638  -32.069538  
+27.297630  32.444088  23.818474  13.905664  13.886219  33.197960  19.602440  -5.438952  -29.282585  4.220894  
+-31.047628  -5.967454  -15.532126  31.632353  18.968309  -20.643166  25.451929  -29.252943  25.353363  31.446577  
+-29.480902  26.957392  2.875650  -30.756542  28.904150  -30.677294  -7.803256  -3.807869  24.872663  -29.877567  
+-22.565489  30.024027  22.170925  27.085526  -26.759377  -20.698097  24.962259  30.733471  -6.988181  -26.746565  
+-26.527519  -32.189098  12.014070  6.617297  18.855453  -31.615606  22.567261  5.846895  30.375355  -26.095812  
+-27.512320  28.680782  14.500208  21.156994  32.140953  -3.669570  5.279128  -24.266092  29.650183  23.805666  
+8.043905  -12.737823  4.512187  15.255741  33.115318  28.959831  31.735544  9.968329  -23.206686  30.895378  
+26.174623  26.838005  -26.408766  2.086205  -19.624910  30.056616  -26.491264  -15.869252  -27.731758  -28.084812  
+33.798901  9.602103  5.424158  28.581442  -28.910339  31.374783  -21.994387  4.254702  31.387598  -16.908768  
+-22.995621  -29.013706  -3.134014  34.395058  18.291862  -14.794615  -25.759489  29.110916  32.434479  6.428141  
+22.396238  28.856667  24.694206  29.728733  17.439247  -24.605965  2.835178  32.425121  -29.118446  32.634369  
+21.048349  28.621387  29.156994  26.189903  -29.382019  23.461313  28.266794  -0.439052  23.495407  -24.725916  
+-27.643070  -24.467356  -24.125101  12.355736  -31.026474  -11.452502  29.360916  26.205215  -27.469412  28.773991  
+17.492985  2.943702  27.385895  17.119638  35.015461  -8.329785  -29.867542  -22.840242  6.396861  -29.727692  
+14.143679  -29.546240  25.005054  -32.755421  4.263321  12.211868  -25.658663  22.994242  29.143982  -22.893181  
+24.109888  -27.497812  -27.954905  32.443611  -3.344005  -31.847933  -11.106377  29.914062  -13.352994  27.370584  
+29.769308  -27.634550  10.123406  -0.666036  27.717897  -22.755526  -21.831999  29.521137  -19.971655  31.803200  
+-27.502804  34.955513  22.627068  -26.192478  -30.501144  25.425434  -17.472500  33.547077  -21.327307  9.094096  
+-30.031528  24.495207  29.067213  27.323195  27.462391  -4.872978  30.398762  -25.902514  -27.583355  10.717492  
+-2.095082  11.889703  -10.809792  30.213783  1.781955  -29.186869  -11.892235  25.833742  -32.324806  -32.079998  
+-29.235382  30.834251  30.403370  -11.315332  -24.759306  31.109966  31.431036  28.520866  11.053640  3.461449  
+-30.244762  -27.393930  28.511477  29.816730  -27.471121  -7.608500  26.504629  -28.544924  9.468965  17.659010  
+31.055311  25.810459  -26.201794  -27.467518  -26.213955  -27.562859  -29.694899  21.291172  6.601510  21.115910  
+-24.484440  14.377709  27.141979  -24.846848  29.676838  19.359415  -26.188015  -28.933739  27.068943  28.852873  
+-1.777584  28.690315  -30.685251  -25.811670  -26.726999  22.073185  30.474836  -26.577009  -1.388977  -24.970066  
+-23.217674  -9.603335  25.585693  32.880417  17.636166  -26.905874  29.450474  17.441338  -29.926682  -2.519353  
+-18.993116  -17.049662  -29.117178  26.266535  27.745338  -24.618834  -32.491642  21.682329  -15.290477  25.305677  
+21.594990  18.116844  -22.970961  26.803097  -28.312132  -25.754536  28.784237  23.493803  -23.988674  24.755627  
+26.273111  20.164145  -30.960867  10.705051  -32.859798  -8.560682  27.298222  26.350872  -22.881374  -29.441200  
+-22.493010  23.351444  28.667454  -25.100960  -27.100527  26.709175  -27.322639  -25.643158  -23.143845  20.998848  
+33.212540  -22.807255  -8.209283  -23.595226  -29.341192  24.369164  27.328712  -26.528467  13.444833  -27.852577  
+0.897182  -18.460764  13.430999  25.243839  -22.347672  26.362997  1.497149  -28.266176  35.687267  17.992989  
+10.311977  32.574795  -0.212680  -30.948067  -28.844055  -13.601215  1.557753  25.845419  -26.258997  -30.565941  
+-31.612873  -9.108874  -26.461384  -20.205444  -30.433044  25.255568  26.380428  -26.816496  -26.852779  9.175333  
+-23.040833  -31.964855  -25.077463  -28.732893  -24.889439  26.744467  -26.337885  25.007233  -24.697218  22.533663  
+30.737677  14.543345  -26.202257  -15.591269  -22.377333  28.348845  29.444912  -24.730145  -28.503851  18.424576  
+-26.413193  28.465033  23.083967  30.347820  12.164445  -25.689840  -32.023987  -12.430599  19.589396  -26.604269  
+24.747435  -25.146259  -8.288306  -26.737041  -12.364920  -30.125212  -30.506683  13.233122  -27.001324  -25.677553  
+-23.593397  2.490179  30.440943  -25.393753  16.548756  -32.422806  -30.887869  30.479034  -17.930670  22.131184  
+-22.438736  8.358352  16.260340  -32.475449  -32.186527  7.956705  22.723034  18.579256  28.241919  32.100170  
+19.554148  -27.834885  -22.022249  21.876564  23.675402  27.664116  -25.391336  26.641520  21.600826  -25.006041  
+-25.975653  20.819170  25.681568  -14.112076  30.400187  -26.938988  -31.833731  -24.777851  -23.332275  -6.757283  
+-22.558081  -30.685102  -29.712374  23.001144  14.667596  17.613012  25.100410  24.326008  24.480333  -29.273287  
+-26.562567  28.114670  -24.706234  30.221634  -28.659506  -30.630051  -5.832726  5.143960  -9.164999  28.023228  
+-5.923516  -11.563029  -24.251698  -33.599762  11.713305  -26.949112  -18.838186  30.039885  -29.089350  -27.182583  
+-28.901306  -31.126938  17.398819  -26.592638  30.544956  3.800116  29.343433  25.095493  9.057474  -27.154503  
+25.736546  -13.424304  30.470133  20.869114  18.423546  24.845211  -29.066833  23.181301  -30.541372  25.994198  
+27.423670  -27.840143  13.429342  31.628370  27.305670  -15.566775  21.208973  30.164932  26.405418  22.738131  
+27.583424  17.739641  -28.972815  27.014660  22.040768  28.733265  5.443688  24.076410  -30.501183  -22.660669  
+29.299047  21.763460  -25.778793  -30.054329  18.825420  -28.253668  -18.830385  25.444197  27.765272  -11.697937  
+-16.964239  -30.562384  30.909069  11.853930  25.537861  9.847809  -1.116659  28.196758  35.026066  -25.823643  
+-27.128920  -31.256323  21.659021  24.397120  -25.733042  20.490381  -23.214678  29.172058  10.333962  9.034096  
+14.474123  -23.810432  -24.891966  18.942736  -28.131004  -9.560011  21.164343  -31.593370  -23.664772  30.311522  
+-30.458584  -13.034205  0.747105  6.969122  32.300362  -27.568441  19.547087  26.822100  -33.261684  -30.514378  
+-32.572960  -16.802517  -21.750109  -26.299847  10.077271  -26.800924  27.696951  -11.072599  26.649021  33.732758  
+25.869362  -14.049567  -31.227896  -16.428043  25.684437  26.808477  22.170685  -32.006725  -27.951071  -26.857271  
+25.632647  31.340467  -10.101071  -27.868580  28.392941  -30.367975  -24.844458  18.878220  -28.495523  -23.132236  
+1.986802  -28.611712  -26.413385  -26.797050  -25.955442  -30.128197  -26.639410  -14.373254  28.916788  19.168682  
+-19.165081  11.260596  31.176182  9.450422  31.285467  -20.239744  21.123598  21.685785  29.227621  -31.673935  
+0.587843  22.940138  28.678320  25.398922  -18.522312  12.439598  -29.282730  33.175476  21.039089  -26.045649  
+-25.681229  -5.916020  24.594976  -27.655167  -19.081779  17.430195  -26.535902  21.330406  -29.509890  -34.709892  
+-24.813129  19.791067  26.324507  -33.118763  -18.493454  -25.687447  26.396252  -1.613418  -28.247681  -27.283630  
+-25.763205  -18.964548  -24.838812  -18.957668  30.600906  -24.606560  10.967690  -30.789375  28.121155  5.437460  
+-28.941336  30.519905  -28.119589  -23.024672  28.105591  29.297325  -1.960685  17.279530  -29.578667  -17.794458  
+-14.513925  24.624935  -23.667196  27.040792  3.144825  28.194065  17.492538  28.565624  30.727345  29.069174  
+-23.433559  -5.516361  30.931314  25.211166  7.632286  28.322212  0.928505  33.286747  -0.994150  33.493996  
+23.183256  27.546146  3.295649  20.680958  32.848858  14.191882  -20.808727  18.313766  28.677576  34.206108  
+7.304214  -26.545599  21.813995  -29.120394  -32.868858  -30.856737  24.989367  -3.438031  -10.098872  30.483994  
+-1.543379  -9.049648  29.524065  29.556068  30.132706  31.693953  8.643419  16.408585  -29.715712  -27.209595  
+-1.318370  -28.632818  -5.848276  -19.451675  27.203268  29.918613  -27.557243  -29.160196  11.098360  30.477375  
+30.259293  31.887877  28.997480  -26.240725  29.429012  -0.215187  31.697910  18.112293  7.368057  26.644302  
+-28.542744  32.168686  28.398161  -25.519390  21.313173  24.417574  -23.385223  23.575758  -24.957533  -11.581442  
+-29.584984  -22.043736  -19.973017  -13.154330  27.776617  28.880579  24.541265  -26.868013  -23.242449  -26.350306  
+27.122181  26.698082  -16.079922  -30.070417  -15.069088  -32.086346  -6.156638  -21.599962  -29.905394  -22.629557  
+23.463209  -25.001377  -24.783054  -28.923738  -32.481968  -22.494843  22.910870  -24.435270  23.247295  18.574396  
+-16.888866  29.557543  25.438974  16.747263  23.634312  30.699593  31.858620  -22.419878  20.923744  27.286860  
+23.698317  -28.092585  17.806080  -27.186083  4.859796  30.562733  -21.827574  -19.261030  -30.630808  22.816006  
+8.570764  -26.789154  17.791445  -28.964176  -29.611862  30.816334  25.552217  8.495584  -19.825544  30.543760  
+10.111639  -19.598457  23.963257  -30.313669  26.156183  -25.989300  27.614353  -24.404526  20.948635  -30.697847  
+23.499454  28.296463  28.447521  -23.573496  8.948705  -27.488176  -21.296618  33.204815  -1.533401  -32.551239  
+-28.905920  -28.724876  -11.068836  23.758741  -27.164768  2.238347  25.200848  -21.659460  31.813583  -25.553432  
+24.451195  23.192873  17.820963  28.785830  -26.175900  -20.575638  -19.249416  24.187832  33.765800  27.542351  
+31.044796  18.402918  30.415819  22.584785  5.366678  1.192327  27.368513  27.835930  -29.189474  -26.132465  
+-25.984489  -25.897291  -24.572817  -27.869888  35.358978  0.409840  -29.416412  23.666075  -25.127134  0.175234  
+-11.632380  1.468935  -12.562681  -4.036163  -17.348457  3.709737  12.364988  -29.359982  13.158352  3.583840  
+-31.037598  -23.666887  7.681589  -15.789920  -18.904598  -27.841438  25.454210  28.760548  18.029247  16.851074  
+26.357662  -25.009775  -29.791250  14.314116  -28.555151  0.319603  -28.451876  23.641190  29.803474  -19.127604  
+20.317736  11.170012  26.932655  -15.372322  20.496868  -30.759846  12.953140  30.441490  -35.144604  -22.444994  
+4.470020  -14.852816  -28.201660  30.268980  33.456806  26.419891  16.373205  -28.011635  10.045803  -28.102468  
+-29.568325  -19.445253  -23.598480  32.237045  -11.473091  -27.800039  -18.787716  -6.833638  25.951796  -29.994253  
+2.175416  18.538134  -15.958865  -26.025406  -28.610727  -23.338968  -29.128931  28.077280  29.938484  -31.821379  
+13.321897  -23.288567  25.899305  27.282066  -29.057159  7.306644  -16.628313  19.552446  28.743105  -33.372395  
+25.663147  -24.316936  30.338200  0.198456  26.764936  -28.802996  -24.417147  26.743793  26.973076  -22.167675  
+-24.675283  -29.163818  4.554856  29.763702  -23.107208  -4.606274  -25.717699  30.389217  -26.685402  -24.885359  
+17.466875  22.449562  -30.188108  28.243744  30.856178  -26.148636  -4.465913  -22.124397  24.865055  -26.878393  
+13.763696  19.437191  -4.767939  -30.196630  26.213408  27.918175  -29.278442  26.010557  -18.770628  -34.011822  
+-29.065424  24.655348  -31.381573  -26.498888  23.706768  1.163733  32.557743  29.334454  -25.294851  0.571252  
+2.821732  -29.741623  -25.697899  4.740164  -2.629756  -24.113411  -33.509792  -23.366123  -22.589396  32.119278  
+27.928167  -28.453217  -27.783646  28.721386  30.288094  -7.694778  26.734276  20.536390  12.432297  -27.357151  
+29.255533  -28.615919  -30.009079  -26.702307  -26.329327  3.907118  14.859112  -0.607094  -32.211464  21.356220  
+-18.793222  -3.798059  -26.758448  28.500853  34.239231  -22.307819  -26.285475  27.232656  9.680526  -31.123280  
+-22.048409  19.472820  -27.342068  -3.084518  31.052856  28.628109  -18.369673  -6.574208  26.069016  2.390783  
+30.838614  -31.065832  -23.328526  -27.681437  28.729666  5.293194  22.912565  -24.776793  -3.040089  23.239820  
+24.948847  -29.624977  -18.823366  22.120489  -19.881227  -27.936697  23.355516  13.080451  31.027403  -27.728983  
+-27.207590  -31.597433  -12.881650  -6.010530  9.100506  -29.575729  -26.902830  23.663296  30.666758  31.928682  
+-21.830980  -31.940022  -27.536440  25.065334  22.005463  27.432138  -18.701872  -23.727381  25.942179  11.190812  
+-2.231342  -18.594671  0.143037  -13.649037  -17.063463  -30.886179  15.078956  -32.989906  24.989979  -31.739000  
+25.452377  -27.772600  -27.105972  25.484657  -25.555532  -0.991211  -20.596451  -24.194292  -28.303204  -24.034193  
+-20.308994  26.506071  -22.997358  -27.003933  27.493284  -1.058701  27.859604  -27.349453  26.765139  -28.524254  
+-16.797264  -24.915733  -15.681656  -26.831530  -30.325777  31.558727  -5.553338  -24.391125  31.935699  -28.778387  
+31.743446  26.157917  28.448555  -18.487127  7.345466  1.489666  -29.501638  11.606647  -27.396669  -13.608665  
+-27.674065  22.803783  -23.587780  -5.956399  17.851345  -29.958305  -2.373573  32.541912  -29.145765  32.780499  
+23.156601  -31.936874  -23.037279  23.210339  -16.066366  28.110289  18.845188  30.645571  -26.768814  -16.099922  
+27.679998  -20.325911  25.808142  -25.733467  -28.541807  0.567349  28.784498  26.622042  28.476433  -1.516529  
+26.030373  -16.593649  22.357252  26.293604  28.905434  -27.011293  26.409996  -18.414158  -21.725388  -33.704205  
+-24.948288  -25.220125  -20.178833  -7.443022  9.836597  34.162106  -27.491079  27.349024  -30.223257  -23.430996  
+18.110004  -27.612009  -26.904844  -24.353579  4.394511  31.755394  27.892437  27.468506  -19.308678  27.300795  
+-27.026585  27.288965  -7.176413  10.046975  25.635988  23.404205  -28.872671  31.483458  29.834528  -28.559134  
+30.009659  -11.481675  27.223341  19.816360  4.897099  -24.425240  -28.176208  -27.415291  -29.087711  21.933622  
+29.687820  22.965918  27.730066  31.794384  9.901048  4.573306  20.007175  -29.642658  -26.747276  28.268198  
+-0.865210  -19.871767  -19.929611  -7.993979  18.854616  -28.328897  -34.383411  22.391741  31.597097  -22.520195  
+18.711977  -36.071030  27.292971  15.776377  -27.944176  2.161903  16.054998  3.965790  13.864322  31.318604  
+32.407635  5.166471  16.989594  27.554375  27.841732  26.678566  31.432329  28.344770  25.829052  -4.596391  
+-27.288744  -30.192442  -24.259874  28.172007  22.895628  -0.534298  -19.668987  -6.121844  -27.388472  -26.192146  
+-29.263872  -30.790047  19.891373  -21.585848  -25.329546  -19.121740  27.868361  -25.622396  -13.165931  -27.882870  
+22.623146  23.712912  31.028137  20.355440  25.867502  29.143358  -27.648264  28.304945  17.928005  15.036697  
+-26.480713  -10.525772  22.626904  -30.745777  -24.995880  -13.706410  23.108267  -30.951660  -27.589741  26.716717  
+31.877645  -26.776035  -30.638912  -11.357694  27.723171  -14.465068  -13.479167  29.104784  -25.188648  -26.069992  
+-27.348982  15.839380  27.952333  28.053581  21.310860  29.003035  -17.415442  -17.901690  -26.812763  28.250551  
+-2.292844  -14.367384  31.270039  -2.544875  -3.583298  34.580555  -30.110287  -25.307888  26.263306  -18.783525  
+25.580534  19.344273  24.519999  -27.579952  -28.082302  26.304674  -7.087376  20.679804  -28.221176  25.788729  
+26.403370  0.119673  30.563673  -25.678677  23.550240  26.026884  25.694942  -15.687905  -26.583086  28.904022  
+-26.024733  -9.991076  -26.260162  -32.388321  25.972918  26.600454  24.502594  25.001644  27.591122  -23.150839  
+-20.381500  29.739450  29.266190  -19.060871  31.730856  -27.851404  -29.299297  22.886538  20.299524  -5.612797  
+-30.245682  9.170924  27.835001  28.510269  -26.989723  -29.905684  -21.079306  -4.574450  27.621330  26.835732  
+-11.741691  -21.096174  -31.672081  -26.892820  -20.835611  26.145498  -19.070086  -8.344960  -25.313398  -28.809412  
+27.975668  29.217541  -21.093300  -24.969948  24.385786  27.821079  12.356703  29.299297  31.538540  -18.826864  
+-0.011608  -21.470102  -21.539015  26.133718  -24.347315  14.058448  -29.397707  -32.114067  27.519901  -28.864784  
+7.751823  25.806000  32.901085  -18.736755  -30.452698  31.745525  -19.301916  23.036520  -1.871948  -13.531702  
+-25.096243  -22.490328  -29.185835  29.310244  -22.384819  25.474823  -23.745300  6.527666  -25.035147  26.242929  
+31.915901  -17.114971  33.850632  -23.008661  -20.975691  31.195967  -20.159695  25.620447  -9.417980  -21.470547  
+-20.885433  -26.098394  -34.525181  -27.231531  -22.594303  -19.190878  -17.335438  -22.200954  23.105984  -27.633783  
+-25.089838  27.039967  -29.545822  -26.537960  16.975136  23.591961  27.614595  -26.206774  26.214140  24.426662  
+24.727230  9.407478  -19.955605  -30.136086  32.399204  -29.649614  31.909718  -7.453758  -6.022649  21.740572  
+12.958760  24.706667  -23.926395  -30.368166  29.662342  14.598271  -25.140099  -27.388971  -21.885681  -8.899488  
+-14.913486  5.755036  29.146093  30.288597  26.944231  -23.483667  28.112745  23.703074  26.498447  25.958067  
+11.558963  31.078140  20.723763  -30.646187  9.957328  27.129442  -30.294744  21.838882  30.638649  -5.043203  
+-29.248917  17.624363  31.224365  30.660954  10.486515  -23.798962  1.554539  -28.965864  -12.215902  -22.325430  
+7.900054  -26.661585  27.479298  31.024197  26.996269  -25.794918  -28.789604  20.071230  -26.860794  -21.076006  
+-27.726221  -28.307617  34.196552  19.789654  31.658072  9.052336  20.067137  -24.075565  22.948666  33.775368  
+-18.119324  -15.809902  27.389950  14.877948  -23.965155  22.419680  31.682259  30.595205  -31.514141  -24.590290  
+-18.131638  -31.149517  22.957989  27.805208  29.596313  -18.579456  26.984100  31.832233  -0.351689  -22.661404  
+-19.898781  14.091078  -16.836910  -23.718222  26.494846  7.629979  9.194495  19.305960  -2.738285  -35.370060  
+-25.090359  25.073004  -29.615166  22.081806  24.856117  13.964811  -28.084621  -24.082621  -25.604486  -24.462408  
+30.246601  -5.769229  -5.193548  29.170889  11.829287  -25.503380  -30.386749  30.259050  19.686636  -26.349174  
+28.390156  -24.656689  -12.252963  25.772734  -30.656946  29.966541  -27.206295  26.297985  -12.604877  -3.371529  
+26.495270  25.092012  -26.570024  29.583403  -12.035311  22.394245  -19.207348  -28.881124  19.397552  26.818882  
+-13.935023  -29.313412  -33.118549  -29.540964  9.710785  -26.418322  -15.709097  30.511360  -27.285845  30.564705  
+-1.097461  -29.774305  -24.169292  -29.655241  27.834856  19.809050  23.895390  26.617266  -22.941202  -32.466064  
+27.327742  -26.427551  27.262140  -21.368608  23.675949  28.715414  28.391165  27.343777  -29.445198  -16.981379  
+12.984652  -25.212948  -25.955906  -33.128109  3.915369  32.641487  16.643110  -28.839380  -29.649031  20.084105  
+29.169926  -29.581917  -9.146402  26.112736  21.341251  22.479158  2.133000  -27.415180  -27.825184  29.289385  
+15.334047  30.304628  -10.422917  -10.776401  -28.027750  22.465811  -27.439026  -30.379057  30.532068  -22.980307  
+6.460567  24.801245  27.595768  -18.807585  26.529850  -28.904119  27.325108  -26.231388  -27.992422  -19.203676  
+4.858919  9.724921  26.735258  -29.821846  23.857037  28.866035  -28.931206  30.675814  -18.045187  26.510839  
+-23.896399  -29.940565  -29.135975  25.415710  -31.608906  26.104200  9.917217  18.043379  26.905247  17.197084  
+-32.659801  24.501835  11.548573  24.957283  17.654007  23.903896  30.063805  -25.241699  15.368115  -28.222347  
+-21.819532  28.157255  26.924294  -2.496731  -32.710079  28.959297  17.546373  -31.157272  4.777966  13.330534  
+-33.874298  -22.775492  -23.086416  23.421789  -26.284649  12.585775  -29.640625  -25.766966  17.247511  16.120251  
+-30.796759  -24.995079  -19.737066  13.902723  19.905830  -31.017385  15.919159  -27.547905  -23.628786  28.600891  
+28.395857  -14.105124  23.998751  30.859987  -21.012695  28.477846  20.331127  29.432749  22.459372  23.770639  
+9.352928  -31.270706  -29.708103  18.127703  29.772743  -31.743284  9.090717  -6.822830  3.621120  25.464043  
+-28.046972  -19.711567  -28.521206  16.062174  -18.660967  -32.186073  29.525179  -18.658434  25.409454  3.064334  
+29.735567  27.620518  24.151989  29.720812  -32.017345  8.971922  13.413472  28.063982  -21.506521  13.922566  
+-29.474632  -19.652834  32.006847  24.401064  24.865980  25.338604  -30.355970  22.534678  2.968681  -22.344526  
+-30.064535  28.272619  -11.764478  -28.267519  -9.421213  24.136015  -6.741315  -32.448353  -29.630991  -25.437532  
+-26.516050  26.305784  -25.274731  -23.731672  -6.135195  -21.882580  -30.837490  -15.397966  -29.641878  -26.116444  
+-17.967083  -36.490044  -21.267710  -29.521482  -20.714117  10.630355  2.775754  32.427319  29.701410  22.186726  
+19.387829  -31.321960  6.491024  -3.254502  -9.085204  22.054094  31.965021  -22.539881  -29.751919  -27.778631  
+27.144449  28.251413  -27.894733  18.980383  -16.955488  -24.369068  19.126995  24.730665  28.388189  -30.265663  
+-22.823879  -16.743576  -0.855249  -20.405294  27.509684  21.952494  -32.309036  30.639891  30.141865  26.804674  
+-24.074057  1.584005  -10.435838  -21.381445  27.189999  -23.158571  -31.572952  -11.807989  31.084354  29.657049  
+-22.285618  14.744546  30.259914  26.419849  -29.737955  25.760761  -21.247749  26.240458  29.567011  21.174404  
+8.155906  24.326309  30.161058  10.056418  -23.279669  -28.574661  32.762390  30.282391  29.276430  3.936939  
+-29.147345  31.067495  -32.088154  16.249660  26.796309  -26.572680  -12.852500  -13.132098  23.243259  20.810740  
+-26.896341  20.438314  26.042990  19.506247  20.804615  27.008863  32.395691  30.100246  -26.771997  21.191238  
+7.246809  27.760994  29.059271  27.027941  3.511128  12.881917  -25.996683  -31.800346  29.468363  20.971094  
+13.394855  -22.939171  -32.371952  -11.730799  -26.592562  31.801849  -23.234404  -28.626965  -23.670897  29.706806  
+14.622396  29.198448  -11.544444  -7.621999  -4.405611  32.631290  28.775391  28.799553  -29.890314  -29.841303  
+21.813150  21.489521  -10.591779  -27.987438  -29.199821  -7.887535  -26.221470  -27.671728  -29.797443  20.302853  
+30.639811  13.334771  -8.900882  28.202700  12.857843  -6.109283  30.157297  -15.369250  31.276281  -31.603954  
+7.694522  -20.468029  -0.725897  -17.788485  -34.178978  23.927425  -33.732220  4.955217  20.375965  -24.123995  
+-16.236792  28.180031  -27.844164  -24.859165  -23.890783  -28.153116  -21.531990  22.802910  -27.761011  23.846361  
+28.526554  -27.008692  -30.810272  16.839460  -24.733376  28.403906  -15.245345  -22.803564  23.127598  24.632538  
+25.869368  3.164432  26.618368  29.791756  -30.799095  13.229739  26.083759  -33.614803  26.977602  15.521008  
+14.767395  -23.872744  18.893583  -25.599060  29.511194  -26.763277  -14.523918  -18.442045  -29.616571  27.419004  
+23.568420  -27.056763  24.325432  -23.938623  -28.297735  -6.575099  -26.447481  24.425529  -29.128120  23.467936  
+27.782188  30.725523  -1.994576  20.232574  23.253380  31.770685  25.011625  29.346586  -18.634232  24.028671  
+-2.991406  30.011583  -28.977139  19.140427  31.104210  25.743391  27.864761  -26.303442  5.711771  -24.898342  
+23.080534  32.841953  27.434668  -26.967560  24.944504  23.324984  21.113098  -24.822979  26.371103  3.247402  
+10.371755  -28.783300  30.557535  9.852886  -21.892038  29.397787  30.194834  23.821756  23.221987  -29.185167  
+27.725525  20.331497  29.906160  29.985994  4.673646  -33.141441  17.755194  19.337343  11.178561  -30.378700  
+-29.022953  32.298927  30.623846  -27.330795  -26.317472  -13.545459  -31.038189  14.862134  6.394091  -23.130997  
+-27.122976  24.278252  -3.923284  -4.505970  7.424839  -33.698040  28.509602  29.525066  -14.325845  -3.606597  
+-23.049450  -26.757929  28.846226  -15.622251  -26.292234  12.927630  -32.268642  -23.362898  33.380123  16.713203  
+-26.834475  -25.778423  -25.374941  -33.272823  -8.950101  -26.951784  30.359373  23.437349  -23.741333  17.970463  
+23.584236  29.477566  30.482859  24.227072  -0.161754  -28.249121  -25.205200  -22.896660  -26.021072  -27.754309  
+24.359877  -15.766882  -22.589453  -28.795191  -22.054977  -25.591492  28.914436  -16.483168  -29.730721  -29.069077  
+28.374998  -10.337638  -24.898254  -8.696457  -29.906717  -30.577459  -11.940366  31.599871  -23.696524  16.888037  
+28.412569  -11.547874  -23.385649  5.188973  -26.594147  28.829832  30.491238  31.156525  24.449814  -22.396378  
+-24.123362  10.227979  -33.093067  -26.940413  19.241301  26.934536  -30.959558  -29.113039  -25.290173  24.200045  
+-25.407791  -28.724577  3.698982  -1.167456  32.141792  -3.179670  -27.368929  -31.284103  -29.620163  17.914351  
+-26.139801  -23.038982  22.281845  -17.640434  21.039083  16.812750  31.378922  30.040468  20.431204  24.787907  
+8.001920  29.006453  -29.817034  -16.471649  24.109184  -22.226015  -31.618090  -31.567238  28.035131  -17.240200  
+31.732470  31.900095  27.778193  -4.249768  -15.619086  24.138508  24.233559  14.618389  25.075472  30.349316  
+-28.288677  32.652050  -12.559782  -5.508770  -30.175503  -27.688131  6.298277  17.481476  31.894840  12.626587  
+-0.359956  29.207279  28.969049  -29.720470  -11.271438  0.406908  17.933264  31.816317  31.016989  -29.226896  
+-29.037714  31.317698  29.765678  10.190748  27.784094  -20.760891  19.971119  28.424423  -21.875158  -30.634502  
+17.454336  27.734694  -28.182638  22.936987  -30.864325  24.006058  -22.265110  18.289276  -29.283976  23.994133  
+-28.076096  24.803003  31.810873  -28.802849  16.174349  -12.161655  -0.723460  -30.066971  -4.219203  -27.094242  
+-25.232018  -26.122824  8.917661  30.416269  25.667267  -23.732468  27.151720  -31.532894  21.933271  -24.658945  
+4.607127  25.353094  -31.823626  18.221535  -9.143847  28.309465  27.168276  28.348866  4.025306  -16.054871  
+24.069939  -6.346677  -18.416504  20.772797  29.109146  -22.270210  28.348614  -25.223400  28.465523  33.228703  
+-22.829838  31.330181  2.640439  23.182808  29.689547  -25.471079  31.577196  23.975561  -16.879004  27.922268  
+29.727743  -26.793751  4.074662  -26.435411  9.276300  -30.378164  -22.027834  -29.494093  17.942389  32.048019  
+12.443921  -31.355478  -20.997168  -26.298655  13.543483  -22.858194  27.675776  -9.945221  27.362482  27.321886  
+-22.948797  -16.643089  24.180367  -28.334538  30.239267  25.488913  -27.400799  27.946491  12.241156  -26.680285  
+-26.742994  -32.847370  0.372974  29.170841  19.595181  25.148224  25.905928  -27.588221  5.420761  22.849968  
+-31.289413  -25.980698  10.574203  -26.781279  23.723721  -16.573223  -29.030935  -27.023516  26.670540  -28.518023  
+-20.405828  2.004235  -29.175016  31.777958  18.817739  3.310179  24.954983  23.126196  -33.089378  25.994604  
+24.361629  -24.034267  27.114393  -22.175446  -21.102106  26.505531  28.671572  -27.174116  27.081461  17.971365  
+23.356621  -5.383027  -5.395381  30.386618  -26.971796  35.123657  25.429768  3.912057  -28.749304  27.695974  
+5.089523  30.756739  -18.651115  -29.794476  -11.307332  15.305420  -30.898745  26.515871  -26.690683  31.057924  
+-27.608395  2.751207  31.480362  -6.192355  -15.776289  14.917231  -26.300941  -31.236757  -9.482904  -31.367132  
+-29.525408  13.207518  30.402412  -27.161982  -16.195581  -8.314233  6.639257  26.347960  -12.045978  31.111658  
+-25.366018  20.475132  27.603605  30.567028  -27.804394  21.405256  -6.385581  -26.473637  23.634207  -25.096960  
+29.934078  -27.561596  21.638102  -26.487444  -7.843333  -32.990967  25.479225  23.726942  1.743223  -23.586367  
+-18.529795  -14.682743  -11.309550  29.943205  -32.861969  -24.109367  -11.641270  30.234364  27.131487  27.869272  
+32.296886  16.968967  -28.056850  17.463118  4.709224  -25.974831  -25.367235  1.224072  -26.906301  29.314491  
+-25.831589  27.744438  28.279171  -23.356329  5.997526  13.055943  27.772594  -29.972574  30.874453  -6.439247  
+-27.270761  -26.999367  17.389296  29.682049  25.536079  -31.437716  -17.270382  18.765409  -14.157981  25.990219  
+-25.644127  24.661541  -30.554047  20.114891  -23.111427  22.993216  -27.149054  23.140715  20.203518  27.635824  
+-25.846523  22.715874  -12.718971  -3.160396  -14.715969  35.330879  -30.877163  15.205578  -22.881746  29.061197  
+-15.076153  23.229858  -33.552963  -0.534045  -26.019924  -30.503695  -30.021885  -26.314020  -0.870840  6.176859  
+-31.264351  21.678905  -23.063509  30.365349  32.470901  -10.662707  -8.933731  -26.195234  -25.810390  24.120329  
+27.617683  -26.467562  24.821156  -18.866934  -30.946278  -19.225807  -19.320507  -27.095076  29.887562  -27.905640  
+29.890749  -16.860283  31.453899  14.095822  6.417044  -24.313219  30.336508  -22.971561  22.078314  15.273052  
+10.796197  25.368275  -14.171386  -28.335548  16.275265  -31.915974  -18.500086  -33.356716  -19.192612  33.692402  
+-27.123287  27.355597  -30.336468  28.779318  -32.750500  10.814196  24.501240  3.015838  23.269903  -25.158703  
+-21.149429  -13.080396  -28.024158  -25.943312  23.708012  -28.325745  26.544689  -25.332069  -15.316700  -32.523273  
+13.809246  29.555386  19.702276  28.850292  27.295843  -28.034163  27.024630  -24.833534  26.612434  19.731405  
+28.613760  -29.762756  -30.633032  9.729327  -30.736677  4.846626  25.470345  24.346096  11.554205  23.544035  
+-26.353815  -0.544388  26.486794  -28.141678  -28.819151  -19.970861  -30.929327  22.311621  27.651613  26.565744  
+1.227070  10.043915  -22.600807  26.245567  25.942457  -30.712118  -27.150064  -30.792393  -24.804663  -30.143036  
+26.438381  12.739036  29.980673  29.757868  17.797293  25.890196  28.367943  -28.205496  16.972397  -27.318939  
diff --git a/codec2/tags/0.4/src/codebook/lspdt1-4.txt b/codec2/tags/0.4/src/codebook/lspdt1-4.txt
new file mode 100644 (file)
index 0000000..890001f
--- /dev/null
@@ -0,0 +1,82 @@
+4 81
+ -25  -25  -50  -50 
+   0  -25  -50  -50 
+  25  -25  -50  -50 
+ -25    0  -50  -50 
+   0    0  -50  -50 
+  25    0  -50  -50 
+ -25   25  -50  -50 
+   0   25  -50  -50 
+  25   25  -50  -50 
+ -25  -25    0  -50 
+   0  -25    0  -50 
+  25  -25    0  -50 
+ -25    0    0  -50 
+   0    0    0  -50 
+  25    0    0  -50 
+ -25   25    0  -50 
+   0   25    0  -50 
+  25   25    0  -50 
+ -25  -25   50  -50 
+   0  -25   50  -50 
+  25  -25   50  -50 
+ -25    0   50  -50 
+   0    0   50  -50 
+  25    0   50  -50 
+ -25   25   50  -50 
+   0   25   50  -50 
+  25   25   50  -50 
+ -25  -25  -50    0 
+   0  -25  -50    0 
+  25  -25  -50    0 
+ -25    0  -50    0 
+   0    0  -50    0 
+  25    0  -50    0 
+ -25   25  -50    0 
+   0   25  -50    0 
+  25   25  -50    0 
+ -25  -25    0    0 
+   0  -25    0    0 
+  25  -25    0    0 
+ -25    0    0    0 
+   0    0    0    0 
+  25    0    0    0 
+ -25   25    0    0 
+   0   25    0    0 
+  25   25    0    0 
+ -25  -25   50    0 
+   0  -25   50    0 
+  25  -25   50    0 
+ -25    0   50    0 
+   0    0   50    0 
+  25    0   50    0 
+ -25   25   50    0 
+   0   25   50    0 
+  25   25   50    0 
+ -25  -25  -50   50 
+   0  -25  -50   50 
+  25  -25  -50   50 
+ -25    0  -50   50 
+   0    0  -50   50 
+  25    0  -50   50 
+ -25   25  -50   50 
+   0   25  -50   50 
+  25   25  -50   50 
+ -25  -25    0   50 
+   0  -25    0   50 
+  25  -25    0   50 
+ -25    0    0   50 
+   0    0    0   50 
+  25    0    0   50 
+ -25   25    0   50 
+   0   25    0   50 
+  25   25    0   50 
+ -25  -25   50   50 
+   0  -25   50   50 
+  25  -25   50   50 
+ -25    0   50   50 
+   0    0   50   50 
+  25    0   50   50 
+ -25   25   50   50 
+   0   25   50   50 
+  25   25   50   50 
diff --git a/codec2/tags/0.4/src/codebook/lspdt1.txt b/codec2/tags/0.4/src/codebook/lspdt1.txt
new file mode 100644 (file)
index 0000000..ba30880
--- /dev/null
@@ -0,0 +1,9 @@
+1 8
+-75
+-50
+-25
+  0
+ 25
+ 50
+ 75
+100
diff --git a/codec2/tags/0.4/src/codebook/lspdt10.txt b/codec2/tags/0.4/src/codebook/lspdt10.txt
new file mode 100644 (file)
index 0000000..e72c16c
--- /dev/null
@@ -0,0 +1,3 @@
+1 2
+-50
+ 50
diff --git a/codec2/tags/0.4/src/codebook/lspdt2.txt b/codec2/tags/0.4/src/codebook/lspdt2.txt
new file mode 100644 (file)
index 0000000..ba30880
--- /dev/null
@@ -0,0 +1,9 @@
+1 8
+-75
+-50
+-25
+  0
+ 25
+ 50
+ 75
+100
diff --git a/codec2/tags/0.4/src/codebook/lspdt3.txt b/codec2/tags/0.4/src/codebook/lspdt3.txt
new file mode 100644 (file)
index 0000000..7ebefd9
--- /dev/null
@@ -0,0 +1,5 @@
+1 4
+-50
+  0
+ 50
+ 100
diff --git a/codec2/tags/0.4/src/codebook/lspdt4.txt b/codec2/tags/0.4/src/codebook/lspdt4.txt
new file mode 100644 (file)
index 0000000..7ebefd9
--- /dev/null
@@ -0,0 +1,5 @@
+1 4
+-50
+  0
+ 50
+ 100
diff --git a/codec2/tags/0.4/src/codebook/lspdt5-10.txt b/codec2/tags/0.4/src/codebook/lspdt5-10.txt
new file mode 100644 (file)
index 0000000..3e18efa
--- /dev/null
@@ -0,0 +1,730 @@
+6 729
+ -50  -50  -50  -50  -50  -50 
+   0  -50  -50  -50  -50  -50 
+  50  -50  -50  -50  -50  -50 
+ -50    0  -50  -50  -50  -50 
+   0    0  -50  -50  -50  -50 
+  50    0  -50  -50  -50  -50 
+ -50   50  -50  -50  -50  -50 
+   0   50  -50  -50  -50  -50 
+  50   50  -50  -50  -50  -50 
+ -50  -50    0  -50  -50  -50 
+   0  -50    0  -50  -50  -50 
+  50  -50    0  -50  -50  -50 
+ -50    0    0  -50  -50  -50 
+   0    0    0  -50  -50  -50 
+  50    0    0  -50  -50  -50 
+ -50   50    0  -50  -50  -50 
+   0   50    0  -50  -50  -50 
+  50   50    0  -50  -50  -50 
+ -50  -50   50  -50  -50  -50 
+   0  -50   50  -50  -50  -50 
+  50  -50   50  -50  -50  -50 
+ -50    0   50  -50  -50  -50 
+   0    0   50  -50  -50  -50 
+  50    0   50  -50  -50  -50 
+ -50   50   50  -50  -50  -50 
+   0   50   50  -50  -50  -50 
+  50   50   50  -50  -50  -50 
+ -50  -50  -50    0  -50  -50 
+   0  -50  -50    0  -50  -50 
+  50  -50  -50    0  -50  -50 
+ -50    0  -50    0  -50  -50 
+   0    0  -50    0  -50  -50 
+  50    0  -50    0  -50  -50 
+ -50   50  -50    0  -50  -50 
+   0   50  -50    0  -50  -50 
+  50   50  -50    0  -50  -50 
+ -50  -50    0    0  -50  -50 
+   0  -50    0    0  -50  -50 
+  50  -50    0    0  -50  -50 
+ -50    0    0    0  -50  -50 
+   0    0    0    0  -50  -50 
+  50    0    0    0  -50  -50 
+ -50   50    0    0  -50  -50 
+   0   50    0    0  -50  -50 
+  50   50    0    0  -50  -50 
+ -50  -50   50    0  -50  -50 
+   0  -50   50    0  -50  -50 
+  50  -50   50    0  -50  -50 
+ -50    0   50    0  -50  -50 
+   0    0   50    0  -50  -50 
+  50    0   50    0  -50  -50 
+ -50   50   50    0  -50  -50 
+   0   50   50    0  -50  -50 
+  50   50   50    0  -50  -50 
+ -50  -50  -50   50  -50  -50 
+   0  -50  -50   50  -50  -50 
+  50  -50  -50   50  -50  -50 
+ -50    0  -50   50  -50  -50 
+   0    0  -50   50  -50  -50 
+  50    0  -50   50  -50  -50 
+ -50   50  -50   50  -50  -50 
+   0   50  -50   50  -50  -50 
+  50   50  -50   50  -50  -50 
+ -50  -50    0   50  -50  -50 
+   0  -50    0   50  -50  -50 
+  50  -50    0   50  -50  -50 
+ -50    0    0   50  -50  -50 
+   0    0    0   50  -50  -50 
+  50    0    0   50  -50  -50 
+ -50   50    0   50  -50  -50 
+   0   50    0   50  -50  -50 
+  50   50    0   50  -50  -50 
+ -50  -50   50   50  -50  -50 
+   0  -50   50   50  -50  -50 
+  50  -50   50   50  -50  -50 
+ -50    0   50   50  -50  -50 
+   0    0   50   50  -50  -50 
+  50    0   50   50  -50  -50 
+ -50   50   50   50  -50  -50 
+   0   50   50   50  -50  -50 
+  50   50   50   50  -50  -50 
+ -50  -50  -50  -50    0  -50 
+   0  -50  -50  -50    0  -50 
+  50  -50  -50  -50    0  -50 
+ -50    0  -50  -50    0  -50 
+   0    0  -50  -50    0  -50 
+  50    0  -50  -50    0  -50 
+ -50   50  -50  -50    0  -50 
+   0   50  -50  -50    0  -50 
+  50   50  -50  -50    0  -50 
+ -50  -50    0  -50    0  -50 
+   0  -50    0  -50    0  -50 
+  50  -50    0  -50    0  -50 
+ -50    0    0  -50    0  -50 
+   0    0    0  -50    0  -50 
+  50    0    0  -50    0  -50 
+ -50   50    0  -50    0  -50 
+   0   50    0  -50    0  -50 
+  50   50    0  -50    0  -50 
+ -50  -50   50  -50    0  -50 
+   0  -50   50  -50    0  -50 
+  50  -50   50  -50    0  -50 
+ -50    0   50  -50    0  -50 
+   0    0   50  -50    0  -50 
+  50    0   50  -50    0  -50 
+ -50   50   50  -50    0  -50 
+   0   50   50  -50    0  -50 
+  50   50   50  -50    0  -50 
+ -50  -50  -50    0    0  -50 
+   0  -50  -50    0    0  -50 
+  50  -50  -50    0    0  -50 
+ -50    0  -50    0    0  -50 
+   0    0  -50    0    0  -50 
+  50    0  -50    0    0  -50 
+ -50   50  -50    0    0  -50 
+   0   50  -50    0    0  -50 
+  50   50  -50    0    0  -50 
+ -50  -50    0    0    0  -50 
+   0  -50    0    0    0  -50 
+  50  -50    0    0    0  -50 
+ -50    0    0    0    0  -50 
+   0    0    0    0    0  -50 
+  50    0    0    0    0  -50 
+ -50   50    0    0    0  -50 
+   0   50    0    0    0  -50 
+  50   50    0    0    0  -50 
+ -50  -50   50    0    0  -50 
+   0  -50   50    0    0  -50 
+  50  -50   50    0    0  -50 
+ -50    0   50    0    0  -50 
+   0    0   50    0    0  -50 
+  50    0   50    0    0  -50 
+ -50   50   50    0    0  -50 
+   0   50   50    0    0  -50 
+  50   50   50    0    0  -50 
+ -50  -50  -50   50    0  -50 
+   0  -50  -50   50    0  -50 
+  50  -50  -50   50    0  -50 
+ -50    0  -50   50    0  -50 
+   0    0  -50   50    0  -50 
+  50    0  -50   50    0  -50 
+ -50   50  -50   50    0  -50 
+   0   50  -50   50    0  -50 
+  50   50  -50   50    0  -50 
+ -50  -50    0   50    0  -50 
+   0  -50    0   50    0  -50 
+  50  -50    0   50    0  -50 
+ -50    0    0   50    0  -50 
+   0    0    0   50    0  -50 
+  50    0    0   50    0  -50 
+ -50   50    0   50    0  -50 
+   0   50    0   50    0  -50 
+  50   50    0   50    0  -50 
+ -50  -50   50   50    0  -50 
+   0  -50   50   50    0  -50 
+  50  -50   50   50    0  -50 
+ -50    0   50   50    0  -50 
+   0    0   50   50    0  -50 
+  50    0   50   50    0  -50 
+ -50   50   50   50    0  -50 
+   0   50   50   50    0  -50 
+  50   50   50   50    0  -50 
+ -50  -50  -50  -50   50  -50 
+   0  -50  -50  -50   50  -50 
+  50  -50  -50  -50   50  -50 
+ -50    0  -50  -50   50  -50 
+   0    0  -50  -50   50  -50 
+  50    0  -50  -50   50  -50 
+ -50   50  -50  -50   50  -50 
+   0   50  -50  -50   50  -50 
+  50   50  -50  -50   50  -50 
+ -50  -50    0  -50   50  -50 
+   0  -50    0  -50   50  -50 
+  50  -50    0  -50   50  -50 
+ -50    0    0  -50   50  -50 
+   0    0    0  -50   50  -50 
+  50    0    0  -50   50  -50 
+ -50   50    0  -50   50  -50 
+   0   50    0  -50   50  -50 
+  50   50    0  -50   50  -50 
+ -50  -50   50  -50   50  -50 
+   0  -50   50  -50   50  -50 
+  50  -50   50  -50   50  -50 
+ -50    0   50  -50   50  -50 
+   0    0   50  -50   50  -50 
+  50    0   50  -50   50  -50 
+ -50   50   50  -50   50  -50 
+   0   50   50  -50   50  -50 
+  50   50   50  -50   50  -50 
+ -50  -50  -50    0   50  -50 
+   0  -50  -50    0   50  -50 
+  50  -50  -50    0   50  -50 
+ -50    0  -50    0   50  -50 
+   0    0  -50    0   50  -50 
+  50    0  -50    0   50  -50 
+ -50   50  -50    0   50  -50 
+   0   50  -50    0   50  -50 
+  50   50  -50    0   50  -50 
+ -50  -50    0    0   50  -50 
+   0  -50    0    0   50  -50 
+  50  -50    0    0   50  -50 
+ -50    0    0    0   50  -50 
+   0    0    0    0   50  -50 
+  50    0    0    0   50  -50 
+ -50   50    0    0   50  -50 
+   0   50    0    0   50  -50 
+  50   50    0    0   50  -50 
+ -50  -50   50    0   50  -50 
+   0  -50   50    0   50  -50 
+  50  -50   50    0   50  -50 
+ -50    0   50    0   50  -50 
+   0    0   50    0   50  -50 
+  50    0   50    0   50  -50 
+ -50   50   50    0   50  -50 
+   0   50   50    0   50  -50 
+  50   50   50    0   50  -50 
+ -50  -50  -50   50   50  -50 
+   0  -50  -50   50   50  -50 
+  50  -50  -50   50   50  -50 
+ -50    0  -50   50   50  -50 
+   0    0  -50   50   50  -50 
+  50    0  -50   50   50  -50 
+ -50   50  -50   50   50  -50 
+   0   50  -50   50   50  -50 
+  50   50  -50   50   50  -50 
+ -50  -50    0   50   50  -50 
+   0  -50    0   50   50  -50 
+  50  -50    0   50   50  -50 
+ -50    0    0   50   50  -50 
+   0    0    0   50   50  -50 
+  50    0    0   50   50  -50 
+ -50   50    0   50   50  -50 
+   0   50    0   50   50  -50 
+  50   50    0   50   50  -50 
+ -50  -50   50   50   50  -50 
+   0  -50   50   50   50  -50 
+  50  -50   50   50   50  -50 
+ -50    0   50   50   50  -50 
+   0    0   50   50   50  -50 
+  50    0   50   50   50  -50 
+ -50   50   50   50   50  -50 
+   0   50   50   50   50  -50 
+  50   50   50   50   50  -50 
+ -50  -50  -50  -50  -50    0 
+   0  -50  -50  -50  -50    0 
+  50  -50  -50  -50  -50    0 
+ -50    0  -50  -50  -50    0 
+   0    0  -50  -50  -50    0 
+  50    0  -50  -50  -50    0 
+ -50   50  -50  -50  -50    0 
+   0   50  -50  -50  -50    0 
+  50   50  -50  -50  -50    0 
+ -50  -50    0  -50  -50    0 
+   0  -50    0  -50  -50    0 
+  50  -50    0  -50  -50    0 
+ -50    0    0  -50  -50    0 
+   0    0    0  -50  -50    0 
+  50    0    0  -50  -50    0 
+ -50   50    0  -50  -50    0 
+   0   50    0  -50  -50    0 
+  50   50    0  -50  -50    0 
+ -50  -50   50  -50  -50    0 
+   0  -50   50  -50  -50    0 
+  50  -50   50  -50  -50    0 
+ -50    0   50  -50  -50    0 
+   0    0   50  -50  -50    0 
+  50    0   50  -50  -50    0 
+ -50   50   50  -50  -50    0 
+   0   50   50  -50  -50    0 
+  50   50   50  -50  -50    0 
+ -50  -50  -50    0  -50    0 
+   0  -50  -50    0  -50    0 
+  50  -50  -50    0  -50    0 
+ -50    0  -50    0  -50    0 
+   0    0  -50    0  -50    0 
+  50    0  -50    0  -50    0 
+ -50   50  -50    0  -50    0 
+   0   50  -50    0  -50    0 
+  50   50  -50    0  -50    0 
+ -50  -50    0    0  -50    0 
+   0  -50    0    0  -50    0 
+  50  -50    0    0  -50    0 
+ -50    0    0    0  -50    0 
+   0    0    0    0  -50    0 
+  50    0    0    0  -50    0 
+ -50   50    0    0  -50    0 
+   0   50    0    0  -50    0 
+  50   50    0    0  -50    0 
+ -50  -50   50    0  -50    0 
+   0  -50   50    0  -50    0 
+  50  -50   50    0  -50    0 
+ -50    0   50    0  -50    0 
+   0    0   50    0  -50    0 
+  50    0   50    0  -50    0 
+ -50   50   50    0  -50    0 
+   0   50   50    0  -50    0 
+  50   50   50    0  -50    0 
+ -50  -50  -50   50  -50    0 
+   0  -50  -50   50  -50    0 
+  50  -50  -50   50  -50    0 
+ -50    0  -50   50  -50    0 
+   0    0  -50   50  -50    0 
+  50    0  -50   50  -50    0 
+ -50   50  -50   50  -50    0 
+   0   50  -50   50  -50    0 
+  50   50  -50   50  -50    0 
+ -50  -50    0   50  -50    0 
+   0  -50    0   50  -50    0 
+  50  -50    0   50  -50    0 
+ -50    0    0   50  -50    0 
+   0    0    0   50  -50    0 
+  50    0    0   50  -50    0 
+ -50   50    0   50  -50    0 
+   0   50    0   50  -50    0 
+  50   50    0   50  -50    0 
+ -50  -50   50   50  -50    0 
+   0  -50   50   50  -50    0 
+  50  -50   50   50  -50    0 
+ -50    0   50   50  -50    0 
+   0    0   50   50  -50    0 
+  50    0   50   50  -50    0 
+ -50   50   50   50  -50    0 
+   0   50   50   50  -50    0 
+  50   50   50   50  -50    0 
+ -50  -50  -50  -50    0    0 
+   0  -50  -50  -50    0    0 
+  50  -50  -50  -50    0    0 
+ -50    0  -50  -50    0    0 
+   0    0  -50  -50    0    0 
+  50    0  -50  -50    0    0 
+ -50   50  -50  -50    0    0 
+   0   50  -50  -50    0    0 
+  50   50  -50  -50    0    0 
+ -50  -50    0  -50    0    0 
+   0  -50    0  -50    0    0 
+  50  -50    0  -50    0    0 
+ -50    0    0  -50    0    0 
+   0    0    0  -50    0    0 
+  50    0    0  -50    0    0 
+ -50   50    0  -50    0    0 
+   0   50    0  -50    0    0 
+  50   50    0  -50    0    0 
+ -50  -50   50  -50    0    0 
+   0  -50   50  -50    0    0 
+  50  -50   50  -50    0    0 
+ -50    0   50  -50    0    0 
+   0    0   50  -50    0    0 
+  50    0   50  -50    0    0 
+ -50   50   50  -50    0    0 
+   0   50   50  -50    0    0 
+  50   50   50  -50    0    0 
+ -50  -50  -50    0    0    0 
+   0  -50  -50    0    0    0 
+  50  -50  -50    0    0    0 
+ -50    0  -50    0    0    0 
+   0    0  -50    0    0    0 
+  50    0  -50    0    0    0 
+ -50   50  -50    0    0    0 
+   0   50  -50    0    0    0 
+  50   50  -50    0    0    0 
+ -50  -50    0    0    0    0 
+   0  -50    0    0    0    0 
+  50  -50    0    0    0    0 
+ -50    0    0    0    0    0 
+   0    0    0    0    0    0 
+  50    0    0    0    0    0 
+ -50   50    0    0    0    0 
+   0   50    0    0    0    0 
+  50   50    0    0    0    0 
+ -50  -50   50    0    0    0 
+   0  -50   50    0    0    0 
+  50  -50   50    0    0    0 
+ -50    0   50    0    0    0 
+   0    0   50    0    0    0 
+  50    0   50    0    0    0 
+ -50   50   50    0    0    0 
+   0   50   50    0    0    0 
+  50   50   50    0    0    0 
+ -50  -50  -50   50    0    0 
+   0  -50  -50   50    0    0 
+  50  -50  -50   50    0    0 
+ -50    0  -50   50    0    0 
+   0    0  -50   50    0    0 
+  50    0  -50   50    0    0 
+ -50   50  -50   50    0    0 
+   0   50  -50   50    0    0 
+  50   50  -50   50    0    0 
+ -50  -50    0   50    0    0 
+   0  -50    0   50    0    0 
+  50  -50    0   50    0    0 
+ -50    0    0   50    0    0 
+   0    0    0   50    0    0 
+  50    0    0   50    0    0 
+ -50   50    0   50    0    0 
+   0   50    0   50    0    0 
+  50   50    0   50    0    0 
+ -50  -50   50   50    0    0 
+   0  -50   50   50    0    0 
+  50  -50   50   50    0    0 
+ -50    0   50   50    0    0 
+   0    0   50   50    0    0 
+  50    0   50   50    0    0 
+ -50   50   50   50    0    0 
+   0   50   50   50    0    0 
+  50   50   50   50    0    0 
+ -50  -50  -50  -50   50    0 
+   0  -50  -50  -50   50    0 
+  50  -50  -50  -50   50    0 
+ -50    0  -50  -50   50    0 
+   0    0  -50  -50   50    0 
+  50    0  -50  -50   50    0 
+ -50   50  -50  -50   50    0 
+   0   50  -50  -50   50    0 
+  50   50  -50  -50   50    0 
+ -50  -50    0  -50   50    0 
+   0  -50    0  -50   50    0 
+  50  -50    0  -50   50    0 
+ -50    0    0  -50   50    0 
+   0    0    0  -50   50    0 
+  50    0    0  -50   50    0 
+ -50   50    0  -50   50    0 
+   0   50    0  -50   50    0 
+  50   50    0  -50   50    0 
+ -50  -50   50  -50   50    0 
+   0  -50   50  -50   50    0 
+  50  -50   50  -50   50    0 
+ -50    0   50  -50   50    0 
+   0    0   50  -50   50    0 
+  50    0   50  -50   50    0 
+ -50   50   50  -50   50    0 
+   0   50   50  -50   50    0 
+  50   50   50  -50   50    0 
+ -50  -50  -50    0   50    0 
+   0  -50  -50    0   50    0 
+  50  -50  -50    0   50    0 
+ -50    0  -50    0   50    0 
+   0    0  -50    0   50    0 
+  50    0  -50    0   50    0 
+ -50   50  -50    0   50    0 
+   0   50  -50    0   50    0 
+  50   50  -50    0   50    0 
+ -50  -50    0    0   50    0 
+   0  -50    0    0   50    0 
+  50  -50    0    0   50    0 
+ -50    0    0    0   50    0 
+   0    0    0    0   50    0 
+  50    0    0    0   50    0 
+ -50   50    0    0   50    0 
+   0   50    0    0   50    0 
+  50   50    0    0   50    0 
+ -50  -50   50    0   50    0 
+   0  -50   50    0   50    0 
+  50  -50   50    0   50    0 
+ -50    0   50    0   50    0 
+   0    0   50    0   50    0 
+  50    0   50    0   50    0 
+ -50   50   50    0   50    0 
+   0   50   50    0   50    0 
+  50   50   50    0   50    0 
+ -50  -50  -50   50   50    0 
+   0  -50  -50   50   50    0 
+  50  -50  -50   50   50    0 
+ -50    0  -50   50   50    0 
+   0    0  -50   50   50    0 
+  50    0  -50   50   50    0 
+ -50   50  -50   50   50    0 
+   0   50  -50   50   50    0 
+  50   50  -50   50   50    0 
+ -50  -50    0   50   50    0 
+   0  -50    0   50   50    0 
+  50  -50    0   50   50    0 
+ -50    0    0   50   50    0 
+   0    0    0   50   50    0 
+  50    0    0   50   50    0 
+ -50   50    0   50   50    0 
+   0   50    0   50   50    0 
+  50   50    0   50   50    0 
+ -50  -50   50   50   50    0 
+   0  -50   50   50   50    0 
+  50  -50   50   50   50    0 
+ -50    0   50   50   50    0 
+   0    0   50   50   50    0 
+  50    0   50   50   50    0 
+ -50   50   50   50   50    0 
+   0   50   50   50   50    0 
+  50   50   50   50   50    0 
+ -50  -50  -50  -50  -50   50 
+   0  -50  -50  -50  -50   50 
+  50  -50  -50  -50  -50   50 
+ -50    0  -50  -50  -50   50 
+   0    0  -50  -50  -50   50 
+  50    0  -50  -50  -50   50 
+ -50   50  -50  -50  -50   50 
+   0   50  -50  -50  -50   50 
+  50   50  -50  -50  -50   50 
+ -50  -50    0  -50  -50   50 
+   0  -50    0  -50  -50   50 
+  50  -50    0  -50  -50   50 
+ -50    0    0  -50  -50   50 
+   0    0    0  -50  -50   50 
+  50    0    0  -50  -50   50 
+ -50   50    0  -50  -50   50 
+   0   50    0  -50  -50   50 
+  50   50    0  -50  -50   50 
+ -50  -50   50  -50  -50   50 
+   0  -50   50  -50  -50   50 
+  50  -50   50  -50  -50   50 
+ -50    0   50  -50  -50   50 
+   0    0   50  -50  -50   50 
+  50    0   50  -50  -50   50 
+ -50   50   50  -50  -50   50 
+   0   50   50  -50  -50   50 
+  50   50   50  -50  -50   50 
+ -50  -50  -50    0  -50   50 
+   0  -50  -50    0  -50   50 
+  50  -50  -50    0  -50   50 
+ -50    0  -50    0  -50   50 
+   0    0  -50    0  -50   50 
+  50    0  -50    0  -50   50 
+ -50   50  -50    0  -50   50 
+   0   50  -50    0  -50   50 
+  50   50  -50    0  -50   50 
+ -50  -50    0    0  -50   50 
+   0  -50    0    0  -50   50 
+  50  -50    0    0  -50   50 
+ -50    0    0    0  -50   50 
+   0    0    0    0  -50   50 
+  50    0    0    0  -50   50 
+ -50   50    0    0  -50   50 
+   0   50    0    0  -50   50 
+  50   50    0    0  -50   50 
+ -50  -50   50    0  -50   50 
+   0  -50   50    0  -50   50 
+  50  -50   50    0  -50   50 
+ -50    0   50    0  -50   50 
+   0    0   50    0  -50   50 
+  50    0   50    0  -50   50 
+ -50   50   50    0  -50   50 
+   0   50   50    0  -50   50 
+  50   50   50    0  -50   50 
+ -50  -50  -50   50  -50   50 
+   0  -50  -50   50  -50   50 
+  50  -50  -50   50  -50   50 
+ -50    0  -50   50  -50   50 
+   0    0  -50   50  -50   50 
+  50    0  -50   50  -50   50 
+ -50   50  -50   50  -50   50 
+   0   50  -50   50  -50   50 
+  50   50  -50   50  -50   50 
+ -50  -50    0   50  -50   50 
+   0  -50    0   50  -50   50 
+  50  -50    0   50  -50   50 
+ -50    0    0   50  -50   50 
+   0    0    0   50  -50   50 
+  50    0    0   50  -50   50 
+ -50   50    0   50  -50   50 
+   0   50    0   50  -50   50 
+  50   50    0   50  -50   50 
+ -50  -50   50   50  -50   50 
+   0  -50   50   50  -50   50 
+  50  -50   50   50  -50   50 
+ -50    0   50   50  -50   50 
+   0    0   50   50  -50   50 
+  50    0   50   50  -50   50 
+ -50   50   50   50  -50   50 
+   0   50   50   50  -50   50 
+  50   50   50   50  -50   50 
+ -50  -50  -50  -50    0   50 
+   0  -50  -50  -50    0   50 
+  50  -50  -50  -50    0   50 
+ -50    0  -50  -50    0   50 
+   0    0  -50  -50    0   50 
+  50    0  -50  -50    0   50 
+ -50   50  -50  -50    0   50 
+   0   50  -50  -50    0   50 
+  50   50  -50  -50    0   50 
+ -50  -50    0  -50    0   50 
+   0  -50    0  -50    0   50 
+  50  -50    0  -50    0   50 
+ -50    0    0  -50    0   50 
+   0    0    0  -50    0   50 
+  50    0    0  -50    0   50 
+ -50   50    0  -50    0   50 
+   0   50    0  -50    0   50 
+  50   50    0  -50    0   50 
+ -50  -50   50  -50    0   50 
+   0  -50   50  -50    0   50 
+  50  -50   50  -50    0   50 
+ -50    0   50  -50    0   50 
+   0    0   50  -50    0   50 
+  50    0   50  -50    0   50 
+ -50   50   50  -50    0   50 
+   0   50   50  -50    0   50 
+  50   50   50  -50    0   50 
+ -50  -50  -50    0    0   50 
+   0  -50  -50    0    0   50 
+  50  -50  -50    0    0   50 
+ -50    0  -50    0    0   50 
+   0    0  -50    0    0   50 
+  50    0  -50    0    0   50 
+ -50   50  -50    0    0   50 
+   0   50  -50    0    0   50 
+  50   50  -50    0    0   50 
+ -50  -50    0    0    0   50 
+   0  -50    0    0    0   50 
+  50  -50    0    0    0   50 
+ -50    0    0    0    0   50 
+   0    0    0    0    0   50 
+  50    0    0    0    0   50 
+ -50   50    0    0    0   50 
+   0   50    0    0    0   50 
+  50   50    0    0    0   50 
+ -50  -50   50    0    0   50 
+   0  -50   50    0    0   50 
+  50  -50   50    0    0   50 
+ -50    0   50    0    0   50 
+   0    0   50    0    0   50 
+  50    0   50    0    0   50 
+ -50   50   50    0    0   50 
+   0   50   50    0    0   50 
+  50   50   50    0    0   50 
+ -50  -50  -50   50    0   50 
+   0  -50  -50   50    0   50 
+  50  -50  -50   50    0   50 
+ -50    0  -50   50    0   50 
+   0    0  -50   50    0   50 
+  50    0  -50   50    0   50 
+ -50   50  -50   50    0   50 
+   0   50  -50   50    0   50 
+  50   50  -50   50    0   50 
+ -50  -50    0   50    0   50 
+   0  -50    0   50    0   50 
+  50  -50    0   50    0   50 
+ -50    0    0   50    0   50 
+   0    0    0   50    0   50 
+  50    0    0   50    0   50 
+ -50   50    0   50    0   50 
+   0   50    0   50    0   50 
+  50   50    0   50    0   50 
+ -50  -50   50   50    0   50 
+   0  -50   50   50    0   50 
+  50  -50   50   50    0   50 
+ -50    0   50   50    0   50 
+   0    0   50   50    0   50 
+  50    0   50   50    0   50 
+ -50   50   50   50    0   50 
+   0   50   50   50    0   50 
+  50   50   50   50    0   50 
+ -50  -50  -50  -50   50   50 
+   0  -50  -50  -50   50   50 
+  50  -50  -50  -50   50   50 
+ -50    0  -50  -50   50   50 
+   0    0  -50  -50   50   50 
+  50    0  -50  -50   50   50 
+ -50   50  -50  -50   50   50 
+   0   50  -50  -50   50   50 
+  50   50  -50  -50   50   50 
+ -50  -50    0  -50   50   50 
+   0  -50    0  -50   50   50 
+  50  -50    0  -50   50   50 
+ -50    0    0  -50   50   50 
+   0    0    0  -50   50   50 
+  50    0    0  -50   50   50 
+ -50   50    0  -50   50   50 
+   0   50    0  -50   50   50 
+  50   50    0  -50   50   50 
+ -50  -50   50  -50   50   50 
+   0  -50   50  -50   50   50 
+  50  -50   50  -50   50   50 
+ -50    0   50  -50   50   50 
+   0    0   50  -50   50   50 
+  50    0   50  -50   50   50 
+ -50   50   50  -50   50   50 
+   0   50   50  -50   50   50 
+  50   50   50  -50   50   50 
+ -50  -50  -50    0   50   50 
+   0  -50  -50    0   50   50 
+  50  -50  -50    0   50   50 
+ -50    0  -50    0   50   50 
+   0    0  -50    0   50   50 
+  50    0  -50    0   50   50 
+ -50   50  -50    0   50   50 
+   0   50  -50    0   50   50 
+  50   50  -50    0   50   50 
+ -50  -50    0    0   50   50 
+   0  -50    0    0   50   50 
+  50  -50    0    0   50   50 
+ -50    0    0    0   50   50 
+   0    0    0    0   50   50 
+  50    0    0    0   50   50 
+ -50   50    0    0   50   50 
+   0   50    0    0   50   50 
+  50   50    0    0   50   50 
+ -50  -50   50    0   50   50 
+   0  -50   50    0   50   50 
+  50  -50   50    0   50   50 
+ -50    0   50    0   50   50 
+   0    0   50    0   50   50 
+  50    0   50    0   50   50 
+ -50   50   50    0   50   50 
+   0   50   50    0   50   50 
+  50   50   50    0   50   50 
+ -50  -50  -50   50   50   50 
+   0  -50  -50   50   50   50 
+  50  -50  -50   50   50   50 
+ -50    0  -50   50   50   50 
+   0    0  -50   50   50   50 
+  50    0  -50   50   50   50 
+ -50   50  -50   50   50   50 
+   0   50  -50   50   50   50 
+  50   50  -50   50   50   50 
+ -50  -50    0   50   50   50 
+   0  -50    0   50   50   50 
+  50  -50    0   50   50   50 
+ -50    0    0   50   50   50 
+   0    0    0   50   50   50 
+  50    0    0   50   50   50 
+ -50   50    0   50   50   50 
+   0   50    0   50   50   50 
+  50   50    0   50   50   50 
+ -50  -50   50   50   50   50 
+   0  -50   50   50   50   50 
+  50  -50   50   50   50   50 
+ -50    0   50   50   50   50 
+   0    0   50   50   50   50 
+  50    0   50   50   50   50 
+ -50   50   50   50   50   50 
+   0   50   50   50   50   50 
+  50   50   50   50   50   50 
diff --git a/codec2/tags/0.4/src/codebook/lspdt5.txt b/codec2/tags/0.4/src/codebook/lspdt5.txt
new file mode 100644 (file)
index 0000000..7ebefd9
--- /dev/null
@@ -0,0 +1,5 @@
+1 4
+-50
+  0
+ 50
+ 100
diff --git a/codec2/tags/0.4/src/codebook/lspdt6.txt b/codec2/tags/0.4/src/codebook/lspdt6.txt
new file mode 100644 (file)
index 0000000..7ebefd9
--- /dev/null
@@ -0,0 +1,5 @@
+1 4
+-50
+  0
+ 50
+ 100
diff --git a/codec2/tags/0.4/src/codebook/lspdt7.txt b/codec2/tags/0.4/src/codebook/lspdt7.txt
new file mode 100644 (file)
index 0000000..e72c16c
--- /dev/null
@@ -0,0 +1,3 @@
+1 2
+-50
+ 50
diff --git a/codec2/tags/0.4/src/codebook/lspdt8.txt b/codec2/tags/0.4/src/codebook/lspdt8.txt
new file mode 100644 (file)
index 0000000..e72c16c
--- /dev/null
@@ -0,0 +1,3 @@
+1 2
+-50
+ 50
diff --git a/codec2/tags/0.4/src/codebook/lspdt9.txt b/codec2/tags/0.4/src/codebook/lspdt9.txt
new file mode 100644 (file)
index 0000000..e72c16c
--- /dev/null
@@ -0,0 +1,3 @@
+1 2
+-50
+ 50
diff --git a/codec2/tags/0.4/src/codebook/lspjvm1.txt b/codec2/tags/0.4/src/codebook/lspjvm1.txt
new file mode 100644 (file)
index 0000000..4588013
--- /dev/null
@@ -0,0 +1,513 @@
+10 512
+0.435217 0.668864 1.010296 1.220420 1.503978 1.784675 2.135458 2.357467 2.618905 2.738042 
+0.179285 0.333160 0.500638 0.796950 1.039987 1.234969 1.652301 1.848233 2.625555 2.804968 
+0.268785 0.356576 0.595753 1.044339 1.249382 1.428680 1.686986 1.864689 2.339905 2.513801 
+0.120070 0.165585 0.484694 0.959160 1.237528 1.529146 1.837513 2.107730 2.487495 2.766846 
+0.150214 0.229487 0.628240 0.961255 1.337065 1.598306 1.919745 2.217861 2.537318 2.759560 
+0.268624 0.345980 0.569637 0.754737 0.916538 1.508543 1.786354 1.954418 2.369530 2.501822 
+0.246064 0.468874 0.662711 0.890015 1.147153 1.510431 1.781056 2.095943 2.655391 2.800369 
+0.191631 0.280628 0.393229 0.611761 1.420170 1.707741 1.873032 2.101553 2.280348 2.499488 
+0.361668 0.507047 0.789974 1.045992 1.502378 1.677032 1.905337 2.162555 2.432259 2.590873 
+0.208160 0.294285 0.448634 0.694229 0.872517 1.070315 1.703352 2.168742 2.426189 2.603657 
+0.316939 0.513618 0.705487 0.917036 1.175989 1.311140 1.618599 2.037840 2.450523 2.579395 
+0.241068 0.377728 0.521595 0.717203 1.310414 1.539991 1.736431 2.098926 2.297917 2.587348 
+0.234937 0.281875 0.780422 1.440733 1.609428 1.756430 1.977206 2.148605 2.602032 2.722501 
+0.178679 0.242672 0.416988 0.708348 0.955620 1.176671 1.781798 2.054488 2.281591 2.448112 
+0.345036 0.421080 0.740887 1.165442 1.324944 1.488798 1.763463 1.906174 2.395050 2.649158 
+0.249586 0.357494 0.520747 0.847195 1.428408 1.597779 1.778194 2.178502 2.413437 2.564662 
+0.295235 0.574231 1.249097 1.464097 1.727559 1.926790 2.095363 2.284830 2.567065 2.722480 
+0.341930 0.427307 0.634001 0.804212 0.905629 1.333373 1.790329 1.892756 2.445823 2.602828 
+0.363948 0.508985 0.667357 0.946354 1.437562 1.626545 1.811141 2.039091 2.291882 2.435493 
+0.163514 0.277407 0.409207 0.902065 1.189070 1.339636 1.802411 1.960770 2.652930 2.818987 
+0.302643 0.359753 0.651207 1.208021 1.423702 1.548149 1.882130 2.015591 2.260535 2.578896 
+0.155928 0.216908 0.381812 0.654803 1.112373 1.589935 1.847562 1.976716 2.224078 2.725337 
+0.274981 0.347675 0.572000 0.736046 0.894248 1.632373 1.891391 2.056890 2.602900 2.721779 
+0.154496 0.243461 0.348174 0.689505 1.573807 1.700306 1.943182 2.101580 2.564661 2.773169 
+0.292612 0.466612 0.795936 1.047468 1.413693 1.750848 2.062894 2.340073 2.613612 2.769493 
+0.242896 0.361500 0.555859 0.793597 0.932291 1.409467 1.863863 2.009534 2.464500 2.677491 
+0.221646 0.344724 0.554564 0.729403 1.136575 1.301772 1.529181 2.163590 2.395821 2.610805 
+0.160969 0.224467 0.371545 0.626879 1.160953 1.444229 1.675966 1.879779 2.478590 2.672023 
+0.214172 0.341585 0.676575 0.977397 1.325429 1.720096 2.072595 2.369539 2.635285 2.778792 
+0.203311 0.289438 0.458739 0.914153 1.122885 1.302925 1.583844 1.886828 2.187869 2.427039 
+0.280383 0.371600 0.824827 1.100246 1.236225 1.398923 1.578041 2.016000 2.368973 2.506732 
+0.170627 0.251778 0.393686 0.608347 1.287599 1.446665 1.793278 2.036554 2.310153 2.752439 
+0.180580 0.288746 0.987854 1.431706 1.677216 1.915661 2.124939 2.289452 2.589612 2.754264 
+0.176335 0.266263 0.445421 0.706403 0.875402 1.422918 1.758670 1.960910 2.410676 2.601751 
+0.216173 0.287404 0.480696 1.009765 1.291304 1.476644 1.895584 2.064286 2.284064 2.483108 
+0.176523 0.273934 0.403407 0.966139 1.304724 1.436612 1.944728 2.084836 2.544458 2.762416 
+0.311836 0.550501 0.879591 1.096228 1.276661 1.477859 1.817706 2.154340 2.560467 2.779841 
+0.179765 0.250560 0.455939 1.023886 1.225132 1.475662 1.734617 1.918713 2.147342 2.438235 
+0.271033 0.457235 0.599622 0.821049 0.940125 1.200937 1.849716 1.986656 2.548168 2.751578 
+0.179326 0.248002 0.426405 0.817060 1.285888 1.565019 2.117359 2.298712 2.572404 2.752701 
+0.374409 0.535936 0.897009 1.185070 1.591569 1.757202 1.967944 2.179985 2.457394 2.622641 
+0.185472 0.282752 0.409439 0.657499 0.856446 1.029396 1.879933 2.069323 2.344742 2.753103 
+0.375964 0.578457 0.758945 0.929339 1.127475 1.259437 1.704109 2.122973 2.336031 2.498298 
+0.225641 0.361030 0.501679 0.783379 1.314851 1.452621 1.714150 1.987157 2.225703 2.724361 
+0.144996 0.252919 0.632145 1.226038 1.575343 1.901549 2.171481 2.390554 2.682293 2.809834 
+0.172022 0.263338 0.448634 0.729435 0.984007 1.171597 1.757049 1.990232 2.321305 2.771210 
+0.235731 0.351117 0.796871 1.055711 1.300224 1.591818 1.895875 2.122918 2.417888 2.599817 
+0.254053 0.319371 0.455623 1.086141 1.664667 1.915882 2.059084 2.233416 2.452037 2.586788 
+0.375538 0.742993 1.139911 1.337758 1.735562 2.013906 2.315012 2.483433 2.651575 2.755211 
+0.247245 0.481131 0.710366 0.897602 1.121094 1.271709 1.787346 2.199502 2.429663 2.740668 
+0.226103 0.311441 0.501648 0.844424 1.362818 1.531338 1.777474 1.989925 2.187493 2.358501 
+0.195862 0.296224 0.609554 0.783241 1.243472 1.445477 1.637032 2.022645 2.483557 2.646137 
+0.233302 0.299441 0.472792 1.249457 1.457875 1.601860 1.831433 1.993719 2.597193 2.755433 
+0.168096 0.224183 0.382700 0.596214 1.060587 1.294418 1.605760 1.848489 2.357695 2.569186 
+0.330050 0.445912 0.661713 0.874446 1.000792 1.452973 1.943987 2.076916 2.423883 2.612359 
+0.226382 0.287303 0.517631 0.806229 1.309009 1.885280 2.160514 2.286410 2.526377 2.660822 
+0.203170 0.499314 0.887358 1.235074 1.462922 1.698260 1.999316 2.229225 2.571613 2.766691 
+0.307531 0.378353 0.573606 0.712218 0.850169 1.308996 2.059092 2.263816 2.497943 2.676815 
+0.276203 0.510250 0.686800 0.902844 1.205197 1.327979 1.718894 2.038947 2.256393 2.697149 
+0.161948 0.229115 0.393619 0.683613 1.137811 1.322692 1.783723 1.961584 2.389073 2.636082 
+0.201334 0.276773 0.468994 0.967017 1.475971 1.632424 1.965774 2.197278 2.480593 2.701553 
+0.214587 0.315421 0.469498 0.733397 1.146003 1.277911 1.727839 2.227135 2.440264 2.681122 
+0.255602 0.394609 0.743393 0.977796 1.199085 1.405972 1.918336 2.224828 2.479187 2.663394 
+0.245989 0.352625 0.517055 0.802830 1.558712 1.795653 1.944055 2.133640 2.333267 2.479982 
+0.337423 0.480433 0.869036 1.139571 1.630764 1.822959 2.074843 2.292613 2.479130 2.625317 
+0.220974 0.358850 0.571640 0.752791 0.937013 1.151721 1.674398 2.062466 2.558717 2.784838 
+0.267518 0.331708 0.541111 1.116547 1.411121 1.532868 1.792949 1.933520 2.248940 2.628644 
+0.084613 0.105083 0.297424 0.916949 1.256301 1.567029 1.885388 2.189875 2.522795 2.792102 
+0.205328 0.287223 0.724462 1.032395 1.457708 1.642169 1.925628 2.175524 2.429638 2.605488 
+0.232554 0.338724 0.502115 0.859975 1.044090 1.245652 1.806555 1.999641 2.261164 2.459984 
+0.291638 0.379172 0.626072 0.792796 0.959124 1.504886 1.734465 1.919612 2.614359 2.722709 
+0.191554 0.263114 0.426797 0.610628 1.077406 1.829543 2.021948 2.210572 2.427652 2.613828 
+0.389151 0.679476 0.915414 1.036635 1.250846 1.586610 2.040972 2.281500 2.567941 2.718815 
+0.203200 0.301280 0.470357 0.668716 0.851737 0.980327 1.570862 2.037617 2.289067 2.693877 
+0.304064 0.405934 0.710274 0.962705 1.128820 1.341667 1.635050 1.845382 2.079916 2.507510 
+0.171777 0.240705 0.409371 0.786432 1.223202 1.375689 1.691760 1.866080 2.350406 2.493942 
+0.231251 0.277994 0.557867 1.325822 1.660352 1.779477 2.007138 2.172322 2.440457 2.652308 
+0.188101 0.259494 0.412543 0.624843 0.839549 1.033700 1.634128 1.931944 2.246076 2.425773 
+0.361304 0.419465 0.795676 1.184605 1.296796 1.578447 1.841746 1.997361 2.540538 2.687139 
+0.274372 0.338938 0.492443 0.963516 1.509514 1.706378 1.869885 2.077166 2.261281 2.444183 
+0.415990 0.652103 1.031293 1.269551 1.572746 1.772975 2.004659 2.175272 2.430606 2.596553 
+0.242045 0.370942 0.534392 0.763529 1.001165 1.129764 1.682192 2.144644 2.324478 2.715697 
+0.377438 0.588168 0.765394 0.976873 1.356652 1.490088 1.737970 2.006774 2.213691 2.389973 
+0.191625 0.284123 0.405342 1.016777 1.432730 1.547592 1.813930 1.958317 2.470765 2.649257 
+0.272672 0.349555 0.633911 1.152234 1.303938 1.547640 1.919504 2.047696 2.562779 2.730575 
+0.168423 0.236330 0.421468 0.831345 1.083543 1.553448 1.880726 2.064701 2.370864 2.632945 
+0.219318 0.301481 0.513617 0.765086 1.026019 1.514647 2.048203 2.248568 2.499810 2.657069 
+0.232695 0.347947 0.495203 0.718830 1.423013 1.722493 1.879584 2.165044 2.420251 2.589658 
+0.270284 0.336865 0.684929 1.155789 1.690421 1.876744 2.027359 2.226178 2.446748 2.582000 
+0.149701 0.193747 0.352019 0.520123 0.823974 1.434753 1.686592 1.961148 2.370914 2.693067 
+0.254818 0.412303 0.601514 0.771438 1.175450 1.376569 1.539029 1.937039 2.408576 2.563621 
+0.233713 0.355886 0.593725 0.762880 1.271479 1.563900 1.797523 2.094688 2.538627 2.711734 
+0.179028 0.237103 0.396818 1.042021 1.633539 1.762676 2.123935 2.322391 2.588193 2.751345 
+0.182027 0.251039 0.434581 0.714302 0.950997 1.437895 1.813570 1.969103 2.145882 2.353968 
+0.501538 0.692148 0.848860 1.071308 1.350543 1.489476 1.841643 2.104284 2.341536 2.515294 
+0.274530 0.381470 0.526682 0.922143 1.444946 1.573605 1.858767 2.066747 2.284796 2.626819 
+0.360617 0.583131 0.979491 1.254083 1.488351 1.797557 2.219518 2.482176 2.742366 2.862025 
+0.140913 0.220301 0.619552 0.818307 1.052429 1.339972 1.830726 2.133953 2.536378 2.751128 
+0.293514 0.391691 0.790080 0.962740 1.160319 1.526602 1.805491 2.041462 2.361619 2.564962 
+0.199542 0.290571 0.452891 0.689515 1.258530 1.409879 1.886242 2.228126 2.465677 2.726646 
+0.296920 0.356356 0.784287 0.996540 1.146175 1.623865 1.815498 2.038297 2.600627 2.705700 
+0.206451 0.276025 0.537547 0.802572 1.220407 1.642060 1.863625 2.001978 2.215339 2.585384 
+0.333650 0.464751 0.653772 0.966306 1.103865 1.340203 1.784701 1.914591 2.470171 2.686916 
+0.181861 0.244870 0.376456 0.554383 1.329897 1.810440 2.047836 2.202318 2.660855 2.817057 
+0.450565 0.647291 0.951172 1.229431 1.519644 1.686812 2.049107 2.267169 2.501284 2.650596 
+0.219996 0.320591 0.427747 0.601183 0.753448 0.929578 1.741979 2.285789 2.472633 2.749566 
+0.333848 0.423373 0.658791 1.031299 1.222625 1.365771 1.901889 2.121101 2.290306 2.531185 
+0.166064 0.233902 0.383355 0.661806 1.226567 1.399684 1.771269 1.974537 2.173487 2.566344 
+0.189286 0.243602 0.390584 1.387930 1.588719 1.763237 2.091118 2.316314 2.593526 2.755080 
+0.158404 0.224878 0.385000 0.668463 0.942954 1.411967 1.700313 1.828069 2.059396 2.692546 
+0.325989 0.461263 0.851471 1.045709 1.284028 1.516199 1.797341 2.088387 2.437669 2.627215 
+0.223709 0.289190 0.632812 0.858738 1.541903 1.746766 1.935738 2.184816 2.404330 2.583013 
+0.545842 0.952420 1.340820 1.516838 1.838879 2.012890 2.244968 2.403170 2.592285 2.691119 
+0.238526 0.349079 0.494582 0.987665 1.170746 1.348229 1.468645 2.296964 2.644160 2.787381 
+0.270857 0.442003 0.655998 0.881913 1.259254 1.428358 1.769867 1.998528 2.395589 2.652840 
+0.154384 0.211806 0.489481 0.997257 1.249817 1.541232 1.778865 1.949397 2.319136 2.623391 
+0.268258 0.312888 0.589114 1.258625 1.572705 1.675430 1.912780 2.070458 2.279933 2.564230 
+0.170715 0.224965 0.374011 0.540197 1.161887 1.499072 1.925865 2.082569 2.246619 2.469724 
+0.324358 0.391989 0.706816 0.833614 1.015725 1.568995 1.735976 2.127068 2.558411 2.653871 
+0.178059 0.258575 0.374125 0.536831 1.334827 1.798628 1.986978 2.189252 2.432266 2.626696 
+0.198857 0.420955 0.817664 1.178363 1.466742 1.821295 2.207327 2.474411 2.738275 2.851185 
+0.188344 0.324302 0.470468 0.790033 0.934101 1.188722 1.887171 2.052833 2.448325 2.630236 
+0.201295 0.365646 0.526513 0.758388 1.140096 1.267331 1.650173 1.879342 2.102889 2.600286 
+0.135058 0.169428 0.307348 0.503160 1.018083 1.447946 1.810984 2.134002 2.480277 2.759846 
+0.178006 0.266610 0.390327 0.928681 1.501613 1.621327 1.871356 2.025864 2.580442 2.770801 
+0.246182 0.424290 0.644023 0.801168 1.114876 1.277757 1.503317 2.074888 2.295695 2.501380 
+0.322996 0.430355 0.631600 1.047698 1.221840 1.426726 1.903081 2.032223 2.516726 2.708452 
+0.292994 0.430599 0.619178 0.794567 1.283029 1.652817 1.840836 2.069946 2.385375 2.528246 
+0.525494 0.787797 1.121816 1.387482 1.674574 1.936221 2.224042 2.390624 2.634276 2.743234 
+0.299504 0.409196 0.602235 0.892336 1.056426 1.253766 1.489136 1.639876 2.427480 2.650368 
+0.423758 0.520480 0.758987 1.041257 1.173655 1.423676 1.818235 1.936407 2.363001 2.626644 
+0.155042 0.247496 0.641445 0.954509 1.224970 1.465850 1.837841 2.090456 2.451501 2.716155 
+0.251949 0.421094 0.706797 0.975659 1.259906 1.520067 1.816310 2.122017 2.474913 2.716671 
+0.215220 0.302248 0.730598 0.896343 1.145567 1.370192 1.700685 2.022563 2.283265 2.489220 
+0.285230 0.453559 0.663670 0.861526 1.011602 1.247419 1.655985 1.861291 2.578936 2.731333 
+0.162067 0.219409 0.373433 0.544669 1.103298 1.597178 1.921040 2.143402 2.406499 2.660484 
+0.342367 0.511499 0.931350 1.163219 1.393645 1.611146 1.972769 2.194416 2.470766 2.649264 
+0.251010 0.364125 0.560956 0.746545 1.019837 1.170725 1.532945 2.288671 2.577088 2.723074 
+0.315001 0.489412 0.720682 0.877607 1.090466 1.253848 1.448221 1.922954 2.255887 2.408634 
+0.174666 0.235793 0.387644 0.554402 1.231089 1.456137 1.688034 2.127450 2.367035 2.597270 
+0.215113 0.341915 1.043717 1.322751 1.495414 1.741895 1.961164 2.239824 2.544905 2.703945 
+0.219852 0.301770 0.513912 0.705474 0.877540 1.295896 1.699002 1.987057 2.287968 2.496966 
+0.290638 0.366442 0.655155 1.044990 1.172154 1.532536 1.800791 1.948931 2.509679 2.660055 
+0.232252 0.313770 0.658552 0.941977 1.463174 1.665488 1.862461 2.027843 2.534016 2.701236 
+0.326539 0.552681 1.121731 1.331381 1.520072 1.867084 2.082861 2.332474 2.606039 2.737092 
+0.190254 0.340428 0.492777 0.739738 0.895461 1.079371 1.643156 1.795290 2.491822 2.729382 
+0.283586 0.418440 0.587306 0.870866 1.418553 1.577030 1.799498 2.069398 2.274484 2.438103 
+0.235752 0.357650 0.502891 1.012434 1.258853 1.407789 1.820057 1.955830 2.505903 2.734330 
+0.278412 0.343137 0.849977 1.232895 1.350504 1.590626 1.787519 2.091578 2.541360 2.663856 
+0.162966 0.243159 0.439238 0.684821 0.887783 1.462899 1.881739 2.044253 2.289393 2.705002 
+0.235063 0.371799 0.578210 0.752199 1.008546 1.476284 1.804912 2.271399 2.655042 2.789653 
+0.154939 0.223696 0.344718 0.667555 1.495659 1.669436 2.069883 2.307215 2.627692 2.811343 
+0.239702 0.335917 0.716616 1.131805 1.452514 1.639133 2.105515 2.279822 2.502030 2.669220 
+0.226818 0.331261 0.472705 0.651974 0.781639 1.219798 1.822904 2.082732 2.439327 2.610900 
+0.223413 0.359594 0.534704 0.741518 1.225894 1.389874 1.618191 2.009911 2.207000 2.459844 
+0.171308 0.268378 0.383799 0.858926 1.376293 1.519165 1.780601 1.922915 2.623094 2.802402 
+0.140134 0.212320 0.443224 0.967457 1.264241 1.562153 1.929148 2.217388 2.668341 2.830751 
+0.221323 0.322124 0.485563 0.818589 1.011837 1.198984 1.423616 1.669403 2.157523 2.363190 
+0.369687 0.525655 0.719213 0.939654 1.137631 1.312217 1.599935 1.826813 2.355221 2.580680 
+0.211975 0.314411 0.489148 0.739213 1.377801 1.554504 1.824373 2.158875 2.352992 2.722621 
+0.170698 0.296368 0.934285 1.243133 1.555900 1.866544 2.159940 2.363436 2.585032 2.738530 
+0.189263 0.305887 0.439912 0.784610 1.227264 1.342508 1.587650 1.754907 2.439893 2.721315 
+0.296339 0.385169 0.612012 1.081322 1.276361 1.437178 1.871470 2.001718 2.339094 2.640217 
+0.229588 0.320544 0.517278 0.969137 1.142560 1.626089 1.877916 2.115461 2.546741 2.708025 
+0.248869 0.420193 0.732388 1.049015 1.303410 1.601458 1.949210 2.239464 2.648223 2.822614 
+0.207600 0.292320 0.496539 0.857149 1.182294 1.399849 1.714165 1.868238 2.027936 2.200737 
+0.225558 0.396897 0.541783 0.873366 1.178972 1.299579 1.677191 1.849602 2.330475 2.752717 
+0.176821 0.231377 0.372767 0.508565 1.152819 1.808050 2.112679 2.250073 2.571342 2.748550 
+0.352149 0.515765 1.023238 1.260221 1.443565 1.622067 1.872804 2.100177 2.489280 2.671043 
+0.166138 0.263444 0.370151 0.590066 0.754819 0.940533 1.761870 1.946611 2.445015 2.758191 
+0.342082 0.476411 0.656223 0.851774 1.003992 1.153372 1.694401 2.065625 2.255642 2.440148 
+0.227237 0.376514 0.514329 0.894887 1.141673 1.283052 1.831377 1.985902 2.334470 2.784878 
+0.215891 0.269548 0.684111 1.405658 1.674813 1.800925 2.172085 2.339395 2.591569 2.730100 
+0.236240 0.400377 0.533684 0.750343 0.910405 1.089112 1.737729 1.912807 2.192519 2.688733 
+0.169242 0.284879 0.916252 1.169769 1.433683 1.644376 1.919124 2.161625 2.482664 2.682591 
+0.270731 0.336506 0.477594 1.042714 1.605840 1.796859 1.945909 2.160039 2.354913 2.520950 
+0.420586 0.652563 1.117162 1.406006 1.747537 1.947424 2.203094 2.359970 2.547902 2.682168 
+0.281552 0.395037 0.640181 0.944531 1.193959 1.330492 1.718657 2.188389 2.444591 2.578673 
+0.311824 0.476892 0.633431 0.845825 1.332518 1.491656 1.693614 2.041082 2.289317 2.439399 
+0.133945 0.200790 0.647237 0.927687 1.188883 1.369658 1.699557 1.972777 2.295259 2.678185 
+0.204796 0.278215 0.443465 1.270484 1.405209 1.640920 1.824252 2.327085 2.599637 2.772533 
+0.183970 0.244116 0.410594 0.639103 1.221589 1.404867 1.628358 1.902439 2.168632 2.306804 
+0.343622 0.434735 0.666599 0.868069 1.048942 1.532778 1.819835 1.971884 2.288701 2.448745 
+0.238017 0.320361 0.657255 0.917611 1.303306 1.727361 1.988909 2.181455 2.442965 2.613322 
+0.323613 0.545056 0.930173 1.226059 1.440181 1.772300 2.056890 2.347811 2.689382 2.820616 
+0.288930 0.401387 0.617124 0.836453 0.990306 1.261227 1.913283 2.110049 2.324584 2.557162 
+0.332670 0.480804 0.656147 0.880536 1.029566 1.230493 1.769063 1.932296 2.200370 2.585210 
+0.185551 0.265352 0.409432 0.608847 1.034698 1.222821 1.876965 2.171647 2.403502 2.666441 
+0.155026 0.223348 0.401684 1.079141 1.415789 1.620021 2.045515 2.258512 2.631625 2.802291 
+0.183461 0.263081 0.425694 0.635685 1.188664 1.357556 1.574991 2.085982 2.288725 2.511108 
+0.314738 0.463011 0.648733 0.877651 1.002890 1.265811 2.005414 2.198095 2.481535 2.714178 
+0.244411 0.318444 0.546578 0.793615 1.326150 1.735479 1.945598 2.114662 2.315350 2.478535 
+0.326237 0.543540 0.987361 1.304413 1.684932 1.902147 2.207172 2.374273 2.557527 2.716216 
+0.157795 0.283302 0.430398 0.660379 0.811060 1.142539 1.479298 1.718714 2.670264 2.847556 
+0.220856 0.283872 0.779935 1.074940 1.312211 1.626329 1.837609 1.968885 2.155988 2.602381 
+0.140763 0.205719 0.406561 0.762459 1.041266 1.486993 1.838306 2.114606 2.552810 2.772285 
+0.140451 0.395920 0.792110 1.108001 1.402642 1.623079 1.943151 2.227952 2.546163 2.773998 
+0.229862 0.336462 0.546590 0.810150 1.201906 1.346787 1.825323 2.092925 2.285730 2.473359 
+0.224913 0.328246 0.517269 0.874793 1.012587 1.452178 1.695778 2.014930 2.511447 2.672574 
+0.247745 0.335741 0.546558 0.710177 1.170556 1.727789 1.970678 2.158532 2.482819 2.628913 
+0.398252 0.555087 0.890367 1.121205 1.381533 1.601228 1.866647 2.066612 2.405164 2.588016 
+0.198563 0.288867 0.478054 0.658477 0.851841 1.027105 1.539739 2.021106 2.579462 2.784184 
+0.304271 0.371642 0.661590 1.068976 1.224249 1.411927 1.680524 1.869770 2.100073 2.308554 
+0.188223 0.257939 0.432402 0.735050 1.318038 1.485528 1.828110 2.046435 2.307018 2.457237 
+0.246723 0.297276 0.604475 1.310901 1.570442 1.688851 1.913658 2.051334 2.556011 2.714965 
+0.158309 0.234509 0.435792 0.667900 0.957567 1.235918 1.592945 1.818158 2.307389 2.768973 
+0.419843 0.501412 0.766892 1.073173 1.189374 1.480225 1.766597 1.922151 2.537937 2.694771 
+0.275140 0.335563 0.678421 1.081521 1.592379 1.772635 1.931245 2.140699 2.333804 2.490857 
+0.372056 0.856814 1.239538 1.409989 1.690297 1.863018 2.072702 2.273547 2.532657 2.690517 
+0.321254 0.422981 0.604856 0.793437 0.912112 1.128454 1.795979 2.173232 2.360146 2.536137 
+0.395214 0.598779 0.771997 0.946713 1.213777 1.330433 1.660335 1.977154 2.165056 2.344018 
+0.225286 0.317828 0.464801 1.112329 1.369512 1.511999 1.921954 2.053407 2.593519 2.777285 
+0.330612 0.407807 0.730129 1.259731 1.459811 1.605671 1.981307 2.137009 2.465971 2.679722 
+0.213145 0.305305 0.507016 0.662299 1.056848 1.479862 1.671904 2.102707 2.369871 2.581994 
+0.219658 0.296096 0.443507 0.610973 0.799691 1.676579 1.965487 2.153235 2.502228 2.692999 
+0.174947 0.257739 0.373547 0.552567 1.405316 1.614249 1.848917 2.117795 2.317884 2.711904 
+0.209667 0.297529 0.756195 1.095304 1.564196 1.844775 2.103697 2.292657 2.520051 2.679489 
+0.170138 0.240310 0.452247 0.684414 0.880102 1.366921 1.741648 2.131295 2.505730 2.732611 
+0.278164 0.468635 0.707518 0.853693 1.054780 1.210458 1.540941 2.174562 2.410662 2.612138 
+0.155738 0.238890 0.352836 0.621012 1.441438 1.619698 1.825165 1.975331 2.525373 2.748574 
+0.223776 0.274424 0.479048 0.797871 1.694190 1.878135 2.135285 2.373726 2.595422 2.729787 
+0.151088 0.198286 0.326558 0.536276 0.845893 1.141653 1.460565 1.762868 2.025851 2.177303 
+0.434445 0.614208 0.887657 1.028446 1.191359 1.392204 1.786886 2.062481 2.423405 2.619356 
+0.180755 0.275311 0.397787 0.859366 1.409762 1.523325 1.908846 2.082319 2.389720 2.743887 
+0.275975 0.508416 0.889894 1.318925 1.633314 1.904728 2.169012 2.374655 2.726973 2.847666 
+0.156239 0.262624 0.406657 0.739074 1.044495 1.201234 1.810887 2.005600 2.581700 2.804889 
+0.195391 0.258771 0.654924 0.824371 1.315259 1.500728 1.765938 2.063992 2.341176 2.513659 
+0.178034 0.301047 0.463020 0.716172 1.198868 1.340454 1.834558 2.022132 2.400750 2.776294 
+0.340368 0.404236 0.843747 1.039238 1.202107 1.708051 1.914952 2.169509 2.521521 2.623348 
+0.218465 0.289694 0.528045 0.817051 1.132337 1.580464 1.838891 1.983392 2.147493 2.348131 
+0.322509 0.458058 0.654679 0.958976 1.118211 1.321565 1.901390 2.046409 2.360931 2.664215 
+0.191821 0.252321 0.389176 0.581111 1.529667 1.931689 2.083614 2.270465 2.566855 2.713879 
+0.493961 0.710827 0.982260 1.196274 1.419327 1.620910 1.928015 2.145652 2.429769 2.601973 
+0.213148 0.311589 0.424636 0.602664 0.736895 1.022165 1.992278 2.218533 2.611628 2.850324 
+0.288129 0.434441 0.629313 0.856153 1.289667 1.424520 1.875795 2.150240 2.351814 2.536843 
+0.160031 0.230716 0.406654 0.870424 1.156517 1.392317 1.804098 1.951437 2.210479 2.735164 
+0.229340 0.293962 0.503222 1.242097 1.475824 1.624647 1.998680 2.144499 2.578549 2.753270 
+0.158770 0.220035 0.363386 0.577761 0.963090 1.174939 1.738169 1.979202 2.162436 2.661916 
+0.346062 0.444816 0.716985 1.180717 1.370580 1.522996 1.892173 2.066682 2.395796 2.627659 
+0.307495 0.389330 0.612607 0.969283 1.557708 1.839939 1.996737 2.172382 2.420627 2.539195 
+0.437804 0.726957 1.291168 1.503297 1.765428 1.962121 2.163647 2.336227 2.579616 2.708524 
+0.232184 0.333678 0.528368 0.706749 1.203280 1.379018 1.611161 2.154678 2.592903 2.750319 
+0.272652 0.461710 0.625777 0.839609 1.342021 1.496726 1.715376 2.137572 2.370040 2.597390 
+0.184908 0.302324 0.454883 0.880307 1.104383 1.292526 1.777203 1.943364 2.444174 2.622726 
+0.265644 0.341261 0.553228 1.139475 1.427148 1.560441 1.933941 2.084129 2.393307 2.654135 
+0.167920 0.207301 0.370331 0.525538 1.030891 1.368163 1.782474 2.062404 2.332762 2.526299 
+0.343172 0.433912 0.717501 0.889734 1.052060 1.695278 2.053156 2.208456 2.608869 2.718320 
+0.216527 0.305247 0.445890 0.729271 1.639736 1.903284 2.053351 2.221254 2.432253 2.568018 
+0.110545 0.209955 0.844788 1.174205 1.492201 1.810243 2.177274 2.440496 2.697294 2.835232 
+0.217384 0.337412 0.488999 0.761842 0.879715 1.209528 1.970747 2.120795 2.611654 2.791762 
+0.190459 0.296484 0.469967 0.800649 1.105561 1.278527 1.516938 1.693066 2.114420 2.716739 
+0.134814 0.175978 0.300425 0.496817 1.244295 1.485308 1.861721 2.131233 2.485046 2.773884 
+0.210174 0.278266 0.435508 0.927538 1.606908 1.753898 1.957554 2.166283 2.398518 2.749609 
+0.213766 0.315300 0.509924 0.709930 0.964724 1.106776 1.382615 2.001070 2.323214 2.565314 
+0.400615 0.524954 0.798552 1.012852 1.135488 1.474850 1.989029 2.130909 2.507971 2.679460 
+0.249400 0.377023 0.519635 0.754227 1.459559 1.642762 1.828961 2.077882 2.298228 2.467534 
+0.473365 0.683973 1.052341 1.375830 1.548106 1.747589 2.139299 2.318768 2.609977 2.739255 
+0.203877 0.341791 0.485180 0.884069 1.097592 1.269532 1.479924 1.757879 2.648399 2.822387 
+0.273046 0.404254 0.555403 0.954547 1.291233 1.399022 1.722890 1.903441 2.171984 2.645312 
+0.040369 0.117266 0.617136 0.892043 1.260331 1.541653 1.859383 2.153096 2.498232 2.761886 
+0.132414 0.211358 0.742445 1.066857 1.331084 1.570793 1.867458 2.132535 2.479624 2.731076 
+0.237329 0.326529 0.612538 0.790663 0.990133 1.413736 1.738235 1.936914 2.167728 2.451626 
+0.273960 0.405794 0.572530 0.933672 1.057816 1.397952 1.856531 1.997548 2.599486 2.760042 
+0.199334 0.298380 0.442931 0.628638 1.303213 1.640138 1.804023 2.113020 2.375455 2.548946 
+0.350188 0.502010 0.821298 1.038639 1.369294 1.592404 1.910815 2.156486 2.460508 2.653260 
+0.281558 0.399892 0.573105 0.753299 0.900613 1.054574 1.581987 2.178437 2.430354 2.616044 
+0.344653 0.543532 0.703715 0.862285 1.198215 1.338208 1.579080 2.060769 2.306749 2.485749 
+0.220701 0.326795 0.520618 0.755133 1.295552 1.451886 1.690502 2.200045 2.414271 2.615909 
+0.279478 0.332193 0.801527 1.345966 1.487477 1.678499 1.922202 2.100025 2.585571 2.713387 
+0.163502 0.212169 0.365096 0.525464 0.869846 1.208807 1.793988 2.040314 2.297180 2.469797 
+0.285531 0.341488 0.754059 1.170016 1.300835 1.513696 1.699861 1.889918 2.581459 2.706874 
+0.249595 0.366997 0.626427 0.945219 1.407043 1.560558 1.831657 2.231149 2.466354 2.654518 
+0.271671 0.443136 1.156412 1.406456 1.676521 1.856481 2.063218 2.230498 2.475840 2.639575 
+0.286620 0.427806 0.637320 0.803409 0.996161 1.266383 1.681751 2.003968 2.394651 2.588547 
+0.314906 0.440519 0.612129 0.896126 1.472415 1.717693 1.881351 2.099437 2.369166 2.495466 
+0.170277 0.251270 0.405477 0.915641 1.126887 1.436630 1.714771 1.893198 2.552995 2.738519 
+0.279410 0.337137 0.734563 1.281046 1.480602 1.611880 1.853215 1.994883 2.416054 2.654827 
+0.165776 0.226083 0.417544 0.744574 1.044468 1.534891 1.808494 1.944946 2.138491 2.601790 
+0.264579 0.336652 0.542033 0.710190 0.913338 1.655751 1.817762 2.231956 2.524436 2.658519 
+0.158194 0.235588 0.338347 0.541657 1.583377 1.766293 2.009135 2.243336 2.503941 2.775158 
+0.332612 0.509620 0.822935 1.075876 1.454286 1.650788 1.974450 2.251279 2.537342 2.745115 
+0.262817 0.359709 0.520893 0.707667 0.818364 1.438849 1.971249 2.087666 2.497014 2.646442 
+0.233200 0.399599 0.612456 0.775547 1.199192 1.355765 1.646901 2.136245 2.342490 2.695742 
+0.149687 0.238538 0.372248 0.634520 1.255813 1.433790 1.770041 1.928752 2.611905 2.824930 
+0.137016 0.210297 0.591489 1.125451 1.375648 1.685296 2.089612 2.390888 2.704458 2.844434 
+0.213490 0.341024 0.541716 0.750061 1.088199 1.244576 1.555338 1.965568 2.187900 2.383714 
+0.300159 0.489291 0.825022 1.037100 1.194088 1.347375 1.684747 2.024936 2.465611 2.740973 
+0.170029 0.255033 0.392758 0.727117 1.382065 1.579676 1.800912 1.959072 2.282335 2.728796 
+0.175883 0.365509 1.112175 1.385866 1.720391 1.977810 2.245295 2.421614 2.629567 2.754004 
+0.162590 0.248164 0.454630 0.763209 0.966031 1.282338 1.730743 1.938052 2.479376 2.667563 
+0.258043 0.345866 0.556520 0.981312 1.361528 1.482377 1.872244 2.158226 2.362269 2.555030 
+0.234139 0.348843 0.528234 0.987884 1.195217 1.422145 1.960028 2.127365 2.603321 2.793004 
+0.179699 0.559209 0.867682 1.088835 1.316888 1.571498 1.922198 2.197391 2.501118 2.728679 
+0.216784 0.310791 0.487492 0.932903 1.201954 1.366554 1.800398 1.977499 2.174265 2.537065 
+0.186878 0.400655 0.580952 0.846287 1.103872 1.266778 1.842772 2.019592 2.488005 2.717222 
+0.164641 0.248712 0.389358 0.772822 1.212561 1.369916 2.025869 2.277615 2.617524 2.809527 
+0.351899 0.520326 0.926597 1.219651 1.509839 1.676837 1.921744 2.111253 2.356380 2.545934 
+0.242182 0.365285 0.506156 0.716020 0.865221 1.011688 1.786917 2.122981 2.350877 2.767729 
+0.413776 0.559566 0.735800 0.928997 1.079117 1.267179 1.880069 2.152492 2.324834 2.539856 
+0.210597 0.329568 0.469735 0.788590 1.215495 1.319810 1.711456 2.058991 2.245438 2.653727 
+0.197937 0.254148 0.477985 1.227090 1.629920 1.767432 2.186975 2.385104 2.594869 2.725544 
+0.205489 0.333855 0.523915 0.706275 1.102152 1.246608 1.648901 2.026835 2.281695 2.759313 
+0.230328 0.322431 0.861834 1.145614 1.347211 1.576111 1.807275 2.004824 2.354365 2.572251 
+0.224898 0.282022 0.506636 1.152298 1.626560 1.752095 2.028178 2.218821 2.488955 2.670460 
+0.313732 0.625469 1.164472 1.499077 1.749612 2.018528 2.262230 2.429601 2.692165 2.822502 
+0.375623 0.575307 0.791200 0.935770 1.096937 1.343393 1.807992 2.187306 2.519720 2.694803 
+0.236981 0.332412 0.479270 0.844461 1.347641 1.490733 1.683942 2.039143 2.297619 2.458431 
+0.129047 0.206250 0.636751 0.865101 1.136893 1.356610 1.704798 1.916685 2.518358 2.756320 
+0.195171 0.266517 0.414793 1.239561 1.452906 1.608357 1.833045 2.047802 2.473522 2.621994 
+0.165853 0.212720 0.372757 0.536136 1.013938 1.339627 1.555122 1.945745 2.236281 2.440949 
+0.256981 0.368868 0.635878 0.802543 1.084757 1.439120 1.814729 2.120519 2.458154 2.621456 
+0.214382 0.297135 0.445091 0.702050 1.365102 1.851262 2.067026 2.207298 2.470728 2.612432 
+0.340710 0.532103 0.935278 1.171022 1.377886 1.638598 1.965274 2.246164 2.631266 2.806341 
+0.310524 0.412051 0.582478 0.768755 0.871594 1.119854 1.926346 2.207508 2.407091 2.636633 
+0.249349 0.443517 0.631532 0.810096 1.205129 1.357206 1.607396 1.984157 2.208016 2.645111 
+0.143090 0.185312 0.325214 0.504000 1.134467 1.327913 1.673654 2.006903 2.389284 2.746094 
+0.226575 0.298946 0.453938 0.998061 1.394600 1.597283 2.064183 2.223246 2.425469 2.569458 
+0.183924 0.255181 0.415834 0.624247 1.042338 1.203077 1.555240 2.125309 2.400352 2.661916 
+0.275610 0.365968 0.654909 0.990108 1.170799 1.455333 2.077561 2.252672 2.502315 2.685945 
+0.204334 0.287844 0.394810 0.761295 1.501200 1.784709 1.935569 2.152830 2.349263 2.545639 
+0.342976 0.527539 0.917466 1.160585 1.499531 1.761830 2.095272 2.301872 2.540570 2.694692 
+0.202374 0.333367 0.480179 0.708677 0.819505 1.105285 1.806641 1.953348 2.610844 2.797497 
+0.307033 0.368471 0.602486 1.108611 1.413347 1.528636 1.798519 1.986138 2.169052 2.437256 
+0.144073 0.196932 0.386988 0.819061 1.289767 1.625073 1.901924 2.136105 2.483019 2.707970 
+0.176760 0.268627 0.662082 1.056866 1.547973 1.711386 1.972939 2.249909 2.544471 2.761094 
+0.191409 0.292985 0.492193 0.800526 1.041836 1.278546 1.836626 2.028677 2.249387 2.627785 
+0.324102 0.399146 0.687435 0.868704 1.022957 1.582084 1.853847 1.981885 2.554914 2.677057 
+0.229172 0.302836 0.481418 0.704363 0.967567 1.828269 2.097295 2.258467 2.549112 2.704652 
+0.467124 0.696788 0.939500 1.094987 1.277543 1.488496 1.896279 2.158470 2.474182 2.659994 
+0.175418 0.234039 0.367674 0.513586 0.747619 1.008405 1.583161 2.053114 2.363292 2.681153 
+0.410273 0.561949 0.736215 0.956685 1.135688 1.288424 1.750612 1.937714 2.151318 2.489336 
+0.204541 0.277613 0.529607 0.722971 1.199975 1.447336 1.715634 1.921054 2.357781 2.507488 
+0.253116 0.311907 0.696982 1.320082 1.575418 1.705324 2.005068 2.168666 2.461879 2.665053 
+0.163657 0.237902 0.393374 0.609490 0.854272 1.089980 1.526387 1.842337 2.126252 2.679051 
+0.448627 0.530664 0.812719 1.095201 1.207641 1.575411 1.884209 2.034297 2.553007 2.688355 
+0.262717 0.338748 0.512685 1.003543 1.480178 1.622083 1.828518 2.142415 2.356457 2.511530 
+0.417111 0.636688 1.036571 1.319877 1.679924 1.873389 2.073722 2.249396 2.507732 2.651054 
+0.263698 0.461151 0.618737 0.830471 1.004041 1.158874 1.801566 2.020222 2.306558 2.743041 
+0.387779 0.575108 0.729791 0.932981 1.361163 1.505161 1.751183 2.068466 2.338260 2.487637 
+0.181510 0.265666 0.454631 1.082382 1.287303 1.579202 1.851178 2.096963 2.467237 2.646930 
+0.277668 0.345119 0.602341 1.179200 1.378990 1.545625 1.813861 1.962590 2.491799 2.664453 
+0.179320 0.248080 0.456925 0.722589 1.126932 1.579450 1.799397 1.950668 2.484125 2.707238 
+0.314322 0.381145 0.608651 0.727613 0.890472 1.610280 2.136172 2.258358 2.596376 2.709780 
+0.189539 0.266068 0.419729 0.651693 1.410161 1.643106 1.854810 2.275582 2.492054 2.722009 
+0.254466 0.313038 0.594149 1.012536 1.688813 1.935465 2.119184 2.287869 2.535543 2.667926 
+0.134691 0.171906 0.302740 0.492936 0.899551 1.229188 1.733940 2.012878 2.446339 2.742762 
+0.231556 0.365068 0.680761 0.889142 1.111338 1.295904 1.542636 1.971784 2.427562 2.631912 
+0.222525 0.305606 0.527193 0.687519 1.181381 1.671764 1.863683 2.072023 2.634517 2.779272 
+0.178770 0.237415 0.375160 0.856692 1.673680 1.813743 2.016791 2.272421 2.522601 2.735959 
+0.193532 0.268731 0.451328 0.753471 0.984854 1.285349 1.685647 1.884123 2.091677 2.243418 
+0.476037 0.651610 0.801054 1.010162 1.241374 1.355840 1.775976 2.086152 2.272907 2.454351 
+0.211657 0.308331 0.421366 0.865966 1.418774 1.556743 1.786149 2.020332 2.198585 2.631981 
+0.203789 0.490794 1.010137 1.275006 1.472213 1.810140 2.170639 2.437660 2.662122 2.788061 
+0.174355 0.252095 0.674715 0.842194 1.055087 1.278000 1.698680 2.070561 2.399385 2.657430 
+0.245109 0.324049 0.628822 0.927910 1.123601 1.580066 1.878640 2.054601 2.358721 2.546838 
+0.182644 0.253804 0.386248 0.614056 1.364821 1.545877 2.040174 2.218827 2.419010 2.624609 
+0.295605 0.367794 0.690701 1.055162 1.186600 1.644453 1.944154 2.101444 2.562120 2.691268 
+0.220878 0.289573 0.640307 0.822072 1.144055 1.567797 1.766410 1.908109 2.103459 2.560489 
+0.403453 0.526298 0.732204 0.901150 1.035869 1.339383 1.783990 1.941961 2.371032 2.626653 
+0.212825 0.258570 0.471588 0.685549 1.263740 1.821051 2.163822 2.288398 2.628063 2.788155 
+0.401181 0.642053 1.032473 1.236110 1.444450 1.686678 2.006722 2.228515 2.572112 2.723964 
+0.239433 0.341091 0.492629 0.707630 0.881426 1.030816 1.719255 2.344056 2.579063 2.756942 
+0.294093 0.382770 0.577412 1.009281 1.313036 1.419303 1.744673 2.094230 2.289039 2.475843 
+0.169805 0.236922 0.403314 0.638995 1.176446 1.352145 1.665573 1.909756 2.150120 2.716243 
+0.210447 0.277913 0.452474 1.402686 1.513430 1.720944 1.903938 2.278499 2.583756 2.743179 
+0.159574 0.225382 0.374008 0.714137 1.011253 1.371713 1.699162 1.871587 2.027056 2.491194 
+0.258602 0.557253 0.819720 1.038856 1.301470 1.445358 1.830613 2.098171 2.320809 2.541075 
+0.232756 0.282242 0.631974 0.898694 1.537444 1.869217 2.063967 2.234463 2.498226 2.633517 
+0.580133 0.997946 1.320956 1.481874 1.731605 1.898579 2.120712 2.290128 2.530088 2.651657 
+0.211840 0.307093 0.453360 0.945579 1.250815 1.490290 1.724135 2.281097 2.562699 2.752602 
+0.314276 0.493555 0.667782 0.896500 1.323006 1.482618 1.667487 1.974415 2.427345 2.555679 
+0.182455 0.261592 0.418011 1.050927 1.261387 1.443370 1.665467 1.939030 2.444695 2.638451 
+0.241570 0.306934 0.491293 1.105950 1.554827 1.666520 1.923917 2.087652 2.367600 2.654889 
+0.190084 0.254850 0.454062 0.724519 1.083362 1.393887 1.892335 2.088856 2.321764 2.484299 
+0.306497 0.389831 0.721793 0.839714 1.124754 1.652401 1.822919 2.273310 2.569195 2.669599 
+0.186200 0.273460 0.383201 0.564758 1.511073 1.845018 1.998284 2.194096 2.388693 2.587923 
+0.300722 0.478218 0.823364 1.127490 1.591141 1.871349 2.174720 2.403181 2.624785 2.782405 
+0.228884 0.358342 0.504622 0.795874 1.005622 1.152613 1.908053 2.124794 2.372473 2.797584 
+0.171885 0.248234 0.432842 0.833143 1.040892 1.269289 1.661635 1.918629 2.158962 2.653403 
+0.140943 0.193684 0.343025 0.562303 1.069552 1.543330 1.824473 1.961637 2.463513 2.770537 
+0.173053 0.245656 0.360656 0.960618 1.589535 1.689906 1.984141 2.142998 2.588389 2.759403 
+0.240180 0.429951 0.637440 0.786596 1.069147 1.226573 1.470883 1.952052 2.195064 2.615973 
+0.367862 0.471897 0.730834 1.082320 1.226293 1.462927 1.928169 2.052466 2.406737 2.662458 
+0.247175 0.358209 0.535946 0.781876 1.363697 1.635239 1.807233 1.993776 2.452769 2.601039 
+0.445578 0.687898 1.114108 1.301027 1.577397 1.886042 2.224903 2.436534 2.659695 2.761031 
+0.214389 0.336025 0.487794 0.759534 0.970518 1.141100 1.457335 1.624644 2.306922 2.715265 
+0.377300 0.466775 0.716121 1.083781 1.256543 1.411238 1.789433 1.936372 2.205572 2.562355 
+0.148362 0.214593 0.545023 0.840437 1.193325 1.480659 1.791868 2.083419 2.410537 2.676129 
+0.150403 0.278398 0.792676 0.976680 1.218845 1.405245 1.775056 2.162458 2.547861 2.746383 
+0.236301 0.328633 0.630867 0.839915 1.042349 1.298870 1.627752 1.839491 2.298928 2.493962 
+0.337889 0.497920 0.711277 0.850420 0.992027 1.246884 1.710746 2.086682 2.527158 2.707162 
+0.172215 0.236540 0.372897 0.525146 1.182577 1.735727 1.927035 2.114619 2.319170 2.542782 
+0.415304 0.624807 0.906616 1.117841 1.446155 1.669417 1.948413 2.172815 2.504530 2.670754 
+0.265417 0.407241 0.613894 0.816534 0.980063 1.156061 1.756747 2.274851 2.497193 2.712242 
+0.276440 0.468209 0.649518 0.816686 1.195171 1.355517 1.549226 1.935272 2.217871 2.426979 
+0.188925 0.277012 0.412665 0.672627 1.354807 1.514523 1.699988 2.144554 2.382186 2.586077 
+0.242630 0.352485 0.912974 1.343781 1.604428 1.801867 2.014791 2.193072 2.460809 2.631999 
+0.190903 0.285841 0.449070 0.760328 0.954285 1.182936 1.692638 1.878163 2.276840 2.465963 
+0.220659 0.300374 0.721694 0.947306 1.298330 1.562980 1.760618 1.888247 2.506445 2.689675 
+0.213168 0.290928 0.695227 0.918179 1.378186 1.631987 1.847886 2.003072 2.358358 2.619347 
+0.328586 0.517244 0.937320 1.376238 1.574840 1.764347 2.058630 2.224334 2.584444 2.756653 
+0.248486 0.367007 0.562147 0.750632 0.902785 1.147563 1.637415 1.912062 2.413993 2.605696 
+0.310691 0.477895 0.670796 0.940507 1.418293 1.563497 1.805141 2.114076 2.376358 2.535155 
+0.256555 0.414210 0.559427 0.981289 1.191646 1.378307 1.678398 1.849306 2.576704 2.756630 
+0.291424 0.335003 0.750149 1.289655 1.437209 1.599989 1.803177 1.967415 2.601748 2.733761 
+0.195254 0.279513 0.451755 0.649111 0.828694 1.609509 1.914906 2.091219 2.319589 2.534899 
+0.222304 0.332624 0.475678 0.685205 1.030332 1.737223 1.920979 2.378290 2.706719 2.817726 
+0.164833 0.240093 0.359862 0.801929 1.513677 1.641713 2.040524 2.248843 2.488659 2.714025 
+0.214777 0.287322 0.572644 1.145070 1.367112 1.752687 2.042424 2.222067 2.543047 2.697885 
+0.226099 0.330382 0.474439 0.687757 0.799187 1.319837 1.944566 2.078099 2.367800 2.508460 
+0.244540 0.392163 0.553692 0.729765 1.247865 1.448376 1.617590 2.074636 2.340052 2.518064 
+0.175381 0.314231 0.446023 0.797404 1.328458 1.439727 1.793346 1.939571 2.468800 2.721651 
+0.205808 0.293670 0.452447 1.074268 1.288235 1.655635 1.857504 2.364687 2.639812 2.798144 
+0.253926 0.392653 0.587584 0.800134 0.976310 1.185587 1.570687 1.821414 2.090893 2.349021 
+0.322461 0.410912 0.723569 1.060644 1.201524 1.400360 1.579189 1.788759 2.460242 2.616602 
+0.211266 0.304981 0.436011 0.771978 1.490623 1.677748 1.886227 2.113497 2.326353 2.727265 
+0.235012 0.406911 0.864785 1.291485 1.708295 1.938554 2.179896 2.352404 2.563792 2.711446 
+0.176814 0.268620 0.445837 0.823113 1.029776 1.271571 1.623388 1.811215 2.402140 2.614165 
+0.241865 0.339268 0.507509 1.003677 1.204347 1.372561 1.940795 2.101371 2.385606 2.669975 
+0.230878 0.334743 0.500370 0.879929 1.021894 1.533770 1.970789 2.128971 2.567262 2.717288 
+0.297505 0.451574 0.748848 0.988527 1.366237 1.606668 1.894660 2.174481 2.521427 2.759168 
+0.199265 0.271145 0.498160 0.854679 1.172103 1.364148 1.762079 1.969095 2.173538 2.311630 
+0.222173 0.424864 0.564942 0.829809 1.038172 1.194055 1.720601 1.858086 2.431760 2.741461 
+0.181961 0.226819 0.390513 0.556339 1.056596 1.553065 2.128349 2.258018 2.602497 2.802121 
+0.357600 0.565047 1.153012 1.350312 1.533576 1.718542 1.957892 2.175347 2.505650 2.678495 
+0.162257 0.236808 0.374039 0.570569 0.748034 1.172262 1.823392 2.053032 2.513769 2.772072 
+0.305794 0.465870 0.645121 0.882650 1.141294 1.266856 1.701581 2.002881 2.184124 2.411254 
+0.231652 0.380738 0.549642 0.837410 1.225266 1.332971 1.851582 2.119371 2.315077 2.732108 
+0.235449 0.286771 0.684809 1.346663 1.526630 1.703476 2.101486 2.254546 2.577181 2.718994 
+0.233870 0.446515 0.605080 0.814654 1.054963 1.178801 1.633158 1.849743 2.139379 2.732772 
+0.271706 0.335152 0.857227 1.253741 1.387189 1.702170 1.896767 2.191114 2.479999 2.601359 
+0.237386 0.314549 0.438339 0.912164 1.577764 1.877791 2.032790 2.197037 2.412322 2.536484 
+0.361168 0.574093 1.023843 1.468517 1.690562 1.917374 2.187368 2.334035 2.669095 2.806291 
+0.278480 0.398742 0.573342 0.839212 1.073888 1.222093 1.691681 2.165258 2.377410 2.536882 
+0.286018 0.447947 0.615060 0.849446 1.319465 1.463583 1.769948 2.001035 2.189431 2.450384 
+0.219440 0.301601 0.668534 0.861094 1.210001 1.498673 1.745120 1.877765 2.314377 2.619597 
+0.223591 0.352153 0.598841 1.217893 1.359082 1.591744 1.771089 2.213856 2.561538 2.735416 
+0.176857 0.236601 0.395107 0.634632 1.133495 1.335116 1.770374 1.981313 2.206556 2.339716 
+0.334735 0.402265 0.659168 0.781639 0.975228 1.664999 1.872069 2.047533 2.476961 2.573979 
+0.215968 0.284755 0.524241 0.781460 1.334811 1.772379 1.953878 2.194209 2.578250 2.741939 
+0.298193 0.489879 0.812985 1.183691 1.496418 1.679975 2.108792 2.316557 2.673779 2.851610 
+0.312989 0.415446 0.618011 0.899096 1.083683 1.263384 1.887396 2.243064 2.419448 2.570481 
+0.244471 0.431115 0.601512 0.813139 1.102163 1.221061 1.692440 2.033163 2.221795 2.619838 
+0.150949 0.219060 0.349217 0.611327 1.077112 1.250547 1.915518 2.083980 2.449999 2.792543 
+0.161611 0.218964 0.445377 0.927863 1.451151 1.768464 2.130012 2.366724 2.666003 2.814049 
+0.196000 0.297256 0.497266 0.691900 1.089877 1.273685 1.513723 2.006472 2.273782 2.572221 
+0.335268 0.460795 0.685187 0.867664 1.013807 1.479554 2.011994 2.168476 2.572643 2.717564 
+0.257604 0.340872 0.499757 0.843052 1.396548 1.831688 2.034226 2.170332 2.422618 2.540496 
+0.417663 0.631718 0.955424 1.197319 1.659797 1.879883 2.168797 2.359053 2.578087 2.698249 
+0.162052 0.251583 0.439900 0.660911 0.903902 1.320296 1.624758 1.778577 2.530531 2.799705 
+0.256861 0.322803 0.685370 1.086437 1.263276 1.569879 1.851654 2.014946 2.264711 2.447006 
+0.125192 0.176171 0.336135 0.781600 1.200220 1.439966 1.805419 2.077525 2.462470 2.738186 
+0.102286 0.191322 0.774556 1.076151 1.369456 1.627146 1.973015 2.236001 2.609367 2.812985 
+0.173442 0.232622 0.491622 0.844157 1.095241 1.370797 1.696966 2.051411 2.316061 2.502053 
+0.257531 0.343598 0.654071 0.838985 1.048102 1.487473 1.725385 1.897417 2.430505 2.585998 
+0.197900 0.276312 0.440283 0.705103 1.267341 1.740297 1.934483 2.154007 2.400200 2.624136 
+0.409590 0.596785 0.983751 1.181770 1.371153 1.502380 1.758280 2.018571 2.380053 2.592151 
+0.231819 0.332890 0.483514 0.644585 0.816808 0.926308 1.403298 2.233007 2.467857 2.678461 
+0.258610 0.340064 0.670485 0.908467 1.107611 1.456243 1.759580 1.932179 2.113118 2.310135 
+0.184377 0.249203 0.410806 0.587907 1.302501 1.510319 1.724432 1.981890 2.282904 2.422125 
+0.254110 0.313328 0.659859 1.265819 1.412949 1.665930 1.927154 2.101984 2.551446 2.673030 
+0.161592 0.237480 0.376535 0.637094 0.823028 1.137613 1.696425 1.875770 2.403632 2.639617 
+0.384501 0.466812 0.740791 0.938093 1.062352 1.509284 1.749143 1.917797 2.548157 2.671506 
+0.333872 0.419367 0.638994 1.092624 1.520550 1.649447 1.866619 2.148941 2.346723 2.506140 
+0.426216 0.686997 1.235881 1.428854 1.611591 1.792860 2.017593 2.233715 2.547773 2.696609 
+0.262949 0.367509 0.530429 0.741867 0.872474 1.069602 1.745566 2.061187 2.283843 2.494178 
+0.335782 0.547236 0.716211 0.919077 1.275686 1.408437 1.685118 1.967394 2.217639 2.446679 
+0.227629 0.330991 0.486068 1.117571 1.304983 1.510130 1.757258 1.946972 2.625557 2.782597 
+0.359850 0.436633 0.750634 1.201513 1.337571 1.594835 1.970273 2.113840 2.573808 2.729963 
+0.211871 0.304028 0.512758 0.663762 1.086354 1.633335 1.818017 2.129577 2.391080 2.600766 
+0.196092 0.279726 0.434488 0.624802 0.772358 1.404377 1.948777 2.160918 2.629996 2.775175 
+0.176304 0.262521 0.373719 0.581101 1.520108 1.736172 1.933230 2.140172 2.358130 2.753524 
+0.254932 0.381411 0.806187 1.102292 1.534523 1.750280 1.970904 2.159871 2.455922 2.658405 
+0.190385 0.288656 0.449066 0.678174 0.812376 1.449326 1.728657 1.966320 2.638812 2.789546 
+0.251178 0.386509 0.609363 0.797102 1.024159 1.181726 1.454661 2.012630 2.493092 2.698933 
+0.166654 0.266226 0.385171 0.711990 1.397897 1.532347 1.915974 2.088003 2.565270 2.789532 
+0.238453 0.306036 0.449309 0.876277 1.521437 1.933982 2.134420 2.267986 2.537601 2.658253 
+0.161634 0.219919 0.353206 0.524346 0.961806 1.207713 1.687918 1.916939 2.161870 2.320657 
+0.413612 0.597095 0.793763 0.986290 1.281786 1.412660 1.652465 2.016091 2.384164 2.528578 
+0.228655 0.341562 0.480989 0.988605 1.371003 1.477423 1.861026 2.015852 2.339752 2.773153 
+0.259092 0.597012 0.985224 1.321740 1.643354 1.957367 2.288682 2.497474 2.716492 2.844467 
+0.185652 0.304664 0.446232 0.864434 1.091795 1.273770 1.942575 2.095543 2.524648 2.768245 
+0.176687 0.256678 0.745652 0.934909 1.283760 1.440062 1.765242 2.122092 2.388099 2.590551 
+0.189805 0.275637 0.440995 0.821356 1.256020 1.410985 1.929781 2.120144 2.396030 2.604643 
+0.266823 0.337688 0.819408 1.134754 1.289204 1.777028 1.982886 2.221748 2.590286 2.698098 
+0.205348 0.276512 0.527305 0.727412 1.024647 1.653979 1.904178 2.046613 2.217922 2.455661 
+0.293498 0.424494 0.613795 0.956130 1.133981 1.324804 1.809031 1.953922 2.293854 2.575884 
+0.183120 0.249650 0.376204 0.543914 1.350827 1.907220 2.092551 2.255705 2.514391 2.687901 
+0.541205 0.789796 1.058955 1.269415 1.503899 1.702191 1.970176 2.175444 2.496810 2.652238 
+0.229326 0.339475 0.451881 0.661210 0.795832 1.073796 2.027104 2.206371 2.478903 2.726784 
+0.330006 0.506868 0.673076 0.887406 1.228765 1.349226 1.781290 2.086583 2.277762 2.480029 
+0.138389 0.200001 0.396259 0.811975 1.090712 1.460413 1.745493 1.904269 2.348250 2.699886 
+0.176584 0.242161 0.378270 1.177848 1.564718 1.678166 1.951618 2.121413 2.580109 2.737132 
+0.145852 0.198423 0.335644 0.550505 1.019727 1.371188 1.797635 1.943825 2.207490 2.746470 
+0.385078 0.503696 0.703239 1.069987 1.365736 1.472054 1.825827 2.159636 2.371283 2.520972 
+0.284950 0.388050 0.507352 0.879125 1.523530 1.776238 1.929597 2.157558 2.447986 2.586398 
+0.491116 0.756155 1.255200 1.522460 1.776579 2.028121 2.286059 2.429774 2.679106 2.776164 
+0.252477 0.396081 0.713022 0.861502 1.152223 1.370802 1.614010 2.144798 2.574072 2.712530 
+0.282756 0.438437 0.613566 0.847746 1.260772 1.379059 1.642202 2.137540 2.368369 2.522163 
+0.203971 0.322195 0.479842 0.953133 1.211278 1.397635 1.800812 1.954516 2.403478 2.573713 
+0.264533 0.358424 0.628768 1.111242 1.340246 1.506485 1.999590 2.194109 2.461411 2.667361 
+0.177730 0.223680 0.394553 0.556177 0.947415 1.500640 1.733528 1.926046 2.261466 2.436054 
+0.314223 0.363636 0.727886 0.851880 1.053844 1.798132 1.974354 2.182595 2.537995 2.629683 
+0.201778 0.275500 0.404891 0.747466 1.500050 1.841184 1.998843 2.226807 2.481989 2.669506 
+0.132164 0.314955 0.821473 1.196038 1.426590 1.699934 2.036856 2.323497 2.685471 2.828965 
+0.223374 0.347335 0.507730 0.773547 0.967916 1.134129 1.991403 2.306567 2.521364 2.788746 
+0.312742 0.449784 0.583287 0.934234 1.268567 1.365063 1.569295 1.687046 2.077299 2.595022 
+0.124286 0.162126 0.290730 0.654031 1.231658 1.538458 1.893070 2.184784 2.562637 2.798224 
+0.177049 0.251654 0.367891 0.912504 1.557576 1.693045 1.898991 2.072136 2.350163 2.646045 
+0.240517 0.378333 0.547809 0.754272 0.973321 1.103670 1.574418 2.028049 2.211127 2.562709 
+0.427795 0.519003 0.771284 0.937240 1.086617 1.609879 1.878750 2.052791 2.534118 2.657149 
+0.224370 0.317969 0.439666 0.812931 1.398497 1.626632 1.794178 2.114000 2.309157 2.496836 
diff --git a/codec2/tags/0.4/src/codebook/lspjvm2.txt b/codec2/tags/0.4/src/codebook/lspjvm2.txt
new file mode 100644 (file)
index 0000000..30b665c
--- /dev/null
@@ -0,0 +1,513 @@
+5 512
+0.005167 -0.037310 -0.002159 0.016849 0.130396 
+0.039445 0.031680 -0.074412 -0.031499 0.060536 
+0.019479 -0.030564 -0.048137 -0.056279 -0.027829 
+0.020585 -0.011270 0.023913 -0.005706 0.011407 
+-0.023217 0.107455 -0.037777 0.004070 -0.017279 
+-0.090444 0.007641 0.099001 -0.047913 -0.017199 
+0.022700 -0.063865 0.047213 0.043843 -0.036225 
+0.001312 -0.123861 -0.038988 0.058666 0.074541 
+0.039508 0.110300 0.013954 -0.119228 -0.035807 
+-0.047392 0.027035 -0.004412 -0.032650 -0.037150 
+0.002491 -0.045447 0.158260 0.022828 -0.030124 
+-0.047856 0.088744 -0.009678 0.106688 0.087690 
+-0.027941 0.044084 -0.028500 0.018736 -0.069969 
+-0.035358 -0.051568 -0.030459 -0.017899 0.027632 
+-0.018607 -0.123557 0.019228 0.057485 -0.028907 
+0.019057 0.038151 -0.080220 0.034222 0.023081 
+0.021312 0.041905 0.112903 0.024092 0.093974 
+-0.116679 0.015344 -0.066059 -0.096437 0.004041 
+-0.022464 -0.116260 0.047819 -0.003921 -0.073504 
+0.001975 -0.025869 0.028200 0.122690 0.010627 
+-0.035672 0.078963 -0.009686 0.000743 -0.147582 
+0.016932 -0.020291 -0.096896 -0.237875 -0.029121 
+0.017376 -0.040130 -0.053865 0.154060 -0.013215 
+0.015215 -0.019023 -0.070604 0.032265 0.040340 
+0.102365 -0.022746 0.019895 0.050570 0.008845 
+-0.034134 0.044441 -0.049387 -0.140481 0.072570 
+0.013023 -0.006079 0.037574 0.004937 -0.081501 
+0.003696 0.049908 0.007355 0.000403 0.026006 
+-0.008466 0.080680 0.061382 -0.108985 -0.088060 
+-0.012275 -0.081061 0.020333 -0.079001 0.068724 
+-0.014081 -0.042609 0.093365 0.044120 0.000303 
+0.063391 0.096574 -0.105424 0.039041 0.010412 
+-0.054031 -0.084948 0.080406 -0.035883 0.137428 
+0.063037 0.050562 0.024690 -0.031394 0.130320 
+-0.015501 -0.078884 -0.076886 -0.013864 -0.073587 
+0.048778 0.003814 -0.031125 0.046897 0.028304 
+0.048692 0.132795 0.065450 0.059487 -0.042396 
+-0.176999 0.056943 -0.004135 -0.049378 -0.041083 
+-0.039445 -0.016292 -0.004550 0.062010 -0.079613 
+-0.054566 -0.008476 -0.016710 0.049202 0.025758 
+-0.078723 0.092091 0.096536 -0.065079 0.021161 
+0.076657 0.009203 -0.036866 -0.016559 0.012823 
+0.008225 -0.003006 0.108033 0.043120 -0.060870 
+-0.019346 0.022790 -0.001728 0.062304 -0.016965 
+-0.001302 -0.014490 -0.041803 -0.034058 -0.197066 
+-0.033655 -0.127217 -0.108681 -0.010571 -0.004705 
+-0.015553 -0.086069 0.034109 -0.101379 0.002068 
+-0.004003 -0.044637 -0.068617 0.052228 -0.047812 
+-0.043307 0.035681 0.042207 -0.055946 0.055944 
+-0.026792 -0.012601 -0.056710 -0.021094 0.105842 
+-0.025598 -0.078858 -0.013487 0.030728 -0.031956 
+0.031444 0.022763 0.025364 0.121366 0.070736 
+-0.084556 0.098118 -0.024301 -0.058655 -0.043194 
+-0.011752 -0.043781 0.091051 -0.071201 -0.020980 
+0.082904 -0.031657 -0.088247 0.066709 -0.079182 
+-0.012151 0.011796 -0.010589 0.100656 0.094539 
+0.035967 0.025338 0.071826 0.009741 -0.040209 
+0.006866 -0.015095 -0.168469 -0.056133 0.060145 
+0.045830 -0.068969 0.034551 0.015842 -0.092809 
+0.054699 0.138744 0.001726 0.006927 0.005167 
+0.016978 0.046384 -0.060183 -0.040742 -0.072692 
+-0.022489 -0.029728 -0.065018 -0.124741 0.044927 
+-0.029057 -0.037154 0.031068 0.060086 0.009984 
+0.009311 -0.006957 -0.105508 0.059637 -0.019564 
+-0.068154 -0.066443 0.000799 0.028579 0.097063 
+0.096936 0.030230 -0.034623 -0.088918 0.040334 
+0.019439 -0.050707 -0.003294 -0.028505 -0.053599 
+0.062460 -0.070688 -0.016465 -0.035680 0.017378 
+0.009363 0.048761 0.043374 0.039587 -0.023232 
+-0.067033 0.042663 0.054070 -0.042797 -0.089391 
+-0.030497 -0.050249 0.059528 0.089089 -0.029633 
+0.064125 -0.086614 -0.002005 0.080620 0.000502 
+-0.003490 0.097336 0.099565 0.015648 0.006691 
+0.077668 0.016572 0.035404 -0.046026 0.017237 
+-0.048631 0.009314 0.141479 0.017079 0.043796 
+-0.106474 0.145951 0.057740 0.011250 -0.059443 
+0.027572 0.026650 0.008527 0.002949 -0.037680 
+-0.077991 -0.090617 0.003420 -0.046010 0.007354 
+0.019056 -0.128651 0.016464 0.004584 -0.030883 
+-0.092069 0.038976 -0.081840 0.066695 -0.047340 
+0.003513 0.040613 0.046815 -0.023406 0.062389 
+0.021759 0.024928 -0.018922 -0.048006 0.063800 
+-0.014416 -0.050333 0.042628 -0.114934 -0.101450 
+0.062139 0.029295 -0.065908 0.111463 0.050781 
+-0.022707 0.135414 0.003548 0.134535 -0.048259 
+-0.092344 -0.027727 0.016343 -0.060786 -0.081502 
+-0.005412 -0.026229 -0.143331 0.052404 -0.077298 
+-0.035919 -0.041968 -0.106108 -0.004369 0.065028 
+0.096370 -0.053299 0.043317 -0.049735 0.049815 
+0.032324 0.051309 -0.009607 -0.205917 0.005023 
+-0.054316 -0.022895 0.099327 -0.006927 -0.076574 
+-0.111024 0.111026 0.038381 -0.060368 0.064238 
+-0.034316 0.026846 0.025740 -0.076162 -0.163904 
+0.055955 -0.056885 0.014831 -0.120715 0.090938 
+0.035289 -0.036439 0.060012 0.080302 0.036215 
+0.065250 0.083030 -0.058784 0.104826 -0.051805 
+-0.011099 -0.006420 0.053042 0.024127 0.092534 
+0.058569 -0.033442 0.025186 -0.018222 0.117744 
+0.044345 -0.042456 -0.043767 -0.021378 -0.121965 
+0.027371 0.052731 -0.020316 0.036912 0.115357 
+0.031150 0.041547 0.059267 -0.039672 -0.086918 
+-0.162369 0.024801 0.031725 0.083400 -0.034463 
+0.000272 -0.008147 -0.002016 0.131953 -0.092911 
+-0.091944 -0.062864 -0.005221 0.063647 -0.012658 
+0.042685 0.067952 0.038644 -0.153221 0.096841 
+0.108299 0.089446 -0.047164 0.004196 -0.043268 
+-0.035456 0.050838 0.070444 0.084465 -0.079980 
+-0.048916 0.057726 0.023894 0.027653 0.017775 
+0.015461 -0.030287 -0.022245 0.052081 -0.150947 
+-0.002682 -0.056774 -0.123366 -0.091754 0.006536 
+0.006473 -0.143025 0.054690 -0.043189 0.032970 
+0.027446 0.033127 -0.132722 -0.010417 -0.080097 
+-0.018187 0.001858 0.111290 -0.090749 0.059434 
+-0.068738 0.090679 -0.145070 -0.065277 0.063514 
+-0.003982 -0.056382 -0.003673 0.015845 -0.073396 
+0.043688 0.002836 0.069211 0.124852 -0.053313 
+-0.040946 0.070440 -0.107024 -0.019199 -0.033672 
+-0.001440 0.021680 0.110595 -0.053452 -0.052426 
+0.035461 -0.028179 -0.049041 0.022580 -0.010989 
+-0.002913 -0.051691 -0.075881 0.037241 0.076377 
+0.034735 -0.031556 0.073516 -0.001427 0.016296 
+-0.017537 0.003346 -0.099774 -0.067624 -0.044257 
+-0.018202 0.030622 0.012773 0.046475 -0.121785 
+-0.057265 0.116179 -0.079916 0.066396 0.050104 
+-0.013177 0.057766 -0.047879 -0.109526 -0.146491 
+0.032675 -0.049318 -0.057045 -0.080068 0.089621 
+-0.046564 -0.029992 0.040828 0.029281 -0.037369 
+-0.009731 -0.082145 -0.117622 0.117077 0.037369 
+0.000820 -0.106634 -0.007967 0.000812 0.140637 
+0.036530 0.062121 -0.065504 -0.094930 0.121336 
+0.017530 -0.017330 -0.040402 -0.018255 0.010992 
+0.019746 -0.027564 0.033588 0.042466 -0.003143 
+0.013767 0.084179 0.033753 -0.017279 -0.009676 
+-0.006452 0.032645 0.031852 -0.030975 -0.043384 
+-0.005433 -0.015258 0.053273 0.054748 -0.064736 
+0.008959 -0.141223 -0.032957 -0.015079 0.018198 
+-0.001681 0.143079 0.076000 0.001037 -0.048744 
+0.022062 0.026030 -0.008263 -0.050353 -0.023037 
+-0.036477 -0.051733 0.137823 -0.034438 -0.007573 
+-0.004256 0.064218 0.075183 0.095106 0.026497 
+0.026360 0.009791 -0.058039 0.053315 -0.077817 
+-0.033283 -0.081151 -0.055220 0.004268 0.017539 
+-0.007329 -0.117200 0.093220 0.037359 0.002718 
+0.010749 0.018281 -0.075800 -0.024889 0.005720 
+0.022129 0.035613 0.036187 0.032246 0.105439 
+-0.073766 0.016887 -0.059934 -0.049471 0.073520 
+-0.024041 -0.104642 0.023557 -0.059746 -0.043871 
+0.022311 -0.000250 -0.074027 0.198593 0.102732 
+0.024478 0.077658 -0.060042 -0.018229 -0.149648 
+-0.009871 -0.105822 0.007585 -0.161459 -0.041121 
+-0.021460 0.009020 -0.065018 0.111801 -0.024953 
+0.074594 -0.026041 -0.062859 0.009199 0.069609 
+0.078672 -0.033414 0.054128 0.005408 -0.016273 
+0.052076 0.107610 -0.067518 -0.096400 0.033703 
+-0.014350 -0.024676 0.056254 -0.043770 -0.060847 
+-0.004185 0.073550 -0.057830 -0.016644 0.029096 
+0.005755 0.026472 0.040449 -0.091950 -0.048538 
+-0.034439 -0.107938 0.090712 -0.117001 0.043170 
+-0.006505 -0.035277 0.117316 0.127002 0.047906 
+-0.001441 0.118379 -0.132165 0.007380 0.023823 
+-0.020120 -0.083725 0.047284 0.023795 0.074123 
+-0.013439 0.024994 0.060254 -0.069120 0.166373 
+-0.024228 -0.063150 -0.046506 -0.077202 -0.054592 
+-0.006571 0.010335 -0.006568 0.003982 0.075837 
+0.008643 0.136339 -0.005502 0.033910 -0.066379 
+-0.127371 -0.006954 0.039770 -0.070123 0.060925 
+-0.046386 -0.026420 -0.005280 0.103509 -0.022310 
+-0.003740 -0.014999 -0.037770 0.080005 0.025231 
+-0.054995 0.071017 0.009442 -0.075737 0.013441 
+0.051947 0.027097 -0.070351 -0.055705 -0.021115 
+0.021387 0.029232 0.163331 -0.032380 0.010008 
+-0.011987 -0.028631 0.002665 0.014770 -0.009558 
+-0.034325 0.015830 -0.091253 -0.012677 -0.107378 
+-0.034624 -0.047725 -0.102330 0.042525 -0.006869 
+0.014048 -0.043127 0.052384 -0.047473 0.055102 
+0.009744 -0.033646 -0.081755 -0.001464 -0.016223 
+-0.036697 -0.002279 0.023279 -0.036221 0.101478 
+-0.058454 0.065074 0.003524 0.005010 0.097182 
+-0.038171 -0.037943 -0.009994 -0.033355 -0.044552 
+0.041318 0.065041 0.000092 0.100816 0.029007 
+-0.031803 0.183537 -0.009617 -0.010544 -0.028465 
+0.006900 -0.014988 0.090490 -0.174817 0.027464 
+0.063314 -0.049281 -0.001567 0.091421 -0.078603 
+-0.004869 -0.063266 -0.001922 0.069338 0.081771 
+0.058737 0.073195 0.081676 -0.047808 -0.025797 
+-0.004185 0.033203 -0.125472 -0.108148 0.031258 
+0.035192 0.029957 0.046675 0.047238 -0.088197 
+0.033315 0.114919 -0.049180 0.025707 0.053843 
+0.035182 0.140206 -0.058660 -0.025978 -0.019658 
+-0.014847 -0.021051 -0.034385 -0.121789 0.173406 
+-0.112251 -0.022333 0.071206 0.028998 0.046468 
+0.067704 -0.026159 -0.158316 0.014936 0.040216 
+-0.010137 -0.053492 0.004935 -0.011277 0.073852 
+0.091261 0.114794 -0.014060 -0.051545 0.077316 
+0.101258 -0.046137 0.022994 -0.066767 -0.065537 
+0.049952 -0.043582 0.012823 0.009313 0.036343 
+0.054885 0.037796 0.021940 0.013211 0.006019 
+-0.099578 0.058596 -0.045463 -0.015632 -0.087141 
+-0.019273 -0.033140 0.043796 0.119057 -0.081813 
+-0.021538 -0.070453 -0.052551 0.077213 0.000094 
+0.050268 0.092271 0.051688 -0.025224 0.075437 
+0.027983 0.069205 0.031787 -0.099975 0.004387 
+-0.002747 -0.056567 0.161394 0.000164 0.084189 
+-0.124844 0.050329 0.009844 0.055877 0.055701 
+0.030479 0.028843 -0.001076 -0.017173 -0.102770 
+-0.038426 -0.133841 -0.035840 -0.072046 0.020206 
+0.016438 -0.097885 0.041857 0.034601 0.030422 
+-0.089192 -0.014112 -0.052276 0.012005 -0.029335 
+-0.011331 0.101833 0.063827 0.044288 0.101597 
+-0.034689 -0.027434 -0.017801 -0.079224 0.067103 
+-0.027456 -0.098034 0.009448 -0.038986 -0.156729 
+0.085023 0.033136 -0.021343 0.110701 -0.011901 
+-0.006484 0.082023 -0.027094 0.091208 -0.013163 
+-0.012223 0.005933 0.010653 -0.098119 -0.005304 
+-0.021061 -0.058077 -0.073035 0.097856 -0.102847 
+-0.035329 -0.092754 -0.101463 -0.048671 0.055015 
+0.102145 0.062017 0.016002 0.036489 0.059000 
+0.042861 0.025447 -0.019735 -0.107841 -0.033752 
+-0.043982 -0.067059 0.051092 0.025235 -0.147107 
+-0.016269 0.123009 0.035894 -0.020453 0.040013 
+0.015557 0.015825 0.080712 -0.069630 -0.149739 
+0.022006 -0.008848 0.040169 -0.095688 0.059575 
+-0.030641 -0.061353 0.046302 0.104489 0.043372 
+-0.001579 0.059737 -0.104073 0.042342 -0.048611 
+-0.013811 -0.056255 0.107179 0.057433 0.084815 
+0.030217 0.022360 -0.040342 -0.028775 0.120588 
+0.041270 -0.045775 -0.030195 -0.106859 -0.104349 
+0.072418 -0.003603 -0.013072 0.040728 0.086869 
+0.091943 0.066517 0.024442 -0.030929 -0.032920 
+-0.160336 -0.010347 -0.068458 0.017458 0.044823 
+0.050694 0.067625 0.040303 0.113164 -0.038747 
+-0.065558 -0.106357 -0.028352 0.121488 0.026548 
+-0.007820 0.054872 0.094674 -0.099533 0.005231 
+0.118132 0.042780 -0.065079 0.031440 0.043229 
+-0.050024 0.015943 0.073917 0.034049 0.010548 
+-0.024979 0.022639 0.027795 0.049491 0.048762 
+-0.002738 -0.010783 -0.027637 -0.006986 -0.104141 
+-0.066719 -0.061742 -0.067028 -0.053057 -0.003478 
+-0.050948 -0.122196 0.022082 0.002595 0.015094 
+0.006014 0.005784 -0.184537 -0.034872 -0.036104 
+0.055412 0.006886 0.103488 -0.063001 0.096665 
+-0.035533 0.009847 -0.095114 0.008588 0.023736 
+-0.034278 -0.111970 -0.041172 0.039730 -0.102952 
+0.063775 0.039273 0.109863 0.091800 0.030306 
+-0.082206 0.089449 -0.058478 -0.029341 0.038389 
+0.061057 -0.024711 0.111044 -0.035079 -0.027985 
+0.014570 0.002046 -0.031545 0.058848 -0.019500 
+-0.002475 -0.025589 -0.144358 0.063478 0.124927 
+-0.014094 -0.010970 0.031621 -0.040043 0.004389 
+0.025003 0.052397 -0.054526 -0.073469 0.026795 
+-0.024697 0.024739 0.118299 0.014948 -0.132109 
+0.020192 0.037815 -0.090270 0.049313 0.082764 
+-0.022642 -0.006053 -0.038073 -0.057363 -0.107347 
+0.033166 -0.027556 -0.019765 -0.111958 0.027773 
+-0.063001 -0.052998 0.019353 -0.009646 -0.011270 
+0.011872 -0.006508 -0.122226 0.059824 0.041779 
+0.016445 -0.031890 -0.036310 0.013085 0.091631 
+0.062866 0.054501 -0.117523 -0.010907 0.087026 
+-0.014974 -0.035920 -0.048565 -0.019246 -0.043405 
+-0.006959 0.006211 0.042370 0.014603 -0.006435 
+0.019149 0.078038 -0.020556 0.018114 -0.036521 
+-0.054036 0.007325 0.056349 -0.033497 -0.025960 
+0.050184 -0.066536 0.091501 0.071356 -0.049044 
+-0.032263 -0.095268 -0.008784 0.049033 0.036929 
+0.020357 0.152151 0.040814 -0.063159 -0.024324 
+-0.017084 0.011876 -0.015442 -0.019811 -0.000366 
+-0.002700 -0.072981 0.109288 0.007473 -0.049442 
+-0.054040 0.051947 0.019359 0.129160 0.021981 
+0.002248 0.035262 -0.023141 0.064666 -0.078273 
+-0.031663 -0.031343 -0.006058 -0.045421 0.017466 
+-0.067122 -0.130784 0.067057 0.052460 -0.041165 
+-0.004411 0.046453 -0.055461 0.048162 -0.009687 
+0.021530 0.007211 0.104764 0.079849 0.086248 
+-0.072791 0.001112 -0.027964 -0.071233 -0.013339 
+0.007979 -0.118231 0.076826 -0.060762 -0.084358 
+-0.011447 0.009765 0.014163 0.164784 -0.015892 
+-0.020756 0.152509 -0.014014 -0.041853 -0.117008 
+-0.011755 -0.005766 -0.086896 -0.139650 -0.032342 
+0.025651 -0.007843 -0.039073 0.103397 -0.042591 
+-0.005971 -0.001324 -0.053945 -0.000716 0.048977 
+0.130185 0.028226 0.061179 0.024489 -0.021939 
+-0.007019 0.054336 -0.010040 -0.095411 0.082406 
+-0.032130 -0.015054 0.033059 0.002802 -0.080159 
+-0.022452 0.077426 -0.015314 0.033583 0.028479 
+0.023293 0.035078 0.006442 -0.110541 -0.106244 
+-0.034737 -0.104140 -0.034570 -0.114316 0.079382 
+0.006009 0.003901 0.080081 0.055082 0.012896 
+0.064981 0.057219 -0.112986 0.003906 -0.028414 
+-0.012383 -0.054541 0.077483 0.004267 0.123567 
+0.007369 0.099856 0.023273 -0.028194 0.122030 
+-0.036635 -0.126589 -0.034567 -0.028288 -0.065040 
+0.014280 0.011435 -0.004867 0.043901 0.035395 
+0.028599 0.075858 0.118460 0.070581 -0.051903 
+-0.170905 0.050352 0.053514 -0.017139 0.021748 
+-0.096610 0.008904 -0.001049 0.078787 -0.101201 
+-0.026229 -0.019757 -0.035771 0.054142 0.068041 
+-0.020328 0.099979 0.096623 -0.046957 -0.001733 
+0.049586 0.052458 -0.031724 -0.028332 -0.005418 
+0.046710 0.014238 0.133125 -0.005428 -0.080055 
+-0.033226 0.034007 0.025272 0.033924 -0.044662 
+-0.034690 -0.079173 -0.160689 -0.153893 -0.228771 
+-0.002450 -0.083966 -0.168294 0.010694 -0.012167 
+0.000004 -0.044377 0.023373 -0.077437 0.012178 
+-0.015899 -0.010828 -0.062847 0.029927 -0.074557 
+-0.053306 0.049688 0.057017 -0.022571 0.015337 
+-0.046545 0.018895 -0.024848 -0.004424 0.165442 
+-0.060201 -0.098629 -0.065190 0.036582 -0.038566 
+0.051453 0.093478 0.039619 0.117535 0.090386 
+-0.029366 0.108075 -0.016568 -0.093576 -0.048799 
+-0.045599 -0.023619 0.070072 -0.109294 0.001548 
+0.076285 -0.091274 -0.068829 0.000215 -0.046519 
+-0.022512 -0.027067 0.014905 0.079017 0.140699 
+0.061141 0.009178 0.097811 0.033468 -0.006666 
+0.007163 -0.007578 -0.124238 -0.025271 0.017581 
+0.042405 -0.034252 0.064890 0.002500 -0.139083 
+0.009733 0.158179 0.014474 0.038913 0.056290 
+-0.004998 0.075401 -0.030557 -0.038595 -0.049070 
+-0.014680 -0.076306 -0.132365 -0.177693 0.091760 
+-0.057238 -0.072379 0.050877 0.051489 0.028125 
+0.004991 0.032621 -0.167359 0.041002 -0.007072 
+-0.086405 -0.042263 -0.019757 -0.011524 0.066004 
+0.085670 0.008071 -0.013614 -0.062142 0.083280 
+0.000887 -0.075820 0.008295 -0.020136 -0.016886 
+0.089657 -0.106260 -0.051491 -0.012687 0.054778 
+0.011535 0.086613 0.053803 0.027164 -0.023825 
+-0.040009 0.080987 0.026309 -0.000334 -0.085288 
+-0.024208 -0.085040 0.096077 0.120527 -0.044181 
+0.003034 -0.091142 0.006471 0.115971 -0.026358 
+0.003489 0.083633 0.109975 -0.029425 0.061726 
+0.056115 -0.006711 0.013158 -0.062917 -0.015029 
+0.003354 0.031574 0.119045 0.022859 0.023777 
+-0.068292 0.115604 0.031617 0.008953 0.006943 
+0.014420 0.008569 -0.031547 -0.006857 -0.051690 
+-0.086683 -0.108339 0.005093 -0.108646 -0.034720 
+0.054273 -0.096753 0.050806 -0.021115 -0.025278 
+-0.079997 0.027008 -0.034211 0.090949 0.005678 
+0.019288 0.042083 0.062119 0.019301 0.040859 
+-0.009113 0.022427 -0.004019 -0.060890 0.032884 
+-0.012373 -0.037976 0.017625 -0.079369 -0.050788 
+0.079720 -0.039347 -0.085324 0.091044 0.026653 
+-0.063122 0.099371 -0.024736 0.084631 -0.100421 
+-0.073313 0.014317 0.022555 -0.116051 -0.063966 
+-0.009688 -0.063666 -0.131709 0.016744 -0.135028 
+-0.003708 -0.043685 -0.121631 -0.036930 0.125776 
+0.084333 0.010114 0.071231 -0.010395 0.059391 
+0.017760 0.033034 -0.018996 -0.130540 0.025758 
+-0.018261 -0.060044 0.127025 -0.032724 -0.107299 
+-0.064538 0.090073 -0.010186 -0.066127 0.107025 
+-0.010940 0.003083 0.019030 -0.023935 -0.140176 
+0.003549 -0.042402 -0.010695 -0.185915 0.060835 
+0.005405 -0.013822 0.029205 0.079338 0.068155 
+0.071485 0.030282 -0.087207 0.073480 -0.027940 
+0.004896 -0.033246 0.072637 0.018017 0.054712 
+0.026184 -0.005287 0.034456 -0.036753 0.079232 
+0.072707 0.004506 -0.039353 -0.015560 -0.071466 
+0.010257 0.067446 -0.006598 0.047396 0.072218 
+0.023405 0.082663 0.015319 -0.035436 -0.075461 
+-0.124036 -0.032046 0.060837 0.010231 -0.053024 
+0.022800 0.042891 -0.041549 0.132395 -0.095330 
+-0.077091 -0.058554 -0.070632 0.047570 0.031856 
+0.000127 0.114996 0.058660 -0.092472 0.064503 
+0.096450 0.066200 -0.001059 0.039487 -0.032859 
+-0.065721 0.001601 0.088037 0.059828 -0.047411 
+-0.077714 0.010275 0.013629 0.003304 0.005407 
+0.000665 0.012927 -0.077525 0.069202 -0.157417 
+0.014547 -0.095965 -0.087546 -0.067375 -0.027867 
+0.005458 -0.095839 0.105294 -0.044892 0.045151 
+-0.001349 0.038356 -0.127152 -0.080503 -0.105423 
+-0.018484 0.008439 0.104398 -0.027959 0.082086 
+-0.020605 0.042785 -0.109139 -0.025958 0.079733 
+0.036289 -0.083773 -0.033819 0.032566 -0.065556 
+0.006659 0.002090 0.097027 0.115715 -0.013271 
+-0.067514 0.128365 -0.089129 0.026160 -0.040584 
+-0.002443 -0.017254 0.129204 -0.110078 -0.064943 
+0.089215 -0.022299 -0.034959 0.022446 -0.019254 
+-0.038900 -0.069862 -0.070540 0.069949 0.111993 
+-0.006311 -0.009057 0.094278 -0.014932 0.003657 
+-0.019323 0.026145 -0.062611 -0.073753 -0.007182 
+0.014101 0.015776 0.052537 0.064728 -0.160187 
+-0.005122 0.076356 -0.104763 0.091493 0.020225 
+-0.000433 0.062698 -0.060457 -0.147540 -0.066168 
+0.007195 -0.061498 -0.037801 -0.039763 0.059551 
+-0.028410 -0.074510 0.057667 0.020584 -0.042510 
+-0.025311 -0.037825 -0.188010 0.077423 0.030749 
+-0.025465 -0.067541 0.003073 -0.049778 0.127789 
+0.002786 0.120009 -0.067812 -0.026565 0.111272 
+0.023219 -0.024403 -0.014507 -0.048624 0.022163 
+0.014596 -0.052136 0.001580 0.064595 0.017963 
+0.021330 0.098862 -0.009253 -0.041062 0.008903 
+-0.013829 0.031967 0.076571 -0.005348 -0.044010 
+0.031252 0.000369 0.036818 0.072854 -0.038569 
+0.004161 -0.128017 -0.053152 0.050896 -0.015212 
+-0.036159 0.097995 0.068397 -0.048472 -0.056131 
+-0.011920 0.059188 0.010215 -0.061152 -0.011717 
+-0.035949 -0.057039 0.090859 -0.029682 0.041466 
+-0.025106 0.131191 0.059327 0.085383 0.021699 
+0.049230 0.036630 -0.077086 0.017806 -0.088790 
+0.004040 -0.069533 -0.026785 0.009666 0.014017 
+-0.055897 -0.096299 0.120693 0.029995 0.032602 
+-0.001365 0.034015 -0.053512 0.001573 -0.019170 
+0.003956 0.006452 0.067313 0.028301 0.160615 
+-0.053111 0.013990 -0.027060 -0.013638 0.039376 
+-0.054462 -0.096553 0.079994 -0.043791 -0.025051 
+-0.003222 0.019418 -0.049525 0.151136 0.034123 
+0.055117 0.058918 -0.017393 0.026169 -0.126380 
+-0.019008 -0.028939 -0.014027 -0.173373 -0.032841 
+-0.003370 0.039680 -0.118311 0.114094 -0.041869 
+0.041121 -0.038391 -0.096074 -0.032479 0.060222 
+0.063968 -0.024528 0.018158 -0.009892 -0.043882 
+-0.005004 0.129800 -0.025438 -0.121186 0.049860 
+0.010448 -0.040388 0.061853 -0.017304 -0.035088 
+-0.008678 0.061476 -0.039493 -0.005055 0.079169 
+0.046134 0.009770 0.068294 -0.078965 -0.043792 
+-0.030529 -0.053845 0.053853 -0.140682 0.111461 
+0.003549 -0.014939 0.148955 0.072861 0.004332 
+0.015386 0.062006 -0.122325 -0.032529 0.010241 
+-0.047982 -0.126440 0.055840 0.067128 0.101189 
+-0.002630 0.031969 0.046076 -0.080194 0.104740 
+-0.033486 -0.077818 -0.058697 -0.095258 -0.111074 
+0.037236 0.011711 0.001113 -0.005664 0.048588 
+0.041131 0.098257 0.033126 0.029317 -0.095311 
+-0.071555 -0.039999 0.026678 -0.072182 0.035031 
+-0.007997 -0.048174 -0.006796 0.075959 -0.052060 
+-0.007645 0.037076 -0.035574 0.085576 0.034126 
+-0.050676 0.051430 0.031999 -0.134308 -0.001489 
+0.084564 -0.018394 -0.097410 -0.042931 -0.025608 
+-0.025489 0.041919 0.142482 0.004617 -0.041085 
+-0.028816 -0.015527 -0.031005 0.028405 -0.022240 
+-0.067737 -0.025241 -0.052578 0.012322 -0.120556 
+0.016278 -0.081744 -0.099160 0.025144 0.025441 
+0.003176 -0.073871 0.031718 -0.028622 0.029031 
+0.017910 -0.030693 -0.104215 -0.015422 -0.065738 
+-0.048346 -0.012847 0.046849 -0.008621 0.058771 
+-0.054495 0.031597 -0.038844 0.043138 0.092588 
+-0.071371 -0.059093 -0.001197 0.001766 -0.074762 
+0.029470 0.089616 0.005009 0.052977 0.015899 
+-0.045424 0.158466 -0.038717 -0.032506 0.028687 
+0.011435 -0.006772 0.047605 -0.144659 -0.031229 
+0.073577 0.011530 -0.008172 0.058883 -0.088412 
+0.033615 -0.034120 -0.030701 0.101215 0.096645 
+0.027368 0.041249 0.081502 -0.025440 0.007592 
+0.059893 0.012106 -0.112009 -0.114692 0.016397 
+0.087068 0.016199 0.051263 0.011915 -0.085364 
+0.026046 0.145258 -0.047521 0.077134 -0.000345 
+0.034532 0.099801 -0.087591 -0.059719 -0.058671 
+0.022737 -0.001887 -0.107049 -0.116757 0.134115 
+-0.055403 0.005157 0.067618 0.081074 0.071787 
+0.063802 -0.003430 -0.106491 0.017543 0.002214 
+-0.013785 -0.032962 0.010084 0.024325 0.045963 
+0.059883 0.072282 -0.008608 -0.015127 0.048225 
+0.041752 -0.068845 0.012227 -0.090748 -0.035309 
+0.045353 -0.078624 -0.019489 0.035531 0.058571 
+0.045414 0.039032 -0.011106 0.048787 -0.025336 
+-0.084893 0.031896 0.010850 0.012526 -0.053205 
+0.016952 -0.044041 0.068766 0.097328 -0.122229 
+0.027016 -0.051759 -0.057246 0.074566 0.006201 
+0.069904 0.100068 0.076124 0.004278 0.029466 
+0.045229 0.055683 0.018790 -0.067806 0.039373 
+0.029179 -0.036787 0.129921 -0.028993 0.037711 
+-0.105011 0.138747 -0.004370 0.052080 0.050835 
+0.025511 -0.002962 0.007852 -0.055234 -0.075055 
+0.000460 -0.089231 -0.030467 -0.080347 0.007488 
+0.067460 -0.076368 0.084991 0.039544 0.033391 
+-0.044318 0.006390 -0.079387 -0.002909 -0.029708 
+-0.047882 0.063040 0.065719 0.021811 0.070945 
+-0.007571 -0.001302 -0.064119 -0.068005 0.051040 
+-0.017747 -0.063938 0.018673 -0.038391 -0.099966 
+0.057475 -0.007669 0.009384 0.109283 0.012248 
+-0.048858 0.092498 0.011967 0.061525 -0.028819 
+-0.015131 -0.024160 -0.033220 -0.101648 -0.017980 
+-0.003342 -0.049829 -0.125096 0.128241 -0.047377 
+-0.028943 -0.109072 -0.066133 -0.015454 0.098334 
+0.053371 0.011324 0.042781 0.044313 0.062510 
+0.098408 0.065410 -0.040693 -0.116351 -0.032327 
+-0.013634 -0.058591 0.081507 0.042019 -0.099770 
+-0.018275 0.084624 -0.007512 -0.041113 0.054203 
+0.017879 -0.029747 0.059865 -0.048281 -0.111513 
+-0.022478 0.002059 0.022383 -0.125360 0.058216 
+0.002386 -0.081600 0.049288 0.157428 0.057724 
+0.005046 0.102125 -0.083473 0.044059 -0.094864 
+0.039120 -0.063306 0.057341 0.060519 0.107383 
+0.007076 -0.009373 -0.012555 -0.066630 0.117121 
+0.025254 -0.008796 -0.062102 -0.083164 -0.079007 
+0.084839 0.042308 -0.055353 0.036386 0.132641 
+0.084464 0.056288 -0.011636 -0.059554 -0.087748 
+-0.147377 -0.052414 -0.010203 -0.009159 -0.018829 
+0.009621 0.061633 0.015716 0.086332 -0.061465 
+-0.011833 -0.062998 -0.021168 0.125194 0.045025 
+0.052316 0.025720 0.095155 -0.093252 0.028720 
+0.056113 0.063321 -0.045315 0.025199 0.023591 
+-0.070481 0.072350 0.092458 0.047973 -0.025439 
+-0.001281 0.021028 0.034576 0.084779 0.006867 
+-0.010323 -0.046330 -0.009172 0.030485 -0.117679 
+-0.021782 -0.034737 -0.086292 -0.045885 0.009655 
+-0.037167 -0.123331 0.017291 -0.028319 0.071447 
+-0.057180 -0.032912 -0.139418 -0.025966 -0.039305 
+0.009411 -0.054017 0.076307 -0.060252 0.110087 
+-0.061366 0.038897 -0.098107 0.046119 0.043021 
+-0.029130 -0.096885 0.007623 0.090513 -0.097416 
+0.053264 0.058296 0.054372 0.060769 0.015586 
+-0.067956 0.059996 -0.037850 0.005986 0.000778 
+0.045873 -0.065546 0.077900 -0.085638 0.000698 
+0.027694 -0.021241 -0.002777 0.034509 -0.048173 
+0.009988 0.001008 -0.077434 0.026002 0.139490 
+0.008910 0.007791 0.059292 -0.057047 0.014127 
+-0.022959 0.085710 -0.068087 -0.081561 0.005935 
+0.007577 0.061544 0.076542 0.001660 -0.113279 
+0.024973 0.086750 -0.061674 0.095059 0.089352 
+-0.024436 0.024181 -0.016117 -0.073634 -0.067986 
+0.074701 -0.046868 -0.054634 -0.092485 0.006662 
+-0.033256 -0.053774 0.049001 -0.002339 0.013545 
+-0.006432 -0.012089 -0.086842 0.104105 0.061991 
diff --git a/codec2/tags/0.4/src/codebook/lspjvm3.txt b/codec2/tags/0.4/src/codebook/lspjvm3.txt
new file mode 100644 (file)
index 0000000..1b11cc8
--- /dev/null
@@ -0,0 +1,513 @@
+5 512
+0.007066 0.075781 -0.070082 -0.092014 -0.066477 
+0.090510 0.106622 0.025911 -0.016760 0.003724 
+-0.024628 0.058332 0.012876 0.059557 -0.002092 
+-0.065092 -0.096975 -0.041837 -0.002432 0.058918 
+0.014358 0.080049 -0.008803 -0.002091 -0.097584 
+0.085323 -0.026053 -0.086585 -0.009541 0.130555 
+0.045391 0.037557 0.074726 -0.050453 0.033517 
+-0.035576 -0.084211 -0.086430 0.008910 -0.072674 
+-0.098699 -0.024540 -0.048972 -0.066975 -0.048791 
+0.032184 0.070992 -0.014416 0.141892 -0.044249 
+-0.108921 -0.020450 0.115988 0.011287 -0.026273 
+0.024341 0.138519 -0.036467 0.020684 0.074258 
+-0.053563 0.077463 0.072166 0.032112 -0.079303 
+-0.025039 0.079675 0.094211 -0.115754 0.038892 
+0.050897 -0.024639 0.057826 -0.110429 0.071184 
+0.015309 -0.034027 -0.055726 0.043179 -0.063089 
+0.043359 -0.011698 0.006637 0.002751 0.030110 
+-0.001261 0.111470 0.043277 -0.004205 -0.021599 
+-0.005698 0.058842 0.168422 0.059313 -0.007971 
+-0.087599 0.073891 -0.083238 0.099279 -0.017364 
+-0.018429 0.014040 -0.014864 -0.111512 0.089450 
+-0.028498 -0.087983 -0.077320 -0.062602 0.000328 
+-0.027152 -0.093796 0.111381 -0.018603 0.092394 
+-0.007256 0.025391 0.011454 0.012802 -0.041680 
+0.008078 0.020905 -0.105401 -0.083265 0.027756 
+-0.049630 -0.044085 -0.051424 0.104125 -0.000779 
+-0.063079 -0.130699 0.070500 0.033468 -0.019802 
+-0.061011 0.094839 -0.040122 0.118409 0.056950 
+0.086391 -0.006615 0.045337 -0.044190 -0.106474 
+-0.081912 0.067557 -0.031649 -0.014437 0.057585 
+-0.121755 -0.049113 0.057109 -0.049872 0.044104 
+0.064705 -0.091589 0.037286 -0.048606 -0.045398 
+0.003456 0.057230 0.006262 -0.055206 -0.063871 
+-0.005249 0.081783 0.134969 -0.002331 0.052643 
+-0.093346 0.072093 0.116025 -0.031453 -0.006012 
+-0.038574 -0.030841 0.010288 0.024420 0.051657 
+-0.086584 0.046381 0.005410 0.052622 -0.072741 
+0.079023 0.078099 -0.093912 0.005477 -0.006721 
+0.100232 -0.017587 0.044819 0.036655 0.021580 
+-0.006829 -0.050076 -0.003020 0.088246 0.013560 
+-0.015690 0.012477 -0.052595 -0.048861 -0.033688 
+0.055615 0.092298 -0.066194 0.016416 -0.066059 
+0.046976 0.003023 0.104646 0.109136 0.018293 
+-0.016507 -0.006859 0.004326 0.070843 0.140750 
+0.025774 0.034730 -0.079590 0.050054 -0.107950 
+0.002378 0.097498 0.027111 -0.122953 -0.002423 
+-0.020539 -0.063263 -0.095493 -0.157361 -0.039183 
+0.025721 0.026897 -0.001200 0.033997 -0.001749 
+0.061593 -0.013053 -0.106317 -0.068190 0.046352 
+-0.056060 0.157084 -0.049365 0.053959 -0.051065 
+-0.047672 0.081570 0.064342 -0.030705 -0.070806 
+-0.076503 -0.059471 0.012419 0.073968 -0.026179 
+-0.038473 0.059013 -0.035783 -0.030057 -0.036346 
+-0.052692 -0.015346 -0.022687 -0.035279 0.013314 
+0.068397 -0.046609 -0.009593 -0.040796 0.157438 
+-0.075360 -0.110464 0.031839 -0.029035 -0.015222 
+0.041013 -0.099212 -0.108920 -0.008627 0.012095 
+0.020855 0.009935 -0.086917 0.058827 -0.006536 
+0.022104 -0.005013 0.003496 0.046663 -0.051061 
+-0.036803 -0.067317 -0.007075 0.180870 -0.027434 
+-0.025056 -0.039341 -0.073918 -0.003180 -0.110930 
+-0.042711 0.005519 -0.035005 -0.088419 0.170942 
+0.001503 -0.121485 0.066383 -0.067346 0.005643 
+0.080088 -0.042562 -0.006668 -0.036538 0.020683 
+0.042848 0.027852 -0.029088 -0.156468 0.006503 
+0.037716 0.032082 0.038416 0.021835 -0.106963 
+-0.043017 0.018166 0.070409 -0.005426 -0.035585 
+-0.111071 -0.039986 0.050430 0.035157 0.066902 
+-0.040684 0.060527 0.036225 0.002527 -0.015087 
+0.059243 0.021268 -0.010682 -0.018434 0.059128 
+0.111314 -0.054070 0.105744 -0.051476 -0.012970 
+-0.000358 -0.099249 -0.077385 0.069924 -0.039101 
+-0.072139 -0.049069 -0.088018 0.006144 0.000712 
+0.081030 0.021987 -0.046031 0.058087 -0.001320 
+-0.046851 -0.011062 0.108321 -0.001146 -0.071193 
+0.044973 -0.002915 -0.003323 0.041735 0.094566 
+0.053530 0.035927 0.100282 0.059082 -0.054059 
+-0.012158 -0.035417 0.020412 -0.073193 0.059296 
+-0.040489 -0.095250 -0.003821 -0.084904 0.053925 
+0.109183 -0.005862 -0.036538 0.080962 -0.040647 
+0.020070 0.057778 -0.020197 -0.079626 -0.003186 
+-0.050855 0.128185 0.034731 0.057460 -0.035236 
+-0.057096 -0.001238 0.122018 -0.071204 -0.047253 
+-0.051767 0.048301 -0.052678 0.025990 -0.017481 
+-0.029379 0.030738 0.047207 -0.047864 -0.033561 
+0.029884 -0.091175 -0.085446 -0.026140 0.092628 
+0.067706 -0.085617 0.081433 0.047305 0.031945 
+-0.048728 -0.040387 0.046206 0.010578 -0.037639 
+0.011328 -0.042458 -0.149597 0.033882 -0.061869 
+0.008800 0.057754 -0.095876 0.038230 0.096876 
+-0.033487 -0.141669 -0.014172 0.028439 -0.092764 
+-0.053714 0.086926 0.034786 0.136053 -0.005569 
+0.028753 0.009630 0.044114 -0.050365 -0.066224 
+0.006017 0.014348 0.024471 0.000489 0.067234 
+-0.021678 -0.118760 0.036349 -0.040295 0.076358 
+-0.008444 -0.086082 -0.044018 -0.025804 0.028971 
+-0.009233 0.053026 -0.035341 -0.182193 -0.102515 
+0.089210 0.066812 0.032417 0.046882 -0.034815 
+-0.052293 0.022814 0.129622 0.128232 -0.012105 
+-0.087084 0.004762 0.086538 0.046566 0.098359 
+-0.018713 0.039204 -0.021707 -0.060110 -0.117527 
+-0.005459 0.060994 -0.057718 -0.021783 0.035154 
+0.100557 -0.015470 -0.025818 0.008450 0.051535 
+-0.001388 -0.114610 -0.057903 0.041862 0.061778 
+0.045701 -0.078563 -0.070166 -0.048450 -0.088530 
+0.021375 -0.004598 -0.090710 -0.009399 -0.073952 
+-0.035575 -0.050280 0.114780 0.137866 0.065234 
+0.003594 -0.066802 -0.144989 0.166201 0.039564 
+-0.022457 -0.030090 0.016187 0.115443 -0.097331 
+-0.019139 0.099440 0.002198 -0.030953 0.021099 
+-0.045399 -0.046871 0.022533 -0.064657 0.005776 
+0.049063 -0.028478 0.019268 0.054265 0.028042 
+0.045559 -0.005541 -0.014410 -0.024165 -0.054976 
+-0.073258 0.084205 0.036077 -0.068683 0.004708 
+-0.085228 0.001234 0.046261 -0.050496 -0.028227 
+-0.086828 -0.001218 0.021865 0.003791 -0.000568 
+-0.088733 -0.040041 -0.035891 -0.054915 0.073463 
+-0.132031 -0.012844 -0.068544 0.013052 0.087335 
+0.038603 -0.115382 -0.010433 -0.007113 0.095126 
+-0.047378 -0.081353 0.018021 -0.021156 -0.120774 
+0.040038 0.007633 -0.088728 -0.009928 0.020142 
+0.052024 -0.021063 -0.118121 0.102739 -0.055837 
+0.005253 -0.061924 0.063680 -0.014512 -0.020259 
+0.029493 -0.013435 -0.020638 0.089342 0.001092 
+-0.046491 -0.145634 -0.083159 -0.158142 -0.279281 
+0.003611 0.055863 -0.064655 -0.088773 0.089283 
+-0.029619 -0.089949 0.017197 -0.066633 -0.052347 
+0.090828 -0.087551 0.000338 0.085238 -0.005313 
+0.096211 0.071381 -0.076546 -0.077927 -0.040864 
+0.062936 0.041559 0.016235 -0.017513 0.014773 
+-0.025734 0.028586 0.070292 0.055794 -0.026131 
+-0.076954 -0.082228 0.043947 -0.035921 0.152668 
+-0.049510 0.023159 0.008506 -0.044773 -0.160358 
+0.024984 -0.025587 -0.071627 -0.038376 0.088478 
+0.120568 0.046723 0.086731 0.000695 -0.015751 
+-0.027837 -0.160937 -0.095031 0.036271 -0.009061 
+-0.015078 -0.036281 -0.103665 -0.058258 -0.049573 
+0.022021 0.108296 -0.002586 0.065655 -0.018584 
+-0.046441 -0.031018 0.067350 0.014328 0.008860 
+-0.000245 0.063400 -0.001810 0.043515 0.090344 
+-0.063845 0.020485 0.079401 0.070558 -0.116428 
+0.032628 0.068949 0.052238 -0.044530 0.096813 
+0.029911 -0.008814 0.044352 -0.168172 0.009604 
+0.055828 -0.100739 -0.026013 0.021193 -0.051425 
+0.035891 -0.004085 0.030216 -0.060801 0.037202 
+0.007262 0.120686 0.026846 0.058464 -0.100792 
+-0.009176 0.027589 0.123957 -0.011283 -0.025744 
+-0.105081 0.118244 -0.042122 -0.025404 0.000873 
+-0.012703 0.084159 -0.067539 -0.140536 0.041637 
+-0.014485 -0.043382 -0.048004 -0.075416 0.054401 
+-0.018651 -0.032908 0.164231 -0.053236 0.033946 
+-0.021681 -0.012655 -0.037049 -0.001613 -0.053393 
+-0.014635 0.017954 -0.116115 -0.027232 0.034005 
+-0.035376 0.026492 -0.037250 0.070733 0.074835 
+-0.021378 -0.142980 0.123195 0.003699 0.025398 
+0.015629 0.077370 0.032623 0.121580 0.097100 
+0.000946 -0.056355 0.042065 0.008184 -0.081824 
+-0.101937 0.065473 0.003360 0.069241 0.073002 
+-0.053844 -0.044301 0.080351 -0.091833 0.044288 
+0.007447 -0.120723 -0.013806 -0.023636 -0.064616 
+0.030556 0.072630 0.074428 -0.087759 -0.026440 
+0.064840 0.049162 0.091053 0.023891 0.033811 
+-0.027746 0.116392 0.106126 -0.056644 -0.014781 
+0.036137 -0.002632 0.055512 0.070077 0.067819 
+-0.030625 0.053772 -0.078457 -0.021351 -0.113011 
+0.052797 0.044875 -0.077269 -0.009867 0.101493 
+0.073477 -0.024103 0.049145 -0.004706 -0.025211 
+-0.053731 -0.049009 -0.035786 0.054430 0.046515 
+0.025154 -0.043569 -0.034789 -0.058610 0.006931 
+0.012049 0.046809 -0.129441 0.025541 -0.030933 
+0.000297 -0.054058 0.179837 0.081515 0.004932 
+-0.028445 -0.073753 0.010629 0.080042 0.098710 
+-0.014017 0.057597 0.001010 0.071658 -0.067570 
+0.074384 0.110366 -0.018121 -0.108754 0.037793 
+0.028041 -0.047508 -0.031359 -0.098913 -0.036486 
+-0.017311 -0.001279 -0.013694 0.051968 0.036512 
+0.088201 0.031155 -0.043442 -0.065045 0.023486 
+0.027000 0.104768 -0.015176 -0.038754 -0.004178 
+0.003732 0.062166 0.085438 -0.077368 -0.101645 
+-0.118347 0.007589 -0.056489 0.082268 0.020253 
+-0.035623 0.034235 -0.099354 -0.061237 -0.024285 
+0.005441 -0.039694 -0.025957 -0.004411 0.049903 
+0.003040 0.036243 0.023552 -0.007334 0.128963 
+-0.077727 -0.059175 -0.019437 -0.024872 0.004339 
+0.084006 -0.076605 -0.102261 0.036714 -0.035205 
+-0.007642 -0.005125 -0.030525 0.096390 -0.053138 
+-0.002192 -0.024851 0.050645 0.041490 -0.043183 
+0.046796 -0.050894 0.055023 0.133834 -0.024013 
+0.000872 -0.057072 -0.000630 0.042070 -0.129339 
+-0.064283 0.037836 -0.066393 0.004438 0.125379 
+-0.062213 -0.067468 0.090177 -0.046094 -0.025725 
+0.079101 -0.074909 -0.043730 -0.073483 0.069672 
+-0.020413 -0.000079 -0.049725 -0.120751 -0.046980 
+0.039894 0.072305 0.009798 0.005613 -0.045217 
+0.006862 0.036285 0.074819 -0.006747 0.015144 
+-0.071562 0.012324 -0.001082 0.014835 0.079960 
+-0.027804 0.103358 -0.017203 0.014914 -0.056687 
+0.030827 0.028076 0.003395 -0.073255 0.110310 
+0.056498 -0.044893 0.110122 -0.109058 -0.052302 
+-0.001604 -0.089977 -0.060548 0.107808 0.025463 
+-0.070203 -0.000513 -0.123913 0.046247 -0.085392 
+0.096343 0.095890 -0.064950 0.070363 0.034272 
+0.037773 -0.076950 0.124858 -0.009008 -0.010115 
+0.083868 0.051242 0.039149 0.015185 0.083375 
+0.029773 -0.045961 0.100395 0.003743 -0.138294 
+-0.041755 0.010806 0.057797 -0.147374 0.095858 
+-0.009929 -0.103347 -0.032310 -0.110560 0.121377 
+0.145244 0.017079 -0.080587 0.020516 -0.044939 
+-0.010477 0.038347 -0.003466 -0.001618 0.019600 
+-0.021762 0.125482 0.011074 0.065815 0.040298 
+0.009202 -0.051686 0.129684 -0.131135 0.044536 
+0.009313 0.102518 -0.075351 0.054338 0.020273 
+-0.045753 0.031345 0.000407 -0.097294 -0.000416 
+-0.007466 -0.044972 -0.078744 0.042414 0.066624 
+0.030318 -0.067852 0.061416 -0.028992 0.056606 
+0.004038 -0.036253 -0.014279 0.023123 -0.007832 
+-0.000137 -0.027684 -0.127648 -0.007713 -0.008746 
+-0.026500 0.049032 -0.183319 0.059107 0.066500 
+0.016902 -0.093331 0.090129 0.016648 -0.083492 
+-0.023669 -0.010473 0.027614 0.145068 0.000681 
+0.044133 -0.035809 0.005668 -0.090461 -0.090732 
+-0.033927 0.042997 0.021700 -0.046955 0.044487 
+-0.026444 -0.061011 0.010110 -0.023804 0.030427 
+-0.015195 -0.155603 -0.016584 0.021461 -0.003528 
+-0.059784 0.032214 0.000847 -0.098859 -0.078980 
+0.043188 0.066433 0.062309 0.144507 0.006865 
+-0.068953 0.046698 0.099369 0.043354 -0.014309 
+-0.033202 -0.002950 0.040734 0.083454 0.039319 
+0.051358 0.006074 -0.073465 -0.090554 -0.120787 
+-0.040676 0.092412 -0.085151 -0.021699 0.005813 
+0.103135 0.024964 0.025832 -0.075982 0.035699 
+-0.027310 -0.153007 0.036420 0.057600 0.081630 
+0.001605 -0.054191 -0.033043 -0.014390 -0.071383 
+0.036180 0.035860 -0.046980 0.038541 -0.044757 
+-0.078032 -0.029878 0.078183 0.082251 0.010549 
+0.053317 -0.038231 -0.065610 0.055798 0.037504 
+0.076317 -0.027605 0.010349 0.095361 -0.088636 
+0.049089 0.113316 0.051084 0.038589 0.034330 
+-0.055948 -0.037217 -0.015418 -0.139976 0.036306 
+0.039306 -0.009889 -0.044910 0.016559 -0.000050 
+0.106073 0.015280 -0.002563 -0.109085 -0.048475 
+-0.035319 0.163860 0.032981 -0.044932 0.003227 
+-0.123233 -0.010638 0.055479 -0.003666 -0.072249 
+-0.111158 0.065365 0.010691 0.039119 -0.001837 
+-0.118729 0.061470 -0.002077 -0.033335 -0.060165 
+-0.026081 -0.001806 -0.079616 -0.000075 0.080598 
+0.032908 -0.035140 -0.003136 -0.029024 0.094622 
+-0.075773 -0.022898 -0.014817 0.058393 -0.111505 
+0.036794 -0.015760 -0.112602 0.030323 0.085897 
+-0.020834 0.056079 -0.103762 0.117671 -0.041205 
+0.041684 -0.084336 0.034186 0.011973 -0.006313 
+0.040836 -0.035709 0.034170 0.122672 0.090973 
+-0.053182 -0.059371 0.091017 -0.090998 -0.116986 
+0.001405 0.138364 0.017107 -0.064076 0.103486 
+-0.031142 -0.030068 0.046547 -0.133471 -0.042055 
+0.140418 -0.125084 0.035218 -0.001162 -0.021130 
+-0.012034 0.097413 -0.079006 -0.039030 -0.054011 
+0.143887 0.078835 -0.000601 -0.021173 -0.039895 
+-0.025050 0.075865 0.039221 0.032458 0.038206 
+-0.038873 -0.085003 -0.032736 -0.026956 0.113525 
+-0.023933 0.120794 -0.003862 -0.026459 -0.138724 
+0.089559 0.029002 -0.052098 -0.085692 0.115174 
+0.083497 0.024179 0.119021 -0.067541 0.019047 
+-0.027720 -0.086083 -0.055329 0.020087 -0.027086 
+-0.047858 -0.051975 -0.035205 -0.059342 -0.068582 
+0.058936 0.044141 -0.080315 0.119744 -0.046518 
+-0.064588 -0.027212 0.147823 0.032404 0.016690 
+0.024302 0.085560 -0.001525 0.016469 0.038891 
+-0.020146 0.019943 0.045067 0.038070 -0.086274 
+-0.025769 0.044192 0.102141 -0.064765 0.055849 
+0.048803 -0.030066 -0.009220 -0.116655 0.068295 
+0.047580 -0.076138 -0.070307 0.047582 -0.111342 
+0.004656 -0.004452 0.029703 -0.004259 0.011130 
+0.014446 0.166086 0.059565 0.000985 -0.052607 
+0.013251 0.094476 0.106216 0.016715 -0.025581 
+-0.101244 0.072897 -0.114526 0.024681 0.010784 
+-0.051759 0.032389 -0.050202 -0.083316 0.052334 
+-0.035100 -0.116721 -0.110336 -0.053391 0.065541 
+-0.029790 -0.020457 0.135285 -0.004142 0.111508 
+-0.030936 0.018549 -0.016034 0.018572 -0.084336 
+-0.048615 -0.018739 -0.096815 -0.090162 0.019410 
+-0.040821 -0.009925 -0.097427 0.091891 0.031793 
+-0.024598 -0.132848 0.078353 0.089339 -0.068562 
+-0.020779 0.040974 -0.055675 0.169131 0.029649 
+0.078165 -0.050679 -0.005881 -0.004983 -0.104324 
+-0.069096 0.127960 0.011392 -0.000769 0.062168 
+-0.079842 0.001606 0.089284 -0.035465 0.031075 
+0.029519 -0.102956 -0.010902 -0.064030 -0.019669 
+0.057492 0.075802 -0.008904 -0.060743 -0.053144 
+0.005126 0.062980 0.085674 0.019895 0.104448 
+-0.086473 0.056906 0.056795 -0.012940 0.036606 
+-0.008604 -0.040450 0.042062 0.041810 0.027680 
+-0.092256 0.091237 -0.039500 0.024761 -0.088978 
+0.068585 0.088295 -0.048033 -0.017808 0.045370 
+0.124600 -0.035320 0.056751 0.092751 0.054025 
+-0.015725 -0.061938 0.036806 0.078768 -0.016065 
+0.002444 -0.023887 -0.072177 -0.029790 -0.005860 
+0.015478 0.129142 -0.091024 0.071482 -0.065445 
+0.005867 -0.006051 0.098646 0.054089 0.018713 
+0.033837 -0.008355 -0.051959 0.057440 0.160305 
+-0.001863 0.016738 -0.033705 0.062233 -0.140759 
+0.027342 0.060074 0.030362 -0.117875 0.061020 
+-0.028026 -0.088238 -0.003782 -0.146288 -0.080395 
+0.050048 0.036136 0.019500 0.066902 0.020355 
+0.024817 -0.056254 -0.140918 -0.085803 0.020540 
+-0.003730 0.161411 -0.049408 0.000219 -0.002348 
+-0.055021 0.067820 0.126483 -0.031063 -0.119299 
+-0.102834 0.001133 0.010172 0.107707 -0.029106 
+-0.059813 0.036698 -0.021720 -0.043189 -0.002270 
+-0.031694 0.009605 -0.022459 -0.036417 0.053675 
+0.061561 -0.012723 0.050040 -0.029450 0.131044 
+-0.124516 -0.107579 -0.012171 0.011761 0.002599 
+0.016327 -0.060854 -0.080910 0.030875 -0.002997 
+-0.020970 -0.011880 -0.086096 0.037912 0.012421 
+0.055253 -0.007250 0.041740 0.055596 -0.024420 
+-0.017564 -0.079202 0.008897 0.180091 0.054490 
+0.001772 -0.022151 -0.082048 -0.010559 -0.163377 
+-0.020660 -0.017827 -0.030800 -0.045856 0.122405 
+-0.052946 -0.130490 0.097383 -0.116737 0.039855 
+0.056504 -0.059549 -0.059931 -0.018658 0.034898 
+0.054889 0.005373 -0.066796 -0.127360 0.047960 
+0.071746 0.027410 -0.006212 0.024132 -0.094062 
+0.005369 -0.008926 0.073085 -0.014265 -0.029204 
+-0.100025 -0.072076 0.014651 0.069368 0.048275 
+-0.066823 0.086074 0.014921 -0.015395 -0.045138 
+0.026224 0.000902 -0.038208 -0.035221 0.057397 
+0.097606 -0.073195 0.051626 -0.033488 0.027813 
+0.002070 -0.097510 -0.057877 0.126680 -0.082194 
+-0.072597 0.006014 -0.093185 -0.016853 -0.022790 
+0.138461 0.005394 -0.056485 0.102778 0.028918 
+-0.045604 -0.060041 0.121251 0.029260 -0.101404 
+0.061194 0.033039 -0.016798 0.064263 0.065144 
+0.010925 0.023151 0.107623 0.027977 -0.090356 
+-0.024863 -0.006440 0.047870 -0.047486 0.088211 
+-0.012139 -0.116121 -0.000525 -0.140961 0.016604 
+0.063490 -0.022732 -0.046944 0.066970 -0.068838 
+0.016143 0.026202 -0.043344 -0.064881 0.024877 
+-0.072845 0.120531 0.077901 0.047272 0.011713 
+-0.044646 0.040932 0.076164 -0.101233 -0.029615 
+-0.065118 0.050966 -0.023273 0.053517 0.023710 
+-0.007489 0.035822 0.023439 -0.055528 -0.004033 
+-0.007662 -0.096546 -0.081662 0.037141 0.137562 
+0.075526 -0.097496 0.123990 0.013996 0.087005 
+-0.019788 -0.082043 0.020524 0.007027 -0.021537 
+-0.036264 -0.090952 -0.177722 -0.009306 -0.031473 
+-0.009287 0.047557 -0.090241 0.089347 0.056375 
+-0.005506 -0.112128 0.004356 0.064421 -0.038478 
+-0.035674 0.040616 0.007731 0.160236 -0.054199 
+-0.007537 0.012434 0.022001 -0.021567 -0.075163 
+-0.026053 0.015909 0.041015 0.021832 0.034152 
+-0.048539 -0.086655 0.047465 0.000682 0.042640 
+0.023697 -0.095971 -0.022874 -0.000369 0.003413 
+0.046005 0.064807 0.010131 -0.129517 -0.092254 
+0.116469 0.053796 0.038110 0.094470 0.018435 
+-0.034803 0.073591 0.108348 0.104096 0.049884 
+-0.021274 0.022097 0.065347 0.065555 0.089319 
+0.000474 -0.004186 -0.040493 -0.065543 -0.083167 
+-0.017425 0.049177 -0.044248 0.008399 0.068180 
+0.154778 0.027549 -0.008012 0.014950 0.043254 
+0.039599 -0.136415 -0.018716 0.061900 0.031263 
+0.058118 -0.037200 -0.114692 -0.080876 -0.053238 
+0.077436 0.015015 -0.092517 0.005804 -0.065541 
+-0.005653 -0.073184 0.095594 0.082470 0.060989 
+-0.000262 -0.035766 -0.083441 0.122634 0.088429 
+-0.014397 -0.055434 -0.005659 0.069697 -0.064892 
+0.008824 0.082498 0.051866 -0.036070 0.033403 
+-0.082855 -0.087376 0.002714 -0.097121 -0.019170 
+0.027179 -0.069870 -0.009316 0.047450 0.040657 
+0.060527 0.004620 -0.040264 -0.051228 -0.029023 
+-0.071384 0.101421 0.009538 -0.099185 0.060100 
+-0.048395 -0.024677 0.025125 -0.056043 -0.058045 
+-0.054059 0.008107 0.021078 0.045290 -0.018459 
+-0.113359 0.014009 -0.006826 -0.052747 0.046922 
+-0.075976 0.008538 -0.084411 -0.004369 0.045801 
+0.075392 -0.067340 0.014454 0.032407 0.092478 
+-0.061859 -0.083458 0.051442 0.031695 -0.080233 
+0.054028 0.027000 -0.073549 0.032300 0.036501 
+-0.011384 -0.020780 -0.124142 0.093905 -0.028332 
+0.039139 -0.030944 0.079952 -0.001717 0.013976 
+0.038005 -0.001751 -0.044097 0.129827 0.014385 
+-0.001682 -0.063458 -0.002511 -0.078150 -0.141236 
+0.021955 0.104851 -0.093246 -0.060019 0.069998 
+0.004399 -0.096408 0.059327 -0.062268 -0.074327 
+0.108063 -0.090534 -0.045654 0.048119 0.049187 
+0.042105 0.043964 -0.091516 -0.047999 -0.028881 
+0.070471 0.055401 -0.025605 0.011176 0.008475 
+0.022254 0.038266 0.048106 0.047176 -0.017967 
+-0.010978 -0.088762 0.034806 0.019311 0.126815 
+-0.010571 0.053073 0.032162 -0.000780 -0.152200 
+-0.014253 -0.021954 -0.131040 -0.061376 0.113838 
+0.060725 0.020201 0.102533 -0.011392 -0.052046 
+-0.069625 -0.091011 -0.097954 0.067847 0.017856 
+-0.053461 -0.040679 -0.121664 -0.077208 -0.106919 
+0.057996 0.069756 -0.012433 0.069569 -0.055159 
+-0.024801 -0.060448 0.101700 0.014619 0.036580 
+-0.004526 0.093977 -0.028211 0.045261 0.149736 
+-0.014691 -0.007959 0.097708 0.107128 -0.079723 
+0.029157 0.020116 0.104828 -0.064208 0.119172 
+0.039583 -0.029446 0.006628 -0.110398 0.004062 
+0.048132 -0.060601 0.009448 0.051777 -0.053127 
+0.050551 -0.001924 0.028079 -0.050618 -0.013698 
+0.001920 0.088162 0.073078 0.085795 -0.066788 
+0.014025 0.042699 0.176241 -0.046674 -0.034822 
+-0.051433 0.121729 -0.057076 0.023901 0.045075 
+-0.057182 0.054780 -0.017280 -0.146674 0.002090 
+-0.016223 -0.044841 -0.084524 -0.152479 0.072688 
+-0.006962 0.008711 0.127455 -0.003876 0.053162 
+-0.013682 -0.025386 -0.000427 -0.024811 -0.024474 
+-0.056267 0.062116 -0.121311 -0.053011 0.065651 
+-0.075385 -0.008680 -0.063033 0.083039 0.110577 
+-0.000152 -0.127017 0.055904 0.013659 0.005664 
+-0.002852 0.047248 0.001128 0.100773 0.037274 
+0.026368 -0.042205 0.021887 -0.020247 -0.056678 
+-0.077475 0.089799 0.058003 0.039741 0.106663 
+-0.016853 -0.015972 0.075741 -0.048829 0.015374 
+-0.032657 -0.125677 -0.062060 -0.057409 -0.061287 
+0.073151 0.050357 0.053547 -0.059886 -0.051298 
+0.057954 -0.003817 0.076028 0.006757 0.061109 
+-0.038030 0.143209 0.092207 -0.018493 0.062291 
+0.005751 -0.036449 0.067582 0.031449 0.101894 
+-0.080754 0.011515 -0.049485 -0.016137 -0.087818 
+0.108851 0.038222 -0.099315 -0.003117 0.052278 
+0.107517 -0.036233 0.065370 0.040409 -0.057029 
+-0.033167 -0.081758 -0.019502 0.033438 0.013365 
+-0.017760 -0.025906 -0.020244 -0.078722 -0.011697 
+-0.028246 0.068647 -0.106417 0.026956 -0.064914 
+0.062711 -0.017857 0.151539 0.044613 -0.017820 
+0.009085 -0.032785 -0.025795 0.075790 0.075667 
+-0.040398 0.058556 -0.042634 0.093973 -0.099529 
+0.057103 0.073562 0.012640 -0.066141 0.029558 
+0.060219 -0.083699 -0.054799 -0.120442 -0.000374 
+0.006521 0.034512 -0.039558 0.042191 0.033865 
+0.103992 -0.014977 -0.077384 -0.051340 0.001873 
+0.047451 0.140612 -0.024885 -0.021420 -0.046604 
+0.030606 0.100660 0.076356 -0.019288 -0.098570 
+-0.114463 -0.010855 -0.034657 0.025618 -0.003356 
+-0.087913 0.064346 -0.075540 -0.091569 -0.024965 
+-0.021232 -0.017255 -0.056931 -0.003104 0.030219 
+-0.020112 -0.012334 0.035298 0.001405 0.161753 
+-0.064618 -0.064401 -0.007218 -0.000120 -0.047208 
+0.116105 -0.056464 -0.069645 -0.007032 -0.012090 
+-0.023237 0.016000 -0.039802 0.074319 -0.012604 
+0.014863 -0.058081 0.093219 0.062253 -0.040302 
+0.027405 -0.128683 0.039923 0.116808 -0.011706 
+0.012483 -0.017698 0.003645 -0.007588 -0.120662 
+-0.032868 0.066217 -0.031343 -0.034166 0.146334 
+-0.031228 -0.125921 0.117756 -0.042686 -0.062094 
+0.049375 -0.112262 0.010166 -0.073599 0.048690 
+0.028292 0.020076 -0.062865 -0.106114 -0.025300 
+0.066916 0.029279 0.028191 -0.003599 -0.040614 
+0.020491 0.060238 0.052747 -0.010390 -0.022389 
+-0.063358 -0.028707 0.035907 -0.011898 0.079703 
+-0.003758 0.078051 -0.017869 0.009045 -0.018982 
+0.034974 0.069405 -0.018909 -0.038613 0.083909 
+0.033935 -0.036607 0.088891 -0.052599 -0.059839 
+0.052758 -0.068308 -0.063615 0.126093 -0.009460 
+-0.042175 -0.011113 -0.073071 0.052086 -0.052619 
+0.049226 0.066898 -0.045666 0.117923 0.053656 
+-0.010739 -0.043962 0.141903 0.001792 -0.035469 
+0.090671 0.043993 -0.013655 0.018989 0.127223 
+0.001030 -0.001154 0.081839 -0.024979 -0.103704 
+-0.077920 0.036083 0.068220 -0.062210 0.113730 
+-0.010501 -0.065801 0.050885 -0.104304 0.121937 
+0.111850 0.009680 -0.011791 0.001677 -0.035029 
+0.010677 0.024572 -0.012860 -0.030323 -0.010466 
+0.011279 0.167752 0.003136 0.109709 0.007292 
+0.000987 0.004572 0.108706 -0.113192 -0.012431 
+-0.015225 0.073653 -0.051275 0.077928 -0.012752 
+-0.011708 0.014172 0.025162 -0.095378 0.026382 
+-0.028889 -0.058569 -0.129329 0.011087 0.061452 
+0.056893 -0.058004 0.103586 -0.060752 0.081824 
+-0.042805 -0.015991 -0.024444 0.028952 -0.013528 
+0.042851 0.019988 -0.165741 -0.031012 -0.014713 
+-0.026059 0.031698 -0.134343 0.032090 0.020828 
+0.051674 -0.128006 0.050856 0.022220 -0.073513 
+-0.009340 0.013756 0.036163 0.098407 -0.023495 
+0.023858 0.008121 0.022220 -0.103489 -0.046663 
+-0.033000 0.063565 0.029224 -0.012693 0.084202 
+0.012187 -0.051000 0.026126 -0.043293 0.008675 
+-0.019812 -0.165070 -0.014555 -0.047431 0.017990 
+-0.040073 0.107192 0.022228 -0.089023 -0.066885 
+0.014630 0.073186 0.069902 0.072634 0.019593 
+-0.041539 0.031788 0.092310 0.027223 0.034027 
+-0.051855 0.000391 0.007869 0.131910 0.069384 
+0.046276 0.040440 -0.037093 -0.031393 -0.112828 
+0.015709 0.096749 -0.103205 -0.021284 0.011405 
+0.158287 -0.021028 0.042219 -0.050759 0.069715 
+-0.042907 -0.116980 0.014224 0.094648 0.028395 
+0.041535 -0.057033 -0.047607 -0.024419 -0.034905 
+0.010125 0.036728 -0.052503 -0.001839 -0.033477 
+-0.053414 -0.070394 0.092895 0.100600 -0.026352 
+0.080574 -0.028763 -0.059548 0.094571 0.091787 
+0.041437 0.014312 0.045792 0.108269 -0.081586 
+0.056288 0.137447 0.054718 -0.032474 0.054502 
+-0.100144 -0.006460 0.024739 -0.117043 -0.008919 
+0.070299 -0.036862 -0.014543 0.024500 -0.015222 
+0.114975 -0.043705 0.000421 -0.061872 -0.035148 
+-0.022797 0.128575 -0.031798 -0.086718 -0.007172 
+-0.071706 -0.006833 0.028645 -0.007011 -0.096745 
+-0.142269 0.027996 0.065210 0.061381 0.000741 
+-0.140531 0.017480 -0.014986 -0.040893 -0.012718 
+-0.012494 -0.021869 -0.032923 0.016456 0.104475 
+0.010792 -0.066178 0.019097 -0.001893 0.067513 
+-0.092673 -0.059851 -0.045936 0.052642 -0.062500 
+0.065013 -0.025659 -0.149301 0.051705 0.035692 
+-0.045790 -0.007482 -0.069141 0.149365 -0.042039 
+0.018492 -0.081315 0.055880 0.058158 0.019669 
+0.063836 -0.012391 0.007057 0.155454 0.033854 
+-0.016532 -0.007661 0.043113 -0.080283 -0.108670 
+-0.029344 0.093781 -0.015840 -0.068134 0.091804 
+0.004148 -0.058507 0.059633 -0.095883 -0.004939 
+0.086151 -0.113571 -0.019466 -0.009167 0.003662 
diff --git a/codec2/tags/0.4/src/codebook/lspres_bw1.txt b/codec2/tags/0.4/src/codebook/lspres_bw1.txt
new file mode 100644 (file)
index 0000000..51fad06
--- /dev/null
@@ -0,0 +1,5 @@
+1 4 
+35
+80
+140
+250
diff --git a/codec2/tags/0.4/src/codebook/lspres_bw2.txt b/codec2/tags/0.4/src/codebook/lspres_bw2.txt
new file mode 100644 (file)
index 0000000..a5eedc4
--- /dev/null
@@ -0,0 +1,10 @@
+1 8 
+50
+100
+200
+400
+500
+600
+800
+1000
+
diff --git a/codec2/tags/0.4/src/codebook/lspres_centre1.txt b/codec2/tags/0.4/src/codebook/lspres_centre1.txt
new file mode 100644 (file)
index 0000000..111a734
--- /dev/null
@@ -0,0 +1,9 @@
+1 8
+300
+350
+400
+450
+500
+550
+600
+650
diff --git a/codec2/tags/0.4/src/codebook/lspres_centre2.txt b/codec2/tags/0.4/src/codebook/lspres_centre2.txt
new file mode 100644 (file)
index 0000000..ee8dd3e
--- /dev/null
@@ -0,0 +1,10 @@
+1 8
+500
+600
+750
+900
+1100
+1300
+1500
+1700
+
diff --git a/codec2/tags/0.4/src/codebook/lspvqanssi1.txt b/codec2/tags/0.4/src/codebook/lspvqanssi1.txt
new file mode 100644 (file)
index 0000000..1ffb917
--- /dev/null
@@ -0,0 +1,257 @@
+10 256
+0.5862 0.7213 0.9146 1.0909 1.2910 1.4954 1.8370 2.0840 2.3771 2.5518 
+0.0871 0.2049 0.5849 0.8552 1.2096 1.4686 1.8210 2.0926 2.4508 2.7389 
+0.2274 0.3126 0.6088 0.8338 1.1824 1.5948 1.8228 1.9856 2.1832 2.4793 
+0.1827 0.2706 0.5842 0.7761 1.0301 1.2462 1.6313 1.9786 2.3479 2.6790 
+0.3055 0.3863 0.7194 1.1609 1.3303 1.5017 1.7265 1.9412 2.4659 2.6315 
+0.1794 0.2522 0.5477 0.7892 1.3887 1.7101 1.9471 2.1667 2.4361 2.6310 
+0.1825 0.2729 0.4185 0.6024 1.2531 1.7291 1.9937 2.1849 2.5865 2.7748 
+0.3219 0.4045 0.7357 1.2708 1.4626 1.6439 1.9388 2.1212 2.5005 2.6749 
+0.2234 0.3496 0.5054 0.6981 0.8672 1.0431 1.7091 2.0690 2.3290 2.6195 
+0.3009 0.3957 0.7576 0.9751 1.1955 1.7727 2.0383 2.2474 2.5612 2.7188 
+0.3841 0.5544 0.9209 1.1811 1.5441 1.8126 2.1175 2.3192 2.5486 2.6935 
+0.2153 0.3105 0.5597 0.8313 1.2168 1.4512 1.7012 1.8962 2.3893 2.5852 
+0.3196 0.4814 0.7629 1.0869 1.5517 1.7780 2.0462 2.2547 2.5023 2.6706 
+0.1964 0.3055 0.4307 0.7178 1.4260 1.6240 1.8392 2.0576 2.2976 2.5492 
+0.4260 0.6888 1.2019 1.4194 1.6437 1.8221 2.0469 2.2508 2.5142 2.6795 
+0.3004 0.3944 0.5847 1.0050 1.1812 1.3559 1.5479 1.7847 2.4924 2.6703 
+0.1595 0.2398 0.4336 0.9228 1.2602 1.5064 1.7915 1.9840 2.2320 2.5692 
+0.1832 0.2985 0.4205 0.5980 0.7620 0.9894 1.7499 2.1151 2.4814 2.7214 
+0.2234 0.3207 0.5457 0.9799 1.2074 1.7079 1.9734 2.1742 2.4575 2.6366 
+0.3598 0.4819 0.6385 0.8878 1.3226 1.4910 1.7257 1.9456 2.2061 2.4579 
+0.4671 0.5911 0.8513 1.0923 1.5104 1.7043 1.9727 2.1839 2.4484 2.6111 
+0.2418 0.3937 0.5420 0.8971 1.1152 1.3054 1.7928 1.9796 2.5441 2.7572 
+0.3541 0.4730 0.6546 0.9063 1.0792 1.2743 1.8545 2.0555 2.3083 2.5404 
+0.3121 0.4016 0.7137 0.8835 1.0736 1.5907 1.8624 2.0857 2.5075 2.6668 
+0.2232 0.3631 0.5273 0.7438 1.0492 1.2235 1.5449 2.2198 2.5160 2.6852 
+0.2557 0.3528 0.5051 0.6528 0.8351 1.5688 1.8838 2.1056 2.4401 2.6111 
+0.4342 0.5318 0.9234 1.1146 1.3015 1.5198 1.8211 2.0340 2.3694 2.5506 
+0.4310 0.5269 0.7431 0.9018 1.0734 1.5196 1.8267 2.0244 2.4508 2.6177 
+0.2150 0.3249 0.4966 0.9434 1.1627 1.3497 1.8003 2.0045 2.3567 2.5909 
+0.2798 0.4111 0.5786 0.7971 1.0414 1.2142 1.6947 2.0866 2.3351 2.5545 
+0.1688 0.2693 0.4004 0.6337 1.3058 1.5064 1.7535 1.9689 2.5542 2.7424 
+0.4419 0.6209 1.0127 1.2135 1.4104 1.6111 1.8820 2.1005 2.4238 2.5966 
+0.3645 0.5120 0.8977 1.2209 1.5286 1.7204 1.9787 2.1779 2.4390 2.6114 
+0.2897 0.4136 0.5504 0.8515 1.2641 1.4334 1.8079 2.0656 2.3509 2.7593 
+0.1611 0.4723 0.7420 1.0071 1.2571 1.5891 1.9224 2.2345 2.5647 2.7991 
+0.2528 0.4178 0.8909 1.3117 1.6622 1.8641 2.1017 2.2974 2.5299 2.6982 
+0.1749 0.2700 0.4116 0.6036 1.1430 1.7776 2.0394 2.2220 2.4667 2.6598 
+0.3451 0.4325 0.6194 0.7406 0.9176 1.5540 1.8426 2.0479 2.4401 2.5965 
+0.3672 0.5164 0.6558 0.8441 1.2332 1.4114 1.6955 2.0875 2.3674 2.5471 
+0.2194 0.3467 0.7384 1.1079 1.5398 1.8437 2.1212 2.3296 2.5800 2.7403 
+0.1525 0.2343 0.3915 0.6843 1.0517 1.5020 1.7905 1.9667 2.2027 2.6725 
+0.3531 0.5908 0.7462 0.9441 1.2774 1.4743 1.8268 2.1059 2.4478 2.6484 
+0.3611 0.4981 0.7598 0.9676 1.4024 1.6330 1.9094 2.1433 2.4408 2.6130 
+0.2153 0.3366 0.4974 0.6693 1.1944 1.6791 1.9002 2.1105 2.4100 2.5922 
+0.2421 0.3392 0.5123 0.9818 1.5411 1.7092 1.9989 2.1981 2.5659 2.7656 
+0.2116 0.3250 0.4845 0.8021 1.0088 1.2158 1.8038 2.0223 2.2975 2.5810 
+0.1902 0.2942 0.8003 1.1086 1.3606 1.6008 1.8956 2.1328 2.4481 2.6405 
+0.2772 0.3914 0.5826 0.7654 0.9495 1.1240 1.3949 2.0411 2.3891 2.5959 
+0.2678 0.5220 0.7630 1.1000 1.3747 1.6432 1.9391 2.2237 2.5511 2.7893 
+0.3200 0.4245 0.6174 0.9904 1.1662 1.3882 1.7601 1.9524 2.3998 2.5819 
+0.1702 0.4871 0.8370 1.0989 1.3593 1.5830 1.8750 2.1277 2.4666 2.6885 
+0.2280 0.3748 0.6554 0.9113 1.2081 1.4619 1.8181 2.0541 2.3791 2.5701 
+0.1752 0.4363 0.6454 0.8798 1.1079 1.5367 1.8667 2.1716 2.4804 2.7249 
+0.3804 0.4700 0.8224 1.0099 1.1892 1.5906 1.8879 2.0907 2.4544 2.6238 
+0.1808 0.2910 0.4683 0.7059 0.8980 1.4031 1.7063 1.9444 2.4658 2.6776 
+0.2418 0.3803 0.5443 0.7589 1.1496 1.3185 1.5451 1.7433 2.1310 2.6523 
+0.2698 0.3690 0.5362 1.0732 1.2921 1.4696 1.7440 1.9470 2.5051 2.6841 
+0.4099 0.5102 0.6983 1.0468 1.2459 1.4185 1.8851 2.0815 2.3464 2.5605 
+0.0669 0.1354 0.3764 0.8433 1.1719 1.4834 1.8181 2.1312 2.4626 2.8044 
+0.1614 0.2372 0.3878 0.5708 1.2759 1.4950 1.8052 2.0807 2.3485 2.6293 
+0.1688 0.2875 0.4301 0.9059 1.2361 1.4054 1.8057 1.9924 2.5589 2.7495 
+0.2864 0.3783 0.7032 1.0817 1.2382 1.5741 1.8619 2.0656 2.5139 2.6848 
+0.3829 0.4781 0.6766 0.8340 1.0056 1.4147 1.6650 1.8840 2.3922 2.5619 
+0.3259 0.4187 0.6139 0.7338 1.1831 1.6497 1.9000 2.1278 2.4322 2.5930 
+0.2569 0.3790 0.5426 0.8390 0.9871 1.4850 1.8652 2.0732 2.4314 2.6005 
+0.1408 0.2283 0.4024 0.8784 1.1485 1.4003 1.7004 1.9205 2.3723 2.6522 
+0.2971 0.5039 0.8005 1.1212 1.4232 1.7801 2.1255 2.3907 2.6795 2.8487 
+0.1515 0.2344 0.4684 0.8040 1.0401 1.3774 1.8329 2.1235 2.5555 2.7770 
+0.5778 0.7157 0.8910 1.0966 1.4235 1.6482 1.9551 2.1831 2.4572 2.6234 
+0.3017 0.4161 0.8088 0.9971 1.2000 1.4419 1.7867 2.0224 2.3473 2.5400 
+0.1208 0.2814 0.6564 0.9448 1.2377 1.5663 1.9084 2.2112 2.5583 2.8155 
+0.2127 0.3127 0.4635 0.6416 0.8449 1.6652 2.0577 2.2656 2.5811 2.7434 
+0.1942 0.3011 0.4212 0.6901 1.5369 1.7639 1.9608 2.1766 2.4435 2.6663 
+0.3510 0.4345 0.7146 0.9086 1.0678 1.2579 1.4425 2.0265 2.4574 2.6252 
+0.3225 0.4323 0.6168 0.8580 1.5388 1.7910 1.9927 2.2013 2.4494 2.6160 
+0.2271 0.4488 0.6287 0.7857 1.2086 1.3830 1.6194 2.1955 2.5236 2.6945 
+0.2568 0.3510 0.5613 1.0500 1.2521 1.4359 1.6995 1.9187 2.2148 2.4275 
+0.2933 0.3941 0.6128 0.8899 1.0720 1.2862 1.5331 1.8301 2.1553 2.3865 
+0.3480 0.4626 0.6009 0.7630 0.9044 1.1225 1.8539 2.1845 2.5035 2.7091 
+0.1337 0.4722 0.8099 1.1273 1.4252 1.6990 2.0188 2.2922 2.6018 2.8168 
+0.1138 0.3263 0.8059 1.0473 1.3262 1.6202 1.9439 2.2007 2.5347 2.7702 
+0.1979 0.3130 0.4635 0.8504 1.1143 1.3221 2.0371 2.2421 2.5406 2.7491 
+0.3321 0.4194 0.8239 1.0458 1.1981 1.3733 1.5661 1.9985 2.3747 2.5416 
+0.3729 0.5958 0.9551 1.2650 1.5484 1.9255 2.2256 2.4809 2.7276 2.8935 
+0.1664 0.2516 0.5347 0.7545 1.1971 1.4089 1.7400 2.0871 2.4098 2.6795 
+0.2370 0.3178 0.6123 1.3315 1.5470 1.7257 2.0063 2.1977 2.5449 2.7252 
+0.2030 0.3328 0.4766 0.7357 1.2780 1.4439 1.7229 1.9405 2.2278 2.6816 
+0.1702 0.2919 0.4598 0.7123 0.9077 1.1450 1.8632 2.0806 2.4990 2.7100 
+0.2421 0.3578 0.5400 0.7217 0.8971 1.4898 1.8518 2.1205 2.6077 2.7894 
+0.3030 0.3935 0.5812 0.7404 0.9425 1.8342 2.0887 2.2811 2.5596 2.7118 
+0.1322 0.1997 0.3466 0.6981 1.1811 1.4849 1.8594 2.1114 2.4708 2.7804 
+0.2317 0.3069 0.6860 1.4306 1.7121 1.8671 2.1249 2.2995 2.5705 2.7456 
+0.3778 0.4863 0.6639 0.9163 1.1560 1.3186 1.5389 1.7169 2.1603 2.5797 
+0.2118 0.3499 0.5259 0.7200 1.1348 1.3140 1.5657 2.0241 2.2873 2.5184 
+0.2902 0.4368 0.6331 0.8971 1.3102 1.5219 1.8674 2.1512 2.4708 2.6809 
+0.1418 0.3988 0.6251 0.8544 1.1268 1.3964 1.7585 2.0322 2.3964 2.6928 
+0.2314 0.3462 0.7282 0.9211 1.1766 1.4941 1.7368 1.9546 2.5170 2.7066 
+0.2076 0.3251 0.7423 0.9590 1.1936 1.5329 1.8887 2.1588 2.4667 2.6709 
+0.2058 0.4139 0.5745 0.7832 0.9595 1.1688 1.7561 1.9562 2.4840 2.7001 
+0.1834 0.2971 0.4643 0.6625 0.8802 1.1137 1.5183 1.8417 2.3842 2.7042 
+0.1688 0.4218 0.7070 1.0465 1.4496 1.6953 1.9560 2.2174 2.5172 2.7404 
+0.2323 0.3981 0.5489 0.7227 1.2886 1.5221 1.7158 2.1184 2.4066 2.5898 
+0.3470 0.5265 0.8140 1.0152 1.3206 1.5411 1.8490 2.0588 2.3556 2.5393 
+0.1707 0.2595 0.6762 0.9037 1.2781 1.4903 1.7946 2.0610 2.3741 2.5771 
+0.1457 0.2318 0.6039 1.0078 1.3461 1.5908 1.8818 2.1248 2.4432 2.6714 
+0.6574 0.8086 1.0243 1.2183 1.4837 1.7129 2.0197 2.2464 2.5059 2.6716 
+0.2546 0.4983 0.8674 1.2536 1.6704 1.9529 2.2134 2.4319 2.6532 2.8109 
+0.2455 0.3379 0.4632 0.8635 1.5286 1.8047 1.9909 2.1806 2.4031 2.5729 
+0.4772 0.6742 1.0000 1.2474 1.5288 1.7415 2.0102 2.2168 2.4770 2.6449 
+0.3357 0.4382 0.6033 1.1317 1.3681 1.5576 1.9251 2.1119 2.5548 2.7395 
+0.2588 0.7015 0.8953 1.0830 1.2828 1.5160 1.8965 2.1921 2.5150 2.7258 
+0.2466 0.3512 0.5047 0.6646 0.8161 1.2577 1.8046 2.0214 2.4447 2.6491 
+0.1631 0.2283 0.4070 0.5955 1.1126 1.3894 1.8978 2.1849 2.5384 2.7382 
+0.3424 0.4748 0.6222 0.8020 0.9706 1.1568 1.7044 1.9297 2.2127 2.5627 
+0.2088 0.5143 0.7400 0.9277 1.1032 1.3561 1.8841 2.2004 2.5882 2.7993 
+0.2016 0.3488 0.5894 0.7419 1.1488 1.3626 1.5566 1.9694 2.5488 2.7209 
+0.2558 0.3914 0.5360 0.7521 1.4330 1.6955 1.8886 2.1428 2.4190 2.5966 
+0.4021 0.5034 0.6653 0.8123 0.9586 1.2825 1.9184 2.1120 2.4090 2.5970 
+0.2343 0.4800 0.6934 0.8523 1.2786 1.4763 1.7235 2.0400 2.3602 2.5562 
+0.2460 0.3687 0.5325 0.7044 1.1488 1.3608 1.8112 2.0757 2.4183 2.6630 
+0.1616 0.3644 0.5725 0.9166 1.2481 1.4938 1.8388 2.1175 2.4712 2.7464 
+0.3760 0.4841 0.6350 1.0082 1.2110 1.4003 1.8127 2.0018 2.5199 2.7238 
+0.1988 0.2824 0.6553 1.0337 1.5413 1.7369 1.9751 2.1751 2.4372 2.6265 
+0.2728 0.4094 0.7498 1.0645 1.3516 1.5946 1.9910 2.2172 2.4830 2.6614 
+0.1657 0.5327 0.7281 0.9966 1.2385 1.4629 1.8119 2.0973 2.4469 2.6979 
+0.1413 0.2098 0.3540 0.5492 0.8486 1.1288 1.6320 1.9056 2.2805 2.5438 
+0.2856 0.3666 0.6259 1.1424 1.6605 1.8197 2.0147 2.1986 2.4121 2.5919 
+0.2725 0.4829 0.7650 1.0119 1.2977 1.5488 1.8755 2.1155 2.4383 2.6377 
+0.2736 0.3804 0.5537 1.0258 1.2269 1.4186 1.9718 2.1468 2.5665 2.7689 
+0.2341 0.5953 1.1030 1.4549 1.7361 1.9758 2.2126 2.4213 2.6405 2.8181 
+0.2273 0.4638 0.6228 0.8500 1.1016 1.2823 1.7094 1.9523 2.2669 2.7029 
+0.2438 0.3798 0.7299 0.9600 1.3765 1.6104 1.8644 2.1161 2.5073 2.7137 
+0.1551 0.4869 0.8676 1.2274 1.5069 1.8857 2.1868 2.4411 2.7106 2.8767 
+0.2746 0.5454 0.7589 0.9458 1.1597 1.3349 1.6653 2.1142 2.4356 2.6239 
+0.1793 0.2646 0.4344 0.7482 1.1502 1.3733 1.8558 2.0817 2.3248 2.5171 
+0.2698 0.4202 0.5765 0.8301 1.0073 1.2101 1.9714 2.2051 2.5138 2.7395 
+0.1929 0.3091 0.4460 0.6266 1.1805 1.3672 1.5990 2.1514 2.4729 2.6468 
+0.1901 0.3047 0.4607 1.1019 1.3168 1.5343 1.9234 2.1365 2.5924 2.7807 
+0.3139 0.5009 0.6700 0.8268 1.0117 1.1810 1.6539 2.1984 2.4828 2.6576 
+0.1403 0.2173 0.4117 0.7302 1.0038 1.2732 1.7392 2.0337 2.3809 2.7386 
+0.4166 0.5101 0.7449 1.1663 1.3492 1.5543 1.9000 2.0941 2.4588 2.6365 
+0.3342 0.4335 0.6160 0.8559 1.0112 1.2097 1.4029 1.6361 2.4129 2.6324 
+0.4543 0.6159 0.7932 0.9843 1.2562 1.4308 1.7116 1.9919 2.2671 2.4631 
+0.2153 0.3609 0.5302 0.7089 0.8756 1.0376 1.6496 2.2826 2.5680 2.7441 
+0.4380 0.6439 0.8282 1.0651 1.3650 1.5829 1.8838 2.1005 2.4006 2.5771 
+0.2523 0.3636 0.5879 1.1628 1.3542 1.6756 2.0488 2.2543 2.6093 2.7953 
+0.4179 0.5426 0.7065 0.8996 1.0684 1.3146 1.9705 2.2021 2.5051 2.7061 
+0.1659 0.2860 0.6693 0.9229 1.3959 1.6544 1.9709 2.2257 2.5236 2.7460 
+0.2540 0.4356 0.5946 0.7627 1.2274 1.4222 1.6573 1.9601 2.2514 2.4711 
+0.1633 0.2337 0.3698 0.5421 1.1757 1.5916 2.1561 2.3371 2.5534 2.7737 
+0.1953 0.2730 0.4521 1.2005 1.7062 1.8627 2.1313 2.3266 2.5906 2.7667 
+0.3053 0.4054 0.5651 0.7470 0.8910 1.1720 1.8864 2.1074 2.3705 2.5744 
+0.1761 0.3033 0.6501 0.8268 1.0369 1.2687 1.8534 2.1889 2.5074 2.7339 
+0.2265 0.3990 1.1359 1.4137 1.6839 1.8912 2.0948 2.3042 2.5489 2.7234 
+0.3326 0.5400 0.8711 1.0948 1.3752 1.6155 1.9360 2.1537 2.4451 2.6133 
+0.2162 0.3522 0.5309 0.7470 0.9677 1.1747 1.5056 1.7942 2.1615 2.4800 
+0.1872 0.2761 0.4053 0.7469 1.5858 1.8945 2.1198 2.3197 2.5819 2.7758 
+0.5381 0.8651 1.2695 1.4918 1.7774 1.9696 2.1865 2.3687 2.5739 2.7158 
+0.2663 0.3422 0.6098 1.2120 1.4516 1.6092 1.8506 2.0376 2.2929 2.5088 
+0.1904 0.3051 0.5663 0.7391 1.1589 1.5705 1.8756 2.1653 2.5518 2.7693 
+0.1543 0.3519 0.6976 1.0664 1.3696 1.7817 2.1308 2.4259 2.7070 2.8753 
+0.3304 0.4283 0.5942 0.7425 0.8906 1.4067 2.0676 2.2460 2.5394 2.7006 
+0.2080 0.3215 0.6278 0.7882 1.3123 1.5592 1.8048 2.0831 2.4303 2.6266 
+0.1188 0.2481 0.8270 1.2420 1.5824 1.8976 2.1816 2.4248 2.6645 2.8459 
+0.0635 0.1528 0.5973 0.9377 1.2653 1.5465 1.8818 2.1681 2.5089 2.7924 
+0.3249 0.5179 0.9143 1.2973 1.4966 1.7550 2.0715 2.3166 2.6500 2.8305 
+0.1918 0.3107 0.4506 0.6994 1.3463 1.5348 1.8447 2.1903 2.4480 2.6877 
+0.3405 0.4644 0.7232 0.9199 1.2611 1.5175 1.8446 2.0652 2.3915 2.5781 
+0.3289 0.5152 0.6602 1.0213 1.1886 1.5496 1.9553 2.1883 2.5394 2.7362 
+0.3000 0.4097 0.8372 1.0793 1.3095 1.5684 1.8746 2.0783 2.3643 2.5490 
+0.2421 0.3280 0.5288 0.9261 1.6911 1.8959 2.1013 2.2823 2.5238 2.6960 
+0.1070 0.3131 0.6226 0.8881 1.1808 1.4867 1.8146 2.1088 2.4594 2.7186 
+0.4400 0.5533 0.7025 0.9206 1.4089 1.5820 1.8080 2.0832 2.3577 2.5300 
+0.2250 0.3434 0.4808 0.6721 0.8198 1.1446 2.0201 2.2625 2.5520 2.7604 
+0.1671 0.2551 0.4603 0.6777 0.9661 1.5579 1.8659 2.1196 2.4425 2.6551 
+0.3910 0.5877 1.0287 1.3547 1.6899 1.9166 2.1451 2.3337 2.5519 2.7071 
+0.1435 0.2165 0.3968 0.8376 1.2572 1.5298 1.8791 2.1352 2.4636 2.7011 
+0.1756 0.2799 0.4120 0.5808 0.7573 1.3340 1.8235 2.1200 2.4993 2.7365 
+0.1332 0.2174 0.4716 0.9483 1.2723 1.6028 1.9272 2.2190 2.5588 2.7990 
+0.2122 0.3143 0.7042 0.8849 1.1312 1.3711 1.6832 1.9633 2.2685 2.5156 
+0.2089 0.3339 0.4817 0.8526 1.0657 1.2741 1.5747 1.8000 2.4860 2.6843 
+0.1636 0.2617 0.4400 0.7357 1.0355 1.2638 1.5672 1.8504 2.1904 2.6588 
+0.1945 0.2934 0.4869 0.8567 1.1262 1.3604 1.6898 1.9143 2.1475 2.3503 
+0.1606 0.2442 0.3931 0.9237 1.5811 1.7529 2.0133 2.2272 2.5250 2.7265 
+0.4866 0.7045 1.0593 1.2795 1.5326 1.8221 2.1461 2.3665 2.6041 2.7599 
+0.4012 0.4911 0.7103 0.8585 1.0495 1.7244 2.0116 2.2041 2.5189 2.6643 
+0.4365 0.6694 0.8644 1.1330 1.4510 1.7627 2.1032 2.3690 2.6280 2.8306 
+0.2072 0.4018 0.6227 0.8913 1.3038 1.6056 1.9704 2.2816 2.6135 2.8182 
+0.3302 0.4968 0.8713 1.0761 1.2576 1.4654 1.8152 2.1400 2.5404 2.7493 
+0.1385 0.2292 0.3530 0.6006 1.4699 1.6571 1.9438 2.1663 2.5027 2.7308 
+0.1894 0.2915 0.4345 0.6341 1.0024 1.1896 1.6896 2.0966 2.4086 2.6768 
+0.3841 0.5197 0.8889 1.1480 1.4383 1.6285 1.8642 2.0669 2.3466 2.5325 
+0.2008 0.3097 0.4664 0.6638 1.2798 1.4940 1.7270 2.0264 2.2915 2.4750 
+0.1864 0.2857 0.4481 1.1025 1.3096 1.5035 1.7614 1.9891 2.4255 2.6031 
+0.4081 0.6134 0.9514 1.1818 1.3943 1.6361 1.9891 2.2395 2.5547 2.7287 
+0.2964 0.3876 0.9450 1.2247 1.3906 1.5882 1.8241 2.0589 2.4188 2.5871 
+0.3127 0.4038 0.6168 1.0810 1.3067 1.4759 1.8817 2.0781 2.3394 2.5539 
+0.2066 0.3059 0.4989 0.7132 0.9066 1.4460 1.7584 1.9755 2.2210 2.4741 
+0.2634 0.3956 0.5667 0.8777 1.0517 1.6029 2.0590 2.2607 2.6064 2.7647 
+0.4331 0.5315 0.7764 1.0444 1.2269 1.4311 1.7093 1.9187 2.4337 2.6149 
+0.2161 0.4429 0.6851 0.8336 1.1037 1.2966 1.5283 2.0299 2.3407 2.5384 
+0.2814 0.3637 0.5416 0.9475 1.5137 1.6945 1.8892 2.1017 2.3190 2.5007 
+0.4454 0.6883 1.1402 1.4098 1.7435 2.0014 2.2521 2.4457 2.6495 2.7985 
+0.1641 0.4083 0.6426 1.0592 1.3258 1.5754 1.8666 2.1381 2.4572 2.7177 
+0.3391 0.4607 0.6072 0.8463 1.4207 1.6062 1.8303 2.0887 2.3615 2.5348 
+0.2414 0.3396 0.5100 0.7470 1.3329 1.8618 2.0751 2.2564 2.5147 2.6874 
+0.1694 0.2535 0.4156 0.8302 1.2853 1.5838 2.0907 2.3085 2.5929 2.7951 
+0.2047 0.3652 0.6500 0.8068 1.0178 1.1865 1.4889 2.0671 2.5966 2.7634 
+0.2425 0.3247 0.6020 1.2226 1.4272 1.5996 1.8377 2.0413 2.5333 2.7021 
+0.3842 0.5030 0.6541 0.8771 1.0576 1.2612 1.6744 1.8735 2.4781 2.6803 
+0.2042 0.3280 0.7283 0.8985 1.1444 1.3299 1.6032 2.1539 2.4739 2.6547 
+0.1268 0.1924 0.3208 0.5153 1.1304 1.4443 1.8047 2.0552 2.4385 2.7572 
+0.2713 0.3659 0.5395 1.0705 1.4228 1.5836 1.9763 2.1641 2.4459 2.6301 
+0.3047 0.4043 0.5727 0.7368 0.8997 1.3242 1.6473 1.8879 2.4330 2.6295 
+0.1224 0.3948 0.6903 0.9199 1.2852 1.5516 1.8645 2.1231 2.4657 2.7044 
+0.2157 0.3281 0.5036 0.9272 1.0975 1.5285 1.8080 2.0569 2.5448 2.7221 
+0.1670 0.2490 0.3696 0.5921 1.3019 1.8398 2.2165 2.3725 2.6142 2.8338 
+0.3899 0.5573 0.8100 1.0732 1.3966 1.6598 2.0001 2.2517 2.5548 2.7403 
+0.4905 0.6064 0.8222 0.9966 1.1912 1.5714 1.9628 2.1727 2.5300 2.7055 
+0.1309 0.2342 0.6232 0.8795 1.1283 1.3655 1.7371 2.0251 2.3992 2.6885 
+0.1805 0.2672 0.4297 1.2440 1.4967 1.6796 1.9592 2.1784 2.5439 2.7289 
+0.2280 0.5429 0.6967 0.8732 1.4074 1.6074 1.9516 2.2124 2.5486 2.7722 
+0.2339 0.3379 0.4924 0.9061 1.3074 1.4719 1.8884 2.1110 2.3618 2.5545 
+0.1384 0.2291 0.5127 1.0450 1.4017 1.7884 2.1134 2.3664 2.6588 2.8435 
+0.2196 0.6359 0.9100 1.2007 1.4589 1.7053 2.0128 2.2722 2.5520 2.7643 
+0.1698 0.2615 0.3810 0.5706 1.4297 1.8686 2.0728 2.2559 2.4860 2.6701 
+0.1445 0.2158 0.3658 0.5451 0.9389 1.3669 1.7900 2.0846 2.3924 2.7161 
+0.2789 0.3816 0.5277 0.8487 1.3751 1.5461 1.7832 2.0264 2.2695 2.4665 
+0.1733 0.3023 0.9216 1.2368 1.4776 1.7229 1.9952 2.2471 2.5390 2.7265 
+0.3374 0.5033 1.0951 1.3262 1.5284 1.7336 1.9733 2.2009 2.4992 2.6751 
+0.1293 0.2743 0.7533 1.0166 1.2416 1.4444 1.7962 2.0851 2.4770 2.7204 
+0.3106 0.4176 0.6358 0.9434 1.1419 1.3458 1.9638 2.1678 2.4390 2.6235 
+0.4533 0.5760 0.7392 0.9136 1.0829 1.2759 1.7903 2.0360 2.3124 2.5325 
+0.3702 0.5218 0.6977 0.8776 1.1096 1.2855 1.5612 1.9480 2.2170 2.4361 
+0.1637 0.2647 0.4185 0.6666 1.1584 1.3270 1.7829 1.9821 2.4361 2.7094 
+0.1769 0.2767 0.3942 0.5746 1.3595 1.7110 1.9176 2.1405 2.3722 2.5705 
+0.2712 0.3820 0.6524 0.8317 1.0341 1.3972 1.7312 1.9918 2.3854 2.5886 
+0.1003 0.2046 0.7261 1.1004 1.4057 1.6697 1.9903 2.2603 2.5813 2.8009 
+0.2534 0.3752 0.7192 0.9323 1.3698 1.5955 1.8653 2.0656 2.3368 2.5340 
+0.3589 0.4508 0.6631 1.0521 1.5065 1.6697 1.8929 2.1074 2.3466 2.5242 
+0.1955 0.2862 0.6111 0.8053 1.0501 1.5218 1.7996 2.0303 2.3788 2.5973 
+0.2982 0.4033 0.5660 0.8924 1.1933 1.3465 1.7895 2.0173 2.2606 2.5069 
+0.3356 0.4711 0.6310 0.8491 1.0049 1.4364 1.8176 2.0292 2.5710 2.7525 
+0.2016 0.2912 0.4363 0.9800 1.4897 1.6494 1.8862 2.0819 2.3636 2.6091 
+0.4549 0.6491 0.8450 1.0209 1.1747 1.3745 1.8824 2.1130 2.3760 2.5768 
+0.2510 0.3524 0.5171 0.8931 1.4094 1.5710 1.8536 2.0478 2.4766 2.7320 
+0.1576 0.2547 0.3891 0.8551 1.4282 1.5880 1.8583 2.0521 2.5359 2.7340 
+0.3481 0.4382 0.7720 1.1289 1.3203 1.5019 1.7665 1.9570 2.2231 2.4465 
+0.3116 0.4068 0.6991 0.8894 1.0912 1.5356 1.8084 2.0006 2.2323 2.4367 
+0.2706 0.4033 0.8272 1.0851 1.4820 1.6927 1.9292 2.1267 2.4049 2.5857 
+0.2745 0.3550 0.8663 1.3742 1.5545 1.7324 1.9664 2.1538 2.4581 2.6245 
+0.1736 0.2553 0.5357 0.9009 1.1888 1.5132 1.8579 2.1181 2.4273 2.6847 
+0.3026 0.4148 0.9044 1.1695 1.3657 1.7036 1.9891 2.2226 2.5441 2.7085 
+0.3998 0.5108 0.7205 0.9848 1.1828 1.3716 1.7154 1.9191 2.1875 2.4257 
+0.2141 0.3095 0.7428 1.0426 1.2851 1.5571 1.7901 1.9804 2.2462 2.5265 
+0.1574 0.2290 0.3869 0.5735 1.0925 1.3383 1.6598 1.9364 2.2095 2.4195
diff --git a/codec2/tags/0.4/src/codebook/lspvqanssi2.txt b/codec2/tags/0.4/src/codebook/lspvqanssi2.txt
new file mode 100644 (file)
index 0000000..1ecd602
--- /dev/null
@@ -0,0 +1,129 @@
+10 128
+0.0120 0.0022 0.0068 -0.0112 -0.0508 -0.0490 0.2249 0.1476 0.0133 -0.0379 
+0.0598 0.0477 0.0380 0.0660 0.0517 0.0150 0.0617 0.0081 -0.0768 -0.1007 
+-0.0087 -0.0440 0.0873 0.0882 0.0391 -0.0060 0.1100 0.0569 -0.0241 -0.0468 
+0.0146 -0.0005 0.0322 -0.0650 -0.0778 -0.0780 -0.0255 -0.0527 -0.0301 -0.0401 
+-0.0240 -0.0560 -0.0374 0.0274 0.0484 -0.0227 0.0328 0.1135 0.0117 -0.0300 
+-0.0324 -0.0574 0.0302 0.0137 -0.0603 -0.1194 -0.0105 -0.0513 0.0698 0.0538 
+0.0635 0.0382 0.0531 0.0897 0.0495 0.0039 -0.0421 -0.0919 0.0407 0.0167 
+0.0954 0.0854 0.0360 -0.0025 -0.0252 -0.0528 -0.0435 -0.0561 -0.0405 -0.0432 
+0.0110 -0.0010 -0.0433 -0.0167 0.1402 0.0738 0.0423 -0.0024 -0.0920 -0.1099 
+0.0179 0.0184 -0.0041 -0.0640 0.1004 0.0608 -0.0023 -0.0357 0.1509 0.1262 
+-0.0145 -0.0240 -0.0595 -0.1063 0.0597 -0.0040 -0.0886 0.1184 0.0380 0.0126 
+-0.0072 0.0172 0.0076 0.0288 0.0810 0.0278 0.0709 0.0051 0.0214 -0.0301 
+0.0127 -0.0126 -0.0434 0.1610 0.1178 0.0704 0.0257 -0.0073 -0.0425 -0.0610 
+-0.0165 -0.0369 -0.0785 0.1007 0.0309 -0.0651 0.0142 -0.0614 0.0426 0.0289 
+-0.0374 -0.0712 0.0049 -0.0382 0.0472 0.0095 -0.0268 -0.0747 -0.0457 -0.0758 
+-0.0211 -0.0432 -0.0547 -0.0446 -0.1078 0.0090 -0.0565 -0.1298 0.0721 0.0351 
+-0.0014 -0.0072 -0.0283 -0.0324 -0.0208 -0.0703 0.0979 0.0865 -0.0007 0.1881 
+-0.0077 -0.0302 0.1231 0.0905 0.0786 0.0432 -0.0286 -0.0661 -0.0055 -0.0275 
+0.0010 0.0043 0.0044 0.0380 -0.1201 -0.0098 -0.0166 0.0105 0.0153 0.0134 
+0.0843 0.0636 0.0416 -0.0004 -0.0570 -0.0592 0.1158 0.0590 0.0126 0.0034 
+0.0346 0.0290 -0.0037 -0.0026 -0.0457 0.1824 0.1469 0.0870 0.0291 -0.0074 
+0.0066 0.0682 -0.0148 0.0287 0.0095 -0.0563 0.1296 0.0426 0.1215 0.0886 
+-0.0132 -0.0399 0.0960 0.0474 0.0140 0.0306 -0.0192 -0.0703 -0.1559 -0.1556 
+-0.0600 0.0482 0.1257 0.0521 0.0229 -0.0031 0.0817 0.0571 -0.0138 -0.0277 
+0.0013 -0.0103 -0.0470 -0.0687 -0.1444 0.0181 0.1350 0.0559 -0.0177 -0.0598 
+-0.0215 -0.0318 -0.0689 -0.0268 0.0917 0.0307 0.0135 -0.0184 -0.0857 0.1231 
+0.0137 -0.0152 0.0199 -0.0291 -0.0685 0.0438 -0.1137 0.0231 -0.0632 -0.0802 
+-0.0011 0.0314 0.0535 -0.0135 -0.0291 -0.0579 -0.1049 0.0288 -0.0628 0.1355 
+-0.0901 0.0041 -0.0170 0.0351 0.0144 -0.0505 0.0396 0.0638 -0.0145 0.0141 
+-0.0400 -0.0603 -0.0714 0.0329 -0.0049 -0.0529 -0.1251 0.0022 -0.0449 -0.0778 
+0.0247 0.0296 0.0239 0.0122 -0.0348 -0.1224 -0.0033 0.1237 -0.0016 -0.0436 
+0.0246 0.0050 0.0322 0.0818 0.0203 0.0846 0.0022 0.0876 0.0149 -0.0184 
+-0.0204 -0.0228 0.0365 -0.0164 0.1087 0.0374 -0.0550 0.0330 -0.0582 -0.0736 
+-0.0305 -0.0485 -0.0572 0.0275 -0.0271 -0.0436 0.1217 0.0700 0.1253 0.0990 
+-0.0079 -0.0204 -0.0325 0.0491 0.0158 -0.0365 -0.1309 -0.1812 0.1428 0.1148 
+0.0680 0.0547 0.0309 0.0079 -0.0332 0.0391 -0.0287 0.1258 0.1123 0.1016 
+-0.0264 -0.0409 -0.0538 -0.0192 -0.0393 -0.0713 -0.0618 -0.1078 -0.1850 0.0532 
+0.0081 -0.0115 -0.0090 0.1201 -0.0413 -0.0995 0.0445 -0.0032 -0.0286 -0.0497 
+-0.0023 -0.0184 -0.0358 0.1279 0.0847 0.0530 0.0230 -0.0212 0.1245 0.0965 
+0.0111 0.1038 0.0597 0.0413 0.0533 0.0011 0.0031 0.0705 0.0242 0.0198 
+0.0020 -0.0071 -0.0262 -0.0496 -0.0750 -0.1273 -0.1785 0.0606 -0.0223 -0.0583 
+-0.0202 0.0669 0.0081 0.0335 -0.0218 -0.1073 -0.0146 -0.0673 0.0490 0.0210 
+-0.0108 -0.0230 -0.0614 -0.0986 0.0629 0.0006 0.1496 0.1099 0.0316 0.0098 
+-0.0368 -0.0685 0.0138 -0.0213 -0.0009 0.0344 -0.0249 0.0311 0.0803 0.0759 
+0.0038 -0.0158 0.0142 0.0254 0.0970 0.0021 -0.1029 0.0006 0.0576 0.0261 
+-0.0083 0.0698 0.0406 -0.0348 0.0200 0.0833 0.0186 -0.0145 -0.0725 -0.0872 
+-0.0506 -0.0673 0.0776 -0.0172 -0.0444 -0.0531 -0.0799 0.0005 -0.0359 -0.0446 
+0.0368 0.0376 -0.0407 -0.0190 0.0987 0.0212 -0.0349 -0.0951 -0.0084 -0.0342 
+-0.0309 -0.0561 0.0950 -0.0125 -0.1028 -0.0133 0.0920 0.0965 0.0668 0.0409 
+-0.0898 0.0036 -0.0353 -0.0024 -0.0365 -0.0259 -0.0485 -0.0843 -0.0063 -0.0167 
+-0.0255 -0.0407 -0.0456 -0.0931 -0.0892 -0.0293 -0.0510 0.0183 -0.0104 0.0472 
+-0.0172 -0.0399 -0.0731 0.0546 0.0320 -0.0283 0.0415 -0.0107 -0.1237 -0.1102 
+0.0210 0.0294 -0.0038 -0.0090 -0.0551 -0.0922 0.0261 -0.0334 -0.1181 -0.1536 
+0.0092 0.0032 -0.0162 0.0398 0.0205 0.1266 -0.0107 -0.0858 0.0392 0.0032 
+-0.0038 -0.0269 -0.0737 0.1138 0.0263 -0.0031 -0.1188 0.1621 0.0831 0.0526 
+0.0023 -0.0149 -0.0497 0.0898 0.0456 -0.0145 -0.0928 -0.1507 -0.0611 -0.0938 
+0.0120 0.0124 -0.0286 -0.1319 0.0219 0.0311 -0.0398 -0.0465 -0.0008 -0.0375 
+0.0138 0.0023 0.0024 0.1072 0.0531 0.0006 0.0292 -0.0115 -0.0620 0.1650 
+0.0070 -0.0251 0.0715 0.0380 -0.0404 0.1230 0.0629 0.0096 0.0973 0.0641 
+-0.0586 0.0772 0.0128 0.1060 0.0715 0.0374 -0.0074 -0.0365 -0.0543 -0.0489 
+-0.0392 0.0871 -0.0069 -0.1084 0.0264 -0.0495 0.0396 0.0005 -0.0293 -0.0240 
+-0.0327 0.0605 0.0662 0.0100 -0.0007 -0.0525 -0.0812 -0.0686 -0.0873 -0.0830 
+0.0119 0.0058 0.0030 -0.0307 0.0650 0.0175 -0.0741 -0.1500 -0.1947 0.0881 
+0.0572 0.0411 0.0152 -0.0127 -0.0589 -0.0510 -0.0212 -0.0834 0.1434 0.1318 
+0.0518 0.0417 -0.0430 0.0963 -0.0014 0.0173 0.0234 -0.0273 0.0359 -0.0118 
+0.0652 0.0587 0.0013 -0.0700 0.1262 0.0975 0.0680 0.0598 0.0048 -0.0305 
+-0.0185 -0.0440 0.1178 0.0656 0.0052 -0.0534 -0.1151 0.1116 0.0659 0.0344 
+0.0788 0.0577 0.0452 0.0283 -0.0278 0.0911 0.0280 -0.0254 0.0029 -0.0361 
+-0.0165 -0.0322 -0.0526 -0.1057 0.0927 0.0293 -0.1026 -0.1671 0.0470 0.0355 
+0.0100 0.0001 -0.0221 -0.0775 -0.1109 -0.1416 0.0884 0.0441 0.0632 0.0409 
+0.0204 0.0432 0.0141 -0.0296 0.1073 0.0580 0.0383 0.0270 -0.0857 0.1246 
+0.0488 0.0231 0.0648 -0.0179 0.0747 0.0156 -0.0384 -0.0733 -0.0732 -0.0970 
+0.0005 -0.0199 -0.0260 -0.0511 -0.1110 0.0670 -0.0413 0.1571 0.0498 0.0191 
+0.0037 -0.0085 -0.0796 0.0086 -0.0852 0.0850 0.0115 -0.0065 0.1161 0.0727 
+0.0023 0.0483 0.0285 -0.0642 -0.0477 0.0175 0.0346 0.0452 0.0655 0.0284 
+-0.0986 0.0463 0.0326 -0.0055 0.0702 0.0194 -0.0423 -0.0107 0.0338 0.0619 
+0.0126 -0.0138 -0.1115 0.0159 -0.0331 0.0217 -0.0376 -0.0407 -0.0222 -0.0503 
+0.0222 0.0071 -0.0490 0.1017 0.0551 -0.0164 0.1578 0.1059 0.0025 -0.0107 
+0.0124 -0.0090 0.0322 0.0930 0.0281 -0.0403 -0.0781 0.0125 -0.0670 -0.1058 
+0.0363 0.0077 0.1052 0.0039 0.0676 0.0891 0.0433 0.0252 0.0224 -0.0043 
+-0.0045 -0.0194 -0.0193 -0.0480 -0.0640 -0.0695 -0.1597 -0.0030 0.1728 0.1231 
+0.0297 0.0025 0.0619 -0.0347 -0.1171 0.1043 0.0868 0.0191 -0.0739 -0.1075 
+0.0073 0.0914 0.0367 -0.0236 0.0232 0.0304 -0.0787 -0.1099 0.0460 0.0082 
+0.0296 0.0297 -0.0444 0.0184 0.0602 -0.0295 -0.0934 0.0636 -0.0347 -0.0722 
+-0.0290 -0.0629 0.0598 0.0013 0.0064 0.1431 0.0920 0.0468 -0.0311 -0.0614 
+-0.0152 -0.0311 -0.0500 -0.0672 -0.1257 -0.0134 -0.0220 -0.0612 -0.1131 -0.1417 
+0.0371 0.0153 -0.0817 -0.0007 0.0837 0.0481 0.0460 0.0678 0.0524 0.0432 
+0.0126 -0.0069 -0.0092 -0.0693 -0.0250 0.1510 0.0098 -0.0683 -0.0566 -0.0769 
+-0.0199 -0.0423 0.0806 0.0562 0.0009 -0.0563 -0.1358 -0.1578 -0.0456 0.0032 
+0.0091 0.0101 -0.0090 -0.0279 -0.0489 -0.1038 -0.0815 0.2184 0.1172 0.0902 
+-0.0024 -0.0135 0.0392 0.0028 0.0792 0.0404 0.0867 0.1610 0.0954 0.0846 
+-0.0004 -0.0220 -0.0282 -0.1022 -0.0799 0.1278 0.0765 0.0402 0.0850 0.0611 
+0.0443 0.0320 -0.0384 -0.0964 0.0030 -0.0398 -0.0730 -0.0052 -0.0267 0.1209 
+-0.0706 0.1151 0.0722 -0.0175 -0.0927 -0.0559 0.0316 0.0186 0.0105 0.0314 
+-0.0145 -0.0263 -0.0564 0.0248 -0.0181 -0.0817 -0.0938 0.0366 -0.0315 0.1253 
+0.0307 0.0039 0.1290 0.0402 -0.0439 -0.0384 0.0044 -0.0177 -0.0172 -0.0310 
+0.0447 0.0298 0.0287 0.0273 -0.0350 -0.0708 -0.1829 -0.0317 0.0643 0.0057 
+-0.0820 -0.0326 0.0209 -0.0711 0.0084 0.0111 0.0426 0.0262 -0.0061 0.0005 
+0.0545 0.0377 -0.0417 -0.0625 0.0114 -0.0405 0.0573 0.0191 -0.0263 -0.0472 
+-0.0053 -0.0049 -0.0255 -0.0578 -0.0237 -0.0721 -0.1487 -0.1636 0.0046 -0.0355 
+0.0309 0.0107 0.0163 0.0132 -0.0536 -0.0009 -0.0706 -0.1350 -0.0514 -0.0960 
+0.0306 0.0003 0.0494 0.0701 0.0027 -0.0458 0.0780 0.0327 0.0937 0.0605 
+-0.0017 -0.0275 0.0797 -0.0268 -0.1014 0.0593 -0.0528 -0.1103 0.0682 0.0322 
+-0.0507 -0.0806 -0.0646 -0.0052 -0.0576 0.0451 0.0489 0.0150 0.0029 -0.0189 
+0.0270 0.0143 -0.0375 -0.0071 -0.0607 -0.1157 -0.0345 -0.1115 0.0201 -0.0104 
+-0.0807 -0.1088 0.0845 0.0720 0.0441 0.0301 0.0043 0.0052 0.0016 0.0201 
+-0.0290 -0.0532 0.0036 -0.0201 -0.0723 -0.1321 0.0867 0.0479 -0.0556 -0.0850 
+-0.0271 0.0126 0.1283 0.0533 -0.0030 -0.0352 -0.0326 -0.0553 0.1402 0.1121 
+-0.0358 -0.0518 -0.1080 0.0134 0.0950 0.0384 -0.0040 -0.0254 0.0026 -0.0217 
+-0.0152 -0.0375 -0.0827 0.0916 0.0188 0.1306 0.0983 0.0606 0.0381 0.0080 
+-0.0107 -0.0269 -0.0573 -0.1189 0.0258 0.1009 0.0565 0.0270 -0.0557 -0.0778 
+-0.0193 -0.0242 -0.0784 -0.0816 0.0287 -0.0484 0.0292 -0.0414 0.1124 0.0767 
+0.0177 -0.0148 0.0472 -0.0808 0.0623 -0.0636 0.0750 -0.0107 0.0673 0.0425 
+-0.0220 0.0577 -0.0769 -0.0247 -0.0321 0.0341 -0.0108 0.0109 -0.0142 0.0122 
+0.0194 0.0248 -0.0096 -0.0205 -0.0460 -0.1160 0.0492 -0.0188 -0.1535 0.0816 
+0.0301 -0.0286 -0.0077 -0.0117 -0.0036 -0.0026 0.0133 -0.0032 0.0007 -0.0160 
+0.0115 -0.0111 0.0246 -0.0639 0.0325 -0.0313 0.0808 0.0435 -0.0777 -0.1108 
+-0.0079 -0.0334 -0.0144 -0.0539 0.1564 0.1175 0.0549 0.0340 0.0319 0.0027 
+-0.0155 -0.0275 -0.0739 -0.0932 0.0108 -0.0698 0.0036 -0.0213 -0.0486 -0.0670 
+-0.0234 -0.0567 0.0020 0.0908 -0.0151 0.0460 -0.0175 -0.0523 0.0098 -0.0237 
+0.0057 -0.0066 -0.0418 0.0418 -0.0449 0.1069 0.0629 -0.0016 -0.1068 -0.1492 
+-0.0791 0.0403 -0.0009 0.0285 -0.0065 0.0963 0.0550 0.0634 0.0693 0.0694 
+-0.0068 -0.0197 -0.0919 0.0071 -0.0551 -0.1173 0.0926 0.0413 0.0127 -0.0158 
+0.0540 0.0389 -0.0195 -0.0800 -0.1383 0.0440 -0.0139 -0.0405 0.0147 -0.0183 
+0.0380 0.0248 0.0520 -0.0609 0.0339 -0.0070 -0.0974 0.1182 0.0221 -0.0310 
+0.0043 0.0046 -0.0274 -0.0502 0.0326 -0.0143 -0.0586 -0.0866 -0.1673 -0.1624 
+0.0428 0.0385 -0.0228 0.0704 0.0069 -0.0145 -0.0623 -0.0639 -0.1479 0.0212 
+-0.0078 -0.0297 0.0025 -0.0239 -0.0793 0.0896 0.0315 -0.0546 -0.1309 0.1080
diff --git a/codec2/tags/0.4/src/codebook/lspvqanssi3.txt b/codec2/tags/0.4/src/codebook/lspvqanssi3.txt
new file mode 100644 (file)
index 0000000..f22ac5a
--- /dev/null
@@ -0,0 +1,65 @@
+10 64
+-0.0291 0.0272 -0.0364 -0.0313 -0.0487 -0.0205 0.0501 0.0225 0.0178 0.0080 
+-0.0406 -0.0383 0.0013 -0.0155 -0.0261 -0.0598 0.0003 -0.0242 0.0151 -0.0140 
+-0.0445 0.0356 0.0180 -0.0272 -0.0018 -0.0177 -0.0703 0.0471 0.0128 -0.0068 
+-0.0033 -0.0285 -0.0560 -0.0186 -0.0499 -0.0070 0.0068 -0.0126 0.0388 -0.0097 
+-0.0071 -0.0114 -0.0308 -0.0094 -0.0541 -0.0272 -0.0756 0.0477 -0.0234 0.0678 
+0.0048 0.0307 -0.0174 -0.0593 0.0097 -0.0134 0.0034 -0.0212 -0.0418 0.0869 
+-0.0189 0.0165 -0.0269 0.0744 0.0344 -0.0177 -0.0603 0.0212 -0.0104 0.0345 
+-0.0130 -0.0352 -0.0086 -0.0257 -0.0286 0.0409 0.0656 0.0106 -0.0598 0.0252 
+0.0041 0.0097 -0.0032 -0.0154 -0.0405 0.0670 -0.0164 0.0451 0.0774 0.0504 
+0.0010 -0.0091 -0.0345 0.0511 0.0016 0.0011 0.0684 0.0167 0.0601 0.0512 
+0.0204 -0.0038 -0.0426 0.0185 -0.0191 -0.0630 0.0295 -0.0153 -0.0559 0.0560 
+-0.0461 -0.0041 0.0515 0.0219 0.0322 0.0093 0.0044 0.0106 -0.0329 -0.0521 
+0.0304 0.0017 0.0209 -0.0002 0.0689 0.0136 0.0216 -0.0268 -0.0682 0.0333 
+-0.0175 -0.0425 0.0153 -0.0050 -0.0113 0.0297 -0.0659 -0.0344 0.0302 -0.0272 
+-0.0217 -0.0362 0.0426 0.0233 -0.0393 0.0052 0.0138 0.0657 0.0427 0.0220 
+-0.0039 -0.0011 -0.0002 -0.0453 -0.0835 0.0144 -0.0268 -0.0589 -0.0185 0.0133 
+0.0081 -0.0032 0.0638 0.0032 0.0060 0.0002 -0.0303 -0.0823 0.0124 -0.0308 
+0.0108 0.0011 0.0059 0.0396 0.0392 0.0351 -0.0045 -0.0323 -0.0512 -0.0975 
+-0.0144 -0.0306 -0.0302 -0.0070 0.0123 -0.0042 -0.0083 -0.0514 0.0120 0.1116 
+-0.0046 -0.0131 0.0472 0.0144 -0.0296 -0.0518 0.0337 -0.0145 -0.0733 0.0793 
+-0.0064 -0.0162 -0.0327 -0.0711 0.0108 -0.0131 0.0025 -0.0254 -0.0277 -0.0680 
+-0.0306 0.0055 0.0272 -0.0189 -0.0173 0.0221 0.0773 0.0043 0.0458 -0.0169 
+-0.0006 0.0299 0.0259 0.0227 -0.0530 -0.0596 -0.0271 -0.0091 0.0181 -0.0233 
+-0.0116 -0.0398 0.0089 0.0708 -0.0028 -0.0084 -0.0206 -0.0354 -0.0275 -0.0037 
+0.0259 -0.0064 -0.0380 0.0572 0.0083 0.0286 -0.0565 0.0158 0.0396 -0.0123 
+0.0552 0.0331 -0.0052 -0.0346 -0.0180 -0.0194 -0.0237 0.0184 0.0056 -0.0199 
+0.0143 0.0131 -0.0166 0.0196 0.0154 0.0310 -0.0048 0.0901 -0.0333 0.0761 
+0.0118 -0.0107 0.0099 0.0078 0.0002 -0.0716 -0.0233 0.0793 0.0516 0.0300 
+0.0204 0.0243 0.0192 0.0181 0.0001 -0.0243 -0.0764 -0.0622 -0.0324 0.0640 
+0.0132 0.0016 -0.0187 -0.0425 0.0627 0.0094 -0.0786 0.0304 0.0294 -0.0146 
+-0.0221 -0.0154 0.0285 -0.0709 0.0406 0.0114 0.0073 -0.0199 0.0081 0.0268 
+0.0227 0.0055 0.0163 -0.0447 0.0246 0.0795 0.0239 0.0211 -0.0145 -0.0576 
+-0.0119 0.0637 0.0278 0.0202 -0.0086 0.0389 0.0320 -0.0049 -0.0272 -0.0274 
+0.0040 -0.0211 0.0426 0.0480 0.0415 0.0659 0.0408 0.0198 0.0327 0.0029 
+0.0430 0.0311 0.0083 0.0353 0.0250 0.0143 0.0106 -0.0305 0.0633 0.0227 
+-0.0277 0.0302 0.0337 0.0176 0.0191 -0.0156 0.0231 0.0118 0.0465 0.0875 
+0.0221 0.0146 0.0147 -0.0211 -0.0317 -0.0179 -0.0049 -0.0297 -0.1078 -0.0413 
+-0.0531 0.0180 -0.0066 0.0365 -0.0033 0.0090 -0.0158 -0.0698 0.0315 -0.0048 
+0.0289 0.0053 0.0082 0.0077 -0.0664 0.0474 0.0407 -0.0096 0.0028 -0.0526 
+-0.0106 -0.0129 -0.0315 0.0335 -0.0217 -0.0427 0.0582 0.0193 -0.0288 -0.0777 
+-0.0003 -0.0141 -0.0102 0.0007 -0.0077 -0.0517 -0.0909 0.0128 -0.0349 -0.0769 
+-0.0227 -0.0159 -0.0327 0.0011 0.0312 0.0100 -0.0180 -0.0537 -0.0997 0.0122 
+0.0190 -0.0139 0.0341 -0.0131 -0.0368 -0.0138 -0.0074 -0.0415 0.0791 0.0503 
+0.0182 0.0027 0.0032 -0.0325 -0.0309 -0.0898 0.0509 -0.0170 0.0301 -0.0137 
+0.0233 0.0100 0.0231 0.0730 0.0212 -0.0299 0.0440 0.0041 -0.0101 -0.0251 
+0.0074 -0.0033 -0.0285 -0.0350 0.0101 0.0735 0.0036 -0.0659 0.0429 -0.0052 
+0.0148 -0.0035 -0.0233 0.0079 -0.0142 -0.0402 -0.0358 -0.0985 -0.0080 -0.0549 
+0.0203 0.0057 -0.0604 0.0098 0.0402 0.0151 0.0500 0.0058 -0.0086 -0.0401 
+0.0056 -0.0381 0.0420 -0.0125 0.0157 -0.0268 0.0433 0.0123 -0.0176 -0.0685 
+0.0030 0.0502 0.0067 -0.0222 0.0405 -0.0226 0.0020 -0.0401 -0.0026 -0.0521 
+0.0317 0.0089 0.0620 0.0251 0.0066 0.0089 -0.0565 0.0414 0.0005 -0.0365 
+-0.0058 0.0086 -0.0291 -0.0164 -0.0134 -0.0490 -0.0427 -0.0451 0.0869 0.0334 
+0.0024 0.0328 -0.0415 0.0003 -0.0287 0.0193 -0.0547 -0.0222 -0.0196 -0.0571 
+-0.0271 -0.0397 -0.0431 -0.0043 0.0332 0.0093 0.0082 0.0585 0.0282 0.0004 
+-0.0251 -0.0167 -0.0289 0.0196 -0.0363 0.0850 0.0028 0.0319 -0.0202 -0.0512 
+0.0389 0.0226 0.0401 -0.0091 -0.0152 0.0001 0.0738 0.0402 0.0097 0.0310 
+-0.0126 0.0130 -0.0046 -0.0216 0.0298 -0.0344 0.0713 0.0547 -0.0470 -0.0294 
+0.0125 0.0044 -0.0028 0.0209 -0.0200 0.0854 0.0018 -0.0386 -0.0703 0.0778 
+-0.0036 -0.0347 0.0309 -0.0184 0.0290 -0.0025 -0.0644 0.0347 -0.0523 0.0644 
+0.0064 0.0295 -0.0017 0.0282 0.0176 0.0027 0.0246 0.0967 0.0401 -0.0231 
+0.0054 -0.0109 0.0055 -0.0479 -0.0490 -0.0136 -0.0245 0.0839 0.0026 -0.0493 
+0.0128 -0.0050 -0.0219 -0.0621 0.0313 0.0019 0.0696 0.0459 0.0574 0.0299 
+-0.0091 -0.0290 -0.0068 0.0276 0.0645 -0.0150 0.0015 -0.0374 0.0415 -0.0124 
+-0.0171 0.0177 -0.0138 0.0034 0.0840 0.0584 0.0233 0.0100 0.0122 0.0047
diff --git a/codec2/tags/0.4/src/codebook/lspvqanssi4.txt b/codec2/tags/0.4/src/codebook/lspvqanssi4.txt
new file mode 100644 (file)
index 0000000..b5edc83
--- /dev/null
@@ -0,0 +1,65 @@
+10 64
+0.0221 -0.0035 -0.0032 -0.0177 -0.0327 0.0518 -0.0110 -0.0150 -0.0136 -0.0327 
+0.0099 -0.0059 0.0031 -0.0174 0.0464 -0.0240 0.0251 -0.0270 0.0454 -0.0082 
+-0.0029 0.0025 -0.0267 -0.0318 -0.0157 0.0173 0.0253 0.0063 -0.0481 0.0419 
+-0.0332 -0.0179 -0.0042 0.0241 0.0044 -0.0098 -0.0081 0.0024 -0.0414 0.0339 
+-0.0060 0.0182 -0.0051 -0.0479 0.0016 -0.0179 0.0316 0.0222 -0.0029 -0.0351 
+0.0074 0.0015 0.0337 -0.0082 -0.0008 0.0129 0.0001 0.0650 0.0175 0.0309 
+-0.0212 -0.0261 0.0196 -0.0309 0.0093 -0.0272 0.0260 0.0169 0.0132 0.0116 
+-0.0010 0.0202 0.0228 -0.0227 -0.0141 0.0192 -0.0423 -0.0097 -0.0342 0.0338 
+-0.0149 -0.0110 -0.0156 0.0290 0.0028 0.0123 -0.0350 -0.0501 0.0272 -0.0245 
+-0.0005 -0.0194 0.0460 -0.0001 -0.0280 0.0216 -0.0028 -0.0162 0.0177 -0.0254 
+-0.0109 -0.0026 0.0038 -0.0150 -0.0421 -0.0422 0.0164 -0.0436 0.0054 -0.0098 
+0.0061 -0.0106 0.0062 0.0207 -0.0329 0.0177 -0.0578 0.0408 0.0077 -0.0260 
+0.0001 -0.0098 0.0106 -0.0003 -0.0292 0.0032 0.0560 0.0311 -0.0282 -0.0445 
+0.0033 0.0345 -0.0022 -0.0029 -0.0228 0.0242 0.0197 -0.0286 0.0194 -0.0328 
+0.0094 -0.0010 0.0121 0.0229 0.0161 0.0363 -0.0124 0.0179 -0.0626 0.0020 
+-0.0070 -0.0272 -0.0171 -0.0249 -0.0039 0.0254 0.0317 -0.0324 0.0276 -0.0090 
+-0.0002 0.0057 -0.0204 0.0512 -0.0170 0.0113 0.0157 0.0427 -0.0024 0.0162 
+-0.0064 -0.0144 0.0216 0.0053 -0.0361 0.0287 0.0230 -0.0161 -0.0189 0.0589 
+0.0091 -0.0059 -0.0308 0.0171 -0.0137 -0.0033 -0.0505 -0.0155 -0.0527 0.0133 
+-0.0121 -0.0051 0.0219 0.0136 0.0476 -0.0090 -0.0460 0.0208 0.0072 -0.0076 
+0.0098 -0.0328 -0.0211 0.0054 -0.0146 -0.0263 0.0248 0.0045 -0.0183 0.0301 
+0.0101 0.0139 -0.0073 0.0234 0.0083 -0.0194 -0.0365 0.0307 0.0580 0.0153 
+-0.0111 0.0019 0.0265 -0.0150 0.0311 0.0362 0.0244 -0.0213 -0.0224 -0.0299 
+0.0061 0.0082 -0.0181 0.0081 -0.0344 0.0133 -0.0095 -0.0411 0.0462 0.0371 
+0.0089 -0.0157 0.0179 -0.0256 -0.0118 -0.0302 -0.0329 0.0212 -0.0463 -0.0162 
+-0.0313 0.0096 -0.0040 0.0186 0.0248 -0.0126 0.0472 -0.0079 0.0115 -0.0270 
+0.0055 0.0044 0.0172 0.0079 -0.0089 -0.0202 -0.0233 -0.0397 -0.0305 -0.0620 
+-0.0282 -0.0104 -0.0071 -0.0242 -0.0255 0.0204 -0.0187 -0.0103 -0.0227 -0.0424 
+-0.0056 0.0065 0.0151 -0.0376 0.0039 0.0009 -0.0507 -0.0040 0.0393 -0.0201 
+0.0128 -0.0228 0.0115 -0.0446 0.0316 0.0266 -0.0036 0.0117 -0.0009 0.0048 
+-0.0088 0.0226 0.0125 0.0090 0.0008 -0.0341 0.0243 -0.0178 -0.0589 0.0278 
+0.0151 0.0021 -0.0349 -0.0365 -0.0098 -0.0179 -0.0212 -0.0313 0.0109 -0.0164 
+-0.0211 -0.0112 -0.0446 0.0014 -0.0034 -0.0179 0.0110 0.0176 0.0286 0.0045 
+0.0034 -0.0151 0.0380 0.0331 -0.0034 -0.0439 0.0145 0.0120 0.0036 0.0017 
+-0.0348 0.0192 0.0167 0.0069 -0.0266 -0.0085 -0.0076 0.0260 0.0234 0.0075 
+-0.0237 0.0150 -0.0094 -0.0201 0.0234 -0.0041 -0.0160 -0.0549 -0.0021 0.0239 
+-0.0019 0.0173 0.0295 0.0443 0.0081 0.0181 -0.0039 -0.0270 0.0155 0.0107 
+0.0065 -0.0055 -0.0368 0.0232 0.0370 0.0367 0.0046 -0.0167 0.0047 0.0173 
+0.0116 0.0053 -0.0229 0.0382 0.0160 -0.0453 0.0057 -0.0267 0.0020 -0.0051 
+-0.0140 0.0302 -0.0208 0.0106 0.0101 -0.0049 -0.0319 0.0227 -0.0206 -0.0371 
+-0.0007 -0.0109 -0.0053 0.0078 0.0410 -0.0001 0.0543 0.0328 -0.0196 0.0332 
+-0.0043 -0.0028 -0.0246 0.0285 -0.0248 0.0153 0.0303 -0.0310 -0.0335 -0.0315 
+-0.0417 0.1029 0.0377 0.0069 0.0012 0.0065 0.0007 -0.0144 -0.0083 0.0004 
+0.0295 0.0099 -0.0144 -0.0145 0.0141 -0.0013 0.0362 -0.0142 -0.0428 -0.0161 
+-0.0095 -0.0206 0.0116 0.0132 0.0164 0.0158 0.0012 -0.0024 0.0640 0.0364 
+0.0005 -0.0022 -0.0165 -0.0057 0.0263 0.0339 0.0014 0.0541 0.0164 -0.0411 
+0.0039 -0.0143 -0.0107 0.0032 -0.0160 -0.0502 0.0010 0.0272 0.0161 -0.0500 
+0.0083 0.0292 -0.0076 -0.0201 0.0313 0.0213 0.0120 0.0087 0.0285 0.0332 
+0.0170 0.0018 0.0001 0.0205 0.0106 -0.0064 -0.0082 -0.0083 -0.0082 0.0886 
+0.0075 -0.0078 -0.0038 -0.0337 -0.0491 0.0048 0.0069 0.0300 0.0369 0.0088 
+-0.0091 -0.0327 0.0041 0.0376 0.0170 0.0154 0.0126 0.0153 -0.0024 -0.0353 
+0.0289 -0.0080 0.0063 0.0274 -0.0061 0.0208 0.0390 -0.0060 0.0294 -0.0088 
+-0.0037 -0.0195 0.0058 0.0023 -0.0149 -0.0360 -0.0587 -0.0248 0.0288 0.0203 
+-0.0031 0.0081 -0.0112 -0.0221 0.0067 -0.0505 -0.0233 0.0353 -0.0131 0.0417 
+0.0243 0.0231 -0.0013 0.0049 -0.0423 -0.0245 -0.0029 0.0184 -0.0162 -0.0010 
+0.0045 0.0101 -0.0042 0.0014 -0.0133 -0.0321 0.0642 0.0153 0.0377 0.0277 
+0.0275 0.0083 0.0286 -0.0243 -0.0084 -0.0236 0.0027 -0.0289 0.0201 0.0235 
+0.0281 0.0078 0.0038 0.0069 0.0302 0.0170 -0.0423 -0.0340 0.0104 -0.0181 
+0.0334 -0.0034 -0.0257 -0.0061 0.0140 -0.0099 -0.0195 0.0529 0.0019 0.0010 
+-0.0114 0.0012 -0.0038 -0.0016 -0.0140 0.0697 0.0372 0.0243 0.0172 0.0066 
+0.0192 0.0149 0.0285 0.0077 0.0246 -0.0135 0.0145 0.0317 -0.0074 -0.0438 
+-0.0034 -0.0175 -0.0245 -0.0153 0.0357 -0.0102 -0.0062 -0.0053 -0.0308 -0.0499 
+0.0025 -0.0253 0.0148 0.0031 0.0189 -0.0023 -0.0085 -0.0596 -0.0337 0.0175 
+-0.0091 -0.0171 -0.0217 -0.0189 0.0056 0.0249 -0.0499 0.0236 0.0042 0.0449
diff --git a/codec2/tags/0.4/src/codebook/lspvqexp1.txt b/codec2/tags/0.4/src/codebook/lspvqexp1.txt
new file mode 100644 (file)
index 0000000..fe8faf6
--- /dev/null
@@ -0,0 +1,2049 @@
+10 2048
+0.408892 0.649827 0.954657 1.095560 1.374775 1.695544 2.186975 2.404129 2.599671 2.716599 
+0.206312 0.393044 0.534358 0.831490 0.964061 1.315881 1.711009 1.884982 2.656064 2.789476 
+0.294007 0.430921 0.584720 0.972610 1.346504 1.446720 1.672880 1.854151 2.292980 2.574467 
+0.130573 0.192259 0.568997 1.014611 1.204902 1.371336 1.696595 2.109828 2.488139 2.749404 
+0.119174 0.172048 0.555350 1.041664 1.294588 1.603976 1.924941 2.215881 2.537337 2.763865 
+0.264060 0.351222 0.551394 0.836209 0.955359 1.467373 1.883071 2.011362 2.370015 2.500936 
+0.206715 0.433527 0.682328 0.833734 1.164725 1.476463 1.775427 2.152234 2.639949 2.796348 
+0.211225 0.320307 0.437323 0.659797 1.492016 1.699378 1.859517 2.131810 2.328455 2.499706 
+0.480644 0.630950 0.822352 1.123960 1.461020 1.594792 1.889414 2.166284 2.404039 2.536132 
+0.233285 0.324869 0.445867 0.683777 0.826101 0.975483 1.764219 2.154061 2.334729 2.602314 
+0.315909 0.537121 0.711160 0.941341 1.178015 1.302627 1.643751 2.058463 2.464410 2.591263 
+0.245173 0.382524 0.532006 0.708503 1.236528 1.448436 1.777993 2.124256 2.306038 2.625603 
+0.245615 0.291619 0.819764 1.444781 1.578166 1.731349 2.095787 2.242522 2.603987 2.720052 
+0.173862 0.229815 0.418896 0.695378 0.931595 1.188532 1.820958 2.120767 2.330289 2.464753 
+0.303527 0.372419 0.740620 1.167964 1.327370 1.494681 1.784226 1.898711 2.311465 2.642713 
+0.259744 0.401730 0.575188 0.834348 1.431968 1.604358 1.798482 2.185462 2.402074 2.554969 
+0.337109 0.570466 1.175085 1.451610 1.761333 1.975735 2.126135 2.293190 2.536691 2.706431 
+0.367145 0.452099 0.647409 0.817255 0.902956 1.238037 1.825344 1.922997 2.436059 2.609846 
+0.378662 0.531818 0.674407 0.919671 1.409610 1.559852 1.771428 2.027114 2.253246 2.408198 
+0.163411 0.267202 0.378752 0.982090 1.260325 1.393847 1.801359 1.943528 2.730199 2.854737 
+0.315416 0.366274 0.657622 1.193970 1.448486 1.554740 1.791291 1.913099 2.285878 2.665674 
+0.182284 0.250810 0.478825 0.774649 1.250927 1.657871 1.857476 1.999098 2.286088 2.777030 
+0.280912 0.330939 0.631688 0.754025 0.941971 1.616999 1.814228 2.013341 2.634148 2.720386 
+0.197110 0.280354 0.442898 0.794104 1.537225 1.674591 1.953914 2.155343 2.626079 2.817453 
+0.324055 0.494234 0.849184 1.111214 1.388737 1.737885 1.975967 2.381772 2.611796 2.753205 
+0.249643 0.364552 0.527912 0.900747 1.026842 1.398842 1.869778 2.015830 2.450740 2.598903 
+0.210241 0.311192 0.495868 0.687507 1.152048 1.296946 1.520174 2.255285 2.440410 2.686456 
+0.159037 0.244226 0.385934 0.687847 1.072342 1.386804 1.785080 1.924100 2.533529 2.669124 
+0.234363 0.441050 0.678179 0.862648 1.224287 1.720752 1.949118 2.386935 2.642309 2.768447 
+0.177323 0.256095 0.417949 0.816232 1.042933 1.254927 1.618581 1.928664 2.118610 2.463463 
+0.247362 0.335496 0.753623 1.051947 1.239658 1.426773 1.621176 2.053494 2.480950 2.615165 
+0.156480 0.216035 0.368476 0.588087 1.238670 1.459124 1.827783 1.975080 2.316953 2.770680 
+0.198050 0.342316 0.883251 1.421788 1.645484 1.905948 2.140263 2.301866 2.620508 2.774812 
+0.257995 0.358680 0.537441 0.694512 0.824406 1.362975 1.764952 1.925331 2.486171 2.617074 
+0.252496 0.330798 0.493815 0.973920 1.306189 1.439735 1.920226 2.087274 2.257323 2.398019 
+0.165073 0.249466 0.371194 1.033936 1.278111 1.449107 2.046790 2.168316 2.497102 2.729474 
+0.351523 0.566840 0.885298 1.113196 1.285310 1.425799 1.728030 2.101425 2.514797 2.765585 
+0.247070 0.331460 0.517797 1.035640 1.189321 1.389341 1.740344 1.976250 2.202072 2.430856 
+0.250272 0.471488 0.632229 0.874364 1.003062 1.214226 1.782201 1.915722 2.618775 2.804373 
+0.178042 0.247938 0.413307 0.724804 1.348933 1.537515 2.114127 2.301885 2.636884 2.826241 
+0.321648 0.521672 0.933498 1.194774 1.582506 1.752098 1.962687 2.185410 2.511609 2.710750 
+0.189405 0.281558 0.405270 0.624133 0.831682 0.979077 1.773124 2.022636 2.231772 2.709233 
+0.338988 0.556585 0.722942 0.903725 1.137734 1.260460 1.698745 2.141650 2.342421 2.527244 
+0.283960 0.422437 0.547151 0.805702 1.347223 1.507695 1.702228 2.041553 2.221081 2.575186 
+0.116988 0.373808 0.677058 1.246354 1.579914 1.860096 2.174202 2.426485 2.666464 2.778514 
+0.172660 0.279061 0.420803 0.776647 1.027097 1.182553 1.880931 2.023781 2.400028 2.816622 
+0.244703 0.354981 0.775126 1.007264 1.208883 1.571339 1.920167 2.128560 2.418384 2.673311 
+0.277862 0.345899 0.491009 1.000182 1.668493 1.893737 2.024216 2.203943 2.418550 2.555188 
+0.200787 0.681282 1.126094 1.309507 1.738042 2.023257 2.342799 2.463428 2.602179 2.702804 
+0.223979 0.466963 0.728850 0.888776 1.090618 1.234456 1.705574 2.241550 2.510834 2.751795 
+0.264860 0.389642 0.536973 0.871669 1.323290 1.441181 1.682582 1.973355 2.163007 2.401176 
+0.254211 0.390772 0.549594 0.748576 1.280532 1.474290 1.636048 2.013508 2.479875 2.650004 
+0.191314 0.280703 0.420214 1.117728 1.347340 1.558388 1.722577 2.094362 2.606691 2.753977 
+0.152313 0.198389 0.337122 0.490241 1.023739 1.222176 1.581978 1.852165 2.361974 2.553970 
+0.343523 0.473063 0.661058 0.896926 1.009881 1.426789 2.003978 2.115197 2.358072 2.676757 
+0.225495 0.299263 0.443642 0.793508 1.407173 1.798104 2.159374 2.284811 2.501925 2.644715 
+0.220837 0.608771 0.967248 1.237940 1.450245 1.693405 2.002186 2.239767 2.534945 2.707207 
+0.290250 0.359912 0.599268 0.771394 0.922184 1.257421 2.137963 2.330228 2.526054 2.700371 
+0.269144 0.463439 0.625052 0.842594 1.239627 1.353331 1.687365 2.092062 2.284863 2.634475 
+0.170231 0.237346 0.408666 0.698347 1.146923 1.313417 1.753705 1.891356 2.401344 2.558038 
+0.171963 0.247483 0.388808 0.980638 1.502962 1.644121 1.955137 2.148787 2.393447 2.630021 
+0.209519 0.325681 0.464669 0.682705 1.111676 1.225834 1.824262 2.151181 2.384320 2.739424 
+0.210672 0.533806 0.825201 0.990473 1.145813 1.393566 1.999486 2.222956 2.524156 2.776040 
+0.261962 0.340226 0.472952 0.863674 1.443518 1.829669 1.994398 2.132878 2.355090 2.469655 
+0.340277 0.460050 0.748860 1.054174 1.614903 1.804636 1.993799 2.247318 2.473443 2.602200 
+0.239159 0.394343 0.578732 0.754990 0.941899 1.128161 1.620559 2.020968 2.585087 2.783718 
+0.269667 0.342100 0.485464 1.053892 1.413864 1.534461 1.740671 1.909701 2.286779 2.538869 
+0.076962 0.097269 0.408343 0.942043 1.237899 1.573872 1.883029 2.186618 2.520305 2.790522 
+0.170175 0.223705 0.651279 1.003661 1.370350 1.628746 1.941629 2.172624 2.450895 2.649955 
+0.219608 0.300784 0.472750 0.871097 1.064995 1.283347 1.869030 2.047338 2.234764 2.423176 
+0.283455 0.337982 0.663326 0.792275 0.925513 1.457560 1.740494 1.857127 2.583274 2.700391 
+0.199190 0.263142 0.443787 0.684379 1.185091 1.879212 2.080132 2.224038 2.427704 2.576557 
+0.219374 0.680594 0.965335 1.102093 1.296977 1.590756 2.074636 2.334754 2.586458 2.754939 
+0.198099 0.308630 0.432817 0.619556 0.754862 0.931998 1.549410 1.846704 2.294094 2.636366 
+0.338876 0.446352 0.640399 0.996449 1.224095 1.344627 1.695974 1.883015 2.104946 2.489100 
+0.166453 0.240154 0.399798 0.829295 1.305386 1.443374 1.723531 1.880577 2.379309 2.500316 
+0.244810 0.287547 0.565833 1.376218 1.610718 1.731021 2.128375 2.264382 2.552460 2.697921 
+0.203376 0.353110 0.454768 0.707277 0.892936 1.038801 1.609843 1.809379 2.065993 2.304645 
+0.392222 0.453261 0.813874 1.205541 1.320471 1.599816 1.858220 2.029353 2.491522 2.638332 
+0.269519 0.326891 0.470180 1.053385 1.538230 1.686468 1.865876 2.081763 2.229408 2.441901 
+0.463250 0.707535 1.093317 1.316217 1.598936 1.783637 1.982618 2.134436 2.396915 2.574501 
+0.234043 0.348930 0.473804 0.709797 1.030257 1.152835 1.749074 2.178802 2.334442 2.638112 
+0.356771 0.553522 0.702444 0.911763 1.372687 1.512426 1.716079 1.969296 2.175300 2.356841 
+0.215283 0.314571 0.448084 0.938241 1.488615 1.610559 1.858891 2.014800 2.487515 2.656114 
+0.255059 0.324128 0.591637 1.140724 1.280033 1.626440 1.845765 2.008493 2.607807 2.732065 
+0.190953 0.284283 0.446537 0.903721 1.083755 1.521604 1.865214 2.039362 2.398102 2.603527 
+0.218632 0.323425 0.485128 0.801138 0.934826 1.550687 1.950327 2.141484 2.437725 2.588421 
+0.240697 0.351397 0.469534 0.775124 1.406794 1.725183 1.871364 2.156495 2.381976 2.555115 
+0.355558 0.461716 0.684575 1.091512 1.719266 1.926216 2.051391 2.237427 2.507442 2.610706 
+0.160350 0.190000 0.366405 0.494497 0.868240 1.345426 1.566707 2.068702 2.335099 2.641913 
+0.219362 0.326275 0.619951 0.801217 1.176182 1.324616 1.567767 1.852718 2.393752 2.544625 
+0.242295 0.361032 0.536827 0.699045 1.264826 1.578333 1.777090 2.115510 2.587465 2.731970 
+0.185629 0.225499 0.394464 1.072663 1.725553 1.814897 2.037215 2.318703 2.570456 2.700776 
+0.199282 0.271847 0.427336 0.691175 0.936688 1.307560 1.755173 1.941991 2.180527 2.289541 
+0.440652 0.657600 0.846249 1.115177 1.383954 1.526095 1.839294 2.054337 2.261747 2.486134 
+0.254743 0.370981 0.519721 0.892661 1.365537 1.512546 1.867709 2.025821 2.338400 2.608154 
+0.374541 0.564001 1.042547 1.268517 1.427251 1.737400 2.240345 2.527386 2.748712 2.871518 
+0.163240 0.229374 0.631209 0.821347 1.079198 1.312352 1.847665 2.085082 2.462129 2.646514 
+0.257702 0.368235 0.785115 0.964453 1.130321 1.417415 1.830826 2.058137 2.393471 2.589613 
+0.195822 0.280922 0.414972 0.646213 1.237085 1.398279 1.830678 2.337509 2.561924 2.750149 
+0.302754 0.361163 0.751614 0.974525 1.131739 1.643605 1.825553 2.044086 2.641030 2.739994 
+0.235437 0.315967 0.652539 0.816752 1.083366 1.622892 1.852217 2.030423 2.192530 2.575813 
+0.291611 0.410807 0.602501 0.962264 1.083617 1.420033 1.771443 1.907873 2.445734 2.652716 
+0.189868 0.257547 0.397682 0.669228 1.309264 1.797630 1.994844 2.138696 2.608657 2.757821 
+0.479797 0.701925 0.989967 1.226383 1.556286 1.735962 2.055139 2.286164 2.529859 2.666528 
+0.215045 0.313827 0.431033 0.651895 0.829909 1.000831 1.815727 2.226013 2.392474 2.760351 
+0.306301 0.398661 0.653631 1.025764 1.189362 1.401036 1.898166 2.051914 2.236996 2.422421 
+0.167970 0.224219 0.368107 0.623431 1.201568 1.381682 1.762247 1.920037 2.113047 2.522470 
+0.185718 0.243656 0.376917 1.209258 1.581544 1.690223 2.033223 2.376102 2.591085 2.756869 
+0.147871 0.206576 0.362439 0.637580 0.940549 1.343574 1.621941 1.733152 1.946250 2.723886 
+0.324080 0.457905 0.793499 1.005600 1.260387 1.583156 1.886643 2.096396 2.372896 2.578810 
+0.226219 0.308328 0.636626 0.866278 1.534446 1.701010 1.887737 2.161067 2.358914 2.503200 
+0.606744 0.955507 1.338156 1.567438 1.821726 2.055362 2.279753 2.416922 2.604378 2.699013 
+0.246984 0.386718 0.502785 0.760434 1.042124 1.263722 1.435097 2.414889 2.724612 2.819326 
+0.292410 0.502940 0.672216 0.892183 1.209496 1.339252 1.760220 1.968766 2.362511 2.623487 
+0.143375 0.199091 0.483698 0.992064 1.214869 1.614010 1.832079 1.978488 2.281935 2.713930 
+0.266561 0.304298 0.533705 1.305138 1.580937 1.665891 1.884884 2.014163 2.228380 2.568778 
+0.178658 0.231896 0.383912 0.540251 1.225283 1.458102 1.922772 2.083421 2.250593 2.408925 
+0.289292 0.350422 0.695339 0.839824 1.012699 1.582703 1.751493 2.110402 2.491079 2.602625 
+0.191978 0.275525 0.396619 0.582467 1.263497 1.658220 1.987982 2.164226 2.491219 2.655634 
+0.271271 0.427594 0.784469 1.094218 1.535344 1.895921 2.111855 2.328610 2.716413 2.835820 
+0.197072 0.315577 0.461034 0.771499 0.895098 1.249097 1.937811 2.117715 2.428590 2.608183 
+0.211338 0.407351 0.538840 0.766827 1.152593 1.246498 1.679320 1.905728 2.120349 2.677619 
+0.135615 0.163159 0.283783 0.431117 0.953107 1.462377 1.809595 2.130270 2.442565 2.743798 
+0.166707 0.238759 0.367497 0.902142 1.508106 1.650293 1.825543 1.979014 2.655324 2.825020 
+0.349277 0.540928 0.693205 0.826151 1.104738 1.259800 1.507300 2.094618 2.320842 2.523635 
+0.325055 0.432779 0.621749 1.070682 1.304776 1.457668 1.900591 2.027150 2.460400 2.683254 
+0.232534 0.355259 0.543295 0.744519 1.329342 1.648497 1.789282 2.116619 2.343387 2.501568 
+0.465485 0.876578 1.205981 1.371947 1.745534 1.938156 2.176847 2.328487 2.521049 2.656868 
+0.246604 0.364927 0.536848 0.850639 1.033582 1.224962 1.555694 1.725857 2.343766 2.568854 
+0.345140 0.476535 0.650548 0.994609 1.167264 1.343813 1.779614 1.923453 2.324548 2.609157 
+0.140607 0.199293 0.674213 0.958553 1.263430 1.520789 1.808626 2.055790 2.415260 2.705252 
+0.125913 0.381885 0.618365 0.994294 1.317324 1.547930 1.818095 2.158588 2.494214 2.751068 
+0.214195 0.320569 0.719851 0.846412 1.134388 1.428969 1.611410 2.041914 2.282243 2.508041 
+0.250098 0.404670 0.540333 0.911835 1.060249 1.279821 1.619963 1.771663 2.496606 2.697909 
+0.163090 0.213459 0.360500 0.504711 1.040089 1.576896 1.979044 2.125480 2.339164 2.609713 
+0.356943 0.533785 0.924836 1.108094 1.324907 1.563986 2.016874 2.233505 2.510859 2.677439 
+0.226046 0.346550 0.669965 0.775492 0.992753 1.149356 1.460794 2.260130 2.505825 2.717261 
+0.322304 0.403181 0.776459 0.964458 1.099992 1.312705 1.399455 1.890224 2.369477 2.448458 
+0.181583 0.245567 0.398747 0.597666 1.249798 1.421203 1.606076 2.062186 2.473743 2.644347 
+0.254588 0.326744 1.005093 1.262125 1.386127 1.779710 1.955644 2.320802 2.571383 2.678189 
+0.216441 0.331207 0.529500 0.654360 0.976477 1.361296 1.647430 2.064996 2.284304 2.569981 
+0.327013 0.391820 0.720865 1.097162 1.210384 1.510465 1.765619 1.895802 2.508466 2.678337 
+0.252152 0.343407 0.663772 1.085064 1.474659 1.659743 1.910625 2.070943 2.565518 2.717751 
+0.349806 0.488123 1.077976 1.292638 1.515886 1.846355 2.084915 2.406884 2.610810 2.736561 
+0.182819 0.308233 0.418992 0.708488 0.808059 1.045333 1.698019 1.837574 2.442304 2.609622 
+0.277323 0.408804 0.571028 0.828924 1.404815 1.598729 1.759862 1.985935 2.333424 2.455915 
+0.229839 0.342341 0.470342 1.002275 1.285925 1.399377 1.816619 1.930907 2.470705 2.802064 
+0.244913 0.299585 0.779774 1.322881 1.429162 1.587382 1.738489 2.162786 2.520459 2.623668 
+0.161891 0.228443 0.419656 0.733282 0.922895 1.405447 1.884393 2.078046 2.269896 2.589494 
+0.270447 0.452251 0.634105 0.780705 0.965021 1.351395 1.825782 2.214939 2.632158 2.796098 
+0.171118 0.234980 0.395507 0.838430 1.544455 1.699044 2.124182 2.287668 2.660613 2.849673 
+0.213781 0.293496 0.663454 0.993393 1.412625 1.646492 2.074110 2.290676 2.508346 2.653511 
+0.199402 0.316802 0.426338 0.630931 0.735249 1.132121 1.883614 2.046046 2.416976 2.580155 
+0.210048 0.294088 0.590707 0.762351 1.146848 1.352924 1.637070 2.017207 2.305862 2.432462 
+0.154676 0.232848 0.373861 0.948260 1.342786 1.514201 1.755766 1.926693 2.555124 2.717005 
+0.137148 0.221322 0.381753 0.919373 1.152152 1.376375 1.826205 2.189540 2.648671 2.813516 
+0.245209 0.338241 0.486220 0.814091 0.944966 1.134755 1.358289 1.523556 2.149645 2.315495 
+0.392124 0.549332 0.727700 0.905451 1.202400 1.375569 1.534258 1.840057 2.422734 2.556400 
+0.148684 0.204787 0.552934 0.803123 1.372462 1.550381 1.754747 2.118492 2.372977 2.711653 
+0.267280 0.397322 0.846103 1.172950 1.465464 1.857475 2.153775 2.381172 2.591304 2.723190 
+0.194992 0.314743 0.526878 0.796319 1.177375 1.299335 1.525584 1.682646 2.452032 2.795741 
+0.301179 0.371796 0.577128 1.081605 1.303060 1.419674 1.898891 2.054902 2.252552 2.600649 
+0.252900 0.355818 0.549064 0.965795 1.162628 1.585047 1.928827 2.119789 2.498842 2.665173 
+0.256762 0.436508 0.715681 1.130116 1.316991 1.587569 1.850331 2.197839 2.605877 2.796521 
+0.235855 0.314907 0.609574 0.859658 1.266780 1.499482 1.790537 1.910982 2.039772 2.187359 
+0.200486 0.336241 0.495825 0.891310 1.133452 1.285295 1.612858 1.828238 2.394734 2.809663 
+0.179969 0.232629 0.363081 0.500578 1.184534 1.700401 2.059216 2.168101 2.610554 2.836451 
+0.348768 0.492321 1.055246 1.314914 1.471270 1.645210 1.876419 2.100446 2.525029 2.694314 
+0.171135 0.273412 0.378187 0.581850 0.726115 0.908194 1.708076 1.905747 2.542437 2.797354 
+0.315194 0.475887 0.658397 0.849734 1.017156 1.173887 1.755577 2.042149 2.216786 2.521016 
+0.229599 0.378223 0.495710 0.879870 1.173185 1.276381 1.777400 1.935276 2.173970 2.748099 
+0.197210 0.253422 0.651252 1.311542 1.636493 1.706783 2.105431 2.346619 2.641613 2.771729 
+0.232136 0.443332 0.579669 0.760076 0.955242 1.094270 1.726616 1.914262 2.122649 2.700118 
+0.186271 0.267327 0.840223 1.116294 1.440220 1.650886 1.944246 2.192076 2.483403 2.643816 
+0.268607 0.318357 0.512736 1.129834 1.613930 1.740081 1.917514 2.123735 2.299945 2.557182 
+0.479249 0.689878 1.088007 1.470716 1.716709 1.922473 2.158730 2.305877 2.511790 2.656073 
+0.307991 0.431011 0.578118 0.877244 1.205302 1.312688 1.629259 2.238238 2.462001 2.580776 
+0.293918 0.452236 0.659902 0.921329 1.309254 1.422508 1.668206 2.064588 2.322038 2.461436 
+0.131440 0.209617 0.702675 1.016897 1.223185 1.385724 1.670724 1.961691 2.376852 2.732092 
+0.193489 0.279816 0.428516 1.256267 1.395720 1.633455 1.873432 2.214886 2.671449 2.786280 
+0.182323 0.240522 0.451705 0.799605 1.223096 1.445970 1.647433 1.971485 2.217583 2.336581 
+0.384106 0.488198 0.644947 0.897630 1.047334 1.468272 1.839224 1.937923 2.262459 2.408476 
+0.260306 0.326571 0.615384 1.084790 1.376745 1.778446 1.998233 2.171540 2.424597 2.575747 
+0.340699 0.545965 0.865284 1.131340 1.458730 1.711046 2.089316 2.336073 2.684077 2.841771 
+0.290674 0.372204 0.609647 0.779269 0.906420 1.332695 1.973245 2.155443 2.354880 2.655993 
+0.308041 0.460783 0.632808 0.911363 1.081813 1.231896 1.747306 1.927967 2.170864 2.605727 
+0.180523 0.263276 0.388872 0.565969 0.970599 1.149292 1.871610 2.207290 2.458204 2.667791 
+0.143978 0.222658 0.400384 1.086970 1.323702 1.528106 1.995792 2.231147 2.688186 2.836361 
+0.209150 0.326190 0.485707 0.681360 1.195456 1.385054 1.544410 2.045718 2.276514 2.434761 
+0.297725 0.399777 0.588061 0.894914 1.022395 1.243834 2.009751 2.182970 2.413135 2.638027 
+0.228593 0.289986 0.631198 0.791618 1.403101 1.777890 1.926222 2.136335 2.313587 2.489963 
+0.343174 0.500760 1.039265 1.351369 1.721522 1.925940 2.190967 2.354142 2.532626 2.657845 
+0.149735 0.297295 0.440372 0.642471 0.732234 1.200738 1.414606 1.770276 2.778155 2.883980 
+0.223698 0.281114 0.635545 1.061406 1.252740 1.613423 1.836402 1.963828 2.140470 2.593562 
+0.168168 0.232950 0.408892 0.653722 1.031457 1.548556 1.766449 2.230830 2.626126 2.797381 
+0.222326 0.345655 0.786775 1.107909 1.305189 1.588197 1.993469 2.213238 2.511325 2.685326 
+0.224020 0.317494 0.598436 0.845315 1.197927 1.319317 1.767399 2.160174 2.338471 2.525570 
+0.198682 0.295026 0.450891 0.867753 0.988755 1.401296 1.687600 1.894339 2.559558 2.696080 
+0.206679 0.295846 0.477897 0.699492 1.273871 1.789097 1.959682 2.171515 2.399523 2.555694 
+0.353705 0.509579 0.861689 1.094569 1.427975 1.625819 1.845189 2.034662 2.339261 2.562173 
+0.176626 0.248928 0.429179 0.658231 0.856663 1.071207 1.601595 1.968639 2.470776 2.718292 
+0.314175 0.392578 0.678288 0.944677 1.081793 1.304708 1.492952 1.733627 2.167258 2.307337 
+0.202661 0.269438 0.509570 0.817339 1.376869 1.513847 1.874609 2.094859 2.323847 2.480180 
+0.234414 0.278975 0.540035 1.347889 1.582923 1.720967 1.986105 2.114372 2.567473 2.703603 
+0.146798 0.210418 0.385776 0.649932 0.920041 1.248588 1.573579 1.711404 2.232087 2.791487 
+0.382058 0.469618 0.713606 1.069660 1.176016 1.497437 1.813598 1.950404 2.598859 2.726089 
+0.334215 0.396922 0.687976 1.087820 1.575500 1.754574 1.906641 2.123504 2.311875 2.443046 
+0.264352 0.802524 1.285656 1.486584 1.714037 1.865311 2.035536 2.281585 2.562390 2.750718 
+0.270580 0.372011 0.562949 0.825388 0.994299 1.169245 1.870741 2.135215 2.301336 2.518290 
+0.449329 0.649113 0.811339 0.973882 1.234030 1.349977 1.692316 1.971266 2.154687 2.357538 
+0.180117 0.263580 0.408830 1.127021 1.317638 1.497965 1.895425 2.031294 2.672116 2.818667 
+0.331179 0.404977 0.766611 1.259419 1.431059 1.581972 1.939935 2.087575 2.416872 2.639616 
+0.194102 0.279875 0.549239 0.704386 1.177109 1.529852 1.691669 2.044312 2.359273 2.560290 
+0.217844 0.305871 0.442547 0.616270 0.791798 1.713038 1.956014 2.134547 2.520649 2.795859 
+0.162088 0.245953 0.365670 0.638902 1.457619 1.641568 1.838031 2.013303 2.320106 2.729780 
+0.236749 0.306797 0.734177 1.072402 1.551912 1.853315 2.104151 2.256363 2.475312 2.617668 
+0.176733 0.238829 0.485876 0.687779 0.927283 1.403874 1.830537 2.195431 2.429970 2.626018 
+0.268020 0.478288 0.731817 0.871173 1.083963 1.253101 1.535103 2.185826 2.455996 2.622463 
+0.166174 0.232448 0.362076 0.591660 1.356885 1.632572 1.826301 1.987791 2.467764 2.659140 
+0.236315 0.287802 0.548409 0.987167 1.721933 1.836472 2.152486 2.384523 2.592315 2.741028 
+0.148319 0.185444 0.292576 0.511994 0.653403 1.371832 1.527681 1.776139 2.182163 2.227991 
+0.401535 0.564293 0.893142 1.022987 1.156707 1.327441 1.701821 1.993285 2.370534 2.578619 
+0.165638 0.255975 0.370284 0.802811 1.426084 1.572731 1.787459 1.915582 2.413753 2.802844 
+0.317083 0.519809 0.936968 1.293236 1.686332 1.984336 2.186929 2.353187 2.746765 2.860986 
+0.189287 0.380990 0.546039 0.784587 1.003621 1.162395 1.874419 2.057907 2.555748 2.785834 
+0.200570 0.284860 0.609927 0.826229 1.198949 1.436548 1.809361 2.033038 2.401620 2.587587 
+0.168913 0.291597 0.445205 0.722025 1.163607 1.283554 1.763882 1.943265 2.445617 2.817539 
+0.360050 0.443567 0.853632 0.987093 1.191562 1.562912 1.869792 2.232417 2.543480 2.645225 
+0.231905 0.297890 0.611365 0.830346 1.094545 1.582087 1.848979 2.056068 2.241982 2.394253 
+0.331013 0.427540 0.641785 0.946294 1.070136 1.373613 1.859665 1.965907 2.332441 2.584977 
+0.186393 0.242540 0.372099 0.728034 1.467825 1.880137 2.042177 2.272992 2.633925 2.779591 
+0.446483 0.648214 0.993351 1.205829 1.476224 1.661697 1.899206 2.087562 2.408776 2.592556 
+0.208614 0.297946 0.427983 0.600065 0.709456 1.284278 2.044367 2.179822 2.682450 2.818833 
+0.306024 0.468602 0.638450 0.827416 1.302277 1.427429 1.811154 2.176106 2.372543 2.496738 
+0.152872 0.217872 0.355627 0.713701 1.075149 1.446741 1.848785 1.978762 2.159635 2.712916 
+0.234973 0.319771 0.478090 1.080036 1.447440 1.571699 1.982304 2.127281 2.559717 2.736762 
+0.162524 0.250245 0.389070 0.646952 0.872934 1.222022 1.856534 2.002922 2.205745 2.599505 
+0.323202 0.432855 0.814249 1.180773 1.335093 1.521419 1.901656 2.092343 2.350187 2.560064 
+0.273240 0.329948 0.562890 1.003483 1.538259 1.875392 2.025443 2.170349 2.380148 2.499017 
+0.500444 0.796365 1.318632 1.529307 1.785448 1.972761 2.147764 2.310849 2.519566 2.650408 
+0.263728 0.375983 0.556014 0.707339 1.188811 1.339543 1.652143 2.209513 2.616263 2.738796 
+0.266858 0.438409 0.640135 0.862517 1.340556 1.500100 1.686339 2.153946 2.448590 2.598137 
+0.190447 0.295300 0.432651 0.884499 1.072087 1.256294 1.823661 1.957091 2.345386 2.577329 
+0.243926 0.297921 0.524525 1.251205 1.478145 1.594774 1.967380 2.076378 2.370787 2.732472 
+0.167306 0.212866 0.358147 0.499128 0.984267 1.284647 1.814420 2.033044 2.314127 2.439818 
+0.254879 0.320323 0.682137 0.944750 1.083508 1.662985 2.084039 2.246726 2.582054 2.713386 
+0.212215 0.297268 0.418087 0.743693 1.609250 1.923321 2.079152 2.242169 2.464816 2.591376 
+0.117901 0.208978 0.750040 1.145517 1.437720 1.744291 2.143051 2.439937 2.749809 2.873675 
+0.193258 0.299329 0.443516 0.797326 0.939062 1.148247 2.018657 2.143420 2.638335 2.829836 
+0.213782 0.353502 0.481322 0.711845 1.170764 1.302711 1.535835 1.703291 2.279212 2.748103 
+0.115171 0.144705 0.242103 0.453456 1.202245 1.525989 1.893854 2.179999 2.517564 2.798073 
+0.238570 0.307781 0.447781 0.957056 1.599743 1.771585 1.940690 2.245051 2.435372 2.633593 
+0.194447 0.266589 0.445674 0.635231 0.910266 1.074602 1.340239 1.919744 2.377594 2.630265 
+0.297496 0.544047 0.851256 1.025765 1.203569 1.446499 1.981579 2.194582 2.414346 2.605178 
+0.203460 0.275006 0.515591 0.732576 1.407979 1.561138 1.760709 2.030957 2.312387 2.431093 
+0.498532 0.697751 1.045964 1.328280 1.488249 1.717432 2.051335 2.268465 2.588202 2.722759 
+0.194097 0.345960 0.482722 0.874859 1.052521 1.250837 1.534492 1.720853 2.636782 2.816708 
+0.266101 0.394737 0.545547 0.974166 1.278319 1.387120 1.790143 1.967144 2.177889 2.702878 
+0.102867 0.171081 0.576060 0.818748 1.189242 1.510470 1.778003 2.103994 2.520545 2.748259 
+0.119052 0.208027 0.744711 1.011939 1.289820 1.547449 1.904002 2.157777 2.533138 2.773751 
+0.210113 0.291141 0.487281 0.790277 0.954605 1.401661 1.701442 1.897619 2.210404 2.382596 
+0.266446 0.411500 0.593156 0.920817 1.042570 1.321476 1.890868 2.015685 2.574753 2.734992 
+0.195053 0.286814 0.458352 0.639707 1.284634 1.645299 1.800882 2.168396 2.390218 2.562172 
+0.341567 0.526183 0.892818 1.084248 1.334447 1.590215 1.889298 2.135833 2.519801 2.745352 
+0.323599 0.420247 0.572363 0.757221 0.889572 1.036953 1.623345 2.196313 2.409765 2.540575 
+0.410364 0.592459 0.763563 0.927955 1.176077 1.308890 1.569276 2.059039 2.380497 2.499273 
+0.194371 0.276796 0.581419 0.722859 1.264729 1.505348 1.711903 2.189092 2.444234 2.629075 
+0.252525 0.297192 0.844332 1.381854 1.514803 1.693308 1.854404 2.129548 2.591287 2.684159 
+0.170004 0.214112 0.394084 0.539179 0.822416 1.250980 1.752323 2.086240 2.289006 2.448613 
+0.289267 0.343412 0.775795 1.191573 1.303367 1.539691 1.782253 1.905366 2.579603 2.729614 
+0.234791 0.321602 0.704594 0.949738 1.420244 1.594285 1.774127 2.194285 2.467211 2.589613 
+0.340968 0.561082 1.199771 1.415378 1.689161 1.838640 2.014730 2.162685 2.430697 2.592350 
+0.345276 0.499518 0.706277 0.861164 0.999501 1.150174 1.572106 1.964424 2.390120 2.588870 
+0.357406 0.496053 0.646703 0.939578 1.460352 1.676567 1.834109 2.014842 2.385901 2.507758 
+0.176473 0.238482 0.404112 0.892358 1.136652 1.536592 1.716827 1.872719 2.552209 2.759174 
+0.222384 0.324129 0.833161 1.246603 1.460920 1.650632 1.876566 2.087675 2.354362 2.547825 
+0.167777 0.229073 0.433058 0.810575 1.128669 1.556495 1.799821 1.915429 2.106489 2.677788 
+0.306967 0.371498 0.623689 0.749815 0.934500 1.649015 1.792619 2.190421 2.536272 2.643777 
+0.148383 0.236235 0.322878 0.555588 1.594153 1.725789 1.992119 2.178572 2.540447 2.774265 
+0.377895 0.546230 0.852056 1.067292 1.455797 1.652672 2.018925 2.238220 2.468715 2.644735 
+0.300062 0.399164 0.567524 0.740898 0.849393 1.425476 1.948578 2.050102 2.416440 2.546289 
+0.218019 0.356752 0.584786 0.769374 1.165925 1.291779 1.688308 2.175240 2.369045 2.711417 
+0.143884 0.210234 0.342148 0.566261 1.198668 1.437368 1.683504 1.842729 2.638129 2.833574 
+0.115081 0.173169 0.584021 1.134381 1.407360 1.689153 2.034286 2.294650 2.638147 2.814312 
+0.190721 0.252429 0.584147 0.836602 1.015264 1.254879 1.571659 2.007112 2.245095 2.426652 
+0.309544 0.480824 0.812592 1.075038 1.325338 1.457449 1.679174 1.976619 2.381620 2.705381 
+0.164599 0.274956 0.399399 0.735839 1.360979 1.482765 1.859273 2.011226 2.288457 2.792980 
+0.187333 0.353999 1.222795 1.502985 1.770143 1.982262 2.203271 2.378492 2.606563 2.729390 
+0.158025 0.248611 0.551584 0.735140 0.915073 1.281500 1.744031 1.922872 2.435679 2.716805 
+0.273434 0.367213 0.642574 1.050887 1.345202 1.494431 1.909997 2.107095 2.336366 2.534901 
+0.264699 0.416517 0.576907 0.947351 1.178990 1.385352 1.951926 2.132530 2.549979 2.786944 
+0.142221 0.546287 0.805410 1.079219 1.288179 1.492189 1.774180 2.114597 2.427330 2.681890 
+0.230540 0.326500 0.461675 0.964559 1.255458 1.369392 1.856593 2.039532 2.207278 2.539486 
+0.137659 0.377399 0.593860 0.793016 1.115754 1.281644 1.840901 1.971659 2.472814 2.713504 
+0.144356 0.222505 0.346683 0.782224 1.201084 1.371745 2.123343 2.366887 2.623919 2.803847 
+0.362575 0.509680 1.001234 1.230119 1.473004 1.608864 1.802561 2.021551 2.326705 2.519219 
+0.240803 0.361576 0.516660 0.727416 0.914394 1.051113 1.716835 2.160538 2.328331 2.706675 
+0.351054 0.517992 0.725905 0.915622 1.055525 1.339295 1.898183 2.100270 2.307558 2.559254 
+0.200168 0.322989 0.505425 0.676330 1.190121 1.354931 1.731948 1.999324 2.249015 2.624332 
+0.219896 0.269490 0.521875 1.237665 1.710417 1.793651 2.115240 2.279260 2.536737 2.689478 
+0.215336 0.396644 0.543160 0.728604 1.109190 1.229364 1.727973 1.963312 2.325039 2.797789 
+0.264892 0.352500 0.883446 1.155268 1.338153 1.628498 1.841805 2.014230 2.264319 2.462976 
+0.239779 0.301722 0.529044 1.147546 1.636525 1.760760 1.966137 2.262281 2.456574 2.621762 
+0.320203 0.679639 1.229787 1.529834 1.826892 2.060858 2.286789 2.422168 2.716167 2.843881 
+0.353658 0.547800 0.796651 0.899078 1.041245 1.321838 1.822982 2.161422 2.619096 2.820678 
+0.261908 0.345021 0.472318 0.918792 1.423161 1.564348 1.733377 2.067856 2.262877 2.396698 
+0.124156 0.193894 0.636158 0.840841 1.110258 1.289251 1.683161 1.869014 2.398865 2.731114 
+0.165710 0.239716 0.465502 1.228637 1.420469 1.692829 1.888377 2.147997 2.486300 2.699831 
+0.160684 0.209986 0.367031 0.503201 1.015826 1.200739 1.524190 2.011867 2.222744 2.475835 
+0.277916 0.405640 0.619792 0.770716 1.136524 1.426314 1.822220 2.135166 2.485194 2.647977 
+0.231394 0.352162 0.469144 0.682116 1.481669 1.842849 2.029794 2.179907 2.469833 2.589806 
+0.380604 0.561972 0.896403 1.133414 1.391582 1.626403 1.961716 2.211112 2.588392 2.787673 
+0.322688 0.406580 0.586076 0.731518 0.852667 1.152831 1.995073 2.295481 2.441596 2.617794 
+0.197630 0.400738 0.603098 0.838719 1.177968 1.302320 1.559507 1.871355 2.200186 2.796317 
+0.159189 0.198711 0.364347 0.509370 1.127246 1.399692 1.623432 2.046094 2.279806 2.705935 
+0.233578 0.298035 0.460794 1.139533 1.415576 1.616317 2.117648 2.254774 2.452874 2.595232 
+0.177717 0.242239 0.394824 0.650020 0.987501 1.104089 1.611392 2.177724 2.393809 2.694514 
+0.299562 0.409957 0.723642 1.062891 1.216972 1.411830 2.051394 2.240860 2.503777 2.709591 
+0.201879 0.287289 0.406508 0.659566 1.400321 1.792888 1.936179 2.099785 2.279253 2.454742 
+0.359188 0.531719 0.904543 1.142371 1.572219 1.782800 2.067174 2.342915 2.583586 2.731217 
+0.245193 0.363406 0.508075 0.721046 0.817318 1.141324 1.787709 1.937075 2.532146 2.678676 
+0.280203 0.342294 0.579285 1.021875 1.451807 1.612518 1.803002 2.013050 2.189908 2.367656 
+0.124640 0.167543 0.484641 0.896195 1.324263 1.701101 1.908392 2.091365 2.427391 2.766624 
+0.152261 0.248563 0.705878 1.026619 1.492524 1.688058 2.019960 2.241100 2.465374 2.733867 
+0.169524 0.275607 0.440772 0.719798 1.121602 1.261028 1.809404 2.005583 2.240287 2.716912 
+0.329978 0.420004 0.718053 0.936318 1.070988 1.489233 1.858025 1.988096 2.520192 2.667419 
+0.229078 0.298586 0.511977 0.723831 1.144803 1.763599 2.164905 2.282990 2.512775 2.671092 
+0.456055 0.680179 0.929388 1.076639 1.233955 1.484650 1.903702 2.126601 2.527098 2.727819 
+0.168979 0.211126 0.352636 0.486868 0.828354 1.056116 1.439894 2.019355 2.482102 2.794744 
+0.388525 0.560294 0.717429 0.985928 1.184401 1.320169 1.814889 2.045192 2.224054 2.519281 
+0.207864 0.278390 0.577744 0.755061 1.180647 1.365438 1.765814 1.933058 2.355569 2.495779 
+0.273703 0.316766 0.687833 1.373372 1.573215 1.679562 2.017370 2.150752 2.443206 2.666143 
+0.139043 0.179618 0.315633 0.517664 0.768733 1.079636 1.390644 1.825048 2.101118 2.739679 
+0.443325 0.508374 0.821570 1.141790 1.252203 1.580452 1.827461 1.983767 2.580866 2.715534 
+0.272418 0.343583 0.526010 1.076654 1.474251 1.582828 1.851400 2.162984 2.327319 2.521128 
+0.372015 0.542684 0.990447 1.414552 1.716538 1.844518 2.067134 2.276470 2.459989 2.623009 
+0.296347 0.473546 0.629389 0.879809 1.022187 1.210411 1.881605 2.064735 2.306350 2.615239 
+0.421613 0.570707 0.726241 1.011174 1.451250 1.595500 1.814127 2.086968 2.350981 2.485098 
+0.138010 0.208811 0.371352 1.058801 1.360740 1.563789 1.835310 2.106508 2.488086 2.685686 
+0.304388 0.366691 0.637332 1.163418 1.322554 1.489449 1.820316 1.937237 2.490676 2.695981 
+0.160998 0.233003 0.393385 0.742550 1.040177 1.581795 1.846434 2.020562 2.454386 2.656034 
+0.293730 0.353143 0.554522 0.676232 0.826408 1.581608 2.144029 2.268817 2.602846 2.715369 
+0.174487 0.251975 0.375041 0.584283 1.427390 1.560251 1.883505 2.266902 2.453791 2.739291 
+0.236065 0.282833 0.692209 1.097292 1.694874 1.966224 2.123394 2.280655 2.544753 2.658369 
+0.129365 0.165960 0.285820 0.488714 0.981342 1.175696 1.724506 2.087889 2.501287 2.735548 
+0.226211 0.351015 0.619709 0.857773 1.132574 1.308463 1.487032 1.965719 2.504712 2.670516 
+0.203957 0.285955 0.462644 0.620843 1.230135 1.668195 1.835692 2.036399 2.639041 2.775792 
+0.159885 0.225639 0.351326 0.882800 1.592195 1.709989 2.060725 2.305297 2.531165 2.753869 
+0.182663 0.255048 0.437572 0.758568 0.996367 1.382381 1.651134 1.839516 2.008732 2.215961 
+0.418150 0.556126 0.728385 1.007878 1.270088 1.366376 1.715316 2.066928 2.257578 2.389769 
+0.207212 0.291325 0.416536 0.913294 1.492822 1.637098 1.825777 1.978284 2.214137 2.552111 
+0.241341 0.427255 0.990332 1.209018 1.403013 1.731713 2.115958 2.363302 2.608966 2.742739 
+0.188611 0.290583 0.686340 0.839849 1.094731 1.279717 1.560751 2.134527 2.353362 2.641874 
+0.303141 0.383534 0.612718 0.971405 1.141894 1.558084 1.937162 2.069641 2.316813 2.480680 
+0.179032 0.247590 0.375840 0.575450 1.367486 1.543422 2.101856 2.277817 2.513453 2.724165 
+0.279200 0.350633 0.674006 1.015821 1.154154 1.656796 1.871235 2.061172 2.539189 2.655336 
+0.220829 0.293262 0.666921 0.930888 1.307454 1.585242 1.798660 1.919831 2.100904 2.490486 
+0.407626 0.528205 0.695580 0.942289 1.068323 1.248001 1.834686 1.955840 2.367277 2.684681 
+0.187917 0.238836 0.392030 0.586354 1.220852 1.713253 2.205448 2.317138 2.607952 2.772751 
+0.406035 0.678205 1.009915 1.169891 1.361883 1.567949 1.969141 2.218271 2.484866 2.653946 
+0.263469 0.379446 0.574642 0.739690 0.891674 1.015764 1.634497 2.310050 2.531555 2.722555 
+0.276896 0.353172 0.495976 0.992936 1.248222 1.349871 1.691833 2.151044 2.363150 2.534333 
+0.165915 0.220580 0.380706 0.597420 1.137653 1.320387 1.576770 1.939725 2.122544 2.647358 
+0.215129 0.283229 0.414568 1.356845 1.527108 1.679575 1.891014 2.130176 2.602350 2.741207 
+0.206573 0.274549 0.539970 0.803271 1.064961 1.486193 1.704709 1.828604 1.978928 2.462439 
+0.245410 0.534217 0.840240 1.054925 1.298942 1.439072 1.805223 2.039652 2.261595 2.482457 
+0.236976 0.308980 0.585923 0.783026 1.498617 1.930204 2.097800 2.251258 2.476303 2.596959 
+0.571463 1.021016 1.359450 1.510990 1.761279 1.913272 2.106845 2.286831 2.543023 2.660054 
+0.187494 0.265400 0.418588 0.927645 1.377800 1.582098 1.740975 2.237651 2.615481 2.802350 
+0.308598 0.491606 0.632564 0.923419 1.411973 1.578570 1.730433 1.976996 2.433166 2.558710 
+0.147715 0.217707 0.377800 0.910933 1.185758 1.366725 1.612211 2.013767 2.403550 2.696412 
+0.255983 0.321186 0.503024 1.109229 1.544228 1.645679 1.931499 2.060262 2.490962 2.677649 
+0.175450 0.230655 0.407361 0.720246 1.062295 1.330697 1.797198 2.019193 2.315150 2.443569 
+0.223790 0.338008 0.719854 0.950722 1.144176 1.597163 1.855352 2.263747 2.561723 2.704014 
+0.192133 0.289847 0.398779 0.556338 1.501770 1.755759 1.934139 2.206912 2.388353 2.645486 
+0.297639 0.450015 0.788874 1.101418 1.627516 1.880937 2.155204 2.413078 2.599468 2.743886 
+0.217417 0.333895 0.462399 0.822556 1.071185 1.203256 1.990668 2.195575 2.436009 2.784665 
+0.163563 0.239093 0.376533 0.839654 1.058152 1.266142 1.728781 1.907170 2.096879 2.659086 
+0.137806 0.181530 0.328192 0.516935 1.031832 1.525160 1.768896 1.915914 2.359545 2.727805 
+0.164104 0.236815 0.332559 0.910079 1.609754 1.696913 2.000392 2.161661 2.560691 2.703739 
+0.228917 0.407594 0.638844 0.801544 1.054407 1.197528 1.396765 1.854050 2.203784 2.611161 
+0.391989 0.486610 0.771960 1.116329 1.248980 1.474917 1.949979 2.088145 2.481910 2.691692 
+0.279187 0.400947 0.576848 0.718895 1.254179 1.650864 1.823958 1.934813 2.498090 2.611019 
+0.458469 0.714872 1.061410 1.262159 1.583256 1.935302 2.258053 2.430476 2.654284 2.756814 
+0.222188 0.326247 0.447894 0.840363 1.072654 1.191396 1.417342 1.567507 2.404790 2.696868 
+0.346704 0.402748 0.714703 1.139511 1.315770 1.444510 1.797498 1.920454 2.155272 2.559128 
+0.155723 0.214701 0.494437 0.875267 1.172389 1.405229 1.797171 2.092950 2.373162 2.664794 
+0.143642 0.390291 0.851279 1.039361 1.187534 1.415631 1.895439 2.190895 2.617165 2.792304 
+0.266078 0.370570 0.662415 0.836415 0.988458 1.316618 1.567592 1.858948 2.257531 2.426635 
+0.336056 0.469998 0.781562 0.918047 1.031306 1.219377 1.737468 2.050577 2.458442 2.720080 
+0.165799 0.215460 0.363262 0.498067 1.217803 1.622985 1.903435 2.072821 2.251153 2.522123 
+0.418176 0.619702 0.947421 1.146388 1.456489 1.664370 1.965827 2.179934 2.466824 2.629682 
+0.265129 0.360058 0.519333 0.815729 0.992554 1.155878 1.718766 2.222951 2.442701 2.585525 
+0.308187 0.464955 0.631733 0.775884 1.197138 1.454372 1.618186 2.005378 2.298683 2.443207 
+0.178219 0.251645 0.407157 0.725307 1.323507 1.464894 1.694747 2.102622 2.283774 2.589151 
+0.206659 0.311706 0.925646 1.192852 1.568069 1.802078 2.008324 2.197021 2.461939 2.657140 
+0.174956 0.236808 0.392320 0.654967 0.934857 1.152108 1.595741 1.864532 2.214108 2.354775 
+0.230434 0.344630 0.704520 0.910666 1.348070 1.567822 1.811907 1.939844 2.509990 2.701550 
+0.180253 0.232955 0.624261 0.923991 1.421690 1.599589 1.814005 2.073839 2.413260 2.570514 
+0.398056 0.571576 1.027057 1.401582 1.532635 1.743391 2.038501 2.173100 2.635865 2.756941 
+0.244124 0.349847 0.599577 0.750991 0.891408 1.153522 1.605551 1.899047 2.317997 2.500479 
+0.324856 0.539756 0.695489 0.870499 1.378985 1.583978 1.787428 2.079347 2.366844 2.502610 
+0.250886 0.480663 0.608352 0.931539 1.092319 1.383530 1.692940 1.863607 2.650750 2.806650 
+0.338327 0.396903 0.699669 1.241511 1.414878 1.559671 1.867401 2.000074 2.583166 2.742075 
+0.164041 0.233302 0.383240 0.540410 0.806255 1.495618 1.938839 2.063074 2.286859 2.677635 
+0.218870 0.316692 0.450414 0.721514 1.234846 1.762116 1.921161 2.415204 2.642001 2.782596 
+0.163667 0.235743 0.354094 0.797110 1.437154 1.554340 2.096932 2.265233 2.481373 2.661373 
+0.141630 0.198248 0.557013 1.138173 1.485146 1.786655 1.990698 2.185739 2.443261 2.719231 
+0.217999 0.366741 0.519705 0.781024 0.899903 1.248543 1.852721 1.986039 2.401777 2.555847 
+0.205878 0.302603 0.472303 0.693773 1.275278 1.505045 1.651223 2.075256 2.330750 2.459809 
+0.205336 0.309242 0.483400 0.841555 1.362515 1.548353 1.760082 1.993603 2.496424 2.633078 
+0.173174 0.251866 0.410487 1.098827 1.251313 1.651838 1.903428 2.405674 2.698209 2.817074 
+0.274582 0.463838 0.620569 0.820587 0.988556 1.155062 1.637870 1.835193 2.071934 2.529835 
+0.364198 0.472940 0.697706 1.016409 1.151822 1.373913 1.673193 1.811034 2.432956 2.643088 
+0.210609 0.316509 0.475251 0.668420 1.418526 1.631402 1.796155 2.141848 2.319077 2.697236 
+0.294479 0.519397 0.846472 1.213453 1.709661 1.916717 2.258070 2.456443 2.600351 2.786559 
+0.170463 0.255944 0.401983 0.820520 1.094719 1.322743 1.646553 1.784940 2.486157 2.613248 
+0.237336 0.356516 0.490576 0.924631 1.184187 1.304165 1.910651 2.102207 2.302776 2.641078 
+0.237089 0.334322 0.503100 0.942044 1.087499 1.511162 1.952715 2.075663 2.564695 2.734500 
+0.270484 0.426158 0.787084 1.011450 1.420404 1.627576 1.856282 2.112823 2.548329 2.769664 
+0.212376 0.278943 0.617049 0.887684 1.142337 1.356367 1.727600 1.935068 2.149199 2.293257 
+0.219581 0.437941 0.549582 0.824175 1.110224 1.217621 1.723719 1.891729 2.537107 2.790704 
+0.180332 0.207980 0.422463 0.642179 1.028384 1.607980 2.250525 2.381973 2.608993 2.774395 
+0.363639 0.523626 1.148877 1.352576 1.562465 1.724307 1.921396 2.120662 2.445004 2.610164 
+0.150266 0.222691 0.365816 0.555803 0.688872 1.162897 1.782593 2.040683 2.522491 2.769536 
+0.322510 0.444036 0.616943 0.895765 1.056214 1.275784 1.751504 1.895911 2.132909 2.370408 
+0.228790 0.394631 0.548588 0.772733 1.227890 1.335766 1.788390 2.041514 2.278792 2.744098 
+0.234366 0.288401 0.669909 1.295698 1.461082 1.731631 2.183204 2.296645 2.539291 2.656637 
+0.255688 0.474634 0.639397 0.858887 1.097668 1.228104 1.592196 1.812078 2.070709 2.717623 
+0.214002 0.365378 0.921340 1.120628 1.379265 1.601621 1.931336 2.141337 2.414577 2.593476 
+0.220925 0.307330 0.407573 0.868421 1.663240 1.844525 1.994660 2.189618 2.371374 2.516151 
+0.362773 0.569567 1.005505 1.504530 1.678917 1.910360 2.158978 2.297543 2.659978 2.788995 
+0.296160 0.426108 0.649527 0.859492 1.056490 1.213501 1.697291 2.135737 2.364297 2.514164 
+0.281900 0.432754 0.589102 0.914308 1.277709 1.401926 1.774347 1.972103 2.235129 2.544435 
+0.277240 0.357036 0.828830 1.002473 1.178011 1.446057 1.715661 1.918548 2.237210 2.572122 
+0.235923 0.330705 0.623139 1.275081 1.398365 1.615244 1.800110 2.151779 2.592066 2.735797 
+0.179223 0.246208 0.400152 0.708696 1.129890 1.318110 1.696185 1.907985 2.203754 2.331059 
+0.316183 0.382213 0.679593 0.814474 0.986274 1.762901 1.990617 2.149795 2.433563 2.555738 
+0.218193 0.282095 0.586606 0.865818 1.378763 1.742711 1.918177 2.243443 2.595193 2.752713 
+0.309792 0.481840 0.827993 1.213125 1.606995 1.730492 2.141679 2.280307 2.608238 2.849348 
+0.270780 0.352881 0.501183 0.906847 1.086388 1.325169 1.838184 2.204039 2.421528 2.566162 
+0.226107 0.390361 0.555807 0.749815 1.088830 1.205930 1.680764 2.021480 2.201488 2.659122 
+0.123441 0.173507 0.307303 0.690407 1.173938 1.333877 1.786765 2.000793 2.425213 2.751118 
+0.158591 0.214573 0.427561 0.902581 1.277688 1.674870 2.126902 2.421840 2.701440 2.836990 
+0.189303 0.283266 0.464375 0.672875 1.104817 1.250272 1.526572 2.083813 2.270321 2.510880 
+0.287382 0.434077 0.583769 0.905506 1.053249 1.483726 1.993792 2.165572 2.575308 2.698217 
+0.263500 0.370045 0.536776 0.782922 1.324389 1.844905 2.005965 2.156203 2.458755 2.583419 
+0.384009 0.584098 0.936199 1.287834 1.635325 1.761083 2.169160 2.324023 2.535401 2.749390 
+0.146402 0.213762 0.398489 0.690149 0.996244 1.435892 1.670170 1.813953 2.445981 2.787485 
+0.301226 0.367882 0.654854 1.094027 1.229960 1.592088 1.885201 2.005608 2.274408 2.444608 
+0.149947 0.216185 0.391920 0.830502 1.253633 1.431601 1.785490 2.103484 2.525214 2.755484 
+0.097894 0.173875 0.729312 1.016482 1.304096 1.606405 1.935582 2.257805 2.640341 2.840475 
+0.169855 0.242145 0.571777 0.803659 1.022243 1.354604 1.782360 1.980234 2.368909 2.535598 
+0.254591 0.378801 0.672668 0.807056 1.056720 1.493018 1.655380 1.979812 2.449241 2.599697 
+0.193304 0.260487 0.459964 0.670291 1.308012 1.768287 1.946244 2.212251 2.405579 2.728625 
+0.366883 0.536817 0.908218 1.110776 1.354740 1.500190 1.704032 1.943640 2.329476 2.560555 
+0.211004 0.305715 0.399667 0.516282 0.691520 0.849824 1.396564 2.291427 2.546197 2.699794 
+0.235007 0.315896 0.593374 0.857317 1.094567 1.500585 1.840100 1.974535 2.128181 2.274238 
+0.183909 0.226449 0.400954 0.544120 1.348797 1.515812 1.765685 1.973782 2.256647 2.370030 
+0.237680 0.317979 0.661098 1.253198 1.394092 1.734084 1.949126 2.131970 2.641034 2.757610 
+0.166212 0.241240 0.371751 0.557281 0.767198 1.134161 1.620608 1.834400 2.454323 2.635245 
+0.330393 0.391091 0.780047 1.022404 1.134626 1.502694 1.702935 1.890801 2.580707 2.691910 
+0.408812 0.495670 0.687407 1.108832 1.546181 1.696379 1.885325 2.139028 2.368060 2.517184 
+0.376422 0.555069 1.161646 1.386418 1.622733 1.845580 2.017094 2.201137 2.552466 2.708053 
+0.274146 0.380469 0.549878 0.799730 0.939402 1.117940 1.645452 2.052539 2.350689 2.490049 
+0.329001 0.575380 0.735296 0.911471 1.268064 1.391747 1.781411 2.007253 2.202059 2.466893 
+0.212169 0.311180 0.439692 1.078259 1.267527 1.468391 1.726469 1.906190 2.628147 2.786434 
+0.297463 0.361038 0.824509 1.239302 1.339377 1.569785 1.940696 2.077375 2.519418 2.696863 
+0.207701 0.292358 0.552629 0.711964 1.172305 1.651429 1.844960 2.071458 2.419231 2.553707 
+0.209832 0.301136 0.449094 0.647610 0.777779 1.480469 1.932068 2.131542 2.710060 2.812704 
+0.172423 0.255437 0.369220 0.543108 1.401559 1.717608 1.933428 2.154827 2.367862 2.787661 
+0.255748 0.347504 0.796616 1.027751 1.504250 1.760784 1.937354 2.112544 2.469490 2.637341 
+0.169424 0.278442 0.444446 0.687556 0.797962 1.369199 1.630793 2.131758 2.696521 2.814286 
+0.263582 0.429254 0.626198 0.790299 0.996064 1.131137 1.510958 2.083907 2.354499 2.747674 
+0.160669 0.249969 0.366613 0.619384 1.335750 1.509419 1.938079 2.107770 2.598329 2.796645 
+0.244289 0.315310 0.439736 0.746805 1.478790 1.975786 2.164362 2.279744 2.549736 2.677409 
+0.158860 0.216940 0.349617 0.495945 1.053452 1.187951 1.643661 1.872490 2.121853 2.234733 
+0.364934 0.547895 0.703548 1.046696 1.327165 1.444813 1.638612 1.994689 2.369195 2.515047 
+0.199825 0.282570 0.423937 1.052805 1.331805 1.455952 1.892213 2.048648 2.272970 2.743986 
+0.205916 0.528758 1.069123 1.303179 1.547206 1.887462 2.261478 2.525666 2.727548 2.836565 
+0.211344 0.325615 0.470129 0.876822 1.036692 1.388499 2.004071 2.168361 2.641575 2.788384 
+0.165214 0.237113 0.652635 0.853498 1.274603 1.418260 1.750475 2.188010 2.392225 2.656697 
+0.171345 0.265931 0.404296 0.777656 1.251339 1.381106 1.876187 2.028307 2.321131 2.646341 
+0.243930 0.315918 0.797490 1.189416 1.348551 1.850071 2.061191 2.229853 2.567528 2.706220 
+0.194777 0.274153 0.522750 0.716292 0.872211 1.616112 1.890034 2.023297 2.194462 2.435800 
+0.244945 0.443755 0.592420 0.889336 1.105448 1.259185 1.758350 1.914694 2.352504 2.581197 
+0.179880 0.257145 0.369148 0.581368 1.406373 1.820128 2.061537 2.213705 2.526442 2.674115 
+0.545317 0.839577 1.093857 1.262533 1.530824 1.739612 2.017505 2.229486 2.511345 2.662061 
+0.188061 0.301651 0.405278 0.612153 0.779478 1.037845 2.004224 2.211267 2.475847 2.697676 
+0.314335 0.465910 0.634660 0.880106 1.266325 1.367294 1.763992 2.104409 2.276097 2.443435 
+0.141443 0.203354 0.372102 0.773557 1.052380 1.521452 1.774251 1.900827 2.384498 2.726988 
+0.183016 0.267487 0.382582 1.062637 1.528110 1.626188 1.861114 2.019971 2.608976 2.763674 
+0.143357 0.192604 0.323821 0.497856 0.905440 1.343367 1.820946 2.001139 2.153210 2.609622 
+0.354165 0.489743 0.667126 1.118630 1.392866 1.492788 1.780757 2.073223 2.328160 2.560997 
+0.282856 0.383914 0.485830 0.850543 1.506444 1.797613 1.937969 2.146059 2.427443 2.548079 
+0.487767 0.866830 1.364561 1.521265 1.733207 1.945262 2.238743 2.399018 2.632115 2.744288 
+0.280530 0.416807 0.597088 0.899084 1.119331 1.255621 1.616253 2.134732 2.562029 2.692235 
+0.284821 0.494631 0.684501 0.838586 1.258096 1.395495 1.638054 2.162929 2.354037 2.540591 
+0.205140 0.295529 0.494620 0.956357 1.129557 1.430489 1.736194 1.883778 2.442628 2.597296 
+0.304833 0.379519 0.691807 1.147815 1.310207 1.513791 2.008217 2.142574 2.387944 2.637546 
+0.181676 0.219451 0.383940 0.516016 1.044498 1.517177 1.777135 1.964014 2.218885 2.363256 
+0.294578 0.352761 0.665993 0.810615 0.975505 1.763777 1.954836 2.159643 2.626241 2.718025 
+0.172769 0.247043 0.367453 0.702216 1.520013 1.752683 1.974569 2.256458 2.462168 2.651882 
+0.133992 0.301438 0.794542 1.081390 1.502045 1.696404 2.061943 2.278505 2.623520 2.822598 
+0.250639 0.391712 0.550858 0.794112 0.913038 1.085745 2.034282 2.313366 2.505665 2.787062 
+0.323242 0.434081 0.555684 0.961893 1.357180 1.456826 1.643504 1.784048 2.015616 2.515904 
+0.143041 0.186235 0.352826 0.680065 1.264865 1.599306 1.944390 2.254806 2.597410 2.807813 
+0.203141 0.289063 0.395881 0.800946 1.463891 1.689942 1.835029 2.061175 2.225528 2.642274 
+0.222797 0.394599 0.573255 0.715466 1.025538 1.188023 1.564145 2.025279 2.191600 2.532423 
+0.405610 0.492208 0.769597 0.896548 1.095745 1.667540 1.851755 2.090613 2.499090 2.611378 
+0.238982 0.324219 0.447220 0.884037 1.482394 1.649975 1.799871 2.147158 2.341317 2.496853 
+0.453661 0.658367 0.977870 1.248116 1.512727 1.831479 2.096748 2.293691 2.622778 2.735454 
+0.171442 0.338885 0.499399 0.793308 1.060572 1.203862 1.664796 1.804188 2.519133 2.756339 
+0.278022 0.338379 0.636156 1.044803 1.186358 1.516967 1.701121 1.872073 2.394724 2.502070 
+0.121438 0.167486 0.411911 0.917381 1.165927 1.533981 1.818319 2.060997 2.450329 2.746320 
+0.162532 0.224824 0.658346 0.916673 1.391225 1.595859 1.857208 2.217273 2.498430 2.753849 
+0.275986 0.349156 0.568548 0.683453 1.016150 1.598731 1.764733 1.935888 2.342502 2.451659 
+0.253773 0.480249 0.604419 0.965946 1.273556 1.519695 1.780207 2.006359 2.680279 2.811275 
+0.187376 0.271558 0.385829 0.556450 1.380619 1.664090 1.814039 2.064114 2.245361 2.453707 
+0.294725 0.466563 0.736292 1.055050 1.550984 1.693651 1.897743 2.212842 2.491391 2.698543 
+0.239923 0.334060 0.461488 0.662636 0.791453 1.005699 1.600227 2.170741 2.458382 2.619019 
+0.327525 0.492740 0.643437 0.903326 1.245421 1.348861 1.592207 1.937940 2.512050 2.644548 
+0.221363 0.338816 0.483946 0.687648 1.284665 1.551620 1.720135 2.073904 2.254226 2.544134 
+0.258618 0.300723 0.704898 1.390679 1.579033 1.718703 1.937423 2.081021 2.591851 2.718075 
+0.204543 0.311448 0.448600 0.699217 1.072306 1.225857 1.749871 2.025585 2.206864 2.441320 
+0.407224 0.493488 0.735697 1.167395 1.335468 1.468164 1.704353 1.844157 2.418454 2.658505 
+0.177985 0.233336 0.506489 0.863799 1.426574 1.604693 1.864455 2.179274 2.402289 2.599311 
+0.201307 0.580059 1.233073 1.407900 1.670628 1.818287 2.017446 2.256081 2.551962 2.742129 
+0.322757 0.406373 0.612482 0.787838 0.909320 1.345224 1.671798 1.785817 2.404421 2.543501 
+0.331870 0.431884 0.597156 0.927729 1.457447 1.672300 1.841455 2.039567 2.250965 2.417211 
+0.202946 0.328964 0.442956 0.945971 1.181249 1.322011 1.766214 1.899811 2.569787 2.777471 
+0.274929 0.335270 0.613025 1.214599 1.385772 1.557449 1.956849 2.066650 2.288912 2.459016 
+0.146768 0.210059 0.360823 0.630784 1.072395 1.512445 1.766060 1.876355 2.226609 2.774121 
+0.278686 0.371483 0.567509 0.728655 0.855673 1.555589 1.958603 2.076551 2.544275 2.713690 
+0.143219 0.224816 0.347059 0.649970 1.564613 1.685486 1.917021 2.072654 2.453763 2.655050 
+0.294541 0.443278 0.726594 0.985933 1.415734 1.765955 2.073442 2.328283 2.592514 2.745548 
+0.243739 0.365134 0.572466 0.827675 0.939711 1.401796 1.826498 1.947840 2.429538 2.736311 
+0.213082 0.349340 0.619784 0.765201 1.188628 1.358763 1.534192 2.128318 2.415976 2.591807 
+0.161799 0.248667 0.354739 0.716246 1.327356 1.505974 1.706364 1.848519 2.455553 2.645897 
+0.228516 0.375004 0.745896 1.050532 1.367740 1.799352 2.151717 2.418669 2.673185 2.797596 
+0.234744 0.320318 0.466401 1.013481 1.184613 1.343346 1.535391 1.904405 2.318092 2.457794 
+0.296936 0.385747 0.828858 1.091916 1.213084 1.370156 1.504418 2.008638 2.299958 2.422080 
+0.189955 0.288894 0.417900 0.584179 1.286507 1.481483 1.710061 2.088780 2.259900 2.658597 
+0.170659 0.301463 1.070828 1.400247 1.605036 1.820055 2.012834 2.274844 2.579681 2.738437 
+0.194796 0.277316 0.434438 0.646763 0.772268 1.506173 1.740645 1.962370 2.464322 2.657388 
+0.222257 0.294563 0.463770 1.144565 1.329294 1.506915 1.848439 2.035803 2.320447 2.526842 
+0.188443 0.314239 0.448752 0.852815 1.354102 1.446757 1.902520 2.034088 2.526616 2.815041 
+0.226181 0.693860 0.965201 1.130620 1.285879 1.475154 1.863626 2.238763 2.603071 2.788862 
+0.105661 0.160079 0.370939 0.956425 1.151620 1.531460 1.723426 1.913560 2.122164 2.492465 
+0.298984 0.431063 0.586646 0.778394 0.883075 1.252332 1.854971 2.007147 2.580641 2.710519 
+0.197240 0.272225 0.520497 0.915877 1.306265 1.547858 2.092985 2.299254 2.524173 2.690593 
+0.413504 0.577521 0.882547 1.151243 1.588968 1.757858 1.954145 2.157780 2.423490 2.567497 
+0.182013 0.280163 0.398250 0.608531 0.819691 0.969023 1.853980 2.067111 2.358004 2.831492 
+0.376103 0.585036 0.744512 0.923312 1.183525 1.290764 1.692231 2.073489 2.270157 2.435995 
+0.206648 0.328267 0.465432 0.752470 1.311956 1.450538 1.719681 2.019809 2.237402 2.712715 
+0.146386 0.213798 0.495001 1.215327 1.552462 1.867870 2.131376 2.312738 2.674961 2.807719 
+0.204301 0.298214 0.439837 0.759917 0.957505 1.118467 1.710802 2.037862 2.222732 2.676717 
+0.208889 0.314961 0.807094 0.979256 1.326634 1.615428 1.855738 2.074151 2.481053 2.662164 
+0.252094 0.321219 0.425486 1.124218 1.685315 1.954485 2.094831 2.253423 2.478229 2.605367 
+0.454303 0.738006 1.152178 1.340103 1.644779 1.957406 2.329060 2.526950 2.700749 2.789332 
+0.260026 0.460186 0.631124 0.860895 1.160270 1.274078 1.873660 2.167213 2.365849 2.770340 
+0.188841 0.259372 0.483027 0.884169 1.354974 1.505271 1.787912 1.916914 2.217944 2.371433 
+0.171267 0.239784 0.594776 0.748624 1.254712 1.402634 1.627575 2.102077 2.361702 2.545685 
+0.261290 0.332761 0.480740 1.272870 1.411888 1.585755 1.891613 2.059093 2.603683 2.753852 
+0.174471 0.227361 0.395376 0.589674 1.098988 1.351413 1.527512 1.875704 2.288035 2.491253 
+0.392523 0.493384 0.723718 0.863221 0.994939 1.404446 1.868453 2.008324 2.440145 2.622287 
+0.229001 0.293967 0.482060 0.752040 1.321587 1.964756 2.143632 2.272231 2.511299 2.652857 
+0.129576 0.441380 0.809457 1.253754 1.449504 1.695975 2.014264 2.282645 2.615841 2.803547 
+0.291794 0.444574 0.567987 0.774856 0.900327 1.365457 2.004858 2.128537 2.620438 2.820651 
+0.262097 0.516409 0.687606 0.926622 1.163526 1.292705 1.715555 1.937306 2.227923 2.777260 
+0.148606 0.204513 0.361193 0.693710 1.055532 1.278718 1.693525 1.980097 2.352859 2.672283 
+0.253802 0.336651 0.526195 0.891801 1.442978 1.584849 1.979819 2.247623 2.476136 2.660081 
+0.228789 0.338363 0.500714 0.793809 1.196272 1.305413 1.731081 2.259108 2.442615 2.652754 
+0.378062 0.473823 0.693080 1.009192 1.183244 1.328164 1.919726 2.260450 2.429886 2.572302 
+0.247090 0.357491 0.583930 0.824533 1.624951 1.779841 1.978982 2.185311 2.378227 2.583823 
+0.349863 0.525291 0.898639 1.154449 1.653664 1.882655 2.181526 2.353823 2.532309 2.660763 
+0.190910 0.256714 0.576278 0.756016 0.919967 1.182918 1.663565 2.144466 2.501734 2.728244 
+0.298865 0.359843 0.568492 1.131552 1.379757 1.490406 1.824274 1.945718 2.238708 2.644005 
+0.075640 0.092838 0.245669 0.863294 1.223916 1.524202 1.857987 2.167767 2.516095 2.793204 
+0.232965 0.332699 0.723652 1.036910 1.459468 1.595582 1.952510 2.172737 2.392688 2.562895 
+0.247766 0.389477 0.616596 0.808130 0.997595 1.253872 1.724465 1.938385 2.286441 2.479069 
+0.316879 0.442442 0.602552 0.812843 0.919668 1.524096 1.727104 1.959085 2.648008 2.744204 
+0.180121 0.250848 0.377588 0.514084 1.112861 1.845482 2.013326 2.213933 2.474673 2.663237 
+0.510891 0.729294 0.918315 1.009382 1.258580 1.685479 2.036454 2.223282 2.546829 2.685952 
+0.204819 0.306851 0.495622 0.688481 0.939049 1.054525 1.550902 2.063497 2.267332 2.744891 
+0.327442 0.389656 0.773076 1.023761 1.144959 1.391107 1.629777 1.826936 2.044965 2.488423 
+0.163318 0.224949 0.377732 0.697324 1.243068 1.379089 1.633682 1.887173 2.332645 2.483657 
+0.240171 0.293151 0.543472 1.269350 1.631535 1.739995 1.933642 2.084522 2.414170 2.650266 
+0.179979 0.246939 0.396342 0.589909 0.919210 1.070722 1.642599 2.043006 2.217357 2.503273 
+0.302811 0.355529 0.811588 1.166553 1.271468 1.626247 1.848829 1.997826 2.540939 2.669384 
+0.283439 0.349236 0.510446 0.919208 1.451466 1.719296 1.870795 2.075959 2.292387 2.415026 
+0.351847 0.508411 1.045930 1.254317 1.551190 1.805638 2.048595 2.229665 2.467316 2.616962 
+0.266736 0.408066 0.559013 0.768550 0.973174 1.096776 1.669225 2.079118 2.239808 2.647906 
+0.299839 0.538608 0.750887 0.937387 1.361442 1.507727 1.723958 2.019542 2.288365 2.433554 
+0.184692 0.270218 0.419274 1.047374 1.395536 1.529142 1.783612 1.919322 2.399668 2.739026 
+0.282417 0.355135 0.625619 1.193013 1.365194 1.548352 1.961542 2.076835 2.555666 2.736510 
+0.148276 0.201484 0.357526 0.691839 1.109393 1.590808 1.929494 2.052123 2.288831 2.674265 
+0.239872 0.340799 0.510028 0.754201 1.021805 1.444270 2.086249 2.268881 2.498859 2.644372 
+0.229200 0.356617 0.469799 0.697079 1.459153 1.736841 1.888964 2.204606 2.435847 2.594633 
+0.235297 0.299631 0.756788 1.069754 1.591291 1.782731 1.990029 2.186477 2.404269 2.551371 
+0.153218 0.216649 0.366074 0.591966 0.786672 1.337023 1.751677 1.932515 2.401392 2.607477 
+0.264340 0.436803 0.595010 0.767010 1.179494 1.352438 1.528478 1.996792 2.441404 2.572631 
+0.204113 0.325813 0.640860 0.803282 1.276398 1.511437 1.769275 2.073412 2.562526 2.723891 
+0.183616 0.242809 0.370321 0.932837 1.683840 1.816525 2.211177 2.406486 2.636015 2.765906 
+0.196637 0.265829 0.439050 0.770452 1.054669 1.487115 1.916956 2.043030 2.176612 2.349845 
+0.540575 0.704261 0.884898 1.106375 1.273439 1.431611 1.908872 2.163885 2.347449 2.530928 
+0.258740 0.346556 0.466932 0.905095 1.485463 1.645285 1.873902 2.133924 2.308179 2.675230 
+0.347296 0.582875 0.945844 1.279162 1.499633 1.852636 2.184304 2.463318 2.760760 2.870853 
+0.150936 0.266396 0.672274 0.842540 1.058933 1.395955 1.763874 2.053646 2.603603 2.795989 
+0.248334 0.323639 0.796411 0.974630 1.217472 1.616989 1.786496 1.995745 2.426072 2.572132 
+0.171528 0.226268 0.387197 0.596052 1.219235 1.373257 1.802693 2.162095 2.401149 2.694122 
+0.309880 0.375034 0.782497 0.936541 1.130945 1.571152 1.743522 2.158706 2.484175 2.596635 
+0.211833 0.283751 0.471901 0.833897 1.238193 1.611788 1.813797 2.021568 2.299015 2.453586 
+0.325164 0.495780 0.668458 0.977772 1.204875 1.377736 1.792224 1.981132 2.470212 2.687064 
+0.181910 0.238625 0.380080 0.551818 1.284137 1.815502 2.100874 2.224073 2.678894 2.832381 
+0.432484 0.602036 0.967559 1.355422 1.539906 1.638130 2.062617 2.274317 2.408629 2.586735 
+0.223933 0.320440 0.455471 0.635789 0.775870 0.919569 1.655549 2.258604 2.454533 2.743063 
+0.366581 0.460393 0.676450 1.035749 1.222446 1.344767 1.892128 2.136552 2.294736 2.535285 
+0.163193 0.228589 0.372272 0.655743 1.215923 1.357562 1.812178 2.049878 2.219187 2.622506 
+0.199107 0.255898 0.383597 1.460200 1.573471 1.769089 1.990458 2.299624 2.582669 2.742646 
+0.171634 0.266479 0.432062 0.687765 0.835208 1.354791 1.779760 1.939277 2.152823 2.654474 
+0.322744 0.454468 0.896616 1.075278 1.276965 1.525868 1.809606 2.045119 2.396969 2.600609 
+0.185456 0.225713 0.593805 0.777028 1.383381 1.756301 1.909552 2.182404 2.428047 2.628560 
+0.523864 0.996370 1.345344 1.500637 1.856758 1.976312 2.235904 2.414483 2.560231 2.666268 
+0.224472 0.316210 0.461082 1.069924 1.226634 1.409037 1.539144 2.110751 2.541082 2.731841 
+0.282572 0.449304 0.655998 0.827960 1.292714 1.495327 1.771585 2.007810 2.430764 2.621645 
+0.129294 0.178584 0.451465 1.015109 1.245704 1.462743 1.785107 2.042319 2.339740 2.626045 
+0.266450 0.311925 0.672071 1.272373 1.586471 1.680518 1.967287 2.126302 2.331703 2.606765 
+0.155912 0.210793 0.359734 0.582139 0.993095 1.506017 1.938903 2.072031 2.211582 2.514161 
+0.366487 0.454941 0.765153 0.933105 1.077517 1.457225 1.642714 2.050965 2.548495 2.660408 
+0.183421 0.269815 0.375652 0.582732 1.364229 1.857303 2.030324 2.188264 2.389621 2.554337 
+0.157986 0.433220 0.872229 1.187796 1.412974 1.724479 2.144349 2.464695 2.761508 2.877055 
+0.198383 0.350654 0.577264 0.787611 0.933392 1.119024 1.806604 2.076373 2.430526 2.603043 
+0.184568 0.290732 0.456474 0.730730 1.167452 1.298890 1.669065 1.850198 2.187295 2.556672 
+0.119787 0.157206 0.296086 0.580699 1.039340 1.448681 1.791765 2.115501 2.493729 2.765061 
+0.197875 0.296866 0.460866 0.906361 1.504895 1.622424 1.923913 2.064370 2.528505 2.799113 
+0.215006 0.360632 0.624855 0.788786 1.122529 1.271335 1.469548 2.029397 2.292842 2.469529 
+0.312967 0.420596 0.594715 1.013895 1.177345 1.350956 1.928177 2.047807 2.512550 2.690404 
+0.306441 0.447709 0.635622 0.837489 1.339889 1.684905 1.878731 2.050783 2.442345 2.559302 
+0.512714 0.732554 1.090397 1.458930 1.653272 1.872563 2.243616 2.386971 2.644360 2.753299 
+0.338380 0.388353 0.687865 0.937576 1.022955 1.198008 1.345071 1.507334 2.539150 2.676481 
+0.404547 0.489770 0.787746 1.025925 1.160826 1.496135 1.873747 1.995764 2.348409 2.558815 
+0.185178 0.273616 0.662107 0.944310 1.146715 1.437855 1.860110 2.088161 2.488532 2.701156 
+0.297691 0.433807 0.689073 0.914516 1.224645 1.524468 1.882477 2.108378 2.460989 2.729694 
+0.246421 0.329313 0.740815 0.903181 1.072400 1.285931 1.740684 2.032245 2.270116 2.425587 
+0.349571 0.509003 0.727457 0.878169 1.005363 1.205249 1.651188 1.987842 2.609611 2.723475 
+0.174962 0.249723 0.401862 0.559808 1.151652 1.704681 1.872495 2.239764 2.430897 2.686106 
+0.360336 0.530604 0.935905 1.180560 1.399529 1.740890 1.999598 2.182066 2.486093 2.641677 
+0.220231 0.312545 0.449608 0.705056 1.007679 1.135090 1.633644 2.306528 2.622813 2.773890 
+0.343635 0.564980 0.719160 0.856829 1.120400 1.237963 1.472239 1.924690 2.221264 2.357713 
+0.181932 0.261428 0.385382 0.529871 1.326078 1.525795 1.689465 2.161317 2.354960 2.559655 
+0.190215 0.341309 1.145487 1.357611 1.520525 1.690701 1.910605 2.192963 2.496750 2.684620 
+0.231256 0.323986 0.509297 0.695026 0.811246 1.205058 1.698676 1.952659 2.225356 2.436417 
+0.232855 0.310052 0.551612 0.995822 1.160276 1.555029 1.794030 1.930657 2.512921 2.691535 
+0.224518 0.299721 0.651543 0.885427 1.520642 1.679516 1.886989 2.041276 2.532253 2.699897 
+0.204419 0.557694 1.100186 1.347777 1.507922 1.794663 2.079200 2.312468 2.590685 2.744668 
+0.206125 0.397544 0.556512 0.740671 0.860709 1.076989 1.713565 1.825995 2.561599 2.767561 
+0.271126 0.422296 0.596820 0.801216 1.362100 1.508235 1.854835 2.090662 2.270770 2.457032 
+0.217883 0.344596 0.493190 0.984719 1.284852 1.446608 1.855635 2.014247 2.506491 2.663445 
+0.286136 0.348718 0.879652 1.116298 1.280497 1.611569 1.788213 2.223036 2.485667 2.605528 
+0.206618 0.325875 0.503268 0.690657 0.816866 1.603798 1.931282 2.048093 2.300900 2.746683 
+0.239837 0.367432 0.586673 0.749249 1.029445 1.541977 1.837717 2.152675 2.628130 2.775655 
+0.154164 0.222772 0.333818 0.562653 1.465627 1.728492 1.959659 2.326185 2.619462 2.821726 
+0.231365 0.366985 0.807033 1.157258 1.520494 1.640269 2.028108 2.269663 2.456856 2.630277 
+0.242567 0.331771 0.487513 0.644276 0.800853 1.242217 1.739018 2.099717 2.426228 2.596782 
+0.221262 0.374389 0.569573 0.704902 1.187721 1.414042 1.633903 2.049607 2.225608 2.522881 
+0.182959 0.295198 0.401501 0.779683 1.428548 1.551019 1.766917 1.908320 2.610886 2.770247 
+0.139632 0.228108 0.540279 0.898292 1.161261 1.527413 1.913196 2.221342 2.669902 2.842594 
+0.199568 0.297036 0.423971 0.782421 1.094574 1.237964 1.458722 1.683022 2.217064 2.401823 
+0.345577 0.539506 0.728116 0.928242 1.109271 1.252921 1.616753 1.872570 2.294941 2.593196 
+0.232502 0.366195 0.532625 0.762469 1.377487 1.543949 1.839468 2.094305 2.306962 2.746485 
+0.140704 0.240287 0.914003 1.159689 1.490769 1.781986 2.113189 2.322630 2.553898 2.735752 
+0.182050 0.274243 0.384886 0.753150 1.226502 1.367895 1.578386 1.756614 2.368689 2.613973 
+0.296233 0.395081 0.622990 1.050299 1.209800 1.377648 1.850837 1.965328 2.357424 2.667891 
+0.210632 0.289301 0.558974 0.972835 1.230379 1.669485 1.879551 2.047374 2.584468 2.764860 
+0.238075 0.443727 0.795624 1.008735 1.264607 1.681476 1.949029 2.204123 2.681059 2.831198 
+0.209107 0.318887 0.502202 0.936331 1.215090 1.364179 1.664829 1.835085 2.029832 2.237236 
+0.210399 0.360507 0.466140 0.793696 1.167290 1.269402 1.717457 1.883978 2.332357 2.642576 
+0.182774 0.238064 0.406254 0.553908 1.089357 1.921943 2.114739 2.269998 2.553977 2.719355 
+0.328207 0.496148 0.997544 1.217533 1.381558 1.589977 1.895773 2.171180 2.563942 2.756785 
+0.146726 0.209578 0.327902 0.527454 0.750165 0.964221 1.730110 1.909856 2.277000 2.794161 
+0.355489 0.509819 0.674351 0.852118 1.030963 1.155918 1.581384 2.041691 2.263390 2.416994 
+0.220775 0.394332 0.538938 0.857502 1.090722 1.239600 1.901251 2.063868 2.417954 2.814398 
+0.227931 0.269928 0.659119 1.441707 1.726640 1.837599 2.172077 2.323353 2.607646 2.741321 
+0.204294 0.338820 0.480507 0.748377 0.971841 1.112524 1.682403 1.842741 2.204016 2.598799 
+0.134004 0.253595 0.893064 1.145993 1.324870 1.551540 1.870979 2.144984 2.515124 2.768074 
+0.257317 0.324072 0.436271 0.992642 1.573175 1.838976 1.971813 2.132071 2.317177 2.463177 
+0.440270 0.694478 1.072028 1.389390 1.760193 1.976248 2.246033 2.390948 2.572760 2.701541 
+0.271868 0.367973 0.618954 0.990978 1.193710 1.400934 1.753507 2.089331 2.441172 2.596397 
+0.327621 0.496909 0.684291 0.830070 1.230609 1.553632 1.769123 2.021449 2.321602 2.475665 
+0.150834 0.225465 0.584436 0.830787 1.228446 1.381420 1.677267 1.961417 2.348329 2.682122 
+0.210368 0.286671 0.430934 1.168493 1.348054 1.560861 1.788186 2.334928 2.567985 2.774704 
+0.192791 0.272915 0.432199 0.684073 1.250160 1.396822 1.637113 1.872041 2.138995 2.291744 
+0.317041 0.383173 0.714443 0.880122 1.046184 1.601600 1.793056 1.983005 2.334210 2.481632 
+0.262491 0.384516 0.723463 0.898594 1.235333 1.679346 2.063633 2.230677 2.438434 2.609821 
+0.329714 0.503133 0.986474 1.242112 1.421780 1.772248 2.016548 2.418708 2.735517 2.841414 
+0.234483 0.366854 0.685189 0.837277 1.107168 1.323527 1.924146 2.188176 2.392339 2.576791 
+0.367554 0.480477 0.685257 0.863574 0.967484 1.324325 1.780913 1.895223 2.217908 2.565386 
+0.170831 0.247070 0.413674 0.735129 1.097256 1.244501 1.863046 2.116005 2.354145 2.593904 
+0.191987 0.265143 0.522063 1.001132 1.477027 1.634641 2.128571 2.320908 2.626696 2.814549 
+0.173820 0.236201 0.389631 0.565594 1.191995 1.339140 1.563074 2.078967 2.273323 2.569148 
+0.376887 0.472762 0.685713 0.842626 0.950694 1.348880 2.073181 2.248666 2.464908 2.680293 
+0.200511 0.267485 0.473655 0.709045 1.237600 1.615428 2.015635 2.177003 2.363079 2.525359 
+0.179632 0.571501 0.993053 1.356696 1.697465 1.978072 2.161225 2.343876 2.605905 2.752543 
+0.171679 0.323767 0.479066 0.737860 0.967236 1.119767 1.534022 1.686592 2.597041 2.826056 
+0.230844 0.314638 0.827482 1.044417 1.246762 1.604017 1.888847 2.034619 2.240069 2.646086 
+0.137641 0.194410 0.446076 0.749008 1.056291 1.455419 1.852539 2.123128 2.508952 2.766009 
+0.096036 0.420947 0.665747 1.146516 1.463996 1.612743 1.861963 2.227963 2.503650 2.739358 
+0.245487 0.384590 0.558312 0.811909 1.198414 1.349136 1.841320 2.025572 2.208162 2.405870 
+0.208252 0.316837 0.487011 0.938933 1.139581 1.396565 1.746724 2.105258 2.522568 2.681942 
+0.283283 0.395565 0.569206 0.705427 1.140133 1.660691 1.900167 2.146532 2.523653 2.667587 
+0.399059 0.602519 0.918365 1.124094 1.352400 1.574194 1.915640 2.120676 2.392517 2.583609 
+0.212592 0.313545 0.489908 0.651935 0.827527 1.014819 1.629779 2.107560 2.651570 2.794154 
+0.334733 0.413938 0.656403 1.035599 1.230100 1.372371 1.752515 1.932544 2.116066 2.340962 
+0.195470 0.268391 0.431096 0.744590 1.272458 1.434994 1.887256 2.055124 2.216059 2.355652 
+0.233843 0.277098 0.577590 1.353544 1.573248 1.679793 1.831093 1.982748 2.575813 2.732432 
+0.140410 0.214833 0.361115 0.707069 1.082237 1.227591 1.633210 1.818367 2.466253 2.766104 
+0.433646 0.517163 0.808168 1.061617 1.182393 1.497547 1.723696 1.907866 2.509297 2.679398 
+0.251461 0.331356 0.713430 0.993326 1.485426 1.665910 1.856843 2.073870 2.333905 2.470116 
+0.362946 0.782976 1.168741 1.324526 1.627412 1.779530 1.994819 2.203297 2.514465 2.683132 
+0.283937 0.367927 0.590168 0.763650 0.889158 1.242000 1.768049 2.150831 2.361695 2.526931 
+0.401929 0.576820 0.737804 0.921682 1.116842 1.229133 1.694656 2.010744 2.155271 2.356219 
+0.212653 0.310679 0.420635 1.110694 1.371611 1.510937 1.878595 2.017471 2.541126 2.696793 
+0.319899 0.406846 0.688156 1.227145 1.532072 1.647604 1.959419 2.112752 2.468573 2.688910 
+0.213311 0.302778 0.513141 0.665182 1.070601 1.519880 1.688862 2.155925 2.405361 2.641935 
+0.203445 0.273890 0.446788 0.621718 0.821718 1.552774 1.970174 2.157338 2.529885 2.666726 
+0.179248 0.265048 0.386747 0.570219 1.370731 1.523935 1.867101 2.136819 2.309819 2.738000 
+0.192568 0.286600 0.737250 1.129156 1.630027 1.793060 2.137459 2.357517 2.543832 2.752975 
+0.159062 0.222492 0.441749 0.706956 0.873673 1.273730 1.807800 2.085052 2.433983 2.738811 
+0.267122 0.464503 0.667094 0.815715 1.028866 1.162422 1.617585 2.164095 2.329764 2.612700 
+0.144708 0.223957 0.317997 0.564825 1.508828 1.655161 1.857741 2.024989 2.639153 2.820953 
+0.194645 0.249640 0.406742 0.707511 1.660221 1.859905 2.085456 2.405218 2.607363 2.746061 
+0.429960 0.592124 0.787877 0.890595 1.103239 1.404765 1.789301 2.072362 2.432455 2.617254 
+0.184536 0.285665 0.429789 0.950068 1.412318 1.523812 1.954708 2.141451 2.414013 2.765321 
+0.369916 0.560855 0.927769 1.354226 1.560397 1.733808 2.189951 2.345823 2.725694 2.866959 
+0.142852 0.219159 0.368392 0.659778 0.999846 1.194353 1.856812 2.065831 2.665677 2.850916 
+0.209110 0.305167 0.683734 0.914276 1.379246 1.526394 1.790110 2.064232 2.299981 2.459264 
+0.184899 0.316366 0.506466 0.728745 1.218050 1.378981 1.814293 1.999655 2.544039 2.730706 
+0.286474 0.355126 0.718899 1.089400 1.225976 1.695737 1.936410 2.121418 2.444195 2.568086 
+0.260728 0.353369 0.604610 0.768238 1.072125 1.608746 1.805375 1.949798 2.105786 2.406476 
+0.330885 0.561445 0.724292 0.940383 1.093573 1.263066 1.930153 2.163533 2.408371 2.762449 
+0.190585 0.245026 0.388935 0.531269 1.613901 1.940446 2.068138 2.295339 2.525519 2.695115 
+0.659517 0.793695 0.983316 1.214573 1.426393 1.621779 1.948650 2.120559 2.402013 2.570449 
+0.220748 0.332069 0.424610 0.602935 0.734265 0.935558 2.055617 2.265657 2.530681 2.854902 
+0.290477 0.440845 0.612873 0.839848 1.327423 1.456572 1.939179 2.167778 2.371320 2.570765 
+0.179431 0.280105 0.432734 0.918191 1.192829 1.320190 1.811052 1.955192 2.340353 2.782529 
+0.202912 0.265690 0.431272 1.238667 1.481469 1.610194 1.975157 2.101548 2.630962 2.798935 
+0.162106 0.210383 0.366556 0.543819 1.054714 1.205759 1.641024 2.015868 2.178793 2.627151 
+0.317316 0.385969 0.673513 1.190904 1.357921 1.500892 1.894288 2.020919 2.379283 2.662802 
+0.327266 0.429724 0.606313 0.900788 1.464235 1.816681 2.002694 2.138059 2.452853 2.554712 
+0.416374 0.642735 1.300859 1.518625 1.707945 1.956089 2.222013 2.390921 2.684341 2.784854 
+0.186066 0.250175 0.562512 0.738528 1.208585 1.362690 1.606043 2.109182 2.501183 2.707198 
+0.236912 0.461787 0.686242 0.881092 1.300577 1.424620 1.725187 2.169489 2.361758 2.662324 
+0.208063 0.337571 0.482777 0.926508 1.161683 1.311006 1.776451 1.933103 2.448810 2.646540 
+0.256479 0.328343 0.499814 1.097457 1.386665 1.496809 1.952745 2.087139 2.342994 2.654825 
+0.161661 0.224177 0.383379 0.607758 0.991555 1.381589 1.804283 1.998147 2.415608 2.619198 
+0.386111 0.495518 0.750917 0.937387 1.069306 1.592878 2.091954 2.230429 2.574083 2.695163 
+0.236835 0.303063 0.548777 0.748487 1.602860 1.790903 1.980987 2.173544 2.482285 2.674930 
+0.115857 0.253229 0.839446 1.182318 1.604808 1.930292 2.262789 2.477033 2.731091 2.843896 
+0.213435 0.341074 0.506347 0.714649 0.813915 1.154546 1.865334 2.056297 2.656061 2.833781 
+0.152341 0.225866 0.394818 0.830840 1.039343 1.299776 1.515314 1.701937 2.172593 2.703933 
+0.150002 0.193206 0.361814 0.541289 1.168971 1.515576 1.875006 2.181631 2.473830 2.750294 
+0.175983 0.238402 0.392935 0.834832 1.568038 1.753001 1.950436 2.176878 2.408077 2.761430 
+0.213829 0.318859 0.535586 0.713597 1.015672 1.174333 1.408597 2.083136 2.354086 2.563569 
+0.417612 0.500513 0.811466 1.027816 1.139572 1.532510 1.959824 2.084676 2.544668 2.694259 
+0.279259 0.446390 0.589074 0.796267 1.496946 1.723595 1.869786 2.100336 2.331076 2.456141 
+0.444430 0.638237 1.041068 1.445315 1.605692 1.733619 2.167615 2.326214 2.602181 2.745455 
+0.210087 0.362661 0.515500 0.840169 1.033119 1.239618 1.373615 1.803901 2.716235 2.848165 
+0.225160 0.350738 0.501850 0.896968 1.297884 1.414194 1.669332 1.835349 2.075666 2.672832 
+0.039211 0.113866 0.622349 0.907025 1.252791 1.535875 1.876167 2.163786 2.540348 2.789312 
+0.126350 0.194309 0.675134 1.116698 1.365415 1.576318 1.849118 2.102016 2.438531 2.737802 
+0.251266 0.342779 0.622143 0.793543 1.004128 1.433428 1.828192 2.011292 2.214652 2.441068 
+0.287491 0.392893 0.575294 0.916666 1.023814 1.482149 1.829139 1.953760 2.589735 2.724978 
+0.198423 0.295697 0.439598 0.609605 1.262768 1.619956 1.747689 2.005913 2.368608 2.490906 
+0.358531 0.483574 0.802846 1.004510 1.351513 1.645034 1.955330 2.161545 2.477437 2.639225 
+0.252099 0.385070 0.557560 0.740943 0.911070 1.013935 1.524718 2.136124 2.396009 2.750794 
+0.277335 0.507312 0.745418 0.921396 1.189730 1.321635 1.630275 2.000574 2.318359 2.450355 
+0.251729 0.359609 0.480792 0.813240 1.317908 1.441397 1.655896 2.171984 2.476511 2.611973 
+0.267463 0.311514 0.756574 1.332619 1.482384 1.635505 1.872999 2.053016 2.640422 2.756993 
+0.175657 0.240482 0.383528 0.598077 0.916809 1.091066 1.760568 1.946970 2.313700 2.484722 
+0.308726 0.352539 0.822652 1.208001 1.295254 1.507386 1.644261 1.995003 2.594656 2.684930 
+0.292332 0.442077 0.718688 0.941531 1.395212 1.630615 1.847265 2.270351 2.514492 2.713146 
+0.215044 0.379718 1.248947 1.429713 1.705990 1.881505 2.089432 2.306464 2.505316 2.662383 
+0.243250 0.359897 0.521676 0.699893 1.005116 1.271071 1.694794 2.008687 2.440679 2.593828 
+0.300924 0.394176 0.559419 0.899409 1.454448 1.708566 1.869825 2.116095 2.376539 2.493592 
+0.153405 0.251763 0.392574 0.866089 1.104658 1.286553 1.780043 1.916997 2.532174 2.688015 
+0.279453 0.326159 0.753633 1.333374 1.499514 1.626480 1.898852 2.038525 2.500726 2.702071 
+0.170059 0.229176 0.395854 0.705543 1.082349 1.588065 1.821443 1.949022 2.120108 2.537716 
+0.202145 0.274872 0.419107 0.608489 0.758495 1.603432 1.748277 2.189578 2.559336 2.730653 
+0.177888 0.251468 0.365661 0.658086 1.634785 1.816726 1.997979 2.183875 2.456958 2.811253 
+0.317970 0.468942 0.803601 1.078125 1.370511 1.630999 1.971111 2.226246 2.543508 2.768268 
+0.234066 0.324515 0.462757 0.683101 0.779120 1.399880 1.995585 2.098113 2.538242 2.655334 
+0.226221 0.390737 0.587891 0.741564 1.148309 1.290898 1.572982 2.116901 2.296227 2.676682 
+0.152380 0.275031 0.397732 0.652751 1.329373 1.439312 1.794813 1.940569 2.520664 2.797824 
+0.166696 0.251629 0.512274 1.144842 1.315763 1.710247 2.178415 2.460971 2.703738 2.827969 
+0.216867 0.347530 0.531282 0.706161 1.126385 1.301329 1.475176 1.901629 2.242013 2.431677 
+0.300362 0.482595 0.791226 1.005231 1.156964 1.313455 1.691239 2.006858 2.373111 2.733635 
+0.169474 0.255383 0.406046 0.734985 1.442352 1.579575 1.789148 1.957193 2.399133 2.566651 
+0.130440 0.237458 1.032166 1.386551 1.711848 1.993258 2.268221 2.439261 2.683283 2.812111 
+0.173867 0.278057 0.388656 0.749215 0.960862 1.146135 1.799140 1.979764 2.471783 2.619305 
+0.242130 0.340749 0.474654 0.828524 1.328466 1.445245 1.802538 2.204747 2.373101 2.551440 
+0.232537 0.347402 0.580048 1.030748 1.297867 1.477044 1.985462 2.164878 2.627119 2.813421 
+0.187113 0.520796 0.877184 1.139100 1.389082 1.622317 1.923715 2.144320 2.454348 2.655504 
+0.198782 0.276683 0.501229 0.913907 1.081324 1.395372 1.775624 1.940434 2.159949 2.585288 
+0.219192 0.432472 0.587263 0.912549 1.202466 1.322625 1.811369 1.992180 2.458299 2.760505 
+0.191165 0.276813 0.416963 0.651161 1.167971 1.294155 2.003249 2.230928 2.506110 2.774812 
+0.363801 0.518796 0.957361 1.225911 1.566650 1.757756 1.962407 2.115286 2.359997 2.543054 
+0.227701 0.362569 0.499430 0.731314 0.922719 1.040854 1.838698 2.164784 2.383067 2.810807 
+0.465091 0.619804 0.778037 0.935635 1.093218 1.259037 1.829035 2.206537 2.404214 2.547685 
+0.219345 0.331580 0.468701 0.864163 1.221425 1.316478 1.768475 2.078164 2.234895 2.666223 
+0.202678 0.257891 0.463059 1.225499 1.595549 1.714423 2.230601 2.403829 2.599305 2.731507 
+0.191295 0.292649 0.453931 0.663743 1.147168 1.275622 1.648493 2.119111 2.300099 2.725340 
+0.202700 0.296043 0.842652 1.096103 1.432375 1.634580 1.849789 2.019083 2.373823 2.644180 
+0.223698 0.286308 0.535549 0.951336 1.583619 1.712827 2.069074 2.228672 2.508621 2.712105 
+0.393154 0.609187 1.147735 1.476125 1.660227 2.028129 2.280391 2.450954 2.687946 2.792306 
+0.330421 0.541443 0.735477 0.935290 1.088544 1.300043 1.758898 2.291508 2.520235 2.677690 
+0.228002 0.342730 0.476697 0.849764 1.368387 1.487565 1.712396 1.973744 2.334383 2.559863 
+0.104462 0.175301 0.563572 0.921064 1.173139 1.367029 1.770789 1.951766 2.518901 2.747920 
+0.195798 0.262376 0.397584 1.297059 1.483849 1.624630 1.820421 2.042136 2.481635 2.604228 
+0.173538 0.223847 0.382154 0.562642 0.874661 1.340042 1.617180 1.932579 2.238320 2.383936 
+0.257237 0.371721 0.696634 0.866614 1.045455 1.380460 1.752496 2.066892 2.504906 2.650308 
+0.218997 0.321077 0.437617 0.666034 1.306150 1.849231 2.027564 2.199883 2.494261 2.649249 
+0.320867 0.453548 0.918076 1.266491 1.422317 1.759869 1.998420 2.173922 2.635097 2.760926 
+0.288066 0.410534 0.547460 0.760858 0.863292 1.068351 1.939410 2.167961 2.348114 2.767507 
+0.218835 0.407925 0.654818 0.800374 1.153682 1.307829 1.657331 1.988984 2.263141 2.720996 
+0.153945 0.202790 0.346143 0.519640 1.071723 1.237072 1.712069 1.893855 2.509996 2.744059 
+0.248060 0.319372 0.459918 0.983442 1.443498 1.755178 2.100888 2.226747 2.447411 2.563325 
+0.174462 0.227225 0.392742 0.571792 1.079416 1.257366 1.551460 2.042776 2.429302 2.629154 
+0.274891 0.362315 0.660508 0.970740 1.151818 1.492509 2.072636 2.222125 2.494909 2.686200 
+0.220299 0.317099 0.435591 0.793260 1.562295 1.723726 1.912306 2.110472 2.315517 2.618587 
+0.350079 0.511699 0.888658 1.136538 1.502800 1.698163 2.138112 2.327492 2.505197 2.660921 
+0.173175 0.286482 0.419571 0.629953 0.747452 1.073798 1.745440 1.887288 2.728362 2.862994 
+0.302893 0.357795 0.579776 1.154149 1.373560 1.502096 1.831774 1.992189 2.178385 2.421943 
+0.140345 0.186167 0.360424 0.858043 1.324588 1.624322 1.866334 2.036366 2.402471 2.617804 
+0.207490 0.275386 0.532026 0.903652 1.559244 1.774707 1.962334 2.362983 2.596218 2.738415 
+0.218842 0.320129 0.541623 0.875722 1.067991 1.362399 1.856837 2.024142 2.291054 2.645666 
+0.341898 0.421854 0.677264 0.873738 1.018393 1.630494 1.868485 2.019716 2.616580 2.717499 
+0.211631 0.278329 0.446819 0.679617 0.882530 1.848991 2.102209 2.280260 2.586273 2.750039 
+0.400922 0.636971 0.853016 1.019114 1.364375 1.550804 1.850055 2.119999 2.453786 2.623222 
+0.182154 0.242330 0.378923 0.509876 0.716576 1.076135 1.587035 2.069399 2.351207 2.660390 
+0.400616 0.546715 0.729647 0.920762 1.100075 1.250132 1.664408 1.856723 2.067945 2.443519 
+0.209711 0.304779 0.494008 0.698197 1.296713 1.461577 1.655811 1.885168 2.324920 2.489386 
+0.248365 0.299675 0.641181 1.260844 1.683313 1.795634 2.022337 2.219236 2.445410 2.655259 
+0.167092 0.244845 0.404157 0.672069 1.004556 1.174641 1.578514 1.897154 2.103236 2.709969 
+0.429420 0.514025 0.817076 1.048094 1.187821 1.561651 1.826573 2.032100 2.492575 2.641130 
+0.264974 0.350531 0.483895 0.953322 1.415379 1.541498 1.741521 2.171851 2.402443 2.527925 
+0.416115 0.686348 1.016333 1.284030 1.627945 1.880349 2.143431 2.282669 2.504877 2.648617 
+0.231020 0.416620 0.567188 0.760726 0.955087 1.089751 1.781039 1.967816 2.404279 2.797135 
+0.416422 0.567520 0.709693 0.879615 1.302011 1.438085 1.678611 2.054536 2.326361 2.457927 
+0.247904 0.324051 0.545383 1.111006 1.266454 1.612279 1.870112 2.027173 2.425991 2.655109 
+0.279983 0.344606 0.621600 1.161229 1.307142 1.554450 1.784019 1.936785 2.444710 2.544691 
+0.161547 0.223962 0.393255 0.741174 1.202310 1.599192 1.822694 1.937889 2.442478 2.729139 
+0.340992 0.431955 0.678217 0.820520 0.999612 1.548630 2.164553 2.310748 2.585979 2.711488 
+0.200183 0.279651 0.467745 0.730753 1.426170 1.607139 1.815853 2.220677 2.506455 2.727126 
+0.274123 0.333601 0.517799 0.968069 1.665916 2.015026 2.169211 2.290528 2.535899 2.658723 
+0.128641 0.167761 0.298260 0.447464 0.821352 1.285100 1.591690 1.879933 2.400984 2.764683 
+0.198225 0.285988 0.697225 0.945530 1.135179 1.304018 1.590254 1.943114 2.370953 2.581323 
+0.201444 0.271446 0.576127 0.726304 1.159527 1.677334 1.872822 2.127341 2.665189 2.807544 
+0.198540 0.257454 0.402737 0.846677 1.689490 1.872412 2.034308 2.301368 2.545100 2.729540 
+0.200348 0.278019 0.471514 0.752728 1.057356 1.291805 1.777614 1.916008 2.050356 2.172844 
+0.466866 0.645308 0.804067 0.998786 1.191235 1.303931 1.785280 2.063043 2.218678 2.420840 
+0.217955 0.321210 0.422194 0.865351 1.405153 1.526771 1.791058 2.088900 2.251039 2.667199 
+0.168989 0.497826 1.018345 1.283132 1.493512 1.888380 2.226737 2.418452 2.616832 2.749197 
+0.147852 0.218473 0.622343 0.825646 1.034661 1.220457 1.704813 2.051368 2.264302 2.712720 
+0.202129 0.285808 0.640153 0.871843 1.173967 1.564865 1.834400 2.062497 2.412487 2.645130 
+0.183772 0.259996 0.404816 0.684417 1.383605 1.536056 1.977056 2.169199 2.372324 2.556503 
+0.306590 0.365918 0.723737 1.056338 1.191585 1.709401 1.978183 2.126256 2.594741 2.707129 
+0.219620 0.295360 0.600693 0.751928 1.012492 1.554688 1.777591 1.936858 2.168459 2.637471 
+0.484146 0.588901 0.779655 0.974444 1.078335 1.362035 1.861448 1.968026 2.308413 2.629418 
+0.228810 0.270297 0.510434 0.721201 1.241319 1.730974 2.096849 2.211832 2.642499 2.808686 
+0.400197 0.579628 1.063821 1.257463 1.434952 1.645068 2.017358 2.268483 2.625254 2.773542 
+0.232047 0.335877 0.450404 0.618767 0.762409 0.943602 1.844169 2.391140 2.569963 2.779299 
+0.315037 0.423610 0.597448 0.972112 1.370369 1.476900 1.783359 2.042461 2.209021 2.480610 
+0.194589 0.300944 0.526012 0.730548 1.193408 1.383086 1.609867 1.882051 2.100633 2.703077 
+0.215641 0.294490 0.558585 1.391554 1.487145 1.740600 1.911148 2.277087 2.578133 2.742082 
+0.160391 0.226326 0.368755 0.670545 0.912912 1.286570 1.631159 1.807727 1.987079 2.498593 
+0.313582 0.634117 0.786900 0.944061 1.309221 1.432287 1.720247 2.096637 2.283214 2.589845 
+0.214437 0.264378 0.625288 0.975877 1.451393 1.848655 2.094494 2.248063 2.542408 2.690286 
+0.532950 0.968164 1.239348 1.422500 1.673683 1.785201 2.010288 2.200155 2.489732 2.638101 
+0.190399 0.270657 0.393327 0.864241 1.117361 1.553286 1.679497 2.236221 2.526322 2.700079 
+0.287724 0.467671 0.675841 0.856838 1.284704 1.460878 1.649715 1.913527 2.422638 2.548168 
+0.215869 0.300450 0.454163 1.082174 1.280570 1.465769 1.679659 1.869841 2.473902 2.623546 
+0.274887 0.330100 0.521274 1.123699 1.527645 1.625993 1.931695 2.090005 2.295751 2.645233 
+0.177139 0.223177 0.433328 0.774459 1.097689 1.467517 1.918942 2.134341 2.337195 2.540463 
+0.346166 0.429209 0.673089 0.781966 1.198349 1.775370 1.954363 2.186438 2.523312 2.625185 
+0.197636 0.296745 0.398712 0.631500 1.583954 1.843578 1.994071 2.173016 2.361743 2.519793 
+0.356767 0.538545 0.898397 1.140796 1.519279 1.870556 2.168497 2.427459 2.643928 2.759816 
+0.235015 0.349662 0.469548 0.816642 0.998816 1.146467 1.889133 2.097584 2.284986 2.765528 
+0.167083 0.224131 0.448491 0.771954 0.948871 1.283667 1.621698 1.998899 2.223248 2.603115 
+0.159315 0.217018 0.374226 0.590601 1.105826 1.536441 1.809766 1.960128 2.582005 2.795394 
+0.168849 0.234032 0.344667 1.029831 1.622442 1.708285 2.016025 2.179960 2.644139 2.784632 
+0.251075 0.442282 0.599669 0.763346 1.115735 1.253234 1.496825 1.992708 2.184264 2.666670 
+0.388258 0.473926 0.719990 1.058667 1.198870 1.374618 1.864229 2.002653 2.271742 2.608038 
+0.293347 0.422867 0.533090 0.863648 1.464010 1.686465 1.842829 2.008624 2.424518 2.579258 
+0.422335 0.661725 1.188673 1.343060 1.557186 1.860452 2.239896 2.431450 2.631923 2.747718 
+0.210220 0.335092 0.511807 0.760320 0.952999 1.125991 1.476685 1.647025 2.137411 2.688168 
+0.373319 0.450044 0.685548 1.063488 1.214342 1.368881 1.749950 1.871124 2.228036 2.638333 
+0.175282 0.247596 0.583289 0.800597 1.137160 1.494047 1.790222 1.974957 2.343536 2.783786 
+0.154093 0.244641 0.765316 0.879236 1.262433 1.388927 1.719208 2.139465 2.523177 2.692366 
+0.222311 0.296370 0.669831 0.821863 1.017560 1.348925 1.641603 1.852235 2.386204 2.585103 
+0.372785 0.531082 0.729578 0.873202 1.002102 1.194509 1.654182 2.163378 2.555067 2.658778 
+0.180452 0.250281 0.391345 0.554433 1.111079 1.737542 1.910605 2.127866 2.347054 2.534033 
+0.447990 0.697721 0.913809 1.073923 1.398658 1.670558 1.960290 2.195050 2.584428 2.733637 
+0.253764 0.410608 0.631333 0.803642 0.949880 1.072389 1.769476 2.303179 2.473513 2.749295 
+0.249292 0.446941 0.652687 0.818128 1.175583 1.321675 1.534828 1.927620 2.151897 2.401118 
+0.201342 0.301055 0.433733 0.667341 1.394399 1.542142 1.766411 2.222136 2.392138 2.617167 
+0.263299 0.393237 0.913686 1.357749 1.580030 1.698507 1.930164 2.135083 2.415503 2.650696 
+0.189848 0.308713 0.459867 0.797899 0.949965 1.168427 1.746219 1.919236 2.340878 2.529939 
+0.236533 0.300777 0.705293 0.910173 1.158168 1.522892 1.727631 1.847056 2.544899 2.698351 
+0.219264 0.293220 0.734905 0.969140 1.364696 1.628075 1.824426 1.921247 2.283403 2.660295 
+0.231171 0.417787 0.828086 1.301747 1.563040 1.823547 2.038748 2.195446 2.600171 2.776056 
+0.280635 0.391503 0.560168 0.699729 0.849390 1.139817 1.609055 2.003493 2.496847 2.631252 
+0.329050 0.484505 0.654854 0.957533 1.414924 1.532367 1.798653 2.132845 2.332577 2.503880 
+0.227219 0.317562 0.601344 0.991967 1.260680 1.430395 1.612725 1.766840 2.496056 2.645255 
+0.270493 0.315583 0.641937 1.235995 1.409340 1.574822 1.760130 1.902696 2.598899 2.735147 
+0.235474 0.326468 0.507399 0.696822 0.844939 1.633632 1.871816 2.063592 2.368254 2.525576 
+0.233853 0.361484 0.482226 0.641979 0.992245 1.767823 1.952577 2.472579 2.742913 2.825489 
+0.168433 0.243379 0.376538 0.823302 1.489064 1.619584 1.949821 2.203288 2.468309 2.771787 
+0.206625 0.282620 0.554762 1.077945 1.286219 1.787257 2.045355 2.207994 2.522847 2.710409 
+0.281540 0.359214 0.508755 0.689167 0.780776 1.277647 1.987095 2.102406 2.452824 2.573050 
+0.240331 0.408023 0.587761 0.766784 1.268990 1.450068 1.614701 2.027579 2.386559 2.524671 
+0.213600 0.378897 0.482559 0.820665 1.293224 1.395614 1.715777 1.852078 2.466446 2.706440 
+0.192448 0.262539 0.378679 1.019763 1.468722 1.663670 1.910800 2.391601 2.621746 2.796560 
+0.220322 0.364745 0.565226 0.783488 1.013662 1.175116 1.402286 1.885036 2.103704 2.324743 
+0.322267 0.390833 0.713492 1.031629 1.156838 1.350887 1.515558 1.694139 2.382654 2.516728 
+0.192624 0.294262 0.426181 0.741678 1.498008 1.633347 1.893062 2.059462 2.393665 2.782635 
+0.237455 0.354262 0.864239 1.246075 1.666553 1.844678 2.174333 2.351099 2.520290 2.655921 
+0.185359 0.302261 0.428703 0.781405 0.947101 1.141955 1.617902 1.761286 2.464616 2.634452 
+0.271859 0.354517 0.569485 1.079860 1.240128 1.441296 1.944968 2.053805 2.406507 2.736827 
+0.214936 0.298540 0.472345 0.913665 1.080008 1.684282 1.985267 2.173551 2.601519 2.749361 
+0.318521 0.444000 0.739244 0.971075 1.303751 1.557191 1.918998 2.197692 2.552225 2.778091 
+0.187184 0.266393 0.414559 0.873123 1.122008 1.345856 1.781616 1.932051 2.123625 2.364411 
+0.212033 0.437364 0.587744 0.807841 1.008570 1.156068 1.667422 1.813734 2.388649 2.769182 
+0.177749 0.231877 0.394438 0.587873 1.018115 1.532170 2.031818 2.176571 2.587458 2.778604 
+0.397403 0.572539 1.117765 1.287841 1.469835 1.676483 1.995880 2.232196 2.496431 2.667425 
+0.173937 0.259671 0.371889 0.555593 0.908572 1.118222 1.943858 2.087012 2.545553 2.816900 
+0.296434 0.458071 0.635222 0.864989 1.198523 1.305471 1.672912 2.015023 2.193002 2.377815 
+0.205052 0.312572 0.468685 0.774972 1.212302 1.316262 1.821237 2.193552 2.380352 2.766685 
+0.240642 0.281687 0.717545 1.351376 1.501114 1.640455 2.046214 2.216028 2.588688 2.729942 
+0.230445 0.421175 0.558602 0.846662 1.051701 1.197214 1.704701 1.838398 2.267565 2.697618 
+0.276287 0.327977 0.824738 1.266737 1.373629 1.712792 1.891497 2.121117 2.537629 2.629970 
+0.236249 0.310208 0.402132 0.954290 1.542483 1.886318 2.043856 2.203899 2.435931 2.547918 
+0.323080 0.525410 0.940102 1.419025 1.732419 1.904886 2.278288 2.399903 2.613800 2.842137 
+0.259462 0.384806 0.559454 0.827377 1.079010 1.194629 1.553023 2.150915 2.369416 2.537197 
+0.309877 0.458904 0.634515 0.905896 1.340319 1.484136 1.732179 2.044813 2.234578 2.374887 
+0.200760 0.267223 0.619798 0.880150 1.341984 1.566789 1.724877 1.834378 2.408354 2.666757 
+0.232160 0.325786 0.611845 1.111911 1.277003 1.508409 1.711967 2.103218 2.470657 2.665982 
+0.160381 0.206959 0.356984 0.510509 1.122026 1.271899 1.727695 1.943129 2.251421 2.380751 
+0.339821 0.413428 0.663411 0.796136 0.920303 1.589702 1.879891 1.995622 2.491309 2.584399 
+0.225236 0.289017 0.531590 0.689709 1.348190 1.761804 1.902696 2.175207 2.654910 2.781414 
+0.283922 0.449613 0.777624 1.129523 1.487473 1.706799 2.164061 2.402885 2.691872 2.844990 
+0.328301 0.439249 0.648655 0.897495 1.049452 1.222028 1.849808 2.229574 2.423163 2.565623 
+0.236478 0.488322 0.656819 0.862950 1.144127 1.252241 1.694351 2.068901 2.226797 2.679600 
+0.169945 0.258037 0.384767 0.609183 1.121274 1.266086 1.906028 2.054377 2.436068 2.795471 
+0.177152 0.233124 0.534434 0.970496 1.404070 1.867414 2.171355 2.381133 2.619262 2.753148 
+0.225245 0.323943 0.535205 0.711545 1.030041 1.268317 1.543910 1.921579 2.352057 2.531897 
+0.380284 0.516944 0.727113 0.869680 1.061908 1.484627 1.847885 2.176267 2.550710 2.682243 
+0.227653 0.311146 0.407614 0.830722 1.390383 1.796577 1.984514 2.172202 2.442702 2.597183 
+0.395180 0.597222 0.988635 1.248608 1.649366 1.943305 2.114992 2.281535 2.610845 2.728627 
+0.159527 0.253807 0.427177 0.703855 0.920030 1.359209 1.618673 1.774181 2.658938 2.839174 
+0.232953 0.317175 0.734127 1.080631 1.332652 1.674943 1.899956 2.046773 2.307884 2.543358 
+0.125436 0.171676 0.329679 0.770190 1.288629 1.482675 1.769818 2.055328 2.430854 2.715479 
+0.108098 0.175220 0.776302 1.221645 1.460683 1.686249 1.929306 2.193619 2.536986 2.758891 
+0.152357 0.202480 0.472758 0.861767 1.159578 1.340969 1.681897 2.048109 2.275054 2.477467 
+0.216694 0.273656 0.664155 0.850536 1.153027 1.561670 1.759318 1.901416 2.353101 2.500133 
+0.234504 0.329541 0.449717 0.797883 1.290186 1.691782 1.880443 2.100171 2.454967 2.611905 
+0.423938 0.621841 0.996723 1.214793 1.409002 1.563377 1.783564 2.010297 2.490150 2.698586 
+0.224661 0.325658 0.459910 0.625802 0.808594 0.895832 1.274078 2.111179 2.326505 2.585806 
+0.276916 0.361107 0.729423 0.920236 1.053283 1.413110 1.741880 1.962097 2.139800 2.429514 
+0.174802 0.232198 0.385912 0.540434 1.262000 1.441657 1.595105 1.943274 2.269839 2.417795 
+0.265949 0.330919 0.614312 1.257075 1.438174 1.628356 1.917882 2.077892 2.425421 2.567960 
+0.184742 0.272816 0.441616 0.641718 0.815915 1.210558 1.722330 1.942876 2.319698 2.747254 
+0.390404 0.468994 0.743751 0.956882 1.081791 1.532303 1.750715 1.909157 2.466230 2.592626 
+0.278150 0.353755 0.588139 1.120329 1.521033 1.629736 1.993707 2.192040 2.399567 2.620496 
+0.431717 0.694505 1.256024 1.445196 1.671784 1.844456 2.028769 2.200956 2.506360 2.653075 
+0.208110 0.276044 0.538093 0.719555 0.900539 1.075355 1.745222 2.086474 2.298600 2.556630 
+0.352056 0.531509 0.676701 0.887365 1.282885 1.426632 1.614434 1.945858 2.270688 2.425511 
+0.247241 0.356899 0.502519 1.065178 1.284311 1.437490 1.855456 1.992377 2.597541 2.776219 
+0.396219 0.473793 0.715289 1.202273 1.346298 1.549130 1.940574 2.082739 2.514755 2.713815 
+0.202378 0.285773 0.510159 0.640990 1.020854 1.686414 1.864702 2.133482 2.472249 2.625491 
+0.136813 0.196375 0.389204 0.606996 0.826010 1.435725 1.829944 2.110031 2.522891 2.760011 
+0.178586 0.265329 0.368903 0.594584 1.563859 1.743534 1.910893 2.088980 2.290832 2.753782 
+0.326016 0.474212 0.821872 1.109710 1.491269 1.780679 1.990347 2.151819 2.439284 2.687522 
+0.198877 0.303609 0.451495 0.660899 0.772185 1.284705 1.783160 1.923118 2.602735 2.756655 
+0.279250 0.410975 0.617113 0.801949 0.990885 1.139677 1.438000 1.937681 2.530952 2.667930 
+0.182348 0.288676 0.418208 0.638943 1.372299 1.531009 1.853629 2.058568 2.425537 2.822046 
+0.235124 0.297027 0.512992 0.982242 1.579055 1.930478 2.096962 2.225930 2.572915 2.699703 
+0.162278 0.215431 0.355780 0.485908 0.932607 1.181318 1.754127 1.988386 2.205810 2.337559 
+0.508788 0.685414 0.844731 0.983038 1.244131 1.360404 1.646047 2.084834 2.375165 2.496801 
+0.221912 0.310104 0.433571 0.978939 1.478709 1.587503 1.870190 2.010717 2.307807 2.780012 
+0.359050 0.649694 1.005623 1.392268 1.637149 1.994024 2.239355 2.474016 2.727591 2.831065 
+0.174907 0.277141 0.433141 0.954995 1.167887 1.336923 1.902421 2.052616 2.483944 2.686652 
+0.193342 0.297566 0.824802 1.002859 1.285763 1.465909 1.800134 2.073494 2.392133 2.587289 
+0.209852 0.288483 0.458682 0.843162 1.202473 1.352796 2.014405 2.202275 2.423702 2.568228 
+0.276031 0.338955 0.858149 1.217747 1.357220 1.691136 1.841368 2.176457 2.647222 2.735745 
+0.223125 0.303040 0.542560 0.703413 1.109469 1.691790 1.909510 2.043240 2.184955 2.383039 
+0.338660 0.434962 0.644715 0.989980 1.142041 1.308641 1.862318 1.996732 2.219202 2.585521 
+0.169788 0.227570 0.355680 0.476462 1.249736 1.884793 2.054427 2.245569 2.516757 2.692583 
+0.510617 0.730414 1.008300 1.210250 1.460951 1.677387 1.984236 2.201040 2.503259 2.654324 
+0.224817 0.351828 0.465847 0.709341 0.827775 0.992719 1.978367 2.142995 2.475303 2.800083 
+0.308599 0.506317 0.673098 0.860582 1.161218 1.306099 1.811163 2.021896 2.233070 2.490125 
+0.180388 0.242667 0.458646 0.739129 1.098421 1.521511 1.707512 1.853458 2.375659 2.563893 
+0.191139 0.259717 0.375119 1.195018 1.535308 1.637017 1.945089 2.126276 2.528158 2.662854 
+0.144026 0.195867 0.353543 0.581701 1.048420 1.377425 1.815657 1.969736 2.339863 2.778177 
+0.384542 0.545846 0.742643 1.036203 1.274580 1.406237 1.737850 2.169732 2.446560 2.578757 
+0.313042 0.444130 0.599720 0.924365 1.567785 1.748672 1.900293 2.194593 2.410541 2.573262 
+0.492225 0.752280 1.124936 1.471295 1.758189 2.030974 2.238788 2.397439 2.680130 2.783434 
+0.204117 0.347099 0.699998 0.845266 1.234413 1.419863 1.647535 2.080443 2.553390 2.707330 
+0.257069 0.400082 0.558347 0.805346 1.259790 1.380823 1.608549 2.124230 2.308452 2.486914 
+0.187028 0.318194 0.445217 0.923741 1.268789 1.390301 1.796420 1.931293 2.418538 2.603222 
+0.243477 0.326319 0.635481 1.172112 1.360926 1.526662 2.109593 2.260517 2.545032 2.720529 
+0.166613 0.243290 0.400708 0.657757 0.842275 1.476511 1.791837 1.950760 2.119370 2.472850 
+0.311146 0.353401 0.824181 1.012251 1.149117 1.842349 2.055130 2.218062 2.570268 2.661992 
+0.208668 0.283611 0.411201 0.809929 1.517017 1.823008 1.957049 2.229403 2.412596 2.626293 
+0.154448 0.334483 0.779457 1.197447 1.370217 1.692002 1.980004 2.409686 2.713983 2.827926 
+0.234171 0.317688 0.451503 0.830950 0.995999 1.149839 1.803812 2.310181 2.531615 2.732000 
+0.268413 0.427669 0.559871 0.864380 1.275062 1.362920 1.581797 1.689453 2.226263 2.624807 
+0.107565 0.142648 0.266262 0.674471 1.151548 1.464128 1.861043 2.141020 2.509385 2.783297 
+0.182059 0.241841 0.379523 1.073956 1.618846 1.718260 1.915296 2.047758 2.360928 2.720733 
+0.235150 0.374352 0.545815 0.714492 0.870405 1.000816 1.559351 1.984193 2.158182 2.596142 
+0.434816 0.514709 0.756010 0.899497 1.037358 1.585142 1.834527 2.000422 2.564235 2.674345 
+0.220087 0.341090 0.451896 0.734427 1.391206 1.582675 1.725710 2.141788 2.371107 2.511862 
+0.482146 0.706990 1.033285 1.248170 1.467412 1.657558 2.147999 2.343164 2.600856 2.731213 
+0.213401 0.322062 0.647358 0.791444 0.977300 1.281320 1.599647 1.939047 2.672620 2.797626 
+0.266041 0.338577 0.634659 1.127429 1.295917 1.449033 1.658080 1.796624 2.285728 2.541842 
+0.119705 0.174258 0.480098 1.063251 1.273831 1.476888 1.794829 2.119252 2.513047 2.762255 
+0.132629 0.207248 0.566178 1.085083 1.427584 1.613863 1.889768 2.150853 2.557229 2.784690 
+0.243227 0.327780 0.614668 0.761155 0.956760 1.516306 1.811880 2.030177 2.440252 2.582195 
+0.276721 0.454860 0.642970 0.784038 1.148980 1.495704 1.703559 2.045787 2.591550 2.733608 
+0.189778 0.287373 0.392353 0.645856 1.447021 1.617951 1.816249 2.137973 2.286683 2.572288 
+0.400084 0.558491 0.869949 1.062095 1.467794 1.653306 1.899420 2.128461 2.442747 2.604032 
+0.199764 0.300259 0.426072 0.645425 0.897550 1.048949 1.748510 2.273694 2.495239 2.649109 
+0.296976 0.548524 0.761769 0.955832 1.233251 1.360741 1.693122 2.106225 2.391505 2.525275 
+0.248971 0.399490 0.565645 0.720524 1.301434 1.542758 1.716234 2.124059 2.351786 2.681231 
+0.230842 0.287955 0.878785 1.471322 1.627007 1.798878 2.005181 2.197775 2.563907 2.690549 
+0.176416 0.248403 0.402172 0.733179 0.912580 1.227444 1.694562 2.088653 2.427226 2.563010 
+0.330895 0.394275 0.774692 1.201779 1.321842 1.534733 1.782019 1.938050 2.422893 2.563017 
+0.227080 0.299503 0.577295 0.756890 1.417382 1.624050 1.795338 2.177707 2.440812 2.572784 
+0.411173 0.652311 1.207281 1.442451 1.795401 2.003085 2.140804 2.292980 2.639630 2.785365 
+0.332277 0.425121 0.639151 0.821829 0.917909 1.367536 1.826675 1.939314 2.535595 2.654182 
+0.345400 0.534948 0.689404 0.928224 1.433841 1.640941 1.825449 2.051581 2.274575 2.418295 
+0.141590 0.233113 0.380526 0.868351 1.172524 1.363081 1.874782 2.001448 2.669736 2.855042 
+0.309644 0.355571 0.694245 1.252006 1.460701 1.577178 1.853145 1.978370 2.227714 2.570337 
+0.181796 0.242419 0.465928 0.715655 1.132014 1.662718 1.850134 1.972773 2.184021 2.722527 
+0.270338 0.338307 0.544290 0.711724 0.871287 1.703598 1.918408 2.093313 2.668494 2.765585 
+0.150135 0.233584 0.336008 0.740881 1.603784 1.723020 1.936836 2.077330 2.611782 2.783379 
+0.294465 0.456340 0.870538 1.062801 1.291659 1.616175 2.070689 2.369390 2.648605 2.779945 
+0.220578 0.311705 0.491111 0.847979 1.008368 1.532076 1.849702 2.005101 2.512156 2.669189 
+0.229638 0.339951 0.513064 0.716308 1.121176 1.256758 1.479075 2.121337 2.503285 2.662824 
+0.160524 0.210553 0.362234 0.595417 1.110208 1.477620 1.653645 1.883754 2.439740 2.625662 
+0.236615 0.430340 0.682470 0.856444 1.159709 1.515913 1.944281 2.332831 2.633186 2.783526 
+0.208672 0.301280 0.471802 0.926610 1.098592 1.288875 1.519452 1.800256 2.105532 2.428804 
+0.243004 0.379283 0.831427 0.991746 1.231060 1.393310 1.679725 2.091152 2.354981 2.528458 
+0.149934 0.192836 0.336118 0.489287 1.278027 1.443086 1.737711 1.939793 2.258510 2.725935 
+0.162158 0.237674 0.813115 1.431297 1.690841 1.974269 2.228385 2.387649 2.645607 2.800036 
+0.196527 0.310980 0.462098 0.736718 0.837132 1.268534 1.708387 1.848473 2.433059 2.576944 
+0.217349 0.293339 0.438216 0.968725 1.350504 1.532480 1.911129 2.082089 2.268517 2.522732 
+0.172105 0.253481 0.450363 0.927945 1.249256 1.437596 1.922782 2.218348 2.523926 2.733317 
+0.289228 0.446047 0.832892 1.123024 1.277186 1.474382 1.792564 2.096649 2.561362 2.797590 
+0.214142 0.283470 0.516137 1.061346 1.260972 1.417097 1.665641 1.862087 2.187452 2.353608 
+0.235527 0.492936 0.614052 0.859127 0.993761 1.190535 1.848411 1.973235 2.500443 2.746547 
+0.143271 0.207291 0.331889 0.827028 1.406412 1.555136 2.045910 2.231114 2.689514 2.839109 
+0.343742 0.496860 0.865166 1.285087 1.588995 1.756794 2.022431 2.211289 2.468649 2.662665 
+0.213309 0.328675 0.455568 0.723514 0.874048 1.082530 1.853818 2.038906 2.260788 2.778839 
+0.356471 0.536984 0.755721 0.903361 1.038099 1.226007 1.687762 2.156339 2.420844 2.542644 
+0.281664 0.451610 0.591581 0.828915 1.326665 1.477284 1.708022 2.017509 2.266128 2.700127 
+0.135742 0.202004 0.583681 1.273102 1.602365 1.942380 2.228707 2.450342 2.728373 2.845988 
+0.176935 0.288677 0.440469 0.786770 1.012958 1.172754 1.752038 1.913637 2.366577 2.766438 
+0.207276 0.322804 0.788604 1.062222 1.294802 1.485775 1.944748 2.180022 2.397073 2.598545 
+0.258418 0.319098 0.442127 1.133408 1.649338 1.854417 1.994251 2.185084 2.363409 2.534653 
+0.230448 0.768093 1.180265 1.433576 1.687255 1.978844 2.259606 2.452430 2.659127 2.786279 
+0.211701 0.332064 0.697403 0.880507 1.102252 1.277927 1.808607 2.273983 2.531209 2.736845 
+0.245378 0.367568 0.512696 0.766674 1.343265 1.519747 1.697079 2.028107 2.215378 2.381457 
+0.221209 0.324945 0.580820 0.748228 1.178564 1.431153 1.585928 1.927918 2.511054 2.643255 
+0.201716 0.269175 0.401778 1.244589 1.471872 1.604627 1.805637 1.992744 2.610885 2.752593 
+0.160780 0.247690 0.362958 0.624009 1.013756 1.182001 1.581983 1.735927 2.415792 2.646241 
+0.320217 0.438376 0.710346 0.878476 1.032132 1.508649 1.972158 2.150849 2.428882 2.559870 
+0.229810 0.276051 0.623852 0.830087 1.321297 1.854677 2.155401 2.284792 2.546209 2.690175 
+0.172343 0.516169 0.866716 1.177175 1.468063 1.699344 1.986666 2.212830 2.511703 2.739129 
+0.301807 0.360652 0.549602 0.672645 0.818574 1.362279 2.098253 2.278909 2.509794 2.695143 
+0.294974 0.528192 0.672468 0.856772 1.265640 1.393603 1.638102 2.013275 2.218602 2.565642 
+0.169196 0.238150 0.410484 0.644996 1.213738 1.372823 1.800122 1.969874 2.449498 2.615088 
+0.184333 0.260633 0.376102 1.023515 1.545709 1.640728 2.037188 2.208164 2.488002 2.744323 
+0.205806 0.304865 0.436462 0.616734 1.126032 1.261522 1.725527 2.275740 2.464199 2.702123 
+0.184070 0.318390 0.717474 0.865476 1.106500 1.361536 2.038210 2.231225 2.554333 2.779851 
+0.246294 0.360790 0.538254 0.736709 1.529013 1.795377 1.952814 2.142384 2.364128 2.495169 
+0.353866 0.494646 0.877256 1.112783 1.566844 1.730636 2.025508 2.291163 2.453412 2.592313 
+0.266813 0.432427 0.627311 0.754824 0.905537 1.197394 1.729117 2.123791 2.612331 2.827337 
+0.273873 0.325959 0.540600 1.115405 1.498701 1.606801 1.814584 1.961539 2.188053 2.581605 
+0.080925 0.099600 0.276658 0.947658 1.291923 1.611810 1.910613 2.219380 2.537903 2.797293 
+0.168058 0.226944 0.705184 1.118312 1.428461 1.627351 1.878361 2.102812 2.397762 2.613552 
+0.257821 0.370068 0.510355 0.878371 1.064949 1.223791 1.796480 2.039854 2.276323 2.505472 
+0.243671 0.302629 0.595985 0.730818 1.062394 1.558183 1.727802 1.887397 2.590876 2.710615 
+0.211122 0.278412 0.520693 0.699430 1.097533 1.812529 1.983523 2.189366 2.429825 2.610746 
+0.256155 0.564923 0.839859 0.987034 1.191276 1.647157 2.021784 2.266855 2.558850 2.704555 
+0.202989 0.292278 0.435910 0.640810 0.806537 0.924136 1.535334 2.086372 2.299823 2.572501 
+0.261418 0.340324 0.627433 1.013276 1.180897 1.361209 1.731180 1.903731 2.106233 2.555098 
+0.183272 0.269138 0.450407 0.909918 1.188568 1.381279 1.745735 1.872820 2.365239 2.484744 
+0.230426 0.280037 0.644137 1.434869 1.666206 1.796575 2.015246 2.157224 2.561916 2.707798 
+0.227013 0.347868 0.525371 0.707399 0.880208 1.091634 1.654713 1.951332 2.177455 2.319267 
+0.380861 0.446326 0.749128 1.201643 1.336943 1.503446 1.800630 1.947582 2.527910 2.700466 
+0.315223 0.375610 0.564441 1.017919 1.552234 1.710374 1.873741 2.122288 2.299878 2.473435 
+0.446116 0.664203 0.984542 1.279400 1.574979 1.727934 1.978897 2.175567 2.469185 2.631008 
+0.221571 0.330656 0.499929 0.777432 1.028387 1.180617 1.640596 2.168791 2.367015 2.714387 
+0.421994 0.632233 0.778145 1.001218 1.346201 1.466628 1.720295 1.964067 2.152128 2.372888 
+0.163687 0.242822 0.347278 0.971370 1.516739 1.620115 1.816941 1.949014 2.443334 2.638176 
+0.284949 0.352677 0.685252 1.135143 1.255140 1.560889 1.905396 2.035214 2.547256 2.683043 
+0.177362 0.243130 0.452833 0.824266 1.135565 1.520115 1.813864 1.958746 2.294091 2.563724 
+0.178458 0.242386 0.592702 0.788280 1.051353 1.502905 1.934975 2.183628 2.477003 2.654310 
+0.259519 0.407690 0.538212 0.728451 1.390298 1.713874 1.876895 2.109781 2.420753 2.577065 
+0.255216 0.310327 0.589176 1.157266 1.687747 1.925407 2.045142 2.222504 2.425083 2.548028 
+0.164446 0.206868 0.378009 0.525559 0.944579 1.419792 1.613300 1.889685 2.292641 2.565572 
+0.240619 0.406939 0.588886 0.735213 1.146793 1.389773 1.537737 1.878402 2.297976 2.552226 
+0.289310 0.418786 0.620314 0.764899 1.239942 1.612628 1.827524 2.107944 2.485462 2.639007 
+0.198771 0.253637 0.405678 1.048168 1.663883 1.766039 2.128211 2.283365 2.560190 2.709800 
+0.165963 0.230669 0.375008 0.692069 0.959835 1.378579 1.760825 1.948801 2.081418 2.369799 
+0.523510 0.686129 0.825335 1.033919 1.330937 1.444794 1.739869 2.062844 2.315205 2.450730 
+0.293681 0.417926 0.595503 0.957896 1.404495 1.522162 1.884014 2.096933 2.301269 2.621891 
+0.359283 0.604669 1.076288 1.248249 1.451793 1.744413 2.125184 2.431489 2.687730 2.799316 
+0.156185 0.235581 0.552175 0.813130 1.154557 1.326329 1.861696 2.153380 2.503796 2.787362 
+0.290411 0.440558 0.736912 0.889007 1.171361 1.470366 1.794734 2.061516 2.373978 2.626041 
+0.224936 0.320946 0.527542 0.738900 1.255619 1.428610 1.871090 2.256589 2.480524 2.694434 
+0.288975 0.352962 0.777218 0.955880 1.109873 1.594800 1.813598 1.955710 2.589302 2.714964 
+0.213548 0.285746 0.635954 0.830113 1.233322 1.591243 1.839168 1.977797 2.191863 2.623667 
+0.336902 0.465806 0.655656 0.935793 1.068579 1.275847 1.761107 1.886493 2.444770 2.653299 
+0.178879 0.258874 0.377390 0.527403 1.357599 1.761048 1.949090 2.163795 2.596422 2.759195 
+0.430143 0.622963 0.955719 1.182584 1.497132 1.720157 2.044968 2.255285 2.544050 2.680998 
+0.213810 0.308853 0.412187 0.569347 0.698344 0.951238 1.880619 2.207829 2.428571 2.828730 
+0.230078 0.350112 0.747969 0.974442 1.265182 1.407146 1.813877 2.069124 2.247230 2.451871 
+0.161458 0.227385 0.387324 0.640232 1.277813 1.478011 1.725217 1.915041 2.125833 2.645182 
+0.200302 0.251181 0.381966 1.303694 1.547137 1.662388 2.120598 2.270182 2.603139 2.775037 
+0.143149 0.204983 0.349581 0.667355 1.054734 1.399807 1.727708 1.850109 2.047799 2.715549 
+0.337070 0.484021 0.803330 0.985730 1.331585 1.542266 1.830512 2.086973 2.445274 2.632911 
+0.215583 0.269471 0.606879 0.945487 1.515635 1.750218 1.939935 2.174549 2.408151 2.576074 
+0.534065 0.863487 1.372366 1.575333 1.866659 2.070622 2.218716 2.368585 2.634956 2.716254 
+0.237658 0.350270 0.489196 0.956466 1.150453 1.341383 1.448597 2.345953 2.655585 2.785735 
+0.233020 0.367323 0.713299 0.877999 1.226884 1.412189 1.743848 1.959402 2.416964 2.595603 
+0.134934 0.190506 0.457228 0.942655 1.200550 1.509494 1.748249 1.912543 2.326213 2.742656 
+0.297757 0.342592 0.625651 1.192568 1.540655 1.652384 1.875775 2.074460 2.224137 2.465967 
+0.177286 0.234207 0.389716 0.517516 1.264974 1.424653 1.878090 2.150100 2.343577 2.537476 
+0.281819 0.367413 0.659188 0.765361 1.004368 1.501384 1.726113 2.194951 2.534788 2.645854 
+0.180979 0.252107 0.389029 0.570917 1.209940 1.699305 2.111361 2.224160 2.447867 2.620250 
+0.256330 0.426903 0.826318 1.152683 1.487139 1.915114 2.246737 2.487453 2.705023 2.815420 
+0.195539 0.316745 0.452617 0.833168 0.960504 1.269064 1.879314 2.025539 2.474377 2.680723 
+0.203505 0.369568 0.536367 0.778820 1.088933 1.243750 1.588708 1.823497 2.020053 2.594631 
+0.156418 0.198956 0.346275 0.496071 1.022702 1.572819 1.753592 2.143215 2.439211 2.674470 
+0.160863 0.247666 0.345815 0.841020 1.523112 1.638256 1.887324 2.031339 2.509810 2.718796 
+0.258214 0.480809 0.650419 0.801775 1.142337 1.283943 1.504959 2.054206 2.225835 2.474616 
+0.303681 0.412740 0.649849 1.086617 1.266890 1.447470 1.896224 2.075119 2.565787 2.741747 
+0.271067 0.413984 0.597954 0.768944 1.247881 1.606107 1.786404 2.085376 2.326363 2.529854 
+0.521626 0.811390 1.129336 1.284608 1.629969 1.909728 2.228029 2.368756 2.570103 2.697107 
+0.303633 0.421526 0.573677 0.925024 1.125497 1.258550 1.501212 1.610013 2.249352 2.608832 
+0.411522 0.503523 0.746692 1.046522 1.172005 1.384521 1.797259 1.900603 2.387578 2.660719 
+0.175711 0.239782 0.620582 0.952051 1.278311 1.501826 1.917072 2.130700 2.368785 2.608122 
+0.164631 0.422501 0.724319 0.950544 1.214644 1.491261 1.799734 2.067799 2.473726 2.757283 
+0.193259 0.281162 0.690376 0.855405 1.232753 1.402146 1.689327 1.991274 2.228334 2.435353 
+0.301425 0.429993 0.650401 0.873662 1.008503 1.369274 1.690750 1.825918 2.520079 2.683664 
+0.155700 0.201237 0.338696 0.505340 1.147916 1.472901 1.941300 2.074514 2.326431 2.663368 
+0.350326 0.535475 0.827403 1.201270 1.427031 1.581852 1.963067 2.220906 2.472991 2.668217 
+0.279035 0.416052 0.604816 0.794888 0.990688 1.105072 1.420018 2.166296 2.539337 2.676318 
+0.278246 0.394509 0.777126 0.921607 1.080479 1.281224 1.433634 2.046850 2.283781 2.454104 
+0.158340 0.199119 0.354050 0.555065 1.177314 1.442096 1.685385 2.144139 2.396032 2.716012 
+0.247102 0.317737 0.855614 1.333153 1.454453 1.787157 1.970697 2.269614 2.586000 2.679846 
+0.202515 0.257270 0.542126 0.724324 0.933997 1.317188 1.717435 2.091303 2.303481 2.469447 
+0.295032 0.375581 0.775220 1.057728 1.185439 1.521116 1.807145 1.955630 2.459124 2.631564 
+0.266524 0.353178 0.553809 1.043318 1.444903 1.560508 1.829729 1.962933 2.504864 2.699633 
+0.392075 0.574661 1.110281 1.317280 1.473545 1.883432 2.051877 2.263410 2.613387 2.737894 
+0.168326 0.277952 0.453865 0.702950 0.855434 1.035959 1.678564 1.811649 2.430121 2.811216 
+0.301453 0.416493 0.552087 0.857890 1.446563 1.610970 1.775934 2.104633 2.298771 2.438580 
+0.296445 0.422883 0.572322 1.053033 1.294027 1.427183 1.752752 1.892326 2.450076 2.720985 
+0.291284 0.337800 0.787813 1.245129 1.350343 1.575395 1.771522 2.054749 2.520469 2.632047 
+0.138710 0.200016 0.384208 0.667517 0.930105 1.493340 1.923603 2.079511 2.389298 2.733779 
+0.280864 0.419489 0.614429 0.763022 1.011923 1.456038 1.644559 2.246694 2.668232 2.789516 
+0.145213 0.217524 0.328786 0.706480 1.529301 1.661988 2.106773 2.330515 2.581680 2.792686 
+0.265809 0.345868 0.597082 1.070990 1.497116 1.633533 2.139627 2.280686 2.512817 2.668144 
+0.208788 0.353537 0.448428 0.744542 0.832763 1.081624 1.871188 2.032083 2.429608 2.599530 
+0.238916 0.386378 0.542985 0.766669 1.174876 1.281048 1.635077 2.080947 2.247664 2.488499 
+0.203556 0.321547 0.427750 0.977606 1.419067 1.509630 1.819297 1.946189 2.580163 2.776386 
+0.139996 0.214290 0.381653 0.921888 1.276433 1.581217 1.904101 2.138537 2.662439 2.833853 
+0.212852 0.314107 0.462617 0.919913 1.063259 1.256340 1.466783 1.677489 2.033592 2.181966 
+0.466600 0.630996 0.782487 0.940455 1.238899 1.391865 1.580807 1.885579 2.314316 2.461513 
+0.227025 0.350571 0.564570 0.792724 1.354349 1.541346 1.801883 2.207919 2.410212 2.682787 
+0.249981 0.396397 0.985691 1.264822 1.534123 1.871221 2.123754 2.286134 2.517526 2.674066 
+0.177530 0.299649 0.406845 0.735920 1.226985 1.334179 1.570608 1.724780 2.559215 2.784411 
+0.331581 0.410000 0.675272 1.110025 1.255576 1.427242 1.924905 2.045160 2.303923 2.638796 
+0.210022 0.302618 0.477941 0.890428 1.097541 1.628245 1.909906 2.220072 2.508520 2.652118 
+0.243446 0.420405 0.781875 1.124911 1.345163 1.548171 1.986124 2.256316 2.655998 2.839208 
+0.200937 0.269954 0.466285 0.792334 1.180229 1.434359 1.791176 1.944075 2.077160 2.197213 
+0.251311 0.446771 0.586446 0.941160 1.156270 1.303306 1.672045 1.830703 2.385130 2.761692 
+0.176967 0.213758 0.376271 0.498915 1.047907 1.738519 2.144585 2.257100 2.630427 2.811560 
+0.352772 0.503472 0.939563 1.201270 1.506542 1.660120 1.860724 2.068816 2.441126 2.640996 
+0.178023 0.303052 0.386553 0.624462 0.745438 0.945475 1.851506 1.982051 2.478715 2.678062 
+0.364266 0.492788 0.670783 0.846141 0.981327 1.137049 1.747901 2.123325 2.278768 2.451425 
+0.194628 0.412302 0.576670 0.847302 1.093833 1.250221 1.832799 1.978334 2.268735 2.705748 
+0.210126 0.261821 0.730491 1.414850 1.596688 1.714047 2.240294 2.394580 2.609061 2.726773 
+0.269651 0.402612 0.565711 0.760525 0.889819 1.107327 1.796638 1.997957 2.232105 2.568438 
+0.133808 0.231770 0.964886 1.241597 1.484042 1.687250 1.909900 2.150489 2.488549 2.709142 
+0.306823 0.378775 0.528651 1.056677 1.597646 1.784457 1.922205 2.165550 2.402629 2.533249 
+0.406081 0.580663 1.171379 1.458297 1.720903 1.880717 2.213995 2.369466 2.530713 2.666970 
+0.228294 0.391754 0.668996 0.852912 1.156334 1.293279 1.648848 2.231024 2.414612 2.628285 
+0.302709 0.472535 0.626855 0.843574 1.352641 1.488643 1.688728 2.088022 2.315798 2.484648 
+0.174773 0.243410 0.746413 0.964816 1.191099 1.363990 1.763375 2.002057 2.265912 2.600431 
+0.208518 0.277532 0.471186 1.268798 1.353448 1.735767 1.868117 2.374184 2.641977 2.776723 
+0.181223 0.240142 0.433185 0.698630 1.302639 1.456283 1.718530 1.991528 2.237981 2.340398 
+0.351292 0.440375 0.723077 0.926148 1.074170 1.439999 1.696850 1.901716 2.300430 2.453901 
+0.226417 0.295615 0.571000 0.984080 1.315950 1.698856 1.941891 2.121713 2.342505 2.579999 
+0.380156 0.575056 0.932765 1.215036 1.441177 1.764868 2.084529 2.309314 2.649989 2.795048 
+0.327618 0.406456 0.591362 0.776642 0.880344 1.202380 1.954155 2.143987 2.351308 2.562503 
+0.349506 0.502746 0.667403 0.858540 1.006257 1.182652 1.744117 1.942048 2.263027 2.631113 
+0.177120 0.223929 0.376392 0.517683 0.980327 1.245272 1.809519 2.111620 2.342282 2.674853 
+0.123205 0.175349 0.396680 1.076230 1.369038 1.673956 1.959621 2.213420 2.585626 2.780840 
+0.199931 0.299170 0.450172 0.705023 1.188319 1.349840 1.579504 2.154568 2.351041 2.525566 
+0.302167 0.465527 0.626305 0.861772 0.982600 1.308182 1.952424 2.093800 2.477514 2.675986 
+0.242409 0.306396 0.609503 0.781681 1.304327 1.721020 1.925053 2.059600 2.219491 2.531271 
+0.355459 0.562814 1.005674 1.276256 1.699547 1.938826 2.256737 2.427235 2.599155 2.727721 
+0.151530 0.250374 0.398298 0.598018 0.779517 1.173799 1.570201 1.708674 2.564516 2.838232 
+0.220397 0.279236 0.757790 1.106570 1.277089 1.577301 1.822237 1.978751 2.121441 2.474720 
+0.153326 0.218116 0.394366 0.701525 1.051329 1.626441 1.887066 2.073879 2.602080 2.787764 
+0.234610 0.396895 0.841428 1.067362 1.368124 1.669319 1.979920 2.264168 2.548149 2.700534 
+0.210859 0.310938 0.499147 0.721086 1.174085 1.319358 1.795112 2.119739 2.328704 2.523434 
+0.205900 0.309942 0.473488 0.788729 0.910899 1.492677 1.711470 1.896973 2.451938 2.620192 
+0.228664 0.320277 0.483685 0.662193 1.183931 1.743195 1.934444 2.129302 2.472394 2.610315 
+0.308768 0.504829 0.834602 1.135142 1.422684 1.603830 1.804246 2.039329 2.434630 2.712164 
+0.195372 0.307825 0.510685 0.705293 0.862776 0.987472 1.561941 1.940733 2.431850 2.813875 
+0.306758 0.363734 0.676055 1.018763 1.123399 1.370232 1.612188 1.792290 2.051896 2.212304 
+0.175686 0.229897 0.430909 0.821342 1.267737 1.439041 1.813710 2.050941 2.367020 2.513483 
+0.270387 0.314704 0.625717 1.328248 1.485768 1.648429 1.945037 2.074570 2.558789 2.681083 
+0.150545 0.249063 0.484485 0.650722 0.926307 1.336973 1.578609 1.727988 2.372974 2.800106 
+0.451543 0.550287 0.774083 1.017766 1.117810 1.452119 1.851289 1.956638 2.541998 2.714928 
+0.303976 0.365108 0.645290 1.163674 1.649225 1.816629 1.956898 2.167435 2.334752 2.499609 
+0.258346 0.804804 1.233083 1.450024 1.793938 1.975438 2.178153 2.350853 2.545268 2.695382 
+0.305873 0.411332 0.559751 0.770260 0.870638 1.070601 1.844362 2.171189 2.331380 2.561172 
+0.328067 0.572423 0.818346 0.977873 1.251504 1.396022 1.679055 2.003477 2.202890 2.376892 
+0.233685 0.324374 0.505263 1.162727 1.383328 1.533712 1.921509 2.038933 2.644680 2.830387 
+0.368811 0.446580 0.830711 1.314440 1.454376 1.633636 1.932315 2.093222 2.523433 2.696884 
+0.225386 0.331700 0.499419 0.651259 1.081776 1.536183 1.684810 2.115502 2.326023 2.493957 
+0.223044 0.298517 0.436019 0.582229 0.785616 1.768538 2.059742 2.207026 2.494017 2.696171 
+0.180285 0.258337 0.369821 0.519766 1.426414 1.652781 1.844922 2.044342 2.221032 2.715648 
+0.283330 0.386958 0.793201 1.012390 1.401661 1.814923 2.032214 2.252691 2.478442 2.623605 
+0.192303 0.289501 0.500660 0.766599 0.927796 1.379237 1.761645 2.133602 2.524890 2.706929 
+0.240366 0.425376 0.713195 0.854560 1.062811 1.239666 1.453114 2.086242 2.409526 2.579680 
+0.137084 0.190186 0.315294 0.519061 1.348977 1.578096 1.776272 1.932718 2.478330 2.764053 
+0.256575 0.299517 0.557847 0.772199 1.734591 1.838024 2.175501 2.380904 2.586733 2.722357 
+0.152502 0.184110 0.342575 0.500794 0.869142 1.091892 1.283627 1.913051 2.078861 2.216081 
+0.422116 0.624411 0.936013 1.075293 1.214093 1.394857 1.793604 2.068743 2.420462 2.621433 
+0.172110 0.265160 0.376968 0.872523 1.415505 1.522936 1.876576 2.026326 2.412597 2.784541 
+0.206316 0.484509 0.867999 1.264771 1.619155 1.941304 2.179857 2.450350 2.746320 2.859252 
+0.183287 0.327870 0.479087 0.793937 1.054850 1.228053 1.799851 2.057544 2.605366 2.808018 
+0.199645 0.251567 0.651339 0.845163 1.224263 1.400865 1.849917 2.073362 2.320314 2.465281 
+0.172950 0.268061 0.408629 0.749321 1.232382 1.363027 1.833510 1.995806 2.311255 2.818028 
+0.383755 0.436949 0.854750 1.093429 1.211736 1.678565 1.897539 2.135411 2.547959 2.639036 
+0.206666 0.277792 0.525267 0.971550 1.150633 1.543543 1.818711 1.982032 2.192940 2.418823 
+0.297704 0.438877 0.602705 0.935349 1.126380 1.302724 1.887231 2.030156 2.370716 2.648705 
+0.225939 0.261133 0.511885 0.708833 1.424678 1.892147 2.104001 2.250163 2.605088 2.746840 
+0.452216 0.679332 1.031388 1.239650 1.444390 1.576987 1.800188 2.037662 2.347747 2.559010 
+0.246537 0.319428 0.434869 0.567303 0.678662 1.145054 2.156111 2.318698 2.695808 2.850677 
+0.323068 0.487001 0.653349 0.909650 1.315899 1.427550 1.843764 2.091482 2.277958 2.521041 
+0.151653 0.209991 0.374931 0.854455 1.064290 1.434370 1.854148 1.976154 2.226004 2.750320 
+0.254129 0.318082 0.553509 1.223731 1.483086 1.618808 1.995613 2.126498 2.542503 2.704703 
+0.159794 0.237065 0.373617 0.681392 0.916230 1.100174 1.782317 1.960086 2.120694 2.618079 
+0.395727 0.506034 0.756406 1.188386 1.370570 1.507131 1.860951 2.052892 2.386064 2.617425 
+0.235512 0.301393 0.657521 0.969184 1.638320 1.830168 1.984994 2.183324 2.395359 2.538524 
+0.451916 0.818196 1.310860 1.494170 1.734505 1.944228 2.085155 2.271405 2.604215 2.715654 
+0.229547 0.331804 0.499374 0.698992 1.265974 1.467138 1.658356 2.268601 2.583952 2.762021 
+0.258732 0.443700 0.582380 0.800795 1.354913 1.537609 1.724000 2.113993 2.369337 2.558869 
+0.156813 0.299295 0.462045 0.796077 1.096063 1.269277 1.836371 1.991867 2.448318 2.597971 
+0.246591 0.304473 0.529300 1.215091 1.451169 1.571384 1.868982 1.972518 2.391725 2.695616 
+0.169559 0.209107 0.367228 0.505130 1.079358 1.293153 1.736205 2.042985 2.323978 2.564293 
+0.329533 0.392210 0.720874 0.936253 1.067646 1.644185 1.991320 2.118407 2.596262 2.701052 
+0.201406 0.291786 0.394755 0.617862 1.695417 1.914199 2.049472 2.237494 2.441266 2.568384 
+0.115269 0.195387 0.738170 1.042436 1.524313 1.807507 2.173634 2.393265 2.651838 2.824917 
+0.173769 0.282805 0.419446 0.776536 0.928220 1.160391 1.958931 2.101699 2.541381 2.732928 
+0.209696 0.340593 0.516203 0.794250 1.153989 1.275003 1.570690 1.733317 2.086323 2.795392 
+0.110476 0.145162 0.248644 0.465410 1.205115 1.426951 1.838992 2.085791 2.488927 2.779657 
+0.223681 0.283712 0.440694 1.041879 1.657659 1.762280 2.000478 2.153137 2.435135 2.637721 
+0.178995 0.282691 0.473035 0.740633 0.911089 1.104519 1.288366 1.821180 2.201221 2.508461 
+0.443099 0.561309 0.804443 1.033650 1.140498 1.408557 1.973383 2.105087 2.432294 2.654409 
+0.222370 0.320892 0.431815 0.774539 1.450421 1.638383 1.817605 2.055496 2.231523 2.414745 
+0.488759 0.722119 1.075268 1.294956 1.551912 1.839530 2.130626 2.354921 2.626536 2.737698 
+0.209201 0.325492 0.450619 1.020698 1.213389 1.358613 1.538589 1.759768 2.620164 2.791411 
+0.254420 0.409271 0.532950 0.933560 1.248401 1.350851 1.728513 1.887503 2.311205 2.707429 
+0.039082 0.123291 0.563195 0.857519 1.261207 1.529819 1.850039 2.144420 2.476829 2.755410 
+0.127556 0.217058 0.807380 1.043662 1.378203 1.631976 1.940815 2.207962 2.528274 2.764303 
+0.214258 0.299923 0.606169 0.768797 1.015893 1.349821 1.669065 1.924581 2.111348 2.418396 
+0.364885 0.502482 0.675283 0.930660 1.036461 1.354434 1.834770 1.950661 2.559472 2.726950 
+0.221471 0.330609 0.456653 0.686616 1.285861 1.685279 1.842952 2.117269 2.300993 2.591367 
+0.347069 0.500335 0.788322 1.022915 1.371254 1.585460 1.855588 2.176902 2.477587 2.720481 
+0.281028 0.414603 0.602236 0.792786 0.907330 1.090040 1.687453 2.129718 2.489785 2.634419 
+0.363245 0.571116 0.705668 0.861203 1.204113 1.333048 1.544624 2.016192 2.258768 2.434454 
+0.215734 0.321274 0.465393 0.666555 1.274668 1.427396 1.670511 2.228318 2.394993 2.624012 
+0.270727 0.332361 0.883612 1.283495 1.433436 1.649610 1.838125 2.021889 2.560021 2.698378 
+0.175763 0.213621 0.391730 0.566755 0.955973 1.388956 1.878982 2.137460 2.349368 2.478188 
+0.257598 0.316184 0.657817 1.118064 1.272143 1.501175 1.689925 1.857456 2.616979 2.735442 
+0.227270 0.307771 0.544263 1.030949 1.478367 1.606785 1.851814 2.266798 2.452714 2.629357 
+0.255179 0.376313 1.164078 1.383762 1.652706 1.817476 2.014659 2.160928 2.460094 2.623430 
+0.274618 0.450301 0.650957 0.842032 1.042329 1.233369 1.641038 1.987714 2.446952 2.597194 
+0.337780 0.514835 0.668892 0.911283 1.476046 1.714011 1.887574 2.115985 2.373951 2.499093 
+0.172594 0.270224 0.434372 0.864398 1.037663 1.485795 1.748590 2.020761 2.643028 2.800341 
+0.270150 0.317310 0.733644 1.342780 1.517768 1.641210 1.845979 1.981779 2.361540 2.595899 
+0.160609 0.230103 0.452778 0.853418 1.061340 1.458644 1.711466 1.875295 2.205269 2.709841 
+0.302065 0.354507 0.587391 0.684546 0.931120 1.757948 1.902878 2.288464 2.550897 2.656497 
+0.142376 0.211224 0.315730 0.534420 1.587988 1.751880 2.118162 2.354064 2.604623 2.786794 
+0.386559 0.540492 0.884711 1.083540 1.507785 1.692150 1.931330 2.198611 2.531354 2.678491 
+0.323902 0.389328 0.540529 0.671309 0.782921 1.525984 2.046871 2.140001 2.472270 2.566702 
+0.227988 0.399979 0.639588 0.791383 1.185694 1.369429 1.655774 2.094051 2.385252 2.754008 
+0.140257 0.228630 0.342001 0.596028 1.326401 1.465391 1.823254 1.961877 2.671876 2.831534 
+0.121381 0.186129 0.623448 1.000592 1.306405 1.641012 2.056458 2.375989 2.709278 2.848728 
+0.247607 0.350532 0.510244 0.883136 1.094021 1.210853 1.639562 2.030725 2.223639 2.416473 
+0.357005 0.520431 0.875831 1.062576 1.221746 1.345463 1.623626 2.038524 2.477051 2.698891 
+0.179634 0.278991 0.394920 0.736511 1.402026 1.576761 1.774624 1.972434 2.183128 2.757177 
+0.203160 0.430851 1.114653 1.371969 1.757116 1.992375 2.261491 2.431952 2.637357 2.752659 
+0.138600 0.200975 0.519401 0.724917 1.034246 1.394176 1.722948 1.946633 2.443593 2.716691 
+0.298095 0.365805 0.582351 1.086692 1.326009 1.425975 1.844288 2.197476 2.361003 2.521646 
+0.224031 0.332426 0.469990 1.001054 1.197837 1.340048 1.959629 2.074407 2.586538 2.799850 
+0.217865 0.623928 0.846007 1.056459 1.270022 1.514463 1.916564 2.173644 2.481877 2.731790 
+0.216744 0.285870 0.554706 0.993990 1.223763 1.481385 1.841075 2.001157 2.202645 2.554494 
+0.183332 0.408012 0.595713 0.854496 1.037244 1.240493 1.858004 2.051789 2.454286 2.641640 
+0.185879 0.262800 0.433401 0.963144 1.221951 1.453093 2.083738 2.338219 2.637954 2.802979 
+0.376619 0.531366 0.924956 1.260648 1.459226 1.589579 1.913753 2.153929 2.384625 2.568935 
+0.276908 0.401698 0.535406 0.725282 0.853962 0.993671 1.784685 2.264235 2.415421 2.743011 
+0.392628 0.530015 0.694728 0.898255 1.037465 1.203267 1.847972 2.130377 2.294167 2.519263 
+0.221585 0.348013 0.498036 0.715769 1.244234 1.381107 1.612806 2.098989 2.271383 2.656074 
+0.181011 0.243672 0.520565 1.273809 1.635579 1.924649 2.152884 2.325189 2.545337 2.704856 
+0.212747 0.338170 0.512165 0.698820 1.069232 1.195663 1.594938 1.997384 2.252972 2.771008 
+0.239602 0.319299 0.856477 1.177220 1.318502 1.493392 1.741957 2.006496 2.283856 2.495161 
+0.228476 0.280840 0.476230 1.203494 1.625636 1.719185 2.032736 2.169601 2.510422 2.699013 
+0.286987 0.578563 1.175416 1.489497 1.807057 2.031448 2.224193 2.402210 2.620582 2.786223 
+0.284803 0.530975 0.821128 0.972435 1.146598 1.402202 1.828804 2.094299 2.506084 2.720046 
+0.245331 0.345077 0.478580 0.845525 1.322977 1.438811 1.722802 2.097265 2.261936 2.441149 
+0.170708 0.247004 0.608618 0.775849 1.065513 1.283496 1.723268 1.892396 2.539816 2.717299 
+0.208332 0.300056 0.505156 1.253926 1.377427 1.594647 1.754029 2.171773 2.487478 2.685632 
+0.171329 0.225179 0.378514 0.577821 1.098665 1.311943 1.526522 1.967713 2.172531 2.346440 
+0.239282 0.344225 0.528808 0.666274 1.042444 1.388419 1.857559 2.094835 2.473543 2.649229 
+0.198580 0.259051 0.438298 0.705347 1.431453 1.897639 2.046829 2.207600 2.449656 2.599716 
+0.337069 0.528000 0.951780 1.180918 1.376423 1.654985 1.971529 2.266927 2.704743 2.847367 
+0.284813 0.367338 0.523627 0.691416 0.797885 1.120421 1.819243 2.265148 2.456517 2.588448 
+0.269159 0.476818 0.659344 0.899456 1.209541 1.335886 1.627523 1.903299 2.132623 2.655472 
+0.119224 0.156658 0.271903 0.418321 1.065297 1.360087 1.644993 1.982627 2.382784 2.755980 
+0.282273 0.349303 0.537097 1.066089 1.307982 1.458937 2.037910 2.256912 2.434757 2.578973 
+0.201474 0.291056 0.422152 0.616067 1.022184 1.152574 1.449965 2.197085 2.439911 2.635280 
+0.324130 0.396121 0.713192 1.073384 1.173029 1.526515 2.037201 2.137280 2.569318 2.702445 
+0.199269 0.284170 0.404247 0.697358 1.446027 1.807057 1.954743 2.169169 2.379241 2.545732 
+0.348456 0.529109 0.879319 1.101024 1.475230 1.807439 2.081272 2.280127 2.549592 2.702863 
+0.184393 0.309059 0.446883 0.786980 0.939533 1.169098 1.804458 1.930933 2.599357 2.810854 
+0.372412 0.451942 0.679847 1.075185 1.453546 1.572935 1.797280 2.060904 2.239656 2.413231 
+0.162340 0.215690 0.397026 0.885715 1.351665 1.692524 1.923001 2.162159 2.529446 2.710698 
+0.174845 0.244687 0.722017 1.058880 1.584480 1.712948 1.914989 2.272779 2.514853 2.721138 
+0.180603 0.263970 0.439556 0.797992 1.025300 1.271742 1.843790 2.013992 2.183901 2.609028 
+0.275445 0.331708 0.686947 0.880832 1.019790 1.601662 1.815444 1.960055 2.524843 2.635159 
+0.246743 0.338623 0.507004 0.744344 0.978588 1.719875 2.149981 2.270511 2.455050 2.609715 
+0.511182 0.731278 1.001870 1.154541 1.304543 1.479350 1.855646 2.159073 2.465297 2.619985 
+0.159919 0.196942 0.359631 0.506645 0.910908 1.079437 1.605706 2.020672 2.336267 2.675469 
+0.400414 0.532831 0.732331 1.013768 1.194337 1.337622 1.760440 1.913653 2.137670 2.495860 
+0.198432 0.265271 0.463330 0.715843 1.124005 1.473936 1.785103 1.947760 2.284523 2.402467 
+0.251071 0.299335 0.761114 1.358836 1.477322 1.755740 1.974355 2.155204 2.509334 2.610900 
+0.168430 0.240238 0.385248 0.642207 0.818665 1.079971 1.497030 1.739210 2.014670 2.480512 
+0.403618 0.476427 0.760625 1.119521 1.225260 1.585741 1.910637 2.082695 2.602596 2.728042 
+0.270110 0.353552 0.507117 0.982357 1.452637 1.561604 1.831119 2.097015 2.260480 2.506040 
+0.409239 0.594796 0.975401 1.298743 1.696566 1.869597 2.021276 2.210722 2.513551 2.654084 
+0.264683 0.461411 0.644817 0.860983 1.044619 1.166400 1.802711 2.091425 2.295669 2.754119 
+0.469686 0.613125 0.780126 0.980941 1.398148 1.536063 1.747415 2.051727 2.394884 2.516178 
+0.186791 0.269819 0.399921 1.138197 1.381467 1.573894 1.960790 2.110781 2.483798 2.628204 
+0.258801 0.327749 0.504295 1.197030 1.358461 1.528535 1.792614 1.927747 2.524317 2.681583 
+0.161459 0.233374 0.511026 0.740697 0.973203 1.529858 1.845698 2.024509 2.388404 2.769333 
+0.338109 0.399145 0.642671 0.750976 0.940491 1.777467 2.157523 2.269354 2.634732 2.724164 
+0.180623 0.259965 0.390546 0.612711 1.433871 1.678265 1.843034 2.228297 2.443281 2.647327 
+0.247299 0.293271 0.692143 0.919932 1.644451 1.918105 2.097755 2.258082 2.510431 2.625830 
+0.149020 0.205904 0.356032 0.602403 0.987977 1.147484 1.771885 1.955289 2.387841 2.798390 
+0.232598 0.414291 0.675328 0.818194 1.101627 1.308523 1.519246 1.952980 2.347393 2.695458 
+0.176302 0.240703 0.418040 0.744771 1.241784 1.631902 1.803676 1.965041 2.614696 2.812026 
+0.147792 0.225066 0.327162 0.749127 1.639390 1.742663 2.031072 2.226257 2.554880 2.737390 
+0.153870 0.209078 0.349325 0.617112 0.939783 1.262086 1.603026 1.759135 1.968177 2.111699 
+0.401254 0.531884 0.716519 1.042091 1.338740 1.442853 1.814274 2.094864 2.275463 2.451094 
+0.257481 0.354612 0.474799 0.889648 1.418879 1.545760 1.780610 2.002306 2.180143 2.532227 
+0.145143 0.398917 0.981552 1.314723 1.480195 1.798420 2.069724 2.386944 2.668464 2.802905 
+0.178493 0.240401 0.691115 0.837764 1.073179 1.297529 1.642950 2.040266 2.463959 2.622440 
+0.283570 0.372001 0.585235 0.956144 1.106750 1.584081 1.860096 2.009870 2.399586 2.562348 
+0.173740 0.229082 0.361309 0.554292 1.445623 1.608360 2.083231 2.257294 2.420588 2.616658 
+0.324415 0.415954 0.746050 1.011384 1.143615 1.556506 1.921430 2.048417 2.544327 2.700584 
+0.214462 0.286094 0.581008 0.805945 1.275261 1.610434 1.794665 1.905601 2.100985 2.530385 
+0.406606 0.540199 0.741703 0.841294 1.020646 1.288940 1.697760 1.988139 2.374821 2.589349 
+0.202273 0.235653 0.484403 0.754406 1.274678 1.821075 2.241890 2.368887 2.620778 2.800892 
+0.270698 0.780374 1.036092 1.204303 1.426576 1.652095 1.944935 2.222209 2.496745 2.678321 
+0.229051 0.330732 0.459692 0.687040 0.867860 0.971515 1.553263 2.327103 2.599324 2.733993 
+0.260962 0.343168 0.545250 1.036179 1.306217 1.422412 1.660351 2.041101 2.335761 2.495897 
+0.171216 0.239743 0.394965 0.588008 1.144698 1.289132 1.673831 1.940258 2.235772 2.782337 
+0.195902 0.254449 0.377534 1.406314 1.521423 1.673084 1.866963 2.261663 2.535496 2.688582 
+0.150694 0.213444 0.372155 0.787173 1.035226 1.454281 1.699328 1.829446 2.003441 2.525940 
+0.232566 0.460472 0.787265 0.996419 1.396693 1.523961 1.855686 2.119370 2.346354 2.515401 
+0.233393 0.307066 0.580252 0.812411 1.638408 1.916323 2.050381 2.201478 2.398327 2.532500 
+0.654665 1.113987 1.347221 1.518794 1.813315 1.953845 2.210362 2.381661 2.551979 2.660202 
+0.223873 0.325731 0.467395 0.921251 1.270288 1.397723 1.734370 2.414313 2.638346 2.800382 
+0.310637 0.477608 0.685272 0.996817 1.355825 1.484000 1.704038 2.061930 2.448624 2.565929 
+0.148930 0.226761 0.370757 1.019241 1.219213 1.396110 1.661688 1.901830 2.408793 2.697915 
+0.229342 0.295527 0.586649 1.059472 1.597702 1.716890 1.937422 2.109084 2.436811 2.674887 
+0.192819 0.263035 0.434697 0.673121 1.119753 1.338824 1.909548 2.076183 2.261830 2.387228 
+0.320147 0.380189 0.741994 0.844995 1.074712 1.639187 1.762953 2.266267 2.646178 2.721096 
+0.174567 0.253745 0.360203 0.504953 1.488396 1.814662 1.955756 2.149395 2.323488 2.584030 
+0.263126 0.470251 0.798026 1.161280 1.606556 1.808008 2.130398 2.302959 2.489210 2.752479 
+0.231279 0.366009 0.530320 0.804291 0.943863 1.141251 1.962507 2.101760 2.449591 2.815548 
+0.172028 0.250238 0.449914 0.861171 1.080449 1.240891 1.585537 1.918091 2.217571 2.722636 
+0.131319 0.183681 0.316018 0.523172 0.890644 1.486126 1.758535 1.891187 2.487652 2.765559 
+0.165174 0.243169 0.350507 1.016712 1.534247 1.638560 1.932592 2.084107 2.538300 2.689502 
+0.262744 0.474699 0.655053 0.795707 1.068818 1.252172 1.418647 1.961010 2.309455 2.536506 
+0.359054 0.435831 0.725138 1.118933 1.229842 1.514926 1.879370 2.001037 2.462089 2.652002 
+0.218540 0.299734 0.601107 0.823625 1.269799 1.620287 1.839893 1.976756 2.375450 2.640668 
+0.487484 0.730967 1.052266 1.258969 1.526405 1.802696 2.229099 2.451538 2.684818 2.774190 
+0.235780 0.364477 0.520691 0.749469 0.950595 1.159410 1.423255 1.544612 2.361393 2.766014 
+0.366160 0.476136 0.652510 1.062481 1.309788 1.418863 1.784871 1.987495 2.189248 2.558080 
+0.184696 0.253223 0.471758 0.830299 1.272428 1.483910 1.761955 2.136740 2.416390 2.620731 
+0.128256 0.217552 0.752532 1.013345 1.185988 1.415101 1.811830 2.211505 2.607414 2.789321 
+0.247330 0.328294 0.701060 0.927525 1.109801 1.291869 1.638584 1.875516 2.227907 2.417348 
+0.261841 0.503729 0.732366 0.870192 1.033798 1.299712 1.693809 2.023705 2.463903 2.789299 
+0.165555 0.219912 0.358917 0.505900 1.230885 1.663232 1.852393 2.028502 2.286248 2.725340 
+0.426544 0.643468 0.917679 1.196829 1.471597 1.648363 1.933059 2.151933 2.533829 2.705743 
+0.308359 0.416322 0.591830 0.808745 0.946905 1.230266 1.815498 2.281895 2.520403 2.631259 
+0.269965 0.447323 0.574488 0.763324 1.256417 1.405168 1.571648 1.980676 2.220782 2.442545 
+0.188326 0.280970 0.408039 0.646742 1.320810 1.446061 1.615924 2.148422 2.351742 2.514250 
+0.241655 0.365356 0.810170 1.309700 1.669576 1.812447 2.014631 2.236122 2.442170 2.609315 
+0.191747 0.289189 0.450664 0.748517 0.915409 1.168139 1.584199 1.750548 2.260120 2.447778 
+0.215480 0.278055 0.768309 1.041609 1.391676 1.605855 1.766698 1.876725 2.528928 2.706006 
+0.216771 0.298936 0.710997 0.862001 1.342336 1.590245 1.886295 2.097920 2.415093 2.592546 
+0.359220 0.566823 0.939326 1.372126 1.545352 1.699671 2.041310 2.205011 2.518317 2.710314 
+0.305907 0.442295 0.613007 0.776603 0.914320 1.099675 1.615712 1.826869 2.359635 2.622631 
+0.323177 0.497481 0.632094 0.852217 1.431198 1.600546 1.791940 2.143530 2.380021 2.560286 
+0.276909 0.420019 0.563912 1.000971 1.135252 1.388079 1.711802 1.918572 2.573328 2.752989 
+0.353490 0.388981 0.807777 1.276863 1.382826 1.606736 1.810843 1.979129 2.631848 2.733152 
+0.211471 0.306166 0.424434 0.581123 0.710913 1.547934 2.010370 2.138366 2.380508 2.503481 
+0.225924 0.333197 0.488381 0.801446 1.090937 1.638206 1.799647 2.390310 2.652313 2.790138 
+0.171504 0.249271 0.358286 0.870885 1.550123 1.667881 2.054589 2.231743 2.439091 2.602023 
+0.165599 0.227318 0.460922 1.107714 1.477735 1.814994 2.062885 2.255887 2.546566 2.715347 
+0.204992 0.345256 0.473494 0.712728 0.805809 1.312492 1.893635 2.009686 2.341092 2.479636 
+0.241898 0.390228 0.537134 0.715035 1.312338 1.499876 1.662491 2.135780 2.352112 2.532228 
+0.163569 0.301194 0.427433 0.764441 1.375596 1.484079 1.850824 1.989487 2.494381 2.667698 
+0.185986 0.271128 0.421812 1.063503 1.222027 1.628289 1.811308 2.167184 2.682964 2.795197 
+0.202601 0.379588 0.533353 0.730653 1.060008 1.189413 1.598490 1.835597 2.061862 2.426341 
+0.381195 0.485776 0.727063 1.085074 1.215649 1.412868 1.615482 1.828196 2.539184 2.686523 
+0.196130 0.286997 0.409907 0.696364 1.424577 1.699356 1.891753 2.153448 2.327269 2.685103 
+0.217874 0.396132 0.938681 1.246697 1.661963 1.931349 2.246916 2.421796 2.619892 2.750931 
+0.145642 0.216508 0.413198 0.862759 1.057682 1.322682 1.673351 1.828806 2.347789 2.651186 
+0.252166 0.353210 0.523268 0.998504 1.176163 1.345135 1.984750 2.128958 2.373533 2.721309 
+0.207926 0.318108 0.470343 0.848345 0.989299 1.405273 1.967910 2.101386 2.512180 2.676499 
+0.305162 0.559986 0.771585 0.960172 1.334408 1.717417 1.924182 2.084417 2.601968 2.796124 
+0.215239 0.293295 0.505385 0.962671 1.240775 1.392460 1.797329 1.965379 2.131247 2.276248 
+0.252164 0.460717 0.585238 0.895100 1.077276 1.245603 1.770113 1.919629 2.388482 2.774345 
+0.171691 0.214222 0.361048 0.500619 0.905993 1.365660 2.191797 2.291635 2.536887 2.788810 
+0.210536 0.585917 1.067844 1.305357 1.534407 1.728603 1.950964 2.160461 2.474553 2.655915 
+0.169262 0.231674 0.372121 0.532093 0.775314 1.210871 1.829565 2.081870 2.370289 2.704223 
+0.343950 0.448128 0.628833 0.913957 1.088899 1.224316 1.766842 2.099926 2.246679 2.400841 
+0.241643 0.386851 0.578033 0.893447 1.284732 1.404909 1.839518 2.125416 2.327160 2.739690 
+0.241059 0.287428 0.601200 1.273580 1.460278 1.653802 2.095665 2.226476 2.507632 2.651598 
+0.212479 0.430242 0.578263 0.750884 0.984798 1.103297 1.564720 1.845357 2.044045 2.707564 
+0.267240 0.357278 0.901382 1.173429 1.387845 1.739763 1.960853 2.173315 2.408387 2.570937 
+0.216978 0.306711 0.423920 0.791397 1.547660 1.881522 2.025421 2.184747 2.389726 2.510855 
+0.309853 0.505477 1.137673 1.452808 1.660808 1.914525 2.084337 2.308435 2.638463 2.772736 
+0.301921 0.420539 0.593933 0.887576 1.158301 1.268991 1.788041 2.156468 2.316421 2.507218 
+0.293230 0.474574 0.623415 0.798513 1.266075 1.425523 1.764734 1.994016 2.181652 2.456787 
+0.267189 0.365075 0.696711 0.927891 1.096450 1.472164 1.765266 1.937224 2.223753 2.655092 
+0.238720 0.370663 0.617866 1.246955 1.365777 1.650640 1.856445 2.306366 2.616822 2.765237 
+0.175180 0.233649 0.388873 0.625509 1.137464 1.364059 1.780788 1.978889 2.142278 2.269743 
+0.363510 0.421032 0.668364 0.762955 0.998948 1.715897 1.877803 2.064237 2.529901 2.608567 
+0.207131 0.288224 0.537847 0.889921 1.241448 1.796637 1.982317 2.231362 2.514249 2.666169 
+0.311071 0.486542 0.911402 1.324355 1.500183 1.670614 2.142536 2.330931 2.596184 2.778564 
+0.286136 0.386970 0.584375 0.911705 1.134588 1.317656 1.852739 2.283740 2.498365 2.622864 
+0.253233 0.419082 0.572357 0.778424 1.126703 1.277532 1.807391 2.017696 2.220121 2.576306 
+0.119841 0.163781 0.296364 0.661342 1.063342 1.241590 1.856804 2.104475 2.497328 2.762449 
+0.134955 0.201314 0.403983 0.934711 1.360477 1.718449 2.065183 2.278684 2.574632 2.753186 
+0.187681 0.272074 0.453358 0.682207 1.079560 1.206376 1.499740 2.043148 2.242754 2.665815 
+0.313258 0.412019 0.658075 0.828689 0.973583 1.514446 1.981071 2.102741 2.535037 2.681357 
+0.255030 0.322348 0.627488 0.839253 1.410591 1.810002 2.038784 2.181294 2.416832 2.562402 
+0.419919 0.625767 0.997973 1.218385 1.544616 1.788193 2.193417 2.384323 2.580200 2.698287 
+0.144698 0.204991 0.382026 0.623303 0.874762 1.289145 1.707320 1.863261 2.458684 2.750055 
+0.348116 0.419496 0.704420 1.093503 1.227121 1.494841 1.778803 1.913492 2.247296 2.428664 
+0.150045 0.246799 0.376978 0.783403 1.269598 1.422794 1.903455 2.035588 2.514973 2.759883 
+0.105122 0.206614 0.753484 1.038977 1.400140 1.658373 2.030750 2.283051 2.654021 2.837336 
+0.192365 0.288692 0.447554 0.818792 0.961011 1.398186 1.770980 1.943311 2.350650 2.500051 
+0.262128 0.381361 0.574890 0.709707 1.071672 1.453038 1.732793 1.979241 2.422853 2.645439 
+0.182137 0.236372 0.375437 0.738739 1.319942 1.813603 1.942481 2.136125 2.304536 2.660541 
+0.388048 0.531674 0.948328 1.154568 1.307573 1.434685 1.768235 2.048136 2.364776 2.585037 
+0.213588 0.288434 0.462998 0.598306 0.773371 0.915658 1.452520 2.086025 2.523003 2.722037 
+0.255467 0.334344 0.621250 0.810402 0.995432 1.466371 1.709488 1.890365 2.052513 2.247982 
+0.202649 0.282992 0.450372 0.652595 1.271305 1.607863 1.769708 1.985229 2.230577 2.380831 
+0.255806 0.325628 0.668776 1.230304 1.373533 1.702388 1.962730 2.144556 2.518005 2.640112 
+0.164126 0.217024 0.367572 0.604779 0.787116 1.194139 1.683264 1.826517 2.301871 2.524861 
+0.374711 0.458954 0.726536 0.920865 1.045916 1.511231 1.712666 1.895532 2.601724 2.708894 
+0.321014 0.460345 0.639594 1.017667 1.508099 1.631146 1.864246 2.140150 2.327445 2.508909 
+0.451810 0.719234 1.150765 1.385625 1.620547 1.892342 2.068707 2.263104 2.625298 2.740266 
+0.317844 0.411108 0.550802 0.761160 0.870205 1.038480 1.695720 2.112903 2.292249 2.451544 
+0.321858 0.548379 0.720393 0.955644 1.233322 1.359795 1.685327 1.923628 2.307181 2.544584 
+0.211797 0.292996 0.437036 1.171159 1.397378 1.525798 1.701395 1.861517 2.572521 2.757919 
+0.334603 0.405956 0.767677 1.215768 1.335601 1.658739 1.989520 2.108465 2.602700 2.719250 
+0.236812 0.348424 0.519218 0.665697 1.102403 1.611533 1.819999 2.115185 2.332044 2.604171 
+0.212181 0.308266 0.480795 0.705382 0.828843 1.420354 1.886330 2.032387 2.621328 2.767098 
+0.156168 0.242178 0.348609 0.550072 1.486404 1.641030 1.904334 2.091753 2.439156 2.809664 
+0.232081 0.327237 0.817249 1.194162 1.571594 1.731682 1.910994 2.090434 2.488066 2.694976 
+0.166025 0.252998 0.441946 0.686509 0.905928 1.524321 1.747034 1.950457 2.619697 2.805258 
+0.196816 0.324035 0.613887 0.796124 1.033469 1.198765 1.570531 2.015231 2.414398 2.745220 
+0.152873 0.238362 0.348769 0.790622 1.413327 1.522987 1.899666 2.041945 2.648276 2.825752 
+0.238929 0.311579 0.412073 0.915401 1.512444 1.940985 2.178055 2.302141 2.517257 2.635463 
+0.160234 0.194261 0.347515 0.460654 0.859252 1.041440 1.658005 1.765106 2.252543 2.312052 
+0.391446 0.575762 0.767956 0.913604 1.304424 1.440779 1.667960 1.962669 2.446664 2.573637 
+0.213295 0.338515 0.465366 0.911020 1.312069 1.413848 1.864947 2.045811 2.354224 2.763667 
+0.170870 0.556857 1.036355 1.381019 1.682662 1.999979 2.319783 2.526350 2.739001 2.850764 
+0.208142 0.323528 0.474225 0.911543 1.048694 1.258201 1.966595 2.078676 2.553969 2.814829 
+0.162972 0.229629 0.731192 0.902973 1.246076 1.372954 1.693139 2.110582 2.362875 2.555643 
+0.197223 0.291057 0.436718 0.707631 1.251503 1.421382 1.926786 2.108784 2.413585 2.596412 
+0.188400 0.289822 0.797989 1.142133 1.323120 1.715797 2.074975 2.335066 2.566622 2.712846 
+0.176052 0.240463 0.486022 0.736587 0.983507 1.654478 1.892603 2.036521 2.205899 2.540522 
+0.285807 0.420951 0.578219 0.937462 1.172738 1.315248 1.698845 1.846953 2.333613 2.500319 
+0.191178 0.264476 0.384535 0.632084 1.446016 1.916538 2.114759 2.257365 2.532359 2.669854 
+0.585958 0.712547 0.995175 1.345358 1.519221 1.715374 1.913837 2.069254 2.514199 2.672046 
+0.232352 0.335589 0.447674 0.661655 0.840293 1.102372 2.111319 2.297768 2.505132 2.794479 
+0.293351 0.391184 0.614053 0.997235 1.204180 1.322845 1.746085 2.070938 2.259359 2.492199 
+0.128784 0.193380 0.374338 0.847941 1.107813 1.396176 1.796836 1.928700 2.389952 2.702928 
+0.187671 0.251167 0.419138 1.154089 1.596401 1.689187 1.941996 2.092773 2.621931 2.795923 
+0.148570 0.200662 0.344258 0.538968 0.866249 1.341751 1.759051 1.890255 2.225276 2.769903 
+0.345597 0.416970 0.657718 1.108569 1.439934 1.549124 1.811931 2.165143 2.359862 2.480281 
+0.260394 0.347444 0.453068 0.867942 1.515797 1.830215 1.974617 2.135238 2.518564 2.622302 
+0.467387 0.718460 1.257405 1.516226 1.785886 1.982028 2.277442 2.407989 2.575877 2.697560 
+0.254025 0.396915 0.711272 0.826708 1.079490 1.303882 1.532614 2.101023 2.580896 2.726410 
+0.251349 0.458227 0.691728 0.853294 1.181701 1.324576 1.553722 2.121741 2.324860 2.537399 
+0.193070 0.295330 0.434005 1.028433 1.180760 1.492311 1.774884 1.958905 2.378250 2.514336 
+0.328295 0.438707 0.672483 1.098796 1.409689 1.525062 1.957988 2.202692 2.417235 2.626557 
+0.171589 0.215360 0.396416 0.549523 1.010817 1.564392 1.776805 2.010598 2.334140 2.489964 
+0.318782 0.372964 0.715257 0.808908 1.049817 1.858174 2.008814 2.244447 2.552397 2.638023 
+0.201432 0.265508 0.443842 0.655062 1.463954 1.780676 1.989105 2.317647 2.504044 2.729015 
+0.089299 0.221502 0.866390 1.161581 1.386624 1.681219 2.037751 2.306655 2.683398 2.842046 
+0.212127 0.340083 0.489712 0.702958 0.879220 1.069546 1.931755 2.304789 2.539222 2.833730 
+0.328502 0.460793 0.574149 0.923510 1.262431 1.349319 1.540115 1.646239 1.968666 2.558808 
+0.151688 0.205453 0.364147 0.726598 1.290329 1.608244 1.900602 2.132843 2.473238 2.714681 
+0.185087 0.268618 0.380471 0.858380 1.535920 1.659732 1.871001 2.060741 2.281531 2.743722 
+0.257576 0.375609 0.522074 0.806014 0.988781 1.118512 1.619900 2.008108 2.189450 2.503981 
+0.400530 0.492365 0.729967 0.986855 1.095728 1.599909 1.935703 2.057853 2.435587 2.582604 
+0.223967 0.308358 0.436977 0.810278 1.375371 1.715667 1.876660 2.086799 2.333392 2.482046 
+0.356889 0.697785 1.003210 1.181500 1.520050 1.769174 2.060990 2.297507 2.609041 2.761196 
+0.157986 0.286402 0.432170 0.759718 1.081482 1.206946 1.688203 1.857653 2.667619 2.834603 
+0.196232 0.271155 0.616200 0.987195 1.265761 1.503484 1.745037 1.946600 2.389443 2.562468 
+0.150612 0.207932 0.531767 0.924718 1.224167 1.532206 1.868861 2.129974 2.479660 2.745102 
+0.159516 0.244552 0.677711 0.957418 1.266300 1.638493 1.929433 2.212544 2.525881 2.712593 
+0.311860 0.375573 0.609251 0.741478 0.874235 1.502532 1.759234 1.910133 2.346160 2.464214 
+0.272687 0.495052 0.602981 0.936595 1.218033 1.659652 1.783798 2.226628 2.673580 2.789721 
+0.182994 0.269489 0.387738 0.559582 1.343891 1.727891 1.917480 2.131703 2.353147 2.525604 
+0.308577 0.475904 0.797573 1.025973 1.477364 1.632200 1.868066 2.187647 2.448313 2.609309 
+0.206491 0.281366 0.496579 0.711998 0.842942 1.042724 1.626715 2.075674 2.411838 2.577868 
+0.326421 0.517351 0.715080 0.911851 1.128611 1.259596 1.539759 1.960615 2.508231 2.630330 
+0.225691 0.354477 0.473958 0.715802 1.385094 1.590187 1.774163 2.045280 2.231611 2.620722 
+0.243650 0.282149 0.801163 1.454069 1.614695 1.739741 1.936677 2.098900 2.621205 2.730598 
+0.175768 0.236613 0.389409 0.747034 0.946387 1.205905 1.739280 1.989798 2.245012 2.388323 
+0.387506 0.464495 0.740570 1.128342 1.279681 1.451771 1.809069 1.941649 2.324383 2.652406 
+0.231774 0.321631 0.420712 0.846725 1.477615 1.662880 1.835880 2.220722 2.418706 2.624548 
+0.339377 0.589871 1.313110 1.506577 1.748224 1.947324 2.102041 2.254806 2.543830 2.680043 
+0.341587 0.433858 0.661863 0.821397 0.950863 1.418003 1.784815 1.903400 2.385908 2.575412 
+0.345179 0.447774 0.612195 0.945135 1.419677 1.592743 1.773414 2.040871 2.324811 2.437686 
+0.181279 0.307819 0.435997 0.934515 1.100027 1.302288 1.693949 1.895047 2.700574 2.825382 
+0.310037 0.368350 0.622802 1.178640 1.411438 1.526484 1.919150 2.065079 2.254912 2.589937 
+0.150978 0.212352 0.348668 0.573651 1.039486 1.590007 1.846476 1.963984 2.148357 2.662487 
+0.277951 0.349703 0.550843 0.708320 0.838864 1.573740 1.810453 1.992371 2.532412 2.642545 
+0.153422 0.252689 0.342559 0.686894 1.497196 1.638310 1.961921 2.130271 2.557903 2.742772 
+0.279249 0.447383 0.763867 1.059905 1.545382 1.724231 2.031986 2.292812 2.552588 2.796233 
+0.230577 0.389164 0.539408 0.761297 0.908015 1.337558 1.872590 2.004078 2.333966 2.727901 
+0.232875 0.346443 0.540354 0.678135 1.101040 1.382052 1.587740 2.186049 2.411254 2.607361 
+0.178843 0.269153 0.416180 0.638286 1.259337 1.389112 1.680672 1.869557 2.418798 2.781921 
+0.238712 0.372837 0.675624 1.027319 1.339343 1.669807 2.074360 2.351022 2.663150 2.815245 
+0.215603 0.308405 0.496032 0.940314 1.090508 1.308705 1.583747 1.902325 2.209688 2.576931 
+0.291384 0.348946 0.780234 1.202297 1.290327 1.444813 1.575215 1.952612 2.399593 2.483613 
+0.198791 0.307267 0.456507 0.669854 1.275490 1.409566 1.731928 2.093564 2.326604 2.772666 
+0.166723 0.274518 1.057461 1.415490 1.716962 1.941408 2.139410 2.271877 2.554685 2.755174 
+0.179844 0.282631 0.449297 0.722971 0.854062 1.439226 1.833271 2.030343 2.411399 2.580818 
+0.194891 0.247057 0.501829 1.004986 1.304934 1.451918 1.799457 2.025853 2.311832 2.422165 
+0.192373 0.297404 0.420858 0.940309 1.303418 1.426055 1.949700 2.077238 2.623849 2.795647 
+0.284285 0.555560 0.869980 1.055893 1.232747 1.442851 1.823935 2.260258 2.608541 2.799256 
+0.182395 0.248334 0.473858 1.064734 1.236328 1.480815 1.718550 1.883271 2.073356 2.512622 
+0.293574 0.445666 0.581331 0.774876 0.860972 1.080798 1.894962 2.036530 2.546161 2.753034 
+0.164780 0.231139 0.397045 0.799136 1.184762 1.560887 2.082481 2.246203 2.538883 2.722312 
+0.427982 0.603539 0.920429 1.129159 1.650391 1.805433 1.997586 2.263608 2.512703 2.626448 
+0.168043 0.256064 0.384473 0.655220 0.888834 1.046199 1.879431 2.027056 2.416638 2.713319 
+0.426266 0.599810 0.770098 0.938960 1.085997 1.239035 1.780899 2.098691 2.240555 2.451170 
+0.206361 0.331236 0.460417 0.809533 1.319919 1.432077 1.699325 1.907851 2.185584 2.791362 
+0.172066 0.257009 0.693635 1.290430 1.502260 1.882174 2.058034 2.285835 2.654385 2.780637 
+0.170469 0.242710 0.420771 0.673196 1.013631 1.168518 1.734302 2.076408 2.284278 2.777254 
+0.231524 0.384268 0.762288 1.075716 1.340044 1.570221 1.844109 2.087904 2.435480 2.609095 
+0.234196 0.299491 0.501062 1.074183 1.591896 1.874452 2.075105 2.288231 2.499325 2.625494 
+0.469375 0.772069 1.143891 1.321644 1.809933 2.060553 2.352686 2.509836 2.660967 2.746296 
+0.267541 0.509192 0.697162 0.881682 1.154246 1.287919 1.732950 2.170277 2.373112 2.701116 
+0.225002 0.296925 0.521071 0.868722 1.247262 1.605607 1.862301 1.995077 2.132673 2.303312 
+0.182154 0.268818 0.650902 0.829595 1.340290 1.518522 1.678145 2.062000 2.476058 2.618836 
+0.262094 0.315377 0.554545 1.249325 1.471511 1.602479 1.859154 1.986339 2.555494 2.716803 
+0.159937 0.221544 0.379613 0.703404 1.009260 1.336589 1.634712 1.832112 2.318601 2.492376 
+0.317307 0.445696 0.644479 0.865391 1.006145 1.475121 1.860039 1.994490 2.375194 2.696675 
+0.243257 0.313667 0.455515 0.804455 1.138675 1.990813 2.199166 2.317604 2.528196 2.655319 
+0.149876 0.523035 0.850884 1.130052 1.422386 1.709616 2.052423 2.309997 2.639482 2.816247 
+0.295517 0.381331 0.579620 0.758901 0.871645 1.328267 1.986843 2.119635 2.549100 2.680632 
+0.291632 0.485587 0.631619 0.928421 1.214008 1.324041 1.814157 2.030748 2.252379 2.749354 
+0.139746 0.195222 0.343435 0.703664 1.118059 1.352517 1.752608 1.877596 2.297202 2.717509 
+0.243712 0.353375 0.585060 0.914994 1.377929 1.519246 1.980348 2.132954 2.489440 2.702636 
+0.176444 0.255300 0.420605 0.747448 1.153758 1.299601 1.683980 2.102983 2.463231 2.667324 
+0.252495 0.390591 0.697066 0.966926 1.231424 1.414479 1.867378 2.243706 2.495192 2.656606 
+0.272420 0.381655 0.551517 0.888825 1.590308 1.808189 1.943240 2.138959 2.358917 2.487502 
+0.336178 0.471630 0.935669 1.201733 1.678329 1.870851 2.098930 2.268758 2.467556 2.613989 
+0.201767 0.332879 0.530137 0.745363 1.051345 1.174747 1.706266 2.049544 2.461842 2.799073 
+0.224306 0.303901 0.510428 1.086097 1.267920 1.446573 1.785392 1.911767 2.289610 2.700286 
+0.131135 0.171778 0.323877 0.821611 1.226519 1.537322 1.889645 2.169879 2.520932 2.772178 
+0.212962 0.347455 0.744136 0.964332 1.426998 1.636084 1.937573 2.189447 2.476377 2.657238 
+0.221564 0.298344 0.590780 0.774362 1.002528 1.237108 1.762739 1.946722 2.225939 2.371709 
+0.300082 0.409111 0.600009 0.784231 0.905421 1.449797 1.878545 2.002657 2.618940 2.779774 
+0.177168 0.244397 0.382973 0.547832 0.958732 1.796741 2.037031 2.198241 2.416774 2.606982 
+0.445089 0.691608 0.911651 1.027834 1.215634 1.498612 2.011028 2.296914 2.571657 2.730890 
+0.218890 0.332216 0.485543 0.669862 0.827655 0.946060 1.655213 2.081780 2.297490 2.781759 
+0.264561 0.330768 0.698979 0.882675 1.036048 1.373216 1.608206 1.801189 2.021468 2.470223 
+0.198417 0.232211 0.502648 0.724700 1.196144 1.304503 1.692944 1.862228 2.327527 2.429571 
+0.240112 0.278797 0.513980 1.374924 1.647698 1.742378 1.988501 2.137277 2.329969 2.585200 
+0.216630 0.297516 0.454364 0.700613 0.893785 1.036923 1.565511 2.032201 2.301512 2.463679 
+0.308267 0.357421 0.811138 1.127420 1.244275 1.651427 1.813657 2.045151 2.637104 2.726842 
+0.242030 0.328382 0.452907 0.861731 1.555327 1.743950 1.896242 2.084827 2.255121 2.454955 
+0.405487 0.653274 1.000615 1.215980 1.553100 1.809940 2.090490 2.237915 2.442893 2.589896 
+0.258975 0.421106 0.596341 0.793521 1.016877 1.148382 1.710733 2.132131 2.329411 2.755008 
+0.383770 0.618549 0.792683 0.970281 1.353980 1.492209 1.740595 2.034232 2.262266 2.418759 
+0.182576 0.276855 0.395058 1.006542 1.378696 1.494813 1.790120 1.929259 2.427587 2.564728 
+0.262944 0.336362 0.560480 1.134456 1.298593 1.499501 1.953395 2.050099 2.524027 2.712280 
+0.128134 0.176378 0.373760 0.758708 1.132934 1.485273 1.930693 2.068716 2.343529 2.773154 
+0.209614 0.299558 0.469136 0.796651 0.955701 1.572224 2.012335 2.290736 2.580444 2.723601 
+0.205230 0.307160 0.423168 0.638468 1.376104 1.735940 1.925713 2.112538 2.470319 2.600522 
+0.249605 0.312259 0.801138 1.134882 1.687789 1.883222 2.049696 2.223042 2.454133 2.577341 
+0.150236 0.180308 0.350515 0.500915 0.804675 1.506103 1.712024 2.023875 2.343152 2.636887 
+0.294328 0.430367 0.587290 0.910719 1.184482 1.304216 1.581107 2.004270 2.395137 2.534772 
+0.185620 0.281137 0.544021 0.818067 1.320581 1.540046 1.863117 2.127465 2.523995 2.737758 
+0.154431 0.208321 0.340239 1.022588 1.552229 1.696583 2.198386 2.394862 2.607880 2.801047 
+0.172397 0.232300 0.478592 0.699642 0.957173 1.484486 1.847798 1.985936 2.145557 2.327115 
+0.511765 0.721492 0.860517 1.030820 1.340681 1.459390 1.823745 2.108810 2.406735 2.558400 
+0.281714 0.392430 0.578702 0.891995 1.494831 1.661309 1.877927 2.097376 2.291857 2.619590 
+0.326495 0.586450 0.954506 1.197200 1.519600 1.893887 2.319365 2.533775 2.736139 2.847582 
+0.106638 0.178766 0.680283 0.829053 0.990716 1.241479 1.789242 2.154750 2.597141 2.799901 
+0.294220 0.377984 0.793384 0.971352 1.172200 1.572398 1.804897 2.028760 2.264042 2.492483 
+0.171726 0.263446 0.395475 0.621988 1.267402 1.408927 1.898373 2.102150 2.426709 2.776510 
+0.303342 0.364222 0.792880 1.046061 1.184958 1.568551 1.760719 2.139470 2.565548 2.655674 
+0.192848 0.257653 0.414826 0.791829 1.260674 1.636533 1.874636 2.009896 2.202175 2.572052 
+0.341824 0.417968 0.655810 1.026514 1.158607 1.346654 1.798696 1.911077 2.526891 2.702043 
+0.176931 0.234845 0.363167 0.522327 1.394457 1.894472 2.109195 2.282625 2.684080 2.823357 
+0.433185 0.607432 0.929790 1.250808 1.472755 1.627281 2.014445 2.256366 2.466320 2.630010 
+0.211267 0.313559 0.402576 0.554601 0.723386 0.871912 1.614736 2.390825 2.565792 2.757341 
+0.307409 0.394557 0.612848 0.987028 1.191241 1.356915 1.954914 2.160787 2.345073 2.569786 
+0.184320 0.254786 0.425592 0.782972 1.223405 1.413726 1.796288 1.997325 2.163509 2.505424 
+0.183175 0.235186 0.358817 1.447766 1.601221 1.798948 2.134861 2.384961 2.598175 2.763819 
+0.168505 0.236625 0.392319 0.651410 0.887019 1.463266 1.720871 1.858740 2.054516 2.697266 
+0.250944 0.424982 0.901118 1.085636 1.247720 1.422572 1.835136 2.141276 2.468994 2.643082 
+0.238593 0.326384 0.595703 0.813678 1.506809 1.745897 1.890343 2.252317 2.461518 2.634033 
+0.519767 0.866690 1.252206 1.413883 1.854974 2.027801 2.281339 2.431268 2.597701 2.697588 
+0.246522 0.333214 0.509160 1.154104 1.290713 1.443135 1.588080 2.324589 2.609196 2.797383 
+0.275391 0.402140 0.584019 0.959905 1.333760 1.460912 1.827046 2.003725 2.436316 2.639286 
+0.150522 0.212041 0.531410 1.050416 1.371279 1.580851 1.792845 1.995166 2.294940 2.614257 
+0.278576 0.329548 0.667074 1.214075 1.560713 1.652347 1.873746 2.021113 2.338907 2.664300 
+0.167863 0.226536 0.396757 0.597846 1.051873 1.627164 1.958256 2.062767 2.191380 2.432992 
+0.348666 0.407399 0.764654 0.897788 1.054142 1.537316 1.689159 2.089782 2.640438 2.728359 
+0.171013 0.243044 0.356522 0.490258 1.359997 1.815025 1.981484 2.206887 2.431276 2.636843 
+0.153522 0.396506 0.847453 1.284564 1.488783 1.804268 2.273812 2.522892 2.761823 2.876763 
+0.171880 0.287093 0.496257 0.755483 0.937035 1.107577 1.897834 2.108945 2.413154 2.660532 
+0.227201 0.370270 0.530492 0.844519 1.174595 1.296373 1.718215 1.907170 2.166590 2.484352 
+0.149331 0.183437 0.326162 0.488638 1.002939 1.377342 1.867235 2.108546 2.503408 2.786207 
+0.173193 0.266920 0.374287 0.945263 1.452229 1.556781 1.952554 2.099249 2.609846 2.766646 
+0.239351 0.413047 0.605130 0.721419 1.069987 1.322991 1.500901 2.100747 2.338950 2.541476 
+0.314543 0.427272 0.646059 0.977969 1.105555 1.443778 1.949196 2.065960 2.472020 2.663676 
+0.306321 0.430910 0.620780 0.848250 1.324991 1.683308 1.879595 2.069502 2.344394 2.454817 
+0.575586 0.847570 1.152532 1.423138 1.684099 1.969479 2.240224 2.428206 2.665523 2.760463 
+0.350078 0.450964 0.688480 0.893082 1.035498 1.299152 1.508386 1.683054 2.499108 2.655705 
+0.471148 0.571022 0.813000 1.058092 1.196537 1.491163 1.831861 1.956586 2.408824 2.619234 
+0.171564 0.273430 0.738762 0.920791 1.183470 1.349450 1.890642 2.110332 2.341546 2.722247 
+0.304218 0.440526 0.720869 0.956392 1.296296 1.536912 1.798491 2.129943 2.470933 2.711029 
+0.208585 0.283203 0.713164 0.859752 1.075018 1.320232 1.749308 2.009905 2.348887 2.539152 
+0.264896 0.431760 0.680060 0.840630 1.005182 1.200071 1.639044 1.877513 2.579690 2.697610 
+0.171107 0.229447 0.393985 0.553918 1.187522 1.583641 1.829031 2.101558 2.437468 2.610652 
+0.301877 0.445169 0.968634 1.180258 1.415638 1.646629 1.953737 2.185760 2.483000 2.660034 
+0.267959 0.387016 0.557674 0.755435 1.057021 1.189525 1.629581 2.283668 2.558077 2.683573 
+0.295624 0.500278 0.696740 0.866240 1.099396 1.243691 1.449224 1.818732 2.156886 2.467455 
+0.170796 0.218503 0.382819 0.541542 1.174040 1.482773 1.670539 2.124357 2.342810 2.501870 
+0.218617 0.408868 1.012231 1.352073 1.571864 1.753294 1.946988 2.192205 2.547198 2.762737 
+0.210391 0.288701 0.475984 0.690054 0.862131 1.282021 1.715676 1.959037 2.326017 2.522621 
+0.325276 0.411256 0.607216 1.024267 1.146043 1.558528 1.827982 1.956178 2.547484 2.688731 
+0.238733 0.302603 0.642540 0.860406 1.382580 1.700239 1.853297 2.013606 2.539089 2.671372 
+0.251458 0.654734 1.143938 1.335095 1.596794 1.905380 2.171292 2.352561 2.549262 2.709208 
+0.223912 0.427965 0.590260 0.805826 0.965451 1.148957 1.600066 1.767416 2.589376 2.776857 
+0.231425 0.413483 0.638906 0.882586 1.449203 1.579707 1.859705 2.112105 2.296389 2.474881 
+0.175747 0.273698 0.397808 1.029989 1.240179 1.441564 1.858169 1.988257 2.524452 2.677832 
+0.252558 0.363162 0.974161 1.201176 1.356803 1.559352 1.792123 2.089122 2.459025 2.636551 
+0.173802 0.246852 0.480971 0.700611 0.891748 1.561958 1.823062 1.996221 2.202269 2.680874 
+0.156459 0.259855 0.526047 0.742605 0.958340 1.426445 1.896392 2.280343 2.683239 2.835947 
+0.142921 0.202788 0.307634 0.548822 1.431571 1.572303 1.984312 2.212223 2.639484 2.831017 
+0.229329 0.366711 0.836992 1.135952 1.499118 1.677865 2.047730 2.243207 2.553663 2.706012 
+0.263443 0.342499 0.477117 0.660406 0.787355 1.288964 1.851275 2.320384 2.518393 2.638003 
+0.212725 0.343388 0.492706 0.738769 1.226813 1.353718 1.598551 1.965475 2.110981 2.504476 
+0.160187 0.263690 0.362021 0.839661 1.356922 1.457150 1.769821 1.888317 2.678737 2.835838 
+0.133248 0.196263 0.549077 0.905288 1.338934 1.580432 1.965798 2.247794 2.613434 2.821093 
+0.239176 0.349470 0.587777 0.780748 0.980439 1.200381 1.437420 1.725392 2.240059 2.450024 
+0.360450 0.512584 0.678578 0.889177 1.014277 1.240800 1.650560 1.806004 2.370762 2.627783 
+0.207946 0.300178 0.419389 0.758257 1.373065 1.509366 1.798146 2.166289 2.334602 2.736094 
+0.113082 0.204024 0.875013 1.243194 1.622958 1.886831 2.142636 2.338959 2.579123 2.767029 
+0.204623 0.309091 0.441874 0.966890 1.231677 1.366805 1.580086 1.745147 2.374530 2.638283 
+0.306051 0.414526 0.628201 1.074722 1.259864 1.439108 1.821360 1.964678 2.394043 2.575006 
+0.222328 0.323754 0.568002 0.970977 1.120920 1.580969 1.759222 2.139577 2.608362 2.763997 
+0.183300 0.372397 0.683079 1.022379 1.330137 1.624137 1.951990 2.252475 2.602804 2.814906 
+0.178777 0.259371 0.411261 0.873219 1.178107 1.319602 1.632433 1.885996 2.112106 2.286708 
+0.195172 0.346190 0.497154 0.755965 1.230183 1.347062 1.685780 1.867553 2.329508 2.752389 
+0.195738 0.263473 0.396445 0.598238 1.275429 1.903330 2.156978 2.286654 2.571493 2.728101 
+0.369955 0.545605 1.042124 1.189996 1.350332 1.546670 1.867983 2.111160 2.467785 2.643118 
+0.120478 0.160718 0.275169 0.491413 0.821334 1.099250 1.777446 1.936945 2.424408 2.722251 
+0.312690 0.451099 0.623388 0.828741 0.993468 1.136473 1.649831 1.980283 2.173337 2.352824 
+0.243020 0.364104 0.491726 0.944543 1.131493 1.302149 1.857127 1.973690 2.400218 2.803623 
+0.193524 0.259253 0.688441 1.340521 1.671654 1.914554 2.135144 2.313920 2.516303 2.683437 
+0.232326 0.387947 0.503848 0.715456 0.874078 1.042221 1.733322 1.898809 2.239800 2.752745 
+0.127511 0.344390 0.935547 1.175974 1.388543 1.630551 1.946941 2.245394 2.574897 2.775392 
+0.250995 0.323646 0.441648 0.957645 1.547323 1.747938 1.902388 2.157859 2.364221 2.510959 
+0.452291 0.693622 1.167859 1.318220 1.723133 1.940224 2.173724 2.424464 2.649258 2.755778 
+0.302326 0.431401 0.690302 0.950763 1.203250 1.329801 1.782387 2.179065 2.423352 2.542775 
+0.355954 0.504290 0.646021 0.864339 1.352328 1.533661 1.709471 1.960437 2.313335 2.451721 
+0.104149 0.152699 0.587242 0.903889 1.183253 1.432120 1.706576 1.956497 2.205742 2.655087 
+0.214047 0.281655 0.457781 1.318444 1.423722 1.610884 1.738687 2.315997 2.544975 2.780560 
+0.182527 0.232898 0.390991 0.554764 1.219695 1.416974 1.668180 1.883510 2.094564 2.216562 
+0.338387 0.409542 0.641629 0.767246 1.002251 1.650238 1.882942 2.041315 2.327004 2.467281 
+0.231453 0.309431 0.647883 0.827408 1.212245 1.724138 1.934800 2.138651 2.400716 2.581201 
+0.251173 0.509839 0.868347 1.305335 1.478259 1.819818 2.046666 2.383549 2.753204 2.859247 
+0.285117 0.362320 0.652022 0.913386 1.044703 1.289808 1.899468 2.119379 2.316214 2.520072 
+0.308945 0.404194 0.607700 0.785461 0.897492 1.263812 1.840947 1.995191 2.217981 2.533953 
+0.172631 0.233496 0.395828 0.637121 1.094870 1.305225 1.975991 2.149162 2.425342 2.614303 
+0.156972 0.227094 0.399128 1.055061 1.517113 1.669668 2.078208 2.233434 2.697606 2.846463 
+0.173100 0.226252 0.408500 0.582801 1.098220 1.450523 1.627000 2.016222 2.249189 2.498326 
+0.315638 0.497823 0.661879 0.886266 0.997659 1.195049 2.020156 2.258426 2.523904 2.750360 
+0.271575 0.365793 0.531980 0.808835 1.273952 1.739663 1.983593 2.133546 2.348498 2.473697 
+0.309045 0.513620 0.898951 1.324674 1.639949 1.904400 2.137826 2.348142 2.582366 2.748999 
+0.173271 0.315218 0.477788 0.757177 0.875942 1.105511 1.237776 1.628886 2.684859 2.842014 
+0.214839 0.273034 0.819191 1.102040 1.352164 1.657619 1.843619 1.972455 2.148374 2.639406 
+0.116215 0.162407 0.342715 0.825790 1.042936 1.381631 1.804365 2.083780 2.487045 2.753736 
+0.114070 0.425427 0.799793 1.070942 1.370278 1.618583 1.941131 2.202718 2.530097 2.788603 
+0.243867 0.378883 0.547723 0.808932 1.239737 1.400240 1.860324 2.069002 2.263329 2.534065 
+0.240195 0.333936 0.487895 0.915142 1.015549 1.511986 1.689823 2.078568 2.520731 2.673842 
+0.243495 0.327973 0.505429 0.651882 1.068591 1.611267 2.012066 2.161812 2.523348 2.687469 
+0.450190 0.521168 0.921017 1.146167 1.266402 1.657642 1.864716 2.036294 2.463023 2.557702 
+0.168729 0.270636 0.453713 0.701140 0.915560 1.098438 1.604334 1.960600 2.637718 2.809070 
+0.285452 0.345925 0.683009 1.127133 1.267180 1.493486 1.729244 1.897942 2.101957 2.279775 
+0.197911 0.283257 0.436315 0.680443 1.328944 1.456235 1.789607 2.073798 2.297794 2.442548 
+0.240843 0.293460 0.653007 1.222875 1.575683 1.682154 1.863647 2.019866 2.562349 2.730154 
+0.175191 0.254744 0.507483 0.660774 1.010367 1.200881 1.595444 1.912422 2.384227 2.758183 
+0.433781 0.510463 0.720856 1.101334 1.226464 1.443652 1.812748 1.957333 2.487847 2.673719 
+0.221585 0.287234 0.682977 1.068491 1.562962 1.716402 1.897843 2.129521 2.335900 2.524987 
+0.432705 0.840501 1.285672 1.439193 1.607667 1.795398 2.063813 2.311674 2.563015 2.711062 
+0.354576 0.466602 0.650767 0.813566 0.938340 1.128342 1.805345 2.218869 2.395036 2.543280 
+0.353822 0.544418 0.717185 0.903075 1.193814 1.302618 1.592775 1.928464 2.123197 2.300791 
+0.232127 0.335542 0.466150 1.038780 1.385075 1.474844 1.919673 2.031739 2.495480 2.805573 
+0.324665 0.377060 0.695910 1.283924 1.443588 1.596523 2.037150 2.169899 2.487425 2.691252 
+0.178303 0.236258 0.409957 0.644793 0.991558 1.439340 1.644055 2.056081 2.477767 2.606365 
+0.284645 0.347903 0.527540 0.667977 0.816156 1.687403 1.948029 2.113140 2.519425 2.617605 
+0.169782 0.245851 0.359543 0.504529 1.401427 1.633494 1.805664 2.181529 2.362061 2.647147 
+0.210292 0.309966 0.666265 1.086214 1.491332 1.862248 2.127350 2.359368 2.574699 2.710415 
+0.176920 0.247329 0.439418 0.634764 0.868848 1.346770 1.668256 2.024234 2.456935 2.792061 
+0.291292 0.461927 0.673858 0.827395 1.001436 1.123471 1.600221 2.273412 2.437555 2.642259 
+0.164460 0.272259 0.374336 0.675110 1.490030 1.612152 1.836475 1.984289 2.535905 2.742055 
+0.207858 0.272302 0.418159 0.745538 1.629583 1.981417 2.127840 2.293577 2.578197 2.705476 
+-0.062228 -0.323076 -0.332711 -0.101708 -0.034218 -0.067730 -0.032006 -0.034055 -0.063661 -0.112308 
+0.471805 0.655978 0.860725 0.972051 1.153458 1.409133 1.784627 2.073639 2.494294 2.661139 
+0.180954 0.273084 0.389972 0.849113 1.392936 1.510894 1.921378 2.096123 2.378596 2.651504 
+0.225545 0.488038 0.863470 1.410418 1.596034 1.771648 2.216348 2.386984 2.715102 2.839389 
+0.144776 0.247942 0.381281 0.699264 1.145490 1.295150 1.800737 2.008105 2.629862 2.826194 
+0.184806 0.248115 0.690786 0.828582 1.321220 1.503651 1.718611 2.087128 2.314827 2.538325 
+0.177133 0.339599 0.481545 0.790062 1.227237 1.348197 1.883037 2.021486 2.441350 2.699083 
+0.311370 0.368740 0.858970 1.014739 1.208416 1.746055 1.924647 2.151463 2.415915 2.560580 
+0.199710 0.264710 0.470506 0.794534 1.118412 1.570882 1.812521 1.939545 2.110880 2.373289 
+0.350635 0.482066 0.710421 0.960792 1.103058 1.325978 1.913082 2.069461 2.404068 2.662115 
+0.186366 0.241536 0.381062 0.517738 1.497745 1.924116 2.070412 2.234108 2.608905 2.750199 
+0.509032 0.734852 0.927875 1.145398 1.394132 1.611867 1.956418 2.176366 2.420236 2.596717 
+0.201922 0.299074 0.414361 0.597667 0.721234 0.975702 1.929938 2.144210 2.650822 2.846817 
+0.249810 0.373368 0.691262 0.918023 1.296625 1.472578 1.881052 2.160262 2.404070 2.576539 
+0.136751 0.198997 0.351968 0.839701 1.241879 1.397675 1.739341 1.946552 2.247675 2.676990 
+0.215765 0.277228 0.527200 1.277413 1.507933 1.677635 2.048299 2.207947 2.614490 2.774622 
+0.146093 0.199242 0.331057 0.518068 0.983944 1.184948 1.769667 1.933330 2.116265 2.713820 
+0.311505 0.400669 0.630844 1.132601 1.442876 1.558170 1.906709 2.045975 2.419754 2.659979 
+0.328470 0.401583 0.615037 0.993895 1.574441 1.869936 2.011558 2.184989 2.467408 2.581751 
+0.463865 0.687911 1.294672 1.536811 1.700885 1.872005 2.174049 2.341841 2.576782 2.729884 
+0.225601 0.311949 0.558510 0.720660 1.176452 1.364036 1.558010 2.010565 2.645874 2.801078 
+0.300116 0.554320 0.704246 0.926026 1.318277 1.422364 1.788571 2.123745 2.298732 2.683560 
+0.217312 0.342834 0.505628 0.885611 1.036468 1.281361 1.711880 1.931222 2.475950 2.632713 
+0.235789 0.329023 0.515572 1.047927 1.413696 1.546519 1.893021 2.099995 2.430834 2.628838 
+0.170354 0.225158 0.395611 0.654515 1.106878 1.458362 1.794475 2.012486 2.334320 2.553665 
+0.420377 0.492906 0.763825 0.888793 1.057272 1.729447 1.982471 2.145245 2.614874 2.700457 
+0.227828 0.299193 0.480966 0.855216 1.663391 1.817425 2.035090 2.237723 2.436081 2.645378 
+0.104919 0.220297 0.922747 1.248851 1.468985 1.845122 2.172923 2.471447 2.702677 2.827250 
+0.245660 0.363951 0.496495 0.718395 0.792531 1.188290 2.028262 2.148021 2.601079 2.767886 
+0.204949 0.323637 0.501508 0.803477 1.101494 1.228773 1.446609 1.596114 1.975723 2.669065 
+0.162963 0.221990 0.366143 0.569144 1.300415 1.508941 1.736879 2.176494 2.560640 2.781882 
+0.226216 0.303208 0.451507 0.942554 1.584997 1.708649 1.937744 2.125981 2.374113 2.806697 
+0.279313 0.434425 0.600140 0.761924 0.967326 1.085339 1.400649 2.085299 2.311823 2.531842 
+0.496970 0.611003 0.813504 1.003786 1.112345 1.561294 2.006644 2.127810 2.538433 2.707483 
+0.263598 0.399612 0.523023 0.751894 1.468733 1.634563 1.854672 2.093993 2.288808 2.486320 
+0.447064 0.669729 1.231144 1.393911 1.519359 1.740011 2.130839 2.331661 2.622426 2.742410 
+0.217113 0.344226 0.479443 0.953089 1.113345 1.292028 1.405063 2.035854 2.706084 2.818154 
+0.215666 0.346628 0.459806 0.841338 1.330315 1.450787 1.693170 1.963290 2.133067 2.598851 
+0.032462 0.108906 0.641839 0.918247 1.274605 1.548613 1.860118 2.149524 2.473967 2.745703 
+0.126290 0.220180 0.749275 1.069688 1.256552 1.502364 1.780350 2.049865 2.514790 2.760101 
+0.201396 0.256212 0.604955 0.839430 1.037016 1.425915 1.784411 2.082149 2.278545 2.520697 
+0.250554 0.361913 0.538203 1.009347 1.125631 1.467374 1.842276 1.982168 2.659098 2.812528 
+0.173329 0.232821 0.397105 0.674759 1.272214 1.578849 1.859567 2.046929 2.368178 2.523695 
+0.361106 0.495511 0.860190 1.082212 1.386309 1.580348 1.935833 2.155852 2.453898 2.622802 
+0.232936 0.346360 0.515455 0.716889 0.946937 1.062494 1.542360 2.240413 2.402681 2.639495 
+0.329138 0.483393 0.640612 0.860349 1.191888 1.297933 1.656172 2.079184 2.298135 2.457837 
+0.238706 0.397136 0.560834 0.799404 1.288560 1.405264 1.678272 2.182520 2.375152 2.668620 
+0.304175 0.364112 0.779173 1.338909 1.476173 1.664278 1.993154 2.118992 2.593337 2.731349 
+0.164802 0.217347 0.366682 0.565116 0.753855 1.009701 1.744416 2.023924 2.268955 2.433440 
+0.296797 0.356308 0.759995 1.197140 1.309824 1.482490 1.667647 1.840314 2.517650 2.648945 
+0.273443 0.411365 0.594999 0.894650 1.424021 1.586944 1.842399 2.215251 2.447173 2.729450 
+0.236751 0.360177 1.030195 1.434197 1.683780 1.888286 2.114605 2.264435 2.477029 2.630414 
+0.273289 0.394610 0.610213 0.759723 0.937713 1.239572 1.713796 1.995028 2.367774 2.635783 
+0.334115 0.411443 0.610825 0.955868 1.502521 1.785262 1.937709 2.105790 2.350122 2.470200 
+0.159072 0.242631 0.393231 0.844130 1.217685 1.419823 1.733096 1.891617 2.514256 2.659089 
+0.309184 0.361119 0.759243 1.263501 1.440575 1.570597 1.821846 1.944982 2.440271 2.684484 
+0.161993 0.224640 0.401324 0.753906 1.032749 1.440682 1.809558 1.978594 2.149676 2.538575 
+0.247815 0.331789 0.491727 0.713759 0.865824 1.618286 1.768016 2.244205 2.532077 2.684242 
+0.170605 0.248525 0.354505 0.495374 1.569514 1.828195 1.990227 2.213056 2.400769 2.760431 
+0.331931 0.515143 0.809566 1.042681 1.451957 1.638579 1.956390 2.262500 2.598192 2.813680 
+0.209020 0.349585 0.505601 0.704594 0.814790 1.362447 1.939075 2.048582 2.423957 2.756261 
+0.281207 0.453713 0.595485 0.765529 1.220000 1.391996 1.561764 2.022289 2.265860 2.679768 
+0.150346 0.251592 0.409505 0.770775 1.236125 1.384343 1.745495 1.893299 2.588497 2.822991 
+0.161090 0.246862 0.484826 1.245783 1.397859 1.714145 2.040802 2.468857 2.706233 2.837580 
+0.213765 0.374235 0.536566 0.733390 1.126324 1.249567 1.538484 1.976391 2.151928 2.359273 
+0.272518 0.457655 0.808972 1.019104 1.150011 1.326035 1.711513 2.051136 2.549677 2.799790 
+0.179767 0.262954 0.395346 0.660835 1.345694 1.502264 1.819384 1.963548 2.273263 2.618778 
+0.175488 0.306329 1.103215 1.306099 1.574389 1.897560 2.214935 2.416432 2.605393 2.738739 
+0.154666 0.239592 0.415828 0.780679 0.945224 1.233384 1.696039 1.940742 2.514563 2.679770 
+0.269177 0.354740 0.557021 0.969509 1.345317 1.463570 1.798387 2.241221 2.456339 2.610210 
+0.239145 0.326264 0.494465 1.071214 1.209459 1.537726 1.952743 2.113220 2.610725 2.747535 
+0.218208 0.598959 0.871276 1.110151 1.386993 1.648655 1.918609 2.193362 2.546880 2.756671 
+0.176681 0.262087 0.424568 0.933283 1.208095 1.334188 1.755633 1.926341 2.187131 2.556577 
+0.213062 0.385248 0.514741 0.876978 1.165897 1.307493 1.825031 2.012224 2.554948 2.737931 
+0.151222 0.247007 0.382114 0.751657 1.215610 1.342363 1.975904 2.137584 2.617134 2.820105 
+0.299224 0.473356 0.825171 1.146594 1.528401 1.694234 1.952214 2.144722 2.373789 2.555562 
+0.207137 0.319897 0.501670 0.711149 0.853927 1.057889 1.770494 2.071726 2.492216 2.811033 
+0.465560 0.618831 0.782398 1.010037 1.195984 1.322540 1.855998 2.160517 2.324801 2.507033 
+0.201076 0.301843 0.444311 0.822638 1.176021 1.272371 1.646433 2.064560 2.227727 2.623829 
+0.210505 0.247037 0.495092 1.302518 1.760886 1.827284 2.217044 2.446377 2.623543 2.741148 
+0.195999 0.279369 0.481573 0.654787 1.080842 1.412382 1.716490 2.052322 2.290101 2.738165 
+0.236926 0.310814 0.896361 1.162180 1.328092 1.558913 1.774564 1.905228 2.402246 2.665023 
+0.244472 0.327963 0.646896 1.095894 1.620412 1.772324 2.045520 2.193957 2.547128 2.722609 
+0.346731 0.581380 1.070375 1.522205 1.740223 1.980572 2.266647 2.404418 2.746561 2.871000 
+0.430698 0.619190 0.836877 1.015020 1.167909 1.332640 1.815328 2.234722 2.476070 2.638178 
+0.221367 0.307079 0.458329 0.850712 1.289560 1.423009 1.621570 1.985342 2.331434 2.467832 
+0.116322 0.217253 0.728326 0.940859 1.188330 1.378722 1.687841 1.910693 2.604869 2.797202 
+0.187928 0.267923 0.389066 1.155944 1.483571 1.593699 1.818241 1.963936 2.473096 2.607548 
+0.168954 0.211406 0.372427 0.529448 0.973588 1.431171 1.621558 1.856431 2.189298 2.343881 
+0.273371 0.413963 0.664359 0.794553 1.017733 1.399395 1.724746 2.089838 2.367948 2.555808 
+0.212416 0.270112 0.509967 0.759092 1.293781 1.781086 2.091445 2.219374 2.499069 2.630826 
+0.300696 0.481937 0.835784 1.276211 1.461493 1.644316 1.971697 2.234847 2.641035 2.829278 
+0.285091 0.416886 0.605330 0.808172 0.944872 1.129570 1.919248 2.157389 2.400226 2.673656 
+0.225704 0.384656 0.630586 0.788196 1.224861 1.419420 1.681321 1.970805 2.212616 2.617121 
+0.132447 0.177755 0.301537 0.471768 1.155148 1.332095 1.708466 2.024543 2.495585 2.788666 
+0.252038 0.329800 0.481080 0.954609 1.422083 1.620359 2.006123 2.168392 2.355165 2.505083 
+0.183435 0.241389 0.417674 0.598794 1.014975 1.205139 1.701958 1.977784 2.374336 2.586101 
+0.302192 0.384974 0.608153 0.938510 1.084287 1.329203 2.069641 2.319152 2.494203 2.675684 
+0.198808 0.281220 0.391748 0.777377 1.553382 1.790825 1.925301 2.135471 2.304278 2.485154 
+0.370469 0.548730 0.880131 1.168541 1.456674 1.645880 2.049941 2.288441 2.557653 2.759821 
+0.156583 0.250724 0.394960 0.691089 0.837322 1.066297 1.836287 1.972838 2.591097 2.786561 
+0.322824 0.379018 0.593081 1.086011 1.406693 1.490406 1.734998 1.912817 2.081717 2.475586 
+0.158775 0.218842 0.457222 0.869711 1.219773 1.629722 1.953462 2.134004 2.392326 2.640093 
+0.217524 0.325911 0.628615 0.997991 1.504329 1.668932 1.958103 2.245372 2.630371 2.808323 
+0.170343 0.254286 0.510717 0.814297 1.028209 1.355930 1.726583 2.047676 2.381522 2.692279 
+0.297689 0.343194 0.742306 0.882638 1.038877 1.713935 1.880819 2.088189 2.556386 2.634265 
+0.215251 0.296748 0.454072 0.676499 1.007705 1.797713 2.004948 2.206914 2.548819 2.725676 
+0.412021 0.642343 0.828334 0.951784 1.236305 1.495649 1.898175 2.129486 2.438961 2.666301 
+0.179065 0.252377 0.372814 0.530815 0.713797 0.927597 1.666069 2.104770 2.392383 2.734423 
+0.433130 0.566964 0.740476 0.961675 1.107074 1.288034 1.772074 1.904854 2.174689 2.570674 
+0.223409 0.295735 0.606368 0.786946 1.326960 1.538874 1.755901 1.939986 2.371080 2.488210 
+0.224170 0.294402 0.684662 1.251045 1.593460 1.708681 2.018073 2.187551 2.515208 2.721384 
+0.166379 0.238226 0.406222 0.623445 0.883761 1.076979 1.603102 1.916054 2.202559 2.699771 
+0.489484 0.578385 0.832748 1.115430 1.216650 1.575882 1.929300 2.049396 2.522680 2.658393 
+0.291742 0.359710 0.491711 1.071820 1.458792 1.603219 1.747893 2.124226 2.418190 2.528558 
+0.438848 0.678792 1.139964 1.311051 1.673038 1.878533 2.126488 2.288717 2.493483 2.631731 
+0.271300 0.466760 0.592041 0.808897 0.942888 1.124238 1.820005 1.976080 2.249710 2.775433 
+0.389199 0.559773 0.703683 0.900063 1.345064 1.462662 1.769904 2.128433 2.365683 2.501187 
+0.190440 0.280423 0.447001 1.039189 1.218375 1.614861 1.844728 2.111340 2.460942 2.613396 
+0.241700 0.302019 0.613366 1.249946 1.410607 1.580256 1.768325 1.986861 2.430632 2.581026 
+0.206516 0.286418 0.537788 0.707728 1.197196 1.572380 1.755394 1.933391 2.472918 2.645023 
+0.318502 0.396523 0.647544 0.775364 0.936563 1.581584 2.058082 2.195477 2.618710 2.743108 
+0.191584 0.269771 0.414492 0.786131 1.376273 1.613474 1.799398 2.344394 2.536806 2.749566 
+0.237976 0.316356 0.446480 0.893873 1.679975 1.965388 2.096434 2.252618 2.468845 2.587829 
+0.123845 0.159072 0.284123 0.467782 0.818151 1.307335 1.754936 2.066298 2.476057 2.758144 
+0.261052 0.393384 0.760978 0.918516 1.100980 1.327690 1.632686 2.033602 2.384945 2.554088 
+0.264436 0.350588 0.609731 0.749716 1.157992 1.660102 1.868180 2.004961 2.591971 2.739458 
+0.164585 0.215089 0.375970 0.959153 1.727354 1.859913 1.991898 2.220550 2.431018 2.769731 
+0.204030 0.290606 0.483834 0.827022 1.016831 1.223453 1.699260 1.910125 2.140620 2.267503 
+0.526138 0.709922 0.836725 1.069406 1.269462 1.405044 1.834798 2.034524 2.212188 2.459999 
+0.225247 0.340174 0.449473 0.914306 1.380619 1.486761 1.795410 1.983939 2.206215 2.713630 
+0.200753 0.622848 0.941841 1.226624 1.507543 1.821962 2.134104 2.366417 2.634739 2.771988 
+0.174703 0.282776 0.702258 0.898342 1.084446 1.266724 1.757851 2.083739 2.401420 2.756275 
+0.249131 0.323445 0.720321 0.878509 1.110362 1.576682 1.865315 2.114744 2.387200 2.528666 
+0.192991 0.271656 0.400815 0.639719 1.281970 1.423380 2.050229 2.264541 2.462010 2.662504 
+0.266874 0.325220 0.675228 1.126545 1.267438 1.706113 1.920856 2.125988 2.574605 2.678193 
+0.223081 0.286041 0.655976 0.816840 1.060069 1.561164 1.748293 1.911129 2.075313 2.503462 
+0.407716 0.515541 0.739241 0.941291 1.059746 1.404674 1.781339 1.892197 2.404849 2.648290 
+0.240599 0.312213 0.510661 0.666324 1.224803 1.866233 2.050438 2.204639 2.619539 2.768546 
+0.384825 0.587577 1.021218 1.214225 1.437340 1.728676 1.998469 2.183120 2.571593 2.747573 
+0.245764 0.343500 0.509527 0.727872 0.876936 1.024899 1.769731 2.415709 2.632816 2.787619 
+0.290619 0.390761 0.566531 0.941586 1.353924 1.461037 1.795546 2.132642 2.313283 2.486608 
+0.172727 0.258217 0.438312 0.716613 1.170907 1.311367 1.733515 1.899224 2.138675 2.739799 
+0.222657 0.287215 0.449779 1.369666 1.490501 1.701894 1.880425 2.393512 2.600773 2.787142 
+0.154428 0.222305 0.357310 0.630820 1.037882 1.342771 1.730454 1.920364 2.046990 2.549536 
+0.299554 0.623129 0.825895 1.063948 1.332600 1.466624 1.854370 2.128982 2.327186 2.521370 
+0.218073 0.257913 0.681337 0.900215 1.517137 1.843444 2.006541 2.205575 2.505616 2.633109 
+0.686321 1.027088 1.182402 1.346554 1.590920 1.854772 2.111571 2.250916 2.482490 2.625270 
+0.220174 0.305579 0.452469 1.009178 1.208905 1.586079 1.726183 2.308495 2.539415 2.745570 
+0.341504 0.508703 0.663379 0.854389 1.270406 1.419250 1.624925 2.064447 2.426578 2.552193 
+0.199767 0.277559 0.419200 1.151687 1.302355 1.531961 1.720872 2.013206 2.476765 2.595851 
+0.243094 0.314600 0.435247 1.051642 1.528616 1.656151 1.884292 2.065968 2.307851 2.563448 
+0.224054 0.300322 0.546545 0.706978 1.059557 1.412749 1.925773 2.119205 2.355100 2.490204 
+0.342948 0.395972 0.713508 0.788514 1.092279 1.685316 1.836105 2.270695 2.521777 2.625975 
+0.183089 0.263605 0.369340 0.558240 1.511750 1.902656 2.045224 2.218195 2.445586 2.611569 
+0.332871 0.558850 0.877672 1.147342 1.590679 1.823730 2.184823 2.407743 2.721120 2.860996 
+0.228040 0.355308 0.498081 0.818616 1.098234 1.212951 1.802644 2.085736 2.290465 2.748208 
+0.189112 0.289591 0.530362 0.768658 0.944224 1.325806 1.678253 1.884531 2.251127 2.682120 
+0.144799 0.199748 0.350015 0.546248 1.106050 1.629785 1.884696 2.005826 2.432189 2.780747 
+0.172297 0.243074 0.380863 0.968654 1.645970 1.743664 1.952788 2.092464 2.574491 2.809210 
+0.220791 0.397930 0.676300 0.814804 1.085618 1.265955 1.557093 1.974461 2.157493 2.568431 
+0.351036 0.481040 0.684693 1.046142 1.219179 1.404440 1.909685 2.051432 2.405205 2.669908 
+0.255837 0.394071 0.518620 0.767306 1.393237 1.618907 1.766511 2.022002 2.425935 2.559548 
+0.418747 0.617245 1.109151 1.299581 1.560582 1.912698 2.151587 2.420609 2.666448 2.766110 
+0.194318 0.321980 0.488422 0.733153 0.927489 1.091432 1.537804 1.709529 2.300954 2.777973 
+0.441506 0.552407 0.771304 1.070023 1.253431 1.402955 1.774359 1.917186 2.236828 2.573015 
+0.096364 0.161493 0.604211 0.841192 1.084960 1.469012 1.765762 2.035652 2.415550 2.679394 
+0.164758 0.273531 0.786362 0.944165 1.314729 1.443079 1.820614 2.232970 2.474360 2.689648 
+0.214880 0.277389 0.624783 0.819250 1.049581 1.383136 1.664426 1.809937 2.247050 2.531672 
+0.339450 0.490710 0.650894 0.802164 0.968459 1.286294 1.736119 2.108232 2.488573 2.676959 
+0.173316 0.243343 0.367127 0.508577 1.224968 1.826439 1.981666 2.158278 2.351480 2.588130 
+0.452858 0.676518 0.916839 1.095033 1.353796 1.666215 1.906615 2.097253 2.478402 2.671285 
+0.255572 0.430173 0.627154 0.845685 1.029142 1.165075 1.851297 2.238290 2.425106 2.786559 
+0.292973 0.495593 0.670882 0.825200 1.176688 1.345844 1.524943 1.905429 2.293155 2.481585 
+0.190065 0.270578 0.429350 0.650608 1.338108 1.544596 1.723081 2.100587 2.455792 2.616187 
+0.270146 0.357004 1.012493 1.334770 1.484494 1.749118 1.948371 2.163260 2.479187 2.615849 
+0.190746 0.284342 0.459935 0.840326 1.058271 1.247416 1.686518 1.858042 2.349852 2.474999 
+0.261440 0.355783 0.788131 0.963975 1.170960 1.426067 1.663365 1.845513 2.450110 2.615423 
+0.223477 0.289406 0.644196 0.841108 1.449672 1.680461 1.864688 1.970082 2.320400 2.678113 
+0.307863 0.471864 0.951274 1.401941 1.598874 1.839736 2.064310 2.222939 2.646039 2.793416 
+0.215456 0.324380 0.542457 0.738120 0.904477 1.125488 1.593790 1.942637 2.403731 2.625335 
+0.327978 0.431326 0.649146 0.980387 1.452639 1.595021 1.827042 2.174676 2.430383 2.562971 
+0.221416 0.405136 0.534878 0.941825 1.275052 1.387146 1.678769 1.816890 2.607600 2.805074 
+0.261063 0.296006 0.765065 1.323946 1.455938 1.597320 1.755333 1.939918 2.595321 2.725885 
+0.196465 0.266597 0.478088 0.673695 0.918173 1.783876 1.968005 2.144556 2.340807 2.571099 
+0.222072 0.329556 0.457488 0.632821 0.926941 1.737060 1.925589 2.280188 2.742106 2.840767 
+0.177587 0.262768 0.386637 0.661755 1.507334 1.651771 2.016609 2.209898 2.436253 2.794750 
+0.237412 0.318760 0.572489 1.126672 1.262629 1.705670 1.962639 2.240223 2.640836 2.760043 
+0.164018 0.263560 0.389157 0.576607 0.699517 1.304965 1.938275 2.108181 2.361245 2.481099 
+0.312927 0.453499 0.595937 0.720801 1.155128 1.421222 1.654805 2.125481 2.342733 2.559528 
+0.187311 0.340553 0.479298 0.800541 1.324137 1.434292 1.773373 1.966276 2.442163 2.794439 
+0.240145 0.361802 0.529355 1.032511 1.333136 1.613724 1.902121 2.393189 2.610681 2.798432 
+0.256618 0.369979 0.571037 0.805889 0.931870 1.242267 1.556114 1.777808 2.100100 2.279277 
+0.315460 0.387429 0.763439 1.135994 1.225008 1.383314 1.479969 1.857272 2.506217 2.572444 
+0.231972 0.332687 0.498409 0.763292 1.482840 1.675304 1.917342 2.171163 2.373797 2.762604 
+0.241092 0.374768 0.886119 1.278350 1.760790 1.986414 2.153341 2.321588 2.561671 2.682561 
+0.181333 0.265570 0.457041 0.832421 0.997777 1.194519 1.519027 1.911348 2.372249 2.624795 
+0.217281 0.313910 0.490988 1.021293 1.238563 1.420272 1.905572 2.077699 2.389621 2.611841 
+0.241907 0.344617 0.495322 0.833050 0.943750 1.625368 1.957947 2.118287 2.573169 2.706253 
+0.260933 0.421768 0.714877 1.045217 1.348286 1.557267 1.920459 2.142565 2.463638 2.761801 
+0.191170 0.260573 0.482902 0.852619 1.182296 1.355163 1.734327 2.038425 2.220238 2.348315 
+0.235960 0.420321 0.558300 0.822306 0.959709 1.163020 1.746196 1.872763 2.463190 2.656887 
+0.182801 0.229509 0.384936 0.525996 1.144440 1.505356 2.087714 2.235691 2.603441 2.821072 
+0.433326 0.648975 1.152821 1.324354 1.499568 1.680615 1.927155 2.144623 2.501930 2.672369 
+0.185230 0.282855 0.433567 0.613008 0.800249 1.189297 1.815486 2.216184 2.611609 2.819742 
+0.305950 0.512379 0.682631 0.866346 1.140903 1.267093 1.689424 1.993235 2.167743 2.491215 
+0.214384 0.330677 0.465107 0.799324 1.249335 1.354711 1.961836 2.155521 2.365402 2.768664 
+0.252228 0.294891 0.721925 1.385448 1.627786 1.728361 2.094373 2.246017 2.542430 2.725817 
+0.247355 0.467492 0.616684 0.821505 1.051679 1.163064 1.676721 1.903589 2.192444 2.770439 
+0.267056 0.322353 0.878273 1.273551 1.387890 1.656880 1.838486 2.256932 2.489329 2.617788 
+0.276548 0.347431 0.510036 0.916479 1.503298 1.902076 2.081537 2.205346 2.459159 2.574602 
+0.420124 0.634373 0.972031 1.349147 1.660814 1.863940 2.209039 2.359323 2.665996 2.774761 
+0.245603 0.346643 0.484960 0.852273 1.113317 1.246194 1.675673 2.134010 2.397448 2.567438 
+0.278909 0.453205 0.609401 0.817334 1.386351 1.540485 1.784357 2.027199 2.208866 2.416858 
+0.216689 0.291968 0.633303 0.821476 1.230792 1.517474 1.740384 1.839894 2.264549 2.645633 
+0.250583 0.356352 0.706187 1.159764 1.340429 1.531877 1.805133 2.212588 2.494217 2.645859 
+0.173603 0.221482 0.407668 0.602668 1.173887 1.363948 1.714837 2.069366 2.246713 2.384843 
+0.351700 0.426939 0.676212 0.785470 1.018054 1.600174 1.760596 1.981016 2.523457 2.622580 
+0.247404 0.347843 0.537821 0.715383 1.334742 1.730445 1.932738 2.116362 2.550868 2.719251 
+0.267640 0.435192 0.734410 1.154981 1.439281 1.665625 2.036115 2.238505 2.694509 2.857159 
+0.377315 0.500802 0.678295 0.852176 0.986722 1.234297 1.946465 2.216296 2.369690 2.568046 
+0.282474 0.484623 0.647346 0.838126 1.116069 1.236355 1.605158 2.068283 2.241476 2.594701 
+0.179830 0.276699 0.393477 0.618077 1.005536 1.171683 1.936124 2.147218 2.344016 2.802089 
+0.150385 0.222615 0.453699 1.059570 1.514904 1.869262 2.170323 2.385821 2.713541 2.834759 
+0.190104 0.279191 0.487233 0.679289 1.139586 1.367418 1.532297 1.968753 2.379302 2.609276 
+0.383123 0.512258 0.719040 0.900857 1.026096 1.446135 1.985069 2.104295 2.577580 2.725283 
+0.233385 0.311008 0.468900 0.822874 1.358548 1.845397 2.088437 2.201482 2.419016 2.524441 
+0.448047 0.666107 0.986682 1.233646 1.707798 1.882326 2.175233 2.389889 2.561257 2.672922 
+0.190653 0.315609 0.490994 0.746849 0.882522 1.292447 1.594598 1.771911 2.563910 2.770587 
+0.215760 0.268515 0.648673 1.130954 1.282429 1.603348 1.802088 2.039412 2.361344 2.489232 
+0.146123 0.204228 0.382306 0.718573 1.152464 1.523749 1.750535 2.085976 2.456666 2.706774 
+0.097438 0.189231 0.726839 1.130330 1.394979 1.591658 1.959512 2.188961 2.611863 2.823535 
+0.153693 0.220100 0.418171 0.907592 1.098588 1.409276 1.661682 2.052898 2.357440 2.534558 
+0.249007 0.320795 0.581631 0.894597 1.056178 1.470144 1.725025 1.888314 2.380417 2.512561 
+0.215043 0.307452 0.489967 0.675625 1.212878 1.644852 1.813460 2.219287 2.421185 2.711916 
+0.454182 0.656019 0.980383 1.162424 1.342999 1.469780 1.737221 2.016043 2.396287 2.589121 
+0.248859 0.363988 0.568562 0.710472 0.879383 0.969136 1.321791 2.203573 2.459572 2.685742 
+0.275498 0.346347 0.720990 0.962739 1.142409 1.548421 1.756807 1.939827 2.107470 2.346331 
+0.168346 0.213677 0.371061 0.533405 1.281879 1.420915 1.743873 1.929374 2.354611 2.516531 
+0.269357 0.323555 0.660417 1.246119 1.389881 1.620112 1.880792 2.024803 2.535747 2.641379 
+0.143544 0.211826 0.349106 0.686750 0.852997 1.123379 1.740477 1.910903 2.395457 2.675160 
+0.391096 0.461323 0.706811 0.863080 0.973392 1.482338 1.771634 1.885759 2.506445 2.623396 
+0.306784 0.371767 0.612809 1.165417 1.539601 1.649444 1.847967 2.215674 2.421224 2.551842 
+0.412446 0.658776 1.248823 1.445679 1.591378 1.718751 1.944947 2.241242 2.542474 2.718017 
+0.219635 0.320449 0.459092 0.733764 0.861516 1.087584 1.877017 2.055926 2.267583 2.421807 
+0.353269 0.558306 0.705301 0.895998 1.276299 1.401657 1.682423 1.948663 2.130723 2.378531 
+0.266056 0.406507 0.542960 1.171871 1.333369 1.503282 1.781150 1.967881 2.639831 2.805456 
+0.366997 0.435212 0.708835 1.184565 1.338341 1.578537 2.031195 2.174915 2.531932 2.718652 
+0.180016 0.244121 0.466532 0.637822 0.933798 1.613163 1.758726 2.141582 2.383844 2.570767 
+0.183031 0.268217 0.410149 0.583275 0.768297 1.302461 1.927508 2.184191 2.515648 2.724226 
+0.198728 0.279758 0.393674 0.687093 1.521403 1.831985 1.964413 2.182576 2.354737 2.718166 
+0.266621 0.428987 0.748177 1.052044 1.416922 1.709958 1.975394 2.163065 2.390250 2.722350 
+0.187580 0.301657 0.428103 0.623084 0.722948 1.407722 1.664241 1.898839 2.663491 2.802190 
+0.207840 0.306975 0.483853 0.724360 1.022497 1.221432 1.415162 1.956839 2.527680 2.734643 
+0.188611 0.284294 0.408262 0.721431 1.384715 1.505269 1.966087 2.173208 2.428517 2.770771 
+0.222823 0.272639 0.503764 0.859246 1.498403 1.885767 2.099957 2.235388 2.567829 2.691284 
+0.152758 0.219680 0.338675 0.597863 0.978697 1.200801 1.746909 1.957261 2.074441 2.404458 
+0.429246 0.630671 0.792842 0.964490 1.262744 1.388795 1.721613 2.091229 2.345298 2.490896 
+0.256329 0.380734 0.539915 1.009152 1.400960 1.509524 1.869215 2.029196 2.348803 2.776082 
+0.272403 0.672458 0.977874 1.334181 1.683066 1.922996 2.291748 2.486116 2.709534 2.862231 
+0.158762 0.287189 0.410234 0.812307 1.117621 1.262447 1.898049 2.047016 2.529228 2.738030 
+0.179810 0.233529 0.707400 1.047569 1.289640 1.489108 1.847319 2.074331 2.343157 2.539680 
+0.215347 0.304896 0.440699 0.897509 1.322585 1.472844 1.996310 2.165007 2.384550 2.574797 
+0.286874 0.339813 0.883878 1.115931 1.272467 1.744249 1.885743 2.158576 2.589603 2.672644 
+0.210579 0.284270 0.517041 0.796519 1.129021 1.668905 1.939439 2.065525 2.221131 2.479044 
+0.261094 0.357573 0.576680 0.963769 1.112459 1.279265 1.822867 1.981048 2.197737 2.571008 
+0.181278 0.244687 0.379354 0.499565 1.371147 1.939687 2.081545 2.257664 2.473413 2.679019 
+0.491809 0.793403 1.095573 1.248586 1.433776 1.611914 1.888047 2.132035 2.457073 2.627391 
+0.251235 0.353668 0.466231 0.673754 0.761327 1.114781 2.007224 2.123861 2.465832 2.639406 
+0.345158 0.523258 0.679274 0.860119 1.194849 1.326006 1.848632 2.132397 2.326670 2.510966 
+0.160104 0.220957 0.395991 0.698411 0.969721 1.448772 1.710923 1.833738 2.255148 2.614909 
+0.154242 0.218964 0.347268 1.230461 1.592574 1.733703 2.002980 2.182922 2.555376 2.704150 
+0.147752 0.202050 0.328105 0.531857 1.097229 1.287887 1.880144 2.033520 2.241027 2.732837 
+0.394173 0.497084 0.712849 1.053505 1.351267 1.458228 1.861207 2.181794 2.392320 2.533753 
+0.302335 0.380917 0.549353 0.985252 1.517171 1.702307 1.859140 2.148560 2.460271 2.579449 
+0.489225 0.748632 1.289304 1.544824 1.780201 2.071873 2.310551 2.443509 2.704605 2.789720 
+0.237235 0.383617 0.738218 0.908733 1.218091 1.378373 1.607258 2.196781 2.508687 2.662952 
+0.287297 0.414596 0.576260 0.837481 1.292636 1.398051 1.699746 2.155291 2.397760 2.512719 
+0.226644 0.373291 0.522981 0.950126 1.196878 1.352198 1.832943 1.977466 2.370185 2.574990 
+0.202424 0.294204 0.576457 1.079769 1.296360 1.513369 1.942298 2.239055 2.513119 2.684820 
+0.205672 0.262350 0.438217 0.606959 0.798794 1.451892 1.730536 1.885799 2.292567 2.433348 
+0.304096 0.348725 0.817557 0.973213 1.149195 1.769516 1.914392 2.234704 2.592687 2.674729 
+0.206504 0.281307 0.376040 0.779557 1.499555 1.886752 2.032034 2.220961 2.528659 2.666047 
+0.130572 0.255765 0.794488 1.301534 1.504711 1.681929 2.069095 2.309137 2.695781 2.848379 
+0.214845 0.339856 0.490758 0.723584 1.026000 1.188343 1.937657 2.288473 2.513405 2.753320 
+0.359564 0.482479 0.670546 1.042777 1.240083 1.360140 1.592377 1.718141 2.214001 2.639319 
+0.106171 0.136363 0.239866 0.666826 1.262252 1.543841 1.886197 2.162484 2.518336 2.782589 
+0.188744 0.251920 0.360219 0.913075 1.618822 1.785177 1.927723 2.115808 2.320559 2.642776 
+0.225904 0.378515 0.558007 0.728218 0.996381 1.117859 1.477832 1.960983 2.185323 2.667571 
+0.436819 0.511780 0.811933 1.004760 1.128440 1.604755 1.813182 1.987683 2.595291 2.709021 
+0.249083 0.362078 0.480846 0.813722 1.404123 1.566622 1.741757 2.142883 2.302238 2.567856 
+0.249083 0.362078 0.480846 0.813722 1.404123 1.566622 1.741757 2.142883 2.302238 2.567856 
diff --git a/codec2/tags/0.4/src/codebook/lspvqexp2.txt b/codec2/tags/0.4/src/codebook/lspvqexp2.txt
new file mode 100644 (file)
index 0000000..2614889
--- /dev/null
@@ -0,0 +1,2049 @@
+5 2048
+-0.002077 -0.038247 -0.036477 -0.003710 0.058915 
+-0.035874 -0.128709 0.029183 -0.019849 0.049800 
+-0.007389 -0.040358 0.044426 0.047695 -0.043474 
+0.075558 0.066718 -0.000350 -0.002910 0.009981 
+-0.009790 0.076568 -0.100581 0.021504 -0.026649 
+-0.026362 -0.100884 -0.003799 0.061469 0.001711 
+-0.034198 -0.008936 0.039170 -0.055448 -0.078447 
+0.028441 -0.038152 0.015590 0.036567 -0.041377 
+0.049588 -0.091695 0.004580 -0.055922 -0.041638 
+-0.025374 -0.037246 -0.002046 0.002822 -0.108640 
+-0.050719 0.152889 0.036331 0.025204 -0.017701 
+0.035302 0.120953 0.037832 -0.092915 0.065586 
+-0.048191 -0.092276 -0.077588 -0.043380 0.071115 
+0.011347 -0.004383 0.064201 0.091266 -0.037474 
+0.019023 0.014911 -0.012935 0.038099 0.015753 
+0.005340 -0.046005 0.048595 0.061014 0.075044 
+0.083994 -0.042736 0.000191 -0.120346 0.059455 
+-0.040009 -0.085618 -0.022013 0.016604 -0.021977 
+-0.041351 0.055057 0.041498 -0.057724 -0.004755 
+0.046951 0.098620 0.036630 -0.034510 0.026358 
+0.034831 -0.018107 -0.038210 -0.024564 -0.076584 
+-0.038199 -0.082180 -0.087172 0.100873 -0.013934 
+0.007410 0.052748 -0.012468 -0.086356 -0.004344 
+-0.008693 0.023248 0.088995 0.063277 -0.010981 
+-0.014865 -0.008322 -0.026526 0.001412 -0.009086 
+-0.041663 -0.082625 0.022751 -0.040388 -0.157427 
+0.000052 0.047105 0.090012 0.049647 -0.052600 
+0.043776 0.044112 -0.006996 0.035467 0.033674 
+0.038165 0.009940 -0.005274 -0.025234 0.012284 
+0.059331 0.033687 -0.030071 0.038173 -0.045016 
+0.026068 0.158444 0.048818 -0.057637 0.009770 
+-0.040754 -0.099489 -0.027782 -0.004839 0.170178 
+0.018211 -0.024125 -0.001981 -0.056519 0.022604 
+0.043672 -0.084946 0.014191 0.071154 -0.005074 
+-0.088121 -0.013992 -0.039939 0.008830 -0.019720 
+-0.014986 0.009192 -0.018737 -0.054735 -0.013960 
+-0.001601 0.002582 -0.065304 0.007212 -0.013857 
+-0.007417 -0.077118 -0.033128 0.041117 0.100625 
+0.000688 -0.014708 -0.011064 -0.123109 -0.008590 
+0.038570 -0.013241 0.026994 -0.007213 -0.000633 
+0.001257 -0.072096 0.057499 0.003234 0.041459 
+-0.084929 -0.010858 0.034929 0.018375 -0.101168 
+-0.009436 0.035974 -0.047298 0.107772 -0.014572 
+-0.033241 0.076725 -0.052278 -0.044989 0.064574 
+-0.034320 -0.080934 -0.062584 -0.052365 -0.007583 
+0.043332 -0.039973 0.001890 0.081092 0.032425 
+0.072661 0.019296 -0.009173 -0.013795 -0.048534 
+0.003494 -0.036829 0.029480 0.062652 0.019438 
+0.003633 -0.011968 -0.096593 -0.102286 0.064289 
+-0.051416 -0.052157 -0.106111 0.005858 -0.031779 
+0.001473 0.071136 -0.017587 0.041119 -0.084642 
+-0.019285 0.061407 0.024265 -0.082217 0.101714 
+-0.021349 -0.011424 -0.157899 -0.011584 0.086331 
+-0.079601 0.013742 -0.095978 0.093032 0.011498 
+-0.108846 -0.042340 -0.021774 -0.091363 -0.082840 
+-0.068721 -0.023200 0.069062 0.025331 -0.063542 
+-0.002176 -0.044709 -0.011586 -0.035579 -0.061392 
+0.002329 -0.055782 0.087560 -0.009142 -0.031210 
+0.087176 0.029363 0.048300 0.030101 0.003028 
+-0.006744 0.110741 0.047285 0.042711 0.114962 
+-0.014983 0.067022 -0.034867 0.007693 0.108661 
+0.072716 0.001158 -0.020279 0.097118 -0.049090 
+0.018332 0.073348 0.048479 0.038012 -0.075550 
+0.024128 -0.002290 0.027979 -0.007476 0.128642 
+0.063321 -0.016130 -0.010724 -0.033216 0.012203 
+0.004603 -0.069020 0.019149 0.023442 -0.041990 
+0.001559 -0.054141 -0.017873 0.001051 0.009669 
+0.007371 0.043631 0.032348 -0.066689 -0.007712 
+0.075542 0.039341 -0.074389 0.089409 -0.067587 
+0.013297 -0.123535 -0.034031 0.013429 0.024826 
+0.017265 0.052105 0.067939 -0.101957 -0.053347 
+0.046413 0.004984 0.062332 0.030324 0.060242 
+-0.025911 -0.060816 0.054284 -0.056832 0.016850 
+0.007933 -0.018569 -0.000549 0.026701 -0.090331 
+-0.006708 0.055666 0.016664 0.060888 -0.010839 
+-0.037232 0.056511 -0.020495 -0.017025 0.030780 
+-0.059804 -0.054145 -0.035811 -0.030383 -0.022947 
+-0.038436 -0.017628 -0.001154 0.071736 0.013679 
+0.089806 0.109393 0.002158 0.022933 -0.009429 
+-0.081438 -0.020658 0.036259 0.054585 0.017455 
+0.037820 0.018769 -0.052528 -0.146355 0.121991 
+-0.018012 -0.054744 0.003927 0.003980 -0.068627 
+-0.025582 0.068240 0.012886 -0.118982 -0.025012 
+-0.060768 0.074453 0.039306 0.043620 -0.021238 
+0.008481 -0.086583 -0.067953 0.013657 -0.016164 
+0.052682 0.037754 -0.034526 0.147500 -0.038053 
+-0.000554 0.038997 -0.033353 -0.103730 -0.024374 
+0.063047 0.007908 0.052749 -0.060232 0.105523 
+-0.018157 -0.023187 0.050942 -0.044718 0.023590 
+-0.031973 -0.076362 0.073925 0.002114 -0.024398 
+-0.058682 0.080042 0.018073 0.170306 0.034023 
+0.049977 -0.005101 0.005590 0.044243 0.045804 
+-0.002783 0.065756 -0.036121 -0.026414 -0.032356 
+0.022865 0.009608 0.014138 0.076862 -0.045138 
+0.060759 0.119694 0.029403 -0.106477 -0.030301 
+0.005873 -0.044463 0.032373 0.018732 0.030235 
+0.054996 0.014096 -0.056245 -0.108233 0.076912 
+-0.003553 -0.057174 0.014594 -0.044747 -0.000811 
+-0.070712 0.032588 0.016264 0.000303 0.049043 
+0.009463 0.074638 0.018082 0.009662 0.016092 
+0.002476 0.044398 -0.087719 -0.019282 -0.061589 
+0.060302 -0.067478 -0.040506 0.023576 0.052937 
+-0.072603 -0.012619 0.001381 -0.072008 -0.029615 
+0.037036 -0.024612 0.072062 -0.042065 0.019378 
+-0.040438 -0.119783 -0.006434 -0.060809 0.085511 
+-0.008272 0.020380 0.022744 0.066027 -0.063608 
+0.000489 0.072277 0.001453 0.008278 0.040882 
+0.032724 0.159938 -0.041156 0.022564 0.038648 
+0.014324 -0.095703 -0.056763 -0.088713 0.020001 
+-0.023825 0.027423 -0.018492 0.065606 0.000365 
+0.039845 0.018820 -0.038350 -0.078718 -0.033629 
+-0.001663 0.009565 0.108200 0.058847 0.065809 
+-0.049633 -0.045554 0.020137 -0.086381 0.091892 
+-0.002517 -0.024076 -0.000222 0.049573 -0.129418 
+-0.045283 0.051515 -0.006173 0.029917 -0.010061 
+0.006979 0.078079 0.067161 -0.006824 0.036737 
+0.001946 0.029299 -0.146673 0.005204 -0.049944 
+-0.003573 -0.022387 -0.192735 0.086714 0.000681 
+0.023023 0.025278 0.032334 -0.092047 -0.097106 
+0.009314 -0.026795 0.048717 -0.014619 0.009445 
+-0.034367 0.013246 0.033975 0.027681 -0.048279 
+-0.034841 -0.011498 0.129486 0.012413 -0.099857 
+-0.009759 0.017468 0.030971 0.054610 0.058014 
+-0.053387 0.017293 0.044926 0.081337 0.056077 
+-0.014173 0.033715 -0.080168 -0.039195 0.057433 
+-0.008063 -0.024017 -0.029873 0.059315 -0.016884 
+0.037413 0.102710 0.039066 -0.000322 -0.007096 
+0.001081 0.004899 0.064913 -0.009724 0.052938 
+0.080878 -0.088833 0.017234 -0.064402 0.068572 
+-0.037607 -0.071831 0.000857 0.017839 -0.001686 
+0.014565 0.002904 0.000522 -0.003298 0.002213 
+0.095679 0.012244 0.036755 -0.099818 0.011289 
+-0.028433 0.070577 -0.043776 -0.022561 -0.076359 
+-0.030471 -0.127211 -0.047570 0.077242 -0.002030 
+0.022748 -0.045608 0.087172 -0.006712 -0.112507 
+0.048520 -0.049787 0.033883 0.026952 0.022558 
+0.062996 0.012765 0.026950 -0.066289 -0.068448 
+0.054918 0.003780 0.040104 -0.005777 -0.085504 
+0.064809 0.077196 0.014756 0.043405 0.023787 
+0.031364 0.128719 -0.042317 -0.004864 0.087827 
+-0.029815 -0.093621 -0.008519 -0.023955 0.051611 
+-0.014788 -0.068189 0.037225 0.179376 -0.029766 
+0.060538 0.006306 0.012777 0.019308 0.009494 
+-0.008692 -0.017852 0.038436 0.046522 0.130088 
+-0.012523 -0.023608 0.032478 -0.090472 0.044247 
+-0.044404 -0.030180 -0.040445 0.035083 -0.032830 
+-0.072877 0.049263 0.081485 -0.069301 0.014635 
+-0.057655 0.197364 -0.000351 -0.022115 0.039887 
+0.042215 -0.009109 -0.086347 -0.104682 -0.049640 
+-0.047970 -0.025332 -0.040848 0.083051 -0.021243 
+-0.028802 0.015424 0.001733 -0.128243 -0.060411 
+0.055727 0.057515 0.146167 -0.056022 0.024345 
+0.002416 -0.015298 0.002236 -0.020925 -0.036973 
+-0.029182 -0.058852 0.072372 -0.069443 -0.038400 
+-0.056167 0.006957 0.068247 0.059373 -0.048485 
+0.034235 0.048623 -0.036035 0.085210 0.110573 
+-0.015337 0.046972 -0.043542 0.006351 0.031155 
+0.088626 0.069233 0.008134 0.019241 -0.060153 
+0.041371 0.089979 -0.041853 0.023626 0.016064 
+-0.053828 -0.049329 -0.016176 -0.013092 0.057257 
+0.069686 -0.046114 -0.045261 -0.039290 0.020585 
+0.061314 -0.027727 -0.001927 0.022808 -0.015832 
+-0.075912 -0.014836 0.002965 0.081369 -0.022597 
+0.005534 0.065315 0.044334 -0.043319 -0.041186 
+-0.013693 0.026330 -0.020694 0.032579 -0.067664 
+-0.035584 -0.076274 -0.115553 0.029283 0.115779 
+0.013526 -0.034741 0.010015 -0.130855 -0.047597 
+0.080984 0.031915 0.048376 -0.028547 -0.023234 
+-0.052917 -0.103074 0.071678 -0.043019 -0.020299 
+-0.045608 0.007487 -0.028223 0.036499 -0.089053 
+-0.034453 0.074651 -0.025209 0.077487 -0.013263 
+0.004921 0.072189 -0.050852 0.059399 0.035439 
+0.002935 -0.054894 -0.031357 -0.070326 -0.036947 
+-0.026730 0.036590 -0.025250 0.113258 0.121094 
+0.080910 0.042350 -0.092512 -0.043499 -0.025455 
+0.034745 -0.070282 0.032647 0.111722 -0.019157 
+0.020761 0.013997 -0.061982 -0.060954 0.055112 
+0.036288 -0.080176 -0.027267 0.012212 -0.093795 
+-0.041882 0.097155 0.087384 -0.031435 -0.082801 
+0.009464 0.032459 0.077828 -0.112376 0.108840 
+0.019555 0.014775 -0.073011 -0.043973 0.011444 
+-0.048044 0.056260 -0.038387 0.043656 0.008263 
+-0.014005 -0.016142 -0.038569 -0.064552 -0.057510 
+-0.078202 -0.059032 0.084016 -0.010298 0.012574 
+-0.020059 -0.064059 -0.059392 -0.046799 -0.054238 
+0.022026 -0.006059 0.084724 0.041685 -0.029012 
+0.026514 0.032033 0.022922 0.031857 0.030105 
+-0.035650 0.031377 -0.030435 0.061662 0.079732 
+-0.025495 0.041751 -0.112711 -0.015737 0.015504 
+0.121804 -0.030913 -0.016931 0.056284 -0.031211 
+-0.038259 -0.005525 0.074063 -0.019980 -0.074225 
+-0.043126 -0.008346 0.052048 -0.010386 0.102477 
+0.020457 -0.053151 0.037134 -0.048166 0.025535 
+-0.004324 -0.102005 0.042549 0.062684 -0.011027 
+-0.041502 -0.022180 -0.001040 0.012690 0.058495 
+0.039481 0.061425 0.036436 -0.094401 0.024691 
+-0.002509 -0.024231 -0.105831 0.050352 -0.105564 
+0.036061 -0.093016 -0.042697 0.049621 -0.014022 
+0.037095 0.014433 0.054764 -0.096569 -0.011104 
+0.004844 0.011453 0.022667 -0.022798 0.002655 
+0.021742 -0.079613 0.045351 -0.079863 0.014770 
+0.050245 -0.026754 -0.023870 0.015727 -0.098730 
+0.042398 0.154448 -0.009362 0.081429 -0.020656 
+-0.072560 0.133852 0.025744 -0.109001 0.075747 
+-0.059454 -0.002469 -0.103847 -0.008798 0.031741 
+-0.020032 -0.011426 -0.002985 0.061967 -0.058554 
+0.096033 0.053995 -0.071745 0.012181 0.016611 
+-0.051161 -0.042525 0.015651 0.078963 0.054139 
+-0.007119 0.014112 0.000797 -0.147306 0.012158 
+-0.048199 -0.042152 -0.060602 0.035608 -0.095526 
+-0.044437 0.079277 -0.036361 -0.085666 0.005652 
+-0.035263 0.081781 0.098388 -0.015160 0.032423 
+0.048597 -0.010937 -0.045141 -0.016016 -0.045851 
+0.017285 0.029554 -0.068669 0.090490 -0.069378 
+-0.015215 0.065693 -0.080376 -0.098850 -0.001785 
+-0.000808 0.001812 0.047789 -0.059522 0.029808 
+-0.040358 -0.013967 -0.035444 -0.057752 0.011251 
+0.027783 -0.009928 0.081566 -0.060520 -0.032563 
+-0.018103 0.008202 0.020263 0.036779 0.028019 
+0.034566 0.020755 0.010139 0.022813 0.071878 
+-0.033001 0.012734 -0.101437 -0.069713 0.016386 
+0.040255 0.034849 0.017738 0.082952 0.030522 
+0.011027 0.101822 0.000381 -0.044621 -0.048575 
+-0.018043 -0.104642 0.042318 0.024433 0.071077 
+0.028556 0.050381 -0.035783 -0.004765 0.019134 
+0.004109 -0.114088 -0.030007 -0.003475 -0.033302 
+-0.132027 -0.012463 -0.036186 0.000562 -0.054043 
+-0.003544 0.052264 0.043304 0.012117 0.016872 
+-0.034524 0.066372 -0.065579 -0.033370 0.014889 
+0.004579 -0.049747 -0.050504 0.049331 0.040066 
+-0.125392 -0.097291 0.050421 -0.071309 -0.051625 
+0.065285 0.022484 0.062435 0.017569 -0.040502 
+-0.004470 -0.054208 0.010625 -0.094016 0.022508 
+0.033725 0.032426 -0.015455 0.036159 -0.115369 
+-0.103817 0.142767 -0.000238 -0.019162 0.008959 
+0.030765 0.075502 -0.088049 0.017398 0.024749 
+-0.021910 -0.075993 -0.149318 -0.174722 0.102620 
+0.008195 -0.009007 0.007189 0.076657 0.014460 
+0.034428 0.027255 -0.013869 -0.050491 -0.048691 
+0.037759 -0.098562 0.085631 0.021691 -0.000794 
+-0.029941 0.026585 -0.033603 -0.014074 0.066789 
+0.005141 -0.012246 -0.067551 0.100708 -0.040232 
+-0.002751 0.049901 0.016959 0.021812 -0.059523 
+-0.022331 0.030079 0.058567 -0.029002 0.104237 
+-0.013602 -0.035019 -0.155316 0.016558 -0.013881 
+0.004136 -0.001657 -0.097220 0.019060 0.052990 
+0.004200 0.054365 -0.016768 -0.045191 -0.105984 
+-0.052803 -0.016935 0.092437 -0.013893 -0.033606 
+-0.023246 -0.039305 0.036068 -0.020164 -0.060244 
+0.045916 -0.014132 0.044463 0.046890 -0.118975 
+0.074037 0.010976 0.090692 0.090068 0.023711 
+-0.044310 0.007556 -0.037900 0.026798 0.084256 
+0.002559 0.013715 0.004015 0.008334 0.101711 
+0.022258 0.030790 -0.065656 0.019198 -0.035505 
+0.026328 0.028683 0.115303 -0.028803 -0.086521 
+-0.004355 -0.046031 0.011248 -0.040795 0.121216 
+0.000425 -0.056590 0.011373 -0.070856 0.064965 
+-0.043302 -0.095015 0.013747 0.048043 0.047157 
+-0.046839 -0.005878 -0.013815 0.028948 -0.001373 
+0.115513 0.049750 0.038856 0.002747 0.068706 
+-0.059471 0.083940 -0.035785 0.026815 -0.027017 
+0.004618 -0.093707 -0.031970 0.104710 -0.008533 
+-0.008056 -0.017611 0.038062 -0.073507 -0.036477 
+0.022407 -0.059049 0.022840 0.012451 -0.010174 
+0.057217 -0.050858 -0.053612 -0.064090 -0.097360 
+0.041668 -0.011445 -0.075167 0.006584 -0.122856 
+-0.011272 0.137465 -0.067901 0.011357 -0.050853 
+0.020753 0.070596 0.004302 -0.066991 0.055696 
+-0.043828 -0.042721 -0.096928 -0.047589 0.046254 
+-0.027538 -0.005234 0.030541 0.077571 -0.039512 
+0.032372 -0.022397 0.002903 0.014010 0.028365 
+0.007460 0.011506 0.019889 0.062747 0.095319 
+0.052300 0.007374 0.036028 -0.116833 0.049517 
+0.004313 -0.039924 -0.005692 0.035446 -0.006279 
+-0.092093 0.025645 0.053023 -0.015761 -0.045887 
+-0.018082 0.081602 0.046870 0.015485 0.067284 
+0.055890 0.008159 -0.036149 -0.067704 -0.096800 
+0.015948 -0.036949 -0.083131 0.080618 0.031677 
+0.025776 0.047673 -0.012634 -0.098220 0.039341 
+0.018630 0.024685 0.068760 -0.009148 -0.006932 
+0.000131 -0.009954 -0.075954 -0.020703 0.000996 
+-0.040731 -0.082876 0.075619 0.017000 -0.130026 
+0.003839 0.083757 0.085935 0.058477 -0.018794 
+0.019268 0.053820 -0.025907 -0.016484 0.048963 
+0.017315 0.011801 -0.016617 -0.016373 0.052079 
+0.016567 0.064592 -0.011714 0.047244 -0.029583 
+-0.010269 0.112646 -0.025079 -0.018015 -0.021550 
+-0.019521 -0.111462 -0.047937 -0.002779 0.083724 
+0.004416 0.004607 -0.006974 -0.101561 0.027376 
+0.083440 -0.109869 -0.002361 -0.011364 -0.079707 
+-0.138325 -0.095825 0.034339 0.024551 -0.012431 
+-0.000401 0.007608 0.013950 -0.060441 0.010061 
+0.012546 -0.000065 -0.023529 0.015494 -0.012896 
+-0.014981 -0.019040 -0.043634 0.076437 0.059672 
+0.014985 -0.037394 0.020033 -0.082023 -0.016717 
+0.029711 -0.006237 0.055347 0.024365 0.002094 
+0.019464 -0.038260 0.127306 -0.051862 0.049168 
+-0.074259 -0.022269 0.023182 0.071183 -0.065354 
+-0.055933 0.064170 -0.055712 0.107983 0.054978 
+0.015294 0.093224 -0.052328 0.000761 -0.020823 
+0.023903 -0.063241 -0.093322 -0.054658 -0.006845 
+0.048141 -0.023201 -0.047564 0.106605 0.000059 
+0.146340 0.030121 -0.040556 -0.020381 -0.050294 
+0.016659 -0.021563 0.027855 0.069633 -0.009148 
+0.027112 0.056646 -0.023372 -0.211107 0.014012 
+-0.019924 -0.122201 -0.040118 0.003571 -0.146470 
+0.017162 0.075261 0.002383 -0.006374 -0.081174 
+0.043906 -0.005278 -0.027448 -0.046459 0.140484 
+0.008671 0.019853 -0.128017 -0.022950 0.048609 
+-0.019167 -0.010958 -0.061823 0.072910 0.001440 
+-0.023976 -0.030275 0.027463 -0.138470 -0.139145 
+-0.028088 -0.013451 0.113264 0.081011 -0.012685 
+0.006025 -0.055737 0.022779 -0.019951 -0.046793 
+-0.015091 -0.017958 0.063092 0.032101 -0.004007 
+0.052309 0.070815 0.012148 0.095984 0.074330 
+0.006032 0.083156 -0.045278 0.013825 0.066658 
+-0.000966 0.053253 -0.095660 -0.022943 0.108130 
+0.092983 -0.012055 0.008111 0.064988 0.010427 
+0.042345 0.042586 0.077502 0.053009 -0.031546 
+-0.004484 -0.019859 0.027061 0.016614 0.085821 
+0.089250 0.014975 -0.022722 -0.045228 0.047095 
+-0.028190 -0.124509 -0.029014 0.024231 -0.016564 
+-0.025209 -0.031288 -0.023742 0.040341 0.030385 
+-0.022564 0.023760 0.018611 -0.077310 0.051696 
+0.028200 0.005454 -0.045487 0.027221 -0.074627 
+-0.040934 -0.110565 -0.103536 0.033125 0.041451 
+-0.017540 0.013737 0.131164 -0.103202 -0.000294 
+0.030605 -0.030002 0.058861 0.024425 0.055122 
+0.021447 -0.043394 0.039465 -0.020523 -0.012530 
+-0.003317 -0.002650 -0.020200 -0.002414 -0.060515 
+0.003135 0.115504 0.005075 0.072669 0.057819 
+-0.075310 0.064527 0.025999 -0.067556 0.046351 
+-0.124098 -0.049305 -0.009230 -0.084801 0.068375 
+-0.026781 -0.066657 0.010588 0.093986 0.017406 
+0.047141 0.053480 -0.019255 0.069267 0.010659 
+-0.068511 0.015815 -0.011687 0.047685 0.033658 
+0.064260 0.062994 0.018822 -0.143452 0.092703 
+-0.029884 -0.006035 -0.016152 -0.021618 -0.045339 
+-0.049252 0.041988 -0.021510 -0.039175 -0.031350 
+-0.101541 0.005832 0.055761 0.009961 0.086386 
+0.007597 -0.052775 -0.079976 0.023111 0.004302 
+-0.020123 0.039264 -0.062497 0.078009 0.004409 
+-0.063787 0.038329 -0.055050 -0.086972 -0.084417 
+0.025733 -0.011156 0.104895 0.026765 0.037827 
+-0.013149 0.009709 0.004095 -0.039085 0.041414 
+-0.018153 -0.088525 0.078011 -0.022509 -0.080366 
+-0.047630 0.036346 0.013702 0.071239 0.024081 
+0.114305 -0.072565 0.004642 0.035947 0.040623 
+-0.017954 0.045965 -0.007375 -0.030016 -0.004483 
+0.040170 0.083716 0.012267 0.096863 -0.028263 
+0.000694 0.069353 0.024960 -0.069792 -0.070096 
+-0.028321 -0.072324 0.018256 0.000091 0.049255 
+0.038695 0.041521 -0.035000 -0.034223 0.090426 
+-0.004319 -0.060041 0.030034 -0.014687 0.016165 
+-0.139996 0.013811 0.037782 -0.083214 0.054142 
+0.024863 0.017964 0.045207 0.006294 0.058657 
+-0.071515 0.093447 -0.050680 -0.014853 -0.071657 
+0.007823 -0.010828 -0.096918 0.050508 0.136819 
+-0.042282 -0.060920 -0.006691 -0.054808 -0.055435 
+0.076309 -0.048186 0.105925 -0.031527 -0.030737 
+-0.043870 -0.102846 0.054550 -0.095983 0.065369 
+-0.027944 0.014204 0.008256 0.035180 -0.105002 
+-0.011778 0.036941 -0.007284 0.034566 0.002672 
+-0.011867 0.094032 -0.081505 -0.042171 -0.012357 
+0.025234 -0.142099 -0.011399 -0.092199 0.016061 
+-0.007420 0.024527 0.010787 0.089568 0.009287 
+0.040383 0.043550 0.036649 -0.055816 -0.039815 
+0.029883 -0.031089 0.087022 0.064863 0.035410 
+-0.010187 0.023054 -0.018519 -0.057105 0.026218 
+-0.007645 -0.026641 -0.033134 0.044367 -0.059939 
+-0.047569 0.091489 0.022502 0.013205 -0.056318 
+0.041414 0.022193 0.081274 -0.006608 0.035220 
+-0.012493 0.024440 -0.105974 -0.058317 -0.038994 
+0.042143 0.057826 -0.117349 0.047843 0.089338 
+0.065029 0.029927 -0.014494 -0.010548 -0.129518 
+-0.033996 -0.030825 0.032254 -0.021848 -0.021345 
+-0.065200 0.012770 0.020636 -0.034493 -0.080268 
+-0.015033 -0.018599 0.076611 0.034283 -0.084435 
+0.051904 0.063942 0.046362 0.039561 0.096234 
+-0.030658 0.054240 0.027612 0.022042 0.112035 
+-0.045512 -0.048431 -0.084263 -0.015994 0.103483 
+0.045903 -0.004115 -0.021572 0.057589 0.016494 
+0.013949 0.101635 0.127534 0.014985 -0.006815 
+-0.053449 -0.000707 0.052773 -0.047290 0.071075 
+0.041771 -0.079418 -0.026505 -0.082019 0.091756 
+-0.088458 -0.055800 0.015266 0.048373 -0.028842 
+0.004456 0.001112 0.005363 0.012172 -0.036807 
+0.063688 0.114491 -0.034186 -0.082173 0.044547 
+0.010385 0.061010 -0.075589 0.038888 -0.057732 
+-0.068354 -0.091781 -0.001533 0.042343 0.007713 
+-0.003066 -0.016490 0.097581 -0.008705 -0.169889 
+0.041901 -0.029045 0.088606 0.028236 -0.005092 
+0.087986 -0.005514 -0.001520 -0.067407 -0.036923 
+0.018378 -0.001874 0.029761 -0.028224 -0.114769 
+0.024657 0.082316 0.020235 0.034884 -0.039374 
+0.106617 0.085265 -0.014306 -0.039880 0.059967 
+-0.020866 -0.045287 -0.013407 -0.029010 0.025480 
+0.020099 -0.053760 0.035241 0.067883 -0.069313 
+0.022318 0.001659 -0.045385 -0.001930 0.007348 
+0.027072 -0.051692 0.069337 0.012098 0.107819 
+-0.026942 -0.039741 0.043295 -0.135918 0.031043 
+-0.040145 -0.021705 -0.052514 0.001132 -0.030098 
+-0.040748 0.046793 0.149894 -0.021036 -0.023530 
+-0.040778 0.085491 0.068161 0.033268 0.032992 
+-0.008355 0.008600 -0.125074 -0.034204 -0.082832 
+0.030318 0.000442 -0.007943 0.113836 -0.044022 
+0.015079 0.065357 -0.018956 -0.092656 -0.056274 
+-0.017481 -0.004857 0.117201 -0.005233 0.069151 
+0.011030 -0.024316 -0.015695 -0.011308 -0.005062 
+-0.010876 -0.038919 0.032578 -0.054136 -0.121302 
+-0.046807 0.041175 0.059588 0.031040 -0.027127 
+0.021551 0.000830 -0.013766 0.046306 0.081467 
+0.014301 -0.010731 -0.051227 -0.018797 0.043587 
+0.050317 0.086115 -0.027629 0.046202 -0.084445 
+0.021044 0.041527 0.005458 0.006677 0.002404 
+-0.037453 -0.035957 -0.039078 -0.063247 0.088516 
+0.079477 0.004030 -0.063421 -0.074051 -0.039753 
+0.062917 -0.119760 -0.002471 0.000423 0.007336 
+-0.124273 0.001094 -0.026391 0.070714 -0.035166 
+0.037072 0.018118 0.017500 -0.050692 -0.015928 
+-0.003390 -0.002367 -0.040046 0.013349 -0.041478 
+-0.034407 -0.009890 -0.095593 0.109253 0.041509 
+-0.062990 -0.041682 0.001528 -0.124601 -0.030128 
+0.086076 0.003516 0.073015 0.024339 -0.069858 
+-0.022435 -0.042554 0.107497 -0.132302 0.035124 
+-0.105430 0.042327 -0.064964 0.057304 -0.092634 
+-0.058398 0.052083 0.018947 0.087990 -0.026444 
+0.023373 0.037085 -0.083589 0.015247 0.016566 
+-0.026782 -0.070361 -0.019757 -0.109826 -0.040199 
+-0.009688 -0.005408 -0.003769 0.111444 0.029897 
+0.070686 0.021466 -0.052076 0.015609 -0.023854 
+0.008088 -0.022084 0.052542 0.122824 -0.018174 
+-0.009808 0.107602 -0.059166 -0.100824 0.082456 
+-0.004737 -0.023536 -0.095212 -0.007114 -0.098814 
+-0.061778 0.049247 0.025130 0.010909 -0.091691 
+0.034764 -0.014047 0.002819 -0.050330 0.085399 
+0.057257 -0.052435 -0.067151 -0.012311 0.040602 
+-0.118166 0.053141 -0.119211 0.024274 0.027075 
+-0.022345 -0.060443 -0.046916 -0.099227 -0.115958 
+-0.071020 0.015499 0.055810 -0.012697 0.010803 
+-0.051685 -0.097540 0.013970 -0.096689 -0.060525 
+0.010422 0.018434 0.151855 0.015230 -0.080804 
+0.040130 0.043946 0.022887 0.043819 -0.027371 
+0.037213 0.059423 -0.040656 0.141843 0.065180 
+-0.083238 0.057208 -0.113200 -0.056009 0.030056 
+0.060522 -0.054570 0.006137 0.062833 -0.081547 
+0.002753 0.037357 0.055441 0.049180 -0.017699 
+-0.006225 0.029216 0.040657 0.016328 0.041969 
+0.058998 -0.067000 0.002571 -0.008178 0.027776 
+-0.026103 -0.049399 0.093279 0.052313 -0.029958 
+-0.070689 -0.054589 0.027325 -0.010464 -0.000604 
+0.009479 0.125126 0.086072 -0.052874 0.065774 
+0.003009 0.013855 -0.088166 0.018907 -0.064212 
+0.023827 -0.024022 -0.121652 0.032035 0.015278 
+0.023427 -0.027194 0.066092 -0.100117 -0.048548 
+0.013755 0.005344 0.038451 -0.000513 0.018468 
+0.065931 -0.062001 0.035615 -0.067561 -0.013315 
+0.045441 -0.016064 0.010535 0.035953 -0.068093 
+0.035872 0.097935 -0.025516 0.061435 0.028137 
+-0.042656 0.110708 -0.022981 -0.052860 -0.009583 
+-0.084678 -0.040172 -0.092364 0.061778 0.003794 
+-0.002964 -0.047375 -0.029968 0.090529 -0.045382 
+0.103144 0.034998 -0.012760 0.013885 0.048887 
+-0.049886 -0.034647 0.061193 0.058574 0.084107 
+-0.022304 -0.008817 0.036857 -0.119972 0.000619 
+-0.079467 -0.031710 -0.108927 -0.033843 -0.034845 
+-0.125290 0.079806 -0.011673 -0.070719 -0.063897 
+-0.051524 0.042071 0.082303 -0.016684 0.053366 
+0.024657 -0.062913 -0.040533 -0.032117 -0.013188 
+0.036519 0.055734 -0.134481 0.055949 -0.050480 
+0.002035 0.010998 -0.064264 -0.078569 -0.026404 
+-0.017580 0.005453 0.068795 -0.031274 0.024178 
+-0.038245 -0.037973 -0.013256 -0.072256 0.057358 
+-0.004941 -0.047850 0.119977 -0.015040 -0.079231 
+-0.013449 -0.005542 0.028890 0.032536 -0.020619 
+0.083769 -0.028624 0.049040 0.021538 0.104107 
+-0.072475 0.019284 -0.044425 -0.058775 0.061172 
+0.025682 0.004208 0.041846 0.095369 0.007892 
+0.030701 0.062103 -0.086288 -0.068866 -0.110743 
+0.052685 -0.069032 0.010339 0.044804 0.106157 
+0.105575 0.017263 -0.110890 -0.040735 0.061412 
+0.021037 -0.102095 0.039008 0.010335 0.005686 
+-0.108307 0.057569 -0.004539 -0.019864 0.033710 
+-0.031254 0.013482 0.035051 0.014893 -0.001676 
+-0.053780 0.014329 -0.037130 0.010087 -0.043959 
+0.031302 -0.006715 -0.065618 0.066261 0.071102 
+-0.085133 -0.020753 0.050721 -0.042021 0.006613 
+0.038123 0.041345 0.095993 -0.028353 -0.008509 
+-0.039544 -0.069281 0.047585 -0.020085 0.000819 
+0.000478 0.017818 0.008015 0.068812 -0.184380 
+-0.073606 0.120550 -0.032173 0.058092 0.024132 
+-0.016705 0.130871 -0.094852 0.044256 0.003919 
+-0.002119 -0.026963 -0.003553 -0.110166 0.083113 
+-0.008545 -0.026785 0.025936 0.069075 0.054271 
+0.029418 0.039817 0.040088 -0.036680 -0.073300 
+-0.003368 -0.074471 0.111772 0.030913 -0.018960 
+-0.040689 0.058799 -0.017810 -0.064269 0.071408 
+-0.022927 -0.077256 -0.075665 0.100717 -0.099471 
+0.004792 0.063353 -0.017202 -0.012465 -0.052031 
+0.015659 0.049801 0.020300 0.001231 0.061694 
+-0.002196 -0.039936 -0.095913 -0.006760 -0.036261 
+-0.004827 -0.023039 -0.062452 0.023724 0.043337 
+0.002849 -0.004311 -0.067199 -0.039365 -0.082845 
+-0.036454 -0.014788 0.059651 -0.039192 -0.021445 
+-0.003667 -0.011645 0.021036 -0.006220 -0.025338 
+0.010705 -0.002077 0.043196 0.035112 -0.036895 
+0.017671 0.003759 0.106991 0.040822 0.011089 
+-0.048837 0.025240 -0.002343 0.015983 0.080230 
+-0.005045 -0.000454 -0.055852 -0.004494 0.084580 
+0.044207 -0.018164 -0.035672 0.024802 -0.028216 
+0.026617 0.021648 0.082157 0.012675 -0.049856 
+0.001020 -0.118363 0.069854 -0.038161 0.096174 
+0.032049 -0.035139 -0.015943 -0.028306 0.055425 
+-0.092742 -0.074326 0.010130 -0.020646 0.043131 
+-0.014246 -0.037891 0.006922 0.059464 -0.023168 
+0.059938 0.021652 -0.004602 -0.005103 0.062343 
+0.000410 0.032704 -0.087978 0.042098 -0.008283 
+0.000714 -0.078595 0.004443 0.036763 0.004995 
+-0.050964 0.045909 0.038942 -0.052841 -0.054318 
+0.033939 -0.020268 0.019574 0.029805 -0.002001 
+0.068470 -0.056316 0.007236 -0.031313 -0.066063 
+-0.003425 0.022247 -0.018479 -0.008040 -0.105011 
+-0.109717 0.132884 0.056892 0.052155 -0.073444 
+0.051067 0.107179 0.014594 -0.036657 0.110846 
+-0.009896 -0.042527 -0.082220 -0.007607 0.057007 
+-0.034754 0.003213 0.041643 0.142016 -0.007658 
+0.012781 0.014366 -0.021935 0.010511 0.028021 
+0.002082 -0.027023 0.055247 0.097082 0.111840 
+0.040151 -0.019830 -0.007033 -0.097207 0.026595 
+-0.069875 -0.070451 -0.049743 0.053253 -0.019762 
+-0.078475 0.043019 0.022103 -0.033625 -0.008627 
+0.058858 0.080427 0.060029 0.002771 0.041250 
+0.030257 -0.044059 -0.001226 -0.060544 -0.126844 
+-0.029407 -0.021079 -0.108126 0.070012 -0.006653 
+0.013084 0.090992 -0.002726 -0.070041 -0.006757 
+-0.017571 0.027459 0.103937 0.003012 0.038213 
+-0.007808 -0.011937 -0.015457 -0.033181 0.012816 
+0.010199 -0.056227 0.006057 -0.017569 -0.098687 
+0.006000 0.076819 0.022272 0.082508 -0.058508 
+0.031808 0.054009 0.007871 0.055301 0.070296 
+0.023941 0.025656 -0.005875 -0.068203 0.027482 
+0.036615 0.026218 -0.011406 0.026235 -0.022002 
+-0.011161 0.120568 0.023165 -0.010473 0.002080 
+-0.033028 -0.043255 -0.030454 0.009261 0.113350 
+0.023271 -0.015934 -0.037492 -0.032890 0.016928 
+0.020967 -0.090717 -0.016510 0.070725 -0.063975 
+-0.097203 0.017597 0.016946 0.027298 -0.016049 
+-0.019287 -0.005319 0.019000 -0.037327 -0.040993 
+-0.003975 0.027897 -0.095076 -0.010053 -0.014610 
+0.005584 -0.024009 0.000599 0.082121 0.098790 
+0.005987 -0.036027 -0.067221 -0.128015 -0.052111 
+0.056606 -0.020029 0.012172 -0.018025 -0.028588 
+-0.015169 -0.087101 0.044526 -0.022464 0.054835 
+-0.084369 -0.058286 -0.039363 -0.003339 -0.116729 
+-0.051506 0.079944 -0.023815 0.113004 -0.052120 
+-0.012383 0.075636 -0.024387 -0.039200 0.032050 
+-0.031568 -0.140199 -0.082589 -0.060485 -0.013115 
+0.092001 -0.002684 -0.027087 0.111635 0.050016 
+0.077055 -0.010441 -0.006942 -0.026898 -0.083879 
+-0.008401 -0.026725 0.049993 0.043707 0.027966 
+-0.019866 -0.057701 -0.086619 -0.114361 -0.008921 
+-0.039708 -0.122519 -0.074209 0.014381 -0.065102 
+-0.023419 0.118673 -0.000005 0.071661 -0.127659 
+-0.009184 0.020308 0.019151 -0.054484 0.096378 
+0.016102 -0.060605 -0.128655 -0.004225 0.079251 
+-0.021895 0.024065 -0.097479 0.045279 -0.036151 
+-0.045806 0.005106 0.000093 -0.074415 -0.071654 
+-0.067599 -0.017537 0.050178 0.015860 -0.018919 
+-0.015382 -0.057989 0.032437 -0.039627 -0.030285 
+0.015438 -0.005533 0.110416 -0.004137 -0.030336 
+0.085365 0.089779 0.061676 0.017178 -0.016279 
+0.028526 0.055656 0.008566 0.000706 0.124966 
+-0.018124 0.040023 -0.067773 0.028532 0.098381 
+0.062832 -0.038523 0.003865 0.065698 -0.026661 
+0.076081 0.062167 0.112325 0.052139 -0.040826 
+0.003747 -0.052113 0.013442 0.002756 0.102858 
+0.040603 -0.012693 0.031245 -0.046645 -0.003625 
+-0.024647 -0.062463 0.000476 0.024807 -0.036286 
+-0.003083 -0.015952 -0.016156 0.002976 0.016598 
+-0.015092 0.058522 0.011542 -0.046504 0.009174 
+0.097896 0.056220 -0.055387 0.022356 -0.126788 
+0.024795 -0.092333 -0.084406 -0.010051 0.060835 
+0.013338 -0.010735 0.052739 -0.119952 -0.093185 
+0.010522 -0.001505 0.056134 0.038675 0.016542 
+0.005217 -0.061424 0.071990 -0.028908 0.011826 
+-0.009221 -0.010760 0.023849 0.034664 -0.066108 
+0.018587 0.070818 0.013554 0.106469 0.035530 
+-0.060716 0.072344 0.010625 -0.017888 0.006548 
+-0.122347 -0.080419 -0.039979 -0.045658 -0.046576 
+-0.040526 -0.039641 -0.048709 0.067016 0.023042 
+0.064800 0.099396 -0.064314 0.005665 -0.025960 
+-0.094387 -0.056820 0.015466 0.086382 0.024902 
+-0.019486 0.021888 0.000550 -0.168957 0.071388 
+-0.019935 -0.042118 -0.040820 -0.012013 -0.072063 
+-0.004249 0.039160 0.010084 -0.080610 -0.043915 
+-0.101425 0.074442 0.035350 0.051348 0.051160 
+-0.031631 -0.053381 -0.062261 -0.020441 -0.031251 
+0.050923 0.000358 -0.074646 0.076663 -0.042498 
+-0.033718 0.037025 -0.017087 -0.091951 0.017983 
+0.015622 0.007807 0.087203 -0.061047 0.077306 
+-0.049822 0.015499 0.035918 -0.044388 0.034786 
+-0.003435 -0.072680 0.042506 -0.004200 -0.024834 
+-0.034415 0.065814 0.079911 0.117115 0.013096 
+0.065811 0.001560 0.054427 0.085716 0.083343 
+-0.034994 0.035815 -0.034661 -0.032421 0.000133 
+0.021908 0.041958 -0.008418 0.091804 -0.023169 
+0.019306 0.087287 0.064984 -0.052908 -0.010301 
+-0.022717 -0.062698 0.029605 0.020970 0.011270 
+0.049229 -0.033794 -0.040198 -0.068419 0.063147 
+-0.023097 -0.079045 -0.010748 -0.064320 -0.011785 
+-0.108984 0.015970 -0.038308 0.017991 0.062400 
+-0.000719 0.044392 0.034008 -0.020969 0.006446 
+-0.044457 0.044495 -0.084323 -0.014046 -0.057116 
+0.037862 -0.024751 -0.045926 0.007665 0.082611 
+-0.081497 -0.013395 -0.026864 -0.040485 -0.031100 
+0.095144 0.005947 0.063254 0.009423 0.031198 
+0.008443 -0.078212 -0.002275 -0.025354 0.048808 
+0.003982 0.011608 -0.005923 0.061556 -0.091653 
+-0.028425 0.056332 0.005018 0.007136 0.010607 
+0.039647 0.145962 0.007951 -0.017526 -0.039745 
+0.023022 -0.066844 -0.047384 -0.044307 0.041848 
+-0.056589 0.034263 -0.033277 0.073824 -0.030747 
+0.009451 0.005157 -0.048186 -0.045749 -0.054258 
+-0.003301 0.004995 0.071505 0.029585 0.050033 
+-0.064837 0.012928 0.002785 -0.117405 0.045317 
+-0.026899 -0.051475 -0.054625 0.064955 -0.136139 
+-0.083576 0.066985 0.000964 0.024630 -0.036989 
+0.049229 0.047537 0.090953 0.036197 0.054765 
+0.062892 0.045061 -0.097460 0.009938 -0.027736 
+-0.008479 0.053538 -0.125219 0.036747 0.027556 
+-0.017214 0.036754 0.009736 -0.087187 -0.089725 
+-0.002417 -0.039070 0.076625 0.018126 0.032402 
+-0.035537 -0.003939 -0.001806 0.018436 -0.060172 
+-0.024517 0.048085 0.052646 0.044561 -0.126681 
+-0.005381 0.059991 0.064924 0.047878 0.043526 
+-0.079817 0.034296 -0.009242 0.037169 0.115281 
+-0.015147 -0.019430 -0.077776 -0.033431 0.076276 
+0.023914 0.014924 -0.049231 0.048491 -0.012740 
+0.023873 0.121027 0.067832 -0.009223 -0.039188 
+-0.018355 -0.042663 0.070587 -0.003855 0.077791 
+0.036307 -0.069362 -0.035976 -0.011638 0.103907 
+-0.055984 -0.110967 -0.002537 -0.016356 -0.022701 
+-0.018211 0.017831 -0.009534 0.011128 -0.026445 
+0.071893 0.028948 0.017993 -0.055001 0.032913 
+0.013143 0.141940 -0.030668 -0.010630 -0.075402 
+-0.008241 -0.097950 -0.070541 0.086461 0.063873 
+0.010107 -0.006389 0.086778 -0.017779 -0.056644 
+0.040699 -0.054122 0.073702 -0.008815 0.011806 
+0.020978 -0.004901 0.046808 -0.038708 -0.048713 
+0.065026 -0.042069 0.030306 -0.003984 -0.125105 
+0.020044 0.154911 0.060110 0.041504 0.013796 
+0.003360 0.144327 -0.056583 -0.031643 0.021938 
+-0.082644 -0.117123 -0.032869 -0.004149 0.019806 
+0.007405 -0.051019 -0.020896 0.133232 -0.028058 
+0.050897 0.015399 -0.022377 0.012018 0.002474 
+-0.031801 -0.041942 0.020380 0.018326 0.106183 
+0.038954 -0.045696 0.017961 -0.080241 0.038198 
+-0.031449 -0.026191 -0.079952 0.035385 -0.053671 
+-0.055347 0.103293 0.049459 -0.008219 0.010257 
+-0.061794 0.124358 0.049411 0.069306 0.034282 
+-0.013114 -0.040074 -0.071968 -0.195520 -0.088871 
+-0.030547 -0.024227 -0.047665 0.132613 0.012253 
+0.036726 0.018979 -0.021295 -0.120084 -0.050532 
+-0.020265 0.013963 0.136035 -0.067105 0.051832 
+0.013865 -0.036402 0.005526 -0.042230 -0.022246 
+-0.030844 -0.014871 0.097708 -0.055950 -0.060091 
+-0.107193 -0.000749 0.094279 0.066459 0.015231 
+0.068358 0.042724 -0.020943 0.012438 0.110596 
+-0.022189 0.026125 -0.011649 0.004604 0.037204 
+0.039096 0.065797 0.045162 -0.003834 -0.056679 
+0.017104 0.070007 -0.005419 -0.016435 -0.000214 
+-0.097253 -0.033412 -0.004272 0.021730 0.092887 
+0.039513 -0.027819 -0.045420 -0.062670 -0.013033 
+0.033957 -0.040429 -0.018152 0.020048 0.015966 
+-0.083740 0.050010 0.032999 0.053057 -0.072973 
+0.000797 0.028222 0.063769 -0.045254 -0.001401 
+-0.008530 0.000350 -0.050423 0.016321 -0.077400 
+-0.017818 -0.062015 -0.039769 0.103694 0.123584 
+0.004844 -0.068111 -0.008528 -0.128884 -0.003312 
+0.098749 0.025292 0.013547 0.007157 -0.032589 
+-0.024049 -0.074941 0.062923 -0.112079 -0.008534 
+-0.046211 0.028223 -0.041903 -0.001378 -0.077507 
+-0.015178 0.093495 -0.033668 0.043904 -0.026096 
+0.008741 0.024695 -0.042365 0.063246 0.013544 
+-0.021438 -0.018498 -0.060824 -0.093599 -0.003304 
+0.013206 0.019776 0.011491 0.115257 0.066627 
+0.042660 0.045968 -0.044189 -0.056683 0.002399 
+0.025400 -0.031109 0.037612 0.112170 0.041814 
+0.005019 -0.013887 -0.051704 -0.065646 0.030095 
+-0.006617 -0.067206 -0.053773 0.020368 -0.060694 
+-0.042554 0.031959 0.034480 -0.016413 -0.056939 
+0.026266 0.003617 0.032682 -0.066017 0.064464 
+0.025224 -0.014523 -0.107735 -0.028243 0.015327 
+-0.027555 0.013037 -0.049117 0.015929 -0.001301 
+-0.010874 -0.018588 -0.021124 -0.055630 -0.102228 
+-0.048525 -0.057257 0.083344 0.005472 0.060981 
+-0.022083 -0.107351 -0.002309 -0.015487 -0.065168 
+0.011812 -0.029764 0.117191 0.062742 -0.062476 
+0.020253 0.014273 0.020564 0.047570 -0.021837 
+0.006995 0.009213 -0.047359 0.072944 0.095512 
+0.010178 0.039050 -0.077791 -0.020722 0.021947 
+0.090992 -0.061050 -0.090772 0.081786 -0.045653 
+-0.012634 0.036482 0.058533 -0.002696 -0.033458 
+-0.040412 0.012196 0.010799 -0.011791 0.110559 
+0.009821 -0.036074 0.066220 -0.015518 0.056690 
+-0.027127 -0.071116 0.031944 0.079010 -0.022395 
+-0.039431 -0.000384 -0.014285 0.016850 0.033711 
+0.008705 0.100114 0.041438 -0.100989 0.011356 
+-0.046625 -0.040932 -0.139483 0.054309 -0.063813 
+-0.012343 -0.055168 -0.096047 0.031057 -0.034404 
+0.061917 0.022545 0.077964 -0.061018 -0.028539 
+-0.002541 -0.030177 0.006468 -0.005315 0.042803 
+0.027882 -0.101187 0.073519 -0.048492 -0.034044 
+0.063858 -0.051841 -0.034119 0.025079 -0.055338 
+0.022337 0.072417 -0.039178 0.093515 0.010215 
+-0.063332 0.136724 -0.034306 -0.068709 0.036614 
+-0.060321 0.003109 -0.064068 -0.001911 0.026497 
+-0.043444 0.005220 -0.028260 0.089346 -0.073713 
+0.082013 0.000948 -0.079297 0.077331 0.007199 
+0.013959 -0.089135 -0.001973 0.083595 0.061678 
+-0.027937 0.074507 0.052481 -0.156418 -0.008126 
+-0.077649 -0.025098 -0.028822 0.031584 -0.062854 
+-0.037974 0.052900 -0.008246 -0.058382 0.007371 
+-0.059698 0.005125 0.103990 0.035731 0.076498 
+0.045455 -0.034656 -0.089189 0.010512 -0.022809 
+0.023399 0.080456 -0.046407 0.119537 -0.046816 
+0.011054 0.024797 -0.075119 -0.091853 0.017319 
+0.022797 0.030783 0.051211 -0.054302 0.035466 
+-0.053426 0.002530 0.020784 -0.089056 0.007237 
+0.031757 -0.019566 0.082209 -0.018737 -0.006975 
+-0.032879 0.000924 0.069241 0.009323 0.017753 
+0.041898 0.020597 0.000749 0.046727 0.117703 
+-0.020501 0.027483 -0.056525 -0.059522 0.018749 
+0.025171 0.033068 0.005911 0.134204 0.011451 
+0.038296 0.086523 -0.027888 -0.033250 -0.035178 
+0.043617 -0.108778 0.024102 0.016641 0.092810 
+0.073643 0.030016 -0.066742 -0.010738 0.064668 
+0.039526 -0.112082 -0.032794 -0.037218 0.027811 
+-0.128246 0.003025 -0.070009 -0.076832 -0.013242 
+-0.030105 0.038807 0.066675 0.013770 0.023016 
+-0.094473 0.028346 -0.050126 -0.043963 -0.011618 
+0.017048 -0.083869 -0.023363 0.030985 0.027338 
+-0.080760 -0.055583 0.032162 -0.032668 -0.036833 
+0.058238 0.020173 0.050309 -0.009187 0.009272 
+-0.051130 -0.060180 0.014297 -0.085720 0.033908 
+-0.002635 0.061924 -0.014460 0.025310 -0.143366 
+-0.086237 0.079075 -0.057641 0.027727 0.053345 
+0.030701 0.128530 -0.096663 0.028249 -0.038583 
+-0.041418 -0.078768 -0.009950 -0.139435 0.050946 
+-0.001476 -0.004529 -0.005454 0.042876 0.012496 
+0.037365 0.037258 -0.009785 -0.014137 -0.075187 
+-0.015646 -0.084672 0.066850 0.049159 0.022652 
+-0.100018 0.030626 -0.031693 -0.026283 0.098183 
+0.037095 -0.031902 -0.082082 0.064108 -0.081413 
+-0.016931 0.069276 0.025553 0.019033 -0.009843 
+0.021095 0.006896 0.091735 -0.006895 0.125729 
+-0.038132 -0.025017 -0.094419 0.023870 0.012859 
+-0.032674 0.010226 -0.092226 -0.004873 0.064962 
+-0.006137 0.026959 -0.019304 -0.064646 -0.056343 
+-0.049825 -0.021361 0.067875 -0.021989 0.008580 
+-0.036917 -0.006108 0.023764 -0.015728 -0.098608 
+0.056344 -0.043710 0.075790 0.016095 -0.079516 
+0.016637 0.054791 0.091656 0.119050 -0.037915 
+0.002929 -0.026705 -0.038725 0.031207 0.092135 
+-0.016211 0.014904 -0.012804 -0.003882 0.145488 
+0.013740 -0.018092 -0.113500 0.052133 -0.037974 
+0.032356 0.065081 0.054718 -0.006753 -0.115419 
+-0.041122 -0.070389 0.024012 -0.033000 0.078595 
+0.002090 -0.003576 0.025975 -0.029200 0.073729 
+-0.067545 -0.099515 0.068346 0.036494 -0.010089 
+-0.040395 -0.024474 0.000906 0.004180 -0.011648 
+0.077079 0.062025 0.048336 -0.047553 0.020667 
+-0.034650 0.102764 -0.088833 0.063548 -0.063948 
+0.004926 -0.075665 -0.010204 0.077117 0.008604 
+0.016964 -0.006119 0.015651 -0.060279 -0.084239 
+0.021175 -0.041494 0.062789 0.023042 -0.049413 
+0.030400 -0.088557 -0.027424 -0.038734 -0.047767 
+-0.039267 -0.007115 -0.095571 0.040131 -0.172339 
+-0.015514 0.125809 0.002775 0.011847 -0.039818 
+0.003508 0.088794 -0.016537 -0.041801 0.077773 
+-0.025099 -0.015829 -0.087113 -0.031825 0.018394 
+-0.033412 -0.037361 0.054089 0.082347 -0.078775 
+0.044163 -0.001941 -0.036779 0.006281 0.033103 
+-0.019683 0.013567 0.044802 0.035896 0.099997 
+0.048928 0.024331 0.024339 -0.119730 -0.020516 
+0.003938 -0.049114 -0.020101 0.025056 -0.039189 
+-0.111669 0.015432 0.107806 0.009106 -0.041783 
+0.004427 0.114069 0.035561 0.004165 0.048624 
+0.065296 -0.020221 -0.112241 -0.024621 -0.104499 
+0.040792 -0.042481 -0.126163 0.113850 0.052426 
+0.045897 0.073140 -0.038559 -0.101637 -0.010880 
+0.014157 0.016488 0.118415 -0.003117 0.015104 
+0.005410 -0.047124 -0.034323 -0.038341 0.011107 
+-0.021536 -0.087493 0.030662 0.003416 -0.087892 
+-0.019840 0.053393 0.053193 0.082340 -0.013319 
+0.013522 0.032147 -0.036372 0.021664 0.058868 
+0.001821 0.053133 0.015237 -0.029422 0.049671 
+0.032518 0.054852 -0.061126 0.052882 0.005097 
+-0.000200 0.077584 0.023798 -0.015922 -0.043740 
+-0.019244 -0.065261 -0.001356 0.041977 0.064243 
+0.006831 0.025573 -0.039113 -0.067333 0.007728 
+0.061532 -0.086024 0.037808 0.024787 -0.036093 
+-0.148755 -0.014995 0.025827 -0.017793 -0.025363 
+0.010676 -0.014283 0.038621 -0.041757 -0.018561 
+-0.004984 0.048476 -0.027007 0.007045 -0.010409 
+0.017155 -0.042986 -0.059561 0.084763 0.072516 
+-0.014595 -0.020495 -0.009080 -0.061622 -0.023300 
+0.018242 0.008783 0.036423 -0.001710 -0.025459 
+-0.030263 -0.038355 0.112339 -0.013108 0.030839 
+-0.050166 -0.045350 -0.006927 0.057254 -0.090539 
+-0.052734 0.030495 -0.028123 0.095772 0.021287 
+0.004939 0.065006 -0.066334 0.009532 0.009978 
+0.000692 -0.079650 -0.130620 -0.025115 -0.037193 
+0.028545 -0.011885 -0.018329 0.101976 0.056169 
+0.074905 -0.039652 -0.019531 -0.031025 -0.031945 
+-0.004999 -0.024155 0.051113 0.063966 -0.016577 
+-0.028105 0.007520 -0.098547 -0.151585 0.016061 
+-0.011144 -0.064311 -0.071227 -0.012819 -0.089185 
+-0.011034 0.126948 0.065626 0.030017 -0.077054 
+-0.016170 -0.011244 -0.030183 -0.068083 0.115571 
+0.004514 -0.032999 -0.119452 -0.052594 0.048244 
+0.006761 0.001824 -0.082055 0.063269 0.016468 
+-0.015038 0.008738 -0.042234 -0.087201 -0.135683 
+-0.058265 -0.010563 0.099495 0.035913 0.016120 
+0.022021 -0.060263 0.058709 -0.025272 -0.069868 
+-0.012474 -0.023791 0.072270 0.012475 -0.047178 
+0.065743 0.022110 0.027334 0.039002 0.034057 
+0.056588 0.090825 -0.083277 0.062553 0.045167 
+0.016230 0.042246 -0.055865 -0.029814 0.063583 
+0.101556 -0.041974 0.065108 0.059385 -0.023394 
+0.067253 0.003519 0.053386 0.071879 -0.052816 
+-0.014833 -0.034839 0.008862 0.040661 0.076481 
+0.113195 -0.022318 0.022988 -0.047563 0.021223 
+-0.031776 -0.097003 0.010273 0.070963 -0.088181 
+-0.014952 -0.044557 -0.040211 0.027326 0.055263 
+-0.027993 0.036839 0.059553 -0.085166 0.023284 
+0.081938 0.013347 -0.056030 0.032386 -0.078191 
+-0.012334 -0.065844 -0.082412 0.021620 0.049765 
+0.021974 0.064777 0.116942 -0.066893 -0.029098 
+0.063773 -0.015678 0.036050 -0.001531 0.050204 
+-0.007431 -0.053256 0.019949 -0.084515 -0.052331 
+0.003628 -0.002831 0.028651 -0.022563 -0.068663 
+-0.046864 0.085680 0.035073 0.090355 0.076019 
+-0.033539 0.078709 0.049120 -0.058380 0.063174 
+-0.067044 -0.040988 -0.024670 -0.076422 0.022349 
+-0.059226 -0.063296 -0.024667 0.109900 -0.039214 
+0.081493 0.061838 -0.018769 0.054117 0.049416 
+-0.039105 -0.000888 -0.008740 0.069660 0.056013 
+-0.013119 0.088704 0.005989 -0.118940 0.055085 
+-0.021830 -0.027348 -0.037636 -0.044645 -0.013684 
+-0.033348 0.066928 -0.026840 -0.074085 -0.052255 
+-0.095346 0.073214 0.052368 0.000793 0.036896 
+0.029109 -0.040256 -0.063044 -0.008606 -0.000437 
+0.037406 0.035413 -0.064896 0.100694 -0.002451 
+-0.062127 -0.005213 -0.045513 -0.099165 -0.029096 
+0.046180 -0.038707 0.091676 -0.027947 0.081059 
+-0.051970 0.036875 -0.002862 -0.034628 0.032122 
+-0.042473 -0.133086 0.097766 0.014513 -0.057376 
+-0.026905 0.025345 0.058654 0.088520 0.021655 
+0.068829 -0.068890 0.073760 0.037294 0.067743 
+0.004270 0.030315 -0.017342 -0.022912 0.021230 
+0.027415 0.010279 0.033049 0.105463 -0.080985 
+-0.024846 0.118625 0.017407 -0.060377 -0.071617 
+-0.034814 -0.031741 0.033114 -0.008946 0.044965 
+0.026382 0.068195 -0.053337 -0.079506 0.089886 
+0.019186 -0.075490 -0.002131 -0.014334 0.010145 
+-0.102313 0.044049 0.024515 -0.079086 0.105318 
+0.030157 0.019277 0.009149 -0.002192 0.035223 
+-0.093034 0.037988 -0.056189 0.005485 -0.070967 
+0.093206 -0.017940 -0.068121 0.025189 0.098473 
+-0.047072 -0.057202 0.027986 -0.068841 -0.023193 
+0.059350 -0.020968 0.125734 -0.015897 0.013012 
+-0.018615 -0.122453 -0.008474 -0.064049 0.013910 
+0.021902 0.037915 0.039737 0.028260 -0.089535 
+-0.052408 0.036171 0.024766 0.038944 0.043725 
+0.068495 0.097351 -0.051536 -0.026994 0.009734 
+0.022521 -0.085412 -0.004269 -0.068523 0.026057 
+-0.003617 0.002555 -0.024622 0.075742 0.024453 
+0.043622 0.048992 -0.003958 -0.051371 -0.010372 
+-0.009291 -0.026649 0.112796 0.034440 0.000480 
+0.000993 0.012835 -0.024524 -0.086702 0.076990 
+-0.012872 -0.012272 -0.049239 0.045637 -0.100430 
+-0.080402 0.098860 -0.001607 -0.027740 -0.028447 
+0.010187 0.049316 0.064463 -0.032244 0.096351 
+0.042173 -0.014830 -0.130350 -0.065157 -0.020131 
+0.011826 0.043958 -0.096975 0.094420 0.065360 
+0.008046 0.034625 0.022699 -0.011948 -0.162034 
+-0.028577 -0.049031 0.062518 0.027121 0.011773 
+-0.062840 -0.028274 0.019513 0.004294 -0.058221 
+0.015044 0.032322 0.078632 0.074899 -0.089319 
+0.012740 0.036679 0.061490 0.073955 0.074210 
+-0.042945 0.081229 0.003752 -0.027289 0.107675 
+0.028637 -0.027527 -0.094485 -0.014081 0.106655 
+0.037034 -0.046495 -0.057983 0.047583 0.007322 
+-0.000480 0.084590 0.058447 0.010057 -0.044796 
+-0.035563 -0.017414 0.104652 -0.101773 0.088697 
+0.008873 -0.059058 -0.074754 -0.068039 0.080127 
+-0.042104 -0.067599 0.033969 0.019253 -0.038611 
+0.007952 0.028316 -0.003028 0.025731 -0.031708 
+0.103465 0.087113 0.002288 -0.034732 0.000345 
+0.011011 0.084188 -0.047564 0.007324 -0.100708 
+-0.031667 -0.084195 -0.045309 0.035772 0.029785 
+-0.003803 0.041355 0.070690 -0.006148 -0.101234 
+0.036078 -0.057998 0.086587 0.069468 -0.017787 
+0.043517 -0.032858 -0.018033 -0.080238 -0.054284 
+0.011916 -0.027168 0.032061 0.004608 -0.164665 
+0.024300 0.127777 -0.001633 0.037157 -0.077063 
+0.079112 0.092827 -0.045527 0.012537 0.048156 
+-0.028838 -0.088344 -0.058200 -0.001037 0.009927 
+0.005766 -0.051805 0.035975 0.103039 -0.118515 
+0.040739 0.028846 -0.010371 -0.011677 -0.017552 
+-0.012737 -0.062534 0.096752 0.040808 0.067058 
+-0.016128 -0.050826 0.049568 -0.159884 0.104117 
+-0.060870 -0.026777 -0.040150 0.003038 0.011219 
+-0.047457 0.044509 0.104699 -0.061694 -0.048700 
+-0.028345 0.058571 0.115771 0.060865 0.049165 
+-0.017126 -0.029090 -0.087904 -0.040448 -0.053762 
+-0.009906 0.012529 -0.107155 0.136828 -0.025232 
+0.019743 0.120518 -0.033402 -0.147125 -0.096492 
+-0.011562 -0.010821 0.143581 -0.029410 0.012515 
+-0.007255 -0.051247 -0.015950 -0.001080 -0.021038 
+0.033604 -0.082138 0.032578 -0.050610 -0.097139 
+-0.058199 0.107657 0.105983 0.027511 -0.023155 
+0.031791 0.024300 -0.017968 0.063148 0.049343 
+-0.007836 -0.006517 -0.013473 -0.004970 0.056535 
+0.020974 0.047090 0.009318 0.062741 -0.066064 
+0.049383 0.062600 -0.007244 0.025406 -0.011447 
+-0.019044 -0.033373 -0.012008 -0.020777 0.089488 
+0.069039 -0.039904 -0.061004 -0.104096 0.011128 
+0.072522 -0.048600 -0.051581 0.021177 0.001740 
+-0.135630 0.074921 0.010935 0.054793 -0.041526 
+0.024169 0.044285 0.017189 -0.023435 -0.022755 
+-0.018169 0.007995 -0.068248 -0.015644 -0.055355 
+-0.008988 0.013394 -0.130934 0.055860 0.075055 
+-0.024869 -0.072987 0.105486 -0.141599 -0.052593 
+0.104369 -0.026032 0.010393 0.003048 -0.077763 
+0.020642 -0.054726 0.098890 -0.062038 -0.008284 
+-0.030920 0.041949 -0.052596 0.055867 -0.059301 
+-0.027785 0.067366 -0.015217 0.061893 -0.058155 
+0.044323 0.038825 -0.048558 0.026668 0.056475 
+-0.042396 -0.044360 -0.073532 -0.092982 -0.055163 
+-0.002151 -0.047433 0.007696 0.110986 0.055177 
+0.038644 0.059219 -0.050130 -0.016829 -0.018164 
+-0.003120 -0.055675 0.097769 0.119773 0.017092 
+-0.022682 0.021229 -0.029792 -0.117466 0.066111 
+0.065948 -0.074617 -0.074175 0.016698 -0.071365 
+-0.047641 0.063671 0.005349 -0.039942 -0.093589 
+0.065751 0.017235 0.035630 -0.031694 0.061852 
+0.053612 -0.016144 -0.071008 -0.029225 0.066491 
+-0.040345 0.042471 -0.075360 0.066743 0.050696 
+-0.014316 -0.034336 0.016703 -0.103271 -0.081002 
+-0.052827 0.007353 0.046627 0.008461 0.049725 
+-0.003406 -0.093149 0.006210 -0.055973 -0.057089 
+-0.020200 0.012346 0.141207 0.045917 -0.012261 
+0.039647 0.050373 0.056749 0.072718 0.002752 
+0.004009 0.038716 -0.039473 0.082663 0.054674 
+-0.004500 0.042366 -0.110686 -0.077697 0.039758 
+0.051345 0.003071 -0.019544 0.063662 -0.082557 
+0.025358 0.016659 0.029266 0.011585 -0.055014 
+-0.026965 0.026974 0.018085 -0.022347 0.075107 
+0.063294 -0.046595 0.032484 -0.030675 0.062036 
+-0.033627 -0.064331 0.081940 0.081033 -0.050699 
+-0.046257 -0.013797 -0.008749 -0.013019 0.018478 
+-0.008139 0.075257 0.092736 -0.053166 0.014791 
+-0.013803 0.044603 -0.116267 0.032848 -0.092134 
+0.020647 -0.052370 -0.128516 0.004475 -0.043562 
+0.036375 -0.002867 0.103214 -0.109219 0.008372 
+-0.017374 -0.021978 0.020315 0.012816 0.005703 
+0.099649 -0.047777 0.054769 -0.025362 -0.003862 
+0.036146 -0.000369 -0.000853 0.012461 -0.032338 
+0.013247 0.073478 -0.020868 0.034203 0.002982 
+-0.016316 0.149713 0.002631 -0.081349 -0.020016 
+-0.155943 -0.058299 -0.046014 0.027098 0.028942 
+-0.011857 -0.022016 0.017303 0.105805 -0.012430 
+0.086002 -0.009549 -0.071369 -0.005224 0.013152 
+-0.032159 -0.053343 0.027646 0.043468 0.037717 
+-0.009747 0.013014 0.058424 -0.101661 -0.010004 
+-0.053787 -0.020784 -0.072472 -0.041184 -0.087878 
+-0.077459 0.062841 0.011552 -0.085703 -0.035239 
+-0.018818 0.030430 0.040444 -0.042755 0.041121 
+0.003887 -0.025745 -0.049363 -0.025894 -0.054378 
+0.070007 -0.019364 -0.141059 0.039915 -0.045332 
+0.024336 0.030320 -0.082784 -0.048936 -0.027234 
+0.020447 0.007182 0.084824 -0.045970 0.027752 
+-0.009759 -0.023702 -0.008379 -0.071048 0.015064 
+0.009395 -0.052442 0.130155 -0.011644 -0.014787 
+-0.021138 0.024468 0.045928 0.043163 -0.030898 
+0.065143 -0.014501 -0.008479 -0.017099 0.098271 
+-0.038323 0.004035 -0.061317 -0.041506 0.038436 
+0.055127 0.060303 0.044674 0.128814 0.038762 
+0.086495 0.069068 -0.070150 -0.089410 -0.054372 
+0.033209 -0.096623 0.034209 0.050531 0.038502 
+0.059019 0.043258 -0.045121 -0.063876 0.049971 
+0.014954 -0.153720 0.031755 -0.021388 0.014803 
+-0.125385 0.063700 -0.019166 -0.095829 0.022129 
+-0.035969 0.041896 0.030461 -0.015321 -0.015067 
+-0.040013 0.024331 -0.015398 -0.008113 -0.019773 
+0.027804 -0.039993 -0.074170 0.033667 0.046367 
+-0.086691 -0.034684 0.054798 -0.087551 -0.014591 
+0.044687 0.057457 0.118611 0.010895 0.011308 
+-0.066320 -0.063774 0.057919 -0.051338 0.049145 
+0.006265 0.048016 -0.010350 0.089136 -0.100672 
+-0.040908 0.090819 -0.084327 0.065891 0.025763 
+-0.030480 0.103529 -0.144803 -0.036912 0.017161 
+-0.020671 -0.059993 -0.030123 -0.104598 0.039178 
+0.018764 0.001037 0.014109 0.056332 0.050717 
+-0.004747 0.035822 0.019209 -0.010162 -0.044650 
+-0.039307 -0.111424 0.122778 0.090067 0.014313 
+-0.047117 0.042269 -0.052396 -0.023384 0.123438 
+-0.016756 -0.092801 -0.058478 0.080712 -0.052288 
+-0.031113 0.064436 -0.005451 -0.018327 -0.053156 
+-0.022903 0.031275 0.042126 0.009823 0.074549 
+0.002952 -0.010186 -0.114717 -0.029095 -0.026125 
+0.003889 -0.003003 -0.060079 0.034566 0.010262 
+-0.029593 0.012239 -0.052124 -0.028219 -0.110036 
+-0.015073 0.005623 0.053202 -0.029201 -0.038548 
+-0.025617 -0.000150 0.022644 0.000550 -0.049223 
+0.018036 -0.010954 0.045453 0.019204 -0.075695 
+0.027728 0.012573 0.072358 0.082283 0.037531 
+-0.003946 0.003139 0.000013 0.021161 0.067238 
+0.019852 -0.022422 -0.032314 -0.024316 0.106260 
+-0.001499 -0.028984 -0.045186 0.019666 -0.000966 
+0.047073 0.075944 0.081739 -0.029633 -0.060673 
+-0.013207 -0.057523 0.057259 -0.055200 0.078923 
+0.013582 -0.060645 -0.029418 0.013853 0.056976 
+-0.061172 -0.146801 0.049472 0.016436 0.045997 
+-0.031589 -0.031052 0.031418 0.026113 -0.038676 
+0.064035 0.045482 0.020622 0.005875 0.029585 
+-0.005284 0.054275 -0.076784 -0.000845 -0.023097 
+0.009660 -0.128422 0.002992 0.055651 -0.005932 
+-0.027123 0.022215 0.057779 -0.080469 -0.076867 
+0.008909 -0.030195 0.004706 0.060938 -0.038886 
+0.050785 -0.063214 0.004370 -0.033455 -0.013089 
+-0.009154 -0.030641 -0.030220 0.005174 -0.132262 
+-0.021476 0.105410 0.027719 0.051123 -0.017271 
+-0.000185 0.117864 0.035809 -0.071891 0.116329 
+-0.009954 -0.102737 -0.053397 -0.057653 0.058746 
+0.009878 0.024776 0.043190 0.082400 -0.020615 
+0.032439 0.035539 -0.018820 0.017822 0.016504 
+0.008745 -0.008596 0.054707 0.063681 0.056656 
+0.032254 -0.023608 -0.002017 -0.146378 0.047072 
+-0.016978 -0.066403 -0.042616 0.019845 -0.016902 
+-0.036058 0.030091 0.057405 -0.035798 0.002185 
+0.033655 0.062726 0.038185 -0.024604 0.038026 
+0.013655 -0.050063 -0.040289 -0.034587 -0.089238 
+-0.021893 -0.072730 -0.145619 0.108409 0.003979 
+0.003043 0.058544 -0.005494 -0.058294 -0.023242 
+-0.027050 0.048686 0.105867 0.037255 -0.005019 
+-0.017867 0.007807 -0.016470 -0.017352 -0.004222 
+-0.051778 -0.082651 0.031128 -0.051302 -0.094105 
+-0.007583 0.048196 0.056035 0.076579 -0.049990 
+0.037184 0.064354 -0.004853 0.019012 0.052243 
+0.041607 0.017800 -0.018867 -0.048040 0.036929 
+0.071847 0.012078 -0.003492 0.052903 -0.041736 
+-0.008196 0.113020 0.034731 -0.051940 0.022987 
+-0.022300 -0.033261 0.020486 -0.029803 0.179316 
+0.014762 -0.006096 -0.022377 -0.053417 0.045007 
+0.047412 -0.078434 0.007164 0.048187 -0.032463 
+-0.106666 -0.022577 -0.007054 0.017166 -0.007364 
+0.007677 0.013536 0.004985 -0.052519 -0.019141 
+0.018399 0.004096 -0.066275 -0.014342 -0.023287 
+0.017068 -0.061082 -0.021342 0.049768 0.072011 
+0.006385 -0.035801 -0.027304 -0.099812 0.001797 
+0.065304 -0.033306 0.042256 -0.008741 -0.006929 
+0.010954 -0.080864 0.095856 -0.012888 0.050346 
+-0.058343 -0.042527 0.010740 0.027268 -0.131655 
+-0.022159 0.048331 -0.019242 0.139544 -0.009212 
+0.008528 0.095408 -0.072588 -0.026269 0.046686 
+-0.057569 -0.103939 -0.092932 -0.053006 0.017352 
+0.065774 -0.067465 -0.035608 0.077533 0.035754 
+0.076737 0.042552 -0.018386 -0.040285 -0.060055 
+0.002954 -0.063347 0.023485 0.069391 0.030181 
+0.015083 -0.035587 -0.073150 -0.108303 0.033116 
+-0.051149 -0.070534 -0.072103 0.010046 -0.008050 
+-0.038552 0.065148 -0.005398 0.029138 -0.091804 
+-0.032927 0.026057 0.044995 -0.067493 0.140590 
+-0.010770 -0.051205 -0.134801 0.039771 0.047000 
+-0.040774 0.024562 -0.118058 0.061721 0.010046 
+-0.084855 -0.002180 -0.028081 -0.040929 -0.091046 
+-0.074457 -0.063377 0.065429 0.036303 -0.058948 
+-0.009780 -0.035398 0.010274 -0.054774 -0.052228 
+0.000477 -0.035468 0.059891 -0.011652 -0.043705 
+0.130993 0.029418 0.024997 0.014118 -0.000473 
+0.012220 0.094825 0.003360 0.050743 0.112621 
+-0.036424 0.119286 -0.062500 0.028140 0.113267 
+0.092232 -0.028352 0.015304 0.118553 -0.037245 
+0.047917 0.068301 0.034398 0.054323 -0.111406 
+0.016223 -0.016616 0.048104 -0.012621 0.095559 
+0.040486 -0.036481 0.006675 -0.029498 0.019722 
+-0.005174 -0.090840 0.040097 0.031192 -0.056686 
+-0.015354 -0.037239 -0.040451 0.001148 0.016519 
+0.027984 0.063613 0.029013 -0.053331 0.009462 
+0.094796 0.073376 -0.035437 0.079788 -0.072969 
+0.005683 -0.141562 -0.028240 0.056569 0.053462 
+0.024141 0.020688 0.105325 -0.088920 -0.074876 
+0.044548 0.015221 0.063364 0.044219 0.028301 
+-0.011412 -0.033571 0.034361 -0.067847 0.000284 
+0.012742 -0.045973 -0.009839 0.044280 -0.077401 
+0.013255 0.065280 0.018179 0.074351 0.004383 
+-0.054040 0.072674 -0.012623 -0.023532 0.057154 
+-0.077067 -0.071007 -0.013831 -0.015362 -0.004755 
+-0.051874 -0.046591 -0.008108 0.051772 0.006314 
+0.106169 0.066165 -0.024173 0.034211 -0.015378 
+-0.085769 -0.015752 -0.008456 0.051049 0.015420 
+-0.005850 -0.015631 -0.060787 -0.151510 0.080912 
+-0.029476 -0.034162 -0.023308 0.021727 -0.069572 
+-0.002926 0.066532 0.034835 -0.091864 -0.014468 
+-0.077637 0.085530 0.058931 0.087803 -0.024233 
+0.027189 -0.084814 -0.064844 -0.010260 -0.038228 
+0.079925 0.040571 -0.027455 0.112376 0.008327 
+-0.015541 0.020299 -0.039833 -0.122069 -0.008265 
+0.048969 -0.037595 0.073512 -0.070833 0.106844 
+-0.031463 -0.019591 0.029763 -0.022865 0.013933 
+-0.014056 -0.092923 0.075324 0.002550 0.006051 
+-0.074776 0.035465 0.027474 0.120921 0.027105 
+0.061516 -0.026568 0.024123 0.047036 0.024385 
+0.003344 0.059906 -0.051191 -0.053047 -0.027729 
+-0.001564 0.005823 0.010087 0.083294 -0.024265 
+0.042741 0.094994 0.021393 -0.083504 -0.083151 
+0.011291 -0.058920 0.012861 0.030070 0.042736 
+0.022911 -0.008546 -0.057609 -0.069900 0.088492 
+-0.002894 -0.066828 -0.009727 -0.047981 0.019844 
+-0.085641 0.000042 0.003014 -0.007295 0.035791 
+0.036123 0.067002 0.026630 -0.001636 0.009073 
+-0.016053 0.084871 -0.100683 -0.050020 -0.071874 
+0.072365 -0.036757 -0.017701 0.038197 0.053099 
+-0.056378 -0.028855 0.012463 -0.045723 -0.005667 
+0.064256 -0.028177 0.057826 -0.055872 0.030883 
+-0.002914 -0.097445 0.018108 -0.065132 0.064327 
+-0.036809 0.022530 0.032579 0.083859 -0.088729 
+-0.009218 0.070687 -0.027232 0.016749 0.037592 
+0.061102 0.155046 -0.004610 -0.031402 0.008374 
+-0.011437 -0.059360 -0.064021 -0.069056 0.022916 
+-0.003860 0.044792 -0.030508 0.057430 -0.013125 
+0.027304 -0.003144 -0.007603 -0.074523 -0.036823 
+0.004066 -0.035482 0.142619 0.062765 0.083342 
+-0.023363 -0.016003 0.016507 -0.060403 0.074455 
+-0.020249 -0.025938 -0.007470 0.084381 -0.106173 
+-0.060300 0.087411 0.014814 0.028437 0.010883 
+0.012873 0.103973 0.089761 0.027096 0.064947 
+0.033057 0.028486 -0.133571 -0.002210 -0.014149 
+0.005981 0.010927 -0.143115 0.070712 0.006923 
+0.044569 0.004846 -0.008362 -0.109156 -0.120284 
+-0.007157 -0.027002 0.075999 0.001357 -0.006077 
+-0.035577 0.042029 0.018068 0.017700 -0.038593 
+-0.058375 0.013590 0.094255 0.021156 -0.080328 
+-0.006126 0.058842 0.032376 0.051314 0.064136 
+-0.063765 0.028090 0.032284 0.078521 0.108677 
+0.012656 0.007400 -0.092093 -0.036734 0.056851 
+0.000116 -0.002036 -0.026805 0.084821 -0.011989 
+0.023502 0.064916 0.050640 -0.002411 -0.015045 
+-0.026830 -0.004301 0.065835 -0.025416 0.056093 
+0.090627 -0.051534 -0.023105 -0.029171 0.064099 
+-0.030773 -0.085191 0.015343 -0.005415 0.005626 
+0.013041 0.010729 0.018058 0.018453 -0.002180 
+0.089388 0.064815 0.021466 -0.092663 -0.019224 
+-0.008842 0.103392 -0.036092 -0.034972 -0.070552 
+-0.077454 -0.124438 -0.056352 0.069482 0.030672 
+-0.003203 -0.020694 0.070840 -0.004376 -0.102179 
+0.064995 -0.059481 0.049343 0.024210 -0.003858 
+0.056350 -0.015583 0.065190 -0.059043 -0.090407 
+0.042894 0.012225 0.074108 0.009773 -0.093983 
+0.048272 0.093970 0.039985 0.070722 0.010834 
+0.011975 0.135085 -0.000165 -0.021759 0.065164 
+-0.040893 -0.089985 -0.024270 -0.003863 0.030587 
+0.000069 -0.021155 0.028518 0.153614 -0.071797 
+0.070676 0.025584 0.005300 0.043065 -0.000089 
+-0.003734 -0.036750 0.018132 0.036268 0.168510 
+0.019026 -0.021440 0.042884 -0.095824 0.021242 
+-0.026137 -0.034052 -0.063076 0.031835 -0.012727 
+-0.084292 0.114347 0.068154 -0.074997 0.009182 
+-0.056381 0.161792 0.065873 -0.004008 0.052013 
+0.005326 0.018022 -0.114663 -0.107213 -0.079062 
+-0.037042 0.007951 -0.066766 0.089297 -0.035405 
+0.006611 0.013565 0.029000 -0.122667 -0.037773 
+0.030080 0.039640 0.112965 -0.038791 0.051681 
+0.018950 -0.002870 0.004002 -0.035366 -0.046099 
+-0.006632 -0.046456 0.064561 -0.045986 -0.052509 
+-0.045507 0.034342 0.094059 0.085895 -0.059965 
+0.047107 0.045776 -0.051041 0.069720 0.062871 
+-0.004318 0.016990 -0.053383 -0.000405 0.042032 
+0.061772 0.087463 0.018593 0.001180 -0.105041 
+0.036585 0.091364 -0.010729 0.002978 0.015583 
+-0.077926 -0.029862 -0.037549 -0.014135 0.056743 
+0.082538 -0.079858 -0.038190 -0.052196 -0.005951 
+0.095037 -0.039714 0.003105 0.009675 -0.006472 
+-0.098367 0.004226 0.018157 0.116425 -0.033752 
+-0.009903 0.043421 0.067382 -0.058642 -0.037966 
+-0.004321 0.046370 -0.039951 0.033751 -0.045280 
+-0.005703 -0.055692 -0.075669 0.043537 0.088421 
+-0.000079 -0.053451 0.015580 -0.177514 -0.037255 
+0.081872 -0.006931 0.040197 -0.040382 -0.030544 
+-0.032474 -0.073683 0.111389 -0.043286 -0.012181 
+-0.070486 0.021008 -0.006453 0.059025 -0.084346 
+-0.045844 0.134617 -0.026041 0.078112 -0.027141 
+-0.001031 0.044353 -0.065608 0.036661 0.045948 
+0.004303 -0.038662 -0.062062 -0.073388 -0.026033 
+-0.002636 -0.014067 -0.022648 0.128905 0.104651 
+0.091629 0.045550 -0.039856 -0.036999 -0.014194 
+0.058828 -0.095390 0.054826 0.108067 0.017921 
+0.007401 0.037480 -0.051214 -0.080561 0.050245 
+0.005451 -0.084552 -0.014427 0.003994 -0.067761 
+-0.042687 0.064428 0.056058 -0.024265 -0.093157 
+0.011618 0.006660 0.071511 -0.116214 0.061118 
+0.046247 0.008564 -0.083904 -0.015807 0.002628 
+-0.075241 0.045928 -0.025621 0.024239 0.024757 
+-0.010838 -0.006020 -0.007541 -0.087714 -0.046745 
+-0.086472 -0.058225 0.054459 0.025327 0.052933 
+-0.014453 -0.076697 -0.033271 -0.024850 -0.042314 
+0.006569 0.008881 0.074045 0.050097 -0.053039 
+0.019414 0.021988 0.024896 0.056649 0.014029 
+-0.029525 0.048784 -0.029431 0.042442 0.049334 
+-0.026698 0.072277 -0.101799 -0.008341 0.047314 
+0.082658 -0.016114 -0.042442 0.043527 -0.030064 
+-0.011416 0.013182 0.060549 0.002644 -0.070164 
+-0.045732 -0.022494 0.019693 -0.016130 0.079647 
+0.000137 -0.038661 0.034959 -0.041633 0.047926 
+0.003937 -0.073487 0.058946 0.065316 -0.021139 
+-0.029658 -0.005529 0.019340 0.005718 0.041614 
+0.046584 0.048974 0.064738 -0.076893 0.055570 
+-0.008793 -0.001555 -0.108121 0.080904 -0.073317 
+0.004653 -0.088656 -0.069282 0.058314 0.010922 
+0.012637 0.026970 0.078839 -0.078606 -0.003575 
+0.010350 0.012762 0.009724 -0.032223 0.025429 
+0.028469 -0.112814 0.072108 -0.066038 0.028088 
+0.021121 -0.042380 -0.040489 0.029521 -0.098778 
+0.078694 0.118164 -0.017958 0.087002 0.013197 
+-0.023191 0.159205 0.002982 -0.142188 0.019509 
+-0.062408 -0.050584 -0.091242 0.004705 0.040898 
+-0.034214 -0.000165 -0.013000 0.062856 -0.025148 
+0.102892 0.026243 -0.114277 0.061707 0.020581 
+-0.052551 -0.075429 0.028865 0.098236 0.087934 
+0.003941 0.037129 0.029683 -0.128548 0.026698 
+-0.036967 -0.019454 -0.078159 0.008871 -0.086884 
+-0.058585 0.059095 -0.041884 -0.137966 -0.017325 
+-0.057685 0.085566 0.119159 -0.011731 0.076164 
+0.059270 -0.000533 -0.073970 -0.001937 -0.048985 
+0.021162 0.035663 -0.047899 0.054477 -0.072253 
+0.030344 0.099352 -0.101163 -0.104366 -0.004390 
+0.017480 -0.006506 0.031974 -0.043831 0.028735 
+-0.033380 -0.037286 -0.025470 -0.075025 -0.009320 
+-0.001852 -0.019244 0.082659 -0.052343 -0.013826 
+-0.006310 0.016400 0.043020 0.054048 0.019322 
+0.025350 0.000037 0.019873 -0.001509 0.073472 
+-0.050388 0.028730 -0.071807 -0.078877 -0.006660 
+0.042649 0.008729 -0.001538 0.090951 0.006897 
+0.044002 0.096566 0.016693 -0.023445 -0.061755 
+0.017879 -0.081886 0.054302 0.025875 0.073506 
+0.045439 0.035703 -0.050539 -0.024113 0.030719 
+0.003684 -0.089257 -0.009652 0.004777 -0.019300 
+-0.184163 0.032927 -0.044636 -0.031259 -0.075344 
+-0.014780 0.063123 0.067839 0.012301 -0.009528 
+-0.061510 0.097677 -0.067039 -0.006689 -0.004137 
+0.016930 -0.038502 -0.023013 0.052181 0.034074 
+-0.090822 -0.097151 0.030070 -0.043927 0.004506 
+0.049853 0.013260 0.049217 0.011345 -0.015640 
+-0.017375 -0.084889 0.027637 -0.083011 0.017271 
+0.011964 0.013770 -0.041388 0.021785 -0.113317 
+-0.104729 0.128840 -0.005522 0.005470 0.070867 
+0.034456 0.113067 -0.120802 0.015723 0.032177 
+-0.026534 -0.052353 -0.069474 -0.100515 0.121550 
+0.014104 -0.026758 -0.017051 0.063176 0.010188 
+0.007059 0.032242 0.002999 -0.038362 -0.058729 
+0.021051 -0.069408 0.065496 0.036434 0.024457 
+-0.051978 0.045735 -0.057632 -0.009011 0.056847 
+0.033616 -0.045577 -0.087817 0.102137 -0.027964 
+-0.002581 0.069852 0.041033 0.041021 -0.038913 
+-0.025533 0.043910 0.093674 0.006518 0.140256 
+-0.022931 0.003222 -0.164511 -0.012575 0.008372 
+0.023221 -0.013081 -0.086070 0.000152 0.053139 
+0.005914 0.050660 -0.044071 -0.047270 -0.079699 
+-0.047341 -0.038511 0.125150 0.012254 -0.032029 
+-0.013659 -0.058072 0.035218 -0.033783 -0.083119 
+0.046233 -0.049628 0.079349 0.065395 -0.090450 
+0.044946 0.046353 0.131024 0.076594 0.042978 
+-0.047922 0.002985 -0.056522 0.056443 0.112147 
+0.010900 0.000489 -0.020178 0.036351 0.129699 
+0.037153 0.027557 -0.079114 0.043216 -0.032491 
+0.071191 0.026446 0.111274 -0.011111 -0.062724 
+-0.000122 -0.019280 0.038617 -0.059199 0.111019 
+0.020501 -0.045138 -0.015061 -0.064807 0.065959 
+-0.054589 -0.087659 0.038646 0.014381 0.034881 
+-0.048543 -0.006280 -0.009214 0.027865 -0.032303 
+0.071681 0.064881 0.009542 -0.005854 0.079711 
+-0.030565 0.072960 -0.051732 0.009082 -0.047330 
+0.051060 -0.086171 -0.053292 0.117917 0.007520 
+0.006614 0.011574 0.052013 -0.067455 -0.037879 
+0.006855 -0.046269 0.030860 0.034071 -0.002125 
+0.048522 -0.066340 -0.050068 -0.091857 -0.039875 
+0.042169 -0.025418 -0.046173 0.047008 -0.159002 
+-0.047329 0.169123 -0.038203 -0.005754 -0.037022 
+0.040981 0.059210 -0.002242 -0.042617 0.044265 
+-0.059317 -0.044882 -0.074775 -0.083442 0.028007 
+-0.041098 -0.031959 0.043096 0.061795 -0.028197 
+0.040470 -0.018708 -0.008600 0.002891 0.053975 
+-0.024208 0.023791 0.009775 0.081813 0.089801 
+0.033188 0.016547 0.021751 -0.087759 0.023122 
+-0.022831 -0.039574 -0.020474 0.037836 -0.007783 
+-0.094861 0.073247 0.069161 -0.023846 -0.041333 
+-0.025772 0.087748 0.025988 -0.012948 0.064875 
+0.010587 0.013649 -0.041432 -0.081306 -0.084813 
+-0.006181 -0.038833 -0.069003 0.107345 0.007611 
+0.016453 0.041605 -0.043538 -0.126253 0.035968 
+-0.003914 0.021006 0.086272 -0.015117 0.004273 
+-0.017316 -0.011375 -0.050330 -0.020760 0.009092 
+-0.018200 -0.056900 0.062502 0.046639 -0.106123 
+0.033584 0.108129 0.061245 0.069683 -0.038308 
+-0.006263 0.062187 -0.026140 -0.006177 0.072540 
+0.026465 0.025257 0.000306 -0.033152 0.070377 
+0.032552 0.067946 -0.041184 0.068817 -0.042517 
+-0.023665 0.089426 -0.009517 -0.031905 -0.028876 
+-0.047198 -0.101750 -0.021643 0.030076 0.103800 
+0.003349 0.017493 0.002512 -0.094201 -0.005963 
+0.089063 -0.095130 0.050351 -0.004288 -0.067613 
+-0.131572 -0.051380 0.008583 0.005412 0.028560 
+-0.017345 0.004478 0.031108 -0.057891 -0.007459 
+-0.009374 0.004726 -0.032662 0.036793 -0.009074 
+-0.023603 -0.039928 -0.021853 0.074091 0.084789 
+0.020853 -0.007579 0.017575 -0.082903 -0.016044 
+0.033216 -0.023150 0.052294 0.018359 -0.025699 
+-0.035371 -0.079831 0.144398 -0.041178 0.060835 
+-0.045799 -0.044320 0.000953 0.061485 -0.045374 
+-0.093964 0.068302 -0.076466 0.119176 -0.014095 
+-0.009224 0.091475 -0.038545 0.004967 0.001667 
+0.028758 -0.091372 -0.095792 -0.025909 0.005482 
+0.031234 -0.025637 -0.021291 0.135677 0.020946 
+0.107580 0.013372 -0.085671 0.020971 -0.038560 
+0.038570 -0.017209 0.045906 0.060269 0.001966 
+0.032650 -0.006186 -0.072219 -0.189856 -0.007205 
+-0.015639 -0.055057 -0.065552 -0.053151 -0.128235 
+-0.012954 0.084159 0.026617 0.003305 -0.085995 
+0.047267 -0.020931 0.007625 -0.078957 0.121974 
+0.045764 0.005225 -0.141436 0.003027 0.051391 
+-0.036784 -0.001419 -0.053342 0.051094 0.015725 
+-0.019096 -0.002840 0.026380 -0.069790 -0.184245 
+-0.051566 -0.028396 0.071692 0.098005 -0.020301 
+0.016438 -0.046403 0.001404 -0.000052 -0.054688 
+-0.022357 0.007259 0.085506 0.017935 -0.014656 
+0.098405 0.054979 0.035010 0.075368 0.047790 
+0.037848 0.078374 -0.058610 0.016057 0.084829 
+0.041381 0.045231 -0.121185 -0.048619 0.095037 
+0.078616 0.022570 0.039332 0.081333 -0.008814 
+0.036266 0.020667 0.051651 0.048340 -0.014173 
+0.001842 -0.015009 0.034124 0.017931 0.056477 
+0.124333 0.001687 -0.029607 -0.069722 0.024592 
+-0.008487 -0.136955 -0.020417 0.039039 -0.063902 
+-0.051767 -0.039427 -0.040545 0.032784 0.056740 
+-0.001091 0.036666 0.028260 -0.081961 0.033769 
+0.027067 0.018663 -0.038013 0.000810 -0.051724 
+-0.017021 -0.083432 -0.113410 0.025947 0.004457 
+-0.019510 -0.003952 0.096457 -0.087833 -0.033332 
+0.032633 -0.028593 0.053980 0.004859 0.027062 
+0.027726 -0.054113 0.046789 -0.047480 -0.022139 
+0.006309 0.013074 0.001745 0.000719 -0.068648 
+-0.039339 0.124991 -0.017031 0.104387 0.075424 
+-0.064776 0.049930 0.021317 -0.031441 0.064129 
+-0.081324 -0.071417 -0.036637 -0.054516 0.069005 
+-0.034336 -0.097799 0.042552 0.103137 0.014131 
+0.086508 0.031131 -0.032366 0.059489 -0.003838 
+-0.064570 -0.002930 0.012624 0.042919 0.062446 
+0.044061 0.055589 0.003834 -0.094630 0.085990 
+-0.053889 -0.024564 -0.026389 -0.016842 -0.060025 
+-0.074654 0.030141 -0.008240 -0.045068 -0.051917 
+-0.152218 0.035234 0.028967 0.032527 0.062252 
+0.000908 -0.036356 -0.081610 -0.001575 0.014623 
+-0.004478 0.064008 -0.087800 0.081273 -0.017113 
+-0.018705 0.033443 -0.058350 -0.122667 -0.057365 
+0.033540 -0.050441 0.124594 0.013386 0.053846 
+-0.043376 -0.002266 -0.008195 -0.033995 0.053108 
+-0.040370 -0.064239 0.077268 -0.002621 -0.059563 
+-0.046177 0.004964 0.033231 0.064375 0.001192 
+0.114583 -0.058848 0.061280 0.006693 0.036098 
+0.009875 0.035834 -0.018310 -0.036184 -0.014992 
+0.069939 0.059780 0.016602 0.073982 -0.035990 
+-0.015685 0.078068 0.050322 -0.088097 -0.105328 
+-0.025670 -0.057722 -0.013893 0.006662 0.048590 
+0.078264 0.016992 -0.038464 -0.047615 0.099275 
+0.010093 -0.039867 0.011067 -0.011289 0.010908 
+-0.115702 0.003261 0.019257 -0.044432 0.040269 
+0.018630 0.024500 0.039527 -0.019008 0.039507 
+-0.072659 0.078072 -0.050083 -0.037195 -0.134288 
+0.019462 0.000276 -0.077134 0.027231 0.091209 
+-0.050042 -0.033161 0.001557 -0.033891 -0.049683 
+0.056345 -0.048181 0.069910 -0.020048 -0.046249 
+-0.039646 -0.128983 0.089155 -0.075828 0.037947 
+0.004400 0.018311 0.016766 0.013464 -0.103994 
+-0.006838 0.049909 0.006876 0.039950 0.026768 
+0.027940 0.106751 -0.086738 -0.030655 -0.023916 
+0.054319 -0.087527 -0.016511 -0.107128 0.027059 
+-0.002389 0.030765 0.000550 0.071481 0.033998 
+0.036687 0.048116 0.010056 -0.080424 -0.053276 
+-0.000327 -0.054330 0.094151 0.063155 0.020931 
+-0.026860 0.016310 -0.024435 -0.073159 0.050455 
+0.022409 -0.008454 -0.035545 0.054995 -0.048738 
+-0.044119 0.073997 0.039168 -0.014561 -0.032013 
+0.028242 0.039841 0.075847 -0.017028 0.060085 
+-0.021478 0.038475 -0.145149 -0.060014 -0.014315 
+0.056108 0.032615 -0.097225 0.033835 0.051055 
+0.042640 0.045231 0.000360 -0.041305 -0.108117 
+-0.023348 -0.045772 0.038096 0.000486 -0.013393 
+-0.093532 0.016559 0.001345 -0.008241 -0.068229 
+0.010724 0.006837 0.077785 0.024403 -0.089797 
+0.019810 0.041552 0.064900 0.067216 0.122533 
+-0.033019 0.073688 0.001023 0.040220 0.079306 
+-0.033084 -0.028731 -0.066533 0.015167 0.078774 
+0.036633 -0.011276 -0.029348 0.033478 0.000076 
+-0.011424 0.089071 0.107503 -0.027201 -0.024133 
+-0.086237 -0.015807 0.067867 -0.026911 0.055025 
+0.003279 -0.076609 -0.022878 -0.065051 0.117459 
+-0.064757 -0.048837 -0.006132 0.015775 -0.025174 
+-0.012054 -0.017396 -0.008215 0.026521 -0.033990 
+0.045441 0.100425 0.005545 -0.063862 0.021216 
+0.038286 0.073333 -0.080698 0.015085 -0.070552 
+-0.073377 -0.065780 -0.028242 0.031930 0.034800 
+0.014232 0.011229 0.097374 -0.050100 -0.132752 
+0.011148 -0.042578 0.076114 0.024497 -0.012283 
+0.120806 -0.036672 0.010487 -0.089491 -0.070409 
+-0.010691 -0.003941 0.028773 0.005044 -0.130679 
+0.045320 0.101038 0.007190 0.023122 -0.032858 
+0.071021 0.085183 -0.064280 -0.039826 0.069093 
+-0.045199 -0.056327 -0.038230 -0.030074 0.020018 
+0.043187 -0.037153 0.053548 0.081616 -0.046930 
+0.041026 -0.013232 -0.029798 -0.007515 -0.009780 
+-0.014618 -0.049999 0.086479 -0.000441 0.122169 
+0.000547 -0.072517 0.024520 -0.173329 0.033337 
+-0.032822 -0.039451 -0.029459 -0.010553 -0.014511 
+-0.042816 0.043535 0.098090 -0.011974 -0.009803 
+-0.011320 0.103835 0.068587 0.016565 0.009926 
+-0.038017 -0.036161 -0.141386 -0.056138 -0.087531 
+0.012520 0.001341 -0.028710 0.134825 -0.022612 
+0.025072 0.059725 -0.059548 -0.077144 -0.055577 
+0.008583 0.014431 0.160366 -0.000317 0.069355 
+0.021539 -0.030848 -0.001411 0.003884 -0.021168 
+-0.002315 -0.031485 0.058421 -0.069080 -0.089460 
+-0.074381 0.044224 0.078251 0.015334 -0.018453 
+0.024757 -0.006325 -0.030304 0.041022 0.051034 
+-0.000912 0.014462 -0.042230 -0.034329 0.049998 
+0.042384 0.055463 -0.026732 0.016663 -0.070257 
+0.027628 0.032582 0.025606 0.007339 -0.016995 
+-0.014641 -0.013348 -0.035777 -0.048054 0.072409 
+0.073357 0.019992 -0.053669 -0.099428 0.009662 
+0.053875 -0.084206 -0.028164 0.001825 -0.007384 
+-0.118351 0.036128 -0.052874 0.044796 -0.008440 
+0.034462 0.021959 0.038695 -0.029505 -0.010005 
+0.006580 -0.019193 -0.033304 -0.006948 -0.032920 
+-0.035370 -0.048525 -0.089756 0.086975 0.071726 
+-0.061466 -0.022927 0.037104 -0.115937 -0.074302 
+0.095124 0.034074 0.041596 -0.019002 -0.078886 
+-0.046289 -0.026431 0.075125 -0.085653 0.030848 
+-0.087457 -0.013738 -0.079060 0.085171 -0.076996 
+-0.026743 0.040359 0.001789 0.092574 -0.022293 
+0.036215 0.020128 -0.057905 0.020242 0.017234 
+-0.015028 -0.102072 -0.050335 -0.106620 -0.024631 
+-0.035796 -0.019773 0.029319 0.102570 0.030958 
+0.052784 0.035726 -0.058017 -0.006419 -0.004020 
+-0.014277 -0.047373 0.048700 0.111928 0.002486 
+0.008505 0.051728 -0.097055 -0.122271 0.071235 
+0.003188 -0.039588 -0.076039 0.021148 -0.078617 
+-0.065872 0.029089 -0.000290 0.000898 -0.140194 
+0.058506 -0.007075 0.002829 -0.061576 0.057297 
+0.022539 -0.043176 -0.078264 -0.026623 0.050164 
+-0.067814 0.043950 -0.089140 0.025451 0.015987 
+-0.021710 -0.023764 -0.037703 -0.092210 -0.086925 
+-0.088289 0.020833 0.085474 0.007660 0.032167 
+-0.047200 -0.148647 -0.011014 -0.056924 -0.066650 
+0.000222 0.031116 0.120665 0.017924 -0.052237 
+0.024475 0.057260 0.023098 0.039613 0.002833 
+0.015113 0.005702 -0.065102 0.150484 0.040642 
+-0.062865 0.018220 -0.104305 -0.058038 0.078032 
+0.062938 -0.043059 -0.041551 0.090274 -0.090255 
+0.003055 0.024771 0.053662 0.023982 -0.007128 
+-0.022873 0.016118 0.029948 -0.005441 0.027042 
+0.035737 -0.062768 0.026554 -0.001648 0.046026 
+-0.015209 -0.061640 0.080279 0.035525 -0.062174 
+-0.071438 -0.038252 0.017523 0.005805 0.027560 
+0.022277 0.116677 0.082862 -0.023075 0.020718 
+0.028369 -0.000644 -0.106525 -0.000025 -0.058375 
+0.061774 -0.034461 -0.117604 0.015663 0.025243 
+0.050739 -0.035373 0.050164 -0.097896 -0.016953 
+-0.005625 -0.011887 0.038968 0.009589 0.020354 
+0.073417 -0.037194 0.001085 -0.082529 -0.002741 
+0.018895 0.000683 -0.005260 0.037680 -0.057914 
+0.012065 0.095507 -0.006422 0.038327 0.053359 
+-0.034912 0.104532 -0.034267 -0.091475 -0.037716 
+-0.084581 -0.011088 -0.054143 0.048128 0.015983 
+0.020394 -0.028289 -0.010829 0.083357 -0.051892 
+0.095076 0.000131 -0.014931 0.032836 0.067972 
+-0.033453 -0.011655 0.043489 0.044985 0.063936 
+-0.002184 -0.038102 0.055724 -0.108760 -0.005538 
+-0.065997 0.004333 -0.074726 -0.015630 -0.015614 
+-0.126012 0.028542 0.044984 -0.082637 -0.073741 
+-0.053097 0.043995 0.064370 -0.042989 0.078666 
+0.032226 -0.050840 -0.030220 -0.007436 -0.034516 
+0.018953 0.031855 -0.118774 0.087949 -0.022126 
+-0.018807 0.026136 -0.060837 -0.058430 -0.043270 
+-0.023841 -0.001635 0.100076 -0.051546 0.008906 
+-0.018942 -0.046607 -0.031680 -0.056224 0.042606 
+0.027052 -0.054425 0.104195 -0.058465 -0.062190 
+-0.009973 0.010150 0.018185 0.049565 -0.005886 
+0.094118 0.002006 0.034862 -0.013054 0.093378 
+-0.068149 0.010758 -0.011233 -0.061272 0.036668 
+0.049859 -0.008436 0.036689 0.126919 -0.002194 
+0.048726 0.081941 -0.048791 -0.035094 -0.075793 
+0.038586 -0.043391 0.024660 0.042400 0.074817 
+0.074537 0.022976 -0.091022 -0.044301 0.025592 
+0.019796 -0.129796 0.029916 0.017043 -0.041798 
+-0.122413 0.049991 0.006262 -0.014011 -0.015763 
+-0.024958 0.007419 0.020053 -0.006102 -0.004461 
+-0.047792 0.040663 -0.058097 0.018616 -0.023217 
+0.001382 0.001452 -0.062222 0.051898 0.052539 
+-0.068723 -0.000916 0.071418 -0.060541 -0.020258 
+0.063725 0.074490 0.080845 -0.023018 -0.006902 
+-0.045143 -0.078702 0.018868 -0.044159 0.011980 
+0.025938 0.021655 0.025290 0.063764 -0.132708 
+-0.035846 0.091140 -0.021667 0.037332 0.035687 
+-0.056994 0.140855 -0.102945 -0.006009 0.023620 
+0.000204 -0.022699 -0.019046 -0.095351 0.050022 
+-0.004054 -0.019058 -0.006429 0.068069 0.054649 
+0.022500 0.029309 0.030159 -0.011081 -0.085224 
+-0.029775 -0.097594 0.132106 0.026943 0.016069 
+-0.012230 0.046209 -0.034177 -0.048993 0.094154 
+-0.006547 -0.043268 -0.100110 0.130569 -0.083928 
+0.008317 0.041995 -0.020555 0.004803 -0.056359 
+0.023566 0.050093 0.044221 0.017323 0.073761 
+0.000300 -0.034851 -0.062557 0.003592 -0.037316 
+-0.023709 -0.011929 -0.063727 0.008558 0.029238 
+0.012654 0.027199 -0.057145 -0.011774 -0.078417 
+-0.053560 -0.003741 0.037455 -0.039273 -0.042025 
+-0.002715 -0.030644 0.024806 0.010899 -0.041167 
+0.026322 -0.013442 0.040313 0.057461 -0.057587 
+0.046460 0.004776 0.094893 0.063931 -0.013181 
+-0.024787 0.046427 0.000830 0.004541 0.070036 
+0.012732 0.022279 -0.046965 -0.012615 0.106753 
+0.032489 -0.016696 -0.061242 0.021789 -0.044774 
+0.022712 0.030946 0.067933 -0.021075 -0.043324 
+-0.010231 -0.077078 0.089327 -0.073913 0.129378 
+0.001532 -0.043316 -0.016732 -0.026599 0.046714 
+-0.088765 -0.101898 -0.000950 -0.012357 0.078311 
+-0.025387 -0.053598 0.022292 0.050494 -0.007031 
+0.067206 0.032304 -0.012170 -0.015225 0.029593 
+-0.011657 0.043622 -0.062834 0.042909 0.003119 
+-0.005148 -0.106709 0.013981 0.016710 0.024731 
+-0.050424 0.039756 0.053237 -0.088869 -0.030557 
+0.019223 -0.011248 0.001772 0.041389 -0.019693 
+0.032684 -0.038816 -0.003782 -0.038112 -0.064818 
+-0.036779 0.002321 -0.011310 -0.005428 -0.097258 
+-0.068507 0.117705 0.010296 0.057410 -0.042191 
+0.060044 0.076100 0.070634 -0.052272 0.109450 
+-0.024491 -0.060570 -0.062604 -0.023828 0.043683 
+-0.008675 0.020641 0.026445 0.122122 -0.030590 
+0.007406 -0.006945 -0.038838 0.022271 0.036487 
+-0.008083 -0.015591 0.089045 0.103083 0.080265 
+0.048011 0.008577 -0.024779 -0.098878 0.047757 
+-0.034944 -0.071262 -0.029632 0.058633 -0.031833 
+-0.086670 0.020910 0.017850 -0.060040 -0.000118 
+0.072375 0.123805 0.028335 0.006174 0.050778 
+0.022055 -0.013090 -0.021358 -0.030207 -0.129857 
+-0.009686 -0.036702 -0.094352 0.083990 -0.027328 
+0.022973 0.088840 -0.029830 -0.041108 0.007991 
+0.010351 0.043580 0.088045 0.019792 0.034260 
+-0.018485 -0.026954 0.001393 -0.028881 -0.009226 
+-0.007746 -0.080511 -0.012092 -0.026729 -0.115592 
+-0.019491 0.098337 0.046778 0.072298 -0.078237 
+0.005173 0.056223 -0.004141 0.066867 0.056189 
+0.017966 0.044171 0.000676 -0.045110 0.018200 
+0.032009 0.030245 -0.024198 0.053369 -0.032949 
+0.005817 0.101192 0.004770 -0.022792 0.027114 
+0.010600 -0.037525 -0.040021 0.003401 0.139637 
+0.013348 -0.003801 -0.031619 -0.055232 -0.000905 
+0.059632 -0.125609 -0.015414 0.054802 -0.053951 
+-0.064755 0.024768 0.023636 0.018903 -0.000431 
+-0.029042 0.021020 0.004843 -0.036543 -0.029041 
+-0.023141 0.025949 -0.071411 -0.019207 0.007088 
+0.038696 -0.038765 -0.019290 0.071608 0.100669 
+0.002161 -0.019148 -0.033723 -0.110313 -0.048374 
+0.036294 -0.011707 0.027523 -0.005146 -0.049367 
+-0.011778 -0.100402 0.063310 -0.031106 0.021885 
+-0.095761 -0.080098 0.004308 0.033965 -0.080439 
+-0.023927 0.055660 0.007395 0.124410 -0.073291 
+0.004189 0.060944 -0.045152 -0.060831 0.024748 
+0.002404 -0.137119 -0.070340 -0.011515 -0.026093 
+0.074911 -0.008646 -0.046756 0.070610 0.043733 
+0.056208 -0.004307 -0.017910 -0.044341 -0.049322 
+-0.031960 -0.031297 0.041787 0.064553 0.010380 
+-0.009674 -0.056380 -0.131194 -0.102372 0.013069 
+-0.040055 -0.101666 -0.095641 0.031396 -0.040243 
+-0.044960 0.107223 -0.038146 0.043004 -0.091273 
+0.008832 0.035095 0.018303 -0.033024 0.111336 
+-0.012516 -0.088527 -0.138520 -0.042476 0.043839 
+-0.066586 0.012378 -0.100214 0.030453 -0.045537 
+-0.058136 -0.024370 0.006936 -0.057720 -0.111712 
+-0.062832 -0.049461 0.055617 0.032267 -0.008208 
+-0.024939 -0.062605 0.007490 -0.019889 -0.032406 
+-0.002685 -0.018727 0.104523 0.024688 -0.046299 
+0.058710 0.060194 0.045739 0.021202 -0.014056 
+0.012044 0.058266 -0.001396 0.021628 0.093785 
+-0.015184 0.056542 -0.100357 0.020669 0.075524 
+0.037202 -0.028476 -0.004358 0.088662 -0.013431 
+0.058653 0.069303 0.068988 0.033660 -0.062939 
+0.018950 -0.056021 0.021534 -0.016087 0.075798 
+0.048597 -0.010444 0.007248 -0.063630 0.010521 
+-0.014106 -0.074996 -0.000773 0.053311 -0.048215 
+-0.002735 -0.017992 -0.002647 0.020040 0.029636 
+-0.022757 0.078272 0.023803 -0.057204 0.024134 
+0.064828 0.052842 -0.109740 -0.016306 -0.097522 
+0.035253 -0.097609 -0.069816 0.027249 0.039346 
+-0.007883 0.014192 0.087185 -0.137182 -0.071137 
+0.013525 0.010840 0.070855 0.012224 0.018564 
+-0.008135 -0.046474 0.058225 -0.040550 -0.011424 
+-0.027632 -0.035317 0.023198 0.038554 -0.081506 
+-0.012968 0.096501 0.027391 0.100326 0.005492 
+-0.058045 0.112112 0.002180 -0.025343 0.025626 
+-0.099536 -0.061595 -0.061651 -0.027489 -0.010581 
+-0.017782 -0.053973 -0.034355 0.078629 0.008211 
+0.072702 0.071223 -0.044680 0.012444 -0.044745 
+-0.139050 0.003441 0.000913 0.094752 0.048346 
+-0.007363 0.025892 0.010184 -0.176655 0.133261 
+0.001621 -0.024628 -0.030137 -0.007947 -0.085652 
+-0.029719 0.022053 0.013686 -0.080132 -0.026124 
+-0.070528 0.051163 0.066954 0.055796 0.025845 
+-0.010124 -0.065017 -0.069344 -0.022724 -0.000369 
+0.053467 0.016636 -0.040196 0.075376 -0.016667 
+-0.029877 0.004811 -0.023632 -0.097696 0.009076 
+0.002224 -0.010353 0.064867 -0.044772 0.077105 
+-0.055734 -0.018593 0.032803 -0.059184 0.036008 
+-0.007975 -0.100334 0.044830 -0.020643 -0.039421 
+-0.010042 0.007773 0.099620 0.108164 0.029716 
+0.078106 -0.011285 0.030783 0.081425 0.047785 
+-0.040324 0.065464 -0.037268 -0.020200 -0.013981 
+0.005168 0.027259 -0.021859 0.088221 -0.057304 
+0.044425 0.092606 0.044230 -0.055754 -0.033767 
+-0.019787 -0.048782 0.003298 0.018153 0.021226 
+0.068475 -0.047841 -0.084262 -0.076417 0.054885 
+-0.017738 -0.064677 -0.017373 -0.033227 -0.010808 
+-0.146013 0.005243 -0.037539 -0.015601 0.022925 
+-0.011193 0.044758 0.012972 -0.010808 0.024612 
+-0.056295 0.056909 -0.080235 -0.047137 -0.029242 
+0.056368 -0.002198 -0.035936 0.027306 0.075325 
+-0.064563 0.000437 -0.011783 -0.026348 -0.005163 
+0.082637 0.004076 0.084051 -0.032954 0.031309 
+-0.006451 -0.094091 0.012843 -0.029321 0.020598 
+0.015005 -0.014363 0.013016 0.075182 -0.086563 
+-0.024242 0.085406 -0.009668 0.002995 0.003827 
+0.027577 0.119405 -0.019147 0.005101 -0.010265 
+0.032537 -0.051797 -0.040632 -0.068586 0.019971 
+-0.056266 0.018425 -0.035550 0.044019 -0.018450 
+0.013988 -0.007499 -0.030389 -0.047227 -0.036402 
+-0.019853 -0.021715 0.089123 0.033422 0.051031 
+-0.043643 0.004053 0.039026 -0.092898 0.069717 
+0.002242 -0.073405 -0.022716 0.065550 -0.109492 
+-0.065737 0.051307 -0.007900 -0.001899 -0.038721 
+0.061064 0.068115 0.108020 -0.005186 0.091419 
+0.038141 0.068502 -0.119719 -0.032776 -0.034200 
+0.022829 0.022600 -0.114802 0.021444 0.011983 
+-0.010708 0.025008 0.016734 -0.058795 -0.121062 
+-0.020649 -0.036630 0.056523 -0.002163 0.027921 
+-0.063293 0.012239 0.014511 0.034178 -0.056068 
+-0.063080 0.014943 0.080895 0.063737 -0.133859 
+0.016385 0.042840 0.046425 0.058005 0.035977 
+-0.084512 0.057576 -0.010982 0.060681 0.072678 
+-0.008045 0.001068 -0.085375 -0.058554 0.098160 
+0.011639 0.009086 -0.053064 0.074379 -0.027243 
+-0.013015 0.121189 0.047177 -0.009998 -0.034644 
+-0.007092 -0.012841 0.075861 0.011568 0.086842 
+0.045432 -0.079240 -0.025773 -0.009674 0.064448 
+-0.018079 -0.118996 0.009565 -0.016846 -0.011029 
+-0.006024 0.033095 0.005964 -0.000340 -0.012580 
+0.081590 0.052148 -0.008312 -0.076947 0.027736 
+0.018812 0.136957 -0.054412 -0.040884 -0.124297 
+-0.047994 -0.081925 -0.033440 0.118449 0.044842 
+0.004569 -0.006306 0.075165 -0.038914 -0.081500 
+0.038445 -0.078834 0.047793 -0.013885 0.006954 
+0.039465 -0.031245 0.038253 -0.039471 -0.057441 
+0.034043 -0.029460 0.017171 0.000194 -0.094801 
+0.013428 0.116396 0.026097 0.041725 0.007773 
+-0.017706 0.115162 -0.031613 -0.010630 0.042917 
+-0.039768 -0.139730 -0.048469 -0.000045 0.028945 
+-0.004139 -0.081954 0.003386 0.115256 -0.049927 
+0.077924 0.020540 -0.017751 0.003371 -0.011666 
+-0.022988 -0.072458 0.027132 0.049961 0.112610 
+0.047083 -0.041033 0.043690 -0.084367 0.071528 
+-0.011307 -0.010002 -0.059736 0.049793 -0.043057 
+-0.038207 0.109289 0.066216 -0.043249 -0.011953 
+-0.042904 0.111380 0.021751 0.023150 0.051803 
+-0.041532 -0.082754 -0.165799 -0.145192 -0.159015 
+-0.036957 -0.008840 -0.028641 0.105964 0.006864 
+0.029247 0.059193 0.009831 -0.144329 -0.047501 
+-0.014033 0.041089 0.095670 -0.051674 0.049619 
+0.031086 -0.026835 -0.015872 -0.041019 -0.016594 
+-0.047321 -0.050941 0.108942 -0.059399 -0.094262 
+-0.082008 0.021291 0.061910 0.073377 -0.015244 
+0.057463 0.023209 -0.065966 0.034032 0.111775 
+-0.021516 0.014300 -0.031041 -0.012892 0.024486 
+0.045971 0.041949 0.025017 -0.003197 -0.044689 
+0.046157 0.053074 -0.010276 -0.022357 0.014208 
+-0.059017 -0.049325 0.007655 0.034365 0.071554 
+0.043755 -0.026127 -0.068545 -0.041093 -0.027706 
+0.042534 -0.059878 -0.006088 0.036135 -0.000512 
+-0.141426 0.019792 0.031442 0.038225 -0.087692 
+-0.006095 0.062862 0.064053 -0.026935 -0.004107 
+-0.015518 0.018237 -0.054342 0.025962 -0.043604 
+-0.041405 -0.044407 -0.066543 0.052842 0.123468 
+0.018775 -0.097456 0.021557 -0.111244 -0.022276 
+0.087995 0.020846 0.009786 -0.024442 -0.000924 
+-0.021387 -0.115466 0.059505 -0.084840 -0.018622 
+-0.039091 0.041857 -0.059951 0.027552 -0.106180 
+-0.013005 0.077819 -0.057001 0.037112 -0.006017 
+0.017069 0.035373 -0.036667 0.041547 0.030229 
+-0.017543 -0.020408 -0.084738 -0.062925 -0.014286 
+-0.003367 -0.001926 0.040560 0.163635 0.057733 
+0.052600 0.014935 -0.041074 -0.038673 -0.009607 
+0.035704 -0.049327 0.051517 0.079677 0.024194 
+-0.021034 -0.014069 -0.062355 -0.078356 0.049042 
+-0.028768 -0.088463 -0.035194 0.027880 -0.078732 
+-0.051166 0.029644 0.064622 -0.002258 -0.067584 
+0.014417 0.014299 0.025278 -0.095873 0.081486 
+0.018230 -0.014653 -0.093112 -0.067755 0.006200 
+-0.038621 0.033831 -0.065313 0.022443 0.016583 
+-0.013554 -0.003383 -0.003813 -0.038565 -0.079906 
+-0.054026 -0.097241 0.089312 -0.012968 0.081033 
+-0.047581 -0.080574 -0.024559 -0.018898 -0.082106 
+0.008601 -0.028523 0.100338 0.112593 -0.048526 
+0.027421 0.024654 -0.000988 0.060571 -0.007538 
+0.008276 0.041800 -0.035683 0.044325 0.088914 
+0.019003 0.052585 -0.106627 -0.043862 0.018154 
+0.061095 -0.055270 -0.060593 0.071565 -0.023743 
+-0.010098 0.052293 0.067864 0.013882 -0.062200 
+-0.017320 0.007520 -0.015594 -0.023894 0.092727 
+0.029631 -0.013572 0.043058 -0.024937 0.054426 
+-0.006383 -0.060407 0.031096 0.077251 -0.051193 
+-0.028054 0.013443 -0.006446 0.025674 0.011140 
+0.025108 0.078829 0.096347 -0.120869 0.009600 
+-0.016833 -0.041386 -0.147598 0.012379 -0.080149 
+-0.001507 -0.061584 -0.069511 0.053464 -0.028698 
+0.050460 0.034750 0.053162 -0.062058 -0.000099 
+0.013018 -0.014428 0.008787 -0.021213 0.031728 
+0.032305 -0.106213 0.027220 -0.042487 -0.013001 
+0.042839 -0.025383 -0.014866 0.006080 -0.055914 
+-0.004772 0.111496 -0.048142 0.101228 -0.000113 
+-0.007065 0.108619 -0.026644 -0.081066 0.026279 
+-0.049199 0.003818 -0.043697 0.009844 0.051099 
+-0.021007 -0.012906 -0.013888 0.109787 -0.054136 
+0.054741 0.002659 -0.080186 0.041342 -0.004960 
+-0.009585 -0.090940 0.035445 0.084784 0.071802 
+0.004212 0.000051 0.061246 -0.179092 0.004524 
+-0.066032 -0.062309 -0.052999 0.003717 -0.054731 
+-0.063044 0.065802 0.005675 -0.083010 0.009338 
+-0.050599 0.044865 0.069794 0.035892 0.069365 
+0.077322 -0.037515 -0.101389 -0.032958 -0.023327 
+0.004893 0.076975 -0.094625 0.108672 -0.084543 
+0.029133 0.033581 -0.097391 -0.099645 -0.008470 
+0.047506 0.014070 0.037599 -0.039370 0.027529 
+-0.037487 -0.030513 0.001358 -0.109004 0.006393 
+0.046480 -0.005807 0.072837 -0.015338 -0.034187 
+-0.036067 0.007979 0.057660 0.043930 0.022410 
+0.054219 -0.000956 0.022423 0.048054 0.091746 
+-0.006642 0.030166 -0.048592 -0.040789 -0.005702 
+0.007988 0.043955 -0.019103 0.106518 0.024012 
+0.042589 0.059798 -0.006033 -0.026617 -0.048288 
+0.015792 -0.114984 0.000601 -0.000354 0.067489 
+0.038969 0.014313 -0.064460 -0.002179 0.051347 
+-0.002092 -0.105852 -0.031092 -0.032437 -0.000174 
+-0.128927 -0.008284 -0.009141 -0.076672 -0.015283 
+-0.049413 0.056280 0.045565 -0.006905 0.022082 
+-0.085801 0.050952 -0.050910 -0.017483 0.005888 
+-0.006170 -0.061465 -0.030951 0.035802 0.015739 
+-0.083792 -0.044795 0.060723 -0.030343 -0.069566 
+0.030676 0.038387 0.050804 0.004892 0.017579 
+-0.044803 -0.090476 -0.017970 -0.069598 0.035520 
+0.006056 0.044354 -0.061744 0.058806 -0.130744 
+-0.057101 0.099578 -0.045874 -0.002499 0.046826 
+0.049723 0.098173 -0.082881 0.073610 -0.011594 
+-0.009669 -0.094859 -0.037445 -0.119323 0.065051 
+-0.015284 -0.026778 0.005845 0.048246 0.025717 
+0.028300 0.003404 -0.007273 -0.021871 -0.079752 
+-0.013062 -0.126858 0.059483 0.049526 0.036093 
+-0.056998 -0.003159 -0.043116 -0.016197 0.089723 
+0.016100 -0.051512 -0.060459 0.061427 -0.060520 
+-0.010836 0.070291 -0.004533 0.015834 -0.031588 
+0.046681 0.024603 0.057986 -0.000132 0.098934 
+-0.017240 0.002476 -0.113392 0.016989 0.001335 
+-0.009243 0.021430 -0.088867 0.016496 0.036539 
+-0.024722 0.027988 -0.025209 -0.037811 -0.070416 
+-0.027312 -0.042762 0.085979 -0.017748 0.001795 
+-0.038652 -0.032652 0.049244 -0.003571 -0.092866 
+0.021843 -0.080697 0.081009 0.019897 -0.063178 
+0.025596 0.016382 0.119656 0.092436 -0.016244 
+-0.023622 -0.006095 -0.013438 0.039393 0.098847 
+0.026872 0.057469 -0.033557 -0.019961 0.171557 
+0.009244 -0.003066 -0.087323 0.039711 -0.024124 
+0.027198 0.088494 0.108382 0.011044 -0.127500 
+-0.035575 -0.083203 0.035144 -0.032137 0.120334 
+0.002031 -0.020743 0.003890 -0.046130 0.060318 
+-0.032118 -0.093914 0.036450 0.036482 -0.003628 
+-0.045976 -0.020514 0.020744 0.028721 0.002437 
+0.114939 0.051708 0.055899 -0.024311 0.024351 
+-0.064421 0.084144 -0.108787 0.030475 -0.042867 
+0.008077 -0.063222 -0.026071 0.061247 -0.016598 
+0.011100 0.007787 0.023799 -0.068735 -0.056142 
+0.025938 -0.060156 0.050084 0.037444 -0.022008 
+0.010303 -0.098972 -0.052827 -0.061667 -0.068986 
+-0.011902 -0.042759 -0.084042 -0.002067 -0.151469 
+-0.017637 0.134014 -0.026226 0.026110 0.007490 
+0.021463 0.079145 0.014098 -0.019123 0.079837 
+-0.010640 -0.040407 -0.116967 -0.015889 0.022180 
+-0.005119 -0.014871 0.057013 0.068658 -0.079078 
+0.058641 -0.006509 -0.034086 -0.022005 0.041557 
+0.016029 -0.003335 0.062705 0.037826 0.092035 
+0.047014 0.007296 -0.014070 -0.130533 -0.001078 
+0.025557 -0.063677 -0.037435 0.030993 -0.040663 
+-0.133077 0.001203 0.087675 -0.028956 0.005954 
+0.030377 0.094103 0.031530 0.029501 0.058250 
+0.043750 0.005780 -0.081652 -0.046912 -0.071344 
+0.049909 -0.017203 -0.105850 0.077672 0.063239 
+0.015203 0.080354 -0.019175 -0.126004 0.012938 
+0.004638 -0.013389 0.087621 -0.010466 0.023940 
+-0.002703 -0.035427 -0.059936 -0.035946 0.018749 
+0.025763 -0.100231 0.035256 0.021093 -0.102097 
+-0.023912 0.065319 0.051327 0.052308 0.008324 
+0.018600 0.027370 -0.019629 0.003753 0.074711 
+-0.009465 0.042899 -0.007945 -0.044091 0.057014 
+0.043860 0.063015 -0.053778 0.033882 -0.018588 
+-0.007623 0.070289 0.017506 -0.028443 -0.016436 
+-0.016131 -0.087520 -0.000211 0.013207 0.081102 
+0.026870 0.010280 -0.039354 -0.085402 0.005385 
+0.045387 -0.075274 0.005158 0.013437 -0.061107 
+-0.123832 -0.006790 0.046660 0.021633 0.005414 
+-0.004335 -0.011498 0.029755 -0.025547 -0.002465 
+0.008431 0.032361 -0.039776 0.018846 -0.007647 
+-0.002531 -0.054317 -0.034538 0.095049 0.040090 
+-0.016239 -0.046115 0.006000 -0.083863 -0.018887 
+0.001956 -0.005777 0.053960 0.003049 -0.028290 
+-0.017755 -0.044904 0.084936 -0.038020 0.048751 
+-0.036897 -0.069299 0.003508 0.029780 -0.079610 
+-0.085660 0.060685 -0.006321 0.078501 0.006878 
+-0.000940 0.062341 -0.042279 -0.015673 0.013762 
+-0.029805 -0.051092 -0.117256 -0.046978 -0.012383 
+0.024326 -0.000611 -0.046838 0.087711 0.032932 
+0.089398 -0.013201 -0.035642 -0.013591 -0.019974 
+0.002673 -0.016622 0.070976 0.074861 0.005584 
+0.013705 0.013057 -0.070513 -0.132482 0.011905 
+-0.021242 -0.092172 -0.098335 -0.045995 -0.077946 
+-0.013171 0.148310 0.023267 -0.011841 -0.094360 
+-0.008329 0.001195 -0.000926 -0.099253 0.141073 
+0.039201 0.001784 -0.135018 -0.082677 0.044641 
+-0.005949 -0.030037 -0.085312 0.049127 0.014847 
+-0.013469 -0.002593 -0.056090 -0.045962 -0.191274 
+-0.041064 -0.030590 0.082413 0.061704 0.022132 
+0.035533 -0.066234 0.034454 -0.009588 -0.050467 
+-0.029761 -0.016491 0.067872 0.038969 -0.039014 
+0.057543 0.047087 0.043850 0.039443 0.054508 
+0.058856 0.109195 -0.043374 0.070615 0.089501 
+0.024405 0.045632 -0.080334 -0.004657 0.067992 
+0.068464 -0.013325 0.052791 0.040606 -0.016031 
+0.043482 0.025913 0.030708 0.051020 -0.058413 
+0.012923 -0.031961 -0.001425 0.025659 0.065492 
+0.081425 -0.018210 0.009682 -0.008238 0.027227 
+-0.047221 -0.123710 0.027984 0.046569 -0.051906 
+-0.013099 -0.010653 -0.030766 0.027285 0.060770 
+-0.039564 0.053122 0.066810 -0.114075 0.054466 
+0.054259 0.024216 -0.045685 -0.001518 -0.082578 
+-0.026337 -0.055608 -0.075956 0.054064 0.026871 
+0.015694 0.016757 0.129806 -0.052800 -0.016678 
+0.048569 -0.001337 0.027199 0.004454 0.027064 
+0.019218 -0.065149 0.034752 -0.071056 -0.047284 
+-0.001601 -0.021741 0.012135 -0.006775 -0.080880 
+-0.033474 0.068299 0.002424 0.082260 0.038960 
+-0.030455 0.105682 0.013086 -0.054492 0.067646 
+-0.084988 -0.031769 -0.005191 -0.045479 0.025036 
+-0.054564 -0.097375 0.013290 0.107239 -0.037042 
+0.136211 0.054048 -0.044849 0.071688 0.021370 
+-0.065162 -0.020715 -0.035790 0.090635 0.057812 
+-0.008215 0.061018 -0.000019 -0.085259 0.052848 
+-0.027541 -0.005643 -0.052940 -0.038511 -0.027902 
+-0.041703 0.075862 0.013165 -0.059187 -0.036318 
+-0.141024 0.082443 0.069711 -0.013203 0.014406 
+0.030125 -0.045500 -0.041806 0.002497 0.025155 
+0.017453 0.003895 -0.083765 0.104400 0.011102 
+-0.048345 0.018909 -0.030988 -0.072003 -0.023689 
+0.039778 -0.011208 0.089401 -0.003381 0.064581 
+-0.037057 0.017900 0.009406 -0.035557 0.007209 
+-0.003241 -0.108553 0.107998 -0.002787 -0.041577 
+-0.001725 0.010872 0.036545 0.091885 0.044958 
+0.069362 -0.032205 0.088568 0.031341 0.039043 
+0.010331 0.015777 -0.034748 -0.023237 0.005678 
+0.045804 0.043555 0.039834 0.109120 -0.055790 
+-0.015894 0.100543 0.050280 -0.072103 -0.045188 
+-0.011023 -0.045609 0.030003 -0.010336 0.063708 
+0.019876 0.039063 -0.034557 -0.076987 0.129728 
+0.030980 -0.069793 0.006613 -0.009915 -0.020373 
+-0.069965 0.002061 0.000541 -0.052867 0.092944 
+0.006017 0.032142 0.001437 0.012183 0.032717 
+-0.116354 0.039141 -0.103482 -0.032555 -0.058604 
+0.051576 -0.057991 -0.087256 0.032997 0.087854 
+-0.040337 -0.024261 0.038911 -0.077252 -0.039797 
+0.081800 0.001805 0.100735 0.013940 0.003214 
+-0.061214 -0.144295 0.008308 -0.079288 0.011819 
+-0.009353 0.021735 0.041214 0.036036 -0.075607 
+-0.035037 0.053300 0.014234 0.024169 0.037498 
+0.041347 0.073833 -0.068231 -0.042470 0.014760 
+0.033778 -0.058964 -0.006533 -0.067729 -0.003610 
+-0.018476 0.009825 -0.029418 0.050496 0.036382 
+0.060848 0.025206 -0.004172 -0.075537 -0.012303 
+-0.004545 -0.052962 0.118191 0.014623 0.029139 
+0.011171 0.016876 -0.013963 -0.059052 0.080971 
+0.002827 -0.003879 -0.049140 0.078897 -0.085060 
+-0.088602 0.131228 0.004221 -0.011391 -0.071427 
+0.017718 0.070627 0.054229 -0.044273 0.070835 
+0.025214 0.000275 -0.196338 -0.055537 -0.009349 
+0.028434 0.030911 -0.087382 0.065504 0.032241 
+0.011778 0.089297 0.008448 -0.051996 -0.159620 
+-0.008923 -0.062831 0.056001 0.025205 -0.012758 
+-0.071953 -0.005149 0.018063 -0.014935 -0.030631 
+0.013403 0.008570 0.080274 0.062037 -0.129636 
+0.011472 0.077844 0.062828 0.098467 0.066360 
+-0.086768 0.078864 0.029290 -0.000317 0.128502 
+0.004070 -0.025683 -0.096323 -0.046173 0.149402 
+0.030056 -0.030776 -0.044512 0.070740 -0.008688 
+0.014318 0.073530 0.097921 0.001865 -0.050654 
+-0.033176 -0.025587 0.089396 -0.054027 0.105766 
+0.000104 -0.058115 -0.051152 -0.028157 0.079932 
+-0.060212 -0.086791 0.029739 -0.006208 -0.054993 
+-0.004691 0.017634 -0.011116 0.051677 -0.039065 
+0.062654 0.079876 0.012684 -0.029185 -0.019667 
+0.012281 0.089665 -0.044542 0.013976 -0.055887 
+-0.029754 -0.078267 -0.023077 0.060156 0.047758 
+-0.017389 0.027009 0.061441 -0.041074 -0.115783 
+0.058611 -0.060866 0.113852 0.028394 -0.032204 
+0.051306 -0.045035 0.012411 -0.104662 -0.067768 
+0.005348 -0.053385 0.029868 0.023673 -0.127300 
+0.010816 0.112224 -0.017053 0.061578 -0.040140 
+0.049130 0.081442 -0.020925 -0.013124 0.049795 
+0.000088 -0.080273 -0.041920 -0.006154 0.026384 
+-0.017665 -0.029077 0.028767 0.109973 -0.064974 
+0.016728 0.012762 -0.017789 -0.018455 -0.027535 
+-0.026842 -0.082729 0.081654 0.058251 0.101281 
+0.008607 -0.074243 0.030006 -0.114336 0.077834 
+-0.042818 -0.047540 -0.040810 0.016980 0.009716 
+-0.019924 0.025318 0.094241 -0.026210 -0.040988 
+0.003781 0.101619 0.098932 0.076552 0.025069 
+0.010124 -0.042034 -0.095420 -0.072274 -0.061223 
+-0.025071 -0.016132 -0.047999 0.172624 -0.036838 
+0.011581 0.054710 -0.035830 -0.120277 -0.100100 
+-0.057028 0.006910 0.118464 -0.022154 0.025012 
+-0.017797 -0.033263 -0.008283 -0.003727 -0.043563 
+-0.003699 -0.095741 0.060120 -0.083925 -0.090614 
+-0.052209 0.069252 0.084102 0.031573 -0.065150 
+0.048194 0.013857 -0.000901 0.082968 0.075239 
+-0.023543 -0.017918 -0.034752 -0.020715 0.045946 
+0.025948 0.035884 -0.001330 0.030377 -0.069708 
+0.037228 0.064584 -0.011534 0.004775 -0.031321 
+-0.023894 -0.066680 -0.017407 -0.031766 0.082944 
+0.029780 -0.020334 -0.059467 -0.105484 -0.011107 
+0.107375 -0.081264 -0.085535 0.015847 0.011785 
+-0.147292 0.091983 -0.035194 0.018371 -0.019603 
+0.000643 0.026524 0.033881 -0.031605 -0.026151 
+-0.015905 0.025076 -0.040237 -0.015447 -0.036770 
+-0.023092 -0.008956 -0.094738 0.052213 0.066411 
+-0.014003 -0.038628 0.067782 -0.113461 -0.048569 
+0.077947 -0.029368 0.029847 0.032522 -0.053873 
+-0.009694 -0.066035 0.097838 -0.080553 0.014786 
+-0.041721 0.042424 -0.067096 0.086017 -0.083068 
+-0.031687 0.049261 0.011088 0.055956 -0.042553 
+0.064152 0.032740 -0.042521 0.032623 0.026468 
+-0.060446 -0.061420 -0.040101 -0.072435 -0.035127 
+-0.015938 -0.056502 -0.012235 0.159594 0.036828 
+0.014961 0.039926 -0.052046 -0.008302 -0.025221 
+-0.019677 -0.050264 0.064556 0.090868 0.045306 
+-0.056054 0.027715 -0.051663 -0.105423 0.043022 
+0.028868 -0.059945 -0.078316 -0.022563 -0.067438 
+-0.015459 0.051782 0.012461 -0.017353 -0.111666 
+0.047354 0.038969 0.018721 -0.042239 0.086618 
+0.047663 -0.009423 -0.062622 -0.054796 0.027821 
+-0.055863 0.015206 -0.063846 0.042120 0.051280 
+0.000880 -0.064353 -0.006378 -0.079885 -0.085024 
+-0.060682 -0.023010 0.052677 0.020476 0.036878 
+-0.022570 -0.097679 0.024609 -0.051637 -0.023871 
+0.018994 -0.008905 0.163821 0.035607 -0.004083 
+0.029753 0.070722 0.065015 0.036317 0.015253 
+-0.018487 0.021981 -0.052297 0.101195 0.046329 
+-0.018899 0.076923 -0.090549 -0.069408 0.052880 
+0.072613 0.016603 0.009898 0.038810 -0.097531 
+0.011528 0.033681 0.044555 0.022445 -0.040337 
+-0.006570 0.016912 0.017289 -0.010643 0.054567 
+0.039843 -0.082038 0.051662 -0.036190 0.056489 
+-0.013943 -0.108354 0.074006 0.095726 -0.069664 
+-0.034176 -0.043247 0.007026 -0.014616 0.018185 
+0.005567 0.064569 0.062030 -0.061575 0.033160 
+0.003638 0.043355 -0.092562 -0.001359 -0.118802 
+0.034657 -0.080892 -0.115509 0.051575 -0.016477 
+0.073726 -0.028197 0.101744 -0.091687 -0.002308 
+0.003490 -0.025382 0.023563 0.013144 -0.007840 
+0.098021 -0.089215 0.043236 -0.056307 0.013368 
+0.056472 0.016004 0.007337 0.008555 -0.046066 
+-0.000940 0.088476 -0.003382 0.056229 0.011333 
+0.025841 0.126240 -0.050253 -0.071801 -0.036593 
+-0.113256 -0.027423 -0.077799 -0.003365 0.042368 
+-0.007708 -0.040673 -0.002409 0.091194 -0.002389 
+0.089456 -0.007822 -0.034486 0.016810 0.021491 
+-0.021203 -0.054528 0.050001 0.028679 0.059435 
+-0.034908 0.003863 0.053342 -0.072845 0.001339 
+-0.054033 0.012885 -0.065048 -0.045609 -0.058860 
+-0.076548 0.032086 0.025364 -0.136995 -0.019692 
+-0.014073 0.049843 0.053275 -0.021054 0.051495 
+0.005986 -0.032989 -0.055326 -0.031727 -0.023301 
+0.052516 0.011953 -0.114987 0.050477 -0.086649 
+0.029069 0.034181 -0.055159 -0.036203 -0.045128 
+0.001147 -0.008622 0.073690 -0.077472 0.037649 
+-0.023539 -0.019114 0.007866 -0.053950 0.029809 
+0.002350 -0.026481 0.147821 -0.047601 -0.036813 
+-0.037253 0.033533 0.027495 0.047206 -0.008682 
+0.052569 -0.038196 0.009663 -0.000160 0.096707 
+-0.058192 0.000390 -0.047017 -0.034486 0.014275 
+0.016853 0.040124 0.061386 0.115421 0.015532 
+0.083606 0.081646 -0.014130 -0.065768 -0.049301 
+0.046979 -0.074307 -0.000569 0.043637 0.041337 
+0.036121 0.073310 -0.066751 -0.075889 0.042658 
+-0.033533 -0.145897 0.036198 0.008869 -0.000721 
+-0.096931 0.083547 -0.053221 -0.059850 0.044181 
+-0.047437 0.017891 0.054674 -0.007182 -0.021841 
+-0.057955 0.025656 -0.022698 0.003117 0.006525 
+0.054665 -0.016601 -0.070885 0.038416 0.036323 
+-0.106994 -0.070705 0.076054 -0.096182 0.017493 
+0.019099 0.040334 0.095834 0.024157 -0.012504 
+-0.036345 -0.054321 0.024473 -0.042893 0.045064 
+0.020362 0.013309 -0.022876 0.136195 -0.126968 
+-0.008470 0.104812 -0.060638 0.042024 0.051826 
+-0.046516 0.068780 -0.166211 0.010537 -0.020067 
+-0.016696 -0.031551 -0.045680 -0.140254 0.023460 
+0.019033 -0.007193 0.020098 0.033574 0.032849 
+-0.009729 0.029711 0.035164 -0.031548 -0.069463 
+-0.068795 -0.076409 0.084793 0.058786 0.033407 
+-0.055633 0.057879 -0.064890 -0.085820 0.141134 
+-0.032456 -0.044056 -0.052030 0.080704 -0.065311 
+-0.029210 0.031372 -0.005285 0.001060 -0.066081 
+-0.002741 0.043095 0.081838 0.016630 0.083339 
+-0.027374 -0.002893 -0.096649 -0.007570 -0.027971 
+0.023363 -0.012161 -0.079953 0.015753 0.010524 
+0.011885 0.035772 -0.053325 -0.031173 -0.135173 
+-0.008628 -0.004336 0.065589 -0.022764 -0.012130 
+-0.022211 -0.014175 0.049009 -0.008368 -0.051407 
+0.003391 -0.045775 0.040152 0.019404 -0.076654 
+-0.003267 0.015085 0.089489 0.060779 0.030779 
+-0.008577 0.025139 -0.005374 0.038636 0.058301 
+0.018353 -0.010357 -0.012618 -0.013865 0.082768 
+0.012199 -0.031424 -0.049425 0.036742 -0.023385 
+0.016261 0.046336 0.082459 -0.046018 -0.072305 
+0.007065 -0.052342 0.072695 -0.082325 0.056070 
diff --git a/codec2/tags/0.4/src/codebook/lspvqexp3.txt b/codec2/tags/0.4/src/codebook/lspvqexp3.txt
new file mode 100644 (file)
index 0000000..f7d2f2e
--- /dev/null
@@ -0,0 +1,2049 @@
+5 2048
+-0.136198 0.024151 -0.063695 0.003294 0.028292 
+0.058532 0.000407 0.081822 0.109613 0.092702 
+0.002289 -0.004336 -0.001953 0.032305 -0.008448 
+-0.035198 -0.023077 -0.052002 -0.025974 -0.085171 
+0.004385 -0.026216 -0.018253 -0.018256 0.012774 
+0.006358 0.026024 -0.087778 0.011771 -0.078083 
+0.007874 0.003175 -0.052089 0.064003 -0.042512 
+0.014535 0.006232 -0.033255 -0.045854 -0.107260 
+0.004491 0.019560 0.061050 0.029138 0.036281 
+-0.078731 -0.044440 -0.048337 -0.025092 0.081402 
+-0.007244 -0.049045 0.058090 0.066585 0.018635 
+-0.075770 0.063007 -0.000503 -0.135694 -0.037603 
+-0.054068 -0.104063 0.005153 0.006977 0.008814 
+-0.020893 -0.019060 -0.070042 0.004665 0.090232 
+-0.015010 0.032240 0.000378 -0.002297 0.004771 
+-0.040127 -0.041383 0.105462 -0.015007 -0.029958 
+0.009637 0.050721 -0.064000 0.070794 -0.027916 
+0.001217 -0.095625 0.095422 -0.058274 0.030180 
+0.047937 -0.040794 -0.018864 0.036107 -0.038520 
+-0.035711 -0.046199 -0.031081 -0.090591 -0.073785 
+0.068495 -0.021466 0.055625 0.027533 -0.056869 
+0.059775 -0.041632 -0.096969 -0.057469 -0.082582 
+0.076556 -0.075055 0.014253 -0.024721 -0.110025 
+0.039510 0.002922 0.001583 -0.081297 -0.054432 
+0.036638 0.106348 -0.029202 0.053259 0.060782 
+-0.053679 0.039323 0.097200 0.001035 0.086560 
+-0.023819 -0.121783 -0.029909 0.046493 -0.020142 
+0.049289 0.084407 0.081999 -0.002632 -0.023474 
+-0.049136 -0.022296 0.090649 0.036711 -0.056647 
+0.006248 0.061232 0.007889 -0.075399 0.015312 
+0.057416 0.103818 -0.016070 0.040505 -0.001189 
+0.114331 -0.090671 0.090784 0.004698 -0.078036 
+-0.096890 0.084786 0.041716 0.042491 -0.057462 
+-0.014909 -0.032684 0.071338 -0.025083 0.051331 
+0.050537 -0.069533 -0.037126 0.032846 0.025729 
+-0.047775 0.055988 -0.018972 -0.025690 -0.027975 
+-0.017970 0.023020 0.098593 0.004612 0.013157 
+0.044770 0.015091 -0.069310 -0.062427 -0.021413 
+-0.022487 0.105120 0.052485 0.089068 -0.015127 
+-0.069327 -0.005520 -0.039356 -0.065169 -0.081883 
+0.077729 0.024051 0.008893 0.135290 0.036535 
+-0.016512 -0.061216 -0.051545 0.019876 0.044939 
+-0.119244 -0.030603 -0.021134 0.038262 0.002980 
+-0.079101 0.080099 0.036993 -0.067815 -0.008885 
+-0.054560 -0.014317 0.093316 0.100385 -0.001690 
+0.052346 -0.004258 -0.013592 -0.042301 0.049842 
+0.092826 0.061851 0.027621 -0.024069 -0.059213 
+0.031617 -0.009108 0.022338 -0.063250 -0.097158 
+-0.008177 -0.030577 -0.107136 0.017774 0.059538 
+-0.053438 0.008281 -0.008953 -0.207584 0.041500 
+0.006693 -0.093889 -0.039108 0.040752 0.020200 
+0.005813 -0.021241 -0.046317 -0.019980 -0.037740 
+0.134550 0.018885 -0.020492 0.033445 -0.004411 
+0.000456 -0.030901 -0.058047 -0.081834 -0.007611 
+0.006314 0.008851 0.070179 0.003036 -0.035749 
+0.067106 -0.087172 0.047680 -0.058147 -0.011858 
+-0.043608 -0.020841 0.038136 -0.031081 0.185361 
+-0.054055 -0.067146 0.097240 -0.082580 0.051439 
+0.003624 -0.133423 0.011530 0.119056 -0.043475 
+-0.001737 0.110875 0.038530 -0.027030 0.053434 
+0.000648 -0.029320 0.121211 0.029589 -0.039707 
+-0.068850 0.000408 -0.032227 -0.003072 0.052231 
+0.034923 0.080837 -0.037156 -0.094754 0.014542 
+-0.005315 -0.054038 0.012812 -0.027090 -0.001601 
+-0.083437 0.019212 -0.016505 0.046104 0.038554 
+0.072309 -0.011739 0.059850 -0.056206 0.073386 
+0.135263 0.000286 -0.060518 0.036391 -0.060506 
+-0.027527 -0.000692 0.036739 -0.066074 -0.088864 
+0.005166 -0.054854 -0.003007 -0.010121 0.027824 
+-0.036967 -0.100932 -0.182594 -0.013910 0.014657 
+0.023979 0.055629 -0.054566 0.106056 -0.079044 
+-0.037983 -0.044929 0.043735 -0.085774 -0.009132 
+-0.024985 -0.071464 0.051902 0.102450 0.054042 
+-0.016588 -0.074683 -0.064110 0.056690 0.110680 
+-0.064499 -0.033720 0.024264 0.088022 0.031179 
+-0.015453 0.035079 0.044771 -0.043409 -0.047855 
+0.078062 -0.091048 0.052298 0.018898 0.005019 
+-0.054365 0.080023 -0.065458 -0.065704 0.014520 
+-0.003386 0.001319 -0.046118 -0.010700 0.008233 
+-0.030496 -0.072516 0.051522 -0.020414 -0.101831 
+0.017761 0.038077 -0.114244 0.041726 0.083964 
+-0.016531 -0.129688 -0.014288 -0.122167 0.063062 
+0.116380 -0.065367 -0.038604 0.095723 -0.036360 
+-0.066306 0.014726 -0.011596 -0.005770 -0.048796 
+0.090592 -0.004417 0.009466 0.098691 -0.066093 
+0.001754 -0.005848 -0.043066 -0.037892 0.031807 
+-0.022616 -0.021159 0.045873 0.028421 -0.085595 
+0.049794 -0.001914 0.008752 -0.077905 0.029994 
+0.044235 0.064398 0.005282 -0.003674 0.086059 
+-0.032460 0.015037 -0.007206 -0.036713 0.011909 
+-0.017113 -0.061523 -0.001698 0.001480 -0.052389 
+-0.005496 0.081887 0.018394 0.005492 -0.048520 
+-0.036485 0.006979 0.121328 0.069020 -0.093697 
+-0.035414 0.025382 0.033335 -0.042742 0.078618 
+0.022150 0.100313 -0.081797 -0.006077 -0.036600 
+0.043498 -0.047693 0.080861 -0.041208 -0.074855 
+-0.034519 0.006730 0.150509 0.059429 -0.003976 
+-0.059532 -0.022218 0.071419 -0.051453 0.008904 
+0.063565 -0.107466 -0.026643 -0.009845 0.097906 
+-0.094940 0.057756 -0.085002 0.019603 -0.098395 
+0.015610 0.000806 0.058999 -0.025760 0.036316 
+0.071066 0.030579 -0.066243 -0.023751 -0.060747 
+0.067731 0.090313 0.041003 0.076536 -0.012685 
+0.069395 0.035647 -0.112161 -0.075184 0.003099 
+-0.017065 0.018376 0.017104 0.109557 0.049888 
+-0.047698 -0.041877 -0.000537 0.051347 -0.003682 
+-0.016370 -0.001696 -0.010154 0.067477 -0.036583 
+-0.020092 0.048256 0.084878 -0.100501 -0.035380 
+0.008671 -0.122585 0.038716 -0.002197 -0.101482 
+0.037247 -0.032842 -0.068559 -0.021387 0.014449 
+0.027927 0.060964 -0.048375 0.028367 0.038134 
+-0.014885 -0.092447 -0.081616 -0.015822 -0.134913 
+-0.021274 0.013697 -0.035055 0.055911 0.033111 
+-0.034970 -0.015798 -0.007119 -0.076467 0.028984 
+-0.014502 -0.124275 0.021441 0.078607 0.002858 
+-0.042356 -0.003098 0.045995 0.031341 -0.016968 
+0.041560 0.019148 0.004700 0.005637 0.093016 
+0.063490 -0.048735 -0.069068 -0.034088 -0.028215 
+0.045350 0.075594 0.037776 0.024450 -0.071678 
+0.087072 0.009286 -0.023885 0.019862 -0.012771 
+-0.029248 -0.016036 -0.089092 0.074240 0.169069 
+-0.033409 0.026100 -0.024626 -0.043863 0.098736 
+0.012158 -0.077333 -0.083731 0.013768 -0.080944 
+-0.060470 0.037407 -0.013690 0.007337 -0.001188 
+0.005453 0.026261 0.119036 0.043940 0.046011 
+-0.035860 0.008540 -0.113766 -0.097502 0.024057 
+0.024457 0.118827 -0.001543 -0.064711 -0.007631 
+0.049637 -0.101928 -0.002462 0.054230 -0.044736 
+-0.067470 0.078729 -0.034003 0.014536 -0.022247 
+0.161762 -0.041209 0.037097 -0.052532 -0.031344 
+0.061129 0.020176 -0.066030 0.038964 0.022928 
+-0.014012 -0.030939 -0.092443 0.002874 -0.114395 
+-0.010621 -0.005537 0.018042 -0.045648 0.044588 
+0.007453 0.095088 -0.128336 0.107088 -0.032186 
+-0.047594 0.046694 0.039679 0.083442 -0.088060 
+0.060757 0.082896 0.037419 -0.092975 -0.054674 
+0.022723 -0.030652 0.025581 0.033843 0.085935 
+-0.020876 -0.055952 -0.103915 -0.073020 0.045301 
+0.020552 0.047020 0.047981 0.150138 -0.041783 
+-0.081206 0.015811 0.025886 -0.105666 0.097623 
+-0.026606 -0.109640 0.031300 -0.029835 0.007132 
+-0.004757 0.036673 -0.113804 -0.044055 0.015492 
+0.016617 0.050138 -0.020709 0.070749 0.016487 
+-0.041772 -0.059857 0.040483 0.002005 -0.030924 
+0.045135 0.114146 -0.077004 0.040268 0.014157 
+-0.007526 -0.029177 0.064663 -0.093478 0.103127 
+0.041264 -0.004835 0.013205 0.110399 -0.026498 
+-0.107188 -0.024533 -0.071115 -0.052007 -0.006395 
+0.030684 -0.035133 0.019891 0.033587 -0.028437 
+-0.019472 -0.016122 -0.099020 -0.052317 -0.029623 
+0.023893 -0.019150 0.042703 -0.007384 -0.135429 
+-0.008658 0.020311 0.016085 -0.113980 -0.001115 
+-0.036113 0.054423 0.008653 -0.007789 0.077924 
+-0.129044 -0.005070 0.011282 0.013904 0.077014 
+-0.025623 -0.031789 -0.073370 0.010481 -0.041819 
+0.008182 0.065192 0.027333 -0.034730 -0.026375 
+-0.073571 -0.019647 0.040694 -0.003020 -0.065061 
+-0.014276 0.079966 0.003562 -0.144068 0.054787 
+-0.022846 0.071080 -0.036877 -0.012692 -0.082166 
+-0.006918 -0.096688 0.095501 0.064056 0.007213 
+-0.036690 0.026213 0.059957 0.047896 0.003414 
+0.000914 0.015446 0.098563 -0.056379 0.137143 
+0.018164 -0.076211 -0.070196 0.001563 0.047637 
+-0.049087 0.114850 -0.090803 -0.012260 -0.036278 
+0.029559 0.002293 0.037244 0.047064 0.038113 
+0.070849 0.065524 -0.021498 0.000989 -0.091111 
+-0.036143 0.076107 0.016355 0.059505 -0.023400 
+-0.048163 0.004599 0.025481 -0.093492 -0.022306 
+0.020409 0.023572 -0.001520 0.059761 0.064734 
+-0.032331 -0.014971 -0.032497 -0.010585 0.008900 
+-0.085173 -0.038940 0.017863 0.073312 -0.032050 
+-0.026419 0.012730 0.067669 -0.005028 -0.054256 
+-0.019721 -0.049805 0.080959 0.050680 0.057457 
+-0.006579 -0.003248 -0.080847 -0.103158 0.064238 
+0.082133 0.070334 -0.026602 -0.064571 0.042901 
+0.017513 -0.081866 -0.016501 -0.088344 0.022655 
+0.009335 -0.047461 -0.005181 0.060236 0.032349 
+-0.056626 -0.022179 -0.044705 -0.131625 -0.028104 
+-0.026924 -0.045874 0.036424 0.026185 0.023864 
+-0.028118 -0.018505 0.018550 0.000643 -0.055726 
+0.101839 -0.037958 0.031116 0.110118 0.009110 
+0.112021 -0.038578 -0.104082 -0.042272 0.040893 
+0.028742 -0.028607 0.080643 0.003287 -0.063413 
+0.099046 -0.029956 0.002892 -0.067344 -0.016823 
+0.008602 0.017513 -0.014264 -0.041185 0.124856 
+-0.054844 -0.072185 0.033952 -0.096401 0.046007 
+-0.020749 -0.046471 0.003558 0.082125 -0.096910 
+0.025411 0.127329 0.076666 0.068718 0.005743 
+0.043603 -0.056968 0.086610 0.010153 -0.036367 
+-0.068722 0.024772 -0.000639 -0.052051 0.074796 
+0.019967 0.077602 -0.034771 -0.009789 -0.023551 
+0.047117 -0.066717 -0.066348 -0.063558 0.008220 
+-0.027567 0.036273 -0.067110 0.028847 0.089473 
+0.083247 0.004591 0.077405 -0.082932 -0.013968 
+0.079836 -0.052437 -0.080184 0.015535 0.000867 
+-0.020465 0.038101 0.029256 0.027121 -0.094745 
+0.022846 0.000927 0.004314 -0.039488 0.016252 
+-0.016129 -0.000925 -0.125901 0.037569 -0.012151 
+0.050660 0.036394 -0.018283 0.058805 -0.009276 
+0.002687 -0.029775 -0.002892 -0.018790 -0.068265 
+-0.026723 -0.038695 0.067644 0.027095 0.104267 
+-0.033127 -0.092325 -0.101391 0.051657 0.047692 
+-0.039487 0.017442 -0.007204 0.106333 -0.026736 
+-0.026984 0.048252 0.041384 -0.002131 0.042443 
+0.019367 -0.077827 0.019452 -0.004992 0.095049 
+-0.020183 0.054128 -0.089501 -0.106767 0.133742 
+0.003715 0.065993 -0.010120 0.002578 0.010632 
+-0.104027 -0.092526 0.051102 -0.064092 0.007341 
+0.037981 0.005348 -0.098388 0.082010 0.023682 
+0.101454 -0.074181 0.022470 -0.047488 0.034728 
+0.054519 -0.059484 -0.055491 0.133582 0.009556 
+-0.120963 -0.043837 0.028549 0.025534 0.028904 
+0.108670 -0.032038 0.012596 0.038519 -0.012244 
+0.003888 0.019393 -0.076558 -0.013031 -0.019858 
+-0.006786 -0.020230 0.044975 0.034040 -0.032445 
+0.099970 -0.025120 -0.012044 -0.058520 0.081664 
+-0.018743 0.028691 0.017459 0.030523 0.121595 
+-0.045728 -0.044359 0.002157 0.025037 0.043565 
+-0.027940 -0.112422 0.019525 0.012089 -0.036526 
+0.012809 0.102396 0.061700 0.009053 -0.006318 
+-0.073644 0.052544 0.093009 0.002094 -0.048500 
+-0.067838 0.044219 0.004622 -0.021517 0.144798 
+0.000396 0.028552 -0.047957 0.022072 -0.044059 
+0.022301 -0.046990 0.069399 -0.022723 0.001209 
+-0.061132 0.035083 0.054456 -0.053667 0.023348 
+-0.021700 0.035612 0.078641 -0.067377 0.046902 
+0.103671 -0.042167 -0.039490 0.027663 0.018158 
+-0.034924 0.044647 -0.017309 0.013019 -0.075672 
+0.016417 0.018863 -0.005962 -0.054108 -0.028444 
+0.033930 -0.024540 -0.021060 0.018088 -0.079446 
+0.004808 0.042524 0.042005 0.062594 -0.020936 
+0.045898 -0.007873 -0.067501 -0.079291 -0.053730 
+-0.044782 0.007470 -0.003636 0.041779 0.032024 
+-0.055764 -0.025299 -0.042428 0.043255 0.061536 
+-0.028270 0.031312 -0.055603 0.078003 -0.007771 
+-0.035400 0.019441 0.101450 -0.047446 -0.021123 
+-0.003012 -0.065746 0.021167 0.028415 -0.039012 
+0.078986 0.041230 -0.109603 -0.053586 0.081713 
+0.069524 0.086261 0.032415 0.020301 0.008172 
+-0.050007 -0.043252 0.032538 -0.040149 -0.060186 
+-0.036647 0.074839 -0.067704 0.105038 0.016407 
+-0.017166 -0.040157 -0.034379 -0.045783 0.036121 
+0.006989 -0.053621 -0.014310 0.130029 0.014339 
+0.010984 -0.049323 0.011801 0.024418 -0.061108 
+0.048945 0.020936 -0.016709 0.036678 0.056799 
+-0.032054 -0.081596 -0.020000 -0.014900 -0.016931 
+0.025720 0.030371 0.054373 0.041972 -0.103673 
+0.072505 -0.008653 -0.038498 -0.082343 -0.011659 
+0.008214 -0.051158 -0.011619 0.011396 0.073440 
+-0.028140 -0.085370 -0.083429 -0.059579 0.093532 
+0.017281 -0.029324 -0.063027 0.036276 -0.035917 
+-0.062731 0.083485 0.034826 -0.016723 0.041119 
+0.006462 0.063240 0.106462 0.005405 0.014198 
+-0.107371 0.016648 -0.039299 -0.060254 0.066074 
+0.010798 0.104663 -0.026071 -0.092536 -0.049821 
+0.052302 -0.111521 -0.028997 -0.044881 -0.058612 
+-0.066180 0.063782 -0.087613 0.131044 0.079319 
+0.051549 -0.031150 0.050463 0.014022 0.072812 
+0.040951 -0.008242 -0.035076 -0.012706 -0.007732 
+-0.087407 -0.043003 -0.051495 -0.005909 -0.078253 
+0.024556 -0.000301 -0.002836 0.000471 0.036449 
+-0.033227 0.013122 -0.041830 0.053473 -0.062823 
+0.001698 0.056414 -0.009009 0.074868 -0.031437 
+0.061142 0.034153 0.037913 -0.016467 -0.112529 
+-0.042555 0.004865 0.068299 0.039970 0.035002 
+-0.032275 -0.054429 -0.110647 -0.004981 0.106602 
+-0.009971 -0.070226 0.011717 0.078195 -0.004486 
+-0.053666 0.032253 0.019880 -0.063381 -0.011499 
+-0.021161 -0.147358 0.022501 0.026856 0.014878 
+0.071720 -0.018691 -0.078472 0.006781 0.128504 
+0.009349 0.032300 0.024117 0.093683 -0.001689 
+-0.038787 -0.022119 0.025894 -0.051130 -0.029077 
+-0.003509 0.056923 -0.043564 0.047755 0.029228 
+0.094577 -0.059873 0.105327 -0.045681 0.020128 
+0.019571 -0.053714 -0.026005 0.082821 0.010883 
+-0.090635 -0.046160 0.015147 -0.060630 -0.025114 
+0.065345 -0.062635 0.033608 -0.000239 -0.055078 
+0.028179 0.007232 -0.132300 -0.058511 -0.027521 
+0.009924 -0.057576 0.037098 -0.048222 -0.067691 
+0.025807 0.005481 0.053364 -0.071026 0.002704 
+-0.019833 0.056496 -0.012323 0.054975 0.053260 
+-0.058168 -0.002745 0.051808 0.007857 0.072213 
+-0.028508 -0.100966 -0.066436 0.094923 -0.032702 
+0.016386 0.144962 0.060276 -0.060885 0.045013 
+-0.008694 -0.035070 0.077187 0.011427 -0.039974 
+0.041845 0.095921 -0.012129 -0.069502 0.058053 
+0.016498 0.068097 -0.063723 0.058607 -0.084662 
+0.051080 -0.084087 0.061664 -0.014378 -0.020357 
+-0.101420 0.018380 0.026201 0.021273 0.001716 
+0.018280 -0.048955 0.114013 0.007403 0.073650 
+-0.007198 -0.073071 -0.043345 -0.025399 0.062280 
+-0.057043 0.007375 -0.057945 0.001682 -0.068288 
+-0.004458 0.057944 0.019870 0.030319 0.023300 
+0.023258 0.038816 -0.075939 0.024401 -0.008493 
+-0.088976 0.084875 -0.004901 0.107413 0.036685 
+-0.017576 0.049893 -0.017089 -0.076959 -0.047043 
+0.012304 0.096589 0.020081 0.055371 0.026179 
+-0.031262 -0.023054 -0.062863 0.022469 0.026254 
+-0.081002 0.001604 -0.067115 0.089364 -0.044846 
+-0.104635 0.022051 0.024153 -0.050297 -0.090473 
+-0.111208 -0.014747 0.065056 0.064524 0.014978 
+-0.018009 -0.045181 -0.036814 -0.049839 0.101556 
+0.123355 0.029904 0.046059 0.075873 0.023800 
+0.018950 -0.069598 -0.023833 -0.044717 -0.059289 
+0.005309 -0.050755 -0.129767 0.090909 0.049327 
+0.034593 -0.024217 -0.013090 -0.120429 0.018611 
+0.035730 -0.069972 -0.020352 0.040567 -0.008846 
+-0.035745 -0.012086 -0.029290 -0.031875 -0.022851 
+0.126885 0.093804 -0.041337 0.064417 0.012827 
+-0.006103 -0.064712 -0.034377 -0.072895 -0.024513 
+0.024964 0.025126 0.053845 -0.032844 -0.040164 
+0.057226 -0.047268 0.002180 -0.030810 -0.046649 
+-0.011612 -0.016914 0.019534 -0.045647 0.103552 
+-0.019784 -0.059284 0.034278 -0.052666 0.063638 
+-0.030288 -0.052341 -0.018891 0.060842 -0.038845 
+0.029390 0.061982 0.049711 -0.034509 0.014359 
+-0.001671 -0.096474 0.111850 -0.008201 -0.039744 
+-0.018012 -0.003881 -0.008624 -0.032458 0.060460 
+0.046820 0.050558 -0.004330 -0.043328 0.024076 
+0.020855 -0.064731 0.003784 -0.011162 -0.039018 
+-0.064459 0.004758 -0.065784 0.046246 0.009026 
+0.061065 0.051008 0.060159 -0.028994 0.058623 
+0.065914 -0.082042 -0.137623 0.009165 -0.028321 
+0.013924 0.038290 0.064550 -0.076981 -0.104556 
+0.057766 -0.047215 -0.025831 -0.014589 0.040468 
+-0.018660 -0.044675 -0.134278 -0.019992 0.000064 
+-0.007643 0.019573 -0.005029 0.139097 -0.058444 
+0.015872 -0.061714 0.054845 -0.093905 -0.023694 
+-0.069868 -0.051634 0.093449 0.116722 0.041075 
+-0.031597 -0.064630 -0.001604 -0.011889 0.114102 
+-0.038392 -0.043996 0.036345 0.159256 0.042733 
+-0.014768 0.023374 0.091565 -0.062174 0.008748 
+0.027552 -0.065067 0.043484 0.029833 0.068407 
+0.062921 0.100413 -0.044081 -0.047093 0.012867 
+-0.021198 0.053674 -0.074601 0.009988 -0.000368 
+0.004615 -0.031012 0.126258 -0.044950 -0.053716 
+0.068829 0.028389 -0.081499 0.096576 0.111555 
+0.032580 -0.091888 0.004783 -0.058619 0.103336 
+0.023528 -0.067561 -0.052227 0.060540 -0.008415 
+-0.134399 -0.003137 -0.005498 0.000696 -0.064610 
+0.103028 -0.016839 0.054380 0.058673 -0.018968 
+-0.030411 0.004030 -0.022930 -0.074504 -0.005768 
+-0.040922 -0.056206 0.026643 0.091472 -0.046289 
+0.024551 0.006847 -0.043098 -0.076632 0.023143 
+-0.027690 0.058150 -0.033455 -0.000947 0.108861 
+-0.053902 -0.004117 -0.000733 -0.004552 0.018160 
+-0.015632 -0.075342 -0.057899 0.043216 -0.030867 
+-0.025610 0.087151 0.015012 -0.058812 -0.077554 
+-0.057877 0.030875 0.088541 0.068489 -0.037517 
+-0.013136 0.003726 0.026354 -0.076145 0.081871 
+0.009685 0.049282 -0.053126 -0.041669 -0.055971 
+0.070689 -0.000302 0.030654 -0.059458 -0.032358 
+-0.073479 0.014645 0.057040 0.060111 0.026122 
+-0.021404 -0.035383 0.105578 -0.064143 0.009201 
+0.067302 -0.018682 -0.018425 0.053502 0.095608 
+-0.089642 0.061823 -0.049713 0.118868 -0.071061 
+0.033484 0.020846 0.017472 0.009132 0.017367 
+0.095422 0.015719 -0.042701 -0.059963 -0.093737 
+0.065153 0.040501 0.070592 0.084313 0.023778 
+0.011293 0.022143 -0.078417 -0.072724 0.022472 
+-0.047887 0.042426 0.002790 0.080670 0.045298 
+-0.124868 -0.052373 -0.036868 0.080892 0.053132 
+-0.029773 -0.038766 -0.021131 0.028890 -0.019483 
+-0.031257 0.013785 0.114016 -0.019299 -0.095540 
+-0.081494 -0.108033 0.072808 0.034714 -0.046113 
+0.018918 0.025646 -0.012081 -0.029184 0.035413 
+0.062215 0.094361 -0.038357 0.004033 0.061858 
+-0.040066 -0.073778 -0.039352 -0.026946 -0.078584 
+-0.027017 -0.016385 -0.070475 0.068096 0.031208 
+0.024912 -0.031301 0.028130 -0.092740 0.010887 
+0.080067 -0.086228 -0.002645 0.062014 0.039789 
+-0.000913 -0.002893 0.021215 0.025308 -0.079170 
+0.021198 0.011411 -0.029445 0.021288 0.028934 
+-0.012482 -0.093791 -0.086795 -0.065003 -0.091575 
+0.042822 0.048190 0.027573 0.016672 -0.031582 
+0.084478 -0.026855 0.002037 -0.003986 -0.032282 
+-0.037516 0.024939 0.006645 0.069559 0.096001 
+-0.009324 -0.020647 0.016115 -0.002890 0.099816 
+0.035798 -0.055626 -0.082205 0.061510 -0.137040 
+-0.003237 0.086092 -0.015616 0.038825 0.025940 
+-0.009435 -0.039900 0.130411 0.041684 0.029411 
+-0.053212 0.035136 -0.038974 -0.068479 -0.014046 
+-0.052464 0.114330 0.014803 -0.043086 -0.031898 
+0.114055 -0.094015 0.000194 0.005274 -0.032729 
+-0.061821 0.146682 -0.033636 0.052702 -0.025910 
+0.076647 0.000572 0.089946 0.018515 -0.012439 
+0.057567 -0.023096 -0.066766 0.029717 -0.021521 
+-0.048165 0.037444 -0.026950 -0.054050 -0.122571 
+0.003033 -0.021280 0.058783 -0.065330 0.032047 
+0.016007 0.003629 -0.102811 0.075806 -0.028556 
+-0.051245 0.032001 0.006924 0.046225 -0.066944 
+0.026360 0.071868 0.000989 -0.051417 -0.082284 
+0.007536 -0.005941 0.054340 0.097832 0.059470 
+0.005201 -0.029254 -0.063891 -0.032060 0.063113 
+0.005567 -0.038440 0.079032 0.117269 -0.027965 
+-0.018444 0.021519 0.056596 -0.077845 -0.001929 
+0.018144 -0.117195 0.021022 -0.078031 0.060201 
+0.068169 0.033446 -0.116183 0.024450 0.054125 
+0.043263 0.043637 -0.024388 0.028606 -0.043272 
+-0.076651 -0.044322 0.043529 -0.032600 -0.022496 
+-0.028618 0.105767 -0.131078 0.022952 0.032809 
+0.014704 -0.078921 0.053414 -0.130561 0.025975 
+-0.006145 -0.020377 0.002576 0.111120 -0.027416 
+-0.056800 -0.034249 -0.102732 -0.077605 -0.054125 
+0.013938 -0.018912 0.031272 0.045116 0.009640 
+-0.000666 -0.010171 -0.101812 -0.086048 -0.079481 
+0.012556 -0.025093 -0.037932 0.018846 -0.121557 
+0.019521 0.077648 0.062764 -0.080462 -0.006901 
+-0.022906 0.106898 -0.001186 -0.033179 0.083120 
+-0.108465 0.004729 -0.004907 -0.051941 0.019890 
+-0.052798 -0.048321 -0.039992 0.011392 0.022231 
+0.052123 0.053230 0.008893 -0.021235 -0.021543 
+-0.052336 -0.002642 0.014048 0.021729 -0.071873 
+0.008583 0.063055 -0.005700 -0.130218 -0.004615 
+0.001933 0.068978 0.002830 0.041471 -0.075840 
+0.058590 -0.105352 0.109710 -0.008703 0.046126 
+-0.058564 0.044743 0.028326 -0.017021 -0.043831 
+-0.006378 0.002489 0.083015 -0.017479 0.032458 
+0.075359 -0.070133 -0.094634 0.004253 0.050570 
+-0.084605 0.081302 0.020066 -0.026905 -0.070421 
+0.027450 0.006091 0.038101 0.058759 -0.022035 
+0.075718 0.034255 -0.003008 0.013391 -0.039205 
+-0.027185 0.117021 0.026809 0.017619 -0.048835 
+0.013076 -0.001288 -0.041201 -0.077396 -0.060871 
+0.003384 0.082249 0.080509 0.073375 0.032946 
+-0.020732 -0.036562 -0.005218 0.006654 0.017449 
+-0.070219 -0.067294 -0.000185 0.046725 -0.032632 
+-0.114281 0.007061 0.027082 -0.042412 -0.035359 
+-0.017030 -0.081911 0.091617 -0.001734 0.040171 
+0.029232 0.022946 -0.023063 -0.099398 0.088196 
+0.134224 0.037312 -0.010897 0.015441 0.048401 
+0.036710 -0.079633 0.068283 -0.095899 -0.076950 
+0.031388 -0.049701 -0.078358 0.071239 0.093230 
+-0.047640 -0.059715 -0.006775 -0.091115 -0.004787 
+0.029706 -0.062712 0.001230 0.035511 0.012170 
+-0.035826 -0.020972 -0.004566 -0.054826 -0.080743 
+0.043183 -0.019993 -0.009134 0.093461 0.062293 
+0.055956 -0.052129 -0.076380 -0.112243 0.065413 
+0.075567 0.019848 0.094121 0.021786 -0.068644 
+0.060691 -0.037556 0.053416 -0.063583 -0.009116 
+0.059647 0.033059 0.008383 -0.057678 0.106669 
+-0.086182 -0.028844 0.069038 -0.050651 0.045613 
+-0.022872 -0.050951 0.020221 0.009049 -0.129767 
+-0.034033 0.103312 0.070048 -0.008972 0.021930 
+-0.019606 -0.031561 0.065822 0.016592 -0.009995 
+-0.028203 0.056913 -0.043993 -0.020496 0.028610 
+0.050871 0.070498 -0.045548 -0.038539 -0.050789 
+0.065005 -0.048246 0.011105 -0.026236 0.004123 
+-0.069629 0.029918 -0.108123 -0.018902 0.020385 
+0.012121 0.000873 0.079758 -0.028851 -0.001646 
+0.048281 -0.044204 -0.025910 -0.031220 0.006049 
+-0.039981 0.031852 -0.007419 -0.008198 -0.105351 
+0.021943 -0.009020 0.041415 -0.051481 0.064758 
+-0.066937 0.070473 -0.128350 0.059786 -0.012980 
+0.046171 -0.005175 -0.054847 0.066448 -0.057361 
+0.015253 -0.020476 0.048261 -0.069168 -0.074295 
+-0.072588 -0.042977 0.018592 0.070496 0.114648 
+0.010817 -0.128853 -0.097246 0.020464 0.031236 
+-0.024940 0.041108 0.011415 0.087818 -0.043080 
+0.025168 0.025134 0.027778 -0.030419 -0.017191 
+-0.010787 -0.089466 0.006383 0.016841 0.083765 
+0.008103 0.031762 -0.065297 -0.043194 0.060151 
+-0.031870 0.035064 -0.027919 0.019804 0.031581 
+0.015682 -0.090393 0.054461 -0.051669 -0.020003 
+-0.006273 0.029554 -0.052349 0.122862 0.052590 
+0.053436 -0.092575 -0.038422 -0.014132 0.025596 
+-0.007446 -0.068838 -0.100706 0.110571 -0.074217 
+-0.124216 -0.046391 -0.001952 -0.035192 0.056849 
+0.049815 -0.000716 0.078561 0.103458 -0.031106 
+0.004277 0.053141 -0.013453 -0.014118 -0.043585 
+0.037082 -0.072984 0.085005 0.059632 -0.092468 
+0.070536 0.024296 0.032733 -0.064865 0.050807 
+0.048457 0.051588 0.064615 0.014068 0.107732 
+-0.036905 -0.023656 0.039094 -0.021163 0.016683 
+-0.033733 -0.099111 -0.053957 0.004493 -0.052760 
+-0.012367 0.103975 0.055514 -0.018205 -0.077832 
+-0.018229 0.099840 0.043099 0.026033 -0.127892 
+0.005209 0.115289 0.030702 -0.090228 0.102291 
+-0.036231 0.059027 -0.073456 0.025828 -0.058846 
+0.023155 -0.021831 0.050419 -0.052958 -0.025641 
+-0.057417 -0.038855 0.069655 0.009463 -0.011469 
+-0.001709 0.032146 0.133188 -0.084494 0.022112 
+0.105454 -0.037301 -0.006059 -0.002167 0.033760 
+-0.067749 0.052323 -0.002914 0.042408 -0.038078 
+0.080983 0.032390 -0.013515 -0.017162 -0.001944 
+0.018212 -0.057337 -0.024336 0.003385 -0.053031 
+0.007656 0.093900 0.019898 0.057621 -0.016597 
+0.028536 0.010449 -0.048939 -0.132260 -0.015093 
+-0.032383 0.042496 0.006198 0.022980 0.050028 
+-0.091286 0.046546 -0.012873 0.053569 0.100661 
+0.001121 0.033644 -0.044783 0.040892 -0.007458 
+0.015227 0.057715 0.135154 -0.011532 -0.048523 
+-0.020718 -0.100767 0.060073 0.082344 -0.067297 
+0.052855 0.019105 -0.072241 -0.034480 0.046910 
+0.028509 0.105159 -0.005862 -0.006672 0.031437 
+-0.044146 -0.049556 0.015169 -0.001790 -0.082293 
+-0.043861 0.020628 -0.082354 0.150955 -0.022192 
+-0.053152 -0.023628 -0.040518 -0.032409 0.040596 
+-0.072007 -0.085815 0.034433 0.062865 0.051963 
+0.007741 -0.008439 0.034908 -0.009552 -0.032946 
+0.043386 0.024843 0.020463 0.077839 0.109446 
+-0.033733 -0.111561 -0.077032 -0.028750 -0.004143 
+0.027687 -0.006467 0.011063 0.043189 -0.123963 
+0.091285 0.045529 -0.007055 -0.051180 -0.054342 
+0.012612 -0.032042 0.014321 0.047055 0.140528 
+-0.069055 -0.048973 -0.035481 -0.091096 0.061054 
+-0.017211 -0.042891 -0.047427 0.050343 -0.010907 
+-0.031955 0.062361 0.017419 -0.036013 -0.002721 
+0.041131 0.024163 0.089626 0.022372 0.009373 
+-0.095530 0.047262 -0.031783 -0.036250 -0.009977 
+-0.021451 0.082581 -0.051394 -0.022879 -0.034885 
+0.076878 -0.111199 -0.010824 0.015104 0.028609 
+-0.085213 0.147576 -0.065340 0.019676 0.072754 
+0.082529 0.036091 0.076516 0.052432 0.071795 
+0.008287 -0.036426 -0.009891 0.029857 0.002193 
+-0.003334 -0.028181 -0.037997 -0.010828 -0.075271 
+-0.009274 -0.000105 0.026357 -0.014523 -0.000196 
+0.045930 0.012760 -0.088269 0.009968 -0.079905 
+0.046175 0.009370 -0.000002 0.029935 -0.042887 
+0.023842 0.018746 -0.006990 0.008271 -0.090227 
+0.030612 0.016519 0.081049 0.009339 0.055323 
+-0.044325 0.004172 -0.068893 -0.045980 0.077715 
+0.001175 -0.046950 0.036603 0.091690 -0.007926 
+-0.030905 0.059344 0.015477 -0.098726 -0.013555 
+-0.055799 -0.077539 -0.011439 -0.004065 0.054785 
+0.034376 0.008123 -0.066323 0.015381 0.051534 
+-0.029072 0.008390 -0.021483 0.034645 -0.015101 
+-0.032733 -0.053135 0.072680 -0.018542 0.019239 
+0.037756 0.062391 -0.075094 0.101033 0.003228 
+0.041719 -0.083617 0.062272 -0.023256 0.039273 
+0.009314 -0.036930 -0.022348 0.054612 -0.061547 
+-0.057502 -0.045821 -0.027136 -0.057127 -0.040360 
+0.066291 0.009189 0.032460 -0.001094 -0.054085 
+0.006575 -0.054172 -0.130758 -0.090713 -0.002316 
+0.034393 -0.052381 0.012536 0.038109 -0.081767 
+0.085920 0.009447 -0.009120 -0.115802 -0.024373 
+-0.009739 0.098210 -0.050578 0.009031 0.067793 
+-0.102503 0.070893 0.048610 0.025783 0.070098 
+-0.082345 -0.110272 -0.069934 0.039617 -0.015865 
+0.093134 0.050931 0.078967 0.014464 0.014646 
+-0.080307 -0.028843 0.108070 -0.021868 -0.059963 
+-0.033823 0.075594 0.036621 -0.060586 0.034463 
+0.062713 0.100354 -0.048699 0.006569 -0.054387 
+0.085716 -0.042197 0.055028 -0.023813 -0.019848 
+-0.128971 0.064906 -0.014135 0.053208 -0.054020 
+0.012192 -0.023224 0.086982 0.002569 0.081299 
+0.043572 -0.052176 -0.053337 0.001834 -0.002848 
+-0.073999 0.045245 -0.072961 0.011777 -0.001025 
+-0.038850 0.021979 0.082271 0.023871 -0.014373 
+0.066920 0.022695 -0.046891 -0.028261 0.005879 
+-0.066511 0.074096 0.039110 0.046744 -0.001032 
+-0.028041 0.019515 -0.079802 -0.098550 -0.057732 
+0.050261 0.061069 -0.014075 0.084526 0.061622 
+-0.011750 -0.051429 -0.073887 -0.004920 0.014058 
+-0.107882 -0.029024 -0.096352 0.047279 -0.040754 
+-0.069567 0.060745 0.075817 -0.045723 -0.101709 
+-0.047723 -0.030640 0.056081 0.076466 0.002197 
+-0.010621 0.007690 -0.030150 -0.067986 0.062739 
+0.117024 0.061613 0.012656 0.043682 -0.031102 
+0.018671 -0.047947 -0.040784 -0.089523 -0.106392 
+-0.005815 -0.001616 -0.068421 0.027810 0.057644 
+-0.008067 -0.006506 0.039180 -0.154508 -0.011541 
+0.033405 -0.122890 -0.013528 0.038364 -0.001838 
+-0.004906 -0.046275 -0.038730 -0.031623 -0.003879 
+0.152370 -0.022857 -0.072307 0.029362 0.058441 
+0.009357 -0.022712 -0.075829 -0.057416 -0.038179 
+0.011980 0.029996 0.082156 0.024194 -0.072075 
+0.072125 -0.051638 0.039224 -0.086809 -0.049036 
+-0.016999 -0.028023 -0.045506 -0.030265 0.170708 
+-0.044189 -0.166394 0.095599 -0.078305 0.024710 
+-0.012502 -0.049717 0.030435 0.149411 -0.047396 
+-0.004166 0.092334 0.002567 0.003784 0.058999 
+-0.014837 -0.013693 0.116725 -0.016922 -0.014098 
+-0.026542 0.025453 -0.072587 -0.010040 0.040512 
+0.061390 0.063914 -0.059682 -0.091206 -0.018253 
+-0.019787 -0.066510 0.016750 -0.053649 -0.028817 
+-0.092221 0.050852 -0.009044 0.047829 -0.002441 
+0.018727 0.036731 0.089017 -0.091873 0.088367 
+0.109395 0.014861 -0.097044 -0.015050 0.009286 
+0.002921 0.027523 0.011728 -0.046926 -0.098498 
+0.000836 -0.056539 0.023297 0.018001 0.049131 
+0.004675 0.001073 -0.170749 0.014371 0.034021 
+0.020092 0.037851 -0.028229 0.102064 -0.048952 
+-0.025833 -0.026058 0.012805 -0.114410 -0.051993 
+0.013397 -0.036918 0.089997 0.157135 0.083396 
+-0.039602 -0.080711 -0.021277 0.053202 0.071289 
+-0.109812 0.002914 -0.015096 0.091661 0.031649 
+0.001854 0.034905 0.032772 -0.002794 -0.042979 
+0.068519 -0.063135 0.013342 -0.006060 0.046252 
+0.017425 0.141501 -0.060676 -0.083881 0.048423 
+-0.023162 0.027077 -0.098028 -0.014739 0.010480 
+-0.022374 -0.086942 0.100437 -0.075083 -0.115201 
+0.007563 0.033322 -0.103828 0.051361 0.024684 
+-0.004454 -0.055777 -0.046699 -0.082728 0.073797 
+0.055443 -0.143092 -0.037825 0.078811 0.036497 
+-0.077281 -0.008325 0.013544 -0.017594 -0.041641 
+0.047789 -0.034492 -0.002379 0.073826 -0.075772 
+-0.009782 0.050561 -0.019115 -0.056305 -0.001601 
+-0.034683 0.008058 0.060254 0.034221 -0.132588 
+0.051493 -0.015100 -0.031876 -0.051222 0.000989 
+0.047049 0.026343 -0.041914 -0.036045 0.095869 
+-0.062112 -0.018423 0.003773 -0.027867 -0.010398 
+-0.048280 -0.036537 -0.017897 -0.005851 -0.058694 
+-0.014345 0.061231 0.015028 -0.034773 -0.062937 
+-0.000104 0.042883 0.145663 0.087783 -0.037200 
+0.016255 0.036518 0.046461 -0.034405 0.079881 
+0.035236 0.059227 -0.075679 -0.016770 -0.068794 
+0.070744 -0.037727 0.127718 -0.021398 -0.046414 
+-0.032597 0.063874 0.097691 0.026403 -0.004663 
+-0.087849 -0.026770 0.144388 -0.048131 0.031670 
+0.106295 -0.065269 -0.040652 -0.014211 0.056560 
+-0.043383 0.070554 -0.010791 0.053436 -0.111118 
+0.031068 0.016914 0.052035 0.004705 -0.005330 
+0.034760 -0.023902 -0.025479 -0.020657 -0.051098 
+0.009155 0.063415 0.088456 0.063249 -0.036212 
+-0.000009 0.037196 -0.081303 -0.097243 -0.019263 
+0.029158 0.050108 0.039763 0.121192 0.042011 
+-0.067899 -0.051989 -0.021537 0.068444 0.027782 
+-0.016312 -0.019484 -0.002050 0.053199 0.005392 
+-0.008887 0.011627 0.044619 -0.090553 -0.063460 
+0.004298 -0.096710 0.054118 0.026422 -0.054091 
+0.011429 0.013193 -0.050806 -0.014131 0.048069 
+0.073934 0.058524 -0.027092 0.000422 0.030744 
+-0.027127 -0.040621 -0.081295 -0.132942 -0.174424 
+-0.009461 0.028177 -0.035784 0.088923 0.029507 
+-0.031399 0.023611 -0.016887 -0.076838 0.033483 
+0.030485 -0.089706 0.003531 0.109110 0.014393 
+-0.057547 -0.003360 0.039022 0.000441 -0.017536 
+0.010777 0.032913 0.009826 0.011260 0.063002 
+0.039884 -0.084768 -0.091794 -0.019418 0.001947 
+0.035580 0.092377 0.044137 -0.039732 -0.073936 
+0.074461 -0.026009 -0.018411 0.052151 -0.023017 
+-0.074733 -0.019706 -0.045403 0.041498 0.114826 
+-0.062412 -0.015496 -0.008802 0.010005 0.134097 
+-0.006114 -0.127624 -0.111323 0.020666 -0.044975 
+-0.039706 0.068792 0.011916 0.016754 -0.000454 
+-0.010497 0.014889 0.070891 0.116098 0.021857 
+-0.085198 0.023739 -0.088592 -0.046397 -0.013729 
+-0.021026 0.161165 0.011340 -0.032323 -0.022466 
+0.071886 -0.105818 0.021622 0.083276 -0.011759 
+-0.053961 0.111353 -0.063359 0.048522 0.020913 
+0.155966 -0.097759 0.067338 0.004069 0.048556 
+0.039733 0.024807 -0.036450 0.026902 -0.001497 
+0.008231 0.007538 -0.082664 -0.024402 -0.130124 
+0.001341 0.009836 0.031207 -0.007516 0.063997 
+0.013111 0.044756 -0.108910 0.036952 -0.038516 
+0.032064 0.054737 0.021054 0.090083 -0.095331 
+0.086201 0.072386 0.002048 -0.084090 -0.123429 
+0.036048 -0.020936 -0.001486 0.048416 0.057746 
+-0.007902 -0.025902 -0.039170 -0.090144 0.033093 
+-0.037429 -0.008878 0.031789 0.108803 -0.001264 
+-0.067338 0.047247 -0.010053 -0.104491 0.019316 
+-0.038488 -0.110868 -0.017281 -0.069637 0.003541 
+0.034292 0.055001 -0.090837 -0.028732 0.016192 
+0.056000 0.072632 -0.022204 0.040858 0.031991 
+-0.034742 -0.035448 0.019035 -0.013232 -0.014398 
+-0.006173 0.109096 -0.049988 0.013882 0.005876 
+-0.010246 -0.017441 0.025300 -0.098996 0.052687 
+0.025387 0.000912 -0.009639 0.084043 -0.052007 
+-0.083781 -0.030439 -0.073927 0.007538 0.012090 
+0.066881 -0.025604 0.016332 0.037268 -0.033802 
+-0.015458 -0.021930 -0.070557 -0.051580 0.012924 
+-0.009009 -0.017953 0.042537 -0.020288 -0.091337 
+-0.024530 0.040526 0.056023 -0.110282 0.026677 
+-0.038359 0.097050 0.014986 0.037195 0.054785 
+-0.083630 0.055443 -0.035272 0.003855 0.043706 
+-0.057062 -0.037280 -0.046268 0.022056 -0.034342 
+0.003546 0.055713 0.011998 0.006224 -0.025227 
+-0.088934 -0.028368 0.079334 -0.001505 -0.127990 
+-0.061598 0.084053 0.025380 -0.096473 0.067390 
+-0.020260 0.092217 -0.018618 0.027917 -0.048252 
+0.031415 -0.091387 0.090810 0.045103 -0.026705 
+-0.064460 0.002074 0.031180 0.067323 -0.016903 
+-0.005864 -0.003330 0.069051 -0.033416 0.082203 
+0.044956 -0.053755 -0.137252 -0.046061 0.093635 
+-0.088599 0.097969 -0.032264 -0.086639 -0.091644 
+0.033056 0.016076 0.011350 0.037895 0.004198 
+0.044101 0.049833 -0.032485 0.037383 -0.129242 
+-0.042353 0.109453 -0.005173 0.074401 -0.070002 
+-0.005799 0.052127 0.027453 -0.100450 -0.058706 
+0.015240 0.069141 0.015929 0.041277 0.055504 
+-0.023227 -0.001112 0.002065 0.012704 0.036834 
+-0.089424 -0.016815 0.074728 0.052480 -0.044368 
+-0.072117 0.037136 0.079468 -0.038248 -0.057019 
+0.003825 -0.069667 0.055439 0.014255 0.032135 
+-0.036398 0.060844 -0.051464 -0.103545 0.071708 
+0.063325 0.075800 0.002963 -0.013314 0.045130 
+0.020282 -0.083516 0.014408 -0.071592 -0.027531 
+-0.010278 -0.013934 -0.042730 0.072202 0.007273 
+-0.019582 -0.018122 0.004112 -0.129409 0.026095 
+-0.031100 -0.041493 0.001026 0.068622 0.045611 
+-0.016275 0.007467 0.007254 0.005397 -0.030822 
+0.027449 -0.020425 0.019762 0.122976 0.047420 
+0.032987 0.001328 -0.098351 -0.053497 0.013908 
+0.029366 0.013866 0.122783 0.041198 -0.068939 
+0.102145 -0.006101 0.037359 -0.057573 0.015037 
+0.049004 -0.008177 -0.020529 -0.022026 0.125989 
+-0.072538 -0.037701 0.022874 -0.032248 0.015711 
+-0.012920 -0.043093 -0.039808 0.025999 -0.059643 
+-0.020747 0.120412 0.058354 0.038064 0.023366 
+0.022306 -0.008795 0.096772 0.019502 -0.021527 
+-0.031783 0.042640 -0.012099 -0.056425 0.052337 
+0.040885 0.076375 -0.024182 -0.007386 0.006375 
+0.012472 -0.048071 -0.011689 -0.054259 0.004254 
+-0.041141 0.023551 -0.047763 0.040648 0.055189 
+0.041209 0.026372 0.083642 -0.041189 0.018401 
+0.098897 -0.079038 -0.058140 -0.021688 -0.004584 
+0.008362 0.050981 0.027989 0.004290 -0.077892 
+0.079784 0.022189 -0.000950 -0.028833 0.038684 
+-0.020911 0.002112 -0.089285 -0.009057 -0.044291 
+0.067770 0.023611 -0.010856 0.057004 -0.068496 
+0.028960 -0.012273 0.005375 -0.038117 -0.075004 
+0.002103 0.002426 0.056212 0.025731 0.113254 
+-0.069929 -0.080474 -0.089722 -0.019285 0.039492 
+-0.047136 -0.038086 -0.013093 0.104245 -0.014991 
+0.002220 0.028745 -0.014120 -0.003022 0.024545 
+0.002795 -0.099925 0.077130 -0.017081 0.101062 
+-0.062377 0.063615 -0.060597 -0.033619 0.126293 
+-0.014254 0.057849 -0.017270 0.000255 0.046692 
+-0.054974 -0.092568 0.028597 -0.061007 -0.049412 
+0.026217 -0.012099 -0.046248 0.055666 0.060678 
+0.069724 -0.056332 -0.008145 -0.067284 0.012714 
+0.050454 -0.036820 -0.038474 0.094104 -0.025727 
+-0.075576 -0.039175 0.010329 0.008010 0.003823 
+0.101716 -0.042132 0.070715 0.035590 0.040456 
+0.006306 0.001003 -0.055836 0.007729 -0.026461 
+-0.015636 -0.027037 0.017196 0.048239 -0.066902 
+0.090990 0.022012 -0.017646 -0.098129 0.037112 
+0.005951 0.024530 0.021647 -0.014662 0.107048 
+-0.087049 -0.037337 0.044913 0.024889 0.092117 
+0.019813 -0.103273 -0.011622 0.001294 -0.057107 
+-0.019526 0.055974 0.039931 -0.006568 -0.007790 
+-0.048103 0.049238 0.061609 0.006077 -0.075369 
+-0.009412 0.048275 0.009865 -0.081620 0.092182 
+-0.017333 0.064175 -0.040670 0.004648 -0.022311 
+0.003981 -0.066772 0.051258 -0.003877 -0.019203 
+-0.071235 0.039869 0.084219 -0.012268 0.000880 
+-0.047928 0.058804 0.087149 -0.026185 0.038879 
+0.064338 -0.035073 -0.023367 0.048265 0.050703 
+-0.021562 0.045307 -0.009582 -0.003124 -0.020818 
+0.022634 -0.009844 0.002915 -0.015520 -0.030355 
+0.083917 -0.031796 -0.047661 0.008159 -0.040844 
+0.028545 0.035008 0.057934 0.053669 -0.054020 
+0.035223 0.042440 -0.036255 -0.096245 -0.051155 
+-0.029984 0.014055 0.019736 0.048158 0.004093 
+-0.025898 -0.014328 0.002510 0.028365 0.085207 
+0.006077 0.002203 -0.027505 0.047570 -0.017349 
+-0.020587 0.067784 0.099796 -0.026735 -0.024473 
+-0.025703 -0.094091 0.031649 0.029644 0.003411 
+0.058308 0.049034 -0.068172 -0.115474 0.069425 
+0.033811 0.118472 0.050946 0.053623 0.078579 
+-0.019271 -0.065324 0.045402 -0.037870 -0.047215 
+-0.005675 0.086373 -0.014768 0.145929 0.037386 
+-0.014700 -0.049202 0.023594 -0.056698 0.023680 
+-0.033374 -0.061027 -0.059854 0.138963 0.011599 
+0.001533 -0.035748 -0.008464 0.032284 -0.039337 
+0.081951 -0.006716 -0.010483 0.112224 0.090494 
+-0.038372 -0.067773 -0.036190 -0.038843 -0.011294 
+0.090443 0.048152 0.042218 0.056232 -0.093971 
+0.122476 -0.005575 -0.036654 -0.029043 -0.034003 
+0.022275 -0.033887 -0.060285 0.004531 0.075150 
+-0.065225 -0.097285 -0.022983 -0.069686 0.069205 
+-0.001642 -0.056254 -0.077585 0.025569 -0.054803 
+-0.100539 0.093912 0.080158 -0.002782 0.010494 
+-0.006143 0.026757 0.145882 -0.004906 0.028979 
+-0.109082 0.071364 -0.005886 -0.068041 0.037065 
+-0.018060 0.065418 -0.041926 -0.102324 -0.083326 
+0.011189 -0.087023 -0.052738 -0.029586 -0.017342 
+-0.039294 0.027361 -0.091183 0.088291 0.045424 
+0.057392 -0.021108 0.072939 0.049198 0.122993 
+0.038302 -0.020317 -0.005652 0.011269 -0.001771 
+-0.047838 -0.064151 -0.069358 0.022155 -0.083435 
+0.003546 0.019317 0.007896 0.030876 0.029493 
+-0.015680 0.011502 -0.079687 0.043705 -0.076931 
+0.007474 0.001457 0.006085 0.047001 -0.040679 
+0.038183 0.030132 -0.015742 -0.043583 -0.066149 
+-0.013762 -0.006024 0.029832 0.027818 0.040294 
+-0.027094 -0.024302 -0.105055 -0.022415 0.045939 
+0.003325 -0.031412 0.002150 0.091557 0.040350 
+-0.023031 0.051570 -0.004636 -0.046863 -0.032721 
+-0.001379 -0.136365 0.030118 -0.015619 0.060966 
+0.051409 0.002981 -0.085911 0.034787 0.092612 
+-0.024351 0.032927 -0.011889 0.047216 0.013262 
+-0.031903 -0.008671 0.062494 -0.057320 -0.025303 
+-0.026174 0.061109 -0.031321 0.063430 -0.001627 
+0.033534 -0.042932 0.077354 -0.044685 0.038110 
+0.029437 -0.011422 -0.026351 0.079037 -0.011110 
+-0.065906 -0.012694 0.002666 -0.081176 0.007352 
+0.047210 -0.022385 0.022590 0.004000 -0.056449 
+0.028936 -0.002388 -0.119043 0.000528 -0.022876 
+0.000565 -0.041766 0.035570 -0.010223 -0.055419 
+-0.003717 0.050681 0.042119 -0.073103 -0.034640 
+-0.019828 0.077821 -0.007847 0.115964 0.095672 
+-0.057148 -0.022559 0.035308 -0.042327 0.097345 
+-0.034233 -0.054020 -0.057557 0.089841 0.009229 
+0.070683 0.108539 0.046246 -0.050120 -0.008497 
+-0.056988 -0.048306 0.068906 0.015296 -0.073327 
+0.020887 0.044562 -0.007768 -0.071345 0.057720 
+0.027704 0.094761 -0.024903 0.058677 -0.054592 
+0.045246 -0.128952 0.028581 0.009761 -0.036013 
+-0.137353 0.034736 0.027748 0.045031 0.020522 
+-0.032682 -0.010848 0.135840 -0.008210 0.064445 
+0.016483 -0.066692 -0.036966 -0.018892 0.037266 
+-0.055969 -0.000146 -0.070159 -0.043813 -0.035507 
+0.007295 0.067471 0.062439 0.031139 0.004051 
+0.081763 0.058234 -0.080642 0.039998 -0.014646 
+-0.020107 0.121620 -0.031533 0.049787 0.048427 
+-0.027995 0.017340 -0.036722 -0.027766 -0.072522 
+0.016754 0.116377 -0.007417 0.117559 -0.023170 
+-0.036028 -0.013555 -0.057848 -0.006776 0.057208 
+-0.080437 -0.067988 -0.044028 0.086414 -0.051744 
+-0.073007 0.043810 0.014807 -0.049665 -0.049222 
+-0.085317 -0.073906 0.084214 0.028253 0.022565 
+0.061129 -0.008498 -0.065248 -0.093368 0.125544 
+0.101010 0.030100 0.021030 0.003998 -0.000819 
+0.051523 -0.052633 -0.031029 -0.086071 -0.030398 
+-0.049646 -0.039065 -0.114362 0.111554 -0.013322 
+0.060882 -0.037407 -0.007392 -0.128509 0.069699 
+0.010662 -0.095924 0.004877 0.022956 -0.003608 
+-0.040638 0.005864 -0.025032 0.003803 -0.033060 
+0.104406 0.009014 -0.070791 0.101107 -0.010706 
+0.018493 -0.060775 -0.046556 -0.102536 -0.058762 
+0.013012 0.047639 0.074284 -0.021771 -0.071480 
+0.121697 -0.062576 -0.061069 -0.084239 -0.030672 
+-0.053509 -0.072509 0.029717 -0.075666 0.119601 
+-0.071159 -0.064371 0.049556 -0.006955 0.050790 
+-0.014936 -0.030424 -0.029046 0.095626 -0.053380 
+0.026242 0.084580 0.046043 -0.013774 0.048761 
+-0.003036 -0.055345 0.130574 0.072416 -0.040259 
+-0.012252 0.029803 -0.017821 -0.029420 0.057413 
+0.036485 0.041237 -0.032473 -0.046230 0.000440 
+-0.003955 -0.066533 0.009267 0.004057 0.002718 
+-0.054960 0.012076 -0.051431 -0.001750 0.015747 
+0.067251 0.037864 0.116071 -0.012828 0.063945 
+0.065686 0.005781 -0.102444 0.050582 -0.006415 
+-0.022414 0.010021 0.095137 -0.034063 -0.154439 
+0.018933 -0.026790 -0.009372 -0.025828 0.058756 
+0.008035 -0.025525 -0.090140 -0.012845 -0.008559 
+0.017881 -0.039468 -0.051786 0.088240 -0.081061 
+0.017134 -0.000603 0.072990 -0.106103 -0.045466 
+-0.026151 -0.003544 0.108411 0.044002 0.070681 
+-0.065841 -0.096530 -0.055378 0.015170 0.126129 
+-0.048244 0.006173 0.013564 0.196118 -0.046276 
+-0.026911 0.046123 0.060438 -0.042470 -0.007582 
+0.086581 -0.077901 0.057108 -0.013982 0.095961 
+0.013568 0.081727 -0.063919 -0.008458 0.020099 
+0.015455 0.049515 -0.048905 -0.006740 0.017709 
+-0.023263 -0.011752 0.104977 -0.091749 -0.072352 
+0.041545 0.027311 -0.061505 0.073899 0.057681 
+0.060911 -0.048034 -0.006742 -0.018161 0.082492 
+0.044955 -0.030697 -0.042272 0.060646 0.025253 
+-0.095552 -0.007674 -0.037376 -0.042828 -0.028071 
+0.078704 0.034767 0.003569 0.103759 -0.017217 
+-0.006459 -0.003174 -0.006884 -0.052177 0.000067 
+-0.000080 0.002880 0.067251 0.077245 -0.083559 
+0.043695 0.037396 0.005392 -0.085654 0.021389 
+0.037997 0.095932 -0.028364 -0.033582 0.112597 
+-0.047949 0.014115 0.027626 0.006558 0.055128 
+-0.035469 -0.081510 -0.015853 0.031846 -0.003825 
+-0.019678 0.109423 0.054030 -0.050997 -0.017309 
+-0.027511 -0.012712 0.078270 0.073890 -0.036127 
+0.007627 0.021692 0.029178 -0.076480 0.035985 
+-0.013671 0.074729 -0.070079 -0.041782 -0.003345 
+0.081644 -0.007541 0.018661 -0.069248 -0.082554 
+-0.066409 0.041793 0.088394 0.023002 0.031839 
+-0.004239 -0.055445 0.153536 -0.029606 0.011440 
+0.120925 -0.031292 0.009491 0.023924 0.097333 
+-0.064946 0.044945 -0.036368 0.075204 -0.043170 
+0.084879 0.044759 0.026172 0.014565 0.045921 
+0.045467 -0.017067 -0.028516 -0.030039 -0.097097 
+0.033711 0.032445 0.072773 0.052865 -0.002100 
+0.007495 0.042950 -0.042792 -0.074042 -0.011530 
+-0.056728 0.042999 0.092369 0.099547 0.013443 
+-0.054306 -0.043025 -0.068623 0.095940 0.074227 
+-0.079501 -0.007941 0.000413 0.032496 -0.031837 
+-0.016260 0.033024 0.064746 -0.017847 -0.104087 
+0.000197 -0.151410 0.074026 -0.001001 -0.031403 
+0.046221 0.036460 -0.040808 -0.021449 0.032127 
+0.079554 0.080997 -0.076818 -0.019398 0.037202 
+-0.001902 -0.080469 -0.020903 -0.017046 -0.093414 
+-0.063198 0.002218 -0.041482 0.114007 -0.001262 
+0.004609 -0.045369 -0.012778 -0.106632 -0.009353 
+0.046742 -0.093363 -0.020190 0.070943 0.104612 
+-0.026496 0.030245 0.036531 0.049474 -0.034971 
+0.010070 -0.016557 -0.015930 0.036066 0.046365 
+-0.059709 -0.083439 -0.099145 -0.024957 -0.044832 
+0.031623 0.022393 0.012334 -0.009649 -0.050844 
+0.126142 0.023320 0.052720 0.016504 -0.047781 
+0.002926 0.004861 -0.060239 0.050008 0.098520 
+-0.050552 -0.025407 -0.003390 -0.014939 0.068650 
+0.032517 -0.092568 -0.058102 0.078834 -0.068898 
+0.001143 0.108254 0.006322 0.014800 -0.012314 
+0.050222 -0.034504 0.174248 0.025459 -0.002951 
+-0.040868 0.022522 -0.081662 -0.051546 0.029154 
+-0.001469 0.154137 0.010623 0.000752 0.036767 
+0.113304 -0.068389 0.029430 0.054651 -0.072835 
+-0.063281 0.122269 -0.028825 -0.023612 0.018427 
+0.073886 -0.005629 0.074243 -0.013698 0.036158 
+0.027137 -0.008779 -0.051317 0.034729 0.011425 
+-0.005290 0.084381 -0.046825 -0.054925 -0.134575 
+-0.007420 -0.034384 0.032822 -0.006816 0.016250 
+0.013071 0.022288 -0.116225 0.121282 -0.061502 
+-0.022397 0.009282 0.013596 0.083516 -0.068117 
+0.018270 0.070016 -0.019013 -0.055558 -0.038255 
+0.048457 -0.023579 0.050451 0.085665 0.035829 
+0.005139 -0.053830 -0.068741 -0.045650 0.019271 
+-0.039606 -0.040208 0.113025 0.137240 -0.039967 
+-0.050847 0.011254 0.031376 -0.087299 0.036520 
+0.012497 -0.096540 -0.005847 -0.023409 0.055187 
+0.047393 -0.016958 -0.127368 0.014126 0.013071 
+0.042850 0.030065 -0.005283 -0.003391 -0.012498 
+-0.063424 -0.066634 -0.007857 -0.012463 -0.048025 
+-0.038726 0.093465 -0.068296 -0.004955 0.020647 
+0.064345 -0.025818 0.123250 -0.113614 0.042799 
+0.012083 0.019991 -0.011713 0.093276 -0.018115 
+-0.069842 -0.040684 -0.062936 -0.036833 -0.057289 
+0.048571 -0.021162 0.059277 0.027594 0.031567 
+0.004623 0.013103 -0.070462 -0.031843 -0.062285 
+0.003964 -0.043003 0.001089 0.007283 -0.094012 
+0.089866 0.071995 0.101778 -0.112357 0.012040 
+-0.072256 0.086698 0.032881 -0.033458 0.098016 
+-0.082535 0.048160 0.026744 -0.027036 0.025903 
+-0.042452 -0.094755 -0.054770 0.004509 0.015786 
+0.053114 0.051959 0.021238 -0.079127 -0.025941 
+-0.061221 -0.032380 0.000678 0.034720 -0.119877 
+-0.029004 0.038623 -0.037611 -0.139319 -0.005737 
+0.041081 0.129303 -0.021741 0.027442 -0.123106 
+0.038200 -0.064672 0.083376 0.032648 0.033742 
+-0.048851 0.029052 0.025199 0.023531 -0.025856 
+-0.003336 0.029494 0.075111 -0.010905 0.064079 
+0.037642 -0.035068 -0.084707 0.026922 0.022164 
+-0.068680 0.075838 -0.025633 -0.004398 -0.115237 
+-0.004548 -0.002381 0.026301 0.068400 -0.006462 
+0.121501 0.071558 -0.029120 0.004560 -0.059715 
+0.020657 0.160004 -0.003257 0.029479 -0.040264 
+-0.009405 0.008581 -0.016967 -0.102333 -0.102278 
+-0.030081 0.075670 0.078504 0.112244 0.066878 
+-0.024548 -0.067136 -0.004662 -0.026166 0.044337 
+-0.066652 -0.078118 0.000364 0.038618 -0.076186 
+-0.089846 -0.017872 0.072022 -0.066259 -0.059455 
+-0.028736 -0.093805 0.079006 0.023036 -0.015992 
+-0.045002 -0.004511 -0.021728 -0.091307 0.072076 
+0.104573 0.051663 0.037822 0.009659 0.091841 
+-0.000223 -0.070248 0.002859 -0.085403 -0.067834 
+-0.010392 -0.032752 -0.036464 0.047626 0.061988 
+-0.020766 -0.098673 0.010533 -0.120437 -0.028288 
+-0.010613 -0.086247 -0.006349 0.031765 0.038227 
+-0.042501 0.012368 0.001644 -0.053936 -0.052854 
+0.040412 0.006924 0.010332 0.084276 0.018472 
+0.030309 -0.012747 -0.071598 -0.111819 0.023998 
+0.087829 0.061878 0.094608 -0.037238 -0.050664 
+0.036768 -0.026142 0.028210 -0.019029 -0.007024 
+0.056710 -0.012442 0.005440 -0.103556 0.139787 
+-0.138355 -0.040445 0.025577 -0.107722 0.078150 
+-0.001450 -0.071658 -0.025306 0.038319 -0.103037 
+-0.028321 0.098830 0.057603 -0.007905 0.078051 
+-0.009903 -0.025356 0.086842 0.012796 0.022952 
+-0.014137 0.064001 -0.027812 -0.039279 0.060983 
+0.027092 0.074119 -0.010385 -0.012999 -0.057892 
+0.027647 -0.079000 0.021994 -0.032696 -0.014011 
+-0.042864 0.021318 -0.117190 0.023970 0.036325 
+0.057969 0.007604 0.135989 -0.027874 0.036906 
+0.067047 -0.008885 -0.080445 -0.027705 0.003494 
+-0.016421 0.020609 -0.029576 0.029755 -0.109042 
+0.078601 -0.014246 0.028812 -0.022730 0.042634 
+-0.037523 0.028199 -0.083746 0.036775 -0.009971 
+0.037147 0.014445 -0.058619 0.061398 -0.011282 
+-0.015391 0.000460 0.008396 -0.046827 -0.027835 
+-0.014145 -0.069296 0.027030 0.067044 0.087990 
+-0.003414 -0.125998 -0.042444 -0.033398 0.047298 
+-0.084005 0.001739 0.050690 0.114059 -0.044072 
+0.002756 0.040246 0.024529 -0.045169 0.010004 
+-0.037919 -0.092984 0.039383 0.031606 0.079460 
+0.010879 0.059048 -0.072431 -0.003405 0.086399 
+0.008666 0.031679 -0.042362 0.054428 0.060492 
+-0.022185 -0.099806 0.129259 -0.080670 -0.043866 
+0.012856 0.013568 -0.033243 0.095598 0.093044 
+0.062030 -0.075113 -0.037729 -0.060376 0.060004 
+0.031119 -0.061372 -0.096201 0.101855 -0.016822 
+-0.082510 -0.060718 -0.033015 -0.027222 0.007231 
+0.062973 -0.041640 0.109215 0.081676 -0.013847 
+-0.013324 0.027366 -0.033590 -0.046803 -0.039116 
+0.061055 -0.037717 0.065252 0.078148 -0.053763 
+0.050494 -0.011958 0.033369 -0.107018 0.057087 
+-0.015111 0.079702 0.078616 0.051406 0.103170 
+-0.055713 -0.031900 0.039951 0.010658 0.030803 
+-0.032401 -0.161199 -0.006920 -0.041844 -0.054552 
+0.068517 0.125210 0.080621 0.013543 -0.033413 
+-0.044663 0.074392 0.035932 0.023301 -0.045912 
+-0.009902 0.066933 0.032801 -0.049038 0.095407 
+-0.039521 0.112499 -0.074490 0.036163 -0.044197 
+0.018696 -0.011558 0.057933 -0.025639 -0.061431 
+-0.081026 0.005753 0.057683 -0.011585 0.006821 
+-0.006872 0.098313 0.119539 -0.081953 0.004434 
+0.067413 -0.006236 0.002746 0.014715 0.026754 
+-0.037853 0.034309 -0.028443 0.026642 -0.037707 
+0.066061 0.019234 0.029629 -0.015190 -0.012766 
+0.027166 -0.042834 -0.056186 -0.009603 -0.083747 
+0.050175 0.073412 0.007110 0.043388 -0.043870 
+0.042677 0.025735 -0.094635 -0.142996 -0.099443 
+-0.025460 0.022178 0.045321 0.069113 0.054570 
+-0.064131 0.000827 0.011239 0.039192 0.080176 
+-0.032389 -0.013939 -0.064993 0.048795 -0.022851 
+-0.004958 0.060895 0.123682 -0.068608 -0.074900 
+-0.019889 -0.062160 0.073126 0.058232 -0.032283 
+0.081527 -0.007318 -0.072361 0.003923 0.047891 
+0.057147 0.118678 -0.020847 -0.014802 -0.015634 
+-0.052605 -0.036531 0.034867 -0.078556 -0.111584 
+-0.003560 0.003142 -0.024669 0.173160 0.032364 
+-0.053222 -0.023754 -0.040899 -0.047008 -0.003696 
+-0.033042 -0.093138 -0.004980 0.112166 0.080717 
+-0.010216 -0.006619 0.021922 0.016601 -0.003126 
+0.051343 0.053954 -0.046302 0.038985 0.078694 
+-0.030092 -0.107599 -0.081002 -0.105924 0.002939 
+0.011743 0.034846 0.003716 0.065184 -0.117462 
+0.164375 0.073700 -0.033512 -0.050132 0.014156 
+-0.000174 -0.023948 -0.024012 -0.006934 0.108972 
+-0.059460 -0.048846 -0.012336 -0.051560 0.072806 
+-0.018567 -0.058139 -0.097127 0.057960 -0.003780 
+-0.069194 0.099784 0.014634 0.002396 0.004753 
+0.054780 0.066215 0.126638 0.054455 0.006893 
+-0.141807 0.059586 -0.018459 -0.063126 -0.022803 
+-0.035254 0.069275 -0.013827 -0.071276 -0.003613 
+0.069290 -0.132719 0.008038 -0.042340 0.029226 
+-0.111912 0.046898 -0.082164 0.046524 0.042479 
+0.097773 -0.009098 0.059874 0.073312 0.066974 
+0.019922 0.006528 -0.012465 0.012819 -0.009649 
+-0.002277 -0.027303 -0.050759 -0.050323 -0.080025 
+-0.003253 -0.006990 -0.002405 -0.013040 -0.007020 
+0.025178 0.055844 -0.116797 0.017350 -0.095996 
+0.027313 0.001295 -0.036475 0.035209 -0.050719 
+0.013403 0.027367 -0.033867 -0.020572 -0.083462 
+0.026022 0.029014 0.068306 0.059719 0.045583 
+-0.102670 -0.014676 -0.070060 -0.007867 0.061628 
+0.021102 -0.044131 0.078378 0.066952 0.012162 
+-0.059452 0.052841 -0.010660 -0.090335 -0.061320 
+-0.052210 -0.080353 0.003880 -0.025212 0.019020 
+-0.010473 0.007817 -0.044796 0.000027 0.083904 
+0.006729 0.028716 -0.007627 0.008946 -0.012966 
+-0.049870 -0.073154 0.092609 -0.040256 -0.020294 
+0.003554 0.076666 -0.067856 0.042000 -0.009122 
+0.044476 -0.118767 0.080698 -0.076039 0.023373 
+0.024567 -0.033258 -0.036048 0.044153 -0.019221 
+-0.018260 -0.035700 -0.029634 -0.065584 -0.049991 
+0.042902 -0.000452 0.031084 0.045586 -0.065013 
+0.072242 -0.014513 -0.122642 -0.018067 -0.052772 
+0.066880 -0.103725 0.037586 0.013011 -0.086527 
+0.032019 0.010695 0.027327 -0.089804 -0.030002 
+0.010910 0.113012 -0.008852 0.024520 0.099760 
+-0.077270 0.018171 0.079814 0.035008 0.127627 
+-0.025609 -0.178637 -0.034357 0.054347 -0.012604 
+0.043660 0.062421 0.068757 0.002273 0.000552 
+-0.055697 0.010254 0.102285 0.024048 -0.044425 
+-0.004860 0.053366 0.013063 -0.098388 0.046218 
+0.043926 0.077559 -0.036943 0.060936 -0.016764 
+0.098322 -0.041365 0.092078 0.019431 -0.039793 
+-0.118098 0.023995 0.053538 0.015639 -0.041697 
+-0.011851 -0.052177 0.084977 -0.050669 0.070218 
+0.030401 -0.076060 -0.020483 0.012783 0.033816 
+-0.050769 0.057281 -0.040092 -0.021298 -0.002690 
+-0.001729 0.035744 0.065206 -0.002257 0.015864 
+0.044906 0.045612 -0.081326 -0.040729 -0.018151 
+-0.048153 0.086870 0.077712 0.059363 -0.027251 
+-0.089240 0.025410 -0.036539 -0.067019 -0.057377 
+0.058057 0.070889 -0.015866 0.124536 0.012038 
+-0.007238 -0.051026 -0.027541 0.019248 0.026927 
+-0.083553 -0.025718 -0.042635 0.058541 -0.011741 
+-0.059778 0.065660 0.061292 -0.086725 -0.032482 
+-0.047209 -0.027933 0.087677 0.047367 0.001582 
+0.051308 -0.018242 -0.025264 -0.062026 0.074843 
+0.088969 0.059484 0.048905 -0.025787 -0.015960 
+0.010270 -0.030210 0.036763 -0.093327 -0.114689 
+0.013105 -0.035443 -0.085439 0.043021 0.056988 
+-0.020390 -0.008308 0.009722 -0.148341 0.081086 
+0.010332 -0.101445 -0.021486 0.078663 0.025110 
+0.007874 -0.023882 -0.034158 0.002488 -0.015558 
+0.158690 -0.025837 -0.011736 0.035542 0.005703 
+0.001555 -0.019753 -0.040038 -0.051161 -0.002844 
+0.041149 0.021540 0.062971 0.012070 -0.035360 
+0.091865 -0.090158 0.020460 -0.046615 -0.038100 
+0.002630 -0.055311 0.026706 -0.008623 0.155705 
+-0.030212 -0.117746 0.084958 -0.087229 0.092780 
+-0.011810 -0.084822 -0.029035 0.127892 -0.065824 
+0.008357 0.089638 0.003467 -0.034364 0.040506 
+-0.001934 -0.050401 0.105320 0.007386 -0.011020 
+-0.055669 0.029633 -0.034990 -0.028782 0.050039 
+0.059295 0.118394 -0.033924 -0.132036 0.012985 
+0.000793 -0.035658 0.031224 -0.040614 -0.014333 
+-0.054078 0.015577 -0.031608 0.071981 0.019771 
+0.079765 -0.007986 0.076487 -0.077172 0.119140 
+0.102976 -0.039809 -0.092140 0.032478 -0.070501 
+-0.026617 -0.016197 0.009189 -0.039295 -0.117914 
+0.014457 -0.061592 0.025979 -0.028542 0.042043 
+-0.029473 -0.031444 -0.158578 -0.003258 0.058182 
+0.072344 0.052910 -0.092808 0.085354 -0.079413 
+-0.044358 -0.041179 0.072986 -0.129686 -0.025728 
+-0.005197 -0.108115 0.063915 0.073996 0.057224 
+0.000050 -0.069751 -0.062690 0.026183 0.084719 
+-0.052197 -0.011673 0.032435 0.084752 0.060158 
+-0.031241 0.023120 0.048633 -0.025976 -0.032094 
+0.051737 -0.070951 0.034497 0.003743 0.019843 
+-0.055829 0.115532 -0.098594 -0.066675 0.048946 
+0.003976 -0.010224 -0.071617 0.007215 0.017134 
+-0.023828 -0.066295 0.084251 -0.039425 -0.074279 
+-0.010390 0.058722 -0.091528 0.073371 0.071531 
+-0.005671 -0.076154 -0.032125 -0.137305 0.071102 
+0.068984 -0.088661 -0.037098 0.081501 -0.013426 
+-0.093305 0.025622 -0.014982 0.007427 -0.068188 
+0.064271 -0.035807 0.026492 0.107054 -0.095956 
+-0.008699 0.021743 -0.031579 -0.040618 0.022948 
+-0.006215 -0.028661 0.082129 0.022510 -0.090809 
+0.032763 -0.014948 -0.000344 -0.068665 0.009455 
+0.064722 0.101146 0.018141 -0.019456 0.082955 
+-0.033054 0.018056 -0.025308 -0.023021 -0.006592 
+-0.027499 -0.079456 -0.014152 0.030881 -0.059661 
+-0.023889 0.075852 0.004376 -0.014776 -0.035516 
+-0.031784 0.056947 0.125839 0.039811 -0.082984 
+-0.015402 0.040202 0.031099 -0.040303 0.047701 
+0.050471 0.082637 -0.118070 -0.024705 -0.027053 
+0.042555 -0.045217 0.043471 -0.044274 -0.055532 
+-0.050709 0.038372 0.139423 0.034228 0.044240 
+-0.049598 -0.006876 0.084222 -0.084035 0.029679 
+0.024672 -0.099431 -0.061796 0.004907 0.127399 
+-0.065852 0.032572 -0.083461 0.040649 -0.064464 
+0.021261 0.012978 0.043311 -0.006692 0.029174 
+0.033834 0.010903 -0.049322 -0.023014 -0.053063 
+0.050601 0.079776 0.017751 0.090575 -0.044427 
+0.037446 0.038015 -0.114311 -0.116158 0.028262 
+-0.049840 -0.001403 0.022194 0.134131 0.092987 
+-0.066064 -0.014258 -0.007936 0.069423 0.006734 
+-0.036449 -0.006999 0.014668 0.062054 -0.033927 
+-0.037695 0.031955 0.072185 -0.067258 -0.065412 
+-0.030677 -0.153131 0.064817 0.020761 -0.114634 
+0.046484 -0.012249 -0.045214 -0.032565 0.032724 
+0.038377 0.052687 -0.074746 0.015211 0.031545 
+-0.001416 -0.092829 -0.036780 -0.058636 -0.153621 
+-0.019035 0.008907 -0.020006 0.073795 0.064152 
+-0.000207 -0.014885 0.001697 -0.075230 0.026080 
+0.012374 -0.089499 0.037475 0.064069 0.017655 
+-0.032040 -0.028499 0.036399 0.038500 -0.014121 
+0.034750 -0.002062 -0.015799 0.000062 0.074059 
+0.038031 -0.076502 -0.082402 -0.051544 -0.043409 
+0.052959 0.046017 0.047906 -0.000054 -0.062527 
+0.077616 -0.011144 -0.036095 0.006758 0.006522 
+-0.023224 -0.010642 -0.107560 0.051291 0.103622 
+-0.051956 -0.008535 -0.042995 -0.030987 0.123523 
+0.039493 -0.107293 -0.068566 0.006004 -0.077249 
+-0.049696 0.040608 0.002098 -0.005654 0.027282 
+-0.009389 0.042181 0.088705 0.055663 0.013492 
+-0.021941 -0.005352 -0.129536 -0.049372 0.006692 
+0.010255 0.107988 0.009301 -0.029104 -0.027292 
+0.015083 -0.122624 0.012460 0.056717 -0.065848 
+-0.097599 0.064951 -0.063651 0.037039 -0.031919 
+0.160199 -0.025996 -0.003930 -0.047321 0.027398 
+0.043702 0.013525 -0.061810 0.010431 0.014853 
+0.001414 -0.021460 -0.143900 -0.026666 -0.116995 
+-0.024697 -0.005896 0.048756 -0.053298 0.041329 
+0.012695 0.052326 -0.133818 0.105903 0.031440 
+-0.035969 0.050106 0.022116 0.126387 -0.109337 
+0.072036 0.100468 -0.005336 -0.056878 -0.046406 
+0.015972 -0.014095 -0.004362 0.051363 0.094242 
+-0.044797 -0.027049 -0.074056 -0.081706 0.012076 
+-0.021437 0.047597 0.088166 0.121074 -0.053524 
+-0.101688 0.029406 0.050242 -0.066960 0.062052 
+-0.035998 -0.084834 0.048189 -0.024642 0.023264 
+-0.011644 0.041881 -0.143927 -0.036006 0.064384 
+0.021606 0.052025 -0.023292 0.037743 0.004852 
+-0.027128 -0.078095 0.017231 -0.009425 -0.026275 
+0.007197 0.096964 -0.068860 0.060880 0.037649 
+0.014117 -0.065558 0.047350 -0.098632 0.083283 
+0.045025 0.025416 0.038291 0.099379 -0.057242 
+-0.098262 -0.004438 -0.093149 -0.017525 -0.064476 
+0.025479 -0.016529 0.020430 0.012592 -0.009811 
+-0.015037 0.005498 -0.076398 -0.034881 -0.007594 
+0.028415 -0.040315 0.028704 -0.028492 -0.105515 
+0.018470 0.042456 0.045301 -0.147209 0.007810 
+-0.047688 0.032497 -0.008208 0.017988 0.084280 
+-0.102271 0.004685 -0.018636 -0.003214 0.061342 
+-0.034608 -0.028335 -0.058715 -0.016027 -0.027108 
+0.008836 0.088808 0.038542 -0.020970 0.000400 
+-0.050920 -0.007459 0.061998 -0.024563 -0.091152 
+-0.014850 0.115523 0.022779 -0.107846 0.019813 
+-0.004600 0.099048 -0.029527 -0.031147 -0.061377 
+0.023544 -0.134421 0.066807 0.032147 0.021599 
+-0.043477 0.029615 0.039209 0.024621 0.019526 
+-0.002071 0.031970 0.101991 -0.003775 0.121976 
+-0.006993 -0.073412 -0.104010 -0.006442 0.062073 
+-0.052770 0.070835 -0.091445 -0.041991 -0.068768 
+0.059883 0.020621 0.042259 0.038888 0.021605 
+0.042693 0.038667 -0.040035 0.004977 -0.076466 
+-0.022332 0.056801 -0.000212 0.035708 -0.032640 
+-0.038064 0.006782 -0.009894 -0.100385 -0.033497 
+0.025298 0.034269 0.027448 0.077164 0.050701 
+-0.027548 -0.022455 -0.035381 0.018361 -0.004348 
+-0.069287 -0.017294 -0.004310 0.071591 -0.054832 
+-0.053949 -0.001929 0.071395 -0.015681 -0.038443 
+-0.044016 -0.048662 0.078642 0.014355 0.048150 
+-0.009957 0.032861 -0.075294 -0.123870 0.026265 
+0.093728 0.046174 -0.009184 -0.050917 0.079102 
+0.050699 -0.110383 -0.040917 -0.086311 0.012596 
+0.001827 -0.059395 -0.048207 0.063786 0.026565 
+-0.077077 -0.004569 -0.044546 -0.099623 0.006256 
+-0.016101 -0.027424 0.017338 0.024906 0.015827 
+-0.027372 -0.017107 0.034566 -0.019851 -0.035154 
+0.065204 -0.032861 -0.006305 0.115986 0.005671 
+0.060617 -0.019162 -0.098096 -0.042694 0.047107 
+0.037104 -0.008058 0.084632 -0.004556 -0.101542 
+0.075086 -0.009191 0.004624 -0.043225 -0.002498 
+0.032484 0.053384 0.011807 -0.035382 0.158001 
+-0.043066 -0.071159 0.039828 -0.062471 0.016281 
+-0.043445 -0.029971 -0.014564 0.054938 -0.076111 
+0.022672 0.108672 0.099046 0.018104 0.033550 
+0.027144 -0.053217 0.067212 0.035840 -0.020805 
+-0.064595 0.009953 -0.011147 -0.063721 0.036759 
+0.018701 0.102409 -0.031796 0.011001 -0.023883 
+0.028968 -0.057157 -0.042508 -0.052145 0.008972 
+-0.065914 0.070920 -0.087959 0.024752 0.079740 
+0.056457 0.008541 0.080771 -0.042955 -0.022030 
+0.077296 -0.087393 -0.065077 0.010062 -0.035395 
+-0.023652 0.009169 0.016281 0.043270 -0.112518 
+0.024860 -0.024549 0.016927 -0.028905 0.029316 
+-0.008912 -0.016575 -0.120884 0.023903 -0.054407 
+0.044132 0.038152 0.018656 0.065922 -0.016132 
+-0.006389 -0.043456 -0.005277 -0.038377 -0.043256 
+-0.028775 -0.034704 0.041058 0.024792 0.075342 
+-0.087680 -0.084754 -0.123797 0.069380 0.046858 
+-0.058807 0.032247 -0.003162 0.075858 -0.011643 
+-0.015012 0.064356 0.018978 -0.013598 0.027903 
+-0.019744 -0.072473 0.036145 -0.023830 0.091601 
+0.000445 0.030482 -0.087404 -0.045375 0.130636 
+0.016918 0.057383 -0.002236 0.019154 0.035447 
+-0.068637 -0.064903 0.079540 -0.091132 -0.027111 
+0.020001 -0.002105 -0.063610 0.085303 0.021592 
+0.135112 -0.114788 0.011338 -0.012485 0.059281 
+0.089211 -0.036178 -0.066274 0.112956 0.046283 
+-0.074477 -0.051750 0.031961 0.038617 0.011847 
+0.114117 -0.067782 0.028677 0.047877 0.009921 
+0.018292 0.016738 -0.056403 -0.038710 -0.010604 
+0.020050 -0.022217 0.056833 0.036114 -0.051337 
+0.155982 0.012794 -0.028857 -0.120583 0.084902 
+0.013151 0.029339 0.004512 0.029269 0.158467 
+-0.059083 -0.044942 -0.002369 0.025053 0.077484 
+-0.006987 -0.128357 0.000998 0.000658 -0.008066 
+0.002694 0.078402 0.051558 0.026018 -0.035135 
+-0.051516 0.093206 0.075687 0.007585 -0.030493 
+-0.042801 0.024643 0.035323 -0.068825 0.138089 
+-0.012481 0.043826 -0.059032 -0.004079 -0.057181 
+0.030592 -0.043929 0.081829 -0.034370 -0.027097 
+-0.043916 0.028082 0.040159 -0.023825 0.016659 
+-0.040314 0.027255 0.066119 -0.088450 0.079633 
+0.085602 -0.045368 -0.019169 0.063621 0.015908 
+-0.012968 0.043077 -0.011652 -0.009363 -0.072419 
+0.041253 0.015117 -0.000599 -0.038888 -0.015197 
+0.070823 -0.013167 -0.026186 0.024055 -0.072483 
+-0.003924 0.013391 0.055366 0.084999 -0.038449 
+0.043468 0.030321 -0.071656 -0.068751 -0.085100 
+-0.045854 -0.012937 0.001146 0.029160 0.007917 
+-0.038722 -0.013069 -0.022602 0.017646 0.050031 
+-0.034069 0.004746 -0.045839 0.088322 -0.033433 
+-0.049425 0.044323 0.135449 -0.033950 -0.006189 
+0.008117 -0.074632 0.033319 0.057707 -0.034315 
+0.061949 0.058279 -0.069064 -0.024633 0.083634 
+0.044328 0.065502 0.039147 0.045297 0.010853 
+-0.035928 -0.034367 0.029180 -0.079893 -0.056124 
+-0.021337 0.069848 -0.042840 0.100637 -0.021594 
+-0.017056 -0.026458 -0.005396 -0.038921 0.024334 
+-0.013119 -0.040654 -0.019092 0.122318 0.060562 
+0.014946 -0.017839 0.014916 0.007557 -0.055684 
+0.085343 0.020079 -0.020189 0.024923 0.038626 
+-0.008572 -0.098936 -0.015287 -0.036331 -0.030196 
+0.029395 0.068464 0.062459 0.007118 -0.121145 
+0.090713 0.018611 -0.060202 -0.064626 -0.026447 
+0.020572 -0.066985 -0.020928 0.046500 0.071362 
+-0.032780 -0.113550 -0.035570 -0.046101 0.123381 
+-0.000637 -0.030887 -0.085549 0.058943 -0.047480 
+-0.069392 0.133001 0.039940 -0.054277 0.026772 
+0.012818 0.061828 0.101149 -0.034239 0.018944 
+-0.101441 0.071801 -0.065653 -0.058695 0.062080 
+0.017518 0.111010 -0.059046 -0.054110 -0.031295 
+0.055930 -0.143458 -0.044617 -0.023186 -0.013649 
+-0.111579 0.040441 -0.065712 0.110422 0.014995 
+0.035371 0.001600 0.051063 -0.002833 0.096648 
+0.023072 0.007446 -0.027126 -0.021716 0.006914 
+-0.066680 -0.023776 -0.033004 0.018842 -0.100090 
+0.006577 -0.009435 0.014480 0.005289 0.027268 
+-0.023355 -0.000517 -0.035704 0.018493 -0.073805 
+0.007356 0.036041 -0.026668 0.057975 -0.046666 
+0.054676 0.021222 0.006590 -0.020075 -0.091969 
+-0.024459 -0.004411 0.080089 0.014146 0.047996 
+-0.013099 -0.028560 -0.086210 -0.038070 0.115542 
+-0.029380 -0.069424 0.000189 0.102273 0.014531 
+-0.058430 0.045176 -0.004636 -0.048318 0.011492 
+-0.070572 -0.166966 0.056891 0.042773 0.015200 
+0.025472 0.000731 -0.061858 -0.008651 0.108291 
+0.012505 0.032344 0.012567 0.062585 0.015632 
+-0.026488 -0.012319 0.030187 -0.052121 0.002827 
+-0.017721 0.065865 -0.047380 0.020409 0.023943 
+0.079766 -0.046306 0.060273 -0.027458 0.038828 
+0.032883 -0.043636 0.000901 0.075220 -0.005792 
+-0.090456 -0.041894 0.002536 -0.104333 -0.034913 
+0.038532 -0.048225 0.033342 -0.011078 -0.035938 
+0.000390 0.038012 -0.135572 -0.025786 -0.050179 
+0.001333 -0.078764 0.020818 -0.022520 -0.065079 
+0.013806 0.009337 0.024640 -0.064068 -0.007668 
+-0.005821 0.054794 0.006679 0.052490 0.085097 
+-0.084449 0.026105 0.043027 -0.006820 0.063480 
+-0.005166 -0.108834 -0.074395 0.066384 0.003385 
+0.002689 0.152176 0.074065 -0.025017 0.001996 
+-0.026355 -0.035760 0.063399 -0.010722 -0.053613 
+0.040833 0.083154 0.032094 -0.074978 0.040456 
+0.007659 0.060872 -0.050901 0.029009 -0.066327 
+0.040735 -0.106153 0.073500 -0.025479 -0.054887 
+-0.075445 0.009415 0.016203 0.012388 0.014428 
+0.000457 -0.036095 0.143621 0.046534 0.106183 
+-0.039550 -0.060834 -0.058729 -0.030704 0.046588 
+-0.069071 0.044146 -0.047632 -0.019171 -0.064829 
+0.017817 0.047929 0.039073 0.022116 0.021014 
+0.033732 0.050846 -0.059942 0.004345 -0.029985 
+-0.080140 0.129440 0.031031 0.084146 0.016015 
+-0.036682 0.044772 -0.049258 -0.056682 -0.051988 
+0.039973 0.080584 0.002750 0.080571 0.017418 
+-0.049233 -0.050745 -0.078517 0.041796 0.028714 
+-0.073271 -0.009924 -0.046737 0.077202 -0.089452 
+-0.100286 0.026524 0.025935 -0.000519 -0.108153 
+-0.097136 -0.011694 0.088312 0.041746 0.052188 
+0.026268 -0.054000 -0.039524 -0.030580 0.094436 
+0.083377 0.058849 0.024027 0.068118 0.022595 
+0.041719 -0.067897 0.005738 -0.058511 -0.080953 
+-0.011827 -0.008352 -0.136686 0.077343 0.036266 
+0.035162 -0.013237 -0.040135 -0.166246 0.029329 
+0.031590 -0.082787 -0.003165 0.022566 -0.029527 
+-0.026857 -0.030669 -0.012846 -0.014703 -0.024941 
+0.097289 0.062474 -0.023270 0.071516 0.026007 
+0.012490 -0.079323 -0.064277 -0.101304 -0.014965 
+0.038609 0.050228 0.059018 -0.054583 -0.037042 
+0.088943 -0.050793 -0.023046 -0.036841 -0.049866 
+0.006089 -0.012353 0.050822 -0.044544 0.133501 
+-0.044647 -0.060379 0.051279 -0.028470 0.068335 
+-0.008481 -0.078112 -0.022666 0.077373 -0.024423 
+0.000007 0.064437 0.062147 -0.038681 0.032008 
+-0.017525 -0.067472 0.114370 0.020743 -0.076853 
+-0.017874 0.001327 -0.014704 -0.014656 0.034577 
+0.024361 0.056274 0.006448 -0.028830 0.044899 
+0.016576 -0.044087 -0.010917 -0.013797 -0.018111 
+-0.065385 -0.007719 -0.037632 0.031813 0.021400 
+0.049162 0.020931 0.037485 -0.026412 0.056338 
+0.036907 -0.042904 -0.132436 0.043098 -0.041228 
+-0.035680 0.034986 0.047873 -0.072791 -0.131274 
+0.044610 -0.023411 -0.025045 0.005907 0.046734 
+-0.032724 -0.061008 -0.111818 0.015564 -0.002133 
+-0.015445 -0.011766 -0.048157 0.139974 -0.079607 
+0.004936 -0.033105 0.052832 -0.087579 -0.040662 
+-0.055766 -0.026403 0.102134 0.084616 0.064986 
+-0.020826 -0.077346 -0.025393 -0.002277 0.084614 
+-0.053523 -0.091453 0.022927 0.150824 -0.002083 
+-0.001161 0.030663 0.060472 -0.050918 0.018421 
+0.027526 -0.091037 0.070144 0.040963 0.090458 
+0.030099 0.071509 -0.062928 -0.052351 0.030143 
+-0.026417 0.032481 -0.045066 0.000111 -0.004684 
+-0.002093 -0.014278 0.173191 -0.019552 -0.072985 
+0.033124 0.074779 -0.053669 0.106059 0.090086 
+0.039197 -0.065054 0.025258 -0.050488 0.068107 
+0.037370 -0.074734 -0.072895 0.041719 -0.026666 
+-0.116776 -0.050593 -0.022049 0.019100 -0.052687 
+0.077699 0.002538 0.021642 0.069070 -0.025842 
+-0.025721 0.004558 -0.051248 -0.059783 -0.021367 
+-0.043714 -0.040732 0.063823 0.074918 -0.079342 
+0.050195 0.021249 -0.028816 -0.061727 0.018248 
+0.005884 0.050434 -0.021363 -0.018341 0.100200 
+-0.041043 -0.005428 0.011984 -0.030931 0.026453 
+0.005239 -0.089215 -0.046851 0.018966 -0.029878 
+-0.019543 0.106899 0.047058 -0.097279 -0.091117 
+-0.029152 0.017775 0.066229 0.079262 -0.009853 
+0.015344 0.002972 0.005261 -0.068619 0.065134 
+0.021325 0.052198 -0.040335 -0.031105 -0.022038 
+0.046868 -0.008746 0.024060 -0.039353 -0.043527 
+-0.053729 0.048245 0.078712 0.063353 0.054853 
+0.000893 -0.011563 0.116159 -0.043972 0.030272 
+0.054786 -0.024768 -0.040403 0.056841 0.146419 
+-0.034807 0.057094 -0.054852 0.104343 -0.076770 
+0.050072 0.052860 0.019579 -0.001424 0.015739 
+0.065242 -0.006303 -0.020658 -0.036628 -0.138792 
+0.038907 0.049015 0.064288 0.105084 -0.009955 
+-0.013576 0.042749 -0.058027 -0.060563 0.018986 
+-0.042694 0.055557 0.029964 0.088314 0.017075 
+-0.098025 -0.059071 -0.029354 0.030490 0.045049 
+-0.039481 -0.016714 -0.028323 0.051148 -0.033224 
+-0.012870 -0.002631 0.095782 -0.018745 -0.067411 
+-0.067803 -0.096432 0.048605 0.001590 -0.007541 
+0.020762 0.011888 -0.020905 -0.048766 0.049192 
+0.094934 0.090567 -0.064939 0.021130 0.094459 
+-0.009557 -0.060711 -0.057713 -0.034265 -0.053583 
+-0.016969 -0.012648 -0.063332 0.105446 0.016028 
+-0.006489 -0.023448 0.027450 -0.092041 -0.002328 
+0.038286 -0.093578 0.014068 0.045683 0.038064 
+-0.013579 0.012105 0.031264 0.028629 -0.053522 
+0.018638 0.010295 -0.019741 0.051773 0.021102 
+-0.003833 -0.088492 -0.107650 -0.039638 -0.042960 
+0.017232 0.033768 0.024773 0.031441 -0.026193 
+0.102995 -0.003033 0.013478 -0.022850 -0.045542 
+-0.043058 0.040213 -0.037024 0.062912 0.127046 
+0.001959 -0.029856 0.021744 -0.024546 0.073822 
+0.034590 -0.034810 -0.073281 0.037715 -0.086249 
+-0.031013 0.094574 -0.014633 0.035329 -0.001586 
+-0.004488 -0.022600 0.105074 0.068271 0.014684 
+-0.069910 0.035216 -0.046091 -0.056792 0.016636 
+-0.031304 0.104876 0.015142 -0.014980 -0.018234 
+0.076863 -0.070661 -0.018752 0.021078 -0.015693 
+-0.082177 0.139823 -0.020936 0.000788 -0.047650 
+0.086463 0.003184 0.053978 0.016598 0.005082 
+0.037579 -0.007222 -0.068342 0.001780 -0.016838 
+0.000034 0.019368 -0.028889 -0.073195 -0.167931 
+-0.002740 -0.051503 0.060666 -0.048875 0.013166 
+-0.002367 0.018484 -0.088268 0.058154 -0.005778 
+-0.019212 0.030488 -0.007580 0.042345 -0.062956 
+0.013296 0.040910 0.018849 -0.062445 -0.062359 
+-0.004222 -0.003121 0.026069 0.075825 0.086917 
+0.019144 -0.018779 -0.072348 -0.063072 0.046388 
+0.009524 -0.032045 0.075619 0.076314 -0.042349 
+-0.026193 -0.003729 0.066560 -0.103338 -0.004071 
+-0.000469 -0.090470 0.033564 -0.067881 0.027775 
+0.040936 0.054314 -0.123113 -0.001763 0.032899 
+0.028282 0.057689 -0.011369 0.021664 -0.023786 
+-0.104368 -0.070997 0.059588 -0.014596 -0.042435 
+0.003429 0.090193 -0.113362 -0.007873 0.011799 
+0.036299 -0.059670 0.054351 -0.084675 0.034819 
+-0.007507 -0.018723 -0.009649 0.092970 0.008836 
+-0.028752 -0.044170 -0.070934 -0.103397 -0.030638 
+0.048533 -0.032645 0.020691 0.053664 0.011144 
+-0.021593 0.015401 -0.085379 -0.058031 -0.078320 
+-0.003648 -0.010436 -0.012911 -0.007136 -0.134525 
+0.030251 0.042795 0.087389 -0.092708 -0.026287 
+-0.039855 0.155791 -0.013492 -0.036665 0.072298 
+-0.133309 -0.003156 0.013287 -0.012142 0.018020 
+-0.071518 -0.038880 -0.026195 0.009773 -0.006971 
+0.044349 0.079337 0.015294 -0.035758 -0.003607 
+-0.058092 0.001525 0.042209 0.047862 -0.061178 
+0.014357 0.093707 0.022406 -0.118850 -0.034213 
+0.019269 0.070424 -0.016998 0.021550 -0.094794 
+0.004962 -0.108204 0.128671 0.015466 0.031554 
+-0.080559 0.041092 0.022039 0.001186 -0.022630 
+-0.043310 0.005192 0.074769 -0.022963 0.039941 
+0.055086 -0.081362 -0.064870 0.040274 0.052633 
+-0.062993 0.085037 -0.010420 -0.016774 -0.052155 
+0.002576 0.013639 0.061713 0.041734 -0.008138 
+0.080793 0.024851 -0.042037 0.019932 -0.048494 
+-0.029059 0.146206 0.042139 0.033378 -0.021081 
+-0.014080 0.001144 -0.016467 -0.076606 -0.056525 
+0.005355 0.079452 0.043451 0.085716 0.029884 
+-0.042582 -0.055446 0.005137 0.000476 0.001691 
+-0.041210 -0.077759 0.022581 0.046845 -0.028540 
+-0.120802 -0.013263 0.072039 -0.031588 -0.006830 
+-0.040167 -0.125914 0.088795 0.022744 0.055951 
+0.003326 0.027383 -0.028722 -0.123214 0.059791 
+0.097070 0.030682 -0.019252 0.000330 0.082240 
+0.006364 -0.113196 0.035671 -0.063923 -0.075420 
+0.017812 -0.046079 -0.059540 0.093696 0.056472 
+-0.031904 -0.065015 -0.019089 -0.091007 0.031632 
+0.018500 -0.054687 0.032704 0.040721 0.012163 
+-0.041854 -0.010613 -0.017039 -0.028850 -0.061295 
+0.029279 0.000022 -0.023031 0.084704 0.032995 
+0.000464 -0.042280 -0.122277 -0.133466 0.058700 
+0.095073 0.044206 0.068361 0.039925 -0.039455 
+0.043618 -0.033785 0.035086 -0.056425 0.019711 
+0.049265 0.053168 0.030600 -0.096642 0.090726 
+-0.078183 -0.002747 0.032400 -0.043278 0.040809 
+-0.019946 -0.088229 0.027009 0.056114 -0.113044 
+-0.020901 0.076359 0.059245 0.016714 0.040966 
+-0.010584 -0.003554 0.056159 0.010151 0.000010 
+-0.027039 0.073329 -0.015462 -0.016179 0.013943 
+0.075066 0.067462 -0.030769 -0.024755 -0.022212 
+0.040264 -0.071337 0.009512 -0.045952 0.023049 
+-0.094656 0.057345 -0.124101 -0.007720 0.037588 
+0.036110 -0.011456 0.089645 -0.007765 0.014716 
+0.059788 -0.047648 -0.019740 -0.007164 -0.013816 
+-0.060158 0.013439 0.002759 -0.025340 -0.091571 
+0.043341 -0.028869 0.026551 -0.031854 0.060505 
+-0.049549 0.033978 -0.109503 0.068308 -0.028080 
+0.053928 -0.022460 -0.086171 0.086833 -0.045654 
+0.000759 -0.010999 0.026013 -0.046809 -0.054160 
+-0.030739 -0.041475 -0.010348 0.057903 0.106187 
+-0.031967 -0.136159 -0.056033 0.020976 0.056817 
+-0.030310 0.060592 0.045537 0.086963 -0.032719 
+0.018689 0.033949 0.017964 -0.019455 0.008378 
+0.014325 -0.124934 -0.010142 0.033116 0.066121 
+-0.008592 0.059328 -0.090438 -0.060148 0.065598 
+-0.010732 0.014210 -0.046081 0.019411 0.040325 
+-0.012140 -0.084611 0.064608 -0.023209 -0.018978 
+0.028244 -0.000390 -0.070852 0.136445 0.055833 
+0.034530 -0.106636 -0.049748 -0.043837 0.056670 
+-0.020391 -0.027277 -0.125403 0.082621 -0.064172 
+-0.085208 -0.034925 0.000691 -0.016798 0.037357 
+0.058365 -0.014015 0.051315 0.078205 0.001672 
+0.009538 0.041777 0.001519 -0.031501 -0.027967 
+0.008286 -0.051667 0.045953 0.057151 -0.083565 
+0.099401 0.052489 0.027972 -0.093449 0.022696 
+0.014953 0.056948 0.062741 0.024005 0.076825 
+-0.029857 -0.002820 0.046866 -0.002247 0.022284 
+-0.005875 -0.120877 -0.029880 0.030478 -0.074641 
+0.026517 0.141968 0.041939 -0.017604 -0.063098 
+-0.042315 0.108332 0.077079 0.042498 -0.093786 
+-0.000624 0.109876 0.061671 -0.037131 0.145507 
+-0.015339 0.059306 -0.094584 0.004561 -0.031261 
+0.003112 -0.004144 0.054816 -0.035342 -0.020048 
+-0.055998 -0.008131 0.096183 0.002903 0.002243 
+-0.024465 -0.011484 0.122067 -0.117424 0.061629 
+0.100785 -0.008995 -0.021311 -0.034915 0.028992 
+-0.065386 0.062233 0.009424 0.013652 -0.066035 
+0.068604 0.015424 -0.016048 -0.028882 -0.021780 
+0.034733 -0.052918 -0.046384 0.003918 -0.037747 
+0.012883 0.061961 0.011614 0.047979 -0.020950 
+0.012662 -0.003597 -0.016134 -0.114584 -0.032846 
+-0.025773 0.029225 0.029423 0.035929 0.050919 
+-0.093288 0.024548 0.026469 0.086567 0.069788 
+-0.015915 0.014888 -0.054796 0.032121 0.010392 
+0.010094 0.027316 0.105326 -0.033913 -0.034646 
+-0.047655 -0.119467 0.014906 0.070898 -0.051722 
+0.085920 0.026450 -0.048565 -0.048393 0.040708 
+0.013886 0.115144 0.000426 0.025815 0.028617 
+-0.076183 -0.060818 0.007730 -0.030613 -0.106233 
+0.008414 0.008274 -0.071702 0.123060 -0.014131 
+-0.075611 -0.006558 -0.031029 -0.038394 0.018650 
+-0.068219 -0.088628 0.017122 0.073322 0.003094 
+0.023978 -0.022533 0.052647 0.005485 -0.022853 
+0.047387 0.058945 -0.012186 0.049493 0.117395 
+-0.008681 -0.136174 -0.057438 -0.017543 -0.020215 
+0.064213 -0.018764 0.030830 0.026967 -0.104162 
+0.097321 0.026515 -0.008192 -0.071056 -0.023457 
+0.037214 -0.028805 0.019265 0.010163 0.118572 
+-0.083174 -0.026261 -0.079021 -0.109716 0.081199 
+-0.001821 -0.039505 -0.064758 0.022196 -0.008395 
+-0.056773 0.070319 0.039957 -0.024091 -0.012671 
+0.043873 0.034859 0.113349 0.002335 -0.016767 
+-0.117575 0.038224 -0.016650 -0.007249 -0.028289 
+-0.020867 0.099598 -0.027205 -0.047643 -0.022079 
+0.062869 -0.095742 0.004349 -0.009783 -0.009631 
+-0.114174 0.101698 -0.020882 0.032183 0.046772 
+0.066030 0.023138 0.031676 0.048789 0.064708 
+0.016049 -0.022143 -0.026033 0.014811 0.017879 
+0.005234 -0.011470 -0.061933 0.012402 -0.073904 
+-0.008574 0.011810 0.022041 -0.034666 0.015863 
+0.032824 0.011302 -0.083572 0.034152 -0.049572 
+0.046696 -0.004826 -0.026282 0.006930 -0.036282 
+0.018845 0.023008 -0.022702 0.002839 -0.056809 
+0.046756 -0.012044 0.093032 0.037759 0.053581 
+-0.068607 -0.014841 -0.102444 -0.056353 0.054083 
+0.022493 -0.027398 0.044342 0.073545 -0.016381 
+-0.030891 0.080430 0.020741 -0.064660 -0.030998 
+-0.064001 -0.094590 -0.012708 0.031636 0.033664 
+0.017650 -0.020332 -0.049802 0.010802 0.048687 
+-0.014333 0.032177 -0.003331 0.031214 -0.009314 
+-0.043033 -0.047137 0.054111 -0.030505 -0.006532 
+0.021755 0.050908 -0.056081 0.074478 0.019301 
+0.003105 -0.097554 0.054912 -0.016068 0.031570 
+0.019298 -0.067236 -0.010230 0.065782 -0.048545 
+-0.032341 -0.039446 -0.004134 -0.054109 -0.014461 
+0.064470 -0.004466 0.064183 -0.013807 -0.040371 
+0.012385 -0.043869 -0.179654 -0.075267 -0.058833 
+0.027833 -0.078315 0.006233 0.019417 -0.100407 
+0.057753 0.000717 0.032416 -0.121474 -0.047213 
+-0.015720 0.092246 -0.059387 0.040603 0.109440 
+-0.058153 0.071202 0.030939 0.049569 0.087021 
+-0.076095 -0.131564 -0.027353 -0.000486 -0.015803 
+0.104552 0.088105 0.072307 -0.020686 0.043142 
+-0.089957 0.000627 0.140513 0.006435 -0.023427 
+-0.000585 0.090754 0.029188 -0.057282 0.010274 
+0.075187 0.111159 -0.057877 0.069809 -0.050756 
+0.062932 -0.036407 0.050992 0.009269 -0.006383 
+-0.106503 0.017063 0.008141 0.064195 -0.045832 
+0.011576 -0.041847 0.061264 -0.005204 0.058984 
+0.021548 -0.048377 -0.044097 0.010789 0.013451 
+-0.063551 0.063079 -0.080144 -0.027762 -0.017784 
+-0.023803 0.027775 0.060824 0.001841 -0.009369 
+0.061007 0.032254 -0.064190 -0.006988 -0.010230 
+-0.038793 0.076776 0.045814 0.049754 0.027771 
+-0.047904 0.017897 -0.052309 -0.106778 -0.037221 
+0.011510 0.060085 -0.009615 0.096725 0.047490 
+-0.010900 -0.074275 -0.061489 0.016070 0.006262 
+-0.121827 0.005654 -0.050379 0.042456 -0.027064 
+-0.068110 0.106922 0.068599 -0.034845 -0.067145 
+-0.036874 -0.041315 0.035902 0.059175 0.013939 
+0.008294 -0.000352 -0.046255 -0.058090 0.089826 
+0.091060 0.092701 0.009236 0.013325 -0.019194 
+0.039376 -0.018583 -0.016868 -0.096550 -0.086377 
+-0.016296 0.002608 -0.083265 0.049964 0.042836 
+-0.011462 -0.046261 0.084247 -0.180528 0.034023 
+0.041962 -0.128842 -0.057438 0.031753 -0.013294 
+-0.008752 -0.054893 -0.036386 -0.004605 -0.020903 
+0.113550 0.017158 -0.063971 0.047456 0.033803 
+0.026820 -0.033048 -0.057221 -0.039801 -0.029135 
+0.004112 0.055166 0.080631 0.011347 -0.039214 
+0.069633 -0.057947 0.018314 -0.110810 -0.006258 
+0.011057 -0.058755 -0.016184 -0.078348 0.154720 
+-0.056156 -0.110551 0.114867 -0.031689 0.014677 
+0.024109 -0.060048 0.019844 0.109975 -0.045339 
+0.002565 0.067118 0.019907 0.004995 0.078815 
+-0.017892 0.015592 0.118138 0.009682 -0.024624 
+-0.025684 0.027247 -0.044912 -0.011851 0.057506 
+0.106751 0.066538 -0.073230 -0.069470 -0.044869 
+-0.007738 -0.078232 0.000098 -0.056553 -0.000261 
+-0.069574 0.025403 -0.032460 0.042204 -0.009414 
+0.024336 0.002379 0.084422 -0.062254 0.070007 
+0.083297 0.011215 -0.087554 0.008854 -0.031248 
+-0.019485 0.015117 0.019539 -0.018885 -0.091190 
+0.006668 -0.029364 0.010585 0.004194 0.053285 
+-0.032862 0.007750 -0.181078 0.014752 -0.032591 
+0.035286 0.052475 -0.044255 0.152326 -0.034986 
+0.001871 -0.048154 0.032533 -0.150372 -0.061009 
+0.025623 -0.057468 0.099245 0.098809 0.047259 
+-0.017644 -0.089718 -0.052981 0.060000 0.050683 
+-0.093984 -0.012007 0.021790 0.115572 0.011056 
+-0.005239 0.022166 0.036556 -0.019139 -0.017723 
+0.036182 -0.053160 0.008506 0.003654 0.035883 
+-0.011143 0.126442 -0.042372 -0.049170 0.021566 
+-0.034390 0.004133 -0.083543 0.003794 0.003199 
+0.023898 -0.058139 0.097937 -0.021906 -0.118046 
+-0.009779 0.053140 -0.086424 0.032891 0.040964 
+0.003078 -0.054441 -0.008601 -0.059920 0.074604 
+0.120587 -0.102501 -0.066840 0.070391 0.032323 
+-0.084081 -0.025867 0.003136 -0.037883 -0.064963 
+0.077565 -0.011987 -0.030929 0.076324 -0.096244 
+-0.003417 0.038221 -0.027320 -0.034091 0.001490 
+-0.007638 -0.034015 0.052893 0.055546 -0.147361 
+0.042258 -0.020035 -0.017400 -0.076711 -0.017528 
+0.045540 0.051725 -0.024199 -0.035180 0.069090 
+-0.066211 0.016712 0.012236 -0.023556 -0.008512 
+-0.043404 -0.040132 0.006223 0.020953 -0.040829 
+-0.031888 0.063196 0.044618 -0.021241 -0.065557 
+0.013691 0.016905 0.113755 0.054933 -0.021644 
+0.016741 0.030625 0.010121 -0.037365 0.072566 
+0.006060 0.080380 -0.086262 -0.033079 -0.082250 
+0.087161 -0.049737 0.100611 -0.073241 -0.060578 
+-0.018873 0.076177 0.146262 0.031684 -0.014816 
+-0.074152 0.012492 0.111905 -0.037241 0.036831 
+0.091650 -0.058779 -0.035497 0.009717 0.105238 
+-0.068452 0.050555 -0.035241 0.038942 -0.086304 
+0.055772 0.028480 0.055647 -0.013345 0.009719 
+0.060855 -0.009449 -0.029466 -0.039618 -0.045775 
+0.012008 0.093753 0.059452 0.084398 -0.063094 
+0.003659 0.074625 -0.110159 -0.075540 -0.006386 
+0.010137 0.032774 0.014827 0.166347 0.079179 
+-0.032299 -0.047524 -0.033098 0.052546 0.023211 
+-0.005083 -0.040770 0.010451 0.047465 -0.015315 
+-0.001296 0.006073 0.070897 -0.060137 -0.051576 
+-0.032384 -0.082914 0.047391 0.018599 -0.072054 
+0.020109 0.006570 -0.072222 -0.028125 0.023991 
+0.073458 0.052141 -0.039550 0.020745 -0.004247 
+-0.027316 -0.026412 -0.050898 -0.048547 -0.135601 
+-0.022268 0.038434 -0.006989 0.106829 0.013384 
+0.000746 0.016253 -0.014804 -0.086222 0.017979 
+0.043413 -0.078404 0.050130 0.105998 0.009523 
+-0.080688 -0.029072 0.043530 0.018815 -0.027097 
+0.017270 0.008265 0.029905 0.025756 0.068311 
+0.010413 -0.062141 -0.092435 -0.009085 -0.011445 
+0.024539 0.076003 0.038136 -0.010407 -0.045941 
+0.082228 -0.001579 -0.035917 0.064558 -0.023500 
+-0.063481 0.003930 -0.067573 0.030233 0.098224 
+-0.042799 0.003064 0.009816 -0.008225 0.109707 
+-0.034960 -0.080238 -0.123786 0.048109 -0.059473 
+-0.055367 0.057060 -0.001238 0.030381 0.025074 
+0.006831 0.017900 0.111674 0.097968 0.015896 
+-0.050238 0.041727 -0.107658 -0.072374 -0.018776 
+0.001860 0.159151 -0.015443 -0.046034 -0.062151 
+0.065586 -0.066719 0.031320 0.059675 -0.022808 
+-0.066461 0.086303 -0.026658 0.070774 0.006480 
+0.159805 -0.035879 0.058009 0.012928 -0.008505 
+0.051041 -0.000692 -0.022889 0.039547 0.001201 
+-0.030295 0.029145 -0.073169 -0.019964 -0.102560 
+-0.021646 -0.009084 0.039313 -0.008758 0.059413 
+0.019112 0.068432 -0.154269 0.042342 -0.017110 
+0.003279 0.087898 0.002044 0.110066 -0.076844 
+0.041884 0.035740 -0.001247 -0.094360 -0.090406 
+0.040890 -0.028718 0.013704 0.031084 0.040651 
+-0.028325 -0.027470 -0.060171 -0.069388 0.051373 
+-0.010018 0.016317 0.030962 0.131065 -0.012443 
+-0.085994 0.023695 0.036048 -0.123378 0.017394 
+-0.014188 -0.147008 0.010122 -0.048605 0.011567 
+0.011549 0.033481 -0.087698 -0.007977 0.012262 
+0.046426 0.046093 -0.000803 0.034084 0.024231 
+-0.011190 -0.037156 0.022545 0.009116 -0.021868 
+0.000176 0.161431 -0.066441 -0.004212 0.008997 
+-0.027580 -0.039554 0.047688 -0.114080 0.037481 
+0.021017 -0.015449 0.023651 0.076890 -0.062376 
+-0.089367 -0.035901 -0.117304 -0.014988 -0.004232 
+0.065798 -0.038753 0.006615 0.027216 0.000892 
+-0.043842 -0.027915 -0.077769 -0.025289 0.007296 
+0.021684 -0.008098 0.034493 0.002195 -0.089680 
+0.015447 0.014866 0.063536 -0.107947 0.040356 
+-0.049353 0.085041 -0.019010 0.017126 0.054466 
+-0.095573 0.040640 0.005208 0.001846 0.046985 
+-0.060406 -0.059147 -0.078410 0.032047 -0.027762 
+0.023664 0.067476 0.025927 0.004505 -0.005180 
+-0.107366 -0.052865 0.059971 0.018624 -0.086019 
+-0.038792 0.082042 -0.009606 -0.082518 0.048899 
+-0.032272 0.118434 -0.029891 0.014012 -0.078772 
+0.071631 -0.124648 0.096824 0.071580 -0.014951 
+-0.078224 0.028148 0.050459 0.044666 -0.016543 
+-0.039821 -0.016072 0.087706 -0.056648 0.087416 
+0.030016 -0.076113 -0.101181 -0.049336 0.048944 
+-0.063956 0.087916 -0.036885 -0.059650 -0.044808 
+0.054549 0.006956 0.033701 0.030349 -0.017304 
+0.057616 0.016137 -0.052723 0.039906 -0.101393 
+-0.068763 0.099576 0.006264 0.083677 -0.032515 
+-0.006446 0.031066 0.009386 -0.132131 -0.067080 
+0.049843 0.065652 0.020336 0.046760 0.071347 
+-0.013796 -0.001044 -0.022677 0.019523 0.014154 
+-0.120083 -0.039608 0.050937 0.066017 -0.034193 
+-0.069836 0.025969 0.058877 -0.033911 -0.021741 
+0.005164 -0.037563 0.051151 0.030827 0.041654 
+-0.050675 0.032902 -0.056904 -0.083309 0.051372 
+0.092971 0.070309 0.017775 -0.033610 0.023024 
+0.044912 -0.113795 0.009331 -0.100912 -0.024567 
+0.000589 -0.023568 -0.041534 0.046948 0.019053 
+-0.031982 -0.010104 -0.033008 -0.120085 0.014601 
+-0.013314 -0.032777 0.022640 0.053925 0.056793 
+-0.009301 0.011372 0.004027 -0.017398 -0.055177 
+0.038121 -0.000187 0.037310 0.135976 0.012337 
+0.060620 -0.032842 -0.103898 -0.068672 0.001160 
+0.043004 -0.011293 0.085530 0.053401 -0.086065 
+0.123377 0.016620 0.045728 -0.034590 -0.014069 
+0.081166 0.009573 0.008541 0.007549 0.143099 
+-0.050664 -0.045174 0.012225 -0.052408 0.008760 
+-0.016453 -0.030851 -0.052611 0.054134 -0.086747 
+-0.068170 0.152077 0.049576 0.035454 0.051824 
+0.042151 -0.013574 0.070619 0.043677 -0.011524 
+-0.051292 0.065538 -0.002312 -0.036357 0.061560 
+0.011089 0.083280 -0.022801 -0.035830 0.007115 
+0.022494 -0.033816 -0.026885 -0.055802 0.037931 
+-0.067432 0.034696 -0.048668 0.025237 0.063419 
+0.052414 0.002888 0.073912 -0.070773 0.030231 
+0.098077 -0.052981 -0.038547 -0.044533 0.015899 
+-0.006684 0.059142 0.015994 -0.010569 -0.114343 
+0.049113 0.011781 0.007813 -0.023202 0.027226 
+-0.048228 0.023363 -0.119744 -0.005880 -0.047102 
+0.056647 0.043309 -0.020351 0.078326 -0.050033 
+0.004297 -0.004014 -0.008930 -0.041817 -0.061743 
+-0.031268 0.020567 0.053127 0.035109 0.095886 
+-0.022695 -0.103689 -0.101536 -0.035350 0.033822 
+-0.071528 -0.027884 -0.013301 0.135256 -0.057997 
+-0.006784 0.025162 0.014105 -0.008340 0.036569 
+-0.047669 -0.071591 0.074153 -0.001441 0.118717 
+-0.038919 0.054650 -0.101206 -0.019929 0.096971 
+0.019005 0.066319 -0.033069 -0.010263 0.057814 
+-0.038319 -0.115955 0.048866 -0.085605 -0.005601 
+0.066517 -0.010474 -0.068925 0.056969 0.055565 
+0.068964 -0.047482 -0.006419 -0.087153 0.047383 
+0.032670 -0.032209 -0.036239 0.140438 -0.038488 
+-0.103112 -0.063917 0.016553 0.017109 -0.018945 
+0.071205 -0.057507 0.036017 0.043139 0.045741 
+0.011471 0.019692 -0.031466 -0.001430 -0.027755 
+-0.010061 -0.028245 0.031925 0.070075 -0.044640 
+0.079725 -0.005444 -0.055716 -0.081872 0.035299 
+-0.020415 0.060898 0.037726 -0.007902 0.118692 
+-0.091406 -0.074996 0.014883 -0.011479 0.096472 
+-0.004637 -0.120365 0.011661 -0.019123 -0.055083 
+-0.021707 0.080305 0.062197 -0.007888 -0.014681 
+-0.064206 0.034037 0.066576 0.037499 -0.089224 
+-0.027816 0.038300 -0.009289 -0.093182 0.126160 
+0.000015 0.066641 -0.028392 0.023167 -0.021511 
+0.010571 -0.044084 0.057444 0.012462 0.005604 
+-0.062572 0.054520 0.053554 0.005974 0.010050 
+-0.037332 0.047516 0.066630 -0.035787 0.074909 
+0.066925 -0.030867 -0.053629 0.022622 0.033939 
+-0.033606 0.038370 0.006718 0.000847 -0.048333 
+0.027340 -0.025685 0.007564 -0.047322 -0.016881 
+0.054471 -0.017126 -0.063705 0.008150 -0.059374 
+0.010814 0.037617 0.025879 0.059782 -0.064248 
+0.042565 0.025815 -0.028591 -0.064574 -0.034454 
+-0.031756 0.000598 0.011630 0.073568 0.026113 
+-0.014567 0.003799 -0.014072 0.027953 0.071711 
+-0.011735 0.014001 -0.022183 0.070160 -0.007010 
+-0.049052 0.104807 0.111959 -0.037082 -0.007329 
+-0.011153 -0.073166 0.045311 0.040814 -0.001227 
+0.040666 0.038813 -0.049173 -0.078035 0.061429 
+0.063840 0.120475 0.035684 0.029819 0.046868 
+-0.017290 -0.035945 0.064987 -0.053189 -0.049460 
+-0.030434 0.069244 -0.015774 0.136658 -0.012690 
+0.005401 -0.045873 0.006291 -0.075787 0.046146 
+-0.001969 -0.104323 -0.047978 0.150326 0.032908 
+-0.004080 -0.012965 -0.015875 0.014424 -0.040690 
+0.098688 0.025183 -0.017974 0.072128 0.070408 
+-0.030717 -0.065297 -0.073385 -0.051253 -0.014989 
+0.058581 0.033837 0.014225 0.031069 -0.081646 
+0.089555 -0.017678 -0.068486 -0.040654 -0.051917 
+0.047272 -0.042437 -0.042350 0.019696 0.085122 
+-0.053413 -0.122905 -0.021426 -0.039696 0.051817 
+0.020410 -0.050261 -0.093654 -0.001174 -0.043672 
+-0.102482 0.084668 0.098393 -0.052216 0.050107 
+-0.005196 0.034413 0.122643 -0.031565 0.066945 
+-0.079300 0.072369 -0.011993 -0.035713 0.023269 
+-0.002546 0.076113 -0.067724 -0.084767 -0.053840 
+0.037939 -0.091041 -0.026871 -0.009130 -0.021081 
+-0.067836 0.022012 -0.052138 0.083855 0.065835 
+0.061174 -0.015388 0.100602 -0.009214 0.131331 
+0.048374 -0.020733 -0.009385 -0.013658 0.012043 
+-0.057898 -0.017737 -0.088355 0.024991 -0.079612 
+0.000356 0.019063 0.032476 0.022195 0.010063 
+-0.017095 0.024040 -0.080464 0.063948 -0.114944 
+0.012612 0.022171 -0.005737 0.035304 -0.061207 
+0.055311 0.033024 0.010681 -0.035592 -0.053947 
+-0.011004 -0.012254 0.055221 0.045545 0.049084 
+0.005046 -0.005400 -0.115901 -0.044796 0.068701 
+-0.005781 -0.031080 0.037791 0.097212 0.026378 
+-0.032777 0.026666 0.006559 -0.032347 -0.025736 
+-0.039802 -0.165807 0.007831 0.003219 0.090520 
+0.051658 -0.027677 -0.121531 0.016080 0.074249 
+-0.017031 0.055987 0.005024 0.056572 0.006367 
+-0.029525 -0.005725 0.069335 -0.024541 -0.003936 
+-0.050003 0.053274 -0.052184 0.045028 0.014532 
+0.039597 -0.056809 0.094737 -0.048726 0.081476 
+0.030138 -0.008376 0.001189 0.059831 -0.018934 
+-0.069575 0.002414 -0.006677 -0.061422 -0.024261 
+0.061177 -0.023449 -0.000323 -0.012054 -0.074484 
+0.038383 0.021929 -0.101717 -0.022789 -0.036563 
+0.013636 -0.063362 0.053011 0.004735 -0.077306 
+0.008396 0.043986 0.028657 -0.067441 -0.008945 
+-0.037043 0.071514 -0.037839 0.077754 0.066277 
+-0.065319 -0.001333 0.067596 -0.021862 0.099395 
+-0.063958 -0.082056 -0.044809 0.063666 0.000060 
+0.046881 0.121405 0.030877 -0.008566 0.007738 
+-0.043809 -0.049349 0.046172 0.040387 -0.045205 
+0.007940 0.060687 -0.036544 -0.076121 0.042696 
+-0.003337 0.102081 -0.040222 0.067540 -0.025542 
+0.030041 -0.090029 0.041031 0.020329 -0.012727 
+-0.089279 0.046642 0.018999 0.055650 0.032822 
+-0.052350 -0.055869 0.123885 -0.019014 0.088042 
+0.001830 -0.080700 -0.023798 -0.021378 0.007657 
+-0.042996 0.023456 -0.055210 -0.018485 -0.033292 
+-0.016446 0.052880 0.043571 0.032302 -0.006553 
+0.054726 0.057637 -0.079728 0.030525 -0.045654 
+-0.016583 0.136252 -0.001399 0.088342 0.059925 
+-0.018644 0.033899 -0.026838 -0.060676 -0.084264 
+-0.007612 0.086537 -0.000185 0.091345 0.006932 
+-0.012308 -0.029627 -0.057073 -0.008780 0.039234 
+-0.044963 -0.042058 -0.067929 0.074154 -0.051802 
+-0.061304 0.020025 0.026829 -0.086288 -0.076261 
+-0.069406 -0.050920 0.124796 0.022026 0.010977 
+0.038169 -0.027398 -0.073580 -0.056630 0.093880 
+0.081911 0.024440 0.008606 0.033419 -0.000580 
+0.033675 -0.032327 -0.007767 -0.065309 -0.050057 
+-0.050072 -0.014708 -0.100502 0.074529 0.005808 
+0.016991 -0.022397 -0.012659 -0.102715 0.069860 
+0.007505 -0.098626 0.017930 0.000660 0.030909 
+-0.019108 -0.001078 -0.038606 -0.007684 -0.046485 
+0.070639 0.016330 -0.034902 0.085208 0.016702 
+0.031560 -0.039036 -0.086796 -0.116810 -0.043757 
+0.027858 0.024031 0.045674 -0.036231 -0.081680 
+0.085800 -0.045662 -0.023544 -0.087212 -0.075608 
+-0.015723 -0.040238 0.013265 -0.085104 0.106223 
+-0.082075 -0.107869 0.056348 -0.031110 0.053637 
+0.000135 -0.037700 -0.055809 0.094526 -0.021978 
+0.034525 0.054227 0.053019 0.003097 0.040872 
+-0.039125 -0.085945 0.154564 0.038990 -0.027547 
+0.001012 0.012970 -0.012585 -0.008224 0.076006 
+0.057344 0.055498 -0.015305 -0.064045 -0.009027 
+0.028053 -0.055613 0.019793 0.005156 -0.005730 
+-0.081848 0.009551 -0.035835 -0.005885 -0.006310 
+0.056241 0.074335 0.101385 -0.045124 0.075779 
+0.098255 -0.025349 -0.135871 0.068593 0.018442 
+0.008761 -0.006857 0.032026 -0.041062 -0.176540 
+-0.003354 -0.030120 -0.024455 -0.009820 0.053273 
+-0.013461 -0.013288 -0.112246 0.007427 0.011505 
+0.000211 -0.007304 -0.033855 0.097950 -0.118398 
+0.030054 0.000253 0.110782 -0.135596 -0.057368 
+-0.016542 -0.002743 0.078980 0.080403 0.081391 
+-0.047818 -0.058659 -0.050242 0.012663 0.083037 
+-0.061626 0.019808 -0.007693 0.160145 0.019543 
+0.010731 0.046526 0.068954 -0.024462 -0.015987 
+0.057362 -0.091820 0.016953 0.016968 0.076250 
+0.018441 0.111365 -0.067091 -0.018485 0.053164 
+0.005666 0.035169 -0.035022 -0.006122 -0.002602 
+-0.047379 -0.023841 0.119826 -0.069174 -0.036278 
+0.066394 0.057299 -0.074109 0.057609 0.038296 
+0.057444 -0.029816 0.022335 -0.034234 0.104815 
+0.048829 -0.043111 -0.072490 0.067468 0.004571 
+-0.110285 -0.021601 -0.020759 -0.012685 -0.017656 
+0.126982 0.016916 -0.004567 0.107105 -0.027552 
+0.007144 -0.013052 -0.020950 -0.061707 -0.025117 
+-0.020557 -0.015960 0.045201 0.121070 -0.089963 
+0.035852 0.025505 -0.020181 -0.106140 0.001278 
+-0.003190 0.085573 -0.040587 -0.057134 0.092945 
+-0.049909 0.014414 0.010498 -0.020042 0.053348 
+-0.005743 -0.065367 -0.017619 0.024990 -0.016761 
+-0.001102 0.081298 0.066867 -0.051868 -0.045101 
+-0.008798 0.003830 0.082195 0.041312 -0.048878 
+0.029855 0.023388 0.029924 -0.050988 0.039197 
+-0.009097 0.043885 -0.079323 -0.043981 -0.028178 
+0.066419 0.012794 0.059244 -0.059898 -0.071819 
+-0.106012 0.055735 0.110205 0.053225 -0.000572 
+-0.024268 -0.039276 0.113882 -0.011410 0.026499 
+0.086180 -0.011966 0.013046 0.031127 0.066167 
+-0.027553 0.060671 -0.045735 0.060949 -0.051384 
+0.048136 0.029615 0.023552 0.009801 0.050664 
+0.065347 -0.026945 -0.067001 -0.022261 -0.108076 
+0.060158 0.041960 0.067335 0.052471 -0.029246 
+0.005009 0.007741 -0.052254 -0.083086 -0.017223 
+-0.052633 0.052579 0.067865 0.153710 0.017808 
+-0.087647 -0.021298 -0.079632 0.070262 0.044472 
+-0.050379 -0.010528 -0.002296 0.013103 -0.019826 
+-0.007796 0.016897 0.056191 0.006326 -0.079428 
+-0.036621 -0.124708 0.063044 -0.022890 -0.045545 
+0.041047 0.025474 -0.028608 0.002726 0.048077 
+0.099637 0.066892 -0.070620 0.001304 0.013309 
+-0.014646 -0.054310 -0.000625 -0.041803 -0.102217 
+-0.045571 -0.015019 -0.026224 0.105191 0.032885 
+-0.000149 -0.033313 0.006390 -0.078169 -0.030753 
+0.041211 -0.066981 0.004327 0.092330 0.071230 
+-0.029542 0.036311 0.054269 0.022893 -0.046259 
+-0.001621 -0.003966 0.005826 0.056342 0.042238 
+-0.028467 -0.044194 -0.112504 -0.019352 -0.056343 
+0.025104 0.017498 0.028931 0.016630 -0.061128 
+0.115505 0.002142 0.019876 0.014986 -0.066700 
+0.002735 0.027334 -0.033263 0.031449 0.112566 
+-0.025718 -0.017066 -0.019976 -0.036001 0.083541 
+0.048068 -0.073969 -0.035121 0.039966 -0.077883 
+-0.015535 0.089870 0.023998 0.011277 0.010489 
+0.033555 -0.012483 0.127157 0.027709 0.014969 
+-0.033730 0.006080 -0.048319 -0.052745 0.027066 
+-0.021685 0.115020 0.006318 -0.021548 0.021575 
+0.090884 -0.054542 -0.015574 0.030923 -0.068692 
+-0.095404 0.092367 -0.049371 -0.007959 0.012304 
+0.123951 0.014405 0.082998 -0.023011 0.029154 
+0.017924 -0.006151 -0.084050 0.033509 -0.002582 
+0.024225 0.045534 -0.034178 -0.026409 -0.121581 
+0.007469 -0.024266 0.049937 -0.020242 0.021756 
+-0.020005 0.017806 -0.083185 0.089127 -0.055074 
+-0.034134 0.018495 -0.014900 0.084470 -0.088049 
+0.012587 0.053323 -0.003416 -0.081639 -0.022685 
+0.028673 -0.041773 0.034449 0.070890 0.057659 
+0.017152 -0.036172 -0.093521 -0.025296 0.035162 
+0.029819 -0.039228 0.085181 0.163548 -0.001854 
+-0.029758 0.022943 0.021209 -0.070771 0.014429 
+-0.013368 -0.088799 -0.009255 -0.052504 0.041099 
+0.025723 0.001161 -0.107366 -0.001012 0.033565 
+0.044131 0.035694 -0.021740 0.002649 0.007424 
+-0.085656 -0.093763 -0.001170 -0.025695 -0.037360 
+-0.044626 0.064499 -0.071805 -0.003962 0.048891 
+0.024092 -0.027384 0.095833 -0.090763 0.002000 
+0.023459 0.019764 -0.029245 0.119488 0.005968 
+-0.096712 -0.071733 -0.047297 -0.074321 -0.062880 
+0.035501 -0.027280 0.037144 0.008541 0.020241 
+0.018467 -0.015675 -0.095340 -0.027954 -0.069184 
+-0.012559 -0.010226 -0.008974 0.014176 -0.089107 
+0.055689 0.060512 0.073656 -0.081115 0.028454 
+-0.087380 0.077056 -0.016938 -0.014435 0.091481 
+-0.117469 0.042015 0.041204 -0.038524 0.004206 
+-0.062655 -0.068726 -0.052024 -0.002012 -0.016652 
+0.058910 0.036081 0.033210 -0.054379 0.003673 
+-0.091615 -0.001601 0.019547 0.062960 -0.110025 
+-0.019088 0.071235 -0.039133 -0.103127 0.005287 
+0.019768 0.106127 -0.017072 -0.008543 -0.093660 
+0.044248 -0.053844 0.097968 0.000346 0.012930 
+-0.032294 0.027944 0.021196 0.006513 -0.001250 
+-0.020211 0.039251 0.067859 0.020349 0.058248 
+0.024609 -0.074146 -0.100418 0.030150 0.026229 
+-0.039773 0.099169 0.008735 -0.011164 -0.109708 
+0.001230 0.003111 0.054746 0.076006 0.018527 
+0.098756 0.017060 -0.025289 -0.006160 -0.078352 
+0.002616 0.144579 -0.020766 0.062239 -0.016518 
+-0.035809 -0.021765 -0.035105 -0.144630 -0.095066 
+0.010952 0.046460 0.068649 0.085352 0.087482 
+-0.033104 -0.048980 -0.018280 -0.014775 0.025770 
+-0.111625 -0.092460 0.005859 0.075107 -0.062936 
+-0.085897 0.005900 0.055026 -0.087076 -0.027440 
+-0.033017 -0.063979 0.066972 0.028398 0.010265 
+-0.030890 -0.001574 -0.045533 -0.106812 0.113658 
+0.104903 0.004971 0.028534 -0.023905 0.074634 
+-0.025588 -0.100482 -0.029403 -0.070372 -0.062718 
+-0.020418 -0.021403 -0.043078 0.080410 0.075037 
+-0.035154 -0.074551 -0.013207 -0.145218 -0.000997 
+-0.014570 -0.065138 0.008479 0.044833 0.024817 
+-0.038683 0.006048 0.032395 -0.031666 -0.059782 
+0.070540 0.001925 0.005314 0.060966 0.028570 
+0.041891 -0.035393 -0.044033 -0.087988 0.022861 
+0.054156 0.027545 0.100860 -0.032365 -0.073861 
+0.047055 -0.005439 0.042181 -0.028039 0.007216 
+0.034289 -0.013035 0.012785 -0.068215 0.102120 
+-0.090059 -0.035706 0.026737 -0.089429 0.038438 
+-0.040128 -0.077000 -0.054932 0.048963 -0.127689 
+-0.020587 0.094010 0.104367 -0.014378 0.068899 
+0.007536 -0.012966 0.078066 0.039371 0.013971 
+-0.019439 0.083877 -0.042991 -0.046952 0.039415 
+0.055981 0.076150 -0.000417 -0.001657 -0.048929 
+0.046983 -0.072438 -0.012301 -0.047275 -0.023350 
+-0.059164 -0.003587 -0.100107 0.007189 0.060971 
+0.042822 -0.008493 0.134842 -0.044502 -0.010541 
+0.089334 -0.016620 -0.048559 -0.027560 -0.005511 
+-0.032724 0.034262 -0.042951 0.017548 -0.145421 
+0.056398 -0.006331 0.030847 0.001640 0.057797 
+-0.063806 -0.000882 -0.091910 0.016087 -0.019546 
+0.061433 0.036856 -0.056495 0.069485 -0.031554 
+-0.012055 0.017768 0.015448 -0.074610 -0.037352 
+-0.004122 -0.064702 0.053976 0.074254 0.134606 
+-0.001169 -0.110572 -0.031859 0.002913 0.016777 
+-0.083814 0.052146 0.036174 0.103645 -0.024775 
+-0.005335 0.048662 0.002436 -0.040366 0.023406 
+-0.028113 -0.087518 0.030981 0.017198 0.042213 
+0.009268 0.022638 -0.091913 -0.007325 0.067826 
+0.007175 0.039739 -0.030746 0.019636 0.060134 
+0.002597 -0.074017 0.092250 -0.059181 -0.016534 
+-0.011358 -0.017007 -0.017703 0.102970 0.122663 
+0.057377 -0.041987 -0.053837 -0.031373 0.063014 
+0.006671 -0.090650 -0.138471 0.106533 0.010497 
+-0.102967 -0.075716 -0.038511 -0.071066 0.017321 
+0.093836 -0.006301 0.118555 0.061346 0.013449 
+-0.000558 0.009959 -0.026395 -0.028150 -0.032041 
+0.044864 -0.060691 0.041780 0.046048 -0.051785 
+0.062238 0.004872 0.030879 -0.128966 0.012667 
+0.023845 0.078065 0.044196 0.046742 0.148868 
+-0.030628 -0.042491 0.021535 -0.011918 0.043483 
+-0.047778 -0.117530 -0.005429 -0.008792 -0.098801 
+0.020009 0.106857 0.089897 0.024663 -0.061028 
+-0.015371 0.069471 0.045508 0.046334 -0.069530 
+0.010731 0.072915 0.065071 -0.058529 0.071085 
+-0.012683 0.094842 -0.090176 0.065021 -0.044033 
+0.019140 -0.012000 0.092585 -0.034244 -0.040555 
+-0.084684 -0.011832 0.061629 0.009146 0.027188 
+-0.026891 0.080725 0.088536 -0.084517 0.044584 
+0.093624 -0.016766 0.021101 -0.002887 0.009587 
+-0.068241 0.007223 -0.040467 0.035718 -0.043998 
+0.050133 0.003764 0.010389 -0.000348 -0.020485 
+0.049700 -0.066152 -0.041930 -0.021767 -0.077931 
+0.035116 0.108204 0.024456 0.032605 -0.043283 
+0.024511 0.009921 -0.031396 -0.173419 -0.049078 
+-0.014906 0.036522 0.041073 0.061298 0.024532 
+-0.074779 -0.013084 0.018258 0.041618 0.044657 
+-0.018537 0.007319 -0.066448 0.027570 -0.032981 
+-0.024516 0.092119 0.129643 -0.016032 -0.072728 
+-0.044848 -0.084876 0.072567 0.089222 -0.006042 
+0.077927 0.001985 -0.041619 -0.009227 0.069988 
+0.088912 0.133137 -0.016458 0.008841 0.031287 
+-0.047102 -0.083683 0.030843 -0.112282 -0.103671 
+-0.006459 -0.031852 -0.057190 0.207145 -0.002174 
+-0.047509 -0.051560 -0.034172 -0.058751 0.014904 
+-0.055125 -0.123573 -0.025949 0.094512 0.035410 
+0.003286 0.008369 0.029091 0.023530 -0.021963 
+0.056787 0.037285 -0.041070 0.012945 0.109131 
+-0.012940 -0.088290 -0.060557 -0.064861 0.027757 
+0.012384 0.004678 -0.022211 0.059852 -0.089239 
+0.120404 0.036099 -0.023853 -0.025676 0.001845 
+0.000298 -0.029950 -0.027028 0.027301 0.128816 
+-0.046314 -0.030039 0.011273 -0.059749 0.055640 
+0.001351 -0.032191 -0.091552 0.054641 0.010980 
+-0.105128 0.083057 0.017517 0.006971 -0.014256 
+0.046500 0.060555 0.099997 0.034081 0.044797 
+-0.117689 0.049576 -0.059663 -0.109523 0.015561 
+-0.039089 0.097102 -0.015266 -0.057401 0.015861 
+0.029363 -0.123492 0.017355 -0.025359 0.005924 
diff --git a/codec2/tags/0.4/src/codebook/mel1.txt b/codec2/tags/0.4/src/codebook/mel1.txt
new file mode 100644 (file)
index 0000000..06d59f8
--- /dev/null
@@ -0,0 +1,9 @@
+1 8
+550
+600
+650
+700
+750
+800
+850
+900
diff --git a/codec2/tags/0.4/src/codebook/mel2.txt b/codec2/tags/0.4/src/codebook/mel2.txt
new file mode 100644 (file)
index 0000000..b650319
--- /dev/null
@@ -0,0 +1,5 @@
+1 4
+50
+100
+200
+300
diff --git a/codec2/tags/0.4/src/codebook/mel3.txt b/codec2/tags/0.4/src/codebook/mel3.txt
new file mode 100644 (file)
index 0000000..b81a729
--- /dev/null
@@ -0,0 +1,17 @@
+1 16
+800
+850
+900
+950
+1000
+1050
+1100
+1150
+1200
+1250
+1300
+1350
+1400
+1450
+1500
+1650
diff --git a/codec2/tags/0.4/src/codebook/mel4.txt b/codec2/tags/0.4/src/codebook/mel4.txt
new file mode 100644 (file)
index 0000000..3f79ca8
--- /dev/null
@@ -0,0 +1,9 @@
+1 8
+25
+50
+75
+100
+125
+150
+175
+250
diff --git a/codec2/tags/0.4/src/codebook/mel5.txt b/codec2/tags/0.4/src/codebook/mel5.txt
new file mode 100644 (file)
index 0000000..5791d4a
--- /dev/null
@@ -0,0 +1,9 @@
+1 8
+1350
+1400
+1450
+1500
+1550
+1600
+1650
+1700
diff --git a/codec2/tags/0.4/src/codebook/mel6.txt b/codec2/tags/0.4/src/codebook/mel6.txt
new file mode 100644 (file)
index 0000000..40b319d
--- /dev/null
@@ -0,0 +1,6 @@
+1 4
+25
+50
+100
+150
+
diff --git a/codec2/tags/0.4/src/codebookd.c b/codec2/tags/0.4/src/codebookd.c
new file mode 100644 (file)
index 0000000..48c35cf
--- /dev/null
@@ -0,0 +1,433 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/dlsp1.txt */
+static const float codes0[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+  /* codebook/dlsp2.txt */
+static const float codes1[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+  /* codebook/dlsp3.txt */
+static const float codes2[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+  /* codebook/dlsp4.txt */
+static const float codes3[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  250,
+  300,
+  350,
+  400,
+  450,
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250,
+  1300,
+  1350,
+  1400
+};
+  /* codebook/dlsp5.txt */
+static const float codes4[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  250,
+  300,
+  350,
+  400,
+  450,
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250,
+  1300,
+  1350,
+  1400
+};
+  /* codebook/dlsp6.txt */
+static const float codes5[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  250,
+  300,
+  350,
+  400,
+  450,
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250,
+  1300,
+  1350,
+  1400
+};
+  /* codebook/dlsp7.txt */
+static const float codes6[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+  /* codebook/dlsp8.txt */
+static const float codes7[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+  /* codebook/dlsp9.txt */
+static const float codes8[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+  /* codebook/dlsp10.txt */
+static const float codes9[] = {
+  25,
+  50,
+  75,
+  100,
+  125,
+  150,
+  175,
+  200,
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700,
+  725,
+  750,
+  775,
+  800
+};
+
+const struct lsp_codebook lsp_cbd[] = {
+  /* codebook/dlsp1.txt */
+  {
+    1,
+    5,
+    32,
+    codes0
+  },
+  /* codebook/dlsp2.txt */
+  {
+    1,
+    5,
+    32,
+    codes1
+  },
+  /* codebook/dlsp3.txt */
+  {
+    1,
+    5,
+    32,
+    codes2
+  },
+  /* codebook/dlsp4.txt */
+  {
+    1,
+    5,
+    32,
+    codes3
+  },
+  /* codebook/dlsp5.txt */
+  {
+    1,
+    5,
+    32,
+    codes4
+  },
+  /* codebook/dlsp6.txt */
+  {
+    1,
+    5,
+    32,
+    codes5
+  },
+  /* codebook/dlsp7.txt */
+  {
+    1,
+    5,
+    32,
+    codes6
+  },
+  /* codebook/dlsp8.txt */
+  {
+    1,
+    5,
+    32,
+    codes7
+  },
+  /* codebook/dlsp9.txt */
+  {
+    1,
+    5,
+    32,
+    codes8
+  },
+  /* codebook/dlsp10.txt */
+  {
+    1,
+    5,
+    32,
+    codes9
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookdt.c b/codec2/tags/0.4/src/codebookdt.c
new file mode 100644 (file)
index 0000000..a80c6e4
--- /dev/null
@@ -0,0 +1,153 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/lspdt1.txt */
+static const float codes0[] = {
+  -75,
+  -50,
+  -25,
+  0,
+  25,
+  50,
+  75,
+  100
+};
+  /* codebook/lspdt2.txt */
+static const float codes1[] = {
+  -75,
+  -50,
+  -25,
+  0,
+  25,
+  50,
+  75,
+  100
+};
+  /* codebook/lspdt3.txt */
+static const float codes2[] = {
+  -50,
+  0,
+  50,
+  100
+};
+  /* codebook/lspdt4.txt */
+static const float codes3[] = {
+  -50,
+  0,
+  50,
+  100
+};
+  /* codebook/lspdt5.txt */
+static const float codes4[] = {
+  -50,
+  0,
+  50,
+  100
+};
+  /* codebook/lspdt6.txt */
+static const float codes5[] = {
+  -50,
+  0,
+  50,
+  100
+};
+  /* codebook/lspdt7.txt */
+static const float codes6[] = {
+  -50,
+  50
+};
+  /* codebook/lspdt8.txt */
+static const float codes7[] = {
+  -50,
+  50
+};
+  /* codebook/lspdt9.txt */
+static const float codes8[] = {
+  -50,
+  50
+};
+  /* codebook/lspdt10.txt */
+static const float codes9[] = {
+  -50,
+  50
+};
+
+const struct lsp_codebook lsp_cbdt[] = {
+  /* codebook/lspdt1.txt */
+  {
+    1,
+    3,
+    8,
+    codes0
+  },
+  /* codebook/lspdt2.txt */
+  {
+    1,
+    3,
+    8,
+    codes1
+  },
+  /* codebook/lspdt3.txt */
+  {
+    1,
+    2,
+    4,
+    codes2
+  },
+  /* codebook/lspdt4.txt */
+  {
+    1,
+    2,
+    4,
+    codes3
+  },
+  /* codebook/lspdt5.txt */
+  {
+    1,
+    2,
+    4,
+    codes4
+  },
+  /* codebook/lspdt6.txt */
+  {
+    1,
+    2,
+    4,
+    codes5
+  },
+  /* codebook/lspdt7.txt */
+  {
+    1,
+    1,
+    2,
+    codes6
+  },
+  /* codebook/lspdt8.txt */
+  {
+    1,
+    1,
+    2,
+    codes7
+  },
+  /* codebook/lspdt9.txt */
+  {
+    1,
+    1,
+    2,
+    codes8
+  },
+  /* codebook/lspdt10.txt */
+  {
+    1,
+    1,
+    2,
+    codes9
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookge.c b/codec2/tags/0.4/src/codebookge.c
new file mode 100644 (file)
index 0000000..9472272
--- /dev/null
@@ -0,0 +1,279 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/gecb.txt */
+static const float codes0[] = {
+  2.71,  12.0184,
+  0.04675,  -2.73881,
+  0.120993,  8.38895,
+  -1.58028,  -0.892307,
+  1.19307,  -1.91561,
+  0.187101,  -3.27679,
+  0.332251,  -7.66455,
+  -1.47944,  31.2461,
+  1.52761,  27.7095,
+  -0.524379,  5.25012,
+  0.55333,  7.4388,
+  -0.843451,  -1.95299,
+  2.26389,  8.61029,
+  0.143143,  2.36549,
+  0.616506,  1.28427,
+  -1.71133,  22.0967,
+  1.00813,  17.3965,
+  -0.106718,  1.41891,
+  -0.136246,  14.2736,
+  -1.70909,  -20.5319,
+  1.65787,  -3.39107,
+  0.138049,  -4.95785,
+  0.536729,  -1.94375,
+  0.196307,  36.8519,
+  1.27248,  22.5565,
+  -0.670219,  -1.90604,
+  0.382092,  6.40113,
+  -0.756911,  -4.90102,
+  1.82931,  4.6138,
+  0.318794,  0.73683,
+  0.612815,  -2.07505,
+  -0.410151,  24.7871,
+  1.77602,  13.1909,
+  0.106457,  -0.104492,
+  0.192206,  10.1838,
+  -1.82442,  -7.71565,
+  0.931346,  4.34835,
+  0.308813,  -4.086,
+  0.397143,  -11.8089,
+  -0.048715,  41.2273,
+  0.877342,  35.8503,
+  -0.759794,  0.476634,
+  0.978593,  7.67467,
+  -1.19506,  3.03883,
+  2.63989,  -3.41106,
+  0.191127,  3.60351,
+  0.402932,  1.0843,
+  -2.15202,  18.1076,
+  1.5468,  8.32271,
+  -0.143089,  -4.07592,
+  -0.150142,  5.86674,
+  -1.40844,  -3.2507,
+  1.56615,  -10.4132,
+  0.178171,  -10.2267,
+  0.362164,  -0.028556,
+  -0.070125,  24.3907,
+  0.594752,  17.4828,
+  -0.28698,  -6.90407,
+  0.464818,  10.2055,
+  -1.00684,  -14.3572,
+  2.32957,  -3.69161,
+  0.335745,  2.40714,
+  1.01966,  -3.15565,
+  -1.25945,  7.9919,
+  2.38369,  19.6806,
+  -0.094947,  -2.41374,
+  0.20933,  6.66477,
+  -2.22103,  1.37986,
+  1.29239,  2.04633,
+  0.243626,  -0.890741,
+  0.428773,  -7.19366,
+  -1.11374,  41.3414,
+  2.6098,  31.1405,
+  -0.446468,  2.53419,
+  0.490104,  4.62757,
+  -1.11723,  -3.24174,
+  1.79156,  8.41493,
+  0.156012,  0.183336,
+  0.532447,  3.15455,
+  -0.764484,  18.514,
+  0.952395,  11.7713,
+  -0.332567,  0.346987,
+  0.202165,  14.7168,
+  -2.12924,  -15.559,
+  1.35358,  -1.92679,
+  -0.010963,  -16.3364,
+  0.399053,  -2.79057,
+  0.750657,  31.1483,
+  0.655743,  24.4819,
+  -0.45321,  -0.735879,
+  0.2869,  6.5467,
+  -0.715673,  -12.3578,
+  1.54849,  3.87217,
+  0.271874,  0.802339,
+  0.502073,  -4.85485,
+  -0.497037,  17.7619,
+  1.19116,  13.9544,
+  0.01563,  1.33157,
+  0.341867,  8.93537,
+  -2.31601,  -5.39506,
+  0.75861,  1.9645,
+  0.24132,  -3.23769,
+  0.267151,  -11.2344,
+  -0.273126,  32.6248,
+  1.75352,  40.432,
+  -0.784011,  3.04576,
+  0.705987,  5.66118,
+  -1.3864,  1.35356,
+  2.37646,  1.67485,
+  0.242973,  4.73218,
+  0.491227,  0.354061,
+  -1.60676,  8.65895,
+  1.16711,  5.9871,
+  -0.137601,  -12.0417,
+  -0.251375,  10.3972,
+  -1.43151,  -8.90411,
+  0.98828,  -13.209,
+  0.261484,  -6.35497,
+  0.395932,  -0.702529,
+  0.283704,  26.8996,
+  0.420959,  15.4418,
+  -0.355804,  -13.7278,
+  0.527372,  12.3985,
+  -1.16956,  -15.9985,
+  1.90669,  -5.81605,
+  0.354492,  3.85157,
+  0.82576,  -4.16264,
+  -0.49019,  13.0572,
+  2.25577,  13.5264,
+  -0.004956,  -3.23713,
+  0.026709,  7.86645,
+  -1.81037,  -0.451183,
+  1.08383,  -0.18362,
+  0.135836,  -2.26658,
+  0.375812,  -5.51225,
+  -1.96644,  38.6829,
+  1.97799,  24.5655,
+  -0.704656,  6.35881,
+  0.480786,  7.05175,
+  -0.976417,  -2.42273,
+  2.50215,  6.75935,
+  0.083588,  3.2588,
+  0.543629,  0.910013,
+  -1.23196,  23.0915,
+  0.785492,  14.807,
+  -0.213554,  1.688,
+  0.004748,  18.1718,
+  -1.54719,  -16.1168,
+  1.50104,  -3.28114,
+  0.080133,  -4.63472,
+  0.476592,  -2.18093,
+  0.44247,  40.304,
+  1.07277,  27.592,
+  -0.594738,  -4.16681,
+  0.42248,  7.61609,
+  -0.927521,  -7.27441,
+  1.99162,  1.29636,
+  0.291307,  2.39878,
+  0.721081,  -1.95062,
+  -0.804256,  24.9295,
+  1.64839,  19.1197,
+  0.060852,  -0.590639,
+  0.266085,  9.10325,
+  -1.9574,  -2.88461,
+  1.11693,  2.6724,
+  0.35458,  -2.74854,
+  0.330733,  -14.1561,
+  -0.527851,  39.5756,
+  0.991152,  43.195,
+  -0.589619,  1.26919,
+  0.787401,  8.73071,
+  -1.0138,  1.02507,
+  2.8254,  1.89538,
+  0.24089,  2.74557,
+  0.427195,  2.54446,
+  -1.95311,  12.244,
+  1.44862,  12.0607,
+  -0.210492,  -3.37906,
+  -0.056713,  10.204,
+  -1.65237,  -5.10274,
+  1.29475,  -12.2708,
+  0.111608,  -8.67592,
+  0.326634,  -1.16763,
+  0.021781,  31.1258,
+  0.455335,  21.4684,
+  -0.37544,  -3.37121,
+  0.39362,  11.302,
+  -0.851456,  -19.4149,
+  2.10703,  -2.22886,
+  0.373233,  1.92406,
+  0.884438,  -1.72058,
+  -0.975127,  9.84013,
+  2.0033,  17.3954,
+  -0.036915,  -1.11137,
+  0.148456,  5.39997,
+  -1.91441,  4.77382,
+  1.44791,  0.537122,
+  0.194979,  -1.03818,
+  0.495771,  -9.95502,
+  -1.05899,  32.9471,
+  2.01122,  32.4544,
+  -0.30965,  4.71911,
+  0.436082,  4.63552,
+  -1.23711,  -1.25428,
+  2.02274,  9.42834,
+  0.190342,  1.46077,
+  0.479017,  2.48479,
+  -1.07848,  16.2217,
+  1.20764,  9.65421,
+  -0.258087,  -1.67236,
+  0.071852,  13.416,
+  -1.87723,  -16.072,
+  1.28957,  -4.87118,
+  0.067713,  -13.4427,
+  0.435551,  -4.1655,
+  0.46614,  30.5895,
+  0.904895,  21.598,
+  -0.518369,  -2.53205,
+  0.337363,  5.63726,
+  -0.554975,  -17.4005,
+  1.69188,  1.14574,
+  0.227934,  0.889297,
+  0.587303,  -5.72973,
+  -0.262133,  18.6666,
+  1.39505,  17.0029,
+  -0.01909,  4.30838,
+  0.304235,  12.6699,
+  -2.07406,  -6.46084,
+  0.920546,  1.21296,
+  0.284927,  -1.78547,
+  0.209724,  -16.024,
+  -0.636067,  31.5768,
+  1.34989,  34.6775,
+  -0.971625,  5.30086,
+  0.590249,  4.44971,
+  -1.56787,  3.60239,
+  2.1455,  4.51666,
+  0.296022,  4.12017,
+  0.445299,  0.868772,
+  -1.44193,  14.1284,
+  1.35575,  6.0074,
+  -0.012814,  -7.49657,
+  -0.43,  8.50012,
+  -1.20469,  -7.11326,
+  1.10102,  -6.83682,
+  0.196463,  -6.234,
+  0.436747,  -1.12979,
+  0.141052,  22.8549,
+  0.290821,  18.8114,
+  -0.529536,  -7.73251,
+  0.63428,  10.7898,
+  -1.33472,  -20.3258,
+  1.81564,  -1.90332,
+  0.394778,  3.79758,
+  0.732682,  -8.18382,
+  -0.741244,  11.7683
+};
+
+const struct lsp_codebook ge_cb[] = {
+  /* codebook/gecb.txt */
+  {
+    2,
+    8,
+    256,
+    codes0
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookjnd.c b/codec2/tags/0.4/src/codebookjnd.c
new file mode 100644 (file)
index 0000000..76eedd7
--- /dev/null
@@ -0,0 +1,3496 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/lsp1.txt */
+static const float codes0[] = {
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600
+};
+  /* codebook/lsp2.txt */
+static const float codes1[] = {
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700
+};
+  /* codebook/lsp3.txt */
+static const float codes2[] = {
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250
+};
+  /* codebook/lsp4.txt */
+static const float codes3[] = {
+  700,
+  800,
+  900,
+  1000,
+  1100,
+  1200,
+  1300,
+  1400,
+  1500,
+  1600,
+  1700,
+  1800,
+  1900,
+  2000,
+  2100,
+  2200
+};
+  /* ../unittest/lspjnd5-10.txt */
+static const float codes4[] = {
+  1400,  2000,  2400,  2500,  3300,  3400,
+  1400,  1900,  2400,  2500,  3200,  3400,
+  1400,  1800,  2400,  2500,  3200,  3300,
+  1400,  1800,  2400,  2500,  3300,  3400,
+  1400,  2100,  2400,  2600,  3300,  3400,
+  1400,  1900,  2300,  2600,  3200,  3300,
+  1400,  1900,  2100,  2600,  3100,  3200,
+  1600,  2100,  2400,  2500,  3200,  3300,
+  1500,  1900,  2300,  2600,  3100,  3200,
+  1600,  1800,  2400,  2600,  3200,  3300,
+  1700,  1900,  2300,  2500,  3200,  3300,
+  1800,  1900,  2300,  2500,  3200,  3300,
+  1800,  2000,  2300,  2500,  3300,  3400,
+  1900,  2000,  2200,  2600,  3300,  3400,
+  1700,  2000,  2700,  2900,  3200,  3300,
+  1700,  2100,  2600,  2900,  3200,  3300,
+  1600,  2000,  2500,  2800,  3200,  3400,
+  1500,  1800,  2300,  2400,  3200,  3300,
+  1400,  1700,  2200,  2400,  3200,  3300,
+  1300,  1700,  2200,  2300,  3200,  3300,
+  1300,  1600,  2200,  2300,  3200,  3300,
+  1200,  1600,  2200,  2400,  3200,  3300,
+  1200,  1600,  2200,  2300,  3200,  3300,
+  1200,  1500,  2200,  2300,  3100,  3300,
+  1200,  1500,  2200,  2300,  3200,  3300,
+  1300,  1500,  2100,  2300,  3000,  3200,
+  1300,  1600,  2000,  2200,  3000,  3200,
+  1400,  1700,  2000,  2300,  3100,  3200,
+  1500,  1700,  2000,  2300,  3200,  3300,
+  1300,  1600,  1900,  2100,  3100,  3200,
+  1200,  1500,  2100,  2300,  3200,  3300,
+  1500,  1800,  2000,  2300,  3000,  3200,
+  1200,  1500,  2200,  2400,  3300,  3400,
+  1200,  1500,  2200,  2400,  3200,  3400,
+  1200,  1500,  2200,  2400,  3200,  3300,
+  1300,  1500,  2300,  2400,  3200,  3300,
+  1300,  1500,  2200,  2500,  3000,  3200,
+  1300,  1600,  2300,  2600,  3000,  3200,
+  1400,  1800,  2400,  2600,  3100,  3200,
+  1700,  2000,  2500,  2800,  3200,  3300,
+  1900,  2200,  2600,  2700,  3100,  3200,
+  1900,  2300,  2600,  2900,  3200,  3300,
+  2000,  2300,  2600,  2900,  3300,  3400,
+  1900,  2300,  2500,  2900,  3300,  3400,
+  1800,  2300,  2500,  2800,  3300,  3400,
+  1600,  1800,  2400,  2500,  3200,  3400,
+  1500,  1800,  2400,  2600,  3100,  3400,
+  1800,  2100,  2600,  2900,  3300,  3500,
+  2000,  2500,  2700,  3000,  3400,  3500,
+  2200,  2500,  2700,  3100,  3300,  3400,
+  2300,  2500,  2700,  3100,  3300,  3400,
+  2100,  2500,  2600,  3000,  3200,  3300,
+  2100,  2400,  2500,  3000,  3200,  3300,
+  1700,  2000,  2300,  2700,  3100,  3200,
+  1700,  2000,  2300,  2800,  3100,  3300,
+  1600,  1900,  2200,  2800,  3000,  3200,
+  1500,  1900,  2100,  2700,  3000,  3200,
+  1400,  1900,  2000,  2600,  3000,  3100,
+  1200,  1600,  2100,  2400,  3200,  3300,
+  1500,  1600,  2300,  2400,  3200,  3400,
+  1600,  1700,  2200,  2400,  3100,  3400,
+  1600,  1700,  2200,  2400,  3200,  3400,
+  1700,  1800,  2300,  2400,  3200,  3400,
+  1700,  1800,  2300,  2400,  3200,  3300,
+  1700,  1800,  2300,  2400,  3100,  3200,
+  1700,  1800,  2200,  2500,  3100,  3200,
+  1600,  1800,  2100,  2400,  3000,  3100,
+  1500,  1700,  2100,  2300,  3000,  3100,
+  1400,  1700,  2100,  2500,  3000,  3200,
+  1000,  1700,  2300,  2500,  3200,  3300,
+  1100,  1700,  2400,  2500,  3300,  3400,
+  1500,  2000,  2300,  2600,  3000,  3300,
+  1300,  1600,  1800,  2600,  2900,  3100,
+  1300,  1600,  1900,  2200,  2900,  3000,
+  1500,  1700,  2200,  2500,  2900,  3000,
+  1500,  1600,  2100,  2400,  2900,  3100,
+  1500,  1600,  2000,  2600,  3000,  3100,
+  1600,  1700,  2100,  2600,  3100,  3200,
+  1700,  1900,  2100,  2500,  3300,  3400,
+  1700,  1900,  2200,  2500,  3300,  3400,
+  1600,  2000,  2400,  2600,  3000,  3300,
+  1700,  2100,  2400,  2600,  3100,  3300,
+  1700,  2100,  2400,  2600,  3200,  3400,
+  1400,  1600,  2300,  2400,  3300,  3400,
+  1300,  1400,  2100,  2200,  2900,  3200,
+  1000,  1300,  2200,  2300,  3200,  3400,
+  1600,  2000,  2300,  2600,  2800,  3100,
+  1600,  2000,  2300,  2600,  2900,  3200,
+  1600,  2000,  2300,  2600,  3100,  3300,
+  1700,  2000,  2300,  2600,  3100,  3300,
+  1600,  1900,  2300,  2500,  3100,  3400,
+  1500,  1900,  2300,  2600,  3000,  3300,
+  1500,  1900,  2300,  2600,  3100,  3300,
+  1500,  2000,  2300,  2700,  3100,  3300,
+  2000,  2500,  2700,  2900,  3300,  3400,
+  2000,  2400,  2600,  2800,  3300,  3400,
+  1700,  2300,  2600,  2800,  3300,  3400,
+  1400,  1700,  2400,  2500,  3200,  3300,
+  1300,  1600,  2300,  2500,  3200,  3300,
+  1300,  1500,  2000,  2300,  3200,  3300,
+  1500,  1800,  2200,  2400,  2900,  3300,
+  1500,  1700,  2200,  2400,  3000,  3200,
+  1400,  1800,  2200,  2400,  3000,  3300,
+  1400,  1800,  2200,  2400,  3000,  3200,
+  1200,  1500,  2100,  2400,  3100,  3300,
+  1300,  1800,  2200,  2300,  3300,  3400,
+  1300,  1700,  2200,  2400,  3300,  3400,
+  1400,  1500,  2300,  2500,  3100,  3400,
+  1500,  1600,  2300,  2500,  3100,  3300,
+  1500,  1600,  2400,  2500,  3100,  3300,
+  1400,  1800,  2400,  2500,  3000,  3300,
+  1300,  1700,  2100,  2500,  3000,  3200,
+  1300,  1600,  2100,  2500,  3100,  3200,
+  1300,  1700,  2200,  2500,  3100,  3200,
+  1300,  1600,  2200,  2500,  3100,  3300,
+  1300,  1700,  2300,  2600,  3200,  3300,
+  1300,  1700,  2400,  2500,  3200,  3400,
+  1500,  1900,  2500,  2600,  3200,  3400,
+  1500,  2000,  2500,  2600,  3300,  3400,
+  1600,  2100,  2600,  2900,  3400,  3500,
+  1600,  1900,  2500,  2800,  3300,  3400,
+  1500,  2000,  2500,  2600,  3200,  3300,
+  1600,  2000,  2500,  2700,  3100,  3200,
+  1500,  1700,  2400,  2700,  3100,  3200,
+  1500,  1600,  2400,  2600,  3100,  3300,
+  1500,  1600,  2200,  2400,  3000,  3200,
+  1500,  1600,  2200,  2300,  3000,  3200,
+  1400,  1700,  2100,  2300,  3000,  3100,
+  1700,  1800,  2300,  2800,  3100,  3300,
+  1800,  2100,  2500,  2800,  3200,  3300,
+  1800,  2200,  2500,  2700,  3200,  3300,
+  1900,  2200,  2500,  2800,  3200,  3300,
+  1800,  2200,  2500,  2800,  3200,  3300,
+  1600,  2000,  2300,  2500,  3000,  3200,
+  1500,  1900,  2200,  2500,  3100,  3200,
+  1500,  1700,  2200,  2400,  3100,  3200,
+  1600,  1700,  2200,  2400,  3000,  3100,
+  1600,  1700,  2300,  2400,  3000,  3100,
+  1600,  1700,  2300,  2400,  3000,  3200,
+  1600,  1700,  2300,  2400,  2900,  3100,
+  1600,  1700,  2300,  2400,  2900,  3200,
+  1600,  1700,  2300,  2500,  2900,  3200,
+  1500,  1600,  2300,  2500,  2900,  3300,
+  1400,  1500,  2200,  2500,  3000,  3300,
+  1200,  1400,  2300,  2400,  3000,  3300,
+  1100,  1400,  2300,  2400,  3100,  3300,
+  1200,  1800,  2400,  2500,  3300,  3400,
+  1400,  2000,  2400,  2700,  3300,  3400,
+  1600,  2100,  2500,  2800,  3300,  3400,
+  1700,  2300,  2600,  2900,  3300,  3400,
+  1400,  2100,  2400,  2600,  3100,  3200,
+  1300,  1600,  2300,  2500,  3000,  3200,
+  1200,  1500,  2100,  2500,  3000,  3200,
+  1300,  1700,  2100,  2300,  2900,  3200,
+  1500,  1600,  2200,  2400,  3000,  3100,
+  1500,  1600,  2200,  2500,  3000,  3200,
+  1600,  1700,  2200,  2500,  3100,  3200,
+  1600,  1700,  2200,  2500,  3100,  3300,
+  1600,  1700,  2200,  2400,  3100,  3300,
+  1600,  1700,  2300,  2500,  3300,  3400,
+  1700,  1800,  2300,  2500,  3300,  3400,
+  1800,  2000,  2300,  2700,  3200,  3300,
+  1900,  2000,  2300,  2700,  3300,  3400,
+  1900,  2000,  2100,  2400,  3300,  3400,
+  1800,  2100,  2400,  2800,  3200,  3400,
+  2000,  2200,  2500,  2700,  3100,  3300,
+  2000,  2300,  2500,  2700,  3100,  3300,
+  2000,  2300,  2500,  2800,  3300,  3400,
+  1900,  2300,  2500,  2800,  3300,  3400,
+  1800,  1900,  2300,  2600,  3300,  3400,
+  1800,  1900,  2400,  2600,  3200,  3300,
+  1700,  1900,  2400,  2500,  3200,  3300,
+  1700,  1800,  2300,  2600,  3200,  3300,
+  1600,  1700,  2300,  2600,  3200,  3300,
+  1600,  1900,  2300,  2600,  3200,  3300,
+  1500,  1800,  2200,  2400,  3200,  3300,
+  1500,  1800,  2100,  2500,  3100,  3200,
+  1700,  2100,  2400,  2800,  3200,  3300,
+  1900,  2100,  2500,  2900,  3200,  3300,
+  1900,  2100,  2400,  2900,  3200,  3300,
+  1800,  2100,  2400,  2800,  3100,  3200,
+  2000,  2200,  2500,  2800,  3100,  3300,
+  2000,  2200,  2700,  2800,  3100,  3300,
+  2000,  2300,  2600,  2800,  3200,  3300,
+  1800,  2000,  2600,  2800,  3200,  3300,
+  1800,  2100,  2600,  2800,  3200,  3400,
+  1800,  2200,  2500,  2700,  3300,  3400,
+  1700,  1900,  2500,  2600,  3200,  3400,
+  1700,  1900,  2400,  2700,  3200,  3400,
+  1500,  1900,  2500,  2600,  3100,  3300,
+  1200,  2100,  2400,  2600,  3200,  3300,
+  1300,  1800,  2400,  2500,  3200,  3300,
+  1200,  1600,  2400,  2600,  3200,  3300,
+  1200,  1900,  2500,  2700,  3200,  3300,
+  1300,  2000,  2400,  2700,  3200,  3300,
+  1200,  1900,  2300,  2500,  3200,  3300,
+  1100,  1800,  2300,  2400,  3200,  3300,
+  1100,  1900,  2300,  2500,  3200,  3300,
+  1100,  2100,  2400,  2600,  3200,  3300,
+  1000,  1900,  2400,  2500,  3200,  3300,
+  1000,  1500,  2400,  2500,  3100,  3200,
+  1000,  1500,  2300,  2400,  3100,  3200,
+  1000,  1900,  2300,  2500,  3000,  3100,
+  1100,  1900,  2300,  2400,  3100,  3200,
+  1200,  1800,  2300,  2400,  3100,  3200,
+  1300,  1800,  2300,  2400,  3100,  3200,
+  1400,  1800,  2300,  2400,  3200,  3300,
+  1600,  1700,  2300,  2400,  3100,  3300,
+  1600,  1700,  2300,  2400,  3100,  3200,
+  1600,  1700,  2200,  2400,  3100,  3200,
+  1500,  1800,  2200,  2400,  3100,  3200,
+  1400,  1800,  2200,  2400,  3100,  3200,
+  1400,  1800,  2200,  2400,  3000,  3100,
+  1800,  2000,  2300,  2800,  2900,  3100,
+  1500,  1900,  2300,  2500,  3100,  3200,
+  1500,  1900,  2300,  2400,  3300,  3400,
+  1500,  2000,  2400,  2600,  3300,  3400,
+  1600,  2000,  2400,  2700,  3300,  3400,
+  1600,  2000,  2400,  2500,  3300,  3400,
+  1600,  2000,  2400,  2600,  3300,  3400,
+  1700,  2100,  2400,  2600,  2900,  3200,
+  1600,  2000,  2500,  2700,  2900,  3200,
+  1500,  1800,  2400,  2800,  3000,  3200,
+  1500,  1800,  2100,  2400,  2900,  3100,
+  1600,  1900,  2100,  2400,  3100,  3300,
+  1600,  1900,  2100,  2500,  3100,  3200,
+  1800,  1900,  2300,  2400,  3100,  3300,
+  1900,  2000,  2500,  2600,  3200,  3300,
+  1900,  2200,  2600,  2700,  3300,  3400,
+  1900,  2300,  2600,  2700,  3300,  3400,
+  1900,  2300,  2700,  2800,  3300,  3400,
+  2000,  2200,  2700,  2800,  3300,  3400,
+  2000,  2400,  2700,  2800,  3300,  3400,
+  2000,  2300,  2700,  2800,  3300,  3400,
+  2000,  2400,  2600,  2700,  3300,  3400,
+  2000,  2200,  2600,  2700,  3200,  3300,
+  1900,  2100,  2600,  2700,  3200,  3300,
+  1900,  2100,  2500,  2700,  3200,  3300,
+  1900,  2000,  2400,  2600,  3200,  3300,
+  1900,  2000,  2400,  2600,  3100,  3200,
+  1900,  2000,  2300,  2500,  3100,  3200,
+  1800,  2000,  2300,  2500,  3100,  3200,
+  1800,  1900,  2300,  2500,  3000,  3100,
+  1800,  1900,  2400,  2700,  3000,  3200,
+  1800,  1900,  2500,  2700,  3000,  3200,
+  1800,  2000,  2500,  2700,  3100,  3200,
+  2000,  2300,  2600,  2900,  3100,  3300,
+  1900,  2300,  2700,  3000,  3200,  3300,
+  2000,  2400,  2700,  3000,  3200,  3300,
+  2100,  2500,  2800,  3000,  3200,  3300,
+  2200,  2400,  2800,  3000,  3300,  3400,
+  1900,  2200,  2700,  2900,  3300,  3400,
+  2200,  2400,  2900,  3100,  3300,  3400,
+  2100,  2400,  2800,  3100,  3300,  3400,
+  2200,  2500,  2800,  3100,  3300,  3400,
+  2100,  2400,  2600,  2800,  3300,  3400,
+  2000,  2400,  2600,  2700,  3200,  3300,
+  1700,  2000,  2400,  2600,  3200,  3300,
+  1700,  1900,  2400,  2600,  3100,  3300,
+  1800,  1900,  2400,  2700,  3200,  3300,
+  1800,  1900,  2400,  2700,  3100,  3200,
+  1800,  1900,  2400,  2700,  3100,  3300,
+  1800,  1900,  2300,  2700,  3100,  3200,
+  1700,  1900,  2200,  2700,  3000,  3300,
+  1700,  1800,  2300,  2700,  2900,  3200,
+  1700,  1900,  2300,  2700,  2900,  3200,
+  1700,  1900,  2200,  2700,  3000,  3200,
+  1700,  2000,  2300,  2800,  3000,  3200,
+  1400,  1700,  2300,  2400,  3300,  3400,
+  1400,  1800,  2300,  2400,  3300,  3400,
+  1400,  1900,  2300,  2400,  3300,  3400,
+  1400,  2100,  2300,  2500,  3300,  3400,
+  1400,  2100,  2300,  2600,  3300,  3400,
+  1700,  2200,  2500,  2700,  3200,  3400,
+  1800,  2100,  2600,  2900,  3200,  3400,
+  1800,  2100,  2600,  2800,  3300,  3400,
+  1800,  2100,  2600,  2700,  3300,  3400,
+  1800,  2000,  2500,  2700,  3300,  3400,
+  1800,  2100,  2400,  2700,  3300,  3400,
+  1800,  2100,  2400,  2600,  3300,  3400,
+  1800,  2200,  2400,  2600,  3300,  3400,
+  1800,  2200,  2400,  2700,  3300,  3400,
+  1900,  2300,  2600,  2900,  3200,  3400,
+  1900,  2200,  2600,  2700,  3200,  3400,
+  1900,  2100,  2600,  2700,  3300,  3400,
+  2000,  2100,  2500,  2700,  3200,  3300,
+  2000,  2100,  2500,  2700,  3300,  3400,
+  2000,  2200,  2500,  2700,  3300,  3400,
+  2000,  2100,  2600,  2700,  3300,  3400,
+  2000,  2100,  2500,  2700,  3400,  3500,
+  1900,  2100,  2500,  2600,  3200,  3400,
+  2000,  2200,  2600,  2700,  3200,  3400,
+  2100,  2300,  2600,  2800,  3300,  3400,
+  2100,  2500,  2700,  3100,  3300,  3400,
+  2100,  2500,  2800,  3100,  3300,  3400,
+  2100,  2300,  2400,  2700,  3200,  3300,
+  2000,  2300,  2500,  2800,  3200,  3300,
+  1700,  2100,  2500,  2700,  3200,  3300,
+  1600,  1900,  2300,  2700,  3100,  3300,
+  1600,  1800,  2300,  2800,  3100,  3300,
+  1500,  1800,  2300,  2400,  3100,  3200,
+  1500,  1700,  2300,  2400,  3100,  3300,
+  1400,  1700,  2300,  2400,  3100,  3300,
+  1400,  1500,  2300,  2400,  3100,  3300,
+  1300,  1500,  2300,  2400,  3100,  3300,
+  1300,  1500,  2400,  2500,  3100,  3300,
+  1300,  1500,  2400,  2500,  3000,  3300,
+  1300,  1500,  2300,  2400,  2900,  3300,
+  1400,  1500,  2400,  2500,  2900,  3300,
+  1500,  1600,  2300,  2500,  2800,  3300,
+  1600,  1700,  2300,  2500,  2800,  3400,
+  1700,  1800,  2300,  2500,  2800,  3300,
+  1800,  1900,  2400,  2500,  3100,  3400,
+  1800,  1900,  2400,  2500,  3200,  3400,
+  1900,  2000,  2400,  2500,  3300,  3400,
+  1900,  2000,  2300,  2500,  3300,  3400,
+  1900,  2200,  2600,  2900,  3400,  3500,
+  1800,  2200,  2600,  2900,  3300,  3400,
+  1900,  2300,  2600,  3000,  3400,  3500,
+  2000,  2300,  2600,  3000,  3300,  3400,
+  1800,  2200,  2500,  2900,  3200,  3300,
+  1800,  2100,  2400,  2700,  3200,  3300,
+  1900,  2100,  2500,  2800,  3200,  3300,
+  1700,  2100,  2500,  2700,  3100,  3300,
+  1400,  1800,  2300,  2600,  3100,  3200,
+  1300,  1600,  1700,  2400,  3000,  3100,
+  1500,  1800,  2300,  2600,  3000,  3200,
+  1900,  2200,  2500,  2800,  3000,  3300,
+  2000,  2300,  2600,  2800,  3100,  3300,
+  2000,  2300,  2700,  2900,  3100,  3300,
+  2100,  2300,  2700,  2900,  3100,  3300,
+  2000,  2300,  2700,  3000,  3300,  3400,
+  1700,  2200,  2500,  2600,  3300,  3400,
+  1400,  2000,  2400,  2600,  3300,  3400,
+  1300,  1900,  2300,  2600,  3100,  3300,
+  1200,  1600,  2200,  2400,  3000,  3100,
+  1100,  1500,  2200,  2400,  3100,  3200,
+  1100,  1400,  2300,  2400,  3200,  3300,
+  1100,  1500,  2300,  2400,  3200,  3300,
+  1100,  1500,  2300,  2400,  3300,  3400,
+  1300,  1400,  2400,  2500,  3100,  3300,
+  1500,  2200,  2500,  2600,  3100,  3200,
+  2100,  2400,  2700,  3000,  3200,  3300,
+  2200,  2400,  2700,  3000,  3300,  3400,
+  2000,  2400,  2700,  3000,  3300,  3400,
+  2000,  2400,  2700,  2900,  3300,  3400,
+  2000,  2300,  2700,  3000,  3400,  3500,
+  2100,  2400,  2700,  3000,  3400,  3500,
+  2100,  2500,  2700,  3100,  3400,  3500,
+  1900,  2400,  2600,  2800,  3300,  3400,
+  1900,  2100,  2600,  2800,  3300,  3400,
+  1900,  2100,  2500,  2700,  3300,  3400,
+  1900,  2100,  2500,  2600,  3300,  3400,
+  1800,  2200,  2400,  2800,  3300,  3400,
+  1800,  2000,  2400,  2700,  3300,  3400,
+  1900,  2000,  2400,  2700,  3200,  3300,
+  2000,  2100,  2400,  2600,  3300,  3400,
+  1500,  2100,  2200,  2500,  3300,  3400,
+  1400,  1900,  2300,  2500,  3300,  3400,
+  1400,  2000,  2300,  2600,  3200,  3300,
+  1400,  1800,  2200,  2600,  3100,  3200,
+  1700,  2100,  2400,  2700,  3100,  3300,
+  1800,  2000,  2400,  2700,  3000,  3200,
+  1600,  2000,  2300,  2500,  3100,  3200,
+  1700,  2000,  2300,  2500,  3100,  3300,
+  1600,  1900,  2200,  2600,  2900,  3200,
+  1600,  1900,  2300,  2600,  2900,  3200,
+  1600,  1900,  2300,  2600,  3000,  3200,
+  1600,  1800,  2200,  2500,  3000,  3200,
+  1600,  1800,  2300,  2600,  3100,  3200,
+  1700,  1800,  2400,  2600,  3100,  3200,
+  1700,  1800,  2300,  2500,  3000,  3100,
+  1700,  1800,  2300,  2500,  3100,  3200,
+  1700,  1800,  2200,  2400,  3000,  3200,
+  1700,  1800,  2100,  2300,  3100,  3200,
+  1700,  1900,  2100,  2400,  3000,  3200,
+  1800,  2000,  2200,  2400,  3000,  3200,
+  1800,  2000,  2300,  2500,  3100,  3300,
+  1800,  2000,  2300,  2600,  3200,  3300,
+  1800,  2000,  2400,  2600,  3200,  3300,
+  1800,  2000,  2400,  2600,  3300,  3400,
+  1800,  1900,  2400,  2500,  3300,  3400,
+  1700,  1900,  2400,  2500,  3300,  3400,
+  1700,  2100,  2400,  2600,  3300,  3400,
+  1800,  2100,  2500,  2900,  3300,  3400,
+  1800,  2200,  2600,  2800,  3300,  3500,
+  1800,  2100,  2600,  2900,  3300,  3400,
+  1800,  2100,  2600,  3000,  3200,  3300,
+  1800,  2200,  2600,  2900,  3200,  3300,
+  1800,  2100,  2600,  2800,  3200,  3300,
+  1900,  2200,  2400,  2700,  3100,  3200,
+  1700,  2000,  2300,  2700,  3000,  3100,
+  1700,  2000,  2300,  2600,  3000,  3100,
+  1800,  2100,  2400,  2600,  3100,  3200,
+  1800,  2100,  2400,  2700,  3100,  3200,
+  1900,  2100,  2400,  2700,  3200,  3300,
+  1800,  2000,  2400,  2700,  3100,  3300,
+  1700,  2000,  2400,  2700,  3100,  3300,
+  1700,  1900,  2300,  2700,  3100,  3300,
+  1700,  2000,  2300,  2600,  3100,  3200,
+  1600,  1900,  2300,  2600,  3100,  3200,
+  1400,  1700,  2200,  2500,  3000,  3200,
+  1500,  1700,  2100,  2500,  2900,  3100,
+  1500,  1800,  2300,  2600,  2900,  3200,
+  1500,  1900,  2400,  2600,  3000,  3200,
+  1600,  2000,  2300,  2700,  3100,  3200,
+  1600,  2000,  2400,  2700,  3100,  3300,
+  1600,  2200,  2600,  2900,  3300,  3400,
+  1700,  2200,  2600,  3000,  3300,  3400,
+  1700,  2100,  2500,  2900,  3300,  3400,
+  1700,  2200,  2500,  2900,  3300,  3400,
+  1500,  1800,  2400,  2500,  3200,  3400,
+  1500,  1700,  2400,  2500,  3300,  3400,
+  1500,  1700,  2300,  2400,  3300,  3400,
+  1600,  1800,  2300,  2400,  3300,  3400,
+  1600,  1800,  2400,  2500,  3300,  3400,
+  1600,  1700,  2400,  2500,  2800,  3300,
+  1600,  1800,  2300,  2500,  2700,  3200,
+  1600,  1700,  2300,  2500,  2700,  3200,
+  1600,  1700,  2200,  2500,  2700,  3100,
+  1600,  1700,  2200,  2500,  2600,  3000,
+  1600,  1700,  2400,  2500,  2700,  3200,
+  1600,  1700,  2400,  2500,  2800,  3200,
+  1700,  1800,  2400,  2600,  2900,  3300,
+  1700,  1800,  2300,  2600,  2800,  3300,
+  1700,  1800,  2400,  2600,  3000,  3400,
+  1700,  1800,  2300,  2500,  2900,  3300,
+  1600,  1700,  2300,  2500,  3000,  3300,
+  1400,  1800,  2000,  2400,  3000,  3200,
+  1400,  1700,  2000,  2300,  3000,  3200,
+  1700,  2000,  2300,  2500,  3100,  3200,
+  1700,  1800,  2400,  2500,  3100,  3200,
+  1800,  2000,  2400,  2500,  3200,  3300,
+  1900,  2000,  2400,  2600,  3300,  3400,
+  1900,  2000,  2300,  2600,  3300,  3400,
+  2000,  2100,  2200,  2600,  3300,  3400,
+  2000,  2100,  2300,  2600,  3300,  3400,
+  2100,  2200,  2500,  2800,  3300,  3400,
+  2000,  2100,  2300,  2500,  3200,  3300,
+  1900,  2000,  2200,  2600,  3200,  3300,
+  1800,  1900,  2100,  2600,  3100,  3200,
+  1700,  1900,  2100,  2600,  3000,  3200,
+  1500,  1800,  2100,  2300,  3000,  3200,
+  1500,  1800,  2100,  2400,  3100,  3300,
+  1500,  1700,  2200,  2500,  3100,  3300,
+  1500,  1800,  2200,  2300,  3200,  3300,
+  1500,  1900,  2300,  2500,  3300,  3400,
+  1800,  2300,  2600,  3000,  3400,  3500,
+  1900,  2300,  2700,  3000,  3400,  3500,
+  2000,  2300,  2800,  3100,  3300,  3400,
+  2100,  2300,  2800,  3100,  3300,  3400,
+  2000,  2300,  2700,  3000,  3200,  3300,
+  2000,  2200,  2600,  2900,  3100,  3300,
+  2000,  2200,  2500,  2800,  3000,  3200,
+  2000,  2200,  2400,  2800,  3100,  3200,
+  1600,  2000,  2400,  2600,  3100,  3200,
+  1400,  1900,  2400,  2500,  3100,  3200,
+  1400,  1900,  2300,  2600,  3000,  3200,
+  1500,  2000,  2400,  2700,  2900,  3200,
+  2000,  2300,  2800,  3000,  3200,  3400,
+  2100,  2300,  2900,  3100,  3300,  3400,
+  1800,  2300,  2600,  2900,  3400,  3500,
+  1700,  2300,  2500,  2900,  3300,  3400,
+  1300,  2000,  2400,  2700,  3300,  3400,
+  1200,  1900,  2300,  2600,  3300,  3400,
+  1200,  1800,  2300,  2600,  3300,  3400,
+  1100,  1800,  2300,  2500,  3300,  3400,
+  1800,  2200,  2600,  2800,  3300,  3400,
+  1800,  2000,  2500,  2700,  3200,  3400,
+  1700,  2100,  2600,  2700,  3200,  3300,
+  1700,  2200,  2600,  2800,  3300,  3400,
+  1800,  2200,  2600,  3000,  3300,  3500,
+  1700,  2100,  2600,  2800,  3300,  3400,
+  1700,  2100,  2500,  2800,  3300,  3400,
+  1700,  2200,  2500,  2800,  3300,  3400,
+  1700,  2200,  2500,  2800,  3300,  3500,
+  1800,  2200,  2500,  2900,  3300,  3400,
+  2100,  2200,  2600,  2700,  3100,  3400,
+  1900,  2100,  2500,  2600,  3100,  3400,
+  1900,  2000,  2500,  2600,  3200,  3400,
+  1900,  2000,  2600,  2700,  3200,  3400,
+  1800,  1900,  2500,  2600,  3100,  3400,
+  1600,  2000,  2700,  2800,  3300,  3400,
+  1400,  2000,  2700,  2800,  3300,  3400,
+  1000,  1900,  2700,  2800,  3300,  3400,
+  1000,  1400,  2700,  2900,  3200,  3400,
+  1100,  1500,  2700,  2900,  3200,  3300,
+  1200,  1700,  2400,  2500,  3100,  3300,
+  1300,  1900,  2400,  2500,  3300,  3400,
+  1300,  2000,  2400,  2600,  3200,  3300,
+  1400,  2000,  2400,  2600,  3100,  3300,
+  1500,  2000,  2400,  2700,  3000,  3300,
+  1300,  2100,  2400,  2700,  3200,  3300,
+  1400,  1900,  2700,  2800,  3300,  3400,
+  1500,  1900,  2700,  2800,  3300,  3400,
+  1400,  1800,  2600,  2700,  3200,  3400,
+  1800,  2300,  2600,  2700,  2900,  3200,
+  1500,  1700,  2400,  2600,  2800,  3300,
+  1600,  1700,  2500,  2700,  2900,  3300,
+  1800,  1900,  2600,  2700,  3200,  3400,
+  1800,  1900,  2600,  2700,  3200,  3300,
+  2000,  2200,  2600,  2800,  3200,  3300,
+  2000,  2100,  2600,  2700,  3200,  3400,
+  2000,  2100,  2500,  2800,  3200,  3400,
+  2000,  2100,  2600,  2700,  3100,  3300,
+  1900,  2000,  2400,  2600,  3100,  3300,
+  1800,  1900,  2400,  2600,  3100,  3200,
+  1700,  2000,  2300,  2400,  3200,  3300,
+  1900,  2100,  2500,  2700,  3200,  3400,
+  1900,  2000,  2500,  2700,  3200,  3400,
+  1800,  2000,  2500,  2600,  3200,  3300,
+  1800,  2100,  2500,  2700,  3200,  3400,
+  1800,  2000,  2500,  2600,  3200,  3400,
+  1800,  1900,  2400,  2500,  3000,  3300,
+  1800,  2000,  2400,  2600,  3100,  3300,
+  1900,  2100,  2500,  2600,  3200,  3300,
+  2000,  2100,  2500,  2600,  3300,  3400,
+  2000,  2200,  2500,  2600,  3300,  3400,
+  2100,  2200,  2500,  2600,  3300,  3400,
+  2100,  2200,  2500,  2600,  3200,  3400,
+  2100,  2200,  2400,  2500,  3200,  3400,
+  2000,  2100,  2400,  2500,  3200,  3400,
+  1800,  1900,  2400,  2600,  3200,  3400,
+  1800,  1900,  2500,  2600,  3200,  3400,
+  1800,  2300,  2700,  2900,  3300,  3400,
+  1900,  2400,  2800,  3000,  3300,  3500,
+  1900,  2300,  2800,  3100,  3300,  3400,
+  2000,  2300,  2700,  2900,  3200,  3400,
+  1800,  2000,  2600,  2900,  3300,  3400,
+  1700,  2000,  2500,  2600,  3200,  3400,
+  1600,  2100,  2500,  2600,  3300,  3400,
+  1500,  2100,  2500,  2600,  3300,  3400,
+  1500,  2000,  2400,  2500,  3200,  3300,
+  1400,  2000,  2400,  2600,  3200,  3300,
+  1300,  1900,  2400,  2600,  3100,  3300,
+  1300,  2000,  2600,  2800,  3300,  3400,
+  1500,  2000,  2600,  2700,  3300,  3400,
+  1600,  2000,  2500,  2700,  3200,  3400,
+  1600,  2000,  2500,  2600,  3200,  3400,
+  1600,  2000,  2400,  2500,  3200,  3400,
+  1700,  2000,  2300,  2500,  3300,  3400,
+  1600,  1900,  2300,  2400,  3300,  3400,
+  1500,  1700,  2200,  2400,  3200,  3300,
+  1500,  1800,  2200,  2500,  2900,  3200,
+  1300,  1700,  2200,  2500,  3000,  3300,
+  1200,  1700,  2200,  2600,  3000,  3200,
+  1100,  1700,  2300,  2600,  3100,  3300,
+  1200,  1800,  2300,  2500,  3300,  3400,
+  1100,  2100,  2400,  2600,  3300,  3400,
+  1200,  2200,  2400,  2700,  3300,  3400,
+  1200,  2300,  2500,  2700,  3300,  3400,
+  1200,  2300,  2500,  2800,  3300,  3400,
+  1200,  2300,  2600,  2800,  3300,  3400,
+  1100,  1800,  2500,  2600,  3400,  3500,
+  1300,  1700,  2500,  2600,  3200,  3400,
+  1400,  1800,  2500,  2600,  3200,  3400,
+  1500,  1900,  2500,  2600,  3200,  3300,
+  1500,  1900,  2500,  2700,  3200,  3300,
+  1800,  1900,  2500,  2700,  3100,  3200,
+  1900,  2100,  2400,  2500,  3200,  3300,
+  2000,  2100,  2300,  2500,  3300,  3400,
+  1500,  1900,  2400,  2800,  3100,  3300,
+  1200,  1700,  2500,  2600,  3300,  3400,
+  1300,  1900,  2500,  2600,  3300,  3400,
+  1400,  1800,  2500,  2700,  3300,  3400,
+  1300,  1700,  2400,  2700,  3200,  3400,
+  1100,  2100,  2600,  2700,  3300,  3400,
+  1200,  2100,  2600,  2700,  3300,  3400,
+  1200,  2100,  2500,  2700,  3300,  3400,
+  1200,  2100,  2500,  2600,  3300,  3400,
+  1200,  2000,  2500,  2600,  3300,  3400,
+  1200,  2200,  2500,  2700,  3400,  3500,
+  1400,  1800,  2400,  2600,  3100,  3400,
+  1400,  1900,  2400,  2600,  3100,  3300,
+  1500,  1800,  2400,  2700,  3100,  3300,
+  1500,  1900,  2400,  2600,  3200,  3400,
+  1600,  2100,  2400,  2600,  3300,  3400,
+  1900,  2200,  2400,  2600,  3300,  3400,
+  2000,  2200,  2400,  2600,  3200,  3300,
+  2000,  2100,  2400,  2500,  3200,  3300,
+  2100,  2200,  2500,  2600,  3200,  3300,
+  2100,  2200,  2500,  2700,  3200,  3300,
+  2000,  2100,  2400,  2600,  3100,  3200,
+  1500,  2100,  2300,  2600,  3100,  3200,
+  1500,  1900,  2300,  2400,  3100,  3300,
+  1500,  1800,  2300,  2400,  3100,  3300,
+  1400,  1800,  2300,  2400,  3100,  3300,
+  1400,  1900,  2300,  2500,  3100,  3300,
+  1600,  1900,  2500,  2600,  3200,  3300,
+  1500,  1800,  2300,  2600,  3100,  3300,
+  1400,  1700,  2200,  2600,  3100,  3200,
+  1400,  1600,  2200,  2500,  3000,  3200,
+  1300,  1700,  2400,  2600,  3100,  3200,
+  1400,  1700,  2200,  2500,  3200,  3300,
+  1400,  1800,  2300,  2500,  3200,  3300,
+  1300,  1900,  2200,  2400,  3200,  3300,
+  1100,  1500,  2300,  2400,  3200,  3400,
+  1000,  1600,  2500,  2600,  3300,  3400,
+  1000,  1700,  2500,  2600,  3300,  3400,
+  1000,  1800,  2600,  2700,  3300,  3400,
+  1000,  1900,  2600,  2700,  3300,  3400,
+  1000,  1800,  2800,  2900,  3300,  3400,
+  1400,  1600,  2500,  2600,  3100,  3400,
+  1600,  1700,  2500,  2600,  3100,  3400,
+  1600,  1700,  2500,  2600,  3000,  3400,
+  1700,  1800,  2500,  2600,  3000,  3400,
+  1700,  1800,  2400,  2600,  2800,  3300,
+  1700,  1800,  2400,  2600,  2900,  3400,
+  1700,  1800,  2500,  2600,  3200,  3400,
+  1700,  1800,  2500,  2600,  3100,  3400,
+  1600,  1800,  2500,  2600,  3200,  3400,
+  1600,  1800,  2600,  2700,  3200,  3400,
+  1600,  1900,  2600,  2700,  3300,  3400,
+  1600,  2000,  2600,  2700,  3200,  3400,
+  1800,  2300,  2800,  3000,  3300,  3400,
+  1800,  2100,  2800,  3100,  3300,  3400,
+  1900,  2100,  2700,  2900,  3300,  3400,
+  1800,  2000,  2600,  2800,  3200,  3400,
+  1700,  1900,  2500,  2800,  3100,  3300,
+  1700,  1800,  2400,  2600,  3000,  3300,
+  1700,  1800,  2500,  2700,  3000,  3400,
+  1700,  1900,  2600,  2700,  3100,  3400,
+  1600,  1900,  2600,  2700,  3000,  3300,
+  1700,  2000,  2600,  2700,  3100,  3300,
+  1700,  1900,  2600,  2700,  3200,  3300,
+  1700,  1900,  2600,  2800,  3200,  3300,
+  1600,  1900,  2600,  2800,  3200,  3400,
+  1200,  1800,  2700,  2800,  3200,  3400,
+  1100,  1700,  2700,  2800,  3200,  3300,
+  1500,  1800,  2600,  2700,  3100,  3400,
+  1500,  1800,  2500,  2600,  3100,  3400,
+  1600,  1800,  2500,  2600,  3100,  3400,
+  1600,  1800,  2400,  2500,  3100,  3400,
+  1500,  1700,  2400,  2500,  3000,  3400,
+  1400,  1600,  2400,  2500,  3000,  3400,
+  1400,  1600,  2400,  2600,  2900,  3300,
+  1200,  1700,  2600,  2700,  3100,  3300,
+  1200,  1800,  2600,  2700,  3200,  3400,
+  1100,  1900,  2600,  2700,  3200,  3400,
+  1400,  1800,  2500,  2700,  3200,  3400,
+  1700,  1900,  2500,  2600,  2900,  3300,
+  1600,  1700,  2500,  2700,  3000,  3400,
+  1400,  1500,  2500,  2700,  3200,  3400,
+  1400,  1700,  2500,  2700,  3000,  3300,
+  1800,  2000,  2200,  2600,  2900,  3200,
+  1900,  2100,  2400,  2600,  3100,  3300,
+  1900,  2300,  2400,  2700,  3200,  3300,
+  1800,  2200,  2400,  2700,  3200,  3300,
+  1600,  1900,  2200,  2400,  3000,  3200,
+  1500,  1900,  2100,  2500,  3100,  3200,
+  1500,  1900,  2100,  2400,  3100,  3200,
+  1400,  1900,  2100,  2500,  3200,  3300,
+  1300,  2000,  2200,  2500,  3200,  3300,
+  1200,  2000,  2200,  2500,  3200,  3300,
+  1200,  2100,  2300,  2600,  3200,  3300,
+  1100,  2000,  2500,  2600,  3300,  3400,
+  1200,  2200,  2500,  2600,  3300,  3400,
+  1500,  1800,  2400,  2500,  3300,  3400,
+  1800,  1900,  2300,  2400,  3300,  3400,
+  2100,  2200,  2400,  2600,  3300,  3400,
+  2200,  2300,  2600,  2700,  3300,  3400,
+  2200,  2300,  2600,  2800,  3300,  3400,
+  2100,  2300,  2500,  2800,  3100,  3300,
+  2200,  2300,  2600,  2700,  3100,  3400,
+  2100,  2200,  2600,  2700,  3200,  3400,
+  1900,  2300,  2600,  2900,  3100,  3300,
+  2000,  2300,  2600,  2900,  3200,  3300,
+  2200,  2300,  2700,  2900,  3300,  3400,
+  2000,  2300,  2500,  2900,  3300,  3400,
+  1500,  1700,  2200,  2600,  3100,  3300,
+  1500,  1700,  2200,  2600,  3000,  3300,
+  1500,  1800,  2200,  2600,  3100,  3300,
+  1500,  1800,  2000,  2300,  3200,  3300,
+  1600,  1800,  2000,  2300,  3200,  3300,
+  1600,  1900,  2100,  2300,  3200,  3300,
+  1700,  1900,  2200,  2400,  3200,  3300,
+  1700,  1900,  2300,  2400,  3300,  3400,
+  1800,  1900,  2300,  2500,  3300,  3400,
+  1800,  2000,  2400,  2500,  3200,  3400,
+  1800,  2000,  2400,  2600,  3100,  3400,
+  1800,  1900,  2400,  2600,  3100,  3400,
+  1400,  1600,  2500,  2600,  2900,  3300,
+  1300,  1500,  2500,  2600,  2900,  3300,
+  1300,  1700,  2300,  2700,  3000,  3200,
+  1600,  1900,  2400,  2800,  3100,  3200,
+  1500,  2000,  2400,  2800,  3100,  3300,
+  1100,  1700,  2600,  2700,  3200,  3400,
+  1100,  1800,  2600,  2700,  3300,  3400,
+  1100,  1800,  2700,  2800,  3300,  3400,
+  1700,  2000,  2600,  2700,  3100,  3400,
+  1700,  2100,  2500,  2600,  3000,  3200,
+  1700,  2200,  2600,  2700,  3100,  3200,
+  1700,  2000,  2500,  2600,  3000,  3200,
+  1700,  1900,  2500,  2600,  3000,  3300,
+  1700,  1900,  2400,  2600,  3000,  3300,
+  2000,  2200,  2400,  2600,  3300,  3400,
+  1800,  2100,  2400,  2500,  3300,  3400,
+  1700,  2100,  2400,  2500,  3300,  3400,
+  1500,  2100,  2400,  2500,  3300,  3400,
+  1600,  2100,  2400,  2500,  3300,  3400,
+  1700,  2000,  2300,  2400,  3300,  3400,
+  1700,  2000,  2400,  2500,  3300,  3400,
+  1800,  2000,  2400,  2500,  3300,  3400,
+  1900,  2000,  2400,  2500,  3100,  3400,
+  1900,  2000,  2400,  2500,  3000,  3400,
+  1900,  2000,  2300,  2400,  2800,  3300,
+  1800,  2000,  2200,  2400,  2600,  3200,
+  1900,  2000,  2300,  2500,  2800,  3200,
+  1700,  2000,  2300,  2700,  3100,  3300,
+  1700,  1900,  2500,  2800,  3200,  3300,
+  1700,  2000,  2500,  2800,  3300,  3400,
+  1700,  2000,  2600,  2900,  3300,  3400,
+  1700,  1800,  2500,  2700,  3200,  3400,
+  1600,  1700,  2400,  2600,  2900,  3300,
+  1600,  1700,  2500,  2600,  2900,  3300,
+  1600,  1800,  2600,  2700,  3100,  3400,
+  1600,  1700,  2600,  2700,  3000,  3300,
+  1600,  1700,  2600,  2700,  3100,  3300,
+  1700,  1900,  2500,  2800,  3200,  3400,
+  2100,  2500,  2700,  3000,  3300,  3400,
+  2100,  2400,  2700,  2900,  3300,  3400,
+  2200,  2500,  2700,  3000,  3300,  3400,
+  2200,  2500,  2800,  2900,  3400,  3500,
+  2200,  2500,  2800,  2900,  3300,  3500,
+  2100,  2500,  2700,  2800,  3300,  3400,
+  2100,  2400,  2700,  2900,  3200,  3400,
+  2100,  2300,  2600,  2800,  3100,  3400,
+  2100,  2200,  2500,  2700,  3100,  3400,
+  2200,  2300,  2500,  2700,  3200,  3400,
+  1900,  2100,  2400,  2500,  3200,  3400,
+  1700,  2000,  2400,  2500,  3200,  3300,
+  1500,  1900,  2400,  2500,  3100,  3300,
+  1400,  1900,  2500,  2600,  3300,  3400,
+  1200,  1900,  2600,  2700,  3300,  3400,
+  1100,  2000,  2600,  2700,  3300,  3400,
+  1100,  1700,  2600,  2700,  3300,  3400,
+  1300,  1600,  2500,  2600,  3100,  3400,
+  1500,  1600,  2400,  2500,  3000,  3400,
+  1600,  1700,  2400,  2500,  3100,  3400,
+  1900,  2000,  2300,  2500,  2900,  3400,
+  1900,  2000,  2400,  2500,  2800,  3300,
+  1900,  2000,  2500,  2700,  3300,  3400,
+  1900,  2000,  2500,  2800,  3300,  3400,
+  2000,  2200,  2700,  2900,  3300,  3400,
+  1900,  2200,  2700,  2800,  3200,  3300,
+  1900,  2200,  2700,  2900,  3200,  3300,
+  2000,  2300,  2700,  2900,  3200,  3300,
+  2200,  2600,  2700,  2900,  3300,  3400,
+  2100,  2400,  2700,  2800,  3300,  3400,
+  2100,  2200,  2500,  2700,  3300,  3400,
+  1900,  2100,  2400,  2500,  3300,  3400,
+  1600,  2000,  2400,  2500,  3200,  3300,
+  1500,  2000,  2400,  2500,  3300,  3400,
+  1200,  1900,  2400,  2500,  3300,  3500,
+  1200,  1600,  2400,  2500,  3200,  3400,
+  1700,  2100,  2600,  2900,  3300,  3400,
+  1800,  2200,  2700,  3000,  3300,  3400,
+  1800,  2200,  2800,  3000,  3300,  3400,
+  1700,  2100,  2600,  2900,  3200,  3400,
+  1700,  2000,  2600,  2800,  3200,  3400,
+  1600,  1800,  2500,  2700,  3200,  3400,
+  1500,  1700,  2500,  2600,  3200,  3400,
+  1500,  1700,  2400,  2600,  3200,  3300,
+  1500,  1800,  2400,  2600,  3200,  3300,
+  1500,  1800,  2300,  2500,  3200,  3400,
+  1400,  1800,  2300,  2500,  3300,  3400,
+  1400,  1800,  2300,  2400,  3200,  3400,
+  1600,  1900,  2500,  2600,  3200,  3400,
+  1500,  1900,  2600,  2700,  3200,  3400,
+  1500,  1900,  2600,  2700,  3300,  3400,
+  1400,  1900,  2600,  2700,  3300,  3400,
+  1400,  1900,  2600,  2700,  3200,  3400,
+  1500,  1700,  2600,  2700,  3100,  3300,
+  1600,  1800,  2600,  2700,  3100,  3200,
+  1900,  2100,  2700,  2900,  3200,  3300,
+  2000,  2100,  2500,  2700,  3200,  3400,
+  2000,  2100,  2400,  2600,  3100,  3400,
+  2000,  2100,  2300,  2600,  3000,  3300,
+  1900,  2000,  2300,  2500,  3000,  3400,
+  1800,  1900,  2300,  2400,  3000,  3400,
+  1600,  1800,  2300,  2400,  3000,  3400,
+  1400,  1700,  2400,  2500,  2900,  3400,
+  1300,  1700,  2400,  2500,  3100,  3400,
+  1400,  1700,  2300,  2600,  3100,  3300,
+  1200,  1600,  2400,  2500,  3200,  3300,
+  1200,  1600,  2500,  2600,  3200,  3300,
+  1300,  1800,  2500,  2600,  3200,  3300,
+  1400,  1800,  2500,  2600,  3200,  3300,
+  1700,  2000,  2400,  2600,  3100,  3200,
+  1800,  1900,  2400,  2600,  3000,  3300,
+  2000,  2300,  2700,  2900,  3300,  3400,
+  1900,  2300,  2900,  3100,  3400,  3500,
+  1900,  2100,  2700,  3000,  3300,  3400,
+  1800,  1900,  2300,  2700,  3100,  3300,
+  1800,  1900,  2200,  2500,  3100,  3300,
+  1700,  1800,  2100,  2400,  3000,  3300,
+  1700,  1800,  2200,  2400,  3100,  3300,
+  1400,  1900,  2100,  2300,  3200,  3300,
+  1300,  1800,  2000,  2300,  3200,  3300,
+  1300,  1800,  1900,  2500,  3200,  3300,
+  1300,  1900,  2100,  2600,  3200,  3300,
+  2000,  2100,  2400,  2500,  3100,  3400,
+  2100,  2200,  2400,  2500,  3100,  3400,
+  2100,  2400,  2800,  2900,  3100,  3300,
+  2000,  2200,  2600,  2900,  3200,  3300,
+  2100,  2200,  2700,  2800,  3200,  3300,
+  2000,  2100,  2700,  2800,  3200,  3300,
+  2000,  2100,  2600,  2800,  3200,  3400,
+  1900,  2000,  2600,  2700,  3300,  3400,
+  1800,  1900,  2500,  2700,  3300,  3400,
+  2000,  2100,  2600,  2700,  3200,  3300,
+  2000,  2100,  2600,  2700,  3100,  3400,
+  1900,  2100,  2600,  2700,  3200,  3400,
+  1800,  2000,  2600,  2700,  3300,  3400,
+  1800,  2000,  2600,  2700,  3300,  3500,
+  1700,  1900,  2500,  2700,  3200,  3400,
+  1800,  2100,  2700,  2900,  3200,  3400,
+  1900,  2200,  2600,  2900,  3200,  3300,
+  1900,  2200,  2700,  2900,  3200,  3400,
+  1800,  2200,  2700,  3000,  3200,  3400,
+  1800,  2100,  2700,  2900,  3300,  3400,
+  1900,  2200,  2600,  2900,  3300,  3500,
+  1700,  2100,  2500,  2800,  3400,  3500,
+  1600,  1900,  2400,  2600,  3200,  3400,
+  1600,  1900,  2400,  2500,  3300,  3400,
+  1700,  2000,  2400,  2500,  3200,  3400,
+  1700,  2000,  2300,  2500,  3200,  3300,
+  1700,  2000,  2300,  2400,  2900,  3200,
+  1900,  2000,  2600,  2700,  3100,  3200,
+  1900,  2000,  2600,  2700,  3100,  3400,
+  1800,  2000,  2600,  2700,  3100,  3300,
+  1400,  1800,  2300,  2600,  3000,  3200,
+  1300,  1800,  2200,  2500,  3100,  3300,
+  1300,  1900,  2200,  2600,  3100,  3300,
+  1400,  1800,  2100,  2500,  3000,  3200,
+  1300,  1600,  1700,  2500,  3100,  3200,
+  1300,  1600,  1700,  2400,  3100,  3200,
+  1300,  1600,  1800,  2300,  3100,  3200,
+  1500,  1800,  2400,  2500,  3100,  3200,
+  1500,  1900,  2500,  2600,  3000,  3200,
+  1800,  2200,  2600,  2800,  3200,  3400,
+  1800,  2000,  2500,  2700,  3100,  3300,
+  1700,  1900,  2400,  2700,  3100,  3300,
+  1800,  1900,  2500,  2700,  3100,  3300,
+  1800,  1900,  2600,  2700,  3000,  3300,
+  2100,  2200,  2600,  2700,  3200,  3300,
+  2100,  2200,  2600,  2700,  3300,  3400,
+  1900,  2100,  2300,  2500,  3300,  3400,
+  1700,  2100,  2500,  2800,  3100,  3300,
+  1600,  2100,  2500,  2700,  3100,  3300,
+  1500,  1900,  2400,  2700,  3100,  3300,
+  1200,  1700,  1800,  2100,  3200,  3400,
+  1400,  1700,  1800,  2200,  3300,  3400,
+  1600,  1800,  1900,  2400,  3200,  3300,
+  1700,  1900,  2000,  2500,  3100,  3200,
+  1700,  1900,  2100,  2400,  2900,  3100,
+  1800,  2000,  2200,  2400,  2800,  3200,
+  1900,  2100,  2300,  2600,  2900,  3300,
+  1900,  2100,  2300,  2600,  3200,  3400,
+  2000,  2100,  2400,  2500,  3300,  3400,
+  1800,  1900,  2400,  2500,  3200,  3500,
+  1700,  1900,  2500,  2700,  3200,  3300,
+  1800,  2000,  2600,  3000,  3300,  3400,
+  1900,  2000,  2500,  2700,  2900,  3200,
+  1900,  2000,  2500,  2700,  2900,  3100,
+  1900,  2000,  2400,  2600,  2900,  3200,
+  1700,  2000,  2300,  2600,  2900,  3200,
+  1800,  2000,  2300,  2600,  2900,  3200,
+  1900,  2000,  2400,  2600,  2900,  3300,
+  1900,  2000,  2400,  2600,  3000,  3300,
+  1900,  2000,  2500,  2600,  3100,  3400,
+  1600,  1800,  2200,  2600,  3000,  3300,
+  1600,  1800,  2200,  2500,  3000,  3300,
+  1700,  1900,  2300,  2600,  3000,  3200,
+  1800,  1900,  2300,  2600,  3000,  3200,
+  1800,  1900,  2400,  2500,  3000,  3400,
+  1700,  1800,  2400,  2500,  3200,  3400,
+  1600,  1700,  2400,  2600,  3100,  3300,
+  1600,  1700,  2400,  2500,  3200,  3300,
+  1500,  1600,  2400,  2500,  3200,  3400,
+  1400,  1600,  2400,  2500,  3200,  3400,
+  1300,  1600,  2400,  2500,  3200,  3300,
+  1400,  2000,  2500,  2700,  3100,  3300,
+  1700,  1900,  2200,  2500,  3000,  3300,
+  1700,  1900,  2300,  2500,  3100,  3300,
+  2000,  2100,  2400,  2600,  3100,  3300,
+  2000,  2200,  2500,  2600,  3100,  3300,
+  1900,  2000,  2400,  2500,  3200,  3400,
+  2100,  2200,  2300,  2400,  3200,  3400,
+  2000,  2100,  2300,  2500,  3000,  3400,
+  1600,  1800,  2100,  2500,  3000,  3200,
+  1700,  1800,  2200,  2700,  3200,  3300,
+  1800,  1900,  2400,  2800,  3200,  3400,
+  1800,  2000,  2500,  2800,  3200,  3400,
+  1700,  2100,  2600,  2900,  3300,  3500,
+  1800,  2200,  2600,  2900,  3300,  3500,
+  1700,  2200,  2600,  2900,  3300,  3400,
+  1700,  2100,  2500,  2800,  3200,  3400,
+  1700,  1900,  2600,  2700,  3300,  3400,
+  1700,  1800,  2600,  2700,  3100,  3400,
+  1700,  1800,  2600,  2700,  3200,  3400,
+  1700,  1900,  2700,  2800,  3200,  3400,
+  1600,  1900,  2700,  2800,  3200,  3300,
+  1400,  1900,  2800,  2900,  3200,  3300,
+  1600,  2000,  2600,  2700,  3200,  3300,
+  1700,  2000,  2600,  2700,  3200,  3300,
+  1700,  2000,  2600,  2700,  3200,  3400,
+  1700,  2000,  2600,  2700,  3300,  3400,
+  1700,  1900,  2500,  2600,  3300,  3400,
+  1700,  1800,  2500,  2700,  3100,  3300,
+  1700,  1900,  2500,  2800,  3300,  3400,
+  1700,  2000,  2400,  2800,  3300,  3400,
+  1600,  1800,  2100,  2400,  3100,  3200,
+  1700,  1800,  2000,  2700,  3100,  3200,
+  1700,  1900,  2100,  2700,  3100,  3200,
+  1800,  2000,  2200,  2700,  3100,  3200,
+  1900,  2000,  2300,  2700,  3100,  3200,
+  1900,  2100,  2300,  2700,  3100,  3200,
+  1900,  2100,  2400,  2700,  3100,  3200,
+  2000,  2100,  2400,  2700,  3100,  3200,
+  2000,  2200,  2400,  2700,  3100,  3200,
+  1900,  2100,  2300,  2600,  3100,  3200,
+  1800,  2100,  2200,  2600,  3100,  3200,
+  1600,  2000,  2200,  2600,  3100,  3200,
+  1500,  2000,  2200,  2700,  3100,  3200,
+  1500,  1900,  2200,  2700,  3100,  3200,
+  1500,  1800,  2200,  2600,  3100,  3200,
+  1800,  2100,  2600,  2700,  3100,  3300,
+  1700,  2100,  2600,  2700,  3100,  3300,
+  1500,  1800,  2600,  2700,  3200,  3400,
+  1200,  1400,  2500,  2700,  3200,  3400,
+  1400,  1700,  2400,  2600,  3200,  3400,
+  1400,  1600,  2400,  2600,  3100,  3400,
+  1500,  1700,  2500,  2600,  3000,  3300,
+  1600,  1800,  2500,  2600,  3100,  3300,
+  1700,  1900,  2500,  2600,  3100,  3300,
+  1800,  1900,  2400,  2600,  3000,  3400,
+  2000,  2100,  2500,  2600,  3000,  3300,
+  2100,  2200,  2500,  2600,  3100,  3400,
+  2200,  2300,  2500,  2600,  3100,  3400,
+  1400,  1900,  2300,  2400,  2800,  3200,
+  1400,  1900,  2300,  2400,  2700,  3100,
+  1500,  1700,  2300,  2400,  2800,  3200,
+  1600,  1700,  2100,  2500,  3000,  3300,
+  1700,  2000,  2400,  2800,  3000,  3300,
+  1800,  2000,  2600,  2800,  3100,  3300,
+  1800,  2000,  2500,  2700,  3200,  3300,
+  1800,  2000,  2600,  2700,  3200,  3400,
+  1800,  2000,  2600,  2700,  3200,  3300,
+  1800,  2200,  2600,  2800,  3200,  3300,
+  1800,  2100,  2600,  2800,  3100,  3300,
+  1700,  1900,  2500,  2700,  3000,  3300,
+  1800,  1900,  2500,  2700,  3000,  3300,
+  1900,  2000,  2500,  2700,  3100,  3300,
+  1900,  2000,  2500,  2700,  3100,  3400,
+  1700,  1900,  2600,  2800,  3200,  3400,
+  1600,  1900,  2600,  2800,  3300,  3400,
+  1500,  1800,  2500,  2700,  3300,  3400,
+  1500,  1900,  2400,  2500,  3200,  3400,
+  1200,  1800,  2200,  2300,  3100,  3200,
+  1400,  1900,  2300,  2600,  3000,  3300,
+  1300,  1400,  2300,  2400,  2800,  3100,
+  1300,  1400,  2300,  2500,  3000,  3200,
+  1300,  1600,  2400,  2600,  3000,  3200,
+  1400,  1600,  2400,  2500,  2900,  3200,
+  1500,  1600,  2400,  2600,  3000,  3200,
+  1500,  1700,  2400,  2600,  2900,  3200,
+  1600,  1800,  2400,  2600,  2900,  3100,
+  1800,  2000,  2500,  2700,  3000,  3300,
+  1900,  2100,  2600,  2700,  3000,  3300,
+  1900,  2100,  2500,  2700,  3000,  3200,
+  2000,  2100,  2400,  2700,  3100,  3300,
+  2000,  2200,  2400,  2700,  3100,  3300,
+  1900,  2300,  2600,  2700,  3000,  3200,
+  2000,  2200,  2500,  2600,  3000,  3200,
+  1900,  2000,  2500,  2600,  3000,  3300,
+  1800,  2000,  2400,  2600,  3000,  3300,
+  1500,  1900,  2300,  2500,  2700,  3000,
+  1500,  2000,  2400,  2500,  2700,  3100,
+  1200,  1900,  2300,  2500,  2800,  3000,
+  1300,  1800,  2200,  2300,  3100,  3200,
+  1600,  1900,  2400,  2500,  3100,  3200,
+  2100,  2200,  2600,  2700,  3100,  3300,
+  2100,  2200,  2600,  2700,  3000,  3300,
+  2000,  2200,  2600,  2700,  3100,  3300,
+  2000,  2100,  2400,  2600,  3200,  3300,
+  1800,  2000,  2300,  2400,  3100,  3300,
+  1500,  2000,  2200,  2500,  3200,  3300,
+  1600,  1900,  2400,  2600,  3100,  3300,
+  1500,  1800,  2200,  2600,  3000,  3200,
+  1500,  1800,  2100,  2600,  2900,  3100,
+  1400,  1700,  1900,  2300,  2800,  3000,
+  1500,  1700,  1900,  2200,  2800,  2900,
+  1500,  1700,  2000,  2200,  2900,  3000,
+  1500,  1700,  2100,  2300,  2900,  3000,
+  1500,  1800,  2200,  2300,  3000,  3100,
+  1500,  1800,  2200,  2400,  3000,  3100,
+  1600,  1800,  2300,  2400,  3100,  3200,
+  1600,  1800,  2300,  2500,  3100,  3200,
+  1600,  1800,  2400,  2500,  3100,  3200,
+  1600,  1800,  2400,  2500,  3100,  3300,
+  1600,  1800,  2400,  2500,  3200,  3300,
+  1500,  1700,  2400,  2500,  3200,  3300,
+  1500,  1700,  2300,  2500,  2900,  3300,
+  1800,  2100,  2500,  2600,  3200,  3300,
+  1900,  2100,  2400,  2500,  3100,  3400,
+  1900,  2100,  2200,  2500,  3100,  3300,
+  1700,  1800,  2200,  2500,  2900,  3300,
+  1700,  1800,  2400,  2500,  3000,  3300,
+  1600,  1700,  2400,  2500,  3100,  3300,
+  1500,  1700,  2400,  2500,  3100,  3300,
+  1400,  1700,  2500,  2600,  3100,  3200,
+  1300,  1600,  2500,  2600,  3100,  3200,
+  1200,  1600,  2500,  2600,  3100,  3200,
+  1100,  1700,  2600,  2700,  3100,  3200,
+  1100,  1500,  2600,  2700,  3100,  3200,
+  1100,  1500,  2600,  2700,  3100,  3300,
+  1100,  1500,  2500,  2700,  3000,  3300,
+  1000,  1600,  2600,  2700,  3100,  3300,
+  1300,  1600,  2600,  2700,  3100,  3300,
+  1300,  1600,  2600,  2700,  3200,  3300,
+  1500,  1700,  2500,  2600,  3100,  3300,
+  1700,  1800,  2500,  2600,  3100,  3300,
+  1700,  1900,  2500,  2600,  3200,  3300,
+  1800,  1900,  2500,  2600,  3200,  3300,
+  1800,  2000,  2500,  2700,  3100,  3400,
+  1800,  2100,  2500,  2700,  3100,  3300,
+  1900,  2200,  2500,  2700,  3200,  3300,
+  1900,  2200,  2400,  2600,  3100,  3300,
+  1900,  2300,  2500,  2600,  3100,  3300,
+  1900,  2000,  2200,  2400,  3200,  3300,
+  1600,  1900,  2200,  2300,  3200,  3300,
+  1400,  1600,  2200,  2400,  3100,  3200,
+  1100,  1500,  2300,  2500,  3000,  3100,
+  1400,  1700,  2500,  2700,  3200,  3300,
+  1500,  1800,  2400,  2500,  3200,  3300,
+  1800,  2100,  2500,  2800,  3100,  3300,
+  1800,  1900,  2300,  2500,  3200,  3400,
+  1700,  1900,  2300,  2500,  3200,  3400,
+  1800,  2100,  2500,  2800,  3200,  3400,
+  1800,  2000,  2500,  2800,  3200,  3300,
+  1900,  2100,  2600,  2800,  3100,  3400,
+  1700,  2100,  2600,  2700,  3200,  3400,
+  1800,  2100,  2600,  2700,  3300,  3500,
+  1900,  2000,  2500,  2600,  3300,  3400,
+  1600,  1900,  2200,  2400,  3200,  3300,
+  1400,  2000,  2300,  2600,  3100,  3200,
+  1300,  1800,  2300,  2400,  3000,  3100,
+  1300,  1700,  2300,  2500,  3000,  3100,
+  1600,  1700,  2600,  2700,  3200,  3300,
+  1700,  2000,  2300,  2400,  3100,  3300,
+  2200,  2300,  2600,  2800,  3200,  3400,
+  2100,  2300,  2500,  2900,  3200,  3300,
+  2200,  2300,  2500,  2900,  3200,  3300,
+  2000,  2300,  2500,  2700,  3200,  3300,
+  2200,  2400,  2500,  2700,  3200,  3300,
+  2200,  2400,  2600,  2800,  3200,  3300,
+  1700,  2000,  2400,  2700,  3000,  3200,
+  1700,  1900,  2500,  2700,  3000,  3200,
+  1700,  1900,  2600,  2700,  3100,  3300,
+  1500,  1800,  2600,  2700,  3100,  3300,
+  1600,  1700,  2600,  2700,  2900,  3300,
+  1600,  1700,  2600,  2800,  3000,  3300,
+  1700,  2000,  2700,  2800,  3100,  3400,
+  1600,  1900,  2500,  2700,  3000,  3300,
+  1800,  2200,  2800,  2900,  3300,  3400,
+  2000,  2500,  2800,  2900,  3400,  3500,
+  2000,  2400,  2800,  2900,  3400,  3500,
+  2000,  2300,  2700,  2800,  3200,  3400,
+  1600,  1700,  2400,  2600,  3200,  3300,
+  1500,  1900,  2400,  2500,  3200,  3300,
+  1400,  1900,  2400,  2500,  3200,  3300,
+  1400,  1900,  2500,  2600,  3200,  3300,
+  1300,  1900,  2500,  2600,  3200,  3300,
+  1300,  1700,  2500,  2600,  3100,  3300,
+  1300,  1500,  2500,  2600,  3100,  3300,
+  1200,  1400,  2400,  2500,  3100,  3300,
+  1200,  1500,  2400,  2500,  3100,  3300,
+  1200,  1600,  2400,  2500,  3100,  3300,
+  1200,  1700,  2500,  2600,  3100,  3300,
+  1200,  1700,  2500,  2600,  3200,  3300,
+  1200,  1800,  2500,  2600,  3200,  3300,
+  1200,  1800,  2400,  2500,  3200,  3300,
+  1200,  1800,  2400,  2500,  3100,  3300,
+  1200,  1700,  2400,  2500,  3100,  3200,
+  1200,  1600,  2400,  2500,  3000,  3200,
+  1200,  1600,  2400,  2500,  2900,  3100,
+  1200,  1700,  2400,  2500,  3000,  3300,
+  1300,  1700,  2400,  2500,  3100,  3300,
+  1200,  1700,  2400,  2500,  3000,  3100,
+  1200,  1700,  2300,  2400,  3000,  3100,
+  1600,  2000,  2300,  2600,  3000,  3300,
+  1400,  1600,  1900,  2200,  3000,  3100,
+  1400,  1600,  1800,  2100,  3000,  3100,
+  1300,  1500,  1600,  2000,  3100,  3200,
+  1300,  1500,  1700,  1900,  3100,  3200,
+  1400,  1600,  1700,  1900,  3100,  3200,
+  1600,  1700,  2000,  2100,  3100,  3200,
+  1600,  1800,  2100,  2200,  3100,  3200,
+  1800,  1900,  2300,  2400,  3200,  3300,
+  1900,  2100,  2600,  2700,  3100,  3400,
+  1900,  2000,  2500,  2600,  3000,  3400,
+  1800,  2100,  2600,  2700,  3200,  3400,
+  1800,  2300,  2600,  2800,  3300,  3500,
+  1600,  2100,  2400,  2600,  3200,  3300,
+  1300,  1900,  2500,  2600,  3100,  3300,
+  1300,  1800,  2500,  2600,  3100,  3300,
+  1400,  1800,  2600,  2700,  3100,  3300,
+  1600,  1800,  2500,  2700,  3100,  3300,
+  1600,  1800,  2500,  2600,  3200,  3300,
+  1700,  1800,  2500,  2600,  3200,  3300,
+  1900,  2000,  2500,  2700,  2900,  3300,
+  2000,  2100,  2400,  2600,  2900,  3200,
+  2000,  2100,  2400,  2600,  3000,  3300,
+  2100,  2200,  2400,  2600,  3000,  3300,
+  2000,  2100,  2500,  2600,  3100,  3400,
+  1900,  2000,  2400,  2600,  3000,  3400,
+  1800,  1900,  2300,  2500,  2900,  3400,
+  1700,  1800,  2500,  2700,  3100,  3400,
+  1700,  1900,  2500,  2700,  3100,  3400,
+  1800,  1900,  2700,  2800,  3200,  3400,
+  2100,  2200,  2600,  2800,  3100,  3400,
+  2200,  2300,  2600,  2800,  3100,  3400,
+  1800,  2300,  2500,  2700,  3100,  3300,
+  1500,  2000,  2400,  2500,  2800,  3100,
+  1600,  2000,  2400,  2500,  2800,  3100,
+  1600,  2000,  2400,  2500,  2800,  3200,
+  1600,  2000,  2400,  2500,  2900,  3300,
+  1800,  2200,  2500,  2600,  3000,  3300,
+  2100,  2300,  2500,  2600,  3100,  3300,
+  2100,  2200,  2600,  2700,  3100,  3200,
+  1800,  1900,  2600,  2700,  3100,  3200,
+  1800,  1900,  2600,  2700,  3100,  3300,
+  1700,  1800,  2600,  2700,  3100,  3300,
+  1700,  1800,  2600,  2700,  3200,  3300,
+  1600,  1700,  2600,  2700,  3200,  3400,
+  1600,  1700,  2500,  2700,  3200,  3300,
+  1500,  1800,  2400,  2500,  3000,  3300,
+  1500,  1900,  2300,  2500,  3000,  3200,
+  1700,  2100,  2300,  2600,  3100,  3300,
+  1800,  2000,  2700,  2800,  3100,  3300,
+  1700,  1800,  2500,  2700,  2900,  3300,
+  1600,  1800,  2500,  2700,  3000,  3300,
+  1700,  1800,  2400,  2600,  3100,  3300,
+  1700,  1800,  2400,  2500,  3200,  3300,
+  1800,  1900,  2400,  2500,  3200,  3300,
+  1900,  2000,  2400,  2500,  3200,  3300,
+  2000,  2100,  2300,  2500,  3200,  3400,
+  2000,  2100,  2200,  2400,  3200,  3400,
+  2000,  2100,  2300,  2400,  3100,  3400,
+  1700,  1900,  2400,  2500,  3200,  3400,
+  1700,  1900,  2400,  2500,  3100,  3400,
+  1700,  1800,  2400,  2600,  3300,  3400,
+  1700,  1800,  2500,  2600,  3300,  3400,
+  1600,  1900,  2500,  2600,  3300,  3400,
+  1700,  1900,  2600,  2800,  3100,  3300,
+  1700,  2100,  2600,  2700,  3300,  3400,
+  1800,  2000,  2400,  2500,  3100,  3300,
+  2000,  2100,  2300,  2400,  3200,  3400,
+  1400,  1900,  2300,  2400,  3000,  3300,
+  1400,  2000,  2300,  2500,  3000,  3100,
+  1400,  1700,  2500,  2600,  3100,  3300,
+  1300,  1600,  2400,  2600,  3100,  3300,
+  1300,  1600,  2400,  2500,  3200,  3400,
+  1500,  2000,  2500,  2700,  3200,  3400,
+  1800,  2100,  2500,  2900,  3200,  3400,
+  1800,  2200,  2500,  2800,  3300,  3400,
+  1700,  2000,  2500,  2900,  3300,  3400,
+  1700,  2100,  2600,  2900,  3400,  3500,
+  1500,  1900,  2400,  2800,  3300,  3400,
+  1800,  2100,  2500,  2800,  3300,  3400,
+  1700,  2000,  2600,  2800,  3300,  3400,
+  1700,  2100,  2600,  2800,  3200,  3400,
+  1900,  2200,  2600,  2800,  3200,  3300,
+  1900,  2100,  2600,  2800,  3200,  3300,
+  1800,  2100,  2700,  2800,  3300,  3400,
+  1700,  2100,  2700,  2800,  3200,  3400,
+  1800,  2200,  2600,  2700,  3200,  3400,
+  1800,  2200,  2600,  2700,  3300,  3400,
+  1800,  2300,  2600,  2700,  3300,  3400,
+  1900,  2300,  2500,  2700,  3300,  3400,
+  1800,  2200,  2500,  2800,  3200,  3400,
+  1800,  2200,  2500,  2700,  3100,  3300,
+  1700,  2200,  2400,  2600,  3100,  3200,
+  1800,  2000,  2300,  2500,  3200,  3300,
+  1800,  2000,  2200,  2500,  3300,  3400,
+  1800,  2000,  2200,  2600,  3300,  3400,
+  1500,  1800,  1900,  2400,  3200,  3300,
+  1500,  1700,  1900,  2500,  3200,  3300,
+  1500,  1800,  1900,  2500,  3200,  3300,
+  1600,  1800,  2000,  2400,  3300,  3400,
+  1500,  1700,  2200,  2600,  3000,  3200,
+  1400,  1700,  2000,  2600,  3000,  3200,
+  1500,  1900,  2400,  2600,  3100,  3200,
+  1400,  1900,  2500,  2600,  3100,  3300,
+  1200,  1600,  2500,  2700,  3100,  3300,
+  1200,  1800,  2500,  2600,  3100,  3200,
+  1400,  1800,  2300,  2400,  3100,  3200,
+  1400,  1700,  2200,  2300,  3200,  3300,
+  1800,  1900,  2200,  2300,  3300,  3400,
+  1800,  2100,  2300,  2400,  2900,  3200,
+  1900,  2100,  2300,  2500,  3000,  3300,
+  1900,  2100,  2400,  2600,  3300,  3400,
+  1600,  1900,  2400,  2500,  3200,  3300,
+  1500,  1700,  2300,  2400,  3200,  3300,
+  1500,  1900,  2300,  2500,  3200,  3300,
+  1600,  2000,  2500,  2700,  3200,  3300,
+  1900,  2200,  2500,  2700,  3300,  3400,
+  1800,  2300,  2500,  2700,  3300,  3400,
+  1800,  2400,  2500,  2900,  3300,  3400,
+  1900,  2400,  2600,  3000,  3300,  3400,
+  2000,  2400,  2700,  3000,  3400,  3500,
+  1800,  2100,  2500,  2900,  3200,  3300,
+  1700,  2100,  2500,  2900,  3200,  3400,
+  1800,  2100,  2600,  2800,  3100,  3400,
+  1800,  2200,  2700,  2800,  3200,  3400,
+  1800,  2300,  2700,  2900,  3300,  3500,
+  1400,  2000,  2600,  2700,  3200,  3400,
+  1300,  1800,  2200,  2300,  3000,  3100,
+  1300,  1700,  2100,  2200,  3100,  3200,
+  1400,  1700,  2000,  2200,  3000,  3100,
+  1400,  1600,  2000,  2100,  3000,  3100,
+  1500,  1800,  2000,  2300,  3100,  3200,
+  1600,  1800,  2000,  2300,  3100,  3200,
+  1600,  1800,  2000,  2200,  3100,  3200,
+  1700,  2000,  2200,  2300,  3000,  3200,
+  1700,  2100,  2400,  2800,  3100,  3300,
+  1800,  2000,  2600,  2800,  3000,  3200,
+  1700,  1900,  2600,  2700,  3200,  3400,
+  1600,  1700,  2400,  2600,  3200,  3400,
+  1600,  1700,  2400,  2500,  3200,  3400,
+  1700,  2100,  2500,  2800,  3200,  3300,
+  1700,  2200,  2500,  2800,  3200,  3300,
+  1700,  2100,  2400,  2600,  3200,  3300,
+  1700,  1900,  2400,  2600,  3200,  3300,
+  1600,  1900,  2200,  2500,  3100,  3300,
+  1500,  1900,  2100,  2400,  3100,  3300,
+  1500,  1600,  2000,  2300,  3000,  3200,
+  1500,  1700,  2100,  2500,  3100,  3300,
+  1600,  1800,  2300,  2700,  3100,  3300,
+  1600,  1700,  2300,  2600,  3100,  3200,
+  1500,  1700,  2300,  2500,  3000,  3200,
+  1400,  1700,  2400,  2500,  3000,  3200,
+  1200,  1500,  2500,  2600,  3000,  3100,
+  1100,  1900,  2600,  2700,  3000,  3100,
+  1500,  2000,  2700,  2800,  3200,  3400,
+  1700,  2100,  2700,  2800,  3300,  3400,
+  1800,  2200,  2700,  2800,  3300,  3400,
+  1800,  2400,  2700,  2800,  3200,  3300,
+  1800,  2300,  2500,  2600,  3100,  3200,
+  1500,  1800,  2100,  2400,  3000,  3200,
+  1400,  1600,  1800,  2200,  3000,  3100,
+  1300,  1600,  1700,  2100,  3000,  3100,
+  1200,  1400,  1600,  2400,  3000,  3100,
+  1300,  1500,  1600,  2100,  3000,  3100,
+  1400,  1600,  1700,  2100,  3000,  3100,
+  1400,  1700,  2100,  2300,  3100,  3200,
+  1400,  1700,  2200,  2300,  3100,  3200,
+  1400,  1600,  2200,  2300,  3100,  3200,
+  1400,  1700,  2200,  2400,  3100,  3200,
+  1400,  1700,  2300,  2400,  3100,  3200,
+  1400,  1600,  2300,  2400,  3100,  3200,
+  1400,  1600,  2200,  2300,  3000,  3200,
+  1500,  2000,  2400,  2600,  3200,  3300,
+  1700,  2000,  2700,  2800,  3200,  3400,
+  2100,  2400,  2800,  2900,  3200,  3400,
+  2000,  2500,  2700,  2800,  3400,  3500,
+  2100,  2600,  2800,  2900,  3400,  3500,
+  2000,  2500,  2700,  2800,  3300,  3400,
+  1900,  2100,  2700,  2800,  3200,  3400,
+  2100,  2200,  2700,  2800,  3200,  3400,
+  2100,  2200,  2700,  2900,  3300,  3400,
+  2200,  2300,  2700,  2800,  3200,  3400,
+  1700,  2100,  2400,  2700,  3200,  3400,
+  1600,  2100,  2400,  2600,  2900,  3200,
+  1500,  2100,  2400,  2500,  2800,  3100,
+  1600,  2100,  2400,  2500,  2800,  3200,
+  1600,  2100,  2400,  2500,  2900,  3200,
+  1600,  2100,  2400,  2500,  3000,  3200,
+  1600,  2100,  2300,  2500,  3200,  3300,
+  1700,  1800,  2200,  2600,  3100,  3300,
+  1700,  1900,  2300,  2600,  3100,  3300,
+  1800,  1900,  2300,  2500,  3100,  3300,
+  1800,  1900,  2400,  2500,  3100,  3200,
+  1600,  1800,  2200,  2500,  3100,  3300,
+  1500,  1700,  1900,  2200,  3100,  3200,
+  1500,  1700,  1900,  2100,  3100,  3200,
+  1500,  1700,  1900,  2300,  3200,  3300,
+  1500,  1700,  1900,  2400,  3200,  3300,
+  1500,  1700,  1800,  2400,  3200,  3300,
+  1500,  1700,  1900,  2200,  3200,  3300,
+  1500,  1700,  1900,  2100,  3200,  3300,
+  1500,  1600,  1900,  2000,  3100,  3200,
+  1500,  1700,  2000,  2100,  3200,  3300,
+  1600,  1700,  2000,  2100,  3200,  3300,
+  1600,  1800,  2100,  2300,  3200,  3300,
+  1700,  1900,  2300,  2500,  3100,  3200,
+  1700,  2000,  2400,  2600,  3000,  3100,
+  1700,  2100,  2400,  2600,  3000,  3100,
+  1600,  2000,  2400,  2600,  2900,  3100,
+  1800,  2200,  2600,  2800,  3000,  3200,
+  2000,  2400,  2500,  2800,  3100,  3200,
+  2100,  2500,  2600,  2800,  3200,  3300,
+  2200,  2500,  2700,  3000,  3200,  3300,
+  2100,  2500,  2700,  3000,  3200,  3300,
+  2200,  2500,  2600,  3000,  3200,  3300,
+  2200,  2500,  2600,  2900,  3200,  3300,
+  2200,  2400,  2600,  2800,  3100,  3300,
+  2000,  2300,  2500,  2700,  3100,  3200,
+  2000,  2200,  2500,  2700,  3100,  3200,
+  2000,  2300,  2500,  2800,  3100,  3200,
+  2000,  2300,  2400,  2800,  3100,  3200,
+  2100,  2200,  2500,  2800,  3100,  3200,
+  2000,  2100,  2500,  2800,  3200,  3300,
+  1900,  2000,  2200,  2500,  3200,  3300,
+  1600,  1800,  2100,  2400,  3100,  3300,
+  1500,  1600,  1800,  2100,  3200,  3300,
+  1500,  1700,  1800,  2100,  3200,  3300,
+  1500,  1700,  1800,  2300,  3200,  3300,
+  2000,  2200,  2400,  2600,  3000,  3200,
+  2000,  2400,  2600,  2800,  3100,  3300,
+  2000,  2400,  2500,  2700,  3100,  3300,
+  1800,  2200,  2500,  2600,  3100,  3300,
+  1600,  1800,  2400,  2500,  3000,  3200,
+  1500,  1800,  2400,  2500,  3000,  3100,
+  1800,  2000,  2200,  2700,  3000,  3300,
+  1600,  1900,  2100,  2600,  3000,  3200,
+  1500,  1700,  1900,  2300,  3000,  3100,
+  1500,  1700,  1900,  2200,  3000,  3100,
+  1600,  1700,  2200,  2400,  2900,  3000,
+  1600,  1800,  2200,  2400,  2900,  3000,
+  1800,  2300,  2600,  2700,  3200,  3400,
+  1800,  1900,  2500,  2600,  3300,  3400,
+  1800,  1900,  2400,  2600,  3300,  3400,
+  1700,  1900,  2300,  2500,  3300,  3400,
+  1600,  1800,  2300,  2400,  3200,  3300,
+  1300,  1900,  2300,  2400,  3100,  3200,
+  1600,  1700,  2400,  2600,  3100,  3200,
+  2000,  2100,  2500,  2600,  3200,  3300,
+  2100,  2200,  2400,  2600,  3200,  3400,
+  1700,  2000,  2400,  2600,  3100,  3400,
+  1700,  1800,  2400,  2500,  3100,  3300,
+  1600,  1900,  2300,  2400,  3100,  3200,
+  1600,  1900,  2200,  2500,  3000,  3100,
+  1500,  1800,  2000,  2300,  3000,  3100,
+  1500,  1700,  1900,  2100,  2900,  3000,
+  1400,  1600,  2400,  2700,  2900,  3100,
+  1400,  1600,  2300,  2600,  3000,  3100,
+  1500,  1600,  2300,  2500,  2900,  3100,
+  1600,  1700,  2400,  2600,  3000,  3200,
+  1600,  1800,  2400,  2600,  3100,  3200,
+  1600,  1900,  2400,  2600,  3100,  3200,
+  1700,  2100,  2400,  2600,  3100,  3200,
+  1600,  2000,  2300,  2600,  3100,  3200,
+  1400,  1600,  2200,  2300,  3100,  3300,
+  1400,  1600,  2200,  2300,  3200,  3300,
+  1300,  1800,  2300,  2500,  3300,  3400,
+  1200,  1900,  2400,  2500,  3300,  3400,
+  1200,  1700,  2400,  2500,  3300,  3400,
+  1500,  1700,  2300,  2500,  3100,  3200,
+  1900,  2000,  2300,  2400,  3200,  3300,
+  2200,  2300,  2500,  2700,  3200,  3300,
+  2100,  2300,  2500,  2800,  3300,  3400,
+  1300,  1900,  2300,  2400,  3100,  3300,
+  1800,  2000,  2400,  2700,  3200,  3300,
+  1500,  2000,  2300,  2400,  3000,  3300,
+  1600,  2000,  2400,  2700,  3000,  3200,
+  1800,  2100,  2400,  2600,  3000,  3200,
+  1800,  2100,  2400,  2600,  3000,  3300,
+  1800,  2100,  2400,  2500,  3100,  3300,
+  1700,  2100,  2300,  2600,  3100,  3200,
+  1600,  2000,  2200,  2500,  3200,  3300,
+  1500,  1800,  2200,  2300,  3200,  3400,
+  1400,  1600,  2200,  2300,  3200,  3400,
+  1300,  1500,  2200,  2300,  3200,  3300,
+  1200,  1600,  2300,  2400,  3300,  3400,
+  1200,  1500,  2300,  2400,  3200,  3400,
+  1200,  1400,  2300,  2400,  3100,  3400,
+  1300,  1500,  2400,  2500,  3200,  3400,
+  1700,  2300,  2600,  2700,  3300,  3400,
+  1800,  2400,  2700,  3000,  3300,  3400,
+  1800,  2300,  2700,  2800,  3200,  3300,
+  1800,  2200,  2500,  2600,  3300,  3400,
+  1700,  1900,  2400,  2600,  3200,  3400,
+  1700,  1800,  2200,  2500,  3200,  3400,
+  1500,  1700,  2300,  2500,  3100,  3300,
+  1400,  1700,  2200,  2400,  3000,  3200,
+  1300,  1600,  2200,  2300,  3000,  3100,
+  1300,  1900,  2200,  2400,  2900,  3100,
+  1400,  1900,  2300,  2400,  3000,  3100,
+  1400,  1900,  2300,  2500,  2900,  3100,
+  1400,  1800,  2400,  2600,  2800,  3100,
+  1600,  2000,  2500,  2700,  3100,  3300,
+  1500,  2000,  2500,  2700,  3200,  3300,
+  1500,  2100,  2600,  2900,  3300,  3400,
+  1800,  2300,  2600,  2800,  3300,  3400,
+  1700,  2200,  2600,  2700,  3300,  3400,
+  2000,  2200,  2500,  2700,  3000,  3100,
+  2000,  2300,  2600,  2800,  3100,  3200,
+  2100,  2400,  2500,  2900,  3200,  3300,
+  2100,  2300,  2500,  2800,  3100,  3200,
+  1900,  2200,  2300,  2700,  3100,  3200,
+  1200,  1900,  2000,  2300,  3100,  3200,
+  1300,  1600,  1700,  2100,  3200,  3300,
+  1400,  1600,  1700,  2100,  3200,  3300,
+  1400,  1600,  1700,  2200,  3200,  3300,
+  1600,  1700,  2200,  2600,  2900,  3100,
+  1900,  2300,  2700,  2900,  3200,  3300,
+  1700,  2100,  2700,  2900,  3200,  3400,
+  1800,  2100,  2700,  2800,  3100,  3400,
+  1800,  2100,  2600,  2800,  3000,  3200,
+  1800,  2100,  2700,  2800,  3200,  3400,
+  1400,  1600,  2600,  2700,  3000,  3300,
+  1400,  1500,  2600,  2700,  3000,  3400,
+  1300,  1400,  2400,  2800,  3000,  3300,
+  1800,  2200,  2600,  2900,  3200,  3400,
+  1600,  2100,  2600,  2900,  3200,  3400,
+  1200,  1700,  2500,  2600,  3000,  3100,
+  1200,  1800,  2300,  2600,  3000,  3100,
+  1200,  1800,  2300,  2500,  3000,  3100,
+  1300,  1700,  2400,  2500,  3000,  3100,
+  1500,  1800,  2400,  2500,  2900,  3000,
+  1600,  2300,  2500,  2700,  3000,  3100,
+  1900,  2200,  2700,  2900,  3100,  3200,
+  1900,  2200,  2800,  2900,  3100,  3200,
+  1900,  2300,  2800,  2900,  3200,  3300,
+  2200,  2500,  2800,  3000,  3300,  3400,
+  2100,  2500,  2800,  3000,  3300,  3400,
+  2000,  2400,  2700,  2800,  3300,  3500,
+  1900,  2200,  2600,  2800,  3300,  3400,
+  1900,  2100,  2700,  2800,  3300,  3400,
+  1700,  1900,  2600,  2700,  3000,  3300,
+  1600,  1700,  2500,  2600,  3100,  3300,
+  1800,  1900,  2600,  2800,  3100,  3300,
+  1800,  1900,  2500,  2800,  3000,  3300,
+  1900,  2000,  2600,  2800,  3100,  3400,
+  2000,  2100,  2500,  2700,  3000,  3300,
+  2100,  2200,  2500,  2700,  3000,  3300,
+  2100,  2200,  2500,  2800,  3000,  3300,
+  2000,  2100,  2400,  2700,  2900,  3200,
+  1900,  2000,  2400,  2600,  2800,  3100,
+  1700,  2000,  2500,  2700,  3100,  3300,
+  1700,  2100,  2700,  2800,  3100,  3300,
+  1500,  1700,  2400,  2600,  3100,  3400,
+  1500,  1600,  2400,  2500,  3000,  3300,
+  1400,  1600,  2300,  2600,  3100,  3300,
+  1400,  1500,  2300,  2600,  3100,  3300,
+  1500,  1600,  2400,  2600,  2900,  3200,
+  1600,  1700,  2300,  2600,  3000,  3200,
+  1600,  1700,  2300,  2700,  3000,  3200,
+  1700,  1800,  2400,  2600,  3000,  3200,
+  1600,  1700,  2300,  2500,  3100,  3200,
+  1500,  1600,  2200,  2400,  3100,  3200,
+  1300,  1800,  2200,  2400,  3100,  3200,
+  1300,  1800,  2300,  2400,  3000,  3200,
+  1200,  1700,  2300,  2400,  2900,  3100,
+  1200,  1800,  2400,  2500,  2900,  3200,
+  1200,  1800,  2300,  2500,  3100,  3200,
+  1300,  1800,  2400,  2600,  3200,  3300,
+  1300,  1700,  2400,  2500,  3200,  3300,
+  1200,  1700,  2400,  2500,  3200,  3300,
+  1200,  1500,  2400,  2500,  3200,  3300,
+  1900,  2100,  2500,  2800,  3100,  3300,
+  1800,  2000,  2400,  2700,  3000,  3300,
+  1800,  2000,  2300,  2600,  3000,  3300,
+  1900,  2000,  2300,  2400,  3200,  3500,
+  1900,  2000,  2300,  2400,  3100,  3400,
+  1800,  2000,  2300,  2500,  3200,  3400,
+  1700,  2000,  2500,  2600,  3300,  3400,
+  1800,  2100,  2500,  2800,  3100,  3400,
+  1800,  2000,  2500,  2800,  3100,  3300,
+  1800,  2100,  2500,  2600,  3100,  3300,
+  1700,  2100,  2500,  2700,  3100,  3400,
+  1600,  1700,  2500,  2600,  3200,  3300,
+  1500,  2200,  2400,  2700,  3200,  3300,
+  1400,  2000,  2300,  2700,  3300,  3400,
+  1400,  2000,  2300,  2500,  3300,  3400,
+  1600,  2000,  2400,  2600,  3100,  3300,
+  1600,  2000,  2300,  2600,  3300,  3400,
+  1600,  2100,  2300,  2600,  3300,  3400,
+  1700,  1900,  2300,  2600,  3300,  3400,
+  1900,  2000,  2300,  2400,  3300,  3400,
+  1900,  2000,  2200,  2400,  3300,  3400,
+  1700,  1800,  2200,  2500,  3000,  3200,
+  1700,  1800,  2100,  2500,  3000,  3200,
+  1500,  1700,  2100,  2500,  3000,  3200,
+  1500,  1600,  2100,  2500,  3000,  3200,
+  1500,  1700,  2200,  2700,  3100,  3200,
+  1600,  1900,  2300,  2700,  3200,  3300,
+  1500,  1700,  1800,  2600,  3200,  3300,
+  1600,  1900,  2100,  2500,  3100,  3300,
+  2000,  2300,  2700,  2800,  3100,  3300,
+  2200,  2500,  2900,  3000,  3200,  3300,
+  2300,  2500,  2900,  3000,  3200,  3300,
+  1400,  1900,  2300,  2500,  3200,  3300,
+  1600,  2000,  2300,  2700,  3200,  3300,
+  1500,  1900,  2000,  2400,  3200,  3300,
+  1300,  1800,  2000,  2400,  3300,  3400,
+  1400,  1900,  2200,  2500,  3200,  3300,
+  1800,  2200,  2600,  3000,  3300,  3400,
+  1900,  2200,  2800,  2900,  3300,  3400,
+  2000,  2500,  2900,  3100,  3200,  3300,
+  2000,  2400,  2900,  3000,  3300,  3400,
+  2100,  2400,  2800,  3000,  3200,  3300,
+  2000,  2400,  2700,  2900,  3200,  3300,
+  1700,  2100,  2600,  2800,  3200,  3300,
+  1500,  1900,  2300,  2700,  3100,  3300,
+  1500,  1800,  2200,  2600,  3200,  3300,
+  1500,  1700,  2200,  2500,  3200,  3400,
+  1100,  2200,  2500,  2800,  3200,  3300,
+  1000,  2100,  2500,  2700,  3200,  3300,
+  1000,  2000,  2500,  2700,  3200,  3300,
+  1000,  2000,  2400,  2600,  3200,  3300,
+  1100,  1900,  2400,  2600,  3100,  3200,
+  1600,  1900,  2400,  2700,  3100,  3400,
+  1700,  2100,  2500,  2700,  3000,  3200,
+  2000,  2200,  2600,  2800,  3100,  3300,
+  2100,  2200,  2600,  2800,  3100,  3300,
+  1900,  2100,  2400,  2700,  3100,  3300,
+  1900,  2000,  2300,  2600,  3100,  3200,
+  1800,  1900,  2200,  2600,  3100,  3200,
+  1500,  1700,  2000,  2600,  3100,  3200,
+  1400,  1500,  1800,  2800,  3200,  3300,
+  1300,  1500,  1700,  2600,  3200,  3300,
+  1600,  1900,  2400,  2700,  3100,  3200,
+  1600,  1900,  2400,  2700,  3100,  3300,
+  1700,  1900,  2300,  2700,  3000,  3200,
+  1700,  1900,  2200,  2600,  3000,  3200,
+  1200,  1600,  1800,  2000,  3100,  3400,
+  1100,  1600,  2400,  2500,  3000,  3300,
+  1400,  1700,  2300,  2400,  2900,  3200,
+  1700,  2000,  2300,  2700,  3200,  3300,
+  1600,  1700,  2300,  2400,  3000,  3400,
+  1700,  1800,  2300,  2400,  2900,  3400,
+  1700,  1800,  2300,  2400,  2800,  3300,
+  1800,  1900,  2300,  2400,  2800,  3200,
+  1800,  1900,  2300,  2400,  3000,  3300,
+  1800,  1900,  2300,  2400,  2900,  3300,
+  1700,  1800,  2200,  2300,  2600,  3200,
+  1700,  1800,  2200,  2300,  2700,  3200,
+  1700,  1800,  2300,  2400,  3000,  3300,
+  1700,  1800,  2300,  2400,  3100,  3400,
+  1700,  1800,  2200,  2400,  3200,  3400,
+  1700,  1900,  2200,  2400,  3300,  3400,
+  1800,  1900,  2200,  2400,  3200,  3400,
+  1800,  1900,  2300,  2400,  3200,  3400,
+  1800,  1900,  2300,  2400,  3100,  3400,
+  1800,  2000,  2200,  2400,  3200,  3300,
+  1800,  1900,  2200,  2400,  3200,  3300,
+  1700,  1800,  2000,  2200,  3200,  3300,
+  1400,  1700,  1800,  2200,  3200,  3300,
+  1400,  1800,  2100,  2500,  3100,  3300,
+  1500,  1800,  2200,  2700,  3100,  3200,
+  1600,  2000,  2300,  2500,  2900,  3200,
+  1800,  2200,  2500,  2700,  3000,  3300,
+  2000,  2400,  2700,  2800,  3100,  3300,
+  2200,  2500,  2800,  2900,  3200,  3300,
+  1500,  2300,  2500,  2900,  3300,  3400,
+  1500,  1700,  2300,  2600,  3000,  3200,
+  1700,  1900,  2300,  2600,  3000,  3300,
+  1600,  1700,  2200,  2300,  3200,  3400,
+  1600,  1700,  2200,  2300,  3300,  3400,
+  1200,  2000,  2400,  2600,  3200,  3300,
+  1000,  1800,  2400,  2500,  3200,  3300,
+  1000,  2000,  2300,  2500,  3200,  3300,
+  1300,  1700,  2200,  2600,  3100,  3200,
+  1600,  1900,  2500,  2700,  3000,  3200,
+  1300,  1900,  2400,  2700,  3000,  3200,
+  1600,  1800,  2200,  2700,  3100,  3200,
+  1700,  2100,  2300,  2500,  3100,  3300,
+  1600,  1900,  2400,  2500,  3200,  3400,
+  1600,  2000,  2300,  2500,  3100,  3300,
+  1600,  1900,  2300,  2400,  3000,  3200,
+  1500,  1900,  2200,  2300,  3000,  3200,
+  1500,  2000,  2200,  2400,  3100,  3200,
+  1400,  2000,  2200,  2400,  3100,  3200,
+  1300,  2000,  2200,  2500,  3100,  3200,
+  1100,  2100,  2300,  2600,  3100,  3200,
+  1000,  2000,  2400,  2500,  3100,  3200,
+  1000,  1700,  2400,  2500,  3100,  3200,
+  1000,  1600,  2400,  2500,  3100,  3200,
+  1100,  1600,  2400,  2500,  3100,  3200,
+  1100,  1600,  2400,  2600,  3100,  3200,
+  1100,  1600,  2500,  2600,  3200,  3300,
+  1100,  1500,  2500,  2600,  3200,  3300,
+  1100,  1500,  2500,  2600,  3100,  3200,
+  1200,  1400,  2400,  2600,  3100,  3200,
+  1300,  1700,  2300,  2400,  3200,  3300,
+  1300,  1800,  2300,  2400,  3200,  3300,
+  1300,  1900,  2300,  2400,  3200,  3300,
+  1400,  1900,  2300,  2400,  3100,  3300,
+  1500,  1700,  2300,  2400,  3000,  3200,
+  1500,  1700,  2300,  2400,  3000,  3300,
+  2100,  2300,  2800,  3000,  3300,  3400,
+  2200,  2400,  2900,  3000,  3200,  3300,
+  2100,  2300,  2900,  3000,  3300,  3400,
+  2000,  2300,  2600,  3000,  3200,  3300,
+  1300,  1600,  2200,  2600,  3100,  3300,
+  1000,  2000,  2300,  2500,  3300,  3400,
+  1000,  2100,  2400,  2600,  3300,  3400,
+  1300,  1700,  1900,  2100,  3100,  3200,
+  1500,  1800,  2000,  2400,  3200,  3300,
+  1600,  1800,  2000,  2500,  3200,  3300,
+  1600,  1800,  2100,  2600,  3200,  3300,
+  1700,  1900,  2100,  2700,  3200,  3300,
+  1600,  1800,  2100,  2500,  3300,  3400,
+  1700,  1900,  2100,  2500,  2900,  3200,
+  1600,  1900,  2100,  2300,  2800,  3200,
+  1200,  1700,  2200,  2600,  3000,  3300,
+  1200,  1700,  2300,  2600,  3100,  3300,
+  1600,  2100,  2400,  2700,  3100,  3300,
+  1500,  2000,  2400,  2600,  3100,  3400,
+  2100,  2200,  2700,  3000,  3200,  3300,
+  2100,  2200,  2700,  2900,  3100,  3300,
+  1500,  1800,  2200,  2600,  2900,  3200,
+  1400,  1600,  1800,  2900,  3200,  3300,
+  1600,  1700,  1900,  2500,  3100,  3200,
+  1700,  1800,  2000,  2600,  3100,  3200,
+  1700,  1800,  2100,  2600,  3200,  3300,
+  1700,  1900,  2200,  2600,  3200,  3300,
+  1700,  1900,  2200,  2600,  3100,  3200,
+  1700,  1900,  2200,  2500,  3100,  3200,
+  1700,  1800,  2200,  2600,  3200,  3300,
+  1700,  1800,  2200,  2500,  3200,  3300,
+  1600,  1800,  2100,  2300,  3100,  3200,
+  2300,  2500,  2800,  2900,  3200,  3300,
+  1700,  1900,  2400,  2700,  3200,  3300,
+  1700,  2000,  2400,  2800,  3200,  3300,
+  1500,  1900,  2300,  2700,  3200,  3300,
+  1500,  2000,  2300,  2500,  3200,  3300,
+  1600,  1900,  2200,  2500,  3200,  3300,
+  1600,  1900,  2200,  2400,  3100,  3300,
+  1600,  1800,  2200,  2300,  3000,  3300,
+  1700,  1800,  2200,  2300,  3000,  3300,
+  1700,  1900,  2200,  2400,  3100,  3300,
+  1700,  1900,  2200,  2400,  3100,  3400,
+  1700,  1800,  2200,  2400,  3100,  3400,
+  1500,  1800,  2300,  2400,  2900,  3300,
+  1500,  1700,  2200,  2400,  3100,  3400,
+  1400,  1700,  2200,  2300,  3100,  3400,
+  1600,  1900,  2500,  2700,  3200,  3400,
+  1500,  1800,  2400,  2600,  3000,  3300,
+  1400,  2100,  2500,  2600,  3100,  3300,
+  1200,  1800,  2100,  2300,  3200,  3300,
+  1800,  2100,  2600,  2900,  3100,  3200,
+  2000,  2400,  2900,  3100,  3300,  3400,
+  1500,  1800,  2200,  2400,  3300,  3400,
+  1500,  2000,  2100,  2700,  3300,  3400,
+  1600,  1800,  2000,  2400,  2900,  3100,
+  1600,  1800,  2200,  2600,  3000,  3200,
+  1500,  1800,  2100,  2600,  3000,  3200,
+  1600,  1900,  2100,  2400,  3000,  3300,
+  1600,  2000,  2200,  2500,  3300,  3400,
+  1600,  2000,  2100,  2400,  3300,  3400,
+  1400,  1700,  2200,  2600,  3000,  3200,
+  1300,  1600,  2200,  2500,  3000,  3200,
+  1300,  1500,  2100,  2500,  3000,  3300,
+  1200,  1600,  1700,  2400,  3300,  3400,
+  1300,  1600,  1700,  2500,  3300,  3400,
+  1300,  1600,  1700,  2500,  3200,  3300,
+  1400,  1700,  1800,  2500,  3200,  3300,
+  1500,  1800,  2000,  2500,  3200,  3300,
+  1500,  1900,  2000,  2500,  3200,  3300,
+  1600,  1800,  2100,  2400,  3200,  3300,
+  1600,  1900,  2100,  2400,  3200,  3300,
+  1500,  1700,  2100,  2200,  3000,  3300,
+  1400,  1600,  2100,  2200,  3000,  3200,
+  1400,  1800,  2100,  2300,  3000,  3200,
+  1600,  2100,  2300,  2700,  3100,  3300,
+  1200,  2100,  2400,  2700,  3300,  3400,
+  1600,  2100,  2200,  2600,  3300,  3400,
+  1300,  2000,  2200,  2500,  3300,  3400,
+  1300,  2300,  2500,  2800,  3300,  3400,
+  1300,  2000,  2300,  2500,  3200,  3300,
+  1700,  2000,  2400,  2800,  3100,  3300,
+  1900,  2200,  2500,  2900,  3100,  3300,
+  2000,  2100,  2600,  2800,  3200,  3300,
+  2000,  2100,  2700,  2900,  3200,  3300,
+  1000,  1900,  2400,  2600,  3300,  3400,
+  1000,  1900,  2500,  2600,  3200,  3300,
+  1000,  1900,  2500,  2600,  3300,  3400,
+  1000,  1800,  2400,  2600,  3200,  3300,
+  1000,  1800,  2400,  2600,  3300,  3400,
+  1000,  1900,  2400,  2600,  3200,  3300,
+  1400,  1700,  2200,  2600,  3100,  3300,
+  1400,  1600,  2100,  2500,  3000,  3300,
+  1300,  1800,  2100,  2400,  3200,  3300,
+  1100,  1900,  2200,  2400,  3200,  3300,
+  1100,  1900,  2300,  2500,  3300,  3400,
+  1100,  1900,  2400,  2500,  3200,  3300,
+  1100,  1900,  2400,  2600,  3200,  3300,
+  1100,  1900,  2300,  2400,  3300,  3400,
+  1200,  2000,  2300,  2500,  3200,  3300,
+  1300,  1900,  2200,  2400,  3300,  3400,
+  1500,  1800,  2200,  2300,  3300,  3400,
+  1700,  2200,  2700,  3000,  3300,  3400,
+  1900,  2200,  2800,  3000,  3200,  3300,
+  1900,  2200,  2500,  3000,  3200,  3300,
+  1600,  2100,  2300,  2700,  3300,  3400,
+  1600,  2000,  2300,  2700,  3300,  3400,
+  1600,  2100,  2500,  3000,  3300,  3400,
+  1600,  2200,  2600,  3000,  3300,  3400,
+  1900,  2400,  2900,  3100,  3300,  3400,
+  2100,  2500,  2900,  3000,  3300,  3400,
+  2000,  2400,  2900,  3000,  3200,  3300,
+  1700,  2200,  2400,  2900,  3200,  3300,
+  1300,  1800,  2100,  2500,  3200,  3300,
+  1500,  1600,  1800,  2300,  3000,  3200,
+  1500,  1600,  1900,  2000,  3000,  3300,
+  1400,  1800,  2200,  2600,  3200,  3300,
+  1600,  1800,  2200,  2400,  2900,  3100,
+  1500,  1700,  2100,  2400,  2900,  3100,
+  1400,  1700,  2100,  2400,  3000,  3200,
+  1400,  1700,  2300,  2600,  3200,  3300,
+  1300,  1900,  2300,  2600,  3200,  3300,
+  1000,  2100,  2500,  2700,  3300,  3400,
+  1400,  1900,  2000,  2500,  3200,  3300,
+  1600,  1900,  2100,  2500,  3300,  3400,
+  1600,  2000,  2300,  2500,  3200,  3300,
+  2200,  2400,  2800,  3000,  3200,  3300,
+  1900,  2300,  2400,  2700,  3100,  3200,
+  1900,  2200,  2300,  2600,  3100,  3200,
+  1900,  2100,  2300,  2800,  3200,  3300,
+  1700,  2000,  2400,  2700,  3200,  3300,
+  1900,  2200,  2500,  2700,  3100,  3300,
+  1700,  1800,  2200,  2500,  3300,  3400,
+  1700,  1900,  2200,  2700,  3200,  3300,
+  1700,  1900,  2300,  2700,  3300,  3400,
+  1800,  2000,  2400,  2800,  3300,  3400,
+  1800,  2000,  2300,  2600,  3300,  3400,
+  1900,  2000,  2300,  2500,  3200,  3300,
+  1900,  2100,  2400,  2600,  3200,  3300,
+  2000,  2200,  2400,  2700,  3200,  3300,
+  2100,  2200,  2500,  2900,  3200,  3300,
+  2200,  2300,  2600,  2900,  3200,  3300,
+  2200,  2300,  2700,  2900,  3100,  3300,
+  2100,  2400,  2600,  2800,  3200,  3300,
+  1900,  2200,  2600,  2800,  3000,  3200,
+  1800,  2100,  2400,  2700,  3000,  3200,
+  1800,  2000,  2400,  2700,  3100,  3200,
+  1600,  2000,  2200,  2500,  3100,  3200,
+  1300,  1900,  2100,  2300,  3100,  3300,
+  1200,  1600,  2100,  2200,  3200,  3400,
+  1100,  2000,  2400,  2600,  3200,  3300,
+  1400,  1700,  2100,  2300,  3100,  3300,
+  1400,  1900,  2200,  2500,  3300,  3400,
+  1300,  1800,  2200,  2700,  3200,  3300,
+  1300,  1900,  2200,  2600,  3200,  3300,
+  1400,  2000,  2200,  2700,  3200,  3300,
+  1400,  2000,  2200,  2600,  3300,  3400,
+  1400,  2000,  2200,  2500,  3200,  3300,
+  1400,  1900,  2200,  2400,  3200,  3300,
+  1400,  1800,  2200,  2300,  3000,  3300,
+  1400,  1800,  2200,  2300,  3100,  3300,
+  1400,  1800,  2100,  2300,  3200,  3400,
+  1500,  2000,  2400,  2700,  3300,  3400,
+  1700,  2100,  2500,  3000,  3300,  3400,
+  1400,  1900,  2300,  2800,  3200,  3300,
+  1400,  2000,  2200,  2400,  3200,  3300,
+  1200,  1900,  2200,  2400,  3200,  3300,
+  1200,  1900,  2200,  2500,  3200,  3300,
+  1200,  2000,  2200,  2500,  3300,  3400,
+  1700,  2100,  2300,  2400,  3200,  3400,
+  1400,  1600,  1800,  2500,  3100,  3200,
+  1500,  1800,  2100,  2500,  3000,  3200,
+  1700,  1800,  2200,  2500,  3100,  3300,
+  2000,  2100,  2500,  2800,  3100,  3300,
+  1900,  2100,  2200,  2700,  3100,  3200,
+  1500,  1800,  2100,  2300,  3200,  3400,
+  1600,  1800,  2000,  2300,  3200,  3400,
+  1600,  1800,  2100,  2300,  3200,  3400,
+  1500,  1800,  2000,  2300,  3300,  3400,
+  1500,  1700,  1900,  2400,  3300,  3400,
+  1600,  1900,  2000,  2700,  3100,  3200,
+  1700,  1900,  2200,  2600,  3100,  3300,
+  1700,  1900,  2200,  2500,  3200,  3300,
+  1700,  2000,  2400,  2600,  3100,  3300,
+  1700,  2000,  2400,  2700,  3100,  3200,
+  2300,  2400,  2700,  3000,  3200,  3300,
+  2200,  2400,  2600,  2900,  3200,  3300,
+  2200,  2400,  2500,  2800,  3200,  3300,
+  2100,  2400,  2500,  2800,  3200,  3300,
+  2000,  2400,  2500,  2700,  3200,  3300,
+  1900,  2300,  2400,  2800,  3200,  3300,
+  1900,  2300,  2600,  2700,  3100,  3300,
+  2000,  2400,  2800,  2900,  3200,  3300,
+  1700,  2200,  2500,  2800,  3200,  3400,
+  1500,  2100,  2400,  2600,  3100,  3300,
+  1500,  1900,  2300,  2500,  3200,  3400,
+  1400,  1900,  2300,  2400,  3200,  3300,
+  1100,  1700,  2400,  2600,  3200,  3300,
+  1100,  1700,  2400,  2600,  3300,  3400,
+  1100,  1800,  2400,  2500,  3300,  3400,
+  1100,  1800,  2400,  2500,  3200,  3300,
+  1100,  2000,  2500,  2600,  3200,  3300,
+  1100,  2100,  2500,  2600,  3200,  3300,
+  1100,  2100,  2500,  2700,  3200,  3300,
+  1000,  2200,  2600,  2700,  3200,  3300,
+  1100,  2300,  2600,  2800,  3200,  3300,
+  1100,  2100,  2500,  2700,  3100,  3200,
+  1500,  1700,  2300,  2500,  2900,  3200,
+  1600,  1700,  2200,  2600,  2800,  3100,
+  1600,  1700,  2100,  2600,  2800,  3000,
+  1500,  1700,  2100,  2500,  2800,  3000,
+  1500,  1600,  2200,  2500,  2800,  3100,
+  1500,  1600,  2300,  2600,  2800,  3100,
+  1400,  1500,  2300,  2700,  2900,  3100,
+  1400,  1500,  2200,  2700,  2800,  3100,
+  1400,  1600,  2000,  2700,  2900,  3100,
+  1500,  1700,  2200,  2700,  3100,  3300,
+  1500,  1800,  2300,  2700,  3100,  3300,
+  1600,  1700,  2300,  2700,  3000,  3300,
+  1700,  1800,  2200,  2700,  2900,  3200,
+  1800,  1900,  2200,  2700,  2900,  3100,
+  1700,  1900,  2200,  2600,  2900,  3000,
+  1800,  2000,  2300,  2700,  2900,  3100,
+  1800,  2000,  2300,  2800,  3000,  3200,
+  1800,  2000,  2400,  2800,  3000,  3200,
+  1800,  1900,  2300,  2800,  3000,  3200,
+  1500,  1700,  2200,  2500,  3000,  3100,
+  1700,  2100,  2400,  2800,  3100,  3200,
+  1800,  2200,  2700,  2900,  3400,  3500,
+  1900,  2400,  2700,  2900,  3400,  3500,
+  2000,  2400,  2600,  2900,  3300,  3400,
+  1900,  2400,  2500,  2800,  3200,  3300,
+  1900,  2300,  2500,  2600,  3200,  3300,
+  1700,  1900,  2400,  2500,  3100,  3200,
+  1600,  1700,  2300,  2600,  2900,  3100,
+  1600,  1700,  2400,  2600,  2900,  3100,
+  1600,  2100,  2600,  2800,  3300,  3400,
+  1700,  2200,  2700,  3000,  3200,  3300,
+  1700,  2300,  2800,  2900,  3200,  3300,
+  1700,  2300,  2700,  3000,  3200,  3300,
+  1600,  2100,  2700,  2900,  3300,  3400,
+  1200,  1600,  2400,  2600,  3000,  3300,
+  1100,  1400,  2400,  2700,  2900,  3100,
+  1200,  1800,  2200,  2500,  3100,  3300,
+  1200,  1700,  2200,  2500,  3100,  3300,
+  1800,  1900,  2300,  2500,  2900,  3200,
+  1900,  2000,  2400,  2500,  2800,  3100,
+  2000,  2200,  2400,  2500,  2800,  3100,
+  2000,  2200,  2400,  2600,  2800,  3200,
+  2000,  2100,  2500,  2700,  3100,  3400,
+  1900,  2000,  2600,  2700,  3100,  3300,
+  1900,  2000,  2600,  2700,  3200,  3300,
+  1900,  2400,  2700,  3000,  3300,  3400,
+  2000,  2400,  2800,  2900,  3200,  3400,
+  1900,  2000,  2300,  2600,  3000,  3200,
+  1900,  2100,  2400,  2700,  3000,  3200,
+  1900,  2100,  2400,  2800,  3100,  3200,
+  1900,  2100,  2400,  2800,  3300,  3400,
+  1500,  1800,  2100,  2600,  3100,  3300,
+  1600,  1800,  2100,  2200,  3000,  3300,
+  1800,  2100,  2300,  2500,  3000,  3200,
+  2000,  2100,  2300,  2500,  3000,  3300,
+  2000,  2100,  2300,  2500,  2900,  3300,
+  2000,  2100,  2300,  2400,  2900,  3300,
+  1600,  1800,  2300,  2500,  2900,  3200,
+  1700,  1900,  2400,  2700,  3000,  3200,
+  1700,  2000,  2400,  2600,  3000,  3300,
+  1600,  2000,  2300,  2700,  3000,  3200,
+  1500,  1800,  2300,  2600,  3100,  3200,
+  1700,  1800,  2300,  2400,  2800,  3000,
+  1800,  2000,  2400,  2500,  2900,  3200,
+  1800,  2000,  2400,  2600,  3000,  3200,
+  1900,  2000,  2400,  2500,  3000,  3200,
+  1900,  2000,  2300,  2500,  3000,  3200,
+  1800,  1900,  2200,  2400,  2900,  3200,
+  1800,  1900,  2200,  2300,  2900,  3200,
+  1600,  1800,  2200,  2400,  3100,  3300,
+  1600,  2000,  2400,  2700,  3100,  3200,
+  1800,  2100,  2500,  2700,  3000,  3200,
+  2000,  2200,  2500,  2700,  3000,  3200,
+  2000,  2300,  2500,  2700,  3000,  3200,
+  2000,  2300,  2400,  2700,  3000,  3200,
+  2100,  2200,  2400,  2500,  3000,  3300,
+  1900,  2000,  2300,  2600,  2800,  3300,
+  1900,  2000,  2400,  2700,  3100,  3300,
+  1500,  2000,  2400,  2700,  3100,  3300,
+  1600,  1900,  2500,  2800,  3000,  3300,
+  1900,  2000,  2400,  2700,  2900,  3200,
+  2000,  2200,  2400,  2700,  2900,  3200,
+  2100,  2200,  2400,  2700,  2900,  3200,
+  2100,  2300,  2400,  2600,  2800,  3200,
+  1300,  2000,  2300,  2500,  2700,  3100,
+  1800,  1900,  2100,  2400,  2900,  3100,
+  1700,  1900,  2100,  2500,  2900,  3100,
+  1800,  1900,  2300,  2600,  3100,  3300,
+  1600,  1700,  2300,  2600,  2800,  3200,
+  1700,  1800,  2300,  2600,  2800,  3100,
+  1700,  1800,  2300,  2700,  2800,  3200,
+  1500,  1700,  2300,  2600,  3000,  3300,
+  1400,  1700,  2200,  2500,  3000,  3300,
+  1400,  1600,  2200,  2300,  3000,  3300,
+  1400,  1600,  2200,  2400,  2800,  3300,
+  1500,  1600,  2200,  2400,  2900,  3300,
+  1500,  1600,  2200,  2400,  2800,  3300,
+  1500,  1700,  2200,  2500,  3000,  3200,
+  1700,  1900,  2300,  2700,  3000,  3300,
+  1600,  1800,  2400,  2700,  3000,  3200,
+  1600,  2000,  2500,  2800,  3000,  3300,
+  2000,  2200,  2500,  2600,  3200,  3300,
+  1600,  1800,  2200,  2500,  3100,  3200,
+  1500,  1700,  1800,  2300,  3300,  3400,
+  1400,  1600,  1800,  2000,  3200,  3400,
+  1400,  1600,  1800,  1900,  3100,  3400,
+  1400,  1600,  1900,  2000,  2900,  3300,
+  1400,  1500,  1900,  2000,  2900,  3200,
+  1900,  2200,  2500,  2800,  3100,  3200,
+  1800,  2200,  2500,  2700,  3000,  3200,
+  1800,  2200,  2600,  2700,  3100,  3200,
+  2000,  2300,  2700,  2800,  3200,  3300,
+  2100,  2200,  2600,  2800,  3000,  3300,
+  2100,  2200,  2500,  2700,  3100,  3300,
+  1700,  1800,  2000,  2100,  2800,  3200,
+  1600,  1700,  1900,  2000,  2800,  3200,
+  1400,  1500,  1800,  1900,  2800,  3200,
+  1400,  1800,  2100,  2400,  3000,  3200,
+  1600,  1900,  2300,  2600,  3000,  3300,
+  1600,  1900,  2300,  2500,  3100,  3300,
+  1600,  1900,  2400,  2700,  3000,  3200,
+  1600,  1900,  2400,  2700,  3000,  3300,
+  1500,  1900,  2400,  2700,  3000,  3300,
+  1100,  1400,  2500,  2800,  3000,  3300,
+  1100,  1300,  2300,  2800,  3000,  3200,
+  1400,  1500,  2100,  2700,  2900,  3100,
+  1500,  1600,  2100,  2700,  2900,  3100,
+  1700,  1800,  2200,  2600,  2800,  3100,
+  1800,  2000,  2300,  2600,  2800,  3000,
+  1900,  2100,  2300,  2600,  2800,  3100,
+  2000,  2100,  2300,  2600,  2800,  3100,
+  2000,  2100,  2400,  2500,  2800,  3200,
+  1900,  2100,  2300,  2500,  2800,  3200,
+  1800,  1900,  2300,  2500,  2800,  3300,
+  1700,  1800,  2300,  2500,  3000,  3300,
+  1700,  1900,  2400,  2600,  3000,  3200,
+  1500,  1900,  2200,  2600,  3100,  3300,
+  1300,  1500,  1800,  1900,  2900,  3200,
+  1300,  1500,  1800,  1900,  2900,  3300,
+  1300,  1500,  1800,  1900,  2800,  3200,
+  1400,  1500,  1700,  1900,  2800,  3200,
+  1400,  1500,  1700,  1800,  2800,  3200,
+  1700,  2000,  2400,  2500,  3100,  3300,
+  2100,  2400,  2700,  2800,  3300,  3500,
+  1800,  2300,  2700,  2900,  3200,  3400,
+  1700,  2300,  2700,  2900,  3300,  3400,
+  1700,  2100,  2700,  2900,  3300,  3400,
+  1800,  2400,  2700,  2900,  3300,  3400,
+  1900,  2500,  2800,  3000,  3300,  3400,
+  2000,  2500,  2800,  3000,  3300,  3400,
+  2000,  2400,  2700,  3000,  3200,  3400,
+  1900,  2300,  2700,  3000,  3200,  3400,
+  1800,  2000,  2500,  2700,  2900,  3200,
+  1800,  2000,  2400,  2700,  2900,  3100,
+  1900,  2000,  2300,  2700,  2900,  3000,
+  1900,  2000,  2400,  2700,  2900,  3100,
+  1800,  1900,  2400,  2700,  2900,  3100,
+  1800,  1900,  2300,  2700,  2800,  3100,
+  1800,  1900,  2300,  2600,  2800,  3100,
+  1500,  1800,  2400,  2700,  3200,  3400,
+  1600,  1800,  2500,  2700,  3100,  3400,
+  1500,  1700,  2400,  2700,  3000,  3300,
+  1400,  1500,  2400,  2700,  2900,  3200,
+  1300,  1500,  2300,  2700,  2900,  3100,
+  1400,  1600,  2100,  2600,  2800,  3000,
+  1500,  1600,  2100,  2600,  2800,  3000,
+  1400,  1600,  2200,  2400,  3000,  3200,
+  1300,  1600,  2200,  2500,  2900,  3200,
+  1300,  1700,  2200,  2600,  3000,  3300,
+  1300,  1700,  2200,  2700,  3100,  3200,
+  1200,  1400,  2200,  2700,  2900,  3100,
+  1100,  1400,  2300,  2700,  2900,  3100,
+  1100,  1300,  2400,  2800,  3000,  3200,
+  1200,  1600,  2300,  2600,  3100,  3200,
+  1500,  2100,  2400,  2700,  3200,  3300,
+  1800,  2100,  2400,  2800,  3200,  3300,
+  1600,  2100,  2400,  2800,  3200,  3300,
+  1600,  2000,  2500,  2900,  3200,  3300,
+  1800,  2000,  2500,  2900,  3200,  3300,
+  1700,  1900,  2400,  2800,  3100,  3300,
+  1600,  1800,  2400,  2700,  3100,  3300,
+  1500,  1600,  2200,  2500,  2900,  3200,
+  1500,  1600,  2200,  2500,  2800,  3200,
+  1400,  1600,  2100,  2500,  2800,  3100,
+  1200,  1400,  2200,  2500,  2700,  3100,
+  1100,  1400,  2400,  2800,  2900,  3100,
+  1400,  1700,  2300,  2600,  2900,  3200,
+  1500,  1800,  2300,  2500,  2900,  3300,
+  1500,  1700,  2000,  2100,  3000,  3300,
+  1500,  1700,  2000,  2200,  3100,  3300,
+  1500,  1700,  2100,  2300,  3100,  3200,
+  1600,  1900,  2500,  2700,  3100,  3200,
+  1800,  2300,  2800,  3100,  3300,  3400,
+  1800,  2200,  2700,  2900,  3200,  3400,
+  1700,  2200,  2700,  2800,  3200,  3400,
+  1500,  1800,  2600,  2700,  3000,  3200,
+  1500,  1700,  2300,  2700,  2800,  3100,
+  1400,  1500,  2100,  2200,  2700,  3200,
+  1400,  1500,  2000,  2100,  2600,  3100,
+  1300,  1500,  1900,  2000,  2500,  3100,
+  1400,  1500,  1800,  1900,  2700,  3200,
+  1500,  1600,  2000,  2100,  2600,  3100,
+  1700,  1800,  2000,  2200,  2600,  3100,
+  1700,  1800,  2100,  2200,  2700,  3100,
+  1600,  2000,  2400,  2500,  3000,  3200,
+  2000,  2200,  2500,  2900,  3100,  3300,
+  1900,  2200,  2400,  2600,  2900,  3100,
+  1600,  1700,  2200,  2400,  2700,  3300,
+  1700,  1800,  2300,  2400,  2800,  3200,
+  1800,  1900,  2300,  2500,  2800,  3200,
+  1900,  2100,  2400,  2500,  3000,  3300,
+  2100,  2200,  2500,  2600,  3000,  3300,
+  2000,  2100,  2500,  2700,  2900,  3200,
+  1700,  1900,  2200,  2700,  2800,  3100,
+  1800,  1900,  2400,  2700,  2800,  3200,
+  1800,  1900,  2400,  2700,  2900,  3200,
+  1700,  1800,  2200,  2700,  2800,  3100,
+  1700,  1800,  2200,  2700,  3000,  3200,
+  1900,  2100,  2500,  2900,  3100,  3300,
+  1700,  2000,  2500,  2700,  3200,  3400,
+  1900,  2200,  2700,  3000,  3300,  3400,
+  2000,  2400,  2800,  3100,  3400,  3500,
+  2100,  2400,  2600,  2900,  3200,  3300,
+  2100,  2400,  2500,  2700,  3100,  3300,
+  1800,  2100,  2500,  2700,  3200,  3300,
+  1700,  2100,  2400,  2700,  3200,  3300,
+  1500,  1600,  1800,  1900,  2600,  3100,
+  1500,  1600,  1900,  2000,  2500,  3100,
+  1600,  1700,  2000,  2100,  2500,  3100,
+  1800,  2100,  2300,  2500,  2800,  3200,
+  1900,  2100,  2300,  2500,  2700,  3200,
+  2000,  2200,  2400,  2600,  2900,  3300,
+  2000,  2200,  2400,  2600,  2900,  3200,
+  2000,  2100,  2400,  2500,  2900,  3300,
+  1800,  2200,  2500,  2900,  3400,  3500,
+  1800,  2300,  2500,  2900,  3300,  3400,
+  2000,  2300,  2500,  2800,  3000,  3300,
+  1800,  2000,  2400,  2500,  2800,  3300,
+  1100,  1400,  2600,  2800,  3000,  3200,
+  1300,  1500,  2200,  2700,  2900,  3200,
+  1400,  1600,  2200,  2700,  3000,  3200,
+  1400,  1600,  2200,  2600,  3100,  3200,
+  1500,  1800,  2200,  2400,  3100,  3300,
+  1700,  1800,  2200,  2500,  3000,  3300,
+  1700,  1800,  2200,  2600,  3000,  3200,
+  1700,  1800,  2300,  2600,  3000,  3200,
+  1700,  1800,  2400,  2700,  3000,  3100,
+  1600,  1700,  2500,  2800,  3000,  3200,
+  1400,  1500,  2200,  2700,  2900,  3100,
+  1300,  1400,  2100,  2700,  2900,  3200,
+  1500,  1900,  2300,  2600,  3000,  3200,
+  1400,  1600,  2200,  2500,  2700,  3100,
+  1600,  1700,  2200,  2500,  2800,  3200,
+  1600,  1800,  2100,  2500,  2900,  3200,
+  1600,  1800,  2100,  2600,  3000,  3200,
+  1800,  2100,  2400,  2800,  3100,  3300,
+  1800,  2100,  2400,  2700,  3000,  3300,
+  2000,  2100,  2500,  2800,  3000,  3200,
+  1800,  2000,  2500,  2700,  3000,  3200,
+  1600,  1900,  2300,  2700,  2900,  3200,
+  1600,  1900,  2100,  2500,  2800,  3100,
+  1700,  1900,  2100,  2500,  2800,  3000,
+  1700,  1800,  2100,  2600,  2800,  3000,
+  1600,  1700,  2000,  2600,  2800,  3000,
+  1400,  1700,  2200,  2700,  3000,  3200,
+  1500,  1800,  2300,  2700,  3000,  3200,
+  1600,  1800,  2300,  2600,  3000,  3300,
+  1600,  1800,  2300,  2600,  3100,  3300,
+  1600,  1900,  2300,  2600,  3100,  3300,
+  1200,  1300,  2100,  2700,  3000,  3100,
+  1300,  1400,  2100,  2700,  2900,  3100,
+  1300,  1400,  2200,  2700,  2900,  3100,
+  1300,  1400,  2100,  2600,  2800,  3100,
+  1300,  1500,  2100,  2600,  2800,  3100,
+  1500,  1600,  1900,  2500,  2900,  3100,
+  1500,  1700,  2100,  2700,  2900,  3200,
+  1600,  1900,  2400,  2700,  3200,  3300,
+  1900,  2100,  2500,  2800,  3200,  3400,
+  1700,  2000,  2400,  2800,  3200,  3400,
+  1600,  1700,  2200,  2400,  2800,  3300,
+  1500,  1600,  2200,  2400,  3000,  3300,
+  1500,  1700,  2300,  2700,  3100,  3300,
+  1400,  1500,  2000,  2600,  2900,  3100,
+  1400,  1500,  2100,  2500,  2800,  3100,
+  1400,  1700,  2200,  2600,  3000,  3300,
+  1000,  1500,  2600,  2800,  3100,  3400,
+  1300,  1500,  2500,  2700,  2900,  3300,
+  1500,  1600,  2200,  2600,  2800,  3100,
+  1700,  1800,  2200,  2400,  2700,  3200,
+  1700,  1800,  2100,  2400,  2600,  3100,
+  1600,  1700,  2100,  2400,  2700,  3200,
+  1600,  1900,  2300,  2700,  3000,  3300,
+  1500,  1600,  2000,  2400,  3000,  3300,
+  1600,  1800,  2300,  2600,  3200,  3300,
+  1700,  1800,  2400,  2600,  3200,  3400,
+  1600,  1800,  2400,  2600,  3200,  3400,
+  1700,  1800,  2300,  2600,  3000,  3300,
+  1700,  1800,  2100,  2500,  2900,  3200,
+  1800,  1900,  2100,  2600,  2800,  3000,
+  1800,  1900,  2200,  2600,  2800,  3000,
+  1800,  1900,  2200,  2600,  2900,  3100,
+  1700,  1800,  2100,  2600,  2900,  3100,
+  1600,  1700,  2100,  2700,  2900,  3100,
+  1400,  1600,  2100,  2700,  2900,  3200,
+  1200,  1600,  2200,  2400,  3000,  3300,
+  1600,  1900,  2300,  2700,  3100,  3400,
+  1200,  1800,  2300,  2700,  3100,  3300,
+  1600,  2000,  2400,  2800,  3100,  3300,
+  1700,  1900,  2100,  2600,  3100,  3300,
+  1800,  1900,  2300,  2600,  3100,  3400,
+  1900,  2000,  2300,  2600,  3200,  3300,
+  1900,  2000,  2300,  2600,  3100,  3300,
+  1900,  2100,  2300,  2700,  3100,  3300,
+  1200,  1400,  2200,  2800,  3000,  3100,
+  1800,  2100,  2400,  2700,  3200,  3400,
+  1600,  2100,  2500,  2800,  3100,  3300,
+  1600,  2000,  2500,  2800,  3200,  3300,
+  1700,  2000,  2500,  2800,  3200,  3400,
+  1700,  1900,  2700,  2800,  3100,  3400,
+  1600,  1800,  2400,  2600,  3100,  3400,
+  1600,  1800,  2300,  2500,  3100,  3400,
+  1600,  1800,  2200,  2500,  3100,  3400,
+  1600,  1800,  2100,  2300,  3100,  3400,
+  1500,  1700,  2000,  2200,  3000,  3300,
+  1500,  1600,  1900,  2000,  3000,  3200,
+  1300,  1500,  1700,  1900,  2800,  3200,
+  1800,  2000,  2300,  2600,  3000,  3200,
+  1700,  2000,  2200,  2600,  3000,  3200,
+  1600,  1900,  2400,  2600,  3000,  3300,
+  1300,  1700,  2100,  2400,  2900,  3200,
+  1600,  1800,  2400,  2600,  3000,  3300,
+  1300,  1600,  2200,  2300,  2900,  3200,
+  1300,  1400,  2100,  2200,  3000,  3200,
+  1300,  1500,  1800,  2000,  3000,  3200,
+  1300,  1400,  1800,  1900,  2800,  3200,
+  1300,  1700,  2200,  2500,  3000,  3200,
+  1200,  1800,  2300,  2600,  3200,  3300,
+  1400,  1900,  2300,  2700,  3100,  3300,
+  1500,  2000,  2400,  2600,  3000,  3300,
+  1600,  2000,  2500,  2600,  3100,  3300,
+  1600,  1900,  2500,  2700,  3100,  3300,
+  1600,  2000,  2500,  2600,  3000,  3200,
+  1400,  1600,  2300,  2600,  2800,  3200,
+  1300,  1500,  2000,  2600,  2700,  3000,
+  1300,  1500,  2200,  2600,  2800,  3100,
+  1400,  1500,  2100,  2600,  2800,  3100,
+  1400,  1500,  2100,  2600,  2800,  3000,
+  1500,  1600,  2000,  2500,  2700,  3000,
+  1500,  1700,  2000,  2500,  2700,  3000,
+  1600,  1700,  2000,  2500,  2800,  3000,
+  1700,  1800,  2100,  2500,  2900,  3100,
+  1700,  1900,  2100,  2500,  2900,  3000,
+  1800,  2000,  2200,  2600,  2800,  3000,
+  1800,  2100,  2300,  2600,  2800,  3100,
+  1800,  2100,  2300,  2600,  2900,  3100,
+  1800,  2000,  2200,  2600,  2900,  3100,
+  1800,  2000,  2300,  2600,  2900,  3100,
+  1800,  2000,  2300,  2600,  2800,  3100,
+  1700,  1900,  2200,  2600,  2800,  3000,
+  1700,  1800,  2100,  2500,  2700,  3000,
+  1500,  1700,  2200,  2400,  2800,  3300,
+  1500,  1900,  2300,  2500,  3100,  3300,
+  1700,  1800,  2200,  2800,  3100,  3200,
+  1700,  1900,  2100,  2700,  3000,  3200,
+  1900,  2100,  2400,  2600,  3000,  3200,
+  2000,  2200,  2400,  2700,  3000,  3200,
+  1900,  2300,  2400,  2700,  3100,  3300,
+  1500,  1600,  1800,  2000,  3100,  3300,
+  1200,  1400,  1900,  2500,  2900,  3100,
+  1600,  1700,  2000,  2100,  2900,  3300,
+  1700,  1800,  2100,  2200,  2900,  3300,
+  1800,  1900,  2200,  2300,  3000,  3300,
+  1900,  2000,  2200,  2300,  3100,  3300,
+  2000,  2100,  2300,  2500,  3100,  3400,
+  1900,  2100,  2300,  2500,  3000,  3200,
+  1800,  2000,  2300,  2400,  2900,  3200,
+  1900,  2200,  2600,  2800,  3100,  3300,
+  2000,  2400,  2600,  2700,  3200,  3400,
+  1800,  2200,  2600,  2700,  3100,  3300,
+  1600,  2100,  2600,  2700,  3100,  3300,
+  1600,  2100,  2500,  2800,  3200,  3400,
+  1900,  2200,  2500,  2800,  3200,  3400,
+  1800,  2000,  2500,  2800,  3300,  3400,
+  1700,  1900,  2600,  2800,  3100,  3400,
+  1600,  1700,  2400,  2700,  3100,  3300,
+  1400,  1600,  2200,  2500,  2800,  3200,
+  1400,  1600,  2300,  2500,  2900,  3200,
+  1400,  1500,  2300,  2600,  2900,  3200,
+  1300,  1500,  2400,  2600,  3000,  3300,
+  1200,  1400,  2400,  2600,  2900,  3300,
+  1200,  1300,  2300,  2600,  2800,  3200,
+  1200,  1300,  2300,  2600,  2800,  3100,
+  1200,  1400,  2300,  2600,  2800,  3200,
+  1200,  1400,  2300,  2500,  2800,  3200,
+  1200,  1400,  2300,  2500,  2700,  3200,
+  1300,  1400,  2300,  2500,  2700,  3200,
+  1300,  1400,  2300,  2400,  2900,  3200,
+  1300,  1600,  2300,  2400,  2900,  3200,
+  1600,  1700,  2200,  2500,  3000,  3200,
+  1600,  1700,  2200,  2500,  2900,  3200,
+  1600,  1800,  2300,  2400,  2900,  3200,
+  1600,  1800,  2200,  2400,  2900,  3200,
+  1700,  1900,  2400,  2700,  3000,  3300,
+  1600,  1800,  2400,  2700,  3000,  3300,
+  1600,  1800,  2300,  2600,  2900,  3200,
+  1600,  1800,  2500,  2700,  2900,  3200,
+  1600,  1900,  2500,  2800,  3100,  3300,
+  1600,  1900,  2500,  2800,  3000,  3200,
+  1400,  1700,  2400,  2700,  2900,  3200,
+  1400,  1500,  2200,  2600,  2800,  3100,
+  1300,  1500,  2300,  2600,  2800,  3100,
+  1200,  1400,  2300,  2500,  2700,  3100,
+  1300,  1600,  2200,  2600,  3000,  3300,
+  1200,  1600,  2500,  2700,  3100,  3400,
+  1300,  1800,  2400,  2700,  3200,  3400,
+  1300,  1700,  2300,  2700,  3100,  3300,
+  1300,  1700,  2200,  2500,  3100,  3300,
+  1300,  1600,  2200,  2600,  2900,  3200,
+  1400,  1600,  2200,  2700,  2800,  3100,
+  1600,  1700,  2200,  2700,  3100,  3200,
+  1800,  2000,  2400,  2800,  3100,  3300,
+  1800,  2000,  2400,  2800,  3200,  3300,
+  1700,  1800,  2200,  2700,  2900,  3100,
+  1700,  1800,  2300,  2700,  3000,  3300,
+  1800,  1900,  2600,  2800,  3300,  3400,
+  1900,  2100,  2300,  2600,  2900,  3100,
+  1900,  2200,  2400,  2700,  3000,  3100,
+  1800,  2300,  2400,  2700,  3000,  3100,
+  1800,  2300,  2400,  2600,  3100,  3200,
+  2000,  2300,  2400,  2700,  3100,  3200,
+  2100,  2300,  2500,  2700,  3000,  3200,
+  2000,  2100,  2500,  2700,  3000,  3200,
+  1900,  2000,  2300,  2700,  2900,  3100,
+  1600,  1800,  2200,  2500,  2700,  3000,
+  1500,  1800,  2300,  2500,  2700,  3000,
+  1500,  1800,  2200,  2500,  2700,  3000,
+  1600,  1800,  2300,  2500,  2800,  3000,
+  1700,  1800,  2400,  2700,  3000,  3200,
+  1700,  1800,  2500,  2700,  3000,  3200,
+  1700,  1800,  2400,  2700,  3000,  3300,
+  1600,  1700,  2400,  2600,  2900,  3200,
+  1500,  1700,  2400,  2600,  2800,  3200,
+  1500,  1700,  2400,  2500,  2800,  3200,
+  1400,  1600,  2400,  2500,  3000,  3300,
+  1500,  1700,  2300,  2400,  2900,  3200,
+  1500,  1800,  2200,  2400,  2800,  3000,
+  1600,  1900,  2200,  2600,  2900,  3100,
+  1800,  2000,  2300,  2600,  2900,  3000,
+  1600,  2000,  2300,  2500,  2900,  3100,
+  1600,  1800,  2100,  2300,  2900,  3100,
+  1300,  1500,  2200,  2400,  3000,  3200,
+  1300,  1500,  2200,  2400,  2900,  3200,
+  1300,  1500,  2200,  2500,  2900,  3200,
+  1400,  1500,  2300,  2500,  2900,  3200,
+  1600,  1700,  2100,  2500,  2800,  3100,
+  1600,  1700,  2100,  2600,  2800,  3100,
+  1700,  1800,  2100,  2500,  2800,  3100,
+  1700,  1800,  2200,  2600,  2900,  3100,
+  1700,  1900,  2300,  2600,  2900,  3200,
+  1800,  2100,  2300,  2600,  2900,  3200,
+  1800,  2100,  2300,  2700,  2900,  3200,
+  1900,  2200,  2400,  2700,  2900,  3200,
+  1900,  2100,  2300,  2700,  2900,  3100,
+  1900,  2000,  2300,  2600,  2800,  3100,
+  1900,  2200,  2500,  2800,  3100,  3300,
+  1900,  2200,  2400,  2800,  3000,  3200,
+  1900,  2200,  2400,  2700,  2900,  3100,
+  1900,  2300,  2400,  2800,  3100,  3200,
+  2000,  2300,  2500,  2800,  3100,  3300,
+  1900,  2400,  2500,  2800,  3100,  3200,
+  1800,  2000,  2200,  2500,  3000,  3200,
+  1800,  1900,  2100,  2400,  2900,  3200,
+  1500,  1600,  2200,  2400,  2700,  3200,
+  1300,  1400,  2200,  2500,  2700,  3200,
+  1200,  1500,  2500,  2700,  3000,  3300,
+  1300,  1600,  2400,  2600,  3000,  3300,
+  2000,  2200,  2600,  2700,  3000,  3300,
+  2100,  2300,  2500,  2700,  3000,  3300,
+  2100,  2300,  2600,  2700,  3000,  3300,
+  2000,  2200,  2600,  2700,  3000,  3200,
+  1800,  2300,  2500,  2600,  2900,  3200,
+  1800,  2300,  2500,  2700,  2900,  3100,
+  1800,  2200,  2400,  2600,  2900,  3200,
+  1800,  2200,  2400,  2600,  2800,  3100,
+  1800,  2200,  2300,  2600,  2900,  3100,
+  1800,  2000,  2200,  2800,  3000,  3200,
+  1800,  1900,  2200,  2800,  3000,  3200,
+  1700,  1900,  2300,  2800,  3000,  3300,
+  1600,  1800,  2300,  2800,  3000,  3300,
+  1400,  1700,  2200,  2500,  2800,  2900,
+  1400,  1700,  2100,  2500,  2900,  3200,
+  1700,  2000,  2200,  2800,  3200,  3300,
+  1800,  1900,  2200,  2700,  2900,  3200,
+  1800,  2000,  2200,  2700,  2900,  3100,
+  1800,  2000,  2200,  2700,  2800,  3000,
+  1800,  2000,  2200,  2700,  2800,  3100,
+  1600,  1900,  2100,  2600,  2900,  3200,
+  2000,  2100,  2600,  2900,  3000,  3200,
+  2000,  2200,  2700,  2900,  3100,  3300,
+  2000,  2200,  2400,  2800,  3000,  3200,
+  2000,  2200,  2300,  2700,  3000,  3200,
+  1700,  2200,  2400,  2600,  2900,  3100,
+  1800,  2200,  2400,  2700,  3000,  3200,
+  1900,  2300,  2500,  2700,  3000,  3200,
+  1900,  2300,  2500,  2700,  2900,  3100,
+  1900,  2300,  2500,  2800,  3000,  3200,
+  1900,  2300,  2500,  2700,  2900,  3200,
+  1800,  2200,  2400,  2700,  2900,  3100,
+  1800,  2000,  2300,  2700,  3000,  3200,
+  1600,  1700,  2100,  2800,  3100,  3200,
+  1400,  1800,  2200,  2500,  3000,  3100,
+  1400,  1800,  2300,  2500,  3000,  3100,
+  1400,  1800,  2300,  2500,  2900,  3100,
+  1600,  1800,  2500,  2800,  3100,  3200,
+  1700,  2000,  2400,  2700,  3200,  3400,
+  1700,  2000,  2500,  2800,  3100,  3400,
+  1500,  1700,  2300,  2600,  2900,  3200,
+  1500,  1700,  2200,  2600,  2800,  3200,
+  1500,  1700,  2200,  2600,  2900,  3300,
+  1400,  1700,  2200,  2600,  2900,  3300,
+  1200,  1500,  2200,  2300,  3100,  3400,
+  1200,  1600,  2300,  2400,  3200,  3300,
+  1200,  1700,  2300,  2400,  3100,  3300,
+  1100,  1700,  2400,  2500,  3100,  3300,
+  1100,  1800,  2500,  2600,  3100,  3300,
+  1100,  1800,  2500,  2600,  3200,  3300,
+  1000,  1800,  2500,  2600,  3200,  3300,
+  1000,  1700,  2400,  2500,  3200,  3300,
+  1100,  1600,  2400,  2500,  3200,  3300,
+  1100,  1600,  2300,  2400,  3200,  3300,
+  1300,  1600,  2300,  2500,  3100,  3300,
+  1400,  1700,  2300,  2500,  3100,  3300,
+  2000,  2100,  2500,  2600,  3200,  3400,
+  1700,  2100,  2600,  2800,  3100,  3200,
+  1800,  2200,  2700,  2900,  3100,  3300,
+  2100,  2400,  2700,  2900,  3200,  3300,
+  2100,  2500,  2700,  2900,  3300,  3400,
+  2100,  2400,  2600,  2800,  3200,  3400,
+  1700,  1900,  2400,  2600,  2900,  3000,
+  1600,  1900,  2400,  2500,  2800,  2900,
+  1300,  2000,  2400,  2500,  2900,  3200,
+  1500,  2000,  2400,  2500,  2900,  3100,
+  1600,  2000,  2400,  2600,  3000,  3100,
+  1700,  1900,  2500,  2600,  3100,  3200,
+  1600,  1800,  2600,  2700,  3300,  3400,
+  1500,  1600,  2600,  2700,  3200,  3400,
+  1500,  1700,  2600,  2700,  3200,  3400,
+  1500,  2100,  2600,  2800,  3300,  3400,
+  1700,  2200,  2700,  2900,  3300,  3400,
+  1700,  2300,  2700,  2800,  3300,  3400,
+  1800,  2300,  2700,  2800,  3300,  3400,
+  1400,  1700,  2500,  2600,  3000,  3300,
+  1400,  1800,  2500,  2600,  3000,  3300,
+  1800,  2200,  2700,  2900,  3300,  3400,
+  1800,  2300,  2600,  2900,  3300,  3400,
+  1400,  1900,  2500,  2600,  3200,  3400,
+  1400,  2000,  2400,  2500,  3200,  3300,
+  1400,  2100,  2400,  2600,  3200,  3300,
+  1200,  2000,  2400,  2700,  3200,  3300,
+  1300,  1900,  2300,  2600,  3100,  3200,
+  1300,  1800,  2300,  2500,  3100,  3200,
+  1200,  1700,  2300,  2500,  3000,  3100,
+  1200,  1800,  2400,  2500,  3000,  3100,
+  1100,  2100,  2300,  2600,  3000,  3100,
+  1400,  1800,  2200,  2700,  3100,  3200,
+  1600,  2000,  2400,  2600,  3200,  3300,
+  1600,  1900,  2400,  2600,  3300,  3400,
+  1600,  2000,  2500,  2600,  3300,  3400,
+  1600,  2000,  2300,  2500,  3300,  3400,
+  1500,  2400,  2700,  2800,  3100,  3300,
+  1300,  2000,  2500,  2600,  3200,  3300,
+  1400,  2000,  2500,  2600,  3200,  3300,
+  1600,  1900,  2400,  2600,  3200,  3300,
+  1600,  2000,  2300,  2600,  3200,  3300,
+  1600,  2100,  2300,  2500,  3000,  3100,
+  1800,  2100,  2400,  2700,  2900,  3200,
+  1500,  1700,  2000,  2600,  3200,  3300,
+  1400,  1700,  2000,  2400,  3200,  3300,
+  1400,  1900,  2200,  2500,  3100,  3300,
+  1500,  1900,  2200,  2500,  3100,  3300,
+  1200,  1900,  2500,  2600,  3100,  3300,
+  1000,  1700,  2600,  2800,  3300,  3400,
+  1200,  1500,  2400,  2700,  2900,  3200,
+  1700,  2100,  2400,  2800,  3200,  3400,
+  1700,  2000,  2600,  2800,  3100,  3400,
+  1700,  2000,  2600,  2700,  3000,  3300,
+  1500,  1700,  2500,  2700,  3000,  3300,
+  1600,  2000,  2600,  2800,  3100,  3300,
+  1500,  2000,  2500,  2800,  3200,  3400,
+  1400,  1800,  2500,  2800,  3300,  3400,
+  1700,  2200,  2600,  2900,  3200,  3400,
+  1700,  2200,  2600,  2800,  3200,  3400,
+  1800,  2000,  2500,  2600,  3300,  3400,
+  1500,  1800,  2200,  2500,  3100,  3200,
+  1600,  2100,  2400,  2700,  3300,  3400,
+  1400,  1800,  2500,  2700,  3000,  3300,
+  1300,  1600,  2500,  2600,  3200,  3400,
+  1400,  1700,  2500,  2600,  3300,  3400,
+  1500,  1700,  2400,  2500,  3200,  3400,
+  1900,  2000,  2300,  2500,  3200,  3400,
+  1600,  1900,  2100,  2500,  3000,  3200,
+  1600,  2100,  2500,  2800,  3200,  3300,
+  1400,  2000,  2400,  2700,  3200,  3300,
+  900,  1800,  2400,  2600,  3200,  3300,
+  1100,  1600,  2700,  2800,  3200,  3400,
+  1200,  1600,  2600,  2800,  3200,  3400,
+  1300,  1700,  2500,  2700,  3100,  3300,
+  1400,  1700,  2400,  2700,  3200,  3300,
+  1400,  1800,  2300,  2500,  3100,  3200,
+  1400,  2100,  2400,  2600,  2900,  3100,
+  1300,  2000,  2400,  2600,  3100,  3200,
+  1200,  1800,  2300,  2500,  3200,  3300,
+  1300,  1900,  2300,  2500,  3100,  3300,
+  1600,  2000,  2400,  2600,  3200,  3400,
+  1800,  2000,  2300,  2500,  3100,  3400,
+  1700,  1900,  2300,  2400,  3100,  3300,
+  1600,  1800,  2300,  2400,  2900,  3300,
+  1600,  1800,  2300,  2400,  3000,  3300,
+  1600,  1700,  2300,  2400,  3000,  3300,
+  1600,  1700,  2300,  2400,  2800,  3200,
+  1600,  1700,  2300,  2400,  2900,  3300,
+  1500,  1700,  2300,  2500,  3000,  3300,
+  1400,  1700,  2500,  2600,  3200,  3300,
+  1300,  1600,  2500,  2700,  3100,  3300,
+  1300,  1500,  2500,  2700,  3100,  3300,
+  1300,  1600,  2400,  2700,  3000,  3400,
+  1800,  2300,  2600,  2800,  3100,  3300,
+  1800,  2200,  2500,  2800,  3100,  3300,
+  1700,  2100,  2500,  2700,  3000,  3300,
+  1600,  1900,  2500,  2700,  2900,  3200,
+  1700,  2000,  2500,  2700,  3000,  3200,
+  1700,  2300,  2600,  2700,  3200,  3400,
+  1400,  1700,  1900,  2200,  3200,  3300,
+  1200,  1900,  2100,  2600,  3100,  3200,
+  1200,  1900,  2200,  2700,  3100,  3200,
+  1200,  1900,  2300,  2700,  3200,  3300,
+  1100,  2000,  2300,  2600,  3200,  3300,
+  1200,  1900,  2400,  2700,  3200,  3300,
+  1200,  1800,  2300,  2600,  3200,  3400,
+  1200,  1600,  2400,  2700,  3200,  3400,
+  1200,  1500,  2400,  2600,  3000,  3200,
+  1300,  1500,  2100,  2500,  2700,  3000,
+  1200,  1800,  2400,  2600,  3100,  3200,
+  1200,  2000,  2400,  2500,  3200,  3300,
+  1700,  2400,  2700,  3100,  3300,  3400,
+  2000,  2500,  2700,  3100,  3400,  3500,
+  1900,  2400,  2700,  3100,  3400,  3500,
+  1900,  2200,  2700,  3100,  3300,  3400,
+  1800,  2200,  2700,  3100,  3300,  3400,
+  1500,  1700,  2100,  2500,  3200,  3300,
+  1400,  1800,  2100,  2600,  3200,  3300,
+  1200,  1700,  2000,  2300,  3300,  3400,
+  1300,  1500,  1600,  2300,  3100,  3200,
+  1500,  1900,  2400,  2600,  3000,  3300,
+  1500,  2000,  2400,  2500,  2800,  3200,
+  1400,  2000,  2400,  2500,  2900,  3200,
+  1300,  1600,  1700,  2300,  3300,  3400,
+  1300,  1600,  1700,  2100,  3200,  3400,
+  2000,  2200,  2500,  2900,  3300,  3400,
+  2100,  2300,  2500,  2700,  3300,  3400,
+  1900,  2200,  2400,  2700,  3300,  3400,
+  1500,  1900,  2200,  2400,  3000,  3300,
+  1500,  1900,  2400,  2700,  3300,  3400,
+  1500,  1700,  2500,  2700,  3200,  3400,
+  1500,  1700,  2500,  2600,  3100,  3400,
+  1600,  2000,  2400,  2700,  3200,  3300,
+  1600,  1800,  2200,  2600,  3000,  3100,
+  1500,  1800,  2200,  2600,  3000,  3100,
+  1500,  1900,  2400,  2500,  3000,  3200,
+  1200,  1500,  2400,  2600,  3200,  3300,
+  1500,  2000,  2500,  2700,  3100,  3300,
+  1700,  2100,  2500,  2900,  3200,  3300,
+  1400,  1800,  2400,  2500,  3100,  3300,
+  1400,  2000,  2300,  2500,  3200,  3400,
+  1200,  1900,  2200,  2400,  3300,  3400,
+  1200,  1900,  2300,  2500,  3300,  3400,
+  1200,  1900,  2300,  2400,  3300,  3400,
+  1200,  1700,  2300,  2400,  3300,  3400,
+  1200,  1600,  2200,  2300,  3300,  3400,
+  1200,  1600,  2200,  2400,  3300,  3400,
+  1300,  1600,  2100,  2400,  3200,  3300,
+  1500,  1700,  2200,  2600,  2900,  3200,
+  2100,  2200,  2500,  2800,  3200,  3300,
+  1600,  1800,  2300,  2500,  3100,  3300,
+  1500,  1800,  2300,  2500,  3100,  3300,
+  1400,  1800,  2300,  2600,  3100,  3300,
+  1400,  1800,  2400,  2600,  3100,  3300,
+  1300,  1800,  2400,  2700,  3200,  3300,
+  1100,  1800,  2400,  2700,  3200,  3300,
+  1400,  2000,  2500,  2600,  2900,  3200,
+  1500,  2100,  2500,  2600,  2900,  3200,
+  1500,  1900,  2400,  2600,  3100,  3300,
+  1300,  1900,  2400,  2800,  3100,  3300,
+  1300,  2000,  2500,  2700,  3200,  3300,
+  1300,  1800,  2600,  2700,  3100,  3400,
+  1300,  1700,  2600,  2700,  3100,  3300,
+  1300,  1700,  2600,  2700,  3100,  3400,
+  1400,  1900,  2400,  2600,  2900,  3100,
+  1500,  1800,  2300,  2600,  2900,  3100,
+  1600,  1900,  2400,  2600,  3000,  3200,
+  1700,  2000,  2600,  2900,  3100,  3300,
+  1800,  2300,  2500,  2800,  3200,  3400,
+  1900,  2300,  2600,  2900,  3300,  3400,
+  1600,  1900,  2500,  2600,  3000,  3100,
+  1600,  1900,  2500,  2600,  3000,  3200,
+  1500,  1800,  2200,  2500,  3200,  3300,
+  1500,  1900,  2200,  2500,  3300,  3400,
+  1500,  1800,  2200,  2400,  3200,  3400,
+  1500,  1800,  2100,  2400,  3200,  3400,
+  1600,  1800,  2100,  2200,  3200,  3400,
+  1700,  1800,  2100,  2400,  3100,  3300,
+  1600,  1700,  2300,  2400,  2700,  3100,
+  1600,  1900,  2400,  2500,  3000,  3300,
+  1600,  2100,  2500,  2600,  3200,  3400,
+  1200,  2000,  2400,  2500,  3400,  3500,
+  1200,  1600,  2300,  2400,  3200,  3400,
+  1400,  1900,  2400,  2500,  3000,  3200,
+  1300,  1800,  2100,  2500,  3100,  3300,
+  1300,  1700,  2300,  2500,  3100,  3300,
+  1300,  1700,  2200,  2400,  3200,  3300,
+  1300,  1800,  2200,  2400,  3200,  3300,
+  1500,  1800,  2300,  2500,  3200,  3300,
+  1600,  1800,  2300,  2500,  3300,  3400,
+  1700,  1900,  2400,  2600,  3300,  3400,
+  1700,  1900,  2500,  2700,  3000,  3100,
+  1700,  1800,  2500,  2600,  3100,  3200,
+  1700,  1800,  2500,  2600,  3000,  3200,
+  1600,  1800,  2400,  2600,  3000,  3200,
+  1600,  1800,  2400,  2600,  3100,  3300,
+  1500,  1700,  2400,  2600,  3100,  3300,
+  1300,  1700,  2400,  2600,  3100,  3300,
+  1300,  1700,  2400,  2600,  3200,  3300,
+  1400,  1800,  2400,  2600,  3200,  3300,
+  1400,  1800,  2300,  2600,  3200,  3300,
+  1500,  1800,  2300,  2600,  3300,  3400,
+  1500,  1800,  2300,  2500,  3300,  3400,
+  1500,  1700,  2200,  2400,  3300,  3400,
+  1800,  2200,  2400,  2600,  3200,  3300,
+  1700,  1900,  2300,  2700,  3200,  3300,
+  1600,  1800,  2000,  2600,  3200,  3300,
+  1900,  2000,  2200,  2500,  3300,  3400,
+  1900,  2100,  2300,  2600,  3300,  3400,
+  1800,  1900,  2200,  2600,  3100,  3300,
+  1100,  1900,  2600,  2700,  3200,  3300,
+  1000,  1700,  2700,  2800,  3200,  3300,
+  1000,  1800,  2600,  2700,  3000,  3100,
+  1200,  2000,  2600,  2800,  3200,  3300,
+  1200,  2000,  2500,  2700,  3200,  3300,
+  1200,  2000,  2500,  2600,  3200,  3300,
+  1200,  2000,  2400,  2500,  3300,  3400,
+  1300,  2000,  2300,  2500,  3300,  3400,
+  1300,  1900,  2300,  2500,  3300,  3400,
+  1400,  1900,  2300,  2600,  3300,  3400,
+  2200,  2400,  2500,  2900,  3200,  3300,
+  2100,  2200,  2400,  2800,  3200,  3300,
+  2000,  2200,  2400,  2800,  3200,  3300,
+  1900,  2100,  2400,  2800,  3200,  3300,
+  1600,  1800,  2000,  2400,  2800,  3000,
+  1600,  1900,  2300,  2400,  2900,  3300,
+  1800,  2100,  2400,  2500,  3100,  3200,
+  1800,  2300,  2500,  2700,  3200,  3300,
+  1800,  2100,  2500,  2700,  3300,  3400,
+  1500,  1900,  2100,  2700,  3000,  3100,
+  1500,  1700,  1800,  2600,  3300,  3400,
+  1500,  1700,  1800,  2500,  3300,  3400,
+  1300,  1500,  1600,  2500,  3200,  3300,
+  1300,  1500,  1700,  2400,  3000,  3100,
+  1600,  2000,  2500,  2700,  3300,  3400,
+  2000,  2100,  2400,  2700,  3300,  3400,
+  1800,  2000,  2200,  2600,  3100,  3300,
+  1800,  1900,  2100,  2600,  3200,  3300,
+  1700,  2000,  2100,  2700,  3200,  3300,
+  1700,  2100,  2200,  2700,  3200,  3300,
+  1700,  2200,  2400,  2700,  3200,  3300,
+  1700,  2200,  2400,  2600,  3200,  3300,
+  1700,  2100,  2500,  2600,  3200,  3300,
+  1800,  2400,  2600,  3000,  3300,  3400,
+  1800,  2400,  2800,  3100,  3300,  3400,
+  1900,  2400,  2800,  3100,  3300,  3500,
+  1900,  2300,  2800,  3000,  3300,  3400,
+  1600,  1800,  2400,  2600,  3000,  3100,
+  1500,  1700,  1900,  2500,  3300,  3400,
+  1200,  1700,  2200,  2300,  3100,  3300,
+  1100,  1500,  2300,  2400,  3000,  3300,
+  1200,  1600,  2300,  2400,  3100,  3300,
+  1200,  1600,  2300,  2400,  3100,  3400,
+  1300,  1600,  2200,  2400,  3200,  3300,
+  1500,  1600,  2100,  2400,  3000,  3300,
+  1600,  1700,  2100,  2400,  3100,  3300,
+  1500,  1600,  2100,  2500,  3100,  3300,
+  1600,  1900,  2200,  2600,  3100,  3300,
+  1500,  1800,  2200,  2500,  3000,  3200,
+  1400,  1800,  2200,  2500,  2900,  3200,
+  1300,  1600,  2200,  2600,  3000,  3200,
+  1700,  2000,  2400,  2800,  3000,  3100,
+  1700,  2100,  2400,  2700,  3000,  3100,
+  1800,  2200,  2500,  2800,  3000,  3200,
+  1700,  2100,  2500,  2800,  3100,  3200,
+  1800,  2200,  2500,  2700,  3200,  3400,
+  1600,  1900,  2300,  2500,  3200,  3300,
+  1600,  1800,  2100,  2500,  3200,  3300,
+  1600,  1800,  2000,  2400,  3200,  3300,
+  1500,  1700,  1900,  2300,  3300,  3400,
+  1400,  1600,  1800,  2200,  3300,  3400,
+  1500,  1600,  1900,  2600,  3000,  3200,
+  1500,  2000,  2300,  2600,  3200,  3300,
+  1200,  1900,  2100,  2500,  3200,  3300,
+  1900,  2100,  2300,  2600,  3200,  3300,
+  1800,  2100,  2300,  2600,  3300,  3400,
+  1700,  2100,  2300,  2600,  3200,  3300,
+  1600,  2100,  2300,  2700,  3200,  3300,
+  1500,  1900,  2400,  2700,  3200,  3300,
+  1400,  1900,  2400,  2700,  3200,  3300,
+  1400,  1900,  2400,  2600,  3200,  3300,
+  1500,  2100,  2500,  2600,  3200,  3300,
+  1600,  1800,  2100,  2500,  2900,  3100,
+  1800,  2000,  2500,  2800,  3000,  3200,
+  1400,  1600,  2100,  2600,  3000,  3300,
+  1700,  2000,  2400,  2700,  3300,  3400,
+  1700,  2100,  2500,  2700,  3300,  3400,
+  1700,  2100,  2600,  2700,  3000,  3300,
+  1800,  2100,  2500,  2700,  3100,  3200,
+  2200,  2300,  2500,  2800,  3200,  3300,
+  2100,  2300,  2500,  2800,  3200,  3300,
+  2000,  2200,  2500,  2800,  3200,  3300,
+  1900,  2000,  2400,  2700,  3100,  3200,
+  1600,  2000,  2400,  2700,  3100,  3400,
+  1300,  1800,  2100,  2500,  3100,  3200,
+  1300,  1800,  2200,  2800,  3100,  3200,
+  1300,  2000,  2200,  2600,  3200,  3300,
+  1900,  2100,  2400,  2500,  3000,  3200,
+  1800,  2100,  2400,  2600,  3200,  3300,
+  1500,  1900,  2400,  2600,  3300,  3400,
+  1500,  1800,  2400,  2600,  3200,  3400,
+  1500,  1700,  2400,  2600,  3200,  3400,
+  1400,  1700,  2400,  2600,  3100,  3300,
+  1400,  1900,  2500,  2600,  2900,  3200,
+  1400,  1900,  2400,  2700,  3000,  3200,
+  1400,  1900,  2400,  2600,  3000,  3100,
+  1400,  1900,  2300,  2500,  2700,  3000,
+  1300,  1800,  2200,  2500,  3300,  3400,
+  1300,  1800,  2200,  2400,  3300,  3400,
+  1300,  1700,  2100,  2400,  3200,  3400,
+  1400,  1900,  2300,  2600,  3100,  3300,
+  1900,  2200,  2400,  2800,  3100,  3200,
+  1600,  2200,  2400,  2700,  3300,  3400,
+  1600,  2100,  2400,  2700,  3200,  3300,
+  1400,  1700,  2000,  2500,  3000,  3200,
+  1400,  1800,  2300,  2500,  3000,  3200,
+  1700,  1900,  2100,  2400,  3200,  3300,
+  1800,  1900,  2200,  2500,  3200,  3300,
+  1900,  2000,  2500,  2700,  3200,  3300,
+  1900,  2000,  2500,  2600,  3100,  3300,
+  1400,  1900,  2300,  2500,  2800,  3200,
+  1400,  1900,  2300,  2500,  2900,  3300,
+  1400,  1600,  2300,  2500,  3000,  3200,
+  1400,  1600,  2200,  2500,  3100,  3200,
+  2000,  2200,  2500,  2700,  3000,  3300,
+  1600,  2100,  2600,  2900,  3200,  3300,
+  1500,  1700,  2100,  2500,  3100,  3200,
+  1200,  2100,  2600,  2700,  3200,  3300,
+  1100,  2100,  2600,  2800,  3200,  3300,
+  1000,  2000,  2800,  2900,  3100,  3200,
+  1600,  1900,  2100,  2500,  3000,  3100,
+  1700,  1900,  2200,  2500,  3000,  3100,
+  1700,  1900,  2300,  2400,  3100,  3200,
+  1400,  2000,  2300,  2400,  3200,  3300,
+  1300,  2000,  2200,  2400,  3100,  3200,
+  1200,  2000,  2300,  2500,  3100,  3200,
+  1200,  1800,  2300,  2600,  3100,  3200,
+  1300,  1600,  2300,  2700,  3100,  3200,
+  1300,  1700,  2300,  2700,  3100,  3200,
+  1100,  2000,  2300,  2600,  3100,  3200,
+  1300,  2000,  2400,  2500,  3200,  3300,
+  1300,  1900,  2400,  2500,  3200,  3300,
+  1500,  1800,  2100,  2600,  3300,  3400,
+  1500,  1900,  2100,  2500,  2800,  3000,
+  1500,  2000,  2200,  2500,  3000,  3100,
+  1500,  2000,  2200,  2600,  3100,  3200,
+  1600,  1900,  2300,  2500,  3100,  3200,
+  1600,  1900,  2200,  2400,  3100,  3200,
+  1600,  1900,  2400,  2600,  2900,  3100,
+  1900,  2300,  2600,  2800,  3100,  3200,
+  2000,  2400,  2700,  2800,  3100,  3200,
+  1300,  1800,  2000,  2400,  3100,  3200,
+  1100,  1700,  2100,  2400,  3100,  3200,
+  1300,  1600,  2100,  2500,  3000,  3100,
+  1200,  1700,  2200,  2500,  3000,  3200,
+  1400,  1800,  2100,  2300,  3100,  3200,
+  1700,  1800,  2100,  2200,  3200,  3300,
+  1700,  1900,  2100,  2300,  3200,  3300,
+  1800,  1900,  2400,  2800,  3100,  3200,
+  2000,  2300,  2800,  3000,  3100,  3300,
+  2100,  2300,  2700,  3000,  3200,  3300,
+  2100,  2300,  2600,  2900,  3200,  3300,
+  2200,  2400,  2700,  2800,  3200,  3300,
+  1700,  2000,  2300,  2500,  3000,  3100,
+  1600,  2000,  2300,  2400,  2800,  3200,
+  1700,  2100,  2300,  2400,  2900,  3200,
+  1400,  1800,  2300,  2600,  3000,  3300,
+  1500,  2200,  2400,  2700,  3100,  3200,
+  1500,  2200,  2500,  2700,  3200,  3300,
+  1400,  1600,  2400,  2500,  3100,  3400,
+  1600,  2200,  2500,  2800,  3300,  3400,
+  1600,  2000,  2500,  2800,  3300,  3400,
+  1400,  1700,  2400,  2500,  3200,  3400,
+  1400,  1600,  2400,  2600,  3200,  3300,
+  1400,  1700,  2300,  2500,  3200,  3300,
+  1500,  2000,  2300,  2400,  2800,  3200,
+  1500,  2000,  2300,  2400,  2700,  3200,
+  1400,  1900,  2300,  2500,  3000,  3300,
+  1200,  1400,  2300,  2600,  2900,  3100,
+  1500,  2000,  2300,  2500,  3000,  3200,
+  1800,  2000,  2500,  2600,  3100,  3200,
+  1500,  1800,  2400,  2600,  3000,  3200,
+  1200,  1500,  2200,  2400,  3000,  3100,
+  1500,  1900,  2400,  2600,  3200,  3300,
+  1700,  2000,  2600,  2800,  3200,  3300,
+  1500,  1900,  2100,  2500,  3200,  3300,
+  1700,  1800,  2000,  2300,  3000,  3100,
+  1600,  1900,  2300,  2500,  2800,  3100,
+  1600,  1800,  2300,  2500,  3000,  3200,
+  1700,  1800,  2300,  2500,  3200,  3300,
+  1700,  1800,  2300,  2500,  3100,  3300,
+  1600,  1700,  2200,  2400,  3000,  3300,
+  1500,  1700,  2300,  2500,  3200,  3400,
+  1500,  1700,  2300,  2400,  2800,  3300,
+  1600,  1700,  2200,  2400,  2600,  3200,
+  1700,  1800,  2200,  2400,  2900,  3300,
+  1900,  2100,  2400,  2500,  3100,  3300,
+  1900,  2000,  2400,  2500,  3100,  3300,
+  1900,  2300,  2500,  2900,  3200,  3300,
+  2200,  2400,  2700,  3100,  3300,  3400,
+  2200,  2400,  2800,  3100,  3300,  3400,
+  1500,  1900,  2300,  2400,  3200,  3300,
+  1500,  1800,  2200,  2300,  3100,  3300,
+  1700,  2000,  2600,  2900,  3200,  3400,
+  1500,  2000,  2300,  2500,  3100,  3200,
+  1300,  1600,  2000,  2500,  3000,  3200,
+  1800,  2000,  2200,  2500,  3000,  3100,
+  1200,  1800,  2200,  2400,  3100,  3200,
+  1300,  1500,  2100,  2200,  3100,  3200,
+  1400,  1900,  2200,  2300,  3200,  3300,
+  1900,  2300,  2600,  3000,  3200,  3400,
+  1900,  2300,  2600,  2800,  3200,  3300,
+  1900,  2200,  2600,  2900,  3100,  3300,
+  1200,  1500,  2500,  2600,  3100,  3200,
+  1400,  1900,  2300,  2400,  2600,  3100,
+  1500,  1600,  2100,  2400,  2900,  3200,
+  1400,  1600,  2200,  2600,  2900,  3200,
+  1700,  1800,  2100,  2300,  3000,  3100,
+  1700,  1900,  2100,  2300,  3100,  3200,
+  1800,  1900,  2200,  2300,  3200,  3300,
+  1700,  1900,  2200,  2300,  3200,  3300,
+  1700,  1800,  2200,  2300,  3200,  3300,
+  1600,  1700,  2200,  2300,  3100,  3300,
+  1700,  2100,  2400,  2900,  3300,  3400,
+  1600,  2100,  2500,  2700,  3300,  3400,
+  1500,  2000,  2400,  2600,  3100,  3200,
+  1600,  2000,  2300,  2500,  2800,  3000,
+  1500,  1700,  1800,  2200,  2800,  2900,
+  1500,  1700,  1900,  2100,  2700,  2800,
+  1600,  2000,  2300,  2500,  3000,  3300,
+  1900,  2300,  2500,  2800,  3100,  3200,
+  2200,  2400,  2600,  3000,  3200,  3300,
+  2300,  2500,  2800,  3100,  3300,  3400,
+  1900,  2400,  2700,  3000,  3400,  3500,
+  1900,  2400,  2600,  3000,  3400,  3500,
+  1800,  2300,  2700,  3100,  3400,  3500,
+  1800,  2300,  2700,  3000,  3300,  3400,
+  1400,  1700,  2200,  2500,  3200,  3400,
+  1600,  1900,  2500,  2600,  3100,  3300,
+  2000,  2300,  2600,  2800,  3300,  3400,
+  1900,  2200,  2500,  2800,  3300,  3400,
+  1700,  2100,  2400,  2700,  3300,  3400,
+  1600,  1700,  2300,  2500,  3200,  3400,
+  1600,  1700,  2300,  2400,  3300,  3400,
+  1600,  1800,  2400,  2600,  3300,  3400,
+  1500,  1700,  2300,  2700,  3300,  3400,
+  1400,  1800,  2300,  2400,  3100,  3400,
+  1500,  2000,  2300,  2400,  2900,  3200,
+  1500,  1900,  2300,  2400,  2800,  3200,
+  1300,  1800,  2200,  2500,  3000,  3100,
+  1200,  1700,  2200,  2300,  3200,  3300,
+  1200,  1700,  2200,  2400,  3200,  3300,
+  1100,  1700,  2200,  2400,  3200,  3300,
+  1100,  1700,  2300,  2500,  3100,  3200,
+  1100,  1700,  2300,  2600,  3100,  3200,
+  1300,  1800,  2300,  2600,  3000,  3200,
+  1300,  1900,  2300,  2600,  3000,  3300,
+  1300,  1800,  2300,  2600,  3100,  3300,
+  1400,  2000,  2500,  2800,  3200,  3300,
+  1200,  1600,  2400,  2700,  3200,  3300,
+  1500,  1800,  2300,  2500,  3100,  3200,
+  1500,  1600,  2200,  2600,  3000,  3200,
+  1500,  1600,  2200,  2500,  3000,  3300,
+  1200,  1600,  2400,  2600,  3200,  3400,
+  1000,  2300,  2800,  2900,  3100,  3200,
+  900,  1700,  2700,  2800,  3200,  3300,
+  1500,  1700,  2400,  2500,  3100,  3200,
+  1500,  1900,  2400,  2500,  3100,  3200,
+  1400,  1900,  2400,  2500,  2900,  3100,
+  1600,  2100,  2400,  2600,  3000,  3100,
+  1700,  1900,  2300,  2500,  3000,  3100,
+  2100,  2400,  2600,  2900,  3100,  3300,
+  2200,  2400,  2700,  2900,  3200,  3300,
+  2100,  2200,  2700,  2800,  3100,  3300,
+  2000,  2100,  2300,  2600,  3100,  3300,
+  1800,  2000,  2100,  2600,  3100,  3200,
+  1800,  1900,  2200,  2500,  2900,  3000,
+  1800,  1900,  2300,  2400,  3000,  3100,
+  1800,  1900,  2200,  2400,  3000,  3100,
+  1800,  2000,  2200,  2500,  3100,  3200,
+  1800,  2000,  2300,  2800,  3100,  3200,
+  1800,  2000,  2400,  2800,  3100,  3200,
+  1800,  2000,  2400,  2800,  3000,  3100,
+  1700,  1900,  2300,  2700,  2900,  3100,
+  1700,  1900,  2200,  2700,  2900,  3100,
+  1600,  1800,  2000,  2600,  2800,  3000,
+  1500,  1700,  2000,  2500,  2900,  3100,
+  1700,  1900,  2200,  2500,  3000,  3200,
+  1700,  1800,  2300,  2400,  3100,  3300,
+  1800,  2000,  2300,  2500,  3000,  3100,
+  1800,  1900,  2200,  2400,  3100,  3200,
+  1400,  1600,  2100,  2600,  3000,  3200,
+  1400,  1600,  2000,  2500,  3000,  3200,
+  1400,  1800,  2000,  2400,  3200,  3300,
+  1200,  1900,  2100,  2500,  3100,  3200,
+  1100,  1700,  2100,  2300,  3000,  3100,
+  1300,  1500,  1700,  2000,  2900,  3100,
+  1600,  1900,  2200,  2400,  2900,  3100,
+  1700,  2000,  2200,  2500,  3200,  3300,
+  1700,  1800,  2100,  2500,  3100,  3300,
+  2000,  2300,  2500,  2700,  3100,  3400,
+  1900,  2200,  2500,  2600,  3000,  3300,
+  1900,  2000,  2300,  2400,  3100,  3300,
+  1800,  1900,  2300,  2400,  3000,  3200,
+  1800,  1900,  2300,  2500,  3100,  3200,
+  1700,  1800,  2300,  2400,  3000,  3100,
+  1500,  1600,  2500,  2600,  2900,  3300,
+  1500,  1700,  2500,  2600,  3100,  3200,
+  1900,  2300,  2500,  2800,  3200,  3300,
+  1400,  1600,  2000,  2600,  3000,  3200,
+  1700,  1900,  2100,  2600,  3000,  3100,
+  1800,  1900,  2400,  2900,  3100,  3300,
+  1800,  1900,  2500,  2900,  3100,  3300,
+  1600,  1800,  2100,  2700,  3000,  3200,
+  1700,  2000,  2300,  2700,  2900,  3200,
+  1600,  2000,  2400,  2600,  2900,  3200,
+  1500,  1700,  2300,  2500,  3300,  3400,
+  1400,  1600,  2200,  2400,  3100,  3300,
+  1500,  1600,  2200,  2500,  3200,  3400,
+  1600,  1700,  2300,  2400,  3200,  3300,
+  1600,  1700,  2300,  2500,  3200,  3300,
+  1600,  1700,  2200,  2500,  3200,  3300,
+  1700,  2100,  2300,  2400,  3100,  3300,
+  1600,  2000,  2400,  2500,  3000,  3300,
+  1500,  1800,  2300,  2400,  2900,  3200,
+  1600,  2000,  2400,  2800,  3200,  3400,
+  1900,  2200,  2600,  2800,  3200,  3400,
+  1900,  2200,  2500,  2800,  3100,  3400,
+  1300,  1800,  2400,  2600,  3100,  3400,
+  1300,  1500,  2400,  2500,  2900,  3300,
+  1300,  1700,  2500,  2600,  3100,  3200,
+  1300,  1700,  2600,  2700,  3200,  3300,
+  1400,  1900,  2600,  2700,  3200,  3300,
+  1400,  2000,  2600,  2700,  3200,  3300,
+  1700,  1900,  2100,  2600,  3200,  3300,
+  1700,  2000,  2100,  2300,  3200,  3300,
+  2000,  2100,  2400,  2600,  3200,  3400,
+  2100,  2200,  2500,  2700,  3200,  3400,
+  1800,  1900,  2500,  2700,  3200,  3400,
+  1700,  2000,  2500,  2700,  3300,  3400,
+  1400,  1900,  2500,  2700,  3100,  3200,
+  1500,  1800,  2500,  2600,  3100,  3300,
+  1600,  2000,  2300,  2600,  3000,  3200,
+  1600,  1900,  2300,  2700,  3000,  3200,
+  1600,  1800,  2300,  2600,  3000,  3200,
+  1400,  1600,  2100,  2500,  3000,  3200,
+  1400,  1800,  2200,  2500,  2700,  3100,
+  1400,  1900,  2300,  2500,  3100,  3200,
+  1300,  2000,  2300,  2500,  3100,  3200,
+  1300,  1900,  2300,  2500,  3100,  3200,
+  1800,  2100,  2500,  2700,  3000,  3300,
+  1800,  2100,  2400,  2700,  3100,  3300,
+  1900,  2100,  2500,  2700,  3100,  3300,
+  1600,  1800,  2300,  2400,  3200,  3400,
+  1700,  1800,  2400,  2500,  3300,  3400,
+  1900,  2000,  2700,  2800,  3200,  3400,
+  1900,  2000,  2600,  2900,  3100,  3300,
+  2000,  2200,  2800,  2900,  3300,  3400,
+  2000,  2100,  2700,  2800,  3300,  3400,
+  1900,  2100,  2400,  2700,  3300,  3400,
+  1600,  1900,  2100,  2500,  3200,  3300,
+  1400,  1900,  2100,  2400,  3200,  3300,
+  1200,  1900,  2100,  2400,  3100,  3200,
+  1200,  1800,  2100,  2500,  2900,  3200,
+  1300,  1700,  1900,  2400,  2800,  2900,
+  1900,  2300,  2600,  3000,  3200,  3300,
+  1800,  2300,  2600,  3000,  3300,  3400,
+  1800,  2200,  2500,  2800,  3300,  3500,
+  1700,  1900,  2300,  2400,  3200,  3400,
+  1800,  1900,  2400,  2500,  3100,  3300,
+  2100,  2200,  2400,  2500,  3100,  3300,
+  1800,  2100,  2500,  2800,  3100,  3200,
+  2000,  2300,  2600,  2700,  3100,  3300,
+  2100,  2200,  2500,  2600,  3100,  3300,
+  2000,  2200,  2300,  2500,  3100,  3300,
+  1800,  1900,  2100,  2300,  3200,  3300,
+  1800,  1900,  2100,  2400,  3300,  3400,
+  1700,  1800,  2200,  2300,  3300,  3400,
+  1700,  1800,  2200,  2300,  3200,  3400,
+  1600,  1700,  2200,  2300,  2900,  3400,
+  1400,  1600,  2500,  2600,  3100,  3200,
+  1300,  1400,  2400,  2600,  3000,  3100,
+  1300,  1500,  2400,  2500,  3000,  3200,
+  1300,  1800,  2400,  2500,  3100,  3200,
+  1300,  1900,  2400,  2500,  3100,  3200,
+  1800,  1900,  2200,  2400,  3300,  3400,
+  1000,  1500,  2500,  2600,  3200,  3400,
+  1000,  1700,  2500,  2600,  3200,  3300,
+  1300,  1700,  2200,  2600,  3000,  3200,
+  900,  1800,  2400,  2600,  3300,  3400,
+  900,  1800,  2300,  2400,  3300,  3400,
+  1000,  1600,  2300,  2400,  3300,  3400,
+  1400,  1900,  2200,  2600,  3300,  3400,
+  1500,  1900,  2300,  2600,  3300,  3400,
+  1300,  2000,  2200,  2500,  3000,  3200,
+  1100,  1800,  2300,  2500,  3200,  3300,
+  1100,  1800,  2400,  2600,  3200,  3300,
+  1100,  1900,  2400,  2700,  3200,  3300,
+  1300,  2000,  2200,  2400,  3200,  3300,
+  1800,  2100,  2400,  2800,  3300,  3400,
+  1700,  2200,  2500,  2700,  3300,  3400,
+  1700,  2000,  2300,  2700,  3200,  3400,
+  1200,  1600,  2500,  2600,  3200,  3400,
+  1100,  1900,  2500,  2600,  3200,  3300,
+  1500,  1600,  2400,  2700,  2900,  3200,
+  1500,  1800,  2500,  2700,  3100,  3400,
+  1600,  1900,  2600,  2800,  3100,  3300,
+  1700,  1800,  2600,  2700,  3000,  3300,
+  1700,  1800,  2500,  2600,  2900,  3200,
+  1700,  1800,  2500,  2600,  3000,  3300,
+  1600,  1700,  2500,  2600,  3000,  3300,
+  1700,  2000,  2400,  2700,  3100,  3400,
+  1700,  1800,  2400,  2600,  2900,  3200,
+  1800,  1900,  2500,  2600,  2900,  3200,
+  1700,  1800,  2200,  2500,  2700,  3200,
+  1700,  1800,  2300,  2500,  2800,  3200,
+  1500,  1600,  2000,  2400,  2600,  2900,
+  1200,  1300,  2100,  2400,  2600,  3200,
+  1700,  2200,  2500,  2900,  3200,  3400,
+  1700,  2200,  2600,  2900,  3400,  3500,
+  1700,  2100,  2700,  2900,  3400,  3500,
+  1500,  1800,  2400,  2600,  3100,  3300,
+  1100,  1700,  2500,  2600,  3200,  3300,
+  1300,  1700,  2600,  2700,  3200,  3400,
+  1400,  1900,  2600,  2800,  3200,  3300,
+  1600,  2000,  2500,  2900,  3300,  3400,
+  1500,  1700,  2500,  2700,  3100,  3300,
+  1800,  2000,  2500,  2700,  2900,  3300,
+  1900,  2000,  2600,  2700,  2900,  3300,
+  1900,  2100,  2400,  2700,  2900,  3200,
+  1900,  2000,  2500,  2700,  3000,  3300,
+  1900,  2000,  2400,  2700,  3000,  3300,
+  1700,  1900,  2500,  2600,  3100,  3400,
+  1600,  1900,  2500,  2600,  3200,  3500,
+  1900,  2100,  2600,  2900,  3200,  3400,
+  2100,  2300,  2700,  2900,  3200,  3300,
+  1600,  2000,  2200,  2400,  3100,  3200,
+  1700,  1900,  2200,  2400,  2900,  3100,
+  1700,  1800,  2100,  2400,  2800,  3200,
+  1900,  2200,  2500,  2700,  3000,  3200,
+  1900,  2300,  2600,  2700,  3100,  3200,
+  1800,  2400,  2600,  2900,  3200,  3300,
+  1800,  2300,  2500,  2900,  3200,  3300,
+  1600,  1800,  2500,  2600,  3300,  3400,
+  1500,  1700,  2200,  2400,  2900,  3200,
+  1500,  1600,  2200,  2300,  2800,  3200,
+  1400,  1500,  2100,  2200,  2800,  3200,
+  1400,  1500,  2100,  2300,  2800,  3200,
+  1400,  1500,  2200,  2400,  2700,  3100,
+  1700,  1900,  2400,  2800,  3100,  3200,
+  1700,  1800,  2400,  2700,  3100,  3300,
+  1800,  1900,  2300,  2700,  2900,  3300,
+  2000,  2100,  2400,  2700,  3000,  3300,
+  1400,  1600,  2500,  2700,  3100,  3400,
+  1000,  1600,  2300,  2400,  3100,  3200,
+  1100,  1700,  2400,  2500,  3200,  3300,
+  1200,  1700,  2300,  2400,  3100,  3200,
+  2000,  2100,  2400,  2500,  3100,  3300,
+  1900,  2000,  2300,  2500,  3100,  3300,
+  1600,  1800,  2300,  2500,  3200,  3300,
+  1400,  1600,  2300,  2400,  3100,  3300,
+  1300,  1500,  2300,  2500,  3000,  3300,
+  1300,  1500,  2300,  2500,  3100,  3200,
+  1300,  1800,  2300,  2600,  3100,  3200,
+  1800,  1900,  2400,  2500,  3000,  3200,
+  1900,  2400,  2600,  3000,  3200,  3300,
+  1400,  1500,  2400,  2600,  2900,  3300,
+  1400,  1500,  2200,  2600,  2800,  3300,
+  1400,  1500,  2200,  2500,  2800,  3200,
+  1400,  1500,  2300,  2500,  3000,  3300,
+  1600,  2000,  2400,  2700,  3200,  3400,
+  1700,  2200,  2600,  2800,  3100,  3300,
+  1800,  2100,  2600,  2700,  3200,  3300,
+  1700,  2200,  2500,  2700,  3200,  3300,
+  1500,  1700,  2200,  2300,  3000,  3300,
+  1600,  1700,  2200,  2500,  3200,  3400,
+  1600,  1800,  2300,  2400,  3100,  3300,
+  1700,  1800,  2200,  2400,  3000,  3300,
+  1700,  1800,  2200,  2300,  3000,  3200,
+  1700,  1800,  2200,  2300,  3100,  3300,
+  1700,  2000,  2200,  2600,  3200,  3300,
+  1800,  1900,  2200,  2500,  3100,  3200,
+  1600,  1700,  2100,  2400,  2900,  3200,
+  1500,  1800,  2300,  2700,  3000,  3300,
+  1500,  1800,  2200,  2600,  3000,  3300,
+  1700,  2000,  2500,  2700,  3200,  3300,
+  1900,  2000,  2600,  2800,  3200,  3400,
+  1800,  1900,  2500,  2800,  3100,  3300,
+  1600,  1800,  2500,  2600,  3000,  3300,
+  1200,  1500,  2500,  2700,  3100,  3200,
+  1100,  1900,  2500,  2600,  3100,  3200,
+  1200,  1900,  2400,  2500,  3100,  3200,
+  1500,  1700,  2100,  2200,  3200,  3300,
+  1600,  1800,  2000,  2200,  3300,  3400,
+  1500,  1600,  1800,  2000,  3300,  3400,
+  1400,  1600,  1800,  1900,  3300,  3400,
+  1400,  1600,  2400,  2600,  3000,  3400,
+  1400,  1800,  2500,  2600,  3100,  3200,
+  1500,  1700,  2400,  2700,  3100,  3300,
+  1500,  1800,  2500,  2700,  3000,  3300,
+  1400,  1500,  2400,  2600,  3000,  3300,
+  1200,  1400,  2300,  2400,  3000,  3200,
+  1200,  1600,  2300,  2400,  3100,  3200,
+  1400,  2000,  2400,  2700,  3100,  3300,
+  1600,  1900,  2300,  2700,  3100,  3200,
+  1500,  1900,  2300,  2700,  3100,  3200,
+  1200,  1400,  2300,  2500,  3100,  3300,
+  1800,  1900,  2400,  2600,  3000,  3100,
+  1800,  1900,  2500,  2600,  2900,  3100,
+  1600,  2000,  2400,  2700,  3000,  3300,
+  1600,  1900,  2400,  2500,  3100,  3300,
+  1600,  1900,  2500,  2600,  3100,  3200,
+  1700,  1800,  2400,  2500,  2900,  3300,
+  1700,  1800,  2300,  2500,  2900,  3200,
+  1700,  1800,  2400,  2500,  3000,  3200,
+  1800,  1900,  2200,  2500,  3000,  3200,
+  1700,  2000,  2300,  2500,  3000,  3200,
+  1800,  2000,  2300,  2500,  3000,  3200,
+  1900,  2100,  2300,  2600,  3000,  3200,
+  1900,  2100,  2400,  2600,  3000,  3300,
+  2000,  2100,  2300,  2500,  3000,  3200,
+  1700,  1800,  2300,  2600,  3100,  3300,
+  1700,  2100,  2500,  2700,  3200,  3400,
+  1700,  1900,  2300,  2500,  3000,  3200,
+  1800,  1900,  2200,  2400,  2900,  3300,
+  1800,  1900,  2300,  2500,  3000,  3300,
+  1800,  2000,  2200,  2500,  2900,  3200,
+  1900,  2200,  2400,  2600,  2900,  3200,
+  1700,  2100,  2600,  2800,  3100,  3300,
+  1800,  2300,  2700,  2900,  3200,  3300,
+  2000,  2300,  2800,  2900,  3100,  3300,
+  2100,  2200,  2600,  2800,  3200,  3300,
+  1800,  1900,  2300,  2400,  3100,  3200,
+  1700,  1800,  2300,  2500,  3000,  3200,
+  1800,  1900,  2300,  2500,  3000,  3200,
+  1800,  1900,  2300,  2600,  3100,  3200,
+  1800,  2000,  2300,  2600,  3100,  3200,
+  1400,  1600,  1800,  2000,  3100,  3300,
+  1300,  1700,  2300,  2400,  3100,  3200,
+  1500,  1700,  2300,  2400,  3100,  3200,
+  1600,  1700,  2300,  2500,  2900,  3100,
+  1500,  1700,  2300,  2500,  2900,  3100,
+  1500,  1700,  2300,  2500,  2800,  3000,
+  1500,  1600,  2300,  2500,  2800,  3200,
+  1400,  1500,  2300,  2600,  3000,  3200,
+  1200,  1600,  2400,  2500,  3000,  3300,
+  1400,  1600,  2200,  2500,  2900,  3200,
+  1500,  1900,  2300,  2600,  2900,  3200,
+  1400,  1800,  2400,  2700,  3200,  3400,
+  1500,  1900,  2400,  2700,  3200,  3400,
+  1700,  2100,  2400,  2800,  3000,  3300,
+  1700,  2000,  2500,  2700,  3100,  3400,
+  1800,  1900,  2400,  2800,  3200,  3300,
+  1800,  1900,  2300,  2900,  3200,  3300,
+  1800,  1900,  2500,  2800,  3200,  3300,
+  1700,  1800,  2400,  2800,  3200,  3300,
+  1700,  1800,  2400,  2700,  3200,  3300,
+  1600,  1700,  2300,  2600,  3000,  3300,
+  1600,  1700,  2200,  2500,  2900,  3300,
+  1500,  1600,  2300,  2500,  3000,  3300,
+  1500,  1900,  2400,  2500,  3300,  3400,
+  1500,  2000,  2400,  2800,  3200,  3300,
+  1400,  1800,  2400,  2700,  3200,  3300,
+  1400,  1900,  2400,  2700,  3200,  3400,
+  1300,  1700,  2300,  2500,  3200,  3400,
+  1100,  1700,  2300,  2400,  3100,  3200,
+  1500,  1700,  1900,  2200,  3300,  3400,
+  1900,  2300,  2600,  2800,  3200,  3400,
+  1900,  2400,  2700,  2800,  3300,  3400,
+  2000,  2300,  2700,  2900,  3400,  3500,
+  1900,  2300,  2700,  2900,  3400,  3500,
+  1900,  2100,  2800,  2900,  3300,  3400,
+  1700,  1800,  2700,  2800,  3100,  3300,
+  1500,  1700,  2700,  2800,  3200,  3300,
+  1500,  1600,  2600,  2700,  3000,  3300,
+  1400,  1600,  2600,  2800,  3000,  3200,
+  1200,  1400,  2600,  2700,  3000,  3200,
+  1000,  1500,  2600,  2800,  3200,  3400,
+  1100,  1300,  2500,  2800,  3000,  3200,
+  1500,  1600,  2500,  2600,  3000,  3300,
+  1400,  1500,  2300,  2600,  2800,  3200,
+  1400,  1600,  2200,  2600,  2800,  3100,
+  1500,  1600,  2300,  2700,  2900,  3200,
+  1400,  1500,  2500,  2600,  3100,  3400,
+  1400,  1500,  2400,  2600,  2800,  3300,
+  1400,  1600,  2400,  2600,  2800,  3200,
+  1300,  1600,  2300,  2600,  2900,  3300,
+  1700,  2200,  2600,  2700,  3200,  3300,
+  1700,  2300,  2600,  2700,  3200,  3300,
+  1700,  1900,  2400,  2600,  3100,  3200,
+  1800,  2300,  2500,  2600,  3200,  3300,
+  1900,  2400,  2500,  2800,  3300,  3400,
+  1800,  2000,  2600,  2800,  3300,  3400,
+  1600,  1900,  2400,  2800,  3200,  3300,
+  1700,  1800,  2600,  2800,  3000,  3300,
+  1900,  2000,  2600,  2800,  3200,  3300,
+  2000,  2100,  2700,  2800,  3200,  3400,
+  2000,  2100,  2600,  2800,  3300,  3400,
+  1600,  1700,  2300,  2600,  2900,  3300,
+  1400,  1600,  2400,  2500,  2800,  3200,
+  1800,  1900,  2500,  2700,  3000,  3400,
+  1900,  2000,  2600,  2700,  3000,  3300,
+  1700,  2000,  2400,  2600,  2900,  3200,
+  1500,  1600,  2300,  2600,  3000,  3300,
+  1500,  1600,  2400,  2600,  2900,  3300,
+  1400,  1500,  2300,  2700,  3000,  3300,
+  1600,  1800,  2500,  2600,  2900,  3200,
+  2000,  2100,  2400,  2600,  3000,  3200,
+  1800,  2000,  2300,  2400,  3200,  3300,
+  1600,  1900,  2300,  2400,  3200,  3300,
+  1500,  1800,  2400,  2700,  3200,  3300,
+  1700,  1900,  2300,  2400,  3000,  3200,
+  2000,  2200,  2400,  2500,  3200,  3300,
+  2200,  2300,  2600,  2700,  3200,  3300,
+  2100,  2200,  2400,  2700,  3000,  3200,
+  2100,  2200,  2500,  2700,  3000,  3200,
+  2200,  2300,  2600,  2800,  3000,  3300,
+  1900,  2200,  2600,  2700,  3000,  3300,
+  1700,  1800,  2500,  2700,  2800,  3200,
+  1700,  1800,  2600,  2700,  3000,  3200,
+  1700,  1900,  2500,  2700,  3100,  3300,
+  1700,  1900,  2500,  2700,  3300,  3400,
+  1800,  2000,  2400,  2600,  3100,  3200,
+  1700,  2200,  2300,  2500,  3200,  3300,
+  1700,  2200,  2300,  2600,  3100,  3200,
+  1600,  1700,  2400,  2600,  3300,  3400,
+  1600,  1700,  2400,  2500,  3300,  3400,
+  1900,  2100,  2500,  2800,  3000,  3100,
+  1800,  2100,  2500,  2800,  3000,  3100,
+  1800,  2100,  2600,  2800,  3100,  3200,
+  1800,  2000,  2500,  2800,  3100,  3200,
+  1900,  2100,  2500,  2600,  3000,  3200,
+  1800,  1900,  2600,  2800,  3200,  3400,
+  1500,  2100,  2500,  2700,  3300,  3400,
+  1100,  2000,  2400,  2600,  3300,  3400,
+  1100,  1900,  2400,  2500,  3300,  3400,
+  1300,  1500,  2200,  2400,  2900,  3300,
+  1600,  1700,  2300,  2500,  2900,  3300,
+  1600,  1700,  2400,  2500,  3000,  3200,
+  1800,  1900,  2500,  2600,  3100,  3300,
+  1900,  2000,  2500,  2700,  3100,  3200,
+  2100,  2200,  2400,  2600,  3100,  3400,
+  2100,  2200,  2500,  2600,  3000,  3400,
+  1900,  2100,  2400,  2700,  3000,  3100,
+  1600,  1800,  2200,  2400,  3000,  3200,
+  1600,  1700,  2200,  2300,  2900,  3300,
+  1600,  1700,  2100,  2300,  2800,  3100,
+  2200,  2300,  2600,  2800,  3100,  3300,
+  2200,  2300,  2700,  2800,  3100,  3400,
+  2000,  2100,  2600,  2800,  3100,  3400,
+  1700,  1800,  2400,  2700,  2900,  3200,
+  1600,  1800,  2400,  2700,  3100,  3200,
+  1600,  1800,  2300,  2400,  3000,  3200,
+  1800,  1900,  2400,  2600,  3100,  3300,
+  1900,  2000,  2300,  2600,  2900,  3200,
+  1900,  2100,  2300,  2700,  2800,  3000,
+  1800,  2000,  2600,  2700,  3000,  3300,
+  1800,  1900,  2400,  2600,  2900,  3300,
+  1700,  1800,  2300,  2400,  2900,  3300,
+  1600,  1700,  2100,  2500,  3000,  3200,
+  1600,  1800,  2200,  2600,  3100,  3200,
+  1500,  1700,  2200,  2500,  2900,  3300,
+  1500,  1600,  2300,  2400,  2800,  3300,
+  1400,  1600,  2300,  2400,  3000,  3300,
+  1500,  2000,  2500,  2800,  3200,  3300,
+  1300,  1500,  2600,  2700,  3100,  3300,
+  1200,  1400,  1700,  1900,  3100,  3300,
+  1200,  1700,  1900,  2300,  3200,  3300,
+  1200,  1900,  2000,  2300,  3200,  3300,
+  1200,  2000,  2100,  2500,  3300,  3400,
+  1200,  2000,  2200,  2600,  3300,  3400,
+  1200,  2000,  2300,  2400,  3200,  3300,
+  1000,  1900,  2300,  2500,  3200,  3300,
+  1200,  1800,  2200,  2500,  3100,  3200,
+  1400,  1600,  2300,  2500,  3200,  3300,
+  1500,  1600,  2500,  2700,  2900,  3200,
+  1600,  1900,  2400,  2800,  3100,  3300,
+  1700,  1800,  2400,  2800,  3100,  3200,
+  1700,  1800,  2500,  2800,  3100,  3200,
+  1500,  1800,  2400,  2500,  2900,  3100,
+  1500,  1600,  2400,  2500,  2900,  3200,
+  1300,  1500,  2200,  2500,  2800,  3100,
+  1300,  1400,  2000,  2400,  2600,  2900,
+  1400,  1500,  2100,  2500,  2700,  3100,
+  1500,  2000,  2300,  2600,  3000,  3200,
+  1700,  2100,  2400,  2600,  2900,  3100,
+  1400,  1500,  2300,  2600,  3000,  3300,
+  1500,  1700,  2200,  2300,  3200,  3300,
+  1400,  1600,  2000,  2400,  3100,  3300,
+  1500,  1700,  2000,  2100,  3100,  3300,
+  1600,  1900,  2200,  2500,  2900,  3200,
+  1500,  1600,  2200,  2400,  2800,  3200,
+  1500,  1600,  2100,  2500,  3000,  3300,
+  1500,  1600,  2000,  2500,  2900,  3300,
+  1500,  1600,  2100,  2500,  2900,  3200,
+  1500,  1600,  2200,  2700,  2800,  3100,
+  1300,  1400,  2200,  2600,  3000,  3200,
+  1400,  1900,  2400,  2700,  3100,  3300,
+  1600,  1800,  2500,  2600,  3000,  3200,
+  1500,  1700,  2300,  2500,  2800,  3200,
+  1700,  1800,  2200,  2400,  3200,  3300,
+  1700,  1900,  2200,  2300,  3000,  3300,
+  1600,  1700,  2000,  2400,  3000,  3200,
+  1700,  1800,  2300,  2600,  2900,  3200,
+  1500,  2000,  2300,  2600,  3100,  3400,
+  1400,  1900,  2500,  2700,  3100,  3300,
+  1400,  1700,  2600,  2700,  3100,  3300,
+  1500,  1600,  2300,  2600,  2800,  3200,
+  1700,  1800,  2300,  2500,  3100,  3400,
+  1500,  1600,  2200,  2300,  3100,  3300,
+  1400,  1500,  2200,  2400,  3100,  3200,
+  1400,  1600,  2200,  2400,  3000,  3100,
+  1700,  2100,  2300,  2700,  3100,  3200,
+  1900,  2300,  2500,  2700,  3100,  3200,
+  1900,  2300,  2600,  2800,  3100,  3300,
+  1900,  2400,  2600,  2900,  3200,  3300,
+  1900,  2300,  2600,  2800,  3300,  3400,
+  1800,  2400,  2600,  2800,  3300,  3400,
+  1600,  1800,  2600,  2700,  3000,  3300,
+  1600,  1700,  2600,  2700,  2900,  3200,
+  1500,  1600,  2500,  2700,  3000,  3300,
+  1300,  1400,  2400,  2700,  2900,  3300,
+  1300,  1400,  2300,  2700,  2800,  3100,
+  1300,  1400,  2500,  2800,  3000,  3300,
+  1500,  1700,  2400,  2500,  2800,  3300,
+  1900,  2000,  2500,  2600,  3000,  3200,
+  1800,  2000,  2400,  2500,  3100,  3200,
+  1700,  1800,  2100,  2300,  2800,  3100,
+  1700,  1800,  2200,  2400,  2800,  3200,
+  1600,  1700,  2200,  2400,  2800,  3200,
+  1500,  1600,  2200,  2400,  2700,  3300,
+  1400,  1500,  2200,  2400,  2900,  3200,
+  1600,  1700,  2300,  2500,  2700,  3000,
+  1600,  1700,  2200,  2500,  2700,  3000,
+  1700,  1900,  2200,  2500,  2800,  3100,
+  1900,  2000,  2300,  2500,  2900,  3100,
+  1900,  2100,  2300,  2500,  2900,  3200,
+  1900,  2100,  2300,  2500,  3100,  3300,
+  2000,  2200,  2600,  2800,  3000,  3200,
+  1900,  2200,  2500,  2700,  2900,  3200,
+  2100,  2300,  2600,  2800,  3100,  3300,
+  2100,  2300,  2600,  2700,  3000,  3200,
+  2100,  2200,  2500,  2600,  3000,  3200,
+  1500,  1600,  2300,  2400,  2900,  3200,
+  1400,  1500,  2100,  2400,  2800,  3100,
+  1300,  1600,  2100,  2400,  3100,  3200,
+  1300,  1400,  2300,  2600,  2800,  3200,
+  1400,  1500,  2200,  2500,  2700,  3200,
+  1400,  1500,  2300,  2500,  2700,  3200,
+  1500,  1600,  2400,  2500,  2800,  3200,
+  1600,  1700,  2400,  2500,  2900,  3200,
+  1700,  1800,  2400,  2500,  2900,  3100,
+  1800,  1900,  2400,  2600,  3000,  3200,
+  2100,  2200,  2700,  2900,  3200,  3300,
+  1800,  2100,  2500,  2900,  3100,  3300,
+  1700,  1800,  2500,  2800,  2900,  3300,
+  1200,  1600,  2100,  2400,  3000,  3200,
+  1600,  1700,  2100,  2600,  2900,  3000,
+  1600,  1700,  2200,  2700,  2900,  3000,
+  1600,  1800,  2200,  2500,  2900,  3000,
+  1700,  1800,  2300,  2500,  2900,  3100,
+  1700,  1900,  2300,  2600,  2900,  3100,
+  1500,  1700,  2000,  2600,  2900,  3100,
+  1400,  1600,  1800,  2600,  3000,  3100,
+  1300,  1500,  1700,  2700,  3100,  3200,
+  1300,  1700,  2400,  2700,  3100,  3300,
+  1200,  1600,  2400,  2600,  2900,  3200,
+  1300,  1400,  2000,  2700,  2800,  3000,
+  1400,  1500,  2000,  2600,  2800,  3000,
+  1500,  1700,  2100,  2600,  2800,  3000,
+  1600,  1800,  2200,  2700,  2800,  3000,
+  1600,  1800,  2100,  2700,  2900,  3100,
+  1500,  1900,  2300,  2700,  3000,  3100,
+  1500,  1900,  2300,  2700,  3000,  3200,
+  1500,  2000,  2300,  2700,  3000,  3200,
+  1800,  2100,  2300,  2700,  3100,  3300,
+  1500,  2000,  2300,  2600,  3000,  3100,
+  1500,  2100,  2300,  2700,  3100,  3200,
+  1600,  2100,  2200,  2700,  3100,  3200,
+  1500,  2100,  2200,  2600,  3100,  3200,
+  1400,  2300,  2500,  2700,  3100,  3200,
+  1700,  2100,  2300,  2700,  2900,  3100,
+  1500,  1800,  2300,  2700,  3000,  3100,
+  1500,  1700,  2300,  2700,  3000,  3100,
+  1500,  1600,  2100,  2700,  3000,  3100,
+  1400,  1500,  1900,  2600,  3100,  3200,
+  1200,  1300,  1900,  2600,  2900,  3100,
+  1100,  1200,  1800,  2700,  3000,  3100,
+  1200,  1300,  1800,  2700,  3000,  3100,
+  1200,  1400,  1900,  2700,  3000,  3100,
+  1300,  1500,  1800,  2600,  3000,  3100,
+  1200,  1400,  2300,  2700,  2900,  3100,
+  1300,  1400,  2200,  2700,  2800,  3100,
+  1300,  1500,  2000,  2600,  2900,  3100,
+  1300,  1500,  2100,  2700,  2900,  3100,
+  1400,  1800,  2100,  2600,  2800,  3000,
+  1400,  1800,  2100,  2500,  2900,  3100,
+  1700,  2000,  2500,  2800,  3000,  3200,
+  1900,  2000,  2700,  2800,  3100,  3400,
+  1900,  2100,  2600,  2800,  3100,  3300,
+  1600,  2100,  2400,  2700,  3200,  3400,
+  1700,  2000,  2300,  2500,  2800,  3200,
+  1500,  1700,  2100,  2300,  3000,  3200,
+  1400,  1900,  2200,  2500,  2900,  3200,
+  1400,  1900,  2300,  2500,  2700,  3100,
+  1300,  1500,  2100,  2700,  2800,  3100,
+  1300,  1500,  2000,  2600,  2800,  3100,
+  1300,  1400,  2100,  2600,  2800,  3000,
+  1300,  1400,  2000,  2600,  2800,  3000,
+  1200,  1300,  2000,  2700,  2800,  3000,
+  1200,  1400,  2300,  2600,  2900,  3200,
+  1300,  1600,  2300,  2700,  2900,  3200,
+  1600,  1900,  2300,  2800,  3100,  3200,
+  1700,  1900,  2300,  2800,  3000,  3200,
+  1700,  1900,  2100,  2600,  2900,  3000,
+  1700,  1900,  2400,  2600,  2800,  3100,
+  1700,  2100,  2400,  2500,  2800,  3100,
+  1700,  2000,  2400,  2500,  2900,  3100,
+  1900,  2200,  2400,  2600,  3000,  3200,
+  1700,  2000,  2400,  2700,  3000,  3100,
+  1500,  1900,  2300,  2600,  3000,  3100,
+  1500,  1600,  2100,  2600,  2900,  3200,
+  1400,  1600,  1800,  2300,  2800,  2900,
+  1400,  1600,  1700,  2500,  3200,  3300,
+  1400,  1600,  1800,  2400,  3200,  3300,
+  1400,  1700,  1900,  2200,  3100,  3200,
+  1300,  1700,  1900,  2300,  3100,  3200,
+  1100,  1600,  2000,  2300,  3000,  3100,
+  1500,  1900,  2500,  2800,  3200,  3300,
+  1800,  2000,  2300,  2800,  3000,  3100,
+  1800,  1900,  2300,  2700,  2900,  3200,
+  1700,  1900,  2300,  2600,  2800,  3100,
+  1700,  1900,  2100,  2500,  2700,  3000,
+  1700,  1900,  2100,  2600,  2800,  3000,
+  1700,  1900,  2100,  2700,  2900,  3100,
+  1700,  1900,  2500,  2800,  3000,  3300
+};
+
+const struct lsp_codebook lsp_cbjnd[] = {
+  /* codebook/lsp1.txt */
+  {
+    1,
+    4,
+    16,
+    codes0
+  },
+  /* codebook/lsp2.txt */
+  {
+    1,
+    4,
+    16,
+    codes1
+  },
+  /* codebook/lsp3.txt */
+  {
+    1,
+    4,
+    16,
+    codes2
+  },
+  /* codebook/lsp4.txt */
+  {
+    1,
+    4,
+    16,
+    codes3
+  },
+  /* ../unittest/lspjnd5-10.txt */
+  {
+    6,
+    11.7181,
+    3369,
+    codes4
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookjvm.c b/codec2/tags/0.4/src/codebookjvm.c
new file mode 100644 (file)
index 0000000..917674e
--- /dev/null
@@ -0,0 +1,1579 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/lspjvm1.txt */
+static const float codes0[] = {
+  0.435217,  0.668864,  1.0103,  1.22042,  1.50398,  1.78468,  2.13546,  2.35747,  2.61891,  2.73804,
+  0.179285,  0.33316,  0.500638,  0.79695,  1.03999,  1.23497,  1.6523,  1.84823,  2.62556,  2.80497,
+  0.268785,  0.356576,  0.595753,  1.04434,  1.24938,  1.42868,  1.68699,  1.86469,  2.33991,  2.5138,
+  0.12007,  0.165585,  0.484694,  0.95916,  1.23753,  1.52915,  1.83751,  2.10773,  2.48749,  2.76685,
+  0.150214,  0.229487,  0.62824,  0.961255,  1.33706,  1.59831,  1.91974,  2.21786,  2.53732,  2.75956,
+  0.268624,  0.34598,  0.569637,  0.754737,  0.916538,  1.50854,  1.78635,  1.95442,  2.36953,  2.50182,
+  0.246064,  0.468874,  0.662711,  0.890015,  1.14715,  1.51043,  1.78106,  2.09594,  2.65539,  2.80037,
+  0.191631,  0.280628,  0.393229,  0.611761,  1.42017,  1.70774,  1.87303,  2.10155,  2.28035,  2.49949,
+  0.361668,  0.507047,  0.789974,  1.04599,  1.50238,  1.67703,  1.90534,  2.16255,  2.43226,  2.59087,
+  0.20816,  0.294285,  0.448634,  0.694229,  0.872517,  1.07032,  1.70335,  2.16874,  2.42619,  2.60366,
+  0.316939,  0.513618,  0.705487,  0.917036,  1.17599,  1.31114,  1.6186,  2.03784,  2.45052,  2.5794,
+  0.241068,  0.377728,  0.521595,  0.717203,  1.31041,  1.53999,  1.73643,  2.09893,  2.29792,  2.58735,
+  0.234937,  0.281875,  0.780422,  1.44073,  1.60943,  1.75643,  1.97721,  2.14861,  2.60203,  2.7225,
+  0.178679,  0.242672,  0.416988,  0.708348,  0.95562,  1.17667,  1.7818,  2.05449,  2.28159,  2.44811,
+  0.345036,  0.42108,  0.740887,  1.16544,  1.32494,  1.4888,  1.76346,  1.90617,  2.39505,  2.64916,
+  0.249586,  0.357494,  0.520747,  0.847195,  1.42841,  1.59778,  1.77819,  2.1785,  2.41344,  2.56466,
+  0.295235,  0.574231,  1.2491,  1.4641,  1.72756,  1.92679,  2.09536,  2.28483,  2.56707,  2.72248,
+  0.34193,  0.427307,  0.634001,  0.804212,  0.905629,  1.33337,  1.79033,  1.89276,  2.44582,  2.60283,
+  0.363948,  0.508985,  0.667357,  0.946354,  1.43756,  1.62654,  1.81114,  2.03909,  2.29188,  2.43549,
+  0.163514,  0.277407,  0.409207,  0.902065,  1.18907,  1.33964,  1.80241,  1.96077,  2.65293,  2.81899,
+  0.302643,  0.359753,  0.651207,  1.20802,  1.4237,  1.54815,  1.88213,  2.01559,  2.26054,  2.5789,
+  0.155928,  0.216908,  0.381812,  0.654803,  1.11237,  1.58993,  1.84756,  1.97672,  2.22408,  2.72534,
+  0.274981,  0.347675,  0.572,  0.736046,  0.894248,  1.63237,  1.89139,  2.05689,  2.6029,  2.72178,
+  0.154496,  0.243461,  0.348174,  0.689505,  1.57381,  1.70031,  1.94318,  2.10158,  2.56466,  2.77317,
+  0.292612,  0.466612,  0.795936,  1.04747,  1.41369,  1.75085,  2.06289,  2.34007,  2.61361,  2.76949,
+  0.242896,  0.3615,  0.555859,  0.793597,  0.932291,  1.40947,  1.86386,  2.00953,  2.4645,  2.67749,
+  0.221646,  0.344724,  0.554564,  0.729403,  1.13657,  1.30177,  1.52918,  2.16359,  2.39582,  2.61081,
+  0.160969,  0.224467,  0.371545,  0.626879,  1.16095,  1.44423,  1.67597,  1.87978,  2.47859,  2.67202,
+  0.214172,  0.341585,  0.676575,  0.977397,  1.32543,  1.7201,  2.07259,  2.36954,  2.63528,  2.77879,
+  0.203311,  0.289438,  0.458739,  0.914153,  1.12288,  1.30292,  1.58384,  1.88683,  2.18787,  2.42704,
+  0.280383,  0.3716,  0.824827,  1.10025,  1.23623,  1.39892,  1.57804,  2.016,  2.36897,  2.50673,
+  0.170627,  0.251778,  0.393686,  0.608347,  1.2876,  1.44667,  1.79328,  2.03655,  2.31015,  2.75244,
+  0.18058,  0.288746,  0.987854,  1.43171,  1.67722,  1.91566,  2.12494,  2.28945,  2.58961,  2.75426,
+  0.176335,  0.266263,  0.445421,  0.706403,  0.875402,  1.42292,  1.75867,  1.96091,  2.41068,  2.60175,
+  0.216173,  0.287404,  0.480696,  1.00977,  1.2913,  1.47664,  1.89558,  2.06429,  2.28406,  2.48311,
+  0.176523,  0.273934,  0.403407,  0.966139,  1.30472,  1.43661,  1.94473,  2.08484,  2.54446,  2.76242,
+  0.311836,  0.550501,  0.879591,  1.09623,  1.27666,  1.47786,  1.81771,  2.15434,  2.56047,  2.77984,
+  0.179765,  0.25056,  0.455939,  1.02389,  1.22513,  1.47566,  1.73462,  1.91871,  2.14734,  2.43824,
+  0.271033,  0.457235,  0.599622,  0.821049,  0.940125,  1.20094,  1.84972,  1.98666,  2.54817,  2.75158,
+  0.179326,  0.248002,  0.426405,  0.81706,  1.28589,  1.56502,  2.11736,  2.29871,  2.5724,  2.7527,
+  0.374409,  0.535936,  0.897009,  1.18507,  1.59157,  1.7572,  1.96794,  2.17999,  2.45739,  2.62264,
+  0.185472,  0.282752,  0.409439,  0.657499,  0.856446,  1.0294,  1.87993,  2.06932,  2.34474,  2.7531,
+  0.375964,  0.578457,  0.758945,  0.929339,  1.12748,  1.25944,  1.70411,  2.12297,  2.33603,  2.4983,
+  0.225641,  0.36103,  0.501679,  0.783379,  1.31485,  1.45262,  1.71415,  1.98716,  2.2257,  2.72436,
+  0.144996,  0.252919,  0.632145,  1.22604,  1.57534,  1.90155,  2.17148,  2.39055,  2.68229,  2.80983,
+  0.172022,  0.263338,  0.448634,  0.729435,  0.984007,  1.1716,  1.75705,  1.99023,  2.32131,  2.77121,
+  0.235731,  0.351117,  0.796871,  1.05571,  1.30022,  1.59182,  1.89587,  2.12292,  2.41789,  2.59982,
+  0.254053,  0.319371,  0.455623,  1.08614,  1.66467,  1.91588,  2.05908,  2.23342,  2.45204,  2.58679,
+  0.375538,  0.742993,  1.13991,  1.33776,  1.73556,  2.01391,  2.31501,  2.48343,  2.65158,  2.75521,
+  0.247245,  0.481131,  0.710366,  0.897602,  1.12109,  1.27171,  1.78735,  2.1995,  2.42966,  2.74067,
+  0.226103,  0.311441,  0.501648,  0.844424,  1.36282,  1.53134,  1.77747,  1.98993,  2.18749,  2.3585,
+  0.195862,  0.296224,  0.609554,  0.783241,  1.24347,  1.44548,  1.63703,  2.02264,  2.48356,  2.64614,
+  0.233302,  0.299441,  0.472792,  1.24946,  1.45788,  1.60186,  1.83143,  1.99372,  2.59719,  2.75543,
+  0.168096,  0.224183,  0.3827,  0.596214,  1.06059,  1.29442,  1.60576,  1.84849,  2.3577,  2.56919,
+  0.33005,  0.445912,  0.661713,  0.874446,  1.00079,  1.45297,  1.94399,  2.07692,  2.42388,  2.61236,
+  0.226382,  0.287303,  0.517631,  0.806229,  1.30901,  1.88528,  2.16051,  2.28641,  2.52638,  2.66082,
+  0.20317,  0.499314,  0.887358,  1.23507,  1.46292,  1.69826,  1.99932,  2.22922,  2.57161,  2.76669,
+  0.307531,  0.378353,  0.573606,  0.712218,  0.850169,  1.309,  2.05909,  2.26382,  2.49794,  2.67682,
+  0.276203,  0.51025,  0.6868,  0.902844,  1.2052,  1.32798,  1.71889,  2.03895,  2.25639,  2.69715,
+  0.161948,  0.229115,  0.393619,  0.683613,  1.13781,  1.32269,  1.78372,  1.96158,  2.38907,  2.63608,
+  0.201334,  0.276773,  0.468994,  0.967017,  1.47597,  1.63242,  1.96577,  2.19728,  2.48059,  2.70155,
+  0.214587,  0.315421,  0.469498,  0.733397,  1.146,  1.27791,  1.72784,  2.22713,  2.44026,  2.68112,
+  0.255602,  0.394609,  0.743393,  0.977796,  1.19908,  1.40597,  1.91834,  2.22483,  2.47919,  2.66339,
+  0.245989,  0.352625,  0.517055,  0.80283,  1.55871,  1.79565,  1.94405,  2.13364,  2.33327,  2.47998,
+  0.337423,  0.480433,  0.869036,  1.13957,  1.63076,  1.82296,  2.07484,  2.29261,  2.47913,  2.62532,
+  0.220974,  0.35885,  0.57164,  0.752791,  0.937013,  1.15172,  1.6744,  2.06247,  2.55872,  2.78484,
+  0.267518,  0.331708,  0.541111,  1.11655,  1.41112,  1.53287,  1.79295,  1.93352,  2.24894,  2.62864,
+  0.084613,  0.105083,  0.297424,  0.916949,  1.2563,  1.56703,  1.88539,  2.18987,  2.52279,  2.7921,
+  0.205328,  0.287223,  0.724462,  1.0324,  1.45771,  1.64217,  1.92563,  2.17552,  2.42964,  2.60549,
+  0.232554,  0.338724,  0.502115,  0.859975,  1.04409,  1.24565,  1.80656,  1.99964,  2.26116,  2.45998,
+  0.291638,  0.379172,  0.626072,  0.792796,  0.959124,  1.50489,  1.73447,  1.91961,  2.61436,  2.72271,
+  0.191554,  0.263114,  0.426797,  0.610628,  1.07741,  1.82954,  2.02195,  2.21057,  2.42765,  2.61383,
+  0.389151,  0.679476,  0.915414,  1.03664,  1.25085,  1.58661,  2.04097,  2.2815,  2.56794,  2.71882,
+  0.2032,  0.30128,  0.470357,  0.668716,  0.851737,  0.980327,  1.57086,  2.03762,  2.28907,  2.69388,
+  0.304064,  0.405934,  0.710274,  0.962705,  1.12882,  1.34167,  1.63505,  1.84538,  2.07992,  2.50751,
+  0.171777,  0.240705,  0.409371,  0.786432,  1.2232,  1.37569,  1.69176,  1.86608,  2.35041,  2.49394,
+  0.231251,  0.277994,  0.557867,  1.32582,  1.66035,  1.77948,  2.00714,  2.17232,  2.44046,  2.65231,
+  0.188101,  0.259494,  0.412543,  0.624843,  0.839549,  1.0337,  1.63413,  1.93194,  2.24608,  2.42577,
+  0.361304,  0.419465,  0.795676,  1.18461,  1.2968,  1.57845,  1.84175,  1.99736,  2.54054,  2.68714,
+  0.274372,  0.338938,  0.492443,  0.963516,  1.50951,  1.70638,  1.86988,  2.07717,  2.26128,  2.44418,
+  0.41599,  0.652103,  1.03129,  1.26955,  1.57275,  1.77297,  2.00466,  2.17527,  2.43061,  2.59655,
+  0.242045,  0.370942,  0.534392,  0.763529,  1.00117,  1.12976,  1.68219,  2.14464,  2.32448,  2.7157,
+  0.377438,  0.588168,  0.765394,  0.976873,  1.35665,  1.49009,  1.73797,  2.00677,  2.21369,  2.38997,
+  0.191625,  0.284123,  0.405342,  1.01678,  1.43273,  1.54759,  1.81393,  1.95832,  2.47077,  2.64926,
+  0.272672,  0.349555,  0.633911,  1.15223,  1.30394,  1.54764,  1.9195,  2.0477,  2.56278,  2.73058,
+  0.168423,  0.23633,  0.421468,  0.831345,  1.08354,  1.55345,  1.88073,  2.0647,  2.37086,  2.63295,
+  0.219318,  0.301481,  0.513617,  0.765086,  1.02602,  1.51465,  2.0482,  2.24857,  2.49981,  2.65707,
+  0.232695,  0.347947,  0.495203,  0.71883,  1.42301,  1.72249,  1.87958,  2.16504,  2.42025,  2.58966,
+  0.270284,  0.336865,  0.684929,  1.15579,  1.69042,  1.87674,  2.02736,  2.22618,  2.44675,  2.582,
+  0.149701,  0.193747,  0.352019,  0.520123,  0.823974,  1.43475,  1.68659,  1.96115,  2.37091,  2.69307,
+  0.254818,  0.412303,  0.601514,  0.771438,  1.17545,  1.37657,  1.53903,  1.93704,  2.40858,  2.56362,
+  0.233713,  0.355886,  0.593725,  0.76288,  1.27148,  1.5639,  1.79752,  2.09469,  2.53863,  2.71173,
+  0.179028,  0.237103,  0.396818,  1.04202,  1.63354,  1.76268,  2.12393,  2.32239,  2.58819,  2.75134,
+  0.182027,  0.251039,  0.434581,  0.714302,  0.950997,  1.4379,  1.81357,  1.9691,  2.14588,  2.35397,
+  0.501538,  0.692148,  0.84886,  1.07131,  1.35054,  1.48948,  1.84164,  2.10428,  2.34154,  2.51529,
+  0.27453,  0.38147,  0.526682,  0.922143,  1.44495,  1.5736,  1.85877,  2.06675,  2.2848,  2.62682,
+  0.360617,  0.583131,  0.979491,  1.25408,  1.48835,  1.79756,  2.21952,  2.48218,  2.74237,  2.86203,
+  0.140913,  0.220301,  0.619552,  0.818307,  1.05243,  1.33997,  1.83073,  2.13395,  2.53638,  2.75113,
+  0.293514,  0.391691,  0.79008,  0.96274,  1.16032,  1.5266,  1.80549,  2.04146,  2.36162,  2.56496,
+  0.199542,  0.290571,  0.452891,  0.689515,  1.25853,  1.40988,  1.88624,  2.22813,  2.46568,  2.72665,
+  0.29692,  0.356356,  0.784287,  0.99654,  1.14618,  1.62387,  1.8155,  2.0383,  2.60063,  2.7057,
+  0.206451,  0.276025,  0.537547,  0.802572,  1.22041,  1.64206,  1.86363,  2.00198,  2.21534,  2.58538,
+  0.33365,  0.464751,  0.653772,  0.966306,  1.10387,  1.3402,  1.7847,  1.91459,  2.47017,  2.68692,
+  0.181861,  0.24487,  0.376456,  0.554383,  1.3299,  1.81044,  2.04784,  2.20232,  2.66086,  2.81706,
+  0.450565,  0.647291,  0.951172,  1.22943,  1.51964,  1.68681,  2.04911,  2.26717,  2.50128,  2.6506,
+  0.219996,  0.320591,  0.427747,  0.601183,  0.753448,  0.929578,  1.74198,  2.28579,  2.47263,  2.74957,
+  0.333848,  0.423373,  0.658791,  1.0313,  1.22263,  1.36577,  1.90189,  2.1211,  2.29031,  2.53118,
+  0.166064,  0.233902,  0.383355,  0.661806,  1.22657,  1.39968,  1.77127,  1.97454,  2.17349,  2.56634,
+  0.189286,  0.243602,  0.390584,  1.38793,  1.58872,  1.76324,  2.09112,  2.31631,  2.59353,  2.75508,
+  0.158404,  0.224878,  0.385,  0.668463,  0.942954,  1.41197,  1.70031,  1.82807,  2.0594,  2.69255,
+  0.325989,  0.461263,  0.851471,  1.04571,  1.28403,  1.5162,  1.79734,  2.08839,  2.43767,  2.62721,
+  0.223709,  0.28919,  0.632812,  0.858738,  1.5419,  1.74677,  1.93574,  2.18482,  2.40433,  2.58301,
+  0.545842,  0.95242,  1.34082,  1.51684,  1.83888,  2.01289,  2.24497,  2.40317,  2.59228,  2.69112,
+  0.238526,  0.349079,  0.494582,  0.987665,  1.17075,  1.34823,  1.46864,  2.29696,  2.64416,  2.78738,
+  0.270857,  0.442003,  0.655998,  0.881913,  1.25925,  1.42836,  1.76987,  1.99853,  2.39559,  2.65284,
+  0.154384,  0.211806,  0.489481,  0.997257,  1.24982,  1.54123,  1.77886,  1.9494,  2.31914,  2.62339,
+  0.268258,  0.312888,  0.589114,  1.25863,  1.57271,  1.67543,  1.91278,  2.07046,  2.27993,  2.56423,
+  0.170715,  0.224965,  0.374011,  0.540197,  1.16189,  1.49907,  1.92587,  2.08257,  2.24662,  2.46972,
+  0.324358,  0.391989,  0.706816,  0.833614,  1.01573,  1.56899,  1.73598,  2.12707,  2.55841,  2.65387,
+  0.178059,  0.258575,  0.374125,  0.536831,  1.33483,  1.79863,  1.98698,  2.18925,  2.43227,  2.6267,
+  0.198857,  0.420955,  0.817664,  1.17836,  1.46674,  1.8213,  2.20733,  2.47441,  2.73828,  2.85119,
+  0.188344,  0.324302,  0.470468,  0.790033,  0.934101,  1.18872,  1.88717,  2.05283,  2.44832,  2.63024,
+  0.201295,  0.365646,  0.526513,  0.758388,  1.1401,  1.26733,  1.65017,  1.87934,  2.10289,  2.60029,
+  0.135058,  0.169428,  0.307348,  0.50316,  1.01808,  1.44795,  1.81098,  2.134,  2.48028,  2.75985,
+  0.178006,  0.26661,  0.390327,  0.928681,  1.50161,  1.62133,  1.87136,  2.02586,  2.58044,  2.7708,
+  0.246182,  0.42429,  0.644023,  0.801168,  1.11488,  1.27776,  1.50332,  2.07489,  2.2957,  2.50138,
+  0.322996,  0.430355,  0.6316,  1.0477,  1.22184,  1.42673,  1.90308,  2.03222,  2.51673,  2.70845,
+  0.292994,  0.430599,  0.619178,  0.794567,  1.28303,  1.65282,  1.84084,  2.06995,  2.38538,  2.52825,
+  0.525494,  0.787797,  1.12182,  1.38748,  1.67457,  1.93622,  2.22404,  2.39062,  2.63428,  2.74323,
+  0.299504,  0.409196,  0.602235,  0.892336,  1.05643,  1.25377,  1.48914,  1.63988,  2.42748,  2.65037,
+  0.423758,  0.52048,  0.758987,  1.04126,  1.17366,  1.42368,  1.81824,  1.93641,  2.363,  2.62664,
+  0.155042,  0.247496,  0.641445,  0.954509,  1.22497,  1.46585,  1.83784,  2.09046,  2.4515,  2.71616,
+  0.251949,  0.421094,  0.706797,  0.975659,  1.25991,  1.52007,  1.81631,  2.12202,  2.47491,  2.71667,
+  0.21522,  0.302248,  0.730598,  0.896343,  1.14557,  1.37019,  1.70069,  2.02256,  2.28327,  2.48922,
+  0.28523,  0.453559,  0.66367,  0.861526,  1.0116,  1.24742,  1.65598,  1.86129,  2.57894,  2.73133,
+  0.162067,  0.219409,  0.373433,  0.544669,  1.1033,  1.59718,  1.92104,  2.1434,  2.4065,  2.66048,
+  0.342367,  0.511499,  0.93135,  1.16322,  1.39365,  1.61115,  1.97277,  2.19442,  2.47077,  2.64926,
+  0.25101,  0.364125,  0.560956,  0.746545,  1.01984,  1.17072,  1.53295,  2.28867,  2.57709,  2.72307,
+  0.315001,  0.489412,  0.720682,  0.877607,  1.09047,  1.25385,  1.44822,  1.92295,  2.25589,  2.40863,
+  0.174666,  0.235793,  0.387644,  0.554402,  1.23109,  1.45614,  1.68803,  2.12745,  2.36703,  2.59727,
+  0.215113,  0.341915,  1.04372,  1.32275,  1.49541,  1.74189,  1.96116,  2.23982,  2.5449,  2.70394,
+  0.219852,  0.30177,  0.513912,  0.705474,  0.87754,  1.2959,  1.699,  1.98706,  2.28797,  2.49697,
+  0.290638,  0.366442,  0.655155,  1.04499,  1.17215,  1.53254,  1.80079,  1.94893,  2.50968,  2.66005,
+  0.232252,  0.31377,  0.658552,  0.941977,  1.46317,  1.66549,  1.86246,  2.02784,  2.53402,  2.70124,
+  0.326539,  0.552681,  1.12173,  1.33138,  1.52007,  1.86708,  2.08286,  2.33247,  2.60604,  2.73709,
+  0.190254,  0.340428,  0.492777,  0.739738,  0.895461,  1.07937,  1.64316,  1.79529,  2.49182,  2.72938,
+  0.283586,  0.41844,  0.587306,  0.870866,  1.41855,  1.57703,  1.7995,  2.0694,  2.27448,  2.4381,
+  0.235752,  0.35765,  0.502891,  1.01243,  1.25885,  1.40779,  1.82006,  1.95583,  2.5059,  2.73433,
+  0.278412,  0.343137,  0.849977,  1.2329,  1.3505,  1.59063,  1.78752,  2.09158,  2.54136,  2.66386,
+  0.162966,  0.243159,  0.439238,  0.684821,  0.887783,  1.4629,  1.88174,  2.04425,  2.28939,  2.705,
+  0.235063,  0.371799,  0.57821,  0.752199,  1.00855,  1.47628,  1.80491,  2.2714,  2.65504,  2.78965,
+  0.154939,  0.223696,  0.344718,  0.667555,  1.49566,  1.66944,  2.06988,  2.30721,  2.62769,  2.81134,
+  0.239702,  0.335917,  0.716616,  1.1318,  1.45251,  1.63913,  2.10552,  2.27982,  2.50203,  2.66922,
+  0.226818,  0.331261,  0.472705,  0.651974,  0.781639,  1.2198,  1.8229,  2.08273,  2.43933,  2.6109,
+  0.223413,  0.359594,  0.534704,  0.741518,  1.22589,  1.38987,  1.61819,  2.00991,  2.207,  2.45984,
+  0.171308,  0.268378,  0.383799,  0.858926,  1.37629,  1.51917,  1.7806,  1.92291,  2.62309,  2.8024,
+  0.140134,  0.21232,  0.443224,  0.967457,  1.26424,  1.56215,  1.92915,  2.21739,  2.66834,  2.83075,
+  0.221323,  0.322124,  0.485563,  0.818589,  1.01184,  1.19898,  1.42362,  1.6694,  2.15752,  2.36319,
+  0.369687,  0.525655,  0.719213,  0.939654,  1.13763,  1.31222,  1.59994,  1.82681,  2.35522,  2.58068,
+  0.211975,  0.314411,  0.489148,  0.739213,  1.3778,  1.5545,  1.82437,  2.15887,  2.35299,  2.72262,
+  0.170698,  0.296368,  0.934285,  1.24313,  1.5559,  1.86654,  2.15994,  2.36344,  2.58503,  2.73853,
+  0.189263,  0.305887,  0.439912,  0.78461,  1.22726,  1.34251,  1.58765,  1.75491,  2.43989,  2.72131,
+  0.296339,  0.385169,  0.612012,  1.08132,  1.27636,  1.43718,  1.87147,  2.00172,  2.33909,  2.64022,
+  0.229588,  0.320544,  0.517278,  0.969137,  1.14256,  1.62609,  1.87792,  2.11546,  2.54674,  2.70802,
+  0.248869,  0.420193,  0.732388,  1.04902,  1.30341,  1.60146,  1.94921,  2.23946,  2.64822,  2.82261,
+  0.2076,  0.29232,  0.496539,  0.857149,  1.18229,  1.39985,  1.71416,  1.86824,  2.02794,  2.20074,
+  0.225558,  0.396897,  0.541783,  0.873366,  1.17897,  1.29958,  1.67719,  1.8496,  2.33048,  2.75272,
+  0.176821,  0.231377,  0.372767,  0.508565,  1.15282,  1.80805,  2.11268,  2.25007,  2.57134,  2.74855,
+  0.352149,  0.515765,  1.02324,  1.26022,  1.44357,  1.62207,  1.8728,  2.10018,  2.48928,  2.67104,
+  0.166138,  0.263444,  0.370151,  0.590066,  0.754819,  0.940533,  1.76187,  1.94661,  2.44501,  2.75819,
+  0.342082,  0.476411,  0.656223,  0.851774,  1.00399,  1.15337,  1.6944,  2.06562,  2.25564,  2.44015,
+  0.227237,  0.376514,  0.514329,  0.894887,  1.14167,  1.28305,  1.83138,  1.9859,  2.33447,  2.78488,
+  0.215891,  0.269548,  0.684111,  1.40566,  1.67481,  1.80093,  2.17209,  2.3394,  2.59157,  2.7301,
+  0.23624,  0.400377,  0.533684,  0.750343,  0.910405,  1.08911,  1.73773,  1.91281,  2.19252,  2.68873,
+  0.169242,  0.284879,  0.916252,  1.16977,  1.43368,  1.64438,  1.91912,  2.16162,  2.48266,  2.68259,
+  0.270731,  0.336506,  0.477594,  1.04271,  1.60584,  1.79686,  1.94591,  2.16004,  2.35491,  2.52095,
+  0.420586,  0.652563,  1.11716,  1.40601,  1.74754,  1.94742,  2.20309,  2.35997,  2.5479,  2.68217,
+  0.281552,  0.395037,  0.640181,  0.944531,  1.19396,  1.33049,  1.71866,  2.18839,  2.44459,  2.57867,
+  0.311824,  0.476892,  0.633431,  0.845825,  1.33252,  1.49166,  1.69361,  2.04108,  2.28932,  2.4394,
+  0.133945,  0.20079,  0.647237,  0.927687,  1.18888,  1.36966,  1.69956,  1.97278,  2.29526,  2.67818,
+  0.204796,  0.278215,  0.443465,  1.27048,  1.40521,  1.64092,  1.82425,  2.32709,  2.59964,  2.77253,
+  0.18397,  0.244116,  0.410594,  0.639103,  1.22159,  1.40487,  1.62836,  1.90244,  2.16863,  2.3068,
+  0.343622,  0.434735,  0.666599,  0.868069,  1.04894,  1.53278,  1.81983,  1.97188,  2.2887,  2.44875,
+  0.238017,  0.320361,  0.657255,  0.917611,  1.30331,  1.72736,  1.98891,  2.18145,  2.44297,  2.61332,
+  0.323613,  0.545056,  0.930173,  1.22606,  1.44018,  1.7723,  2.05689,  2.34781,  2.68938,  2.82062,
+  0.28893,  0.401387,  0.617124,  0.836453,  0.990306,  1.26123,  1.91328,  2.11005,  2.32458,  2.55716,
+  0.33267,  0.480804,  0.656147,  0.880536,  1.02957,  1.23049,  1.76906,  1.9323,  2.20037,  2.58521,
+  0.185551,  0.265352,  0.409432,  0.608847,  1.0347,  1.22282,  1.87697,  2.17165,  2.4035,  2.66644,
+  0.155026,  0.223348,  0.401684,  1.07914,  1.41579,  1.62002,  2.04552,  2.25851,  2.63162,  2.80229,
+  0.183461,  0.263081,  0.425694,  0.635685,  1.18866,  1.35756,  1.57499,  2.08598,  2.28872,  2.51111,
+  0.314738,  0.463011,  0.648733,  0.877651,  1.00289,  1.26581,  2.00541,  2.1981,  2.48153,  2.71418,
+  0.244411,  0.318444,  0.546578,  0.793615,  1.32615,  1.73548,  1.9456,  2.11466,  2.31535,  2.47853,
+  0.326237,  0.54354,  0.987361,  1.30441,  1.68493,  1.90215,  2.20717,  2.37427,  2.55753,  2.71622,
+  0.157795,  0.283302,  0.430398,  0.660379,  0.81106,  1.14254,  1.4793,  1.71871,  2.67026,  2.84756,
+  0.220856,  0.283872,  0.779935,  1.07494,  1.31221,  1.62633,  1.83761,  1.96888,  2.15599,  2.60238,
+  0.140763,  0.205719,  0.406561,  0.762459,  1.04127,  1.48699,  1.83831,  2.11461,  2.55281,  2.77228,
+  0.140451,  0.39592,  0.79211,  1.108,  1.40264,  1.62308,  1.94315,  2.22795,  2.54616,  2.774,
+  0.229862,  0.336462,  0.54659,  0.81015,  1.20191,  1.34679,  1.82532,  2.09293,  2.28573,  2.47336,
+  0.224913,  0.328246,  0.517269,  0.874793,  1.01259,  1.45218,  1.69578,  2.01493,  2.51145,  2.67257,
+  0.247745,  0.335741,  0.546558,  0.710177,  1.17056,  1.72779,  1.97068,  2.15853,  2.48282,  2.62891,
+  0.398252,  0.555087,  0.890367,  1.1212,  1.38153,  1.60123,  1.86665,  2.06661,  2.40516,  2.58802,
+  0.198563,  0.288867,  0.478054,  0.658477,  0.851841,  1.0271,  1.53974,  2.02111,  2.57946,  2.78418,
+  0.304271,  0.371642,  0.66159,  1.06898,  1.22425,  1.41193,  1.68052,  1.86977,  2.10007,  2.30855,
+  0.188223,  0.257939,  0.432402,  0.73505,  1.31804,  1.48553,  1.82811,  2.04644,  2.30702,  2.45724,
+  0.246723,  0.297276,  0.604475,  1.3109,  1.57044,  1.68885,  1.91366,  2.05133,  2.55601,  2.71497,
+  0.158309,  0.234509,  0.435792,  0.6679,  0.957567,  1.23592,  1.59294,  1.81816,  2.30739,  2.76897,
+  0.419843,  0.501412,  0.766892,  1.07317,  1.18937,  1.48022,  1.7666,  1.92215,  2.53794,  2.69477,
+  0.27514,  0.335563,  0.678421,  1.08152,  1.59238,  1.77263,  1.93124,  2.1407,  2.3338,  2.49086,
+  0.372056,  0.856814,  1.23954,  1.40999,  1.6903,  1.86302,  2.0727,  2.27355,  2.53266,  2.69052,
+  0.321254,  0.422981,  0.604856,  0.793437,  0.912112,  1.12845,  1.79598,  2.17323,  2.36015,  2.53614,
+  0.395214,  0.598779,  0.771997,  0.946713,  1.21378,  1.33043,  1.66033,  1.97715,  2.16506,  2.34402,
+  0.225286,  0.317828,  0.464801,  1.11233,  1.36951,  1.512,  1.92195,  2.05341,  2.59352,  2.77729,
+  0.330612,  0.407807,  0.730129,  1.25973,  1.45981,  1.60567,  1.98131,  2.13701,  2.46597,  2.67972,
+  0.213145,  0.305305,  0.507016,  0.662299,  1.05685,  1.47986,  1.6719,  2.10271,  2.36987,  2.58199,
+  0.219658,  0.296096,  0.443507,  0.610973,  0.799691,  1.67658,  1.96549,  2.15323,  2.50223,  2.693,
+  0.174947,  0.257739,  0.373547,  0.552567,  1.40532,  1.61425,  1.84892,  2.11779,  2.31788,  2.7119,
+  0.209667,  0.297529,  0.756195,  1.0953,  1.5642,  1.84477,  2.1037,  2.29266,  2.52005,  2.67949,
+  0.170138,  0.24031,  0.452247,  0.684414,  0.880102,  1.36692,  1.74165,  2.13129,  2.50573,  2.73261,
+  0.278164,  0.468635,  0.707518,  0.853693,  1.05478,  1.21046,  1.54094,  2.17456,  2.41066,  2.61214,
+  0.155738,  0.23889,  0.352836,  0.621012,  1.44144,  1.6197,  1.82517,  1.97533,  2.52537,  2.74857,
+  0.223776,  0.274424,  0.479048,  0.797871,  1.69419,  1.87813,  2.13528,  2.37373,  2.59542,  2.72979,
+  0.151088,  0.198286,  0.326558,  0.536276,  0.845893,  1.14165,  1.46056,  1.76287,  2.02585,  2.1773,
+  0.434445,  0.614208,  0.887657,  1.02845,  1.19136,  1.3922,  1.78689,  2.06248,  2.4234,  2.61936,
+  0.180755,  0.275311,  0.397787,  0.859366,  1.40976,  1.52332,  1.90885,  2.08232,  2.38972,  2.74389,
+  0.275975,  0.508416,  0.889894,  1.31893,  1.63331,  1.90473,  2.16901,  2.37466,  2.72697,  2.84767,
+  0.156239,  0.262624,  0.406657,  0.739074,  1.04449,  1.20123,  1.81089,  2.0056,  2.5817,  2.80489,
+  0.195391,  0.258771,  0.654924,  0.824371,  1.31526,  1.50073,  1.76594,  2.06399,  2.34118,  2.51366,
+  0.178034,  0.301047,  0.46302,  0.716172,  1.19887,  1.34045,  1.83456,  2.02213,  2.40075,  2.77629,
+  0.340368,  0.404236,  0.843747,  1.03924,  1.20211,  1.70805,  1.91495,  2.16951,  2.52152,  2.62335,
+  0.218465,  0.289694,  0.528045,  0.817051,  1.13234,  1.58046,  1.83889,  1.98339,  2.14749,  2.34813,
+  0.322509,  0.458058,  0.654679,  0.958976,  1.11821,  1.32157,  1.90139,  2.04641,  2.36093,  2.66422,
+  0.191821,  0.252321,  0.389176,  0.581111,  1.52967,  1.93169,  2.08361,  2.27046,  2.56685,  2.71388,
+  0.493961,  0.710827,  0.98226,  1.19627,  1.41933,  1.62091,  1.92801,  2.14565,  2.42977,  2.60197,
+  0.213148,  0.311589,  0.424636,  0.602664,  0.736895,  1.02216,  1.99228,  2.21853,  2.61163,  2.85032,
+  0.288129,  0.434441,  0.629313,  0.856153,  1.28967,  1.42452,  1.8758,  2.15024,  2.35181,  2.53684,
+  0.160031,  0.230716,  0.406654,  0.870424,  1.15652,  1.39232,  1.8041,  1.95144,  2.21048,  2.73516,
+  0.22934,  0.293962,  0.503222,  1.2421,  1.47582,  1.62465,  1.99868,  2.1445,  2.57855,  2.75327,
+  0.15877,  0.220035,  0.363386,  0.577761,  0.96309,  1.17494,  1.73817,  1.9792,  2.16244,  2.66192,
+  0.346062,  0.444816,  0.716985,  1.18072,  1.37058,  1.523,  1.89217,  2.06668,  2.3958,  2.62766,
+  0.307495,  0.38933,  0.612607,  0.969283,  1.55771,  1.83994,  1.99674,  2.17238,  2.42063,  2.5392,
+  0.437804,  0.726957,  1.29117,  1.5033,  1.76543,  1.96212,  2.16365,  2.33623,  2.57962,  2.70852,
+  0.232184,  0.333678,  0.528368,  0.706749,  1.20328,  1.37902,  1.61116,  2.15468,  2.5929,  2.75032,
+  0.272652,  0.46171,  0.625777,  0.839609,  1.34202,  1.49673,  1.71538,  2.13757,  2.37004,  2.59739,
+  0.184908,  0.302324,  0.454883,  0.880307,  1.10438,  1.29253,  1.7772,  1.94336,  2.44417,  2.62273,
+  0.265644,  0.341261,  0.553228,  1.13947,  1.42715,  1.56044,  1.93394,  2.08413,  2.39331,  2.65413,
+  0.16792,  0.207301,  0.370331,  0.525538,  1.03089,  1.36816,  1.78247,  2.0624,  2.33276,  2.5263,
+  0.343172,  0.433912,  0.717501,  0.889734,  1.05206,  1.69528,  2.05316,  2.20846,  2.60887,  2.71832,
+  0.216527,  0.305247,  0.44589,  0.729271,  1.63974,  1.90328,  2.05335,  2.22125,  2.43225,  2.56802,
+  0.110545,  0.209955,  0.844788,  1.1742,  1.4922,  1.81024,  2.17727,  2.4405,  2.69729,  2.83523,
+  0.217384,  0.337412,  0.488999,  0.761842,  0.879715,  1.20953,  1.97075,  2.1208,  2.61165,  2.79176,
+  0.190459,  0.296484,  0.469967,  0.800649,  1.10556,  1.27853,  1.51694,  1.69307,  2.11442,  2.71674,
+  0.134814,  0.175978,  0.300425,  0.496817,  1.2443,  1.48531,  1.86172,  2.13123,  2.48505,  2.77388,
+  0.210174,  0.278266,  0.435508,  0.927538,  1.60691,  1.7539,  1.95755,  2.16628,  2.39852,  2.74961,
+  0.213766,  0.3153,  0.509924,  0.70993,  0.964724,  1.10678,  1.38261,  2.00107,  2.32321,  2.56531,
+  0.400615,  0.524954,  0.798552,  1.01285,  1.13549,  1.47485,  1.98903,  2.13091,  2.50797,  2.67946,
+  0.2494,  0.377023,  0.519635,  0.754227,  1.45956,  1.64276,  1.82896,  2.07788,  2.29823,  2.46753,
+  0.473365,  0.683973,  1.05234,  1.37583,  1.54811,  1.74759,  2.1393,  2.31877,  2.60998,  2.73925,
+  0.203877,  0.341791,  0.48518,  0.884069,  1.09759,  1.26953,  1.47992,  1.75788,  2.6484,  2.82239,
+  0.273046,  0.404254,  0.555403,  0.954547,  1.29123,  1.39902,  1.72289,  1.90344,  2.17198,  2.64531,
+  0.040369,  0.117266,  0.617136,  0.892043,  1.26033,  1.54165,  1.85938,  2.1531,  2.49823,  2.76189,
+  0.132414,  0.211358,  0.742445,  1.06686,  1.33108,  1.57079,  1.86746,  2.13253,  2.47962,  2.73108,
+  0.237329,  0.326529,  0.612538,  0.790663,  0.990133,  1.41374,  1.73823,  1.93691,  2.16773,  2.45163,
+  0.27396,  0.405794,  0.57253,  0.933672,  1.05782,  1.39795,  1.85653,  1.99755,  2.59949,  2.76004,
+  0.199334,  0.29838,  0.442931,  0.628638,  1.30321,  1.64014,  1.80402,  2.11302,  2.37545,  2.54895,
+  0.350188,  0.50201,  0.821298,  1.03864,  1.36929,  1.5924,  1.91082,  2.15649,  2.46051,  2.65326,
+  0.281558,  0.399892,  0.573105,  0.753299,  0.900613,  1.05457,  1.58199,  2.17844,  2.43035,  2.61604,
+  0.344653,  0.543532,  0.703715,  0.862285,  1.19822,  1.33821,  1.57908,  2.06077,  2.30675,  2.48575,
+  0.220701,  0.326795,  0.520618,  0.755133,  1.29555,  1.45189,  1.6905,  2.20005,  2.41427,  2.61591,
+  0.279478,  0.332193,  0.801527,  1.34597,  1.48748,  1.6785,  1.9222,  2.10002,  2.58557,  2.71339,
+  0.163502,  0.212169,  0.365096,  0.525464,  0.869846,  1.20881,  1.79399,  2.04031,  2.29718,  2.4698,
+  0.285531,  0.341488,  0.754059,  1.17002,  1.30084,  1.5137,  1.69986,  1.88992,  2.58146,  2.70687,
+  0.249595,  0.366997,  0.626427,  0.945219,  1.40704,  1.56056,  1.83166,  2.23115,  2.46635,  2.65452,
+  0.271671,  0.443136,  1.15641,  1.40646,  1.67652,  1.85648,  2.06322,  2.2305,  2.47584,  2.63958,
+  0.28662,  0.427806,  0.63732,  0.803409,  0.996161,  1.26638,  1.68175,  2.00397,  2.39465,  2.58855,
+  0.314906,  0.440519,  0.612129,  0.896126,  1.47241,  1.71769,  1.88135,  2.09944,  2.36917,  2.49547,
+  0.170277,  0.25127,  0.405477,  0.915641,  1.12689,  1.43663,  1.71477,  1.8932,  2.55299,  2.73852,
+  0.27941,  0.337137,  0.734563,  1.28105,  1.4806,  1.61188,  1.85321,  1.99488,  2.41605,  2.65483,
+  0.165776,  0.226083,  0.417544,  0.744574,  1.04447,  1.53489,  1.80849,  1.94495,  2.13849,  2.60179,
+  0.264579,  0.336652,  0.542033,  0.71019,  0.913338,  1.65575,  1.81776,  2.23196,  2.52444,  2.65852,
+  0.158194,  0.235588,  0.338347,  0.541657,  1.58338,  1.76629,  2.00914,  2.24334,  2.50394,  2.77516,
+  0.332612,  0.50962,  0.822935,  1.07588,  1.45429,  1.65079,  1.97445,  2.25128,  2.53734,  2.74512,
+  0.262817,  0.359709,  0.520893,  0.707667,  0.818364,  1.43885,  1.97125,  2.08767,  2.49701,  2.64644,
+  0.2332,  0.399599,  0.612456,  0.775547,  1.19919,  1.35576,  1.6469,  2.13625,  2.34249,  2.69574,
+  0.149687,  0.238538,  0.372248,  0.63452,  1.25581,  1.43379,  1.77004,  1.92875,  2.61191,  2.82493,
+  0.137016,  0.210297,  0.591489,  1.12545,  1.37565,  1.6853,  2.08961,  2.39089,  2.70446,  2.84443,
+  0.21349,  0.341024,  0.541716,  0.750061,  1.0882,  1.24458,  1.55534,  1.96557,  2.1879,  2.38371,
+  0.300159,  0.489291,  0.825022,  1.0371,  1.19409,  1.34738,  1.68475,  2.02494,  2.46561,  2.74097,
+  0.170029,  0.255033,  0.392758,  0.727117,  1.38207,  1.57968,  1.80091,  1.95907,  2.28234,  2.7288,
+  0.175883,  0.365509,  1.11217,  1.38587,  1.72039,  1.97781,  2.2453,  2.42161,  2.62957,  2.754,
+  0.16259,  0.248164,  0.45463,  0.763209,  0.966031,  1.28234,  1.73074,  1.93805,  2.47938,  2.66756,
+  0.258043,  0.345866,  0.55652,  0.981312,  1.36153,  1.48238,  1.87224,  2.15823,  2.36227,  2.55503,
+  0.234139,  0.348843,  0.528234,  0.987884,  1.19522,  1.42215,  1.96003,  2.12737,  2.60332,  2.793,
+  0.179699,  0.559209,  0.867682,  1.08884,  1.31689,  1.5715,  1.9222,  2.19739,  2.50112,  2.72868,
+  0.216784,  0.310791,  0.487492,  0.932903,  1.20195,  1.36655,  1.8004,  1.9775,  2.17426,  2.53707,
+  0.186878,  0.400655,  0.580952,  0.846287,  1.10387,  1.26678,  1.84277,  2.01959,  2.488,  2.71722,
+  0.164641,  0.248712,  0.389358,  0.772822,  1.21256,  1.36992,  2.02587,  2.27762,  2.61752,  2.80953,
+  0.351899,  0.520326,  0.926597,  1.21965,  1.50984,  1.67684,  1.92174,  2.11125,  2.35638,  2.54593,
+  0.242182,  0.365285,  0.506156,  0.71602,  0.865221,  1.01169,  1.78692,  2.12298,  2.35088,  2.76773,
+  0.413776,  0.559566,  0.7358,  0.928997,  1.07912,  1.26718,  1.88007,  2.15249,  2.32483,  2.53986,
+  0.210597,  0.329568,  0.469735,  0.78859,  1.21549,  1.31981,  1.71146,  2.05899,  2.24544,  2.65373,
+  0.197937,  0.254148,  0.477985,  1.22709,  1.62992,  1.76743,  2.18698,  2.3851,  2.59487,  2.72554,
+  0.205489,  0.333855,  0.523915,  0.706275,  1.10215,  1.24661,  1.6489,  2.02683,  2.28169,  2.75931,
+  0.230328,  0.322431,  0.861834,  1.14561,  1.34721,  1.57611,  1.80728,  2.00482,  2.35437,  2.57225,
+  0.224898,  0.282022,  0.506636,  1.1523,  1.62656,  1.75209,  2.02818,  2.21882,  2.48896,  2.67046,
+  0.313732,  0.625469,  1.16447,  1.49908,  1.74961,  2.01853,  2.26223,  2.4296,  2.69216,  2.8225,
+  0.375623,  0.575307,  0.7912,  0.93577,  1.09694,  1.34339,  1.80799,  2.18731,  2.51972,  2.6948,
+  0.236981,  0.332412,  0.47927,  0.844461,  1.34764,  1.49073,  1.68394,  2.03914,  2.29762,  2.45843,
+  0.129047,  0.20625,  0.636751,  0.865101,  1.13689,  1.35661,  1.7048,  1.91668,  2.51836,  2.75632,
+  0.195171,  0.266517,  0.414793,  1.23956,  1.45291,  1.60836,  1.83305,  2.0478,  2.47352,  2.62199,
+  0.165853,  0.21272,  0.372757,  0.536136,  1.01394,  1.33963,  1.55512,  1.94574,  2.23628,  2.44095,
+  0.256981,  0.368868,  0.635878,  0.802543,  1.08476,  1.43912,  1.81473,  2.12052,  2.45815,  2.62146,
+  0.214382,  0.297135,  0.445091,  0.70205,  1.3651,  1.85126,  2.06703,  2.2073,  2.47073,  2.61243,
+  0.34071,  0.532103,  0.935278,  1.17102,  1.37789,  1.6386,  1.96527,  2.24616,  2.63127,  2.80634,
+  0.310524,  0.412051,  0.582478,  0.768755,  0.871594,  1.11985,  1.92635,  2.20751,  2.40709,  2.63663,
+  0.249349,  0.443517,  0.631532,  0.810096,  1.20513,  1.35721,  1.6074,  1.98416,  2.20802,  2.64511,
+  0.14309,  0.185312,  0.325214,  0.504,  1.13447,  1.32791,  1.67365,  2.0069,  2.38928,  2.74609,
+  0.226575,  0.298946,  0.453938,  0.998061,  1.3946,  1.59728,  2.06418,  2.22325,  2.42547,  2.56946,
+  0.183924,  0.255181,  0.415834,  0.624247,  1.04234,  1.20308,  1.55524,  2.12531,  2.40035,  2.66192,
+  0.27561,  0.365968,  0.654909,  0.990108,  1.1708,  1.45533,  2.07756,  2.25267,  2.50232,  2.68595,
+  0.204334,  0.287844,  0.39481,  0.761295,  1.5012,  1.78471,  1.93557,  2.15283,  2.34926,  2.54564,
+  0.342976,  0.527539,  0.917466,  1.16059,  1.49953,  1.76183,  2.09527,  2.30187,  2.54057,  2.69469,
+  0.202374,  0.333367,  0.480179,  0.708677,  0.819505,  1.10529,  1.80664,  1.95335,  2.61084,  2.7975,
+  0.307033,  0.368471,  0.602486,  1.10861,  1.41335,  1.52864,  1.79852,  1.98614,  2.16905,  2.43726,
+  0.144073,  0.196932,  0.386988,  0.819061,  1.28977,  1.62507,  1.90192,  2.13611,  2.48302,  2.70797,
+  0.17676,  0.268627,  0.662082,  1.05687,  1.54797,  1.71139,  1.97294,  2.24991,  2.54447,  2.76109,
+  0.191409,  0.292985,  0.492193,  0.800526,  1.04184,  1.27855,  1.83663,  2.02868,  2.24939,  2.62778,
+  0.324102,  0.399146,  0.687435,  0.868704,  1.02296,  1.58208,  1.85385,  1.98188,  2.55491,  2.67706,
+  0.229172,  0.302836,  0.481418,  0.704363,  0.967567,  1.82827,  2.0973,  2.25847,  2.54911,  2.70465,
+  0.467124,  0.696788,  0.9395,  1.09499,  1.27754,  1.4885,  1.89628,  2.15847,  2.47418,  2.65999,
+  0.175418,  0.234039,  0.367674,  0.513586,  0.747619,  1.0084,  1.58316,  2.05311,  2.36329,  2.68115,
+  0.410273,  0.561949,  0.736215,  0.956685,  1.13569,  1.28842,  1.75061,  1.93771,  2.15132,  2.48934,
+  0.204541,  0.277613,  0.529607,  0.722971,  1.19998,  1.44734,  1.71563,  1.92105,  2.35778,  2.50749,
+  0.253116,  0.311907,  0.696982,  1.32008,  1.57542,  1.70532,  2.00507,  2.16867,  2.46188,  2.66505,
+  0.163657,  0.237902,  0.393374,  0.60949,  0.854272,  1.08998,  1.52639,  1.84234,  2.12625,  2.67905,
+  0.448627,  0.530664,  0.812719,  1.0952,  1.20764,  1.57541,  1.88421,  2.0343,  2.55301,  2.68835,
+  0.262717,  0.338748,  0.512685,  1.00354,  1.48018,  1.62208,  1.82852,  2.14242,  2.35646,  2.51153,
+  0.417111,  0.636688,  1.03657,  1.31988,  1.67992,  1.87339,  2.07372,  2.2494,  2.50773,  2.65105,
+  0.263698,  0.461151,  0.618737,  0.830471,  1.00404,  1.15887,  1.80157,  2.02022,  2.30656,  2.74304,
+  0.387779,  0.575108,  0.729791,  0.932981,  1.36116,  1.50516,  1.75118,  2.06847,  2.33826,  2.48764,
+  0.18151,  0.265666,  0.454631,  1.08238,  1.2873,  1.5792,  1.85118,  2.09696,  2.46724,  2.64693,
+  0.277668,  0.345119,  0.602341,  1.1792,  1.37899,  1.54562,  1.81386,  1.96259,  2.4918,  2.66445,
+  0.17932,  0.24808,  0.456925,  0.722589,  1.12693,  1.57945,  1.7994,  1.95067,  2.48412,  2.70724,
+  0.314322,  0.381145,  0.608651,  0.727613,  0.890472,  1.61028,  2.13617,  2.25836,  2.59638,  2.70978,
+  0.189539,  0.266068,  0.419729,  0.651693,  1.41016,  1.64311,  1.85481,  2.27558,  2.49205,  2.72201,
+  0.254466,  0.313038,  0.594149,  1.01254,  1.68881,  1.93546,  2.11918,  2.28787,  2.53554,  2.66793,
+  0.134691,  0.171906,  0.30274,  0.492936,  0.899551,  1.22919,  1.73394,  2.01288,  2.44634,  2.74276,
+  0.231556,  0.365068,  0.680761,  0.889142,  1.11134,  1.2959,  1.54264,  1.97178,  2.42756,  2.63191,
+  0.222525,  0.305606,  0.527193,  0.687519,  1.18138,  1.67176,  1.86368,  2.07202,  2.63452,  2.77927,
+  0.17877,  0.237415,  0.37516,  0.856692,  1.67368,  1.81374,  2.01679,  2.27242,  2.5226,  2.73596,
+  0.193532,  0.268731,  0.451328,  0.753471,  0.984854,  1.28535,  1.68565,  1.88412,  2.09168,  2.24342,
+  0.476037,  0.65161,  0.801054,  1.01016,  1.24137,  1.35584,  1.77598,  2.08615,  2.27291,  2.45435,
+  0.211657,  0.308331,  0.421366,  0.865966,  1.41877,  1.55674,  1.78615,  2.02033,  2.19859,  2.63198,
+  0.203789,  0.490794,  1.01014,  1.27501,  1.47221,  1.81014,  2.17064,  2.43766,  2.66212,  2.78806,
+  0.174355,  0.252095,  0.674715,  0.842194,  1.05509,  1.278,  1.69868,  2.07056,  2.39938,  2.65743,
+  0.245109,  0.324049,  0.628822,  0.92791,  1.1236,  1.58007,  1.87864,  2.0546,  2.35872,  2.54684,
+  0.182644,  0.253804,  0.386248,  0.614056,  1.36482,  1.54588,  2.04017,  2.21883,  2.41901,  2.62461,
+  0.295605,  0.367794,  0.690701,  1.05516,  1.1866,  1.64445,  1.94415,  2.10144,  2.56212,  2.69127,
+  0.220878,  0.289573,  0.640307,  0.822072,  1.14406,  1.5678,  1.76641,  1.90811,  2.10346,  2.56049,
+  0.403453,  0.526298,  0.732204,  0.90115,  1.03587,  1.33938,  1.78399,  1.94196,  2.37103,  2.62665,
+  0.212825,  0.25857,  0.471588,  0.685549,  1.26374,  1.82105,  2.16382,  2.2884,  2.62806,  2.78816,
+  0.401181,  0.642053,  1.03247,  1.23611,  1.44445,  1.68668,  2.00672,  2.22851,  2.57211,  2.72396,
+  0.239433,  0.341091,  0.492629,  0.70763,  0.881426,  1.03082,  1.71925,  2.34406,  2.57906,  2.75694,
+  0.294093,  0.38277,  0.577412,  1.00928,  1.31304,  1.4193,  1.74467,  2.09423,  2.28904,  2.47584,
+  0.169805,  0.236922,  0.403314,  0.638995,  1.17645,  1.35214,  1.66557,  1.90976,  2.15012,  2.71624,
+  0.210447,  0.277913,  0.452474,  1.40269,  1.51343,  1.72094,  1.90394,  2.2785,  2.58376,  2.74318,
+  0.159574,  0.225382,  0.374008,  0.714137,  1.01125,  1.37171,  1.69916,  1.87159,  2.02706,  2.49119,
+  0.258602,  0.557253,  0.81972,  1.03886,  1.30147,  1.44536,  1.83061,  2.09817,  2.32081,  2.54107,
+  0.232756,  0.282242,  0.631974,  0.898694,  1.53744,  1.86922,  2.06397,  2.23446,  2.49823,  2.63352,
+  0.580133,  0.997946,  1.32096,  1.48187,  1.73161,  1.89858,  2.12071,  2.29013,  2.53009,  2.65166,
+  0.21184,  0.307093,  0.45336,  0.945579,  1.25082,  1.49029,  1.72414,  2.2811,  2.5627,  2.7526,
+  0.314276,  0.493555,  0.667782,  0.8965,  1.32301,  1.48262,  1.66749,  1.97441,  2.42735,  2.55568,
+  0.182455,  0.261592,  0.418011,  1.05093,  1.26139,  1.44337,  1.66547,  1.93903,  2.44469,  2.63845,
+  0.24157,  0.306934,  0.491293,  1.10595,  1.55483,  1.66652,  1.92392,  2.08765,  2.3676,  2.65489,
+  0.190084,  0.25485,  0.454062,  0.724519,  1.08336,  1.39389,  1.89234,  2.08886,  2.32176,  2.4843,
+  0.306497,  0.389831,  0.721793,  0.839714,  1.12475,  1.6524,  1.82292,  2.27331,  2.5692,  2.6696,
+  0.1862,  0.27346,  0.383201,  0.564758,  1.51107,  1.84502,  1.99828,  2.1941,  2.38869,  2.58792,
+  0.300722,  0.478218,  0.823364,  1.12749,  1.59114,  1.87135,  2.17472,  2.40318,  2.62478,  2.7824,
+  0.228884,  0.358342,  0.504622,  0.795874,  1.00562,  1.15261,  1.90805,  2.12479,  2.37247,  2.79758,
+  0.171885,  0.248234,  0.432842,  0.833143,  1.04089,  1.26929,  1.66164,  1.91863,  2.15896,  2.6534,
+  0.140943,  0.193684,  0.343025,  0.562303,  1.06955,  1.54333,  1.82447,  1.96164,  2.46351,  2.77054,
+  0.173053,  0.245656,  0.360656,  0.960618,  1.58953,  1.68991,  1.98414,  2.143,  2.58839,  2.7594,
+  0.24018,  0.429951,  0.63744,  0.786596,  1.06915,  1.22657,  1.47088,  1.95205,  2.19506,  2.61597,
+  0.367862,  0.471897,  0.730834,  1.08232,  1.22629,  1.46293,  1.92817,  2.05247,  2.40674,  2.66246,
+  0.247175,  0.358209,  0.535946,  0.781876,  1.3637,  1.63524,  1.80723,  1.99378,  2.45277,  2.60104,
+  0.445578,  0.687898,  1.11411,  1.30103,  1.5774,  1.88604,  2.2249,  2.43653,  2.65969,  2.76103,
+  0.214389,  0.336025,  0.487794,  0.759534,  0.970518,  1.1411,  1.45733,  1.62464,  2.30692,  2.71527,
+  0.3773,  0.466775,  0.716121,  1.08378,  1.25654,  1.41124,  1.78943,  1.93637,  2.20557,  2.56236,
+  0.148362,  0.214593,  0.545023,  0.840437,  1.19333,  1.48066,  1.79187,  2.08342,  2.41054,  2.67613,
+  0.150403,  0.278398,  0.792676,  0.97668,  1.21885,  1.40524,  1.77506,  2.16246,  2.54786,  2.74638,
+  0.236301,  0.328633,  0.630867,  0.839915,  1.04235,  1.29887,  1.62775,  1.83949,  2.29893,  2.49396,
+  0.337889,  0.49792,  0.711277,  0.85042,  0.992027,  1.24688,  1.71075,  2.08668,  2.52716,  2.70716,
+  0.172215,  0.23654,  0.372897,  0.525146,  1.18258,  1.73573,  1.92703,  2.11462,  2.31917,  2.54278,
+  0.415304,  0.624807,  0.906616,  1.11784,  1.44615,  1.66942,  1.94841,  2.17282,  2.50453,  2.67075,
+  0.265417,  0.407241,  0.613894,  0.816534,  0.980063,  1.15606,  1.75675,  2.27485,  2.49719,  2.71224,
+  0.27644,  0.468209,  0.649518,  0.816686,  1.19517,  1.35552,  1.54923,  1.93527,  2.21787,  2.42698,
+  0.188925,  0.277012,  0.412665,  0.672627,  1.35481,  1.51452,  1.69999,  2.14455,  2.38219,  2.58608,
+  0.24263,  0.352485,  0.912974,  1.34378,  1.60443,  1.80187,  2.01479,  2.19307,  2.46081,  2.632,
+  0.190903,  0.285841,  0.44907,  0.760328,  0.954285,  1.18294,  1.69264,  1.87816,  2.27684,  2.46596,
+  0.220659,  0.300374,  0.721694,  0.947306,  1.29833,  1.56298,  1.76062,  1.88825,  2.50644,  2.68968,
+  0.213168,  0.290928,  0.695227,  0.918179,  1.37819,  1.63199,  1.84789,  2.00307,  2.35836,  2.61935,
+  0.328586,  0.517244,  0.93732,  1.37624,  1.57484,  1.76435,  2.05863,  2.22433,  2.58444,  2.75665,
+  0.248486,  0.367007,  0.562147,  0.750632,  0.902785,  1.14756,  1.63742,  1.91206,  2.41399,  2.6057,
+  0.310691,  0.477895,  0.670796,  0.940507,  1.41829,  1.5635,  1.80514,  2.11408,  2.37636,  2.53516,
+  0.256555,  0.41421,  0.559427,  0.981289,  1.19165,  1.37831,  1.6784,  1.84931,  2.5767,  2.75663,
+  0.291424,  0.335003,  0.750149,  1.28965,  1.43721,  1.59999,  1.80318,  1.96741,  2.60175,  2.73376,
+  0.195254,  0.279513,  0.451755,  0.649111,  0.828694,  1.60951,  1.91491,  2.09122,  2.31959,  2.5349,
+  0.222304,  0.332624,  0.475678,  0.685205,  1.03033,  1.73722,  1.92098,  2.37829,  2.70672,  2.81773,
+  0.164833,  0.240093,  0.359862,  0.801929,  1.51368,  1.64171,  2.04052,  2.24884,  2.48866,  2.71403,
+  0.214777,  0.287322,  0.572644,  1.14507,  1.36711,  1.75269,  2.04242,  2.22207,  2.54305,  2.69789,
+  0.226099,  0.330382,  0.474439,  0.687757,  0.799187,  1.31984,  1.94457,  2.0781,  2.3678,  2.50846,
+  0.24454,  0.392163,  0.553692,  0.729765,  1.24786,  1.44838,  1.61759,  2.07464,  2.34005,  2.51806,
+  0.175381,  0.314231,  0.446023,  0.797404,  1.32846,  1.43973,  1.79335,  1.93957,  2.4688,  2.72165,
+  0.205808,  0.29367,  0.452447,  1.07427,  1.28823,  1.65563,  1.8575,  2.36469,  2.63981,  2.79814,
+  0.253926,  0.392653,  0.587584,  0.800134,  0.97631,  1.18559,  1.57069,  1.82141,  2.09089,  2.34902,
+  0.322461,  0.410912,  0.723569,  1.06064,  1.20152,  1.40036,  1.57919,  1.78876,  2.46024,  2.6166,
+  0.211266,  0.304981,  0.436011,  0.771978,  1.49062,  1.67775,  1.88623,  2.1135,  2.32635,  2.72726,
+  0.235012,  0.406911,  0.864785,  1.29148,  1.70829,  1.93855,  2.1799,  2.3524,  2.56379,  2.71145,
+  0.176814,  0.26862,  0.445837,  0.823113,  1.02978,  1.27157,  1.62339,  1.81122,  2.40214,  2.61417,
+  0.241865,  0.339268,  0.507509,  1.00368,  1.20435,  1.37256,  1.94079,  2.10137,  2.38561,  2.66998,
+  0.230878,  0.334743,  0.50037,  0.879929,  1.02189,  1.53377,  1.97079,  2.12897,  2.56726,  2.71729,
+  0.297505,  0.451574,  0.748848,  0.988527,  1.36624,  1.60667,  1.89466,  2.17448,  2.52143,  2.75917,
+  0.199265,  0.271145,  0.49816,  0.854679,  1.1721,  1.36415,  1.76208,  1.96909,  2.17354,  2.31163,
+  0.222173,  0.424864,  0.564942,  0.829809,  1.03817,  1.19405,  1.7206,  1.85809,  2.43176,  2.74146,
+  0.181961,  0.226819,  0.390513,  0.556339,  1.0566,  1.55306,  2.12835,  2.25802,  2.6025,  2.80212,
+  0.3576,  0.565047,  1.15301,  1.35031,  1.53358,  1.71854,  1.95789,  2.17535,  2.50565,  2.67849,
+  0.162257,  0.236808,  0.374039,  0.570569,  0.748034,  1.17226,  1.82339,  2.05303,  2.51377,  2.77207,
+  0.305794,  0.46587,  0.645121,  0.88265,  1.14129,  1.26686,  1.70158,  2.00288,  2.18412,  2.41125,
+  0.231652,  0.380738,  0.549642,  0.83741,  1.22527,  1.33297,  1.85158,  2.11937,  2.31508,  2.73211,
+  0.235449,  0.286771,  0.684809,  1.34666,  1.52663,  1.70348,  2.10149,  2.25455,  2.57718,  2.71899,
+  0.23387,  0.446515,  0.60508,  0.814654,  1.05496,  1.1788,  1.63316,  1.84974,  2.13938,  2.73277,
+  0.271706,  0.335152,  0.857227,  1.25374,  1.38719,  1.70217,  1.89677,  2.19111,  2.48,  2.60136,
+  0.237386,  0.314549,  0.438339,  0.912164,  1.57776,  1.87779,  2.03279,  2.19704,  2.41232,  2.53648,
+  0.361168,  0.574093,  1.02384,  1.46852,  1.69056,  1.91737,  2.18737,  2.33403,  2.6691,  2.80629,
+  0.27848,  0.398742,  0.573342,  0.839212,  1.07389,  1.22209,  1.69168,  2.16526,  2.37741,  2.53688,
+  0.286018,  0.447947,  0.61506,  0.849446,  1.31947,  1.46358,  1.76995,  2.00103,  2.18943,  2.45038,
+  0.21944,  0.301601,  0.668534,  0.861094,  1.21,  1.49867,  1.74512,  1.87777,  2.31438,  2.6196,
+  0.223591,  0.352153,  0.598841,  1.21789,  1.35908,  1.59174,  1.77109,  2.21386,  2.56154,  2.73542,
+  0.176857,  0.236601,  0.395107,  0.634632,  1.13349,  1.33512,  1.77037,  1.98131,  2.20656,  2.33972,
+  0.334735,  0.402265,  0.659168,  0.781639,  0.975228,  1.665,  1.87207,  2.04753,  2.47696,  2.57398,
+  0.215968,  0.284755,  0.524241,  0.78146,  1.33481,  1.77238,  1.95388,  2.19421,  2.57825,  2.74194,
+  0.298193,  0.489879,  0.812985,  1.18369,  1.49642,  1.67998,  2.10879,  2.31656,  2.67378,  2.85161,
+  0.312989,  0.415446,  0.618011,  0.899096,  1.08368,  1.26338,  1.8874,  2.24306,  2.41945,  2.57048,
+  0.244471,  0.431115,  0.601512,  0.813139,  1.10216,  1.22106,  1.69244,  2.03316,  2.2218,  2.61984,
+  0.150949,  0.21906,  0.349217,  0.611327,  1.07711,  1.25055,  1.91552,  2.08398,  2.45,  2.79254,
+  0.161611,  0.218964,  0.445377,  0.927863,  1.45115,  1.76846,  2.13001,  2.36672,  2.666,  2.81405,
+  0.196,  0.297256,  0.497266,  0.6919,  1.08988,  1.27368,  1.51372,  2.00647,  2.27378,  2.57222,
+  0.335268,  0.460795,  0.685187,  0.867664,  1.01381,  1.47955,  2.01199,  2.16848,  2.57264,  2.71756,
+  0.257604,  0.340872,  0.499757,  0.843052,  1.39655,  1.83169,  2.03423,  2.17033,  2.42262,  2.5405,
+  0.417663,  0.631718,  0.955424,  1.19732,  1.6598,  1.87988,  2.1688,  2.35905,  2.57809,  2.69825,
+  0.162052,  0.251583,  0.4399,  0.660911,  0.903902,  1.3203,  1.62476,  1.77858,  2.53053,  2.79971,
+  0.256861,  0.322803,  0.68537,  1.08644,  1.26328,  1.56988,  1.85165,  2.01495,  2.26471,  2.44701,
+  0.125192,  0.176171,  0.336135,  0.7816,  1.20022,  1.43997,  1.80542,  2.07752,  2.46247,  2.73819,
+  0.102286,  0.191322,  0.774556,  1.07615,  1.36946,  1.62715,  1.97301,  2.236,  2.60937,  2.81298,
+  0.173442,  0.232622,  0.491622,  0.844157,  1.09524,  1.3708,  1.69697,  2.05141,  2.31606,  2.50205,
+  0.257531,  0.343598,  0.654071,  0.838985,  1.0481,  1.48747,  1.72538,  1.89742,  2.43051,  2.586,
+  0.1979,  0.276312,  0.440283,  0.705103,  1.26734,  1.7403,  1.93448,  2.15401,  2.4002,  2.62414,
+  0.40959,  0.596785,  0.983751,  1.18177,  1.37115,  1.50238,  1.75828,  2.01857,  2.38005,  2.59215,
+  0.231819,  0.33289,  0.483514,  0.644585,  0.816808,  0.926308,  1.4033,  2.23301,  2.46786,  2.67846,
+  0.25861,  0.340064,  0.670485,  0.908467,  1.10761,  1.45624,  1.75958,  1.93218,  2.11312,  2.31013,
+  0.184377,  0.249203,  0.410806,  0.587907,  1.3025,  1.51032,  1.72443,  1.98189,  2.2829,  2.42213,
+  0.25411,  0.313328,  0.659859,  1.26582,  1.41295,  1.66593,  1.92715,  2.10198,  2.55145,  2.67303,
+  0.161592,  0.23748,  0.376535,  0.637094,  0.823028,  1.13761,  1.69642,  1.87577,  2.40363,  2.63962,
+  0.384501,  0.466812,  0.740791,  0.938093,  1.06235,  1.50928,  1.74914,  1.9178,  2.54816,  2.67151,
+  0.333872,  0.419367,  0.638994,  1.09262,  1.52055,  1.64945,  1.86662,  2.14894,  2.34672,  2.50614,
+  0.426216,  0.686997,  1.23588,  1.42885,  1.61159,  1.79286,  2.01759,  2.23372,  2.54777,  2.69661,
+  0.262949,  0.367509,  0.530429,  0.741867,  0.872474,  1.0696,  1.74557,  2.06119,  2.28384,  2.49418,
+  0.335782,  0.547236,  0.716211,  0.919077,  1.27569,  1.40844,  1.68512,  1.96739,  2.21764,  2.44668,
+  0.227629,  0.330991,  0.486068,  1.11757,  1.30498,  1.51013,  1.75726,  1.94697,  2.62556,  2.7826,
+  0.35985,  0.436633,  0.750634,  1.20151,  1.33757,  1.59484,  1.97027,  2.11384,  2.57381,  2.72996,
+  0.211871,  0.304028,  0.512758,  0.663762,  1.08635,  1.63333,  1.81802,  2.12958,  2.39108,  2.60077,
+  0.196092,  0.279726,  0.434488,  0.624802,  0.772358,  1.40438,  1.94878,  2.16092,  2.63,  2.77518,
+  0.176304,  0.262521,  0.373719,  0.581101,  1.52011,  1.73617,  1.93323,  2.14017,  2.35813,  2.75352,
+  0.254932,  0.381411,  0.806187,  1.10229,  1.53452,  1.75028,  1.9709,  2.15987,  2.45592,  2.65841,
+  0.190385,  0.288656,  0.449066,  0.678174,  0.812376,  1.44933,  1.72866,  1.96632,  2.63881,  2.78955,
+  0.251178,  0.386509,  0.609363,  0.797102,  1.02416,  1.18173,  1.45466,  2.01263,  2.49309,  2.69893,
+  0.166654,  0.266226,  0.385171,  0.71199,  1.3979,  1.53235,  1.91597,  2.088,  2.56527,  2.78953,
+  0.238453,  0.306036,  0.449309,  0.876277,  1.52144,  1.93398,  2.13442,  2.26799,  2.5376,  2.65825,
+  0.161634,  0.219919,  0.353206,  0.524346,  0.961806,  1.20771,  1.68792,  1.91694,  2.16187,  2.32066,
+  0.413612,  0.597095,  0.793763,  0.98629,  1.28179,  1.41266,  1.65246,  2.01609,  2.38416,  2.52858,
+  0.228655,  0.341562,  0.480989,  0.988605,  1.371,  1.47742,  1.86103,  2.01585,  2.33975,  2.77315,
+  0.259092,  0.597012,  0.985224,  1.32174,  1.64335,  1.95737,  2.28868,  2.49747,  2.71649,  2.84447,
+  0.185652,  0.304664,  0.446232,  0.864434,  1.09179,  1.27377,  1.94257,  2.09554,  2.52465,  2.76824,
+  0.176687,  0.256678,  0.745652,  0.934909,  1.28376,  1.44006,  1.76524,  2.12209,  2.3881,  2.59055,
+  0.189805,  0.275637,  0.440995,  0.821356,  1.25602,  1.41098,  1.92978,  2.12014,  2.39603,  2.60464,
+  0.266823,  0.337688,  0.819408,  1.13475,  1.2892,  1.77703,  1.98289,  2.22175,  2.59029,  2.6981,
+  0.205348,  0.276512,  0.527305,  0.727412,  1.02465,  1.65398,  1.90418,  2.04661,  2.21792,  2.45566,
+  0.293498,  0.424494,  0.613795,  0.95613,  1.13398,  1.3248,  1.80903,  1.95392,  2.29385,  2.57588,
+  0.18312,  0.24965,  0.376204,  0.543914,  1.35083,  1.90722,  2.09255,  2.25571,  2.51439,  2.6879,
+  0.541205,  0.789796,  1.05895,  1.26942,  1.5039,  1.70219,  1.97018,  2.17544,  2.49681,  2.65224,
+  0.229326,  0.339475,  0.451881,  0.66121,  0.795832,  1.0738,  2.0271,  2.20637,  2.4789,  2.72678,
+  0.330006,  0.506868,  0.673076,  0.887406,  1.22877,  1.34923,  1.78129,  2.08658,  2.27776,  2.48003,
+  0.138389,  0.200001,  0.396259,  0.811975,  1.09071,  1.46041,  1.74549,  1.90427,  2.34825,  2.69989,
+  0.176584,  0.242161,  0.37827,  1.17785,  1.56472,  1.67817,  1.95162,  2.12141,  2.58011,  2.73713,
+  0.145852,  0.198423,  0.335644,  0.550505,  1.01973,  1.37119,  1.79763,  1.94383,  2.20749,  2.74647,
+  0.385078,  0.503696,  0.703239,  1.06999,  1.36574,  1.47205,  1.82583,  2.15964,  2.37128,  2.52097,
+  0.28495,  0.38805,  0.507352,  0.879125,  1.52353,  1.77624,  1.9296,  2.15756,  2.44799,  2.5864,
+  0.491116,  0.756155,  1.2552,  1.52246,  1.77658,  2.02812,  2.28606,  2.42977,  2.67911,  2.77616,
+  0.252477,  0.396081,  0.713022,  0.861502,  1.15222,  1.3708,  1.61401,  2.1448,  2.57407,  2.71253,
+  0.282756,  0.438437,  0.613566,  0.847746,  1.26077,  1.37906,  1.6422,  2.13754,  2.36837,  2.52216,
+  0.203971,  0.322195,  0.479842,  0.953133,  1.21128,  1.39763,  1.80081,  1.95452,  2.40348,  2.57371,
+  0.264533,  0.358424,  0.628768,  1.11124,  1.34025,  1.50648,  1.99959,  2.19411,  2.46141,  2.66736,
+  0.17773,  0.22368,  0.394553,  0.556177,  0.947415,  1.50064,  1.73353,  1.92605,  2.26147,  2.43605,
+  0.314223,  0.363636,  0.727886,  0.85188,  1.05384,  1.79813,  1.97435,  2.1826,  2.538,  2.62968,
+  0.201778,  0.2755,  0.404891,  0.747466,  1.50005,  1.84118,  1.99884,  2.22681,  2.48199,  2.66951,
+  0.132164,  0.314955,  0.821473,  1.19604,  1.42659,  1.69993,  2.03686,  2.3235,  2.68547,  2.82896,
+  0.223374,  0.347335,  0.50773,  0.773547,  0.967916,  1.13413,  1.9914,  2.30657,  2.52136,  2.78875,
+  0.312742,  0.449784,  0.583287,  0.934234,  1.26857,  1.36506,  1.5693,  1.68705,  2.0773,  2.59502,
+  0.124286,  0.162126,  0.29073,  0.654031,  1.23166,  1.53846,  1.89307,  2.18478,  2.56264,  2.79822,
+  0.177049,  0.251654,  0.367891,  0.912504,  1.55758,  1.69305,  1.89899,  2.07214,  2.35016,  2.64604,
+  0.240517,  0.378333,  0.547809,  0.754272,  0.973321,  1.10367,  1.57442,  2.02805,  2.21113,  2.56271,
+  0.427795,  0.519003,  0.771284,  0.93724,  1.08662,  1.60988,  1.87875,  2.05279,  2.53412,  2.65715,
+  0.22437,  0.317969,  0.439666,  0.812931,  1.3985,  1.62663,  1.79418,  2.114,  2.30916,  2.49684
+};
+  /* codebook/lspjvm2.txt */
+static const float codes1[] = {
+  0.005167,  -0.03731,  -0.002159,  0.016849,  0.130396,
+  0.039445,  0.03168,  -0.074412,  -0.031499,  0.060536,
+  0.019479,  -0.030564,  -0.048137,  -0.056279,  -0.027829,
+  0.020585,  -0.01127,  0.023913,  -0.005706,  0.011407,
+  -0.023217,  0.107455,  -0.037777,  0.00407,  -0.017279,
+  -0.090444,  0.007641,  0.099001,  -0.047913,  -0.017199,
+  0.0227,  -0.063865,  0.047213,  0.043843,  -0.036225,
+  0.001312,  -0.123861,  -0.038988,  0.058666,  0.074541,
+  0.039508,  0.1103,  0.013954,  -0.119228,  -0.035807,
+  -0.047392,  0.027035,  -0.004412,  -0.03265,  -0.03715,
+  0.002491,  -0.045447,  0.15826,  0.022828,  -0.030124,
+  -0.047856,  0.088744,  -0.009678,  0.106688,  0.08769,
+  -0.027941,  0.044084,  -0.0285,  0.018736,  -0.069969,
+  -0.035358,  -0.051568,  -0.030459,  -0.017899,  0.027632,
+  -0.018607,  -0.123557,  0.019228,  0.057485,  -0.028907,
+  0.019057,  0.038151,  -0.08022,  0.034222,  0.023081,
+  0.021312,  0.041905,  0.112903,  0.024092,  0.093974,
+  -0.116679,  0.015344,  -0.066059,  -0.096437,  0.004041,
+  -0.022464,  -0.11626,  0.047819,  -0.003921,  -0.073504,
+  0.001975,  -0.025869,  0.0282,  0.12269,  0.010627,
+  -0.035672,  0.078963,  -0.009686,  0.000743,  -0.147582,
+  0.016932,  -0.020291,  -0.096896,  -0.237875,  -0.029121,
+  0.017376,  -0.04013,  -0.053865,  0.15406,  -0.013215,
+  0.015215,  -0.019023,  -0.070604,  0.032265,  0.04034,
+  0.102365,  -0.022746,  0.019895,  0.05057,  0.008845,
+  -0.034134,  0.044441,  -0.049387,  -0.140481,  0.07257,
+  0.013023,  -0.006079,  0.037574,  0.004937,  -0.081501,
+  0.003696,  0.049908,  0.007355,  0.000403,  0.026006,
+  -0.008466,  0.08068,  0.061382,  -0.108985,  -0.08806,
+  -0.012275,  -0.081061,  0.020333,  -0.079001,  0.068724,
+  -0.014081,  -0.042609,  0.093365,  0.04412,  0.000303,
+  0.063391,  0.096574,  -0.105424,  0.039041,  0.010412,
+  -0.054031,  -0.084948,  0.080406,  -0.035883,  0.137428,
+  0.063037,  0.050562,  0.02469,  -0.031394,  0.13032,
+  -0.015501,  -0.078884,  -0.076886,  -0.013864,  -0.073587,
+  0.048778,  0.003814,  -0.031125,  0.046897,  0.028304,
+  0.048692,  0.132795,  0.06545,  0.059487,  -0.042396,
+  -0.176999,  0.056943,  -0.004135,  -0.049378,  -0.041083,
+  -0.039445,  -0.016292,  -0.00455,  0.06201,  -0.079613,
+  -0.054566,  -0.008476,  -0.01671,  0.049202,  0.025758,
+  -0.078723,  0.092091,  0.096536,  -0.065079,  0.021161,
+  0.076657,  0.009203,  -0.036866,  -0.016559,  0.012823,
+  0.008225,  -0.003006,  0.108033,  0.04312,  -0.06087,
+  -0.019346,  0.02279,  -0.001728,  0.062304,  -0.016965,
+  -0.001302,  -0.01449,  -0.041803,  -0.034058,  -0.197066,
+  -0.033655,  -0.127217,  -0.108681,  -0.010571,  -0.004705,
+  -0.015553,  -0.086069,  0.034109,  -0.101379,  0.002068,
+  -0.004003,  -0.044637,  -0.068617,  0.052228,  -0.047812,
+  -0.043307,  0.035681,  0.042207,  -0.055946,  0.055944,
+  -0.026792,  -0.012601,  -0.05671,  -0.021094,  0.105842,
+  -0.025598,  -0.078858,  -0.013487,  0.030728,  -0.031956,
+  0.031444,  0.022763,  0.025364,  0.121366,  0.070736,
+  -0.084556,  0.098118,  -0.024301,  -0.058655,  -0.043194,
+  -0.011752,  -0.043781,  0.091051,  -0.071201,  -0.02098,
+  0.082904,  -0.031657,  -0.088247,  0.066709,  -0.079182,
+  -0.012151,  0.011796,  -0.010589,  0.100656,  0.094539,
+  0.035967,  0.025338,  0.071826,  0.009741,  -0.040209,
+  0.006866,  -0.015095,  -0.168469,  -0.056133,  0.060145,
+  0.04583,  -0.068969,  0.034551,  0.015842,  -0.092809,
+  0.054699,  0.138744,  0.001726,  0.006927,  0.005167,
+  0.016978,  0.046384,  -0.060183,  -0.040742,  -0.072692,
+  -0.022489,  -0.029728,  -0.065018,  -0.124741,  0.044927,
+  -0.029057,  -0.037154,  0.031068,  0.060086,  0.009984,
+  0.009311,  -0.006957,  -0.105508,  0.059637,  -0.019564,
+  -0.068154,  -0.066443,  0.000799,  0.028579,  0.097063,
+  0.096936,  0.03023,  -0.034623,  -0.088918,  0.040334,
+  0.019439,  -0.050707,  -0.003294,  -0.028505,  -0.053599,
+  0.06246,  -0.070688,  -0.016465,  -0.03568,  0.017378,
+  0.009363,  0.048761,  0.043374,  0.039587,  -0.023232,
+  -0.067033,  0.042663,  0.05407,  -0.042797,  -0.089391,
+  -0.030497,  -0.050249,  0.059528,  0.089089,  -0.029633,
+  0.064125,  -0.086614,  -0.002005,  0.08062,  0.000502,
+  -0.00349,  0.097336,  0.099565,  0.015648,  0.006691,
+  0.077668,  0.016572,  0.035404,  -0.046026,  0.017237,
+  -0.048631,  0.009314,  0.141479,  0.017079,  0.043796,
+  -0.106474,  0.145951,  0.05774,  0.01125,  -0.059443,
+  0.027572,  0.02665,  0.008527,  0.002949,  -0.03768,
+  -0.077991,  -0.090617,  0.00342,  -0.04601,  0.007354,
+  0.019056,  -0.128651,  0.016464,  0.004584,  -0.030883,
+  -0.092069,  0.038976,  -0.08184,  0.066695,  -0.04734,
+  0.003513,  0.040613,  0.046815,  -0.023406,  0.062389,
+  0.021759,  0.024928,  -0.018922,  -0.048006,  0.0638,
+  -0.014416,  -0.050333,  0.042628,  -0.114934,  -0.10145,
+  0.062139,  0.029295,  -0.065908,  0.111463,  0.050781,
+  -0.022707,  0.135414,  0.003548,  0.134535,  -0.048259,
+  -0.092344,  -0.027727,  0.016343,  -0.060786,  -0.081502,
+  -0.005412,  -0.026229,  -0.143331,  0.052404,  -0.077298,
+  -0.035919,  -0.041968,  -0.106108,  -0.004369,  0.065028,
+  0.09637,  -0.053299,  0.043317,  -0.049735,  0.049815,
+  0.032324,  0.051309,  -0.009607,  -0.205917,  0.005023,
+  -0.054316,  -0.022895,  0.099327,  -0.006927,  -0.076574,
+  -0.111024,  0.111026,  0.038381,  -0.060368,  0.064238,
+  -0.034316,  0.026846,  0.02574,  -0.076162,  -0.163904,
+  0.055955,  -0.056885,  0.014831,  -0.120715,  0.090938,
+  0.035289,  -0.036439,  0.060012,  0.080302,  0.036215,
+  0.06525,  0.08303,  -0.058784,  0.104826,  -0.051805,
+  -0.011099,  -0.00642,  0.053042,  0.024127,  0.092534,
+  0.058569,  -0.033442,  0.025186,  -0.018222,  0.117744,
+  0.044345,  -0.042456,  -0.043767,  -0.021378,  -0.121965,
+  0.027371,  0.052731,  -0.020316,  0.036912,  0.115357,
+  0.03115,  0.041547,  0.059267,  -0.039672,  -0.086918,
+  -0.162369,  0.024801,  0.031725,  0.0834,  -0.034463,
+  0.000272,  -0.008147,  -0.002016,  0.131953,  -0.092911,
+  -0.091944,  -0.062864,  -0.005221,  0.063647,  -0.012658,
+  0.042685,  0.067952,  0.038644,  -0.153221,  0.096841,
+  0.108299,  0.089446,  -0.047164,  0.004196,  -0.043268,
+  -0.035456,  0.050838,  0.070444,  0.084465,  -0.07998,
+  -0.048916,  0.057726,  0.023894,  0.027653,  0.017775,
+  0.015461,  -0.030287,  -0.022245,  0.052081,  -0.150947,
+  -0.002682,  -0.056774,  -0.123366,  -0.091754,  0.006536,
+  0.006473,  -0.143025,  0.05469,  -0.043189,  0.03297,
+  0.027446,  0.033127,  -0.132722,  -0.010417,  -0.080097,
+  -0.018187,  0.001858,  0.11129,  -0.090749,  0.059434,
+  -0.068738,  0.090679,  -0.14507,  -0.065277,  0.063514,
+  -0.003982,  -0.056382,  -0.003673,  0.015845,  -0.073396,
+  0.043688,  0.002836,  0.069211,  0.124852,  -0.053313,
+  -0.040946,  0.07044,  -0.107024,  -0.019199,  -0.033672,
+  -0.00144,  0.02168,  0.110595,  -0.053452,  -0.052426,
+  0.035461,  -0.028179,  -0.049041,  0.02258,  -0.010989,
+  -0.002913,  -0.051691,  -0.075881,  0.037241,  0.076377,
+  0.034735,  -0.031556,  0.073516,  -0.001427,  0.016296,
+  -0.017537,  0.003346,  -0.099774,  -0.067624,  -0.044257,
+  -0.018202,  0.030622,  0.012773,  0.046475,  -0.121785,
+  -0.057265,  0.116179,  -0.079916,  0.066396,  0.050104,
+  -0.013177,  0.057766,  -0.047879,  -0.109526,  -0.146491,
+  0.032675,  -0.049318,  -0.057045,  -0.080068,  0.089621,
+  -0.046564,  -0.029992,  0.040828,  0.029281,  -0.037369,
+  -0.009731,  -0.082145,  -0.117622,  0.117077,  0.037369,
+  0.00082,  -0.106634,  -0.007967,  0.000812,  0.140637,
+  0.03653,  0.062121,  -0.065504,  -0.09493,  0.121336,
+  0.01753,  -0.01733,  -0.040402,  -0.018255,  0.010992,
+  0.019746,  -0.027564,  0.033588,  0.042466,  -0.003143,
+  0.013767,  0.084179,  0.033753,  -0.017279,  -0.009676,
+  -0.006452,  0.032645,  0.031852,  -0.030975,  -0.043384,
+  -0.005433,  -0.015258,  0.053273,  0.054748,  -0.064736,
+  0.008959,  -0.141223,  -0.032957,  -0.015079,  0.018198,
+  -0.001681,  0.143079,  0.076,  0.001037,  -0.048744,
+  0.022062,  0.02603,  -0.008263,  -0.050353,  -0.023037,
+  -0.036477,  -0.051733,  0.137823,  -0.034438,  -0.007573,
+  -0.004256,  0.064218,  0.075183,  0.095106,  0.026497,
+  0.02636,  0.009791,  -0.058039,  0.053315,  -0.077817,
+  -0.033283,  -0.081151,  -0.05522,  0.004268,  0.017539,
+  -0.007329,  -0.1172,  0.09322,  0.037359,  0.002718,
+  0.010749,  0.018281,  -0.0758,  -0.024889,  0.00572,
+  0.022129,  0.035613,  0.036187,  0.032246,  0.105439,
+  -0.073766,  0.016887,  -0.059934,  -0.049471,  0.07352,
+  -0.024041,  -0.104642,  0.023557,  -0.059746,  -0.043871,
+  0.022311,  -0.00025,  -0.074027,  0.198593,  0.102732,
+  0.024478,  0.077658,  -0.060042,  -0.018229,  -0.149648,
+  -0.009871,  -0.105822,  0.007585,  -0.161459,  -0.041121,
+  -0.02146,  0.00902,  -0.065018,  0.111801,  -0.024953,
+  0.074594,  -0.026041,  -0.062859,  0.009199,  0.069609,
+  0.078672,  -0.033414,  0.054128,  0.005408,  -0.016273,
+  0.052076,  0.10761,  -0.067518,  -0.0964,  0.033703,
+  -0.01435,  -0.024676,  0.056254,  -0.04377,  -0.060847,
+  -0.004185,  0.07355,  -0.05783,  -0.016644,  0.029096,
+  0.005755,  0.026472,  0.040449,  -0.09195,  -0.048538,
+  -0.034439,  -0.107938,  0.090712,  -0.117001,  0.04317,
+  -0.006505,  -0.035277,  0.117316,  0.127002,  0.047906,
+  -0.001441,  0.118379,  -0.132165,  0.00738,  0.023823,
+  -0.02012,  -0.083725,  0.047284,  0.023795,  0.074123,
+  -0.013439,  0.024994,  0.060254,  -0.06912,  0.166373,
+  -0.024228,  -0.06315,  -0.046506,  -0.077202,  -0.054592,
+  -0.006571,  0.010335,  -0.006568,  0.003982,  0.075837,
+  0.008643,  0.136339,  -0.005502,  0.03391,  -0.066379,
+  -0.127371,  -0.006954,  0.03977,  -0.070123,  0.060925,
+  -0.046386,  -0.02642,  -0.00528,  0.103509,  -0.02231,
+  -0.00374,  -0.014999,  -0.03777,  0.080005,  0.025231,
+  -0.054995,  0.071017,  0.009442,  -0.075737,  0.013441,
+  0.051947,  0.027097,  -0.070351,  -0.055705,  -0.021115,
+  0.021387,  0.029232,  0.163331,  -0.03238,  0.010008,
+  -0.011987,  -0.028631,  0.002665,  0.01477,  -0.009558,
+  -0.034325,  0.01583,  -0.091253,  -0.012677,  -0.107378,
+  -0.034624,  -0.047725,  -0.10233,  0.042525,  -0.006869,
+  0.014048,  -0.043127,  0.052384,  -0.047473,  0.055102,
+  0.009744,  -0.033646,  -0.081755,  -0.001464,  -0.016223,
+  -0.036697,  -0.002279,  0.023279,  -0.036221,  0.101478,
+  -0.058454,  0.065074,  0.003524,  0.00501,  0.097182,
+  -0.038171,  -0.037943,  -0.009994,  -0.033355,  -0.044552,
+  0.041318,  0.065041,  9.2e-05,  0.100816,  0.029007,
+  -0.031803,  0.183537,  -0.009617,  -0.010544,  -0.028465,
+  0.0069,  -0.014988,  0.09049,  -0.174817,  0.027464,
+  0.063314,  -0.049281,  -0.001567,  0.091421,  -0.078603,
+  -0.004869,  -0.063266,  -0.001922,  0.069338,  0.081771,
+  0.058737,  0.073195,  0.081676,  -0.047808,  -0.025797,
+  -0.004185,  0.033203,  -0.125472,  -0.108148,  0.031258,
+  0.035192,  0.029957,  0.046675,  0.047238,  -0.088197,
+  0.033315,  0.114919,  -0.04918,  0.025707,  0.053843,
+  0.035182,  0.140206,  -0.05866,  -0.025978,  -0.019658,
+  -0.014847,  -0.021051,  -0.034385,  -0.121789,  0.173406,
+  -0.112251,  -0.022333,  0.071206,  0.028998,  0.046468,
+  0.067704,  -0.026159,  -0.158316,  0.014936,  0.040216,
+  -0.010137,  -0.053492,  0.004935,  -0.011277,  0.073852,
+  0.091261,  0.114794,  -0.01406,  -0.051545,  0.077316,
+  0.101258,  -0.046137,  0.022994,  -0.066767,  -0.065537,
+  0.049952,  -0.043582,  0.012823,  0.009313,  0.036343,
+  0.054885,  0.037796,  0.02194,  0.013211,  0.006019,
+  -0.099578,  0.058596,  -0.045463,  -0.015632,  -0.087141,
+  -0.019273,  -0.03314,  0.043796,  0.119057,  -0.081813,
+  -0.021538,  -0.070453,  -0.052551,  0.077213,  9.4e-05,
+  0.050268,  0.092271,  0.051688,  -0.025224,  0.075437,
+  0.027983,  0.069205,  0.031787,  -0.099975,  0.004387,
+  -0.002747,  -0.056567,  0.161394,  0.000164,  0.084189,
+  -0.124844,  0.050329,  0.009844,  0.055877,  0.055701,
+  0.030479,  0.028843,  -0.001076,  -0.017173,  -0.10277,
+  -0.038426,  -0.133841,  -0.03584,  -0.072046,  0.020206,
+  0.016438,  -0.097885,  0.041857,  0.034601,  0.030422,
+  -0.089192,  -0.014112,  -0.052276,  0.012005,  -0.029335,
+  -0.011331,  0.101833,  0.063827,  0.044288,  0.101597,
+  -0.034689,  -0.027434,  -0.017801,  -0.079224,  0.067103,
+  -0.027456,  -0.098034,  0.009448,  -0.038986,  -0.156729,
+  0.085023,  0.033136,  -0.021343,  0.110701,  -0.011901,
+  -0.006484,  0.082023,  -0.027094,  0.091208,  -0.013163,
+  -0.012223,  0.005933,  0.010653,  -0.098119,  -0.005304,
+  -0.021061,  -0.058077,  -0.073035,  0.097856,  -0.102847,
+  -0.035329,  -0.092754,  -0.101463,  -0.048671,  0.055015,
+  0.102145,  0.062017,  0.016002,  0.036489,  0.059,
+  0.042861,  0.025447,  -0.019735,  -0.107841,  -0.033752,
+  -0.043982,  -0.067059,  0.051092,  0.025235,  -0.147107,
+  -0.016269,  0.123009,  0.035894,  -0.020453,  0.040013,
+  0.015557,  0.015825,  0.080712,  -0.06963,  -0.149739,
+  0.022006,  -0.008848,  0.040169,  -0.095688,  0.059575,
+  -0.030641,  -0.061353,  0.046302,  0.104489,  0.043372,
+  -0.001579,  0.059737,  -0.104073,  0.042342,  -0.048611,
+  -0.013811,  -0.056255,  0.107179,  0.057433,  0.084815,
+  0.030217,  0.02236,  -0.040342,  -0.028775,  0.120588,
+  0.04127,  -0.045775,  -0.030195,  -0.106859,  -0.104349,
+  0.072418,  -0.003603,  -0.013072,  0.040728,  0.086869,
+  0.091943,  0.066517,  0.024442,  -0.030929,  -0.03292,
+  -0.160336,  -0.010347,  -0.068458,  0.017458,  0.044823,
+  0.050694,  0.067625,  0.040303,  0.113164,  -0.038747,
+  -0.065558,  -0.106357,  -0.028352,  0.121488,  0.026548,
+  -0.00782,  0.054872,  0.094674,  -0.099533,  0.005231,
+  0.118132,  0.04278,  -0.065079,  0.03144,  0.043229,
+  -0.050024,  0.015943,  0.073917,  0.034049,  0.010548,
+  -0.024979,  0.022639,  0.027795,  0.049491,  0.048762,
+  -0.002738,  -0.010783,  -0.027637,  -0.006986,  -0.104141,
+  -0.066719,  -0.061742,  -0.067028,  -0.053057,  -0.003478,
+  -0.050948,  -0.122196,  0.022082,  0.002595,  0.015094,
+  0.006014,  0.005784,  -0.184537,  -0.034872,  -0.036104,
+  0.055412,  0.006886,  0.103488,  -0.063001,  0.096665,
+  -0.035533,  0.009847,  -0.095114,  0.008588,  0.023736,
+  -0.034278,  -0.11197,  -0.041172,  0.03973,  -0.102952,
+  0.063775,  0.039273,  0.109863,  0.0918,  0.030306,
+  -0.082206,  0.089449,  -0.058478,  -0.029341,  0.038389,
+  0.061057,  -0.024711,  0.111044,  -0.035079,  -0.027985,
+  0.01457,  0.002046,  -0.031545,  0.058848,  -0.0195,
+  -0.002475,  -0.025589,  -0.144358,  0.063478,  0.124927,
+  -0.014094,  -0.01097,  0.031621,  -0.040043,  0.004389,
+  0.025003,  0.052397,  -0.054526,  -0.073469,  0.026795,
+  -0.024697,  0.024739,  0.118299,  0.014948,  -0.132109,
+  0.020192,  0.037815,  -0.09027,  0.049313,  0.082764,
+  -0.022642,  -0.006053,  -0.038073,  -0.057363,  -0.107347,
+  0.033166,  -0.027556,  -0.019765,  -0.111958,  0.027773,
+  -0.063001,  -0.052998,  0.019353,  -0.009646,  -0.01127,
+  0.011872,  -0.006508,  -0.122226,  0.059824,  0.041779,
+  0.016445,  -0.03189,  -0.03631,  0.013085,  0.091631,
+  0.062866,  0.054501,  -0.117523,  -0.010907,  0.087026,
+  -0.014974,  -0.03592,  -0.048565,  -0.019246,  -0.043405,
+  -0.006959,  0.006211,  0.04237,  0.014603,  -0.006435,
+  0.019149,  0.078038,  -0.020556,  0.018114,  -0.036521,
+  -0.054036,  0.007325,  0.056349,  -0.033497,  -0.02596,
+  0.050184,  -0.066536,  0.091501,  0.071356,  -0.049044,
+  -0.032263,  -0.095268,  -0.008784,  0.049033,  0.036929,
+  0.020357,  0.152151,  0.040814,  -0.063159,  -0.024324,
+  -0.017084,  0.011876,  -0.015442,  -0.019811,  -0.000366,
+  -0.0027,  -0.072981,  0.109288,  0.007473,  -0.049442,
+  -0.05404,  0.051947,  0.019359,  0.12916,  0.021981,
+  0.002248,  0.035262,  -0.023141,  0.064666,  -0.078273,
+  -0.031663,  -0.031343,  -0.006058,  -0.045421,  0.017466,
+  -0.067122,  -0.130784,  0.067057,  0.05246,  -0.041165,
+  -0.004411,  0.046453,  -0.055461,  0.048162,  -0.009687,
+  0.02153,  0.007211,  0.104764,  0.079849,  0.086248,
+  -0.072791,  0.001112,  -0.027964,  -0.071233,  -0.013339,
+  0.007979,  -0.118231,  0.076826,  -0.060762,  -0.084358,
+  -0.011447,  0.009765,  0.014163,  0.164784,  -0.015892,
+  -0.020756,  0.152509,  -0.014014,  -0.041853,  -0.117008,
+  -0.011755,  -0.005766,  -0.086896,  -0.13965,  -0.032342,
+  0.025651,  -0.007843,  -0.039073,  0.103397,  -0.042591,
+  -0.005971,  -0.001324,  -0.053945,  -0.000716,  0.048977,
+  0.130185,  0.028226,  0.061179,  0.024489,  -0.021939,
+  -0.007019,  0.054336,  -0.01004,  -0.095411,  0.082406,
+  -0.03213,  -0.015054,  0.033059,  0.002802,  -0.080159,
+  -0.022452,  0.077426,  -0.015314,  0.033583,  0.028479,
+  0.023293,  0.035078,  0.006442,  -0.110541,  -0.106244,
+  -0.034737,  -0.10414,  -0.03457,  -0.114316,  0.079382,
+  0.006009,  0.003901,  0.080081,  0.055082,  0.012896,
+  0.064981,  0.057219,  -0.112986,  0.003906,  -0.028414,
+  -0.012383,  -0.054541,  0.077483,  0.004267,  0.123567,
+  0.007369,  0.099856,  0.023273,  -0.028194,  0.12203,
+  -0.036635,  -0.126589,  -0.034567,  -0.028288,  -0.06504,
+  0.01428,  0.011435,  -0.004867,  0.043901,  0.035395,
+  0.028599,  0.075858,  0.11846,  0.070581,  -0.051903,
+  -0.170905,  0.050352,  0.053514,  -0.017139,  0.021748,
+  -0.09661,  0.008904,  -0.001049,  0.078787,  -0.101201,
+  -0.026229,  -0.019757,  -0.035771,  0.054142,  0.068041,
+  -0.020328,  0.099979,  0.096623,  -0.046957,  -0.001733,
+  0.049586,  0.052458,  -0.031724,  -0.028332,  -0.005418,
+  0.04671,  0.014238,  0.133125,  -0.005428,  -0.080055,
+  -0.033226,  0.034007,  0.025272,  0.033924,  -0.044662,
+  -0.03469,  -0.079173,  -0.160689,  -0.153893,  -0.228771,
+  -0.00245,  -0.083966,  -0.168294,  0.010694,  -0.012167,
+  4e-06,  -0.044377,  0.023373,  -0.077437,  0.012178,
+  -0.015899,  -0.010828,  -0.062847,  0.029927,  -0.074557,
+  -0.053306,  0.049688,  0.057017,  -0.022571,  0.015337,
+  -0.046545,  0.018895,  -0.024848,  -0.004424,  0.165442,
+  -0.060201,  -0.098629,  -0.06519,  0.036582,  -0.038566,
+  0.051453,  0.093478,  0.039619,  0.117535,  0.090386,
+  -0.029366,  0.108075,  -0.016568,  -0.093576,  -0.048799,
+  -0.045599,  -0.023619,  0.070072,  -0.109294,  0.001548,
+  0.076285,  -0.091274,  -0.068829,  0.000215,  -0.046519,
+  -0.022512,  -0.027067,  0.014905,  0.079017,  0.140699,
+  0.061141,  0.009178,  0.097811,  0.033468,  -0.006666,
+  0.007163,  -0.007578,  -0.124238,  -0.025271,  0.017581,
+  0.042405,  -0.034252,  0.06489,  0.0025,  -0.139083,
+  0.009733,  0.158179,  0.014474,  0.038913,  0.05629,
+  -0.004998,  0.075401,  -0.030557,  -0.038595,  -0.04907,
+  -0.01468,  -0.076306,  -0.132365,  -0.177693,  0.09176,
+  -0.057238,  -0.072379,  0.050877,  0.051489,  0.028125,
+  0.004991,  0.032621,  -0.167359,  0.041002,  -0.007072,
+  -0.086405,  -0.042263,  -0.019757,  -0.011524,  0.066004,
+  0.08567,  0.008071,  -0.013614,  -0.062142,  0.08328,
+  0.000887,  -0.07582,  0.008295,  -0.020136,  -0.016886,
+  0.089657,  -0.10626,  -0.051491,  -0.012687,  0.054778,
+  0.011535,  0.086613,  0.053803,  0.027164,  -0.023825,
+  -0.040009,  0.080987,  0.026309,  -0.000334,  -0.085288,
+  -0.024208,  -0.08504,  0.096077,  0.120527,  -0.044181,
+  0.003034,  -0.091142,  0.006471,  0.115971,  -0.026358,
+  0.003489,  0.083633,  0.109975,  -0.029425,  0.061726,
+  0.056115,  -0.006711,  0.013158,  -0.062917,  -0.015029,
+  0.003354,  0.031574,  0.119045,  0.022859,  0.023777,
+  -0.068292,  0.115604,  0.031617,  0.008953,  0.006943,
+  0.01442,  0.008569,  -0.031547,  -0.006857,  -0.05169,
+  -0.086683,  -0.108339,  0.005093,  -0.108646,  -0.03472,
+  0.054273,  -0.096753,  0.050806,  -0.021115,  -0.025278,
+  -0.079997,  0.027008,  -0.034211,  0.090949,  0.005678,
+  0.019288,  0.042083,  0.062119,  0.019301,  0.040859,
+  -0.009113,  0.022427,  -0.004019,  -0.06089,  0.032884,
+  -0.012373,  -0.037976,  0.017625,  -0.079369,  -0.050788,
+  0.07972,  -0.039347,  -0.085324,  0.091044,  0.026653,
+  -0.063122,  0.099371,  -0.024736,  0.084631,  -0.100421,
+  -0.073313,  0.014317,  0.022555,  -0.116051,  -0.063966,
+  -0.009688,  -0.063666,  -0.131709,  0.016744,  -0.135028,
+  -0.003708,  -0.043685,  -0.121631,  -0.03693,  0.125776,
+  0.084333,  0.010114,  0.071231,  -0.010395,  0.059391,
+  0.01776,  0.033034,  -0.018996,  -0.13054,  0.025758,
+  -0.018261,  -0.060044,  0.127025,  -0.032724,  -0.107299,
+  -0.064538,  0.090073,  -0.010186,  -0.066127,  0.107025,
+  -0.01094,  0.003083,  0.01903,  -0.023935,  -0.140176,
+  0.003549,  -0.042402,  -0.010695,  -0.185915,  0.060835,
+  0.005405,  -0.013822,  0.029205,  0.079338,  0.068155,
+  0.071485,  0.030282,  -0.087207,  0.07348,  -0.02794,
+  0.004896,  -0.033246,  0.072637,  0.018017,  0.054712,
+  0.026184,  -0.005287,  0.034456,  -0.036753,  0.079232,
+  0.072707,  0.004506,  -0.039353,  -0.01556,  -0.071466,
+  0.010257,  0.067446,  -0.006598,  0.047396,  0.072218,
+  0.023405,  0.082663,  0.015319,  -0.035436,  -0.075461,
+  -0.124036,  -0.032046,  0.060837,  0.010231,  -0.053024,
+  0.0228,  0.042891,  -0.041549,  0.132395,  -0.09533,
+  -0.077091,  -0.058554,  -0.070632,  0.04757,  0.031856,
+  0.000127,  0.114996,  0.05866,  -0.092472,  0.064503,
+  0.09645,  0.0662,  -0.001059,  0.039487,  -0.032859,
+  -0.065721,  0.001601,  0.088037,  0.059828,  -0.047411,
+  -0.077714,  0.010275,  0.013629,  0.003304,  0.005407,
+  0.000665,  0.012927,  -0.077525,  0.069202,  -0.157417,
+  0.014547,  -0.095965,  -0.087546,  -0.067375,  -0.027867,
+  0.005458,  -0.095839,  0.105294,  -0.044892,  0.045151,
+  -0.001349,  0.038356,  -0.127152,  -0.080503,  -0.105423,
+  -0.018484,  0.008439,  0.104398,  -0.027959,  0.082086,
+  -0.020605,  0.042785,  -0.109139,  -0.025958,  0.079733,
+  0.036289,  -0.083773,  -0.033819,  0.032566,  -0.065556,
+  0.006659,  0.00209,  0.097027,  0.115715,  -0.013271,
+  -0.067514,  0.128365,  -0.089129,  0.02616,  -0.040584,
+  -0.002443,  -0.017254,  0.129204,  -0.110078,  -0.064943,
+  0.089215,  -0.022299,  -0.034959,  0.022446,  -0.019254,
+  -0.0389,  -0.069862,  -0.07054,  0.069949,  0.111993,
+  -0.006311,  -0.009057,  0.094278,  -0.014932,  0.003657,
+  -0.019323,  0.026145,  -0.062611,  -0.073753,  -0.007182,
+  0.014101,  0.015776,  0.052537,  0.064728,  -0.160187,
+  -0.005122,  0.076356,  -0.104763,  0.091493,  0.020225,
+  -0.000433,  0.062698,  -0.060457,  -0.14754,  -0.066168,
+  0.007195,  -0.061498,  -0.037801,  -0.039763,  0.059551,
+  -0.02841,  -0.07451,  0.057667,  0.020584,  -0.04251,
+  -0.025311,  -0.037825,  -0.18801,  0.077423,  0.030749,
+  -0.025465,  -0.067541,  0.003073,  -0.049778,  0.127789,
+  0.002786,  0.120009,  -0.067812,  -0.026565,  0.111272,
+  0.023219,  -0.024403,  -0.014507,  -0.048624,  0.022163,
+  0.014596,  -0.052136,  0.00158,  0.064595,  0.017963,
+  0.02133,  0.098862,  -0.009253,  -0.041062,  0.008903,
+  -0.013829,  0.031967,  0.076571,  -0.005348,  -0.04401,
+  0.031252,  0.000369,  0.036818,  0.072854,  -0.038569,
+  0.004161,  -0.128017,  -0.053152,  0.050896,  -0.015212,
+  -0.036159,  0.097995,  0.068397,  -0.048472,  -0.056131,
+  -0.01192,  0.059188,  0.010215,  -0.061152,  -0.011717,
+  -0.035949,  -0.057039,  0.090859,  -0.029682,  0.041466,
+  -0.025106,  0.131191,  0.059327,  0.085383,  0.021699,
+  0.04923,  0.03663,  -0.077086,  0.017806,  -0.08879,
+  0.00404,  -0.069533,  -0.026785,  0.009666,  0.014017,
+  -0.055897,  -0.096299,  0.120693,  0.029995,  0.032602,
+  -0.001365,  0.034015,  -0.053512,  0.001573,  -0.01917,
+  0.003956,  0.006452,  0.067313,  0.028301,  0.160615,
+  -0.053111,  0.01399,  -0.02706,  -0.013638,  0.039376,
+  -0.054462,  -0.096553,  0.079994,  -0.043791,  -0.025051,
+  -0.003222,  0.019418,  -0.049525,  0.151136,  0.034123,
+  0.055117,  0.058918,  -0.017393,  0.026169,  -0.12638,
+  -0.019008,  -0.028939,  -0.014027,  -0.173373,  -0.032841,
+  -0.00337,  0.03968,  -0.118311,  0.114094,  -0.041869,
+  0.041121,  -0.038391,  -0.096074,  -0.032479,  0.060222,
+  0.063968,  -0.024528,  0.018158,  -0.009892,  -0.043882,
+  -0.005004,  0.1298,  -0.025438,  -0.121186,  0.04986,
+  0.010448,  -0.040388,  0.061853,  -0.017304,  -0.035088,
+  -0.008678,  0.061476,  -0.039493,  -0.005055,  0.079169,
+  0.046134,  0.00977,  0.068294,  -0.078965,  -0.043792,
+  -0.030529,  -0.053845,  0.053853,  -0.140682,  0.111461,
+  0.003549,  -0.014939,  0.148955,  0.072861,  0.004332,
+  0.015386,  0.062006,  -0.122325,  -0.032529,  0.010241,
+  -0.047982,  -0.12644,  0.05584,  0.067128,  0.101189,
+  -0.00263,  0.031969,  0.046076,  -0.080194,  0.10474,
+  -0.033486,  -0.077818,  -0.058697,  -0.095258,  -0.111074,
+  0.037236,  0.011711,  0.001113,  -0.005664,  0.048588,
+  0.041131,  0.098257,  0.033126,  0.029317,  -0.095311,
+  -0.071555,  -0.039999,  0.026678,  -0.072182,  0.035031,
+  -0.007997,  -0.048174,  -0.006796,  0.075959,  -0.05206,
+  -0.007645,  0.037076,  -0.035574,  0.085576,  0.034126,
+  -0.050676,  0.05143,  0.031999,  -0.134308,  -0.001489,
+  0.084564,  -0.018394,  -0.09741,  -0.042931,  -0.025608,
+  -0.025489,  0.041919,  0.142482,  0.004617,  -0.041085,
+  -0.028816,  -0.015527,  -0.031005,  0.028405,  -0.02224,
+  -0.067737,  -0.025241,  -0.052578,  0.012322,  -0.120556,
+  0.016278,  -0.081744,  -0.09916,  0.025144,  0.025441,
+  0.003176,  -0.073871,  0.031718,  -0.028622,  0.029031,
+  0.01791,  -0.030693,  -0.104215,  -0.015422,  -0.065738,
+  -0.048346,  -0.012847,  0.046849,  -0.008621,  0.058771,
+  -0.054495,  0.031597,  -0.038844,  0.043138,  0.092588,
+  -0.071371,  -0.059093,  -0.001197,  0.001766,  -0.074762,
+  0.02947,  0.089616,  0.005009,  0.052977,  0.015899,
+  -0.045424,  0.158466,  -0.038717,  -0.032506,  0.028687,
+  0.011435,  -0.006772,  0.047605,  -0.144659,  -0.031229,
+  0.073577,  0.01153,  -0.008172,  0.058883,  -0.088412,
+  0.033615,  -0.03412,  -0.030701,  0.101215,  0.096645,
+  0.027368,  0.041249,  0.081502,  -0.02544,  0.007592,
+  0.059893,  0.012106,  -0.112009,  -0.114692,  0.016397,
+  0.087068,  0.016199,  0.051263,  0.011915,  -0.085364,
+  0.026046,  0.145258,  -0.047521,  0.077134,  -0.000345,
+  0.034532,  0.099801,  -0.087591,  -0.059719,  -0.058671,
+  0.022737,  -0.001887,  -0.107049,  -0.116757,  0.134115,
+  -0.055403,  0.005157,  0.067618,  0.081074,  0.071787,
+  0.063802,  -0.00343,  -0.106491,  0.017543,  0.002214,
+  -0.013785,  -0.032962,  0.010084,  0.024325,  0.045963,
+  0.059883,  0.072282,  -0.008608,  -0.015127,  0.048225,
+  0.041752,  -0.068845,  0.012227,  -0.090748,  -0.035309,
+  0.045353,  -0.078624,  -0.019489,  0.035531,  0.058571,
+  0.045414,  0.039032,  -0.011106,  0.048787,  -0.025336,
+  -0.084893,  0.031896,  0.01085,  0.012526,  -0.053205,
+  0.016952,  -0.044041,  0.068766,  0.097328,  -0.122229,
+  0.027016,  -0.051759,  -0.057246,  0.074566,  0.006201,
+  0.069904,  0.100068,  0.076124,  0.004278,  0.029466,
+  0.045229,  0.055683,  0.01879,  -0.067806,  0.039373,
+  0.029179,  -0.036787,  0.129921,  -0.028993,  0.037711,
+  -0.105011,  0.138747,  -0.00437,  0.05208,  0.050835,
+  0.025511,  -0.002962,  0.007852,  -0.055234,  -0.075055,
+  0.00046,  -0.089231,  -0.030467,  -0.080347,  0.007488,
+  0.06746,  -0.076368,  0.084991,  0.039544,  0.033391,
+  -0.044318,  0.00639,  -0.079387,  -0.002909,  -0.029708,
+  -0.047882,  0.06304,  0.065719,  0.021811,  0.070945,
+  -0.007571,  -0.001302,  -0.064119,  -0.068005,  0.05104,
+  -0.017747,  -0.063938,  0.018673,  -0.038391,  -0.099966,
+  0.057475,  -0.007669,  0.009384,  0.109283,  0.012248,
+  -0.048858,  0.092498,  0.011967,  0.061525,  -0.028819,
+  -0.015131,  -0.02416,  -0.03322,  -0.101648,  -0.01798,
+  -0.003342,  -0.049829,  -0.125096,  0.128241,  -0.047377,
+  -0.028943,  -0.109072,  -0.066133,  -0.015454,  0.098334,
+  0.053371,  0.011324,  0.042781,  0.044313,  0.06251,
+  0.098408,  0.06541,  -0.040693,  -0.116351,  -0.032327,
+  -0.013634,  -0.058591,  0.081507,  0.042019,  -0.09977,
+  -0.018275,  0.084624,  -0.007512,  -0.041113,  0.054203,
+  0.017879,  -0.029747,  0.059865,  -0.048281,  -0.111513,
+  -0.022478,  0.002059,  0.022383,  -0.12536,  0.058216,
+  0.002386,  -0.0816,  0.049288,  0.157428,  0.057724,
+  0.005046,  0.102125,  -0.083473,  0.044059,  -0.094864,
+  0.03912,  -0.063306,  0.057341,  0.060519,  0.107383,
+  0.007076,  -0.009373,  -0.012555,  -0.06663,  0.117121,
+  0.025254,  -0.008796,  -0.062102,  -0.083164,  -0.079007,
+  0.084839,  0.042308,  -0.055353,  0.036386,  0.132641,
+  0.084464,  0.056288,  -0.011636,  -0.059554,  -0.087748,
+  -0.147377,  -0.052414,  -0.010203,  -0.009159,  -0.018829,
+  0.009621,  0.061633,  0.015716,  0.086332,  -0.061465,
+  -0.011833,  -0.062998,  -0.021168,  0.125194,  0.045025,
+  0.052316,  0.02572,  0.095155,  -0.093252,  0.02872,
+  0.056113,  0.063321,  -0.045315,  0.025199,  0.023591,
+  -0.070481,  0.07235,  0.092458,  0.047973,  -0.025439,
+  -0.001281,  0.021028,  0.034576,  0.084779,  0.006867,
+  -0.010323,  -0.04633,  -0.009172,  0.030485,  -0.117679,
+  -0.021782,  -0.034737,  -0.086292,  -0.045885,  0.009655,
+  -0.037167,  -0.123331,  0.017291,  -0.028319,  0.071447,
+  -0.05718,  -0.032912,  -0.139418,  -0.025966,  -0.039305,
+  0.009411,  -0.054017,  0.076307,  -0.060252,  0.110087,
+  -0.061366,  0.038897,  -0.098107,  0.046119,  0.043021,
+  -0.02913,  -0.096885,  0.007623,  0.090513,  -0.097416,
+  0.053264,  0.058296,  0.054372,  0.060769,  0.015586,
+  -0.067956,  0.059996,  -0.03785,  0.005986,  0.000778,
+  0.045873,  -0.065546,  0.0779,  -0.085638,  0.000698,
+  0.027694,  -0.021241,  -0.002777,  0.034509,  -0.048173,
+  0.009988,  0.001008,  -0.077434,  0.026002,  0.13949,
+  0.00891,  0.007791,  0.059292,  -0.057047,  0.014127,
+  -0.022959,  0.08571,  -0.068087,  -0.081561,  0.005935,
+  0.007577,  0.061544,  0.076542,  0.00166,  -0.113279,
+  0.024973,  0.08675,  -0.061674,  0.095059,  0.089352,
+  -0.024436,  0.024181,  -0.016117,  -0.073634,  -0.067986,
+  0.074701,  -0.046868,  -0.054634,  -0.092485,  0.006662,
+  -0.033256,  -0.053774,  0.049001,  -0.002339,  0.013545,
+  -0.006432,  -0.012089,  -0.086842,  0.104105,  0.061991
+};
+  /* codebook/lspjvm3.txt */
+static const float codes2[] = {
+  0.007066,  0.075781,  -0.070082,  -0.092014,  -0.066477,
+  0.09051,  0.106622,  0.025911,  -0.01676,  0.003724,
+  -0.024628,  0.058332,  0.012876,  0.059557,  -0.002092,
+  -0.065092,  -0.096975,  -0.041837,  -0.002432,  0.058918,
+  0.014358,  0.080049,  -0.008803,  -0.002091,  -0.097584,
+  0.085323,  -0.026053,  -0.086585,  -0.009541,  0.130555,
+  0.045391,  0.037557,  0.074726,  -0.050453,  0.033517,
+  -0.035576,  -0.084211,  -0.08643,  0.00891,  -0.072674,
+  -0.098699,  -0.02454,  -0.048972,  -0.066975,  -0.048791,
+  0.032184,  0.070992,  -0.014416,  0.141892,  -0.044249,
+  -0.108921,  -0.02045,  0.115988,  0.011287,  -0.026273,
+  0.024341,  0.138519,  -0.036467,  0.020684,  0.074258,
+  -0.053563,  0.077463,  0.072166,  0.032112,  -0.079303,
+  -0.025039,  0.079675,  0.094211,  -0.115754,  0.038892,
+  0.050897,  -0.024639,  0.057826,  -0.110429,  0.071184,
+  0.015309,  -0.034027,  -0.055726,  0.043179,  -0.063089,
+  0.043359,  -0.011698,  0.006637,  0.002751,  0.03011,
+  -0.001261,  0.11147,  0.043277,  -0.004205,  -0.021599,
+  -0.005698,  0.058842,  0.168422,  0.059313,  -0.007971,
+  -0.087599,  0.073891,  -0.083238,  0.099279,  -0.017364,
+  -0.018429,  0.01404,  -0.014864,  -0.111512,  0.08945,
+  -0.028498,  -0.087983,  -0.07732,  -0.062602,  0.000328,
+  -0.027152,  -0.093796,  0.111381,  -0.018603,  0.092394,
+  -0.007256,  0.025391,  0.011454,  0.012802,  -0.04168,
+  0.008078,  0.020905,  -0.105401,  -0.083265,  0.027756,
+  -0.04963,  -0.044085,  -0.051424,  0.104125,  -0.000779,
+  -0.063079,  -0.130699,  0.0705,  0.033468,  -0.019802,
+  -0.061011,  0.094839,  -0.040122,  0.118409,  0.05695,
+  0.086391,  -0.006615,  0.045337,  -0.04419,  -0.106474,
+  -0.081912,  0.067557,  -0.031649,  -0.014437,  0.057585,
+  -0.121755,  -0.049113,  0.057109,  -0.049872,  0.044104,
+  0.064705,  -0.091589,  0.037286,  -0.048606,  -0.045398,
+  0.003456,  0.05723,  0.006262,  -0.055206,  -0.063871,
+  -0.005249,  0.081783,  0.134969,  -0.002331,  0.052643,
+  -0.093346,  0.072093,  0.116025,  -0.031453,  -0.006012,
+  -0.038574,  -0.030841,  0.010288,  0.02442,  0.051657,
+  -0.086584,  0.046381,  0.00541,  0.052622,  -0.072741,
+  0.079023,  0.078099,  -0.093912,  0.005477,  -0.006721,
+  0.100232,  -0.017587,  0.044819,  0.036655,  0.02158,
+  -0.006829,  -0.050076,  -0.00302,  0.088246,  0.01356,
+  -0.01569,  0.012477,  -0.052595,  -0.048861,  -0.033688,
+  0.055615,  0.092298,  -0.066194,  0.016416,  -0.066059,
+  0.046976,  0.003023,  0.104646,  0.109136,  0.018293,
+  -0.016507,  -0.006859,  0.004326,  0.070843,  0.14075,
+  0.025774,  0.03473,  -0.07959,  0.050054,  -0.10795,
+  0.002378,  0.097498,  0.027111,  -0.122953,  -0.002423,
+  -0.020539,  -0.063263,  -0.095493,  -0.157361,  -0.039183,
+  0.025721,  0.026897,  -0.0012,  0.033997,  -0.001749,
+  0.061593,  -0.013053,  -0.106317,  -0.06819,  0.046352,
+  -0.05606,  0.157084,  -0.049365,  0.053959,  -0.051065,
+  -0.047672,  0.08157,  0.064342,  -0.030705,  -0.070806,
+  -0.076503,  -0.059471,  0.012419,  0.073968,  -0.026179,
+  -0.038473,  0.059013,  -0.035783,  -0.030057,  -0.036346,
+  -0.052692,  -0.015346,  -0.022687,  -0.035279,  0.013314,
+  0.068397,  -0.046609,  -0.009593,  -0.040796,  0.157438,
+  -0.07536,  -0.110464,  0.031839,  -0.029035,  -0.015222,
+  0.041013,  -0.099212,  -0.10892,  -0.008627,  0.012095,
+  0.020855,  0.009935,  -0.086917,  0.058827,  -0.006536,
+  0.022104,  -0.005013,  0.003496,  0.046663,  -0.051061,
+  -0.036803,  -0.067317,  -0.007075,  0.18087,  -0.027434,
+  -0.025056,  -0.039341,  -0.073918,  -0.00318,  -0.11093,
+  -0.042711,  0.005519,  -0.035005,  -0.088419,  0.170942,
+  0.001503,  -0.121485,  0.066383,  -0.067346,  0.005643,
+  0.080088,  -0.042562,  -0.006668,  -0.036538,  0.020683,
+  0.042848,  0.027852,  -0.029088,  -0.156468,  0.006503,
+  0.037716,  0.032082,  0.038416,  0.021835,  -0.106963,
+  -0.043017,  0.018166,  0.070409,  -0.005426,  -0.035585,
+  -0.111071,  -0.039986,  0.05043,  0.035157,  0.066902,
+  -0.040684,  0.060527,  0.036225,  0.002527,  -0.015087,
+  0.059243,  0.021268,  -0.010682,  -0.018434,  0.059128,
+  0.111314,  -0.05407,  0.105744,  -0.051476,  -0.01297,
+  -0.000358,  -0.099249,  -0.077385,  0.069924,  -0.039101,
+  -0.072139,  -0.049069,  -0.088018,  0.006144,  0.000712,
+  0.08103,  0.021987,  -0.046031,  0.058087,  -0.00132,
+  -0.046851,  -0.011062,  0.108321,  -0.001146,  -0.071193,
+  0.044973,  -0.002915,  -0.003323,  0.041735,  0.094566,
+  0.05353,  0.035927,  0.100282,  0.059082,  -0.054059,
+  -0.012158,  -0.035417,  0.020412,  -0.073193,  0.059296,
+  -0.040489,  -0.09525,  -0.003821,  -0.084904,  0.053925,
+  0.109183,  -0.005862,  -0.036538,  0.080962,  -0.040647,
+  0.02007,  0.057778,  -0.020197,  -0.079626,  -0.003186,
+  -0.050855,  0.128185,  0.034731,  0.05746,  -0.035236,
+  -0.057096,  -0.001238,  0.122018,  -0.071204,  -0.047253,
+  -0.051767,  0.048301,  -0.052678,  0.02599,  -0.017481,
+  -0.029379,  0.030738,  0.047207,  -0.047864,  -0.033561,
+  0.029884,  -0.091175,  -0.085446,  -0.02614,  0.092628,
+  0.067706,  -0.085617,  0.081433,  0.047305,  0.031945,
+  -0.048728,  -0.040387,  0.046206,  0.010578,  -0.037639,
+  0.011328,  -0.042458,  -0.149597,  0.033882,  -0.061869,
+  0.0088,  0.057754,  -0.095876,  0.03823,  0.096876,
+  -0.033487,  -0.141669,  -0.014172,  0.028439,  -0.092764,
+  -0.053714,  0.086926,  0.034786,  0.136053,  -0.005569,
+  0.028753,  0.00963,  0.044114,  -0.050365,  -0.066224,
+  0.006017,  0.014348,  0.024471,  0.000489,  0.067234,
+  -0.021678,  -0.11876,  0.036349,  -0.040295,  0.076358,
+  -0.008444,  -0.086082,  -0.044018,  -0.025804,  0.028971,
+  -0.009233,  0.053026,  -0.035341,  -0.182193,  -0.102515,
+  0.08921,  0.066812,  0.032417,  0.046882,  -0.034815,
+  -0.052293,  0.022814,  0.129622,  0.128232,  -0.012105,
+  -0.087084,  0.004762,  0.086538,  0.046566,  0.098359,
+  -0.018713,  0.039204,  -0.021707,  -0.06011,  -0.117527,
+  -0.005459,  0.060994,  -0.057718,  -0.021783,  0.035154,
+  0.100557,  -0.01547,  -0.025818,  0.00845,  0.051535,
+  -0.001388,  -0.11461,  -0.057903,  0.041862,  0.061778,
+  0.045701,  -0.078563,  -0.070166,  -0.04845,  -0.08853,
+  0.021375,  -0.004598,  -0.09071,  -0.009399,  -0.073952,
+  -0.035575,  -0.05028,  0.11478,  0.137866,  0.065234,
+  0.003594,  -0.066802,  -0.144989,  0.166201,  0.039564,
+  -0.022457,  -0.03009,  0.016187,  0.115443,  -0.097331,
+  -0.019139,  0.09944,  0.002198,  -0.030953,  0.021099,
+  -0.045399,  -0.046871,  0.022533,  -0.064657,  0.005776,
+  0.049063,  -0.028478,  0.019268,  0.054265,  0.028042,
+  0.045559,  -0.005541,  -0.01441,  -0.024165,  -0.054976,
+  -0.073258,  0.084205,  0.036077,  -0.068683,  0.004708,
+  -0.085228,  0.001234,  0.046261,  -0.050496,  -0.028227,
+  -0.086828,  -0.001218,  0.021865,  0.003791,  -0.000568,
+  -0.088733,  -0.040041,  -0.035891,  -0.054915,  0.073463,
+  -0.132031,  -0.012844,  -0.068544,  0.013052,  0.087335,
+  0.038603,  -0.115382,  -0.010433,  -0.007113,  0.095126,
+  -0.047378,  -0.081353,  0.018021,  -0.021156,  -0.120774,
+  0.040038,  0.007633,  -0.088728,  -0.009928,  0.020142,
+  0.052024,  -0.021063,  -0.118121,  0.102739,  -0.055837,
+  0.005253,  -0.061924,  0.06368,  -0.014512,  -0.020259,
+  0.029493,  -0.013435,  -0.020638,  0.089342,  0.001092,
+  -0.046491,  -0.145634,  -0.083159,  -0.158142,  -0.279281,
+  0.003611,  0.055863,  -0.064655,  -0.088773,  0.089283,
+  -0.029619,  -0.089949,  0.017197,  -0.066633,  -0.052347,
+  0.090828,  -0.087551,  0.000338,  0.085238,  -0.005313,
+  0.096211,  0.071381,  -0.076546,  -0.077927,  -0.040864,
+  0.062936,  0.041559,  0.016235,  -0.017513,  0.014773,
+  -0.025734,  0.028586,  0.070292,  0.055794,  -0.026131,
+  -0.076954,  -0.082228,  0.043947,  -0.035921,  0.152668,
+  -0.04951,  0.023159,  0.008506,  -0.044773,  -0.160358,
+  0.024984,  -0.025587,  -0.071627,  -0.038376,  0.088478,
+  0.120568,  0.046723,  0.086731,  0.000695,  -0.015751,
+  -0.027837,  -0.160937,  -0.095031,  0.036271,  -0.009061,
+  -0.015078,  -0.036281,  -0.103665,  -0.058258,  -0.049573,
+  0.022021,  0.108296,  -0.002586,  0.065655,  -0.018584,
+  -0.046441,  -0.031018,  0.06735,  0.014328,  0.00886,
+  -0.000245,  0.0634,  -0.00181,  0.043515,  0.090344,
+  -0.063845,  0.020485,  0.079401,  0.070558,  -0.116428,
+  0.032628,  0.068949,  0.052238,  -0.04453,  0.096813,
+  0.029911,  -0.008814,  0.044352,  -0.168172,  0.009604,
+  0.055828,  -0.100739,  -0.026013,  0.021193,  -0.051425,
+  0.035891,  -0.004085,  0.030216,  -0.060801,  0.037202,
+  0.007262,  0.120686,  0.026846,  0.058464,  -0.100792,
+  -0.009176,  0.027589,  0.123957,  -0.011283,  -0.025744,
+  -0.105081,  0.118244,  -0.042122,  -0.025404,  0.000873,
+  -0.012703,  0.084159,  -0.067539,  -0.140536,  0.041637,
+  -0.014485,  -0.043382,  -0.048004,  -0.075416,  0.054401,
+  -0.018651,  -0.032908,  0.164231,  -0.053236,  0.033946,
+  -0.021681,  -0.012655,  -0.037049,  -0.001613,  -0.053393,
+  -0.014635,  0.017954,  -0.116115,  -0.027232,  0.034005,
+  -0.035376,  0.026492,  -0.03725,  0.070733,  0.074835,
+  -0.021378,  -0.14298,  0.123195,  0.003699,  0.025398,
+  0.015629,  0.07737,  0.032623,  0.12158,  0.0971,
+  0.000946,  -0.056355,  0.042065,  0.008184,  -0.081824,
+  -0.101937,  0.065473,  0.00336,  0.069241,  0.073002,
+  -0.053844,  -0.044301,  0.080351,  -0.091833,  0.044288,
+  0.007447,  -0.120723,  -0.013806,  -0.023636,  -0.064616,
+  0.030556,  0.07263,  0.074428,  -0.087759,  -0.02644,
+  0.06484,  0.049162,  0.091053,  0.023891,  0.033811,
+  -0.027746,  0.116392,  0.106126,  -0.056644,  -0.014781,
+  0.036137,  -0.002632,  0.055512,  0.070077,  0.067819,
+  -0.030625,  0.053772,  -0.078457,  -0.021351,  -0.113011,
+  0.052797,  0.044875,  -0.077269,  -0.009867,  0.101493,
+  0.073477,  -0.024103,  0.049145,  -0.004706,  -0.025211,
+  -0.053731,  -0.049009,  -0.035786,  0.05443,  0.046515,
+  0.025154,  -0.043569,  -0.034789,  -0.05861,  0.006931,
+  0.012049,  0.046809,  -0.129441,  0.025541,  -0.030933,
+  0.000297,  -0.054058,  0.179837,  0.081515,  0.004932,
+  -0.028445,  -0.073753,  0.010629,  0.080042,  0.09871,
+  -0.014017,  0.057597,  0.00101,  0.071658,  -0.06757,
+  0.074384,  0.110366,  -0.018121,  -0.108754,  0.037793,
+  0.028041,  -0.047508,  -0.031359,  -0.098913,  -0.036486,
+  -0.017311,  -0.001279,  -0.013694,  0.051968,  0.036512,
+  0.088201,  0.031155,  -0.043442,  -0.065045,  0.023486,
+  0.027,  0.104768,  -0.015176,  -0.038754,  -0.004178,
+  0.003732,  0.062166,  0.085438,  -0.077368,  -0.101645,
+  -0.118347,  0.007589,  -0.056489,  0.082268,  0.020253,
+  -0.035623,  0.034235,  -0.099354,  -0.061237,  -0.024285,
+  0.005441,  -0.039694,  -0.025957,  -0.004411,  0.049903,
+  0.00304,  0.036243,  0.023552,  -0.007334,  0.128963,
+  -0.077727,  -0.059175,  -0.019437,  -0.024872,  0.004339,
+  0.084006,  -0.076605,  -0.102261,  0.036714,  -0.035205,
+  -0.007642,  -0.005125,  -0.030525,  0.09639,  -0.053138,
+  -0.002192,  -0.024851,  0.050645,  0.04149,  -0.043183,
+  0.046796,  -0.050894,  0.055023,  0.133834,  -0.024013,
+  0.000872,  -0.057072,  -0.00063,  0.04207,  -0.129339,
+  -0.064283,  0.037836,  -0.066393,  0.004438,  0.125379,
+  -0.062213,  -0.067468,  0.090177,  -0.046094,  -0.025725,
+  0.079101,  -0.074909,  -0.04373,  -0.073483,  0.069672,
+  -0.020413,  -7.9e-05,  -0.049725,  -0.120751,  -0.04698,
+  0.039894,  0.072305,  0.009798,  0.005613,  -0.045217,
+  0.006862,  0.036285,  0.074819,  -0.006747,  0.015144,
+  -0.071562,  0.012324,  -0.001082,  0.014835,  0.07996,
+  -0.027804,  0.103358,  -0.017203,  0.014914,  -0.056687,
+  0.030827,  0.028076,  0.003395,  -0.073255,  0.11031,
+  0.056498,  -0.044893,  0.110122,  -0.109058,  -0.052302,
+  -0.001604,  -0.089977,  -0.060548,  0.107808,  0.025463,
+  -0.070203,  -0.000513,  -0.123913,  0.046247,  -0.085392,
+  0.096343,  0.09589,  -0.06495,  0.070363,  0.034272,
+  0.037773,  -0.07695,  0.124858,  -0.009008,  -0.010115,
+  0.083868,  0.051242,  0.039149,  0.015185,  0.083375,
+  0.029773,  -0.045961,  0.100395,  0.003743,  -0.138294,
+  -0.041755,  0.010806,  0.057797,  -0.147374,  0.095858,
+  -0.009929,  -0.103347,  -0.03231,  -0.11056,  0.121377,
+  0.145244,  0.017079,  -0.080587,  0.020516,  -0.044939,
+  -0.010477,  0.038347,  -0.003466,  -0.001618,  0.0196,
+  -0.021762,  0.125482,  0.011074,  0.065815,  0.040298,
+  0.009202,  -0.051686,  0.129684,  -0.131135,  0.044536,
+  0.009313,  0.102518,  -0.075351,  0.054338,  0.020273,
+  -0.045753,  0.031345,  0.000407,  -0.097294,  -0.000416,
+  -0.007466,  -0.044972,  -0.078744,  0.042414,  0.066624,
+  0.030318,  -0.067852,  0.061416,  -0.028992,  0.056606,
+  0.004038,  -0.036253,  -0.014279,  0.023123,  -0.007832,
+  -0.000137,  -0.027684,  -0.127648,  -0.007713,  -0.008746,
+  -0.0265,  0.049032,  -0.183319,  0.059107,  0.0665,
+  0.016902,  -0.093331,  0.090129,  0.016648,  -0.083492,
+  -0.023669,  -0.010473,  0.027614,  0.145068,  0.000681,
+  0.044133,  -0.035809,  0.005668,  -0.090461,  -0.090732,
+  -0.033927,  0.042997,  0.0217,  -0.046955,  0.044487,
+  -0.026444,  -0.061011,  0.01011,  -0.023804,  0.030427,
+  -0.015195,  -0.155603,  -0.016584,  0.021461,  -0.003528,
+  -0.059784,  0.032214,  0.000847,  -0.098859,  -0.07898,
+  0.043188,  0.066433,  0.062309,  0.144507,  0.006865,
+  -0.068953,  0.046698,  0.099369,  0.043354,  -0.014309,
+  -0.033202,  -0.00295,  0.040734,  0.083454,  0.039319,
+  0.051358,  0.006074,  -0.073465,  -0.090554,  -0.120787,
+  -0.040676,  0.092412,  -0.085151,  -0.021699,  0.005813,
+  0.103135,  0.024964,  0.025832,  -0.075982,  0.035699,
+  -0.02731,  -0.153007,  0.03642,  0.0576,  0.08163,
+  0.001605,  -0.054191,  -0.033043,  -0.01439,  -0.071383,
+  0.03618,  0.03586,  -0.04698,  0.038541,  -0.044757,
+  -0.078032,  -0.029878,  0.078183,  0.082251,  0.010549,
+  0.053317,  -0.038231,  -0.06561,  0.055798,  0.037504,
+  0.076317,  -0.027605,  0.010349,  0.095361,  -0.088636,
+  0.049089,  0.113316,  0.051084,  0.038589,  0.03433,
+  -0.055948,  -0.037217,  -0.015418,  -0.139976,  0.036306,
+  0.039306,  -0.009889,  -0.04491,  0.016559,  -5e-05,
+  0.106073,  0.01528,  -0.002563,  -0.109085,  -0.048475,
+  -0.035319,  0.16386,  0.032981,  -0.044932,  0.003227,
+  -0.123233,  -0.010638,  0.055479,  -0.003666,  -0.072249,
+  -0.111158,  0.065365,  0.010691,  0.039119,  -0.001837,
+  -0.118729,  0.06147,  -0.002077,  -0.033335,  -0.060165,
+  -0.026081,  -0.001806,  -0.079616,  -7.5e-05,  0.080598,
+  0.032908,  -0.03514,  -0.003136,  -0.029024,  0.094622,
+  -0.075773,  -0.022898,  -0.014817,  0.058393,  -0.111505,
+  0.036794,  -0.01576,  -0.112602,  0.030323,  0.085897,
+  -0.020834,  0.056079,  -0.103762,  0.117671,  -0.041205,
+  0.041684,  -0.084336,  0.034186,  0.011973,  -0.006313,
+  0.040836,  -0.035709,  0.03417,  0.122672,  0.090973,
+  -0.053182,  -0.059371,  0.091017,  -0.090998,  -0.116986,
+  0.001405,  0.138364,  0.017107,  -0.064076,  0.103486,
+  -0.031142,  -0.030068,  0.046547,  -0.133471,  -0.042055,
+  0.140418,  -0.125084,  0.035218,  -0.001162,  -0.02113,
+  -0.012034,  0.097413,  -0.079006,  -0.03903,  -0.054011,
+  0.143887,  0.078835,  -0.000601,  -0.021173,  -0.039895,
+  -0.02505,  0.075865,  0.039221,  0.032458,  0.038206,
+  -0.038873,  -0.085003,  -0.032736,  -0.026956,  0.113525,
+  -0.023933,  0.120794,  -0.003862,  -0.026459,  -0.138724,
+  0.089559,  0.029002,  -0.052098,  -0.085692,  0.115174,
+  0.083497,  0.024179,  0.119021,  -0.067541,  0.019047,
+  -0.02772,  -0.086083,  -0.055329,  0.020087,  -0.027086,
+  -0.047858,  -0.051975,  -0.035205,  -0.059342,  -0.068582,
+  0.058936,  0.044141,  -0.080315,  0.119744,  -0.046518,
+  -0.064588,  -0.027212,  0.147823,  0.032404,  0.01669,
+  0.024302,  0.08556,  -0.001525,  0.016469,  0.038891,
+  -0.020146,  0.019943,  0.045067,  0.03807,  -0.086274,
+  -0.025769,  0.044192,  0.102141,  -0.064765,  0.055849,
+  0.048803,  -0.030066,  -0.00922,  -0.116655,  0.068295,
+  0.04758,  -0.076138,  -0.070307,  0.047582,  -0.111342,
+  0.004656,  -0.004452,  0.029703,  -0.004259,  0.01113,
+  0.014446,  0.166086,  0.059565,  0.000985,  -0.052607,
+  0.013251,  0.094476,  0.106216,  0.016715,  -0.025581,
+  -0.101244,  0.072897,  -0.114526,  0.024681,  0.010784,
+  -0.051759,  0.032389,  -0.050202,  -0.083316,  0.052334,
+  -0.0351,  -0.116721,  -0.110336,  -0.053391,  0.065541,
+  -0.02979,  -0.020457,  0.135285,  -0.004142,  0.111508,
+  -0.030936,  0.018549,  -0.016034,  0.018572,  -0.084336,
+  -0.048615,  -0.018739,  -0.096815,  -0.090162,  0.01941,
+  -0.040821,  -0.009925,  -0.097427,  0.091891,  0.031793,
+  -0.024598,  -0.132848,  0.078353,  0.089339,  -0.068562,
+  -0.020779,  0.040974,  -0.055675,  0.169131,  0.029649,
+  0.078165,  -0.050679,  -0.005881,  -0.004983,  -0.104324,
+  -0.069096,  0.12796,  0.011392,  -0.000769,  0.062168,
+  -0.079842,  0.001606,  0.089284,  -0.035465,  0.031075,
+  0.029519,  -0.102956,  -0.010902,  -0.06403,  -0.019669,
+  0.057492,  0.075802,  -0.008904,  -0.060743,  -0.053144,
+  0.005126,  0.06298,  0.085674,  0.019895,  0.104448,
+  -0.086473,  0.056906,  0.056795,  -0.01294,  0.036606,
+  -0.008604,  -0.04045,  0.042062,  0.04181,  0.02768,
+  -0.092256,  0.091237,  -0.0395,  0.024761,  -0.088978,
+  0.068585,  0.088295,  -0.048033,  -0.017808,  0.04537,
+  0.1246,  -0.03532,  0.056751,  0.092751,  0.054025,
+  -0.015725,  -0.061938,  0.036806,  0.078768,  -0.016065,
+  0.002444,  -0.023887,  -0.072177,  -0.02979,  -0.00586,
+  0.015478,  0.129142,  -0.091024,  0.071482,  -0.065445,
+  0.005867,  -0.006051,  0.098646,  0.054089,  0.018713,
+  0.033837,  -0.008355,  -0.051959,  0.05744,  0.160305,
+  -0.001863,  0.016738,  -0.033705,  0.062233,  -0.140759,
+  0.027342,  0.060074,  0.030362,  -0.117875,  0.06102,
+  -0.028026,  -0.088238,  -0.003782,  -0.146288,  -0.080395,
+  0.050048,  0.036136,  0.0195,  0.066902,  0.020355,
+  0.024817,  -0.056254,  -0.140918,  -0.085803,  0.02054,
+  -0.00373,  0.161411,  -0.049408,  0.000219,  -0.002348,
+  -0.055021,  0.06782,  0.126483,  -0.031063,  -0.119299,
+  -0.102834,  0.001133,  0.010172,  0.107707,  -0.029106,
+  -0.059813,  0.036698,  -0.02172,  -0.043189,  -0.00227,
+  -0.031694,  0.009605,  -0.022459,  -0.036417,  0.053675,
+  0.061561,  -0.012723,  0.05004,  -0.02945,  0.131044,
+  -0.124516,  -0.107579,  -0.012171,  0.011761,  0.002599,
+  0.016327,  -0.060854,  -0.08091,  0.030875,  -0.002997,
+  -0.02097,  -0.01188,  -0.086096,  0.037912,  0.012421,
+  0.055253,  -0.00725,  0.04174,  0.055596,  -0.02442,
+  -0.017564,  -0.079202,  0.008897,  0.180091,  0.05449,
+  0.001772,  -0.022151,  -0.082048,  -0.010559,  -0.163377,
+  -0.02066,  -0.017827,  -0.0308,  -0.045856,  0.122405,
+  -0.052946,  -0.13049,  0.097383,  -0.116737,  0.039855,
+  0.056504,  -0.059549,  -0.059931,  -0.018658,  0.034898,
+  0.054889,  0.005373,  -0.066796,  -0.12736,  0.04796,
+  0.071746,  0.02741,  -0.006212,  0.024132,  -0.094062,
+  0.005369,  -0.008926,  0.073085,  -0.014265,  -0.029204,
+  -0.100025,  -0.072076,  0.014651,  0.069368,  0.048275,
+  -0.066823,  0.086074,  0.014921,  -0.015395,  -0.045138,
+  0.026224,  0.000902,  -0.038208,  -0.035221,  0.057397,
+  0.097606,  -0.073195,  0.051626,  -0.033488,  0.027813,
+  0.00207,  -0.09751,  -0.057877,  0.12668,  -0.082194,
+  -0.072597,  0.006014,  -0.093185,  -0.016853,  -0.02279,
+  0.138461,  0.005394,  -0.056485,  0.102778,  0.028918,
+  -0.045604,  -0.060041,  0.121251,  0.02926,  -0.101404,
+  0.061194,  0.033039,  -0.016798,  0.064263,  0.065144,
+  0.010925,  0.023151,  0.107623,  0.027977,  -0.090356,
+  -0.024863,  -0.00644,  0.04787,  -0.047486,  0.088211,
+  -0.012139,  -0.116121,  -0.000525,  -0.140961,  0.016604,
+  0.06349,  -0.022732,  -0.046944,  0.06697,  -0.068838,
+  0.016143,  0.026202,  -0.043344,  -0.064881,  0.024877,
+  -0.072845,  0.120531,  0.077901,  0.047272,  0.011713,
+  -0.044646,  0.040932,  0.076164,  -0.101233,  -0.029615,
+  -0.065118,  0.050966,  -0.023273,  0.053517,  0.02371,
+  -0.007489,  0.035822,  0.023439,  -0.055528,  -0.004033,
+  -0.007662,  -0.096546,  -0.081662,  0.037141,  0.137562,
+  0.075526,  -0.097496,  0.12399,  0.013996,  0.087005,
+  -0.019788,  -0.082043,  0.020524,  0.007027,  -0.021537,
+  -0.036264,  -0.090952,  -0.177722,  -0.009306,  -0.031473,
+  -0.009287,  0.047557,  -0.090241,  0.089347,  0.056375,
+  -0.005506,  -0.112128,  0.004356,  0.064421,  -0.038478,
+  -0.035674,  0.040616,  0.007731,  0.160236,  -0.054199,
+  -0.007537,  0.012434,  0.022001,  -0.021567,  -0.075163,
+  -0.026053,  0.015909,  0.041015,  0.021832,  0.034152,
+  -0.048539,  -0.086655,  0.047465,  0.000682,  0.04264,
+  0.023697,  -0.095971,  -0.022874,  -0.000369,  0.003413,
+  0.046005,  0.064807,  0.010131,  -0.129517,  -0.092254,
+  0.116469,  0.053796,  0.03811,  0.09447,  0.018435,
+  -0.034803,  0.073591,  0.108348,  0.104096,  0.049884,
+  -0.021274,  0.022097,  0.065347,  0.065555,  0.089319,
+  0.000474,  -0.004186,  -0.040493,  -0.065543,  -0.083167,
+  -0.017425,  0.049177,  -0.044248,  0.008399,  0.06818,
+  0.154778,  0.027549,  -0.008012,  0.01495,  0.043254,
+  0.039599,  -0.136415,  -0.018716,  0.0619,  0.031263,
+  0.058118,  -0.0372,  -0.114692,  -0.080876,  -0.053238,
+  0.077436,  0.015015,  -0.092517,  0.005804,  -0.065541,
+  -0.005653,  -0.073184,  0.095594,  0.08247,  0.060989,
+  -0.000262,  -0.035766,  -0.083441,  0.122634,  0.088429,
+  -0.014397,  -0.055434,  -0.005659,  0.069697,  -0.064892,
+  0.008824,  0.082498,  0.051866,  -0.03607,  0.033403,
+  -0.082855,  -0.087376,  0.002714,  -0.097121,  -0.01917,
+  0.027179,  -0.06987,  -0.009316,  0.04745,  0.040657,
+  0.060527,  0.00462,  -0.040264,  -0.051228,  -0.029023,
+  -0.071384,  0.101421,  0.009538,  -0.099185,  0.0601,
+  -0.048395,  -0.024677,  0.025125,  -0.056043,  -0.058045,
+  -0.054059,  0.008107,  0.021078,  0.04529,  -0.018459,
+  -0.113359,  0.014009,  -0.006826,  -0.052747,  0.046922,
+  -0.075976,  0.008538,  -0.084411,  -0.004369,  0.045801,
+  0.075392,  -0.06734,  0.014454,  0.032407,  0.092478,
+  -0.061859,  -0.083458,  0.051442,  0.031695,  -0.080233,
+  0.054028,  0.027,  -0.073549,  0.0323,  0.036501,
+  -0.011384,  -0.02078,  -0.124142,  0.093905,  -0.028332,
+  0.039139,  -0.030944,  0.079952,  -0.001717,  0.013976,
+  0.038005,  -0.001751,  -0.044097,  0.129827,  0.014385,
+  -0.001682,  -0.063458,  -0.002511,  -0.07815,  -0.141236,
+  0.021955,  0.104851,  -0.093246,  -0.060019,  0.069998,
+  0.004399,  -0.096408,  0.059327,  -0.062268,  -0.074327,
+  0.108063,  -0.090534,  -0.045654,  0.048119,  0.049187,
+  0.042105,  0.043964,  -0.091516,  -0.047999,  -0.028881,
+  0.070471,  0.055401,  -0.025605,  0.011176,  0.008475,
+  0.022254,  0.038266,  0.048106,  0.047176,  -0.017967,
+  -0.010978,  -0.088762,  0.034806,  0.019311,  0.126815,
+  -0.010571,  0.053073,  0.032162,  -0.00078,  -0.1522,
+  -0.014253,  -0.021954,  -0.13104,  -0.061376,  0.113838,
+  0.060725,  0.020201,  0.102533,  -0.011392,  -0.052046,
+  -0.069625,  -0.091011,  -0.097954,  0.067847,  0.017856,
+  -0.053461,  -0.040679,  -0.121664,  -0.077208,  -0.106919,
+  0.057996,  0.069756,  -0.012433,  0.069569,  -0.055159,
+  -0.024801,  -0.060448,  0.1017,  0.014619,  0.03658,
+  -0.004526,  0.093977,  -0.028211,  0.045261,  0.149736,
+  -0.014691,  -0.007959,  0.097708,  0.107128,  -0.079723,
+  0.029157,  0.020116,  0.104828,  -0.064208,  0.119172,
+  0.039583,  -0.029446,  0.006628,  -0.110398,  0.004062,
+  0.048132,  -0.060601,  0.009448,  0.051777,  -0.053127,
+  0.050551,  -0.001924,  0.028079,  -0.050618,  -0.013698,
+  0.00192,  0.088162,  0.073078,  0.085795,  -0.066788,
+  0.014025,  0.042699,  0.176241,  -0.046674,  -0.034822,
+  -0.051433,  0.121729,  -0.057076,  0.023901,  0.045075,
+  -0.057182,  0.05478,  -0.01728,  -0.146674,  0.00209,
+  -0.016223,  -0.044841,  -0.084524,  -0.152479,  0.072688,
+  -0.006962,  0.008711,  0.127455,  -0.003876,  0.053162,
+  -0.013682,  -0.025386,  -0.000427,  -0.024811,  -0.024474,
+  -0.056267,  0.062116,  -0.121311,  -0.053011,  0.065651,
+  -0.075385,  -0.00868,  -0.063033,  0.083039,  0.110577,
+  -0.000152,  -0.127017,  0.055904,  0.013659,  0.005664,
+  -0.002852,  0.047248,  0.001128,  0.100773,  0.037274,
+  0.026368,  -0.042205,  0.021887,  -0.020247,  -0.056678,
+  -0.077475,  0.089799,  0.058003,  0.039741,  0.106663,
+  -0.016853,  -0.015972,  0.075741,  -0.048829,  0.015374,
+  -0.032657,  -0.125677,  -0.06206,  -0.057409,  -0.061287,
+  0.073151,  0.050357,  0.053547,  -0.059886,  -0.051298,
+  0.057954,  -0.003817,  0.076028,  0.006757,  0.061109,
+  -0.03803,  0.143209,  0.092207,  -0.018493,  0.062291,
+  0.005751,  -0.036449,  0.067582,  0.031449,  0.101894,
+  -0.080754,  0.011515,  -0.049485,  -0.016137,  -0.087818,
+  0.108851,  0.038222,  -0.099315,  -0.003117,  0.052278,
+  0.107517,  -0.036233,  0.06537,  0.040409,  -0.057029,
+  -0.033167,  -0.081758,  -0.019502,  0.033438,  0.013365,
+  -0.01776,  -0.025906,  -0.020244,  -0.078722,  -0.011697,
+  -0.028246,  0.068647,  -0.106417,  0.026956,  -0.064914,
+  0.062711,  -0.017857,  0.151539,  0.044613,  -0.01782,
+  0.009085,  -0.032785,  -0.025795,  0.07579,  0.075667,
+  -0.040398,  0.058556,  -0.042634,  0.093973,  -0.099529,
+  0.057103,  0.073562,  0.01264,  -0.066141,  0.029558,
+  0.060219,  -0.083699,  -0.054799,  -0.120442,  -0.000374,
+  0.006521,  0.034512,  -0.039558,  0.042191,  0.033865,
+  0.103992,  -0.014977,  -0.077384,  -0.05134,  0.001873,
+  0.047451,  0.140612,  -0.024885,  -0.02142,  -0.046604,
+  0.030606,  0.10066,  0.076356,  -0.019288,  -0.09857,
+  -0.114463,  -0.010855,  -0.034657,  0.025618,  -0.003356,
+  -0.087913,  0.064346,  -0.07554,  -0.091569,  -0.024965,
+  -0.021232,  -0.017255,  -0.056931,  -0.003104,  0.030219,
+  -0.020112,  -0.012334,  0.035298,  0.001405,  0.161753,
+  -0.064618,  -0.064401,  -0.007218,  -0.00012,  -0.047208,
+  0.116105,  -0.056464,  -0.069645,  -0.007032,  -0.01209,
+  -0.023237,  0.016,  -0.039802,  0.074319,  -0.012604,
+  0.014863,  -0.058081,  0.093219,  0.062253,  -0.040302,
+  0.027405,  -0.128683,  0.039923,  0.116808,  -0.011706,
+  0.012483,  -0.017698,  0.003645,  -0.007588,  -0.120662,
+  -0.032868,  0.066217,  -0.031343,  -0.034166,  0.146334,
+  -0.031228,  -0.125921,  0.117756,  -0.042686,  -0.062094,
+  0.049375,  -0.112262,  0.010166,  -0.073599,  0.04869,
+  0.028292,  0.020076,  -0.062865,  -0.106114,  -0.0253,
+  0.066916,  0.029279,  0.028191,  -0.003599,  -0.040614,
+  0.020491,  0.060238,  0.052747,  -0.01039,  -0.022389,
+  -0.063358,  -0.028707,  0.035907,  -0.011898,  0.079703,
+  -0.003758,  0.078051,  -0.017869,  0.009045,  -0.018982,
+  0.034974,  0.069405,  -0.018909,  -0.038613,  0.083909,
+  0.033935,  -0.036607,  0.088891,  -0.052599,  -0.059839,
+  0.052758,  -0.068308,  -0.063615,  0.126093,  -0.00946,
+  -0.042175,  -0.011113,  -0.073071,  0.052086,  -0.052619,
+  0.049226,  0.066898,  -0.045666,  0.117923,  0.053656,
+  -0.010739,  -0.043962,  0.141903,  0.001792,  -0.035469,
+  0.090671,  0.043993,  -0.013655,  0.018989,  0.127223,
+  0.00103,  -0.001154,  0.081839,  -0.024979,  -0.103704,
+  -0.07792,  0.036083,  0.06822,  -0.06221,  0.11373,
+  -0.010501,  -0.065801,  0.050885,  -0.104304,  0.121937,
+  0.11185,  0.00968,  -0.011791,  0.001677,  -0.035029,
+  0.010677,  0.024572,  -0.01286,  -0.030323,  -0.010466,
+  0.011279,  0.167752,  0.003136,  0.109709,  0.007292,
+  0.000987,  0.004572,  0.108706,  -0.113192,  -0.012431,
+  -0.015225,  0.073653,  -0.051275,  0.077928,  -0.012752,
+  -0.011708,  0.014172,  0.025162,  -0.095378,  0.026382,
+  -0.028889,  -0.058569,  -0.129329,  0.011087,  0.061452,
+  0.056893,  -0.058004,  0.103586,  -0.060752,  0.081824,
+  -0.042805,  -0.015991,  -0.024444,  0.028952,  -0.013528,
+  0.042851,  0.019988,  -0.165741,  -0.031012,  -0.014713,
+  -0.026059,  0.031698,  -0.134343,  0.03209,  0.020828,
+  0.051674,  -0.128006,  0.050856,  0.02222,  -0.073513,
+  -0.00934,  0.013756,  0.036163,  0.098407,  -0.023495,
+  0.023858,  0.008121,  0.02222,  -0.103489,  -0.046663,
+  -0.033,  0.063565,  0.029224,  -0.012693,  0.084202,
+  0.012187,  -0.051,  0.026126,  -0.043293,  0.008675,
+  -0.019812,  -0.16507,  -0.014555,  -0.047431,  0.01799,
+  -0.040073,  0.107192,  0.022228,  -0.089023,  -0.066885,
+  0.01463,  0.073186,  0.069902,  0.072634,  0.019593,
+  -0.041539,  0.031788,  0.09231,  0.027223,  0.034027,
+  -0.051855,  0.000391,  0.007869,  0.13191,  0.069384,
+  0.046276,  0.04044,  -0.037093,  -0.031393,  -0.112828,
+  0.015709,  0.096749,  -0.103205,  -0.021284,  0.011405,
+  0.158287,  -0.021028,  0.042219,  -0.050759,  0.069715,
+  -0.042907,  -0.11698,  0.014224,  0.094648,  0.028395,
+  0.041535,  -0.057033,  -0.047607,  -0.024419,  -0.034905,
+  0.010125,  0.036728,  -0.052503,  -0.001839,  -0.033477,
+  -0.053414,  -0.070394,  0.092895,  0.1006,  -0.026352,
+  0.080574,  -0.028763,  -0.059548,  0.094571,  0.091787,
+  0.041437,  0.014312,  0.045792,  0.108269,  -0.081586,
+  0.056288,  0.137447,  0.054718,  -0.032474,  0.054502,
+  -0.100144,  -0.00646,  0.024739,  -0.117043,  -0.008919,
+  0.070299,  -0.036862,  -0.014543,  0.0245,  -0.015222,
+  0.114975,  -0.043705,  0.000421,  -0.061872,  -0.035148,
+  -0.022797,  0.128575,  -0.031798,  -0.086718,  -0.007172,
+  -0.071706,  -0.006833,  0.028645,  -0.007011,  -0.096745,
+  -0.142269,  0.027996,  0.06521,  0.061381,  0.000741,
+  -0.140531,  0.01748,  -0.014986,  -0.040893,  -0.012718,
+  -0.012494,  -0.021869,  -0.032923,  0.016456,  0.104475,
+  0.010792,  -0.066178,  0.019097,  -0.001893,  0.067513,
+  -0.092673,  -0.059851,  -0.045936,  0.052642,  -0.0625,
+  0.065013,  -0.025659,  -0.149301,  0.051705,  0.035692,
+  -0.04579,  -0.007482,  -0.069141,  0.149365,  -0.042039,
+  0.018492,  -0.081315,  0.05588,  0.058158,  0.019669,
+  0.063836,  -0.012391,  0.007057,  0.155454,  0.033854,
+  -0.016532,  -0.007661,  0.043113,  -0.080283,  -0.10867,
+  -0.029344,  0.093781,  -0.01584,  -0.068134,  0.091804,
+  0.004148,  -0.058507,  0.059633,  -0.095883,  -0.004939,
+  0.086151,  -0.113571,  -0.019466,  -0.009167,  0.003662
+};
+
+const struct lsp_codebook lsp_cbjvm[] = {
+  /* codebook/lspjvm1.txt */
+  {
+    10,
+    9,
+    512,
+    codes0
+  },
+  /* codebook/lspjvm2.txt */
+  {
+    5,
+    9,
+    512,
+    codes1
+  },
+  /* codebook/lspjvm3.txt */
+  {
+    5,
+    9,
+    512,
+    codes2
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookres.c b/codec2/tags/0.4/src/codebookres.c
new file mode 100644 (file)
index 0000000..e410dfc
--- /dev/null
@@ -0,0 +1,97 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* ../src/codebook/lspres_centre1.txt */
+static const float codes0[] = {
+  300,
+  350,
+  400,
+  450,
+  500,
+  550,
+  600,
+  650
+};
+  /* ../src/codebook/lspres_bw1.txt */
+static const float codes1[] = {
+  35,
+  80,
+  140,
+  250
+};
+  /* ../src/codebook/lsp3.txt */
+static const float codes2[] = {
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250
+};
+  /* ../src/codebook/lsp4.txt */
+static const float codes3[] = {
+  700,
+  800,
+  900,
+  1000,
+  1100,
+  1200,
+  1300,
+  1400,
+  1500,
+  1600,
+  1700,
+  1800,
+  1900,
+  2000,
+  2100,
+  2200
+};
+
+const struct lsp_codebook lsp_cbres[] = {
+  /* ../src/codebook/lspres_centre1.txt */
+  {
+    1,
+    3,
+    8,
+    codes0
+  },
+  /* ../src/codebook/lspres_bw1.txt */
+  {
+    1,
+    2,
+    4,
+    codes1
+  },
+  /* ../src/codebook/lsp3.txt */
+  {
+    1,
+    4,
+    16,
+    codes2
+  },
+  /* ../src/codebook/lsp4.txt */
+  {
+    1,
+    4,
+    16,
+    codes3
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookvq.c b/codec2/tags/0.4/src/codebookvq.c
new file mode 100644 (file)
index 0000000..bb9f605
--- /dev/null
@@ -0,0 +1,4223 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/lsp1.txt */
+static const float codes0[] = {
+  225,
+  250,
+  275,
+  300,
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600
+};
+  /* codebook/lsp2.txt */
+static const float codes1[] = {
+  325,
+  350,
+  375,
+  400,
+  425,
+  450,
+  475,
+  500,
+  525,
+  550,
+  575,
+  600,
+  625,
+  650,
+  675,
+  700
+};
+  /* codebook/lsp3.txt */
+static const float codes2[] = {
+  500,
+  550,
+  600,
+  650,
+  700,
+  750,
+  800,
+  850,
+  900,
+  950,
+  1000,
+  1050,
+  1100,
+  1150,
+  1200,
+  1250
+};
+  /* codebook/lsp4.txt */
+static const float codes3[] = {
+  700,
+  800,
+  900,
+  1000,
+  1100,
+  1200,
+  1300,
+  1400,
+  1500,
+  1600,
+  1700,
+  1800,
+  1900,
+  2000,
+  2100,
+  2200
+};
+  /* ../unittest/lsp45678910.txt */
+static const float codes4[] = {
+  1.08123,  1.57884,  1.85557,  1.93731,  2.53244,  2.64981,
+  1.0628,  1.45001,  1.83956,  1.9565,  2.48885,  2.65346,
+  1.10159,  1.36102,  1.83358,  1.93241,  2.50518,  2.62981,
+  1.07906,  1.37686,  1.87269,  1.95508,  2.54134,  2.63378,
+  1.09554,  1.63104,  1.86627,  2.06699,  2.50666,  2.57043,
+  1.09306,  1.56136,  1.77247,  2.12386,  2.54748,  2.61826,
+  1.09365,  1.50021,  1.78605,  2.07712,  2.48377,  2.57254,
+  1.03502,  1.48598,  1.67865,  2.07936,  2.40234,  2.51331,
+  1.23172,  1.63057,  1.84991,  2.02345,  2.46721,  2.57161,
+  1.20636,  1.47819,  1.85565,  2.0092,  2.43743,  2.55238,
+  1.20425,  1.49576,  1.8464,  2.03998,  2.50063,  2.59244,
+  1.27202,  1.43835,  1.8545,  2.03871,  2.51872,  2.62009,
+  1.29891,  1.48336,  1.83887,  1.98366,  2.48837,  2.59701,
+  1.38559,  1.50018,  1.81943,  1.9817,  2.50554,  2.61253,
+  1.41367,  1.56655,  1.76718,  1.99449,  2.56961,  2.62524,
+  1.46905,  1.62608,  1.75177,  2.04119,  2.60895,  2.65878,
+  1.48951,  1.61764,  1.68918,  2.05385,  2.66224,  2.70553,
+  1.43112,  1.53558,  1.64732,  1.81092,  2.57577,  2.6922,
+  1.41167,  1.60617,  1.73036,  1.96937,  2.62811,  2.69185,
+  1.34102,  1.63997,  2.19739,  2.28132,  2.44971,  2.626,
+  1.31988,  1.67483,  2.10118,  2.28173,  2.49978,  2.61148,
+  1.27462,  1.61012,  1.90144,  2.23566,  2.51818,  2.62888,
+  1.17221,  1.36564,  1.7847,  1.90445,  2.53808,  2.64619,
+  1.09616,  1.35011,  1.75499,  1.86967,  2.48657,  2.6055,
+  1.03654,  1.3262,  1.72989,  1.86212,  2.46119,  2.57545,
+  1.01653,  1.27725,  1.6888,  1.80838,  2.46298,  2.57624,
+  0.968031,  1.32901,  1.71641,  1.82136,  2.48115,  2.56195,
+  0.940641,  1.28334,  1.76788,  1.86054,  2.50314,  2.5949,
+  0.926995,  1.24333,  1.73891,  1.901,  2.4495,  2.55764,
+  0.839883,  1.23712,  1.70215,  1.81262,  2.42139,  2.49298,
+  0.924474,  1.18807,  1.75752,  1.8249,  2.45594,  2.61106,
+  0.96423,  1.20727,  1.66622,  1.87681,  2.50715,  2.58041,
+  0.989772,  1.18973,  1.69345,  1.80714,  2.44571,  2.56195,
+  0.919183,  1.20312,  1.67383,  1.77261,  2.3858,  2.51167,
+  0.978552,  1.17542,  1.61386,  1.72687,  2.32896,  2.5167,
+  1.01454,  1.25425,  1.58728,  1.75663,  2.40306,  2.51083,
+  1.09672,  1.23117,  1.5574,  1.84394,  2.46358,  2.55546,
+  1.16877,  1.35118,  1.61393,  1.83103,  2.47627,  2.58122,
+  1.17651,  1.26415,  1.56492,  1.76049,  2.48352,  2.58104,
+  1.01797,  1.24983,  1.42449,  1.59354,  2.45834,  2.52503,
+  1.05399,  1.21603,  1.51742,  1.85194,  2.34275,  2.50233,
+  0.908986,  1.2508,  1.59392,  1.8871,  2.37309,  2.53013,
+  0.993871,  1.16402,  1.61662,  1.77573,  2.56946,  2.65857,
+  1.10248,  1.38615,  1.57368,  1.78564,  2.31793,  2.50856,
+  1.20724,  1.39083,  1.55105,  1.85061,  2.33598,  2.49433,
+  0.905032,  1.41648,  1.58005,  1.84183,  2.50381,  2.6016,
+  0.79589,  1.10793,  1.59771,  2.0155,  2.40215,  2.53461,
+  0.732401,  1.15861,  1.55747,  1.938,  2.62642,  2.70543,
+  0.85967,  1.12906,  1.67186,  1.95399,  2.51479,  2.61587,
+  0.921647,  1.24536,  1.68375,  1.89446,  2.59964,  2.71656,
+  0.845409,  1.19476,  1.76731,  1.84451,  2.58977,  2.71694,
+  0.977678,  1.1414,  1.66711,  1.92383,  2.63201,  2.68907,
+  0.951137,  1.12255,  1.71418,  1.8859,  2.53576,  2.67211,
+  1.02995,  1.15955,  1.73944,  1.92833,  2.48818,  2.62352,
+  0.925634,  1.22593,  1.7518,  1.97075,  2.5329,  2.62107,
+  1.0123,  1.21143,  1.79395,  1.88586,  2.46727,  2.57249,
+  0.993978,  1.13747,  1.74347,  1.84089,  2.39008,  2.56639,
+  0.989822,  1.17307,  1.68756,  1.94893,  2.32553,  2.47342,
+  0.955854,  1.23723,  1.80741,  2.11677,  2.39103,  2.50278,
+  1.10336,  1.35799,  1.85224,  2.09709,  2.39275,  2.55324,
+  1.12887,  1.4409,  1.92791,  2.1767,  2.40798,  2.54428,
+  1.31613,  1.57544,  1.96457,  2.15894,  2.48584,  2.57613,
+  1.4696,  1.7721,  1.95484,  2.16407,  2.39962,  2.48192,
+  1.50652,  1.75488,  2.01841,  2.24949,  2.48627,  2.60761,
+  1.52419,  1.77645,  2.05458,  2.27569,  2.58498,  2.66908,
+  1.518,  1.85028,  2.02643,  2.30188,  2.57753,  2.66918,
+  1.42205,  1.78898,  1.96748,  2.18477,  2.59685,  2.69968,
+  1.20841,  1.4347,  1.92362,  2.00377,  2.60293,  2.68501,
+  1.22117,  1.43657,  1.87997,  2.0334,  2.49815,  2.69542,
+  1.21771,  1.37598,  1.90861,  1.97303,  2.48056,  2.6454,
+  1.20035,  1.41224,  1.86328,  2.05454,  2.40923,  2.64633,
+  1.43945,  1.67593,  2.06471,  2.27323,  2.60645,  2.69621,
+  1.54757,  1.95602,  2.08379,  2.38708,  2.63432,  2.71122,
+  1.74537,  1.99526,  2.17627,  2.40949,  2.63225,  2.70742,
+  1.81929,  1.98216,  2.21017,  2.45219,  2.60377,  2.66452,
+  1.66955,  1.94018,  2.10087,  2.38694,  2.53082,  2.63087,
+  1.59768,  1.94591,  2.07284,  2.33889,  2.54425,  2.60825,
+  1.65615,  1.88869,  1.98455,  2.30113,  2.51078,  2.58636,
+  1.6188,  1.89886,  2.02474,  2.29131,  2.44053,  2.56029,
+  1.48128,  1.82621,  1.97192,  2.19291,  2.41702,  2.53029,
+  1.31873,  1.58154,  1.84545,  2.164,  2.38923,  2.50542,
+  1.34133,  1.56585,  1.80288,  2.21848,  2.43077,  2.54583,
+  1.31851,  1.41266,  1.67762,  2.18235,  2.37275,  2.47653,
+  1.24372,  1.45667,  1.66571,  2.12671,  2.33287,  2.43845,
+  1.1525,  1.45886,  1.58294,  2.03752,  2.3421,  2.4283,
+  1.02538,  1.4076,  1.55153,  1.84679,  2.28286,  2.38544,
+  0.87656,  1.38433,  1.5829,  1.74194,  2.23992,  2.33845,
+  0.953781,  1.44188,  1.5924,  1.76417,  2.29409,  2.4742,
+  0.899968,  1.45403,  1.63436,  1.72431,  2.3534,  2.5975,
+  0.784159,  1.42393,  1.73726,  1.85596,  2.39003,  2.61454,
+  0.802442,  1.39707,  1.65855,  1.81679,  2.42939,  2.5001,
+  0.863071,  1.31849,  1.64602,  1.81297,  2.3981,  2.50385,
+  0.89687,  1.30624,  1.67159,  1.90217,  2.46653,  2.60152,
+  0.999503,  1.30429,  1.70842,  1.89904,  2.51234,  2.65519,
+  1.04528,  1.2663,  1.66963,  1.84632,  2.51707,  2.63748,
+  1.03846,  1.15853,  1.64378,  1.86528,  2.5832,  2.65894,
+  1.02632,  1.21931,  1.76835,  1.84092,  2.53817,  2.67333,
+  1.08097,  1.21543,  1.73019,  1.83693,  2.23686,  2.60887,
+  1.1018,  1.43151,  1.75208,  1.91896,  2.09124,  2.53896,
+  1.17873,  1.29731,  1.7241,  1.85075,  2.31029,  2.62153,
+  1.15118,  1.23968,  1.75479,  1.85052,  2.5391,  2.70599,
+  1.2027,  1.3006,  1.76334,  1.86743,  2.47072,  2.66465,
+  1.26112,  1.36868,  1.75328,  1.84665,  2.46151,  2.6526,
+  1.26307,  1.36429,  1.79767,  1.87694,  2.54373,  2.66022,
+  1.32015,  1.41593,  1.80983,  1.90322,  2.51555,  2.64824,
+  1.33987,  1.45935,  1.80668,  1.92458,  2.49148,  2.58705,
+  1.35517,  1.45177,  1.7634,  1.94416,  2.47263,  2.56117,
+  1.32792,  1.42891,  1.70445,  1.91482,  2.39737,  2.50347,
+  1.3076,  1.41535,  1.61629,  1.84079,  2.32217,  2.47099,
+  1.24825,  1.34921,  1.61761,  1.77273,  2.25068,  2.48653,
+  1.09657,  1.35568,  1.62611,  1.94199,  2.31385,  2.49821,
+  1.01253,  1.34284,  1.64785,  1.90716,  2.43593,  2.53319,
+  0.944393,  1.39928,  1.643,  1.93199,  2.33198,  2.48991,
+  0.883306,  1.40234,  1.70636,  2.02537,  2.37371,  2.54371,
+  0.829559,  1.23577,  1.71275,  2.18485,  2.38674,  2.54418,
+  0.923799,  1.51311,  1.70309,  2.10529,  2.47648,  2.55516,
+  0.772688,  1.4433,  1.65612,  2.05301,  2.45044,  2.53252,
+  0.776285,  1.4032,  1.73402,  1.93526,  2.46409,  2.5668,
+  0.782396,  1.41881,  1.75888,  1.97322,  2.54833,  2.6103,
+  0.789572,  1.41108,  1.77153,  2.06041,  2.54026,  2.63125,
+  0.774326,  1.28802,  1.83727,  1.96095,  2.51242,  2.58163,
+  0.811751,  1.27403,  1.81001,  1.88574,  2.56546,  2.63922,
+  0.844982,  1.32083,  1.87391,  1.9446,  2.56105,  2.66172,
+  0.881256,  1.69536,  1.90698,  2.07889,  2.61855,  2.67865,
+  1.09989,  1.72782,  1.97132,  2.15314,  2.50969,  2.60295,
+  1.17385,  1.68544,  1.91746,  2.14743,  2.38305,  2.56703,
+  1.10155,  1.54322,  1.82061,  2.05532,  2.33872,  2.58503,
+  0.975012,  1.37972,  1.77663,  2.03329,  2.19415,  2.51822,
+  0.967054,  1.08246,  1.61897,  2.07793,  2.20684,  2.37089,
+  1.00961,  1.12061,  1.53418,  2.08853,  2.28294,  2.42058,
+  0.899159,  1.20852,  1.42369,  1.97032,  2.28727,  2.4989,
+  0.879682,  1.31448,  1.47949,  1.68936,  2.20974,  2.28576,
+  1.03347,  1.24384,  1.47314,  1.66799,  2.15942,  2.25504,
+  1.04841,  1.25589,  1.537,  1.82005,  2.14225,  2.31375,
+  1.04825,  1.18926,  1.70511,  1.83599,  2.10545,  2.37206,
+  1.03432,  1.13888,  1.51462,  1.82966,  2.17045,  2.42561,
+  1.10388,  1.21765,  1.62215,  1.80585,  2.02753,  2.37681,
+  1.08723,  1.19501,  1.55902,  1.89504,  2.25012,  2.3792,
+  1.13001,  1.29387,  1.6924,  1.85888,  2.1972,  2.34906,
+  1.16289,  1.3046,  1.69102,  1.96932,  2.26861,  2.43029,
+  1.15181,  1.25793,  1.67383,  1.90202,  2.18916,  2.45871,
+  1.16844,  1.27183,  1.55733,  2.08415,  2.30803,  2.42037,
+  1.2351,  1.34019,  1.65679,  2.09516,  2.28319,  2.40964,
+  1.25239,  1.35536,  1.60985,  2.08519,  2.33271,  2.48887,
+  1.22631,  1.34399,  1.67305,  2.21553,  2.46,  2.54692,
+  1.40818,  1.56645,  1.70193,  2.1551,  2.54024,  2.58859,
+  1.304,  1.549,  1.65358,  2.12874,  2.58947,  2.63332,
+  1.31253,  1.48894,  1.69055,  1.98288,  2.55839,  2.62252,
+  1.30359,  1.48566,  1.773,  1.99142,  2.55563,  2.65006,
+  1.2572,  1.52892,  1.88049,  2.04567,  2.40009,  2.56749,
+  1.29472,  1.63432,  1.91154,  2.04666,  2.43808,  2.61113,
+  1.32844,  1.71607,  1.8503,  2.02126,  2.50705,  2.61286,
+  1.13808,  1.26904,  1.79259,  1.89815,  2.53041,  2.65356,
+  1.02479,  1.14554,  1.68822,  1.81293,  2.42504,  2.65093,
+  1.05666,  1.17804,  1.59034,  1.74735,  2.36845,  2.61871,
+  0.994299,  1.11084,  1.63265,  1.73054,  2.33769,  2.5503,
+  0.96003,  1.10348,  1.6328,  1.74508,  2.19725,  2.53053,
+  0.952099,  1.07891,  1.70416,  1.83731,  2.31907,  2.54431,
+  0.901034,  1.0748,  1.65366,  1.78859,  2.39383,  2.53312,
+  0.970595,  1.13005,  1.56835,  1.82097,  2.44511,  2.56337,
+  0.8832,  1.02914,  1.48058,  1.88436,  2.32162,  2.47072,
+  0.817959,  0.941844,  1.41014,  1.54071,  2.17404,  2.48277,
+  0.772028,  0.888033,  1.49012,  1.71709,  2.32435,  2.56046,
+  0.8742,  1.0201,  1.57148,  1.74681,  2.43739,  2.56133,
+  0.827282,  1.01003,  1.60538,  1.75068,  2.26185,  2.4816,
+  0.790605,  1.149,  1.65382,  1.78105,  2.35864,  2.49161,
+  0.746581,  0.96108,  1.60491,  1.879,  2.31927,  2.55158,
+  0.845418,  0.96953,  1.69617,  1.89093,  2.30188,  2.62149,
+  0.826083,  1.01605,  1.6586,  1.85255,  2.43588,  2.57274,
+  0.80426,  0.948999,  1.68449,  2.10334,  2.47505,  2.57585,
+  0.837016,  1.03,  1.67699,  1.79665,  2.49802,  2.63103,
+  0.779629,  0.917041,  1.60707,  1.8689,  2.45957,  2.6289,
+  0.802981,  0.922379,  1.55614,  1.96784,  2.59545,  2.69251,
+  0.821239,  0.952349,  1.58525,  2.0958,  2.59371,  2.65593,
+  0.819528,  1.10955,  1.52684,  1.76751,  2.6378,  2.71051,
+  0.846222,  1.05572,  1.70728,  1.83863,  2.114,  2.5014,
+  0.956553,  1.43985,  1.7249,  1.93982,  2.14519,  2.43191,
+  1.33429,  1.55159,  1.7214,  2.01917,  2.178,  2.32944,
+  1.24736,  1.57146,  1.83452,  2.11416,  2.26821,  2.48981,
+  1.22315,  1.57342,  1.84625,  2.01609,  2.21928,  2.45785,
+  1.23993,  1.53779,  1.8228,  2.04648,  2.44445,  2.57805,
+  1.29968,  1.55774,  1.7983,  2.08069,  2.39337,  2.5752,
+  1.27312,  1.47413,  1.81487,  2.01491,  2.40501,  2.60292,
+  1.22903,  1.4485,  1.75715,  2.05057,  2.41716,  2.59461,
+  1.2063,  1.5151,  1.78896,  2.04215,  2.36856,  2.5858,
+  1.1589,  1.5448,  1.86145,  2.06665,  2.40525,  2.59099,
+  1.20326,  1.47986,  1.83352,  2.07062,  2.4318,  2.5857,
+  1.17077,  1.55578,  1.82667,  2.07708,  2.46748,  2.61941,
+  1.11628,  1.59353,  1.82425,  2.16082,  2.42781,  2.60049,
+  1.25031,  1.6173,  1.96265,  2.15224,  2.53124,  2.63143,
+  1.353,  1.64524,  2.07019,  2.18038,  2.61203,  2.68877,
+  1.46033,  1.91719,  2.08682,  2.31459,  2.64118,  2.72306,
+  1.5571,  1.91661,  2.0569,  2.2632,  2.64033,  2.7028,
+  1.41067,  1.90339,  2.07783,  2.22294,  2.6154,  2.69412,
+  1.34049,  1.80404,  2.04002,  2.14956,  2.60771,  2.67815,
+  1.09068,  1.32106,  1.86274,  1.98378,  2.47586,  2.59244,
+  1.00246,  1.26551,  1.81302,  1.90434,  2.49926,  2.62654,
+  1.05139,  1.16129,  1.83253,  1.95508,  2.50234,  2.62475,
+  0.942516,  1.06424,  1.66956,  1.97725,  2.46418,  2.59833,
+  0.869608,  0.984141,  1.45461,  1.95618,  2.50789,  2.61787,
+  0.972489,  1.13547,  1.52915,  1.72998,  2.41157,  2.57108,
+  1.05128,  1.14941,  1.54752,  1.82715,  2.51133,  2.61762,
+  1.07974,  1.19121,  1.53936,  1.94473,  2.54524,  2.63216,
+  1.18206,  1.26003,  1.5961,  2.08466,  2.51186,  2.57941,
+  1.172,  1.35276,  1.46275,  2.01506,  2.62536,  2.67937,
+  1.20054,  1.32298,  1.5156,  1.7692,  2.52314,  2.66683,
+  1.22809,  1.30713,  1.73403,  1.91475,  2.24482,  2.56203,
+  1.17619,  1.32166,  1.78231,  1.88258,  2.27136,  2.52145,
+  1.15003,  1.48622,  1.77415,  1.97093,  2.38508,  2.61264,
+  1.10316,  1.455,  1.72062,  1.89959,  2.35671,  2.59138,
+  1.07047,  1.38631,  1.74693,  1.89198,  2.36751,  2.54357,
+  0.95361,  1.17616,  1.64355,  1.91998,  2.37206,  2.57246,
+  1.05232,  1.40517,  1.68895,  1.83167,  2.54288,  2.63248,
+  0.996802,  1.44143,  1.68446,  1.82195,  2.59599,  2.65884,
+  1.02655,  1.33494,  1.74094,  1.84038,  2.57165,  2.67897,
+  1.10832,  1.20084,  1.70613,  1.99908,  2.51466,  2.64821,
+  1.13332,  1.21947,  1.74777,  2.01308,  2.40664,  2.64036,
+  1.14214,  1.21872,  1.81464,  1.95106,  2.43007,  2.66618,
+  1.08156,  1.20709,  1.84645,  1.94628,  2.33914,  2.61266,
+  1.14637,  1.23863,  1.87425,  1.9681,  2.42738,  2.59563,
+  1.06941,  1.39313,  1.85976,  1.94182,  2.37447,  2.53818,
+  1.06022,  1.40293,  1.78464,  1.90995,  2.08085,  2.37542,
+  0.893759,  1.22533,  1.74143,  1.89549,  2.06221,  2.44178,
+  0.911307,  1.30139,  1.65149,  1.79817,  1.99688,  2.20866,
+  1.10291,  1.50331,  1.70777,  1.80853,  1.95863,  2.31168,
+  1.14945,  1.32806,  1.73828,  1.90461,  2.06187,  2.25797,
+  1.12135,  1.23056,  1.74878,  1.95066,  2.08647,  2.38929,
+  0.94897,  1.10189,  1.67664,  1.87539,  2.01682,  2.29668,
+  1.03508,  1.16223,  1.64138,  1.95271,  2.10095,  2.35872,
+  0.994183,  1.11431,  1.5476,  1.77373,  1.96608,  2.3363,
+  1.02511,  1.1397,  1.58524,  1.91237,  2.10246,  2.48243,
+  0.955352,  1.06222,  1.65906,  1.84841,  2.04328,  2.48743,
+  1.0491,  1.12055,  1.44698,  1.94902,  2.0269,  2.56059,
+  1.01243,  1.13828,  1.36794,  2.00847,  2.18944,  2.42242,
+  1.08203,  1.23491,  1.35176,  1.82717,  2.17316,  2.30024,
+  1.09436,  1.23514,  1.41642,  1.92259,  2.12823,  2.41941,
+  1.03451,  1.15131,  1.49236,  1.98085,  2.14904,  2.36531,
+  1.01309,  1.15454,  1.45996,  1.94304,  2.28176,  2.39727,
+  0.987103,  1.27435,  1.56187,  1.91746,  2.33429,  2.49565,
+  0.989791,  1.28917,  1.62314,  1.98233,  2.34503,  2.54805,
+  1.04201,  1.22597,  1.61002,  1.9748,  2.40631,  2.53704,
+  1.01969,  1.32372,  1.67908,  1.98369,  2.44302,  2.56193,
+  1.03098,  1.24991,  1.75329,  1.9703,  2.44275,  2.5771,
+  1.07865,  1.28137,  1.82168,  2.04699,  2.51249,  2.6143,
+  1.0425,  1.31828,  1.81754,  1.97774,  2.53877,  2.64347,
+  1.03375,  1.32343,  1.88596,  1.99364,  2.58713,  2.64829,
+  1.08416,  1.43412,  1.89966,  1.97448,  2.66167,  2.7171,
+  1.09579,  1.4813,  1.91655,  1.97041,  2.67123,  2.73097,
+  1.14796,  1.55307,  1.88454,  1.96066,  2.50184,  2.66788,
+  1.13778,  1.49891,  1.96262,  2.04724,  2.53731,  2.64235,
+  1.10886,  1.43549,  1.95549,  2.19587,  2.51428,  2.60153,
+  1.19107,  1.55785,  1.98454,  2.27079,  2.54188,  2.64206,
+  1.11074,  1.55308,  1.97813,  2.21105,  2.61337,  2.70664,
+  1.11409,  1.72802,  1.97504,  2.12448,  2.60293,  2.68194,
+  1.14848,  1.62709,  1.96813,  2.0739,  2.60736,  2.68667,
+  1.109,  1.45065,  1.9611,  2.05861,  2.61165,  2.69461,
+  1.0959,  1.31876,  1.86664,  2.09629,  2.57468,  2.65884,
+  1.11656,  1.36797,  1.92253,  2.01651,  2.54944,  2.64623,
+  1.12947,  1.52911,  1.9422,  2.00334,  2.52787,  2.69992,
+  1.13905,  1.67954,  1.94587,  2.03292,  2.53743,  2.64217,
+  1.21921,  1.59942,  1.9296,  2.01109,  2.5391,  2.70528,
+  1.23397,  1.5562,  1.931,  2.08479,  2.57858,  2.67583,
+  1.23443,  1.65374,  2.03321,  2.25676,  2.63755,  2.69966,
+  1.25529,  1.47504,  2.02254,  2.28923,  2.58769,  2.70395,
+  1.25339,  1.4722,  1.9564,  2.21119,  2.57424,  2.6761,
+  1.12685,  1.58721,  1.95082,  2.03149,  2.41685,  2.61446,
+  1.00706,  1.6083,  1.89623,  1.98634,  2.22302,  2.52403,
+  1.06728,  1.72945,  1.93189,  2.04533,  2.16485,  2.40091,
+  0.94666,  1.69978,  1.87062,  1.98183,  2.13567,  2.44769,
+  1.00269,  1.72856,  1.93991,  2.07252,  2.27479,  2.46748,
+  1.14879,  1.60055,  2.00306,  2.12803,  2.40911,  2.50653,
+  1.19137,  1.35951,  1.90844,  2.11699,  2.36908,  2.52939,
+  1.22974,  1.31636,  1.90147,  2.00117,  2.36835,  2.5757,
+  1.16745,  1.28408,  1.85155,  2.05628,  2.44629,  2.57376,
+  1.17705,  1.28298,  1.79608,  2.01457,  2.4099,  2.52443,
+  1.16655,  1.28173,  1.80413,  1.93859,  2.38305,  2.5438,
+  1.14471,  1.2662,  1.75578,  1.86551,  2.35412,  2.57514,
+  1.16847,  1.28356,  1.69505,  1.81754,  2.30279,  2.52956,
+  1.09347,  1.31611,  1.62583,  1.79105,  2.30331,  2.40856,
+  1.07299,  1.21888,  1.58691,  1.72531,  2.2192,  2.34352,
+  0.946241,  1.17284,  1.42629,  1.55168,  2.19257,  2.32173,
+  1.0018,  1.17498,  1.50744,  1.69786,  2.2408,  2.47824,
+  0.992564,  1.25778,  1.42909,  1.81983,  2.23415,  2.43492,
+  0.933586,  1.25556,  1.37246,  1.68627,  2.26598,  2.34947,
+  0.987914,  1.16288,  1.40442,  1.56348,  2.22767,  2.48537,
+  1.05858,  1.18583,  1.32538,  1.44559,  2.16451,  2.45514,
+  1.04227,  1.14961,  1.38904,  1.47383,  1.90667,  2.39013,
+  0.966952,  1.07554,  1.28815,  1.4051,  2.06186,  2.45199,
+  0.90153,  1.19448,  1.35473,  1.70575,  2.32503,  2.43481,
+  1.03842,  1.29243,  1.52731,  1.90984,  2.23033,  2.46514,
+  1.33601,  1.44169,  1.84913,  2.20803,  2.4144,  2.53251,
+  1.43622,  1.64565,  2.00864,  2.19816,  2.50228,  2.60141,
+  1.42434,  1.68443,  1.92981,  2.1225,  2.51228,  2.60486,
+  1.4522,  1.72299,  1.96221,  2.15666,  2.4841,  2.58459,
+  1.482,  1.73524,  1.97119,  2.2228,  2.51231,  2.62362,
+  1.39256,  1.72127,  1.9403,  2.17497,  2.48894,  2.60185,
+  1.24335,  1.55846,  1.80982,  1.99089,  2.38197,  2.53748,
+  1.19929,  1.4215,  1.76311,  1.99088,  2.35892,  2.48956,
+  1.21777,  1.34878,  1.71467,  1.91684,  2.37973,  2.45696,
+  1.21952,  1.32685,  1.71966,  1.83808,  2.29933,  2.43541,
+  1.26307,  1.35366,  1.78723,  1.91897,  2.32039,  2.44825,
+  1.27096,  1.3738,  1.71818,  1.85793,  2.36692,  2.48175,
+  1.28435,  1.36807,  1.79391,  1.89508,  2.35679,  2.5246,
+  1.24479,  1.35366,  1.78295,  1.92869,  2.22572,  2.37995,
+  1.26928,  1.36873,  1.71918,  1.90968,  2.26716,  2.49154,
+  1.24931,  1.33819,  1.79992,  1.9171,  2.27469,  2.53322,
+  1.1795,  1.25905,  1.80297,  1.92733,  2.22893,  2.50364,
+  1.14096,  1.2459,  1.70866,  1.92379,  2.24346,  2.55734,
+  1.06395,  1.20903,  1.73729,  1.94535,  2.3387,  2.57309,
+  1.00347,  1.10916,  1.74513,  1.90219,  2.30844,  2.60161,
+  0.937618,  1.07754,  1.7478,  1.86965,  2.20505,  2.57045,
+  0.885099,  1.19245,  1.79054,  1.87616,  2.36031,  2.59811,
+  0.803485,  0.966415,  1.76846,  1.92874,  2.19672,  2.53046,
+  0.797205,  1.12072,  1.77658,  1.87857,  2.37036,  2.61434,
+  0.831514,  1.05908,  1.8088,  1.90548,  2.44821,  2.57305,
+  0.806597,  0.967446,  1.82939,  1.96368,  2.35863,  2.65324,
+  0.699378,  0.851831,  1.73945,  1.93394,  2.51638,  2.65525,
+  0.739203,  1.03399,  1.90211,  2.01033,  2.49415,  2.62982,
+  0.945605,  1.07971,  1.79635,  2.03954,  2.58186,  2.69978,
+  0.843512,  1.30486,  1.83545,  2.03683,  2.60022,  2.67783,
+  0.970152,  1.41437,  1.85405,  1.95779,  2.59605,  2.66543,
+  1.06728,  1.43854,  1.88843,  2.06709,  2.53102,  2.64318,
+  1.11762,  1.56311,  1.88632,  2.21887,  2.53022,  2.62408,
+  1.20966,  1.62691,  1.9437,  2.18743,  2.55509,  2.65867,
+  1.33889,  1.81288,  2.03089,  2.3052,  2.56927,  2.66116,
+  1.30337,  1.8401,  2.03598,  2.28675,  2.61423,  2.71336,
+  1.19343,  1.72735,  1.9262,  2.1844,  2.57478,  2.63181,
+  1.06351,  1.71719,  1.90366,  2.11905,  2.44481,  2.49767,
+  1.06218,  1.18895,  1.81048,  2.04498,  2.32238,  2.57878,
+  1.0732,  1.17756,  1.65473,  2.02326,  2.20037,  2.44287,
+  1.02781,  1.16542,  1.66947,  1.85961,  2.20214,  2.46247,
+  1.03558,  1.14824,  1.6049,  1.87255,  2.25785,  2.55168,
+  1.00721,  1.13109,  1.57915,  1.96979,  2.33164,  2.50791,
+  0.908594,  1.0056,  1.46327,  2.07237,  2.30436,  2.40736,
+  0.981614,  1.12643,  1.28057,  1.88685,  2.10192,  2.48784,
+  1.00676,  1.13256,  1.25309,  1.71832,  2.18925,  2.4366,
+  0.89983,  1.15654,  1.26075,  1.69671,  2.11666,  2.2283,
+  0.896996,  1.24655,  1.43687,  1.64519,  2.07364,  2.14913,
+  0.965481,  1.06967,  1.44649,  1.94949,  2.09158,  2.29833,
+  0.898113,  1.05877,  1.61756,  1.94155,  2.11357,  2.37474,
+  0.769481,  1.15938,  1.59741,  1.95985,  2.28384,  2.4182,
+  0.908091,  1.30534,  1.47357,  1.86255,  2.16415,  2.33109,
+  0.924282,  1.33469,  1.5632,  2.04354,  2.40601,  2.51576,
+  0.972939,  1.38197,  1.54999,  2.02124,  2.26849,  2.41933,
+  1.03223,  1.48403,  1.62003,  1.95223,  2.26732,  2.48644,
+  1.00523,  1.35469,  1.6202,  1.77792,  2.22307,  2.49757,
+  1.07274,  1.24504,  1.66167,  1.81939,  2.2605,  2.4687,
+  1.13447,  1.25048,  1.73703,  1.86897,  2.3032,  2.46643,
+  1.14594,  1.29326,  1.72851,  1.95098,  2.35098,  2.50402,
+  1.22636,  1.3298,  1.75078,  1.98214,  2.34784,  2.55303,
+  1.2348,  1.32811,  1.69673,  2.06056,  2.43731,  2.5356,
+  1.24713,  1.3605,  1.74295,  1.96135,  2.47408,  2.66845,
+  1.23474,  1.32984,  1.68863,  1.91333,  2.44294,  2.6277,
+  1.23043,  1.32664,  1.69759,  1.80604,  2.38147,  2.61854,
+  1.18857,  1.27308,  1.70898,  1.969,  2.34068,  2.58896,
+  1.20428,  1.33122,  1.83552,  2.14126,  2.46323,  2.58349,
+  1.20237,  1.39722,  1.86375,  2.15516,  2.59973,  2.68119,
+  1.21758,  1.3333,  1.7639,  1.99498,  2.60184,  2.68482,
+  1.27237,  1.36445,  1.77635,  1.9521,  2.56342,  2.67617,
+  1.33017,  1.43465,  1.82509,  1.93803,  2.57941,  2.6661,
+  1.38355,  1.51477,  1.77471,  2.135,  2.52858,  2.61471,
+  1.48823,  1.63125,  1.79594,  2.18059,  2.49779,  2.58593,
+  1.49785,  1.59843,  1.7604,  1.98572,  2.53807,  2.62222,
+  1.44651,  1.55569,  1.67548,  1.89962,  2.54707,  2.63713,
+  1.42019,  1.65176,  1.88812,  2.20156,  2.49872,  2.62437,
+  1.52485,  1.74892,  1.93948,  2.13259,  2.42662,  2.6043,
+  1.58821,  1.78697,  1.96571,  2.12325,  2.41743,  2.57989,
+  1.60305,  1.80525,  1.93272,  2.08806,  2.49088,  2.62847,
+  1.52171,  1.85304,  1.96816,  2.19842,  2.53092,  2.59723,
+  1.49631,  1.78581,  2.00198,  2.20617,  2.57416,  2.64528,
+  1.4052,  1.50056,  1.90867,  2.17922,  2.54373,  2.64577,
+  1.36955,  1.50131,  1.8488,  2.08986,  2.55112,  2.64362,
+  1.39538,  1.48864,  1.8724,  2.02812,  2.53026,  2.59919,
+  1.35458,  1.50897,  1.84888,  1.97668,  2.50493,  2.57936,
+  1.32575,  1.41133,  1.83713,  1.97079,  2.50272,  2.58483,
+  1.2645,  1.39044,  1.76476,  2.08734,  2.51928,  2.62504,
+  1.2809,  1.35565,  1.79029,  1.99571,  2.50257,  2.58736,
+  1.26744,  1.36084,  1.85803,  2.03563,  2.50938,  2.58487,
+  1.2389,  1.48754,  1.78666,  2.08035,  2.48091,  2.58214,
+  1.22871,  1.44114,  1.71596,  1.89333,  2.50707,  2.56513,
+  1.16735,  1.39731,  1.67205,  1.92353,  2.43839,  2.52352,
+  1.16923,  1.35681,  1.56743,  1.95038,  2.37895,  2.46801,
+  1.24024,  1.4709,  1.62973,  2.02468,  2.37672,  2.45487,
+  1.37086,  1.66529,  1.8315,  2.17643,  2.4864,  2.58657,
+  1.51337,  1.65704,  1.96501,  2.29801,  2.53215,  2.62301,
+  1.44694,  1.61268,  1.92909,  2.2323,  2.46621,  2.56515,
+  1.43066,  1.66453,  1.88216,  2.23458,  2.42166,  2.52729,
+  1.51155,  1.65893,  1.94404,  2.1985,  2.45195,  2.58835,
+  1.53944,  1.74136,  2.11106,  2.22992,  2.43894,  2.61506,
+  1.51095,  1.84689,  2.06179,  2.20245,  2.48411,  2.57263,
+  1.36639,  1.61165,  2.07937,  2.26007,  2.46706,  2.58803,
+  1.38358,  1.64134,  1.99735,  2.22615,  2.49144,  2.61163,
+  1.38146,  1.7069,  1.96306,  2.12555,  2.5968,  2.68111,
+  1.36003,  1.55825,  1.94966,  2.05483,  2.59957,  2.71455,
+  1.37934,  1.49178,  1.9259,  2.04634,  2.53937,  2.69605,
+  1.31327,  1.4694,  1.86311,  2.14175,  2.55396,  2.6681,
+  1.20152,  1.563,  1.92503,  2.09301,  2.47661,  2.61441,
+  0.965563,  1.66213,  1.8361,  2.07187,  2.53005,  2.57845,
+  0.976435,  1.63512,  1.84473,  2.00512,  2.55308,  2.61415,
+  1.09816,  1.54948,  1.82643,  1.90791,  2.49067,  2.62563,
+  0.971599,  1.43193,  1.81819,  1.92319,  2.49384,  2.56812,
+  0.881008,  1.27287,  1.90143,  1.95922,  2.51367,  2.59602,
+  0.915929,  1.47877,  1.9557,  2.08255,  2.49435,  2.58578,
+  1.00818,  1.57939,  1.8982,  2.13917,  2.47763,  2.55121,
+  0.937399,  1.50757,  1.80391,  1.92259,  2.54605,  2.6373,
+  0.848413,  1.35823,  1.78393,  1.90623,  2.47701,  2.58853,
+  0.863404,  1.48863,  1.8355,  1.93003,  2.4655,  2.54532,
+  0.844376,  1.62228,  1.8268,  2.04836,  2.49055,  2.54581,
+  0.869731,  1.70503,  1.8547,  2.1116,  2.51701,  2.59345,
+  0.862235,  1.62302,  1.89937,  2.02871,  2.52784,  2.5748,
+  0.931658,  1.57634,  1.85361,  1.97512,  2.54224,  2.61479,
+  0.848799,  1.58841,  1.8471,  1.9559,  2.53407,  2.58456,
+  0.737814,  1.45722,  1.82999,  1.9662,  2.50127,  2.57945,
+  0.786199,  1.10008,  1.86037,  1.96428,  2.41936,  2.56613,
+  0.728962,  1.04084,  1.77382,  1.96373,  2.35695,  2.57887,
+  0.733093,  1.14778,  1.78977,  1.90929,  2.34982,  2.4811,
+  0.785959,  1.28024,  1.73049,  1.9267,  2.34691,  2.42248,
+  0.784924,  1.44682,  1.66969,  1.93537,  2.36832,  2.4596,
+  0.758523,  1.46692,  1.8059,  1.94659,  2.35221,  2.42634,
+  0.767907,  1.54429,  1.76817,  2.00394,  2.23904,  2.38619,
+  0.896374,  1.56207,  1.71693,  1.9033,  2.30824,  2.43058,
+  0.83453,  1.50481,  1.73742,  1.91773,  2.40928,  2.49329,
+  0.896027,  1.40695,  1.73003,  1.90333,  2.43125,  2.53972,
+  1.03967,  1.36412,  1.80628,  1.94817,  2.44069,  2.55797,
+  1.09345,  1.41236,  1.83372,  1.9401,  2.48965,  2.56445,
+  1.19018,  1.38617,  1.8487,  1.9562,  2.48155,  2.58088,
+  1.24316,  1.35042,  1.8118,  1.89359,  2.46758,  2.61352,
+  1.22199,  1.30871,  1.81591,  1.91199,  2.41753,  2.601,
+  1.22837,  1.34362,  1.76316,  1.8726,  2.39489,  2.58272,
+  1.27839,  1.38971,  1.7385,  1.87027,  2.42085,  2.53285,
+  1.21164,  1.40179,  1.71015,  1.81102,  2.36383,  2.48224,
+  1.1615,  1.40068,  1.76667,  1.89174,  2.39261,  2.49592,
+  1.11494,  1.40549,  1.71834,  1.92742,  2.35682,  2.46833,
+  1.07468,  1.45296,  1.66872,  1.89809,  2.33653,  2.44346,
+  1.00671,  1.35625,  1.62948,  1.84847,  2.31389,  2.42632,
+  0.966452,  1.45792,  1.65469,  1.90639,  2.32006,  2.41834,
+  0.939007,  1.51999,  1.66701,  1.98942,  2.39067,  2.48895,
+  0.94684,  1.48398,  1.70109,  2.10557,  2.39144,  2.49007,
+  0.909129,  1.50106,  1.66537,  2.00494,  2.2567,  2.38984,
+  0.958919,  1.39061,  1.68008,  2.10716,  2.29725,  2.44084,
+  1.46216,  1.58856,  1.80854,  2.10989,  2.26483,  2.41747,
+  1.30164,  1.67381,  1.89252,  2.16811,  2.47756,  2.56162,
+  1.15277,  1.52933,  1.78378,  2.01435,  2.44661,  2.56093,
+  1.1287,  1.49302,  1.74816,  1.93027,  2.53067,  2.62159,
+  1.16436,  1.49686,  1.76766,  1.87114,  2.60725,  2.68479,
+  1.12271,  1.38051,  1.76224,  1.8756,  2.44152,  2.73281,
+  1.17391,  1.54593,  1.8438,  1.93379,  2.12345,  2.62901,
+  1.15544,  1.46581,  1.79388,  1.92855,  2.16855,  2.60961,
+  1.14781,  1.48454,  1.81642,  1.90876,  2.26262,  2.70408,
+  1.18587,  1.39352,  1.81185,  1.88111,  2.54429,  2.7359,
+  1.1533,  1.45114,  1.8554,  1.88862,  2.60331,  2.73808,
+  1.20885,  1.58236,  1.78486,  1.88009,  2.59648,  2.72788,
+  1.19484,  1.5429,  1.91906,  2.02314,  2.55189,  2.63419,
+  1.23033,  1.49206,  1.93722,  2.13361,  2.61573,  2.69023,
+  1.25876,  1.58131,  1.98007,  2.13876,  2.59904,  2.69103,
+  1.22069,  1.57296,  1.91721,  2.17754,  2.59959,  2.70201,
+  1.25814,  1.55663,  1.87174,  2.13263,  2.58551,  2.67331,
+  1.23377,  1.59824,  1.84996,  2.01367,  2.54286,  2.63448,
+  1.26976,  1.56079,  1.86522,  2.07633,  2.52108,  2.61744,
+  1.11656,  1.68088,  1.78169,  1.9205,  2.59221,  2.67584,
+  1.04821,  1.663,  1.8174,  1.91517,  2.48459,  2.62308,
+  0.954241,  1.61967,  1.81346,  1.88169,  2.55067,  2.63197,
+  0.964363,  1.57975,  1.72871,  1.86213,  2.56757,  2.63633,
+  1.29692,  1.64688,  1.88926,  2.06927,  2.32023,  2.48139,
+  1.23277,  1.6196,  1.95547,  2.06656,  2.33528,  2.45651,
+  1.23897,  1.35179,  1.87757,  2.16641,  2.31797,  2.47439,
+  1.18029,  1.38835,  1.60745,  1.95083,  2.21086,  2.47772,
+  1.124,  1.42354,  1.61732,  1.8268,  2.20607,  2.44408,
+  1.14779,  1.48705,  1.62797,  1.92602,  2.27842,  2.48653,
+  1.09265,  1.49972,  1.62304,  1.88016,  2.41166,  2.64865,
+  1.11529,  1.46869,  1.60763,  1.81446,  2.3569,  2.57609,
+  1.17604,  1.42463,  1.61423,  1.96634,  2.35268,  2.57035,
+  1.21105,  1.46743,  1.61778,  1.85149,  2.38977,  2.59186,
+  1.28768,  1.46486,  1.63379,  1.85623,  2.34975,  2.56532,
+  1.29859,  1.49522,  1.639,  1.94264,  2.41539,  2.51812,
+  1.30989,  1.43114,  1.75719,  1.97721,  2.41487,  2.52088,
+  1.39224,  1.47741,  1.8113,  1.90969,  2.44042,  2.57389,
+  1.41494,  1.51538,  1.859,  2.12794,  2.49067,  2.63542,
+  1.49044,  1.56597,  1.95241,  2.04907,  2.49994,  2.60018,
+  1.48507,  1.73412,  1.99737,  2.08938,  2.52477,  2.60816,
+  1.50713,  1.7872,  2.0481,  2.12836,  2.53363,  2.62465,
+  1.48522,  1.77259,  2.0481,  2.14437,  2.59574,  2.67979,
+  1.56004,  1.74452,  2.07614,  2.15684,  2.61506,  2.69877,
+  1.50628,  1.85545,  2.06419,  2.14453,  2.58566,  2.68779,
+  1.59288,  1.90345,  2.08453,  2.16339,  2.4969,  2.63359,
+  1.60945,  1.87086,  2.11982,  2.18659,  2.5995,  2.69782,
+  1.59478,  1.85535,  2.02562,  2.14254,  2.5723,  2.63784,
+  1.52719,  1.71409,  2.07627,  2.18517,  2.52655,  2.63114,
+  1.51801,  1.62801,  2.03926,  2.13453,  2.45384,  2.57636,
+  1.53131,  1.67808,  2.03518,  2.14689,  2.50486,  2.58417,
+  1.50863,  1.63261,  1.96514,  2.14868,  2.49664,  2.59275,
+  1.4999,  1.59942,  1.91369,  2.03686,  2.45019,  2.53817,
+  1.48116,  1.58381,  1.88446,  2.01387,  2.3595,  2.4811,
+  1.47574,  1.5697,  1.79999,  1.91618,  2.32922,  2.5359,
+  1.49864,  1.6236,  1.79282,  1.94522,  2.35863,  2.49073,
+  1.43113,  1.57463,  1.74326,  2.00612,  2.34776,  2.5089,
+  1.42706,  1.53658,  1.79069,  1.94303,  2.34447,  2.45265,
+  1.43684,  1.54202,  1.75892,  1.92562,  2.24291,  2.41684,
+  1.41979,  1.50904,  1.86332,  1.9954,  2.27579,  2.42473,
+  1.4244,  1.51048,  1.88289,  2.17902,  2.30471,  2.45567,
+  1.36605,  1.46119,  1.93532,  2.14755,  2.26342,  2.46579,
+  1.4074,  1.56497,  1.98112,  2.10344,  2.44529,  2.5651,
+  1.59701,  1.87701,  2.0685,  2.27031,  2.49936,  2.60489,
+  1.48498,  1.81813,  2.14982,  2.33759,  2.50475,  2.58944,
+  1.48788,  1.93718,  2.11827,  2.30837,  2.51178,  2.60463,
+  1.6823,  1.97703,  2.19229,  2.37368,  2.52293,  2.61128,
+  1.74946,  1.90568,  2.21827,  2.35201,  2.57423,  2.68148,
+  1.67622,  1.93651,  2.23718,  2.34378,  2.53591,  2.66127,
+  1.72336,  1.98992,  2.27124,  2.41314,  2.55083,  2.64937,
+  1.75601,  1.99691,  2.31266,  2.46148,  2.62542,  2.70874,
+  1.49977,  1.7633,  2.15887,  2.34688,  2.59272,  2.68285,
+  1.74752,  1.92713,  2.24894,  2.41084,  2.60412,  2.69088,
+  1.67035,  1.93826,  2.24767,  2.44713,  2.65754,  2.73004,
+  1.66924,  1.95961,  2.17932,  2.44053,  2.58843,  2.6408,
+  1.78023,  2.01514,  2.16481,  2.39902,  2.58191,  2.64694,
+  1.73956,  1.96722,  2.06569,  2.36448,  2.58998,  2.64944,
+  1.60501,  1.87511,  2.0189,  2.2274,  2.54118,  2.60354,
+  1.51125,  1.8926,  2.02783,  2.14811,  2.52,  2.6082,
+  1.36336,  1.56877,  1.91085,  2.05769,  2.46351,  2.55882,
+  1.3385,  1.48382,  1.8837,  2.06707,  2.44895,  2.5779,
+  1.36919,  1.43786,  1.84522,  2.07846,  2.4285,  2.61589,
+  1.3777,  1.49829,  1.86767,  2.16496,  2.49255,  2.57091,
+  1.4081,  1.48776,  1.87241,  2.09795,  2.44727,  2.55172,
+  1.40236,  1.53195,  1.89769,  2.12667,  2.41916,  2.55144,
+  1.4565,  1.55463,  1.84107,  2.09581,  2.42129,  2.56176,
+  1.43493,  1.52915,  1.79534,  2.1637,  2.44647,  2.53031,
+  1.39111,  1.4955,  1.86968,  2.16123,  2.38141,  2.53202,
+  1.38893,  1.53447,  1.797,  2.10294,  2.39851,  2.52127,
+  1.35857,  1.4713,  1.76005,  2.10088,  2.3502,  2.54655,
+  1.2766,  1.51921,  1.77942,  2.09582,  2.44294,  2.66594,
+  1.20666,  1.45786,  1.76046,  2.24428,  2.49588,  2.64485,
+  1.21461,  1.46027,  1.97902,  2.23945,  2.39832,  2.63447,
+  1.27547,  1.47347,  1.87857,  2.20312,  2.47503,  2.68785,
+  1.29171,  1.39929,  1.81381,  2.19412,  2.50276,  2.61489,
+  1.26006,  1.398,  1.92489,  2.18672,  2.51167,  2.64455,
+  1.21063,  1.32671,  1.89759,  2.10744,  2.46008,  2.71172,
+  1.20266,  1.31923,  1.89263,  2.07986,  2.37942,  2.67989,
+  0.967019,  1.10597,  1.76132,  2.10743,  2.32843,  2.59315,
+  0.947746,  1.0358,  1.39373,  2.06123,  2.30074,  2.66828,
+  0.996167,  1.21503,  1.37899,  1.86198,  2.32966,  2.60502,
+  1.00882,  1.19848,  1.31384,  1.69352,  2.36075,  2.60482,
+  1.05406,  1.21851,  1.36811,  1.73801,  2.17491,  2.54607,
+  1.02157,  1.13399,  1.36917,  1.93564,  2.2678,  2.54441,
+  1.03374,  1.22777,  1.45129,  2.00592,  2.41262,  2.59503,
+  1.06516,  1.16864,  1.53018,  2.0615,  2.41074,  2.48548,
+  1.12123,  1.28128,  1.43223,  1.90993,  2.20273,  2.50931,
+  1.17003,  1.30604,  1.49495,  1.98191,  2.20282,  2.35174,
+  1.15263,  1.26619,  1.621,  2.05767,  2.21445,  2.38164,
+  1.22813,  1.31327,  1.75147,  2.11847,  2.26342,  2.45389,
+  1.30783,  1.39865,  1.79975,  2.12574,  2.26062,  2.4518,
+  1.3601,  1.47744,  1.83574,  2.12187,  2.29156,  2.49979,
+  1.39848,  1.49297,  1.80652,  2.10714,  2.24141,  2.43415,
+  1.35121,  1.46251,  1.72639,  2.12239,  2.28579,  2.42184,
+  1.2972,  1.49887,  1.76625,  2.15784,  2.37671,  2.49716,
+  1.37735,  1.51897,  1.80379,  2.19115,  2.35637,  2.4789,
+  1.28917,  1.55324,  1.67459,  2.11263,  2.40335,  2.47388,
+  1.18897,  1.70034,  1.83432,  2.05558,  2.59953,  2.70041,
+  1.07704,  1.66767,  1.90219,  2.04569,  2.60291,  2.70006,
+  1.07206,  1.27246,  1.84374,  1.90118,  2.58625,  2.72056,
+  1.08439,  1.39207,  1.82356,  1.9013,  2.58943,  2.68003,
+  1.10632,  1.44136,  1.76614,  1.85372,  2.54936,  2.62741,
+  1.09457,  1.55002,  1.77192,  1.87095,  2.55968,  2.62805,
+  1.0419,  1.59855,  1.8137,  1.92849,  2.54563,  2.6715,
+  1.0902,  1.61051,  1.81256,  2.01926,  2.55632,  2.60879,
+  1.01653,  1.62666,  1.74241,  2.04192,  2.54154,  2.60225,
+  1.07557,  1.64775,  1.87067,  2.07397,  2.5746,  2.6288,
+  1.12666,  1.58621,  1.79257,  1.98241,  2.62918,  2.72556,
+  1.02778,  1.54267,  1.8314,  1.95688,  2.60301,  2.66852,
+  1.1119,  1.54342,  1.86147,  1.94292,  2.62196,  2.67286,
+  1.08051,  1.58319,  1.8573,  1.95846,  2.6336,  2.69514,
+  1.13224,  1.44916,  1.88495,  1.977,  2.60785,  2.70942,
+  1.23277,  1.6126,  1.96044,  2.07169,  2.64468,  2.72712,
+  1.32501,  1.7799,  1.9673,  2.11387,  2.54784,  2.66872,
+  1.40459,  1.64445,  2.05809,  2.25711,  2.51912,  2.63461,
+  1.41349,  1.6094,  2.00252,  2.1841,  2.58753,  2.69615,
+  1.35402,  1.59388,  2.01444,  2.1222,  2.61725,  2.72181,
+  1.37382,  1.65676,  1.99218,  2.18987,  2.54872,  2.70251,
+  1.42118,  1.61108,  1.95807,  2.12362,  2.56983,  2.64814,
+  1.37918,  1.6202,  1.92264,  2.09395,  2.55069,  2.64186,
+  1.36773,  1.65667,  1.83845,  1.99212,  2.59623,  2.65404,
+  1.39455,  1.75062,  1.87227,  2.03843,  2.55322,  2.62359,
+  1.46402,  1.74159,  1.91299,  2.15026,  2.56559,  2.64882,
+  1.46113,  1.80906,  1.95461,  2.2099,  2.57028,  2.64252,
+  1.43452,  1.77083,  1.90402,  2.21731,  2.63118,  2.687,
+  1.37553,  1.63166,  1.886,  2.08659,  2.6005,  2.67126,
+  1.33921,  1.56872,  1.81737,  2.08557,  2.59134,  2.66646,
+  1.5044,  1.77959,  2.05714,  2.27244,  2.5346,  2.63465,
+  1.4745,  1.74632,  2.04471,  2.13738,  2.47455,  2.63053,
+  1.55704,  1.75502,  2.03966,  2.08094,  2.66134,  2.74174,
+  1.57345,  1.71536,  2.05673,  2.09837,  2.69164,  2.74369,
+  1.51143,  1.83189,  1.99159,  2.15604,  2.62435,  2.70952,
+  1.50191,  1.71403,  2.01293,  2.07943,  2.55466,  2.69041,
+  1.54718,  1.67191,  1.97797,  2.10406,  2.50716,  2.61481,
+  1.56326,  1.63597,  1.99013,  2.12372,  2.56382,  2.63319,
+  1.58777,  1.69779,  2.00754,  2.12736,  2.58884,  2.65654,
+  1.6183,  1.72223,  2.00849,  2.13128,  2.61817,  2.68764,
+  1.58008,  1.68493,  2.00065,  2.08783,  2.61398,  2.68767,
+  1.57278,  1.73632,  1.96154,  2.14435,  2.64125,  2.68794,
+  1.53899,  1.65285,  1.95211,  2.15604,  2.6393,  2.68573,
+  1.53713,  1.6228,  1.96353,  2.07594,  2.6122,  2.67933,
+  1.53745,  1.63325,  1.98652,  2.07568,  2.54279,  2.6438,
+  1.54323,  1.77202,  2.05391,  2.14247,  2.53641,  2.69049,
+  1.6218,  1.83,  2.05274,  2.21086,  2.58321,  2.66584,
+  1.60957,  1.93532,  2.14668,  2.39332,  2.59721,  2.67056,
+  1.56082,  1.93554,  2.19144,  2.44438,  2.60992,  2.6926,
+  1.70428,  1.87459,  2.01026,  2.3801,  2.52866,  2.6048,
+  1.62478,  1.83779,  1.92536,  2.19301,  2.49717,  2.56943,
+  1.55613,  1.83265,  1.98694,  2.18932,  2.4532,  2.53163,
+  1.34743,  1.66967,  1.94393,  2.10805,  2.50663,  2.60842,
+  1.27841,  1.49725,  1.83841,  2.07392,  2.45455,  2.59232,
+  1.27105,  1.41512,  1.75811,  2.23246,  2.42277,  2.55467,
+  1.26034,  1.35671,  1.91317,  2.22589,  2.3806,  2.55725,
+  1.2231,  1.30797,  1.78409,  2.20752,  2.36287,  2.48779,
+  1.24945,  1.53816,  1.7166,  1.99832,  2.36211,  2.46553,
+  1.20801,  1.50306,  1.7613,  1.91708,  2.44805,  2.52513,
+  1.15185,  1.46115,  1.78394,  1.94689,  2.45256,  2.55631,
+  1.16556,  1.34777,  1.79995,  1.92075,  2.43788,  2.54695,
+  1.10979,  1.31045,  1.81589,  1.92338,  2.4273,  2.6028,
+  1.09199,  1.23364,  1.78961,  1.92504,  2.4678,  2.61117,
+  1.05232,  1.19475,  1.8099,  1.91423,  2.39018,  2.55632,
+  1.03227,  1.18949,  1.77562,  1.88969,  2.39325,  2.64083,
+  0.992854,  1.16963,  1.81416,  1.91225,  2.32027,  2.63432,
+  1.05441,  1.17775,  1.76276,  1.9072,  2.26618,  2.5163,
+  1.02954,  1.16736,  1.78006,  1.97354,  2.22784,  2.61389,
+  1.06778,  1.18481,  1.74132,  1.91913,  2.12196,  2.50079,
+  1.16784,  1.26305,  1.77863,  1.90072,  2.15081,  2.56866,
+  1.24703,  1.32367,  1.81105,  1.93459,  2.18402,  2.67462,
+  1.33178,  1.42614,  1.78514,  1.96603,  2.11456,  2.54183,
+  1.3609,  1.44414,  1.86253,  1.94975,  2.42674,  2.64611,
+  1.40854,  1.45179,  1.86692,  2.01423,  2.47884,  2.70591,
+  1.40555,  1.48355,  1.87498,  1.96029,  2.50276,  2.66254,
+  1.44237,  1.54466,  1.88335,  1.98759,  2.56298,  2.64776,
+  1.48072,  1.5362,  1.88182,  2.01887,  2.58235,  2.66179,
+  1.51308,  1.58325,  1.89576,  1.98715,  2.58617,  2.67601,
+  1.49776,  1.60209,  1.83101,  1.9854,  2.56409,  2.64364,
+  1.49706,  1.56491,  1.84464,  1.9577,  2.53993,  2.67716,
+  1.46811,  1.52375,  1.86584,  1.94008,  2.60797,  2.68486,
+  1.4681,  1.56439,  1.85892,  1.9824,  2.60648,  2.70969,
+  1.42273,  1.5192,  1.80679,  1.89159,  2.61482,  2.70389,
+  1.39687,  1.4767,  1.7764,  2.01325,  2.60785,  2.66599,
+  1.39153,  1.50457,  1.83054,  2.08154,  2.61102,  2.72081,
+  1.37288,  1.64506,  1.83336,  2.01576,  2.63134,  2.70134,
+  1.33129,  1.7474,  1.89795,  2.14651,  2.58668,  2.65827,
+  1.50318,  1.73469,  1.915,  2.28209,  2.59839,  2.67919,
+  1.46524,  1.71176,  2.02517,  2.28408,  2.65366,  2.71739,
+  1.4234,  1.76876,  2.08441,  2.27788,  2.63644,  2.71152,
+  1.42382,  1.72447,  2.03259,  2.30031,  2.60334,  2.68611,
+  1.43318,  1.81887,  2.05388,  2.40924,  2.6286,  2.69946,
+  1.50985,  1.79349,  2.05264,  2.35777,  2.64413,  2.71806,
+  1.57573,  1.85153,  2.03296,  2.3749,  2.58353,  2.66224,
+  1.50126,  1.78083,  1.99855,  2.32927,  2.5056,  2.60674,
+  1.46006,  1.76321,  1.91233,  2.21442,  2.49433,  2.57762,
+  1.44404,  1.65767,  1.89536,  2.14855,  2.47846,  2.59545,
+  1.45429,  1.61986,  1.93589,  2.18975,  2.47883,  2.59488,
+  1.37724,  1.64218,  1.91967,  2.14284,  2.42151,  2.54104,
+  1.05106,  1.42102,  1.8304,  2.02122,  2.37369,  2.54883,
+  0.964571,  1.07164,  1.3949,  2.1512,  2.37178,  2.46495,
+  0.966306,  1.18103,  1.30221,  2.01482,  2.37509,  2.43513,
+  0.89556,  1.20784,  1.33531,  1.82392,  2.23992,  2.3631,
+  1.00678,  1.20309,  1.31782,  1.87398,  2.33664,  2.40878,
+  1.05413,  1.22559,  1.37901,  2.02469,  2.33331,  2.42155,
+  1.0902,  1.22477,  1.40967,  2.0132,  2.24536,  2.35323,
+  1.07648,  1.20397,  1.56389,  2.03395,  2.20336,  2.3691,
+  1.12797,  1.24913,  1.66469,  2.08043,  2.25662,  2.46954,
+  1.20201,  1.42968,  1.79368,  2.08071,  2.33998,  2.46005,
+  1.51722,  1.6739,  1.92792,  2.20364,  2.38676,  2.52014,
+  1.58662,  1.78624,  2.04167,  2.199,  2.41637,  2.58119,
+  1.5933,  1.80855,  2.14878,  2.25028,  2.37209,  2.53241,
+  1.65729,  1.78346,  2.15039,  2.25813,  2.45392,  2.61621,
+  1.57149,  1.79266,  2.11765,  2.35038,  2.57719,  2.66695,
+  1.30199,  1.72975,  1.97442,  2.09325,  2.5939,  2.66302,
+  1.10022,  1.5634,  1.91991,  2.05922,  2.56297,  2.63776,
+  1.02507,  1.54074,  1.8119,  2.05791,  2.49188,  2.60325,
+  1.01531,  1.4735,  1.80259,  2.01308,  2.43676,  2.60532,
+  1.02207,  1.15848,  1.68979,  2.18353,  2.38378,  2.49237,
+  1.21248,  1.45311,  1.82395,  2.06144,  2.39619,  2.53658,
+  1.12624,  1.45293,  1.80959,  2.07107,  2.40894,  2.54956,
+  0.880332,  1.32478,  1.62134,  1.96725,  2.31316,  2.42693,
+  0.749583,  1.35841,  1.57507,  1.87059,  2.27923,  2.37743,
+  0.901917,  1.29022,  1.67443,  1.95441,  2.23336,  2.39152,
+  0.850971,  1.2521,  1.65765,  1.81646,  2.18389,  2.32881,
+  0.88148,  1.2841,  1.69816,  1.84466,  2.34182,  2.44091,
+  0.874499,  1.18268,  1.70949,  1.91745,  2.36597,  2.49965,
+  0.833751,  1.23113,  1.80332,  1.91802,  2.45909,  2.54688,
+  0.85097,  1.12709,  1.77207,  1.85522,  2.48758,  2.58286,
+  0.88165,  1.1148,  1.8207,  1.95908,  2.52175,  2.59873,
+  0.803558,  1.15029,  1.79848,  1.95267,  2.53892,  2.6349,
+  0.867833,  0.990496,  1.83228,  1.92977,  2.54766,  2.68108,
+  0.865057,  1.06744,  1.77326,  1.86019,  2.55833,  2.70222,
+  0.832529,  0.98596,  1.75637,  1.86293,  2.43828,  2.62378,
+  0.850804,  1.06055,  1.89222,  1.98401,  2.48377,  2.66112,
+  0.873803,  1.04198,  1.7462,  1.93244,  2.33822,  2.55458,
+  0.958594,  1.10347,  1.83644,  1.93678,  2.39376,  2.5732,
+  1.01483,  1.14087,  1.82593,  2.01371,  2.40149,  2.60942,
+  1.07537,  1.45764,  1.90046,  2.03349,  2.31419,  2.49095,
+  1.20171,  1.73617,  1.91408,  2.0665,  2.38691,  2.47696,
+  1.21522,  1.87361,  2.0659,  2.18299,  2.37498,  2.48955,
+  1.62021,  1.85126,  2.11154,  2.3428,  2.52749,  2.63389,
+  1.68388,  1.86037,  2.12601,  2.40434,  2.56298,  2.63616,
+  1.70382,  1.93438,  2.13367,  2.39321,  2.60193,  2.68247,
+  1.52688,  1.90013,  2.1511,  2.36164,  2.57517,  2.65898,
+  1.58725,  1.88139,  2.12995,  2.26786,  2.57786,  2.65784,
+  1.53916,  1.87134,  2.19028,  2.36038,  2.62461,  2.70564,
+  1.62575,  1.86218,  2.12009,  2.33946,  2.59216,  2.68214,
+  1.67953,  1.92069,  2.16117,  2.31711,  2.6489,  2.71211,
+  1.6352,  1.92283,  2.17484,  2.4074,  2.63005,  2.70927,
+  1.45419,  1.9757,  2.15185,  2.37134,  2.60918,  2.68579,
+  1.67244,  2.0114,  2.18302,  2.46392,  2.65296,  2.71152,
+  1.61211,  1.98748,  2.10258,  2.29335,  2.61613,  2.67026,
+  1.52807,  1.89507,  2.05358,  2.2325,  2.54491,  2.62412,
+  1.42035,  1.6835,  1.96343,  2.15942,  2.53673,  2.62013,
+  1.45632,  1.69313,  1.96923,  2.16474,  2.58716,  2.67759,
+  1.48111,  1.63754,  1.99264,  2.17848,  2.54814,  2.63276,
+  1.48852,  1.59117,  2.0165,  2.12332,  2.52866,  2.61492,
+  1.47743,  1.65152,  1.96289,  2.10218,  2.5433,  2.61884,
+  1.47386,  1.6223,  1.99223,  2.08035,  2.57269,  2.64443,
+  1.47822,  1.6334,  1.9312,  2.06413,  2.55228,  2.62934,
+  1.45248,  1.67676,  1.94591,  2.08475,  2.60097,  2.66889,
+  1.41156,  1.70618,  1.89025,  2.16962,  2.56732,  2.65016,
+  1.3834,  1.66463,  1.80326,  2.10861,  2.59577,  2.64622,
+  1.4346,  1.64501,  1.87175,  2.11549,  2.52896,  2.66026,
+  1.44454,  1.58183,  1.89864,  2.09407,  2.52845,  2.6315,
+  1.46556,  1.562,  1.84142,  2.0516,  2.55994,  2.63232,
+  1.49929,  1.58105,  1.85745,  2.09899,  2.5116,  2.60434,
+  1.52868,  1.65135,  1.87131,  2.07123,  2.56255,  2.62246,
+  1.51447,  1.63348,  1.7786,  2.1235,  2.6061,  2.66239,
+  1.30148,  1.68391,  1.79606,  2.17075,  2.64495,  2.69178,
+  1.15442,  1.62694,  1.74922,  1.99641,  2.57924,  2.6529,
+  1.11791,  1.56927,  1.79538,  1.8853,  2.37672,  2.73973,
+  1.25179,  1.62567,  1.83926,  1.99131,  2.35012,  2.65505,
+  1.41213,  1.69423,  1.83936,  1.9984,  2.44522,  2.73968,
+  1.37016,  1.68726,  1.87973,  2.00645,  2.32901,  2.63296,
+  1.17478,  1.72905,  1.88737,  2.01391,  2.25939,  2.55774,
+  1.31792,  1.73704,  1.87808,  1.97931,  2.17536,  2.63486,
+  1.14013,  1.58645,  1.93222,  2.02771,  2.23684,  2.48495,
+  1.10014,  1.6001,  1.85129,  1.97238,  2.60483,  2.64945,
+  1.11197,  1.52598,  1.84271,  2.01149,  2.6016,  2.66939,
+  1.08082,  1.49258,  1.81023,  1.96531,  2.55673,  2.64517,
+  1.12935,  1.6359,  1.78518,  2.1374,  2.498,  2.57252,
+  1.00359,  1.60301,  1.7227,  2.1394,  2.43159,  2.511,
+  1.12017,  1.42515,  1.67568,  2.05077,  2.34325,  2.46068,
+  1.32861,  1.59915,  1.87358,  2.17045,  2.47054,  2.61353,
+  1.38209,  1.59534,  1.92346,  2.08211,  2.34955,  2.51075,
+  1.46619,  1.57286,  1.87047,  2.18,  2.34634,  2.47187,
+  1.37977,  1.63301,  1.80827,  2.16629,  2.39872,  2.49247,
+  1.30592,  1.61002,  1.85641,  2.00154,  2.39067,  2.53391,
+  1.38309,  1.58681,  1.75722,  1.9348,  2.43354,  2.58795,
+  1.30751,  1.45094,  1.67533,  2.03394,  2.24423,  2.41812,
+  1.1915,  1.48407,  1.75027,  2.09664,  2.24938,  2.50498,
+  1.24138,  1.49179,  1.77688,  2.07173,  2.36793,  2.50807,
+  1.2657,  1.45992,  1.78175,  2.0099,  2.34858,  2.51604,
+  1.27951,  1.41465,  1.7951,  2.05594,  2.3957,  2.53054,
+  1.33734,  1.44593,  1.85301,  2.07518,  2.38598,  2.53549,
+  1.28897,  1.42471,  1.79799,  2.02629,  2.2998,  2.42371,
+  1.36528,  1.47179,  1.80171,  1.9377,  2.3453,  2.4667,
+  1.35379,  1.44775,  1.73621,  1.86889,  2.27436,  2.47558,
+  1.36086,  1.44961,  1.68047,  1.80265,  2.39554,  2.51326,
+  1.38833,  1.52625,  1.67333,  1.90987,  2.38502,  2.53543,
+  1.42443,  1.54422,  1.7202,  1.93624,  2.30797,  2.49142,
+  1.44894,  1.55201,  1.79794,  1.93752,  2.40687,  2.54612,
+  1.43203,  1.52162,  1.79932,  2.02144,  2.47733,  2.57175,
+  1.46309,  1.54628,  1.83442,  2.06349,  2.4898,  2.59527,
+  1.42547,  1.55643,  1.90472,  2.11082,  2.46637,  2.58756,
+  1.38484,  1.56941,  1.92558,  2.07237,  2.56129,  2.64054,
+  1.41849,  1.53942,  1.93754,  2.01432,  2.6092,  2.67676,
+  1.39701,  1.48328,  1.93673,  1.97775,  2.59561,  2.73585,
+  1.33562,  1.44187,  1.88474,  1.99496,  2.58963,  2.69575,
+  1.35749,  1.519,  1.8716,  1.9802,  2.62902,  2.7003,
+  1.35356,  1.52432,  1.89108,  1.96371,  2.59581,  2.67933,
+  1.2951,  1.63928,  1.90739,  2.10314,  2.58336,  2.67978,
+  1.45554,  1.66759,  1.9532,  2.24049,  2.57067,  2.67362,
+  1.46028,  1.78665,  1.99775,  2.28513,  2.58293,  2.67762,
+  1.54312,  1.72939,  2.15567,  2.28027,  2.65558,  2.74425,
+  1.43444,  1.74878,  2.0422,  2.20129,  2.6065,  2.69586,
+  1.43608,  1.74734,  2.06784,  2.25326,  2.57594,  2.67908,
+  1.47087,  1.69825,  2.08313,  2.25757,  2.56534,  2.66619,
+  1.41742,  1.69344,  2.05319,  2.24354,  2.54484,  2.6328,
+  1.41211,  1.68159,  2.0818,  2.3261,  2.47245,  2.57058,
+  1.39723,  1.76474,  2.03156,  2.29712,  2.47165,  2.57588,
+  1.4665,  1.6943,  2.00592,  2.20633,  2.53451,  2.63576,
+  1.43711,  1.74657,  1.92384,  2.12785,  2.35663,  2.46448,
+  1.32402,  1.59792,  1.75778,  2.12435,  2.34799,  2.44047,
+  1.37539,  1.62639,  1.77807,  2.0684,  2.25894,  2.39753,
+  1.37958,  1.62179,  1.85796,  1.99428,  2.30609,  2.47721,
+  1.41641,  1.64889,  1.86912,  2.09836,  2.3454,  2.47513,
+  1.42624,  1.6392,  1.9254,  2.07268,  2.44895,  2.53255,
+  1.45905,  1.61587,  1.91117,  2.12546,  2.4837,  2.59209,
+  1.45943,  1.6907,  1.85242,  2.13607,  2.5294,  2.5972,
+  1.48514,  1.57805,  1.81057,  2.15062,  2.55904,  2.61824,
+  1.52905,  1.59466,  1.7389,  2.26122,  2.59577,  2.65162,
+  1.53249,  1.58533,  1.82094,  2.22962,  2.62316,  2.65848,
+  1.3744,  1.52808,  1.84802,  2.04246,  2.45823,  2.59109,
+  1.39987,  1.59747,  1.85308,  2.09608,  2.4316,  2.55685,
+  1.45743,  1.60951,  1.93076,  2.1861,  2.39229,  2.52506,
+  1.44051,  1.60759,  1.86998,  2.15828,  2.42428,  2.55553,
+  1.37676,  1.47479,  1.75056,  2.19062,  2.40618,  2.54712,
+  1.32771,  1.45424,  1.64463,  2.11036,  2.35245,  2.45593,
+  1.3028,  1.41895,  1.60978,  2.09312,  2.26349,  2.39325,
+  1.20771,  1.37987,  1.53641,  2.05993,  2.3173,  2.4554,
+  1.15421,  1.30297,  1.49921,  2.07038,  2.3222,  2.63083,
+  1.11147,  1.22442,  1.62564,  2.17608,  2.34255,  2.60619,
+  0.945723,  1.0833,  1.62541,  2.21453,  2.3899,  2.51008,
+  0.992344,  1.11699,  1.45192,  2.00842,  2.31359,  2.43786,
+  1.11731,  1.39299,  1.71346,  2.13231,  2.27682,  2.49761,
+  1.33287,  1.58093,  1.89551,  2.129,  2.4251,  2.57695,
+  1.32204,  1.49774,  1.81922,  2.12864,  2.44361,  2.56795,
+  1.36194,  1.54738,  1.79097,  2.06294,  2.46532,  2.54609,
+  1.25268,  1.48388,  1.75863,  2.03345,  2.41628,  2.53922,
+  1.09938,  1.34475,  1.68653,  2.01675,  2.35586,  2.53084,
+  1.12611,  1.26362,  1.64994,  1.99154,  2.30909,  2.51489,
+  1.19062,  1.28965,  1.69271,  2.00948,  2.16009,  2.41707,
+  1.17498,  1.41431,  1.79786,  1.9876,  2.27882,  2.49276,
+  1.20535,  1.48205,  1.85076,  2.02555,  2.34228,  2.52343,
+  1.24803,  1.56119,  1.85276,  2.09645,  2.42836,  2.55187,
+  1.26073,  1.60183,  1.90105,  2.13198,  2.40985,  2.56555,
+  1.26504,  1.69384,  2.00053,  2.20004,  2.50351,  2.61771,
+  1.27884,  1.73826,  2.06202,  2.28998,  2.60444,  2.67811,
+  1.33943,  1.73592,  2.05012,  2.35241,  2.59739,  2.68822,
+  1.30106,  1.70875,  1.96598,  2.28621,  2.54671,  2.65318,
+  1.2786,  1.74616,  1.95007,  2.21477,  2.60579,  2.68762,
+  1.18377,  1.52306,  1.87912,  2.00491,  2.60031,  2.69049,
+  1.18622,  1.34213,  1.81783,  1.94008,  2.5049,  2.65925,
+  1.17939,  1.24368,  1.89426,  1.97975,  2.55802,  2.72182,
+  1.17562,  1.35704,  1.85319,  1.94081,  2.64681,  2.70566,
+  1.21112,  1.36964,  1.82525,  1.91329,  2.63472,  2.71226,
+  1.16947,  1.34515,  1.76494,  1.88367,  2.59108,  2.71452,
+  1.22209,  1.38948,  1.80018,  1.9359,  2.57377,  2.70292,
+  1.28727,  1.37591,  1.87874,  1.98605,  2.626,  2.70847,
+  1.29971,  1.3896,  1.8739,  1.94272,  2.53348,  2.69147,
+  1.27136,  1.4242,  1.84985,  1.95357,  2.55556,  2.65237,
+  1.25357,  1.44851,  1.82953,  1.9191,  2.48784,  2.63076,
+  1.22392,  1.32302,  1.84126,  1.93273,  2.22685,  2.57072,
+  1.22617,  1.32139,  1.77179,  1.94807,  2.13788,  2.56305,
+  1.31624,  1.39947,  1.78933,  1.96557,  2.13204,  2.42471,
+  1.26439,  1.36395,  1.73553,  2.0056,  2.15584,  2.41892,
+  1.21403,  1.31978,  1.66202,  1.90295,  2.06463,  2.42483,
+  1.2426,  1.34231,  1.62476,  1.92942,  2.08355,  2.31844,
+  1.24161,  1.43912,  1.64633,  1.81792,  1.99776,  2.19663,
+  1.23935,  1.33692,  1.77706,  2.02801,  2.15585,  2.3287,
+  1.17842,  1.26633,  1.80204,  1.95982,  2.1457,  2.46951,
+  1.2477,  1.32863,  1.81269,  1.99279,  2.20064,  2.49944,
+  1.27008,  1.37091,  1.88227,  1.99723,  2.25428,  2.52605,
+  1.29555,  1.37642,  1.86044,  2.07673,  2.249,  2.56712,
+  1.30484,  1.38609,  1.83276,  2.06162,  2.2194,  2.48635,
+  1.31431,  1.38148,  1.91283,  2.01753,  2.28775,  2.57642,
+  1.27508,  1.35377,  1.85847,  2.03703,  2.36206,  2.61542,
+  1.28711,  1.3668,  1.83552,  1.96109,  2.29199,  2.56297,
+  1.25667,  1.34116,  1.79881,  1.92126,  2.33365,  2.59691,
+  1.22928,  1.33751,  1.75398,  1.94239,  2.40355,  2.60217,
+  1.22487,  1.32298,  1.79261,  1.91891,  2.36331,  2.52058,
+  1.21845,  1.32159,  1.65149,  1.88416,  2.36654,  2.52128,
+  1.19322,  1.35912,  1.6324,  1.85763,  2.32285,  2.45271,
+  1.20547,  1.36803,  1.60803,  1.81504,  2.34185,  2.57451,
+  1.06125,  1.31843,  1.54502,  1.88874,  2.40188,  2.61702,
+  1.07252,  1.36579,  1.51413,  1.89367,  2.36962,  2.47423,
+  1.11164,  1.43679,  1.6061,  1.84246,  2.38242,  2.47411,
+  1.01206,  1.3162,  1.47159,  1.79906,  2.34943,  2.45513,
+  1.08947,  1.24857,  1.57279,  1.95306,  2.29844,  2.46178,
+  1.06836,  1.19581,  1.62402,  2.11129,  2.31148,  2.41925,
+  1.14751,  1.52522,  1.72481,  1.95717,  2.38753,  2.47131,
+  1.33434,  1.56815,  1.74904,  1.96257,  2.39063,  2.48465,
+  1.29814,  1.46788,  1.8144,  1.94157,  2.38423,  2.52218,
+  1.29501,  1.41849,  1.85947,  1.96233,  2.37632,  2.52176,
+  1.33583,  1.43664,  1.85826,  1.96633,  2.44658,  2.56348,
+  1.34649,  1.47798,  1.90564,  1.99809,  2.49005,  2.58447,
+  1.40718,  1.54076,  1.8793,  1.99298,  2.48794,  2.56401,
+  1.44766,  1.62857,  1.8282,  2.05365,  2.53405,  2.60586,
+  1.52471,  1.62005,  1.83788,  2.01792,  2.59217,  2.65337,
+  1.56458,  1.64714,  1.76118,  2.02415,  2.61525,  2.65657,
+  1.52937,  1.59398,  1.68316,  1.97983,  2.60164,  2.65439,
+  1.58508,  1.65284,  1.78677,  2.03185,  2.518,  2.62098,
+  1.58891,  1.64423,  1.81381,  2.04148,  2.61072,  2.66605,
+  1.60136,  1.68607,  1.86295,  2.12711,  2.60886,  2.65502,
+  1.64024,  1.75092,  1.9211,  2.16441,  2.54752,  2.61719,
+  1.5486,  1.6382,  1.9174,  2.09265,  2.56383,  2.61584,
+  1.51587,  1.61696,  1.84416,  2.00703,  2.52817,  2.60107,
+  1.46587,  1.5722,  1.74097,  2.01129,  2.49342,  2.58193,
+  1.41191,  1.53428,  1.66939,  2.02551,  2.41906,  2.53499,
+  1.3394,  1.5249,  1.67455,  2.01899,  2.344,  2.44379,
+  1.30067,  1.52706,  1.67307,  2.03619,  2.26952,  2.38379,
+  1.19308,  1.4765,  1.66446,  1.93323,  2.291,  2.41495,
+  1.19279,  1.48559,  1.64926,  1.84405,  2.29509,  2.502,
+  1.19782,  1.36486,  1.70369,  1.82721,  2.26277,  2.4998,
+  1.13827,  1.37925,  1.65813,  1.91249,  2.38908,  2.58338,
+  1.1666,  1.35794,  1.68892,  1.94273,  2.49153,  2.58925,
+  1.17061,  1.39155,  1.72193,  1.88951,  2.50612,  2.61639,
+  1.21096,  1.4527,  1.75562,  1.84497,  2.49006,  2.62473,
+  1.21214,  1.51972,  1.78592,  1.88927,  2.55126,  2.62949,
+  1.276,  1.66462,  1.95776,  2.24934,  2.60229,  2.6777,
+  1.40086,  1.81618,  1.99446,  2.32596,  2.65178,  2.7173,
+  1.46605,  1.83456,  2.11857,  2.37243,  2.62538,  2.70468,
+  1.57886,  1.79094,  2.1361,  2.39283,  2.63855,  2.71402,
+  1.4807,  1.81656,  2.20645,  2.43239,  2.57589,  2.64511,
+  1.61729,  1.80766,  2.24172,  2.44007,  2.56723,  2.63175,
+  1.5701,  1.78507,  2.17821,  2.34813,  2.46705,  2.55664,
+  1.57968,  1.70153,  2.00519,  2.28877,  2.43415,  2.54859,
+  1.57869,  1.67421,  1.96547,  2.19945,  2.33487,  2.4798,
+  1.64055,  1.72692,  1.99161,  2.24034,  2.40097,  2.52363,
+  1.58853,  1.70967,  1.87442,  2.16082,  2.38152,  2.51723,
+  1.4475,  1.66548,  1.90094,  2.10338,  2.39787,  2.53557,
+  1.20302,  1.59921,  1.88428,  2.03226,  2.36901,  2.50474,
+  1.14652,  1.51319,  1.8805,  1.98579,  2.40738,  2.52248,
+  1.13127,  1.435,  1.83409,  2.11135,  2.30655,  2.53115,
+  1.17671,  1.64034,  1.87012,  2.06494,  2.313,  2.43912,
+  1.25449,  1.59061,  1.95849,  2.20017,  2.34427,  2.47982,
+  1.24396,  1.68449,  2.0165,  2.19295,  2.45108,  2.54733,
+  1.53731,  1.76385,  2.18864,  2.37173,  2.53993,  2.64808,
+  1.64654,  1.88757,  2.28095,  2.44345,  2.59307,  2.68077,
+  1.56746,  1.87617,  2.10871,  2.42783,  2.61173,  2.69136,
+  1.34106,  1.87413,  2.11422,  2.3962,  2.62123,  2.70277,
+  1.4492,  1.83784,  2.0584,  2.30747,  2.61691,  2.68969,
+  1.31349,  1.79435,  1.96106,  2.2375,  2.59774,  2.68519,
+  1.20218,  1.70691,  1.9051,  2.13915,  2.61289,  2.69366,
+  1.08034,  1.59049,  1.84652,  2.05928,  2.63137,  2.69738,
+  1.04322,  1.60191,  1.90035,  2.14104,  2.58835,  2.66252,
+  0.984957,  1.55615,  1.84148,  2.14877,  2.57734,  2.66295,
+  0.979403,  1.55384,  1.84417,  2.0526,  2.57775,  2.64111,
+  0.947313,  1.45389,  1.83646,  1.99878,  2.56655,  2.63755,
+  0.95946,  1.44168,  1.83287,  2.1065,  2.55364,  2.63088,
+  0.951016,  1.39788,  1.79374,  2.05307,  2.49264,  2.62257,
+  0.870727,  1.36922,  1.81779,  2.10748,  2.52423,  2.62794,
+  0.902872,  1.38516,  1.7548,  2.01343,  2.53699,  2.65482,
+  0.891101,  1.3624,  1.75358,  1.87804,  2.5598,  2.66247,
+  0.835616,  1.25933,  1.75717,  1.83234,  2.48635,  2.63568,
+  0.787419,  1.13204,  1.69397,  1.77693,  2.53318,  2.61631,
+  0.791106,  1.06813,  1.69774,  1.8516,  2.57196,  2.66955,
+  0.759951,  1.11236,  1.56236,  1.8552,  2.49068,  2.60197,
+  0.792061,  1.14,  1.72482,  1.95446,  2.60886,  2.68968,
+  0.823952,  1.27093,  1.74109,  2.07766,  2.6132,  2.66939,
+  0.736534,  1.12497,  1.74368,  2.09325,  2.57979,  2.66172,
+  0.797043,  1.05194,  1.78023,  2.24036,  2.58348,  2.66231,
+  0.923582,  1.50315,  1.77688,  2.01847,  2.61391,  2.70304,
+  1.42154,  1.73503,  2.00689,  2.21034,  2.57432,  2.67074,
+  1.35017,  1.60612,  1.96301,  2.08497,  2.47819,  2.58995,
+  1.3618,  1.65658,  1.97408,  2.17388,  2.47963,  2.61201,
+  1.31994,  1.76445,  2.02745,  2.24929,  2.52964,  2.63574,
+  1.39403,  1.6642,  2.00631,  2.24619,  2.55809,  2.67132,
+  1.38539,  1.75543,  2.08002,  2.32987,  2.63089,  2.72267,
+  1.33369,  1.66943,  2.02149,  2.25061,  2.60027,  2.6891,
+  1.34153,  1.69816,  1.975,  2.23711,  2.56085,  2.68438,
+  1.38861,  1.78505,  1.95689,  2.28139,  2.56358,  2.64371,
+  1.34589,  1.70624,  1.84298,  2.26416,  2.60622,  2.69479,
+  1.32033,  1.69419,  1.92336,  2.21815,  2.64548,  2.75026,
+  1.33239,  1.74839,  2.01472,  2.22178,  2.60263,  2.69746,
+  1.3976,  1.71535,  1.94972,  2.236,  2.5778,  2.66148,
+  1.61881,  1.79597,  2.01642,  2.20519,  2.50664,  2.63683,
+  1.65981,  1.73533,  2.02109,  2.17584,  2.44338,  2.64145,
+  1.53953,  1.65206,  1.94677,  2.09508,  2.44664,  2.63655,
+  1.53227,  1.59287,  1.97782,  2.05341,  2.55149,  2.67491,
+  1.50935,  1.58111,  2.00424,  2.05938,  2.5246,  2.70294,
+  1.43253,  1.50463,  1.93071,  2.04233,  2.44066,  2.69085,
+  1.19464,  1.67704,  2.0231,  2.07839,  2.44691,  2.74585,
+  1.21037,  1.82483,  2.02151,  2.13909,  2.53993,  2.65964,
+  1.27662,  1.71544,  1.95249,  2.08382,  2.47346,  2.66435,
+  1.23566,  1.54844,  2.06734,  2.11862,  2.42744,  2.72754,
+  1.28347,  1.3743,  1.96342,  2.09842,  2.47439,  2.70286,
+  1.30502,  1.3947,  2.068,  2.13904,  2.52017,  2.70621,
+  1.28482,  1.49431,  2.05521,  2.14033,  2.60212,  2.69883,
+  1.29659,  1.58772,  2.0872,  2.15656,  2.61856,  2.71863,
+  1.25247,  1.58335,  2.10888,  2.17387,  2.6005,  2.68503,
+  1.17744,  1.61204,  2.09388,  2.15517,  2.58107,  2.69512,
+  1.13296,  1.57299,  2.13546,  2.2206,  2.61573,  2.71057,
+  1.06032,  1.54298,  2.16575,  2.23041,  2.60944,  2.69779,
+  0.993306,  1.5422,  2.17075,  2.24721,  2.63117,  2.70689,
+  0.78375,  1.56854,  2.32332,  2.39888,  2.5942,  2.6906,
+  0.866024,  1.45443,  2.11329,  2.18704,  2.66201,  2.71994,
+  0.793002,  1.4377,  2.12567,  2.22555,  2.58888,  2.66479,
+  0.863183,  1.43983,  2.03195,  2.20395,  2.58648,  2.64689,
+  0.817301,  1.44308,  2.07874,  2.35666,  2.57215,  2.63532,
+  0.8402,  1.2682,  1.97396,  2.38069,  2.54674,  2.62412,
+  0.90591,  1.47285,  2.0008,  2.42018,  2.60601,  2.66254,
+  0.885218,  1.59913,  2.06396,  2.33538,  2.68875,  2.73625,
+  0.812099,  1.48097,  2.10316,  2.19363,  2.62136,  2.70211,
+  0.727009,  1.48128,  2.08817,  2.17056,  2.57558,  2.66056,
+  0.783755,  1.48208,  2.21077,  2.28199,  2.56464,  2.65808,
+  0.81089,  1.318,  2.15666,  2.25015,  2.56537,  2.66617,
+  0.775372,  1.35271,  2.27746,  2.37173,  2.58724,  2.65549,
+  0.765239,  1.28061,  2.22745,  2.3049,  2.57753,  2.69687,
+  0.860727,  1.30996,  2.23921,  2.35825,  2.52375,  2.68183,
+  0.828001,  1.15751,  2.1572,  2.2792,  2.55451,  2.65538,
+  0.776568,  1.131,  2.11047,  2.28237,  2.50224,  2.63453,
+  0.662804,  1.21065,  2.21449,  2.27527,  2.48015,  2.59817,
+  0.752595,  1.17213,  2.27025,  2.35479,  2.53437,  2.61343,
+  0.769014,  1.03754,  2.23985,  2.32019,  2.52388,  2.63727,
+  0.747299,  1.03652,  2.05988,  2.38032,  2.50772,  2.67777,
+  0.818428,  1.11045,  2.13257,  2.30679,  2.44267,  2.59784,
+  0.838124,  1.25603,  2.15252,  2.30408,  2.50108,  2.59185,
+  0.84274,  1.14734,  2.04509,  2.31707,  2.45929,  2.58847,
+  0.950977,  1.15093,  2.09764,  2.29,  2.49742,  2.64345,
+  0.932262,  1.15976,  1.94518,  2.23375,  2.53889,  2.63575,
+  0.87264,  1.29467,  1.88108,  2.11219,  2.48873,  2.6127,
+  0.953242,  1.39834,  1.90676,  2.02445,  2.39667,  2.61633,
+  1.01916,  1.44724,  1.91732,  2.02333,  2.21302,  2.5289,
+  0.98091,  1.42044,  1.85762,  1.94344,  2.29448,  2.59612,
+  1.00792,  1.47472,  1.82759,  1.92148,  2.56736,  2.64375,
+  1.05767,  1.58382,  1.86222,  1.98831,  2.50759,  2.60278,
+  1.08948,  1.61094,  1.8942,  2.06798,  2.40143,  2.58925,
+  1.15564,  1.60152,  1.85378,  2.10992,  2.26642,  2.65488,
+  1.19039,  1.40321,  1.85032,  2.12943,  2.35548,  2.59965,
+  1.16567,  1.26623,  1.84792,  2.19176,  2.35216,  2.57681,
+  1.11254,  1.23723,  1.75555,  2.19641,  2.37841,  2.5159,
+  1.0932,  1.22932,  1.63097,  2.19849,  2.39433,  2.49006,
+  1.03092,  1.16009,  1.537,  2.15027,  2.34576,  2.52617,
+  1.09013,  1.22746,  1.4703,  2.12166,  2.32569,  2.41426,
+  1.08419,  1.35343,  1.49577,  2.16541,  2.39664,  2.50153,
+  1.12869,  1.38014,  1.55146,  2.11031,  2.29686,  2.419,
+  1.08717,  1.45426,  1.65879,  2.02039,  2.1963,  2.38146,
+  1.03939,  1.58219,  1.7281,  2.07018,  2.30185,  2.48943,
+  1.01902,  1.64687,  1.82892,  2.12577,  2.54247,  2.62493,
+  1.01791,  1.67544,  2.00939,  2.20063,  2.43227,  2.53275,
+  0.975365,  1.56846,  2.09963,  2.24376,  2.46967,  2.55866,
+  1.04514,  1.75055,  2.09119,  2.27703,  2.474,  2.55964,
+  1.00349,  1.67,  2.14987,  2.21681,  2.54414,  2.59102,
+  0.972271,  1.66935,  2.06691,  2.25346,  2.52812,  2.62679,
+  1.0014,  1.91054,  2.2089,  2.32209,  2.47505,  2.59415,
+  1.10624,  1.7624,  2.17021,  2.36833,  2.53238,  2.63695,
+  0.937567,  1.5708,  2.20831,  2.31208,  2.5476,  2.60415,
+  0.984015,  1.53165,  2.15445,  2.2604,  2.51955,  2.62137,
+  1.05805,  1.58968,  2.13047,  2.23879,  2.55922,  2.636,
+  1.12629,  1.6743,  2.14238,  2.30438,  2.58199,  2.6598,
+  1.09217,  1.54725,  2.13885,  2.24696,  2.57092,  2.65374,
+  1.16415,  1.51357,  2.1206,  2.20304,  2.55593,  2.62912,
+  1.15444,  1.45166,  2.10988,  2.19379,  2.56938,  2.66869,
+  1.17101,  1.29755,  2.10579,  2.22429,  2.52972,  2.66324,
+  1.13937,  1.34334,  2.02494,  2.16127,  2.57005,  2.66206,
+  1.21497,  1.75949,  2.01362,  2.12671,  2.35066,  2.50893,
+  1.41044,  1.78736,  1.94045,  2.082,  2.25578,  2.40636,
+  1.19253,  1.69828,  1.95689,  2.08484,  2.23574,  2.49064,
+  1.17363,  1.44875,  2.01112,  2.14525,  2.28014,  2.53471,
+  1.1728,  1.32718,  1.93887,  2.09591,  2.24756,  2.52684,
+  1.12971,  1.37614,  1.89153,  1.98533,  2.19635,  2.58265,
+  1.19522,  1.29291,  1.88721,  2.02514,  2.2007,  2.52559,
+  1.24628,  1.33897,  1.85165,  2.07279,  2.20907,  2.45744,
+  1.24471,  1.39554,  1.91684,  2.09705,  2.29649,  2.52665,
+  1.34643,  1.45327,  2.12841,  2.31384,  2.56627,  2.66621,
+  1.39218,  1.50657,  2.06042,  2.18383,  2.52364,  2.65642,
+  1.39767,  1.47836,  2.03787,  2.14002,  2.52288,  2.63488,
+  1.40508,  1.43797,  2.0647,  2.12168,  2.48434,  2.66409,
+  1.52797,  1.73164,  2.0014,  2.18228,  2.47746,  2.60968,
+  1.60222,  1.69405,  2.06501,  2.17614,  2.56757,  2.65075,
+  1.54924,  1.66815,  2.06194,  2.13605,  2.57595,  2.67854,
+  1.59049,  1.69321,  1.92159,  2.19358,  2.52234,  2.65782,
+  1.59312,  1.7156,  2.05786,  2.17281,  2.50201,  2.60776,
+  1.50846,  1.71395,  2.05346,  2.14686,  2.38304,  2.62867,
+  1.50094,  1.57787,  1.97852,  2.08096,  2.51787,  2.64082,
+  1.50382,  1.5592,  1.93328,  2.0306,  2.51619,  2.6575,
+  1.43095,  1.50644,  1.85636,  2.01451,  2.40691,  2.5838,
+  1.39442,  1.47116,  1.91477,  2.01533,  2.41451,  2.56893,
+  1.37672,  1.47674,  1.84174,  1.96157,  2.45962,  2.55251,
+  1.30483,  1.50926,  1.80786,  1.89902,  2.5326,  2.61656,
+  1.48624,  1.64687,  1.92899,  2.17664,  2.50338,  2.64553,
+  1.47707,  1.57641,  1.9373,  2.09445,  2.46873,  2.64363,
+  1.43149,  1.55127,  1.93581,  2.02799,  2.46876,  2.60559,
+  1.42717,  1.67082,  1.94498,  2.10994,  2.48274,  2.65243,
+  1.39319,  1.64956,  1.99108,  2.07033,  2.58645,  2.66734,
+  1.40697,  1.51853,  1.96705,  2.06775,  2.50172,  2.62411,
+  1.39913,  1.48738,  1.88033,  1.97257,  2.35919,  2.60481,
+  1.41945,  1.54191,  1.92089,  2.01526,  2.41644,  2.54754,
+  1.44774,  1.62665,  1.9116,  2.03784,  2.5083,  2.60909,
+  1.50794,  1.64922,  1.95449,  2.06384,  2.51578,  2.59147,
+  1.51251,  1.69788,  1.91927,  2.07717,  2.54577,  2.63108,
+  1.57749,  1.65292,  1.96938,  2.05711,  2.5335,  2.61048,
+  1.60471,  1.68784,  1.94363,  2.0307,  2.55246,  2.65947,
+  1.63482,  1.71009,  1.94351,  2.03574,  2.55304,  2.65052,
+  1.62911,  1.72105,  1.90726,  2.02014,  2.5701,  2.65261,
+  1.65386,  1.73101,  1.91707,  2.0165,  2.55131,  2.67898,
+  1.67562,  1.74025,  1.92311,  1.99547,  2.54389,  2.69347,
+  1.70432,  1.761,  1.89209,  1.9586,  2.52034,  2.70958,
+  1.63175,  1.69802,  1.87977,  1.97482,  2.47504,  2.68871,
+  1.56339,  1.66235,  1.8635,  1.96166,  2.49207,  2.69214,
+  1.53527,  1.6218,  1.86452,  2.01688,  2.4572,  2.70145,
+  1.46363,  1.69,  1.94259,  2.01949,  2.51608,  2.68408,
+  1.42716,  1.54573,  1.9226,  1.98339,  2.54908,  2.72404,
+  1.38786,  1.46942,  1.87429,  2.04709,  2.48657,  2.64301,
+  1.36474,  1.46274,  1.90851,  2.07652,  2.46877,  2.62742,
+  1.42161,  1.61667,  2.07439,  2.24363,  2.60481,  2.69712,
+  1.44357,  1.80248,  2.14589,  2.31103,  2.61513,  2.70497,
+  1.40281,  1.86481,  2.20938,  2.37797,  2.65429,  2.73144,
+  1.47267,  1.8608,  2.16288,  2.44727,  2.64842,  2.71902,
+  1.5185,  1.79472,  2.07501,  2.33921,  2.5521,  2.65593,
+  1.5036,  1.75847,  2.11155,  2.30448,  2.551,  2.64355,
+  1.46676,  1.58771,  2.04614,  2.2766,  2.54651,  2.64991,
+  1.41461,  1.49916,  2.00069,  2.08085,  2.54908,  2.65441,
+  1.32462,  1.59742,  1.9617,  2.07526,  2.51879,  2.63826,
+  1.26245,  1.66607,  1.96155,  2.09827,  2.5491,  2.63037,
+  1.22087,  1.63212,  1.94765,  2.05495,  2.51597,  2.60756,
+  1.13665,  1.56914,  1.92325,  2.0114,  2.51398,  2.61292,
+  1.05857,  1.57058,  1.92127,  2.03797,  2.48449,  2.5695,
+  1.03982,  1.49237,  1.86238,  2.11332,  2.46263,  2.58629,
+  1.29165,  1.54669,  1.88843,  2.16034,  2.44457,  2.57368,
+  1.15415,  1.62983,  1.97872,  2.11452,  2.50541,  2.61617,
+  1.01899,  1.84423,  2.0035,  2.14564,  2.43005,  2.54966,
+  1.00364,  1.90025,  2.10397,  2.20081,  2.55527,  2.67887,
+  1.00718,  1.65253,  2.03338,  2.1179,  2.53436,  2.59384,
+  1.01407,  1.62531,  2.07357,  2.164,  2.54614,  2.61183,
+  1.00985,  1.72901,  2.00161,  2.19007,  2.55455,  2.63543,
+  1.01949,  1.59982,  2.06292,  2.18098,  2.58535,  2.65191,
+  1.04228,  1.55985,  2.06172,  2.18491,  2.60883,  2.71127,
+  1.09398,  1.6067,  2.06705,  2.17946,  2.57811,  2.64708,
+  1.11752,  1.5545,  2.01046,  2.17126,  2.52419,  2.60461,
+  1.18915,  1.68712,  2.02682,  2.22074,  2.58466,  2.6736,
+  1.18429,  1.59293,  2.01141,  2.14056,  2.57563,  2.65276,
+  1.24327,  1.54434,  1.99135,  2.10372,  2.54773,  2.63384,
+  1.2498,  1.53006,  1.93046,  2.04451,  2.4895,  2.61104,
+  1.31723,  1.55086,  1.92747,  2.01911,  2.56358,  2.63241,
+  1.30015,  1.5712,  1.81721,  1.96732,  2.57201,  2.65975,
+  1.30479,  1.45907,  1.80435,  1.8738,  2.57235,  2.67785,
+  1.27211,  1.38793,  1.71059,  1.79844,  2.51912,  2.63097,
+  1.16882,  1.27144,  1.68047,  1.84764,  2.47259,  2.63611,
+  1.12771,  1.38042,  1.70269,  1.94834,  2.2548,  2.51659,
+  1.03734,  1.36207,  1.69887,  1.94336,  2.31998,  2.57611,
+  0.912701,  1.21524,  1.77476,  2.05793,  2.4073,  2.60974,
+  0.884045,  1.28334,  1.74009,  2.01204,  2.33233,  2.53015,
+  0.859928,  1.36139,  1.78777,  2.03243,  2.43916,  2.5725,
+  0.933575,  1.49731,  1.86011,  2.00776,  2.46078,  2.63658,
+  0.980843,  1.37667,  1.80827,  1.8993,  2.55138,  2.66068,
+  0.888314,  1.39084,  1.81906,  1.9386,  2.61173,  2.7137,
+  0.839112,  1.45505,  1.86425,  1.93257,  2.56126,  2.64948,
+  0.851738,  1.63344,  1.85494,  2.0651,  2.59153,  2.63797,
+  0.927993,  1.73919,  1.88202,  2.1332,  2.58502,  2.64078,
+  0.938681,  1.79566,  1.96211,  2.13893,  2.56523,  2.6279,
+  0.939389,  1.84213,  2.02182,  2.19635,  2.61152,  2.65832,
+  0.876668,  1.92276,  2.0666,  2.23861,  2.65783,  2.70914,
+  0.92889,  1.83181,  2.05372,  2.20362,  2.65364,  2.69541,
+  0.843177,  1.78595,  2.18004,  2.25807,  2.59681,  2.66987,
+  0.90471,  1.73857,  2.04548,  2.17133,  2.65908,  2.70177,
+  0.870576,  1.67285,  2.04668,  2.1603,  2.66339,  2.70628,
+  0.863208,  1.61128,  2.03958,  2.13199,  2.66274,  2.71021,
+  0.911587,  1.52148,  1.97225,  2.1177,  2.67151,  2.73629,
+  0.857624,  1.50623,  1.92746,  2.09207,  2.599,  2.67135,
+  0.876724,  1.38621,  1.9301,  2.02012,  2.64025,  2.71571,
+  0.822485,  1.36308,  1.9511,  2.01209,  2.54628,  2.70422,
+  0.896312,  1.29923,  1.94615,  2.04,  2.42757,  2.66043,
+  0.993275,  1.37977,  2.00112,  2.08344,  2.47648,  2.62108,
+  1.11197,  1.36926,  1.98057,  2.05008,  2.51842,  2.65472,
+  1.16821,  1.42116,  1.92965,  2.01373,  2.5139,  2.65946,
+  1.18553,  1.47731,  1.9417,  2.02179,  2.54584,  2.63683,
+  1.13468,  1.49839,  1.99686,  2.07705,  2.4871,  2.60596,
+  1.41173,  1.50081,  1.93056,  2.25169,  2.39141,  2.51475,
+  1.3871,  1.55163,  1.93927,  2.13443,  2.39065,  2.5381,
+  1.43647,  1.60163,  1.85631,  2.00172,  2.49843,  2.57968,
+  1.49076,  1.67386,  1.86537,  2.01526,  2.49094,  2.5896,
+  1.53229,  1.66582,  1.85411,  1.98779,  2.54431,  2.63455,
+  1.56314,  1.68325,  1.81921,  1.98134,  2.5924,  2.65599,
+  1.53269,  1.64287,  1.79509,  1.95595,  2.59557,  2.68867,
+  1.50694,  1.59687,  1.72472,  1.90252,  2.49715,  2.64677,
+  1.38523,  1.5533,  1.73378,  1.99349,  2.38568,  2.62019,
+  1.19137,  1.50809,  1.91412,  2.17718,  2.46035,  2.60064,
+  0.990202,  1.26842,  1.7603,  1.98849,  2.51666,  2.66102,
+  1.00489,  1.27303,  1.91958,  1.97696,  2.62153,  2.71115,
+  1.01329,  1.47917,  1.98377,  2.02111,  2.56129,  2.68139,
+  1.09438,  1.4242,  1.985,  2.16479,  2.59214,  2.67097,
+  1.05777,  1.37751,  1.86611,  2.16542,  2.49067,  2.62334,
+  1.00177,  1.3213,  1.90229,  2.13388,  2.49989,  2.65935,
+  0.896048,  1.41478,  1.92755,  2.1276,  2.57065,  2.6585,
+  0.862503,  1.58697,  1.94655,  2.15362,  2.61512,  2.67787,
+  0.837783,  1.70001,  1.93298,  2.20945,  2.58857,  2.68753,
+  0.901209,  1.63977,  1.99997,  2.07058,  2.5153,  2.76315,
+  0.955829,  1.60125,  2.00897,  2.11223,  2.50389,  2.59284,
+  0.939285,  1.70409,  2.02741,  2.12592,  2.43001,  2.53892,
+  0.948268,  1.70087,  2.00277,  2.08835,  2.56347,  2.62211,
+  0.959154,  1.62427,  2.00582,  2.07776,  2.57772,  2.65873,
+  0.932538,  1.59344,  1.95283,  2.04466,  2.56798,  2.6445,
+  0.933107,  1.59056,  1.9457,  2.1119,  2.53428,  2.60887,
+  0.943808,  1.64909,  1.89702,  2.10465,  2.57817,  2.68976,
+  1.00303,  1.61916,  1.93023,  2.21672,  2.58234,  2.63789,
+  0.93681,  1.69235,  1.96553,  2.11865,  2.62852,  2.6848,
+  0.973578,  1.73782,  1.97567,  2.10634,  2.65829,  2.72245,
+  0.955324,  1.75019,  1.96144,  2.07537,  2.65561,  2.73176,
+  0.994013,  1.72739,  1.94678,  2.06241,  2.64338,  2.73849,
+  1.00536,  1.69392,  1.92987,  2.10018,  2.61875,  2.68486,
+  0.967862,  1.64008,  1.93026,  2.02155,  2.63989,  2.72666,
+  0.928258,  1.57936,  1.86441,  1.97301,  2.63891,  2.71789,
+  1.05833,  1.41059,  1.87085,  2.06602,  2.45158,  2.6337,
+  1.12305,  1.48688,  1.86297,  2.08608,  2.41298,  2.59174,
+  1.17747,  1.43154,  1.84929,  2.09976,  2.42334,  2.56613,
+  1.18703,  1.44351,  1.88207,  1.98332,  2.55067,  2.63939,
+  1.26797,  1.62839,  1.93261,  2.04328,  2.55223,  2.64173,
+  1.35555,  1.70156,  1.92424,  2.03456,  2.59018,  2.66096,
+  1.47206,  1.73998,  1.91426,  2.05233,  2.57389,  2.64493,
+  1.46149,  1.79066,  1.91131,  2.05787,  2.5256,  2.58723,
+  1.54235,  1.7424,  1.90165,  2.06306,  2.49917,  2.58066,
+  1.55081,  1.6429,  1.87739,  1.99515,  2.47436,  2.56117,
+  1.62535,  1.72476,  1.89911,  2.05259,  2.44709,  2.55685,
+  1.6367,  1.7422,  1.90449,  2.15532,  2.47031,  2.56929,
+  1.60869,  1.70103,  1.95711,  2.08558,  2.46532,  2.5522,
+  1.51757,  1.68517,  1.92305,  2.02897,  2.3829,  2.50393,
+  1.21585,  1.64813,  1.84289,  2.04997,  2.39383,  2.48435,
+  1.1585,  1.45299,  1.75267,  1.85902,  2.46727,  2.57552,
+  1.12827,  1.38415,  1.8015,  1.89918,  2.47245,  2.60999,
+  1.08062,  1.41434,  1.81249,  1.91664,  2.42269,  2.62012,
+  1.10487,  1.49291,  1.85404,  1.97194,  2.444,  2.58358,
+  1.23581,  1.43782,  1.91948,  2.04279,  2.484,  2.61715,
+  1.16741,  1.4076,  1.77439,  2.07357,  2.3906,  2.54332,
+  1.09657,  1.31723,  1.78221,  2.01354,  2.39437,  2.57181,
+  1.10431,  1.2068,  1.71858,  2.00101,  2.35134,  2.50564,
+  1.04732,  1.31689,  1.82432,  2.05077,  2.41716,  2.53103,
+  1.08718,  1.4084,  1.84314,  2.03167,  2.44048,  2.54426,
+  1.10852,  1.3942,  1.76003,  2.00573,  2.43503,  2.55215,
+  1.12177,  1.34059,  1.7495,  1.96363,  2.49382,  2.60964,
+  1.12241,  1.45271,  1.79313,  2.03041,  2.50213,  2.59324,
+  1.02688,  1.4681,  1.74534,  1.86047,  2.48368,  2.57975,
+  0.97167,  1.24409,  1.75298,  1.83733,  2.38472,  2.62532,
+  0.917302,  1.10441,  1.67493,  1.79243,  2.33619,  2.62947,
+  0.96156,  1.08836,  1.55578,  1.66371,  2.28232,  2.57975,
+  0.919563,  1.06328,  1.5732,  1.7111,  2.42269,  2.67598,
+  0.875889,  1.02261,  1.38084,  1.82916,  2.58466,  2.66738,
+  0.763749,  1.01881,  1.50632,  1.70798,  2.47153,  2.59587,
+  0.886944,  1.03139,  1.42506,  1.71002,  2.42792,  2.57639,
+  0.890351,  1.03765,  1.44399,  1.58788,  2.52021,  2.69583,
+  0.906256,  1.03505,  1.40561,  1.52374,  2.53653,  2.59608,
+  0.929418,  1.06107,  1.15709,  1.5666,  2.52826,  2.69407,
+  0.917396,  1.10612,  1.25304,  1.38951,  2.55157,  2.7091,
+  0.91023,  1.04207,  1.16253,  1.36213,  2.39308,  2.60535,
+  0.804288,  1.05959,  1.41808,  1.53036,  2.41057,  2.66344,
+  0.907675,  1.04629,  1.39254,  1.50823,  2.49535,  2.69234,
+  0.835212,  1.12687,  1.3505,  1.46321,  2.56773,  2.69467,
+  0.770295,  1.1507,  1.42826,  1.60117,  2.61023,  2.68367,
+  0.924536,  1.07541,  1.46853,  1.66987,  2.54368,  2.6932,
+  0.972382,  1.19176,  1.54476,  1.63867,  2.53532,  2.64297,
+  0.903877,  1.10193,  1.51078,  1.60266,  2.48704,  2.63827,
+  0.881279,  1.0969,  1.55425,  1.6443,  2.42466,  2.55757,
+  0.866115,  1.11888,  1.60304,  1.70247,  2.5439,  2.6493,
+  0.906645,  1.16025,  1.67202,  1.74726,  2.51791,  2.65086,
+  0.861085,  1.20586,  1.66099,  1.84709,  2.46274,  2.63203,
+  0.837175,  1.18778,  1.80604,  1.8895,  2.50861,  2.68456,
+  0.797709,  1.17852,  1.90318,  2.02165,  2.54618,  2.69007,
+  0.802875,  1.26275,  1.92394,  2.00058,  2.56844,  2.67011,
+  0.766638,  1.32083,  1.96102,  2.05894,  2.58231,  2.64672,
+  0.811579,  1.45519,  2.01148,  2.08478,  2.54842,  2.63993,
+  0.82977,  1.48496,  2.05271,  2.12723,  2.53064,  2.60818,
+  0.799011,  1.56745,  2.15563,  2.26511,  2.57317,  2.6685,
+  0.730379,  1.35861,  2.12579,  2.19459,  2.5187,  2.60543,
+  0.720667,  1.27784,  2.04281,  2.11192,  2.5928,  2.6753,
+  0.777663,  1.1637,  2.06679,  2.1792,  2.57,  2.67551,
+  0.839969,  1.37318,  2.18588,  2.30468,  2.50936,  2.60258,
+  0.815752,  1.91522,  2.23363,  2.28848,  2.56998,  2.62843,
+  1.19188,  1.94569,  2.17513,  2.29905,  2.52352,  2.63204,
+  1.03628,  1.74221,  2.07271,  2.14156,  2.57319,  2.64155,
+  1.04251,  1.30305,  2.01289,  2.15461,  2.53068,  2.64918,
+  1.10994,  1.20424,  1.92869,  2.05823,  2.3841,  2.63957,
+  1.18739,  1.2877,  1.95425,  2.07126,  2.38256,  2.64181,
+  1.23919,  1.32776,  1.93055,  2.01528,  2.36169,  2.6275,
+  1.29208,  1.35198,  1.93801,  2.01732,  2.4115,  2.66343,
+  1.30624,  1.3824,  1.91845,  2.03831,  2.33939,  2.63774,
+  1.33024,  1.40164,  1.87376,  1.99044,  2.1855,  2.51091,
+  1.35639,  1.45976,  1.88339,  1.98046,  2.26455,  2.54181,
+  1.3474,  1.43864,  1.89167,  2.01801,  2.30257,  2.64381,
+  1.30088,  1.39017,  1.88927,  1.97293,  2.33752,  2.60564,
+  1.31867,  1.41012,  1.89535,  1.99037,  2.38468,  2.65404,
+  1.30927,  1.4255,  1.96615,  2.0219,  2.50112,  2.69851,
+  1.29385,  1.37092,  1.90844,  1.99915,  2.46548,  2.674,
+  1.2774,  1.38284,  2.0023,  2.06684,  2.49685,  2.66407,
+  1.24538,  1.42244,  2.00291,  2.07072,  2.55684,  2.66639,
+  1.27259,  1.49109,  2.0123,  2.12924,  2.56231,  2.65743,
+  1.26518,  1.53394,  2.02094,  2.09309,  2.49838,  2.63095,
+  1.2657,  1.47703,  2.10301,  2.19653,  2.45528,  2.61989,
+  1.2885,  1.64245,  2.09385,  2.24783,  2.56169,  2.65879,
+  1.41026,  1.82897,  2.17187,  2.37413,  2.56459,  2.65338,
+  1.35389,  1.71004,  2.20933,  2.42604,  2.62932,  2.70219,
+  1.41361,  1.76693,  2.13772,  2.43485,  2.63206,  2.70291,
+  1.45905,  1.70694,  2.13508,  2.37703,  2.62642,  2.70895,
+  1.49802,  1.68792,  2.09482,  2.34295,  2.55878,  2.6657,
+  1.41391,  1.58827,  2.08673,  2.29308,  2.51359,  2.64213,
+  1.4,  1.55334,  1.93877,  2.18387,  2.45866,  2.61041,
+  1.37352,  1.44979,  1.8806,  2.07984,  2.29824,  2.55977,
+  1.36754,  1.44075,  1.97377,  2.08607,  2.33911,  2.62191,
+  1.36884,  1.46082,  2.00605,  2.12979,  2.39152,  2.65052,
+  1.37599,  1.49624,  2.05005,  2.13085,  2.45392,  2.69863,
+  1.34057,  1.48416,  2.08413,  2.14094,  2.54992,  2.68543,
+  1.38997,  1.55301,  2.06378,  2.14798,  2.59226,  2.70382,
+  1.24745,  1.50338,  2.0443,  2.13649,  2.34449,  2.59917,
+  1.31511,  1.54085,  2.02833,  2.11633,  2.27254,  2.43155,
+  1.29883,  1.58749,  2.07193,  2.18587,  2.33569,  2.50078,
+  1.29366,  1.56243,  2.0311,  2.14961,  2.40817,  2.51729,
+  1.35755,  1.5133,  1.99809,  2.15305,  2.45046,  2.5838,
+  1.31441,  1.51742,  2.07946,  2.17944,  2.52229,  2.6162,
+  1.23775,  1.51356,  2.05223,  2.18107,  2.53904,  2.62816,
+  1.20856,  1.48604,  2.0465,  2.19467,  2.48998,  2.63667,
+  1.19657,  1.46249,  2.07314,  2.23086,  2.54763,  2.7006,
+  1.08094,  1.45943,  2.1105,  2.21771,  2.53813,  2.67835,
+  1.09448,  1.37861,  2.16788,  2.24618,  2.56793,  2.69132,
+  0.942435,  1.46334,  2.25353,  2.33078,  2.53848,  2.62677,
+  0.828468,  1.39017,  2.15232,  2.21803,  2.54527,  2.62149,
+  0.883311,  1.3342,  2.09482,  2.19126,  2.47558,  2.57346,
+  0.863185,  1.41868,  2.08049,  2.16638,  2.5561,  2.71409,
+  0.84852,  1.39108,  2.04932,  2.13419,  2.70254,  2.78082,
+  0.826225,  1.37358,  2.03739,  2.12058,  2.73609,  2.78259,
+  0.823246,  1.34385,  2.03389,  2.1118,  2.74087,  2.78707,
+  0.833848,  1.33679,  2.04545,  2.11801,  2.69961,  2.79618,
+  0.811654,  1.32134,  2.09499,  2.17812,  2.49423,  2.6499,
+  0.947528,  1.36115,  2.12785,  2.21901,  2.51138,  2.66819,
+  0.875759,  1.25161,  2.13342,  2.24175,  2.47382,  2.66293,
+  0.933534,  1.44844,  2.13913,  2.24451,  2.48676,  2.60694,
+  0.945109,  1.2808,  2.20894,  2.33506,  2.51132,  2.61453,
+  0.956935,  1.37124,  2.1072,  2.19452,  2.40325,  2.57303,
+  0.981,  1.25193,  2.14796,  2.2666,  2.44042,  2.62437,
+  1.06161,  1.23169,  2.07602,  2.2334,  2.4386,  2.63699,
+  1.01887,  1.35404,  1.99803,  2.26008,  2.44314,  2.55477,
+  1.0803,  1.30189,  2.03463,  2.1456,  2.41506,  2.59122,
+  1.13387,  1.35976,  2.06395,  2.16463,  2.43939,  2.62866,
+  1.12504,  1.41413,  1.99754,  2.10372,  2.39242,  2.59958,
+  1.16727,  1.39356,  1.99818,  2.07648,  2.44178,  2.64329,
+  1.1987,  1.42119,  1.96798,  2.05702,  2.43282,  2.64507,
+  1.25623,  1.37807,  1.94185,  2.01933,  2.44458,  2.60885,
+  1.29557,  1.41215,  1.93241,  2.00835,  2.43005,  2.64902,
+  1.28135,  1.46452,  1.88824,  2.00652,  2.42528,  2.6352,
+  1.27058,  1.4067,  1.90119,  1.96929,  2.47098,  2.6479,
+  1.2667,  1.37289,  1.87181,  1.95759,  2.41497,  2.64862,
+  1.19439,  1.35174,  1.88825,  1.97809,  2.40086,  2.66266,
+  1.19887,  1.29984,  1.86428,  1.96365,  2.36279,  2.61951,
+  1.12658,  1.2401,  1.90254,  1.99765,  2.33143,  2.60863,
+  1.10462,  1.21418,  1.87979,  2.01431,  2.25166,  2.57337,
+  1.02429,  1.19321,  1.86892,  2.12788,  2.37601,  2.62345,
+  1.00036,  1.23021,  1.9603,  2.07524,  2.32935,  2.58413,
+  0.977548,  1.32199,  1.98875,  2.10426,  2.38103,  2.60792,
+  0.927608,  1.44792,  2.02789,  2.12301,  2.47848,  2.58588,
+  0.887733,  1.51653,  2.0469,  2.15389,  2.48052,  2.58201,
+  0.898681,  1.56475,  2.09153,  2.17965,  2.57394,  2.67678,
+  0.974718,  1.50086,  2.08197,  2.17778,  2.53228,  2.63499,
+  1.02382,  1.39064,  2.06059,  2.14203,  2.46939,  2.63691,
+  1.10658,  1.43105,  1.97713,  2.09715,  2.47169,  2.65912,
+  1.20126,  1.48566,  1.94465,  2.11254,  2.50025,  2.66593,
+  1.28569,  1.52066,  1.91106,  2.04425,  2.48771,  2.6658,
+  1.36249,  1.53479,  1.91055,  1.99094,  2.50571,  2.66153,
+  1.43459,  1.51484,  1.93419,  2.01741,  2.50153,  2.69388,
+  1.42084,  1.51949,  1.90935,  1.98665,  2.4604,  2.68819,
+  1.40441,  1.46981,  1.96429,  2.05423,  2.36679,  2.65527,
+  1.38829,  1.46691,  1.96405,  2.05895,  2.28653,  2.60493,
+  1.368,  1.43481,  1.8577,  2.00712,  2.19658,  2.60419,
+  1.30084,  1.38054,  1.74025,  2.04689,  2.23523,  2.52191,
+  1.2313,  1.3216,  1.86723,  2.14763,  2.35463,  2.57914,
+  1.15492,  1.2559,  1.93232,  2.16437,  2.39283,  2.60599,
+  1.09866,  1.20222,  1.94827,  2.15016,  2.4926,  2.62574,
+  1.05746,  1.22185,  1.86913,  2.26883,  2.45654,  2.58036,
+  1.03308,  1.1501,  1.70887,  2.26488,  2.47604,  2.56361,
+  0.988998,  1.15927,  1.96203,  2.30271,  2.44872,  2.56072,
+  1.02842,  1.22869,  2.02591,  2.26037,  2.56185,  2.66176,
+  0.93486,  1.34821,  2.05389,  2.21474,  2.5253,  2.64771,
+  0.91915,  1.26456,  2.06814,  2.1834,  2.53498,  2.64432,
+  0.975247,  1.36223,  2.05215,  2.23142,  2.5828,  2.72448,
+  0.954336,  1.31118,  1.97737,  2.23816,  2.47811,  2.61705,
+  0.941853,  1.33598,  1.97642,  2.21901,  2.57949,  2.7143,
+  0.928694,  1.36645,  1.88488,  2.18315,  2.58056,  2.65759,
+  0.986067,  1.33837,  1.95432,  2.18786,  2.56652,  2.63883,
+  0.912646,  1.2844,  1.81414,  2.17507,  2.55393,  2.63852,
+  0.968965,  1.3105,  1.83969,  2.07808,  2.59033,  2.66057,
+  0.977192,  1.30463,  1.88095,  2.12702,  2.59804,  2.71211,
+  1.02384,  1.29962,  1.94471,  2.10378,  2.62592,  2.7309,
+  1.11021,  1.28631,  1.95938,  2.05397,  2.56459,  2.67613,
+  1.02814,  1.32424,  1.97674,  2.09494,  2.5862,  2.75473,
+  1.1298,  1.26991,  2.01187,  2.10922,  2.5889,  2.69654,
+  1.05697,  1.34048,  2.01617,  2.10555,  2.55761,  2.74716,
+  1.0375,  1.25577,  2.02939,  2.13619,  2.51178,  2.70963,
+  1.00616,  1.41717,  2.07195,  2.13261,  2.5439,  2.70196,
+  1.13696,  1.41621,  2.05034,  2.11204,  2.44967,  2.6952,
+  1.13532,  1.43627,  2.08385,  2.19492,  2.38638,  2.65693,
+  1.09407,  1.38546,  2.01516,  2.11333,  2.3201,  2.64153,
+  1.02593,  1.36065,  1.8783,  1.98146,  2.12804,  2.45894,
+  1.14275,  1.41616,  1.90101,  2.05488,  2.17021,  2.45905,
+  1.09321,  1.48838,  1.80138,  2.07358,  2.20343,  2.49483,
+  1.16124,  1.26326,  1.78481,  2.0712,  2.19458,  2.43622,
+  1.01079,  1.14118,  1.72817,  2.11872,  2.25127,  2.42633,
+  1.0838,  1.27598,  1.88843,  2.06839,  2.22746,  2.51111,
+  1.09382,  1.3034,  1.92409,  2.18396,  2.34853,  2.5317,
+  1.40987,  1.54006,  1.72233,  2.04991,  2.23569,  2.38925,
+  1.4666,  1.61703,  1.81939,  2.03581,  2.43973,  2.54332,
+  1.52688,  1.81173,  1.92615,  2.1292,  2.48147,  2.55606,
+  1.42046,  1.73161,  1.92536,  2.08112,  2.47445,  2.57028,
+  1.24837,  1.46252,  1.69927,  1.90711,  2.35535,  2.4848,
+  1.18322,  1.55816,  1.64662,  1.99981,  2.37407,  2.4616,
+  1.14384,  1.51329,  1.67569,  1.90675,  2.42836,  2.51879,
+  1.06699,  1.50005,  1.66753,  1.96146,  2.4459,  2.52156,
+  1.04665,  1.52076,  1.70516,  1.87838,  2.45976,  2.53273,
+  1.01371,  1.55953,  1.73753,  1.95585,  2.43782,  2.51586,
+  1.02195,  1.58688,  1.73703,  1.92918,  2.52364,  2.57788,
+  0.942307,  1.57915,  1.7761,  2.06027,  2.43722,  2.51765,
+  0.914226,  1.64208,  1.8128,  2.00109,  2.50851,  2.57006,
+  0.952017,  1.68807,  1.93502,  2.01615,  2.44679,  2.56358,
+  0.85628,  1.69751,  1.90273,  2.01269,  2.52241,  2.5844,
+  0.891878,  1.55315,  1.9355,  2.04697,  2.53266,  2.59497,
+  0.845424,  1.60229,  1.93772,  2.02752,  2.58302,  2.64917,
+  0.876501,  1.71662,  1.93957,  2.06754,  2.58826,  2.62536,
+  0.901014,  1.86437,  1.97892,  2.07519,  2.46267,  2.6098,
+  0.911677,  1.76785,  1.94779,  2.07258,  2.59574,  2.63495,
+  0.937394,  1.70873,  1.92774,  2.05461,  2.57411,  2.64743,
+  1.00365,  1.61461,  1.94206,  2.03598,  2.59201,  2.66472,
+  1.08941,  1.56371,  1.91069,  1.97496,  2.59091,  2.68182,
+  1.1802,  1.45723,  1.84084,  1.92159,  2.57341,  2.65935,
+  1.23938,  1.44428,  1.81891,  1.89387,  2.5596,  2.65742,
+  1.37732,  1.52899,  1.7449,  1.86222,  2.59116,  2.66907,
+  1.5049,  1.58946,  1.77776,  1.88723,  2.50621,  2.61775,
+  1.62841,  1.69744,  1.8306,  1.95757,  2.49541,  2.65298,
+  1.65534,  1.72676,  1.91445,  2.04295,  2.58971,  2.65897,
+  1.69817,  1.75401,  1.96719,  2.09043,  2.60271,  2.67713,
+  1.6763,  1.76771,  2.04285,  2.15667,  2.62832,  2.69069,
+  1.72497,  1.78993,  2.02225,  2.13845,  2.57623,  2.67177,
+  1.74819,  1.80267,  2.03778,  2.18025,  2.54251,  2.63895,
+  1.72749,  1.82059,  1.98449,  2.15907,  2.52527,  2.64111,
+  1.68116,  1.82095,  1.9757,  2.15738,  2.4858,  2.59041,
+  1.69559,  1.80719,  1.99368,  2.18089,  2.38033,  2.56086,
+  1.70693,  1.8107,  2.00812,  2.1331,  2.42075,  2.64175,
+  1.65458,  1.76573,  2.02476,  2.12403,  2.49348,  2.66085,
+  1.48228,  1.84953,  2.03934,  2.24048,  2.45722,  2.54777,
+  1.60391,  1.83254,  2.0516,  2.25163,  2.46114,  2.56041,
+  1.61191,  1.78732,  2.13446,  2.25032,  2.62094,  2.67828,
+  1.70226,  1.85766,  2.09357,  2.24578,  2.63356,  2.6878,
+  1.69236,  1.77625,  2.02619,  2.27536,  2.58055,  2.68324,
+  1.58711,  1.7503,  1.99794,  2.24207,  2.58654,  2.69145,
+  1.53555,  1.76534,  2.05361,  2.23362,  2.64673,  2.71788,
+  1.18962,  1.33679,  1.76375,  2.00182,  2.43607,  2.59429,
+  1.19096,  1.32263,  1.6625,  2.02854,  2.34741,  2.53098,
+  1.17093,  1.39469,  1.72743,  2.02281,  2.38266,  2.5526,
+  1.0828,  1.38331,  1.62323,  1.82565,  2.46313,  2.57449,
+  1.05886,  1.31642,  1.61784,  1.7344,  2.49668,  2.60735,
+  1.03174,  1.33271,  1.53473,  1.70742,  2.43327,  2.54421,
+  1.09663,  1.40593,  1.54058,  1.71992,  2.50965,  2.57321,
+  1.08814,  1.38193,  1.50722,  1.61855,  2.48411,  2.61844,
+  1.12836,  1.34181,  1.49417,  1.71555,  2.49597,  2.57986,
+  1.17504,  1.36011,  1.5729,  1.75716,  2.48116,  2.58891,
+  1.25184,  1.38829,  1.58041,  1.74429,  2.53023,  2.61428,
+  1.31074,  1.44427,  1.65725,  1.82349,  2.51511,  2.6146,
+  1.32959,  1.48366,  1.70393,  1.87146,  2.53237,  2.62192,
+  1.36465,  1.5031,  1.75584,  1.91903,  2.54748,  2.62441,
+  1.40014,  1.51678,  1.80865,  1.94381,  2.57234,  2.65555,
+  1.40394,  1.53678,  1.85457,  1.96117,  2.52777,  2.65014,
+  1.44164,  1.5349,  1.87363,  1.97075,  2.52812,  2.67083,
+  1.44861,  1.52867,  1.86098,  1.95195,  2.47324,  2.65781,
+  1.45162,  1.54784,  1.82415,  2.01998,  2.46245,  2.6541,
+  1.47491,  1.54848,  1.89089,  1.99547,  2.48461,  2.65999,
+  1.43235,  1.54152,  1.88892,  2.0602,  2.40709,  2.63044,
+  1.44374,  1.52979,  1.8927,  1.99659,  2.3738,  2.62098,
+  1.37922,  1.48973,  1.89736,  2.01674,  2.41678,  2.6275,
+  1.37707,  1.46312,  1.91165,  2.02262,  2.35539,  2.60865,
+  1.3318,  1.43104,  1.92917,  2.0469,  2.37404,  2.605,
+  1.26139,  1.44854,  1.97546,  2.08252,  2.36686,  2.6208,
+  1.22253,  1.41897,  1.97979,  2.11631,  2.43959,  2.66463,
+  1.14294,  1.30444,  1.9845,  2.07136,  2.47308,  2.67295,
+  1.16307,  1.26852,  1.93044,  2.0463,  2.3051,  2.59445,
+  1.10251,  1.24609,  1.95173,  2.10327,  2.29978,  2.57198,
+  1.01057,  1.14733,  1.90254,  2.04624,  2.28802,  2.567,
+  1.01047,  1.307,  1.82765,  2.07687,  2.33326,  2.55597,
+  1.24634,  1.53463,  1.85908,  2.18799,  2.38807,  2.54162,
+  1.20049,  1.57894,  1.89923,  2.16502,  2.44888,  2.58318,
+  0.969958,  1.32117,  1.8792,  2.16627,  2.41795,  2.60245,
+  0.883738,  1.35958,  2.00452,  2.10073,  2.51698,  2.63339,
+  0.844286,  1.40555,  2.05705,  2.14052,  2.51643,  2.66006,
+  0.862435,  1.50233,  2.10741,  2.20516,  2.55819,  2.66049,
+  0.940459,  1.42824,  2.13982,  2.23332,  2.56448,  2.67376,
+  0.930987,  1.58398,  2.0219,  2.15239,  2.40404,  2.50634,
+  1.04656,  1.79826,  1.98842,  2.12929,  2.35758,  2.45354,
+  1.05348,  1.59375,  2.10433,  2.23268,  2.37281,  2.49815,
+  1.13765,  1.64278,  2.08915,  2.23181,  2.38316,  2.57557,
+  1.18078,  1.89984,  2.11471,  2.22334,  2.45315,  2.55491,
+  1.14477,  1.7958,  2.05817,  2.1941,  2.45214,  2.55875,
+  1.13255,  1.6883,  1.98025,  2.10745,  2.32195,  2.44657,
+  1.15584,  1.527,  1.95125,  2.10187,  2.26567,  2.42326,
+  1.21899,  1.55188,  1.97893,  2.1295,  2.36524,  2.54789,
+  1.26996,  1.59283,  1.9574,  2.05925,  2.47736,  2.62007,
+  1.30477,  1.59715,  1.97427,  2.08441,  2.41441,  2.61344,
+  1.30461,  1.64552,  1.9768,  2.10058,  2.36447,  2.5106,
+  1.35745,  1.72162,  2.01397,  2.14179,  2.38518,  2.51214,
+  1.33572,  1.83391,  2.00127,  2.15585,  2.40144,  2.4961,
+  1.3114,  1.55829,  1.93876,  2.06328,  2.30727,  2.52662,
+  1.36036,  1.44076,  1.89358,  2.07531,  2.23753,  2.5046,
+  1.3316,  1.46849,  1.9289,  2.06096,  2.31803,  2.56782,
+  1.31861,  1.5376,  1.92447,  2.01519,  2.35881,  2.59331,
+  1.21436,  1.54619,  1.8821,  1.99525,  2.37793,  2.65294,
+  1.29633,  1.56653,  1.87514,  2.00328,  2.47632,  2.63153,
+  1.39778,  1.58615,  1.86148,  2.03011,  2.58706,  2.65465,
+  1.47524,  1.6442,  1.91588,  2.04703,  2.65327,  2.71442,
+  1.52474,  1.71602,  1.95782,  2.06765,  2.6237,  2.69024,
+  1.57869,  1.67781,  1.94092,  2.06678,  2.61383,  2.70458,
+  1.55866,  1.70253,  1.93011,  2.02827,  2.61505,  2.68653,
+  1.5009,  1.6999,  1.90892,  1.99874,  2.62063,  2.69128,
+  1.44295,  1.70267,  1.90099,  1.97533,  2.62473,  2.69924,
+  1.37288,  1.63829,  1.91771,  2.02829,  2.62618,  2.69745,
+  1.28422,  1.65621,  1.89785,  1.99256,  2.64442,  2.70738,
+  1.20404,  1.65182,  1.88977,  1.99256,  2.63849,  2.70958,
+  1.1492,  1.62207,  1.88451,  1.97925,  2.63269,  2.69924,
+  1.13373,  1.61863,  1.89504,  1.97754,  2.62505,  2.69488,
+  1.15757,  1.66233,  1.88978,  1.97839,  2.62603,  2.68454,
+  1.21894,  1.6671,  1.87906,  2.00517,  2.60227,  2.65813,
+  1.22423,  1.62686,  1.79198,  1.89465,  2.51764,  2.64787,
+  1.35435,  1.55876,  1.84308,  1.93089,  2.57122,  2.63086,
+  1.33953,  1.59509,  1.76225,  1.97927,  2.54602,  2.6132,
+  1.38922,  1.59242,  1.85964,  1.96212,  2.55095,  2.63771,
+  1.44127,  1.59043,  1.87939,  1.98705,  2.58201,  2.66674,
+  1.43103,  1.60981,  1.89027,  2.03787,  2.52504,  2.67206,
+  1.46838,  1.57542,  1.94585,  2.02987,  2.55147,  2.70532,
+  1.45009,  1.60143,  1.9541,  2.0628,  2.53413,  2.66697,
+  1.48217,  1.56544,  1.97359,  2.12415,  2.52021,  2.65602,
+  1.42942,  1.56017,  1.98437,  2.07841,  2.51093,  2.66835,
+  1.44091,  1.58793,  1.97609,  2.09796,  2.46414,  2.62167,
+  1.43247,  1.58261,  1.97335,  2.15993,  2.50051,  2.66833,
+  1.4291,  1.59392,  1.97481,  2.07021,  2.52705,  2.68379,
+  1.37725,  1.57105,  1.93703,  2.09434,  2.48861,  2.65319,
+  1.48527,  1.57272,  1.93552,  2.01586,  2.47189,  2.68702,
+  1.47361,  1.56926,  1.87262,  1.96288,  2.4128,  2.65437,
+  1.48606,  1.58025,  1.86625,  1.97554,  2.31875,  2.58671,
+  1.46521,  1.58112,  1.78499,  1.91302,  2.17248,  2.55592,
+  1.43366,  1.56634,  1.72851,  1.85326,  2.06197,  2.41395,
+  1.36761,  1.54384,  1.70007,  1.85497,  2.03462,  2.28202,
+  1.50326,  1.65718,  1.80936,  1.93767,  2.14319,  2.43561,
+  1.34074,  1.59327,  1.83384,  2.12941,  2.46894,  2.57284,
+  1.33672,  1.4817,  1.94477,  2.23061,  2.48029,  2.58012,
+  1.32132,  1.60314,  1.96833,  2.20337,  2.5151,  2.65005,
+  1.34193,  1.66834,  1.98884,  2.18525,  2.56414,  2.65322,
+  1.31555,  1.6489,  1.9599,  2.14764,  2.51689,  2.61262,
+  1.27731,  1.62022,  2.00186,  2.22941,  2.53155,  2.62182,
+  1.30517,  1.5786,  2.03863,  2.29551,  2.56534,  2.65484,
+  1.33051,  1.60991,  1.99154,  2.26271,  2.56334,  2.66596,
+  1.374,  1.68393,  1.98007,  2.33857,  2.5956,  2.68273,
+  1.2687,  1.38975,  1.88538,  2.1104,  2.48811,  2.63864,
+  1.21681,  1.31005,  1.85469,  2.03671,  2.27759,  2.56653,
+  1.23495,  1.33781,  1.94943,  2.05936,  2.29533,  2.56647,
+  1.18894,  1.30239,  1.9962,  2.10744,  2.34919,  2.58524,
+  1.26898,  1.44015,  2.02477,  2.13685,  2.44401,  2.66404,
+  1.27437,  1.38312,  2.06673,  2.15117,  2.40756,  2.6542,
+  1.26455,  1.35612,  2.00166,  2.11886,  2.28778,  2.56954,
+  1.23434,  1.32978,  2.06339,  2.15077,  2.36719,  2.5986,
+  1.15521,  1.25744,  2.0825,  2.21144,  2.39059,  2.6201,
+  1.19946,  1.26556,  1.93498,  2.22669,  2.54089,  2.6642,
+  1.3047,  1.52685,  1.95455,  2.17466,  2.47769,  2.62171,
+  1.63807,  1.89626,  2.07708,  2.36101,  2.64603,  2.71884,
+  1.64382,  1.94311,  2.13199,  2.32962,  2.57872,  2.64546,
+  1.6409,  1.98922,  2.16147,  2.26921,  2.58647,  2.6554,
+  1.72301,  1.91007,  2.07019,  2.25957,  2.56439,  2.64034,
+  1.65207,  1.99873,  2.13594,  2.35282,  2.65251,  2.71747,
+  1.68072,  2.07409,  2.26967,  2.45347,  2.69994,  2.76304,
+  1.69509,  2.05897,  2.19364,  2.31357,  2.63934,  2.69945,
+  1.78296,  2.01403,  2.2249,  2.33229,  2.64535,  2.7244,
+  1.70596,  1.97475,  2.18083,  2.25608,  2.57518,  2.71694,
+  1.66256,  1.98864,  2.11518,  2.20528,  2.54838,  2.65766,
+  1.56205,  1.8439,  2.17327,  2.26589,  2.47795,  2.69597,
+  1.68592,  1.79584,  2.07833,  2.18014,  2.46537,  2.66731,
+  1.68061,  1.73855,  1.99474,  2.13119,  2.47319,  2.64954,
+  1.65929,  1.83364,  2.00009,  2.14017,  2.56491,  2.69272,
+  1.71489,  1.78482,  1.97491,  2.08523,  2.56667,  2.70104,
+  1.72911,  1.82606,  1.89504,  2.05372,  2.60392,  2.69924,
+  1.69629,  1.79108,  1.91604,  2.01774,  2.58311,  2.7042,
+  1.62684,  1.72099,  1.89044,  2.01448,  2.58919,  2.68914,
+  1.57418,  1.678,  1.8808,  1.9828,  2.57498,  2.66408,
+  1.4326,  1.67638,  1.83467,  1.96466,  2.5353,  2.63865,
+  1.31853,  1.53537,  1.83696,  1.93288,  2.47841,  2.57835,
+  1.22629,  1.49295,  1.83642,  1.94607,  2.43017,  2.58207,
+  1.09891,  1.49905,  1.89629,  2.02887,  2.54053,  2.6186,
+  1.03446,  1.53337,  1.96484,  2.07097,  2.57858,  2.65152,
+  0.979835,  1.48091,  1.97596,  2.08932,  2.53424,  2.63263,
+  0.916592,  1.48129,  1.96751,  2.05329,  2.55835,  2.64274,
+  0.937338,  1.47437,  2.02376,  2.11046,  2.58544,  2.66546,
+  0.873055,  1.56053,  2.0288,  2.08642,  2.57502,  2.68478,
+  0.901938,  1.62841,  2.03181,  2.10285,  2.61016,  2.68565,
+  0.862562,  1.55614,  1.99757,  2.08174,  2.5332,  2.61576,
+  0.90614,  1.66574,  2.01937,  2.13334,  2.58193,  2.66115,
+  0.872836,  1.63866,  2.03844,  2.09728,  2.64501,  2.69779,
+  0.829264,  1.4419,  2.03919,  2.11114,  2.61166,  2.68861,
+  0.825197,  1.30453,  2.05635,  2.14379,  2.59031,  2.65782,
+  0.79352,  1.52102,  1.97944,  2.05842,  2.59623,  2.66858,
+  0.849751,  1.48553,  1.9861,  2.05546,  2.62427,  2.7019,
+  0.849936,  1.38559,  2.00752,  2.06058,  2.56723,  2.67845,
+  0.829655,  1.23098,  1.9884,  2.10148,  2.53073,  2.67733,
+  0.940677,  1.26451,  1.94632,  2.04672,  2.49981,  2.67798,
+  1.03888,  1.29749,  1.95821,  2.036,  2.40697,  2.65032,
+  1.15791,  1.24731,  1.89251,  1.98433,  2.39699,  2.6634,
+  1.23706,  1.31883,  1.84331,  1.95477,  2.42085,  2.69391,
+  1.32887,  1.40395,  1.80868,  1.94612,  2.40089,  2.6834,
+  1.39319,  1.46081,  1.82213,  1.9396,  2.24255,  2.72323,
+  1.37096,  1.52614,  1.78537,  1.96316,  2.13675,  2.6448,
+  1.50113,  1.60677,  1.84183,  2.00946,  2.19846,  2.61465,
+  1.46794,  1.55147,  1.84985,  1.98283,  2.2086,  2.51479,
+  1.40594,  1.48098,  1.85598,  1.99706,  2.17872,  2.49001,
+  1.44817,  1.52096,  1.86881,  1.97537,  2.24103,  2.61635,
+  1.38081,  1.61267,  1.86996,  2.02679,  2.44348,  2.63998,
+  1.48372,  1.59611,  1.96973,  2.10091,  2.57743,  2.68814,
+  1.46768,  1.57822,  1.98656,  2.19471,  2.57095,  2.67109,
+  1.4963,  1.6142,  2.03202,  2.21832,  2.55346,  2.68181,
+  1.59696,  1.72273,  2.14453,  2.31998,  2.60439,  2.70396,
+  1.56328,  1.83007,  2.21313,  2.43293,  2.64111,  2.721,
+  1.5911,  1.94848,  2.28841,  2.48658,  2.66684,  2.74357,
+  1.47571,  1.71866,  2.05098,  2.21796,  2.48728,  2.5718,
+  1.55893,  1.7723,  2.09447,  2.23446,  2.51893,  2.59774,
+  1.56759,  1.82209,  2.10059,  2.28665,  2.53395,  2.64811,
+  1.75003,  1.93667,  2.1356,  2.34764,  2.5469,  2.63832,
+  1.75688,  1.99858,  2.1168,  2.22341,  2.55656,  2.64706,
+  1.70004,  1.92226,  2.07535,  2.18437,  2.55608,  2.63906,
+  1.59867,  1.70971,  1.99456,  2.09879,  2.5214,  2.62844,
+  1.60978,  1.7198,  1.93753,  2.09198,  2.54758,  2.62107,
+  1.58074,  1.68669,  1.92793,  2.05951,  2.58033,  2.64353,
+  1.54116,  1.68466,  1.9448,  2.03825,  2.56852,  2.6371,
+  1.4745,  1.63389,  1.88133,  1.98885,  2.5547,  2.62359,
+  1.42769,  1.61681,  1.89847,  1.99412,  2.54591,  2.63584,
+  1.36697,  1.58374,  1.86076,  2.01809,  2.52625,  2.59403,
+  1.2579,  1.5624,  1.87076,  1.96175,  2.51205,  2.58959,
+  1.18331,  1.57125,  1.86744,  1.98879,  2.54377,  2.60779,
+  1.13772,  1.60719,  1.87915,  2.00877,  2.5368,  2.60748,
+  1.05382,  1.51142,  1.90444,  2.00239,  2.58485,  2.65709,
+  1.02931,  1.56067,  1.91347,  1.98444,  2.61342,  2.67092,
+  0.990299,  1.5203,  1.91971,  2.00599,  2.61587,  2.70596,
+  0.927002,  1.48685,  1.9001,  1.97777,  2.61462,  2.69576,
+  0.924166,  1.5003,  1.83727,  1.91582,  2.60179,  2.70283,
+  0.901854,  1.42276,  1.89801,  1.95014,  2.57299,  2.7593,
+  0.910623,  1.28648,  1.80128,  1.92579,  2.43815,  2.67129,
+  0.904293,  1.22614,  1.87334,  1.94691,  2.48527,  2.64553,
+  0.872654,  1.12266,  1.9125,  2.04762,  2.46806,  2.64549,
+  1.13608,  1.24801,  1.7254,  2.18063,  2.49378,  2.5794,
+  1.1615,  1.34697,  1.80404,  2.15702,  2.55031,  2.63316,
+  1.28729,  1.66372,  2.04419,  2.32192,  2.59928,  2.68713,
+  1.4568,  1.75827,  2.05527,  2.31065,  2.54931,  2.66007,
+  1.41695,  1.74137,  2.10419,  2.35776,  2.59176,  2.67954,
+  1.37953,  1.75252,  2.17341,  2.36107,  2.6175,  2.69932,
+  1.361,  1.76202,  2.11571,  2.33066,  2.562,  2.65039,
+  1.34078,  1.68536,  2.02489,  2.28195,  2.54742,  2.63946,
+  1.27817,  1.68614,  1.96141,  2.16547,  2.55417,  2.64787,
+  1.29452,  1.54762,  1.98197,  2.18343,  2.54751,  2.63723,
+  1.20162,  1.34364,  2.00786,  2.08943,  2.53568,  2.66074,
+  1.202,  1.33211,  1.94915,  2.05181,  2.5532,  2.66547,
+  1.18035,  1.35425,  1.89052,  2.06991,  2.51523,  2.62012,
+  1.12873,  1.41976,  1.85478,  2.05663,  2.4807,  2.58354,
+  1.13319,  1.40234,  1.82266,  2.01361,  2.53991,  2.63944,
+  1.14927,  1.37693,  1.82119,  1.91493,  2.56242,  2.66404,
+  1.08087,  1.40844,  1.78802,  1.87993,  2.51751,  2.65668,
+  1.15244,  1.5096,  1.82234,  1.93981,  2.52894,  2.61915,
+  1.22726,  1.54378,  1.93541,  2.01768,  2.57551,  2.66563,
+  1.25365,  1.48594,  1.94554,  1.98737,  2.53919,  2.71509,
+  1.2245,  1.52134,  1.98216,  2.04494,  2.52268,  2.68745,
+  1.25872,  1.47612,  1.98186,  2.0731,  2.53617,  2.63409,
+  1.25558,  1.47113,  1.98394,  2.05256,  2.54104,  2.70865,
+  1.22142,  1.55673,  2.01332,  2.08977,  2.5386,  2.7065,
+  1.17848,  1.47465,  2.00764,  2.12209,  2.56026,  2.62943,
+  1.13664,  1.45929,  2.03373,  2.10043,  2.5447,  2.68913,
+  1.0352,  1.46256,  2.02497,  2.19409,  2.5306,  2.66221,
+  1.09088,  1.52242,  2.03844,  2.12942,  2.58762,  2.68739,
+  1.05454,  1.53834,  2.00059,  2.08401,  2.51651,  2.64433,
+  1.06957,  1.47115,  1.97701,  2.10266,  2.54822,  2.64566,
+  1.08464,  1.23507,  1.99903,  2.09101,  2.40519,  2.62241,
+  1.07391,  1.18049,  1.96138,  2.10188,  2.2553,  2.5318,
+  1.18554,  1.32028,  2.00675,  2.09885,  2.44308,  2.58297,
+  1.25681,  1.41999,  1.98353,  2.13096,  2.47042,  2.55869,
+  1.29074,  1.39192,  1.99538,  2.10656,  2.35166,  2.48517,
+  1.42857,  1.7483,  2.04481,  2.27757,  2.51309,  2.62525,
+  1.49577,  1.68666,  2.13566,  2.29223,  2.49901,  2.6165,
+  1.48246,  1.63201,  2.08388,  2.29724,  2.48855,  2.60533,
+  1.53884,  1.63087,  2.11175,  2.22311,  2.57684,  2.69324,
+  1.55163,  1.62855,  2.0406,  2.158,  2.59018,  2.71351,
+  1.57001,  1.63772,  1.9581,  2.12426,  2.57018,  2.69279,
+  1.53459,  1.60799,  1.80164,  2.08727,  2.3927,  2.60093,
+  1.50278,  1.60763,  1.8438,  2.08234,  2.32328,  2.52239,
+  1.5157,  1.61344,  1.83784,  2.02724,  2.40291,  2.60224,
+  1.51003,  1.60758,  1.82642,  1.95546,  2.34057,  2.67962,
+  1.44583,  1.56664,  1.75642,  1.86971,  2.29615,  2.60165,
+  1.41071,  1.48852,  1.82002,  1.91044,  2.35823,  2.61465,
+  1.30157,  1.42828,  1.81243,  1.90258,  2.29336,  2.72528,
+  1.10681,  1.35151,  1.88873,  1.95633,  2.32044,  2.64689,
+  1.05626,  1.36692,  1.86662,  1.96895,  2.42146,  2.65352,
+  1.14875,  1.36805,  1.80964,  2.06411,  2.43779,  2.6041,
+  0.99027,  1.45316,  1.88728,  2.03517,  2.29694,  2.6003,
+  0.943695,  1.20427,  1.748,  1.88645,  2.18161,  2.5098,
+  1.05705,  1.2214,  1.83597,  1.97244,  2.15495,  2.49297,
+  0.936404,  1.22552,  1.89505,  1.99806,  2.53953,  2.64493,
+  0.941516,  1.22449,  1.96641,  2.05527,  2.51509,  2.60908,
+  1.00024,  1.31497,  1.942,  2.05192,  2.53588,  2.63478,
+  1.03139,  1.4074,  1.95347,  2.04544,  2.55082,  2.63437,
+  1.11887,  1.44195,  1.95252,  2.062,  2.49434,  2.60804,
+  1.1971,  1.55316,  1.88765,  2.00919,  2.4721,  2.55066,
+  1.2938,  1.58834,  1.86838,  2.04592,  2.4811,  2.56611,
+  1.35377,  1.61065,  1.89762,  2.08348,  2.40829,  2.5434,
+  1.40368,  1.522,  1.89167,  2.05414,  2.35729,  2.51225,
+  1.3704,  1.44625,  1.87133,  1.99814,  2.33668,  2.57069,
+  1.49939,  1.75525,  2.09033,  2.28295,  2.48403,  2.57439,
+  1.56771,  1.84261,  2.13662,  2.27873,  2.47712,  2.57607,
+  1.59155,  1.76754,  2.16941,  2.30293,  2.52513,  2.6375,
+  1.45827,  1.79974,  2.22722,  2.3975,  2.61653,  2.70557,
+  1.49671,  1.84604,  2.2799,  2.43719,  2.64967,  2.72662,
+  1.50276,  1.73132,  2.26873,  2.46421,  2.62362,  2.70674,
+  1.4973,  1.61793,  2.15658,  2.38626,  2.57903,  2.66472,
+  1.37998,  1.53869,  1.85063,  2.10952,  2.41066,  2.58615,
+  1.40587,  1.49793,  1.7417,  1.93228,  2.33718,  2.56385,
+  1.34617,  1.43104,  1.65743,  1.88442,  2.37395,  2.58735,
+  1.30791,  1.40637,  1.73414,  1.87583,  2.46072,  2.60209,
+  1.27394,  1.57115,  1.77128,  1.91225,  2.53645,  2.59561,
+  1.20006,  1.57518,  1.77085,  1.87763,  2.50802,  2.57915,
+  1.12581,  1.53942,  1.72263,  1.85997,  2.51165,  2.57463,
+  1.0649,  1.48451,  1.69086,  1.83275,  2.51958,  2.58928,
+  1.04287,  1.48323,  1.62712,  1.86708,  2.49587,  2.55026,
+  0.95091,  1.47482,  1.57611,  1.83009,  2.51944,  2.56991,
+  1.00452,  1.42303,  1.55012,  1.83522,  2.4736,  2.54437,
+  1.02641,  1.36569,  1.51066,  1.87911,  2.46718,  2.54387,
+  0.978321,  1.33849,  1.52802,  1.91388,  2.46507,  2.52472,
+  0.922555,  1.40958,  1.52026,  1.93266,  2.40471,  2.47222,
+  1.00902,  1.34503,  1.51873,  1.99953,  2.46306,  2.54494,
+  0.989351,  1.43316,  1.57387,  2.01544,  2.4012,  2.49098,
+  1.03533,  1.55632,  1.67731,  2.08678,  2.48152,  2.56795,
+  1.00412,  1.57529,  1.79639,  2.07552,  2.40291,  2.57424,
+  1.03735,  1.68182,  1.94311,  2.06542,  2.47889,  2.5989,
+  1.00585,  1.68475,  1.97239,  2.10931,  2.56505,  2.62351,
+  0.954873,  1.71979,  2.00619,  2.11235,  2.59863,  2.68278,
+  0.937994,  1.72832,  1.99376,  2.10525,  2.63205,  2.70071,
+  0.889626,  1.70953,  2.00129,  2.09009,  2.62054,  2.7098,
+  0.912128,  1.65762,  1.96678,  2.05864,  2.62643,  2.70292,
+  0.972006,  1.56912,  1.98595,  2.13024,  2.56915,  2.67726,
+  1.03879,  1.65117,  2.00829,  2.11811,  2.59919,  2.70129,
+  1.1022,  1.62499,  1.99876,  2.12503,  2.56976,  2.64664,
+  1.18774,  1.63937,  2.05924,  2.1473,  2.47586,  2.63496,
+  1.2741,  1.59067,  2.01675,  2.09963,  2.54872,  2.66899,
+  1.3734,  1.63001,  1.98149,  2.07093,  2.50595,  2.68933,
+  1.51121,  1.60261,  1.91134,  2.0229,  2.47594,  2.64575,
+  1.55308,  1.6394,  1.8704,  1.97561,  2.47343,  2.62657,
+  1.63342,  1.77332,  1.87513,  1.95948,  2.41315,  2.62591,
+  1.59672,  1.74731,  1.87805,  2.04902,  2.58749,  2.66928,
+  1.66467,  1.93335,  2.15604,  2.28003,  2.46274,  2.57155,
+  1.55119,  1.6958,  2.0471,  2.23698,  2.44759,  2.57084,
+  1.6483,  1.72807,  2.06079,  2.27374,  2.47514,  2.6312,
+  1.63355,  1.75757,  2.08928,  2.24098,  2.43612,  2.55685,
+  1.60864,  1.68471,  2.12375,  2.25657,  2.4865,  2.59823,
+  1.65318,  1.71454,  2.10535,  2.20323,  2.50932,  2.64178,
+  1.54105,  1.67996,  2.10427,  2.24726,  2.54038,  2.62672,
+  1.55966,  1.65964,  2.10138,  2.21367,  2.47324,  2.563,
+  1.60881,  1.67178,  2.07143,  2.18483,  2.49328,  2.63946,
+  1.53888,  1.61019,  2.08308,  2.17154,  2.55439,  2.65099,
+  1.51102,  1.59546,  2.03164,  2.13009,  2.5876,  2.6604,
+  1.34069,  1.58784,  1.931,  2.11712,  2.59986,  2.67657,
+  1.48468,  1.53325,  2.02449,  2.11315,  2.54832,  2.65995,
+  1.53434,  1.60831,  2.03154,  2.136,  2.5371,  2.61772,
+  1.57158,  1.61831,  2.05673,  2.13975,  2.52541,  2.62221,
+  1.56447,  1.63127,  2.06059,  2.16604,  2.47,  2.63566,
+  1.53365,  1.66351,  2.09396,  2.19079,  2.40674,  2.62275,
+  1.57012,  1.63104,  2.04937,  2.16517,  2.39357,  2.5885,
+  1.55247,  1.63452,  2.00848,  2.09888,  2.5092,  2.66932,
+  1.49854,  1.60281,  2.00888,  2.09973,  2.52514,  2.65917,
+  1.45092,  1.66054,  1.99176,  2.1033,  2.54407,  2.69647,
+  1.4476,  1.5691,  1.99305,  2.07976,  2.58771,  2.67639,
+  1.39457,  1.5447,  2.00666,  2.07897,  2.57902,  2.72188,
+  1.34792,  1.50775,  1.99379,  2.07733,  2.51023,  2.68268,
+  1.26519,  1.35538,  1.87785,  2.06383,  2.4258,  2.6578,
+  1.2663,  1.37693,  2.00888,  2.27501,  2.47904,  2.63616,
+  1.41473,  1.68062,  2.0574,  2.33275,  2.54997,  2.65245,
+  1.49988,  1.70879,  2.05474,  2.31358,  2.52103,  2.61391,
+  1.44568,  1.74177,  2.12639,  2.33881,  2.49512,  2.59797,
+  1.4592,  1.79234,  2.11349,  2.34607,  2.5637,  2.66497,
+  1.41684,  1.64439,  2.13147,  2.32291,  2.5788,  2.67716,
+  1.44797,  1.70822,  2.14489,  2.27258,  2.59321,  2.70087,
+  1.47461,  1.74298,  2.06694,  2.34163,  2.60175,  2.68525,
+  1.34672,  1.65394,  1.99915,  2.21854,  2.63336,  2.7236,
+  1.37521,  1.55141,  2.05268,  2.23201,  2.58684,  2.69703,
+  1.26095,  1.50175,  1.9252,  2.03394,  2.54669,  2.65203,
+  1.25934,  1.50019,  1.90965,  1.98291,  2.54588,  2.63867,
+  1.25284,  1.56384,  1.91059,  1.97368,  2.57931,  2.66428,
+  1.263,  1.54633,  1.87808,  2.03115,  2.58347,  2.65379,
+  1.2652,  1.52127,  1.90571,  1.96739,  2.58143,  2.65872,
+  1.3077,  1.54772,  1.88142,  1.96204,  2.57347,  2.65883,
+  1.29134,  1.57501,  1.91524,  1.98556,  2.60208,  2.6977,
+  1.29543,  1.62646,  1.9233,  2.02372,  2.59129,  2.68014,
+  1.30121,  1.62408,  1.87893,  1.99808,  2.5601,  2.63451,
+  1.30581,  1.62092,  1.88803,  1.98904,  2.60623,  2.66943,
+  1.30809,  1.64233,  1.88596,  2.01357,  2.61191,  2.69665,
+  1.3121,  1.62786,  1.86184,  1.9741,  2.60262,  2.65849,
+  1.2929,  1.60573,  1.87713,  1.97339,  2.59964,  2.68284,
+  1.27314,  1.59174,  1.87042,  1.94745,  2.60233,  2.67415,
+  1.28358,  1.62082,  1.84727,  1.92803,  2.59005,  2.63688,
+  1.2462,  1.56007,  1.85162,  1.95453,  2.58753,  2.67354,
+  1.26039,  1.53964,  1.83162,  1.92843,  2.55229,  2.62963,
+  1.26122,  1.50523,  1.85731,  1.93391,  2.569,  2.69631,
+  1.28311,  1.71986,  1.8239,  1.97603,  2.56544,  2.62875,
+  1.31439,  1.61774,  1.80406,  1.96054,  2.59681,  2.68674,
+  1.3387,  1.63728,  1.89693,  2.00913,  2.52347,  2.63738,
+  1.33648,  1.57703,  1.85003,  1.94324,  2.52134,  2.59683,
+  1.39891,  1.54928,  1.72446,  1.86193,  2.16679,  2.46633,
+  1.40689,  1.49743,  1.80504,  1.90912,  2.28428,  2.54258,
+  1.47485,  1.57937,  1.97076,  2.0797,  2.37143,  2.54262,
+  1.45231,  1.5394,  2.07666,  2.138,  2.44297,  2.64951,
+  1.45062,  1.50661,  2.03639,  2.13145,  2.48483,  2.67472,
+  1.4348,  1.58308,  2.02767,  2.13681,  2.42911,  2.57834,
+  1.08757,  1.36721,  1.7863,  2.02503,  2.29808,  2.51567,
+  0.992092,  1.43643,  1.72551,  1.96511,  2.42572,  2.54902,
+  0.969474,  1.49732,  1.73009,  2.01605,  2.41437,  2.63332,
+  0.936277,  1.41301,  1.68361,  2.02977,  2.4431,  2.55283,
+  1.17635,  1.55964,  1.74877,  2.06189,  2.31148,  2.43469,
+  1.06711,  1.40664,  1.64389,  1.97881,  2.37473,  2.54784,
+  0.989262,  1.33311,  1.47509,  1.72865,  2.49202,  2.55347,
+  0.957471,  1.30854,  1.42456,  1.82347,  2.49022,  2.55232,
+  1.03577,  1.25449,  1.35208,  1.78625,  2.53949,  2.58578,
+  1.02368,  1.23242,  1.39848,  1.87577,  2.45168,  2.54025,
+  1.03725,  1.24729,  1.38742,  2.00855,  2.41927,  2.49611,
+  1.04592,  1.23169,  1.36195,  1.88761,  2.38445,  2.4715,
+  1.00098,  1.25084,  1.37666,  1.76767,  2.39805,  2.48444,
+  1.06177,  1.21461,  1.41076,  1.72825,  2.42398,  2.51427,
+  1.16823,  1.29119,  1.59751,  1.90001,  2.41542,  2.55501,
+  1.15079,  1.41286,  1.82595,  1.95326,  2.40005,  2.53532,
+  1.16692,  1.51763,  1.94353,  2.03425,  2.37336,  2.52147,
+  1.18318,  1.52316,  1.99531,  2.11989,  2.43346,  2.59116,
+  1.15948,  1.52173,  2.07237,  2.17696,  2.5149,  2.66076,
+  1.26032,  1.72266,  2.11677,  2.24905,  2.53412,  2.64563,
+  1.45043,  1.71771,  2.04879,  2.21275,  2.49949,  2.63613,
+  1.44923,  1.65312,  2.02364,  2.19689,  2.45305,  2.61252,
+  1.38812,  1.59757,  1.96865,  2.16345,  2.42543,  2.57803,
+  1.3476,  1.44981,  1.89414,  2.16897,  2.44647,  2.60227,
+  1.39801,  1.47176,  1.92206,  2.12096,  2.39643,  2.60072,
+  1.42866,  1.54131,  2.04605,  2.13251,  2.39709,  2.6431,
+  1.49267,  1.58516,  2.05934,  2.1583,  2.48082,  2.64875,
+  1.55899,  1.64879,  2.03751,  2.15332,  2.51238,  2.64766,
+  1.5875,  1.65909,  2.0205,  2.13969,  2.53746,  2.61656,
+  1.63435,  1.73936,  2.04449,  2.21819,  2.53013,  2.62274,
+  1.65015,  1.73677,  2.04927,  2.14892,  2.55187,  2.65129,
+  1.6407,  1.70735,  1.99133,  2.11956,  2.58759,  2.64283,
+  1.65582,  1.70975,  1.94195,  2.09079,  2.57008,  2.63037,
+  1.60644,  1.69562,  1.85276,  2.04784,  2.5549,  2.62809,
+  1.48459,  1.65703,  1.82298,  2.00896,  2.58403,  2.65372,
+  1.34838,  1.6278,  1.77907,  1.89733,  2.52187,  2.6464,
+  1.15564,  1.46487,  1.7638,  1.94355,  2.55585,  2.64209,
+  1.33945,  1.67633,  1.97104,  2.1868,  2.43889,  2.57107,
+  1.29738,  1.61553,  1.94676,  2.15118,  2.42984,  2.55813,
+  1.13646,  1.51989,  1.86723,  2.10739,  2.45273,  2.55371,
+  0.943433,  1.35098,  1.71433,  1.83088,  2.38004,  2.57361,
+  0.93395,  1.07858,  1.55309,  1.66234,  2.02795,  2.45315,
+  0.896937,  1.24693,  1.58663,  1.68408,  2.39714,  2.61171,
+  0.892078,  1.35006,  1.56008,  1.68985,  2.50628,  2.60756,
+  0.772181,  1.31368,  1.52566,  1.65028,  2.46898,  2.63641,
+  0.863603,  1.32858,  1.48114,  1.76889,  2.49678,  2.54657,
+  0.908312,  1.25841,  1.38277,  1.69975,  2.44859,  2.54733,
+  0.863083,  1.2738,  1.42241,  1.57588,  2.50992,  2.5671,
+  0.798143,  1.23338,  1.32805,  1.71855,  2.54548,  2.65489,
+  0.937997,  1.29721,  1.44739,  1.65945,  2.53943,  2.66437,
+  1.01531,  1.28265,  1.44965,  1.65693,  2.51959,  2.59724,
+  1.0126,  1.30809,  1.42876,  1.74264,  2.58138,  2.65475,
+  1.07522,  1.35994,  1.46636,  1.79046,  2.58293,  2.65492,
+  1.17472,  1.35459,  1.47068,  1.80811,  2.61181,  2.6906,
+  1.30467,  1.38057,  1.48642,  1.86325,  2.49909,  2.64664,
+  1.32925,  1.45894,  1.59974,  1.9851,  2.41224,  2.4896,
+  1.32685,  1.46696,  1.65071,  1.97288,  2.17365,  2.36378,
+  1.44073,  1.59786,  1.75692,  1.94212,  2.13442,  2.3309,
+  1.49091,  1.61528,  1.79973,  1.98918,  2.30719,  2.53596,
+  1.523,  1.67644,  1.84139,  2.08449,  2.49007,  2.6195,
+  1.53645,  1.67293,  1.83434,  2.06794,  2.59485,  2.65573,
+  1.58521,  1.67342,  1.87935,  2.02614,  2.60916,  2.69133,
+  1.57645,  1.66211,  1.86811,  1.98727,  2.62983,  2.70249,
+  1.56114,  1.62908,  1.91041,  2.00543,  2.63344,  2.72614,
+  1.53121,  1.61555,  1.87364,  1.96628,  2.52259,  2.70606,
+  1.47329,  1.59122,  1.90894,  1.97341,  2.53504,  2.73312,
+  1.41254,  1.47364,  1.87172,  1.95732,  2.3412,  2.7407,
+  1.37981,  1.47324,  1.92392,  1.98607,  2.44717,  2.65758,
+  1.33369,  1.50012,  1.93353,  2.13803,  2.5018,  2.61583,
+  1.40577,  1.57009,  2.02811,  2.33267,  2.57368,  2.66412,
+  1.38605,  1.54675,  2.10184,  2.38012,  2.6073,  2.71246,
+  1.42055,  1.66408,  2.09684,  2.28767,  2.54543,  2.64567,
+  1.42992,  1.63289,  2.05645,  2.24534,  2.46973,  2.59462,
+  1.45034,  1.54233,  1.93614,  2.16009,  2.38966,  2.59495,
+  1.45865,  1.54584,  1.97395,  2.13284,  2.28055,  2.51911,
+  1.49962,  1.62185,  1.92436,  2.08658,  2.25382,  2.39346,
+  1.48012,  1.59661,  1.8229,  2.03008,  2.21246,  2.44059,
+  1.38557,  1.51579,  1.76353,  2.00756,  2.20701,  2.50516,
+  1.36348,  1.48371,  1.74539,  2.02083,  2.17738,  2.42842,
+  1.42241,  1.52636,  1.80247,  2.04137,  2.26763,  2.50998,
+  1.45178,  1.5395,  1.88862,  2.07975,  2.25853,  2.50082,
+  1.46274,  1.54888,  1.92575,  2.06529,  2.3201,  2.59188,
+  1.45961,  1.52679,  1.9373,  2.02975,  2.426,  2.61822,
+  1.42677,  1.49596,  1.9348,  2.02868,  2.47432,  2.63994,
+  1.39548,  1.4946,  1.92354,  2.00687,  2.5088,  2.6516,
+  1.31532,  1.47588,  1.92587,  2.01244,  2.56254,  2.64267,
+  1.21621,  1.54231,  1.86761,  1.96291,  2.57851,  2.63891,
+  1.18812,  1.59211,  1.82616,  1.95676,  2.59273,  2.65931,
+  1.15728,  1.51903,  1.84128,  1.93613,  2.59672,  2.66939,
+  1.04273,  1.33486,  1.85281,  1.92781,  2.50926,  2.72139,
+  1.07692,  1.51273,  1.89221,  1.97602,  2.37074,  2.63564,
+  1.32864,  1.55521,  1.82696,  2.08002,  2.44793,  2.60775,
+  1.27122,  1.38353,  1.74055,  2.04872,  2.35626,  2.56711,
+  1.28876,  1.38548,  1.79387,  1.97785,  2.3904,  2.60455,
+  1.32866,  1.42224,  1.80564,  2.00282,  2.28916,  2.5443,
+  1.37794,  1.49365,  1.79368,  2.03187,  2.35373,  2.51891,
+  1.38443,  1.45365,  1.83807,  2.00184,  2.39078,  2.63512,
+  1.28946,  1.40343,  1.87102,  1.98612,  2.47998,  2.7238,
+  1.20789,  1.38822,  1.86505,  2.03166,  2.45007,  2.59141,
+  1.21863,  1.30931,  1.90985,  2.00378,  2.49942,  2.60498,
+  1.17883,  1.2733,  1.83281,  2.02504,  2.50863,  2.65023,
+  1.14748,  1.25919,  1.93016,  2.02773,  2.52207,  2.63407,
+  1.10091,  1.26803,  1.85791,  1.9519,  2.50889,  2.66039,
+  1.06983,  1.22567,  1.88895,  1.97434,  2.49213,  2.5921,
+  1.04226,  1.18221,  1.89174,  2.03996,  2.55965,  2.67933,
+  0.956414,  1.18097,  1.88146,  1.99433,  2.31647,  2.61769,
+  1.06179,  1.5717,  1.92657,  2.10718,  2.40416,  2.52545,
+  1.37431,  1.4759,  1.67843,  1.97242,  2.36429,  2.51653,
+  1.36344,  1.45577,  1.76316,  1.9708,  2.36833,  2.58698,
+  1.42304,  1.59189,  1.7982,  2.01278,  2.38811,  2.60218,
+  1.52726,  1.60578,  1.90951,  2.03343,  2.40668,  2.59346,
+  1.58513,  1.66451,  1.91801,  2.02654,  2.42573,  2.60092,
+  1.61189,  1.72856,  1.90767,  2.03404,  2.39568,  2.64177,
+  1.46301,  1.62466,  1.87229,  1.99824,  2.48782,  2.66247,
+  1.50707,  1.59791,  1.89375,  1.99701,  2.53598,  2.67246,
+  1.5024,  1.61803,  1.88856,  2.02416,  2.58185,  2.65654,
+  1.55312,  1.63948,  1.91892,  2.03428,  2.57686,  2.65568,
+  1.57736,  1.64826,  1.95809,  2.05341,  2.56789,  2.65652,
+  1.59537,  1.65463,  1.99777,  2.09975,  2.53164,  2.67521,
+  1.62164,  1.70401,  1.95775,  2.07464,  2.58431,  2.66051,
+  1.61843,  1.71139,  1.95479,  2.06745,  2.53377,  2.69523,
+  1.61785,  1.71631,  1.94968,  2.10336,  2.63594,  2.68689,
+  1.64932,  1.74631,  1.90161,  2.06435,  2.60677,  2.69024,
+  1.63506,  1.7696,  1.90462,  2.0191,  2.6076,  2.71333,
+  1.64557,  1.7795,  1.86895,  1.96533,  2.59215,  2.7149,
+  1.68657,  1.7575,  1.85807,  1.92204,  2.50527,  2.69889,
+  1.61272,  1.70323,  1.83105,  1.9259,  2.37381,  2.61368,
+  1.24435,  1.40956,  1.71346,  1.9677,  2.35146,  2.53736,
+  1.26999,  1.3873,  1.64097,  1.99183,  2.32491,  2.50177,
+  1.30535,  1.45577,  1.78878,  2.09123,  2.48724,  2.61473,
+  1.41386,  1.51881,  1.88852,  2.25227,  2.44809,  2.59472,
+  1.40942,  1.59146,  1.94472,  2.19692,  2.51839,  2.63823,
+  1.39914,  1.70331,  1.96615,  2.22486,  2.61691,  2.73408,
+  1.37531,  1.63638,  2.06176,  2.29242,  2.58662,  2.70574,
+  1.39467,  1.73342,  2.0736,  2.29715,  2.57382,  2.67289,
+  1.36608,  1.73861,  2.01663,  2.28566,  2.60549,  2.69352,
+  1.36062,  1.60169,  1.96797,  2.19484,  2.56485,  2.65792,
+  1.3547,  1.47154,  1.99017,  2.16544,  2.569,  2.67912,
+  1.31937,  1.40392,  2.03022,  2.11501,  2.4527,  2.63591,
+  1.30326,  1.37473,  1.97504,  2.11117,  2.36982,  2.66061,
+  1.32579,  1.43105,  2.03617,  2.11394,  2.476,  2.68507,
+  1.30748,  1.51036,  2.1177,  2.17917,  2.55458,  2.69578,
+  1.31143,  1.54831,  2.12835,  2.27973,  2.5517,  2.6455,
+  1.29377,  1.44223,  2.11556,  2.28956,  2.4159,  2.53121,
+  1.27867,  1.69711,  2.0925,  2.19954,  2.36852,  2.56114,
+  1.29264,  1.86793,  2.12883,  2.20633,  2.45084,  2.55178,
+  1.23486,  1.63107,  2.1437,  2.30446,  2.49101,  2.56573,
+  1.21995,  1.36757,  2.1498,  2.21849,  2.49521,  2.6353,
+  1.2089,  1.48484,  2.1803,  2.27669,  2.52633,  2.62673,
+  1.16526,  1.45824,  2.15559,  2.22728,  2.49018,  2.5968,
+  1.11619,  1.49218,  2.17727,  2.2419,  2.53233,  2.62053,
+  1.0969,  1.52492,  2.09349,  2.34525,  2.48036,  2.61116,
+  1.04378,  1.36903,  2.22928,  2.30665,  2.52743,  2.61303,
+  1.08072,  1.33613,  2.13554,  2.24061,  2.46344,  2.63428,
+  1.12626,  1.50254,  2.06533,  2.27483,  2.51283,  2.58825,
+  1.19913,  1.448,  2.04058,  2.21686,  2.44913,  2.5443,
+  1.2443,  1.54083,  2.03653,  2.17483,  2.47027,  2.58034,
+  1.27719,  1.57406,  2.06637,  2.15037,  2.50854,  2.61173,
+  1.34175,  1.57688,  2.03148,  2.12065,  2.49616,  2.57534,
+  1.33544,  1.5416,  1.99434,  2.1088,  2.51884,  2.62295,
+  1.35172,  1.54371,  2.00331,  2.07535,  2.57916,  2.65663,
+  1.3593,  1.47053,  1.96846,  2.04232,  2.56515,  2.66484,
+  1.3682,  1.43322,  1.98377,  2.04495,  2.4386,  2.6706,
+  1.35118,  1.42613,  1.99129,  2.08773,  2.43075,  2.61637,
+  1.34987,  1.4833,  2.00027,  2.24283,  2.53591,  2.62905,
+  1.32206,  1.59678,  2.11312,  2.40815,  2.54898,  2.62526,
+  1.38129,  1.64876,  2.19246,  2.37836,  2.57952,  2.6545,
+  1.37213,  1.54266,  2.06255,  2.30731,  2.47559,  2.58062,
+  1.36357,  1.46348,  1.86476,  2.28846,  2.4678,  2.57169,
+  1.33579,  1.5363,  1.88616,  2.22187,  2.54338,  2.67053,
+  1.25976,  1.39335,  1.60476,  1.93429,  2.43051,  2.5096,
+  1.22472,  1.34965,  1.48194,  1.83683,  2.38496,  2.46313,
+  1.25366,  1.36921,  1.50551,  1.99434,  2.36606,  2.45456,
+  1.25045,  1.37222,  1.56344,  2.13328,  2.39153,  2.46111,
+  1.29898,  1.41253,  1.56,  2.16285,  2.47558,  2.55147,
+  1.3087,  1.48723,  1.61657,  2.14089,  2.42252,  2.52784,
+  1.36226,  1.50974,  1.69114,  2.15185,  2.42506,  2.50401,
+  1.41519,  1.57382,  1.72634,  2.14569,  2.42361,  2.51895,
+  1.4683,  1.62457,  1.768,  2.10708,  2.43369,  2.50188,
+  1.47421,  1.64517,  1.82938,  2.15047,  2.33054,  2.45413,
+  1.48873,  1.66222,  1.85318,  2.16043,  2.39072,  2.50747,
+  1.51537,  1.6851,  1.8209,  2.09082,  2.47713,  2.54132,
+  1.53394,  1.68102,  1.91115,  2.10105,  2.43121,  2.50742,
+  1.54702,  1.76275,  1.90532,  2.0573,  2.36997,  2.49646,
+  1.52475,  1.7075,  1.88085,  2.14514,  2.33129,  2.4433,
+  1.53267,  1.68946,  1.83844,  2.06671,  2.35207,  2.48759,
+  1.44908,  1.63991,  1.78652,  2.04704,  2.32879,  2.42622,
+  1.39341,  1.607,  1.75213,  2.06596,  2.381,  2.47377,
+  1.23492,  1.62038,  1.75171,  2.07935,  2.40097,  2.47182,
+  1.12865,  1.58919,  1.72598,  2.09781,  2.42178,  2.50718,
+  1.20512,  1.49111,  1.70703,  2.14313,  2.40768,  2.4896,
+  1.10599,  1.52409,  1.74026,  2.14252,  2.42276,  2.53271,
+  1.14687,  1.42809,  1.69879,  2.10033,  2.42333,  2.5455,
+  1.11601,  1.3519,  1.75431,  2.14602,  2.4117,  2.52754,
+  1.17851,  1.30684,  1.82411,  2.27204,  2.45289,  2.54631,
+  1.38605,  1.68653,  2.01082,  2.14869,  2.4392,  2.57093,
+  1.33438,  1.67405,  1.96249,  2.10873,  2.40392,  2.5875,
+  1.30954,  1.51943,  2.0306,  2.11973,  2.43608,  2.6208,
+  1.19962,  1.42519,  2.03789,  2.16133,  2.49331,  2.63953,
+  0.913804,  1.25173,  2.05508,  2.17687,  2.41685,  2.64493,
+  0.822137,  1.06733,  2.01912,  2.21659,  2.39556,  2.65819,
+  0.859923,  0.985874,  1.90428,  2.16059,  2.43371,  2.63982,
+  0.906761,  1.14062,  2.0105,  2.14624,  2.46964,  2.64413,
+  0.950845,  1.25396,  2.03953,  2.0959,  2.60028,  2.71109,
+  0.953879,  1.24532,  1.98547,  2.13315,  2.54365,  2.613,
+  1.03167,  1.28659,  1.97462,  2.03713,  2.54102,  2.69028,
+  1.0516,  1.37316,  1.90525,  2.00964,  2.49555,  2.67405,
+  1.08826,  1.2974,  1.89869,  2.01858,  2.50884,  2.69051,
+  1.1467,  1.28227,  1.93071,  2.01015,  2.43941,  2.64701,
+  1.1572,  1.34385,  1.93082,  2.02912,  2.36815,  2.598,
+  1.24735,  1.43274,  1.94259,  2.06745,  2.39283,  2.5543,
+  1.29762,  1.51602,  1.99339,  2.07927,  2.43946,  2.54827,
+  1.38625,  1.4836,  1.96585,  2.07161,  2.44479,  2.59437,
+  1.42969,  1.49987,  1.88063,  2.07411,  2.3462,  2.60425,
+  1.56913,  1.64448,  1.94276,  2.0452,  2.37069,  2.58937,
+  1.69636,  1.74562,  1.98094,  2.09366,  2.43348,  2.58367,
+  1.69484,  1.80115,  1.96103,  2.06832,  2.45264,  2.63829,
+  1.61979,  1.78559,  1.91963,  2.05582,  2.23816,  2.49876,
+  1.22369,  1.62122,  1.79172,  1.89869,  2.16167,  2.49995,
+  1.14441,  1.45291,  1.78089,  1.86674,  2.21421,  2.49427,
+  1.13554,  1.49512,  1.82078,  1.89436,  2.11501,  2.44158,
+  1.13138,  1.53582,  1.73732,  1.84242,  2.02164,  2.42595,
+  1.21265,  1.31217,  1.75291,  1.88932,  2.10891,  2.4697,
+  1.25395,  1.35241,  1.65265,  1.96095,  2.39444,  2.56868,
+  1.36268,  1.58079,  1.91332,  2.21262,  2.3816,  2.52899,
+  1.41733,  1.58205,  1.97763,  2.23799,  2.41308,  2.58029,
+  1.38316,  1.60355,  2.01614,  2.21013,  2.44905,  2.58723,
+  1.44211,  1.54421,  1.93895,  2.14188,  2.495,  2.59016,
+  1.38173,  1.57916,  1.982,  2.13878,  2.48578,  2.62057,
+  1.36159,  1.59781,  1.96493,  2.13812,  2.54261,  2.62247,
+  1.36066,  1.61469,  2.01078,  2.1615,  2.46045,  2.5839,
+  1.39009,  1.62865,  1.96383,  2.13056,  2.47773,  2.61338,
+  1.34617,  1.6485,  2.08237,  2.32171,  2.55595,  2.64942,
+  1.44042,  1.74244,  2.00765,  2.20824,  2.45099,  2.57791,
+  1.44483,  1.69506,  2.02687,  2.21048,  2.41403,  2.53277,
+  1.34554,  1.58917,  1.95542,  2.12931,  2.40989,  2.54316,
+  1.40004,  1.48192,  1.94707,  2.11026,  2.31316,  2.53117,
+  1.38478,  1.48479,  1.98387,  2.10714,  2.36009,  2.58548,
+  1.42919,  1.51494,  2.01966,  2.13766,  2.32955,  2.58529,
+  1.45055,  1.51832,  2.01003,  2.1028,  2.40169,  2.60328,
+  1.44136,  1.52541,  1.96497,  2.07672,  2.37601,  2.59481,
+  1.46479,  1.52155,  1.96899,  2.07787,  2.44496,  2.62108,
+  1.4867,  1.57368,  2.00184,  2.10852,  2.43377,  2.62616,
+  1.47103,  1.5436,  1.99166,  2.11171,  2.47331,  2.64546,
+  1.41527,  1.52449,  2.0127,  2.09575,  2.45882,  2.64202,
+  1.40751,  1.50149,  2.05031,  2.1562,  2.48019,  2.62327,
+  1.37612,  1.45958,  2.00994,  2.16941,  2.4802,  2.64269,
+  1.34595,  1.47288,  2.07312,  2.18486,  2.48613,  2.61036,
+  1.30637,  1.43838,  2.0905,  2.21314,  2.5542,  2.68395,
+  1.21926,  1.42304,  2.09092,  2.17049,  2.55962,  2.66821,
+  1.18047,  1.40808,  1.93517,  2.08818,  2.54813,  2.63944,
+  1.20954,  1.52893,  1.88727,  1.96188,  2.48344,  2.64934,
+  1.21992,  1.52138,  1.93918,  1.98802,  2.46003,  2.67348,
+  1.19875,  1.4741,  1.85911,  1.98104,  2.39535,  2.7192,
+  1.11841,  1.50485,  1.89794,  2.00238,  2.24287,  2.59852,
+  1.01853,  1.45989,  1.74659,  2.05195,  2.32486,  2.45885,
+  0.86699,  1.38778,  1.6541,  1.79974,  2.32579,  2.40738,
+  0.862252,  1.36583,  1.70576,  1.80225,  2.41635,  2.49385,
+  0.928394,  1.54645,  1.71668,  1.87707,  2.37972,  2.52459,
+  1.08335,  1.48734,  1.80115,  2.00569,  2.32174,  2.55873,
+  1.05743,  1.3398,  1.83442,  1.9346,  2.27962,  2.5307,
+  0.954787,  1.141,  1.79287,  1.8918,  2.34291,  2.49204,
+  0.996853,  1.13004,  1.79215,  1.89541,  2.23624,  2.40335,
+  0.920268,  1.06949,  1.87486,  2.07209,  2.33523,  2.48657,
+  0.954214,  1.08107,  1.82732,  2.07915,  2.23882,  2.50812,
+  0.894487,  1.01384,  1.71654,  2.01845,  2.17535,  2.48224,
+  0.842005,  0.979634,  1.64453,  1.9459,  2.27102,  2.43863,
+  0.95571,  1.09,  1.75405,  1.96707,  2.12784,  2.44888,
+  0.954385,  1.09447,  1.72755,  2.00558,  2.26657,  2.5144,
+  1.02562,  1.1376,  1.78753,  2.00208,  2.3369,  2.51184,
+  1.01381,  1.1751,  1.88194,  2.01664,  2.34586,  2.44572,
+  1.08267,  1.2273,  1.92324,  2.02278,  2.40238,  2.52097,
+  1.11811,  1.22414,  1.82445,  1.96175,  2.24583,  2.51583,
+  1.14645,  1.29899,  1.87293,  1.99547,  2.37173,  2.5269,
+  1.18855,  1.31065,  1.90221,  1.99678,  2.29037,  2.52054,
+  1.30992,  1.41653,  1.87845,  2.05009,  2.22418,  2.38779,
+  1.39476,  1.50627,  1.93489,  2.05682,  2.27119,  2.45334,
+  1.37793,  1.57264,  1.9907,  2.08357,  2.38159,  2.60652,
+  1.44402,  1.6893,  1.99746,  2.15321,  2.36113,  2.5077,
+  1.51504,  1.64277,  1.92909,  2.15934,  2.33551,  2.49784,
+  1.54008,  1.70831,  1.88382,  2.09498,  2.39862,  2.5701,
+  1.60091,  1.69851,  1.88148,  2.08517,  2.45101,  2.65374,
+  1.50263,  1.75606,  2.04072,  2.1634,  2.37617,  2.54867,
+  1.53211,  1.85534,  1.99384,  2.13955,  2.30249,  2.43099,
+  1.48486,  1.82205,  1.9643,  2.13596,  2.33702,  2.47234,
+  1.53669,  1.76692,  1.95125,  2.09052,  2.32417,  2.52921,
+  1.58228,  1.72385,  1.91207,  2.06937,  2.30294,  2.4739,
+  1.49971,  1.59329,  1.9127,  2.0341,  2.36655,  2.55379,
+  1.4342,  1.54071,  1.86757,  1.98917,  2.32371,  2.5394,
+  1.1891,  1.50082,  1.76342,  1.9762,  2.13728,  2.44118,
+  1.16592,  1.47018,  1.773,  1.9271,  2.08801,  2.3043,
+  1.25015,  1.60042,  1.81807,  1.92211,  2.08025,  2.24181,
+  1.12269,  1.6288,  1.81441,  1.93295,  2.0993,  2.41867,
+  1.01962,  1.51066,  1.85073,  1.99562,  2.1302,  2.45706,
+  0.958176,  1.63968,  1.84043,  1.95653,  2.10428,  2.27903,
+  1.01054,  1.53751,  1.77222,  1.93052,  2.10162,  2.24851,
+  0.904371,  1.50502,  1.66433,  1.82788,  2.27803,  2.34842,
+  1.06773,  1.45454,  1.68686,  1.80346,  2.38437,  2.49979,
+  1.26287,  1.516,  1.88275,  1.97556,  2.35357,  2.51973,
+  1.56064,  1.69896,  1.92154,  2.00006,  2.54029,  2.60523,
+  1.66562,  1.74409,  1.99592,  2.104,  2.53894,  2.62016,
+  1.61517,  1.7485,  2.02411,  2.12606,  2.40816,  2.61413,
+  1.67803,  1.75295,  2.0279,  2.14656,  2.38237,  2.56851,
+  1.58035,  1.68027,  1.99741,  2.12246,  2.45985,  2.58783,
+  1.59008,  1.69205,  1.93478,  2.09576,  2.55298,  2.62588,
+  1.539,  1.62024,  1.92077,  2.0316,  2.48167,  2.59269,
+  1.4088,  1.51179,  1.74425,  1.89659,  2.41202,  2.51558,
+  1.32056,  1.48799,  1.75496,  1.89691,  2.43716,  2.56318,
+  1.17487,  1.52485,  1.70818,  1.96295,  2.51378,  2.58101,
+  1.28764,  1.55957,  1.90308,  2.10518,  2.45098,  2.59946,
+  1.22403,  1.508,  1.92279,  2.07637,  2.37291,  2.58121,
+  1.16322,  1.44496,  1.73467,  2.02018,  2.32215,  2.54157,
+  1.21226,  1.448,  1.63849,  2.03192,  2.22935,  2.39947,
+  1.10889,  1.28333,  1.48115,  1.90707,  2.10001,  2.29348,
+  1.15522,  1.29037,  1.47672,  1.68807,  2.08922,  2.18177,
+  1.17147,  1.29039,  1.55651,  1.82599,  2.01814,  2.24349,
+  1.14989,  1.28265,  1.6019,  1.7453,  2.11078,  2.40906,
+  1.22391,  1.36072,  1.65007,  1.79294,  2.2651,  2.37093,
+  1.25437,  1.40454,  1.70667,  1.85465,  2.27647,  2.39469,
+  1.22583,  1.44211,  1.76613,  1.92412,  2.2924,  2.39468,
+  1.21114,  1.46189,  1.80455,  1.92702,  2.36199,  2.45328,
+  1.21864,  1.40578,  1.80953,  1.9142,  2.31845,  2.52005,
+  1.22294,  1.39467,  1.84011,  1.9324,  2.39167,  2.50319,
+  1.2069,  1.37287,  1.84295,  1.9438,  2.42446,  2.57876,
+  1.24631,  1.42383,  1.86621,  1.96241,  2.43605,  2.59566,
+  1.27092,  1.4559,  1.88805,  1.97634,  2.46928,  2.58281,
+  1.19826,  1.32394,  1.88024,  1.94941,  2.47166,  2.6448,
+  1.17432,  1.2932,  1.76561,  2.01928,  2.28224,  2.57624,
+  1.14173,  1.38319,  1.88283,  2.12653,  2.45304,  2.61119,
+  1.48334,  1.65073,  2.04359,  2.1938,  2.51727,  2.62292,
+  1.44607,  1.6219,  1.99961,  2.10353,  2.49348,  2.58192,
+  1.41467,  1.63024,  1.94568,  2.06177,  2.50065,  2.58895,
+  1.43843,  1.61559,  1.90335,  2.01303,  2.42611,  2.61364,
+  1.55667,  1.62312,  1.87546,  1.97231,  2.36669,  2.62922,
+  1.4665,  1.63832,  1.79658,  1.95927,  2.45762,  2.60323,
+  1.30828,  1.48139,  1.73054,  1.97927,  2.33226,  2.53809,
+  1.30165,  1.41374,  1.67444,  1.93338,  2.14349,  2.50814,
+  1.31891,  1.41656,  1.75164,  1.91344,  2.29409,  2.55512,
+  1.32451,  1.42562,  1.84492,  1.94741,  2.37538,  2.59737,
+  1.267,  1.35973,  1.84915,  1.95084,  2.37072,  2.5793,
+  1.1627,  1.34431,  1.90693,  1.98657,  2.47058,  2.58342,
+  1.116,  1.36583,  1.94803,  2.04008,  2.46113,  2.5836,
+  1.0618,  1.35029,  2.00628,  2.08046,  2.45163,  2.52696,
+  1.02433,  1.23357,  1.98941,  2.08505,  2.38718,  2.49582,
+  0.962287,  1.21924,  1.967,  2.08919,  2.42466,  2.59986,
+  0.881533,  1.35683,  2.04743,  2.15539,  2.40907,  2.50875,
+  0.85601,  1.21772,  2.00853,  2.11153,  2.42481,  2.53774,
+  0.774065,  0.965055,  1.87414,  2.03588,  2.25102,  2.52797,
+  0.820344,  0.990331,  1.96096,  2.24212,  2.34955,  2.53547,
+  0.846158,  1.06289,  1.97251,  2.16915,  2.35316,  2.55609,
+  0.748812,  1.06344,  1.94995,  2.06685,  2.36451,  2.602,
+  0.855725,  1.15838,  2.00842,  2.14414,  2.3285,  2.60048,
+  0.862076,  1.18823,  1.90646,  2.19135,  2.36851,  2.54264,
+  0.814218,  1.19401,  2.0864,  2.15686,  2.48295,  2.57478,
+  0.811087,  1.32095,  2.03826,  2.11283,  2.50888,  2.59894,
+  0.967874,  1.19172,  2.04932,  2.14652,  2.42267,  2.56678,
+  1.00803,  1.2342,  2.04091,  2.12104,  2.48015,  2.60909,
+  1.11818,  1.31227,  1.96142,  2.07124,  2.40932,  2.60053,
+  1.18934,  1.30243,  1.96196,  2.06321,  2.43212,  2.5453,
+  1.25389,  1.37123,  1.93188,  2.03014,  2.38756,  2.55895,
+  1.3073,  1.39804,  1.91099,  2.00694,  2.40944,  2.57714,
+  1.33009,  1.46846,  1.90852,  2.01222,  2.41802,  2.53768,
+  1.36799,  1.49229,  1.94202,  2.03675,  2.49887,  2.581,
+  1.36837,  1.44343,  1.94748,  2.01318,  2.48634,  2.58524,
+  1.41828,  1.49685,  1.93344,  2.02463,  2.47368,  2.59404,
+  1.44389,  1.55122,  1.90491,  2.0181,  2.45672,  2.54287,
+  1.47369,  1.5871,  1.89983,  2.07901,  2.4215,  2.58448,
+  1.42467,  1.61133,  1.97452,  2.14272,  2.40288,  2.62076,
+  1.43149,  1.62266,  1.94023,  2.12544,  2.42965,  2.58185,
+  1.48454,  1.69058,  1.92186,  2.1091,  2.4744,  2.60783,
+  1.49814,  1.75158,  1.92573,  2.03913,  2.44052,  2.61618,
+  1.50525,  1.78918,  1.99467,  2.11413,  2.40842,  2.59989,
+  1.60987,  1.79304,  1.98623,  2.1606,  2.51957,  2.59325,
+  1.56282,  1.73991,  1.97418,  2.14322,  2.53959,  2.62009,
+  1.65026,  1.72396,  2.00295,  2.1504,  2.5321,  2.60075,
+  1.58463,  1.66548,  1.83385,  1.97966,  2.51117,  2.57618,
+  1.54756,  1.66563,  1.80511,  1.93045,  2.42867,  2.54861,
+  1.49908,  1.59512,  1.70027,  1.82419,  2.37692,  2.57548,
+  1.30084,  1.55295,  1.66458,  1.79171,  2.4883,  2.56108,
+  1.1686,  1.31195,  1.66858,  1.87291,  2.41357,  2.49328,
+  1.04746,  1.24996,  1.69989,  1.91418,  2.41703,  2.49638,
+  0.948776,  1.27559,  1.73894,  1.99868,  2.31215,  2.46202,
+  0.921081,  1.31195,  1.77524,  1.89549,  2.38216,  2.52844,
+  0.811311,  1.12522,  1.74519,  2.09474,  2.32611,  2.51188,
+  0.796518,  1.06023,  1.74013,  2.0605,  2.17951,  2.3855,
+  0.868836,  1.15335,  1.79283,  1.94564,  2.1255,  2.248,
+  0.915536,  1.21816,  1.81891,  2.06835,  2.2434,  2.34865,
+  0.966595,  1.30161,  1.89525,  2.11196,  2.24865,  2.38925,
+  0.995849,  1.44208,  1.95207,  2.06612,  2.24012,  2.33859,
+  1.05639,  1.37221,  1.98417,  2.11933,  2.2717,  2.37274,
+  1.0984,  1.32416,  1.78153,  2.08286,  2.2188,  2.34432,
+  1.03916,  1.35647,  1.82018,  2.11462,  2.34673,  2.45039,
+  0.988689,  1.29388,  1.91635,  2.0882,  2.3625,  2.48127,
+  1.10441,  1.23068,  1.93943,  2.1224,  2.25481,  2.37771,
+  1.0861,  1.17448,  1.82635,  2.11132,  2.23769,  2.47167,
+  1.0698,  1.20649,  1.84538,  2.11863,  2.47109,  2.5754,
+  1.07496,  1.34279,  1.95531,  2.14771,  2.51147,  2.58927,
+  1.1492,  1.41881,  1.88704,  1.96697,  2.47262,  2.58725,
+  1.45575,  1.66983,  1.9641,  2.17518,  2.46999,  2.60501,
+  1.41855,  1.60357,  1.96443,  2.17568,  2.46676,  2.58333,
+  1.38939,  1.60116,  1.92575,  2.13186,  2.44202,  2.57423,
+  1.41533,  1.50734,  1.91126,  2.08714,  2.5352,  2.62958,
+  1.38248,  1.45371,  1.87229,  1.95541,  2.55434,  2.65851,
+  1.39294,  1.4823,  1.83853,  1.92858,  2.47373,  2.63372,
+  1.39046,  1.46304,  1.83991,  1.92201,  2.51494,  2.69879,
+  1.33938,  1.47012,  1.85875,  1.95952,  2.53943,  2.68638,
+  1.35378,  1.54103,  1.82255,  2.02216,  2.54222,  2.6772,
+  1.35087,  1.63188,  1.91879,  2.18353,  2.50109,  2.61731,
+  1.40764,  1.66913,  2.00074,  2.22423,  2.5228,  2.6349,
+  1.43378,  1.58691,  1.99963,  2.19292,  2.53598,  2.62612,
+  1.41388,  1.63943,  1.9522,  2.1707,  2.50111,  2.61059,
+  1.50539,  1.61369,  1.99159,  2.21446,  2.48787,  2.61284,
+  1.40925,  1.56369,  2.04804,  2.15415,  2.48373,  2.64218,
+  1.41102,  1.6467,  1.98318,  2.15255,  2.56881,  2.66125,
+  1.38475,  1.60381,  1.93449,  2.14195,  2.50764,  2.63005,
+  1.36612,  1.55134,  1.99956,  2.17747,  2.48911,  2.59676,
+  1.35554,  1.63502,  2.00842,  2.16267,  2.46527,  2.66141,
+  1.45397,  1.6737,  2.03786,  2.1802,  2.61597,  2.70928,
+  1.36954,  1.69647,  1.99979,  2.08485,  2.48277,  2.66629,
+  1.34974,  1.46231,  1.96672,  2.05172,  2.47262,  2.65262,
+  1.32731,  1.43776,  1.92852,  2.00639,  2.50581,  2.65892,
+  1.34135,  1.41915,  1.9212,  1.99146,  2.53082,  2.61358,
+  1.3427,  1.50533,  1.94693,  2.02943,  2.53822,  2.63558,
+  1.39274,  1.5351,  1.9361,  2.02457,  2.52728,  2.61426,
+  1.43256,  1.54379,  1.95185,  2.04985,  2.54624,  2.62371,
+  1.45294,  1.56943,  1.93237,  2.03725,  2.55869,  2.6381,
+  1.468,  1.59745,  1.92031,  2.01857,  2.53622,  2.62282,
+  1.48681,  1.56965,  1.87585,  1.96607,  2.53674,  2.63191,
+  1.45462,  1.57813,  1.81162,  1.97466,  2.53751,  2.60633,
+  1.41804,  1.50767,  1.78357,  1.893,  2.5518,  2.62899,
+  1.26414,  1.47438,  1.77059,  1.89893,  2.52476,  2.59407,
+  1.11834,  1.45667,  1.73472,  1.99659,  2.41229,  2.51915,
+  1.09643,  1.60312,  1.80839,  2.01224,  2.40962,  2.54436,
+  0.976303,  1.47374,  1.75917,  1.85583,  2.41293,  2.48395,
+  0.990184,  1.3907,  1.71071,  1.83167,  2.37709,  2.45494,
+  1.0569,  1.38737,  1.78311,  1.87351,  2.40142,  2.48642,
+  0.989786,  1.45262,  1.85157,  1.94592,  2.40345,  2.48294,
+  1.11208,  1.36482,  1.77,  1.922,  2.29041,  2.4373,
+  1.09625,  1.33639,  1.74186,  1.96857,  2.21161,  2.36249,
+  1.00003,  1.34618,  1.70453,  1.96685,  2.27739,  2.38937,
+  1.0279,  1.17407,  1.793,  2.02685,  2.1782,  2.38723,
+  1.05688,  1.1675,  1.861,  2.20442,  2.35125,  2.48563,
+  1.07597,  1.22642,  1.99764,  2.19618,  2.3301,  2.49414,
+  1.14722,  1.25813,  1.95867,  2.25855,  2.38775,  2.55212,
+  1.16281,  1.29057,  2.05279,  2.20183,  2.42462,  2.56048,
+  1.14789,  1.26573,  2.02568,  2.13079,  2.49688,  2.62026,
+  1.23956,  1.31573,  2.01838,  2.12351,  2.46395,  2.56921,
+  1.18113,  1.35894,  1.94216,  2.15983,  2.4587,  2.59396,
+  1.24746,  1.38644,  1.89825,  1.99901,  2.44602,  2.54276,
+  1.22769,  1.50489,  1.818,  1.90802,  2.21333,  2.55223,
+  1.20197,  1.57787,  1.77128,  1.87335,  2.06126,  2.53582,
+  1.30623,  1.51631,  1.81923,  1.92342,  2.38203,  2.58257,
+  1.50572,  1.58565,  1.94933,  2.0462,  2.44831,  2.61596,
+  1.62375,  1.69873,  2.00954,  2.10801,  2.46152,  2.6479,
+  1.69086,  1.76429,  2.0361,  2.1755,  2.51525,  2.61682,
+  1.71534,  1.82829,  2.07855,  2.25221,  2.48367,  2.60765,
+  1.65997,  1.80717,  1.97501,  2.25559,  2.48134,  2.58962,
+  1.73482,  1.85022,  2.01204,  2.27674,  2.51936,  2.60818,
+  1.63577,  1.86255,  1.95646,  2.32874,  2.56887,  2.63247,
+  1.61635,  1.8254,  1.94952,  2.28122,  2.56086,  2.6418,
+  1.59247,  1.80436,  1.92716,  2.16734,  2.57751,  2.64687,
+  1.60648,  1.89509,  1.98315,  2.11245,  2.47761,  2.57696,
+  1.70849,  1.83507,  1.96671,  2.12724,  2.42757,  2.54308,
+  1.69109,  1.88958,  1.98607,  2.20677,  2.5224,  2.6018,
+  1.70244,  1.90212,  2.07638,  2.21622,  2.48484,  2.60354,
+  1.32949,  1.54259,  1.87544,  2.10553,  2.38523,  2.53663,
+  1.32138,  1.47416,  1.93227,  2.1525,  2.37442,  2.50671,
+  1.27775,  1.45858,  1.96309,  2.18238,  2.417,  2.55865,
+  1.20802,  1.41871,  2.00974,  2.13853,  2.39678,  2.55451,
+  1.19891,  1.29992,  1.98363,  2.15013,  2.29612,  2.50594,
+  1.25034,  1.36116,  2.01056,  2.19594,  2.34098,  2.50087,
+  1.30866,  1.58516,  2.10634,  2.21416,  2.40267,  2.63589,
+  1.33017,  1.49463,  2.1419,  2.23581,  2.45958,  2.64947,
+  1.29631,  1.43411,  2.09809,  2.20413,  2.35521,  2.60011,
+  1.30962,  1.40298,  1.89254,  2.18495,  2.33361,  2.51316,
+  1.26907,  1.49184,  1.95896,  2.17457,  2.32469,  2.54367,
+  1.43498,  1.62885,  1.98127,  2.24728,  2.4764,  2.59398,
+  1.45964,  1.65008,  2.02437,  2.26772,  2.54631,  2.6752,
+  1.38149,  1.70319,  2.13891,  2.29556,  2.54576,  2.64253,
+  1.44184,  1.70059,  2.19791,  2.27629,  2.46821,  2.69495,
+  1.53967,  1.99967,  2.20653,  2.35148,  2.65123,  2.73482,
+  1.58958,  1.92641,  2.17346,  2.2562,  2.63324,  2.70768,
+  1.43426,  1.85937,  2.14195,  2.21145,  2.51178,  2.62838,
+  1.32681,  1.59657,  2.02477,  2.11581,  2.42614,  2.60934,
+  1.22907,  1.32555,  1.8387,  2.01305,  2.4713,  2.63928,
+  1.23081,  1.32906,  1.87262,  1.96451,  2.44475,  2.59469,
+  1.1937,  1.4263,  1.89859,  2.03936,  2.50271,  2.58105,
+  1.17564,  1.47329,  1.91242,  2.00274,  2.47622,  2.60685,
+  1.09927,  1.4439,  1.89246,  1.99757,  2.52208,  2.61109,
+  1.11374,  1.4391,  1.91227,  2.00048,  2.46277,  2.55934,
+  1.08551,  1.46963,  1.91446,  2.06461,  2.42792,  2.51241,
+  1.05248,  1.5012,  1.9188,  1.99979,  2.49368,  2.57171,
+  1.0436,  1.33162,  1.92795,  1.98919,  2.44573,  2.57808,
+  1.05198,  1.20039,  1.93863,  2.02681,  2.44675,  2.62988,
+  0.978672,  1.08304,  1.86878,  2.13358,  2.43014,  2.58027,
+  0.904772,  1.10521,  1.96057,  2.06495,  2.36256,  2.60488,
+  0.859439,  1.08463,  1.90171,  2.033,  2.27617,  2.57472,
+  0.948943,  1.04355,  1.85564,  2.05086,  2.44443,  2.66148,
+  0.974338,  1.12646,  1.92732,  2.02091,  2.45549,  2.55978,
+  0.995629,  1.17589,  1.93774,  2.01368,  2.37897,  2.61729,
+  1.00131,  1.22439,  1.9017,  1.97647,  2.42588,  2.57484,
+  0.985969,  1.2826,  1.88661,  2.03245,  2.45596,  2.59953,
+  0.92759,  1.32045,  1.92401,  2.01217,  2.49831,  2.59968,
+  1.00794,  1.38396,  1.92163,  2.00762,  2.50757,  2.6075,
+  0.972512,  1.44677,  1.92036,  2.01349,  2.49021,  2.57649,
+  0.951123,  1.45204,  1.88986,  1.98727,  2.42148,  2.56222,
+  0.924342,  1.36995,  1.85174,  1.94274,  2.47566,  2.54428,
+  0.882605,  1.30167,  1.85081,  2.0325,  2.36463,  2.54182,
+  0.933888,  1.369,  1.94311,  2.02385,  2.40544,  2.53033,
+  0.927916,  1.11238,  1.84743,  1.97909,  2.2556,  2.56399,
+  1.03194,  1.24913,  1.83317,  1.92522,  2.31031,  2.52014,
+  0.934046,  1.23989,  1.9096,  2.00815,  2.37287,  2.54896,
+  0.984297,  1.22003,  1.82379,  1.9476,  2.26436,  2.47865,
+  0.933366,  1.27898,  1.86047,  1.943,  2.2898,  2.46567,
+  0.983115,  1.22771,  1.8421,  2.0477,  2.27265,  2.53198,
+  0.953311,  1.24582,  1.84968,  1.94514,  2.28957,  2.57228,
+  0.994609,  1.30346,  1.86814,  1.97156,  2.37244,  2.58526,
+  0.986061,  1.36409,  1.85213,  1.91782,  2.43511,  2.63387,
+  0.975486,  1.24885,  1.8488,  1.93443,  2.40202,  2.5742,
+  1.00839,  1.30468,  1.80431,  1.88851,  2.36947,  2.59823,
+  0.999393,  1.32994,  1.90144,  1.99438,  2.3975,  2.50455,
+  0.922186,  1.32154,  1.85108,  1.96206,  2.38216,  2.47299,
+  0.897224,  1.38219,  1.78084,  1.92173,  2.35959,  2.44809,
+  0.859516,  1.44737,  1.73231,  1.88119,  2.29523,  2.38085,
+  0.986347,  1.60164,  1.75239,  1.96636,  2.31438,  2.4591,
+  1.26526,  1.61653,  1.81127,  2.09714,  2.37124,  2.55036,
+  1.31896,  1.60043,  1.75564,  2.02981,  2.32919,  2.49314,
+  1.2099,  1.47013,  1.67019,  1.97073,  2.41621,  2.52342,
+  1.12223,  1.3084,  1.45711,  1.72023,  2.38426,  2.47042,
+  1.07767,  1.24551,  1.36648,  1.66428,  2.32734,  2.4192,
+  1.07545,  1.22813,  1.36538,  1.55895,  2.23858,  2.32456,
+  1.0445,  1.21579,  1.32599,  1.64519,  2.14864,  2.22575,
+  0.955863,  1.15061,  1.28313,  1.49231,  2.17758,  2.26668,
+  0.909204,  1.04511,  1.16616,  1.32059,  2.21597,  2.35285,
+  0.960368,  1.10354,  1.27835,  1.46773,  2.26015,  2.46024,
+  1.01022,  1.18678,  1.29006,  1.57843,  2.38873,  2.50032,
+  1.02014,  1.13572,  1.23934,  1.38884,  2.43818,  2.56392,
+  1.08249,  1.20695,  1.34746,  1.49004,  2.40482,  2.49462,
+  1.14411,  1.27864,  1.43473,  1.56789,  2.32277,  2.4248,
+  1.2743,  1.34879,  1.5156,  1.63222,  2.36011,  2.55279,
+  1.30133,  1.39063,  1.63849,  1.76491,  2.34796,  2.57611,
+  1.35852,  1.44445,  1.72449,  1.84371,  2.47814,  2.57455,
+  1.39971,  1.51331,  1.79171,  1.90217,  2.49582,  2.58159,
+  1.44887,  1.53475,  1.82151,  1.93149,  2.51782,  2.62286,
+  1.4384,  1.53006,  1.83144,  1.99933,  2.53193,  2.62328,
+  1.51192,  1.58109,  1.92748,  2.0414,  2.57329,  2.66347,
+  1.53538,  1.60831,  1.92423,  2.0488,  2.54675,  2.68165,
+  1.54437,  1.62041,  1.98043,  2.06813,  2.4774,  2.62665,
+  1.55846,  1.64301,  2.02461,  2.12101,  2.45187,  2.63949,
+  1.5242,  1.61395,  2.0059,  2.11548,  2.42909,  2.66308,
+  1.50452,  1.59038,  1.96636,  2.07263,  2.3769,  2.62109,
+  1.43939,  1.51234,  1.95035,  2.05856,  2.27641,  2.57304,
+  1.31521,  1.40005,  1.85475,  1.95763,  2.2462,  2.5765,
+  1.28812,  1.4889,  1.94557,  2.02484,  2.43985,  2.60568,
+  1.43628,  1.66725,  2.05685,  2.14644,  2.54824,  2.66174,
+  1.41739,  1.81984,  2.08357,  2.22028,  2.60669,  2.69086,
+  1.3736,  1.96301,  2.14457,  2.27406,  2.54739,  2.6389,
+  1.32037,  1.91864,  2.06321,  2.23772,  2.41585,  2.51765,
+  1.22378,  1.61975,  1.89059,  2.10791,  2.521,  2.6297,
+  1.01875,  1.42767,  1.91757,  2.00178,  2.43551,  2.56435,
+  1.02625,  1.37705,  1.94917,  2.03921,  2.39377,  2.53005,
+  1.00999,  1.47285,  1.99805,  2.07988,  2.48496,  2.55395,
+  1.05327,  1.46837,  2.01612,  2.12931,  2.45662,  2.56413,
+  1.10107,  1.35527,  2.01044,  2.10747,  2.39561,  2.53775,
+  1.1328,  1.39166,  2.01657,  2.1141,  2.49762,  2.5851,
+  1.17331,  1.44301,  1.97063,  2.10486,  2.44788,  2.53594,
+  1.20948,  1.3841,  1.97224,  2.06959,  2.45749,  2.57369,
+  1.24242,  1.45356,  1.98373,  2.06842,  2.47104,  2.59361,
+  1.32039,  1.46365,  1.99783,  2.08233,  2.47203,  2.60589,
+  1.38952,  1.47773,  1.97869,  2.09404,  2.48017,  2.64444,
+  1.41374,  1.52609,  1.96375,  2.11392,  2.40385,  2.65443,
+  1.51942,  1.59285,  1.91946,  2.02449,  2.30117,  2.66889,
+  1.51366,  1.60013,  1.92201,  2.1051,  2.27832,  2.52342,
+  1.48185,  1.65994,  1.91355,  2.04944,  2.27225,  2.49379,
+  1.56755,  1.65917,  1.93065,  2.07152,  2.31259,  2.56427,
+  1.55089,  1.67766,  1.86393,  2.01013,  2.22347,  2.52001,
+  1.57277,  1.68302,  1.86305,  2.0022,  2.32038,  2.56079,
+  1.62194,  1.73405,  1.92064,  2.06293,  2.33511,  2.57625,
+  1.63149,  1.69714,  1.95288,  2.05658,  2.45963,  2.65286,
+  1.59471,  1.67149,  1.93609,  2.0133,  2.43078,  2.66963,
+  1.60144,  1.6687,  1.9455,  2.03717,  2.50337,  2.68212,
+  1.58757,  1.6649,  1.94462,  2.03299,  2.56976,  2.70341,
+  1.55642,  1.63125,  1.93071,  2.04051,  2.45387,  2.66518,
+  1.48785,  1.56563,  1.89287,  2.01173,  2.39394,  2.64712,
+  1.40601,  1.52018,  1.79165,  1.98788,  2.28933,  2.60276,
+  1.35822,  1.43604,  1.81848,  1.95708,  2.3098,  2.60578,
+  1.30934,  1.40533,  1.8357,  2.07637,  2.34081,  2.61306,
+  1.30379,  1.41561,  1.98515,  2.12949,  2.46936,  2.64312,
+  1.35895,  1.43773,  1.98883,  2.12737,  2.53798,  2.65647,
+  1.33387,  1.48046,  1.95007,  2.12244,  2.43117,  2.58713,
+  1.38453,  1.53971,  1.96409,  2.13055,  2.51045,  2.65281,
+  1.41262,  1.54444,  1.94728,  2.17319,  2.59302,  2.71664,
+  1.43327,  1.53989,  2.00413,  2.20195,  2.51505,  2.63524,
+  1.44758,  1.55402,  2.12827,  2.24017,  2.47075,  2.65708,
+  1.48065,  1.6099,  2.09796,  2.16757,  2.4737,  2.7007,
+  1.60782,  1.67596,  2.02341,  2.14638,  2.42691,  2.63625,
+  1.6433,  1.71778,  2.06066,  2.19756,  2.41541,  2.61433,
+  1.73739,  1.81697,  2.03936,  2.21971,  2.423,  2.62353,
+  1.69426,  1.79937,  2.0426,  2.2801,  2.41863,  2.58327,
+  1.55619,  1.83187,  1.98536,  2.2079,  2.47168,  2.63082,
+  1.42115,  1.8039,  1.98458,  2.12351,  2.4382,  2.5225,
+  1.32744,  1.66887,  1.88843,  2.02994,  2.22446,  2.46175,
+  1.10982,  1.5622,  1.86266,  1.97786,  2.13955,  2.32864,
+  1.23388,  1.5808,  1.85419,  2.02179,  2.1935,  2.35592,
+  1.20754,  1.56864,  1.87291,  1.98667,  2.13794,  2.48765,
+  1.17998,  1.62595,  1.9,  2.00814,  2.23166,  2.59435,
+  1.46984,  1.7172,  1.87567,  2.02443,  2.32546,  2.48842,
+  1.6411,  1.80978,  1.92676,  2.06205,  2.41404,  2.5429,
+  1.6488,  1.73412,  1.9669,  2.08673,  2.35448,  2.49884,
+  1.60547,  1.68939,  2.01005,  2.11421,  2.40763,  2.52707,
+  1.52089,  1.62873,  1.97701,  2.08677,  2.34016,  2.48934,
+  1.50382,  1.60059,  2.03901,  2.13038,  2.39648,  2.51374,
+  1.43782,  1.54532,  2.04393,  2.18837,  2.35682,  2.52145,
+  1.4454,  1.54921,  1.98221,  2.09666,  2.32863,  2.46213,
+  1.41642,  1.50436,  1.97377,  2.08043,  2.39348,  2.54353,
+  1.42582,  1.52808,  1.99573,  2.16253,  2.44069,  2.56251,
+  1.39427,  1.47395,  2.04354,  2.14909,  2.43298,  2.54908,
+  1.37375,  1.47605,  2.0439,  2.16025,  2.34535,  2.50188,
+  1.37018,  1.44359,  2.09287,  2.1781,  2.41306,  2.5906,
+  1.32039,  1.46637,  2.03678,  2.13781,  2.43562,  2.57891,
+  1.28693,  1.39332,  2.06073,  2.20094,  2.50002,  2.58235,
+  1.32339,  1.42179,  2.0585,  2.15393,  2.49555,  2.63809,
+  1.29531,  1.39322,  2.00442,  2.13819,  2.52637,  2.64154,
+  1.23098,  1.35513,  2.04737,  2.15642,  2.52238,  2.66413,
+  1.23375,  1.30852,  1.93949,  2.09735,  2.48735,  2.64984,
+  1.22759,  1.3551,  1.87583,  1.97754,  2.31929,  2.57519,
+  1.22737,  1.50711,  1.85352,  2.02289,  2.21243,  2.57649,
+  1.1529,  1.47051,  1.83043,  1.95431,  2.33145,  2.53325,
+  1.33666,  1.65018,  1.77921,  2.04342,  2.44482,  2.53964,
+  1.45582,  1.58294,  2.02225,  2.17668,  2.48134,  2.59266,
+  1.43763,  1.55624,  2.08145,  2.17496,  2.48245,  2.61457,
+  1.41647,  1.62089,  2.03301,  2.15707,  2.46292,  2.60159,
+  1.3763,  1.55149,  2.11721,  2.19834,  2.41619,  2.60563,
+  1.4428,  1.65786,  2.12709,  2.2063,  2.34486,  2.57811,
+  1.36811,  1.53873,  2.0602,  2.19805,  2.36688,  2.62224,
+  1.34644,  1.42834,  1.98045,  2.12661,  2.28327,  2.53061,
+  1.30459,  1.37326,  1.92352,  2.09636,  2.23996,  2.50843,
+  1.29803,  1.37159,  1.95497,  2.10751,  2.34971,  2.54557,
+  1.30718,  1.41617,  1.98034,  2.06446,  2.3891,  2.58844,
+  1.2793,  1.39078,  1.95978,  2.09069,  2.43615,  2.61261,
+  1.31702,  1.41587,  1.92187,  2.07179,  2.46382,  2.61622,
+  1.29431,  1.4123,  1.9162,  2.0192,  2.48471,  2.61134,
+  1.31005,  1.40777,  1.85317,  2.00991,  2.46649,  2.64501,
+  1.3413,  1.42233,  1.88516,  1.96781,  2.48386,  2.62632,
+  1.42826,  1.52612,  1.88512,  1.97853,  2.49939,  2.60339,
+  1.50117,  1.58051,  1.84728,  2.00049,  2.46595,  2.60887,
+  1.53851,  1.6254,  1.81392,  1.95006,  2.5229,  2.62047,
+  1.56663,  1.6396,  1.77179,  1.87875,  2.54176,  2.66369,
+  1.54343,  1.64782,  1.74862,  1.8226,  2.43468,  2.63128,
+  1.62339,  1.68092,  1.75915,  1.84454,  2.52147,  2.65361,
+  1.57486,  1.66372,  1.76778,  1.86974,  2.45334,  2.65822,
+  1.55831,  1.66125,  1.79384,  1.89513,  2.26187,  2.57233,
+  1.54368,  1.62776,  1.81767,  1.92128,  2.433,  2.65334,
+  1.49354,  1.57566,  1.80569,  1.93945,  2.47064,  2.66508,
+  1.44005,  1.51384,  1.83221,  1.9378,  2.53025,  2.70287,
+  1.3191,  1.50623,  1.82349,  1.93161,  2.53955,  2.6767,
+  1.30727,  1.56337,  1.84793,  1.95172,  2.25182,  2.45322,
+  1.33641,  1.6616,  1.82882,  1.98833,  2.18951,  2.35425,
+  1.34292,  1.59875,  1.78474,  1.91512,  2.10999,  2.45064,
+  1.3367,  1.64636,  1.80074,  1.89121,  2.23591,  2.55851,
+  1.31176,  1.50001,  1.83022,  1.94504,  2.43039,  2.64458,
+  1.26611,  1.43196,  1.85876,  2.05915,  2.59049,  2.67476,
+  1.31778,  1.41995,  1.91646,  2.12482,  2.57473,  2.66848,
+  1.34152,  1.43617,  1.96842,  2.09744,  2.57279,  2.6851,
+  1.30593,  1.43886,  1.93375,  2.03608,  2.56907,  2.65642,
+  1.27913,  1.40647,  1.94309,  2.03172,  2.53008,  2.63088,
+  1.28601,  1.41003,  1.96969,  2.04024,  2.44857,  2.65137,
+  1.25754,  1.39106,  1.96657,  2.03921,  2.40242,  2.64679,
+  1.22439,  1.35213,  1.93137,  2.00634,  2.4562,  2.69615,
+  1.29629,  1.4881,  1.99695,  2.06819,  2.59454,  2.69584,
+  1.33457,  1.60772,  1.92214,  2.16316,  2.54592,  2.67997,
+  1.38178,  1.64677,  2.03764,  2.20409,  2.54579,  2.63933,
+  1.41682,  1.62893,  2.04593,  2.20935,  2.52385,  2.67579,
+  1.43146,  1.6948,  1.99893,  2.15953,  2.52293,  2.66475,
+  1.38424,  1.62294,  2.03694,  2.11571,  2.52889,  2.63393,
+  1.40383,  1.55836,  2.02735,  2.13802,  2.56277,  2.65938,
+  1.39059,  1.67194,  2.01794,  2.16459,  2.59282,  2.68361,
+  1.35753,  1.55376,  2.02314,  2.21231,  2.42046,  2.55826,
+  1.30172,  1.46582,  2.05293,  2.21596,  2.42069,  2.54852,
+  1.33933,  1.59705,  2.03516,  2.14582,  2.5096,  2.64414,
+  1.34609,  1.63387,  2.00692,  2.11472,  2.57003,  2.68888,
+  1.35844,  1.50167,  1.94958,  2.02763,  2.47964,  2.63746,
+  1.42799,  1.53369,  1.85363,  1.96081,  2.43754,  2.58846,
+  1.507,  1.58581,  1.86464,  1.95027,  2.47877,  2.62455,
+  1.53515,  1.61948,  1.7846,  1.92633,  2.53715,  2.6658,
+  1.49966,  1.57482,  1.68583,  1.82255,  2.53399,  2.70531,
+  1.58548,  1.64242,  1.72185,  1.84674,  2.52449,  2.71035,
+  1.16736,  1.62721,  1.76839,  1.85304,  2.26556,  2.54052,
+  1.11032,  1.50695,  1.80563,  1.88181,  2.36127,  2.58996,
+  1.06643,  1.53942,  1.7463,  1.93612,  2.12799,  2.46118,
+  1.111,  1.56535,  1.85208,  1.96046,  2.21492,  2.4979,
+  1.11612,  1.59069,  1.87918,  1.96908,  2.32329,  2.53297,
+  1.1484,  1.55745,  1.81996,  1.96379,  2.38034,  2.48453,
+  1.09256,  1.56982,  1.784,  1.95924,  2.32426,  2.46849,
+  1.213,  1.57893,  1.75164,  1.90157,  2.27177,  2.38609,
+  1.12398,  1.62627,  1.75806,  1.98376,  2.29113,  2.408,
+  1.07579,  1.53483,  1.78478,  2.04194,  2.2367,  2.36811,
+  1.11878,  1.41569,  1.97193,  2.12276,  2.33025,  2.44046,
+  1.01609,  1.33452,  1.8992,  2.12157,  2.42514,  2.54387,
+  1.0662,  1.28942,  1.94816,  2.08195,  2.47149,  2.59382,
+  1.06499,  1.25576,  1.93597,  2.03695,  2.49318,  2.61275,
+  1.04967,  1.22845,  1.82953,  2.02506,  2.43107,  2.67084,
+  1.01963,  1.31358,  1.88031,  1.95395,  2.49169,  2.64266,
+  1.15348,  1.5519,  1.90975,  2.13353,  2.54007,  2.62647,
+  1.29303,  1.60048,  2.03569,  2.16688,  2.57297,  2.65826,
+  1.40931,  1.62414,  1.99362,  2.26849,  2.52706,  2.65186,
+  1.4264,  1.68151,  2.03941,  2.21528,  2.55906,  2.6814,
+  1.42204,  1.75264,  2.02799,  2.23143,  2.54648,  2.63124,
+  1.40307,  1.73555,  2.00708,  2.20211,  2.63554,  2.71835,
+  1.36412,  1.68736,  2.01193,  2.29363,  2.6407,  2.70526,
+  1.32806,  1.60827,  1.98985,  2.36496,  2.59056,  2.68945,
+  1.33359,  1.64487,  2.1305,  2.30858,  2.64414,  2.73281,
+  1.40524,  1.66596,  2.12336,  2.31586,  2.65694,  2.73287,
+  1.43537,  1.67954,  2.0191,  2.2544,  2.59608,  2.67406,
+  1.04103,  1.47652,  1.92332,  2.29056,  2.59234,  2.67362,
+  0.818396,  1.18975,  2.05137,  2.23338,  2.4171,  2.62257,
+  0.745703,  1.24025,  2.13926,  2.22418,  2.47642,  2.55879,
+  0.786217,  1.29674,  2.00436,  2.24582,  2.54872,  2.6314,
+  0.781573,  1.12234,  1.87575,  2.27728,  2.45942,  2.55721,
+  0.697586,  1.32715,  2.09799,  2.17356,  2.57467,  2.6936,
+  0.773107,  1.39301,  1.97117,  2.27022,  2.5915,  2.65154,
+  0.799951,  1.25267,  1.92838,  2.21123,  2.57772,  2.68382,
+  0.737528,  1.23791,  1.82716,  2.11053,  2.4763,  2.62767,
+  0.896067,  1.42136,  1.84116,  2.10482,  2.43287,  2.58572,
+  0.920446,  1.41858,  1.94342,  2.2527,  2.49124,  2.62311,
+  0.905094,  1.28473,  1.84369,  2.26911,  2.47954,  2.59591,
+  1.04955,  1.4475,  1.84117,  2.16036,  2.57575,  2.6557,
+  1.2828,  1.44542,  1.90123,  2.29017,  2.58164,  2.67873,
+  1.17471,  1.51702,  1.86793,  2.17662,  2.54748,  2.64015,
+  1.24126,  1.5185,  1.93677,  2.20877,  2.52132,  2.61983,
+  1.32193,  1.5402,  1.99853,  2.20577,  2.60566,  2.70791,
+  1.3038,  1.62293,  1.88039,  2.18949,  2.58891,  2.66997,
+  1.36083,  1.65855,  1.90332,  2.17801,  2.55428,  2.63477,
+  1.38546,  1.62331,  1.9591,  2.25774,  2.60539,  2.69462,
+  1.46795,  1.62817,  2.0031,  2.34892,  2.5961,  2.67456,
+  1.41184,  1.69139,  1.94701,  2.25922,  2.52614,  2.61511,
+  1.41526,  1.69746,  2.0031,  2.28429,  2.52624,  2.64336,
+  1.36534,  1.61019,  2.0221,  2.1717,  2.5576,  2.64224,
+  1.34395,  1.63077,  2.04084,  2.26171,  2.47792,  2.64736,
+  1.33358,  1.63038,  2.0312,  2.21087,  2.50406,  2.62333,
+  1.34412,  1.70468,  2.06581,  2.19257,  2.54136,  2.65852,
+  1.43988,  1.66659,  2.08273,  2.20601,  2.63634,  2.69917,
+  1.34435,  1.65594,  2.02685,  2.22783,  2.56587,  2.66126,
+  1.29968,  1.58529,  1.96155,  2.23114,  2.59956,  2.6776,
+  1.18443,  1.44165,  1.88854,  2.25541,  2.55466,  2.62551,
+  1.44657,  1.79255,  2.02266,  2.17921,  2.49716,  2.59111,
+  1.46468,  1.80928,  2.06019,  2.20545,  2.54596,  2.64191,
+  1.48129,  1.72952,  2.02569,  2.25001,  2.53746,  2.66775,
+  1.47646,  1.65779,  2.00806,  2.2492,  2.50322,  2.61312,
+  1.38626,  1.58955,  2.0317,  2.2183,  2.50921,  2.6191,
+  1.38626,  1.66286,  2.05258,  2.20868,  2.48839,  2.62305,
+  1.43812,  1.64607,  1.96782,  2.21244,  2.50872,  2.6294,
+  1.4376,  1.59023,  2.08908,  2.18445,  2.56655,  2.67785,
+  1.36702,  1.65253,  2.08437,  2.16949,  2.4836,  2.65574,
+  1.40378,  1.70134,  2.0628,  2.14854,  2.44319,  2.65725,
+  1.39919,  1.70605,  2.06243,  2.14458,  2.53122,  2.63501,
+  1.40966,  1.75057,  2.00507,  2.08724,  2.60283,  2.69407,
+  1.43015,  1.7604,  2.0488,  2.11806,  2.56938,  2.65727,
+  1.41885,  1.85893,  2.01867,  2.14141,  2.59787,  2.67114,
+  1.51504,  1.81561,  1.94217,  2.08906,  2.55465,  2.6346,
+  1.42003,  1.74012,  1.95375,  2.19613,  2.50269,  2.63975,
+  1.3841,  1.72331,  1.90117,  2.1602,  2.42662,  2.52258,
+  1.34105,  1.73737,  1.89475,  2.11087,  2.40751,  2.50284,
+  1.37576,  1.55398,  1.78427,  1.98142,  2.50412,  2.57153,
+  1.41459,  1.52055,  1.71537,  2.01302,  2.5112,  2.60864,
+  1.38497,  1.51911,  1.69669,  1.93938,  2.5757,  2.64475,
+  1.37786,  1.61168,  1.75124,  2.04456,  2.4936,  2.56797,
+  1.36085,  1.55368,  1.69398,  2.03611,  2.53589,  2.58847,
+  1.39163,  1.48933,  1.63148,  1.85308,  2.52955,  2.63182,
+  1.36408,  1.47605,  1.62904,  1.94902,  2.52574,  2.58792,
+  1.2439,  1.39859,  1.53969,  2.06632,  2.52865,  2.59222,
+  1.25551,  1.42936,  1.54884,  1.95098,  2.51998,  2.57485,
+  1.21333,  1.3888,  1.50598,  1.88664,  2.48612,  2.54536,
+  1.1258,  1.2869,  1.53495,  1.98205,  2.49021,  2.57068,
+  1.13252,  1.2962,  1.46083,  1.92525,  2.35567,  2.44404,
+  1.14673,  1.36534,  1.49607,  2.02061,  2.44833,  2.51065,
+  1.19278,  1.37894,  1.49116,  1.95926,  2.45914,  2.51972,
+  1.27161,  1.38388,  1.52586,  1.95321,  2.47314,  2.52627,
+  1.19995,  1.36609,  1.51973,  1.92677,  2.56299,  2.62374,
+  1.23602,  1.38351,  1.51039,  1.7933,  2.58549,  2.67708,
+  1.27722,  1.41656,  1.53945,  1.92379,  2.59908,  2.66772,
+  1.19596,  1.40806,  1.56871,  2.09079,  2.62218,  2.6689,
+  1.17444,  1.3008,  1.70657,  2.07033,  2.33283,  2.491,
+  1.12025,  1.25279,  1.5621,  2.05712,  2.35786,  2.4881,
+  1.17632,  1.29197,  1.76026,  2.09335,  2.39555,  2.59153,
+  1.19772,  1.41553,  1.80193,  2.03318,  2.45962,  2.59256,
+  1.17046,  1.49125,  1.88804,  2.08248,  2.39229,  2.52815,
+  1.08351,  1.49178,  1.94946,  2.0462,  2.42247,  2.59161,
+  1.05994,  1.41798,  1.95482,  2.07325,  2.48096,  2.59912,
+  0.939633,  1.34851,  2.00568,  2.09423,  2.47405,  2.58029,
+  0.849679,  1.29353,  1.99812,  2.10527,  2.4101,  2.61591,
+  0.886534,  1.43235,  1.99045,  2.0898,  2.37908,  2.5395,
+  0.973462,  1.47362,  1.94439,  2.05184,  2.3931,  2.46861,
+  1.04199,  1.57643,  1.95273,  2.06254,  2.32632,  2.43777,
+  1.0487,  1.54395,  1.79902,  2.01526,  2.41591,  2.48738,
+  1.06075,  1.46328,  1.792,  1.94049,  2.41744,  2.51762,
+  1.08688,  1.35051,  1.71544,  1.80448,  2.48199,  2.57724,
+  1.23776,  1.48723,  1.7249,  1.80832,  2.52853,  2.61455,
+  1.39846,  1.49959,  1.70594,  1.81787,  2.53742,  2.61115,
+  1.46184,  1.54928,  1.71949,  1.83518,  2.48005,  2.65662,
+  1.41193,  1.59484,  1.72262,  1.84021,  2.5366,  2.61871,
+  1.52708,  1.60947,  1.70484,  1.83282,  2.51277,  2.60508,
+  1.5493,  1.64971,  1.74718,  1.83885,  2.59328,  2.68152,
+  1.40865,  1.62213,  1.79776,  1.95077,  2.23897,  2.46394,
+  1.46356,  1.64796,  1.79073,  1.92141,  2.34804,  2.57262,
+  1.53189,  1.70037,  1.83404,  2.0056,  2.41348,  2.57054,
+  1.5952,  1.68156,  1.85702,  2.02018,  2.47538,  2.62026,
+  1.57838,  1.65186,  1.91226,  2.01199,  2.5125,  2.62561,
+  1.55111,  1.64436,  1.93621,  2.04161,  2.52732,  2.61724,
+  1.53197,  1.62315,  1.9276,  2.00745,  2.52804,  2.63456,
+  1.49246,  1.57949,  1.90868,  1.99823,  2.49061,  2.58309,
+  1.44543,  1.54876,  1.9137,  2.0028,  2.51924,  2.61095,
+  1.39728,  1.48225,  1.89122,  1.98384,  2.47449,  2.60778,
+  1.3583,  1.56294,  1.90205,  2.00361,  2.42564,  2.58541,
+  1.31335,  1.51889,  1.92307,  2.01194,  2.49694,  2.5837,
+  1.32168,  1.50683,  1.90306,  1.99006,  2.51061,  2.61974,
+  1.27289,  1.51344,  1.8979,  2.03966,  2.53652,  2.60414,
+  1.25574,  1.43115,  1.89662,  1.96089,  2.52675,  2.62424,
+  1.25356,  1.39283,  1.89379,  1.97508,  2.52068,  2.59667,
+  1.21234,  1.37522,  1.86031,  1.96496,  2.53119,  2.59867,
+  1.17744,  1.32419,  1.80663,  1.88529,  2.48732,  2.59546,
+  1.185,  1.38308,  1.78322,  1.86347,  2.46657,  2.57065,
+  1.16227,  1.44473,  1.79788,  1.96024,  2.51584,  2.59443,
+  1.29313,  1.61263,  1.91287,  2.11307,  2.4672,  2.59265,
+  1.3544,  1.69802,  1.96011,  2.14947,  2.53298,  2.65269,
+  1.41207,  1.72912,  2.03409,  2.17295,  2.53881,  2.64369,
+  1.39179,  1.80176,  1.94479,  2.19455,  2.4673,  2.54771,
+  1.47608,  1.74319,  1.98255,  2.14116,  2.55905,  2.64289,
+  1.42368,  1.8572,  1.99841,  2.14699,  2.4995,  2.58386,
+  1.42068,  1.87817,  2.01232,  2.29828,  2.57827,  2.66549,
+  1.45566,  1.91054,  2.06984,  2.39305,  2.59349,  2.67981,
+  1.52558,  1.92571,  2.18647,  2.40072,  2.66013,  2.74311,
+  1.37615,  1.63344,  1.9343,  2.25049,  2.49406,  2.61897,
+  1.3545,  1.56095,  1.93126,  2.20732,  2.5007,  2.61105,
+  1.30807,  1.56951,  1.96724,  2.24546,  2.46112,  2.59551,
+  1.34701,  1.65498,  1.98091,  2.25189,  2.51009,  2.63498,
+  1.47801,  1.58844,  2.0382,  2.22414,  2.49937,  2.64663,
+  1.45153,  1.63029,  2.1141,  2.24973,  2.4165,  2.6518,
+  1.41214,  1.65583,  2.12835,  2.22464,  2.52506,  2.68174,
+  1.3745,  1.84889,  2.14083,  2.2919,  2.60283,  2.691,
+  1.37857,  1.74485,  2.10667,  2.20122,  2.62683,  2.712,
+  1.08274,  1.60312,  2.07077,  2.12957,  2.50429,  2.65755,
+  1.01329,  1.46791,  1.96003,  2.09179,  2.36205,  2.56155,
+  0.9941,  1.32807,  1.7917,  1.90255,  2.41063,  2.50132,
+  0.999159,  1.32525,  1.72231,  1.87138,  2.28118,  2.50209,
+  1.03528,  1.33808,  1.65302,  1.75976,  2.44146,  2.54067,
+  1.07713,  1.29359,  1.56567,  1.7118,  2.33034,  2.43626,
+  1.05812,  1.24303,  1.48833,  1.62368,  2.33012,  2.42954,
+  1.15066,  1.2962,  1.57472,  1.70184,  2.39048,  2.50735,
+  1.16792,  1.38204,  1.57381,  1.7953,  2.44065,  2.49036,
+  1.22137,  1.40507,  1.53578,  1.72864,  2.41229,  2.51938,
+  1.24827,  1.38398,  1.57228,  1.82686,  2.42535,  2.49422,
+  1.27415,  1.38627,  1.55782,  1.73411,  2.37831,  2.47797,
+  1.34389,  1.45603,  1.66853,  1.8156,  2.24874,  2.4197,
+  1.35602,  1.5593,  1.73128,  1.85333,  2.34397,  2.51476,
+  1.43321,  1.57591,  1.67319,  1.78146,  2.2928,  2.49126,
+  1.35471,  1.6376,  1.87537,  2.16287,  2.40849,  2.56638,
+  1.46466,  1.59144,  2.07122,  2.23546,  2.39889,  2.56349,
+  1.42481,  1.62265,  2.02033,  2.16131,  2.32826,  2.46819,
+  1.36427,  1.51615,  2.01176,  2.10961,  2.3957,  2.55472,
+  1.34268,  1.46052,  2.0389,  2.12298,  2.50665,  2.64345,
+  1.33831,  1.51988,  2.03004,  2.10015,  2.53334,  2.67477,
+  1.32113,  1.54557,  1.97723,  2.12227,  2.55759,  2.68022,
+  1.31509,  1.46711,  1.97243,  2.06854,  2.52684,  2.64563,
+  1.30446,  1.40069,  1.95455,  2.05314,  2.5625,  2.68589,
+  1.26718,  1.37666,  1.88806,  2.02989,  2.54542,  2.66931,
+  1.22501,  1.33934,  1.88732,  1.96524,  2.54351,  2.67229,
+  1.22621,  1.40353,  1.79766,  1.95969,  2.54099,  2.62735,
+  1.34703,  1.60794,  1.96677,  2.18451,  2.47788,  2.60882,
+  1.3321,  1.75596,  1.94842,  2.17671,  2.51339,  2.60137,
+  1.34929,  1.7814,  1.92279,  2.10923,  2.46288,  2.55986,
+  1.36238,  1.69359,  1.88434,  2.08805,  2.52247,  2.61397,
+  1.32029,  1.5103,  1.85775,  2.06543,  2.49473,  2.60556,
+  1.28299,  1.45974,  1.74491,  1.96142,  2.43994,  2.62375,
+  1.25136,  1.38192,  1.67354,  1.7727,  2.32354,  2.66159,
+  1.20426,  1.43515,  1.65423,  1.7378,  2.30506,  2.58156,
+  1.18196,  1.46528,  1.67003,  1.8613,  2.44412,  2.54613,
+  1.34712,  1.62826,  1.93134,  2.12343,  2.46685,  2.59892,
+  1.17048,  1.28493,  1.55274,  1.83255,  2.29979,  2.51981,
+  1.19004,  1.28402,  1.64609,  1.96917,  2.49692,  2.62045,
+  1.25541,  1.38147,  1.78173,  2.09499,  2.43136,  2.59352,
+  1.23188,  1.33417,  1.79625,  2.04,  2.38708,  2.55466,
+  1.18052,  1.30857,  1.81824,  1.97632,  2.2935,  2.4518,
+  1.10256,  1.26632,  1.84425,  1.96176,  2.32484,  2.51408,
+  1.00464,  1.14487,  1.83502,  1.9971,  2.18238,  2.52208,
+  0.956994,  1.21291,  1.94092,  2.06045,  2.31223,  2.44167,
+  0.795434,  1.44428,  1.93242,  2.04716,  2.36568,  2.45052,
+  0.942462,  1.60604,  2.02512,  2.11974,  2.29995,  2.43181,
+  0.812186,  1.46939,  2.07832,  2.17302,  2.39197,  2.47405,
+  0.831008,  1.62061,  2.09294,  2.16773,  2.33486,  2.41672,
+  0.917049,  1.801,  2.12123,  2.19938,  2.34728,  2.44052,
+  0.857286,  1.67915,  2.11243,  2.20307,  2.44474,  2.52921,
+  0.809582,  1.54255,  2.18237,  2.23944,  2.46198,  2.54337,
+  0.912283,  1.7792,  2.16632,  2.25109,  2.46168,  2.57688,
+  0.774827,  1.7702,  2.1792,  2.23961,  2.48732,  2.56023,
+  1.22299,  1.57457,  2.08108,  2.22359,  2.50152,  2.6613,
+  1.39422,  1.69632,  2.03665,  2.27333,  2.5704,  2.68413,
+  1.37077,  1.69891,  2.08266,  2.24567,  2.59879,  2.69545,
+  1.37241,  1.64717,  2.14237,  2.27291,  2.60809,  2.68656,
+  1.34279,  1.69454,  2.12328,  2.25676,  2.57528,  2.69095,
+  1.38055,  1.75068,  2.1234,  2.19974,  2.48804,  2.61024,
+  1.39506,  1.88332,  2.0887,  2.18949,  2.45826,  2.54814,
+  1.41315,  1.87284,  2.02083,  2.16196,  2.39617,  2.48701,
+  1.4031,  1.76424,  1.91125,  2.05585,  2.39101,  2.4846,
+  1.25059,  1.60685,  1.83481,  1.91441,  2.34409,  2.54946,
+  1.17101,  1.40644,  1.69912,  1.8581,  2.35407,  2.47105,
+  1.13269,  1.25187,  1.52135,  1.63829,  2.35528,  2.47061,
+  1.01168,  1.2879,  1.45026,  1.66382,  2.28546,  2.37145,
+  1.03024,  1.20842,  1.36667,  1.55035,  2.33752,  2.4214,
+  0.964915,  1.17119,  1.28816,  1.58842,  2.32729,  2.3883,
+  0.953674,  1.10289,  1.26375,  1.83559,  2.31685,  2.42482,
+  0.886544,  1.07464,  1.24224,  1.96444,  2.29681,  2.41295,
+  0.853009,  1.07708,  1.18453,  1.75232,  2.28304,  2.38922,
+  0.840278,  1.03322,  1.15255,  1.52095,  2.33398,  2.45453,
+  0.91077,  1.08387,  1.22354,  1.66808,  2.34624,  2.51185,
+  0.967915,  1.12182,  1.22026,  1.80659,  2.42113,  2.49818,
+  0.992265,  1.16907,  1.26005,  1.67999,  2.39894,  2.45914,
+  1.06528,  1.23096,  1.32238,  1.75348,  2.3144,  2.41593,
+  1.08131,  1.27178,  1.45801,  1.7294,  2.3323,  2.40512,
+  1.01781,  1.34909,  1.51584,  1.72189,  2.29296,  2.39899,
+  1.09765,  1.33294,  1.57003,  1.77646,  2.37727,  2.46589,
+  1.14764,  1.3025,  1.64016,  1.79704,  2.36388,  2.4748,
+  1.12717,  1.32201,  1.68488,  1.79646,  2.40705,  2.57866,
+  1.15953,  1.26665,  1.70955,  1.83058,  2.43816,  2.57242,
+  1.1371,  1.33151,  1.7494,  1.846,  2.41439,  2.51149,
+  1.12127,  1.3511,  1.72822,  1.84666,  2.44921,  2.56416,
+  1.11868,  1.26154,  1.79446,  1.88577,  2.42901,  2.55277,
+  1.07699,  1.21216,  1.72764,  1.86126,  2.43299,  2.56404,
+  1.08209,  1.2617,  1.76092,  1.85803,  2.31585,  2.57359,
+  1.08635,  1.27906,  1.76312,  1.86419,  2.38079,  2.4853,
+  0.988401,  1.26239,  1.7379,  1.83671,  2.37578,  2.49239,
+  1.07471,  1.1962,  1.67728,  1.80631,  2.3414,  2.56064,
+  1.06786,  1.26529,  1.68935,  1.80299,  2.40195,  2.52406,
+  1.01048,  1.28954,  1.65272,  1.77873,  2.3623,  2.46655,
+  0.97757,  1.26131,  1.57627,  1.74133,  2.29762,  2.40409,
+  1.09718,  1.46442,  1.60666,  1.71761,  2.33071,  2.41207,
+  1.38384,  1.65227,  1.8982,  2.09661,  2.47672,  2.57418,
+  1.27973,  1.70061,  1.89499,  2.02987,  2.46839,  2.58449,
+  1.23667,  1.68331,  1.79106,  1.95337,  2.5331,  2.58708,
+  1.18505,  1.59913,  1.8539,  1.94492,  2.49995,  2.5729,
+  1.16357,  1.30732,  1.87244,  1.95399,  2.54467,  2.62323,
+  1.19097,  1.44925,  1.86329,  1.93767,  2.52527,  2.59997,
+  1.11855,  1.51311,  1.85667,  1.96882,  2.49739,  2.57553,
+  1.15652,  1.63093,  1.84545,  2.05111,  2.44317,  2.53405,
+  1.41004,  1.54198,  2.13551,  2.23561,  2.57541,  2.68055,
+  1.39279,  1.72067,  2.03495,  2.19246,  2.48715,  2.6534,
+  1.58125,  1.83784,  2.10976,  2.18748,  2.4979,  2.66009,
+  1.66308,  1.9013,  2.15166,  2.24829,  2.53479,  2.63979,
+  1.62316,  1.84307,  2.17777,  2.25531,  2.5436,  2.68119,
+  1.53971,  1.84607,  2.11908,  2.31502,  2.60542,  2.69501,
+  1.53269,  1.80536,  2.16618,  2.27652,  2.58208,  2.69532,
+  1.5172,  1.86473,  2.11184,  2.24103,  2.6024,  2.67859,
+  1.481,  1.87977,  2.1834,  2.2585,  2.62458,  2.71471,
+  1.48006,  1.94783,  2.12659,  2.23931,  2.6027,  2.68976,
+  1.61575,  2.02568,  2.18841,  2.29147,  2.6737,  2.72328,
+  1.54669,  2.02367,  2.13758,  2.23388,  2.56357,  2.62736,
+  1.51727,  1.90243,  2.13241,  2.18928,  2.54838,  2.64335,
+  1.49876,  1.60236,  2.15993,  2.27567,  2.54058,  2.68296,
+  1.57357,  1.6552,  2.07174,  2.2146,  2.52345,  2.64214,
+  1.60199,  1.68036,  2.13015,  2.24731,  2.56771,  2.67057,
+  1.63293,  1.73367,  2.1347,  2.25513,  2.55999,  2.68208,
+  1.70743,  1.75206,  2.1397,  2.25206,  2.56764,  2.64791,
+  1.68079,  1.81258,  2.18923,  2.2873,  2.57824,  2.64474,
+  1.74613,  1.77855,  2.11951,  2.28339,  2.59638,  2.68683,
+  1.68024,  1.77494,  2.09785,  2.21399,  2.55851,  2.65628,
+  1.69816,  1.77769,  2.09692,  2.21101,  2.51242,  2.62563,
+  1.75722,  1.8282,  2.09218,  2.21863,  2.4599,  2.65391,
+  1.7683,  1.81576,  2.0446,  2.1744,  2.4698,  2.67439,
+  1.74091,  1.83001,  2.0445,  2.16843,  2.4425,  2.58767,
+  1.72899,  1.80159,  2.0369,  2.13569,  2.483,  2.64735,
+  1.7402,  1.78035,  2.03984,  2.11648,  2.46008,  2.66641,
+  1.67917,  1.81059,  1.9762,  2.08515,  2.33097,  2.5747,
+  1.67538,  1.74168,  1.98661,  2.08699,  2.44484,  2.64839,
+  1.60537,  1.68464,  1.97715,  2.08431,  2.40138,  2.62667,
+  1.59359,  1.66701,  1.99308,  2.09579,  2.47706,  2.66052,
+  1.49544,  1.67749,  1.91544,  2.10752,  2.5041,  2.68752,
+  1.37119,  1.58101,  1.81209,  2.15997,  2.54081,  2.65451,
+  1.3089,  1.65276,  1.8777,  2.10022,  2.49836,  2.63527,
+  1.25755,  1.70119,  1.90866,  2.06398,  2.33088,  2.58848,
+  1.26064,  1.73383,  1.90131,  2.04602,  2.23042,  2.37971,
+  1.19202,  1.69544,  1.86633,  1.96986,  2.13128,  2.36781,
+  1.3313,  1.72762,  1.87569,  1.96723,  2.11549,  2.46165,
+  1.22185,  1.64479,  1.86107,  1.95729,  2.26379,  2.50923,
+  1.29701,  1.68481,  1.82511,  1.98127,  2.3887,  2.49794,
+  1.29299,  1.62169,  1.7955,  1.89158,  2.43094,  2.59724,
+  1.29334,  1.41244,  1.67843,  2.01344,  2.40627,  2.57529,
+  1.35525,  1.47052,  1.74829,  2.04483,  2.41107,  2.59082,
+  1.35208,  1.47438,  1.81195,  2.02853,  2.44538,  2.59798,
+  1.38043,  1.47298,  1.83619,  1.95777,  2.39037,  2.57117,
+  1.41757,  1.51497,  1.83999,  1.97461,  2.38249,  2.51071,
+  1.39633,  1.51162,  1.74391,  2.00952,  2.41409,  2.5335,
+  1.356,  1.5112,  1.77504,  1.97354,  2.4454,  2.56885,
+  1.35748,  1.53331,  1.82063,  1.99833,  2.39546,  2.5737,
+  1.24454,  1.44655,  1.72685,  1.93599,  2.42899,  2.55595,
+  1.20656,  1.36587,  1.51002,  1.80904,  2.46485,  2.52024,
+  1.20471,  1.34027,  1.47715,  1.7318,  2.46108,  2.52582,
+  1.15214,  1.29476,  1.42987,  1.66978,  2.43609,  2.50483,
+  1.12233,  1.28467,  1.44544,  1.8119,  2.44447,  2.53569,
+  1.1671,  1.312,  1.43068,  1.93122,  2.57918,  2.62637,
+  1.14096,  1.25556,  1.41692,  1.91311,  2.46264,  2.55265,
+  1.17538,  1.32509,  1.43414,  1.82628,  2.53411,  2.59969,
+  1.15295,  1.31134,  1.42875,  1.73328,  2.49916,  2.55542,
+  1.20894,  1.31815,  1.45086,  1.63113,  2.48479,  2.56076,
+  1.21498,  1.3123,  1.49697,  1.60268,  2.44106,  2.51374,
+  1.1549,  1.27435,  1.49783,  1.61108,  2.49397,  2.62846,
+  1.22174,  1.32448,  1.52936,  1.6685,  2.49634,  2.57245,
+  1.26548,  1.36044,  1.57445,  1.69829,  2.46587,  2.52945,
+  1.29997,  1.41147,  1.63433,  1.79017,  2.46419,  2.54621,
+  1.29682,  1.4613,  1.67405,  1.8673,  2.47283,  2.54653,
+  1.31923,  1.49303,  1.70292,  1.86718,  2.41758,  2.50385,
+  1.3077,  1.51173,  1.79546,  1.9887,  2.41583,  2.50206,
+  1.34144,  1.56729,  1.84964,  2.05441,  2.36855,  2.48494,
+  1.34609,  1.70986,  1.84782,  2.08987,  2.32039,  2.42693,
+  1.35121,  1.5824,  1.85395,  2.08778,  2.26974,  2.40613,
+  1.40341,  1.68126,  1.93063,  2.06474,  2.3176,  2.44551,
+  1.30356,  1.80043,  1.94655,  2.06478,  2.3479,  2.57565,
+  1.40197,  1.79512,  2.04385,  2.14916,  2.33742,  2.47542,
+  1.48635,  1.89691,  2.03368,  2.16458,  2.42721,  2.51671,
+  1.58122,  1.92036,  2.03292,  2.18664,  2.45883,  2.53417,
+  1.62367,  1.94922,  2.05695,  2.22087,  2.54473,  2.61274,
+  1.72008,  1.91633,  2.06966,  2.31006,  2.50308,  2.59265,
+  1.65207,  1.9939,  2.12217,  2.28232,  2.53373,  2.60413,
+  1.69638,  1.99027,  2.08866,  2.3179,  2.56235,  2.6308,
+  1.68861,  1.97655,  2.0855,  2.35442,  2.4834,  2.56768,
+  1.79189,  1.95662,  2.08476,  2.34413,  2.47321,  2.57802,
+  1.77015,  1.95597,  2.07514,  2.2631,  2.50858,  2.59481,
+  1.68817,  1.95839,  2.09717,  2.23713,  2.44313,  2.55839,
+  1.61409,  1.85811,  1.99613,  2.15125,  2.32732,  2.48534,
+  1.51766,  1.72978,  1.97539,  2.11873,  2.39083,  2.52342,
+  1.57639,  1.76492,  1.93735,  2.15944,  2.35454,  2.47655,
+  1.59652,  1.79672,  1.93068,  2.17377,  2.41526,  2.51519,
+  1.59827,  1.75891,  1.94152,  2.24294,  2.46192,  2.54838,
+  1.56459,  1.66781,  1.91021,  2.20751,  2.43297,  2.56229,
+  1.50226,  1.59876,  1.70104,  1.99352,  2.43166,  2.56861,
+  1.26117,  1.37926,  1.66944,  1.86426,  2.42439,  2.56028,
+  1.18314,  1.29168,  1.49624,  1.77509,  2.41535,  2.57185,
+  1.17686,  1.28064,  1.39729,  1.55628,  2.48261,  2.55691,
+  1.15141,  1.26909,  1.40261,  1.52942,  2.5473,  2.66072,
+  1.13835,  1.27009,  1.3867,  1.65651,  2.51668,  2.57083,
+  1.16764,  1.28839,  1.3794,  1.81595,  2.48874,  2.54402,
+  1.19113,  1.31858,  1.43306,  1.89873,  2.44099,  2.50552,
+  1.23155,  1.33971,  1.50583,  1.86546,  2.40192,  2.56755,
+  1.249,  1.34254,  1.52652,  1.64463,  2.26006,  2.52811,
+  1.29212,  1.38504,  1.56729,  1.92802,  2.3436,  2.52673,
+  1.55306,  1.7312,  1.87558,  2.03762,  2.18958,  2.43362,
+  1.55633,  1.80735,  2.00987,  2.13476,  2.39511,  2.51776,
+  1.7008,  1.863,  2.01606,  2.21287,  2.46583,  2.57661,
+  1.74452,  1.8923,  2.04288,  2.2037,  2.39302,  2.52939,
+  1.61468,  1.86704,  2.02413,  2.17237,  2.40215,  2.56787,
+  1.66255,  1.92647,  2.01622,  2.15368,  2.54468,  2.63661,
+  1.60774,  1.84063,  2.03651,  2.14887,  2.47573,  2.62342,
+  1.5426,  1.78941,  1.98821,  2.1337,  2.50007,  2.62384,
+  1.52049,  1.85402,  1.96628,  2.10023,  2.4655,  2.59099,
+  1.4291,  1.7262,  1.95857,  2.06874,  2.39713,  2.57827,
+  1.23096,  1.48391,  1.90942,  2.03717,  2.27816,  2.44268,
+  1.16547,  1.40247,  1.87767,  1.98503,  2.337,  2.4823,
+  1.06065,  1.34179,  1.89159,  1.9978,  2.34225,  2.47385,
+  1.04598,  1.26441,  1.89288,  2.02811,  2.26571,  2.41834,
+  0.872467,  1.31861,  1.94129,  2.05489,  2.26598,  2.523,
+  0.878165,  1.20878,  1.86352,  2.07417,  2.31989,  2.4605,
+  0.87138,  1.05093,  1.86631,  2.04429,  2.18427,  2.46922,
+  0.814866,  1.20623,  1.93624,  2.04636,  2.24399,  2.39101,
+  0.791495,  1.1548,  1.95086,  2.06223,  2.27019,  2.49712,
+  0.734873,  1.1175,  2.01389,  2.14635,  2.25208,  2.34022,
+  0.717596,  1.11331,  2.14512,  2.21429,  2.35066,  2.43709,
+  0.747897,  1.18189,  1.98264,  2.07339,  2.39106,  2.46122,
+  0.81421,  1.5937,  1.93081,  2.05189,  2.27992,  2.45097,
+  1.008,  1.63525,  1.8487,  1.99829,  2.26496,  2.39937,
+  1.05813,  1.54826,  1.72511,  1.88587,  2.17415,  2.38675,
+  1.06533,  1.44683,  1.76311,  2.06116,  2.39393,  2.53335,
+  1.24544,  1.51311,  1.69987,  1.88597,  2.16373,  2.41256,
+  1.40222,  1.55017,  1.6791,  2.10448,  2.31427,  2.46462,
+  1.43969,  1.56554,  1.74616,  2.17576,  2.35318,  2.44597,
+  1.28279,  1.46757,  1.68979,  2.05702,  2.29957,  2.50654,
+  1.15751,  1.36008,  1.53152,  1.93168,  2.27783,  2.38736,
+  1.12772,  1.28719,  1.42109,  1.84436,  2.28107,  2.38522,
+  1.17251,  1.31751,  1.49783,  1.76833,  2.3271,  2.4534,
+  1.21562,  1.35145,  1.55462,  1.70686,  2.28027,  2.41032,
+  1.16271,  1.31851,  1.56882,  1.75711,  2.22556,  2.32124,
+  1.22115,  1.36407,  1.7282,  1.86724,  2.14964,  2.32343,
+  1.27453,  1.45588,  1.65181,  1.92988,  2.11952,  2.24537,
+  1.32483,  1.46666,  1.83773,  1.98275,  2.16784,  2.29489,
+  1.20741,  1.46374,  1.90723,  2.01094,  2.18761,  2.31538,
+  1.1975,  1.32537,  1.90394,  2.10426,  2.26437,  2.40602,
+  0.964658,  1.42133,  1.80059,  2.07554,  2.24967,  2.39142,
+  0.900184,  1.41949,  1.86053,  2.05217,  2.20467,  2.41473,
+  0.976462,  1.44499,  1.83716,  1.99709,  2.13357,  2.30319,
+  0.943062,  1.5438,  1.91463,  1.99313,  2.18465,  2.34418,
+  0.89678,  1.42697,  1.92355,  2.03999,  2.25792,  2.50452,
+  0.957615,  1.55318,  1.86268,  2.04465,  2.19266,  2.48417,
+  1.02438,  1.62687,  1.89128,  2.04179,  2.30477,  2.61313,
+  1.2607,  1.57098,  1.79692,  1.93891,  2.45798,  2.54369,
+  1.43387,  1.67689,  2.02035,  2.24929,  2.48843,  2.61923,
+  1.42779,  1.60531,  1.99984,  2.19762,  2.47258,  2.62826,
+  1.34494,  1.54775,  2.01991,  2.15346,  2.48252,  2.6649,
+  1.39455,  1.83086,  2.07575,  2.1467,  2.52985,  2.66294,
+  1.39353,  1.57998,  2.00527,  2.06832,  2.59583,  2.67795,
+  1.37167,  1.50166,  2.01236,  2.06929,  2.60572,  2.70121,
+  1.36597,  1.44376,  1.8937,  2.06336,  2.54086,  2.63575,
+  1.39281,  1.47093,  1.92042,  1.98528,  2.61205,  2.67063,
+  1.39358,  1.50234,  1.92649,  2.01951,  2.57154,  2.6457,
+  1.33144,  1.47006,  1.84434,  1.94554,  2.52733,  2.62083,
+  1.28039,  1.38,  1.82279,  1.92768,  2.47072,  2.61404,
+  1.23045,  1.39485,  1.77224,  1.9107,  2.49488,  2.56917,
+  1.10377,  1.421,  1.74216,  1.90103,  2.45853,  2.54496,
+  1.07083,  1.43846,  1.75479,  1.82779,  2.32372,  2.48412,
+  1.02392,  1.52234,  1.71372,  1.83474,  2.2896,  2.49685,
+  1.12384,  1.53995,  1.76628,  1.86662,  2.34998,  2.44122,
+  1.04667,  1.49658,  1.79154,  1.85948,  2.40075,  2.4683,
+  1.03123,  1.5049,  1.71427,  1.94435,  2.36522,  2.45944,
+  1.20118,  1.37012,  1.88263,  2.01133,  2.41129,  2.51029,
+  1.24946,  1.32446,  1.90762,  2.059,  2.44862,  2.55141,
+  1.30858,  1.40302,  1.96116,  2.04859,  2.47571,  2.56247,
+  1.35436,  1.47604,  2.00873,  2.11132,  2.51324,  2.59156,
+  1.41531,  1.55963,  2.02019,  2.10785,  2.50535,  2.59646,
+  1.45215,  1.53696,  2.03346,  2.12047,  2.47346,  2.60024,
+  1.47616,  1.57067,  1.98144,  2.08987,  2.44173,  2.57494,
+  1.53214,  1.60732,  1.99626,  2.09911,  2.44899,  2.57508,
+  1.57825,  1.6709,  1.94645,  2.06793,  2.48457,  2.59603,
+  1.64599,  1.71983,  1.90843,  2.03481,  2.5215,  2.63014,
+  1.6752,  1.73909,  1.85801,  1.95115,  2.54962,  2.66814,
+  1.6988,  1.74067,  1.81622,  1.87221,  2.55299,  2.67504,
+  1.58931,  1.66594,  1.75197,  1.83425,  2.49582,  2.66392,
+  1.44357,  1.53506,  1.6855,  1.78803,  2.39178,  2.64485,
+  1.38939,  1.59756,  1.88429,  2.16105,  2.45363,  2.57728,
+  1.34469,  1.5734,  1.94905,  2.03321,  2.43648,  2.65023,
+  1.34068,  1.44219,  1.90408,  1.99239,  2.42751,  2.60434,
+  1.30157,  1.36352,  1.87021,  1.95339,  2.44581,  2.60937,
+  1.26564,  1.36552,  1.83866,  1.92217,  2.43174,  2.55248,
+  1.29187,  1.45107,  1.77074,  1.90068,  2.38049,  2.47459,
+  1.3198,  1.50206,  1.68621,  1.92201,  2.2912,  2.39261,
+  1.25322,  1.4458,  1.59175,  1.89356,  2.29503,  2.3815,
+  1.17138,  1.37063,  1.52321,  1.82582,  2.33635,  2.39918,
+  1.23899,  1.36509,  1.48683,  1.79013,  2.30251,  2.38422,
+  1.18649,  1.32753,  1.46369,  1.68078,  2.32204,  2.40225,
+  1.16077,  1.2949,  1.46764,  1.61324,  2.21966,  2.32965,
+  1.16797,  1.31227,  1.45879,  1.72547,  2.18251,  2.27065,
+  1.16049,  1.37138,  1.54665,  1.85991,  2.15148,  2.26711,
+  1.06064,  1.44774,  1.58936,  1.76203,  2.18795,  2.31254,
+  1.09687,  1.44937,  1.66994,  1.88079,  2.20516,  2.32292,
+  0.965471,  1.39498,  1.66486,  1.86974,  2.13014,  2.2721,
+  0.992815,  1.27623,  1.73632,  1.88313,  2.19849,  2.29195,
+  0.989087,  1.34899,  1.86928,  1.94503,  2.2171,  2.32962,
+  0.90585,  1.29647,  1.83941,  1.98449,  2.13136,  2.26164,
+  0.913468,  1.3471,  1.97494,  2.05681,  2.23306,  2.3124,
+  0.891335,  1.51815,  1.95606,  2.01705,  2.23425,  2.36954,
+  0.838007,  1.4907,  2.01764,  2.09778,  2.33146,  2.41797,
+  0.918242,  1.41122,  2.04709,  2.15794,  2.31221,  2.4143,
+  0.73747,  1.47534,  2.13171,  2.1951,  2.33607,  2.41009,
+  0.804454,  1.24701,  2.18319,  2.2531,  2.37687,  2.45747,
+  0.910989,  1.12058,  2.03128,  2.13474,  2.30167,  2.40132,
+  0.823657,  1.02371,  1.8993,  2.15349,  2.27816,  2.4689,
+  0.820197,  0.968457,  1.65567,  2.13731,  2.32041,  2.44255,
+  0.901009,  1.04763,  1.78579,  2.12632,  2.24814,  2.41922,
+  0.908944,  1.15154,  1.94127,  2.15376,  2.28778,  2.47786,
+  1.02292,  1.32981,  1.97353,  2.1212,  2.26916,  2.49693,
+  1.00803,  1.17657,  1.83255,  2.13074,  2.26309,  2.48407,
+  1.1484,  1.26162,  1.86817,  2.13834,  2.28791,  2.47577,
+  1.13164,  1.24554,  1.7469,  2.12721,  2.27364,  2.43952,
+  1.10545,  1.23069,  1.75987,  2.02322,  2.2259,  2.48502,
+  1.23228,  1.36348,  1.91488,  2.02165,  2.31404,  2.45593,
+  1.28797,  1.37746,  1.85366,  2.03963,  2.34808,  2.50271,
+  1.28514,  1.52079,  1.95102,  2.05364,  2.36654,  2.48611,
+  1.27636,  1.65661,  1.88233,  2.08463,  2.43062,  2.524,
+  1.3057,  1.53254,  1.86153,  2.02916,  2.43563,  2.51958,
+  1.29572,  1.47484,  1.83837,  2.04501,  2.41302,  2.5453,
+  1.2328,  1.30721,  1.78676,  1.91145,  2.53363,  2.62579,
+  1.10601,  1.25243,  1.73731,  1.8274,  2.39547,  2.65803,
+  1.08032,  1.24974,  1.76381,  1.84223,  2.48808,  2.63797,
+  1.08481,  1.3027,  1.7911,  1.91571,  2.53275,  2.62698,
+  1.02408,  1.39849,  1.75815,  1.94769,  2.53675,  2.6478,
+  1.05255,  1.48652,  1.83597,  2.01313,  2.52654,  2.62152,
+  0.980943,  1.52889,  1.88771,  1.99043,  2.55923,  2.63173,
+  0.954706,  1.35519,  1.89085,  1.96874,  2.5383,  2.6458,
+  0.894853,  1.31642,  1.93192,  2.00063,  2.61782,  2.70696,
+  0.859848,  1.16666,  1.85185,  2.01109,  2.62987,  2.73106,
+  0.817565,  1.16914,  1.97568,  2.11707,  2.59314,  2.68371,
+  0.776768,  0.999874,  1.95167,  2.127,  2.57853,  2.71922,
+  0.750075,  1.10567,  2.01524,  2.09916,  2.46918,  2.63788,
+  0.878438,  1.03962,  2.07882,  2.1891,  2.45317,  2.61062,
+  0.915136,  1.11488,  2.01769,  2.23653,  2.37028,  2.53828,
+  0.82611,  1.20898,  2.06907,  2.15683,  2.33186,  2.46307,
+  0.869876,  1.28956,  2.0617,  2.14305,  2.31374,  2.39581,
+  0.790056,  1.42106,  1.94573,  2.02523,  2.25492,  2.38411,
+  0.782642,  1.67814,  1.92831,  1.98015,  2.1697,  2.29002,
+  0.79594,  1.40966,  1.7678,  1.89476,  2.19165,  2.28019,
+  0.832117,  1.16909,  1.82801,  1.91103,  2.22865,  2.36616,
+  0.862231,  1.1894,  1.75495,  1.92413,  2.31213,  2.41255,
+  1.03477,  1.29047,  1.7835,  1.99616,  2.34376,  2.46273,
+  1.13581,  1.35879,  1.78919,  1.98063,  2.37636,  2.49584,
+  1.3039,  1.415,  1.78751,  1.91844,  2.43546,  2.54775,
+  1.48925,  1.59296,  1.85058,  1.95005,  2.42804,  2.57134,
+  1.63147,  1.74264,  1.88788,  1.99493,  2.49377,  2.61966,
+  1.68385,  1.80038,  1.92661,  2.06405,  2.50915,  2.59263,
+  1.74531,  1.85426,  1.98854,  2.11714,  2.50431,  2.61134,
+  1.76427,  1.89058,  2.03799,  2.1743,  2.50772,  2.60061,
+  1.68017,  1.81737,  1.93711,  2.22898,  2.55014,  2.62331,
+  1.55262,  1.81946,  1.95732,  2.26349,  2.51728,  2.58051,
+  1.55842,  1.78491,  2.02149,  2.23937,  2.54371,  2.63746,
+  1.24066,  1.73929,  1.88981,  2.10508,  2.53244,  2.61823,
+  0.928972,  1.44027,  1.76926,  1.85335,  2.40041,  2.63688,
+  1.05577,  1.48884,  1.75607,  1.83257,  2.20968,  2.65031,
+  1.0133,  1.38103,  1.70409,  1.77271,  2.15549,  2.58513,
+  1.00919,  1.33324,  1.74138,  1.8465,  2.15877,  2.51776,
+  1.00638,  1.5199,  1.81375,  1.91629,  2.40767,  2.58185,
+  1.35773,  1.53055,  1.88364,  2.14151,  2.46327,  2.61463,
+  1.42682,  1.56088,  1.88252,  2.17521,  2.48835,  2.6287,
+  1.31598,  1.57984,  1.85956,  2.08348,  2.41988,  2.56465,
+  1.21305,  1.5389,  1.80025,  1.88207,  2.34157,  2.57461,
+  1.27506,  1.54351,  1.9171,  2.12745,  2.38894,  2.54272,
+  1.43894,  1.69814,  1.85661,  2.07519,  2.26671,  2.43737,
+  1.45433,  1.66376,  1.86982,  2.01141,  2.36627,  2.53339,
+  1.38217,  1.67292,  1.82744,  1.94203,  2.45391,  2.55986,
+  1.40066,  1.58545,  1.84133,  2.00274,  2.427,  2.51776,
+  1.38214,  1.68809,  1.81976,  2.06315,  2.41779,  2.49255,
+  1.2551,  1.60338,  1.75391,  2.04757,  2.45556,  2.56959,
+  1.13478,  1.40915,  1.70528,  1.80211,  2.48803,  2.64714,
+  1.11188,  1.26013,  1.67605,  1.77849,  2.50159,  2.627,
+  1.06035,  1.20881,  1.66035,  1.77686,  2.48876,  2.60446,
+  0.94712,  1.16465,  1.64204,  1.72379,  2.47516,  2.56741,
+  0.902077,  1.2512,  1.66403,  1.76901,  2.499,  2.5767,
+  0.92017,  1.24389,  1.70968,  1.79499,  2.53435,  2.62383,
+  0.93877,  1.26768,  1.72586,  1.87016,  2.54951,  2.6282,
+  0.914357,  1.25432,  1.71291,  1.78474,  2.59043,  2.70748,
+  0.930246,  1.28124,  1.80279,  1.87886,  2.56022,  2.68722,
+  0.95535,  1.14867,  1.81473,  1.90259,  2.55782,  2.68459,
+  0.96833,  1.09859,  1.81344,  1.91188,  2.46314,  2.64649,
+  0.990311,  1.18544,  1.86467,  1.94159,  2.48811,  2.66446,
+  1.1869,  1.59093,  1.95416,  2.0337,  2.59786,  2.66218,
+  1.30264,  1.69442,  1.99744,  2.16905,  2.61741,  2.69308,
+  1.37926,  1.71828,  1.99322,  2.2122,  2.54373,  2.64086,
+  1.40516,  1.78053,  1.99789,  2.15115,  2.55578,  2.63222,
+  1.29777,  1.87826,  2.02027,  2.19057,  2.54647,  2.61734,
+  1.44216,  1.85664,  2.10104,  2.29971,  2.56148,  2.64412,
+  1.37017,  1.78121,  2.11499,  2.25182,  2.44675,  2.54984,
+  1.40345,  1.70357,  2.0793,  2.2214,  2.44877,  2.59398,
+  1.41335,  1.64917,  2.00998,  2.15916,  2.51868,  2.61514,
+  1.32666,  1.71994,  1.95044,  2.02547,  2.52107,  2.63595,
+  1.38595,  1.55275,  1.85678,  1.93751,  2.49665,  2.58016,
+  1.34541,  1.48801,  1.88554,  2.01719,  2.54687,  2.6256,
+  1.33572,  1.42021,  1.78707,  1.97684,  2.50133,  2.64355,
+  1.3038,  1.40827,  1.80145,  1.90147,  2.37505,  2.57595,
+  1.31291,  1.40809,  1.83798,  1.95009,  2.31854,  2.4759,
+  1.19361,  1.29364,  1.81906,  1.97449,  2.46808,  2.58528,
+  1.19153,  1.31147,  1.71163,  1.85459,  2.39504,  2.55402,
+  1.10318,  1.33217,  1.71792,  1.85799,  2.34029,  2.44522,
+  0.996011,  1.23417,  1.75102,  1.86827,  2.28588,  2.40672,
+  1.05531,  1.37824,  1.71212,  1.84167,  2.2067,  2.44054,
+  1.07861,  1.46591,  1.78701,  1.94898,  2.23174,  2.47898,
+  0.98452,  1.42059,  1.8153,  1.92522,  2.26343,  2.43094,
+  0.984574,  1.49518,  1.77419,  1.96413,  2.22166,  2.34685,
+  1.15484,  1.5072,  1.8121,  1.94937,  2.28174,  2.4261,
+  1.17006,  1.42938,  1.74509,  1.93793,  2.23502,  2.37477,
+  1.20649,  1.48753,  1.7673,  2.00984,  2.20705,  2.33947,
+  1.07366,  1.37773,  1.82868,  1.993,  2.13061,  2.25678,
+  1.08845,  1.49539,  1.90777,  1.99687,  2.2139,  2.39049,
+  1.12298,  1.42221,  1.86583,  2.03711,  2.25375,  2.41839,
+  1.13417,  1.38264,  1.80424,  1.9632,  2.16117,  2.4736,
+  1.2454,  1.55261,  1.96081,  2.13469,  2.4536,  2.57754,
+  1.1187,  1.56721,  1.95262,  2.17652,  2.44663,  2.57856,
+  1.14171,  1.6436,  2.01334,  2.27743,  2.55738,  2.63478,
+  1.39251,  1.80792,  2.03934,  2.23792,  2.57802,  2.66829,
+  1.43321,  1.83371,  2.02062,  2.25218,  2.51864,  2.60086,
+  1.37926,  1.71223,  2.025,  2.24296,  2.51553,  2.60248,
+  1.36698,  1.67564,  1.97659,  2.19947,  2.51697,  2.59881,
+  1.35276,  1.80187,  2.03361,  2.18194,  2.49138,  2.58988,
+  1.32366,  1.74357,  2.00964,  2.1227,  2.47452,  2.56638,
+  1.19009,  1.54054,  1.93307,  2.08808,  2.50673,  2.57061,
+  1.51983,  1.76619,  1.906,  2.07675,  2.26142,  2.40768,
+  1.53469,  1.71407,  2.01648,  2.1309,  2.32326,  2.45761,
+  1.52205,  1.79476,  2.05095,  2.21828,  2.40801,  2.53773,
+  1.66536,  1.90687,  2.02566,  2.23238,  2.43013,  2.55064,
+  1.6663,  1.83465,  1.99804,  2.22024,  2.40151,  2.50239,
+  1.52361,  1.73009,  1.86296,  2.1646,  2.46626,  2.54923,
+  1.21612,  1.50347,  1.76046,  1.96747,  2.38172,  2.56435,
+  1.17113,  1.42943,  1.61663,  1.91778,  2.38793,  2.47727,
+  1.0913,  1.35137,  1.56866,  1.7962,  2.43759,  2.51487,
+  1.00128,  1.38691,  1.5396,  1.77505,  2.41327,  2.48215,
+  0.952227,  1.39731,  1.52793,  1.72252,  2.44275,  2.49237,
+  0.824979,  1.38889,  1.56898,  1.73526,  2.40875,  2.47118,
+  0.794444,  1.43306,  1.58885,  1.74958,  2.48937,  2.57636,
+  0.899067,  1.52185,  1.6814,  1.78029,  2.44175,  2.50829,
+  0.922249,  1.46461,  1.59253,  1.82844,  2.41816,  2.47726,
+  0.871556,  1.44442,  1.53832,  1.88901,  2.35369,  2.41254,
+  0.857823,  1.27025,  1.50127,  1.76026,  2.35576,  2.4073,
+  0.846263,  1.17661,  1.48198,  1.61417,  2.36993,  2.48569,
+  0.882414,  1.17609,  1.37797,  1.49739,  2.38001,  2.51651,
+  0.938718,  1.10065,  1.48911,  1.57621,  2.32557,  2.54347,
+  0.932462,  1.10559,  1.29435,  1.47096,  2.40012,  2.55472,
+  0.945253,  1.161,  1.30388,  1.58026,  2.46668,  2.58461,
+  1.01832,  1.21474,  1.33058,  1.68375,  2.48296,  2.55716,
+  1.04824,  1.17548,  1.2581,  1.59909,  2.52145,  2.6425,
+  1.07374,  1.20351,  1.2987,  1.68876,  2.55568,  2.61447,
+  1.09679,  1.26086,  1.3686,  1.75534,  2.49303,  2.60645,
+  1.10564,  1.22703,  1.40439,  1.8497,  2.52331,  2.60157,
+  1.14386,  1.26939,  1.38734,  1.82908,  2.39517,  2.49646,
+  1.09925,  1.22861,  1.34441,  1.66442,  2.44063,  2.51807,
+  1.11618,  1.22832,  1.33295,  1.66731,  2.33167,  2.51226,
+  1.20152,  1.29939,  1.47847,  1.57791,  2.00331,  2.45158,
+  1.16799,  1.29273,  1.47073,  1.81462,  2.14096,  2.43615,
+  1.28052,  1.42488,  1.59521,  1.80388,  2.20583,  2.31538,
+  1.23016,  1.36494,  1.61044,  2.00251,  2.17287,  2.35572,
+  1.30255,  1.40061,  1.73433,  2.074,  2.20855,  2.38927,
+  1.51269,  1.81823,  2.14478,  2.26692,  2.44774,  2.56939,
+  1.50753,  1.76042,  2.16423,  2.27687,  2.47949,  2.62484,
+  1.44651,  1.76044,  2.1147,  2.2567,  2.57257,  2.66147,
+  1.46887,  1.81236,  2.11457,  2.19302,  2.61774,  2.71384,
+  1.44965,  1.77645,  2.0806,  2.21016,  2.54091,  2.71399,
+  1.44125,  1.71952,  2.11461,  2.21869,  2.5113,  2.66005,
+  1.47766,  1.61984,  2.1127,  2.1987,  2.5206,  2.6557,
+  1.53287,  1.71815,  2.13263,  2.2223,  2.55144,  2.66573,
+  1.34103,  1.81458,  2.12504,  2.24586,  2.54798,  2.64959,
+  1.36191,  1.69809,  2.07692,  2.25511,  2.52488,  2.64704,
+  1.31533,  1.59277,  2.10978,  2.21019,  2.51775,  2.66697,
+  1.3828,  1.57159,  2.10684,  2.20406,  2.4952,  2.66142,
+  1.45363,  1.64175,  2.10031,  2.19937,  2.4624,  2.60888,
+  1.3761,  1.64657,  1.98719,  2.21841,  2.41362,  2.52681,
+  1.37284,  1.63246,  2.05624,  2.16372,  2.37619,  2.58687,
+  1.43261,  1.62463,  2.07417,  2.11989,  2.48066,  2.66903,
+  1.41068,  1.6628,  2.06922,  2.13037,  2.58137,  2.714,
+  1.17413,  1.52452,  2.03205,  2.10525,  2.50238,  2.65331,
+  1.15083,  1.24978,  2.00479,  2.15823,  2.31798,  2.58817,
+  1.05764,  1.19972,  2.04367,  2.16548,  2.37102,  2.60817,
+  1.07033,  1.16919,  2.05106,  2.1872,  2.47645,  2.67133,
+  0.989962,  1.10088,  1.95972,  2.10766,  2.45186,  2.65933,
+  0.995945,  1.12508,  1.96773,  2.17105,  2.35276,  2.58638,
+  0.951054,  1.07341,  1.76868,  2.2131,  2.36251,  2.50427,
+  0.912647,  1.06363,  1.87431,  2.20935,  2.34779,  2.51505,
+  0.880146,  1.0577,  1.93951,  2.2982,  2.44787,  2.55972,
+  0.808391,  0.999903,  1.78946,  2.22109,  2.38324,  2.5121,
+  0.872797,  1.05131,  1.90798,  2.34589,  2.55144,  2.62038,
+  0.736864,  0.925226,  2.10155,  2.27386,  2.39295,  2.56886,
+  0.704727,  1.0262,  2.09473,  2.21249,  2.47416,  2.6562,
+  0.793545,  1.02948,  1.90102,  2.33368,  2.65025,  2.72142,
+  0.890709,  1.27007,  2.13985,  2.23832,  2.54438,  2.71132,
+  0.971655,  1.31769,  2.24547,  2.35109,  2.63196,  2.71126,
+  1.08079,  1.55577,  2.01062,  2.24599,  2.52841,  2.64489,
+  1.40951,  1.76932,  2.1067,  2.28426,  2.51225,  2.63834,
+  1.24844,  1.66199,  2.03514,  2.28324,  2.53429,  2.64733,
+  0.95246,  1.1238,  2.10348,  2.25807,  2.39474,  2.60457,
+  0.989645,  1.18166,  2.02343,  2.23737,  2.36952,  2.52253,
+  0.926042,  1.34812,  1.94934,  2.06208,  2.34696,  2.44908,
+  0.919696,  1.4053,  1.83405,  2.0997,  2.37621,  2.49339,
+  1.00081,  1.37165,  1.83665,  2.2241,  2.41011,  2.5393,
+  1.20009,  1.43679,  1.83915,  2.17928,  2.39885,  2.49843,
+  1.22352,  1.48641,  1.94399,  2.25226,  2.40733,  2.54068,
+  1.11367,  1.47721,  1.84416,  2.21801,  2.38133,  2.48688,
+  1.13811,  1.49875,  1.98095,  2.29747,  2.45785,  2.56077,
+  1.14615,  1.61454,  1.8989,  2.23248,  2.41657,  2.51096,
+  1.11967,  1.58992,  1.82441,  2.11191,  2.35476,  2.45328,
+  1.03204,  1.58942,  1.85285,  2.14299,  2.324,  2.47294,
+  0.989427,  1.52898,  1.91464,  2.17919,  2.37674,  2.49437,
+  1.09575,  1.49456,  1.86612,  2.13681,  2.28371,  2.46406,
+  0.834557,  1.46372,  1.88257,  2.15093,  2.37864,  2.46309,
+  0.835589,  1.29607,  1.77137,  2.09878,  2.28624,  2.42638,
+  0.806577,  1.40333,  1.68522,  2.04095,  2.23574,  2.3564,
+  0.800011,  1.38309,  1.81416,  1.95993,  2.30958,  2.38679,
+  0.804745,  1.31821,  1.82136,  1.9087,  2.23513,  2.42714,
+  0.895849,  1.36723,  1.86481,  1.97967,  2.32424,  2.42079,
+  0.82739,  1.42508,  1.76716,  2.05819,  2.37623,  2.46943,
+  0.917915,  1.49792,  1.85534,  1.98721,  2.31538,  2.45164,
+  0.940855,  1.40956,  1.78919,  1.98853,  2.33667,  2.53469,
+  0.972711,  1.2917,  1.78694,  1.91488,  2.32326,  2.40549,
+  0.993281,  1.36882,  1.80724,  1.95862,  2.35727,  2.45928,
+  1.07469,  1.34931,  1.84084,  1.95484,  2.26908,  2.38406,
+  1.1006,  1.21857,  1.75613,  1.90019,  2.27787,  2.40621,
+  1.16562,  1.31369,  1.8437,  1.96222,  2.1571,  2.34291,
+  1.15777,  1.37236,  1.87996,  1.99193,  2.25808,  2.39087,
+  1.28609,  1.78099,  1.9597,  2.11887,  2.32454,  2.43759,
+  1.45517,  1.73815,  2.09889,  2.23501,  2.42846,  2.53971,
+  1.50025,  1.68426,  2.161,  2.27259,  2.39908,  2.51033,
+  1.48567,  1.8464,  2.19572,  2.30566,  2.54628,  2.65059,
+  1.72782,  2.01371,  2.16728,  2.30421,  2.58661,  2.65216,
+  1.67677,  1.96053,  2.21701,  2.36881,  2.59828,  2.68162,
+  1.63196,  1.91575,  2.22704,  2.33518,  2.6031,  2.71022,
+  1.66386,  1.97302,  2.12471,  2.22235,  2.66048,  2.72432,
+  1.54201,  1.92958,  2.0756,  2.17063,  2.62855,  2.70775,
+  1.50969,  1.70605,  2.05691,  2.19767,  2.57833,  2.6539,
+  1.48207,  1.67373,  2.13105,  2.19487,  2.58632,  2.69029,
+  1.42345,  1.64327,  2.09232,  2.17894,  2.5272,  2.63675,
+  1.35515,  1.56517,  2.02393,  2.23649,  2.53832,  2.65549,
+  1.32842,  1.55398,  2.08156,  2.16192,  2.47274,  2.65693,
+  1.33076,  1.41904,  2.02671,  2.12905,  2.368,  2.57102,
+  1.27065,  1.37759,  2.02595,  2.14013,  2.38924,  2.57594,
+  1.23682,  1.34543,  2.02239,  2.10985,  2.47813,  2.63391,
+  1.22208,  1.32043,  1.93967,  2.02174,  2.43681,  2.62853,
+  1.25217,  1.35827,  1.97262,  2.07935,  2.37145,  2.59893,
+  1.26623,  1.4702,  1.93045,  2.14581,  2.47186,  2.61815,
+  1.33228,  1.54641,  2.02572,  2.21952,  2.46462,  2.64511,
+  1.4186,  1.64948,  2.00831,  2.12811,  2.48988,  2.67687,
+  1.45568,  1.68468,  1.98898,  2.15265,  2.4704,  2.65153,
+  1.44749,  1.60065,  1.9359,  2.27176,  2.51299,  2.63183,
+  1.44477,  1.55636,  2.02038,  2.28232,  2.47577,  2.61234,
+  1.38748,  1.48741,  2.02468,  2.24466,  2.44505,  2.58283,
+  1.35392,  1.44328,  1.95756,  2.17131,  2.33611,  2.56008,
+  1.36979,  1.44771,  2.00618,  2.19142,  2.40471,  2.60473,
+  1.42596,  1.50428,  2.07231,  2.17818,  2.41766,  2.60341,
+  1.44024,  1.5405,  2.0824,  2.21198,  2.37707,  2.63732,
+  1.49701,  1.58268,  2.05652,  2.17217,  2.38928,  2.59384,
+  1.50496,  1.58456,  1.98409,  2.14933,  2.36756,  2.55972,
+  1.51904,  1.60399,  1.9938,  2.10993,  2.32726,  2.59969,
+  1.56956,  1.65105,  1.98894,  2.11673,  2.34577,  2.56992,
+  1.56989,  1.68368,  1.98057,  2.18292,  2.35723,  2.58728,
+  1.60707,  1.7127,  1.95147,  2.12568,  2.30717,  2.54725,
+  1.64523,  1.7366,  1.95236,  2.13149,  2.37622,  2.60646,
+  1.66961,  1.76398,  1.97965,  2.17323,  2.33235,  2.51667,
+  1.63244,  1.75887,  1.9808,  2.12427,  2.2859,  2.44383,
+  1.55741,  1.6677,  1.90206,  2.10693,  2.26086,  2.48392,
+  1.47042,  1.68895,  1.84638,  2.03283,  2.18513,  2.37587,
+  1.42194,  1.53148,  1.82567,  2.02659,  2.18038,  2.36012,
+  1.38564,  1.60616,  1.84636,  2.07139,  2.4885,  2.60745,
+  1.35971,  1.57766,  1.8971,  2.11196,  2.47111,  2.603,
+  1.33945,  1.54264,  1.93397,  2.13374,  2.45491,  2.58319,
+  1.32581,  1.69176,  2.08023,  2.16421,  2.47416,  2.60522,
+  1.34715,  1.6247,  2.07411,  2.2144,  2.43059,  2.56295,
+  1.31486,  1.54184,  1.96763,  2.16414,  2.37269,  2.60652,
+  1.3129,  1.53408,  1.91728,  2.08995,  2.41161,  2.57067,
+  1.28302,  1.5574,  1.93788,  2.10334,  2.52062,  2.6237,
+  1.13883,  1.33747,  1.87109,  1.97275,  2.43348,  2.64765,
+  1.15594,  1.28112,  1.83135,  1.91924,  2.2666,  2.60094,
+  1.16684,  1.27382,  1.8432,  1.94603,  2.31838,  2.57879,
+  1.17229,  1.27501,  1.83258,  2.02592,  2.35381,  2.62469,
+  1.08216,  1.26544,  1.89236,  1.98901,  2.38316,  2.60142,
+  1.0919,  1.20882,  1.83501,  2.03446,  2.39472,  2.5629,
+  1.09883,  1.19949,  1.75765,  2.06589,  2.3904,  2.57889,
+  1.1328,  1.24439,  1.87662,  2.07155,  2.33918,  2.53792,
+  1.1806,  1.25947,  1.82316,  2.09506,  2.2569,  2.54272,
+  1.18699,  1.31291,  1.80079,  2.10504,  2.36699,  2.49608,
+  1.26639,  1.37714,  1.81043,  2.11327,  2.32962,  2.53315,
+  1.32359,  1.40452,  1.90424,  2.14593,  2.38611,  2.58094,
+  1.35217,  1.4514,  1.94982,  2.07705,  2.39082,  2.53857,
+  1.34386,  1.45223,  1.88989,  2.02674,  2.31748,  2.48249,
+  1.24481,  1.37885,  1.79256,  1.98674,  2.42257,  2.53695,
+  1.12462,  1.2536,  1.70382,  1.95132,  2.43964,  2.54515,
+  0.995104,  1.41175,  1.72851,  1.86164,  2.4566,  2.54496,
+  1.00107,  1.40911,  1.79773,  1.89757,  2.40948,  2.55532,
+  1.03398,  1.42816,  1.78694,  1.88029,  2.32636,  2.50316,
+  0.970169,  1.32072,  1.71664,  1.84157,  2.2202,  2.38892,
+  0.930477,  1.37338,  1.7984,  1.90473,  2.30579,  2.5253,
+  0.939935,  1.41846,  1.7727,  1.87809,  2.36749,  2.46153,
+  0.949116,  1.52711,  1.7659,  1.84073,  2.16493,  2.47434,
+  0.993353,  1.62934,  1.81344,  1.91022,  2.10077,  2.4929,
+  1.01383,  1.54962,  1.79683,  1.89194,  2.23976,  2.55635,
+  0.970121,  1.5098,  1.83401,  1.93898,  2.33857,  2.50435,
+  0.947238,  1.36138,  1.78355,  1.98471,  2.4239,  2.54718,
+  0.980991,  1.38878,  1.78331,  2.13171,  2.45463,  2.55869,
+  1.00267,  1.40234,  1.80719,  2.02446,  2.46442,  2.55428,
+  1.0107,  1.40419,  1.87256,  2.07936,  2.47933,  2.56962,
+  0.972976,  1.3758,  1.84337,  1.9807,  2.51361,  2.57827,
+  0.932062,  1.27768,  1.85113,  1.98588,  2.46629,  2.56626,
+  0.938577,  1.18115,  1.83396,  1.96503,  2.45801,  2.55053,
+  0.940095,  1.14545,  1.79669,  2.07827,  2.4829,  2.61063,
+  0.909789,  1.07408,  1.7174,  2.13911,  2.46252,  2.57226,
+  0.882446,  1.06665,  1.72956,  2.28466,  2.4789,  2.55502,
+  0.938178,  1.1215,  1.82849,  2.23404,  2.47478,  2.5571,
+  0.917165,  1.28307,  1.7795,  2.10029,  2.47583,  2.59018,
+  1.06294,  1.34904,  1.76276,  2.1183,  2.50481,  2.60679,
+  1.18696,  1.4619,  1.88904,  2.11274,  2.48132,  2.62131,
+  1.48072,  1.61923,  1.97948,  2.1771,  2.43648,  2.57898,
+  1.44872,  1.56634,  1.88013,  2.13853,  2.33968,  2.55459,
+  1.40799,  1.61355,  1.82893,  2.0527,  2.3445,  2.53808,
+  1.61602,  1.69101,  1.85635,  1.98008,  2.54825,  2.63776,
+  1.62817,  1.68416,  1.88615,  2.01287,  2.56377,  2.62158,
+  1.59574,  1.68801,  1.9354,  2.02581,  2.48363,  2.61682,
+  1.64156,  1.70866,  1.95546,  2.04699,  2.51983,  2.64574,
+  1.67367,  1.75221,  1.95129,  2.08092,  2.48739,  2.64072,
+  1.65642,  1.73624,  1.99136,  2.09832,  2.57191,  2.67683,
+  1.65982,  1.73245,  1.95125,  2.07702,  2.58164,  2.69352,
+  1.6548,  1.71621,  1.96664,  2.04423,  2.56325,  2.6802,
+  1.60273,  1.68261,  1.91741,  1.99483,  2.53109,  2.67329,
+  1.58255,  1.63953,  1.9261,  1.99207,  2.53207,  2.69711,
+  1.46237,  1.585,  1.8183,  1.89755,  2.55713,  2.70626,
+  1.4532,  1.55073,  1.81519,  1.91646,  2.39997,  2.66768,
+  1.41939,  1.55772,  1.78444,  1.90918,  2.51138,  2.66998,
+  1.39516,  1.53982,  1.84748,  1.93084,  2.58396,  2.70362,
+  1.34885,  1.61088,  1.95815,  2.04307,  2.58609,  2.66435,
+  1.37239,  1.65814,  1.95866,  2.18944,  2.45048,  2.65032,
+  1.35259,  1.52809,  1.92314,  2.19484,  2.42773,  2.56214,
+  1.38093,  1.61227,  1.99338,  2.17611,  2.50893,  2.63506,
+  1.42958,  1.68659,  2.01713,  2.17256,  2.48642,  2.60927,
+  1.39212,  1.64104,  1.95208,  2.06507,  2.42122,  2.57491,
+  1.39959,  1.78826,  1.95209,  2.09858,  2.48993,  2.62939,
+  1.38376,  1.66244,  1.9831,  2.11224,  2.5328,  2.63181,
+  1.37273,  1.67362,  1.91212,  2.13425,  2.433,  2.61228,
+  1.39603,  1.64262,  1.96263,  2.19739,  2.52132,  2.66069,
+  1.37936,  1.62399,  2.0694,  2.24312,  2.56203,  2.66844,
+  1.33867,  1.61863,  2.04204,  2.19512,  2.57016,  2.6991,
+  1.29412,  1.71208,  2.05016,  2.12013,  2.60784,  2.68169,
+  1.29325,  1.59625,  1.99341,  2.06004,  2.58308,  2.66414,
+  1.20992,  1.36267,  1.95512,  2.02835,  2.51296,  2.6258,
+  1.3817,  1.70662,  2.00317,  2.14647,  2.50003,  2.61301,
+  1.20467,  1.73456,  1.9288,  2.10969,  2.4769,  2.54909,
+  1.11449,  1.69632,  1.88882,  2.04367,  2.53927,  2.63717,
+  1.11931,  1.60146,  1.84673,  2.08566,  2.57754,  2.64535,
+  1.12875,  1.53118,  1.85828,  2.14677,  2.59635,  2.68872,
+  1.13025,  1.67465,  1.83066,  2.17211,  2.56255,  2.67283,
+  1.10077,  1.64441,  1.83323,  2.04061,  2.59933,  2.65229,
+  1.06697,  1.5306,  1.76863,  2.00332,  2.61732,  2.67806,
+  1.06312,  1.46936,  1.79782,  1.88185,  2.56819,  2.67915,
+  1.17729,  1.70328,  1.86551,  2.06104,  2.48107,  2.58144,
+  1.40413,  1.6575,  1.92706,  2.18185,  2.45741,  2.58043,
+  1.42836,  1.66354,  1.98499,  2.18345,  2.45866,  2.56949,
+  1.4032,  1.66715,  1.95509,  2.14645,  2.46264,  2.56266,
+  1.23413,  1.59785,  1.91775,  2.03444,  2.40755,  2.56026,
+  1.22453,  1.36863,  1.84807,  1.92472,  2.49495,  2.67021,
+  1.21477,  1.58834,  1.76581,  2.00386,  2.52678,  2.63596,
+  1.26488,  1.63647,  1.82522,  2.07706,  2.56349,  2.67929,
+  1.26961,  1.58898,  1.78218,  2.09502,  2.62041,  2.69179,
+  1.29641,  1.50434,  1.80291,  2.01338,  2.60569,  2.68162,
+  1.33438,  1.52077,  1.79661,  1.96388,  2.60042,  2.70374,
+  1.39757,  1.60058,  1.84597,  1.94012,  2.61622,  2.69611,
+  1.43088,  1.55907,  1.79924,  1.99405,  2.59895,  2.6747,
+  1.48212,  1.58304,  1.80751,  1.98143,  2.57538,  2.68473,
+  1.46434,  1.56562,  1.77603,  1.91763,  2.575,  2.65927,
+  1.4554,  1.53823,  1.73066,  1.88207,  2.56375,  2.66044,
+  1.49958,  1.58442,  1.68807,  1.89207,  2.5871,  2.68867,
+  1.47976,  1.5737,  1.69519,  2.02444,  2.55818,  2.63904,
+  1.45227,  1.54712,  1.75057,  2.07203,  2.53701,  2.67379,
+  1.44738,  1.56304,  1.79438,  2.14163,  2.35339,  2.50255,
+  1.35172,  1.45071,  1.73023,  1.99189,  2.29835,  2.46355,
+  1.31876,  1.41462,  1.64199,  1.94834,  2.32625,  2.47429,
+  1.21205,  1.34623,  1.6851,  1.95989,  2.32224,  2.51295,
+  1.20902,  1.30295,  1.63462,  1.93085,  2.28291,  2.50754,
+  1.18895,  1.29282,  1.66566,  2.17785,  2.37356,  2.47429,
+  1.25754,  1.45115,  1.83601,  2.16148,  2.44729,  2.59664,
+  1.25342,  1.3702,  1.83372,  2.24474,  2.47977,  2.57602,
+  1.17995,  1.30201,  1.59215,  2.15158,  2.45596,  2.51812,
+  1.11448,  1.25765,  1.41158,  2.04236,  2.54829,  2.62041,
+  1.09999,  1.30707,  1.40717,  2.15942,  2.58591,  2.64936,
+  1.13115,  1.24686,  1.40128,  2.1166,  2.48376,  2.54666,
+  1.17377,  1.34087,  1.4499,  2.0937,  2.56103,  2.62648,
+  1.18957,  1.3462,  1.46559,  2.00354,  2.51775,  2.5757,
+  1.21797,  1.30299,  1.56949,  2.02897,  2.45573,  2.55014,
+  1.23191,  1.39323,  1.52046,  1.95573,  2.47623,  2.64224,
+  1.27718,  1.45114,  1.59102,  1.92599,  2.45809,  2.56656,
+  1.21624,  1.48312,  1.68868,  1.98897,  2.45463,  2.59962,
+  1.18429,  1.55304,  1.83889,  2.10027,  2.38501,  2.55005,
+  1.23917,  1.79282,  1.95907,  2.1826,  2.44529,  2.52957,
+  1.62457,  1.86085,  2.12033,  2.21992,  2.42941,  2.5941,
+  1.75324,  1.88933,  2.13652,  2.25457,  2.43633,  2.56246,
+  1.75727,  1.95692,  2.24234,  2.36011,  2.49374,  2.58763,
+  1.80684,  1.9852,  2.19776,  2.33868,  2.49634,  2.60068,
+  1.85991,  2.03042,  2.28254,  2.396,  2.54859,  2.63263,
+  1.7711,  1.89613,  2.30676,  2.42126,  2.53834,  2.62596,
+  1.50565,  1.89323,  2.01933,  2.32579,  2.48797,  2.58553,
+  1.18914,  1.7711,  1.91507,  2.25487,  2.53443,  2.61278,
+  1.104,  1.64935,  1.83499,  1.93594,  2.53413,  2.652,
+  1.07901,  1.52244,  1.76728,  1.93497,  2.52313,  2.59639,
+  1.10621,  1.60804,  1.75144,  2.00839,  2.49173,  2.57715,
+  1.22513,  1.59727,  1.85783,  2.10361,  2.46542,  2.59305,
+  1.37537,  1.61836,  1.93052,  2.21445,  2.44556,  2.5762,
+  1.42999,  1.69897,  1.98214,  2.23334,  2.49044,  2.60535,
+  1.4828,  1.67946,  1.99776,  2.2224,  2.46458,  2.58682,
+  1.408,  1.67664,  1.97085,  2.22109,  2.44036,  2.59243,
+  1.2799,  1.6188,  1.92099,  2.16109,  2.43881,  2.62742,
+  0.936959,  1.31029,  1.66337,  2.0101,  2.51599,  2.59778,
+  1.01466,  1.40151,  1.59008,  2.08087,  2.55691,  2.62215,
+  1.04365,  1.38457,  1.5715,  1.98823,  2.56866,  2.64789,
+  1.10727,  1.41397,  1.56206,  1.87714,  2.55472,  2.63729,
+  1.17948,  1.46739,  1.605,  1.839,  2.52348,  2.6405,
+  1.21832,  1.41202,  1.59163,  1.79653,  2.5198,  2.66057,
+  1.30537,  1.42738,  1.61458,  1.76369,  2.49727,  2.65779,
+  1.33854,  1.45634,  1.6422,  1.86235,  2.44879,  2.63162,
+  1.32868,  1.44222,  1.57523,  1.85891,  2.47066,  2.57043,
+  1.35122,  1.46628,  1.60143,  1.86374,  2.42525,  2.50034,
+  1.36091,  1.47648,  1.62462,  1.83211,  2.48627,  2.56333,
+  1.40173,  1.49988,  1.6134,  1.74973,  2.42322,  2.59141,
+  1.26155,  1.40299,  1.52378,  1.80204,  2.49974,  2.60553,
+  1.16,  1.46705,  1.6056,  1.78769,  2.50805,  2.55736,
+  1.27952,  1.53509,  1.62057,  1.75862,  2.40962,  2.67642,
+  1.16136,  1.50546,  1.6262,  1.7331,  2.39883,  2.61748,
+  1.18463,  1.52853,  1.61429,  1.69821,  2.35034,  2.6671,
+  1.11735,  1.53807,  1.65845,  1.75962,  2.28126,  2.58068,
+  1.10984,  1.49283,  1.70197,  1.78983,  2.15124,  2.48973,
+  1.01023,  1.46712,  1.63109,  1.88642,  2.42002,  2.52278,
+  0.950861,  1.33689,  1.617,  1.78955,  2.44962,  2.52889,
+  1.02847,  1.3481,  1.57189,  1.88039,  2.54391,  2.60801,
+  1.11075,  1.41566,  1.69055,  2.00551,  2.55818,  2.6501,
+  1.11015,  1.43266,  1.6694,  1.90159,  2.51693,  2.60274,
+  1.06783,  1.54338,  1.71944,  1.979,  2.54367,  2.61757,
+  1.42254,  1.70106,  1.94043,  2.32706,  2.55761,  2.64296,
+  1.38612,  1.78193,  2.04068,  2.38389,  2.57395,  2.63346,
+  1.51277,  1.69633,  2.1845,  2.29598,  2.57899,  2.67726,
+  1.57185,  1.70524,  2.22523,  2.31919,  2.5426,  2.67616,
+  1.51491,  1.84429,  2.24734,  2.36159,  2.52907,  2.6533,
+  1.60358,  1.94842,  2.27181,  2.4296,  2.52821,  2.61773,
+  1.62041,  2.02418,  2.37902,  2.47798,  2.62296,  2.67076,
+  1.57882,  1.90635,  2.23831,  2.37884,  2.55696,  2.64712,
+  1.61114,  1.90067,  2.18578,  2.31738,  2.51701,  2.61014,
+  1.55461,  1.94143,  2.13305,  2.24986,  2.49176,  2.57161,
+  1.46962,  1.9189,  2.09418,  2.22518,  2.49035,  2.56434,
+  1.33537,  1.69721,  2.01709,  2.23232,  2.47434,  2.57102,
+  1.22194,  1.51906,  1.81406,  2.1294,  2.45829,  2.56013,
+  1.19335,  1.42604,  1.73164,  2.00909,  2.48569,  2.5661,
+  1.14086,  1.30414,  1.72407,  1.96212,  2.45682,  2.67358,
+  1.17199,  1.317,  1.75694,  2.05081,  2.52062,  2.67935,
+  1.13514,  1.41021,  1.71529,  2.0926,  2.49945,  2.61771,
+  1.11453,  1.48721,  1.5954,  2.01378,  2.53196,  2.6284,
+  1.18516,  1.39989,  1.58265,  2.19579,  2.51838,  2.58247,
+  1.10455,  1.42368,  1.65629,  2.26253,  2.59319,  2.66401,
+  1.1643,  1.59699,  1.71775,  2.20785,  2.56315,  2.6214,
+  1.02259,  1.59646,  1.83176,  2.28798,  2.51904,  2.58042,
+  0.920067,  1.6565,  1.82922,  2.20717,  2.5356,  2.58254,
+  0.940069,  1.57744,  1.96057,  2.18925,  2.48282,  2.54933,
+  0.824619,  1.70849,  1.93223,  2.18861,  2.55188,  2.60548,
+  0.819752,  1.68897,  1.95061,  2.08345,  2.46319,  2.51587,
+  0.820934,  1.71848,  2.02163,  2.15842,  2.52112,  2.57629,
+  0.860984,  1.61569,  2.04686,  2.14622,  2.46989,  2.57106,
+  0.7224,  1.64737,  1.97316,  2.0661,  2.43884,  2.60907,
+  0.853506,  1.57795,  1.94985,  2.08284,  2.44874,  2.51242,
+  0.745605,  1.46451,  1.99332,  2.07751,  2.46918,  2.53247,
+  0.710718,  1.53369,  1.89005,  2.01388,  2.4256,  2.51639,
+  0.877569,  1.51198,  1.8316,  2.0319,  2.44162,  2.51744,
+  1.25962,  1.51952,  1.8797,  2.13883,  2.45029,  2.61407,
+  1.32666,  1.6701,  1.91934,  2.14837,  2.36293,  2.46445,
+  1.43771,  1.67164,  1.95505,  2.16671,  2.40595,  2.55752,
+  1.60387,  1.74029,  1.98995,  2.19878,  2.46753,  2.58565,
+  1.6385,  1.74325,  2.05109,  2.14971,  2.46263,  2.56933,
+  1.63183,  1.72177,  2.00292,  2.13115,  2.43893,  2.56922,
+  1.60316,  1.76319,  2.08219,  2.17477,  2.37672,  2.50226,
+  1.63098,  1.70394,  2.00922,  2.14927,  2.36918,  2.58057,
+  1.5766,  1.65869,  1.92294,  2.12495,  2.44873,  2.57827,
+  1.51627,  1.63071,  1.8608,  2.12704,  2.4444,  2.58228,
+  1.45888,  1.54763,  1.79608,  2.04697,  2.37806,  2.53559,
+  1.37666,  1.51251,  1.73356,  2.09821,  2.36177,  2.45214,
+  1.13475,  1.32018,  1.58255,  2.05289,  2.44906,  2.52706,
+  1.07945,  1.16406,  1.57337,  2.22076,  2.5003,  2.56093,
+  1.06047,  1.18642,  1.45666,  2.15579,  2.437,  2.5269,
+  0.974645,  1.13281,  1.56353,  2.08986,  2.50461,  2.57178,
+  0.925733,  1.04903,  1.55569,  2.09544,  2.54168,  2.61417,
+  1.01286,  1.15468,  1.28381,  2.12616,  2.55879,  2.59581,
+  0.970704,  1.08889,  1.3988,  1.96967,  2.51746,  2.62149,
+  0.99667,  1.1556,  1.28423,  1.96774,  2.47805,  2.53675,
+  1.06187,  1.17276,  1.29685,  1.89013,  2.46531,  2.55049,
+  0.971133,  1.1469,  1.42509,  1.82366,  2.3102,  2.51319,
+  1.12232,  1.24695,  1.57393,  1.94586,  2.35067,  2.54611,
+  1.13044,  1.2818,  1.71175,  2.05285,  2.47117,  2.56897,
+  1.28579,  1.42518,  1.8744,  2.08523,  2.42611,  2.57699,
+  1.27354,  1.49021,  1.87877,  2.10625,  2.40245,  2.54437,
+  1.22424,  1.46248,  1.90461,  2.12819,  2.41656,  2.57002,
+  1.25206,  1.44985,  1.80251,  2.11987,  2.41888,  2.5188,
+  1.32712,  1.41759,  1.78996,  2.17493,  2.34065,  2.46871,
+  1.34678,  1.43555,  1.73431,  2.03604,  2.35655,  2.53105,
+  1.23582,  1.31596,  1.59712,  1.89787,  2.28422,  2.57595,
+  0.955415,  1.30377,  1.56019,  1.73007,  2.44977,  2.64812,
+  0.909089,  1.47167,  1.62448,  1.89097,  2.38965,  2.62795,
+  0.919631,  1.36687,  1.50602,  1.84259,  2.342,  2.55449,
+  0.855197,  1.27967,  1.53955,  1.68852,  2.38691,  2.50206,
+  0.807057,  1.13562,  1.5416,  1.6813,  2.24391,  2.51087,
+  0.849115,  1.19024,  1.44993,  1.54139,  2.30258,  2.6556,
+  0.832569,  1.27336,  1.59248,  1.79281,  2.28417,  2.49848,
+  0.835449,  1.16892,  1.54463,  1.71893,  2.42389,  2.63262,
+  0.826578,  1.27619,  1.40786,  1.66029,  2.37804,  2.47453,
+  0.873632,  1.36031,  1.50287,  1.75833,  2.5708,  2.71226,
+  0.82832,  1.28463,  1.46241,  1.6242,  2.57586,  2.70561,
+  0.86693,  1.13331,  1.25406,  1.42989,  2.49929,  2.56231,
+  0.807119,  1.21808,  1.34601,  1.54062,  2.48761,  2.6331,
+  0.98368,  1.14658,  1.33665,  1.47931,  2.32716,  2.61436,
+  0.991742,  1.17073,  1.29617,  1.48561,  2.54305,  2.66382,
+  0.857243,  1.17219,  1.29859,  1.6239,  2.58125,  2.67565,
+  1.02446,  1.24516,  1.33583,  1.92396,  2.62349,  2.68982,
+  1.03526,  1.29306,  1.41981,  1.88269,  2.47498,  2.67367,
+  0.98116,  1.23984,  1.33455,  1.62845,  2.54405,  2.68174,
+  0.948338,  1.22739,  1.3601,  1.57206,  2.44798,  2.66861,
+  1.09712,  1.2561,  1.36219,  1.63254,  2.50779,  2.65642,
+  1.06074,  1.284,  1.52793,  1.67627,  2.54094,  2.63814,
+  0.999111,  1.2307,  1.53126,  1.64398,  2.37306,  2.63434,
+  0.900037,  1.35716,  1.5199,  1.69115,  2.33345,  2.6059,
+  0.906535,  1.20048,  1.61525,  1.71596,  2.28887,  2.60957,
+  0.841267,  1.3377,  1.72119,  1.79912,  2.17636,  2.62724,
+  0.950819,  1.50712,  1.71882,  1.82673,  2.05053,  2.48989,
+  0.922437,  1.44759,  1.83206,  1.92051,  2.14899,  2.50957,
+  0.797637,  1.12047,  1.75627,  1.94611,  2.20911,  2.53594,
+  0.821846,  1.16874,  1.83791,  1.97773,  2.36161,  2.64241,
+  0.802821,  1.39464,  1.94559,  2.03152,  2.33749,  2.58995,
+  0.808599,  1.21429,  1.87853,  2.00233,  2.28022,  2.57778,
+  0.825133,  1.3293,  1.89662,  1.97956,  2.45575,  2.5731,
+  0.847939,  1.23595,  1.89729,  2.01661,  2.42221,  2.65115,
+  0.793266,  1.31179,  1.88526,  1.97487,  2.49392,  2.69992,
+  0.835729,  1.41812,  1.83973,  1.90323,  2.50796,  2.64513,
+  0.84938,  1.4762,  1.83681,  1.97738,  2.32134,  2.5611,
+  0.77457,  1.28461,  1.75819,  1.86442,  2.36773,  2.5612,
+  0.896154,  1.46644,  1.77022,  1.87135,  2.58655,  2.68848,
+  1.0978,  1.5765,  1.74232,  1.91022,  2.16067,  2.65845,
+  0.95072,  1.45287,  1.76016,  1.93477,  2.19628,  2.62419,
+  0.947778,  1.33478,  1.74561,  1.83051,  2.25611,  2.66786,
+  0.970291,  1.21491,  1.74593,  1.84071,  2.26878,  2.55518,
+  1.02748,  1.19305,  1.65541,  1.77056,  2.11599,  2.50296,
+  1.10863,  1.22404,  1.55642,  1.7059,  2.01907,  2.46382,
+  1.13733,  1.24864,  1.6599,  1.836,  2.0873,  2.49402,
+  1.19278,  1.29031,  1.65286,  1.87863,  2.08608,  2.61596,
+  1.23183,  1.34329,  1.52821,  1.64612,  1.91216,  2.35441,
+  1.04315,  1.3807,  1.67914,  1.83012,  2.00837,  2.41401,
+  1.10289,  1.24306,  1.74748,  1.86138,  2.20309,  2.50438,
+  1.04973,  1.35437,  1.73588,  1.819,  2.24881,  2.55779,
+  1.10598,  1.57142,  1.76481,  1.95355,  2.42885,  2.56011,
+  1.29085,  1.55016,  1.83756,  2.1266,  2.48883,  2.60078,
+  1.19424,  1.4267,  1.83766,  1.91401,  2.44321,  2.63552,
+  1.1655,  1.26009,  1.79094,  1.89331,  2.40045,  2.64664,
+  1.22495,  1.30814,  1.82593,  1.91949,  2.32136,  2.69508,
+  1.24849,  1.34538,  1.77545,  1.87671,  2.35372,  2.65414,
+  1.27114,  1.39967,  1.81154,  1.89758,  2.40349,  2.65392,
+  1.3091,  1.40766,  1.80684,  1.89783,  2.33922,  2.63235,
+  1.29102,  1.38333,  1.80244,  1.88719,  2.24772,  2.66245,
+  1.26136,  1.37051,  1.75597,  1.87125,  2.1019,  2.59359,
+  1.28264,  1.37654,  1.77553,  1.9045,  2.19234,  2.50743,
+  1.36136,  1.45086,  1.79107,  1.90616,  2.2215,  2.54334,
+  1.33499,  1.43138,  1.71627,  1.90549,  2.0892,  2.37826,
+  1.38567,  1.47042,  1.7654,  1.90922,  2.17384,  2.45657,
+  1.36432,  1.45506,  1.75488,  1.87147,  2.36504,  2.57228,
+  1.38778,  1.48689,  1.71209,  1.8475,  2.24356,  2.57069,
+  1.31245,  1.42529,  1.62289,  1.75678,  1.97847,  2.36751,
+  1.3472,  1.45434,  1.68343,  1.82547,  2.08792,  2.46256,
+  1.32645,  1.40544,  1.72764,  1.83555,  2.32887,  2.61433,
+  1.33311,  1.42971,  1.79607,  1.90035,  2.44506,  2.65291,
+  1.3228,  1.42159,  1.73694,  1.8435,  2.53212,  2.64664,
+  1.34468,  1.43186,  1.76621,  1.92458,  2.55008,  2.68986,
+  1.38828,  1.48581,  1.71196,  1.82621,  2.49614,  2.65849,
+  1.41113,  1.49561,  1.77687,  1.87667,  2.49259,  2.65135,
+  1.41779,  1.49158,  1.80169,  1.89041,  2.44245,  2.70699,
+  1.40612,  1.51559,  1.75734,  1.89697,  2.38205,  2.63363,
+  1.42586,  1.51481,  1.77326,  1.90174,  2.44755,  2.63472,
+  1.47603,  1.55503,  1.74573,  1.86162,  2.39877,  2.61498,
+  1.45985,  1.56153,  1.78645,  1.91123,  2.47654,  2.59179,
+  1.40306,  1.51419,  1.72076,  1.90094,  2.48989,  2.57733,
+  1.42813,  1.52351,  1.68976,  1.83521,  2.4589,  2.56597,
+  1.32896,  1.43471,  1.60407,  1.73425,  2.4663,  2.56683,
+  1.24132,  1.34325,  1.458,  1.69662,  2.52782,  2.64566,
+  1.13662,  1.31113,  1.42996,  1.69536,  2.54253,  2.66041,
+  1.15311,  1.34414,  1.69081,  1.98593,  2.42001,  2.55378,
+  1.23176,  1.37392,  1.66882,  2.11744,  2.40191,  2.48888,
+  0.978581,  1.11559,  1.51713,  2.00053,  2.44902,  2.52602,
+  0.951081,  1.10796,  1.20861,  1.73722,  2.4743,  2.61185,
+  0.981806,  1.12784,  1.22059,  1.72099,  2.58653,  2.69889,
+  0.977554,  1.22407,  1.33776,  1.71327,  2.59337,  2.67541,
+  0.986078,  1.2604,  1.40744,  1.57149,  2.56942,  2.63175,
+  1.06877,  1.2094,  1.46443,  1.55798,  2.55135,  2.66975,
+  1.03419,  1.17431,  1.46726,  1.55529,  2.46049,  2.64226,
+  1.05663,  1.17869,  1.5099,  1.62154,  2.15303,  2.54053,
+  1.10894,  1.24024,  1.65138,  1.77854,  2.22761,  2.57195,
+  1.04085,  1.39778,  1.70963,  1.83002,  2.3987,  2.61895,
+  1.06308,  1.56403,  1.69554,  1.79469,  2.41902,  2.57735,
+  1.15665,  1.57989,  1.74299,  1.88897,  2.41901,  2.62687,
+  1.28215,  1.60467,  1.76982,  1.98481,  2.29053,  2.40855,
+  1.41496,  1.75259,  1.9379,  2.07679,  2.28769,  2.50228,
+  1.56159,  1.88269,  2.08718,  2.19987,  2.3986,  2.50906,
+  1.74177,  1.96305,  2.16108,  2.26221,  2.51606,  2.62613,
+  1.57955,  1.9163,  2.20167,  2.30168,  2.45849,  2.64834,
+  1.6562,  1.8493,  2.1017,  2.30217,  2.48776,  2.57383,
+  1.76171,  1.93589,  2.1671,  2.42309,  2.53131,  2.61977,
+  1.74734,  1.94646,  2.12972,  2.45212,  2.59171,  2.6811,
+  1.66477,  1.95071,  2.06484,  2.45292,  2.65328,  2.71998,
+  1.18212,  1.80699,  2.03181,  2.24045,  2.58934,  2.66695,
+  0.911793,  1.44443,  1.9382,  2.00954,  2.51885,  2.66242,
+  0.906235,  1.35395,  1.86014,  1.94894,  2.57034,  2.65373,
+  0.915756,  1.18244,  1.77937,  1.91835,  2.49518,  2.68524,
+  0.923262,  1.16808,  1.70545,  2.00799,  2.40124,  2.58442,
+  0.915338,  1.1961,  1.64118,  1.9578,  2.23516,  2.50251,
+  1.11694,  1.26915,  1.59747,  1.9508,  2.1291,  2.3925,
+  1.22715,  1.34423,  1.80926,  1.99916,  2.32077,  2.54577,
+  1.30788,  1.51797,  1.83234,  2.04216,  2.34776,  2.54341,
+  1.14291,  1.42748,  1.83152,  2.02229,  2.35648,  2.58964,
+  1.02021,  1.20271,  1.78017,  2.07079,  2.56583,  2.66165,
+  1.08785,  1.26596,  1.65328,  2.09396,  2.62566,  2.70924,
+  1.14659,  1.23417,  1.66629,  2.02225,  2.60572,  2.67625,
+  1.08906,  1.31141,  1.64715,  1.83385,  2.66668,  2.72276,
+  1.18839,  1.31996,  1.72568,  1.80695,  2.57119,  2.66417,
+  1.20957,  1.35804,  1.69743,  1.7942,  2.47045,  2.64023,
+  1.24605,  1.33829,  1.69554,  1.782,  2.56576,  2.66694,
+  1.26125,  1.38448,  1.61968,  1.77958,  2.5918,  2.71243,
+  1.33751,  1.45023,  1.64699,  1.77421,  2.57897,  2.70337,
+  1.38769,  1.4781,  1.61892,  1.74728,  2.53199,  2.6657,
+  1.30178,  1.39264,  1.54187,  1.66565,  2.48454,  2.65506,
+  1.25701,  1.39883,  1.52736,  1.73414,  2.61953,  2.68968,
+  1.21116,  1.32426,  1.66434,  1.91151,  2.58934,  2.68525,
+  1.11303,  1.32541,  1.6977,  1.94018,  2.59112,  2.67963,
+  1.00034,  1.35223,  1.71949,  2.02479,  2.57766,  2.6391,
+  0.952537,  1.56466,  1.91458,  2.02111,  2.48126,  2.55357,
+  0.94138,  1.57337,  1.89848,  1.99082,  2.3884,  2.52782,
+  0.835656,  1.42686,  1.9149,  2.0063,  2.45584,  2.54443,
+  0.762518,  1.61797,  1.84816,  1.95272,  2.51168,  2.57689,
+  0.760103,  1.72025,  1.88404,  1.9725,  2.52618,  2.66897,
+  0.788105,  1.51594,  1.76089,  1.95372,  2.49866,  2.5539,
+  0.84239,  1.23509,  1.68744,  2.01111,  2.39147,  2.52955,
+  0.970555,  1.30488,  1.68991,  2.0601,  2.38601,  2.52427,
+  1.07851,  1.22081,  1.63039,  2.10393,  2.41141,  2.5183,
+  1.03513,  1.37429,  1.73952,  2.01539,  2.38354,  2.54289,
+  1.23277,  1.46612,  1.94288,  2.1126,  2.35987,  2.47684,
+  1.03214,  1.46016,  1.84361,  2.11132,  2.40561,  2.54561,
+  0.863004,  1.57537,  1.75434,  2.02642,  2.48406,  2.54587,
+  0.78188,  1.62113,  1.87611,  2.13162,  2.59115,  2.66521,
+  0.689257,  1.56767,  1.95132,  2.24673,  2.50779,  2.64996,
+  0.76292,  1.45451,  2.05214,  2.23995,  2.40891,  2.57038,
+  0.735313,  1.36954,  2.14112,  2.22674,  2.40426,  2.51585,
+  0.692794,  1.21322,  2.02173,  2.17001,  2.40979,  2.63261,
+  0.749191,  1.32741,  1.8763,  2.15981,  2.39637,  2.54356,
+  0.723514,  1.31193,  1.77912,  2.00099,  2.33306,  2.52163,
+  0.800844,  1.39933,  1.70253,  1.88677,  2.1838,  2.39184,
+  0.935365,  1.5324,  1.7461,  1.84327,  2.02788,  2.36693,
+  0.879717,  1.39098,  1.69669,  1.87323,  2.27339,  2.53295,
+  1.11563,  1.39538,  1.55249,  2.06254,  2.37975,  2.48566,
+  1.25346,  1.37982,  1.72652,  2.1649,  2.38685,  2.50781,
+  1.28865,  1.54861,  1.76922,  2.10614,  2.42884,  2.5175,
+  1.36965,  1.61115,  1.79367,  1.97047,  2.36765,  2.55804,
+  1.39903,  1.69493,  1.86562,  2.03676,  2.40916,  2.58643,
+  1.43333,  1.74573,  1.93073,  2.15938,  2.42655,  2.57904,
+  1.26759,  1.66587,  1.97138,  2.10332,  2.44452,  2.56774,
+  1.22612,  1.49722,  1.88861,  2.08359,  2.54785,  2.62348,
+  1.21786,  1.50232,  1.85015,  1.97391,  2.50602,  2.62557,
+  1.21379,  1.59537,  1.87504,  1.97942,  2.42715,  2.60646,
+  1.23975,  1.51387,  1.76668,  1.94793,  2.28162,  2.49207,
+  1.24763,  1.58563,  1.72974,  1.8947,  2.38196,  2.52212,
+  1.20115,  1.47447,  1.74657,  1.83424,  2.28973,  2.52518,
+  1.18147,  1.55532,  1.7036,  1.82308,  2.31583,  2.44389,
+  1.19633,  1.57376,  1.73522,  1.80803,  2.4035,  2.55724,
+  1.14908,  1.63161,  1.76916,  1.92557,  2.36812,  2.54281,
+  1.07109,  1.63355,  1.76134,  1.87247,  2.40846,  2.57352,
+  1.06523,  1.55174,  1.71341,  1.88049,  2.38743,  2.51216,
+  0.987564,  1.63573,  1.78594,  1.95671,  2.4134,  2.54862,
+  0.931677,  1.52646,  1.77301,  1.89696,  2.43796,  2.5139,
+  0.900322,  1.64588,  1.78798,  2.04104,  2.33427,  2.43459,
+  0.867303,  1.71472,  1.90161,  2.09919,  2.3871,  2.47589,
+  0.868278,  1.69374,  1.9173,  2.01308,  2.2746,  2.38253,
+  0.848816,  1.56719,  1.82901,  1.92983,  2.3394,  2.42562,
+  0.789452,  1.36929,  1.82686,  1.91727,  2.41428,  2.50207,
+  0.737031,  1.1733,  1.87303,  1.97283,  2.45513,  2.54124,
+  0.759015,  1.25073,  1.78111,  1.99463,  2.42044,  2.55494,
+  0.749485,  1.36394,  1.89637,  1.99357,  2.44226,  2.50985,
+  0.749379,  1.21466,  1.94066,  2.03408,  2.45072,  2.5683,
+  0.801242,  1.26916,  1.8709,  1.95599,  2.40516,  2.47386,
+  0.82329,  1.25895,  1.87986,  2.0697,  2.41177,  2.5101,
+  0.836531,  1.27393,  1.9573,  2.04747,  2.49016,  2.58229,
+  0.834116,  1.18388,  1.88646,  1.96919,  2.49948,  2.60434,
+  0.876413,  1.17115,  1.94662,  2.0309,  2.43135,  2.55301,
+  0.839364,  1.05611,  1.85364,  2.10059,  2.39261,  2.55434,
+  0.864173,  1.16468,  1.83549,  1.96885,  2.37631,  2.5161,
+  0.932804,  1.29457,  1.83095,  1.90104,  2.44527,  2.55257,
+  0.963048,  1.35686,  1.76883,  1.89322,  2.47992,  2.61467,
+  1.03707,  1.35972,  1.82081,  1.89105,  2.51931,  2.60502,
+  1.06061,  1.46234,  1.79795,  1.93929,  2.52187,  2.59188,
+  1.07992,  1.50417,  1.80221,  1.93053,  2.46514,  2.5432,
+  1.14011,  1.33906,  1.81335,  1.90531,  2.37007,  2.53042,
+  1.15187,  1.35617,  1.77236,  1.88371,  2.37001,  2.61081,
+  1.28808,  1.63863,  1.75106,  2.27992,  2.55539,  2.62328,
+  1.45144,  1.73949,  1.9164,  2.3887,  2.63615,  2.70283,
+  1.59125,  1.85154,  2.21828,  2.38549,  2.59375,  2.67943,
+  1.59226,  2.01614,  2.2338,  2.33376,  2.54482,  2.66517,
+  1.6542,  1.94158,  2.25097,  2.37237,  2.4589,  2.59983,
+  1.70325,  2.0255,  2.2296,  2.3371,  2.46858,  2.61766,
+  1.63882,  2.00556,  2.20195,  2.26846,  2.49954,  2.61841,
+  1.92467,  2.13532,  2.45818,  2.50417,  2.59384,  2.6254,
+  1.80381,  2.06257,  2.19935,  2.28946,  2.55004,  2.64392,
+  1.77301,  1.97662,  2.10757,  2.22087,  2.44498,  2.54384,
+  1.76495,  2.00173,  2.21445,  2.2547,  2.47561,  2.57975,
+  1.67833,  1.86391,  2.24464,  2.34367,  2.47113,  2.63609,
+  1.75581,  1.86025,  2.22372,  2.35306,  2.4983,  2.58668,
+  1.69343,  1.86924,  2.2833,  2.3958,  2.51974,  2.58367,
+  1.7044,  1.79121,  2.14719,  2.33645,  2.47903,  2.59089,
+  1.68326,  1.86225,  2.16334,  2.35184,  2.52091,  2.61603,
+  1.62322,  1.80421,  2.22207,  2.3603,  2.6199,  2.69951,
+  1.65724,  1.82561,  2.25849,  2.34735,  2.54573,  2.69471,
+  1.66007,  1.86034,  2.25357,  2.36412,  2.56409,  2.63073,
+  1.5969,  1.83951,  2.21893,  2.38579,  2.54647,  2.62589,
+  1.62232,  1.8512,  1.99621,  2.3774,  2.52207,  2.59549,
+  1.02947,  1.25453,  1.74899,  2.05352,  2.44588,  2.57611,
+  0.856689,  0.993818,  1.56961,  2.21376,  2.46185,  2.54708,
+  1.01658,  1.1919,  1.29347,  1.77814,  2.4558,  2.55165,
+  1.01054,  1.22815,  1.31143,  1.82028,  2.53151,  2.65675,
+  0.908278,  1.18958,  1.28554,  1.8586,  2.52592,  2.61992,
+  0.871987,  1.17192,  1.31749,  1.82652,  2.40074,  2.51809,
+  1.03312,  1.18885,  1.4397,  2.03901,  2.57242,  2.6561,
+  0.970197,  1.29563,  1.40244,  2.03504,  2.48818,  2.54989,
+  1.0882,  1.22065,  1.55306,  2.13338,  2.5357,  2.59506,
+  1.00995,  1.3898,  1.51706,  2.11522,  2.47419,  2.55069,
+  0.993372,  1.42737,  1.53917,  1.9724,  2.52584,  2.58386,
+  1.04829,  1.48208,  1.63718,  2.16108,  2.52317,  2.61471,
+  1.02433,  1.56286,  1.69224,  2.29516,  2.59484,  2.64857,
+  0.907692,  1.61256,  1.74613,  2.16254,  2.57575,  2.61626,
+  0.890482,  1.61113,  1.77393,  1.97073,  2.57775,  2.6596,
+  0.808392,  1.5978,  1.78596,  2.0064,  2.56504,  2.63896,
+  0.766474,  1.58442,  1.83584,  1.92974,  2.58154,  2.64107,
+  0.769957,  1.62677,  1.86926,  2.02945,  2.60278,  2.66048,
+  0.798945,  1.53186,  1.83489,  1.94653,  2.62826,  2.69262,
+  0.720628,  1.38023,  1.8176,  1.89535,  2.54776,  2.6072,
+  0.717991,  1.30127,  1.75327,  1.88057,  2.50111,  2.57068,
+  0.757538,  1.19751,  1.71932,  1.8634,  2.4672,  2.58075,
+  0.753702,  1.29247,  1.69185,  1.7758,  2.47259,  2.58378,
+  0.814552,  1.2342,  1.58385,  1.68828,  2.54626,  2.60138,
+  0.892573,  1.25942,  1.54867,  1.62871,  2.46518,  2.55748,
+  0.949846,  1.26057,  1.42925,  1.62028,  2.39675,  2.4574,
+  1.0353,  1.2441,  1.49824,  1.64392,  2.38137,  2.52433,
+  1.10807,  1.33757,  1.53819,  1.80059,  2.51358,  2.61769,
+  1.18254,  1.37047,  1.56189,  1.84416,  2.54573,  2.61445,
+  1.21527,  1.3744,  1.59539,  1.9408,  2.51228,  2.59416,
+  1.23283,  1.3567,  1.64836,  2.04066,  2.51833,  2.60689,
+  1.29553,  1.441,  1.62601,  2.06359,  2.53545,  2.6072,
+  1.31746,  1.48417,  1.66663,  2.1072,  2.50946,  2.56956,
+  1.28814,  1.40484,  1.70844,  2.1424,  2.47826,  2.55815,
+  1.30118,  1.49063,  1.68866,  2.20974,  2.51657,  2.5826,
+  1.38891,  1.4886,  1.75307,  2.24911,  2.46845,  2.53274,
+  1.43236,  1.50195,  1.75604,  2.22738,  2.54031,  2.63382,
+  1.27063,  1.44425,  1.69718,  2.16774,  2.57417,  2.66708,
+  1.37795,  1.51182,  1.61924,  2.07059,  2.58057,  2.65545,
+  1.31909,  1.43763,  1.57516,  1.82626,  2.5685,  2.64694,
+  1.27334,  1.43938,  1.61468,  1.97782,  2.58918,  2.64227,
+  1.36481,  1.49144,  1.65464,  1.9149,  2.27758,  2.49171,
+  1.3814,  1.48233,  1.6257,  1.76745,  2.29282,  2.53541,
+  1.31612,  1.4108,  1.57452,  1.6965,  2.24155,  2.54414,
+  1.24921,  1.44841,  1.65161,  1.81201,  2.16694,  2.52883,
+  1.32999,  1.4301,  1.63778,  1.7537,  2.14427,  2.49173,
+  1.21201,  1.46018,  1.66372,  1.72397,  2.45273,  2.65487,
+  1.15467,  1.42799,  1.63984,  1.70382,  2.52478,  2.64719,
+  1.13219,  1.27638,  1.63819,  1.75073,  2.36014,  2.63024,
+  1.1068,  1.2922,  1.56399,  1.73715,  2.27638,  2.67348,
+  1.00947,  1.4092,  1.60525,  1.75588,  2.54981,  2.6669,
+  0.849242,  1.42476,  1.60734,  1.77047,  2.59306,  2.69757,
+  0.884126,  1.41867,  1.69054,  1.91036,  2.64889,  2.75356,
+  0.835786,  1.50533,  1.65083,  1.83983,  2.66751,  2.73182,
+  0.830887,  1.41843,  1.69822,  1.81279,  2.54661,  2.60518,
+  0.770144,  1.45618,  1.73535,  1.83979,  2.48532,  2.53941,
+  0.741204,  1.4612,  1.72026,  2.03966,  2.61315,  2.65662,
+  0.746126,  1.43606,  1.67492,  1.86887,  2.61646,  2.6596,
+  0.785082,  1.34349,  1.67545,  1.75655,  2.55005,  2.61191,
+  0.745773,  1.35482,  1.63002,  1.93899,  2.4536,  2.54908,
+  0.84578,  1.46925,  1.62908,  1.97497,  2.49928,  2.54978,
+  0.949421,  1.46277,  1.57299,  2.28604,  2.54958,  2.60293,
+  1.02515,  1.38536,  1.64839,  2.19293,  2.44063,  2.53102,
+  1.03372,  1.43617,  1.74409,  2.13226,  2.54404,  2.6189,
+  1.08284,  1.45584,  1.59799,  2.00309,  2.62826,  2.73613,
+  1.02162,  1.3808,  1.5378,  2.00792,  2.65618,  2.72548,
+  0.934605,  1.33831,  1.72128,  2.02138,  2.45266,  2.63594,
+  0.974987,  1.2806,  1.74048,  1.98864,  2.38339,  2.58854,
+  0.963572,  1.35863,  1.77509,  2.07708,  2.37441,  2.55255,
+  1.33939,  1.60607,  1.94104,  2.1598,  2.44654,  2.58731,
+  1.26864,  1.60406,  1.94006,  2.17892,  2.48766,  2.5975,
+  1.12981,  1.52262,  1.87297,  2.07507,  2.47971,  2.63317,
+  1.13535,  1.4223,  1.86599,  1.94531,  2.52336,  2.68614,
+  1.13554,  1.56227,  1.76815,  1.92201,  2.50605,  2.73613,
+  1.17333,  1.63762,  1.8454,  1.97453,  2.37951,  2.62759,
+  1.22309,  1.47716,  1.79951,  1.94529,  2.6037,  2.69777,
+  1.28565,  1.78142,  1.97253,  2.33525,  2.64962,  2.71925,
+  1.51607,  1.86247,  2.08499,  2.38614,  2.56337,  2.65052,
+  1.62251,  1.80088,  2.07468,  2.3711,  2.4941,  2.60895,
+  1.64422,  1.73091,  2.23525,  2.34462,  2.4606,  2.62177,
+  1.64649,  1.74384,  2.11867,  2.33454,  2.48765,  2.5973,
+  1.57447,  1.66694,  2.16568,  2.29463,  2.46302,  2.64293,
+  1.56853,  1.66268,  2.06838,  2.24007,  2.37478,  2.53429,
+  1.50109,  1.67557,  2.0192,  2.25394,  2.40396,  2.56021,
+  1.33322,  1.48186,  1.81038,  2.03244,  2.23527,  2.46402,
+  1.18419,  1.37647,  1.74307,  2.07718,  2.24737,  2.43664,
+  0.860298,  1.01797,  1.39947,  2.03136,  2.44583,  2.51204,
+  0.987543,  1.18722,  1.32467,  2.08656,  2.44026,  2.50786,
+  0.987539,  1.05739,  1.40051,  2.29103,  2.46201,  2.53454,
+  1.07257,  1.16846,  1.33543,  2.28155,  2.59528,  2.64199,
+  1.04242,  1.21947,  1.32875,  2.10439,  2.48141,  2.54485,
+  1.07584,  1.20487,  1.37029,  2.20656,  2.50952,  2.5572,
+  1.07591,  1.18808,  1.41434,  2.3201,  2.53091,  2.58942,
+  1.07615,  1.2674,  1.41198,  2.21842,  2.45229,  2.54095,
+  1.15455,  1.31481,  1.50039,  2.30097,  2.50519,  2.56979,
+  1.17038,  1.30037,  1.47778,  2.20108,  2.41823,  2.51101,
+  1.16483,  1.29078,  1.43643,  2.04217,  2.4346,  2.51715,
+  1.19386,  1.29319,  1.52759,  2.00881,  2.37081,  2.47326,
+  1.26354,  1.38567,  1.59613,  2.04876,  2.42779,  2.50408,
+  1.30519,  1.42101,  1.65888,  2.09585,  2.42943,  2.51858,
+  1.3783,  1.49436,  1.71028,  2.07804,  2.47796,  2.55948,
+  1.33373,  1.47526,  1.67404,  2.03963,  2.44671,  2.52705,
+  1.34615,  1.46853,  1.67367,  1.96109,  2.4626,  2.56716,
+  1.32426,  1.4669,  1.74709,  2.00944,  2.48056,  2.57128,
+  1.30692,  1.41105,  1.74078,  2.0324,  2.46634,  2.57579,
+  1.2773,  1.40831,  1.71568,  1.95693,  2.50597,  2.5973,
+  1.23917,  1.40986,  1.63569,  1.84314,  2.51134,  2.59249,
+  1.26227,  1.3779,  1.66588,  1.78528,  2.41492,  2.5191,
+  1.22377,  1.37861,  1.70694,  1.81201,  2.47211,  2.5535,
+  1.24828,  1.56097,  1.68845,  2.02442,  2.46468,  2.53208,
+  1.55115,  1.67483,  1.86392,  2.2426,  2.42567,  2.51231,
+  1.61354,  1.73636,  1.91583,  2.28434,  2.5051,  2.5755,
+  1.67565,  1.76455,  2.01326,  2.3086,  2.47931,  2.57088,
+  1.67679,  1.73219,  2.21691,  2.35074,  2.51681,  2.58494,
+  1.67209,  1.76809,  2.1703,  2.27753,  2.41116,  2.49253,
+  1.64585,  1.88123,  2.21635,  2.32063,  2.46081,  2.56493,
+  1.71409,  1.93321,  2.22012,  2.3277,  2.45303,  2.55743,
+  1.86416,  1.9656,  2.21189,  2.35407,  2.45155,  2.5437,
+  1.84051,  1.9809,  2.14136,  2.27592,  2.48783,  2.60703,
+  1.28163,  1.50854,  1.87809,  2.15331,  2.51039,  2.59772,
+  1.28594,  1.55852,  1.89593,  2.1545,  2.51005,  2.62888,
+  1.1797,  1.45797,  1.80582,  2.0887,  2.53683,  2.64835,
+  1.21318,  1.47414,  1.79648,  1.88639,  2.42644,  2.59714,
+  1.17576,  1.56663,  1.7868,  1.95963,  2.44398,  2.62181,
+  1.24128,  1.49554,  1.77294,  1.95943,  2.51364,  2.61189,
+  1.25286,  1.54735,  1.7413,  1.87367,  2.44728,  2.67464,
+  1.23425,  1.43703,  1.74215,  1.83575,  2.37217,  2.58149,
+  1.2624,  1.35128,  1.71028,  1.83349,  2.30891,  2.5836,
+  1.33086,  1.4241,  1.67389,  1.80298,  2.27185,  2.55676,
+  1.37492,  1.47319,  1.70336,  1.80452,  2.37449,  2.62583,
+  1.35042,  1.47764,  1.74193,  1.86958,  2.46816,  2.63785,
+  1.29945,  1.40927,  1.70733,  1.82882,  2.41262,  2.66007,
+  1.28367,  1.41318,  1.69401,  1.91384,  2.235,  2.66336,
+  1.13135,  1.54545,  1.7382,  1.92713,  2.24255,  2.52954,
+  1.3104,  1.44532,  1.80081,  1.94176,  2.22418,  2.4307,
+  1.20782,  1.40771,  1.79229,  1.89783,  2.27858,  2.58879,
+  1.17208,  1.38037,  1.76961,  1.87071,  2.42071,  2.66541,
+  1.05037,  1.29292,  1.70868,  1.81557,  2.3983,  2.64784,
+  1.0122,  1.35284,  1.71047,  1.79843,  2.50105,  2.62211,
+  0.949688,  1.51131,  1.80223,  2.05177,  2.38659,  2.54393,
+  1.23953,  1.52331,  1.99264,  2.17592,  2.53584,  2.66332,
+  1.17041,  1.42396,  1.91809,  2.07296,  2.37133,  2.60069,
+  1.15328,  1.63164,  1.94366,  2.04139,  2.42629,  2.52794,
+  1.13099,  1.68734,  1.9131,  1.98242,  2.36664,  2.59216,
+  0.876015,  1.53912,  1.95282,  2.04039,  2.35419,  2.59247,
+  0.741027,  1.33078,  2.01026,  2.08898,  2.40638,  2.51241,
+  0.692068,  1.22098,  1.96684,  2.05317,  2.52761,  2.62537,
+  0.697907,  1.40678,  2.01601,  2.08582,  2.57318,  2.65234,
+  0.747161,  1.54248,  1.98219,  2.09109,  2.57331,  2.6146,
+  0.759939,  1.51811,  1.93822,  2.16296,  2.53435,  2.63909,
+  0.752015,  1.44593,  2.09774,  2.15063,  2.47989,  2.58714,
+  0.80419,  1.42852,  2.01245,  2.19581,  2.47075,  2.57726,
+  0.757784,  1.35654,  1.87818,  2.23225,  2.531,  2.6303,
+  0.782189,  1.2517,  1.76691,  2.20655,  2.56445,  2.6177,
+  0.692136,  1.30829,  1.59302,  1.84293,  2.50433,  2.65265,
+  0.779817,  1.26499,  1.68969,  1.80369,  2.5305,  2.66946,
+  0.774734,  1.19962,  1.64959,  1.72658,  2.4371,  2.59153,
+  0.885025,  1.31194,  1.64647,  1.73919,  2.57872,  2.67199,
+  0.949387,  1.38711,  1.64193,  1.76257,  2.52877,  2.58579,
+  1.01204,  1.45536,  1.66673,  1.75258,  2.43427,  2.55352,
+  1.10407,  1.52937,  1.68209,  1.97304,  2.34551,  2.51158,
+  1.424,  1.61941,  1.99551,  2.29891,  2.43078,  2.52129,
+  1.58246,  1.83207,  2.2751,  2.38313,  2.4828,  2.53932,
+  1.70637,  2.00167,  2.30003,  2.39481,  2.48697,  2.58695,
+  1.53226,  1.93376,  2.28401,  2.42231,  2.62294,  2.70604,
+  1.67894,  1.88906,  2.33897,  2.51297,  2.63237,  2.6795,
+  1.63441,  1.78371,  2.12418,  2.463,  2.61035,  2.69136,
+  1.61835,  1.75102,  2.02613,  2.41802,  2.6094,  2.67895,
+  1.5652,  1.7943,  1.90207,  2.40566,  2.62933,  2.69687,
+  1.28214,  1.59125,  1.85203,  2.31423,  2.61778,  2.72294,
+  1.22037,  1.42168,  1.69434,  1.88174,  2.5568,  2.65318,
+  1.1394,  1.29901,  1.62237,  1.77043,  2.54387,  2.6407,
+  1.21449,  1.46742,  1.62803,  1.79401,  2.56341,  2.6917,
+  1.05963,  1.52181,  1.63195,  1.86516,  2.60104,  2.68366,
+  1.1802,  1.53659,  1.67186,  2.13796,  2.58765,  2.63839,
+  1.21365,  1.58211,  1.7095,  2.15751,  2.4768,  2.57401,
+  1.24846,  1.55305,  1.6453,  1.89754,  2.57776,  2.68128,
+  1.34058,  1.60143,  1.67999,  1.88914,  2.64709,  2.75513,
+  1.19455,  1.57556,  1.69753,  1.80137,  2.59652,  2.75237,
+  1.15299,  1.53138,  1.71641,  1.81272,  2.41715,  2.69646,
+  1.17528,  1.56527,  1.65742,  1.73478,  2.51798,  2.67121,
+  1.31588,  1.51598,  1.77517,  2.05808,  2.3073,  2.4493,
+  1.24713,  1.38127,  1.56836,  1.85701,  2.15728,  2.43501,
+  1.24025,  1.38365,  1.58057,  1.99147,  2.30357,  2.41106,
+  1.2868,  1.38585,  1.7307,  2.06754,  2.32691,  2.47304,
+  1.20411,  1.33789,  1.66549,  2.03875,  2.23142,  2.5434,
+  1.18234,  1.31211,  1.52226,  1.97103,  2.23777,  2.48363,
+  1.09543,  1.31991,  1.46571,  2.03259,  2.27994,  2.52364,
+  1.1525,  1.29451,  1.45831,  2.03253,  2.30603,  2.40676,
+  0.991441,  1.27466,  1.42822,  1.94058,  2.3991,  2.50937,
+  0.850157,  1.27472,  1.45373,  1.89353,  2.38229,  2.47766,
+  0.93606,  1.31321,  1.42674,  1.88897,  2.55174,  2.60439,
+  0.972592,  1.32833,  1.43283,  2.01105,  2.57367,  2.61367,
+  0.9094,  1.42276,  1.49463,  2.07395,  2.62063,  2.66268,
+  0.828475,  1.4317,  1.56949,  2.05425,  2.62211,  2.66974,
+  0.779249,  1.37567,  1.47663,  1.94919,  2.559,  2.62214,
+  0.81571,  1.47269,  1.65049,  2.00091,  2.56521,  2.61168,
+  0.822357,  1.33351,  1.55165,  1.86418,  2.59585,  2.70612,
+  0.736497,  1.25989,  1.49082,  1.88222,  2.49441,  2.61998,
+  0.90224,  1.431,  1.5205,  1.91079,  2.6054,  2.67859,
+  0.900488,  1.36305,  1.46181,  2.00977,  2.66588,  2.71718,
+  1.01539,  1.36153,  1.47485,  1.92044,  2.63748,  2.70257,
+  0.950918,  1.33518,  1.44088,  1.87435,  2.67892,  2.74624,
+  0.965674,  1.30691,  1.41289,  1.72718,  2.65632,  2.73947,
+  1.12134,  1.29133,  1.41298,  1.73139,  2.62458,  2.736,
+  1.13549,  1.29997,  1.44863,  1.63579,  2.61671,  2.68774,
+  1.12041,  1.2482,  1.38368,  1.57976,  2.39717,  2.58524,
+  1.11342,  1.2945,  1.48237,  1.60279,  2.39483,  2.63481,
+  1.24175,  1.31817,  1.47317,  1.5775,  2.426,  2.64978,
+  1.18438,  1.27289,  1.49775,  1.60805,  2.14445,  2.53727,
+  1.28314,  1.37732,  1.54304,  1.64518,  2.10579,  2.4909,
+  1.13801,  1.38076,  1.56048,  1.64098,  2.27101,  2.62552,
+  1.24388,  1.35154,  1.60307,  1.73979,  2.03808,  2.44751,
+  1.26726,  1.50996,  1.64165,  1.83198,  2.33133,  2.47283,
+  1.27637,  1.4764,  1.62502,  1.93034,  2.31938,  2.52437,
+  1.22268,  1.55941,  1.66998,  1.80547,  2.32691,  2.58028,
+  1.26522,  1.50389,  1.83098,  2.09154,  2.39672,  2.56909,
+  1.25605,  1.52888,  1.85303,  2.10617,  2.36514,  2.50328,
+  1.2365,  1.47912,  1.7283,  2.04146,  2.52856,  2.6129,
+  1.22064,  1.60519,  1.71377,  1.95092,  2.59764,  2.64949,
+  1.25555,  1.59187,  1.70675,  2.06271,  2.56138,  2.6269,
+  1.30708,  1.58002,  1.65355,  1.94129,  2.55273,  2.64371,
+  1.31097,  1.5128,  1.65653,  1.83919,  2.5921,  2.67771,
+  1.1886,  1.31608,  1.57937,  1.69077,  2.4385,  2.64188,
+  1.11467,  1.23599,  1.59197,  1.74919,  2.35944,  2.54521,
+  1.08007,  1.27713,  1.728,  2.04141,  2.33707,  2.54979,
+  1.03222,  1.25021,  1.681,  1.99834,  2.31853,  2.5022,
+  1.06472,  1.15918,  1.66673,  2.01929,  2.25657,  2.57347,
+  1.02631,  1.14637,  1.67293,  2.05406,  2.43323,  2.61572,
+  0.942929,  1.09279,  1.61352,  2.07778,  2.36514,  2.49974,
+  0.98025,  1.25478,  1.492,  1.80119,  2.44532,  2.57571,
+  0.957395,  1.25187,  1.37834,  1.74457,  2.50297,  2.66587,
+  0.840336,  1.26799,  1.39773,  1.82798,  2.55587,  2.65128,
+  1.0099,  1.17581,  1.27777,  2.04836,  2.6379,  2.7009,
+  0.88384,  1.02678,  1.14669,  1.89368,  2.51869,  2.61056,
+  0.997171,  1.13829,  1.24641,  1.83753,  2.54982,  2.64269,
+  0.992125,  1.17887,  1.28227,  1.9744,  2.55911,  2.61297,
+  1.06759,  1.2558,  1.35902,  1.96394,  2.54142,  2.59631,
+  1.08633,  1.32907,  1.43233,  1.92884,  2.52833,  2.59824,
+  1.10035,  1.34558,  1.46953,  1.94236,  2.46972,  2.56168,
+  1.10102,  1.37438,  1.56114,  1.94256,  2.48429,  2.553,
+  1.1775,  1.45517,  1.57149,  1.9435,  2.50031,  2.5509,
+  1.26077,  1.4779,  1.60161,  2.02402,  2.48743,  2.55424,
+  1.21644,  1.47008,  1.6396,  1.95721,  2.52383,  2.58819,
+  1.25798,  1.4072,  1.65143,  1.91072,  2.4642,  2.62087,
+  1.16209,  1.43654,  1.68217,  1.89692,  2.4473,  2.67707,
+  1.25022,  1.48463,  1.65387,  1.93047,  2.49389,  2.63344,
+  1.23798,  1.51339,  1.64878,  1.88034,  2.50409,  2.58149,
+  1.2232,  1.41246,  1.63408,  1.79718,  2.45121,  2.62062,
+  1.25874,  1.3584,  1.62772,  1.7261,  2.42829,  2.62133,
+  1.23492,  1.34561,  1.55215,  1.70868,  2.38574,  2.60605,
+  1.18642,  1.34181,  1.63691,  1.75468,  2.42972,  2.54439,
+  1.21626,  1.30589,  1.63278,  1.75577,  2.32081,  2.58379,
+  1.16534,  1.28415,  1.56053,  1.68204,  2.24322,  2.49467,
+  1.08586,  1.21511,  1.5906,  1.71533,  2.23163,  2.52723,
+  1.09165,  1.38416,  1.65516,  1.71656,  2.30278,  2.53555,
+  1.06033,  1.23908,  1.62721,  1.73757,  2.42016,  2.59915,
+  1.09008,  1.39478,  1.68248,  1.7999,  2.33181,  2.53286,
+  1.16904,  1.56812,  1.78572,  2.03155,  2.37221,  2.49786,
+  1.2419,  1.66208,  1.82249,  2.16954,  2.42454,  2.52519,
+  1.04029,  1.69041,  1.8531,  2.03859,  2.47201,  2.53597,
+  0.974879,  1.68906,  1.85014,  2.15131,  2.50742,  2.56254,
+  0.879683,  1.74384,  1.96806,  2.16115,  2.46392,  2.54585,
+  0.790116,  1.79441,  2.0373,  2.15974,  2.5084,  2.56488,
+  0.793374,  1.79617,  2.06052,  2.33107,  2.5913,  2.64858,
+  0.859332,  1.80046,  2.02545,  2.20064,  2.53432,  2.61132,
+  0.825206,  1.89513,  2.06358,  2.26453,  2.51403,  2.6108,
+  0.974068,  1.90478,  2.00264,  2.31585,  2.53967,  2.59516,
+  0.961311,  1.82128,  2.01521,  2.27454,  2.60079,  2.65336,
+  0.97104,  1.73701,  1.91495,  2.2439,  2.57236,  2.6126,
+  0.999552,  1.8179,  1.9531,  2.17859,  2.57433,  2.62628,
+  0.9773,  1.75604,  1.92914,  2.13535,  2.42421,  2.55609,
+  1.06554,  1.74764,  1.89917,  2.30975,  2.58739,  2.63059,
+  1.07706,  1.65572,  1.86833,  2.2386,  2.50891,  2.57184,
+  1.07783,  1.71642,  1.79146,  2.26622,  2.61548,  2.65405,
+  1.27602,  1.71338,  1.78883,  2.10144,  2.62562,  2.67959,
+  1.26317,  1.69909,  1.77693,  2.03511,  2.61035,  2.65342,
+  1.29714,  1.66767,  1.74401,  2.03012,  2.60806,  2.67807,
+  1.26237,  1.62646,  1.78116,  2.02618,  2.63626,  2.69918,
+  1.31803,  1.65777,  1.76358,  1.93904,  2.57545,  2.70561,
+  0.980669,  1.55589,  1.72298,  1.97855,  2.56896,  2.63842,
+  0.840013,  1.4634,  1.77278,  2.16486,  2.56689,  2.66623,
+  0.832158,  1.50575,  1.93789,  2.23397,  2.63013,  2.69488,
+  0.745541,  1.5301,  2.06073,  2.163,  2.61913,  2.69213,
+  0.83205,  1.59799,  2.12768,  2.19666,  2.52887,  2.6193,
+  0.820544,  1.61648,  2.04484,  2.13356,  2.58766,  2.66815,
+  0.789348,  1.63857,  1.99603,  2.2128,  2.57293,  2.61543,
+  0.806795,  1.74253,  2.04392,  2.18384,  2.60341,  2.66027,
+  0.843597,  1.76138,  1.99882,  2.13297,  2.5965,  2.67316,
+  0.927714,  1.7594,  1.98717,  2.20199,  2.59168,  2.65081,
+  1.0705,  1.76711,  1.97829,  2.22719,  2.6427,  2.68638,
+  1.02285,  1.85683,  1.98982,  2.21722,  2.48094,  2.57469,
+  0.886409,  1.74269,  1.86307,  2.0549,  2.54233,  2.62705,
+  0.996501,  1.55364,  1.80806,  1.94851,  2.51673,  2.60575,
+  1.21822,  1.52501,  1.87802,  2.1072,  2.42395,  2.57889,
+  1.27471,  1.49178,  1.90624,  2.10124,  2.45572,  2.56357,
+  1.31948,  1.58708,  1.87982,  2.24044,  2.43946,  2.54799,
+  1.47451,  1.699,  1.92926,  2.22822,  2.45187,  2.56313,
+  1.54527,  1.72271,  1.8921,  2.16916,  2.52024,  2.60296,
+  1.54616,  1.66889,  1.96149,  2.21208,  2.506,  2.62127,
+  1.53562,  1.69929,  2.01636,  2.25082,  2.55009,  2.64562,
+  1.58341,  1.68775,  2.05195,  2.33263,  2.49172,  2.59804,
+  1.50093,  1.59405,  1.92923,  2.25985,  2.42262,  2.54776,
+  1.46492,  1.61478,  1.8817,  2.21673,  2.52895,  2.62322,
+  1.40673,  1.60503,  1.80598,  2.22272,  2.50901,  2.58784,
+  1.10642,  1.52778,  1.73018,  2.04592,  2.54946,  2.6375,
+  1.00815,  1.43972,  1.66547,  1.94137,  2.65244,  2.7511,
+  0.971347,  1.40208,  1.7089,  1.95327,  2.61333,  2.68499,
+  0.946352,  1.50104,  1.67215,  1.97587,  2.5279,  2.58557,
+  0.909229,  1.45358,  1.7139,  2.06564,  2.52931,  2.61316,
+  0.975079,  1.52329,  1.83956,  2.13855,  2.49869,  2.58372,
+  0.899524,  1.55241,  1.83164,  2.06857,  2.54488,  2.61118,
+  0.805175,  1.46233,  1.86054,  2.10134,  2.57044,  2.65485,
+  0.859011,  1.51453,  1.8924,  2.01252,  2.57968,  2.64852,
+  0.763528,  1.52243,  1.90254,  2.01852,  2.55645,  2.60958,
+  0.814387,  1.49485,  1.94172,  2.07798,  2.54033,  2.61284,
+  0.853805,  1.40187,  1.94299,  2.08809,  2.48839,  2.57861,
+  0.782036,  1.34855,  1.9353,  2.02508,  2.51682,  2.59805,
+  0.754386,  1.38495,  1.90024,  1.99966,  2.60037,  2.66376,
+  0.746921,  1.42114,  1.93457,  2.03891,  2.55327,  2.6123,
+  0.731911,  1.45076,  1.92451,  2.03274,  2.4979,  2.55649,
+  0.706741,  1.54373,  1.8766,  1.99252,  2.51018,  2.56596,
+  0.852548,  1.54995,  1.89917,  2.2265,  2.52279,  2.58394,
+  0.885718,  1.657,  1.86579,  2.16289,  2.46739,  2.55377,
+  0.951271,  1.64172,  1.814,  2.15306,  2.4271,  2.49961,
+  0.928485,  1.50278,  1.80944,  2.22477,  2.4724,  2.55392,
+  0.816616,  1.3911,  1.66558,  2.17614,  2.51072,  2.58282,
+  0.915934,  1.39094,  1.76751,  2.16955,  2.47166,  2.65253,
+  1.11534,  1.36231,  1.72259,  2.03303,  2.40636,  2.60188,
+  1.13866,  1.25298,  1.68452,  1.93737,  2.38431,  2.6239,
+  1.08432,  1.21195,  1.63364,  1.88994,  2.41309,  2.62623,
+  1.12622,  1.34492,  1.6486,  2.07112,  2.48419,  2.60566,
+  1.1239,  1.46156,  1.8451,  2.17246,  2.46266,  2.60514,
+  1.13256,  1.46864,  1.74022,  2.18493,  2.46794,  2.5801,
+  1.14825,  1.50617,  1.6766,  2.04929,  2.44677,  2.56542,
+  0.999544,  1.4047,  1.64177,  1.86332,  2.52384,  2.59211,
+  0.932167,  1.39598,  1.70943,  1.84574,  2.52479,  2.59962,
+  0.870085,  1.47633,  1.72151,  1.89709,  2.49026,  2.59376,
+  0.891107,  1.42911,  1.78973,  1.95843,  2.5191,  2.60499,
+  0.85555,  1.42127,  1.90094,  2.01101,  2.54662,  2.60976,
+  0.895038,  1.48258,  1.87357,  1.97483,  2.51943,  2.58445,
+  0.809092,  1.4865,  1.90227,  2.00088,  2.51837,  2.59726,
+  0.808211,  1.46017,  1.88158,  1.9614,  2.46839,  2.61633,
+  0.774237,  1.47186,  1.90122,  2.01376,  2.56487,  2.66569,
+  0.800018,  1.57695,  1.93818,  2.04372,  2.49438,  2.6301,
+  0.804705,  1.57076,  1.88936,  1.97549,  2.44765,  2.55519,
+  0.840709,  1.60338,  1.82708,  2.02632,  2.44289,  2.49242,
+  0.887288,  1.53614,  1.78162,  1.9522,  2.50081,  2.57651,
+  0.847527,  1.5047,  1.79295,  1.89159,  2.57889,  2.63732,
+  0.959025,  1.53382,  1.82149,  1.97974,  2.46375,  2.5443,
+  1.03632,  1.64079,  1.88602,  1.96289,  2.35866,  2.57776,
+  0.981142,  1.48674,  1.7331,  1.87828,  2.53797,  2.61047,
+  1.04649,  1.43851,  1.74084,  1.85001,  2.59088,  2.68414,
+  1.1034,  1.48978,  1.73824,  1.8175,  2.58837,  2.70105,
+  1.17692,  1.47368,  1.73285,  1.82327,  2.52453,  2.73354,
+  1.17332,  1.43838,  1.69656,  1.79254,  2.58079,  2.66577,
+  1.13496,  1.42186,  1.60407,  1.75613,  2.61795,  2.70664,
+  1.13601,  1.38418,  1.6991,  1.85532,  2.59101,  2.68321,
+  1.20171,  1.42193,  1.73786,  2.0112,  2.54096,  2.68109,
+  1.22745,  1.62446,  2.12523,  2.34056,  2.59344,  2.67145,
+  1.26513,  1.76569,  2.13134,  2.39177,  2.61396,  2.69985,
+  1.34228,  1.58141,  1.97924,  2.29776,  2.52039,  2.60226,
+  1.44901,  1.72555,  2.17628,  2.35474,  2.53876,  2.62732,
+  1.41873,  1.89868,  2.20633,  2.2756,  2.48875,  2.58679,
+  1.55571,  1.8376,  2.16574,  2.34619,  2.53018,  2.62876,
+  1.44444,  1.79005,  1.91101,  2.30191,  2.46886,  2.54056,
+  1.37805,  1.6685,  1.84527,  2.32489,  2.53771,  2.60147,
+  1.39474,  1.68271,  1.81735,  2.07553,  2.51212,  2.56689,
+  1.2972,  1.65588,  1.82541,  2.0621,  2.51331,  2.57737,
+  1.28066,  1.6699,  1.82457,  2.16821,  2.52817,  2.60199,
+  1.3069,  1.60081,  1.76797,  2.09529,  2.50987,  2.606,
+  1.25768,  1.55975,  1.7878,  2.07689,  2.54039,  2.62718,
+  1.19685,  1.59755,  1.81742,  2.15266,  2.5808,  2.65125,
+  1.23593,  1.67664,  1.94231,  2.32648,  2.56154,  2.64559,
+  1.18906,  1.81889,  2.0815,  2.36645,  2.60802,  2.67209,
+  1.42759,  1.88542,  2.26491,  2.42422,  2.57137,  2.65115,
+  1.71447,  1.93787,  2.39001,  2.45715,  2.55202,  2.60193,
+  1.87414,  2.07351,  2.37047,  2.51126,  2.70918,  2.7495,
+  1.64782,  1.9878,  2.28191,  2.4121,  2.60469,  2.67482,
+  1.59637,  1.88153,  2.19399,  2.38052,  2.51192,  2.58456,
+  1.55551,  1.77522,  2.06409,  2.3257,  2.51293,  2.59926,
+  1.33005,  1.71296,  1.91762,  2.2859,  2.46659,  2.57928,
+  0.990071,  1.41087,  1.63233,  1.96589,  2.46688,  2.58042,
+  0.92515,  1.29903,  1.5514,  1.89749,  2.49848,  2.64521,
+  0.96808,  1.36713,  1.52036,  1.98816,  2.31347,  2.54694,
+  0.974374,  1.28381,  1.47481,  2.0783,  2.33109,  2.45515,
+  1.00062,  1.29915,  1.41568,  1.95576,  2.26155,  2.35426,
+  0.964045,  1.13649,  1.30593,  1.93641,  2.19754,  2.29942,
+  1.01309,  1.20114,  1.37266,  1.82018,  2.06358,  2.21066,
+  1.08648,  1.2167,  1.47666,  1.60404,  1.85596,  2.3245,
+  1.09016,  1.20121,  1.46078,  1.56222,  2.01609,  2.45898,
+  1.13375,  1.25747,  1.40719,  1.78768,  2.28953,  2.53085,
+  1.13483,  1.34122,  1.63629,  1.81377,  2.21945,  2.58465,
+  0.952747,  1.30093,  1.61689,  1.75101,  2.35211,  2.54788,
+  1.0787,  1.49004,  1.57158,  1.80053,  2.46817,  2.65044,
+  1.23905,  1.33303,  1.55138,  1.70782,  2.24292,  2.60425,
+  1.17652,  1.29911,  1.58888,  1.71408,  2.12886,  2.53352,
+  1.13583,  1.25306,  1.53841,  1.63448,  2.25809,  2.59387,
+  1.09238,  1.25324,  1.54177,  1.67988,  2.4232,  2.61758,
+  1.14266,  1.2564,  1.52828,  1.62968,  2.39158,  2.58969,
+  1.17279,  1.28125,  1.4792,  1.60888,  2.33594,  2.59368,
+  1.14678,  1.25195,  1.43292,  1.55329,  2.23894,  2.53418,
+  1.10995,  1.23142,  1.4121,  1.51605,  2.30857,  2.5999,
+  1.12027,  1.23554,  1.42574,  1.50952,  2.43553,  2.64381,
+  1.08587,  1.1893,  1.39272,  1.49435,  2.12934,  2.50899,
+  1.0205,  1.17314,  1.44097,  1.57442,  2.33586,  2.52405,
+  1.04055,  1.17434,  1.52572,  1.69311,  2.49375,  2.63235,
+  1.03452,  1.20526,  1.36509,  1.513,  2.47179,  2.57801,
+  1.07938,  1.204,  1.33243,  1.4566,  2.50213,  2.66563,
+  1.08886,  1.23695,  1.357,  1.56494,  2.60202,  2.70758,
+  1.10679,  1.2624,  1.36727,  1.82395,  2.59858,  2.6763,
+  1.08501,  1.23353,  1.31146,  1.73033,  2.56009,  2.69032,
+  1.06921,  1.18022,  1.34302,  1.47483,  2.26805,  2.54431,
+  1.03939,  1.37562,  1.72144,  2.03802,  2.464,  2.60081,
+  1.26785,  1.38411,  1.6599,  1.93402,  2.20776,  2.42458,
+  1.22528,  1.31662,  1.67815,  1.81923,  2.16534,  2.49855,
+  1.11414,  1.28303,  1.65552,  1.87967,  2.35247,  2.55354,
+  1.09476,  1.37002,  1.79913,  2.08238,  2.46949,  2.57882,
+  1.04125,  1.47276,  1.74873,  2.04759,  2.5117,  2.58983,
+  1.07167,  1.45655,  1.70052,  1.92732,  2.44148,  2.607,
+  0.929006,  1.48724,  1.66955,  1.88562,  2.54427,  2.62832,
+  0.844366,  1.33971,  1.81246,  2.30021,  2.56601,  2.63125,
+  0.761441,  1.27995,  1.67045,  2.00635,  2.52682,  2.60756,
+  0.716643,  1.37484,  1.84344,  2.12696,  2.55299,  2.61315,
+  0.749967,  1.59846,  1.88327,  2.05044,  2.57918,  2.61411,
+  0.759376,  1.59638,  1.9291,  1.98455,  2.56673,  2.65421,
+  0.724977,  1.6829,  1.88829,  2.0348,  2.50386,  2.5655,
+  0.812327,  1.66987,  1.96177,  2.10215,  2.53878,  2.59856,
+  0.767334,  1.59463,  1.98432,  2.13342,  2.50169,  2.55781,
+  0.76023,  1.65065,  1.92837,  2.09405,  2.56524,  2.59608,
+  0.766762,  1.64806,  1.85855,  2.07859,  2.58708,  2.60821,
+  0.860938,  1.62925,  1.82485,  2.06735,  2.56337,  2.60321,
+  0.960953,  1.58363,  1.75221,  2.07844,  2.55553,  2.62851,
+  1.00793,  1.548,  1.73495,  2.18566,  2.48935,  2.55145,
+  1.0404,  1.47112,  1.64352,  2.05156,  2.50852,  2.57917,
+  1.09602,  1.45743,  1.60401,  1.9262,  2.48203,  2.5522,
+  1.13043,  1.43153,  1.59281,  2.01474,  2.51065,  2.56778,
+  1.1979,  1.46548,  1.62293,  2.07595,  2.50705,  2.58275,
+  1.25883,  1.5048,  1.65911,  1.97065,  2.59575,  2.68565,
+  1.31545,  1.46745,  1.70572,  1.89863,  2.60257,  2.70498,
+  1.27248,  1.43189,  1.71285,  1.94026,  2.65038,  2.71717,
+  1.27886,  1.52865,  1.7962,  1.9952,  2.50176,  2.58761,
+  1.45862,  1.69394,  2.0679,  2.26484,  2.50686,  2.62394,
+  1.7188,  1.90961,  2.1476,  2.35417,  2.48558,  2.59127,
+  1.81387,  1.87548,  2.09764,  2.32968,  2.4978,  2.59625,
+  1.74429,  1.85945,  2.04317,  2.28459,  2.4309,  2.53857,
+  1.51418,  1.8083,  1.93379,  2.23465,  2.46223,  2.54624,
+  1.48926,  1.78119,  1.908,  2.14448,  2.41859,  2.51386,
+  1.43479,  1.67979,  1.81735,  2.10537,  2.43137,  2.52824,
+  1.46958,  1.58951,  1.81351,  2.21313,  2.4405,  2.52051,
+  1.49629,  1.64005,  1.89386,  2.29862,  2.4847,  2.57621,
+  1.33342,  1.58473,  1.89302,  2.12181,  2.52535,  2.63262,
+  1.51872,  1.73584,  1.95653,  2.17643,  2.46534,  2.57234,
+  1.52095,  1.74256,  2.01058,  2.13358,  2.44746,  2.5667,
+  1.45812,  1.69223,  2.00192,  2.12054,  2.43104,  2.56511,
+  1.52691,  1.66239,  2.02514,  2.12506,  2.53787,  2.62681,
+  1.4983,  1.64421,  1.96073,  2.10329,  2.44031,  2.57241,
+  1.41548,  1.54829,  1.7708,  2.09993,  2.45026,  2.59946,
+  1.36719,  1.46063,  1.73948,  2.07403,  2.55195,  2.64
+};
+
+const struct lsp_codebook lsp_cbvq[] = {
+  /* codebook/lsp1.txt */
+  {
+    1,
+    4,
+    16,
+    codes0
+  },
+  /* codebook/lsp2.txt */
+  {
+    1,
+    4,
+    16,
+    codes1
+  },
+  /* codebook/lsp3.txt */
+  {
+    1,
+    4,
+    16,
+    codes2
+  },
+  /* codebook/lsp4.txt */
+  {
+    1,
+    4,
+    16,
+    codes3
+  },
+  /* ../unittest/lsp45678910.txt */
+  {
+    6,
+    12,
+    4096,
+    codes4
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codebookvqanssi.c b/codec2/tags/0.4/src/codebookvqanssi.c
new file mode 100644 (file)
index 0000000..b755740
--- /dev/null
@@ -0,0 +1,565 @@
+/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
+
+/*
+ * This intermediary file and the files that used to create it are under 
+ * The LGPL. See the file COPYING.
+ */
+
+#include "defines.h"
+
+  /* codebook/lspvqanssi1.txt */
+static const float codes0[] = {
+  0.5862,  0.7213,  0.9146,  1.0909,  1.291,  1.4954,  1.837,  2.084,  2.3771,  2.5518,
+  0.0871,  0.2049,  0.5849,  0.8552,  1.2096,  1.4686,  1.821,  2.0926,  2.4508,  2.7389,
+  0.2274,  0.3126,  0.6088,  0.8338,  1.1824,  1.5948,  1.8228,  1.9856,  2.1832,  2.4793,
+  0.1827,  0.2706,  0.5842,  0.7761,  1.0301,  1.2462,  1.6313,  1.9786,  2.3479,  2.679,
+  0.3055,  0.3863,  0.7194,  1.1609,  1.3303,  1.5017,  1.7265,  1.9412,  2.4659,  2.6315,
+  0.1794,  0.2522,  0.5477,  0.7892,  1.3887,  1.7101,  1.9471,  2.1667,  2.4361,  2.631,
+  0.1825,  0.2729,  0.4185,  0.6024,  1.2531,  1.7291,  1.9937,  2.1849,  2.5865,  2.7748,
+  0.3219,  0.4045,  0.7357,  1.2708,  1.4626,  1.6439,  1.9388,  2.1212,  2.5005,  2.6749,
+  0.2234,  0.3496,  0.5054,  0.6981,  0.8672,  1.0431,  1.7091,  2.069,  2.329,  2.6195,
+  0.3009,  0.3957,  0.7576,  0.9751,  1.1955,  1.7727,  2.0383,  2.2474,  2.5612,  2.7188,
+  0.3841,  0.5544,  0.9209,  1.1811,  1.5441,  1.8126,  2.1175,  2.3192,  2.5486,  2.6935,
+  0.2153,  0.3105,  0.5597,  0.8313,  1.2168,  1.4512,  1.7012,  1.8962,  2.3893,  2.5852,
+  0.3196,  0.4814,  0.7629,  1.0869,  1.5517,  1.778,  2.0462,  2.2547,  2.5023,  2.6706,
+  0.1964,  0.3055,  0.4307,  0.7178,  1.426,  1.624,  1.8392,  2.0576,  2.2976,  2.5492,
+  0.426,  0.6888,  1.2019,  1.4194,  1.6437,  1.8221,  2.0469,  2.2508,  2.5142,  2.6795,
+  0.3004,  0.3944,  0.5847,  1.005,  1.1812,  1.3559,  1.5479,  1.7847,  2.4924,  2.6703,
+  0.1595,  0.2398,  0.4336,  0.9228,  1.2602,  1.5064,  1.7915,  1.984,  2.232,  2.5692,
+  0.1832,  0.2985,  0.4205,  0.598,  0.762,  0.9894,  1.7499,  2.1151,  2.4814,  2.7214,
+  0.2234,  0.3207,  0.5457,  0.9799,  1.2074,  1.7079,  1.9734,  2.1742,  2.4575,  2.6366,
+  0.3598,  0.4819,  0.6385,  0.8878,  1.3226,  1.491,  1.7257,  1.9456,  2.2061,  2.4579,
+  0.4671,  0.5911,  0.8513,  1.0923,  1.5104,  1.7043,  1.9727,  2.1839,  2.4484,  2.6111,
+  0.2418,  0.3937,  0.542,  0.8971,  1.1152,  1.3054,  1.7928,  1.9796,  2.5441,  2.7572,
+  0.3541,  0.473,  0.6546,  0.9063,  1.0792,  1.2743,  1.8545,  2.0555,  2.3083,  2.5404,
+  0.3121,  0.4016,  0.7137,  0.8835,  1.0736,  1.5907,  1.8624,  2.0857,  2.5075,  2.6668,
+  0.2232,  0.3631,  0.5273,  0.7438,  1.0492,  1.2235,  1.5449,  2.2198,  2.516,  2.6852,
+  0.2557,  0.3528,  0.5051,  0.6528,  0.8351,  1.5688,  1.8838,  2.1056,  2.4401,  2.6111,
+  0.4342,  0.5318,  0.9234,  1.1146,  1.3015,  1.5198,  1.8211,  2.034,  2.3694,  2.5506,
+  0.431,  0.5269,  0.7431,  0.9018,  1.0734,  1.5196,  1.8267,  2.0244,  2.4508,  2.6177,
+  0.215,  0.3249,  0.4966,  0.9434,  1.1627,  1.3497,  1.8003,  2.0045,  2.3567,  2.5909,
+  0.2798,  0.4111,  0.5786,  0.7971,  1.0414,  1.2142,  1.6947,  2.0866,  2.3351,  2.5545,
+  0.1688,  0.2693,  0.4004,  0.6337,  1.3058,  1.5064,  1.7535,  1.9689,  2.5542,  2.7424,
+  0.4419,  0.6209,  1.0127,  1.2135,  1.4104,  1.6111,  1.882,  2.1005,  2.4238,  2.5966,
+  0.3645,  0.512,  0.8977,  1.2209,  1.5286,  1.7204,  1.9787,  2.1779,  2.439,  2.6114,
+  0.2897,  0.4136,  0.5504,  0.8515,  1.2641,  1.4334,  1.8079,  2.0656,  2.3509,  2.7593,
+  0.1611,  0.4723,  0.742,  1.0071,  1.2571,  1.5891,  1.9224,  2.2345,  2.5647,  2.7991,
+  0.2528,  0.4178,  0.8909,  1.3117,  1.6622,  1.8641,  2.1017,  2.2974,  2.5299,  2.6982,
+  0.1749,  0.27,  0.4116,  0.6036,  1.143,  1.7776,  2.0394,  2.222,  2.4667,  2.6598,
+  0.3451,  0.4325,  0.6194,  0.7406,  0.9176,  1.554,  1.8426,  2.0479,  2.4401,  2.5965,
+  0.3672,  0.5164,  0.6558,  0.8441,  1.2332,  1.4114,  1.6955,  2.0875,  2.3674,  2.5471,
+  0.2194,  0.3467,  0.7384,  1.1079,  1.5398,  1.8437,  2.1212,  2.3296,  2.58,  2.7403,
+  0.1525,  0.2343,  0.3915,  0.6843,  1.0517,  1.502,  1.7905,  1.9667,  2.2027,  2.6725,
+  0.3531,  0.5908,  0.7462,  0.9441,  1.2774,  1.4743,  1.8268,  2.1059,  2.4478,  2.6484,
+  0.3611,  0.4981,  0.7598,  0.9676,  1.4024,  1.633,  1.9094,  2.1433,  2.4408,  2.613,
+  0.2153,  0.3366,  0.4974,  0.6693,  1.1944,  1.6791,  1.9002,  2.1105,  2.41,  2.5922,
+  0.2421,  0.3392,  0.5123,  0.9818,  1.5411,  1.7092,  1.9989,  2.1981,  2.5659,  2.7656,
+  0.2116,  0.325,  0.4845,  0.8021,  1.0088,  1.2158,  1.8038,  2.0223,  2.2975,  2.581,
+  0.1902,  0.2942,  0.8003,  1.1086,  1.3606,  1.6008,  1.8956,  2.1328,  2.4481,  2.6405,
+  0.2772,  0.3914,  0.5826,  0.7654,  0.9495,  1.124,  1.3949,  2.0411,  2.3891,  2.5959,
+  0.2678,  0.522,  0.763,  1.1,  1.3747,  1.6432,  1.9391,  2.2237,  2.5511,  2.7893,
+  0.32,  0.4245,  0.6174,  0.9904,  1.1662,  1.3882,  1.7601,  1.9524,  2.3998,  2.5819,
+  0.1702,  0.4871,  0.837,  1.0989,  1.3593,  1.583,  1.875,  2.1277,  2.4666,  2.6885,
+  0.228,  0.3748,  0.6554,  0.9113,  1.2081,  1.4619,  1.8181,  2.0541,  2.3791,  2.5701,
+  0.1752,  0.4363,  0.6454,  0.8798,  1.1079,  1.5367,  1.8667,  2.1716,  2.4804,  2.7249,
+  0.3804,  0.47,  0.8224,  1.0099,  1.1892,  1.5906,  1.8879,  2.0907,  2.4544,  2.6238,
+  0.1808,  0.291,  0.4683,  0.7059,  0.898,  1.4031,  1.7063,  1.9444,  2.4658,  2.6776,
+  0.2418,  0.3803,  0.5443,  0.7589,  1.1496,  1.3185,  1.5451,  1.7433,  2.131,  2.6523,
+  0.2698,  0.369,  0.5362,  1.0732,  1.2921,  1.4696,  1.744,  1.947,  2.5051,  2.6841,
+  0.4099,  0.5102,  0.6983,  1.0468,  1.2459,  1.4185,  1.8851,  2.0815,  2.3464,  2.5605,
+  0.0669,  0.1354,  0.3764,  0.8433,  1.1719,  1.4834,  1.8181,  2.1312,  2.4626,  2.8044,
+  0.1614,  0.2372,  0.3878,  0.5708,  1.2759,  1.495,  1.8052,  2.0807,  2.3485,  2.6293,
+  0.1688,  0.2875,  0.4301,  0.9059,  1.2361,  1.4054,  1.8057,  1.9924,  2.5589,  2.7495,
+  0.2864,  0.3783,  0.7032,  1.0817,  1.2382,  1.5741,  1.8619,  2.0656,  2.5139,  2.6848,
+  0.3829,  0.4781,  0.6766,  0.834,  1.0056,  1.4147,  1.665,  1.884,  2.3922,  2.5619,
+  0.3259,  0.4187,  0.6139,  0.7338,  1.1831,  1.6497,  1.9,  2.1278,  2.4322,  2.593,
+  0.2569,  0.379,  0.5426,  0.839,  0.9871,  1.485,  1.8652,  2.0732,  2.4314,  2.6005,
+  0.1408,  0.2283,  0.4024,  0.8784,  1.1485,  1.4003,  1.7004,  1.9205,  2.3723,  2.6522,
+  0.2971,  0.5039,  0.8005,  1.1212,  1.4232,  1.7801,  2.1255,  2.3907,  2.6795,  2.8487,
+  0.1515,  0.2344,  0.4684,  0.804,  1.0401,  1.3774,  1.8329,  2.1235,  2.5555,  2.777,
+  0.5778,  0.7157,  0.891,  1.0966,  1.4235,  1.6482,  1.9551,  2.1831,  2.4572,  2.6234,
+  0.3017,  0.4161,  0.8088,  0.9971,  1.2,  1.4419,  1.7867,  2.0224,  2.3473,  2.54,
+  0.1208,  0.2814,  0.6564,  0.9448,  1.2377,  1.5663,  1.9084,  2.2112,  2.5583,  2.8155,
+  0.2127,  0.3127,  0.4635,  0.6416,  0.8449,  1.6652,  2.0577,  2.2656,  2.5811,  2.7434,
+  0.1942,  0.3011,  0.4212,  0.6901,  1.5369,  1.7639,  1.9608,  2.1766,  2.4435,  2.6663,
+  0.351,  0.4345,  0.7146,  0.9086,  1.0678,  1.2579,  1.4425,  2.0265,  2.4574,  2.6252,
+  0.3225,  0.4323,  0.6168,  0.858,  1.5388,  1.791,  1.9927,  2.2013,  2.4494,  2.616,
+  0.2271,  0.4488,  0.6287,  0.7857,  1.2086,  1.383,  1.6194,  2.1955,  2.5236,  2.6945,
+  0.2568,  0.351,  0.5613,  1.05,  1.2521,  1.4359,  1.6995,  1.9187,  2.2148,  2.4275,
+  0.2933,  0.3941,  0.6128,  0.8899,  1.072,  1.2862,  1.5331,  1.8301,  2.1553,  2.3865,
+  0.348,  0.4626,  0.6009,  0.763,  0.9044,  1.1225,  1.8539,  2.1845,  2.5035,  2.7091,
+  0.1337,  0.4722,  0.8099,  1.1273,  1.4252,  1.699,  2.0188,  2.2922,  2.6018,  2.8168,
+  0.1138,  0.3263,  0.8059,  1.0473,  1.3262,  1.6202,  1.9439,  2.2007,  2.5347,  2.7702,
+  0.1979,  0.313,  0.4635,  0.8504,  1.1143,  1.3221,  2.0371,  2.2421,  2.5406,  2.7491,
+  0.3321,  0.4194,  0.8239,  1.0458,  1.1981,  1.3733,  1.5661,  1.9985,  2.3747,  2.5416,
+  0.3729,  0.5958,  0.9551,  1.265,  1.5484,  1.9255,  2.2256,  2.4809,  2.7276,  2.8935,
+  0.1664,  0.2516,  0.5347,  0.7545,  1.1971,  1.4089,  1.74,  2.0871,  2.4098,  2.6795,
+  0.237,  0.3178,  0.6123,  1.3315,  1.547,  1.7257,  2.0063,  2.1977,  2.5449,  2.7252,
+  0.203,  0.3328,  0.4766,  0.7357,  1.278,  1.4439,  1.7229,  1.9405,  2.2278,  2.6816,
+  0.1702,  0.2919,  0.4598,  0.7123,  0.9077,  1.145,  1.8632,  2.0806,  2.499,  2.71,
+  0.2421,  0.3578,  0.54,  0.7217,  0.8971,  1.4898,  1.8518,  2.1205,  2.6077,  2.7894,
+  0.303,  0.3935,  0.5812,  0.7404,  0.9425,  1.8342,  2.0887,  2.2811,  2.5596,  2.7118,
+  0.1322,  0.1997,  0.3466,  0.6981,  1.1811,  1.4849,  1.8594,  2.1114,  2.4708,  2.7804,
+  0.2317,  0.3069,  0.686,  1.4306,  1.7121,  1.8671,  2.1249,  2.2995,  2.5705,  2.7456,
+  0.3778,  0.4863,  0.6639,  0.9163,  1.156,  1.3186,  1.5389,  1.7169,  2.1603,  2.5797,
+  0.2118,  0.3499,  0.5259,  0.72,  1.1348,  1.314,  1.5657,  2.0241,  2.2873,  2.5184,
+  0.2902,  0.4368,  0.6331,  0.8971,  1.3102,  1.5219,  1.8674,  2.1512,  2.4708,  2.6809,
+  0.1418,  0.3988,  0.6251,  0.8544,  1.1268,  1.3964,  1.7585,  2.0322,  2.3964,  2.6928,
+  0.2314,  0.3462,  0.7282,  0.9211,  1.1766,  1.4941,  1.7368,  1.9546,  2.517,  2.7066,
+  0.2076,  0.3251,  0.7423,  0.959,  1.1936,  1.5329,  1.8887,  2.1588,  2.4667,  2.6709,
+  0.2058,  0.4139,  0.5745,  0.7832,  0.9595,  1.1688,  1.7561,  1.9562,  2.484,  2.7001,
+  0.1834,  0.2971,  0.4643,  0.6625,  0.8802,  1.1137,  1.5183,  1.8417,  2.3842,  2.7042,
+  0.1688,  0.4218,  0.707,  1.0465,  1.4496,  1.6953,  1.956,  2.2174,  2.5172,  2.7404,
+  0.2323,  0.3981,  0.5489,  0.7227,  1.2886,  1.5221,  1.7158,  2.1184,  2.4066,  2.5898,
+  0.347,  0.5265,  0.814,  1.0152,  1.3206,  1.5411,  1.849,  2.0588,  2.3556,  2.5393,
+  0.1707,  0.2595,  0.6762,  0.9037,  1.2781,  1.4903,  1.7946,  2.061,  2.3741,  2.5771,
+  0.1457,  0.2318,  0.6039,  1.0078,  1.3461,  1.5908,  1.8818,  2.1248,  2.4432,  2.6714,
+  0.6574,  0.8086,  1.0243,  1.2183,  1.4837,  1.7129,  2.0197,  2.2464,  2.5059,  2.6716,
+  0.2546,  0.4983,  0.8674,  1.2536,  1.6704,  1.9529,  2.2134,  2.4319,  2.6532,  2.8109,
+  0.2455,  0.3379,  0.4632,  0.8635,  1.5286,  1.8047,  1.9909,  2.1806,  2.4031,  2.5729,
+  0.4772,  0.6742,  1,  1.2474,  1.5288,  1.7415,  2.0102,  2.2168,  2.477,  2.6449,
+  0.3357,  0.4382,  0.6033,  1.1317,  1.3681,  1.5576,  1.9251,  2.1119,  2.5548,  2.7395,
+  0.2588,  0.7015,  0.8953,  1.083,  1.2828,  1.516,  1.8965,  2.1921,  2.515,  2.7258,
+  0.2466,  0.3512,  0.5047,  0.6646,  0.8161,  1.2577,  1.8046,  2.0214,  2.4447,  2.6491,
+  0.1631,  0.2283,  0.407,  0.5955,  1.1126,  1.3894,  1.8978,  2.1849,  2.5384,  2.7382,
+  0.3424,  0.4748,  0.6222,  0.802,  0.9706,  1.1568,  1.7044,  1.9297,  2.2127,  2.5627,
+  0.2088,  0.5143,  0.74,  0.9277,  1.1032,  1.3561,  1.8841,  2.2004,  2.5882,  2.7993,
+  0.2016,  0.3488,  0.5894,  0.7419,  1.1488,  1.3626,  1.5566,  1.9694,  2.5488,  2.7209,
+  0.2558,  0.3914,  0.536,  0.7521,  1.433,  1.6955,  1.8886,  2.1428,  2.419,  2.5966,
+  0.4021,  0.5034,  0.6653,  0.8123,  0.9586,  1.2825,  1.9184,  2.112,  2.409,  2.597,
+  0.2343,  0.48,  0.6934,  0.8523,  1.2786,  1.4763,  1.7235,  2.04,  2.3602,  2.5562,
+  0.246,  0.3687,  0.5325,  0.7044,  1.1488,  1.3608,  1.8112,  2.0757,  2.4183,  2.663,
+  0.1616,  0.3644,  0.5725,  0.9166,  1.2481,  1.4938,  1.8388,  2.1175,  2.4712,  2.7464,
+  0.376,  0.4841,  0.635,  1.0082,  1.211,  1.4003,  1.8127,  2.0018,  2.5199,  2.7238,
+  0.1988,  0.2824,  0.6553,  1.0337,  1.5413,  1.7369,  1.9751,  2.1751,  2.4372,  2.6265,
+  0.2728,  0.4094,  0.7498,  1.0645,  1.3516,  1.5946,  1.991,  2.2172,  2.483,  2.6614,
+  0.1657,  0.5327,  0.7281,  0.9966,  1.2385,  1.4629,  1.8119,  2.0973,  2.4469,  2.6979,
+  0.1413,  0.2098,  0.354,  0.5492,  0.8486,  1.1288,  1.632,  1.9056,  2.2805,  2.5438,
+  0.2856,  0.3666,  0.6259,  1.1424,  1.6605,  1.8197,  2.0147,  2.1986,  2.4121,  2.5919,
+  0.2725,  0.4829,  0.765,  1.0119,  1.2977,  1.5488,  1.8755,  2.1155,  2.4383,  2.6377,
+  0.2736,  0.3804,  0.5537,  1.0258,  1.2269,  1.4186,  1.9718,  2.1468,  2.5665,  2.7689,
+  0.2341,  0.5953,  1.103,  1.4549,  1.7361,  1.9758,  2.2126,  2.4213,  2.6405,  2.8181,
+  0.2273,  0.4638,  0.6228,  0.85,  1.1016,  1.2823,  1.7094,  1.9523,  2.2669,  2.7029,
+  0.2438,  0.3798,  0.7299,  0.96,  1.3765,  1.6104,  1.8644,  2.1161,  2.5073,  2.7137,
+  0.1551,  0.4869,  0.8676,  1.2274,  1.5069,  1.8857,  2.1868,  2.4411,  2.7106,  2.8767,
+  0.2746,  0.5454,  0.7589,  0.9458,  1.1597,  1.3349,  1.6653,  2.1142,  2.4356,  2.6239,
+  0.1793,  0.2646,  0.4344,  0.7482,  1.1502,  1.3733,  1.8558,  2.0817,  2.3248,  2.5171,
+  0.2698,  0.4202,  0.5765,  0.8301,  1.0073,  1.2101,  1.9714,  2.2051,  2.5138,  2.7395,
+  0.1929,  0.3091,  0.446,  0.6266,  1.1805,  1.3672,  1.599,  2.1514,  2.4729,  2.6468,
+  0.1901,  0.3047,  0.4607,  1.1019,  1.3168,  1.5343,  1.9234,  2.1365,  2.5924,  2.7807,
+  0.3139,  0.5009,  0.67,  0.8268,  1.0117,  1.181,  1.6539,  2.1984,  2.4828,  2.6576,
+  0.1403,  0.2173,  0.4117,  0.7302,  1.0038,  1.2732,  1.7392,  2.0337,  2.3809,  2.7386,
+  0.4166,  0.5101,  0.7449,  1.1663,  1.3492,  1.5543,  1.9,  2.0941,  2.4588,  2.6365,
+  0.3342,  0.4335,  0.616,  0.8559,  1.0112,  1.2097,  1.4029,  1.6361,  2.4129,  2.6324,
+  0.4543,  0.6159,  0.7932,  0.9843,  1.2562,  1.4308,  1.7116,  1.9919,  2.2671,  2.4631,
+  0.2153,  0.3609,  0.5302,  0.7089,  0.8756,  1.0376,  1.6496,  2.2826,  2.568,  2.7441,
+  0.438,  0.6439,  0.8282,  1.0651,  1.365,  1.5829,  1.8838,  2.1005,  2.4006,  2.5771,
+  0.2523,  0.3636,  0.5879,  1.1628,  1.3542,  1.6756,  2.0488,  2.2543,  2.6093,  2.7953,
+  0.4179,  0.5426,  0.7065,  0.8996,  1.0684,  1.3146,  1.9705,  2.2021,  2.5051,  2.7061,
+  0.1659,  0.286,  0.6693,  0.9229,  1.3959,  1.6544,  1.9709,  2.2257,  2.5236,  2.746,
+  0.254,  0.4356,  0.5946,  0.7627,  1.2274,  1.4222,  1.6573,  1.9601,  2.2514,  2.4711,
+  0.1633,  0.2337,  0.3698,  0.5421,  1.1757,  1.5916,  2.1561,  2.3371,  2.5534,  2.7737,
+  0.1953,  0.273,  0.4521,  1.2005,  1.7062,  1.8627,  2.1313,  2.3266,  2.5906,  2.7667,
+  0.3053,  0.4054,  0.5651,  0.747,  0.891,  1.172,  1.8864,  2.1074,  2.3705,  2.5744,
+  0.1761,  0.3033,  0.6501,  0.8268,  1.0369,  1.2687,  1.8534,  2.1889,  2.5074,  2.7339,
+  0.2265,  0.399,  1.1359,  1.4137,  1.6839,  1.8912,  2.0948,  2.3042,  2.5489,  2.7234,
+  0.3326,  0.54,  0.8711,  1.0948,  1.3752,  1.6155,  1.936,  2.1537,  2.4451,  2.6133,
+  0.2162,  0.3522,  0.5309,  0.747,  0.9677,  1.1747,  1.5056,  1.7942,  2.1615,  2.48,
+  0.1872,  0.2761,  0.4053,  0.7469,  1.5858,  1.8945,  2.1198,  2.3197,  2.5819,  2.7758,
+  0.5381,  0.8651,  1.2695,  1.4918,  1.7774,  1.9696,  2.1865,  2.3687,  2.5739,  2.7158,
+  0.2663,  0.3422,  0.6098,  1.212,  1.4516,  1.6092,  1.8506,  2.0376,  2.2929,  2.5088,
+  0.1904,  0.3051,  0.5663,  0.7391,  1.1589,  1.5705,  1.8756,  2.1653,  2.5518,  2.7693,
+  0.1543,  0.3519,  0.6976,  1.0664,  1.3696,  1.7817,  2.1308,  2.4259,  2.707,  2.8753,
+  0.3304,  0.4283,  0.5942,  0.7425,  0.8906,  1.4067,  2.0676,  2.246,  2.5394,  2.7006,
+  0.208,  0.3215,  0.6278,  0.7882,  1.3123,  1.5592,  1.8048,  2.0831,  2.4303,  2.6266,
+  0.1188,  0.2481,  0.827,  1.242,  1.5824,  1.8976,  2.1816,  2.4248,  2.6645,  2.8459,
+  0.0635,  0.1528,  0.5973,  0.9377,  1.2653,  1.5465,  1.8818,  2.1681,  2.5089,  2.7924,
+  0.3249,  0.5179,  0.9143,  1.2973,  1.4966,  1.755,  2.0715,  2.3166,  2.65,  2.8305,
+  0.1918,  0.3107,  0.4506,  0.6994,  1.3463,  1.5348,  1.8447,  2.1903,  2.448,  2.6877,
+  0.3405,  0.4644,  0.7232,  0.9199,  1.2611,  1.5175,  1.8446,  2.0652,  2.3915,  2.5781,
+  0.3289,  0.5152,  0.6602,  1.0213,  1.1886,  1.5496,  1.9553,  2.1883,  2.5394,  2.7362,
+  0.3,  0.4097,  0.8372,  1.0793,  1.3095,  1.5684,  1.8746,  2.0783,  2.3643,  2.549,
+  0.2421,  0.328,  0.5288,  0.9261,  1.6911,  1.8959,  2.1013,  2.2823,  2.5238,  2.696,
+  0.107,  0.3131,  0.6226,  0.8881,  1.1808,  1.4867,  1.8146,  2.1088,  2.4594,  2.7186,
+  0.44,  0.5533,  0.7025,  0.9206,  1.4089,  1.582,  1.808,  2.0832,  2.3577,  2.53,
+  0.225,  0.3434,  0.4808,  0.6721,  0.8198,  1.1446,  2.0201,  2.2625,  2.552,  2.7604,
+  0.1671,  0.2551,  0.4603,  0.6777,  0.9661,  1.5579,  1.8659,  2.1196,  2.4425,  2.6551,
+  0.391,  0.5877,  1.0287,  1.3547,  1.6899,  1.9166,  2.1451,  2.3337,  2.5519,  2.7071,
+  0.1435,  0.2165,  0.3968,  0.8376,  1.2572,  1.5298,  1.8791,  2.1352,  2.4636,  2.7011,
+  0.1756,  0.2799,  0.412,  0.5808,  0.7573,  1.334,  1.8235,  2.12,  2.4993,  2.7365,
+  0.1332,  0.2174,  0.4716,  0.9483,  1.2723,  1.6028,  1.9272,  2.219,  2.5588,  2.799,
+  0.2122,  0.3143,  0.7042,  0.8849,  1.1312,  1.3711,  1.6832,  1.9633,  2.2685,  2.5156,
+  0.2089,  0.3339,  0.4817,  0.8526,  1.0657,  1.2741,  1.5747,  1.8,  2.486,  2.6843,
+  0.1636,  0.2617,  0.44,  0.7357,  1.0355,  1.2638,  1.5672,  1.8504,  2.1904,  2.6588,
+  0.1945,  0.2934,  0.4869,  0.8567,  1.1262,  1.3604,  1.6898,  1.9143,  2.1475,  2.3503,
+  0.1606,  0.2442,  0.3931,  0.9237,  1.5811,  1.7529,  2.0133,  2.2272,  2.525,  2.7265,
+  0.4866,  0.7045,  1.0593,  1.2795,  1.5326,  1.8221,  2.1461,  2.3665,  2.6041,  2.7599,
+  0.4012,  0.4911,  0.7103,  0.8585,  1.0495,  1.7244,  2.0116,  2.2041,  2.5189,  2.6643,
+  0.4365,  0.6694,  0.8644,  1.133,  1.451,  1.7627,  2.1032,  2.369,  2.628,  2.8306,
+  0.2072,  0.4018,  0.6227,  0.8913,  1.3038,  1.6056,  1.9704,  2.2816,  2.6135,  2.8182,
+  0.3302,  0.4968,  0.8713,  1.0761,  1.2576,  1.4654,  1.8152,  2.14,  2.5404,  2.7493,
+  0.1385,  0.2292,  0.353,  0.6006,  1.4699,  1.6571,  1.9438,  2.1663,  2.5027,  2.7308,
+  0.1894,  0.2915,  0.4345,  0.6341,  1.0024,  1.1896,  1.6896,  2.0966,  2.4086,  2.6768,
+  0.3841,  0.5197,  0.8889,  1.148,  1.4383,  1.6285,  1.8642,  2.0669,  2.3466,  2.5325,
+  0.2008,  0.3097,  0.4664,  0.6638,  1.2798,  1.494,  1.727,  2.0264,  2.2915,  2.475,
+  0.1864,  0.2857,  0.4481,  1.1025,  1.3096,  1.5035,  1.7614,  1.9891,  2.4255,  2.6031,
+  0.4081,  0.6134,  0.9514,  1.1818,  1.3943,  1.6361,  1.9891,  2.2395,  2.5547,  2.7287,
+  0.2964,  0.3876,  0.945,  1.2247,  1.3906,  1.5882,  1.8241,  2.0589,  2.4188,  2.5871,
+  0.3127,  0.4038,  0.6168,  1.081,  1.3067,  1.4759,  1.8817,  2.0781,  2.3394,  2.5539,
+  0.2066,  0.3059,  0.4989,  0.7132,  0.9066,  1.446,  1.7584,  1.9755,  2.221,  2.4741,
+  0.2634,  0.3956,  0.5667,  0.8777,  1.0517,  1.6029,  2.059,  2.2607,  2.6064,  2.7647,
+  0.4331,  0.5315,  0.7764,  1.0444,  1.2269,  1.4311,  1.7093,  1.9187,  2.4337,  2.6149,
+  0.2161,  0.4429,  0.6851,  0.8336,  1.1037,  1.2966,  1.5283,  2.0299,  2.3407,  2.5384,
+  0.2814,  0.3637,  0.5416,  0.9475,  1.5137,  1.6945,  1.8892,  2.1017,  2.319,  2.5007,
+  0.4454,  0.6883,  1.1402,  1.4098,  1.7435,  2.0014,  2.2521,  2.4457,  2.6495,  2.7985,
+  0.1641,  0.4083,  0.6426,  1.0592,  1.3258,  1.5754,  1.8666,  2.1381,  2.4572,  2.7177,
+  0.3391,  0.4607,  0.6072,  0.8463,  1.4207,  1.6062,  1.8303,  2.0887,  2.3615,  2.5348,
+  0.2414,  0.3396,  0.51,  0.747,  1.3329,  1.8618,  2.0751,  2.2564,  2.5147,  2.6874,
+  0.1694,  0.2535,  0.4156,  0.8302,  1.2853,  1.5838,  2.0907,  2.3085,  2.5929,  2.7951,
+  0.2047,  0.3652,  0.65,  0.8068,  1.0178,  1.1865,  1.4889,  2.0671,  2.5966,  2.7634,
+  0.2425,  0.3247,  0.602,  1.2226,  1.4272,  1.5996,  1.8377,  2.0413,  2.5333,  2.7021,
+  0.3842,  0.503,  0.6541,  0.8771,  1.0576,  1.2612,  1.6744,  1.8735,  2.4781,  2.6803,
+  0.2042,  0.328,  0.7283,  0.8985,  1.1444,  1.3299,  1.6032,  2.1539,  2.4739,  2.6547,
+  0.1268,  0.1924,  0.3208,  0.5153,  1.1304,  1.4443,  1.8047,  2.0552,  2.4385,  2.7572,
+  0.2713,  0.3659,  0.5395,  1.0705,  1.4228,  1.5836,  1.9763,  2.1641,  2.4459,  2.6301,
+  0.3047,  0.4043,  0.5727,  0.7368,  0.8997,  1.3242,  1.6473,  1.8879,  2.433,  2.6295,
+  0.1224,  0.3948,  0.6903,  0.9199,  1.2852,  1.5516,  1.8645,  2.1231,  2.4657,  2.7044,
+  0.2157,  0.3281,  0.5036,  0.9272,  1.0975,  1.5285,  1.808,  2.0569,  2.5448,  2.7221,
+  0.167,  0.249,  0.3696,  0.5921,  1.3019,  1.8398,  2.2165,  2.3725,  2.6142,  2.8338,
+  0.3899,  0.5573,  0.81,  1.0732,  1.3966,  1.6598,  2.0001,  2.2517,  2.5548,  2.7403,
+  0.4905,  0.6064,  0.8222,  0.9966,  1.1912,  1.5714,  1.9628,  2.1727,  2.53,  2.7055,
+  0.1309,  0.2342,  0.6232,  0.8795,  1.1283,  1.3655,  1.7371,  2.0251,  2.3992,  2.6885,
+  0.1805,  0.2672,  0.4297,  1.244,  1.4967,  1.6796,  1.9592,  2.1784,  2.5439,  2.7289,
+  0.228,  0.5429,  0.6967,  0.8732,  1.4074,  1.6074,  1.9516,  2.2124,  2.5486,  2.7722,
+  0.2339,  0.3379,  0.4924,  0.9061,  1.3074,  1.4719,  1.8884,  2.111,  2.3618,  2.5545,
+  0.1384,  0.2291,  0.5127,  1.045,  1.4017,  1.7884,  2.1134,  2.3664,  2.6588,  2.8435,
+  0.2196,  0.6359,  0.91,  1.2007,  1.4589,  1.7053,  2.0128,  2.2722,  2.552,  2.7643,
+  0.1698,  0.2615,  0.381,  0.5706,  1.4297,  1.8686,  2.0728,  2.2559,  2.486,  2.6701,
+  0.1445,  0.2158,  0.3658,  0.5451,  0.9389,  1.3669,  1.79,  2.0846,  2.3924,  2.7161,
+  0.2789,  0.3816,  0.5277,  0.8487,  1.3751,  1.5461,  1.7832,  2.0264,  2.2695,  2.4665,
+  0.1733,  0.3023,  0.9216,  1.2368,  1.4776,  1.7229,  1.9952,  2.2471,  2.539,  2.7265,
+  0.3374,  0.5033,  1.0951,  1.3262,  1.5284,  1.7336,  1.9733,  2.2009,  2.4992,  2.6751,
+  0.1293,  0.2743,  0.7533,  1.0166,  1.2416,  1.4444,  1.7962,  2.0851,  2.477,  2.7204,
+  0.3106,  0.4176,  0.6358,  0.9434,  1.1419,  1.3458,  1.9638,  2.1678,  2.439,  2.6235,
+  0.4533,  0.576,  0.7392,  0.9136,  1.0829,  1.2759,  1.7903,  2.036,  2.3124,  2.5325,
+  0.3702,  0.5218,  0.6977,  0.8776,  1.1096,  1.2855,  1.5612,  1.948,  2.217,  2.4361,
+  0.1637,  0.2647,  0.4185,  0.6666,  1.1584,  1.327,  1.7829,  1.9821,  2.4361,  2.7094,
+  0.1769,  0.2767,  0.3942,  0.5746,  1.3595,  1.711,  1.9176,  2.1405,  2.3722,  2.5705,
+  0.2712,  0.382,  0.6524,  0.8317,  1.0341,  1.3972,  1.7312,  1.9918,  2.3854,  2.5886,
+  0.1003,  0.2046,  0.7261,  1.1004,  1.4057,  1.6697,  1.9903,  2.2603,  2.5813,  2.8009,
+  0.2534,  0.3752,  0.7192,  0.9323,  1.3698,  1.5955,  1.8653,  2.0656,  2.3368,  2.534,
+  0.3589,  0.4508,  0.6631,  1.0521,  1.5065,  1.6697,  1.8929,  2.1074,  2.3466,  2.5242,
+  0.1955,  0.2862,  0.6111,  0.8053,  1.0501,  1.5218,  1.7996,  2.0303,  2.3788,  2.5973,
+  0.2982,  0.4033,  0.566,  0.8924,  1.1933,  1.3465,  1.7895,  2.0173,  2.2606,  2.5069,
+  0.3356,  0.4711,  0.631,  0.8491,  1.0049,  1.4364,  1.8176,  2.0292,  2.571,  2.7525,
+  0.2016,  0.2912,  0.4363,  0.98,  1.4897,  1.6494,  1.8862,  2.0819,  2.3636,  2.6091,
+  0.4549,  0.6491,  0.845,  1.0209,  1.1747,  1.3745,  1.8824,  2.113,  2.376,  2.5768,
+  0.251,  0.3524,  0.5171,  0.8931,  1.4094,  1.571,  1.8536,  2.0478,  2.4766,  2.732,
+  0.1576,  0.2547,  0.3891,  0.8551,  1.4282,  1.588,  1.8583,  2.0521,  2.5359,  2.734,
+  0.3481,  0.4382,  0.772,  1.1289,  1.3203,  1.5019,  1.7665,  1.957,  2.2231,  2.4465,
+  0.3116,  0.4068,  0.6991,  0.8894,  1.0912,  1.5356,  1.8084,  2.0006,  2.2323,  2.4367,
+  0.2706,  0.4033,  0.8272,  1.0851,  1.482,  1.6927,  1.9292,  2.1267,  2.4049,  2.5857,
+  0.2745,  0.355,  0.8663,  1.3742,  1.5545,  1.7324,  1.9664,  2.1538,  2.4581,  2.6245,
+  0.1736,  0.2553,  0.5357,  0.9009,  1.1888,  1.5132,  1.8579,  2.1181,  2.4273,  2.6847,
+  0.3026,  0.4148,  0.9044,  1.1695,  1.3657,  1.7036,  1.9891,  2.2226,  2.5441,  2.7085,
+  0.3998,  0.5108,  0.7205,  0.9848,  1.1828,  1.3716,  1.7154,  1.9191,  2.1875,  2.4257,
+  0.2141,  0.3095,  0.7428,  1.0426,  1.2851,  1.5571,  1.7901,  1.9804,  2.2462,  2.5265,
+  0.1574,  0.229,  0.3869,  0.5735,  1.0925,  1.3383,  1.6598,  1.9364,  2.2095,  2.4195
+};
+  /* codebook/lspvqanssi2.txt */
+static const float codes1[] = {
+  0.012,  0.0022,  0.0068,  -0.0112,  -0.0508,  -0.049,  0.2249,  0.1476,  0.0133,  -0.0379,
+  0.0598,  0.0477,  0.038,  0.066,  0.0517,  0.015,  0.0617,  0.0081,  -0.0768,  -0.1007,
+  -0.0087,  -0.044,  0.0873,  0.0882,  0.0391,  -0.006,  0.11,  0.0569,  -0.0241,  -0.0468,
+  0.0146,  -0.0005,  0.0322,  -0.065,  -0.0778,  -0.078,  -0.0255,  -0.0527,  -0.0301,  -0.0401,
+  -0.024,  -0.056,  -0.0374,  0.0274,  0.0484,  -0.0227,  0.0328,  0.1135,  0.0117,  -0.03,
+  -0.0324,  -0.0574,  0.0302,  0.0137,  -0.0603,  -0.1194,  -0.0105,  -0.0513,  0.0698,  0.0538,
+  0.0635,  0.0382,  0.0531,  0.0897,  0.0495,  0.0039,  -0.0421,  -0.0919,  0.0407,  0.0167,
+  0.0954,  0.0854,  0.036,  -0.0025,  -0.0252,  -0.0528,  -0.0435,  -0.0561,  -0.0405,  -0.0432,
+  0.011,  -0.001,  -0.0433,  -0.0167,  0.1402,  0.0738,  0.0423,  -0.0024,  -0.092,  -0.1099,
+  0.0179,  0.0184,  -0.0041,  -0.064,  0.1004,  0.0608,  -0.0023,  -0.0357,  0.1509,  0.1262,
+  -0.0145,  -0.024,  -0.0595,  -0.1063,  0.0597,  -0.004,  -0.0886,  0.1184,  0.038,  0.0126,
+  -0.0072,  0.0172,  0.0076,  0.0288,  0.081,  0.0278,  0.0709,  0.0051,  0.0214,  -0.0301,
+  0.0127,  -0.0126,  -0.0434,  0.161,  0.1178,  0.0704,  0.0257,  -0.0073,  -0.0425,  -0.061,
+  -0.0165,  -0.0369,  -0.0785,  0.1007,  0.0309,  -0.0651,  0.0142,  -0.0614,  0.0426,  0.0289,
+  -0.0374,  -0.0712,  0.0049,  -0.0382,  0.0472,  0.0095,  -0.0268,  -0.0747,  -0.0457,  -0.0758,
+  -0.0211,  -0.0432,  -0.0547,  -0.0446,  -0.1078,  0.009,  -0.0565,  -0.1298,  0.0721,  0.0351,
+  -0.0014,  -0.0072,  -0.0283,  -0.0324,  -0.0208,  -0.0703,  0.0979,  0.0865,  -0.0007,  0.1881,
+  -0.0077,  -0.0302,  0.1231,  0.0905,  0.0786,  0.0432,  -0.0286,  -0.0661,  -0.0055,  -0.0275,
+  0.001,  0.0043,  0.0044,  0.038,  -0.1201,  -0.0098,  -0.0166,  0.0105,  0.0153,  0.0134,
+  0.0843,  0.0636,  0.0416,  -0.0004,  -0.057,  -0.0592,  0.1158,  0.059,  0.0126,  0.0034,
+  0.0346,  0.029,  -0.0037,  -0.0026,  -0.0457,  0.1824,  0.1469,  0.087,  0.0291,  -0.0074,
+  0.0066,  0.0682,  -0.0148,  0.0287,  0.0095,  -0.0563,  0.1296,  0.0426,  0.1215,  0.0886,
+  -0.0132,  -0.0399,  0.096,  0.0474,  0.014,  0.0306,  -0.0192,  -0.0703,  -0.1559,  -0.1556,
+  -0.06,  0.0482,  0.1257,  0.0521,  0.0229,  -0.0031,  0.0817,  0.0571,  -0.0138,  -0.0277,
+  0.0013,  -0.0103,  -0.047,  -0.0687,  -0.1444,  0.0181,  0.135,  0.0559,  -0.0177,  -0.0598,
+  -0.0215,  -0.0318,  -0.0689,  -0.0268,  0.0917,  0.0307,  0.0135,  -0.0184,  -0.0857,  0.1231,
+  0.0137,  -0.0152,  0.0199,  -0.0291,  -0.0685,  0.0438,  -0.1137,  0.0231,  -0.0632,  -0.0802,
+  -0.0011,  0.0314,  0.0535,  -0.0135,  -0.0291,  -0.0579,  -0.1049,  0.0288,  -0.0628,  0.1355,
+  -0.0901,  0.0041,  -0.017,  0.0351,  0.0144,  -0.0505,  0.0396,  0.0638,  -0.0145,  0.0141,
+  -0.04,  -0.0603,  -0.0714,  0.0329,  -0.0049,  -0.0529,  -0.1251,  0.0022,  -0.0449,  -0.0778,
+  0.0247,  0.0296,  0.0239,  0.0122,  -0.0348,  -0.1224,  -0.0033,  0.1237,  -0.0016,  -0.0436,
+  0.0246,  0.005,  0.0322,  0.0818,  0.0203,  0.0846,  0.0022,  0.0876,  0.0149,  -0.0184,
+  -0.0204,  -0.0228,  0.0365,  -0.0164,  0.1087,  0.0374,  -0.055,  0.033,  -0.0582,  -0.0736,
+  -0.0305,  -0.0485,  -0.0572,  0.0275,  -0.0271,  -0.0436,  0.1217,  0.07,  0.1253,  0.099,
+  -0.0079,  -0.0204,  -0.0325,  0.0491,  0.0158,  -0.0365,  -0.1309,  -0.1812,  0.1428,  0.1148,
+  0.068,  0.0547,  0.0309,  0.0079,  -0.0332,  0.0391,  -0.0287,  0.1258,  0.1123,  0.1016,
+  -0.0264,  -0.0409,  -0.0538,  -0.0192,  -0.0393,  -0.0713,  -0.0618,  -0.1078,  -0.185,  0.0532,
+  0.0081,  -0.0115,  -0.009,  0.1201,  -0.0413,  -0.0995,  0.0445,  -0.0032,  -0.0286,  -0.0497,
+  -0.0023,  -0.0184,  -0.0358,  0.1279,  0.0847,  0.053,  0.023,  -0.0212,  0.1245,  0.0965,
+  0.0111,  0.1038,  0.0597,  0.0413,  0.0533,  0.0011,  0.0031,  0.0705,  0.0242,  0.0198,
+  0.002,  -0.0071,  -0.0262,  -0.0496,  -0.075,  -0.1273,  -0.1785,  0.0606,  -0.0223,  -0.0583,
+  -0.0202,  0.0669,  0.0081,  0.0335,  -0.0218,  -0.1073,  -0.0146,  -0.0673,  0.049,  0.021,
+  -0.0108,  -0.023,  -0.0614,  -0.0986,  0.0629,  0.0006,  0.1496,  0.1099,  0.0316,  0.0098,
+  -0.0368,  -0.0685,  0.0138,  -0.0213,  -0.0009,  0.0344,  -0.0249,  0.0311,  0.0803,  0.0759,
+  0.0038,  -0.0158,  0.0142,  0.0254,  0.097,  0.0021,  -0.1029,  0.0006,  0.0576,  0.0261,
+  -0.0083,  0.0698,  0.0406,  -0.0348,  0.02,  0.0833,  0.0186,  -0.0145,  -0.0725,  -0.0872,
+  -0.0506,  -0.0673,  0.0776,  -0.0172,  -0.0444,  -0.0531,  -0.0799,  0.0005,  -0.0359,  -0.0446,
+  0.0368,  0.0376,  -0.0407,  -0.019,  0.0987,  0.0212,  -0.0349,  -0.0951,  -0.0084,  -0.0342,
+  -0.0309,  -0.0561,  0.095,  -0.0125,  -0.1028,  -0.0133,  0.092,  0.0965,  0.0668,  0.0409,
+  -0.0898,  0.0036,  -0.0353,  -0.0024,  -0.0365,  -0.0259,  -0.0485,  -0.0843,  -0.0063,  -0.0167,
+  -0.0255,  -0.0407,  -0.0456,  -0.0931,  -0.0892,  -0.0293,  -0.051,  0.0183,  -0.0104,  0.0472,
+  -0.0172,  -0.0399,  -0.0731,  0.0546,  0.032,  -0.0283,  0.0415,  -0.0107,  -0.1237,  -0.1102,
+  0.021,  0.0294,  -0.0038,  -0.009,  -0.0551,  -0.0922,  0.0261,  -0.0334,  -0.1181,  -0.1536,
+  0.0092,  0.0032,  -0.0162,  0.0398,  0.0205,  0.1266,  -0.0107,  -0.0858,  0.0392,  0.0032,
+  -0.0038,  -0.0269,  -0.0737,  0.1138,  0.0263,  -0.0031,  -0.1188,  0.1621,  0.0831,  0.0526,
+  0.0023,  -0.0149,  -0.0497,  0.0898,  0.0456,  -0.0145,  -0.0928,  -0.1507,  -0.0611,  -0.0938,
+  0.012,  0.0124,  -0.0286,  -0.1319,  0.0219,  0.0311,  -0.0398,  -0.0465,  -0.0008,  -0.0375,
+  0.0138,  0.0023,  0.0024,  0.1072,  0.0531,  0.0006,  0.0292,  -0.0115,  -0.062,  0.165,
+  0.007,  -0.0251,  0.0715,  0.038,  -0.0404,  0.123,  0.0629,  0.0096,  0.0973,  0.0641,
+  -0.0586,  0.0772,  0.0128,  0.106,  0.0715,  0.0374,  -0.0074,  -0.0365,  -0.0543,  -0.0489,
+  -0.0392,  0.0871,  -0.0069,  -0.1084,  0.0264,  -0.0495,  0.0396,  0.0005,  -0.0293,  -0.024,
+  -0.0327,  0.0605,  0.0662,  0.01,  -0.0007,  -0.0525,  -0.0812,  -0.0686,  -0.0873,  -0.083,
+  0.0119,  0.0058,  0.003,  -0.0307,  0.065,  0.0175,  -0.0741,  -0.15,  -0.1947,  0.0881,
+  0.0572,  0.0411,  0.0152,  -0.0127,  -0.0589,  -0.051,  -0.0212,  -0.0834,  0.1434,  0.1318,
+  0.0518,  0.0417,  -0.043,  0.0963,  -0.0014,  0.0173,  0.0234,  -0.0273,  0.0359,  -0.0118,
+  0.0652,  0.0587,  0.0013,  -0.07,  0.1262,  0.0975,  0.068,  0.0598,  0.0048,  -0.0305,
+  -0.0185,  -0.044,  0.1178,  0.0656,  0.0052,  -0.0534,  -0.1151,  0.1116,  0.0659,  0.0344,
+  0.0788,  0.0577,  0.0452,  0.0283,  -0.0278,  0.0911,  0.028,  -0.0254,  0.0029,  -0.0361,
+  -0.0165,  -0.0322,  -0.0526,  -0.1057,  0.0927,  0.0293,  -0.1026,  -0.1671,  0.047,  0.0355,
+  0.01,  0.0001,  -0.0221,  -0.0775,  -0.1109,  -0.1416,  0.0884,  0.0441,  0.0632,  0.0409,
+  0.0204,  0.0432,  0.0141,  -0.0296,  0.1073,  0.058,  0.0383,  0.027,  -0.0857,  0.1246,
+  0.0488,  0.0231,  0.0648,  -0.0179,  0.0747,  0.0156,  -0.0384,  -0.0733,  -0.0732,  -0.097,
+  0.0005,  -0.0199,  -0.026,  -0.0511,  -0.111,  0.067,  -0.0413,  0.1571,  0.0498,  0.0191,
+  0.0037,  -0.0085,  -0.0796,  0.0086,  -0.0852,  0.085,  0.0115,  -0.0065,  0.1161,  0.0727,
+  0.0023,  0.0483,  0.0285,  -0.0642,  -0.0477,  0.0175,  0.0346,  0.0452,  0.0655,  0.0284,
+  -0.0986,  0.0463,  0.0326,  -0.0055,  0.0702,  0.0194,  -0.0423,  -0.0107,  0.0338,  0.0619,
+  0.0126,  -0.0138,  -0.1115,  0.0159,  -0.0331,  0.0217,  -0.0376,  -0.0407,  -0.0222,  -0.0503,
+  0.0222,  0.0071,  -0.049,  0.1017,  0.0551,  -0.0164,  0.1578,  0.1059,  0.0025,  -0.0107,
+  0.0124,  -0.009,  0.0322,  0.093,  0.0281,  -0.0403,  -0.0781,  0.0125,  -0.067,  -0.1058,
+  0.0363,  0.0077,  0.1052,  0.0039,  0.0676,  0.0891,  0.0433,  0.0252,  0.0224,  -0.0043,
+  -0.0045,  -0.0194,  -0.0193,  -0.048,  -0.064,  -0.0695,  -0.1597,  -0.003,  0.1728,  0.1231,
+  0.0297,  0.0025,  0.0619,  -0.0347,  -0.1171,  0.1043,  0.0868,  0.0191,  -0.0739,  -0.1075,
+  0.0073,  0.0914,  0.0367,  -0.0236,  0.0232,  0.0304,  -0.0787,  -0.1099,  0.046,  0.0082,
+  0.0296,  0.0297,  -0.0444,  0.0184,  0.0602,  -0.0295,  -0.0934,  0.0636,  -0.0347,  -0.0722,
+  -0.029,  -0.0629,  0.0598,  0.0013,  0.0064,  0.1431,  0.092,  0.0468,  -0.0311,  -0.0614,
+  -0.0152,  -0.0311,  -0.05,  -0.0672,  -0.1257,  -0.0134,  -0.022,  -0.0612,  -0.1131,  -0.1417,
+  0.0371,  0.0153,  -0.0817,  -0.0007,  0.0837,  0.0481,  0.046,  0.0678,  0.0524,  0.0432,
+  0.0126,  -0.0069,  -0.0092,  -0.0693,  -0.025,  0.151,  0.0098,  -0.0683,  -0.0566,  -0.0769,
+  -0.0199,  -0.0423,  0.0806,  0.0562,  0.0009,  -0.0563,  -0.1358,  -0.1578,  -0.0456,  0.0032,
+  0.0091,  0.0101,  -0.009,  -0.0279,  -0.0489,  -0.1038,  -0.0815,  0.2184,  0.1172,  0.0902,
+  -0.0024,  -0.0135,  0.0392,  0.0028,  0.0792,  0.0404,  0.0867,  0.161,  0.0954,  0.0846,
+  -0.0004,  -0.022,  -0.0282,  -0.1022,  -0.0799,  0.1278,  0.0765,  0.0402,  0.085,  0.0611,
+  0.0443,  0.032,  -0.0384,  -0.0964,  0.003,  -0.0398,  -0.073,  -0.0052,  -0.0267,  0.1209,
+  -0.0706,  0.1151,  0.0722,  -0.0175,  -0.0927,  -0.0559,  0.0316,  0.0186,  0.0105,  0.0314,
+  -0.0145,  -0.0263,  -0.0564,  0.0248,  -0.0181,  -0.0817,  -0.0938,  0.0366,  -0.0315,  0.1253,
+  0.0307,  0.0039,  0.129,  0.0402,  -0.0439,  -0.0384,  0.0044,  -0.0177,  -0.0172,  -0.031,
+  0.0447,  0.0298,  0.0287,  0.0273,  -0.035,  -0.0708,  -0.1829,  -0.0317,  0.0643,  0.0057,
+  -0.082,  -0.0326,  0.0209,  -0.0711,  0.0084,  0.0111,  0.0426,  0.0262,  -0.0061,  0.0005,
+  0.0545,  0.0377,  -0.0417,  -0.0625,  0.0114,  -0.0405,  0.0573,  0.0191,  -0.0263,  -0.0472,
+  -0.0053,  -0.0049,  -0.0255,  -0.0578,  -0.0237,  -0.0721,  -0.1487,  -0.1636,  0.0046,  -0.0355,
+  0.0309,  0.0107,  0.0163,  0.0132,  -0.0536,  -0.0009,  -0.0706,  -0.135,  -0.0514,  -0.096,
+  0.0306,  0.0003,  0.0494,  0.0701,  0.0027,  -0.0458,  0.078,  0.0327,  0.0937,  0.0605,
+  -0.0017,  -0.0275,  0.0797,  -0.0268,  -0.1014,  0.0593,  -0.0528,  -0.1103,  0.0682,  0.0322,
+  -0.0507,  -0.0806,  -0.0646,  -0.0052,  -0.0576,  0.0451,  0.0489,  0.015,  0.0029,  -0.0189,
+  0.027,  0.0143,  -0.0375,  -0.0071,  -0.0607,  -0.1157,  -0.0345,  -0.1115,  0.0201,  -0.0104,
+  -0.0807,  -0.1088,  0.0845,  0.072,  0.0441,  0.0301,  0.0043,  0.0052,  0.0016,  0.0201,
+  -0.029,  -0.0532,  0.0036,  -0.0201,  -0.0723,  -0.1321,  0.0867,  0.0479,  -0.0556,  -0.085,
+  -0.0271,  0.0126,  0.1283,  0.0533,  -0.003,  -0.0352,  -0.0326,  -0.0553,  0.1402,  0.1121,
+  -0.0358,  -0.0518,  -0.108,  0.0134,  0.095,  0.0384,  -0.004,  -0.0254,  0.0026,  -0.0217,
+  -0.0152,  -0.0375,  -0.0827,  0.0916,  0.0188,  0.1306,  0.0983,  0.0606,  0.0381,  0.008,
+  -0.0107,  -0.0269,  -0.0573,  -0.1189,  0.0258,  0.1009,  0.0565,  0.027,  -0.0557,  -0.0778,
+  -0.0193,  -0.0242,  -0.0784,  -0.0816,  0.0287,  -0.0484,  0.0292,  -0.0414,  0.1124,  0.0767,
+  0.0177,  -0.0148,  0.0472,  -0.0808,  0.0623,  -0.0636,  0.075,  -0.0107,  0.0673,  0.0425,
+  -0.022,  0.0577,  -0.0769,  -0.0247,  -0.0321,  0.0341,  -0.0108,  0.0109,  -0.0142,  0.0122,
+  0.0194,  0.0248,  -0.0096,  -0.0205,  -0.046,  -0.116,  0.0492,  -0.0188,  -0.1535,  0.0816,
+  0.0301,  -0.0286,  -0.0077,  -0.0117,  -0.0036,  -0.0026,  0.0133,  -0.0032,  0.0007,  -0.016,
+  0.0115,  -0.0111,  0.0246,  -0.0639,  0.0325,  -0.0313,  0.0808,  0.0435,  -0.0777,  -0.1108,
+  -0.0079,  -0.0334,  -0.0144,  -0.0539,  0.1564,  0.1175,  0.0549,  0.034,  0.0319,  0.0027,
+  -0.0155,  -0.0275,  -0.0739,  -0.0932,  0.0108,  -0.0698,  0.0036,  -0.0213,  -0.0486,  -0.067,
+  -0.0234,  -0.0567,  0.002,  0.0908,  -0.0151,  0.046,  -0.0175,  -0.0523,  0.0098,  -0.0237,
+  0.0057,  -0.0066,  -0.0418,  0.0418,  -0.0449,  0.1069,  0.0629,  -0.0016,  -0.1068,  -0.1492,
+  -0.0791,  0.0403,  -0.0009,  0.0285,  -0.0065,  0.0963,  0.055,  0.0634,  0.0693,  0.0694,
+  -0.0068,  -0.0197,  -0.0919,  0.0071,  -0.0551,  -0.1173,  0.0926,  0.0413,  0.0127,  -0.0158,
+  0.054,  0.0389,  -0.0195,  -0.08,  -0.1383,  0.044,  -0.0139,  -0.0405,  0.0147,  -0.0183,
+  0.038,  0.0248,  0.052,  -0.0609,  0.0339,  -0.007,  -0.0974,  0.1182,  0.0221,  -0.031,
+  0.0043,  0.0046,  -0.0274,  -0.0502,  0.0326,  -0.0143,  -0.0586,  -0.0866,  -0.1673,  -0.1624,
+  0.0428,  0.0385,  -0.0228,  0.0704,  0.0069,  -0.0145,  -0.0623,  -0.0639,  -0.1479,  0.0212,
+  -0.0078,  -0.0297,  0.0025,  -0.0239,  -0.0793,  0.0896,  0.0315,  -0.0546,  -0.1309,  0.108
+};
+  /* codebook/lspvqanssi3.txt */
+static const float codes2[] = {
+  -0.0291,  0.0272,  -0.0364,  -0.0313,  -0.0487,  -0.0205,  0.0501,  0.0225,  0.0178,  0.008,
+  -0.0406,  -0.0383,  0.0013,  -0.0155,  -0.0261,  -0.0598,  0.0003,  -0.0242,  0.0151,  -0.014,
+  -0.0445,  0.0356,  0.018,  -0.0272,  -0.0018,  -0.0177,  -0.0703,  0.0471,  0.0128,  -0.0068,
+  -0.0033,  -0.0285,  -0.056,  -0.0186,  -0.0499,  -0.007,  0.0068,  -0.0126,  0.0388,  -0.0097,
+  -0.0071,  -0.0114,  -0.0308,  -0.0094,  -0.0541,  -0.0272,  -0.0756,  0.0477,  -0.0234,  0.0678,
+  0.0048,  0.0307,  -0.0174,  -0.0593,  0.0097,  -0.0134,  0.0034,  -0.0212,  -0.0418,  0.0869,
+  -0.0189,  0.0165,  -0.0269,  0.0744,  0.0344,  -0.0177,  -0.0603,  0.0212,  -0.0104,  0.0345,
+  -0.013,  -0.0352,  -0.0086,  -0.0257,  -0.0286,  0.0409,  0.0656,  0.0106,  -0.0598,  0.0252,
+  0.0041,  0.0097,  -0.0032,  -0.0154,  -0.0405,  0.067,  -0.0164,  0.0451,  0.0774,  0.0504,
+  0.001,  -0.0091,  -0.0345,  0.0511,  0.0016,  0.0011,  0.0684,  0.0167,  0.0601,  0.0512,
+  0.0204,  -0.0038,  -0.0426,  0.0185,  -0.0191,  -0.063,  0.0295,  -0.0153,  -0.0559,  0.056,
+  -0.0461,  -0.0041,  0.0515,  0.0219,  0.0322,  0.0093,  0.0044,  0.0106,  -0.0329,  -0.0521,
+  0.0304,  0.0017,  0.0209,  -0.0002,  0.0689,  0.0136,  0.0216,  -0.0268,  -0.0682,  0.0333,
+  -0.0175,  -0.0425,  0.0153,  -0.005,  -0.0113,  0.0297,  -0.0659,  -0.0344,  0.0302,  -0.0272,
+  -0.0217,  -0.0362,  0.0426,  0.0233,  -0.0393,  0.0052,  0.0138,  0.0657,  0.0427,  0.022,
+  -0.0039,  -0.0011,  -0.0002,  -0.0453,  -0.0835,  0.0144,  -0.0268,  -0.0589,  -0.0185,  0.0133,
+  0.0081,  -0.0032,  0.0638,  0.0032,  0.006,  0.0002,  -0.0303,  -0.0823,  0.0124,  -0.0308,
+  0.0108,  0.0011,  0.0059,  0.0396,  0.0392,  0.0351,  -0.0045,  -0.0323,  -0.0512,  -0.0975,
+  -0.0144,  -0.0306,  -0.0302,  -0.007,  0.0123,  -0.0042,  -0.0083,  -0.0514,  0.012,  0.1116,
+  -0.0046,  -0.0131,  0.0472,  0.0144,  -0.0296,  -0.0518,  0.0337,  -0.0145,  -0.0733,  0.0793,
+  -0.0064,  -0.0162,  -0.0327,  -0.0711,  0.0108,  -0.0131,  0.0025,  -0.0254,  -0.0277,  -0.068,
+  -0.0306,  0.0055,  0.0272,  -0.0189,  -0.0173,  0.0221,  0.0773,  0.0043,  0.0458,  -0.0169,
+  -0.0006,  0.0299,  0.0259,  0.0227,  -0.053,  -0.0596,  -0.0271,  -0.0091,  0.0181,  -0.0233,
+  -0.0116,  -0.0398,  0.0089,  0.0708,  -0.0028,  -0.0084,  -0.0206,  -0.0354,  -0.0275,  -0.0037,
+  0.0259,  -0.0064,  -0.038,  0.0572,  0.0083,  0.0286,  -0.0565,  0.0158,  0.0396,  -0.0123,
+  0.0552,  0.0331,  -0.0052,  -0.0346,  -0.018,  -0.0194,  -0.0237,  0.0184,  0.0056,  -0.0199,
+  0.0143,  0.0131,  -0.0166,  0.0196,  0.0154,  0.031,  -0.0048,  0.0901,  -0.0333,  0.0761,
+  0.0118,  -0.0107,  0.0099,  0.0078,  0.0002,  -0.0716,  -0.0233,  0.0793,  0.0516,  0.03,
+  0.0204,  0.0243,  0.0192,  0.0181,  0.0001,  -0.0243,  -0.0764,  -0.0622,  -0.0324,  0.064,
+  0.0132,  0.0016,  -0.0187,  -0.0425,  0.0627,  0.0094,  -0.0786,  0.0304,  0.0294,  -0.0146,
+  -0.0221,  -0.0154,  0.0285,  -0.0709,  0.0406,  0.0114,  0.0073,  -0.0199,  0.0081,  0.0268,
+  0.0227,  0.0055,  0.0163,  -0.0447,  0.0246,  0.0795,  0.0239,  0.0211,  -0.0145,  -0.0576,
+  -0.0119,  0.0637,  0.0278,  0.0202,  -0.0086,  0.0389,  0.032,  -0.0049,  -0.0272,  -0.0274,
+  0.004,  -0.0211,  0.0426,  0.048,  0.0415,  0.0659,  0.0408,  0.0198,  0.0327,  0.0029,
+  0.043,  0.0311,  0.0083,  0.0353,  0.025,  0.0143,  0.0106,  -0.0305,  0.0633,  0.0227,
+  -0.0277,  0.0302,  0.0337,  0.0176,  0.0191,  -0.0156,  0.0231,  0.0118,  0.0465,  0.0875,
+  0.0221,  0.0146,  0.0147,  -0.0211,  -0.0317,  -0.0179,  -0.0049,  -0.0297,  -0.1078,  -0.0413,
+  -0.0531,  0.018,  -0.0066,  0.0365,  -0.0033,  0.009,  -0.0158,  -0.0698,  0.0315,  -0.0048,
+  0.0289,  0.0053,  0.0082,  0.0077,  -0.0664,  0.0474,  0.0407,  -0.0096,  0.0028,  -0.0526,
+  -0.0106,  -0.0129,  -0.0315,  0.0335,  -0.0217,  -0.0427,  0.0582,  0.0193,  -0.0288,  -0.0777,
+  -0.0003,  -0.0141,  -0.0102,  0.0007,  -0.0077,  -0.0517,  -0.0909,  0.0128,  -0.0349,  -0.0769,
+  -0.0227,  -0.0159,  -0.0327,  0.0011,  0.0312,  0.01,  -0.018,  -0.0537,  -0.0997,  0.0122,
+  0.019,  -0.0139,  0.0341,  -0.0131,  -0.0368,  -0.0138,  -0.0074,  -0.0415,  0.0791,  0.0503,
+  0.0182,  0.0027,  0.0032,  -0.0325,  -0.0309,  -0.0898,  0.0509,  -0.017,  0.0301,  -0.0137,
+  0.0233,  0.01,  0.0231,  0.073,  0.0212,  -0.0299,  0.044,  0.0041,  -0.0101,  -0.0251,
+  0.0074,  -0.0033,  -0.0285,  -0.035,  0.0101,  0.0735,  0.0036,  -0.0659,  0.0429,  -0.0052,
+  0.0148,  -0.0035,  -0.0233,  0.0079,  -0.0142,  -0.0402,  -0.0358,  -0.0985,  -0.008,  -0.0549,
+  0.0203,  0.0057,  -0.0604,  0.0098,  0.0402,  0.0151,  0.05,  0.0058,  -0.0086,  -0.0401,
+  0.0056,  -0.0381,  0.042,  -0.0125,  0.0157,  -0.0268,  0.0433,  0.0123,  -0.0176,  -0.0685,
+  0.003,  0.0502,  0.0067,  -0.0222,  0.0405,  -0.0226,  0.002,  -0.0401,  -0.0026,  -0.0521,
+  0.0317,  0.0089,  0.062,  0.0251,  0.0066,  0.0089,  -0.0565,  0.0414,  0.0005,  -0.0365,
+  -0.0058,  0.0086,  -0.0291,  -0.0164,  -0.0134,  -0.049,  -0.0427,  -0.0451,  0.0869,  0.0334,
+  0.0024,  0.0328,  -0.0415,  0.0003,  -0.0287,  0.0193,  -0.0547,  -0.0222,  -0.0196,  -0.0571,
+  -0.0271,  -0.0397,  -0.0431,  -0.0043,  0.0332,  0.0093,  0.0082,  0.0585,  0.0282,  0.0004,
+  -0.0251,  -0.0167,  -0.0289,  0.0196,  -0.0363,  0.085,  0.0028,  0.0319,  -0.0202,  -0.0512,
+  0.0389,  0.0226,  0.0401,  -0.0091,  -0.0152,  0.0001,  0.0738,  0.0402,  0.0097,  0.031,
+  -0.0126,  0.013,  -0.0046,  -0.0216,  0.0298,  -0.0344,  0.0713,  0.0547,  -0.047,  -0.0294,
+  0.0125,  0.0044,  -0.0028,  0.0209,  -0.02,  0.0854,  0.0018,  -0.0386,  -0.0703,  0.0778,
+  -0.0036,  -0.0347,  0.0309,  -0.0184,  0.029,  -0.0025,  -0.0644,  0.0347,  -0.0523,  0.0644,
+  0.0064,  0.0295,  -0.0017,  0.0282,  0.0176,  0.0027,  0.0246,  0.0967,  0.0401,  -0.0231,
+  0.0054,  -0.0109,  0.0055,  -0.0479,  -0.049,  -0.0136,  -0.0245,  0.0839,  0.0026,  -0.0493,
+  0.0128,  -0.005,  -0.0219,  -0.0621,  0.0313,  0.0019,  0.0696,  0.0459,  0.0574,  0.0299,
+  -0.0091,  -0.029,  -0.0068,  0.0276,  0.0645,  -0.015,  0.0015,  -0.0374,  0.0415,  -0.0124,
+  -0.0171,  0.0177,  -0.0138,  0.0034,  0.084,  0.0584,  0.0233,  0.01,  0.0122,  0.0047
+};
+  /* codebook/lspvqanssi4.txt */
+static const float codes3[] = {
+  0.0221,  -0.0035,  -0.0032,  -0.0177,  -0.0327,  0.0518,  -0.011,  -0.015,  -0.0136,  -0.0327,
+  0.0099,  -0.0059,  0.0031,  -0.0174,  0.0464,  -0.024,  0.0251,  -0.027,  0.0454,  -0.0082,
+  -0.0029,  0.0025,  -0.0267,  -0.0318,  -0.0157,  0.0173,  0.0253,  0.0063,  -0.0481,  0.0419,
+  -0.0332,  -0.0179,  -0.0042,  0.0241,  0.0044,  -0.0098,  -0.0081,  0.0024,  -0.0414,  0.0339,
+  -0.006,  0.0182,  -0.0051,  -0.0479,  0.0016,  -0.0179,  0.0316,  0.0222,  -0.0029,  -0.0351,
+  0.0074,  0.0015,  0.0337,  -0.0082,  -0.0008,  0.0129,  0.0001,  0.065,  0.0175,  0.0309,
+  -0.0212,  -0.0261,  0.0196,  -0.0309,  0.0093,  -0.0272,  0.026,  0.0169,  0.0132,  0.0116,
+  -0.001,  0.0202,  0.0228,  -0.0227,  -0.0141,  0.0192,  -0.0423,  -0.0097,  -0.0342,  0.0338,
+  -0.0149,  -0.011,  -0.0156,  0.029,  0.0028,  0.0123,  -0.035,  -0.0501,  0.0272,  -0.0245,
+  -0.0005,  -0.0194,  0.046,  -0.0001,  -0.028,  0.0216,  -0.0028,  -0.0162,  0.0177,  -0.0254,
+  -0.0109,  -0.0026,  0.0038,  -0.015,  -0.0421,  -0.0422,  0.0164,  -0.0436,  0.0054,  -0.0098,
+  0.0061,  -0.0106,  0.0062,  0.0207,  -0.0329,  0.0177,  -0.0578,  0.0408,  0.0077,  -0.026,
+  0.0001,  -0.0098,  0.0106,  -0.0003,  -0.0292,  0.0032,  0.056,  0.0311,  -0.0282,  -0.0445,
+  0.0033,  0.0345,  -0.0022,  -0.0029,  -0.0228,  0.0242,  0.0197,  -0.0286,  0.0194,  -0.0328,
+  0.0094,  -0.001,  0.0121,  0.0229,  0.0161,  0.0363,  -0.0124,  0.0179,  -0.0626,  0.002,
+  -0.007,  -0.0272,  -0.0171,  -0.0249,  -0.0039,  0.0254,  0.0317,  -0.0324,  0.0276,  -0.009,
+  -0.0002,  0.0057,  -0.0204,  0.0512,  -0.017,  0.0113,  0.0157,  0.0427,  -0.0024,  0.0162,
+  -0.0064,  -0.0144,  0.0216,  0.0053,  -0.0361,  0.0287,  0.023,  -0.0161,  -0.0189,  0.0589,
+  0.0091,  -0.0059,  -0.0308,  0.0171,  -0.0137,  -0.0033,  -0.0505,  -0.0155,  -0.0527,  0.0133,
+  -0.0121,  -0.0051,  0.0219,  0.0136,  0.0476,  -0.009,  -0.046,  0.0208,  0.0072,  -0.0076,
+  0.0098,  -0.0328,  -0.0211,  0.0054,  -0.0146,  -0.0263,  0.0248,  0.0045,  -0.0183,  0.0301,
+  0.0101,  0.0139,  -0.0073,  0.0234,  0.0083,  -0.0194,  -0.0365,  0.0307,  0.058,  0.0153,
+  -0.0111,  0.0019,  0.0265,  -0.015,  0.0311,  0.0362,  0.0244,  -0.0213,  -0.0224,  -0.0299,
+  0.0061,  0.0082,  -0.0181,  0.0081,  -0.0344,  0.0133,  -0.0095,  -0.0411,  0.0462,  0.0371,
+  0.0089,  -0.0157,  0.0179,  -0.0256,  -0.0118,  -0.0302,  -0.0329,  0.0212,  -0.0463,  -0.0162,
+  -0.0313,  0.0096,  -0.004,  0.0186,  0.0248,  -0.0126,  0.0472,  -0.0079,  0.0115,  -0.027,
+  0.0055,  0.0044,  0.0172,  0.0079,  -0.0089,  -0.0202,  -0.0233,  -0.0397,  -0.0305,  -0.062,
+  -0.0282,  -0.0104,  -0.0071,  -0.0242,  -0.0255,  0.0204,  -0.0187,  -0.0103,  -0.0227,  -0.0424,
+  -0.0056,  0.0065,  0.0151,  -0.0376,  0.0039,  0.0009,  -0.0507,  -0.004,  0.0393,  -0.0201,
+  0.0128,  -0.0228,  0.0115,  -0.0446,  0.0316,  0.0266,  -0.0036,  0.0117,  -0.0009,  0.0048,
+  -0.0088,  0.0226,  0.0125,  0.009,  0.0008,  -0.0341,  0.0243,  -0.0178,  -0.0589,  0.0278,
+  0.0151,  0.0021,  -0.0349,  -0.0365,  -0.0098,  -0.0179,  -0.0212,  -0.0313,  0.0109,  -0.0164,
+  -0.0211,  -0.0112,  -0.0446,  0.0014,  -0.0034,  -0.0179,  0.011,  0.0176,  0.0286,  0.0045,
+  0.0034,  -0.0151,  0.038,  0.0331,  -0.0034,  -0.0439,  0.0145,  0.012,  0.0036,  0.0017,
+  -0.0348,  0.0192,  0.0167,  0.0069,  -0.0266,  -0.0085,  -0.0076,  0.026,  0.0234,  0.0075,
+  -0.0237,  0.015,  -0.0094,  -0.0201,  0.0234,  -0.0041,  -0.016,  -0.0549,  -0.0021,  0.0239,
+  -0.0019,  0.0173,  0.0295,  0.0443,  0.0081,  0.0181,  -0.0039,  -0.027,  0.0155,  0.0107,
+  0.0065,  -0.0055,  -0.0368,  0.0232,  0.037,  0.0367,  0.0046,  -0.0167,  0.0047,  0.0173,
+  0.0116,  0.0053,  -0.0229,  0.0382,  0.016,  -0.0453,  0.0057,  -0.0267,  0.002,  -0.0051,
+  -0.014,  0.0302,  -0.0208,  0.0106,  0.0101,  -0.0049,  -0.0319,  0.0227,  -0.0206,  -0.0371,
+  -0.0007,  -0.0109,  -0.0053,  0.0078,  0.041,  -0.0001,  0.0543,  0.0328,  -0.0196,  0.0332,
+  -0.0043,  -0.0028,  -0.0246,  0.0285,  -0.0248,  0.0153,  0.0303,  -0.031,  -0.0335,  -0.0315,
+  -0.0417,  0.1029,  0.0377,  0.0069,  0.0012,  0.0065,  0.0007,  -0.0144,  -0.0083,  0.0004,
+  0.0295,  0.0099,  -0.0144,  -0.0145,  0.0141,  -0.0013,  0.0362,  -0.0142,  -0.0428,  -0.0161,
+  -0.0095,  -0.0206,  0.0116,  0.0132,  0.0164,  0.0158,  0.0012,  -0.0024,  0.064,  0.0364,
+  0.0005,  -0.0022,  -0.0165,  -0.0057,  0.0263,  0.0339,  0.0014,  0.0541,  0.0164,  -0.0411,
+  0.0039,  -0.0143,  -0.0107,  0.0032,  -0.016,  -0.0502,  0.001,  0.0272,  0.0161,  -0.05,
+  0.0083,  0.0292,  -0.0076,  -0.0201,  0.0313,  0.0213,  0.012,  0.0087,  0.0285,  0.0332,
+  0.017,  0.0018,  0.0001,  0.0205,  0.0106,  -0.0064,  -0.0082,  -0.0083,  -0.0082,  0.0886,
+  0.0075,  -0.0078,  -0.0038,  -0.0337,  -0.0491,  0.0048,  0.0069,  0.03,  0.0369,  0.0088,
+  -0.0091,  -0.0327,  0.0041,  0.0376,  0.017,  0.0154,  0.0126,  0.0153,  -0.0024,  -0.0353,
+  0.0289,  -0.008,  0.0063,  0.0274,  -0.0061,  0.0208,  0.039,  -0.006,  0.0294,  -0.0088,
+  -0.0037,  -0.0195,  0.0058,  0.0023,  -0.0149,  -0.036,  -0.0587,  -0.0248,  0.0288,  0.0203,
+  -0.0031,  0.0081,  -0.0112,  -0.0221,  0.0067,  -0.0505,  -0.0233,  0.0353,  -0.0131,  0.0417,
+  0.0243,  0.0231,  -0.0013,  0.0049,  -0.0423,  -0.0245,  -0.0029,  0.0184,  -0.0162,  -0.001,
+  0.0045,  0.0101,  -0.0042,  0.0014,  -0.0133,  -0.0321,  0.0642,  0.0153,  0.0377,  0.0277,
+  0.0275,  0.0083,  0.0286,  -0.0243,  -0.0084,  -0.0236,  0.0027,  -0.0289,  0.0201,  0.0235,
+  0.0281,  0.0078,  0.0038,  0.0069,  0.0302,  0.017,  -0.0423,  -0.034,  0.0104,  -0.0181,
+  0.0334,  -0.0034,  -0.0257,  -0.0061,  0.014,  -0.0099,  -0.0195,  0.0529,  0.0019,  0.001,
+  -0.0114,  0.0012,  -0.0038,  -0.0016,  -0.014,  0.0697,  0.0372,  0.0243,  0.0172,  0.0066,
+  0.0192,  0.0149,  0.0285,  0.0077,  0.0246,  -0.0135,  0.0145,  0.0317,  -0.0074,  -0.0438,
+  -0.0034,  -0.0175,  -0.0245,  -0.0153,  0.0357,  -0.0102,  -0.0062,  -0.0053,  -0.0308,  -0.0499,
+  0.0025,  -0.0253,  0.0148,  0.0031,  0.0189,  -0.0023,  -0.0085,  -0.0596,  -0.0337,  0.0175,
+  -0.0091,  -0.0171,  -0.0217,  -0.0189,  0.0056,  0.0249,  -0.0499,  0.0236,  0.0042,  0.0449
+};
+
+const struct lsp_codebook lsp_cbvqanssi[] = {
+  /* codebook/lspvqanssi1.txt */
+  {
+    10,
+    8,
+    256,
+    codes0
+  },
+  /* codebook/lspvqanssi2.txt */
+  {
+    10,
+    7,
+    128,
+    codes1
+  },
+  /* codebook/lspvqanssi3.txt */
+  {
+    10,
+    6,
+    64,
+    codes2
+  },
+  /* codebook/lspvqanssi4.txt */
+  {
+    10,
+    6,
+    64,
+    codes3
+  },
+  { 0, 0, 0, 0 }
+};
diff --git a/codec2/tags/0.4/src/codec2.c b/codec2/tags/0.4/src/codec2.c
new file mode 100644 (file)
index 0000000..c2eff53
--- /dev/null
@@ -0,0 +1,1765 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: codec2.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 21/8/2010
+
+  Codec2 fully quantised encoder and decoder functions.  If you want use 
+  codec2, the codec2_xxx functions are for you.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2010 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "nlp.h"
+#include "dump.h"
+#include "lpc.h"
+#include "quantise.h"
+#include "phase.h"
+#include "interp.h"
+#include "postfilter.h"
+#include "codec2.h"
+#include "lsp.h"
+#include "codec2_internal.h"
+#include "machdep.h"
+#include "bpf.h"
+
+/*---------------------------------------------------------------------------*\
+                                                       
+                             FUNCTION HEADERS
+
+\*---------------------------------------------------------------------------*/
+
+void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]);
+void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model,
+                         COMP Aw[]);
+void codec2_encode_3200(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char * bits);
+void codec2_encode_2400(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char * bits);
+void codec2_encode_1600(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_1600(struct CODEC2 *c2, short speech[], const unsigned char * bits);
+void codec2_encode_1400(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_1400(struct CODEC2 *c2, short speech[], const unsigned char * bits);
+void codec2_encode_1300(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char * bits, float ber_est);
+void codec2_encode_1200(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_1200(struct CODEC2 *c2, short speech[], const unsigned char * bits);
+void codec2_encode_700(struct CODEC2 *c2, unsigned char * bits, short speech[]);
+void codec2_decode_700(struct CODEC2 *c2, short speech[], const unsigned char * bits);
+static void ear_protection(float in_out[], int n);
+
+/*---------------------------------------------------------------------------*\
+                                                       
+                                FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_create       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 21/8/2010 
+
+  Create and initialise an instance of the codec.  Returns a pointer
+  to the codec states or NULL on failure.  One set of states is
+  sufficient for a full duuplex codec (i.e. an encoder and decoder).
+  You don't need separate states for encoders and decoders.  See
+  c2enc.c and c2dec.c for examples.
+
+\*---------------------------------------------------------------------------*/
+
+struct CODEC2 * codec2_create(int mode)
+{
+    struct CODEC2 *c2;
+    int            i,l;
+
+    c2 = (struct CODEC2*)malloc(sizeof(struct CODEC2));
+    if (c2 == NULL)
+       return NULL;
+    
+    assert(
+          (mode == CODEC2_MODE_3200) || 
+          (mode == CODEC2_MODE_2400) || 
+          (mode == CODEC2_MODE_1600) || 
+          (mode == CODEC2_MODE_1400) || 
+          (mode == CODEC2_MODE_1300) || 
+          (mode == CODEC2_MODE_1200) ||
+          (mode == CODEC2_MODE_700) 
+          );
+    c2->mode = mode;
+    for(i=0; i<M; i++)
+       c2->Sn[i] = 1.0;
+    c2->hpf_states[0] = c2->hpf_states[1] = 0.0;
+    for(i=0; i<2*N; i++)
+       c2->Sn_[i] = 0;
+    c2->fft_fwd_cfg = kiss_fft_alloc(FFT_ENC, 0, NULL, NULL);
+    make_analysis_window(c2->fft_fwd_cfg, c2->w,c2->W);
+    make_synthesis_window(c2->Pn);
+    c2->fft_inv_cfg = kiss_fft_alloc(FFT_DEC, 1, NULL, NULL);
+    quantise_init();
+    c2->prev_Wo_enc = 0.0;
+    c2->bg_est = 0.0;
+    c2->ex_phase = 0.0;
+
+    for(l=1; l<=MAX_AMP; l++)
+       c2->prev_model_dec.A[l] = 0.0;
+    c2->prev_model_dec.Wo = TWO_PI/P_MAX;
+    c2->prev_model_dec.L = PI/c2->prev_model_dec.Wo;
+    c2->prev_model_dec.voiced = 0;
+
+    for(i=0; i<LPC_ORD; i++) {
+      c2->prev_lsps_dec[i] = i*PI/(LPC_ORD+1);
+    }
+    c2->prev_e_dec = 1;
+
+    c2->nlp = nlp_create(M);
+    if (c2->nlp == NULL) {
+       free (c2);
+       return NULL;
+    }
+
+    c2->gray = 1;
+
+    c2->lpc_pf = 1; c2->bass_boost = 1; c2->beta = LPCPF_BETA; c2->gamma = LPCPF_GAMMA;
+
+    c2->xq_enc[0] = c2->xq_enc[1] = 0.0;
+    c2->xq_dec[0] = c2->xq_dec[1] = 0.0;
+
+    c2->smoothing = 0;
+
+    c2->bpf_buf = (float*)malloc(sizeof(float)*(BPF_N+4*N));
+    assert(c2->bpf_buf != NULL);
+    for(i=0; i<BPF_N+4*N; i++)
+        c2->bpf_buf[i] = 0.0;
+    
+    c2->softdec = NULL;
+
+    return c2;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_destroy      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 21/8/2010 
+
+  Destroy an instance of the codec.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_destroy(struct CODEC2 *c2)
+{
+    assert(c2 != NULL);
+    free(c2->bpf_buf);
+    nlp_destroy(c2->nlp);
+    KISS_FFT_FREE(c2->fft_fwd_cfg);
+    KISS_FFT_FREE(c2->fft_inv_cfg);
+    free(c2);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_bits_per_frame     
+  AUTHOR......: David Rowe                           
+  DATE CREATED: Nov 14 2011
+
+  Returns the number of bits per frame.
+
+\*---------------------------------------------------------------------------*/
+
+int codec2_bits_per_frame(struct CODEC2 *c2) {
+    if (c2->mode == CODEC2_MODE_3200)
+       return 64;
+    if (c2->mode == CODEC2_MODE_2400)
+       return 48;
+    if  (c2->mode == CODEC2_MODE_1600)
+       return 64;
+    if  (c2->mode == CODEC2_MODE_1400)
+       return 56;
+    if  (c2->mode == CODEC2_MODE_1300)
+       return 52;
+    if  (c2->mode == CODEC2_MODE_1200)
+       return 48;
+    if  (c2->mode == CODEC2_MODE_700)
+       return 28;
+
+    return 0; /* shouldn't get here */
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_samples_per_frame     
+  AUTHOR......: David Rowe                           
+  DATE CREATED: Nov 14 2011
+
+  Returns the number of speech samples per frame.
+
+\*---------------------------------------------------------------------------*/
+
+int codec2_samples_per_frame(struct CODEC2 *c2) {
+    if (c2->mode == CODEC2_MODE_3200)
+       return 160;
+    if (c2->mode == CODEC2_MODE_2400)
+       return 160;
+    if  (c2->mode == CODEC2_MODE_1600)
+       return 320;
+    if  (c2->mode == CODEC2_MODE_1400)
+       return 320;
+    if  (c2->mode == CODEC2_MODE_1300)
+       return 320;
+    if  (c2->mode == CODEC2_MODE_1200)
+       return 320;
+    if  (c2->mode == CODEC2_MODE_700)
+       return 320;
+
+    return 0; /* shouldnt get here */
+}
+
+void codec2_encode(struct CODEC2 *c2, unsigned char *bits, short speech[])
+{
+    assert(c2 != NULL);
+    assert(
+          (c2->mode == CODEC2_MODE_3200) || 
+          (c2->mode == CODEC2_MODE_2400) || 
+          (c2->mode == CODEC2_MODE_1600) || 
+          (c2->mode == CODEC2_MODE_1400) || 
+          (c2->mode == CODEC2_MODE_1300) || 
+          (c2->mode == CODEC2_MODE_1200) ||
+          (c2->mode == CODEC2_MODE_700)
+          );
+
+    if (c2->mode == CODEC2_MODE_3200)
+       codec2_encode_3200(c2, bits, speech);
+    if (c2->mode == CODEC2_MODE_2400)
+       codec2_encode_2400(c2, bits, speech);
+    if (c2->mode == CODEC2_MODE_1600)
+       codec2_encode_1600(c2, bits, speech);
+    if (c2->mode == CODEC2_MODE_1400)
+       codec2_encode_1400(c2, bits, speech);
+    if (c2->mode == CODEC2_MODE_1300)
+       codec2_encode_1300(c2, bits, speech);
+    if (c2->mode == CODEC2_MODE_1200)
+       codec2_encode_1200(c2, bits, speech);
+    if (c2->mode == CODEC2_MODE_700)
+       codec2_encode_700(c2, bits, speech);
+}
+
+void codec2_decode(struct CODEC2 *c2, short speech[], const unsigned char *bits)
+{
+    codec2_decode_ber(c2, speech, bits, 0.0);
+}
+
+void codec2_decode_ber(struct CODEC2 *c2, short speech[], const unsigned char *bits, float ber_est)
+{
+    assert(c2 != NULL);
+    assert(
+          (c2->mode == CODEC2_MODE_3200) || 
+          (c2->mode == CODEC2_MODE_2400) || 
+          (c2->mode == CODEC2_MODE_1600) || 
+          (c2->mode == CODEC2_MODE_1400) || 
+          (c2->mode == CODEC2_MODE_1300) || 
+          (c2->mode == CODEC2_MODE_1200) ||
+          (c2->mode == CODEC2_MODE_700)
+          );
+
+    if (c2->mode == CODEC2_MODE_3200)
+       codec2_decode_3200(c2, speech, bits);
+    if (c2->mode == CODEC2_MODE_2400)
+       codec2_decode_2400(c2, speech, bits);
+    if (c2->mode == CODEC2_MODE_1600)
+       codec2_decode_1600(c2, speech, bits);
+    if (c2->mode == CODEC2_MODE_1400)
+       codec2_decode_1400(c2, speech, bits);
+    if (c2->mode == CODEC2_MODE_1300)
+       codec2_decode_1300(c2, speech, bits, ber_est);
+    if (c2->mode == CODEC2_MODE_1200)
+       codec2_decode_1200(c2, speech, bits);
+    if (c2->mode == CODEC2_MODE_700)
+       codec2_decode_700(c2, speech, bits);
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_3200          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 13 Sep 2012
+
+  Encodes 160 speech samples (20ms of speech) into 64 bits.  
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm twice.  On the
+  first frame we just send the voicing bits.  On the second frame we
+  send all model parameters.  Compared to 2400 we use a larger number
+  of bits for the LSPs and non-VQ pitch and energy.
+
+  The bit allocation is:
+
+    Parameter                      bits/frame
+    --------------------------------------
+    Harmonic magnitudes (LSPs)     50
+    Pitch (Wo)                      7
+    Energy                          5
+    Voicing (10ms update)           2
+    TOTAL                          64
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_3200(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   ak[LPC_ORD+1];
+    float   lsps[LPC_ORD];
+    float   e;
+    int     Wo_index, e_index;
+    int     lspd_indexes[LPC_ORD];
+    int     i;
+    unsigned int nbit = 0;
+
+    assert(c2 != NULL);
+
+    memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* first 10ms analysis frame - we just want voicing */
+
+    analyse_one_frame(c2, &model, speech);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* second 10ms analysis frame */
+
+    analyse_one_frame(c2, &model, &speech[N]);
+    pack(bits, &nbit, model.voiced, 1);
+    Wo_index = encode_Wo(model.Wo, WO_BITS);
+    pack(bits, &nbit, Wo_index, WO_BITS);
+   
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    e_index = encode_energy(e, E_BITS);
+    pack(bits, &nbit, e_index, E_BITS);
+
+    encode_lspds_scalar(lspd_indexes, lsps, LPC_ORD);
+    for(i=0; i<LSPD_SCALAR_INDEXES; i++) {
+       pack(bits, &nbit, lspd_indexes[i], lspd_bits(i));
+    }
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_3200          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 13 Sep 2012
+
+  Decodes a frame of 64 bits into 160 samples (20ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char * bits)
+{
+    MODEL   model[2];
+    int     lspd_indexes[LPC_ORD];
+    float   lsps[2][LPC_ORD];
+    int     Wo_index, e_index;
+    float   e[2];
+    float   snr;
+    float   ak[2][LPC_ORD+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    COMP    Aw[FFT_ENC];
+
+    assert(c2 != NULL);
+    
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<2; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    /* this will partially fill the model params for the 2 x 10ms
+       frames */
+
+    model[0].voiced = unpack(bits, &nbit, 1);
+    model[1].voiced = unpack(bits, &nbit, 1);
+
+    Wo_index = unpack(bits, &nbit, WO_BITS);
+    model[1].Wo = decode_Wo(Wo_index, WO_BITS);
+    model[1].L  = PI/model[1].Wo;
+
+    e_index = unpack(bits, &nbit, E_BITS);
+    e[1] = decode_energy(e_index, E_BITS);
+
+    for(i=0; i<LSPD_SCALAR_INDEXES; i++) {
+       lspd_indexes[i] = unpack(bits, &nbit, lspd_bits(i));
+    }
+    decode_lspds_scalar(&lsps[1][0], lspd_indexes, LPC_ORD);
+    /* interpolate ------------------------------------------------*/
+
+    /* Wo and energy are sampled every 20ms, so we interpolate just 1
+       10ms frame between 20ms samples */
+
+    interp_Wo(&model[0], &c2->prev_model_dec, &model[1]);
+    e[0] = interp_energy(c2->prev_e_dec, e[1]);
+
+    /* LSPs are sampled every 20ms so we interpolate the frame in
+       between, then recover spectral amplitudes */
+
+    interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5, LPC_ORD);
+
+    for(i=0; i<2; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[1];
+    c2->prev_e_dec = e[1];
+    for(i=0; i<LPC_ORD; i++)
+       c2->prev_lsps_dec[i] = lsps[1][i];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_2400          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 21/8/2010 
+
+  Encodes 160 speech samples (20ms of speech) into 48 bits.  
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm twice.  On the
+  first frame we just send the voicing bit.  On the second frame we
+  send all model parameters.
+
+  The bit allocation is:
+
+    Parameter                      bits/frame
+    --------------------------------------
+    Harmonic magnitudes (LSPs)     36
+    Joint VQ of Energy and Wo       8
+    Voicing (10ms update)           2
+    Spare                           2
+    TOTAL                          48
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_2400(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   ak[LPC_ORD+1];
+    float   lsps[LPC_ORD];
+    float   e;
+    int     WoE_index;
+    int     lsp_indexes[LPC_ORD];
+    int     i;
+    int     spare = 0;
+    unsigned int nbit = 0;
+
+    assert(c2 != NULL);
+
+    memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* first 10ms analysis frame - we just want voicing */
+
+    analyse_one_frame(c2, &model, speech);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* second 10ms analysis frame */
+
+    analyse_one_frame(c2, &model, &speech[N]);
+    pack(bits, &nbit, model.voiced, 1);
+    
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    WoE_index = encode_WoE(&model, e, c2->xq_enc);
+    pack(bits, &nbit, WoE_index, WO_E_BITS);
+
+    encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       pack(bits, &nbit, lsp_indexes[i], lsp_bits(i));
+    }
+    pack(bits, &nbit, spare, 2);
+
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_2400          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 21/8/2010 
+
+  Decodes frames of 48 bits into 160 samples (20ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char * bits)
+{
+    MODEL   model[2];
+    int     lsp_indexes[LPC_ORD];
+    float   lsps[2][LPC_ORD];
+    int     WoE_index;
+    float   e[2];
+    float   snr;
+    float   ak[2][LPC_ORD+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    COMP    Aw[FFT_ENC];
+
+    assert(c2 != NULL);
+    
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<2; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    /* this will partially fill the model params for the 2 x 10ms
+       frames */
+
+    model[0].voiced = unpack(bits, &nbit, 1);
+
+    model[1].voiced = unpack(bits, &nbit, 1);
+    WoE_index = unpack(bits, &nbit, WO_E_BITS);
+    decode_WoE(&model[1], &e[1], c2->xq_dec, WoE_index);
+
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i));
+    }
+    decode_lsps_scalar(&lsps[1][0], lsp_indexes, LPC_ORD);
+    check_lsp_order(&lsps[1][0], LPC_ORD);
+    bw_expand_lsps(&lsps[1][0], LPC_ORD, 50.0, 100.0);
+    /* interpolate ------------------------------------------------*/
+
+    /* Wo and energy are sampled every 20ms, so we interpolate just 1
+       10ms frame between 20ms samples */
+
+    interp_Wo(&model[0], &c2->prev_model_dec, &model[1]);
+    e[0] = interp_energy(c2->prev_e_dec, e[1]);
+    /* LSPs are sampled every 20ms so we interpolate the frame in
+       between, then recover spectral amplitudes */
+
+    interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5, LPC_ORD);
+    for(i=0; i<2; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[1];
+    c2->prev_e_dec = e[1];
+    for(i=0; i<LPC_ORD; i++)
+       c2->prev_lsps_dec[i] = lsps[1][i];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_1600          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: Feb 28 2013
+
+  Encodes 320 speech samples (40ms of speech) into 64 bits.
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm 4 times:
+
+  frame 0: voicing bit
+  frame 1: voicing bit, Wo and E
+  frame 2: voicing bit
+  frame 3: voicing bit, Wo and E, scalar LSPs
+
+  The bit allocation is:
+
+    Parameter                      frame 2  frame 4   Total
+    -------------------------------------------------------
+    Harmonic magnitudes (LSPs)      0       36        36
+    Pitch (Wo)                      7        7        14
+    Energy                          5        5        10
+    Voicing (10ms update)           2        2         4
+    TOTAL                          14       50        64
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_1600(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   lsps[LPC_ORD];
+    float   ak[LPC_ORD+1];
+    float   e;
+    int     lsp_indexes[LPC_ORD];
+    int     Wo_index, e_index;
+    int     i;
+    unsigned int nbit = 0;
+    
+    assert(c2 != NULL);
+
+    memset(bits, '\0',  ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* frame 1: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, speech);
+    pack(bits, &nbit, model.voiced, 1);
+    /* frame 2: - voicing, scalar Wo & E -------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[N]);
+    pack(bits, &nbit, model.voiced, 1);
+    Wo_index = encode_Wo(model.Wo, WO_BITS);
+    pack(bits, &nbit, Wo_index, WO_BITS);
+
+    /* need to run this just to get LPC energy */
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    e_index = encode_energy(e, E_BITS);
+    pack(bits, &nbit, e_index, E_BITS);
+
+    /* frame 3: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[2*N]);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* frame 4: - voicing, scalar Wo & E, scalar LSPs ------------------*/
+
+    analyse_one_frame(c2, &model, &speech[3*N]);
+    pack(bits, &nbit, model.voiced, 1);
+    Wo_index = encode_Wo(model.Wo, WO_BITS);
+    pack(bits, &nbit, Wo_index, WO_BITS);
+
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    e_index = encode_energy(e, E_BITS);
+    pack(bits, &nbit, e_index, E_BITS);
+    encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       pack(bits, &nbit, lsp_indexes[i], lsp_bits(i));
+    }
+
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_1600          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11 May 2012
+
+  Decodes frames of 64 bits into 320 samples (40ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode_1600(struct CODEC2 *c2, short speech[], const unsigned char * bits)
+{
+    MODEL   model[4];
+    int     lsp_indexes[LPC_ORD];
+    float   lsps[4][LPC_ORD];
+    int     Wo_index, e_index;
+    float   e[4];
+    float   snr;
+    float   ak[4][LPC_ORD+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    float   weight;
+    COMP    Aw[FFT_ENC];
+    
+    assert(c2 != NULL);
+
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<4; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    /* this will partially fill the model params for the 4 x 10ms
+       frames */
+
+    model[0].voiced = unpack(bits, &nbit, 1);
+    
+    model[1].voiced = unpack(bits, &nbit, 1);
+    Wo_index = unpack(bits, &nbit, WO_BITS);
+    model[1].Wo = decode_Wo(Wo_index, WO_BITS);
+    model[1].L  = PI/model[1].Wo;
+
+    e_index = unpack(bits, &nbit, E_BITS);
+    e[1] = decode_energy(e_index, E_BITS);
+
+    model[2].voiced = unpack(bits, &nbit, 1);
+
+    model[3].voiced = unpack(bits, &nbit, 1);
+    Wo_index = unpack(bits, &nbit, WO_BITS);
+    model[3].Wo = decode_Wo(Wo_index, WO_BITS);
+    model[3].L  = PI/model[3].Wo;
+
+    e_index = unpack(bits, &nbit, E_BITS);
+    e[3] = decode_energy(e_index, E_BITS);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i));
+    }
+    decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD);
+    check_lsp_order(&lsps[3][0], LPC_ORD);
+    bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0);
+    /* interpolate ------------------------------------------------*/
+
+    /* Wo and energy are sampled every 20ms, so we interpolate just 1
+       10ms frame between 20ms samples */
+
+    interp_Wo(&model[0], &c2->prev_model_dec, &model[1]);
+    e[0] = interp_energy(c2->prev_e_dec, e[1]);
+    interp_Wo(&model[2], &model[1], &model[3]);
+    e[2] = interp_energy(e[1], e[3]);
+
+    /* LSPs are sampled every 40ms so we interpolate the 3 frames in
+       between, then recover spectral amplitudes */
+
+    for(i=0, weight=0.25; i<3; i++, weight += 0.25) {
+       interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD);
+    }
+    for(i=0; i<4; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[3];
+    c2->prev_e_dec = e[3];
+    for(i=0; i<LPC_ORD; i++)
+       c2->prev_lsps_dec[i] = lsps[3][i];
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_1400          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 11 2012
+
+  Encodes 320 speech samples (40ms of speech) into 56 bits.
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm 4 times:
+
+  frame 0: voicing bit
+  frame 1: voicing bit, joint VQ of Wo and E
+  frame 2: voicing bit
+  frame 3: voicing bit, joint VQ of Wo and E, scalar LSPs
+
+  The bit allocation is:
+
+    Parameter                      frame 2  frame 4   Total
+    -------------------------------------------------------
+    Harmonic magnitudes (LSPs)      0       36        36
+    Energy+Wo                       8        8        16
+    Voicing (10ms update)           2        2         4
+    TOTAL                          10       46        56
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_1400(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   lsps[LPC_ORD];
+    float   ak[LPC_ORD+1];
+    float   e;
+    int     lsp_indexes[LPC_ORD];
+    int     WoE_index;
+    int     i;
+    unsigned int nbit = 0;
+
+    assert(c2 != NULL);
+
+    memset(bits, '\0',  ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* frame 1: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, speech);
+    pack(bits, &nbit, model.voiced, 1);
+    /* frame 2: - voicing, joint Wo & E -------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[N]);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* need to run this just to get LPC energy */
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+
+    WoE_index = encode_WoE(&model, e, c2->xq_enc);
+    pack(bits, &nbit, WoE_index, WO_E_BITS);
+    /* frame 3: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[2*N]);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* frame 4: - voicing, joint Wo & E, scalar LSPs ------------------*/
+
+    analyse_one_frame(c2, &model, &speech[3*N]);
+    pack(bits, &nbit, model.voiced, 1);
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    WoE_index = encode_WoE(&model, e, c2->xq_enc);
+    pack(bits, &nbit, WoE_index, WO_E_BITS);
+    encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       pack(bits, &nbit, lsp_indexes[i], lsp_bits(i));
+    }
+
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_1400          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11 May 2012
+
+  Decodes frames of 56 bits into 320 samples (40ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode_1400(struct CODEC2 *c2, short speech[], const unsigned char * bits)
+{
+    MODEL   model[4];
+    int     lsp_indexes[LPC_ORD];
+    float   lsps[4][LPC_ORD];
+    int     WoE_index;
+    float   e[4];
+    float   snr;
+    float   ak[4][LPC_ORD+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    float   weight;
+    COMP    Aw[FFT_ENC];
+
+    assert(c2 != NULL);
+
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<4; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    /* this will partially fill the model params for the 4 x 10ms
+       frames */
+
+    model[0].voiced = unpack(bits, &nbit, 1);
+    
+    model[1].voiced = unpack(bits, &nbit, 1);
+    WoE_index = unpack(bits, &nbit, WO_E_BITS);
+    decode_WoE(&model[1], &e[1], c2->xq_dec, WoE_index);
+
+    model[2].voiced = unpack(bits, &nbit, 1);
+
+    model[3].voiced = unpack(bits, &nbit, 1);
+    WoE_index = unpack(bits, &nbit, WO_E_BITS);
+    decode_WoE(&model[3], &e[3], c2->xq_dec, WoE_index);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i));
+    }
+    decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD);
+    check_lsp_order(&lsps[3][0], LPC_ORD);
+    bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0);
+    /* interpolate ------------------------------------------------*/
+
+    /* Wo and energy are sampled every 20ms, so we interpolate just 1
+       10ms frame between 20ms samples */
+
+    interp_Wo(&model[0], &c2->prev_model_dec, &model[1]);
+    e[0] = interp_energy(c2->prev_e_dec, e[1]);
+    interp_Wo(&model[2], &model[1], &model[3]);
+    e[2] = interp_energy(e[1], e[3]);
+    /* LSPs are sampled every 40ms so we interpolate the 3 frames in
+       between, then recover spectral amplitudes */
+
+    for(i=0, weight=0.25; i<3; i++, weight += 0.25) {
+       interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD);
+    }
+    for(i=0; i<4; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[3];
+    c2->prev_e_dec = e[3];
+    for(i=0; i<LPC_ORD; i++)
+       c2->prev_lsps_dec[i] = lsps[3][i];
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_1300          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: March 14 2013
+
+  Encodes 320 speech samples (40ms of speech) into 52 bits.
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm 4 times:
+
+  frame 0: voicing bit
+  frame 1: voicing bit, 
+  frame 2: voicing bit
+  frame 3: voicing bit, Wo and E, scalar LSPs
+
+  The bit allocation is:
+
+    Parameter                      frame 2  frame 4   Total
+    -------------------------------------------------------
+    Harmonic magnitudes (LSPs)      0       36        36
+    Pitch (Wo)                      0        7         7
+    Energy                          0        5         5
+    Voicing (10ms update)           2        2         4
+    TOTAL                           2       50        52
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_1300(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   lsps[LPC_ORD];
+    float   ak[LPC_ORD+1];
+    float   e;
+    int     lsp_indexes[LPC_ORD];
+    int     Wo_index, e_index;
+    int     i;
+    unsigned int nbit = 0;
+    #ifdef PROFILE
+    unsigned int quant_start;
+    #endif
+
+    assert(c2 != NULL);
+
+    memset(bits, '\0',  ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* frame 1: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, speech);
+    pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray);
+    /* frame 2: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[N]);
+    pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray);
+    /* frame 3: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[2*N]);
+    pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray);
+
+    /* frame 4: - voicing, scalar Wo & E, scalar LSPs ------------------*/
+
+    analyse_one_frame(c2, &model, &speech[3*N]);
+    pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray);
+    Wo_index = encode_Wo(model.Wo, WO_BITS);
+    pack_natural_or_gray(bits, &nbit, Wo_index, WO_BITS, c2->gray);
+
+    #ifdef PROFILE
+    quant_start = machdep_profile_sample();
+    #endif
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    e_index = encode_energy(e, E_BITS);
+    pack_natural_or_gray(bits, &nbit, e_index, E_BITS, c2->gray);
+    encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       pack_natural_or_gray(bits, &nbit, lsp_indexes[i], lsp_bits(i), c2->gray);
+    }
+    #ifdef PROFILE
+    machdep_profile_sample_and_log(quant_start, "    quant/packing"); 
+    #endif
+
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_1300          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11 May 2012
+
+  Decodes frames of 52 bits into 320 samples (40ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+static int frames;
+void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char * bits, float ber_est)
+{
+    MODEL   model[4];
+    int     lsp_indexes[LPC_ORD];
+    float   lsps[4][LPC_ORD];
+    int     Wo_index, e_index;
+    float   e[4];
+    float   snr;
+    float   ak[4][LPC_ORD+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    float   weight;
+    COMP    Aw[FFT_ENC];
+    PROFILE_VAR(recover_start);
+    
+    assert(c2 != NULL);
+    frames+= 4;
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<4; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    /* this will partially fill the model params for the 4 x 10ms
+       frames */
+
+    model[0].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray);    
+    model[1].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray);
+    model[2].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray);
+    model[3].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray);
+
+    Wo_index = unpack_natural_or_gray(bits, &nbit, WO_BITS, c2->gray);
+    model[3].Wo = decode_Wo(Wo_index, WO_BITS);
+    model[3].L  = PI/model[3].Wo;
+
+    e_index = unpack_natural_or_gray(bits, &nbit, E_BITS, c2->gray);
+    e[3] = decode_energy(e_index, E_BITS);
+    for(i=0; i<LSP_SCALAR_INDEXES; i++) {
+       lsp_indexes[i] = unpack_natural_or_gray(bits, &nbit, lsp_bits(i), c2->gray);
+    }
+    decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD);
+    check_lsp_order(&lsps[3][0], LPC_ORD);
+    bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0);
+    if (ber_est > 0.15) {
+        model[0].voiced =  model[1].voiced = model[2].voiced = model[3].voiced = 0;
+        e[3] = decode_energy(10, E_BITS);
+        bw_expand_lsps(&lsps[3][0], LPC_ORD, 200.0, 200.0);
+        fprintf(stderr, "soft mute\n");
+    }
+
+    /* interpolate ------------------------------------------------*/
+
+    /* Wo, energy, and LSPs are sampled every 40ms so we interpolate
+       the 3 frames in between */
+
+    PROFILE_SAMPLE(recover_start);
+    for(i=0, weight=0.25; i<3; i++, weight += 0.25) {
+       interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD);
+        interp_Wo2(&model[i], &c2->prev_model_dec, &model[3], weight);
+        e[i] = interp_energy2(c2->prev_e_dec, e[3],weight);
+    }
+
+    /* then recover spectral amplitudes */    
+
+    for(i=0; i<4; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+    /*
+    for(i=0; i<4; i++) {
+        printf("%d Wo: %f L: %d v: %d\n", frames, model[i].Wo, model[i].L, model[i].voiced);
+    }
+    if (frames == 4*50)
+        exit(0);
+    */
+    PROFILE_SAMPLE_AND_LOG2(recover_start, "    recover"); 
+    #ifdef DUMP
+    dump_lsp_(&lsps[3][0]);
+    dump_ak_(&ak[3][0], LPC_ORD);
+    #endif
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[3];
+    c2->prev_e_dec = e[3];
+    for(i=0; i<LPC_ORD; i++)
+       c2->prev_lsps_dec[i] = lsps[3][i];
+
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_1200          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: Nov 14 2011 
+
+  Encodes 320 speech samples (40ms of speech) into 48 bits.  
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm four times:
+
+  frame 0: voicing bit
+  frame 1: voicing bit, joint VQ of Wo and E
+  frame 2: voicing bit
+  frame 3: voicing bit, joint VQ of Wo and E, VQ LSPs
+
+  The bit allocation is:
+
+    Parameter                      frame 2  frame 4   Total
+    -------------------------------------------------------
+    Harmonic magnitudes (LSPs)      0       27        27
+    Energy+Wo                       8        8        16
+    Voicing (10ms update)           2        2         4
+    Spare                           0        1         1
+    TOTAL                          10       38        48
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_1200(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   lsps[LPC_ORD];
+    float   lsps_[LPC_ORD];
+    float   ak[LPC_ORD+1];
+    float   e;
+    int     lsp_indexes[LPC_ORD];
+    int     WoE_index;
+    int     i;
+    int     spare = 0;
+    unsigned int nbit = 0;
+
+    assert(c2 != NULL);
+
+    memset(bits, '\0',  ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* frame 1: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, speech);
+    pack(bits, &nbit, model.voiced, 1);
+    /* frame 2: - voicing, joint Wo & E -------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[N]);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* need to run this just to get LPC energy */
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+
+    WoE_index = encode_WoE(&model, e, c2->xq_enc);
+    pack(bits, &nbit, WoE_index, WO_E_BITS);
+    /* frame 3: - voicing ---------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &speech[2*N]);
+    pack(bits, &nbit, model.voiced, 1);
+
+    /* frame 4: - voicing, joint Wo & E, scalar LSPs ------------------*/
+
+    analyse_one_frame(c2, &model, &speech[3*N]);
+    pack(bits, &nbit, model.voiced, 1);
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD);
+    WoE_index = encode_WoE(&model, e, c2->xq_enc);
+    pack(bits, &nbit, WoE_index, WO_E_BITS);
+    encode_lsps_vq(lsp_indexes, lsps, lsps_, LPC_ORD);
+    for(i=0; i<LSP_PRED_VQ_INDEXES; i++) {
+       pack(bits, &nbit, lsp_indexes[i], lsp_pred_vq_bits(i));
+    }
+    pack(bits, &nbit, spare, 1);
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_1200          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 14 Feb 2012
+
+  Decodes frames of 48 bits into 320 samples (40ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode_1200(struct CODEC2 *c2, short speech[], const unsigned char * bits)
+{
+    MODEL   model[4];
+    int     lsp_indexes[LPC_ORD];
+    float   lsps[4][LPC_ORD];
+    int     WoE_index;
+    float   e[4];
+    float   snr;
+    float   ak[4][LPC_ORD+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    float   weight;
+    COMP    Aw[FFT_ENC];
+
+    assert(c2 != NULL);
+
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<4; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    /* this will partially fill the model params for the 4 x 10ms
+       frames */
+
+    model[0].voiced = unpack(bits, &nbit, 1);
+
+    model[1].voiced = unpack(bits, &nbit, 1);
+    WoE_index = unpack(bits, &nbit, WO_E_BITS);
+    decode_WoE(&model[1], &e[1], c2->xq_dec, WoE_index);
+
+    model[2].voiced = unpack(bits, &nbit, 1);
+
+    model[3].voiced = unpack(bits, &nbit, 1);
+    WoE_index = unpack(bits, &nbit, WO_E_BITS);
+    decode_WoE(&model[3], &e[3], c2->xq_dec, WoE_index);
+    for(i=0; i<LSP_PRED_VQ_INDEXES; i++) {
+       lsp_indexes[i] = unpack(bits, &nbit, lsp_pred_vq_bits(i));
+    }
+    decode_lsps_vq(lsp_indexes, &lsps[3][0], LPC_ORD , 0);
+    check_lsp_order(&lsps[3][0], LPC_ORD);
+    bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0);
+    /* interpolate ------------------------------------------------*/
+
+    /* Wo and energy are sampled every 20ms, so we interpolate just 1
+       10ms frame between 20ms samples */
+
+    interp_Wo(&model[0], &c2->prev_model_dec, &model[1]);
+    e[0] = interp_energy(c2->prev_e_dec, e[1]);
+    interp_Wo(&model[2], &model[1], &model[3]);
+    e[2] = interp_energy(e[1], e[3]);
+    /* LSPs are sampled every 40ms so we interpolate the 3 frames in
+       between, then recover spectral amplitudes */
+
+    for(i=0, weight=0.25; i<3; i++, weight += 0.25) {
+       interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD);
+    }
+    for(i=0; i<4; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[3];
+    c2->prev_e_dec = e[3];
+    for(i=0; i<LPC_ORD; i++)
+       c2->prev_lsps_dec[i] = lsps[3][i];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_encode_700           
+  AUTHOR......: David Rowe                           
+  DATE CREATED: April 2015
+
+  Encodes 320 speech samples (40ms of speech) into 28 bits.  
+
+  The codec2 algorithm actually operates internally on 10ms (80
+  sample) frames, so we run the encoding algorithm four times:
+
+  frame 0: nothing
+  frame 1: nothing
+  frame 2: nothing
+  frame 3: voicing bit, scalar Wo and E, 17 bit LSP MEL scalar, 2 spare
+
+  The bit allocation is:
+
+    Parameter                      frames 1-3   frame 4   Total
+    -----------------------------------------------------------
+    Harmonic magnitudes (LSPs)          0         17        17
+    Energy                              0          3         3
+    log Wo                              0          5         5
+    Voicing                             0          1         1
+    spare                               0          2         2
+    TOTAL                               0         28        28
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode_700(struct CODEC2 *c2, unsigned char * bits, short speech[])
+{
+    MODEL   model;
+    float   lsps[LPC_ORD_LOW];
+    float   mel[LPC_ORD_LOW];
+    float   ak[LPC_ORD_LOW+1];
+    float   e, f;
+    int     indexes[LPC_ORD_LOW];
+    int     Wo_index, e_index, i;
+    unsigned int nbit = 0;
+    float   bpf_out[4*N];
+    short   bpf_speech[4*N];
+    int     spare = 0;
+
+    assert(c2 != NULL);
+
+    memset(bits, '\0',  ((codec2_bits_per_frame(c2) + 7) / 8));
+
+    /* band pass filter */
+
+    for(i=0; i<BPF_N; i++)
+        c2->bpf_buf[i] = c2->bpf_buf[4*N+i];
+    for(i=0; i<4*N; i++)
+        c2->bpf_buf[BPF_N+i] = speech[i];
+    inverse_filter(&c2->bpf_buf[BPF_N], bpf, 4*N, bpf_out, BPF_N);
+    for(i=0; i<4*N; i++)
+        bpf_speech[i] = speech[i];
+
+    /* frame 1 --------------------------------------------------------*/
+
+    analyse_one_frame(c2, &model, bpf_speech);
+    /* frame 2 --------------------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &bpf_speech[N]);
+    /* frame 3 --------------------------------------------------------*/
+
+    analyse_one_frame(c2, &model, &bpf_speech[2*N]);
+
+    /* frame 4: - voicing, scalar Wo & E, scalar LSPs -----------------*/
+
+    analyse_one_frame(c2, &model, &bpf_speech[3*N]);
+    pack(bits, &nbit, model.voiced, 1);
+    Wo_index = encode_log_Wo(model.Wo, 5);
+    pack_natural_or_gray(bits, &nbit, Wo_index, 5, c2->gray);
+
+    e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, LPC_ORD_LOW);
+    e_index = encode_energy(e, 3);
+    pack_natural_or_gray(bits, &nbit, e_index, 3, c2->gray);
+
+    for(i=0; i<LPC_ORD_LOW; i++) {
+        f = (4000.0/PI)*lsps[i];
+        mel[i] = floor(2595.0*log10(1.0 + f/700.0) + 0.5);
+    }
+    encode_mels_scalar(indexes, mel, LPC_ORD_LOW);
+
+    for(i=0; i<LPC_ORD_LOW; i++) {
+        pack_natural_or_gray(bits, &nbit, indexes[i], mel_bits(i), c2->gray);
+    }
+    
+    pack_natural_or_gray(bits, &nbit, spare, 2, c2->gray);
+
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: codec2_decode_700           
+  AUTHOR......: David Rowe                           
+  DATE CREATED: April 2015
+
+  Decodes frames of 28 bits into 320 samples (40ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode_700(struct CODEC2 *c2, short speech[], const unsigned char * bits)
+{
+    MODEL   model[4];
+    int     indexes[LPC_ORD_LOW];
+    float   mel[LPC_ORD_LOW];
+    float   lsps[4][LPC_ORD_LOW];
+    int     Wo_index, e_index;
+    float   e[4];
+    float   snr, f_;
+    float   ak[4][LPC_ORD_LOW+1];
+    int     i,j;
+    unsigned int nbit = 0;
+    float   weight;
+    COMP    Aw[FFT_ENC];
+
+    assert(c2 != NULL);
+
+    /* only need to zero these out due to (unused) snr calculation */
+
+    for(i=0; i<4; i++)
+       for(j=1; j<=MAX_AMP; j++)
+           model[i].A[j] = 0.0;
+
+    /* unpack bits from channel ------------------------------------*/
+
+    model[3].voiced = unpack(bits, &nbit, 1);
+    model[0].voiced = model[1].voiced = model[2].voiced = model[3].voiced;
+
+    Wo_index = unpack_natural_or_gray(bits, &nbit, 5, c2->gray);
+    model[3].Wo = decode_log_Wo(Wo_index, 5);
+    model[3].L  = PI/model[3].Wo;
+
+    e_index = unpack_natural_or_gray(bits, &nbit, 3, c2->gray);
+    e[3] = decode_energy(e_index, 3);
+    for(i=0; i<LPC_ORD_LOW; i++) {
+        indexes[i] = unpack_natural_or_gray(bits, &nbit, mel_bits(i), c2->gray);
+    }
+    
+    decode_mels_scalar(mel, indexes, LPC_ORD_LOW);
+    for(i=0; i<LPC_ORD_LOW; i++) {
+        f_ = 700.0*( pow(10.0, (float)mel[i]/2595.0) - 1.0);
+        lsps[3][i] = f_*(PI/4000.0);
+        //printf("lsps[3][%d]  %f\n", i, lsps[3][i]);
+    }
+
+    check_lsp_order(&lsps[3][0], LPC_ORD_LOW);
+    bw_expand_lsps(&lsps[3][0], LPC_ORD_LOW, 50.0, 100.0);
+    
+    #ifdef MASK_NOT_FOR_NOW
+    /* first pass at soft decn error masking, needs further work      */
+    /* If soft dec info available expand further for low power frames */
+
+    if (c2->softdec) {
+        float e = 0.0;
+        for(i=9; i<9+17; i++)
+            e += c2->softdec[i]*c2->softdec[i];
+        e /= 6.0;
+        //fprintf(stderr, "e: %f\n", e);
+        //if (e < 0.3)
+        //      bw_expand_lsps(&lsps[3][0], LPC_ORD_LOW, 150.0, 300.0);
+    }
+    #endif
+
+    /* interpolate ------------------------------------------------*/
+    /* LSPs, Wo, and energy are sampled every 40ms so we interpolate
+       the 3 frames in between, then recover spectral amplitudes */
+
+    for(i=0, weight=0.25; i<3; i++, weight += 0.25) {
+       interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD_LOW);
+        interp_Wo2(&model[i], &c2->prev_model_dec, &model[3], weight);
+        e[i] = interp_energy2(c2->prev_e_dec, e[3],weight);
+    }
+    for(i=0; i<4; i++) {
+       lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD_LOW);
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD_LOW, &model[i], e[i], &snr, 0, 0,
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
+       apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
+    }
+
+    #ifdef DUMP
+    dump_lsp_(&lsps[3][0]);
+    dump_ak_(&ak[3][0], LPC_ORD_LOW);
+    dump_model(&model[3]);
+    if (c2->softdec)
+        dump_softdec(c2->softdec, nbit);
+    #endif
+
+    /* update memories for next frame ----------------------------*/
+
+    c2->prev_model_dec = model[3];
+    c2->prev_e_dec = e[3];
+    for(i=0; i<LPC_ORD_LOW; i++)
+       c2->prev_lsps_dec[i] = lsps[3][i];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: synthesise_one_frame()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 23/8/2010 
+
+  Synthesise 80 speech samples (10ms) from model parameters.
+
+\*---------------------------------------------------------------------------*/
+
+void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, COMP Aw[])
+{
+    int     i;
+    PROFILE_VAR(phase_start, pf_start, synth_start);
+
+    #ifdef DUMP
+    dump_quantised_model(model);
+    #endif
+
+    PROFILE_SAMPLE(phase_start);
+
+    phase_synth_zero_order(c2->fft_fwd_cfg, model, &c2->ex_phase, Aw);
+
+    PROFILE_SAMPLE_AND_LOG(pf_start, phase_start, "    phase_synth"); 
+
+    postfilter(model, &c2->bg_est);
+
+    PROFILE_SAMPLE_AND_LOG(synth_start, pf_start, "    postfilter"); 
+
+    synthesise(c2->fft_inv_cfg, c2->Sn_, model, c2->Pn, 1);
+
+    PROFILE_SAMPLE_AND_LOG2(synth_start, "    synth"); 
+
+    ear_protection(c2->Sn_, N);
+
+    for(i=0; i<N; i++) {
+       if (c2->Sn_[i] > 32767.0)
+           speech[i] = 32767;
+       else if (c2->Sn_[i] < -32767.0)
+           speech[i] = -32767;
+       else
+           speech[i] = c2->Sn_[i];
+    }
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: analyse_one_frame()   
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 23/8/2010 
+
+  Extract sinusoidal model parameters from 80 speech samples (10ms of
+  speech).
+\*---------------------------------------------------------------------------*/
+
+void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[])
+{
+    COMP    Sw[FFT_ENC];
+    COMP    Sw_[FFT_ENC];
+    COMP    Ew[FFT_ENC];
+    float   pitch;
+    int     i;
+    PROFILE_VAR(dft_start, nlp_start, model_start, two_stage, estamps);
+
+    /* Read input speech */
+
+    for(i=0; i<M-N; i++)
+      c2->Sn[i] = c2->Sn[i+N];
+    for(i=0; i<N; i++)
+      c2->Sn[i+M-N] = speech[i];
+
+    PROFILE_SAMPLE(dft_start);
+    dft_speech(c2->fft_fwd_cfg, Sw, c2->Sn, c2->w);
+    PROFILE_SAMPLE_AND_LOG(nlp_start, dft_start, "    dft_speech");
+
+    /* Estimate pitch */
+
+    nlp(c2->nlp,c2->Sn,N,P_MIN,P_MAX,&pitch,Sw, c2->W, &c2->prev_Wo_enc);
+    PROFILE_SAMPLE_AND_LOG(model_start, nlp_start, "    nlp"); 
+
+    model->Wo = TWO_PI/pitch;
+    model->L = PI/model->Wo;
+
+    /* estimate model parameters */
+
+    two_stage_pitch_refinement(model, Sw);
+    PROFILE_SAMPLE_AND_LOG(two_stage, model_start, "    two_stage"); 
+    estimate_amplitudes(model, Sw, c2->W, 0);
+    PROFILE_SAMPLE_AND_LOG(estamps, two_stage, "    est_amps"); 
+    est_voicing_mbe(model, Sw, c2->W, Sw_, Ew);
+    c2->prev_Wo_enc = model->Wo;
+    PROFILE_SAMPLE_AND_LOG2(estamps, "    est_voicing"); 
+    #ifdef DUMP
+    dump_model(model);
+    #endif
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: ear_protection()   
+  AUTHOR......: David Rowe                           
+  DATE CREATED: Nov 7 2012
+
+  Limits output level to protect ears when there are bit errors or the input
+  is overdriven.  This doesn't correct or mask bit errors, just reduces the
+  worst of their damage.
+
+\*---------------------------------------------------------------------------*/
+
+static void ear_protection(float in_out[], int n) {
+    float max_sample, over, gain;
+    int   i;
+
+    /* find maximum sample in frame */
+
+    max_sample = 0.0;
+    for(i=0; i<n; i++)
+        if (in_out[i] > max_sample)
+            max_sample = in_out[i];
+
+    /* determine how far above set point */
+
+    over = max_sample/30000.0;
+
+    /* If we are x dB over set point we reduce level by 2x dB, this
+       attenuates major excursions in amplitude (likely to be caused
+       by bit errors) more than smaller ones */
+
+    if (over > 1.0) {
+        gain = 1.0/(over*over);
+        //fprintf(stderr, "gain: %f\n", gain);
+        for(i=0; i<n; i++)
+            in_out[i] *= gain;
+    }
+}
+
+void codec2_set_lpc_post_filter(struct CODEC2 *c2, int enable, int bass_boost, float beta, float gamma)
+{
+    assert((beta >= 0.0) && (beta <= 1.0));
+    assert((gamma >= 0.0) && (gamma <= 1.0));
+    c2->lpc_pf = enable;
+    c2->bass_boost = bass_boost;
+    c2->beta = beta;
+    c2->gamma = gamma;
+}
+
+/* 
+   Allows optional stealing of one of the voicing bits for use as a
+   spare bit, only 1300 & 1400 & 1600 bit/s supported for now.
+   Experimental method of sending voice/data frames for FreeDV.
+*/
+
+int codec2_get_spare_bit_index(struct CODEC2 *c2)
+{
+    assert(c2 != NULL);
+
+    switch(c2->mode) {
+    case CODEC2_MODE_1300:
+        return 2; // bit 2 (3th bit) is v2 (third voicing bit)
+        break;
+    case CODEC2_MODE_1400:
+        return 10; // bit 10 (11th bit) is v2 (third voicing bit)
+        break;
+    case CODEC2_MODE_1600:
+        return 15; // bit 15 (16th bit) is v2 (third voicing bit)
+        break;
+    case CODEC2_MODE_700:
+        return 26; // bits 26 and 27 are spare
+        break;
+    }
+    
+    return -1;
+}
+
+/*
+   Reconstructs the spare voicing bit.  Note works on unpacked bits
+   for convenience.
+*/
+
+int codec2_rebuild_spare_bit(struct CODEC2 *c2, int unpacked_bits[])
+{
+    int v1,v3;
+
+    assert(c2 != NULL);
+
+    v1 = unpacked_bits[1];
+
+    switch(c2->mode) {
+    case CODEC2_MODE_1300:
+
+        v3 = unpacked_bits[1+1+1];
+
+        /* if either adjacent frame is voiced, make this one voiced */
+
+        unpacked_bits[2] = (v1 || v3);  
+
+        return 0;
+
+        break;
+
+    case CODEC2_MODE_1400:
+
+        v3 = unpacked_bits[1+1+8+1];
+
+        /* if either adjacent frame is voiced, make this one voiced */
+
+        unpacked_bits[10] = (v1 || v3);  
+
+        return 0;
+
+        break;
+
+    case CODEC2_MODE_1600:
+        v3 = unpacked_bits[1+1+8+5+1];
+
+        /* if either adjacent frame is voiced, make this one voiced */
+
+        unpacked_bits[15] = (v1 || v3);  
+
+        return 0;
+
+        break;
+    }
+
+    return -1;
+}
+
+void codec2_set_natural_or_gray(struct CODEC2 *c2, int gray)
+{
+    assert(c2 != NULL);
+    c2->gray = gray;
+}
+
+void codec2_set_softdec(struct CODEC2 *c2, float *softdec)
+{
+    assert(c2 != NULL);
+    c2->softdec = softdec;
+}
+
diff --git a/codec2/tags/0.4/src/codec2.h b/codec2/tags/0.4/src/codec2.h
new file mode 100644 (file)
index 0000000..d3c6d27
--- /dev/null
@@ -0,0 +1,65 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: codec2.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 21 August 2010
+
+  Codec 2 fully quantised encoder and decoder functions.  If you want use 
+  Codec 2, these are the functions you need to call.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2010 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/>.
+*/
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+#ifndef __CODEC2__
+#define  __CODEC2__
+
+#define CODEC2_MODE_3200 0
+#define CODEC2_MODE_2400 1
+#define CODEC2_MODE_1600 2
+#define CODEC2_MODE_1400 3
+#define CODEC2_MODE_1300 4
+#define CODEC2_MODE_1200 5
+#define CODEC2_MODE_700  6
+
+struct CODEC2;
+
+struct CODEC2 *  codec2_create(int mode);
+void codec2_destroy(struct CODEC2 *codec2_state);
+void codec2_encode(struct CODEC2 *codec2_state, unsigned char * bits, short speech_in[]);
+void codec2_decode(struct CODEC2 *codec2_state, short speech_out[], const unsigned char *bits);
+void codec2_decode_ber(struct CODEC2 *codec2_state, short speech_out[], const unsigned char *bits, float ber_est);
+int  codec2_samples_per_frame(struct CODEC2 *codec2_state);
+int  codec2_bits_per_frame(struct CODEC2 *codec2_state);
+
+void codec2_set_lpc_post_filter(struct CODEC2 *codec2_state, int enable, int bass_boost, float beta, float gamma);
+int  codec2_get_spare_bit_index(struct CODEC2 *codec2_state);
+int  codec2_rebuild_spare_bit(struct CODEC2 *codec2_state, int unpacked_bits[]);
+void codec2_set_natural_or_gray(struct CODEC2 *codec2_state, int gray);
+void codec2_set_softdec(struct CODEC2 *c2, float *softdec);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/codec2/tags/0.4/src/codec2_cohpsk.h b/codec2/tags/0.4/src/codec2_cohpsk.h
new file mode 100644 (file)
index 0000000..3731aad
--- /dev/null
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk.h
+  AUTHOR......: David Rowe
+  DATE CREATED: March 2015
+                                                                             
+  Functions that implement a coherent PSK FDM modem.
+                                                               
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __CODEC2_COHPSK__
+#define __CODEC2_COHPSK__
+
+#define COHPSK_BITS_PER_FRAME         56              /* hard coded for now */
+#define COHPSK_NC                      7              /* hard coded for now */
+#define COHPSK_NOM_SAMPLES_PER_FRAME 600
+#define COHPSK_MAX_SAMPLES_PER_FRAME 625
+#define COHPSK_RS                     75
+#define COHPSK_FS                   7500              /* note this is a wierd 
+                                                         value to get an integer 
+                                                         oversampling rate */
+
+#include "comp.h"
+#include "modem_stats.h"
+
+struct COHPSK;
+
+extern const int test_bits_coh[];
+
+struct COHPSK *cohpsk_create(void);
+void cohpsk_destroy(struct COHPSK *coh);
+void cohpsk_mod(struct COHPSK *cohpsk, COMP tx_fdm[], int tx_bits[]);
+void cohpsk_clip(COMP tx_fdm[]);
+void cohpsk_demod(struct COHPSK *cohpsk, float rx_bits[], int *sync, COMP rx_fdm[], int *nin_frame);
+void cohpsk_get_demod_stats(struct COHPSK *cohpsk, struct MODEM_STATS *stats);
+void cohpsk_set_verbose(struct COHPSK *coh, int verbose);
+void cohpsk_get_test_bits(struct COHPSK *coh, int rx_bits[]);
+void cohpsk_put_test_bits(struct COHPSK *coh, int *state, short error_pattern[],
+                          int *bit_errors, float rx_bits_sd[]);
+int cohpsk_error_pattern_size(void);
+void cohpsk_set_frame(struct COHPSK *coh, int frame);
+void fdmdv_freq_shift_coh(COMP rx_fdm_fcorr[], COMP rx_fdm[], float foff, float Fs, 
+                          COMP *foff_phase_rect, int nin);
+#endif
diff --git a/codec2/tags/0.4/src/codec2_fdmdv.h b/codec2/tags/0.4/src/codec2_fdmdv.h
new file mode 100644 (file)
index 0000000..334696c
--- /dev/null
@@ -0,0 +1,113 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: codec2_fdmdv.h
+  AUTHOR......: David Rowe
+  DATE CREATED: April 14 2012
+                                                                             
+  A 1400 bit/s (nominal) Frequency Division Multiplexed Digital Voice
+  (FDMDV) modem.  Used for digital audio over HF SSB. See
+  README_fdmdv.txt for more information, and fdmdv_mod.c and
+  fdmdv_demod.c for example usage.
+  
+  The name codec2_fdmdv.h is used to make it unique when "make
+  installed".
+                   
+  References:
+    [1] http://n1su.com/fdmdv/FDMDV_Docs_Rel_1_4b.pdf
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __FDMDV__
+#define __FDMDV__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* set up the calling convention for DLL function import/export for
+   WIN32 cross compiling */
+
+#ifdef __CODEC2_WIN32__
+#ifdef __CODEC2_BUILDING_DLL__
+#define CODEC2_WIN32SUPPORT __declspec(dllexport) __stdcall
+#else
+#define CODEC2_WIN32SUPPORT __declspec(dllimport) __stdcall
+#endif
+#else
+#define CODEC2_WIN32SUPPORT
+#endif
+
+#include "comp.h"
+#include "modem_stats.h"
+
+#define FDMDV_NC                      14  /* default number of data carriers                                */                               
+#define FDMDV_NC_MAX                  20  /* maximum number of data carriers                                */                               
+#define FDMDV_BITS_PER_FRAME          28  /* 20ms frames, for nominal 1400 bit/s                            */
+#define FDMDV_NOM_SAMPLES_PER_FRAME  160  /* modulator output samples/frame and nominal demod samples/frame */
+                                          /* at 8000 Hz sample rate                                         */
+#define FDMDV_MAX_SAMPLES_PER_FRAME  200  /* max demod samples/frame, use this to allocate storage          */
+#define FDMDV_SCALE                 1000  /* suggested scaling for 16 bit shorts                            */
+#define FDMDV_FCENTRE               1500  /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) */
+
+/* 8 to 48 kHz sample rate conversion */
+
+#define FDMDV_OS                 2                            /* oversampling rate                   */
+#define FDMDV_OS_TAPS_16K       48                            /* number of OS filter taps at 16kHz   */
+#define FDMDV_OS_TAPS_8K        (FDMDV_OS_TAPS_16K/FDMDV_OS)  /* number of OS filter taps at 8kHz    */
+
+/* FDMDV states and stats structures */
+
+struct FDMDV;
+    
+struct FDMDV * fdmdv_create(int Nc);
+void           fdmdv_destroy(struct FDMDV *fdmdv_state);
+void           fdmdv_use_old_qpsk_mapping(struct FDMDV *fdmdv_state);
+int            fdmdv_bits_per_frame(struct FDMDV *fdmdv_state);
+float          fdmdv_get_fsep(struct FDMDV *fdmdv_state);
+void           fdmdv_set_fsep(struct FDMDV *fdmdv_state, float fsep);
+
+void           fdmdv_mod(struct FDMDV *fdmdv_state, COMP tx_fdm[], int tx_bits[], int *sync_bit);
+void           fdmdv_demod(struct FDMDV *fdmdv_state, int rx_bits[], int *reliable_sync_bit, COMP rx_fdm[], int *nin);
+    
+void           fdmdv_get_test_bits(struct FDMDV *fdmdv_state, int tx_bits[]);
+int            fdmdv_error_pattern_size(struct FDMDV *fdmdv_state);
+void           fdmdv_put_test_bits(struct FDMDV *f, int *sync, short error_pattern[], int *bit_errors, int *ntest_bits, int rx_bits[]);
+    
+void           fdmdv_get_demod_stats(struct FDMDV *fdmdv_state, struct MODEM_STATS *stats);
+
+void           fdmdv_8_to_16(float out16k[], float in8k[], int n);
+void           fdmdv_8_to_16_short(short out16k[], short in8k[], int n);
+void           fdmdv_16_to_8(float out8k[], float in16k[], int n);
+void           fdmdv_16_to_8_short(short out8k[], short in16k[], int n);
+
+void           fdmdv_freq_shift(COMP rx_fdm_fcorr[], COMP rx_fdm[], float foff, COMP *foff_phase_rect, int nin);
+
+/* debug/development function(s) */
+
+void fdmdv_dump_osc_mags(struct FDMDV *f);
+void fdmdv_simulate_channel(float *sig_pwr_av, COMP samples[], int nin, float target_snr);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/codec2/tags/0.4/src/codec2_fifo.h b/codec2/tags/0.4/src/codec2_fifo.h
new file mode 100644 (file)
index 0000000..dc93e15
--- /dev/null
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: codec2_fifo.h
+  AUTHOR......: David Rowe
+  DATE CREATED: Oct 15 2012
+                                                                             
+  A FIFO design useful in gluing the FDMDV modem and codec together in
+  integrated applications.
+  
+  The name codec2_fifo.h is used to make it unique when "make
+  installed".                   
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __FIFO__
+#define __FIFO__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct FIFO;
+
+struct FIFO *fifo_create(int nshort);
+void fifo_destroy(struct FIFO *fifo);
+int fifo_write(struct FIFO *fifo, short data[], int n);
+int fifo_read(struct FIFO *fifo, short data[], int n);
+int fifo_used(struct FIFO *fifo);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/codec2/tags/0.4/src/codec2_fm.h b/codec2/tags/0.4/src/codec2_fm.h
new file mode 100644 (file)
index 0000000..92457ec
--- /dev/null
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: codec2_fm.h
+  AUTHOR......: David Rowe
+  DATE CREATED: February 2015
+                                                                             
+  Functions that implement analog FM, see also octave/fm.m.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __CODEC2_FM__
+#define __CODEC2_FM__
+
+#include "comp.h"
+
+struct FM {
+    float  Fs;               /* setme: sample rate                  */
+    float  fm_max;           /* setme: maximum modulation frequency */
+    float  fd;               /* setme: maximum deviation            */
+    float  fc;               /* setme: carrier frequency            */ 
+    COMP  *rx_bb;
+    COMP   rx_bb_filt_prev;
+    float *rx_dem_mem;      
+    int    nsam;
+    COMP   lo_phase;
+};
+
+struct FM *fm_create(int nsam);
+void fm_destroy(struct FM *fm_states);
+void fm_demod(struct FM *fm, float rx_out[], float rx[]);
+
+#endif
+
diff --git a/codec2/tags/0.4/src/codec2_internal.h b/codec2/tags/0.4/src/codec2_internal.h
new file mode 100644 (file)
index 0000000..44ff177
--- /dev/null
@@ -0,0 +1,65 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: codec2_internal.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: April 16 2012
+                                                                             
+  Header file for Codec2 internal states, exposed via this header
+  file to assist in testing.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __CODEC2_INTERNAL__
+#define __CODEC2_INTERNAL__
+
+struct CODEC2 {
+    int           mode;
+    kiss_fft_cfg  fft_fwd_cfg;             /* forward FFT config                        */
+    float         w[M];                           /* time domain hamming window                */
+    COMP          W[FFT_ENC];             /* DFT of w[]                                */
+    float         Pn[2*N];                /* trapezoidal synthesis window              */
+    float        *bpf_buf;                 /* buffer for band pass filter               */
+    float         Sn[M];                   /* input speech                              */
+    float         hpf_states[2];           /* high pass filter states                   */
+    void         *nlp;                     /* pitch predictor states                    */
+    int           gray;                    /* non-zero for gray encoding                */
+
+    kiss_fft_cfg  fft_inv_cfg;             /* inverse FFT config                        */
+    float         Sn_[2*N];               /* synthesised output speech                 */
+    float         ex_phase;                /* excitation model phase track              */
+    float         bg_est;                  /* background noise estimate for post filter */
+    float         prev_Wo_enc;             /* previous frame's pitch estimate           */
+    MODEL         prev_model_dec;          /* previous frame's model parameters         */
+    float         prev_lsps_dec[LPC_ORD];  /* previous frame's LSPs                     */
+    float         prev_e_dec;              /* previous frame's LPC energy               */
+    
+    int           lpc_pf;                  /* LPC post filter on                        */
+    int           bass_boost;              /* LPC post filter bass boost                */
+    float         beta;                    /* LPC post filter parameters                */
+    float         gamma;
+
+    float         xq_enc[2];               /* joint pitch and energy VQ states          */
+    float         xq_dec[2];
+
+    int           smoothing;               /* enable smoothing for channels with errors */
+    float        *softdec;                 /* optional soft decn bits from demod        */
+};
+
+#endif
diff --git a/codec2/tags/0.4/src/cohpsk.c b/codec2/tags/0.4/src/cohpsk.c
new file mode 100644 (file)
index 0000000..2542573
--- /dev/null
@@ -0,0 +1,1263 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk.c
+  AUTHOR......: David Rowe
+  DATE CREATED: March 2015
+                                                                             
+  Functions that implement a coherent PSK FDM modem.
+                                                                       
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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/>.
+*/
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               INCLUDES
+
+\*---------------------------------------------------------------------------*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "codec2_cohpsk.h"
+#include "cohpsk_defs.h"
+#include "cohpsk_internal.h"
+#include "fdmdv_internal.h"
+#include "pilots_coh.h"
+#include "comp_prim.h"
+#include "kiss_fft.h"
+#include "linreg.h"
+#include "rn_coh.h"
+#include "test_bits_coh.h"
+
+static COMP qpsk_mod[] = {
+    { 1.0, 0.0},
+    { 0.0, 1.0},
+    { 0.0,-1.0},
+    {-1.0, 0.0}
+};
+    
+static int sampling_points[] = {0, 1, 6, 7};
+
+void corr_with_pilots(float *corr_out, float *mag_out, struct COHPSK *coh, int t, float f_fine);
+void update_ct_symb_buf(COMP ct_symb_buf[][COHPSK_NC*ND], COMP ch_symb[][COHPSK_NC*ND]);
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------* \
+                                                       
+  FUNCTION....: cohpsk_create       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: Marcg 2015 
+
+  Create and initialise an instance of the modem.  Returns a pointer
+  to the modem states or NULL on failure.  One set of states is
+  sufficient for a full duplex modem.
+
+\*---------------------------------------------------------------------------*/
+
+struct COHPSK *cohpsk_create(void)
+{
+    struct COHPSK *coh;
+    struct FDMDV  *fdmdv;
+    int            r,c,p,i;
+    float          freq_hz;
+
+    assert(COHPSK_NC == PILOTS_NC);
+    assert(COHPSK_NOM_SAMPLES_PER_FRAME == (COHPSK_M*NSYMROWPILOT));
+    assert(COHPSK_MAX_SAMPLES_PER_FRAME == (COHPSK_M*NSYMROWPILOT+COHPSK_M/P));
+    assert(COHPSK_ND == ND);
+    assert(COHPSK_NSYM == NSYM);  /* as we want to use the tx sym mem on fdmdv */
+    assert(COHPSK_NT == NT);
+
+    coh = (struct COHPSK*)malloc(sizeof(struct COHPSK));
+    if (coh == NULL)
+        return NULL;
+
+    /* set up buffer of tx pilot symbols for coh demod on rx */
+
+    for(r=0; r<2*NPILOTSFRAME; ) {
+        for(p=0; p<NPILOTSFRAME; r++, p++) {
+            for(c=0; c<COHPSK_NC; c++) {
+                coh->pilot2[r][c] = pilots_coh[p][c];
+            }
+        }
+    }
+    
+    /* Clear symbol buffer memory */
+
+    for (r=0; r<NCT_SYMB_BUF; r++) {
+        for(c=0; c<COHPSK_NC*ND; c++) {
+            coh->ct_symb_buf[r][c].real = 0.0;
+            coh->ct_symb_buf[r][c].imag = 0.0;
+        }
+    }
+
+    coh->ff_phase.real = 1.0; coh->ff_phase.imag = 0.0;
+    coh->sync  = 0;
+    coh->frame = 0;
+    coh->ratio = 0.0;
+    coh->nin = COHPSK_M;
+
+    /* clear sync window buffer */
+
+    for (i=0; i<NSW*NSYMROWPILOT*COHPSK_M; i++) {
+        coh->ch_fdm_frame_buf[i].real = 0.0;
+        coh->ch_fdm_frame_buf[i].imag = 0.0;
+    }
+
+    /* set up fdmdv states so we can use those modem functions */
+
+    fdmdv = fdmdv_create(COHPSK_NC*ND - 1);
+    fdmdv->fsep = COHPSK_RS*(1.0 + COHPSK_EXCESS_BW);
+    for(c=0; c<COHPSK_NC*ND; c++) {
+       fdmdv->phase_tx[c].real = 1.0;
+       fdmdv->phase_tx[c].imag = 0.0;
+
+        /* note non-linear carrier spacing to help PAPR, works v well in conjunction with CLIP */
+
+        freq_hz = fdmdv->fsep*( -(COHPSK_NC*ND)/2 - 0.5 + pow(c + 1.0, 0.98) );
+        
+       fdmdv->freq[c].real = cosf(2.0*M_PI*freq_hz/COHPSK_FS);
+       fdmdv->freq[c].imag = sinf(2.0*M_PI*freq_hz/COHPSK_FS);
+       fdmdv->freq_pol[c]  = 2.0*M_PI*freq_hz/COHPSK_FS;
+
+        //printf("c: %d %f %f\n",c,freq_hz,fdmdv->freq_pol[c]);
+        for(i=0; i<COHPSK_NFILTER; i++) {
+            coh->rx_filter_memory[c][i].real = 0.0;
+            coh->rx_filter_memory[c][i].imag = 0.0;
+        }
+    }
+    fdmdv->fbb_rect.real     = cosf(2.0*PI*FDMDV_FCENTRE/COHPSK_FS);
+    fdmdv->fbb_rect.imag     = sinf(2.0*PI*FDMDV_FCENTRE/COHPSK_FS);
+    fdmdv->fbb_pol           = 2.0*PI*FDMDV_FCENTRE/COHPSK_FS;
+
+    coh->fdmdv = fdmdv;
+
+    coh->sig_rms = coh->noise_rms = 0.0;
+
+    for(c=0; c<COHPSK_NC*ND; c++) {
+        for (r=0; r<NSYMROW; r++) {
+            coh->rx_symb[r][c].real = 0.0;
+            coh->rx_symb[r][c].imag = 0.0;
+        }
+    }
+
+    coh->verbose = 0;
+
+    /* disable optional logging by default */
+
+    coh->rx_baseband_log = NULL;
+    coh->rx_baseband_log_col_index = 0;
+    coh->rx_filt_log = NULL;
+    coh->rx_filt_log_col_index = 0;
+    coh->ch_symb_log = NULL;
+    coh->ch_symb_log_r = 0;
+    coh->rx_timing_log = NULL;
+    coh->rx_timing_log_index = 0;
+
+    /* test frames */
+
+    coh->ptest_bits_coh_tx = coh->ptest_bits_coh_rx = (int*)test_bits_coh;
+    coh->ptest_bits_coh_end = (int*)test_bits_coh + sizeof(test_bits_coh)/sizeof(int);
+    
+    return coh;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_destroy      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: March 2015
+
+  Destroy an instance of the modem.
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_destroy(struct COHPSK *coh)
+{
+    fdmdv_destroy(coh->fdmdv);
+    assert(coh != NULL);
+    free(coh);
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: bits_to_qpsk_symbols()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: March 2015
+
+  Rate Rs modulator.  Maps bits to parallel DQPSK symbols and inserts pilot symbols.
+
+\*---------------------------------------------------------------------------*/
+
+void bits_to_qpsk_symbols(COMP tx_symb[][COHPSK_NC*ND], int tx_bits[], int nbits)
+{
+    int   i, r, c, p_r, data_r, d;
+    short bits;
+
+    /* check number of bits supplied matchs number of QPSK symbols in the frame */
+
+    assert((NSYMROW*COHPSK_NC)*2 == nbits);
+    /*
+      Insert two rows of Nc pilots at beginning of data frame.
+
+      Organise QPSK symbols into a NSYMBROWS rows by PILOTS_NC*ND cols matrix,
+      each column is a carrier, time flows down the cols......
+
+      Note: the "& 0x1" prevents and non binary tx_bits[] screwing up
+      our lives.  Call me defensive.
+
+      sqrtf(ND) term ensures the same energy/symbol for different
+      diversity factors.
+    */
+
+    r = 0;
+    for(p_r=0; p_r<2; p_r++) {
+        for(c=0; c<COHPSK_NC; c++) {
+            tx_symb[r][c].real = pilots_coh[p_r][c]/sqrtf(ND);
+            tx_symb[r][c].imag = 0.0;
+        }
+        r++;
+    }
+    for(data_r=0; data_r<NSYMROW; data_r++, r++) {
+        
+        for(c=0; c<COHPSK_NC; c++) {
+            i = c*NSYMROW + data_r;
+            bits = (tx_bits[2*i]&0x1)<<1 | (tx_bits[2*i+1]&0x1);          
+            tx_symb[r][c] = fcmult(1.0/sqrtf(ND),qpsk_mod[bits]);
+
+            /* test code to see what happens when we attenuate one
+               carrier, this may happen in practice with tx SSB filter
+               ripple.  
+
+               if (c==5) { 
+                 COMP attn = {0.5,0.0};
+                 tx_symb[r][c] = cmult(tx_symb[r][c], attn);
+               }
+            */
+        }
+    }
+    
+    assert(p_r == NPILOTSFRAME);
+    assert(r == NSYMROWPILOT);
+
+    /* copy to other carriers (diversity) */
+
+    for(d=1; d<ND; d++) {
+        for(r=0; r<NSYMROWPILOT; r++) {
+            for(c=0; c<COHPSK_NC; c++) {
+                tx_symb[r][c+COHPSK_NC*d] = tx_symb[r][c];
+            }
+        }
+    }    
+
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: qpsk_symbols_to_bits()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: March 2015
+
+  Rate Rs demodulator. Extract pilot symbols and estimate amplitude and phase
+  of each carrier.  Correct phase of data symbols and convert to bits.
+
+  Further improvement.  In channels with slowly changing phase we
+  could optionally use pilots from several past and future symbols.
+
+\*---------------------------------------------------------------------------*/
+
+void qpsk_symbols_to_bits(struct COHPSK *coh, float rx_bits[], COMP ct_symb_buf[][COHPSK_NC*ND])
+{
+    int   p, r, c, i, pc, d, n;
+    float x[NPILOTSFRAME+2], x1;
+    COMP  y[NPILOTSFRAME+2], yfit;
+    COMP  rx_symb_linear[NSYMROW*COHPSK_NC*ND];
+    COMP  m, b;
+    COMP   __attribute__((unused)) corr, rot, pi_on_4, phi_rect, div_symb;
+    float mag,  __attribute__((unused)) phi_,  __attribute__((unused)) amp_;
+    float sum_x, sum_xx, noise_var;
+    COMP  s;
+
+    pi_on_4.real = cosf(M_PI/4); pi_on_4.imag = sinf(M_PI/4);
+   
+    for(c=0; c<COHPSK_NC*ND; c++) {
+
+        /* Set up lin reg model and interpolate phase.  Works better than average for channels with
+           quickly changing phase, like HF. */
+
+        for(p=0; p<NPILOTSFRAME+2; p++) {
+            x[p] = sampling_points[p];
+            pc = c % COHPSK_NC;
+            y[p] = fcmult(coh->pilot2[p][pc], ct_symb_buf[sampling_points[p]][c]);
+        }
+        
+        linreg(&m, &b, x, y, NPILOTSFRAME+2);
+        for(r=0; r<NSYMROW; r++) {
+            x1 = (float)(r+NPILOTSFRAME);
+            yfit = cadd(fcmult(x1,m),b);
+            coh->phi_[r][c] = atan2(yfit.imag, yfit.real);
+        }
+        /* amplitude estimation */
+
+        mag = 0.0;
+        for(p=0; p<NPILOTSFRAME+2; p++) {
+            mag  += cabsolute(ct_symb_buf[sampling_points[p]][c]);
+        }
+        amp_ =  mag/(NPILOTSFRAME+2);
+        for(r=0; r<NSYMROW; r++) {
+             coh->amp_[r][c] = amp_;
+        }
+    }
+    
+    /* now correct phase of data symbols */
+
+    for(c=0; c<COHPSK_NC*ND; c++) {
+        for (r=0; r<NSYMROW; r++) {
+            phi_rect.real = cosf(coh->phi_[r][c]); phi_rect.imag = -sinf(coh->phi_[r][c]);
+            coh->rx_symb[r][c] = cmult(ct_symb_buf[NPILOTSFRAME + r][c], phi_rect);
+            i = c*NSYMROW + r;
+            rx_symb_linear[i] = coh->rx_symb[r][c];
+        }
+    }
+    
+    /* and finally optional diversity combination, note output is soft decn a "1" is < 0 */
+
+    for(c=0; c<COHPSK_NC; c++) {
+        for(r=0; r<NSYMROW; r++) {
+            div_symb = coh->rx_symb[r][c];
+            for (d=1; d<ND; d++) {
+                div_symb = cadd(div_symb, coh->rx_symb[r][c + COHPSK_NC*d]);
+            }
+            rot = cmult(div_symb, pi_on_4);
+            i = c*NSYMROW + r;
+            rx_bits[2*i+1] = rot.real;
+            rx_bits[2*i]   = rot.imag;
+        }
+    }
+
+    
+    /* estimate RMS signal and noise */
+
+    mag = 0.0;
+    for(i=0; i<NSYMROW*COHPSK_NC*ND; i++)
+        mag += cabsolute(rx_symb_linear[i]);
+    coh->sig_rms = mag/(NSYMROW*COHPSK_NC*ND);
+
+    sum_x = 0;
+    sum_xx = 0;
+    n = 0;
+    for (i=0; i<NSYMROW*COHPSK_NC*ND; i++) {
+      s = rx_symb_linear[i];
+      if (fabsf(s.real) > coh->sig_rms) {
+        sum_x  += s.imag;
+        sum_xx += s.imag*s.imag;
+        n++;
+      }
+    }
+   
+    noise_var = 0;
+    if (n > 1) {
+      noise_var = (n*sum_xx - sum_x*sum_x)/(n*(n-1));
+    }
+    coh->noise_rms = sqrtf(noise_var);
+
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: tx_filter_and_upconvert_coh()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 2015
+
+  Given NC symbols construct M samples (1 symbol) of NC filtered
+  and upconverted symbols.
+  TODO: work out a way to merge with fdmdv version, e.g. run time define M/NSYM,
+  and run unittests on fdmdv and cohpsk modem afterwards.
+
+\*---------------------------------------------------------------------------*/
+
+void tx_filter_and_upconvert_coh(COMP tx_fdm[], int Nc, COMP tx_symbols[], 
+                                 COMP tx_filter_memory[COHPSK_NC*ND][COHPSK_NSYM],
+                                 COMP phase_tx[], COMP freq[], 
+                                 COMP *fbb_phase, COMP fbb_rect)
+{
+    int     c;
+    int     i,j,k;
+    float   acc;
+    COMP    gain;
+    COMP    tx_baseband;
+    COMP  two = {2.0, 0.0};
+    float mag;
+
+    gain.real = sqrtf(2.0)/2.0;
+    gain.imag = 0.0;
+    
+    for(i=0; i<COHPSK_M; i++) {
+       tx_fdm[i].real = 0.0;
+       tx_fdm[i].imag = 0.0;
+    }
+
+    for(c=0; c<Nc; c++)
+       tx_filter_memory[c][COHPSK_NSYM-1] = cmult(tx_symbols[c], gain);
+    
+    /* 
+       tx filter each symbol, generate M filtered output samples for
+       each symbol, which we then freq shift and sum with other
+       carriers.  Efficient polyphase filter techniques used as
+       tx_filter_memory is sparse
+    */
+
+    for(c=0; c<Nc; c++) {
+        for(i=0; i<COHPSK_M; i++) {
+
+           /* filter real sample of symbol for carrier c */
+
+           acc = 0.0;
+           for(j=0,k=COHPSK_M-i-1; j<COHPSK_NSYM; j++,k+=COHPSK_M)
+               acc += COHPSK_M * tx_filter_memory[c][j].real * gt_alpha5_root_coh[k];
+           tx_baseband.real = acc;     
+
+           /* filter imag sample of symbol for carrier c */
+
+           acc = 0.0;
+           for(j=0,k=COHPSK_M-i-1; j<COHPSK_NSYM; j++,k+=COHPSK_M)
+               acc += COHPSK_M * tx_filter_memory[c][j].imag * gt_alpha5_root_coh[k];
+           tx_baseband.imag = acc;
+            //printf("%d %d %f %f\n", c, i, tx_baseband.real, tx_baseband.imag);
+            
+            /* freq shift and sum */
+
+           phase_tx[c] = cmult(phase_tx[c], freq[c]);
+           tx_fdm[i] = cadd(tx_fdm[i], cmult(tx_baseband, phase_tx[c]));
+            //printf("%d %d %f %f\n", c, i, phase_tx[c].real, phase_tx[c].imag);
+       }
+        //exit(0);
+    }
+
+    /* shift whole thing up to carrier freq */
+
+    for (i=0; i<COHPSK_M; i++) {
+       *fbb_phase = cmult(*fbb_phase, fbb_rect);
+       tx_fdm[i] = cmult(tx_fdm[i], *fbb_phase);
+    }
+
+    /*
+      Scale such that total Carrier power C of real(tx_fdm) = Nc.  This
+      excludes the power of the pilot tone.
+      We return the complex (single sided) signal to make frequency
+      shifting for the purpose of testing easier
+    */
+
+    for (i=0; i<COHPSK_M; i++) 
+       tx_fdm[i] = cmult(two, tx_fdm[i]);
+
+    /* normalise digital oscillators as the magnitude can drift over time */
+
+    for (c=0; c<Nc; c++) {
+        mag = cabsolute(phase_tx[c]);
+       phase_tx[c].real /= mag;        
+       phase_tx[c].imag /= mag;        
+    }
+
+    mag = cabsolute(*fbb_phase);
+    fbb_phase->real /= mag;    
+    fbb_phase->imag /= mag;    
+
+    /* shift memory, inserting zeros at end */
+
+    for(i=0; i<COHPSK_NSYM-1; i++)
+       for(c=0; c<Nc; c++)
+           tx_filter_memory[c][i] = tx_filter_memory[c][i+1];
+
+    for(c=0; c<Nc; c++) {
+       tx_filter_memory[c][COHPSK_NSYM-1].real = 0.0;
+       tx_filter_memory[c][COHPSK_NSYM-1].imag = 0.0;
+    }
+}
+
+
+
+void corr_with_pilots(float *corr_out, float *mag_out, struct COHPSK *coh, int t, float f_fine) 
+{
+    COMP  acorr, f_fine_rect, f_corr;
+    float mag, corr;
+    int   c, p, pc;
+    
+    corr = 0.0; mag = 0.0;
+    for (c=0; c<COHPSK_NC*ND; c++) {
+        acorr.real = 0.0; acorr.imag = 0.0;
+        for (p=0; p<NPILOTSFRAME+2; p++) {
+            f_fine_rect.real = cosf(f_fine*2.0*M_PI*(sampling_points[p]+1.0)/COHPSK_RS);
+            f_fine_rect.imag = sinf(f_fine*2.0*M_PI*(sampling_points[p]+1.0)/COHPSK_RS);
+            f_corr = cmult(f_fine_rect, coh->ct_symb_buf[t+sampling_points[p]][c]);
+            pc = c % COHPSK_NC;
+            acorr = cadd(acorr, fcmult(coh->pilot2[p][pc], f_corr));
+            mag  += cabsolute(f_corr);
+        }
+        corr += cabsolute(acorr);
+    }
+
+    *corr_out = corr;
+    *mag_out  = mag;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: frame_sync_fine_freq_est()          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: April 2015
+
+  Returns an estimate of frame sync (coarse timing) offset and fine
+  frequency offset, advances to next sync state if we have a reliable
+  match for frame sync.
+
+\*---------------------------------------------------------------------------*/
+
+void frame_sync_fine_freq_est(struct COHPSK *coh, COMP ch_symb[][COHPSK_NC*ND], int sync, int *next_sync)
+{
+    int   t;
+    float f_fine, mag, max_corr, max_mag, corr;
+
+    update_ct_symb_buf(coh->ct_symb_buf, ch_symb);
+
+    /* sample pilots at start of this frame and start of next frame */
+
+    if (sync == 0) {
+
+        /* sample correlation over 2D grid of time and fine freq points */
+
+        max_corr = max_mag = 0;
+        for (f_fine=-20; f_fine<=20; f_fine+=0.25) {
+            for (t=0; t<NSYMROWPILOT; t++) {
+                corr_with_pilots(&corr, &mag, coh, t, f_fine);
+                //printf("  f: %f  t: %d corr: %f mag: %f\n", f_fine, t, corr, mag);
+                if (corr >= max_corr) {
+                    max_corr = corr;
+                    max_mag = mag;
+                    coh->ct = t;
+                    coh->f_fine_est = f_fine;
+                }
+            }
+        }
+
+        
+        coh->ff_rect.real = cosf(coh->f_fine_est*2.0*M_PI/COHPSK_RS);
+        coh->ff_rect.imag = -sinf(coh->f_fine_est*2.0*M_PI/COHPSK_RS);
+        if (coh->verbose)
+            fprintf(stderr, "  [%d]   fine freq f: %6.2f max_ratio: %f ct: %d\n", coh->frame, coh->f_fine_est, max_corr/max_mag, coh->ct);
+        if (max_corr/max_mag > 0.9) {
+            if (coh->verbose)
+                fprintf(stderr, "  [%d]   encouraging sync word!\n", coh->frame);
+            coh->sync_timer = 0;
+            *next_sync = 1;
+        }
+        else {
+            *next_sync = 0;
+        }
+        coh->ratio = max_corr/max_mag;        
+    }
+}
+
+
+void update_ct_symb_buf(COMP ct_symb_buf[][COHPSK_NC*ND], COMP ch_symb[][COHPSK_NC*ND])
+{
+    int r, c, i;
+
+    /* update memory in symbol buffer */
+
+    for(r=0; r<NCT_SYMB_BUF-NSYMROWPILOT; r++) {
+        for(c=0; c<COHPSK_NC*ND; c++)
+            ct_symb_buf[r][c] = ct_symb_buf[r+NSYMROWPILOT][c];
+    }
+  
+    for(r=NCT_SYMB_BUF-NSYMROWPILOT, i=0; r<NCT_SYMB_BUF; r++, i++) {
+        for(c=0; c<COHPSK_NC*ND; c++)
+            ct_symb_buf[r][c] = ch_symb[i][c];
+    }
+}
+
+
+int sync_state_machine(struct COHPSK *coh, int sync, int next_sync)
+{
+    float corr, mag;
+
+    if (sync == 1) {
+
+        /* check that sync is still good, fall out of sync on consecutive bad frames */
+
+        corr_with_pilots(&corr, &mag, coh, coh->ct, coh->f_fine_est);
+        coh->ratio = fabsf(corr)/mag;        
+
+        // printf("%f\n", cabsolute(corr)/mag);
+
+        if (fabsf(corr)/mag < 0.8) 
+            coh->sync_timer++;
+        else
+            coh->sync_timer = 0;            
+
+        if (coh->sync_timer == 10) {
+            if (coh->verbose)
+                fprintf(stderr,"  [%d] lost sync ....\n", coh->frame);
+            next_sync = 0;
+        }
+    }
+              
+    sync = next_sync;
+
+    return sync;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_mod()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 5/4/2015
+
+  COHPSK modulator, take a frame of COHPSK_BITS_PER_FRAME bits and
+  generates a frame of COHPSK_NOM_SAMPLES_PER_FRAME modulated symbols.
+
+  The output signal is complex to support single sided frequency
+  shifting, for example when testing frequency offsets in channel
+  simulation.
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_mod(struct COHPSK *coh, COMP tx_fdm[], int tx_bits[])
+{
+    struct FDMDV *fdmdv = coh->fdmdv;
+    COMP  tx_symb[NSYMROWPILOT][COHPSK_NC*ND];
+    COMP  tx_onesym[COHPSK_NC*ND];
+    int  r,c;
+
+    bits_to_qpsk_symbols(tx_symb, tx_bits, COHPSK_BITS_PER_FRAME);
+
+    for(r=0; r<NSYMROWPILOT; r++) {
+        for(c=0; c<COHPSK_NC*ND; c++) 
+            tx_onesym[c] = tx_symb[r][c];         
+        tx_filter_and_upconvert_coh(&tx_fdm[r*COHPSK_M], COHPSK_NC*ND , tx_onesym, fdmdv->tx_filter_memory, 
+                                    fdmdv->phase_tx, fdmdv->freq, &fdmdv->fbb_phase_tx, fdmdv->fbb_rect);
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_clip()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 2015
+
+  Hard clips a cohpsk modulator signal to improve PAPR, CLIP threshold
+  hard coded and will need to be changed if NC*ND does.
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_clip(COMP tx_fdm[])
+{
+    COMP  sam;
+    float mag;
+    int   i;
+
+    for(i=0; i<COHPSK_NOM_SAMPLES_PER_FRAME; i++) {
+        sam = tx_fdm[i];
+        mag = cabsolute(sam);            
+        if (mag >  COHPSK_CLIP)  {
+            sam = fcmult( COHPSK_CLIP/mag, sam);
+        }
+        tx_fdm[i] = sam;
+    }
+ }
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdm_downconvert_coh   
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 2015
+
+  Frequency shift each modem carrier down to NC baseband signals.
+
+  TODO: try to combine with fdmdv version, carefully re-test fdmdv modem.
+
+\*---------------------------------------------------------------------------*/
+
+void fdm_downconvert_coh(COMP rx_baseband[COHPSK_NC][COHPSK_M+COHPSK_M/P], int Nc, COMP rx_fdm[], COMP phase_rx[], COMP freq[], int nin)
+{
+    int   i,c;
+    float mag;
+
+    /* maximum number of input samples to demod */
+
+    assert(nin <= (COHPSK_M+COHPSK_M/P));
+
+    /* downconvert */
+  
+    for (c=0; c<Nc; c++) 
+       for (i=0; i<nin; i++) {
+           phase_rx[c] = cmult(phase_rx[c], freq[c]);
+           rx_baseband[c][i] = cmult(rx_fdm[i], cconj(phase_rx[c]));
+       }
+
+    /* normalise digital oscilators as the magnitude can drift over time */
+
+    for (c=0; c<Nc; c++) {
+        mag = cabsolute(phase_rx[c]);
+       phase_rx[c].real /= mag;          
+       phase_rx[c].imag /= mag;          
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: rx_filter_coh()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 2015
+
+  cohpsk version of fdmdv.c rx_filter function.  
+
+  TODO: see if we can merge the two!  Will require re-testing of fdmdv modem.
+
+\*---------------------------------------------------------------------------*/
+
+void rx_filter_coh(COMP rx_filt[COHPSK_NC+1][P+1], int Nc, COMP rx_baseband[COHPSK_NC+1][COHPSK_M+COHPSK_M/P], COMP rx_filter_memory[COHPSK_NC+1][+COHPSK_NFILTER], int nin)
+{
+    int c, i,j,k,l;
+    int n=COHPSK_M/P;
+
+    /* rx filter each symbol, generate P filtered output samples for
+       each symbol.  Note we keep filter memory at rate M, it's just
+       the filter output at rate P */
+
+    for(i=0, j=0; i<nin; i+=n,j++) {
+
+       /* latest input sample */
+       
+       for(c=0; c<Nc; c++)
+           for(k=COHPSK_NFILTER-n,l=i; k<COHPSK_NFILTER; k++,l++)      
+               rx_filter_memory[c][k] = rx_baseband[c][l];
+       
+       /* convolution (filtering) */
+
+       for(c=0; c<Nc; c++) {
+           rx_filt[c][j].real = 0.0; rx_filt[c][j].imag = 0.0;
+           for(k=0; k<COHPSK_NFILTER; k++) 
+               rx_filt[c][j] = cadd(rx_filt[c][j], fcmult(gt_alpha5_root_coh[k], rx_filter_memory[c][k]));
+       }
+
+       /* make room for next input sample */
+       
+       for(c=0; c<Nc; c++)
+           for(k=0,l=n; k<COHPSK_NFILTER-n; k++,l++)   
+               rx_filter_memory[c][k] = rx_filter_memory[c][l];
+    }
+
+    assert(j <= (P+1)); /* check for any over runs */
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_freq_shift_coh()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 2015
+
+  Frequency shift modem signal.  The use of complex input and output allows
+  single sided frequency shifting (no images).
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_freq_shift_coh(COMP rx_fdm_fcorr[], COMP rx_fdm[], float foff, float Fs, 
+                          COMP *foff_phase_rect, int nin)
+{
+    COMP  foff_rect;
+    float mag;
+    int   i;
+
+    foff_rect.real = cosf(2.0*PI*foff/Fs);
+    foff_rect.imag = sinf(2.0*PI*foff/Fs);
+    for(i=0; i<nin; i++) {
+       *foff_phase_rect = cmult(*foff_phase_rect, foff_rect);
+       rx_fdm_fcorr[i] = cmult(rx_fdm[i], *foff_phase_rect);
+    }
+
+    /* normalise digital oscilator as the magnitude can drfift over time */
+
+    mag = cabsolute(*foff_phase_rect);
+    foff_phase_rect->real /= mag;       
+    foff_phase_rect->imag /= mag;       
+}
+
+
+void rate_Fs_rx_processing(struct COHPSK *coh, COMP ch_symb[][COHPSK_NC*ND], COMP ch_fdm_frame[], float *f_est, int nsymb, int nin, int freq_track)
+{
+    struct FDMDV *fdmdv = coh->fdmdv;
+    int   r, c, i, ch_fdm_frame_index;
+    COMP  rx_fdm_frame_bb[COHPSK_M+COHPSK_M/P];
+    COMP  rx_baseband[COHPSK_NC*ND][COHPSK_M+COHPSK_M/P];
+    COMP  rx_filt[COHPSK_NC*ND][P+1];
+    float env[NT*P], rx_timing;
+    COMP  rx_onesym[COHPSK_NC*ND];
+    float beta, g;
+    COMP  adiff, amod_strip, mod_strip;
+
+    ch_fdm_frame_index = 0;
+    rx_timing = 0;
+
+    for (r=0; r<nsymb; r++) {
+        fdmdv_freq_shift_coh(rx_fdm_frame_bb, &ch_fdm_frame[ch_fdm_frame_index], -(*f_est), COHPSK_FS, &fdmdv->fbb_phase_rx, nin);
+        ch_fdm_frame_index += nin;
+        fdm_downconvert_coh(rx_baseband, COHPSK_NC*ND, rx_fdm_frame_bb, fdmdv->phase_rx, fdmdv->freq, nin);
+        rx_filter_coh(rx_filt, COHPSK_NC*ND, rx_baseband, coh->rx_filter_memory, nin);
+        rx_timing = rx_est_timing(rx_onesym, fdmdv->Nc, rx_filt, fdmdv->rx_filter_mem_timing, env, nin, COHPSK_M);
+  
+        for(c=0; c<COHPSK_NC*ND; c++) {
+            ch_symb[r][c] = rx_onesym[c];
+        }
+
+        /* freq tracking, see test_ftrack.m for unit test.  Placed in
+           this function as it needs to work on a symbol by symbol
+           abasis rather than frame by frame.  This means the control
+           loop operates at a sample rate of Rs = 50Hz for say 1 Hz/s
+           drift. */
+
+        if (freq_track) {
+            beta = 0.005;
+            g = 0.2;
+
+            /* combine difference on phase from last symbol over Nc carriers */
+
+            mod_strip.real = 0.0; mod_strip.imag = 0.0;
+            for(c=0; c<fdmdv->Nc+1; c++) {
+                //printf("rx_onesym[%d] %f %f prev_rx_symbols[%d] %f %f\n", c, rx_onesym[c].real, rx_onesym[c].imag,
+                //       fdmdv->prev_rx_symbols[c].real, fdmdv->prev_rx_symbols[c].imag);
+                adiff = cmult(rx_onesym[c], cconj(fdmdv->prev_rx_symbols[c]));
+                fdmdv->prev_rx_symbols[c] = rx_onesym[c];
+
+                /* 4th power strips QPSK modulation, by multiplying phase by 4
+                   Using the abs value of the real coord was found to help 
+                   non-linear issues when noise power was large. */
+
+                amod_strip = cmult(adiff, adiff);
+                amod_strip = cmult(amod_strip, amod_strip);
+                amod_strip.real = fabsf(amod_strip.real);
+                mod_strip = cadd(mod_strip, amod_strip);
+            }
+            //printf("modstrip: %f %f\n", mod_strip.real, mod_strip.imag);
+
+            /* loop filter made up of 1st order IIR plus integrator.  Integerator
+               was found to be reqd  */
+        
+            fdmdv->filt = (1.0-beta)*fdmdv->filt + beta*atan2(mod_strip.imag, mod_strip.real);
+            //printf("filt: %f angle: %f\n", fdmdv->filt, atan2(mod_strip.imag, mod_strip.real));
+            *f_est += g*fdmdv->filt;
+        }    
+
+        /* Optional logging used for testing against Octave version */
+
+        if (coh->rx_baseband_log) {
+            assert(nin <= (COHPSK_M+COHPSK_M/P));
+            for(c=0; c<COHPSK_NC*ND; c++) {       
+                for(i=0; i<nin; i++) {
+                    coh->rx_baseband_log[c*coh->rx_baseband_log_col_sz + coh->rx_baseband_log_col_index + i] = rx_baseband[c][i]; 
+                }
+            }
+            coh->rx_baseband_log_col_index += nin;
+            assert(coh->rx_baseband_log_col_index <= coh->rx_baseband_log_col_sz);
+        }
+
+        if (coh->rx_filt_log) {
+         for(c=0; c<COHPSK_NC*ND; c++) {     
+            for(i=0; i<nin/(COHPSK_M/P); i++) {
+              coh->rx_filt_log[c*coh->rx_filt_log_col_sz + coh->rx_filt_log_col_index + i] = rx_filt[c][i]; 
+            }
+         }
+         coh->rx_filt_log_col_index += nin/(COHPSK_M/P);        
+        }
+
+        if (coh->ch_symb_log) {
+            for(c=0; c<COHPSK_NC*ND; c++) {
+               coh->ch_symb_log[coh->ch_symb_log_r*COHPSK_NC*ND + c] = ch_symb[r][c]; 
+            }
+            coh->ch_symb_log_r++;
+        }
+
+        if (coh->rx_timing_log) {
+            coh->rx_timing_log[coh->rx_timing_log_index] = rx_timing;
+            coh->rx_timing_log_index++;
+            //printf("rx_timing_log_index: %d\n", coh->rx_timing_log_index);
+        }
+
+        /* we only allow a timing shift on one symbol per frame */
+
+        if (nin != COHPSK_M)
+            nin = COHPSK_M;
+    }
+
+    coh->rx_timing = rx_timing;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_demod()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 5/4/2015
+
+  COHPSK demodulator, takes an array of (nominally) nin_frame =
+  COHPSK_NOM_SAMPLES_PER_FRAME modulated samples, returns an array of
+  COHPSK_BITS_PER_FRAME bits.
+
+  The input signal is complex to support single sided frequency shifting
+  before the demod input (e.g. click to tune feature).
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_demod(struct COHPSK *coh, float rx_bits[], int *sync_good, COMP rx_fdm[], int *nin_frame)
+{
+    COMP  ch_symb[NSW*NSYMROWPILOT][COHPSK_NC*ND];
+    int   i, j, sync, anext_sync, next_sync, nin, r, c;
+    float max_ratio, f_est;
+
+    assert(*nin_frame <= COHPSK_MAX_SAMPLES_PER_FRAME);
+
+    next_sync = sync = coh->sync;
+
+    for (i=0; i<NSW*NSYMROWPILOT*COHPSK_M-*nin_frame; i++)
+        coh->ch_fdm_frame_buf[i] = coh->ch_fdm_frame_buf[i+*nin_frame];
+    //printf("nin_frame: %d i: %d i+nin_frame: %d\n", *nin_frame, i, i+*nin_frame);
+    for (j=0; i<NSW*NSYMROWPILOT*COHPSK_M; i++,j++)
+        coh->ch_fdm_frame_buf[i] = rx_fdm[j];
+    //printf("i: %d j: %d rx_fdm[0]: %f %f\n", i,j, rx_fdm[0].real, rx_fdm[0].imag);
+
+    /* if out of sync do Initial Freq offset estimation using NSW frames to flush out filter memories */
+
+    if (sync == 0) {
+
+        /* we can test +/- 20Hz, so we break this up into 3 tests to cover +/- 60Hz */
+
+        max_ratio = 0.0;
+        f_est = 0.0;
+        for (coh->f_est = FDMDV_FCENTRE-40.0; coh->f_est <= FDMDV_FCENTRE+40.0; coh->f_est += 40.0) {
+        
+            if (coh->verbose)
+                fprintf(stderr, "  [%d] acohpsk.f_est: %f +/- 20\n", coh->frame, coh->f_est);
+
+            /* we are out of sync so reset f_est and process two frames to clean out memories */
+
+            rate_Fs_rx_processing(coh, ch_symb, coh->ch_fdm_frame_buf, &coh->f_est, NSW*NSYMROWPILOT, COHPSK_M, 0);
+            for (i=0; i<NSW-1; i++) {
+                update_ct_symb_buf(coh->ct_symb_buf, &ch_symb[i*NSYMROWPILOT]);
+            }
+            frame_sync_fine_freq_est(coh, &ch_symb[(NSW-1)*NSYMROWPILOT], sync, &anext_sync);
+
+            if (anext_sync == 1) {
+                //printf("  [%d] acohpsk.ratio: %f\n", f, coh->ratio);
+                if (coh->ratio > max_ratio) {
+                    max_ratio   = coh->ratio;
+                    f_est       = coh->f_est - coh->f_fine_est;
+                    next_sync   = anext_sync;
+                }
+            }
+        }
+
+        if (next_sync == 1) {
+
+            /* we've found a sync candidate!
+               re-process last NSW frames with adjusted f_est then check again */
+
+            coh->f_est = f_est;
+
+            if (coh->verbose)
+                fprintf(stderr, "  [%d] trying sync and f_est: %f\n", coh->frame, coh->f_est);
+
+            rate_Fs_rx_processing(coh, ch_symb, coh->ch_fdm_frame_buf, &coh->f_est, NSW*NSYMROWPILOT, COHPSK_M, 0);
+            for (i=0; i<NSW-1; i++) {
+                update_ct_symb_buf(coh->ct_symb_buf, &ch_symb[i*NSYMROWPILOT]);
+            }
+            /*
+              for(i=0; i<NSW*NSYMROWPILOT; i++) {
+                printf("%f %f\n", ch_symb[i][0].real, ch_symb[i][0].imag);
+            }
+            */
+            /*
+            for(i=0; i<NCT_SYMB_BUF; i++) {
+                printf("%f %f\n", coh->ct_symb_buf[i][0].real, coh->ct_symb_buf[i][0].imag);
+            }
+            */
+             frame_sync_fine_freq_est(coh, &ch_symb[(NSW-1)*NSYMROWPILOT], sync, &next_sync);
+
+            if (fabs(coh->f_fine_est) > 2.0) {
+                if (coh->verbose)
+                    fprintf(stderr, "  [%d] Hmm %f is a bit big :(\n", coh->frame, coh->f_fine_est);
+                next_sync = 0;
+            }
+        }
+
+        if (next_sync == 1) {
+            /* OK we are in sync!
+               demodulate first frame (demod completed below) */
+
+            if (coh->verbose)
+                fprintf(stderr, "  [%d] in sync! f_est: %f ratio: %f \n", coh->frame, coh->f_est, coh->ratio);
+            for(r=0; r<NSYMROWPILOT+2; r++)
+                for(c=0; c<COHPSK_NC*ND; c++)
+                    coh->ct_symb_ff_buf[r][c] = coh->ct_symb_buf[coh->ct+r][c];
+        }
+    }  
+
+    /* If in sync just do sample rate processing on latest frame */
+
+    if (sync == 1) {
+        rate_Fs_rx_processing(coh, ch_symb, rx_fdm, &coh->f_est, NSYMROWPILOT, coh->nin, 1);
+        frame_sync_fine_freq_est(coh, ch_symb, sync, &next_sync);
+        for(r=0; r<2; r++)
+            for(c=0; c<COHPSK_NC*ND; c++)
+                coh->ct_symb_ff_buf[r][c] = coh->ct_symb_ff_buf[r+NSYMROWPILOT][c];
+        for(; r<NSYMROWPILOT+2; r++)
+            for(c=0; c<COHPSK_NC*ND; c++)
+                coh->ct_symb_ff_buf[r][c] = coh->ct_symb_buf[coh->ct+r][c];
+    }
+
+    /* if we are in sync complete demodulation with symbol rate processing */
+  
+    *sync_good = 0;
+    if ((next_sync == 1) || (sync == 1)) {
+        qpsk_symbols_to_bits(coh, rx_bits, coh->ct_symb_ff_buf);
+        *sync_good = 1;
+    }
+
+    sync = sync_state_machine(coh, sync, next_sync);        
+    coh->sync = sync;
+
+    /* work out how many samples we need for the next call to account
+       for differences in tx and rx sample clocks */
+
+    nin = COHPSK_M;   
+    if (sync == 1) {
+        if (coh->rx_timing > COHPSK_M/P)
+            nin = COHPSK_M + COHPSK_M/P;
+        if (coh->rx_timing < -COHPSK_M/P)
+            nin = COHPSK_M - COHPSK_M/P;
+    }
+    coh->nin = nin;
+    *nin_frame = (NSYMROWPILOT-1)*COHPSK_M + nin;
+    //if (coh->verbose)
+    //    fprintf(stderr, "%f %d %d\n", coh->rx_timing, nin, *nin_frame);
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_fs_offset()          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: May 2015
+
+  Simulates small Fs offset between mod and demod.
+
+\*---------------------------------------------------------------------------*/
+
+int cohpsk_fs_offset(COMP out[], COMP in[], int n, float sample_rate_ppm)
+{
+    double tin, f;
+    int   tout, t1, t2;
+
+    tin = 0.0; tout = 0; 
+    while (tin < n) {
+      t1 = floor(tin);
+      t2 = ceil(tin);
+      f = tin - t1;
+      out[tout].real = (1.0-f)*in[t1].real + f*in[t2].real;
+      out[tout].imag = (1.0-f)*in[t1].imag + f*in[t2].imag;
+      tout += 1;
+      tin  += 1.0 + sample_rate_ppm/1E6;
+      //printf("tin: %f tout: %d f: %f\n", tin, tout, f);
+    }
+
+    return tout;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_get_demod_stats()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 14 June 2015
+
+  Fills stats structure with a bunch of demod information.
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_get_demod_stats(struct COHPSK *coh, struct MODEM_STATS *stats)
+{
+    int   c,r;
+    COMP  pi_4;
+    float new_snr_est;
+
+    pi_4.real = cosf(M_PI/4.0);
+    pi_4.imag = sinf(M_PI/4.0);
+
+    stats->Nc = COHPSK_NC*ND;
+    assert(stats->Nc <= MODEM_STATS_NC_MAX);
+    new_snr_est = 20*log10((coh->sig_rms+1E-6)/(coh->noise_rms+1E-6)) - 10*log10(3000.0/700.0);
+    stats->snr_est = 0.9*stats->snr_est + 0.1*new_snr_est;
+
+    //fprintf(stderr, "sig_rms: %f noise_rms: %f snr_est: %f\n", coh->sig_rms, coh->noise_rms, stats->snr_est);
+    stats->sync = coh->sync;
+    stats->foff = coh->f_est - FDMDV_FCENTRE;
+    stats->rx_timing = coh->rx_timing;
+    stats->clock_offset = 0.0; /* TODO - implement clock offset estimation */
+
+    assert(NSYMROW <= MODEM_STATS_NR_MAX);
+    stats->nr = NSYMROW;
+    for(c=0; c<COHPSK_NC*ND; c++) {
+        for (r=0; r<NSYMROW; r++) {
+            stats->rx_symbols[r][c] = cmult(coh->rx_symb[r][c], pi_4);
+        }
+    }
+}
+
+
+void cohpsk_set_verbose(struct COHPSK *coh, int verbose)
+{
+    assert(coh != NULL);
+    coh->verbose = verbose;
+}
+
+
+void cohpsk_set_frame(struct COHPSK *coh, int frame)
+{
+    assert(coh != NULL);
+    coh->frame = frame;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_get_test_bits()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: June 2015
+
+  Returns a frame of known test bits.
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_get_test_bits(struct COHPSK *coh, int rx_bits[])
+{
+    memcpy(rx_bits, coh->ptest_bits_coh_tx, sizeof(int)*COHPSK_BITS_PER_FRAME);
+    coh->ptest_bits_coh_tx += COHPSK_BITS_PER_FRAME;
+    if (coh->ptest_bits_coh_tx >=coh->ptest_bits_coh_end) {
+        coh->ptest_bits_coh_tx = (int*)test_bits_coh;
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: cohpsk_put_test_bits()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: June 2015
+
+  Accepts bits from demod and attempts to sync with the known
+  test_bits sequence.  When synced measures bit errors.
+
+\*---------------------------------------------------------------------------*/
+
+void cohpsk_put_test_bits(struct COHPSK *coh, int *state, short error_pattern[],
+                        int *bit_errors, float rx_bits_sd[])
+{
+    int i, next_state, anerror;
+    int rx_bits[COHPSK_BITS_PER_FRAME];
+
+    for(i=0; i<COHPSK_BITS_PER_FRAME; i++) {
+        rx_bits[i] = rx_bits_sd[i] < 0.0;
+    }
+
+    *bit_errors = 0;
+    for(i=0; i<COHPSK_BITS_PER_FRAME; i++) {
+        anerror = (rx_bits[i] & 0x1) ^ coh->ptest_bits_coh_rx[i];
+        if ((anerror < 0) || (anerror > 1)) {
+            fprintf(stderr, "i: %d rx_bits: %d ptest_bits_coh_rx: %d\n", i, rx_bits[i], coh->ptest_bits_coh_rx[i]);
+        }
+        *bit_errors += anerror;
+        error_pattern[i] = anerror;
+    }
+
+    /* state logic */
+
+    next_state = *state;
+
+    if (*state == 0) {
+        if (*bit_errors < 4) {
+            next_state = 1;
+            coh->ptest_bits_coh_rx += COHPSK_BITS_PER_FRAME;
+            if (coh->ptest_bits_coh_rx >= coh->ptest_bits_coh_end) {
+                coh->ptest_bits_coh_rx = (int*)test_bits_coh;
+            }
+        }
+    }
+
+    /* if 5 frames with large BER reset test frame sync */
+
+    if (*state > 0) {
+        if (*bit_errors > 8) {
+            if (*state == 6)
+                next_state = 0;
+            else
+                next_state = *state+1;
+        }
+        else
+            next_state = 1;
+    }
+
+    if (*state > 0) {
+        coh->ptest_bits_coh_rx += COHPSK_BITS_PER_FRAME;
+        if (coh->ptest_bits_coh_rx >= coh->ptest_bits_coh_end) {
+            coh->ptest_bits_coh_rx = (int*)test_bits_coh;
+        }
+    }
+   
+    //fprintf(stderr, "state: %d next_state: %d bit_errors: %d\n", *state, next_state, *bit_errors);
+
+    *state = next_state;
+}
+
+int cohpsk_error_pattern_size(void) { 
+    return COHPSK_BITS_PER_FRAME;
+}
+
+
diff --git a/codec2/tags/0.4/src/cohpsk_ch.c b/codec2/tags/0.4/src/cohpsk_ch.c
new file mode 100644 (file)
index 0000000..6aa96b9
--- /dev/null
@@ -0,0 +1,339 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk_ch.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: May 2015
+                                                                             
+  Channel impairment program for testing command line versions of
+  cohpsk modem.
+     
+  TODO: 
+    [ ] measure and prints pwrs to check, prints warning
+    [ ] SNR in 3000Hz input
+    [ ] example operation with sox for sample rate change
+    [ ] way to calibrate for different input pwrs
+    [ ] HT to do real->complex
+        [ ] check no BER hit just through HT
+        [ ] unit test HT
+    [ ] clipping detect
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_cohpsk.h"
+#include "comp_prim.h"
+#include "../unittest/noise_samples.h"
+#include "ht_coeff.h"
+#include "ssbfilt_coeff.h"
+#include "codec2_fdmdv.h"
+
+#define BUF_N                 160
+#define FAST_FADING_DELAY_MS  2.0
+#define SLOW_FADING_DELAY_MS  0.5
+#define PAPR_TARGET           7.0
+
+/* This file gets generated using the function write_noise_file in tcohpsk.m.  You have to run
+   tcohpsk first (any variant) to load the function into Octave, e.g.:
+
+  octave:17> tcohpsk
+  octave:18> write_noise_file("../raw/fading_samples.float", 7500, 7500*60)
+*/
+
+#define FAST_FADING_FILE_NAME "../../raw/fast_fading_samples.float"
+#define SLOW_FADING_FILE_NAME "../../raw/slow_fading_samples.float"
+
+int main(int argc, char *argv[])
+{
+    FILE          *fin, *ffading, *fout;
+    float          NodB, foff_hz;
+    int            fading_en, nhfdelay;
+
+    short          buf[BUF_N];
+    float          htbuf[HT_N+BUF_N];
+    COMP           ch_in[BUF_N];
+    COMP           ch_fdm[BUF_N];
+    float          ssbfiltbuf[SSBFILT_N+BUF_N];
+    float          ssbfiltout[BUF_N];
+                                           
+    COMP           phase_ch;
+    int            noise_r, noise_end;
+    float          No, variance;
+    COMP           scaled_noise;
+    float          hf_gain;
+    COMP          *ch_fdm_delay, aspread, aspread_2ms, delayed, direct;
+    float          tx_pwr, tx_pwr_fade, noise_pwr;
+    int            frames, i, j, k, ret, clipped;
+    float          sam, peak, inclip, papr, CNo, snr3k, EbNo700;
+
+    if (argc == 7) {
+        if (strcmp(argv[1], "-")  == 0) fin = stdin;
+        else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+            fprintf(stderr, "Error opening input modem raw file: %s: %s.\n",
+                    argv[1], strerror(errno));
+            exit(1);
+        }
+
+        if (strcmp(argv[2], "-") == 0) fout = stdout;
+        else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+            fprintf(stderr, "Error opening output modem raw file: %s: %s.\n",
+                    argv[2], strerror(errno));
+            exit(1);
+        }
+
+        NodB = atof(argv[3]);
+        foff_hz = atof(argv[4]);
+        fading_en = atoi(argv[5]);
+        inclip = atof(argv[6]);
+    }
+    else {
+        fprintf(stderr, "usage: %s InputRealModemRawFileFs7500Hz OutputRealModemRawFileFs7500Hz No(dB/Hz) FoffHz Fading[0-none 1-fast 2-slow] InputClip0to1\n", argv[0]);
+        exit(1);
+    }
+    fprintf(stderr, "NodB: %4.2f foff: %4.2f Hz fading: %d inclip: %4.2f\n", NodB, foff_hz, fading_en, inclip);
+    
+    phase_ch.real = 1.0; phase_ch.imag = 0.0; 
+    noise_r = 0; 
+    noise_end = sizeof(noise)/sizeof(COMP);
+
+    /*  N = var = NoFs */
+
+    No = pow(10.0, NodB/10.0);
+    variance = COHPSK_FS*No;
+    
+    tx_pwr = tx_pwr_fade = noise_pwr = 0.0;
+    clipped = 0;
+    peak = 0.0;
+
+    /* init HF fading model */
+
+    if (fading_en) {
+        if (fading_en == 1) {
+            ffading = fopen(FAST_FADING_FILE_NAME, "rb");
+            if (ffading == NULL) {
+                printf("Can't find fast fading file: %s\n", FAST_FADING_FILE_NAME);
+                exit(1);
+            }
+            nhfdelay = floor(FAST_FADING_DELAY_MS*COHPSK_FS/1000);
+        }
+
+        if (fading_en == 2) {
+            ffading = fopen(SLOW_FADING_FILE_NAME, "rb");
+            if (ffading == NULL) {
+                printf("Can't find slow fading file: %s\n", SLOW_FADING_FILE_NAME);
+                exit(1);
+            }
+            nhfdelay = floor(SLOW_FADING_DELAY_MS*COHPSK_FS/1000);
+        }
+
+        ch_fdm_delay = (COMP*)malloc((nhfdelay+COHPSK_NOM_SAMPLES_PER_FRAME)*sizeof(COMP));
+        assert(ch_fdm_delay != NULL);
+        for(i=0; i<nhfdelay+COHPSK_NOM_SAMPLES_PER_FRAME; i++) {
+            ch_fdm_delay[i].real = 0.0;
+            ch_fdm_delay[i].imag = 0.0;
+        }
+
+        /* first values in file are HF gains */
+
+        for (i=0; i<4; i++)
+            ret = fread(&hf_gain, sizeof(float), 1, ffading);
+        fprintf(stderr, "hf_gain: %f\n", hf_gain);
+    }
+
+    for(i=0; i<HT_N; i++) {
+        htbuf[i] = 0.0;
+    }
+
+    /* --------------------------------------------------------*\
+                                 Main Loop
+    \*---------------------------------------------------------*/
+    
+    while(fread(buf, sizeof(short), BUF_N, fin) == BUF_N) {
+       frames++;
+
+        /* Hilbert Transform to produce complex signal so we can do
+           single sided freq shifts.  Allows us to use real signal I/O
+           which is handy */
+
+        for(i=0, j=HT_N; i<BUF_N; i++,j++) {
+
+            /* 
+               Hilbert Transform to produce complex signal so we can do
+               single sided freq shifts.  Essential filters out negative
+               freqencies.
+            */
+
+            sam = (float)buf[i];
+            //printf("sam: %f ", sam);
+            if (sam > inclip*32767.0)
+                sam = inclip*32767.0;
+            if (sam < -inclip*32767.0)
+                sam = -inclip*32767.0;
+            //printf("sam: %f\n", sam);
+            htbuf[j] = sam/FDMDV_SCALE;
+            
+            if (fabs(htbuf[j]) > peak) {
+                peak = fabs(htbuf[j]);
+            }
+            tx_pwr += pow(htbuf[j], 2.0);
+
+            /* FIR filter with HT to get imag, just delay to get real */
+
+            ch_in[i].real = 0.0;
+            ch_in[i].imag = 0.0;
+            for(k=0; k<HT_N; k++) {
+                ch_in[i].real += htbuf[j-k]*ht_coeff[k].real;
+                ch_in[i].imag += htbuf[j-k]*ht_coeff[k].imag;
+            }
+            //printf("%d %f %f\n", i, ch_in[i].real, ch_in[i].imag);
+        }
+        assert(j <= (BUF_N+HT_N));
+        
+        /* update HT memory */
+
+        for(i=0; i<HT_N; i++)
+           htbuf[i] = htbuf[i+BUF_N];
+
+       /* --------------------------------------------------------*\
+                                 Channel
+       \*---------------------------------------------------------*/
+
+        fdmdv_freq_shift(ch_fdm, ch_in, foff_hz, &phase_ch, BUF_N);
+
+        /* optional HF fading -------------------------------------*/
+
+        if (fading_en) {
+
+            /* update delayed signal buffer */
+
+            for(i=0; i<nhfdelay; i++)
+                ch_fdm_delay[i] = ch_fdm_delay[i+BUF_N];
+            for(j=0; j<BUF_N; i++, j++)
+                ch_fdm_delay[i] = ch_fdm[j];
+
+            /* combine direct and delayed paths, both multiplied by
+               "spreading" (doppler) functions */
+
+            for(i=0; i<BUF_N; i++) {
+                ret = fread(&aspread, sizeof(COMP), 1, ffading);
+                assert(ret == 1);
+                ret = fread(&aspread_2ms, sizeof(COMP), 1, ffading);
+                assert(ret == 1);
+                //printf("%f %f %f %f\n", aspread.real, aspread.imag, aspread_2ms.real, aspread_2ms.imag);
+                
+                direct    = cmult(aspread, ch_fdm[i]);
+                delayed   = cmult(aspread_2ms, ch_fdm_delay[i]);
+                ch_fdm[i] = fcmult(hf_gain, cadd(direct, delayed));
+            }
+        }
+
+        /* Measure power after fading model to make sure aaverage pwr
+           is the same as AWGN channels. We only output the real
+           signal, which is half the power. */
+
+        for(i=0; i<BUF_N; i++) {
+            tx_pwr_fade += pow(ch_fdm[i].real, 2.0);
+        }
+
+        /* AWGN noise ------------------------------------------*/
+
+        for(i=0; i<BUF_N; i++) {
+            scaled_noise = fcmult(sqrt(variance), noise[noise_r]);
+            ch_fdm[i] = cadd(ch_fdm[i], scaled_noise);
+            noise_pwr += pow(scaled_noise.real, 2.0);
+            noise_r++;
+            if (noise_r > noise_end) {
+                noise_r = 0;
+                //fprintf(stderr, "  [%d] noise wrap\n", f);            
+            }              
+        }
+
+        /* FIR filter to simulate (a rather flat) SSB filter.  Might
+           be useful to have an option for a filter with a few dB
+           ripple too, to screw up the modem. This is mainly so analog
+           SSB sounds realistic. */
+
+        for(i=0, j=SSBFILT_N; i<BUF_N; i++,j++) {
+            ssbfiltbuf[j] = ch_fdm[i].real;
+            ssbfiltout[i] = 0.0;
+            for(k=0; k<SSBFILT_N; k++) {
+                ssbfiltout[i] += ssbfiltbuf[j-k]*ssbfilt_coeff[k];
+            }
+        }
+
+        /* update SSB filter memory */
+
+        for(i=0; i<SSBFILT_N; i++)
+           ssbfiltbuf[i] = ssbfiltbuf[i+BUF_N];
+
+       /* scale and save to disk as shorts */
+
+       for(i=0; i<BUF_N; i++) {
+            sam = FDMDV_SCALE * ssbfiltout[i];
+            if (sam > 32767.0) {
+                clipped++;
+                sam = 32767.0;
+            }
+            if (sam < -32767.0) {
+                clipped++;
+                sam = -32767.0;
+            }
+           buf[i] = sam;
+        }
+
+       fwrite(buf, sizeof(short), BUF_N, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    fclose(fin);
+    fclose(fout);
+    
+    fprintf(stderr, "peak pwr.....: %7.2f\nav input pwr.: %7.2f\nav pwr fading: %7.2f\nnoise pwr....: %7.2f\nclipping.....: %7.2f %%\n", 
+            peak*peak,
+            tx_pwr/(frames*BUF_N), 
+            tx_pwr_fade/(frames*BUF_N),
+            noise_pwr/(frames*BUF_N),
+            100.0*clipped/frames
+           );
+    papr = 10*log10(peak*peak/(tx_pwr/(frames*BUF_N)));
+    CNo = 10*log10(tx_pwr/(noise_pwr/(COHPSK_FS/2))); // single sided spctrum magic IDFK!
+    snr3k = CNo - 10*log10(3000);
+    EbNo700 = CNo - 10*log10(700) - 10*log10(6.0/4.0); // divide by bit rate and pilot overhead
+    fprintf(stderr, "PAPR (dB)....: %7.2f (target %3.2f)\nC/No (dB)....: %7.2f\nSNR3k........: %7.2f\nEb/No(Rb=700): %7.2f\n",
+            papr,
+            PAPR_TARGET,
+            CNo,
+            snr3k,
+            EbNo700
+            );
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/cohpsk_defs.h b/codec2/tags/0.4/src/cohpsk_defs.h
new file mode 100644 (file)
index 0000000..a03bfe7
--- /dev/null
@@ -0,0 +1,9 @@
+/* Generated by write_pilot_file() Octave function */
+
+#define NSYMROW      4   /* number of data symbols on each row (i.e. each carrier) */
+#define NS           4   /* number of data symbols between pilots                   */
+#define NPILOTSFRAME 2   /* number of pilot symbols on each row                     */
+#define PILOTS_NC    7   /* number of carriers                                      */
+
+#define NSYMROWPILOT 6   /* length of row after pilots inserted                     */
+
diff --git a/codec2/tags/0.4/src/cohpsk_demod.c b/codec2/tags/0.4/src/cohpsk_demod.c
new file mode 100644 (file)
index 0000000..fcac69d
--- /dev/null
@@ -0,0 +1,169 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk_demod.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 6 2015
+                                                                             
+  Given an input file of raw file (8kHz, 16 bit shorts) of COHPSK modem samples,
+  outputs a file of bits (note one bit per int, not compressed).
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_cohpsk.h"
+#include "cohpsk_defs.h"
+#include "cohpsk_internal.h"
+#include "codec2_fdmdv.h"
+#include "octave.h"
+
+#define LOG_FRAMES 100
+#define SYNC_FRAMES 12                    /* sync state uses up extra log storage as we reprocess several times */
+
+int main(int argc, char *argv[])
+{
+    FILE          *fin, *fout, *foct;
+    struct COHPSK *cohpsk;
+    float         rx_bits[COHPSK_BITS_PER_FRAME];
+    COMP          rx_fdm[COHPSK_MAX_SAMPLES_PER_FRAME];
+    short         rx_fdm_scaled[COHPSK_MAX_SAMPLES_PER_FRAME];
+    int           frames, sync, nin_frame;
+    float        *rx_amp_log;
+    float        *rx_phi_log;
+    COMP         *rx_symb_log;
+    float         f_est_log[LOG_FRAMES], ratio_log[LOG_FRAMES];
+    int           i, r, c, log_data_r, oct, logframes;
+
+    if (argc < 3) {
+       printf("usage: %s InputModemRawFile OutputOneBitPerIntFile [OctaveLogFile]\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input modem sample file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    foct = NULL;
+    oct = 0;
+    if (argc == 4) {
+        if ( (foct = fopen(argv[3],"wt")) == NULL ) {
+            fprintf(stderr, "Error opening output Octave file: %s: %s.\n",
+                    argv[3], strerror(errno));            
+       exit(1);
+        }
+        oct = 1;
+    }
+
+    cohpsk = cohpsk_create();
+    cohpsk_set_verbose(cohpsk, 1);
+
+    if (oct) {
+        logframes = LOG_FRAMES;
+        rx_amp_log = (float *)malloc(sizeof(float)*logframes*NSYMROW*COHPSK_NC*ND);
+        assert(rx_amp_log != NULL);
+        rx_phi_log = (float *)malloc(sizeof(float)*logframes*NSYMROW*COHPSK_NC*ND);
+        assert(rx_phi_log != NULL);
+        rx_symb_log = (COMP *)malloc(sizeof(COMP)*logframes*NSYMROW*COHPSK_NC*ND);
+        assert(rx_symb_log != NULL);
+        cohpsk->rx_timing_log = (float*)malloc(sizeof(float)*SYNC_FRAMES*logframes*NSYMROWPILOT);
+        assert(cohpsk->rx_timing_log != NULL);
+    }
+
+    log_data_r = 0;
+    frames = 0;
+
+    nin_frame = COHPSK_NOM_SAMPLES_PER_FRAME;
+    while(fread(rx_fdm_scaled, sizeof(short), nin_frame, fin) == nin_frame) {
+       frames++;
+        cohpsk_set_frame(cohpsk, frames);
+
+       /* scale and demod */
+
+       for(i=0; i<nin_frame; i++) {
+           rx_fdm[i].real = rx_fdm_scaled[i]/FDMDV_SCALE;
+            rx_fdm[i].imag = 0.0;
+        }
+
+       cohpsk_demod(cohpsk, rx_bits, &sync, rx_fdm, &nin_frame);
+
+       if (sync) {
+            fwrite(rx_bits, sizeof(float), COHPSK_BITS_PER_FRAME, fout);
+
+            if (oct) {
+                for(r=0; r<NSYMROW; r++, log_data_r++) {
+                    for(c=0; c<COHPSK_NC*ND; c++) {
+                        rx_amp_log[log_data_r*COHPSK_NC*ND+c] = cohpsk->amp_[r][c]; 
+                        rx_phi_log[log_data_r*COHPSK_NC*ND+c] = cohpsk->phi_[r][c]; 
+                        rx_symb_log[log_data_r*COHPSK_NC*ND+c] = cohpsk->rx_symb[r][c]; 
+                    }
+                }
+
+                f_est_log[frames-1] = cohpsk->f_est;
+                ratio_log[frames-1] = cohpsk->ratio;
+                //fprintf(stderr,"ratio: %f\n", cohpsk->ratio);
+
+                //printf("frames: %d log_data_r: %d\n", frames, log_data_r);
+                if (frames == logframes)
+                    oct = 0;
+            }
+        }
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin); 
+    }
+
+    fclose(fin);
+    fclose(fout);
+
+    /* optionally dump Octave files */
+
+    if (foct != NULL) {
+        octave_save_float(foct, "rx_amp_log_c", (float*)rx_amp_log, log_data_r, COHPSK_NC*ND, COHPSK_NC*ND);  
+        octave_save_float(foct, "rx_phi_log_c", (float*)rx_phi_log, log_data_r, COHPSK_NC*ND, COHPSK_NC*ND);  
+        octave_save_complex(foct, "rx_symb_log_c", (COMP*)rx_symb_log, log_data_r, COHPSK_NC*ND, COHPSK_NC*ND);  
+        octave_save_float(foct, "rx_timing_log_c", (float*)cohpsk->rx_timing_log, 1, cohpsk->rx_timing_log_index, cohpsk->rx_timing_log_index);  
+        octave_save_float(foct, "f_est_log_c", f_est_log, 1, logframes, logframes);  
+        octave_save_float(foct, "ratio_log_c", ratio_log, 1, logframes, logframes);  
+        fclose(foct);
+    }
+
+    cohpsk_destroy(cohpsk);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/cohpsk_get_test_bits.c b/codec2/tags/0.4/src/cohpsk_get_test_bits.c
new file mode 100644 (file)
index 0000000..ed4f547
--- /dev/null
@@ -0,0 +1,87 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk_put_test_bits.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 2015
+                                                                             
+  Generates a file of test bits, useful for input to cohpsk_mod.
+
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  Copyright (C) 2015 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_cohpsk.h"
+#include "test_bits_coh.h"
+
+int main(int argc, char *argv[])
+{
+    FILE         *fout;
+    int           tx_bits[COHPSK_BITS_PER_FRAME];
+    float         sd_tx_bits[COHPSK_BITS_PER_FRAME];
+    int           numBits, nFrames, n;
+    int           *ptest_bits_coh, *ptest_bits_coh_end, i;
+
+    if (argc < 2) {
+       printf("usage: %s OutputOneFloatPerBitFile numBits\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[1],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    ptest_bits_coh = (int*)test_bits_coh;
+    ptest_bits_coh_end = (int*)test_bits_coh + sizeof(test_bits_coh)/sizeof(int);
+    numBits = atoi(argv[2]);
+    nFrames = numBits/COHPSK_BITS_PER_FRAME;
+
+    for(n=0; n<nFrames; n++) {
+
+        memcpy(tx_bits, ptest_bits_coh, sizeof(int)*COHPSK_BITS_PER_FRAME);
+        ptest_bits_coh += COHPSK_BITS_PER_FRAME;
+        if (ptest_bits_coh >= ptest_bits_coh_end) {
+            ptest_bits_coh = (int*)test_bits_coh;
+        }
+
+        for(i=0; i<COHPSK_BITS_PER_FRAME; i++)
+            sd_tx_bits[i] = 1.0 - 2.0*tx_bits[i];
+
+       fwrite(sd_tx_bits, sizeof(float), COHPSK_BITS_PER_FRAME, fout);
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+    }
+
+    fclose(fout);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/cohpsk_internal.h b/codec2/tags/0.4/src/cohpsk_internal.h
new file mode 100644 (file)
index 0000000..119d968
--- /dev/null
@@ -0,0 +1,110 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk_internal.h
+  AUTHOR......: David Rowe
+  DATE CREATED: March 2015
+                                                                             
+  Functions that implement a coherent PSK FDM modem.
+                                                               
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __COHPSK_INTERNAL__
+#define __COHPSK_INTERNAL__
+
+#define NCT_SYMB_BUF      (2*NSYMROWPILOT+2)
+#define ND                2                           /* diversity factor ND 1 is no diveristy, ND we have orginal plus 
+                                                         one copy */
+#define NSW               4                           /* number of sync window frames */
+#define COHPSK_ND         2                           /* diversity factor   */
+#define COHPSK_M          100                         /* oversampling rate */
+#define COHPSK_NSYM       6
+#define COHPSK_NFILTER    (COHPSK_NSYM*COHPSK_M)
+#define COHPSK_EXCESS_BW  0.5                         /* excess BW factor of root nyq filter */
+#define COHPSK_NT         5                           /* number of symbols we estimate timing over */
+#define COHPSK_CLIP       6.5                         /* hard clipping for Nc*Nc=14 to reduce PAPR */
+#include "fdmdv_internal.h"
+#include "kiss_fft.h"
+
+struct COHPSK {
+    COMP         ch_fdm_frame_buf[NSW*NSYMROWPILOT*COHPSK_M];  /* buffer of several frames of symbols from channel      */
+    float        pilot2[2*NPILOTSFRAME][COHPSK_NC];    
+    float        phi_[NSYMROW][COHPSK_NC*ND];           /* phase estimates for this frame of rx data symbols     */
+    float        amp_[NSYMROW][COHPSK_NC*ND];           /* amplitude estimates for this frame of rx data symbols */
+    COMP         rx_symb[NSYMROW][COHPSK_NC*ND];        /* demodulated symbols                                   */
+    float        f_est;
+    COMP         rx_filter_memory[COHPSK_NC*ND][COHPSK_NFILTER];
+    COMP         ct_symb_buf[NCT_SYMB_BUF][COHPSK_NC*ND];
+    int          ct;                                    /* coarse timing offset in symbols                       */
+    float        rx_timing;                             /* fine timing for last symbol in frame                  */
+    int          nin;                                   /* number of samples to input for next symbol            */
+    float        f_fine_est;
+    COMP         ff_rect;
+    COMP         ff_phase;
+    COMP         ct_symb_ff_buf[NSYMROWPILOT+2][COHPSK_NC*ND];
+    int          sync;
+    int          sync_timer;
+
+    int          frame;
+    float        ratio;
+
+    float        sig_rms;
+    float        noise_rms;
+
+    struct FDMDV *fdmdv;
+    
+    int           verbose;
+
+    int          *ptest_bits_coh_tx;
+    int          *ptest_bits_coh_rx;
+    int          *ptest_bits_coh_end;
+
+    /* optional log variables used for testing Octave to C port */
+
+    COMP          *rx_baseband_log;
+    int            rx_baseband_log_col_index;
+    int            rx_baseband_log_col_sz;
+
+    COMP          *rx_filt_log;
+    int            rx_filt_log_col_index;
+    int            rx_filt_log_col_sz;
+
+    COMP          *ch_symb_log;
+    int            ch_symb_log_r;
+    int            ch_symb_log_col_sz;
+
+    float         *rx_timing_log;
+    int            rx_timing_log_index;
+};
+
+void bits_to_qpsk_symbols(COMP tx_symb[][COHPSK_NC*COHPSK_ND], int tx_bits[], int nbits);
+void qpsk_symbols_to_bits(struct COHPSK *coh, float rx_bits[], COMP ct_symb_buf[][COHPSK_NC*COHPSK_ND]);
+void tx_filter_and_upconvert_coh(COMP tx_fdm[], int Nc, COMP tx_symbols[], 
+                                 COMP tx_filter_memory[COHPSK_NC][COHPSK_NSYM],
+                                 COMP phase_tx[], COMP freq[], 
+                                 COMP *fbb_phase, COMP fbb_rect);
+void fdm_downconvert_coh(COMP rx_baseband[COHPSK_NC][COHPSK_M+COHPSK_M/P], int Nc, COMP rx_fdm[], COMP phase_rx[], COMP freq[], int nin);
+void rx_filter_coh(COMP rx_filt[COHPSK_NC+1][P+1], int Nc, COMP rx_baseband[COHPSK_NC+1][COHPSK_M+COHPSK_M/P], COMP rx_filter_memory[COHPSK_NC+1][COHPSK_NFILTER], int nin);
+void frame_sync_fine_freq_est(struct COHPSK *coh, COMP ch_symb[][COHPSK_NC*COHPSK_ND], int sync, int *next_sync);
+void fine_freq_correct(struct COHPSK *coh, int sync, int next_sync);
+int sync_state_machine(struct COHPSK *coh, int sync, int next_sync);
+int cohpsk_fs_offset(COMP out[], COMP in[], int n, float sample_rate_ppm);
+
+#endif
diff --git a/codec2/tags/0.4/src/cohpsk_mod.c b/codec2/tags/0.4/src/cohpsk_mod.c
new file mode 100644 (file)
index 0000000..3678d27
--- /dev/null
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk_mod.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 5 2015
+                                                                             
+  Given an input file of bits (note one bit per float, soft decision format),
+  outputs a raw file (8kHz, 16 bit shorts) of COHPSK modem samples
+  ready to send over a HF radio channel.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_cohpsk.h"
+#include "codec2_fdmdv.h"
+
+int main(int argc, char *argv[])
+{
+    FILE          *fin, *fout;
+    struct COHPSK *cohpsk;
+    float         tx_bits_sd[COHPSK_BITS_PER_FRAME];
+    int           tx_bits[COHPSK_BITS_PER_FRAME];
+    COMP          tx_fdm[COHPSK_NOM_SAMPLES_PER_FRAME];
+    short         tx_fdm_scaled[COHPSK_NOM_SAMPLES_PER_FRAME];
+    int           frames;
+    int           i;
+
+    if (argc < 3) {
+       printf("usage: %s InputOneFloatPerBitFile OutputModemRawFile\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output modem sample file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    cohpsk = cohpsk_create();
+
+    frames = 0;
+
+    while(fread(tx_bits_sd, sizeof(float), COHPSK_BITS_PER_FRAME, fin) == COHPSK_BITS_PER_FRAME) {
+       frames++;
+
+        for(i=0; i<COHPSK_BITS_PER_FRAME; i++)
+            tx_bits[i] = tx_bits_sd[i] < 0.0;
+       cohpsk_mod(cohpsk, tx_fdm, tx_bits);
+        cohpsk_clip(tx_fdm);
+
+       /* scale and save to disk as shorts */
+
+       for(i=0; i<COHPSK_NOM_SAMPLES_PER_FRAME; i++)
+           tx_fdm_scaled[i] = FDMDV_SCALE * tx_fdm[i].real;
+
+       fwrite(tx_fdm_scaled, sizeof(short), COHPSK_NOM_SAMPLES_PER_FRAME, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    fclose(fin);
+    fclose(fout);
+    cohpsk_destroy(cohpsk);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/cohpsk_put_test_bits.c b/codec2/tags/0.4/src/cohpsk_put_test_bits.c
new file mode 100644 (file)
index 0000000..f11fa16
--- /dev/null
@@ -0,0 +1,109 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: cohpsk_put_test_bits.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 2015
+                                                                             
+  Sinks a stream of test bits generated by cohpsk_get_test_bits, useful for 
+  testing coh psk mod and demod.
+
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  Copyright (C) 2015 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_cohpsk.h"
+#include "octave.h"
+
+#define LOG_FRAMES 100
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin, *foct;
+    float         rx_bits_sd[COHPSK_BITS_PER_FRAME];
+    int           state, i, nbits, bit_errors, nerrors;
+    short         error_pattern[COHPSK_BITS_PER_FRAME];
+    int           error_positions_hist[COHPSK_BITS_PER_FRAME], logframes;
+    int           nerr_log[LOG_FRAMES];
+    struct COHPSK *coh;
+
+    for(i=0; i<COHPSK_BITS_PER_FRAME; i++)
+        error_positions_hist[i] = 0;
+
+    if (argc < 2) {
+       fprintf(stderr, "usage: %s InputOneFloatPerBitFile [OctaveLogFile]\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-") == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    coh = cohpsk_create();
+
+    foct = NULL;
+    logframes = 0;
+    if (argc == 3) {
+        if ( (foct = fopen(argv[2],"wt")) == NULL ) {
+            fprintf(stderr, "Error opening output Octave file: %s: %s.\n",
+                    argv[2], strerror(errno));            
+       exit(1);
+        }
+    }
+
+    for(i=0; i<COHPSK_BITS_PER_FRAME; i++)
+        error_positions_hist[i] = 0;
+
+    state = 0; nbits = 0; nerrors = 0;
+    while (fread(rx_bits_sd, sizeof(float), COHPSK_BITS_PER_FRAME, fin) ==  COHPSK_BITS_PER_FRAME) {
+
+        cohpsk_put_test_bits(coh, &state, error_pattern, &bit_errors, rx_bits_sd);
+        if (state == 1) {
+            for(i=0; i<COHPSK_BITS_PER_FRAME; i++)
+                error_positions_hist[i] += error_pattern[i];
+           if (logframes < LOG_FRAMES)
+                nerr_log[logframes++] = bit_errors;
+            nerrors += bit_errors;
+            nbits   += COHPSK_BITS_PER_FRAME;
+        }
+
+        if (fin == stdin) fflush(stdin);
+    }
+
+    if (foct != NULL) {
+        octave_save_int(foct, "nerr_log_c", nerr_log, 1, logframes);  
+        octave_save_int(foct, "error_positions_hist_c", error_positions_hist, 1, COHPSK_BITS_PER_FRAME);  
+        fclose(foct);
+    }
+
+    fclose(fin);
+    fprintf(stderr, "BER: %4.3f Nbits: %d Nerrors: %d\n", (float)nerrors/nbits, nbits, nerrors);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/comp.h b/codec2/tags/0.4/src/comp.h
new file mode 100644 (file)
index 0000000..cedcab3
--- /dev/null
@@ -0,0 +1,38 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: comp.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 24/08/09
+                                                                             
+  Complex number definition.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __COMP__
+#define __COMP__
+
+/* Complex number */
+
+typedef struct {
+  float real;
+  float imag;
+} COMP;
+
+#endif
diff --git a/codec2/tags/0.4/src/comp_prim.h b/codec2/tags/0.4/src/comp_prim.h
new file mode 100644 (file)
index 0000000..41fe817
--- /dev/null
@@ -0,0 +1,92 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: comp_prim.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: Marh 2015
+                                                                             
+  Complex number maths primitives.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __COMP_PRIM__
+#define __COMP_PRIM__
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+inline static COMP cneg(COMP a)
+{
+    COMP res;
+
+    res.real = -a.real;
+    res.imag = -a.imag;
+
+    return res;
+}
+
+inline static COMP cconj(COMP a)
+{
+    COMP res;
+
+    res.real = a.real;
+    res.imag = -a.imag;
+
+    return res;
+}
+
+inline static COMP cmult(COMP a, COMP b)
+{
+    COMP res;
+
+    res.real = a.real*b.real - a.imag*b.imag;
+    res.imag = a.real*b.imag + a.imag*b.real;
+
+    return res;
+}
+
+inline static COMP fcmult(float a, COMP b)
+{
+    COMP res;
+
+    res.real = a*b.real;
+    res.imag = a*b.imag;
+
+    return res;
+}
+
+inline static COMP cadd(COMP a, COMP b)
+{
+    COMP res;
+
+    res.real = a.real + b.real;
+    res.imag = a.imag + b.imag;
+
+    return res;
+}
+
+inline static float cabsolute(COMP a)
+{
+    return sqrtf(powf(a.real, 2.0) + powf(a.imag, 2.0));
+}
+
+#endif
diff --git a/codec2/tags/0.4/src/defines.h b/codec2/tags/0.4/src/defines.h
new file mode 100644 (file)
index 0000000..eac1ab7
--- /dev/null
@@ -0,0 +1,95 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: defines.h                                                     
+  AUTHOR......: David Rowe 
+  DATE CREATED: 23/4/93                                                       
+                                                                             
+  Defines and structures used throughout the codec.                         
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __DEFINES__
+#define __DEFINES__
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               DEFINES                                       
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/* General defines */
+
+#define N          80          /* number of samples per frame          */
+#define MAX_AMP    80          /* maximum number of harmonics          */
+#define PI         3.141592654 /* mathematical constant                */
+#define TWO_PI     6.283185307 /* mathematical constant                */
+#define FS         8000                /* sample rate in Hz                    */
+#define MAX_STR    256          /* maximum string size                  */
+
+#define NW         279          /* analysis window size                 */
+#define FFT_ENC    512         /* size of FFT used for encoder         */
+#define FFT_DEC    512         /* size of FFT used in decoder          */
+#define TW         40          /* Trapezoidal synthesis window overlap */
+#define V_THRESH   6.0          /* voicing threshold in dB              */
+#define LPC_ORD    10          /* LPC order                            */
+#define LPC_ORD_LOW 6          /* LPC order for lower rates            */
+
+/* Pitch estimation defines */
+
+#define M        320           /* pitch analysis frame size            */
+#define P_MIN    20            /* minimum pitch                        */
+#define P_MAX    160           /* maximum pitch                        */
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               TYPEDEFS                                      
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/* Structure to hold model parameters for one frame */
+
+typedef struct {
+  float Wo;            /* fundamental frequency estimate in radians  */
+  int   L;             /* number of harmonics                        */
+  float A[MAX_AMP+1];  /* amplitiude of each harmonic                */
+  float phi[MAX_AMP+1];        /* phase of each harmonic                     */
+  int   voiced;                /* non-zero if this frame is voiced           */
+} MODEL;
+
+/* describes each codebook  */
+
+struct lsp_codebook {
+    int                        k;        /* dimension of vector        */
+    int                        log2m;    /* number of bits in m        */
+    int                        m;        /* elements in codebook       */
+    const float        *       cb;       /* The elements               */
+};
+
+extern const struct lsp_codebook lsp_cb[];
+extern const struct lsp_codebook lsp_cbd[];
+extern const struct lsp_codebook lsp_cbvq[];
+extern const struct lsp_codebook lsp_cbjnd[];
+extern const struct lsp_codebook lsp_cbdt[];
+extern const struct lsp_codebook lsp_cbjvm[];
+extern const struct lsp_codebook lsp_cbvqanssi[];
+extern const struct lsp_codebook mel_cb[];
+extern const struct lsp_codebook ge_cb[];
+
+#endif
diff --git a/codec2/tags/0.4/src/dump.c b/codec2/tags/0.4/src/dump.c
new file mode 100644 (file)
index 0000000..f172424
--- /dev/null
@@ -0,0 +1,670 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: dump.c
+  AUTHOR......: David Rowe          
+  DATE CREATED: 25/8/09                                                       
+                                                                             
+  Routines to dump data to text files for Octave analysis.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 "comp.h"
+#include "dump.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#ifdef __EMBEDDED__
+#include "gdb_stdio.h"
+#define fprintf gdb_stdio_fprintf
+#define fopen gdb_stdio_fopen
+#define fclose gdb_stdio_fclose
+#endif
+
+#ifdef DUMP
+static int dumpon = 0;
+
+static FILE *fsn = NULL;
+static FILE *fsw = NULL;
+static FILE *few = NULL;
+static FILE *fsw_ = NULL;
+static FILE *fsoftdec = NULL;
+static FILE *fmodel = NULL;
+static FILE *fqmodel = NULL;
+static FILE *fpwb = NULL;
+static FILE *fpw = NULL;
+static FILE *frw = NULL;
+static FILE *flsp = NULL;
+static FILE *fweights = NULL;
+static FILE *flsp_ = NULL;
+static FILE *fmel = NULL;
+static FILE *fmel_indexes = NULL;
+static FILE *fphase = NULL;
+static FILE *fphase_ = NULL;
+static FILE *ffw = NULL;
+static FILE *fe = NULL;
+static FILE *fsq = NULL;
+static FILE *fdec = NULL;
+static FILE *fsnr = NULL;
+static FILE *flpcsnr = NULL;
+static FILE *fak = NULL;
+static FILE *fak_ = NULL;
+static FILE *fbg = NULL;
+static FILE *fE = NULL;
+static FILE *frk = NULL;
+static FILE *fhephase = NULL;
+
+static char  prefix[MAX_STR];
+
+void dump_on(char p[]) {
+    dumpon = 1;
+    strcpy(prefix, p);
+}
+
+void dump_off(){
+    if (fsn != NULL)
+       fclose(fsn);
+    if (fsw != NULL)
+       fclose(fsw);
+    if (fsw_ != NULL)
+       fclose(fsw_);
+    if (few != NULL)
+       fclose(few);
+    if (fmodel != NULL)
+       fclose(fmodel);
+    if (fsoftdec != NULL)
+       fclose(fsoftdec);
+    if (fqmodel != NULL)
+       fclose(fqmodel);
+    if (fpwb != NULL)
+       fclose(fpwb);
+    if (fpw != NULL)
+       fclose(fpw);
+    if (frw != NULL)
+       fclose(frw);
+    if (flsp != NULL)
+       fclose(flsp);
+    if (fweights != NULL)
+       fclose(fweights);
+    if (flsp_ != NULL)
+       fclose(flsp_);
+    if (fmel != NULL)
+       fclose(fmel);
+    if (fmel_indexes != NULL)
+       fclose(fmel_indexes);
+    if (fphase != NULL)
+       fclose(fphase);
+    if (fphase_ != NULL)
+       fclose(fphase_);
+    if (ffw != NULL)
+       fclose(ffw);
+    if (fe != NULL)
+       fclose(fe);
+    if (fsq != NULL)
+       fclose(fsq);
+    if (fdec != NULL)
+       fclose(fdec);
+    if (fsnr != NULL)
+       fclose(fsnr);
+    if (flpcsnr != NULL)
+       fclose(flpcsnr);
+    if (fak != NULL)
+       fclose(fak);
+    if (fak_ != NULL)
+       fclose(fak_);
+    if (fbg != NULL)
+       fclose(fbg);
+    if (fE != NULL)
+       fclose(fE);
+    if (frk != NULL)
+       fclose(frk);
+    if (fhephase != NULL)
+       fclose(fhephase);
+}
+
+void dump_Sn(float Sn[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fsn == NULL) {
+       sprintf(s,"%s_sn.txt", prefix);
+       fsn = fopen(s, "wt");
+       assert(fsn != NULL);
+    }
+
+    /* split across two lines to avoid max line length problems */
+    /* reconstruct in Octave */
+
+    for(i=0; i<M/2; i++)
+       fprintf(fsn,"%f\t",Sn[i]);
+    fprintf(fsn,"\n");    
+    for(i=M/2; i<M; i++)
+       fprintf(fsn,"%f\t",Sn[i]);
+    fprintf(fsn,"\n");    
+}
+
+void dump_Sw(COMP Sw[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fsw == NULL) {
+       sprintf(s,"%s_sw.txt", prefix);
+       fsw = fopen(s, "wt");
+       assert(fsw != NULL);
+    }
+
+    for(i=0; i<FFT_ENC/2; i++)
+       fprintf(fsw,"%f\t",
+               10.0*log10(Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag));
+    fprintf(fsw,"\n");    
+}
+
+void dump_Sw_(COMP Sw_[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fsw_ == NULL) {
+       sprintf(s,"%s_sw_.txt", prefix);
+       fsw_ = fopen(s, "wt");
+       assert(fsw_ != NULL);
+    }
+
+    for(i=0; i<FFT_ENC/2; i++)
+       fprintf(fsw_,"%f\t",
+               10.0*log10(Sw_[i].real*Sw_[i].real + Sw_[i].imag*Sw_[i].imag));
+    fprintf(fsw_,"\n");    
+}
+
+void dump_Ew(COMP Ew[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (few == NULL) {
+       sprintf(s,"%s_ew.txt", prefix);
+       few = fopen(s, "wt");
+       assert(few != NULL);
+    }
+
+    for(i=0; i<FFT_ENC/2; i++)
+       fprintf(few,"%f\t",
+               10.0*log10(Ew[i].real*Ew[i].real + Ew[i].imag*Ew[i].imag));
+    fprintf(few,"\n");    
+}
+
+void dump_softdec(float *softdec, int n)
+{
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fsoftdec == NULL) {
+       sprintf(s,"%s_softdec.txt", prefix);
+       fsoftdec = fopen(s, "wt");
+       assert(fsoftdec != NULL);
+    }
+
+    for(i=0; i<n; i++)
+       fprintf(fsoftdec,"%f\t", softdec[i]);
+    fprintf(fsoftdec,"\n");
+}
+
+void dump_model(MODEL *model) {
+    int l;
+    char s[MAX_STR];
+    char line[2048];
+
+    if (!dumpon) return;
+
+    if (fmodel == NULL) {
+       sprintf(s,"%s_model.txt", prefix);
+       fmodel = fopen(s, "wt");
+       assert(fmodel != NULL);
+    }
+
+    sprintf(line,"%12f %12d ", model->Wo, model->L);    
+    for(l=1; l<=model->L; l++) {
+       sprintf(s,"%12f ",model->A[l]);
+        strcat(line, s);
+    }
+    for(l=model->L+1; l<=MAX_AMP; l++) {
+       sprintf(s,"%12f ", 0.0);
+        strcat(line,s);
+    }
+        
+    sprintf(s,"%d\n",model->voiced);
+    strcat(line,s);
+    fprintf(fmodel,"%s",line);    
+}
+
+void dump_quantised_model(MODEL *model) {
+    int l;
+    char s[MAX_STR];
+    char line[2048];
+
+    if (!dumpon) return;
+
+    if (fqmodel == NULL) {
+       sprintf(s,"%s_qmodel.txt", prefix);
+       fqmodel = fopen(s, "wt");
+       assert(fqmodel != NULL);
+    }
+
+    sprintf(line,"%12f %12d ", model->Wo, model->L);    
+    for(l=1; l<=model->L; l++) {
+       sprintf(s,"%12f ",model->A[l]);
+        strcat(line, s);
+    }
+    for(l=model->L+1; l<=MAX_AMP; l++) {
+       sprintf(s,"%12f ", 0.0);
+        strcat(line, s);
+    }
+        
+    sprintf(s,"%d\n",model->voiced);
+    strcat(line, s);
+    fprintf(fqmodel, "%s", line);    
+}
+
+void dump_phase(float phase[], int L) {
+    int l;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fphase == NULL) {
+       sprintf(s,"%s_phase.txt", prefix);
+       fphase = fopen(s, "wt");
+       assert(fphase != NULL);
+    }
+
+    for(l=1; l<=L; l++)
+       fprintf(fphase,"%f\t",phase[l]);
+    for(l=L+1; l<=MAX_AMP; l++)
+       fprintf(fphase,"%f\t",0.0);
+    fprintf(fphase,"\n");    
+}
+
+void dump_phase_(float phase_[], int L) {
+    int l;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fphase_ == NULL) {
+       sprintf(s,"%s_phase_.txt", prefix);
+       fphase_ = fopen(s, "wt");
+       assert(fphase_ != NULL);
+    }
+
+    for(l=1; l<=L; l++)
+       fprintf(fphase_,"%f\t",phase_[l]);
+    for(l=L+1; l<MAX_AMP; l++)
+       fprintf(fphase_,"%f\t",0.0);
+    fprintf(fphase_,"\n");    
+}
+
+
+void dump_hephase(int ind[], int dim) {
+    int m;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fhephase == NULL) {
+       sprintf(s,"%s_hephase.txt", prefix);
+       fhephase = fopen(s, "wt");
+       assert(fhephase != NULL);
+    }
+
+    for(m=0; m<dim; m++)
+       fprintf(fhephase,"%d\t",ind[m]);
+    fprintf(fhephase,"\n");    
+}
+
+
+void dump_snr(float snr) {
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fsnr == NULL) {
+       sprintf(s,"%s_snr.txt", prefix);
+       fsnr = fopen(s, "wt");
+       assert(fsnr != NULL);
+    }
+
+    fprintf(fsnr,"%f\n",snr);
+}
+
+void dump_lpc_snr(float snr) {
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (flpcsnr == NULL) {
+       sprintf(s,"%s_lpc_snr.txt", prefix);
+       flpcsnr = fopen(s, "wt");
+       assert(flpcsnr != NULL);
+    }
+    
+    fprintf(flpcsnr,"%f\n",snr);
+}
+
+/* Pw "before" post filter so we can plot before and after */
+
+void dump_Pwb(COMP Pwb[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fpwb == NULL) {
+       sprintf(s,"%s_pwb.txt", prefix);
+       fpwb = fopen(s, "wt");
+       assert(fpwb != NULL);
+    }
+
+    for(i=0; i<FFT_ENC/2; i++)
+       fprintf(fpwb,"%f\t",Pwb[i].real);
+    fprintf(fpwb,"\n");    
+}
+
+void dump_Pw(COMP Pw[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fpw == NULL) {
+       sprintf(s,"%s_pw.txt", prefix);
+       fpw = fopen(s, "wt");
+       assert(fpw != NULL);
+    }
+
+    for(i=0; i<FFT_ENC/2; i++)
+       fprintf(fpw,"%f\t",Pw[i].real);
+    fprintf(fpw,"\n");    
+}
+
+void dump_Rw(float Rw[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (frw == NULL) {
+       sprintf(s,"%s_rw.txt", prefix);
+       frw = fopen(s, "wt");
+       assert(frw != NULL);
+    }
+
+    for(i=0; i<FFT_ENC/2; i++)
+       fprintf(frw,"%f\t",Rw[i]);
+    fprintf(frw,"\n");    
+}
+
+void dump_weights(float w[], int order) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fweights == NULL) {
+       sprintf(s,"%s_weights.txt", prefix);
+       fweights = fopen(s, "wt");
+       assert(fweights != NULL);
+    }
+
+    for(i=0; i<order; i++)
+       fprintf(fweights,"%f\t", w[i]);
+    fprintf(fweights,"\n");    
+}
+
+void dump_lsp(float lsp[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (flsp == NULL) {
+       sprintf(s,"%s_lsp.txt", prefix);
+       flsp = fopen(s, "wt");
+       assert(flsp != NULL);
+    }
+
+    for(i=0; i<10; i++)
+       fprintf(flsp,"%f\t",lsp[i]);
+    fprintf(flsp,"\n");    
+}
+
+void dump_lsp_(float lsp_[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (flsp_ == NULL) {
+       sprintf(s,"%s_lsp_.txt", prefix);
+       flsp_ = fopen(s, "wt");
+       assert(flsp_ != NULL);
+    }
+
+    for(i=0; i<10; i++)
+       fprintf(flsp_,"%f\t",lsp_[i]);
+    fprintf(flsp_,"\n");    
+}
+
+void dump_mel(float mel[], int order) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fmel == NULL) {
+       sprintf(s,"%s_mel.txt", prefix);
+       fmel = fopen(s, "wt");
+       assert(fmel != NULL);
+    }
+
+    for(i=0; i<order; i++)
+       fprintf(fmel,"%f\t",mel[i]);
+    fprintf(fmel,"\n");    
+}
+
+void dump_mel_indexes(int mel_indexes[], int order) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fmel_indexes == NULL) {
+       sprintf(s,"%s_mel_indexes.txt", prefix);
+       fmel_indexes = fopen(s, "wt");
+       assert(fmel_indexes != NULL);
+    }
+
+    for(i=0; i<order; i++)
+       fprintf(fmel_indexes,"%d\t",mel_indexes[i]);
+    fprintf(fmel_indexes,"\n");    
+}
+
+void dump_ak(float ak[], int order) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fak == NULL) {
+       sprintf(s,"%s_ak.txt", prefix);
+       fak = fopen(s, "wt");
+       assert(fak != NULL);
+    }
+
+    for(i=0; i<=order; i++)
+       fprintf(fak,"%f\t",ak[i]);
+    fprintf(fak,"\n");    
+}
+
+void dump_ak_(float ak_[], int order) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fak_ == NULL) {
+       sprintf(s,"%s_ak_.txt", prefix);
+       fak_ = fopen(s, "wt");
+       assert(fak_ != NULL);
+    }
+
+    for(i=0; i<=order; i++)
+       fprintf(fak_,"%f\t",ak_[i]);
+    fprintf(fak_,"\n");    
+}
+
+void dump_Fw(COMP Fw[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (ffw == NULL) {
+       sprintf(s,"%s_fw.txt", prefix);
+       ffw = fopen(s, "wt");
+       assert(ffw != NULL);
+    }
+
+    for(i=0; i<256; i++)
+       fprintf(ffw,"%f\t",Fw[i].real);
+    fprintf(ffw,"\n");    
+}
+
+void dump_e(float e_hz[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fe == NULL) {
+       sprintf(s,"%s_e.txt", prefix);
+       fe = fopen(s, "wt");
+       assert(fe != NULL);
+    }
+
+    for(i=0; i<500/2; i++)
+       fprintf(fe,"%f\t",e_hz[i]);
+    fprintf(fe,"\n");    
+    for(i=500/2; i<500; i++)
+       fprintf(fe,"%f\t",e_hz[i]);
+    fprintf(fe,"\n");    
+}
+
+void dump_sq(float sq[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fsq == NULL) {
+       sprintf(s,"%s_sq.txt", prefix);
+       fsq = fopen(s, "wt");
+       assert(fsq != NULL);
+    }
+
+    for(i=0; i<M/2; i++)
+       fprintf(fsq,"%f\t",sq[i]);
+    fprintf(fsq,"\n");    
+    for(i=M/2; i<M; i++)
+       fprintf(fsq,"%f\t",sq[i]);
+    fprintf(fsq,"\n");    
+}
+
+void dump_dec(COMP Fw[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fdec == NULL) {
+       sprintf(s,"%s_dec.txt", prefix);
+       fdec = fopen(s, "wt");
+       assert(fdec != NULL);
+    }
+
+    for(i=0; i<320/5; i++)
+       fprintf(fdec,"%f\t",Fw[i].real);
+    fprintf(fdec,"\n");    
+}
+
+void dump_bg(float e, float bg_est, float percent_uv) {
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fbg == NULL) {
+       sprintf(s,"%s_bg.txt", prefix);
+       fbg = fopen(s, "wt");
+       assert(fbg != NULL);
+    }
+
+    fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv);    
+}
+
+void dump_E(float E) {
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (fE == NULL) {
+       sprintf(s,"%s_E.txt", prefix);
+       fE = fopen(s, "wt");
+       assert(fE != NULL);
+    }
+
+    fprintf(fE,"%f\n", 10.0*log10(E));
+}
+
+void dump_Rk(float Rk[]) {
+    int i;
+    char s[MAX_STR];
+
+    if (!dumpon) return;
+
+    if (frk == NULL) {
+       sprintf(s,"%s_rk.txt", prefix);
+       frk = fopen(s, "wt");
+       assert(frk != NULL);
+    }
+
+    for(i=0; i<P_MAX; i++)
+       fprintf(frk,"%f\t",Rk[i]);
+    fprintf(frk,"\n");    
+}
+
+#endif
diff --git a/codec2/tags/0.4/src/dump.h b/codec2/tags/0.4/src/dump.h
new file mode 100644 (file)
index 0000000..3cf5868
--- /dev/null
@@ -0,0 +1,80 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: dump.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 25/8/09                                                       
+                                                                             
+  Routines to dump data to text files for Octave analysis.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __DUMP__
+#define __DUMP__
+
+#include "defines.h"
+#include "comp.h"
+#include "kiss_fft.h"
+#include "codec2_internal.h"
+
+void dump_on(char filename_prefix[]);
+void dump_off();
+
+void dump_Sn(float Sn[]);
+void dump_Sw(COMP Sw[]);
+void dump_Sw_(COMP Sw_[]);
+void dump_Ew(COMP Ew[]);
+void dump_softdec(float *softdec, int n);
+
+/* amplitude modelling */
+
+void dump_model(MODEL *m);
+void dump_quantised_model(MODEL *m);
+void dump_Pwn(COMP Pw[]);
+void dump_Pw(COMP Pw[]);
+void dump_Rw(float Rw[]);
+void dump_lsp(float lsp[]);
+void dump_weights(float w[], int ndim);
+void dump_lsp_(float lsp_[]);
+void dump_mel(float mel[], int order);
+void dump_mel_indexes(int mel_indexes[], int order);
+void dump_ak(float ak[], int order);
+void dump_ak_(float ak[], int order);
+void dump_E(float E);
+void dump_lpc_snr(float snr);
+
+/* phase modelling */
+
+void dump_snr(float snr);
+void dump_phase(float phase[], int L);
+void dump_phase_(float phase[], int L);
+void dump_hephase(int ind[], int dim);
+
+/* NLP states */
+
+void dump_sq(float sq[]);
+void dump_dec(COMP Fw[]);
+void dump_Fw(COMP Fw[]);
+void dump_e(float e_hz[]);
+void dump_Rk(float Rk[]);
+
+/* post filter */
+
+void dump_bg(float e, float bg_est, float percent_uv);
+void dump_Pwb(COMP Pwb[]);
+
+#endif
diff --git a/codec2/tags/0.4/src/fdmdv.c b/codec2/tags/0.4/src/fdmdv.c
new file mode 100644 (file)
index 0000000..bab288d
--- /dev/null
@@ -0,0 +1,1863 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv.c
+  AUTHOR......: David Rowe
+  DATE CREATED: April 14 2012
+                                                                             
+  Functions that implement the FDMDV modem.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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/>.
+*/
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               INCLUDES
+
+\*---------------------------------------------------------------------------*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "fdmdv_internal.h"
+#include "codec2_fdmdv.h"
+#include "comp_prim.h"
+#include "rn.h"
+#include "rxdec_coeff.h"
+#include "test_bits.h"
+#include "pilot_coeff.h"
+#include "kiss_fft.h"
+#include "hanning.h"
+#include "os.h"
+#include "machdep.h"
+
+static int sync_uw[] = {1,-1,1,-1,1,-1};
+
+#ifdef __EMBEDDED__
+#define printf gdb_stdio_printf
+#endif
+
+/*--------------------------------------------------------------------------* \
+                                                       
+  FUNCTION....: fdmdv_create        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012 
+
+  Create and initialise an instance of the modem.  Returns a pointer
+  to the modem states or NULL on failure.  One set of states is
+  sufficient for a full duplex modem.
+
+\*---------------------------------------------------------------------------*/
+
+struct FDMDV * fdmdv_create(int Nc)
+{
+    struct FDMDV *f;
+    int           c, i, k;
+
+    assert(NC == FDMDV_NC_MAX);  /* check public and private #defines match */
+    assert(Nc <= NC);
+    assert(FDMDV_NOM_SAMPLES_PER_FRAME == M);
+    assert(FDMDV_MAX_SAMPLES_PER_FRAME == (M+M/P));
+
+    f = (struct FDMDV*)malloc(sizeof(struct FDMDV));
+    if (f == NULL)
+       return NULL;
+    
+    f->Nc = Nc;
+
+    f->ntest_bits = Nc*NB*4;
+    f->current_test_bit = 0;
+    f->rx_test_bits_mem = (int*)malloc(sizeof(int)*f->ntest_bits);
+    assert(f->rx_test_bits_mem != NULL);
+    for(i=0; i<f->ntest_bits; i++)
+       f->rx_test_bits_mem[i] = 0;
+    assert((sizeof(test_bits)/sizeof(int)) >= f->ntest_bits);
+
+    f->old_qpsk_mapping = 0;
+
+    f->tx_pilot_bit = 0;
+
+    for(c=0; c<Nc+1; c++) {
+       f->prev_tx_symbols[c].real = 1.0;
+       f->prev_tx_symbols[c].imag = 0.0;
+       f->prev_rx_symbols[c].real = 1.0;
+       f->prev_rx_symbols[c].imag = 0.0;
+
+       for(k=0; k<NSYM; k++) {
+           f->tx_filter_memory[c][k].real = 0.0;
+           f->tx_filter_memory[c][k].imag = 0.0;
+       }
+
+       /* Spread initial FDM carrier phase out as far as possible.
+           This helped PAPR for a few dB.  We don't need to adjust rx
+           phase as DQPSK takes care of that. */
+       
+       f->phase_tx[c].real = cosf(2.0*PI*c/(Nc+1));
+       f->phase_tx[c].imag = sinf(2.0*PI*c/(Nc+1));
+
+       f->phase_rx[c].real = 1.0;
+       f->phase_rx[c].imag = 0.0;
+
+       for(k=0; k<NT*P; k++) {
+           f->rx_filter_mem_timing[c][k].real = 0.0;
+           f->rx_filter_mem_timing[c][k].imag = 0.0;
+       }
+    }
+    f->prev_tx_symbols[Nc].real = 2.0;
+
+    fdmdv_set_fsep(f, FSEP);
+    f->freq[Nc].real = cosf(2.0*PI*0.0/FS);
+    f->freq[Nc].imag = sinf(2.0*PI*0.0/FS);
+    f->freq_pol[Nc]  = 2.0*PI*0.0/FS;
+    
+    f->fbb_rect.real     = cosf(2.0*PI*FDMDV_FCENTRE/FS);
+    f->fbb_rect.imag     = sinf(2.0*PI*FDMDV_FCENTRE/FS);
+    f->fbb_pol           = 2.0*PI*FDMDV_FCENTRE/FS;
+    f->fbb_phase_tx.real = 1.0;
+    f->fbb_phase_tx.imag = 0.0;
+    f->fbb_phase_rx.real = 1.0;
+    f->fbb_phase_rx.imag = 0.0;
+
+    /* Generate DBPSK pilot Look Up Table (LUT) */
+
+    generate_pilot_lut(f->pilot_lut, &f->freq[Nc]);
+
+    /* freq Offset estimation states */
+
+    f->fft_pilot_cfg = kiss_fft_alloc (MPILOTFFT, 0, NULL, NULL);
+    assert(f->fft_pilot_cfg != NULL);
+
+    for(i=0; i<NPILOTBASEBAND; i++) {
+       f->pilot_baseband1[i].real = f->pilot_baseband2[i].real = 0.0;
+       f->pilot_baseband1[i].imag = f->pilot_baseband2[i].imag = 0.0;
+    }
+    f->pilot_lut_index = 0;
+    f->prev_pilot_lut_index = 3*M;
+    
+    for(i=0; i<NRXDEC-1+M; i++) {
+        f->rxdec_lpf_mem[i].real = 0.0;
+        f->rxdec_lpf_mem[i].imag = 0.0;
+    }
+
+    for(i=0; i<NPILOTLPF; i++) {
+       f->pilot_lpf1[i].real = f->pilot_lpf2[i].real = 0.0;
+       f->pilot_lpf1[i].imag = f->pilot_lpf2[i].imag = 0.0;
+    }
+
+    f->foff = 0.0;
+    f->foff_phase_rect.real = 1.0;
+    f->foff_phase_rect.imag = 0.0;
+
+    for(i=0; i<NFILTER+M; i++) {
+        f->rx_fdm_mem[i].real = 0.0; 
+        f->rx_fdm_mem[i].imag = 0.0; 
+    }
+
+    f->fest_state = 0;
+    f->sync = 0;
+    f->timer = 0;
+    for(i=0; i<NSYNC_MEM; i++)
+        f->sync_mem[i] = 0;
+
+    for(c=0; c<Nc+1; c++) {
+       f->sig_est[c] = 0.0;
+       f->noise_est[c] = 0.0;
+    }
+
+    f->sig_pwr_av = 0.0;
+
+    return f;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_destroy       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012
+
+  Destroy an instance of the modem.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_destroy(struct FDMDV *fdmdv)
+{
+    assert(fdmdv != NULL);
+    KISS_FFT_FREE(fdmdv->fft_pilot_cfg);
+    free(fdmdv->rx_test_bits_mem);
+    free(fdmdv);
+}
+
+
+void fdmdv_use_old_qpsk_mapping(struct FDMDV *fdmdv) {
+    fdmdv->old_qpsk_mapping = 1;  
+}
+
+
+int fdmdv_bits_per_frame(struct FDMDV *fdmdv)
+{
+    return (fdmdv->Nc * NB);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_get_test_bits()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012
+
+  Generate a frame of bits from a repeating sequence of random data.  OK so
+  it's not very random if it repeats but it makes syncing at the demod easier
+  for test purposes.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_get_test_bits(struct FDMDV *f, int tx_bits[])
+{
+    int i;
+    int bits_per_frame = fdmdv_bits_per_frame(f);
+
+    for(i=0; i<bits_per_frame; i++) {
+       tx_bits[i] = test_bits[f->current_test_bit];
+       f->current_test_bit++;
+       if (f->current_test_bit > (f->ntest_bits-1))
+           f->current_test_bit = 0;
+    }
+}
+
+float fdmdv_get_fsep(struct FDMDV *f)
+{
+    return f->fsep;
+}
+
+void fdmdv_set_fsep(struct FDMDV *f, float fsep) {
+    int   c;
+    float carrier_freq;
+
+    f->fsep = fsep;
+
+    /* Set up frequency of each carrier */
+
+    for(c=0; c<f->Nc/2; c++) {
+       carrier_freq = (-f->Nc/2 + c)*f->fsep;
+       f->freq[c].real = cosf(2.0*PI*carrier_freq/FS);
+       f->freq[c].imag = sinf(2.0*PI*carrier_freq/FS);
+       f->freq_pol[c]  = 2.0*PI*carrier_freq/FS;
+    }
+
+    for(c=f->Nc/2; c<f->Nc; c++) {
+       carrier_freq = (-f->Nc/2 + c + 1)*f->fsep;
+       f->freq[c].real = cosf(2.0*PI*carrier_freq/FS);
+       f->freq[c].imag = sinf(2.0*PI*carrier_freq/FS);
+       f->freq_pol[c]  = 2.0*PI*carrier_freq/FS;
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: bits_to_dqpsk_symbols()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012
+
+  Maps bits to parallel DQPSK symbols. Generate Nc+1 QPSK symbols from
+  vector of (1,Nc*Nb) input tx_bits.  The Nc+1 symbol is the +1 -1 +1
+  .... BPSK sync carrier.
+
+\*---------------------------------------------------------------------------*/
+
+void bits_to_dqpsk_symbols(COMP tx_symbols[], int Nc, COMP prev_tx_symbols[], int tx_bits[], int *pilot_bit, int old_qpsk_mapping)
+{
+    int c, msb, lsb;
+    COMP j = {0.0,1.0};
+
+    /* Map tx_bits to to Nc DQPSK symbols.  Note legacy support for
+       old (suboptimal) V0.91 FreeDV mapping */
+
+    for(c=0; c<Nc; c++) {
+       msb = tx_bits[2*c]; 
+       lsb = tx_bits[2*c+1];
+       if ((msb == 0) && (lsb == 0))
+           tx_symbols[c] = prev_tx_symbols[c];
+       if ((msb == 0) && (lsb == 1))
+            tx_symbols[c] = cmult(j, prev_tx_symbols[c]);
+       if ((msb == 1) && (lsb == 0)) {
+           if (old_qpsk_mapping)
+                tx_symbols[c] = cneg(prev_tx_symbols[c]);           
+            else
+                tx_symbols[c] = cmult(cneg(j),prev_tx_symbols[c]);
+        }
+       if ((msb == 1) && (lsb == 1)) {
+           if (old_qpsk_mapping)
+                tx_symbols[c] = cmult(cneg(j),prev_tx_symbols[c]);  
+            else
+                tx_symbols[c] = cneg(prev_tx_symbols[c]);
+        }
+    }
+
+    /* +1 -1 +1 -1 BPSK sync carrier, once filtered becomes (roughly)
+       two spectral lines at +/- Rs/2 */
+    if (*pilot_bit)
+       tx_symbols[Nc] = cneg(prev_tx_symbols[Nc]);
+    else
+       tx_symbols[Nc] = prev_tx_symbols[Nc];
+
+    if (*pilot_bit) 
+       *pilot_bit = 0;
+    else
+       *pilot_bit = 1;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: tx_filter()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 17/4/2012
+
+  Given Nc*NB bits construct M samples (1 symbol) of Nc+1 filtered
+  symbols streams.
+
+\*---------------------------------------------------------------------------*/
+
+void tx_filter(COMP tx_baseband[NC+1][M], int Nc, COMP tx_symbols[], COMP tx_filter_memory[NC+1][NSYM])
+{
+    int     c;
+    int     i,j,k;
+    float   acc;
+    COMP    gain;
+
+    gain.real = sqrtf(2.0)/2.0;
+    gain.imag = 0.0;
+    
+    for(c=0; c<Nc+1; c++)
+       tx_filter_memory[c][NSYM-1] = cmult(tx_symbols[c], gain);
+    
+    /* 
+       tx filter each symbol, generate M filtered output samples for each symbol.
+       Efficient polyphase filter techniques used as tx_filter_memory is sparse
+    */
+
+    for(i=0; i<M; i++) {
+       for(c=0; c<Nc+1; c++) {
+
+           /* filter real sample of symbol for carrier c */
+
+           acc = 0.0;
+           for(j=0,k=M-i-1; j<NSYM; j++,k+=M)
+               acc += M * tx_filter_memory[c][j].real * gt_alpha5_root[k];
+           tx_baseband[c][i].real = acc;       
+
+           /* filter imag sample of symbol for carrier c */
+
+           acc = 0.0;
+           for(j=0,k=M-i-1; j<NSYM; j++,k+=M)
+               acc += M * tx_filter_memory[c][j].imag * gt_alpha5_root[k];
+           tx_baseband[c][i].imag = acc;
+
+       }
+    }
+
+    /* shift memory, inserting zeros at end */
+
+    for(i=0; i<NSYM-1; i++)
+       for(c=0; c<Nc+1; c++)
+           tx_filter_memory[c][i] = tx_filter_memory[c][i+1];
+
+    for(c=0; c<Nc+1; c++) {
+       tx_filter_memory[c][NSYM-1].real = 0.0;
+       tx_filter_memory[c][NSYM-1].imag = 0.0;
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: tx_filter_and_upconvert()           
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 13 August 2014
+
+  Given Nc symbols construct M samples (1 symbol) of Nc+1 filtered
+  and upconverted symbols.
+
+\*---------------------------------------------------------------------------*/
+
+void tx_filter_and_upconvert(COMP tx_fdm[], int Nc, COMP tx_symbols[], 
+                             COMP tx_filter_memory[NC+1][NSYM],
+                             COMP phase_tx[], COMP freq[], 
+                             COMP *fbb_phase, COMP fbb_rect)
+{
+    int     c;
+    int     i,j,k;
+    float   acc;
+    COMP    gain;
+    COMP    tx_baseband;
+    COMP  two = {2.0, 0.0};
+    float mag;
+
+    gain.real = sqrtf(2.0)/2.0;
+    gain.imag = 0.0;
+    
+    for(i=0; i<M; i++) {
+       tx_fdm[i].real = 0.0;
+       tx_fdm[i].imag = 0.0;
+    }
+
+    for(c=0; c<Nc+1; c++)
+       tx_filter_memory[c][NSYM-1] = cmult(tx_symbols[c], gain);
+
+    /* 
+       tx filter each symbol, generate M filtered output samples for
+       each symbol, which we then freq shift and sum with other
+       carriers.  Efficient polyphase filter techniques used as
+       tx_filter_memory is sparse
+    */
+
+    for(c=0; c<Nc+1; c++) {
+        for(i=0; i<M; i++) {
+
+           /* filter real sample of symbol for carrier c */
+
+           acc = 0.0;
+           for(j=0,k=M-i-1; j<NSYM; j++,k+=M)
+               acc += M * tx_filter_memory[c][j].real * gt_alpha5_root[k];
+           tx_baseband.real = acc;     
+
+           /* filter imag sample of symbol for carrier c */
+
+           acc = 0.0;
+           for(j=0,k=M-i-1; j<NSYM; j++,k+=M)
+               acc += M * tx_filter_memory[c][j].imag * gt_alpha5_root[k];
+           tx_baseband.imag = acc;
+
+            /* freq shift and sum */
+
+           phase_tx[c] = cmult(phase_tx[c], freq[c]);
+           tx_fdm[i] = cadd(tx_fdm[i], cmult(tx_baseband, phase_tx[c]));
+       }
+    }
+
+    /* shift whole thing up to carrier freq */
+
+    for (i=0; i<M; i++) {
+       *fbb_phase = cmult(*fbb_phase, fbb_rect);
+       tx_fdm[i] = cmult(tx_fdm[i], *fbb_phase);
+    }
+
+    /*
+      Scale such that total Carrier power C of real(tx_fdm) = Nc.  This
+      excludes the power of the pilot tone.
+      We return the complex (single sided) signal to make frequency
+      shifting for the purpose of testing easier
+    */
+
+    for (i=0; i<M; i++) 
+       tx_fdm[i] = cmult(two, tx_fdm[i]);
+
+    /* normalise digital oscillators as the magnitude can drift over time */
+
+    for (c=0; c<Nc+1; c++) {
+        mag = cabsolute(phase_tx[c]);
+       phase_tx[c].real /= mag;        
+       phase_tx[c].imag /= mag;        
+    }
+
+    mag = cabsolute(*fbb_phase);
+    fbb_phase->real /= mag;    
+    fbb_phase->imag /= mag;    
+
+    /* shift memory, inserting zeros at end */
+
+    for(i=0; i<NSYM-1; i++)
+       for(c=0; c<Nc+1; c++)
+           tx_filter_memory[c][i] = tx_filter_memory[c][i+1];
+
+    for(c=0; c<Nc+1; c++) {
+       tx_filter_memory[c][NSYM-1].real = 0.0;
+       tx_filter_memory[c][NSYM-1].imag = 0.0;
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdm_upconvert()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 17/4/2012
+
+  Construct FDM signal by frequency shifting each filtered symbol
+  stream.  Returns complex signal so we can apply frequency offsets
+  easily.
+
+\*---------------------------------------------------------------------------*/
+
+void fdm_upconvert(COMP tx_fdm[], int Nc, COMP tx_baseband[NC+1][M], COMP phase_tx[], COMP freq[],
+                   COMP *fbb_phase, COMP fbb_rect)
+{
+    int   i,c;
+    COMP  two = {2.0, 0.0};
+    float mag;
+
+    for(i=0; i<M; i++) {
+       tx_fdm[i].real = 0.0;
+       tx_fdm[i].imag = 0.0;
+    }
+
+    for (c=0; c<=Nc; c++) 
+       for (i=0; i<M; i++) {
+           phase_tx[c] = cmult(phase_tx[c], freq[c]);
+           tx_fdm[i] = cadd(tx_fdm[i], cmult(tx_baseband[c][i], phase_tx[c]));
+       }
+
+    /* shift whole thing up to carrier freq */
+
+    for (i=0; i<M; i++) {
+       *fbb_phase = cmult(*fbb_phase, fbb_rect);
+       tx_fdm[i] = cmult(tx_fdm[i], *fbb_phase);
+    }
+
+    /*
+      Scale such that total Carrier power C of real(tx_fdm) = Nc.  This
+      excludes the power of the pilot tone.
+      We return the complex (single sided) signal to make frequency
+      shifting for the purpose of testing easier
+    */
+
+    for (i=0; i<M; i++) 
+       tx_fdm[i] = cmult(two, tx_fdm[i]);
+
+    /* normalise digital oscilators as the magnitude can drift over time */
+
+    for (c=0; c<Nc+1; c++) {
+        mag = cabsolute(phase_tx[c]);
+       phase_tx[c].real /= mag;        
+       phase_tx[c].imag /= mag;        
+    }
+
+    mag = cabsolute(*fbb_phase);
+    fbb_phase->real /= mag;    
+    fbb_phase->imag /= mag;    
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_mod()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 26/4/2012
+
+  FDMDV modulator, take a frame of FDMDV_BITS_PER_FRAME bits and
+  generates a frame of FDMDV_SAMPLES_PER_FRAME modulated symbols.
+  Sync bit is returned to aid alignment of your next frame.  
+
+  The sync_bit value returned will be used for the _next_ frame.
+
+  The output signal is complex to support single sided frequency
+  shifting, for example when testing frequency offsets in channel
+  simulation.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_mod(struct FDMDV *fdmdv, COMP tx_fdm[], int tx_bits[], int *sync_bit)
+{
+    COMP          tx_symbols[NC+1];
+    PROFILE_VAR(mod_start, tx_filter_and_upconvert_start);
+
+    PROFILE_SAMPLE(mod_start);
+    bits_to_dqpsk_symbols(tx_symbols, fdmdv->Nc, fdmdv->prev_tx_symbols, tx_bits, &fdmdv->tx_pilot_bit, fdmdv->old_qpsk_mapping);
+    memcpy(fdmdv->prev_tx_symbols, tx_symbols, sizeof(COMP)*(fdmdv->Nc+1));
+    PROFILE_SAMPLE_AND_LOG(tx_filter_and_upconvert_start, mod_start, "    bits_to_dqpsk_symbols"); 
+    tx_filter_and_upconvert(tx_fdm, fdmdv->Nc, tx_symbols, fdmdv->tx_filter_memory, 
+                            fdmdv->phase_tx, fdmdv->freq, &fdmdv->fbb_phase_tx, fdmdv->fbb_rect);
+    PROFILE_SAMPLE_AND_LOG2(tx_filter_and_upconvert_start, "    tx_filter_and_upconvert"); 
+
+    *sync_bit = fdmdv->tx_pilot_bit;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: generate_pilot_fdm()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 19/4/2012
+
+  Generate M samples of DBPSK pilot signal for Freq offset estimation.
+
+\*---------------------------------------------------------------------------*/
+
+void generate_pilot_fdm(COMP *pilot_fdm, int *bit, float *symbol, 
+                       float *filter_mem, COMP *phase, COMP *freq)
+{
+    int   i,j,k;
+    float tx_baseband[M];
+
+    /* +1 -1 +1 -1 DBPSK sync carrier, once filtered becomes (roughly)
+       two spectral lines at +/- RS/2 */
+    if (*bit)
+       *symbol = -*symbol;
+
+    if (*bit) 
+       *bit = 0;
+    else
+       *bit = 1;
+
+    /* filter DPSK symbol to create M baseband samples */
+
+    filter_mem[NFILTER-1] = (sqrtf(2)/2) * *symbol;
+    for(i=0; i<M; i++) {
+       tx_baseband[i] = 0.0; 
+       for(j=M-1,k=M-i-1; j<NFILTER; j+=M,k+=M)
+           tx_baseband[i] += M * filter_mem[j] * gt_alpha5_root[k];
+    }
+
+    /* shift memory, inserting zeros at end */
+
+    for(i=0; i<NFILTER-M; i++)
+       filter_mem[i] = filter_mem[i+M];
+
+    for(i=NFILTER-M; i<NFILTER; i++)
+       filter_mem[i] = 0.0;
+
+    /* upconvert */
+
+    for(i=0; i<M; i++) {
+       *phase = cmult(*phase, *freq);
+       pilot_fdm[i].real = sqrtf(2)*2*tx_baseband[i] * phase->real;
+       pilot_fdm[i].imag = sqrtf(2)*2*tx_baseband[i] * phase->imag;
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: generate_pilot_lut()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 19/4/2012
+
+  Generate a 4M sample vector of DBPSK pilot signal.  As the pilot signal
+  is periodic in 4M samples we can then use this vector as a look up table
+  for pilot signal generation in the demod.
+
+\*---------------------------------------------------------------------------*/
+
+void generate_pilot_lut(COMP pilot_lut[], COMP *pilot_freq)
+{
+    int   pilot_rx_bit = 0;
+    float pilot_symbol = sqrtf(2.0);
+    COMP  pilot_phase  = {1.0, 0.0};
+    float pilot_filter_mem[NFILTER];
+    COMP  pilot[M];
+    int   i,f;
+
+    for(i=0; i<NFILTER; i++)
+       pilot_filter_mem[i] = 0.0;
+
+    /* discard first 4 symbols as filter memory is filling, just keep
+       last four symbols */
+
+    for(f=0; f<8; f++) {
+       generate_pilot_fdm(pilot, &pilot_rx_bit, &pilot_symbol, pilot_filter_mem, &pilot_phase, pilot_freq);
+       if (f >= 4)
+           memcpy(&pilot_lut[M*(f-4)], pilot, M*sizeof(COMP));
+    }
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: lpf_peak_pick()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 20/4/2012
+
+  LPF and peak pick part of freq est, put in a function as we call it twice.
+
+\*---------------------------------------------------------------------------*/
+
+void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], 
+                  COMP pilot_lpf[], kiss_fft_cfg fft_pilot_cfg, COMP S[], int nin,
+                   int do_fft)
+{
+    int   i,j,k;
+    int   mpilot;
+    COMP  s[MPILOTFFT];
+    float mag, imax;
+    int   ix;
+    float r;
+
+    /* LPF cutoff 200Hz, so we can handle max +/- 200 Hz freq offset */
+
+    for(i=0; i<NPILOTLPF-nin; i++)
+       pilot_lpf[i] = pilot_lpf[nin+i];
+    for(i=NPILOTLPF-nin, j=NPILOTBASEBAND-nin; i<NPILOTLPF; i++,j++) {
+       pilot_lpf[i].real = 0.0; pilot_lpf[i].imag = 0.0;
+       for(k=0; k<NPILOTCOEFF; k++)
+           pilot_lpf[i] = cadd(pilot_lpf[i], fcmult(pilot_coeff[k], pilot_baseband[j-NPILOTCOEFF+1+k]));
+    }
+
+    /* We only need to do FFTs if we are out of sync.  Making them optional saves CPU in sync, which is when
+       we need to run the codec */
+
+    imax = 0.0;
+    *foff = 0.0;
+    for(i=0; i<MPILOTFFT; i++) {
+        S[i].real = 0.0;
+        S[i].imag = 0.0;
+    }
+
+    if (do_fft) {
+        
+        /* decimate to improve DFT resolution, window and DFT */
+
+        mpilot = FS/(2*200);  /* calc decimation rate given new sample rate is twice LPF freq */
+        for(i=0; i<MPILOTFFT; i++) {
+            s[i].real = 0.0; s[i].imag = 0.0;
+        }
+        for(i=0,j=0; i<NPILOTLPF; i+=mpilot,j++) {
+            s[j] = fcmult(hanning[i], pilot_lpf[i]); 
+        }
+
+        kiss_fft(fft_pilot_cfg, (kiss_fft_cpx *)s, (kiss_fft_cpx *)S);
+
+        /* peak pick and convert to Hz */
+
+        imax = 0.0;
+        ix = 0;
+        for(i=0; i<MPILOTFFT; i++) {
+            mag = S[i].real*S[i].real + S[i].imag*S[i].imag;
+            if (mag > imax) {
+                imax = mag;
+                ix = i;
+            }
+        }
+        r = 2.0*200.0/MPILOTFFT;     /* maps FFT bin to frequency in Hz */
+  
+        if (ix >= MPILOTFFT/2)
+            *foff = (ix - MPILOTFFT)*r;
+        else
+            *foff = (ix)*r;
+    }
+
+    *max = imax;
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: rx_est_freq_offset()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 19/4/2012
+
+  Estimate frequency offset of FDM signal using BPSK pilot.  Note that
+  this algorithm is quite sensitive to pilot tone level wrt other
+  carriers, so test variations to the pilot amplitude carefully.
+
+\*---------------------------------------------------------------------------*/
+
+float rx_est_freq_offset(struct FDMDV *f, COMP rx_fdm[], int nin, int do_fft)
+{
+    int  i,j;
+    COMP pilot[M+M/P];
+    COMP prev_pilot[M+M/P];
+    float foff, foff1, foff2;
+    float   max1, max2;
+
+    assert(nin <= M+M/P);
+
+    /* get pilot samples used for correlation/down conversion of rx signal */
+
+    for (i=0; i<nin; i++) {
+       pilot[i] = f->pilot_lut[f->pilot_lut_index];
+       f->pilot_lut_index++;
+       if (f->pilot_lut_index >= 4*M)
+           f->pilot_lut_index = 0;
+       
+       prev_pilot[i] = f->pilot_lut[f->prev_pilot_lut_index];
+       f->prev_pilot_lut_index++;
+       if (f->prev_pilot_lut_index >= 4*M)
+           f->prev_pilot_lut_index = 0;
+    }
+
+    /*
+      Down convert latest M samples of pilot by multiplying by ideal
+      BPSK pilot signal we have generated locally.  The peak of the
+      resulting signal is sensitive to the time shift between the
+      received and local version of the pilot, so we do it twice at
+      different time shifts and choose the maximum.
+    */
+
+    for(i=0; i<NPILOTBASEBAND-nin; i++) {
+       f->pilot_baseband1[i] = f->pilot_baseband1[i+nin];
+       f->pilot_baseband2[i] = f->pilot_baseband2[i+nin];
+    }
+
+    for(i=0,j=NPILOTBASEBAND-nin; i<nin; i++,j++) {
+               f->pilot_baseband1[j] = cmult(rx_fdm[i], cconj(pilot[i]));
+       f->pilot_baseband2[j] = cmult(rx_fdm[i], cconj(prev_pilot[i]));
+    }
+
+    lpf_peak_pick(&foff1, &max1, f->pilot_baseband1, f->pilot_lpf1, f->fft_pilot_cfg, f->S1, nin, do_fft);
+    lpf_peak_pick(&foff2, &max2, f->pilot_baseband2, f->pilot_lpf2, f->fft_pilot_cfg, f->S2, nin, do_fft);
+
+    if (max1 > max2)
+       foff = foff1;
+    else
+       foff = foff2;
+       
+    return foff;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_freq_shift()          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 26/4/2012
+
+  Frequency shift modem signal.  The use of complex input and output allows
+  single sided frequency shifting (no images).
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_freq_shift(COMP rx_fdm_fcorr[], COMP rx_fdm[], float foff, 
+                      COMP *foff_phase_rect, int nin)
+{
+    COMP  foff_rect;
+    float mag;
+    int   i;
+
+    foff_rect.real = cosf(2.0*PI*foff/FS);
+    foff_rect.imag = sinf(2.0*PI*foff/FS);
+    for(i=0; i<nin; i++) {
+       *foff_phase_rect = cmult(*foff_phase_rect, foff_rect);
+       rx_fdm_fcorr[i] = cmult(rx_fdm[i], *foff_phase_rect);
+    }
+
+    /* normalise digital oscilator as the magnitude can drfift over time */
+
+    mag = cabsolute(*foff_phase_rect);
+    foff_phase_rect->real /= mag;       
+    foff_phase_rect->imag /= mag;       
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdm_downconvert     
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/4/2012
+
+  Frequency shift each modem carrier down to Nc+1 baseband signals.
+
+\*---------------------------------------------------------------------------*/
+
+void fdm_downconvert(COMP rx_baseband[NC+1][M+M/P], int Nc, COMP rx_fdm[], COMP phase_rx[], COMP freq[], int nin)
+{
+    int   i,c;
+    float mag;
+
+    /* maximum number of input samples to demod */
+
+    assert(nin <= (M+M/P));
+
+    /* downconvert */
+  
+    for (c=0; c<Nc+1; c++) 
+       for (i=0; i<nin; i++) {
+           phase_rx[c] = cmult(phase_rx[c], freq[c]);
+           rx_baseband[c][i] = cmult(rx_fdm[i], cconj(phase_rx[c]));
+       }
+
+    /* normalise digital oscilators as the magnitude can drift over time */
+
+    for (c=0; c<Nc+1; c++) {
+        mag = cabsolute(phase_rx[c]);
+       phase_rx[c].real /= mag;          
+       phase_rx[c].imag /= mag;          
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: rx_filter()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/4/2012
+
+  Receive filter each baseband signal at oversample rate P.  Filtering at
+  rate P lowers CPU compared to rate M.
+
+  Depending on the number of input samples to the demod nin, we
+  produce P-1, P (usually), or P+1 filtered samples at rate P.  nin is
+  occasionally adjusted to compensate for timing slips due to
+  different tx and rx sample clocks.
+
+\*---------------------------------------------------------------------------*/
+
+void rx_filter(COMP rx_filt[NC+1][P+1], int Nc, COMP rx_baseband[NC+1][M+M/P], COMP rx_filter_memory[NC+1][NFILTER], int nin)
+{
+    int c, i,j,k,l;
+    int n=M/P;
+
+    /* rx filter each symbol, generate P filtered output samples for
+       each symbol.  Note we keep filter memory at rate M, it's just
+       the filter output at rate P */
+
+    for(i=0, j=0; i<nin; i+=n,j++) {
+
+       /* latest input sample */
+       
+       for(c=0; c<Nc+1; c++)
+           for(k=NFILTER-n,l=i; k<NFILTER; k++,l++)    
+               rx_filter_memory[c][k] = rx_baseband[c][l];
+       
+       /* convolution (filtering) */
+
+       for(c=0; c<Nc+1; c++) {
+           rx_filt[c][j].real = 0.0; rx_filt[c][j].imag = 0.0;
+           for(k=0; k<NFILTER; k++) 
+               rx_filt[c][j] = cadd(rx_filt[c][j], fcmult(gt_alpha5_root[k], rx_filter_memory[c][k]));
+       }
+
+       /* make room for next input sample */
+       
+       for(c=0; c<Nc+1; c++)
+           for(k=0,l=n; k<NFILTER-n; k++,l++)  
+               rx_filter_memory[c][k] = rx_filter_memory[c][l];
+    }
+
+    assert(j <= (P+1)); /* check for any over runs */
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: rxdec_filter()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 31 July 2014
+
+  +/- 1000Hz low pass filter, allows us to filter at rate Q to save CPU load.
+
+\*---------------------------------------------------------------------------*/
+
+void rxdec_filter(COMP rx_fdm_filter[], COMP rx_fdm[], COMP rxdec_lpf_mem[], int nin) {
+    int i,j,k; 
+
+    for(i=0; i<NRXDEC-1+M-nin; i++)
+        rxdec_lpf_mem[i] = rxdec_lpf_mem[i+nin];
+    for(i=0, j=NRXDEC-1+M-nin; i<nin; i++,j++)
+        rxdec_lpf_mem[j] = rx_fdm[i];
+
+    for(i=0; i<nin; i++) {
+        rx_fdm_filter[i].real = 0.0;
+        for(k=0; k<NRXDEC; k++)
+            rx_fdm_filter[i].real += rxdec_lpf_mem[i+k].real * rxdec_coeff[k];
+        rx_fdm_filter[i].imag = 0.0;
+        for(k=0; k<NRXDEC; k++)
+            rx_fdm_filter[i].imag += rxdec_lpf_mem[i+k].imag * rxdec_coeff[k];
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fir_filter()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: July 2014
+
+  Helper fir filter function.
+
+\*---------------------------------------------------------------------------*/
+
+static float fir_filter(float mem[], float coeff[], int dec_rate) {
+    float acc = 0.0;
+    int   m;
+
+    for(m=0; m<NFILTER; m+=dec_rate) { 
+        acc += coeff[m] * mem[2*m];
+    }
+
+    return dec_rate*acc;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: down_convert_and_rx_filter()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 30/6/2014
+
+  Combined down convert and rx filter, more memory efficient but less
+  intuitive design.  
+
+  Depending on the number of input samples to the demod nin, we
+  produce P-1, P (usually), or P+1 filtered samples at rate P.  nin is
+  occasionally adjusted to compensate for timing slips due to
+  different tx and rx sample clocks.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+   TODO: [ ] windback phase calculated once at init time
+*/
+
+void down_convert_and_rx_filter(COMP rx_filt[NC+1][P+1], int Nc, COMP rx_fdm[], 
+                                COMP rx_fdm_mem[], COMP phase_rx[], COMP freq[], 
+                                float freq_pol[], int nin, int dec_rate)
+{
+    int i,k,c,st,N;
+    float windback_phase, mag;
+    COMP  windback_phase_rect;
+    COMP  rx_baseband[NFILTER+M];
+    COMP  f_rect;
+
+    //PROFILE_VAR(windback_start,  downconvert_start, filter_start);
+
+    /* update memory of rx_fdm */
+
+    for(i=0; i<NFILTER+M-nin; i++)
+        rx_fdm_mem[i] = rx_fdm_mem[i+nin];
+    for(i=NFILTER+M-nin, k=0; i<NFILTER+M; i++, k++)
+        rx_fdm_mem[i] = rx_fdm[k];
+
+    for(c=0; c<Nc+1; c++) {
+
+        /*
+          now downconvert using current freq offset to get Nfilter+nin
+          baseband samples.
+     
+                     Nfilter             nin
+          |--------------------------|---------|
+                                      | 
+                                  phase_rx(c)
+     
+          This means winding phase(c) back from this point to ensure
+          phase continuity.
+        */
+
+        //PROFILE_SAMPLE(windback_start);
+        windback_phase           = -freq_pol[c]*NFILTER;
+        windback_phase_rect.real = cosf(windback_phase);
+        windback_phase_rect.imag = sinf(windback_phase);
+        phase_rx[c]              = cmult(phase_rx[c],windback_phase_rect);
+        //PROFILE_SAMPLE_AND_LOG(downconvert_start, windback_start, "        windback"); 
+    
+        /* down convert all samples in buffer */
+
+        st  = NFILTER+M-1;    /* end of buffer                  */
+        st -= nin-1;          /* first new sample               */
+        st -= NFILTER;        /* first sample used in filtering */
+        
+        /* freq shift per dec_rate step is dec_rate times original shift */
+
+        f_rect = freq[c];
+        for(i=0; i<dec_rate-1; i++)
+            f_rect = cmult(f_rect,freq[c]);
+
+        for(i=st; i<NFILTER+M; i+=dec_rate) {
+            phase_rx[c]    = cmult(phase_rx[c], f_rect);
+            rx_baseband[i] = cmult(rx_fdm_mem[i],cconj(phase_rx[c]));
+        }
+        //PROFILE_SAMPLE_AND_LOG(filter_start, downconvert_start, "        downconvert"); 
+        /* now we can filter this carrier's P symbols */
+
+        N=M/P;
+        for(i=0, k=0; i<nin; i+=N, k++) {
+           #ifdef ORIG 
+           rx_filt[c][k].real = 0.0; rx_filt[c][k].imag = 0.0;
+            
+           for(m=0; m<NFILTER; m++) 
+               rx_filt[c][k] = cadd(rx_filt[c][k], fcmult(gt_alpha5_root[m], rx_baseband[st+i+m]));
+           #else
+           rx_filt[c][k].real = fir_filter(&rx_baseband[st+i].real, (float*)gt_alpha5_root, dec_rate);
+           rx_filt[c][k].imag = fir_filter(&rx_baseband[st+i].imag, (float*)gt_alpha5_root, dec_rate);
+           #endif
+        }
+        //PROFILE_SAMPLE_AND_LOG2(filter_start, "        filter"); 
+
+        /* normalise digital oscilators as the magnitude can drift over time */
+
+        mag = cabsolute(phase_rx[c]);
+       phase_rx[c].real /= mag;          
+       phase_rx[c].imag /= mag;
+         
+       //printf("phase_rx[%d] = %f %f\n", c, phase_rx[c].real, phase_rx[c].imag);
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: rx_est_timing()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 23/4/2012
+
+  Estimate optimum timing offset, re-filter receive symbols at optimum
+  timing estimate.
+
+\*---------------------------------------------------------------------------*/
+
+float rx_est_timing(COMP rx_symbols[], 
+                    int  Nc,
+                   COMP rx_filt[NC+1][P+1], 
+                   COMP rx_filter_mem_timing[NC+1][NT*P], 
+                   float env[],
+                   int nin,
+                    int m)      
+{
+    int   c,i,j;
+    int   adjust;
+    COMP  x, phase, freq;
+    float rx_timing, fract, norm_rx_timing;
+    int   low_sample, high_sample;
+
+    /*
+      nin  adjust 
+      --------------------------------
+      120  -1 (one less rate P sample)
+      160   0 (nominal)
+      200   1 (one more rate P sample)
+    */
+
+    adjust = P - nin*P/m;
+    
+    /* update buffer of NT rate P filtered symbols */
+    
+    for(c=0; c<Nc+1; c++) 
+       for(i=0,j=P-adjust; i<(NT-1)*P+adjust; i++,j++)
+           rx_filter_mem_timing[c][i] = rx_filter_mem_timing[c][j];
+    for(c=0; c<Nc+1; c++) 
+       for(i=(NT-1)*P+adjust,j=0; i<NT*P; i++,j++)
+           rx_filter_mem_timing[c][i] = rx_filt[c][j];
+           
+    /* sum envelopes of all carriers */
+
+    for(i=0; i<NT*P; i++) {
+       env[i] = 0.0;
+       for(c=0; c<Nc+1; c++)
+           env[i] += cabsolute(rx_filter_mem_timing[c][i]);
+    }
+
+    /* The envelope has a frequency component at the symbol rate.  The
+       phase of this frequency component indicates the timing.  So work
+       out single DFT at frequency 2*pi/P */
+
+    x.real = 0.0; x.imag = 0.0;
+    freq.real = cosf(2*PI/P);
+    freq.imag = sinf(2*PI/P);
+    phase.real = 1.0;
+    phase.imag = 0.0;
+
+    for(i=0; i<NT*P; i++) {
+       x = cadd(x, fcmult(env[i], phase));
+       phase = cmult(phase, freq);
+    }
+
+    /* Map phase to estimated optimum timing instant at rate P.  The
+       P/4 part was adjusted by experiment, I know not why.... */
+    
+    norm_rx_timing = atan2f(x.imag, x.real)/(2*PI);
+    rx_timing      = norm_rx_timing*P + P/4;
+    
+    if (rx_timing > P)
+       rx_timing -= P;
+    if (rx_timing < -P)
+       rx_timing += P;
+
+    /* rx_filter_mem_timing contains Nt*P samples (Nt symbols at rate
+       P), where Nt is odd.  Lets use linear interpolation to resample
+       in the centre of the timing estimation window .*/
+
+    rx_timing  += floorf(NT/2.0)*P;
+    low_sample = floorf(rx_timing);
+    fract = rx_timing - low_sample;
+    high_sample = ceilf(rx_timing);
+
+    //printf("rx_timing: %f low_sample: %d high_sample: %d fract: %f\n", rx_timing, low_sample, high_sample, fract);
+    
+    for(c=0; c<Nc+1; c++) {
+        rx_symbols[c] = cadd(fcmult(1.0-fract, rx_filter_mem_timing[c][low_sample-1]), fcmult(fract, rx_filter_mem_timing[c][high_sample-1]));
+        //rx_symbols[c] = rx_filter_mem_timing[c][high_sample];
+    }
+       
+    return norm_rx_timing*m;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: qpsk_to_bits()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 24/4/2012
+
+  Convert DQPSK symbols back to an array of bits, extracts sync bit
+  from DBPSK pilot, and also uses pilot to estimate fine frequency
+  error.
+
+\*---------------------------------------------------------------------------*/
+
+float qpsk_to_bits(int rx_bits[], int *sync_bit, int Nc, COMP phase_difference[], COMP prev_rx_symbols[], 
+                   COMP rx_symbols[], int old_qpsk_mapping)
+{
+    int   c;
+    COMP  pi_on_4;
+    COMP  d;
+    int   msb=0, lsb=0;
+    float ferr, norm;
+
+    pi_on_4.real = cosf(PI/4.0);
+    pi_on_4.imag = sinf(PI/4.0);
+
+    /* Extra 45 degree clockwise lets us use real and imag axis as
+       decision boundaries. "norm" makes sure the phase subtraction
+       from the previous symbol doesn't affect the amplitude, which
+       leads to sensible scatter plots */
+
+    for(c=0; c<Nc; c++) {
+        norm = 1.0/(cabsolute(prev_rx_symbols[c])+1E-6);
+       phase_difference[c] = cmult(cmult(rx_symbols[c], fcmult(norm,cconj(prev_rx_symbols[c]))), pi_on_4);
+    }
+                                   
+    /* map (Nc,1) DQPSK symbols back into an (1,Nc*Nb) array of bits */
+
+    for (c=0; c<Nc; c++) {
+      d = phase_difference[c];
+      if ((d.real >= 0) && (d.imag >= 0)) {
+          msb = 0; lsb = 0;
+      }
+      if ((d.real < 0) && (d.imag >= 0)) {
+          msb = 0; lsb = 1;
+      }
+      if ((d.real < 0) && (d.imag < 0)) {
+          if (old_qpsk_mapping) {
+              msb = 1; lsb = 0;
+          } else {
+              msb = 1; lsb = 1;
+          }
+      }
+      if ((d.real >= 0) && (d.imag < 0)) {
+          if (old_qpsk_mapping) {
+              msb = 1; lsb = 1;
+          } else {
+              msb = 1; lsb = 0;
+          }
+      }
+      rx_bits[2*c] = msb;
+      rx_bits[2*c+1] = lsb;
+    }
+    /* Extract DBPSK encoded Sync bit and fine freq offset estimate */
+
+    norm = 1.0/(cabsolute(prev_rx_symbols[Nc])+1E-6);
+    phase_difference[Nc] = cmult(rx_symbols[Nc], fcmult(norm, cconj(prev_rx_symbols[Nc])));
+    if (phase_difference[Nc].real < 0) {
+      *sync_bit = 1;
+      ferr = phase_difference[Nc].imag*norm;    /* make f_err magnitude insensitive */
+    }
+    else {
+      *sync_bit = 0;
+      ferr = -phase_difference[Nc].imag*norm;
+    }
+    
+    /* pilot carrier gets an extra pi/4 rotation to make it consistent
+       with other carriers, as we need it for snr_update and scatter
+       diagram */
+
+    phase_difference[Nc] = cmult(phase_difference[Nc], pi_on_4);
+
+    return ferr;
+}
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: snr_update()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 17 May 2012
+
+  Given phase differences update estimates of signal and noise levels.
+
+\*---------------------------------------------------------------------------*/
+
+void snr_update(float sig_est[], float noise_est[], int Nc, COMP phase_difference[])
+{
+    float s[NC+1];
+    COMP  refl_symbols[NC+1];
+    float n[NC+1];
+    COMP  pi_on_4;
+    int   c;
+
+    pi_on_4.real = cosf(PI/4.0);
+    pi_on_4.imag = sinf(PI/4.0);
+
+    /* mag of each symbol is distance from origin, this gives us a
+       vector of mags, one for each carrier. */
+
+    for(c=0; c<Nc+1; c++)
+       s[c] = cabsolute(phase_difference[c]);
+
+    /* signal mag estimate for each carrier is a smoothed version of
+       instantaneous magntitude, this gives us a vector of smoothed
+       mag estimates, one for each carrier. */
+
+    for(c=0; c<Nc+1; c++)
+       sig_est[c] = SNR_COEFF*sig_est[c] + (1.0 - SNR_COEFF)*s[c];
+
+    /* noise mag estimate is distance of current symbol from average
+       location of that symbol.  We reflect all symbols into the first
+       quadrant for convenience. */
+    
+    for(c=0; c<Nc+1; c++) {
+       refl_symbols[c].real = fabsf(phase_difference[c].real);
+       refl_symbols[c].imag = fabsf(phase_difference[c].imag);    
+       n[c] = cabsolute(cadd(fcmult(sig_est[c], pi_on_4), cneg(refl_symbols[c])));
+    }
+     
+    /* noise mag estimate for each carrier is a smoothed version of
+       instantaneous noise mag, this gives us a vector of smoothed
+       noise power estimates, one for each carrier. */
+
+    for(c=0; c<Nc+1; c++)
+       noise_est[c] = SNR_COEFF*noise_est[c] + (1 - SNR_COEFF)*n[c];
+}
+
+// returns number of shorts in error_pattern[], one short per error
+
+int fdmdv_error_pattern_size(struct FDMDV *f) {
+    return f->ntest_bits;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_put_test_bits()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 24/4/2012
+
+  Accepts nbits from rx and attempts to sync with test_bits sequence.
+  If sync OK measures bit errors.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_put_test_bits(struct FDMDV *f, int *sync, short error_pattern[],
+                        int *bit_errors, int *ntest_bits, int rx_bits[])
+{
+    int   i,j;
+    float ber;
+    int   bits_per_frame = fdmdv_bits_per_frame(f);
+
+    /* Append to our memory */
+
+    for(i=0,j=bits_per_frame; i<f->ntest_bits-bits_per_frame; i++,j++)
+       f->rx_test_bits_mem[i] = f->rx_test_bits_mem[j];
+    for(i=f->ntest_bits-bits_per_frame,j=0; i<f->ntest_bits; i++,j++)
+       f->rx_test_bits_mem[i] = rx_bits[j];
+    
+    /* see how many bit errors we get when checked against test sequence */
+       
+    *bit_errors = 0;
+    for(i=0; i<f->ntest_bits; i++) {
+        error_pattern[i] = test_bits[i] ^ f->rx_test_bits_mem[i];
+       *bit_errors += error_pattern[i];
+       //printf("%d %d %d %d\n", i, test_bits[i], f->rx_test_bits_mem[i], test_bits[i] ^ f->rx_test_bits_mem[i]);
+    }
+
+    /* if less than a thresh we are aligned and in sync with test sequence */
+
+    ber = (float)*bit_errors/f->ntest_bits;
+  
+    *sync = 0;
+    if (ber < 0.2)
+       *sync = 1;
+   
+    *ntest_bits = f->ntest_bits;
+    
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freq_state(()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 24/4/2012
+
+  Freq offset state machine.  Moves between coarse and fine states
+  based on BPSK pilot sequence.  Freq offset estimator occasionally
+  makes mistakes when used continuously.  So we use it until we have
+  acquired the BPSK pilot, then switch to a more robust "fine"
+  tracking algorithm.  If we lose sync we switch back to coarse mode
+  for fast re-acquisition of large frequency offsets.
+
+  The sync state is also useful for higher layers to determine when
+  there is valid FDMDV data for decoding.  We want to reliably and
+  quickly get into sync, stay in sync even on fading channels, and
+  fall out of sync quickly if tx stops or it's a false sync.
+
+  In multipath fading channels the BPSK sync carrier may be pushed
+  down in the noise, despite other carriers being at full strength.
+  We want to avoid loss of sync in these cases.
+
+\*---------------------------------------------------------------------------*/
+
+int freq_state(int *reliable_sync_bit, int sync_bit, int *state, int *timer, int *sync_mem)
+{
+    int next_state, sync, unique_word, i, corr;
+
+    /* look for 6 symbols (120ms) 101010 of sync sequence */
+
+    unique_word = 0;
+    for(i=0; i<NSYNC_MEM-1; i++)
+        sync_mem[i] = sync_mem[i+1];
+    sync_mem[i] = 1 - 2*sync_bit;
+    corr = 0;
+    for(i=0; i<NSYNC_MEM; i++)
+        corr += sync_mem[i]*sync_uw[i];
+    if (abs(corr) == NSYNC_MEM)
+        unique_word = 1;
+    *reliable_sync_bit = (corr == NSYNC_MEM);
+
+    /* iterate state machine */
+
+    next_state = *state;
+    switch(*state) {
+    case 0:
+       if (unique_word) {
+           next_state = 1;
+            *timer = 0;
+        }
+       break;
+    case 1:                   /* tentative sync state         */
+       if (unique_word) {
+            (*timer)++;
+            if (*timer == 25) /* sync has been good for 500ms */
+                next_state = 2;
+        }
+       else 
+           next_state = 0;  /* quickly fall out of sync     */
+       break;
+    case 2:                  /* good sync state */
+       if (unique_word == 0) {
+            *timer = 0;
+           next_state = 3;
+        }
+       break;
+    case 3:                  /* tentative bad state, but could be a fade */
+       if (unique_word)
+           next_state = 2;
+       else  {
+            (*timer)++;
+            if (*timer == 50) /* wait for 1000ms in case sync comes back  */
+                next_state = 0;
+        }
+       break;
+    }
+
+    //printf("state: %d next_state: %d uw: %d timer: %d\n", *state, next_state, unique_word, *timer);
+    *state = next_state;
+    if (*state)
+       sync = 1;
+    else
+       sync = 0;
+    return sync;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_demod()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 26/4/2012
+
+  FDMDV demodulator, take an array of FDMDV_SAMPLES_PER_FRAME
+  modulated samples, returns an array of FDMDV_BITS_PER_FRAME bits,
+  plus the sync bit.  
+
+  The input signal is complex to support single sided frequency shifting
+  before the demod input (e.g. fdmdv2 click to tune feature).
+
+  The number of input samples nin will normally be M ==
+  FDMDV_SAMPLES_PER_FRAME.  However to adjust for differences in
+  transmit and receive sample clocks nin will occasionally be M-M/P,
+  or M+M/P.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_demod(struct FDMDV *fdmdv, int rx_bits[], 
+                int *reliable_sync_bit, COMP rx_fdm[], int *nin)
+{
+    float         foff_coarse, foff_fine;
+    COMP          rx_fdm_fcorr[M+M/P];
+    COMP          rx_fdm_filter[M+M/P];
+    COMP          rx_fdm_bb[M+M/P];
+    COMP          rx_filt[NC+1][P+1];
+    COMP          rx_symbols[NC+1];
+    float         env[NT*P];
+    int           sync_bit;
+    PROFILE_VAR(demod_start, fdmdv_freq_shift_start, down_convert_and_rx_filter_start);
+    PROFILE_VAR(rx_est_timing_start, qpsk_to_bits_start, snr_update_start, freq_state_start);
+
+    /* shift down to complex baseband */
+
+    fdmdv_freq_shift(rx_fdm_bb, rx_fdm, -FDMDV_FCENTRE, &fdmdv->fbb_phase_rx, *nin);
+
+    /* freq offset estimation and correction */
+   
+    PROFILE_SAMPLE(demod_start);
+    foff_coarse = rx_est_freq_offset(fdmdv, rx_fdm_bb, *nin, !fdmdv->sync);
+    PROFILE_SAMPLE_AND_LOG(fdmdv_freq_shift_start, demod_start, "    rx_est_freq_offset"); 
+    
+    if (fdmdv->sync == 0)
+       fdmdv->foff = foff_coarse;
+    fdmdv_freq_shift(rx_fdm_fcorr, rx_fdm_bb, -fdmdv->foff, &fdmdv->foff_phase_rect, *nin);
+    PROFILE_SAMPLE_AND_LOG(down_convert_and_rx_filter_start, fdmdv_freq_shift_start, "    fdmdv_freq_shift"); 
+       
+    /* baseband processing */
+
+    rxdec_filter(rx_fdm_filter, rx_fdm_fcorr, fdmdv->rxdec_lpf_mem, *nin);
+    down_convert_and_rx_filter(rx_filt, fdmdv->Nc, rx_fdm_filter, fdmdv->rx_fdm_mem, fdmdv->phase_rx, fdmdv->freq, 
+                               fdmdv->freq_pol, *nin, M/Q);
+    PROFILE_SAMPLE_AND_LOG(rx_est_timing_start, down_convert_and_rx_filter_start, "    down_convert_and_rx_filter"); 
+    fdmdv->rx_timing = rx_est_timing(rx_symbols, fdmdv->Nc, rx_filt, fdmdv->rx_filter_mem_timing, env, *nin, M);        
+    PROFILE_SAMPLE_AND_LOG(qpsk_to_bits_start, rx_est_timing_start, "    rx_est_timing"); 
+    
+    /* Adjust number of input samples to keep timing within bounds */
+
+    *nin = M;
+
+    if (fdmdv->rx_timing > 2*M/P)
+       *nin += M/P;
+    
+    if (fdmdv->rx_timing < 0)
+       *nin -= M/P;
+    
+    foff_fine = qpsk_to_bits(rx_bits, &sync_bit, fdmdv->Nc, fdmdv->phase_difference, fdmdv->prev_rx_symbols, rx_symbols, 
+                             fdmdv->old_qpsk_mapping);
+    memcpy(fdmdv->prev_rx_symbols, rx_symbols, sizeof(COMP)*(fdmdv->Nc+1));
+    PROFILE_SAMPLE_AND_LOG(snr_update_start, qpsk_to_bits_start, "    qpsk_to_bits"); 
+    snr_update(fdmdv->sig_est, fdmdv->noise_est, fdmdv->Nc, fdmdv->phase_difference);
+    PROFILE_SAMPLE_AND_LOG(freq_state_start, snr_update_start, "    snr_update"); 
+
+    /* freq offset estimation state machine */
+
+    fdmdv->sync = freq_state(reliable_sync_bit, sync_bit, &fdmdv->fest_state, &fdmdv->timer, fdmdv->sync_mem);
+    PROFILE_SAMPLE_AND_LOG2(freq_state_start, "    freq_state"); 
+    fdmdv->foff  -= TRACK_COEFF*foff_fine;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: calc_snr()          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 17 May 2012
+
+  Calculate current SNR estimate (3000Hz noise BW)
+
+\*---------------------------------------------------------------------------*/
+
+float calc_snr(int Nc, float sig_est[], float noise_est[])
+{
+    float S, SdB;
+    float mean, N50, N50dB, N3000dB;
+    float snr_dB;
+    int   c;
+   
+    S = 0.0;
+    for(c=0; c<Nc+1; c++)
+       S += powf(sig_est[c], 2.0);
+    SdB = 10.0*log10f(S+1E-12);
+    
+    /* Average noise mag across all carriers and square to get an
+       average noise power.  This is an estimate of the noise power in
+       Rs = 50Hz of BW (note for raised root cosine filters Rs is the
+       noise BW of the filter) */
+
+    mean = 0.0;
+    for(c=0; c<Nc+1; c++)
+       mean += noise_est[c];
+    mean /= (Nc+1);
+    N50 = powf(mean, 2.0);
+    N50dB = 10.0*log10f(N50+1E-12);
+
+    /* Now multiply by (3000 Hz)/(50 Hz) to find the total noise power
+       in 3000 Hz */
+
+    N3000dB = N50dB + 10.0*log10f(3000.0/RS);
+
+    snr_dB = SdB - N3000dB;
+
+    return snr_dB;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_get_demod_stats()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 1 May 2012
+
+  Fills stats structure with a bunch of demod information.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_get_demod_stats(struct FDMDV *fdmdv, struct MODEM_STATS *stats)
+{
+    int   c;
+
+    assert(fdmdv->Nc <= MODEM_STATS_NC_MAX);
+
+    stats->Nc = fdmdv->Nc;
+    stats->snr_est = calc_snr(fdmdv->Nc, fdmdv->sig_est, fdmdv->noise_est);
+    stats->sync = fdmdv->sync;
+    stats->foff = fdmdv->foff;
+    stats->rx_timing = fdmdv->rx_timing;
+    stats->clock_offset = 0.0; /* TODO - implement clock offset estimation */
+
+    stats->nr = 1;
+    for(c=0; c<fdmdv->Nc+1; c++) {
+       stats->rx_symbols[0][c] = fdmdv->phase_difference[c];
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_8_to_16()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 9 May 2012
+
+  Changes the sample rate of a signal from 8 to 16 kHz.  Support function for
+  SM1000.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_8_to_16(float out16k[], float in8k[], int n)
+{
+    int i,k,l;
+    float acc;
+
+    /* make sure n is an integer multiple of the oversampling rate, ow
+       this function breaks */
+
+    assert((n % FDMDV_OS) == 0);
+
+    /* this version unrolled for specific FDMDV_OS */
+
+    assert(FDMDV_OS == 2);
+    
+    for(i=0; i<n; i++) {
+        acc = 0.0;
+        for(k=0,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+            acc += fdmdv_os_filter[k]*in8k[i-l];
+        out16k[i*FDMDV_OS] = FDMDV_OS*acc;
+
+        acc = 0.0;
+        for(k=1,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+            acc += fdmdv_os_filter[k]*in8k[i-l];
+        out16k[i*FDMDV_OS+1] = FDMDV_OS*acc;
+    }  
+
+    /* update filter memory */
+
+    for(i=-(FDMDV_OS_TAPS_8K); i<0; i++)
+       in8k[i] = in8k[i + n];
+
+}
+
+void fdmdv_8_to_16_short(short out16k[], short in8k[], int n)
+{
+    int i,k,l;
+    float acc;
+
+    /* make sure n is an integer multiple of the oversampling rate, ow
+       this function breaks */
+
+    assert((n % FDMDV_OS) == 0);
+
+    /* this version unrolled for specific FDMDV_OS */
+
+    assert(FDMDV_OS == 2);
+
+    for(i=0; i<n; i++) {
+        acc = 0.0;
+        for(k=0,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+            acc += fdmdv_os_filter[k]*(float)in8k[i-l];
+        out16k[i*FDMDV_OS] = FDMDV_OS*acc;
+
+        acc = 0.0;
+        for(k=1,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+            acc += fdmdv_os_filter[k]*(float)in8k[i-l];
+        out16k[i*FDMDV_OS+1] = FDMDV_OS*acc;
+    }  
+
+    /* update filter memory */
+
+    for(i=-(FDMDV_OS_TAPS_8K); i<0; i++)
+       in8k[i] = in8k[i + n];
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_16_to_8()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 9 May 2012
+
+  Changes the sample rate of a signal from 16 to 8 kHz.
+  n is the number of samples at the 8 kHz rate, there are FDMDV_OS*n
+  samples at the 48 kHz rate.  As above however a memory of
+  FDMDV_OS_TAPS samples is reqd for in16k[] (see t16_8.c unit test as example).
+
+  Low pass filter the 16 kHz signal at 4 kHz using the same filter as
+  the upsampler, then just output every FDMDV_OS-th filtered sample.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_16_to_8(float out8k[], float in16k[], int n)
+{
+    float acc;
+    int   i,j,k;
+    
+    for(i=0, k=0; k<n; i+=FDMDV_OS, k++) {       
+       acc = 0.0;
+       for(j=0; j<FDMDV_OS_TAPS_16K; j++)
+           acc += fdmdv_os_filter[j]*in16k[i-j]; 
+        out8k[k] = acc;       
+    }
+
+    /* update filter memory */
+
+    for(i=-FDMDV_OS_TAPS_16K; i<0; i++)
+       in16k[i] = in16k[i + n*FDMDV_OS];
+}
+
+void fdmdv_16_to_8_short(short out8k[], short in16k[], int n)
+{
+    float acc;
+    int i,j,k;
+
+    for(i=0, k=0; k<n; i+=FDMDV_OS, k++) {
+       acc = 0.0;
+       for(j=0; j<FDMDV_OS_TAPS_16K; j++)
+           acc += fdmdv_os_filter[j]*(float)in16k[i-j];
+        out8k[k] = acc;
+    }
+
+    /* update filter memory */
+
+    for(i=-FDMDV_OS_TAPS_16K; i<0; i++)
+       in16k[i] = in16k[i + n*FDMDV_OS];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  Function used during development to test if magnitude of digital
+  oscillators was drifting.  It was!
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_dump_osc_mags(struct FDMDV *f) 
+{
+    int   i;
+
+    fprintf(stderr, "phase_tx[]:\n");
+    for(i=0; i<=f->Nc; i++)
+       fprintf(stderr,"  %1.3f", (double)cabsolute(f->phase_tx[i]));
+    fprintf(stderr,"\nfreq[]:\n");
+    for(i=0; i<=f->Nc; i++)
+       fprintf(stderr,"  %1.3f", (double)cabsolute(f->freq[i]));
+    fprintf(stderr,"\nfoff_phase_rect: %1.3f", (double)cabsolute(f->foff_phase_rect));
+    fprintf(stderr,"\nphase_rx[]:\n");
+    for(i=0; i<=f->Nc; i++)
+       fprintf(stderr,"  %1.3f", (double)cabsolute(f->phase_rx[i]));
+    fprintf(stderr, "\n\n");
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: randn()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 2 August 2014
+
+  Simple approximation to normal (gaussian) random number generator
+  with 0 mean and unit variance.
+
+\*---------------------------------------------------------------------------*/
+
+#define RANDN_IT 12  /* This magic number of iterations gives us a
+                        unit variance.  I think beacuse var =
+                        (b-a)^2/12 for one uniform random variable, so
+                        for a sum of n random variables it's
+                        n(b-a)^2/12, or for b=1, a = 0, n=12, we get
+                        var = 12(1-0)^2/12 = 1 */ 
+
+static float randn() {
+    int   i;
+    float rn = 0.0;
+
+    for(i=0; i<RANDN_IT; i++)
+        rn += (float)rand()/RAND_MAX;
+
+    rn -= (float)RANDN_IT/2.0;
+    return rn;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_simulate_channel()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 10 July 2014
+
+  Simple channel simulation function to aid in testing.  Target SNR
+  uses noise measured in a 3 kHz bandwidth.  
+
+  Doesn't use fdmdv states so can be called from anywhere, e.g. non
+  fdmdv applications.
+
+  TODO: Measured SNR is coming out a few dB higher than target_snr, this
+  needs to be fixed.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_simulate_channel(float *sig_pwr_av, COMP samples[], int nin, float target_snr) 
+{
+    float sig_pwr, target_snr_linear, noise_pwr, noise_pwr_1Hz, noise_pwr_4000Hz, noise_gain;
+    int   i;
+
+    /* estimate signal power */
+
+    sig_pwr = 0.0;
+    for(i=0; i<nin; i++)
+        sig_pwr += samples[i].real*samples[i].real + samples[i].imag*samples[i].imag;
+    
+    sig_pwr /= nin;
+
+    *sig_pwr_av = 0.9**sig_pwr_av + 0.1*sig_pwr;
+
+    /* det noise to meet target SNR */
+
+    target_snr_linear = powf(10.0, target_snr/10.0);
+    noise_pwr = *sig_pwr_av/target_snr_linear;       /* noise pwr in a 3000 Hz BW     */
+    noise_pwr_1Hz = noise_pwr/3000.0;                  /* noise pwr in a 1 Hz bandwidth */
+    noise_pwr_4000Hz = noise_pwr_1Hz*4000.0;           /* noise pwr in a 4000 Hz BW, which 
+                                                          due to fs=8000 Hz in our simulation noise BW */
+
+    noise_gain = sqrtf(0.5*noise_pwr_4000Hz);          /* split noise pwr between real and imag sides  */
+    
+    for(i=0; i<nin; i++) {
+        samples[i].real += noise_gain*randn();
+        samples[i].imag += noise_gain*randn();
+    }
+    /*    
+    fprintf(stderr, "sig_pwr: %f f->sig_pwr_av: %e target_snr_linear: %f noise_pwr_4000Hz: %e noise_gain: %e\n", 
+            sig_pwr, f->sig_pwr_av, target_snr_linear, noise_pwr_4000Hz, noise_gain);
+    */
+}
diff --git a/codec2/tags/0.4/src/fdmdv_channel.c b/codec2/tags/0.4/src/fdmdv_channel.c
new file mode 100644 (file)
index 0000000..e4d87cb
--- /dev/null
@@ -0,0 +1,103 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_channel.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: 2 August 2014
+                                                                             
+  Given an input raw file (8kHz, 16 bit shorts) of FDMDV modem
+  samples, adds channel impairments and outputs to another raw file.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fdmdv.h"
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin, *fout;
+    short         rx_fdm_buf[FDMDV_NOM_SAMPLES_PER_FRAME];
+    COMP          rx_fdm[FDMDV_NOM_SAMPLES_PER_FRAME];
+    struct FDMDV *fdmdv;
+    float         snrdB, sam;
+    int           i;
+
+    if (argc < 3) {
+       printf("usage: %s InputModemRawFile OutputModemRawFile SNRdB\n", argv[0]);
+       printf("e.g    %s test_in.raw test_out.raw 4\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input modem sample file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output modem sample file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    snrdB = atof(argv[3]);
+    fdmdv = fdmdv_create(FDMDV_NC);
+
+    while(fread(rx_fdm_buf, sizeof(short), FDMDV_NOM_SAMPLES_PER_FRAME, fin) == FDMDV_NOM_SAMPLES_PER_FRAME) {
+        
+       for(i=0; i<FDMDV_NOM_SAMPLES_PER_FRAME; i++) {
+           rx_fdm[i].real = (float)rx_fdm_buf[i]/FDMDV_SCALE;
+            rx_fdm[i].imag = 0.0;
+        }
+
+        /* real signal so we adjust SNR to suit.  I think.  I always get confused by this! */
+
+        fdmdv_simulate_channel(fdmdv, rx_fdm, FDMDV_NOM_SAMPLES_PER_FRAME, snrdB - 3.0); 
+
+       for(i=0; i<FDMDV_NOM_SAMPLES_PER_FRAME; i++) {
+           sam = FDMDV_SCALE*rx_fdm[i].real;
+            if (sam >  32767.0) sam =  32767.0;
+            if (sam < -32767.0) sam = -32767.0;
+            rx_fdm_buf[i] = sam;
+        }
+
+        fwrite(rx_fdm_buf, sizeof(short), FDMDV_NOM_SAMPLES_PER_FRAME, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    fclose(fin);
+    fclose(fout);
+    fdmdv_destroy(fdmdv);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/fdmdv_demod.c b/codec2/tags/0.4/src/fdmdv_demod.c
new file mode 100644 (file)
index 0000000..98762ee
--- /dev/null
@@ -0,0 +1,246 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_demod.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 30 2012
+                                                                             
+  Given an input raw file (8kHz, 16 bit shorts) of FDMDV modem samples
+  outputs a file of bits.  The output file is assumed to be arranged
+  as codec frames of 56 bits (7 bytes) which are received as two 28
+  bit modem frames.
+
+  Demod states can be optionally logged to an Octave file for display
+  using the Octave script fdmdv_demod_c.m.  This is useful for
+  checking demod performance.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fdmdv.h"
+#include "octave.h"
+#include "freedv_api.h"
+
+/* lof of information we want to dump to Octave */
+
+#define MAX_FRAMES 50*60 /* 1 minute at 50 symbols/s */
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin, *fout;
+    struct FDMDV *fdmdv;
+    char         *packed_bits;
+    int          *rx_bits;
+    int          *codec_bits;
+    COMP          rx_fdm[FDMDV_MAX_SAMPLES_PER_FRAME];
+    short         rx_fdm_scaled[FDMDV_MAX_SAMPLES_PER_FRAME];
+    int           i, bit, byte, c;
+    int           nin, nin_prev;
+    int           sync_bit = 0, reliable_sync_bit;
+    int           sync = 0;
+    int           f;
+    FILE         *foct = NULL;
+    struct MODEM_STATS stats;
+    COMP         *rx_fdm_log;
+    int           rx_fdm_log_col_index;
+    COMP         *rx_symbols_log;
+    int           sync_log[MAX_FRAMES];
+    float         rx_timing_log[MAX_FRAMES];
+    float         foff_log[MAX_FRAMES];
+    int           sync_bit_log[MAX_FRAMES];
+    int           rx_bits_log[FDMDV_BITS_PER_FRAME*MAX_FRAMES];
+    float         snr_est_log[MAX_FRAMES];
+    float        *rx_spec_log;
+    int           max_frames_reached;
+    int           bits_per_fdmdv_frame;
+    int           bits_per_codec_frame;
+    int           bytes_per_codec_frame;
+    int           Nc;
+
+    if (argc < 2) {
+       printf("usage: %s InputModemRawFile OutputBitFile [Nc [OctaveDumpFile]]\n", argv[0]);
+       printf("e.g    %s hts1a_fdmdv.raw hts1a.c2\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input modem sample file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output bit file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (argc >= 4) {
+        Nc = atoi(argv[3]);
+
+        if ((Nc < 2) || (Nc > FDMDV_NC_MAX) ) {
+            fprintf(stderr, "Error number of carriers must be between 2 and %d\n",  FDMDV_NC_MAX);
+            exit(1);
+        }
+    }
+    else
+        Nc = FDMDV_NC;
+    
+    fdmdv = fdmdv_create(Nc);
+    modem_stats_open(&stats);
+
+    bits_per_fdmdv_frame = fdmdv_bits_per_frame(fdmdv);
+    bits_per_codec_frame = 2*fdmdv_bits_per_frame(fdmdv);
+    bytes_per_codec_frame = (bits_per_codec_frame+7)/8;
+
+    /* malloc some buffers that are dependant on Nc */
+
+    packed_bits = (char*)malloc(bytes_per_codec_frame); assert(packed_bits != NULL);
+    rx_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame); assert(rx_bits != NULL);
+    codec_bits = (int*)malloc(2*sizeof(int)*bits_per_fdmdv_frame); assert(codec_bits != NULL);
+
+    /* malloc some of the larger variables to prevent out of stack problems */
+
+    rx_fdm_log = (COMP*)malloc(sizeof(COMP)*FDMDV_MAX_SAMPLES_PER_FRAME*MAX_FRAMES);
+    assert(rx_fdm_log != NULL);
+    rx_spec_log = (float*)malloc(sizeof(float)*MODEM_STATS_NSPEC*MAX_FRAMES);
+    assert(rx_spec_log != NULL);
+    rx_symbols_log = (COMP*)malloc(sizeof(COMP)*(Nc+1)*MAX_FRAMES);
+    assert(rx_fdm_log != NULL);
+
+    f = 0;
+    nin = FDMDV_NOM_SAMPLES_PER_FRAME;
+    rx_fdm_log_col_index = 0;
+    max_frames_reached = 0;
+
+    while(fread(rx_fdm_scaled, sizeof(short), nin, fin) == nin)
+    {
+       for(i=0; i<nin; i++) {
+           rx_fdm[i].real = (float)rx_fdm_scaled[i]/FDMDV_SCALE;
+            rx_fdm[i].imag = 0;
+        }
+       nin_prev = nin;
+       fdmdv_demod(fdmdv, rx_bits, &reliable_sync_bit, rx_fdm, &nin);
+
+       /* log data for optional Octave dump */
+
+       if (f < MAX_FRAMES) {
+           fdmdv_get_demod_stats(fdmdv, &stats);
+
+           /* log modem states for later dumping to Octave log file */
+
+           memcpy(&rx_fdm_log[rx_fdm_log_col_index], rx_fdm, sizeof(COMP)*nin_prev);
+           rx_fdm_log_col_index += nin_prev;
+
+           for(c=0; c<Nc+1; c++)
+               rx_symbols_log[f*(Nc+1)+c] = stats.rx_symbols[0][c];
+           foff_log[f] = stats.foff;
+           rx_timing_log[f] = stats.rx_timing;
+           sync_log[f] = stats.sync;
+           sync_bit_log[f] = sync_bit;
+           memcpy(&rx_bits_log[bits_per_fdmdv_frame*f], rx_bits, sizeof(int)*bits_per_fdmdv_frame);
+           snr_est_log[f] = stats.snr_est;
+
+           modem_stats_get_rx_spectrum(&stats, &rx_spec_log[f*MODEM_STATS_NSPEC], rx_fdm, nin_prev);
+
+           f++;
+       }
+       
+       if ((f == MAX_FRAMES) && !max_frames_reached) {
+           fprintf(stderr,"MAX_FRAMES exceed in Octave log, log truncated\n");
+           max_frames_reached = 1;
+       }
+
+        if (reliable_sync_bit)
+            sync = 1;
+        //printf("sync_bit: %d reliable_sync_bit: %d sync: %d\n", sync_bit, reliable_sync_bit, sync);
+
+        if (sync == 0) {
+            memcpy(codec_bits, rx_bits, bits_per_fdmdv_frame*sizeof(int));
+            sync = 1;
+        }
+        else {
+            memcpy(&codec_bits[bits_per_fdmdv_frame], rx_bits, bits_per_fdmdv_frame*sizeof(int));
+
+            /* pack bits, MSB received first  */
+
+            bit = 7; byte = 0;
+            memset(packed_bits, 0, bytes_per_codec_frame);
+            for(i=0; i<bits_per_codec_frame; i++) {
+                packed_bits[byte] |= (codec_bits[i] << bit);
+                bit--;
+                if (bit < 0) {
+                    bit = 7;
+                    byte++;
+                }
+            }
+
+            fwrite(packed_bits, sizeof(char), bytes_per_codec_frame, fout);
+            sync = 0;
+        }
+           
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    /* Optional dump to Octave log file */
+
+    if (argc == 5) {
+
+       if ((foct = fopen(argv[4],"wt")) == NULL ) {
+           fprintf(stderr, "Error opening Octave dump file: %s: %s.\n",
+               argv[4], strerror(errno));
+           exit(1);
+       }
+       octave_save_complex(foct, "rx_fdm_log_c", rx_fdm_log, 1, rx_fdm_log_col_index, FDMDV_MAX_SAMPLES_PER_FRAME);  
+       octave_save_complex(foct, "rx_symbols_log_c", (COMP*)rx_symbols_log, Nc+1, f, MAX_FRAMES);  
+       octave_save_float(foct, "foff_log_c", foff_log, 1, f, MAX_FRAMES);  
+       octave_save_float(foct, "rx_timing_log_c", rx_timing_log, 1, f, MAX_FRAMES);  
+       octave_save_int(foct, "sync_log_c", sync_log, 1, f);  
+       octave_save_int(foct, "rx_bits_log_c", rx_bits_log, 1, bits_per_fdmdv_frame*f);
+       octave_save_int(foct, "sync_bit_log_c", sync_bit_log, 1, f);  
+       octave_save_float(foct, "snr_est_log_c", snr_est_log, 1, f, MAX_FRAMES);  
+       octave_save_float(foct, "rx_spec_log_c", rx_spec_log, f, MODEM_STATS_NSPEC, MODEM_STATS_NSPEC);  
+       fclose(foct);
+    }
+
+    //fdmdv_dump_osc_mags(fdmdv);
+
+    fclose(fin);
+    fclose(fout);
+    free(rx_fdm_log);
+    free(rx_spec_log);
+    fdmdv_destroy(fdmdv);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/fdmdv_get_test_bits.c b/codec2/tags/0.4/src/fdmdv_get_test_bits.c
new file mode 100644 (file)
index 0000000..d04eeab
--- /dev/null
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_get_test_bits.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: 1 May 2012
+                                                                             
+  Generates a file of packed test bits, useful for input to fdmdv_mod.
+
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fdmdv.h"
+
+int main(int argc, char *argv[])
+{
+    FILE         *fout;
+    struct FDMDV *fdmdv;
+    char          *packed_bits;
+    int           *tx_bits;
+    int           n, i, bit, byte;
+    int           numBits, nCodecFrames;
+    int           bits_per_fdmdv_frame;
+    int           bits_per_codec_frame;
+    int           bytes_per_codec_frame;
+    int           Nc;
+
+    if (argc < 3) {
+       printf("usage: %s OutputBitFile numBits [Nc]\n", argv[0]);
+       printf("e.g    %s test.c2 1400\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[1],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output bit file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    numBits = atoi(argv[2]);
+
+    if (argc == 4) {
+        Nc = atoi(argv[3]);
+        if ((Nc < 2) || (Nc > FDMDV_NC_MAX) ) {
+            fprintf(stderr, "Error number of carriers must be btween 2 and %d\n",  FDMDV_NC_MAX);
+            exit(1);
+        }
+    }
+    else
+        Nc = FDMDV_NC;
+
+    fdmdv = fdmdv_create(Nc);
+
+    bits_per_fdmdv_frame = fdmdv_bits_per_frame(fdmdv);
+    bits_per_codec_frame = 2*fdmdv_bits_per_frame(fdmdv);
+    bytes_per_codec_frame = (bits_per_codec_frame+7)/8;
+    fprintf(stderr, "bits_per_fdmdv_frame: %d bits_per_codec_frame: %d bytes_per_codec_frame: %d\n",
+            bits_per_fdmdv_frame, bits_per_codec_frame, bytes_per_codec_frame);
+
+    packed_bits = (char*)malloc(bytes_per_codec_frame);
+    assert(packed_bits != NULL);
+    tx_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame);
+    assert(tx_bits != NULL);
+
+    nCodecFrames = numBits/bits_per_codec_frame;
+
+    for(n=0; n<nCodecFrames; n++) {
+
+       fdmdv_get_test_bits(fdmdv, tx_bits);
+       fdmdv_get_test_bits(fdmdv, &tx_bits[bits_per_fdmdv_frame]);
+       
+       /* pack bits, MSB received first  */
+
+       bit = 7; byte = 0;
+       memset(packed_bits, 0, bytes_per_codec_frame);
+       for(i=0; i<bits_per_codec_frame; i++) {
+           packed_bits[byte] |= (tx_bits[i] << bit);
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+
+       fwrite(packed_bits, sizeof(char), bytes_per_codec_frame, fout);
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+    }
+
+    free(tx_bits);
+    free(packed_bits);
+    fclose(fout);
+    fdmdv_destroy(fdmdv);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/fdmdv_interleave.c b/codec2/tags/0.4/src/fdmdv_interleave.c
new file mode 100644 (file)
index 0000000..beb98ec
--- /dev/null
@@ -0,0 +1,164 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_interleave.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: May 27 2012
+                                                                             
+  Given an input file of bits outputs an interleaved or optionally
+  de-intervleaved file of bits.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fdmdv.h"
+
+#define MAX_INTERLEAVER 10000
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin, *fout, *finter;
+    int          interleaver[MAX_INTERLEAVER];
+    char         *packed_bits;
+    int          *bits;
+    int          *interleaved_bits;
+    int           i, bit, byte, m, mpacked, frames, interleave, src_bit, dest_bit;
+
+    if (argc < 4) {
+       printf("usage: %s InputBitFile OutputBitFile InterleaverFile [de]\n", argv[0]);
+       printf("e.g    %s hts1a.c2 hts1a_interleaved.c2 interleaver.txt\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output bit file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if ((finter = fopen(argv[3],"rt")) == NULL ) {
+       fprintf(stderr, "Error opening interleaver file: %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+
+    if (argc == 5)
+       interleave = 1;
+    else
+       interleave = 0;
+
+    /* load interleaver, size determines block size we will process */
+
+    src_bit = 0;
+    while(fscanf(finter, "%d\n", &dest_bit) == 1) {
+       if (interleave)
+           interleaver[dest_bit] = src_bit;
+       else
+           interleaver[src_bit] = dest_bit;
+           
+       src_bit++;
+       if (src_bit == MAX_INTERLEAVER) {
+           fprintf(stderr, "Error interleaver too big\n");
+           exit(1);
+       }       
+    }
+    fclose(finter);
+
+    m = src_bit;
+    fprintf(stderr, "Interleaver size m = %d  interleave = %d\n", m, interleave);
+    assert((m%8) == 0);
+    mpacked = m/8;
+
+    packed_bits = (char*)malloc(mpacked*sizeof(char));
+    assert(packed_bits != NULL);
+    bits = (int*)malloc(m*sizeof(int));
+    assert(bits != NULL);
+    interleaved_bits = (int*)malloc(m*sizeof(int));
+    assert(interleaved_bits != NULL);
+
+    frames = 0;
+
+    while(fread(packed_bits, sizeof(char), mpacked, fin) == mpacked) {
+       frames++;
+       
+       /* unpack bits, MSB first */
+
+       bit = 7; byte = 0;
+       for(i=0; i<m; i++) {
+           bits[i] = (packed_bits[byte] >> bit) & 0x1;
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+       assert(byte == mpacked);
+
+       /* (de) interleave */
+
+       for(i=0; i<m; i++)
+           interleaved_bits[i] = bits[interleaver[i]];
+
+       /* pack bits, MSB sent first  */
+
+       bit = 7; byte = 0;
+       memset(packed_bits, 0, mpacked);
+       for(i=0; i<m; i++) {
+           packed_bits[byte] |= (interleaved_bits[i] << bit);
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+       assert(byte == mpacked);
+
+       fwrite(packed_bits, sizeof(char), mpacked, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    free(packed_bits);
+    free(bits);
+    free(interleaved_bits);
+
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/fdmdv_internal.h b/codec2/tags/0.4/src/fdmdv_internal.h
new file mode 100644 (file)
index 0000000..7491177
--- /dev/null
@@ -0,0 +1,190 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_internal.h
+  AUTHOR......: David Rowe
+  DATE CREATED: April 16 2012
+                                                                             
+  Header file for FDMDV internal functions, exposed via this header
+  file for testing.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __FDMDV_INTERNAL__
+#define __FDMDV_INTERNAL__
+
+#include "comp.h"
+#include "codec2_fdmdv.h"
+#include "kiss_fft.h"
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+#define PI             3.141592654
+#define FS                    8000  /* sample rate in Hz                                                    */
+#define T                 (1.0/FS)  /* sample period in seconds                                             */
+#define RS                      50  /* symbol rate in Hz                                                    */
+#define NC                      20  /* max number of data carriers (plus one pilot in the centre)           */
+#define NB                       2  /* Bits/symbol for QPSK modulation                                      */
+#define RB              (NC*RS*NB)  /* bit rate                                                             */
+#define M                  (FS/RS)  /* oversampling factor                                                  */
+#define NSYM                     6  /* number of symbols to filter over                                     */
+#define NFILTER            (NSYM*M) /* size of tx/rx filters at sample rate M                               */
+
+#define FSEP                    75  /* Default separation between carriers (Hz)                             */
+
+#define NT                       5  /* number of symbols we estimate timing over                            */
+#define P                        4  /* oversample factor used for initial rx symbol filtering output        */
+#define Q                     (M/4) /* oversample factor used for initial rx symbol filtering input         */
+#define NRXDEC                  31  /* number of taps in the rx decimation filter                           */
+
+#define NPILOT_LUT                 (4*M)    /* number of pilot look up table samples                 */
+#define NPILOTCOEFF                   30    /* number of FIR filter coeffs in LP filter              */
+#define NPILOTBASEBAND (NPILOTCOEFF+M+M/P)  /* number of pilot baseband samples reqd for pilot LPF   */
+#define NPILOTLPF                  (4*M)    /* number of samples we DFT pilot over, pilot est window */
+#define MPILOTFFT                    256
+
+#define NSYNC_MEM                6
+
+/* averaging filter coeffs */
+
+#define TRACK_COEFF              0.5
+#define SNR_COEFF                0.9       /* SNR est averaging filter coeff */
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               STRUCT for States
+
+\*---------------------------------------------------------------------------*/
+
+struct FDMDV {
+
+    int   Nc;           
+    float fsep;
+
+    /* test data (test frame) states */
+
+    int  ntest_bits;
+    int  current_test_bit;
+    int *rx_test_bits_mem;
+
+    /* Modulator */
+
+    int   old_qpsk_mapping;
+    int   tx_pilot_bit;
+    COMP  prev_tx_symbols[NC+1];
+    COMP  tx_filter_memory[NC+1][NSYM];
+    COMP  phase_tx[NC+1];
+    COMP  freq[NC+1];
+    float freq_pol[NC+1];
+  
+    /* Pilot generation at demodulator */
+
+    COMP pilot_lut[NPILOT_LUT];
+    int  pilot_lut_index;
+    int  prev_pilot_lut_index;
+
+    /* freq offset estimation states */
+
+    kiss_fft_cfg fft_pilot_cfg;             
+    COMP pilot_baseband1[NPILOTBASEBAND];
+    COMP pilot_baseband2[NPILOTBASEBAND];
+    COMP pilot_lpf1[NPILOTLPF];
+    COMP pilot_lpf2[NPILOTLPF];
+    COMP S1[MPILOTFFT];
+    COMP S2[MPILOTFFT];
+
+    /* baseband to low IF carrier states */
+
+    COMP  fbb_rect;
+    float fbb_pol;
+    COMP  fbb_phase_tx;
+    COMP  fbb_phase_rx;
+
+    /* freq offset correction states */
+
+    float foff;
+    COMP foff_phase_rect;
+    float filt;
+
+    /* Demodulator */
+
+    COMP  rxdec_lpf_mem[NRXDEC-1+M]; 
+    COMP  rx_fdm_mem[NFILTER+M]; 
+    COMP  phase_rx[NC+1];
+    COMP  rx_filter_mem_timing[NC+1][NT*P];
+    float rx_timing;
+    COMP  phase_difference[NC+1];
+    COMP  prev_rx_symbols[NC+1];
+    
+    /* sync state machine */
+
+    int  sync_mem[NSYNC_MEM];
+    int  fest_state;
+    int  sync;
+    int  timer;
+
+    /* SNR estimation states */
+
+    float sig_est[NC+1];
+    float noise_est[NC+1];
+
+    /* channel simulation */
+
+    float sig_pwr_av;
+};
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                              FUNCTION PROTOTYPES
+
+\*---------------------------------------------------------------------------*/
+
+void bits_to_dqpsk_symbols(COMP tx_symbols[], int Nc, COMP prev_tx_symbols[], int tx_bits[], int *pilot_bit, int old_qpsk_mapping);
+void tx_filter(COMP tx_baseband[NC+1][M], int Nc, COMP tx_symbols[], COMP tx_filter_memory[NC+1][NSYM]);
+void fdm_upconvert(COMP tx_fdm[], int Nc, COMP tx_baseband[NC+1][M], COMP phase_tx[], COMP freq_tx[],
+                   COMP *fbb_phase, COMP fbb_rect);
+void tx_filter_and_upconvert(COMP tx_fdm[], int Nc, COMP tx_symbols[], 
+                             COMP tx_filter_memory[NC+1][NSYM],
+                             COMP phase_tx[], COMP freq[], COMP *fbb_phase, COMP fbb_rect);
+void generate_pilot_fdm(COMP *pilot_fdm, int *bit, float *symbol, float *filter_mem, COMP *phase, COMP *freq);
+void generate_pilot_lut(COMP pilot_lut[], COMP *pilot_freq);
+float rx_est_freq_offset(struct FDMDV *f, COMP rx_fdm[], int nin, int do_fft);
+void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], COMP pilot_lpf[], kiss_fft_cfg fft_pilot_cfg, COMP S[], int nin, int do_fft);
+void fdm_downconvert(COMP rx_baseband[NC+1][M+M/P], int Nc, COMP rx_fdm[], COMP phase_rx[], COMP freq[], int nin);
+void rxdec_filter(COMP rx_fdm_filter[], COMP rx_fdm[], COMP rxdec_lpf_mem[], int nin);
+void rx_filter(COMP rx_filt[NC+1][P+1], int Nc, COMP rx_baseband[NC+1][M+M/P], COMP rx_filter_memory[NC+1][NFILTER], int nin);
+void down_convert_and_rx_filter(COMP rx_filt[NC+1][P+1], int Nc, COMP rx_fdm[], 
+                                COMP rx_fdm_mem[], COMP phase_rx[], COMP freq[], 
+                                float freq_pol[], int nin, int dec_rate);
+float rx_est_timing(COMP  rx_symbols[], int Nc, 
+                   COMP  rx_filt[NC+1][P+1], 
+                   COMP  rx_filter_mem_timing[NC+1][NT*P], 
+                   float env[],
+                   int   nin,
+                    int   m);   
+float qpsk_to_bits(int rx_bits[], int *sync_bit, int Nc, COMP phase_difference[], COMP prev_rx_symbols[], COMP rx_symbols[], int old_qpsk_mapping);
+void snr_update(float sig_est[], float noise_est[], int Nc, COMP phase_difference[]);
+int freq_state(int *reliable_sync_bit, int sync_bit, int *state, int *timer, int *sync_mem);
+float calc_snr(int Nc, float sig_est[], float noise_est[]);
+
+#endif
diff --git a/codec2/tags/0.4/src/fdmdv_mod.c b/codec2/tags/0.4/src/fdmdv_mod.c
new file mode 100644 (file)
index 0000000..5fac650
--- /dev/null
@@ -0,0 +1,159 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_mod.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 28 2012
+                                                                             
+  Given an input file of bits outputs a raw file (8kHz, 16 bit shorts)
+  of FDMDV modem samples ready to send over a HF radio channel.  The
+  input file is assumed to be arranged as codec frames of 56 bits (7
+  bytes) which we send as two 28 bit modem frames.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fdmdv.h"
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin, *fout;
+    struct FDMDV *fdmdv;
+    char          *packed_bits;
+    int           *tx_bits;
+    COMP          tx_fdm[2*FDMDV_NOM_SAMPLES_PER_FRAME];
+    short         tx_fdm_scaled[2*FDMDV_NOM_SAMPLES_PER_FRAME];
+    int           frames;
+    int           i, bit, byte;
+    int           sync_bit;
+    int           bits_per_fdmdv_frame;
+    int           bits_per_codec_frame;
+    int           bytes_per_codec_frame;
+    int           Nc;
+    COMP          foff_phase_rect;
+    float         foff;
+
+    if (argc < 3) {
+       printf("usage: %s InputBitFile OutputModemRawFile [Nc]\n", argv[0]);
+       printf("e.g    %s hts1a.c2 hts1a_fdmdv.raw\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output modem sample file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (argc == 4) {
+        Nc = atoi(argv[3]);
+
+        if ((Nc < 2) || (Nc > FDMDV_NC_MAX) ) {
+            fprintf(stderr, "Error number of carriers must be btween 2 and %d\n",  FDMDV_NC_MAX);
+            exit(1);
+        }
+   }
+    else
+        Nc = FDMDV_NC;
+
+    fdmdv = fdmdv_create(Nc);
+
+    bits_per_fdmdv_frame = fdmdv_bits_per_frame(fdmdv);
+    bits_per_codec_frame = 2*fdmdv_bits_per_frame(fdmdv);
+    bytes_per_codec_frame = (bits_per_codec_frame+7)/8;
+
+    packed_bits = (char*)malloc(bytes_per_codec_frame);
+    assert(packed_bits != NULL);
+    tx_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame);
+    assert(tx_bits != NULL);
+
+    foff = -100;
+    foff_phase_rect.real = 1.0; foff_phase_rect.imag = 0.0; 
+
+    frames = 0;
+
+    while(fread(packed_bits, sizeof(char), bytes_per_codec_frame, fin) == bytes_per_codec_frame) {
+       frames++;
+       
+       /* unpack bits, MSB first */
+
+       bit = 7; byte = 0;
+       for(i=0; i<bits_per_codec_frame; i++) {
+           tx_bits[i] = (packed_bits[byte] >> bit) & 0x1;
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+
+       /* modulate even and odd frames */
+
+       fdmdv_mod(fdmdv, tx_fdm, tx_bits, &sync_bit);
+       assert(sync_bit == 1);
+
+       fdmdv_mod(fdmdv, &tx_fdm[FDMDV_NOM_SAMPLES_PER_FRAME], &tx_bits[bits_per_fdmdv_frame], &sync_bit);
+       assert(sync_bit == 0);
+
+        #ifdef CHANNEL_SIM
+        /* optional freq shift and channel simulation */
+
+        fdmdv_freq_shift(tx_fdm, tx_fdm, foff, &foff_phase_rect, 2*FDMDV_NOM_SAMPLES_PER_FRAME);
+        fdmdv_simulate_channel(&sig_pwr_av, tx_fdm, 2*FDMDV_NOM_SAMPLES_PER_FRAME, 10.0);
+        #endif
+
+       /* scale and save to disk as shorts */
+
+       for(i=0; i<2*FDMDV_NOM_SAMPLES_PER_FRAME; i++)
+           tx_fdm_scaled[i] = FDMDV_SCALE * tx_fdm[i].real;
+
+       fwrite(tx_fdm_scaled, sizeof(short), 2*FDMDV_NOM_SAMPLES_PER_FRAME, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    //fdmdv_dump_osc_mags(fdmdv);
+
+    free(tx_bits);
+    free(packed_bits);
+    fclose(fin);
+    fclose(fout);
+    fdmdv_destroy(fdmdv);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/fdmdv_put_test_bits.c b/codec2/tags/0.4/src/fdmdv_put_test_bits.c
new file mode 100644 (file)
index 0000000..5add4ab
--- /dev/null
@@ -0,0 +1,169 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_put_test_bits.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: 1 May 2012
+                                                                             
+  Using a file of packed test bits as input, determines bit error
+  rate.  Useful for testing fdmdv_demod.
+
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fdmdv.h"
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin;
+    struct FDMDV *fdmdv;
+    char         *packed_bits;
+    int          *rx_bits;
+    int           i, bit, byte;
+    int           test_frame_sync, bit_errors, total_bit_errors, total_bits, ntest_bits;
+    int           test_frame_sync_state, test_frame_count;
+    int           bits_per_fdmdv_frame;
+    int           bits_per_codec_frame;
+    int           bytes_per_codec_frame;
+    int           Nc;
+    short        *error_pattern;
+
+    if (argc < 2) {
+       printf("usage: %s InputBitFile [Nc]\n", argv[0]);
+       printf("e.g    %s test.c2\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-") == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (argc == 3) {
+        Nc = atoi(argv[2]);
+        if ((Nc < 2) || (Nc > FDMDV_NC_MAX) ) {
+            fprintf(stderr, "Error number of carriers must be between 2 and %d\n",  FDMDV_NC_MAX);
+            exit(1);
+        }
+    }
+    else
+        Nc = FDMDV_NC;
+
+    fdmdv = fdmdv_create(Nc);
+
+    bits_per_fdmdv_frame = fdmdv_bits_per_frame(fdmdv);
+    bits_per_codec_frame = 2*fdmdv_bits_per_frame(fdmdv);
+    bytes_per_codec_frame = (bits_per_codec_frame+7)/8;
+    fprintf(stderr, "bits_per_fdmdv_frame: %d bits_per_codec_frame: %d bytes_per_codec_frame: %d\n",
+            bits_per_fdmdv_frame, bits_per_codec_frame, bytes_per_codec_frame);
+
+    packed_bits = (char*)malloc(bytes_per_codec_frame);
+    assert(packed_bits != NULL);
+    rx_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame);
+    assert(rx_bits != NULL);
+
+    error_pattern = (short*)malloc(fdmdv_error_pattern_size(fdmdv)*sizeof(int));
+    assert(error_pattern != NULL);
+
+    total_bit_errors = 0;
+    total_bits = 0;
+    test_frame_sync_state = 0;
+    test_frame_count = 0;
+
+    while(fread(packed_bits, sizeof(char), bytes_per_codec_frame, fin) == bytes_per_codec_frame) {
+       /* unpack bits, MSB first */
+
+       bit = 7; byte = 0;
+       for(i=0; i<bits_per_codec_frame; i++) {
+           rx_bits[i] = (packed_bits[byte] >> bit) & 0x1;
+           //printf("%d 0x%x %d\n", i, packed_bits[byte], rx_bits[i]);
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+
+       fdmdv_put_test_bits(fdmdv, &test_frame_sync, error_pattern, &bit_errors, &ntest_bits, rx_bits);
+
+       if (test_frame_sync == 1) {
+           test_frame_sync_state = 1;
+            test_frame_count = 0;
+        }
+
+        if (test_frame_sync_state) {
+            if (test_frame_count == 0) {
+                total_bit_errors += bit_errors;
+                total_bits = total_bits + ntest_bits;
+                printf("+");
+            }
+            else
+                printf("-");
+            test_frame_count++;
+            if (test_frame_count == 4)
+                test_frame_count = 0;
+       }
+        else
+            printf("-");
+
+       fdmdv_put_test_bits(fdmdv, &test_frame_sync,  error_pattern, &bit_errors, &ntest_bits, &rx_bits[bits_per_fdmdv_frame]);
+
+       if (test_frame_sync == 1) {
+           test_frame_sync_state = 1;
+            test_frame_count = 0;
+        }
+
+        if (test_frame_sync_state) {
+            if (test_frame_count == 0) {
+                total_bit_errors += bit_errors;
+                total_bits = total_bits + ntest_bits;
+                printf("+");
+            }
+            else
+                printf("-");
+            test_frame_count++;
+            if (test_frame_count == 4)
+                test_frame_count = 0;
+       }
+       else
+           printf("-");
+       
+       /* if this is in a pipeline, we probably don't want the usual
+          buffering to occur */
+
+        if (fin == stdin) fflush(stdin);
+    }
+
+    fclose(fin);
+    free(error_pattern);
+    fdmdv_destroy(fdmdv);
+
+    printf("\nbits %d  errors %d  BER %1.4f\n", total_bits, total_bit_errors, (float)total_bit_errors/(1E-6+total_bits) );
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/fec_dec.c b/codec2/tags/0.4/src/fec_dec.c
new file mode 100644 (file)
index 0000000..350b011
--- /dev/null
@@ -0,0 +1,307 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: fec_dec.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 4 march 2013
+
+  FEC decoder for data from modem containing compressed Codec 2 data
+  and FEC.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 "codec2.h"
+#include "codec2_fdmdv.h"
+#include "golay23.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#define MODE_1600 0
+#define MODE_1850 1
+#define MODE_2000 2
+
+int main(int argc, char *argv[])
+{
+    void          *codec2, *fdmdv;
+    FILE          *fin;
+    FILE          *fout;
+    int            bits_per_input_frame, bytes_per_input_frame;
+    unsigned char *packed_input_bits;
+    int           *unpacked_input_bits;
+    int            bits_per_output_frame, bytes_per_output_frame;
+    unsigned char *packed_output_bits;
+    int           *unpacked_output_bits;
+    int            codec2_mode, mode, Nc, bit, byte;
+    int            i,j;
+    int            recd_codeword, codeword1, codeword2;
+
+    if (argc < 3) {
+       printf("%s InputFromModemWithFECFile OutputToCodec2File [2000|1600]\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input file from Demod: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output file to Codec : %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+
+    /* input parameters and buffers. Note data is split into two 20ms
+       frames for transmission over modem. */
+
+    if ((argc != 4) || (strcmp(argv[3],"2000") == 0)) {
+        /* 2000 bit/s with FEC */
+        mode = MODE_2000;
+       codec2_mode = CODEC2_MODE_1400;
+        Nc = 20;
+    } else if ((strcmp(argv[3],"1850") == 0)) {
+        /* 1850 bit/s with FEC */
+        mode = MODE_1850;
+       codec2_mode = CODEC2_MODE_1300;
+        Nc = 20;
+    }
+    else if (strcmp(argv[3],"1600") == 0) {
+        /* 1600 bit/s with FEC (actually 1575 with one spare) */
+        mode = MODE_1600;
+       codec2_mode = CODEC2_MODE_1300;
+        Nc = 16;
+    }
+    else {
+       fprintf(stderr, "Error in mode: %s.  Must be 2000 or 1600\n", argv[3]);
+       exit(1);
+    }
+
+    fdmdv = fdmdv_create(Nc);
+
+    bits_per_input_frame = 2*fdmdv_bits_per_frame(fdmdv);
+    bytes_per_input_frame = bits_per_input_frame / 8;
+    assert((bits_per_input_frame % 8) == 0); /* make sure integer number of bytes per frame */
+
+    packed_input_bits = (unsigned char*)malloc(bytes_per_input_frame*sizeof(char));
+    assert(packed_input_bits != NULL);
+    unpacked_input_bits = (int*)malloc(bits_per_input_frame*sizeof(int));
+    assert(unpacked_input_bits != NULL);
+
+    /* 
+       Output parameters and buffers.
+    */
+
+    codec2 = codec2_create(codec2_mode);
+
+    bits_per_output_frame = codec2_bits_per_frame(codec2);
+    bytes_per_output_frame = (bits_per_output_frame+7)/8;
+
+    packed_output_bits = (unsigned char*)malloc(bytes_per_output_frame*sizeof(char));
+    assert(packed_output_bits != NULL);
+    unpacked_output_bits = (int*)malloc(bits_per_output_frame*sizeof(int));
+    assert(unpacked_output_bits != NULL);
+    
+    fprintf(stderr, "input bits: %d  input_bytes: %d  output_bits: %d  output_bytes: %d\n",
+            bits_per_input_frame,  bytes_per_input_frame, bits_per_output_frame,  bytes_per_output_frame);
+
+    /* main loop */
+
+    golay23_init();
+
+    while(fread(packed_input_bits, sizeof(char), bytes_per_input_frame, fin) == (size_t)bytes_per_input_frame) {
+
+       /* unpack bits, MSB first */
+
+       bit = 7; byte = 0;
+       for(i=0; i<bits_per_input_frame; i++) {
+           unpacked_input_bits[i] = (packed_input_bits[byte] >> bit) & 0x1;
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+
+        #ifdef TEST
+        /* Some test bit errors (not comprehesnive) */
+        unpacked_input_bits[0] = (unpacked_input_bits[0] ^ 1) & 0x1;
+        unpacked_input_bits[23] = (unpacked_input_bits[23] ^ 1) & 0x1;
+        #endif
+
+        if (mode == MODE_2000) {
+            /* decode first codeword */
+
+            recd_codeword = 0;
+            for(i=0; i<12; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=bits_per_output_frame; i<bits_per_output_frame+11; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            codeword1 = golay23_decode(recd_codeword);
+            //codeword1 = recd_codeword;
+            //fprintf(stderr, "received codeword1: 0x%x  decoded codeword1: 0x%x\n", recd_codeword, codeword1);
+
+            for(i=0; i<12; i++) {
+                unpacked_output_bits[i] = (codeword1 >> (22-i)) & 0x1;
+            }
+
+            /* decode second codeword */
+
+            recd_codeword = 0;
+            for(i=12; i<24; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=bits_per_output_frame+11; i<bits_per_output_frame+11+11; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            codeword2 = golay23_decode(recd_codeword);
+            //codeword2 = recd_codeword;
+            //fprintf(stderr, "received codeword2: 0x%x  decoded codeword2: 0x%x\n", recd_codeword, codeword2);
+
+            for(i=0; i<12; i++) {
+                unpacked_output_bits[12+i] = (codeword2 >> (22-i)) & 0x1;
+            }
+
+            /* unprotected bits */
+
+            for(i=24; i<bits_per_output_frame; i++)
+                unpacked_output_bits[i] = unpacked_input_bits[i];
+        }
+        if (mode == MODE_1600) {
+            recd_codeword = 0;
+            for(i=0; i<8; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=11; i<15; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=bits_per_output_frame; i<bits_per_output_frame+11; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            codeword1 = golay23_decode(recd_codeword);
+            //codeword1 = recd_codeword;
+            //fprintf(stderr, "received codeword1: 0x%x  decoded codeword1: 0x%x\n", recd_codeword, codeword1);
+           
+            for(i=0; i<bits_per_output_frame; i++)
+                unpacked_output_bits[i] = unpacked_input_bits[i];
+
+            for(i=0; i<8; i++) {
+                unpacked_output_bits[i] = (codeword1 >> (22-i)) & 0x1;
+            }
+            for(i=8,j=11; i<12; i++,j++) {
+                unpacked_output_bits[j] = (codeword1 >> (22-i)) & 0x1;
+            }
+        }
+
+        if (mode == MODE_1850) {
+            recd_codeword = 0;
+            for(i=0; i<8; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=11; i<15; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=bits_per_output_frame; i<bits_per_output_frame+11; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            codeword1 = golay23_decode(recd_codeword);
+            //codeword1 = recd_codeword;
+            //fprintf(stderr, "received codeword1: 0x%x  decoded codeword1: 0x%x\n", recd_codeword, codeword1);
+           
+            recd_codeword = 0;
+            for(i=16; i<28; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            for(i=bits_per_output_frame+11; i<bits_per_output_frame+11+11; i++) {
+                recd_codeword <<= 1;
+                recd_codeword |= unpacked_input_bits[i];
+            }
+            codeword2 = golay23_decode(recd_codeword);
+            fprintf(stderr, "received codeword2: 0x%x  decoded codeword2: 0x%x\n", recd_codeword, codeword2);
+          
+            for(i=0; i<bits_per_output_frame; i++)
+                unpacked_output_bits[i] = unpacked_input_bits[i];
+            
+            for(i=0; i<8; i++) {
+                unpacked_output_bits[i] = (codeword1 >> (22-i)) & 0x1;
+            }
+            for(i=8,j=11; i<12; i++,j++) {
+                unpacked_output_bits[j] = (codeword1 >> (22-i)) & 0x1;
+            }
+            for(i=0,j=16; i<12; i++,j++) {
+                unpacked_output_bits[j] = (codeword2 >> (22-i)) & 0x1;
+            }
+            
+        }
+
+        /* pack bits, MSB first  */
+
+        bit = 7; byte = 0;
+        memset(packed_output_bits, 0, bytes_per_output_frame);
+        for(i=0; i<bits_per_output_frame; i++) {
+            packed_output_bits[byte] |= (unpacked_output_bits[i] << bit);
+            bit--;
+            if (bit < 0) {
+                bit = 7;
+                byte++;
+            }
+        }
+        
+       fwrite(packed_output_bits, sizeof(char), bytes_per_output_frame, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+           buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    codec2_destroy(codec2);
+    fdmdv_destroy(fdmdv);
+
+    free(packed_input_bits);
+    free(unpacked_input_bits);
+    free(packed_output_bits);
+    free(unpacked_output_bits);
+
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/fec_enc.c b/codec2/tags/0.4/src/fec_enc.c
new file mode 100644 (file)
index 0000000..a26731f
--- /dev/null
@@ -0,0 +1,312 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: fec_enc.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 4 march 2013
+
+  Encodes compressed Codec 2 data using FEC.  This initial version
+  assumes 1400 bit/s Codec 2 input data (56 bit, 40ms frames), with 80
+  bit frame outpout, suitable for 20 carrier, 2000 bit/s modem.  In
+  future other experimental schemes may be supported.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 "codec2.h"
+#include "codec2_fdmdv.h"
+#include "golay23.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#define MODE_1600 0
+#define MODE_1850 1
+#define MODE_2000 2
+
+int main(int argc, char *argv[])
+{
+    void          *codec2, *fdmdv;
+    FILE          *fin;
+    FILE          *fout;
+    int            bits_per_input_frame, bytes_per_input_frame;
+    unsigned char *packed_input_bits;
+    int           *unpacked_input_bits;
+    int            bits_per_output_frame, bytes_per_output_frame;
+    unsigned char *packed_output_bits;
+    int           *unpacked_output_bits;
+    int            codec2_mode, mode, Nc, bit, byte;
+    int            i,j;
+    int            data, codeword1, codeword2;
+
+    if (argc < 3) {
+       printf("%s InputFromCodecFile OutputToModemWithFECFile [2000|1850|1600]\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input file from Codec: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output file : %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+
+    if ((argc != 4) || (strcmp(argv[3],"2000") == 0)) {
+        /* 2000 bit/s with FEC */
+        mode = MODE_2000;
+       codec2_mode = CODEC2_MODE_1400;
+        Nc = 20;
+    } else if ((strcmp(argv[3],"1850") == 0)) {
+        /* 1850 bit/s with FEC */
+        mode = MODE_1850;
+       codec2_mode = CODEC2_MODE_1300;
+        Nc = 20;
+    }
+    else if (strcmp(argv[3],"1600") == 0) {
+        /* 1600 bit/s with FEC (actually 1575 with one spare) */
+        mode = MODE_1600;
+       codec2_mode = CODEC2_MODE_1300;
+        Nc = 16;
+    }
+    else {
+       fprintf(stderr, "Error in mode: %s.  Must be 2000, 1850, or 1600\n", argv[3]);
+       exit(1);
+    }
+    
+    /* input parameters and buffers */
+
+    codec2 = codec2_create(codec2_mode);
+
+    bits_per_input_frame = codec2_bits_per_frame(codec2);
+    bytes_per_input_frame = (bits_per_input_frame + 7)/8;
+
+    packed_input_bits = (unsigned char*)malloc(bytes_per_input_frame*sizeof(char));
+    assert(packed_input_bits != NULL);
+    unpacked_input_bits = (int*)malloc(bits_per_input_frame*sizeof(int));
+    assert(unpacked_input_bits != NULL);
+
+    /* 
+       Output parameters and buffers.  Data is split into two 20ms
+       frames for transmission over modem, but this doesn't really
+       bother us here, as fdmdv_mod takes care of that.
+    */
+
+    fdmdv = fdmdv_create(Nc);
+
+    bits_per_output_frame = 2*fdmdv_bits_per_frame(fdmdv);
+    bytes_per_output_frame = (bits_per_output_frame+7)/8;
+
+    packed_output_bits = (unsigned char*)malloc(bytes_per_output_frame*sizeof(char));
+    assert(packed_output_bits != NULL);
+    unpacked_output_bits = (int*)malloc(bits_per_output_frame*sizeof(int));
+    assert(unpacked_output_bits != NULL);
+    
+    fprintf(stderr, "mode: %d  Nc: %d\n", mode, Nc);
+    fprintf(stderr, "input bits: %d  input_bytes: %d  output_bits: %d  output_bytes: %d\n",
+            bits_per_input_frame,  bytes_per_input_frame, bits_per_output_frame,  bytes_per_output_frame);
+
+    /* main loop */
+
+    golay23_init();
+
+    while(fread(packed_input_bits, sizeof(char), bytes_per_input_frame, fin) == (size_t)bytes_per_input_frame) {
+
+       /* unpack bits, MSB first */
+
+       bit = 7; byte = 0;
+       for(i=0; i<bits_per_input_frame; i++) {
+           unpacked_input_bits[i] = (packed_input_bits[byte] >> bit) & 0x1;
+           bit--;
+           if (bit < 0) {
+               bit = 7;
+               byte++;
+           }
+       }
+
+        /* add FEC  ---------------------------------------------------------*/
+
+        if (mode == MODE_2000) {
+            /* Protect first 24 bits with (23,12) Golay Code.  The first
+               24 bits are the most sensitive, as they contain the
+               pitch/energy VQ and voicing bits. This uses 56 + 11 + 11 =
+               78 bits, so we have two spare in 80 bit frame sent to
+               modem. */
+
+            /* first codeword */
+
+            data = 0;
+            for(i=0; i<12; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            codeword1 = golay23_encode(data);
+            //fprintf(stderr, "data1: 0x%x codeword1: 0x%x\n", data, codeword1);
+
+            /* second codeword */
+
+            data = 0;
+            for(i=12; i<24; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            codeword2 = golay23_encode(data);
+            //fprintf(stderr, "data: 0x%x codeword2: 0x%x\n", data, codeword2);
+
+            /* now pack output frame with parity bits at end to make them
+               as far apart as possible from the data the protect.  Parity
+               bits are LSB of the Golay codeword */
+
+            for(i=0; i<bits_per_input_frame; i++)
+                unpacked_output_bits[i] = unpacked_input_bits[i];
+            for(j=0; i<bits_per_input_frame+11; i++,j++) {
+                unpacked_output_bits[i] = (codeword1 >> (10-j)) & 0x1;
+            }
+            for(j=0; i<bits_per_input_frame+11+11; i++,j++) {
+                unpacked_output_bits[i] = (codeword2 >> (10-j)) & 0x1;
+            }
+        }
+
+        if (mode == MODE_1850) {
+
+            /* Protect first 12 out of first 16 excitation bits with (23,12) Golay Code:
+
+               0,1,2,3: v[0]..v[1]
+               4,5,6,7: MSB of pitch
+               11,12,13,14: MSB of energy
+
+            */
+
+            data = 0;
+            for(i=0; i<8; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            for(i=11; i<15; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            codeword1 = golay23_encode(data);
+
+            /* Protect first 12 LSP bits with (23,12) Golay Code */
+
+            data = 0;
+            for(i=16; i<28; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            codeword2 = golay23_encode(data);
+            fprintf(stderr, "codeword2: 0x0%x\n", codeword2);
+            
+            /* now pack output frame with parity bits at end to make them
+               as far apart as possible from the data they protect.  Parity
+               bits are LSB of the Golay codeword */
+
+            for(i=0; i<bits_per_input_frame; i++)
+                unpacked_output_bits[i] = unpacked_input_bits[i];
+            for(j=0; i<bits_per_input_frame+11; i++,j++) {
+                unpacked_output_bits[i] = (codeword1 >> (10-j)) & 0x1;
+                unpacked_output_bits[i+11] = (codeword2 >> (10-j)) & 0x1;
+            }
+            for(i=bits_per_input_frame+11+11; i<bits_per_output_frame; i++)
+                unpacked_output_bits[i] = 0;
+        }
+
+        if (mode == MODE_1600) {
+
+            /* Protect first 12 out of first 16 excitation bits with (23,12) Golay Code:
+
+               0,1,2,3: v[0]..v[1]
+               4,5,6,7: MSB of pitch
+               11,12,13,14: MSB of energy
+
+            */
+
+            data = 0;
+            for(i=0; i<8; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            for(i=11; i<15; i++) {
+                data <<= 1;
+                data |= unpacked_input_bits[i];
+            }
+            codeword1 = golay23_encode(data);
+
+            /* now pack output frame with parity bits at end to make them
+               as far apart as possible from the data they protect.  Parity
+               bits are LSB of the Golay codeword */
+
+            for(i=0; i<bits_per_input_frame; i++)
+                unpacked_output_bits[i] = unpacked_input_bits[i];
+            for(j=0; i<bits_per_input_frame+11; i++,j++) {
+                unpacked_output_bits[i] = (codeword1 >> (10-j)) & 0x1;
+            }
+            unpacked_output_bits[i] = 0; /* spare bit */
+
+            //for(i=0; i<bits_per_input_frame+12; i++)
+            //    printf("%d\n", unpacked_output_bits[i]);
+
+        }
+
+        /* pack bits, MSB first  */
+
+        bit = 7; byte = 0;
+        memset(packed_output_bits, 0, bytes_per_output_frame);
+        for(i=0; i<bits_per_output_frame; i++) {
+            assert((unpacked_output_bits[i] == 0) || (unpacked_output_bits[i] == 1));
+            packed_output_bits[byte] |= (unpacked_output_bits[i] << bit);
+            bit--;
+            if (bit < 0) {
+                bit = 7;
+                byte++;
+            }
+        }
+        assert(byte == bytes_per_output_frame);
+        
+       fwrite(packed_output_bits, sizeof(char), bytes_per_output_frame, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+           buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    codec2_destroy(codec2);
+    fdmdv_destroy(fdmdv);
+
+    free(packed_input_bits);
+    free(unpacked_input_bits);
+    free(packed_output_bits);
+    free(unpacked_output_bits);
+
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/fifo.c b/codec2/tags/0.4/src/fifo.c
new file mode 100644 (file)
index 0000000..566d77a
--- /dev/null
@@ -0,0 +1,142 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fifo.c
+  AUTHOR......: David Rowe
+  DATE CREATED: Oct 15 2012
+                                                                             
+  A FIFO design useful in gluing the FDMDV modem and codec together in
+  integrated applications.  The unittest/tfifo indicates these
+  routines are thread safe without the need for syncronisation
+  object, e.g. a different thread can read and write to a fifo at the
+  same time.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "codec2_fifo.h"
+
+struct FIFO {
+    short *buf;
+    short *pin;
+    short *pout;
+    int    nshort;
+};
+
+struct FIFO *fifo_create(int nshort) {
+    struct FIFO *fifo;
+
+    fifo = (struct FIFO *)malloc(sizeof(struct FIFO));
+    assert(fifo != NULL);
+
+    fifo->buf = (short*)malloc(sizeof(short)*nshort);
+    assert(fifo->buf != NULL);
+    fifo->pin = fifo->buf;
+    fifo->pout = fifo->buf;
+    fifo->nshort = nshort;
+
+    return fifo;
+}
+
+void fifo_destroy(struct FIFO *fifo) {
+    assert(fifo != NULL);
+    free(fifo->buf);
+    free(fifo);
+}
+
+int fifo_write(struct FIFO *fifo, short data[], int n) {
+    int            i;
+    int            fifo_free;
+    short         *pdata;
+    short         *pin = fifo->pin;
+
+    assert(fifo != NULL);
+    assert(data != NULL);
+
+    // available storage is one less than nshort as prd == pwr
+    // is reserved for empty rather than full
+
+    fifo_free = fifo->nshort - fifo_used(fifo) - 1;
+
+    if (n > fifo_free) {
+       return -1;
+    }
+    else {
+
+       /* This could be made more efficient with block copies
+          using memcpy */
+
+       pdata = data;
+       for(i=0; i<n; i++) {
+           *pin++ = *pdata++;
+           if (pin == (fifo->buf + fifo->nshort))
+               pin = fifo->buf;
+       }
+       fifo->pin = pin;
+    }
+
+    return 0;
+}
+
+int fifo_read(struct FIFO *fifo, short data[], int n)
+{
+    int            i;
+    short         *pdata;
+    short         *pout = fifo->pout;
+
+    assert(fifo != NULL);
+    assert(data != NULL);
+    if (n > fifo_used(fifo)) {
+       return -1;
+    }
+    else {
+
+       /* This could be made more efficient with block copies
+          using memcpy */
+
+       pdata = data;
+       for(i=0; i<n; i++) {
+           *pdata++ = *pout++;
+           if (pout == (fifo->buf + fifo->nshort))
+               pout = fifo->buf;
+       }
+       fifo->pout = pout;
+    }
+
+    return 0;
+}
+
+int fifo_used(struct FIFO *fifo)
+{
+    short         *pin = fifo->pin;
+    short         *pout = fifo->pout;
+    unsigned int   used;
+
+    assert(fifo != NULL);
+    if (pin >= pout)
+        used = pin - pout;
+    else
+        used = fifo->nshort + (unsigned int)(pin - pout);
+
+    return used;
+}
+
diff --git a/codec2/tags/0.4/src/fm.c b/codec2/tags/0.4/src/fm.c
new file mode 100644 (file)
index 0000000..bdccd8a
--- /dev/null
@@ -0,0 +1,195 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fm.c
+  AUTHOR......: David Rowe
+  DATE CREATED: February 2015
+                                                                             
+  Functions that implement analog FM modulation and demodulation, see
+  also octave/fm.m.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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/>.
+*/
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+#define FILT_MEM 200
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               INCLUDES
+
+\*---------------------------------------------------------------------------*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "codec2_fm.h"
+#include "fm_fir_coeff.h"
+#include "comp_prim.h"
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fm_create           
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 24 Feb 2015
+
+  Create and initialise an instance of the "modem".  Returns a pointer
+  to the modem states or NULL on failure.  One set of states is
+  sufficient for a full duplex modem.
+
+\*---------------------------------------------------------------------------*/
+
+struct FM *fm_create(int nsam)
+{
+    struct FM *fm;
+
+    fm = (struct FM*)malloc(sizeof(struct FM));
+    if (fm == NULL)
+       return NULL;
+    fm->rx_bb = (COMP*)malloc(sizeof(COMP)*(FILT_MEM+nsam));
+    assert(fm->rx_bb != NULL);
+
+    fm->rx_bb_filt_prev.real = 0.0;
+    fm->rx_bb_filt_prev.imag = 0.0;
+    fm->lo_phase.real = 1.0;
+    fm->lo_phase.imag = 0.0;
+
+    fm->rx_dem_mem = (float*)malloc(sizeof(float)*(FILT_MEM+nsam));
+    assert(fm->rx_dem_mem != NULL);
+
+    fm->nsam = nsam;
+
+    return fm;
+}
+
+
+void fm_destroy(struct FM *fm_states)
+{
+    free(fm_states->rx_bb);
+    free(fm_states->rx_dem_mem);
+    free(fm_states);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fm_demod            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 24 Feb 2015
+
+  Demodulate a FM signal to baseband audio.
+
+\*---------------------------------------------------------------------------*/
+
+void fm_demod(struct FM *fm_states, float rx_out[], float rx[])
+{
+  float  Fs = fm_states->Fs;
+  float  fc = fm_states->fc; 
+  float  wc = 2*M_PI*fc/Fs;
+  float  fd = fm_states->fd; 
+  float  wd = 2*M_PI*fd/Fs;
+  COMP  *rx_bb = fm_states->rx_bb + FILT_MEM;
+  COMP   wc_rect, rx_bb_filt, rx_bb_diff;
+  float  rx_dem, acc;
+  float *rx_dem_mem = fm_states->rx_dem_mem + FILT_MEM;
+  int    nsam = fm_states->nsam;
+  float  mag;
+  int    i,k;
+
+  wc_rect.real = cosf(wc); wc_rect.imag = -sinf(wc);
+
+  for(i=0; i<nsam; i++) {
+
+      /* down to complex baseband */
+
+      fm_states->lo_phase = cmult(fm_states->lo_phase, wc_rect);
+      rx_bb[i] = fcmult(rx[i], fm_states->lo_phase);      
+
+      /* input FIR filter */
+
+      rx_bb_filt.real = 0.0; rx_bb_filt.imag = 0.0;
+      
+      for(k=0; k<FILT_MEM/2; k++) {
+          rx_bb_filt.real += rx_bb[i-k].real * bin[k+FILT_MEM/4];
+          rx_bb_filt.imag += rx_bb[i-k].imag * bin[k+FILT_MEM/4];
+      }
+      
+      //rx_bb_filt = rx_bb[i];
+      //printf("%f %f %f\n", rx[i], wc_rect.real, wc_rect.imag);
+      //printf("%f %f %f\n", rx[i], fm_states->lo_phase.real, fm_states->lo_phase.imag);
+      //printf("%f %f %f\n", rx[i], rx_bb[i].real, rx_bb[i].imag);
+      //printf("%f %f\n", rx_bb_filt.real, rx_bb_filt.imag);
+      /* 
+         Differentiate first, in rect domain, then find angle, this
+         puts signal on the positive side of the real axis and helps
+         atan2() behaive.
+      */
+
+      rx_bb_diff = cmult(rx_bb_filt, cconj(fm_states->rx_bb_filt_prev));
+      fm_states->rx_bb_filt_prev = rx_bb_filt;
+  
+      rx_dem = atan2f(rx_bb_diff.imag, rx_bb_diff.real);
+
+      /* limit maximum phase jumps, to remove static type noise at low SNRs */
+
+      if (rx_dem > wd)
+          rx_dem = wd;
+      if (rx_dem < -wd)
+          rx_dem = -wd;
+
+      rx_dem *= (1/wd);
+      //printf("%f %f\n", rx_bb_diff.real, rx_bb_diff.imag);
+      rx_dem_mem[i] = rx_dem;
+      acc = 0;
+      /*
+        for(k=0; k<FILT_MEM; k++) {
+          acc += rx_dem_mem[i-k] * bout[k];
+      }
+      */
+      rx_out[i] = rx_dem;
+  }
+
+  /* update filter memories */
+
+  rx_bb      -= FILT_MEM;
+  rx_dem_mem -= FILT_MEM;
+  for(i=0; i<FILT_MEM; i++) {
+      rx_bb[i] = rx_bb[i+nsam];
+      rx_dem_mem[i] = rx_dem_mem[i+nsam];
+  }
+
+  /* normalise digital oscillator as the magnitude can drift over time */
+
+  mag = cabsolute(fm_states->lo_phase);
+  fm_states->lo_phase.real /= mag;     
+  fm_states->lo_phase.imag /= mag;     
+
+}
diff --git a/codec2/tags/0.4/src/fm_demod.c b/codec2/tags/0.4/src/fm_demod.c
new file mode 100644 (file)
index 0000000..8042df6
--- /dev/null
@@ -0,0 +1,92 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fm_demod.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: Feb 24 2015
+                                                                             
+  Given an input raw file (44.4 kHz, 16 bit shorts) with a FM signal centered 
+  11.1 kHz, outputs a file of demodulated audio samples.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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, 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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#include "codec2_fm.h"
+#include "octave.h"
+
+#define N 160
+
+int main(int argc, char *argv[])
+{
+    FILE         *fin, *fout;
+    struct FM    *fm;
+    short         buf[N];
+    float         rx[N];
+    float         rx_out[N];
+    int           i;
+
+    if (argc < 2) {
+       printf("usage: %s InputFMRawFile OutputSpeechRawFile\n", argv[0]);
+       printf("e.g    %s fm.raw fm_demodulated.raw\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    fm         = fm_create(N);
+    fm->Fs     = 44400.0;
+    fm->fm_max = 3000.0;
+    fm->fd     = 5000.0;
+    fm->fc     = fm->Fs/4;
+
+    while(fread(buf, sizeof(short), N, fin) == N) {
+       for(i=0; i<N; i++) {
+           rx[i] = buf[i];
+        }
+        fm_demod(fm, rx_out, rx);
+       for(i=0; i<N; i++) {
+           buf[i] = 16384*rx_out[i];
+        }
+        fwrite(buf, sizeof(short), N, fout);
+    }
+
+    fm_destroy(fm);
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/fm_fir_coeff.h b/codec2/tags/0.4/src/fm_fir_coeff.h
new file mode 100644 (file)
index 0000000..e96926e
--- /dev/null
@@ -0,0 +1,413 @@
+/* Generated by fm_fir_coeff_file() Octave function in fm.m */
+
+const float bin[]={
+  4.79309e-05,
+  1.1306e-05,
+  -5.5983e-05,
+  -7.01194e-05,
+  7.06484e-06,
+  9.92193e-05,
+  8.58591e-05,
+  -4.54326e-05,
+  -0.000152003,
+  -8.65645e-05,
+  0.000107704,
+  0.000207915,
+  6.24307e-05,
+  -0.000194905,
+  -0.000256788,
+  -3.72067e-06,
+  0.000303862,
+  0.000285027,
+  -9.75377e-05,
+  -0.000426141,
+  -0.000276571,
+  0.000245596,
+  0.00054748,
+  0.000214543,
+  -0.000438995,
+  -0.000647904,
+  -8.35097e-05,
+  0.000668808,
+  0.000702715,
+  -0.000127804,
+  -0.000917433,
+  -0.000684399,
+  0.000423605,
+  0.00115821,
+  0.000565432,
+  -0.000798262,
+  -0.00135608,
+  -0.000321829,
+  0.00123404,
+  0.00146953,
+  -6.28411e-05,
+  -0.00169975,
+  -0.00145365,
+  0.000593351,
+  0.00215057,
+  0.00126444,
+  -0.00125906,
+  -0.00252937,
+  -0.000863858,
+  0.00203097,
+  0.00276961,
+  0.000225378,
+  -0.00286002,
+  -0.00279968,
+  0.00066048,
+  0.00367697,
+  0.00254856,
+  -0.00178121,
+  -0.00439398,
+  -0.00195226,
+  0.00309842,
+  0.00490791,
+  0.000960678,
+  -0.0045454,
+  -0.00510509,
+  0.000456067,
+  0.00602631,
+  0.00486678,
+  -0.00230217,
+  -0.00741688,
+  -0.00407467,
+  0.00455244,
+  0.00856596,
+  0.0026148,
+  -0.00715072,
+  -0.0092966,
+  -0.000377815,
+  0.0100109,
+  0.00940383,
+  -0.00274808,
+  -0.0130204,
+  -0.00864357,
+  0.00689875,
+  0.0160465,
+  0.0066998,
+  -0.0122874,
+  -0.0189444,
+  -0.0030966,
+  0.0193367,
+  0.0215669,
+  -0.00304913,
+  -0.0290487,
+  -0.0237748,
+  0.0138493,
+  0.0443198,
+  0.0254471,
+  -0.0364426,
+  -0.0771407,
+  -0.0264901,
+  0.120993,
+  0.285249,
+  0.366844,
+  0.285249,
+  0.120993,
+  -0.0264901,
+  -0.0771407,
+  -0.0364426,
+  0.0254471,
+  0.0443198,
+  0.0138493,
+  -0.0237748,
+  -0.0290487,
+  -0.00304913,
+  0.0215669,
+  0.0193367,
+  -0.0030966,
+  -0.0189444,
+  -0.0122874,
+  0.0066998,
+  0.0160465,
+  0.00689875,
+  -0.00864357,
+  -0.0130204,
+  -0.00274808,
+  0.00940383,
+  0.0100109,
+  -0.000377815,
+  -0.0092966,
+  -0.00715072,
+  0.0026148,
+  0.00856596,
+  0.00455244,
+  -0.00407467,
+  -0.00741688,
+  -0.00230217,
+  0.00486678,
+  0.00602631,
+  0.000456067,
+  -0.00510509,
+  -0.0045454,
+  0.000960678,
+  0.00490791,
+  0.00309842,
+  -0.00195226,
+  -0.00439398,
+  -0.00178121,
+  0.00254856,
+  0.00367697,
+  0.00066048,
+  -0.00279968,
+  -0.00286002,
+  0.000225378,
+  0.00276961,
+  0.00203097,
+  -0.000863858,
+  -0.00252937,
+  -0.00125906,
+  0.00126444,
+  0.00215057,
+  0.000593351,
+  -0.00145365,
+  -0.00169975,
+  -6.28411e-05,
+  0.00146953,
+  0.00123404,
+  -0.000321829,
+  -0.00135608,
+  -0.000798262,
+  0.000565432,
+  0.00115821,
+  0.000423605,
+  -0.000684399,
+  -0.000917433,
+  -0.000127804,
+  0.000702715,
+  0.000668808,
+  -8.35097e-05,
+  -0.000647904,
+  -0.000438995,
+  0.000214543,
+  0.00054748,
+  0.000245596,
+  -0.000276571,
+  -0.000426141,
+  -9.75377e-05,
+  0.000285027,
+  0.000303862,
+  -3.72067e-06,
+  -0.000256788,
+  -0.000194905,
+  6.24307e-05,
+  0.000207915,
+  0.000107704,
+  -8.65645e-05,
+  -0.000152003,
+  -4.54326e-05,
+  8.58591e-05,
+  9.92193e-05,
+  7.06484e-06,
+  -7.01194e-05,
+  -5.5983e-05,
+  1.1306e-05,
+  4.79309e-05
+};
+
+const float bout[]={
+  -0.000901664,
+  -0.00105423,
+  -0.00102202,
+  -0.000796428,
+  -0.0004047,
+  9.24929e-05,
+  0.000610043,
+  0.00105267,
+  0.00133217,
+  0.00138452,
+  0.00118367,
+  0.000749102,
+  0.000145346,
+  -0.000527025,
+  -0.00114777,
+  -0.00159812,
+  -0.00178311,
+  -0.00165083,
+  -0.00120494,
+  -0.000507584,
+  0.000328412,
+  0.0011573,
+  0.00182538,
+  0.00219909,
+  0.00219097,
+  0.00177877,
+  0.00101358,
+  1.48175e-05,
+  -0.00104765,
+  -0.00198192,
+  -0.00260813,
+  -0.00279243,
+  -0.00247437,
+  -0.00168247,
+  -0.000534171,
+  0.000780521,
+  0.00202976,
+  0.00298006,
+  0.00343915,
+  0.00329371,
+  0.00253482,
+  0.00126569,
+  -0.000310763,
+  -0.00192329,
+  -0.00327808,
+  -0.0041113,
+  -0.00423916,
+  -0.00359628,
+  -0.00225463,
+  -0.000418452,
+  0.00160526,
+  0.00345676,
+  0.00478613,
+  0.00531776,
+  0.00490513,
+  0.00356541,
+  0.00148629,
+  -0.000997692,
+  -0.00345694,
+  -0.0054391,
+  -0.00654985,
+  -0.00652835,
+  -0.00530323,
+  -0.00301796,
+  -1.90046e-05,
+  0.00319335,
+  0.00604515,
+  0.00798756,
+  0.00859787,
+  0.00766479,
+  0.00524199,
+  0.001658,
+  -0.00252213,
+  -0.00658004,
+  -0.00976079,
+  -0.011405,
+  -0.0110744,
+  -0.00864874,
+  -0.00437487,
+  0.00114403,
+  0.00702171,
+  0.0122173,
+  0.0157018,
+  0.0166372,
+  0.0145415,
+  0.00940928,
+  0.00176699,
+  -0.00735151,
+  -0.0165112,
+  -0.0240533,
+  -0.0283208,
+  -0.027902,
+  -0.0218568,
+  -0.00988994,
+  0.0075553,
+  0.0293009,
+  0.0535398,
+  0.0780316,
+  0.100365,
+  0.118251,
+  0.129808,
+  0.143804,
+  0.129808,
+  0.118251,
+  0.100365,
+  0.0780316,
+  0.0535398,
+  0.0293009,
+  0.0075553,
+  -0.00988994,
+  -0.0218568,
+  -0.027902,
+  -0.0283208,
+  -0.0240533,
+  -0.0165112,
+  -0.00735151,
+  0.00176699,
+  0.00940928,
+  0.0145415,
+  0.0166372,
+  0.0157018,
+  0.0122173,
+  0.00702171,
+  0.00114403,
+  -0.00437487,
+  -0.00864874,
+  -0.0110744,
+  -0.011405,
+  -0.00976079,
+  -0.00658004,
+  -0.00252213,
+  0.001658,
+  0.00524199,
+  0.00766479,
+  0.00859787,
+  0.00798756,
+  0.00604515,
+  0.00319335,
+  -1.90046e-05,
+  -0.00301796,
+  -0.00530323,
+  -0.00652835,
+  -0.00654985,
+  -0.0054391,
+  -0.00345694,
+  -0.000997692,
+  0.00148629,
+  0.00356541,
+  0.00490513,
+  0.00531776,
+  0.00478613,
+  0.00345676,
+  0.00160526,
+  -0.000418452,
+  -0.00225463,
+  -0.00359628,
+  -0.00423916,
+  -0.0041113,
+  -0.00327808,
+  -0.00192329,
+  -0.000310763,
+  0.00126569,
+  0.00253482,
+  0.00329371,
+  0.00343915,
+  0.00298006,
+  0.00202976,
+  0.000780521,
+  -0.000534171,
+  -0.00168247,
+  -0.00247437,
+  -0.00279243,
+  -0.00260813,
+  -0.00198192,
+  -0.00104765,
+  1.48175e-05,
+  0.00101358,
+  0.00177877,
+  0.00219097,
+  0.00219909,
+  0.00182538,
+  0.0011573,
+  0.000328412,
+  -0.000507584,
+  -0.00120494,
+  -0.00165083,
+  -0.00178311,
+  -0.00159812,
+  -0.00114777,
+  -0.000527025,
+  0.000145346,
+  0.000749102,
+  0.00118367,
+  0.00138452,
+  0.00133217,
+  0.00105267,
+  0.000610043,
+  9.24929e-05,
+  -0.0004047,
+  -0.000796428,
+  -0.00102202,
+  -0.00105423,
+  -0.000901664
+};
diff --git a/codec2/tags/0.4/src/fq20.sh b/codec2/tags/0.4/src/fq20.sh
new file mode 100755 (executable)
index 0000000..b83784b
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+# fq20.shsh
+# David Rowe 27 July 2010
+# 
+# Decode a file with fully quantised codec at 20ms frame rate
+
+../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec
+
diff --git a/codec2/tags/0.4/src/freedv_api.c b/codec2/tags/0.4/src/freedv_api.c
new file mode 100644 (file)
index 0000000..b6bc2d2
--- /dev/null
@@ -0,0 +1,882 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: freedv_api.c
+  AUTHOR......: David Rowe
+  DATE CREATED: August 2014
+                                                                             
+  Library of API functions that implement FreeDV "modes", useful for
+  embedding FreeDV in other programs.
+      
+  TODO:
+    [X] speex tx/rx works
+    [X] txt messages
+    [X] optional test tx framemode
+                                                                       
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "codec2.h"
+#include "codec2_fdmdv.h"
+#include "fdmdv_internal.h"
+#include "golay23.h"
+#include "varicode.h"
+#include "freedv_api.h"
+#include "freedv_api_internal.h"
+#include "comp_prim.h"
+
+#define VERSION     10 /* The API version number.  The first version is 10.  Increment if the API changes
+                           in a way that would require changes by the API user. */
+/*
+ * Version 10   Initial version August 2, 2015.
+ * Version 11   September
+ *              Changes go here.
+ *
+ */
+
+#define NORM_PWR  1.74   /* experimentally derived fudge factor so 1600 and 
+                            700 mode have the same tx power */
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_open
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 August 2014
+
+  Call this first to initialise.  Returns NULL if initialisation fails
+  (e.g. out of memory or mode not supported).
+
+\*---------------------------------------------------------------------------*/
+
+struct freedv *freedv_open(int mode) {
+    struct freedv *f;
+    int            Nc, codec2_mode, nbit, nbyte;
+    
+    if ((mode != FREEDV_MODE_1600) && (mode != FREEDV_MODE_700))
+        return NULL;
+    
+    f = (struct freedv*)malloc(sizeof(struct freedv));
+    if (f == NULL)
+        return NULL;
+    
+    f->mode = mode;
+    f->test_frames = f->smooth_symbols = 0;
+    f->freedv_put_error_pattern = NULL;
+    f->error_pattern_callback_state = NULL;
+   
+    if (mode == FREEDV_MODE_1600) {
+        f->snr_squelch_thresh = 2.0;
+        f->squelch_en = 1;
+        Nc = 16;
+        f->tx_sync_bit = 0;
+        codec2_mode = CODEC2_MODE_1300;
+        f->fdmdv = fdmdv_create(Nc);
+        if (f->fdmdv == NULL)
+            return NULL;
+        golay23_init();
+        f->nin = FDMDV_NOM_SAMPLES_PER_FRAME;
+        f->n_nom_modem_samples = 2*FDMDV_NOM_SAMPLES_PER_FRAME;
+        f->n_max_modem_samples = FDMDV_NOM_SAMPLES_PER_FRAME+FDMDV_MAX_SAMPLES_PER_FRAME;
+        f->modem_sample_rate = FS;
+        nbit = fdmdv_bits_per_frame(f->fdmdv);
+        f->fdmdv_bits = (int*)malloc(nbit*sizeof(int));
+        if (f->fdmdv_bits == NULL)
+            return NULL;
+        nbit = 2*fdmdv_bits_per_frame(f->fdmdv);
+        f->tx_bits = (int*)malloc(nbit*sizeof(int));
+        f->rx_bits = (int*)malloc(nbit*sizeof(int));
+        if ((f->tx_bits == NULL) || (f->rx_bits == NULL))
+            return NULL;
+        f->evenframe = 0;
+        f->sz_error_pattern = fdmdv_error_pattern_size(f->fdmdv);
+    }
+
+    if (mode == FREEDV_MODE_700) {
+        f->snr_squelch_thresh = 0.0;
+        f->squelch_en = 0;
+        codec2_mode = CODEC2_MODE_700;
+        f->cohpsk = cohpsk_create();
+        f->nin = COHPSK_NOM_SAMPLES_PER_FRAME;
+        f->n_nom_modem_samples = COHPSK_NOM_SAMPLES_PER_FRAME;
+        f->n_max_modem_samples = COHPSK_MAX_SAMPLES_PER_FRAME;
+        f->modem_sample_rate = COHPSK_FS;                /* note wierd sample rate */
+        f->clip = 1;
+        nbit = COHPSK_BITS_PER_FRAME;
+        f->tx_bits = (int*)malloc(nbit*sizeof(int));
+        if (f->tx_bits == NULL)
+            return NULL;
+        f->sz_error_pattern = cohpsk_error_pattern_size();
+    }
+
+    f->test_frame_sync_state = 0;
+    f->total_bits = 0;
+    f->total_bit_errors = 0;
+
+    f->codec2 = codec2_create(codec2_mode);
+    if (f->codec2 == NULL)
+        return NULL;
+    if (mode == FREEDV_MODE_1600)
+        f->n_speech_samples = codec2_samples_per_frame(f->codec2);
+    if (mode == FREEDV_MODE_700)
+        f->n_speech_samples = 2*codec2_samples_per_frame(f->codec2);
+    f->prev_rx_bits = (float*)malloc(sizeof(float)*2*codec2_bits_per_frame(f->codec2));
+    if (f->prev_rx_bits == NULL)
+        return NULL;
+
+    nbit = codec2_bits_per_frame(f->codec2);
+    nbyte = (nbit + 7) / 8;
+    f->packed_codec_bits = (unsigned char*)malloc(nbyte*sizeof(char));
+    if (mode == FREEDV_MODE_1600)
+        f->codec_bits = (int*)malloc(nbit*sizeof(int));
+    if (mode == FREEDV_MODE_700)
+        f->codec_bits = (int*)malloc(COHPSK_BITS_PER_FRAME*sizeof(int));    
+
+    if ((f->packed_codec_bits == NULL) || (f->codec_bits == NULL))
+        return NULL;
+
+    varicode_decode_init(&f->varicode_dec_states, 1);
+    f->nvaricode_bits = 0;
+    f->varicode_bit_index = 0;
+    f->freedv_get_next_tx_char = NULL;
+    f->freedv_put_next_rx_char = NULL;
+
+    f->total_bit_errors = 0;
+    
+    return f;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_close
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 August 2014
+
+  Frees up memory.
+
+\*---------------------------------------------------------------------------*/
+
+void freedv_close(struct freedv *freedv) {
+    assert(freedv != NULL);
+
+    free(freedv->prev_rx_bits);
+    free(freedv->packed_codec_bits);
+    free(freedv->codec_bits);
+    free(freedv->tx_bits);
+    if (freedv->mode == FREEDV_MODE_1600)
+        fdmdv_destroy(freedv->fdmdv);
+    if (freedv->mode == FREEDV_MODE_700)
+        cohpsk_destroy(freedv->cohpsk);
+    codec2_destroy(freedv->codec2);
+    free(freedv);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_tx
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 August 2014
+
+  Takes a frame of input speech samples, encodes and modulates them to produce
+  a frame of modem samples that can be sent to the transmitter.
+
+  speech_in[] is sampled at 8 kHz, the user must supply
+  f->n_speech_samples. The speech_in[] level should be such that the
+  peak speech level is between +/16384 and +/- 32767.  
+
+  The FDM modem signal mod_out[] is sampled at f->modem_sample_rate
+  and is f->n_modem_samples long.  mod_out[] will be scaled such that
+  the peak level is just less than +/-32767.
+
+  The FreeDV 1600 modem has a high crest factor (around 12dB), however
+  the energy and duration of the peaks is small.  FreeDV 1600 is
+  usually operated at a "backoff" of 8dB.  Adjust the power
+  amplifier drive so that the average power is 8dB less than the
+  peak power of the PA.  For example, on a radio rated at 100W PEP for
+  SSB, the average FreeDV power is typically 20W.
+
+  The FreeDV 900 modem has a crest factor of about 5dB (with f->clip=1, the
+  default), so if your PA can handle it, it can be driven harder than
+  FreeDV 1600.  Caution - some PAs cannot handle a high continuous
+  power.  A conservative level is 20W average for a 100W PEP rated PA.
+
+\*---------------------------------------------------------------------------*/
+
+/* real-valued short sample output, useful for going straight to DAC */
+
+void freedv_tx(struct freedv *f, short mod_out[], short speech_in[]) {
+    assert(f != NULL);
+    COMP tx_fdm[f->n_nom_modem_samples];
+    int  i;
+
+    freedv_comptx(f, tx_fdm, speech_in);
+
+    for(i=0; i<f->n_nom_modem_samples; i++)
+        mod_out[i] = tx_fdm[i].real;
+}
+
+/* complex valued output, useful for suitable for single sided freq shifting */
+
+void freedv_comptx(struct freedv *f, COMP mod_out[], short speech_in[]) {
+    assert(f != NULL);
+    int    bit, byte, i, j, k;
+    int    bits_per_codec_frame, bits_per_modem_frame;
+    int    data, codeword1, data_flag_index;
+    COMP   tx_fdm[f->n_nom_modem_samples];
+     
+    assert((f->mode == FREEDV_MODE_1600) || (f->mode == FREEDV_MODE_700));
+
+    if (f->mode == FREEDV_MODE_1600) {
+        bits_per_codec_frame = codec2_bits_per_frame(f->codec2);
+        bits_per_modem_frame = fdmdv_bits_per_frame(f->fdmdv);
+
+        codec2_encode(f->codec2, f->packed_codec_bits, speech_in);
+
+        /* unpack bits, MSB first */
+
+        bit = 7; byte = 0;
+        for(i=0; i<bits_per_codec_frame; i++) {
+            f->codec_bits[i] = (f->packed_codec_bits[byte] >> bit) & 0x1;
+            bit--;
+            if (bit < 0) {
+                bit = 7;
+                byte++;
+            }
+        }
+    
+        // spare bit in frame that codec defines.  Use this 1
+        // bit/frame to send txt messages
+
+        data_flag_index = codec2_get_spare_bit_index(f->codec2);
+   
+        if (f->nvaricode_bits) {
+            f->codec_bits[data_flag_index] = f->tx_varicode_bits[f->varicode_bit_index++];
+            f->nvaricode_bits--;
+        } 
+    
+        if (f->nvaricode_bits == 0) {
+            /* get new char and encode */
+            char s[2];
+            if (f->freedv_get_next_tx_char != NULL) {
+                s[0] = (*f->freedv_get_next_tx_char)(f->callback_state);
+                f->nvaricode_bits = varicode_encode(f->tx_varicode_bits, s, VARICODE_MAX_BITS, 1, 1);
+                f->varicode_bit_index = 0;
+            }
+        }
+
+        /* Protect first 12 out of first 16 excitation bits with (23,12) Golay Code:
+
+           0,1,2,3: v[0]..v[1]
+           4,5,6,7: MSB of pitch
+           11,12,13,14: MSB of energy
+
+        */
+
+        data = 0;
+        for(i=0; i<8; i++) {
+            data <<= 1;
+            data |= f->codec_bits[i];
+        }
+        for(i=11; i<15; i++) {
+            data <<= 1;
+            data |= f->codec_bits[i];
+        }
+        codeword1 = golay23_encode(data);
+
+        /* now pack output frame with parity bits at end to make them
+           as far apart as possible from the data they protect.  Parity
+           bits are LSB of the Golay codeword */
+
+        for(i=0; i<bits_per_codec_frame; i++)
+            f->tx_bits[i] = f->codec_bits[i];
+        for(j=0; i<bits_per_codec_frame+11; i++,j++) {
+            f->tx_bits[i] = (codeword1 >> (10-j)) & 0x1;
+        }
+        f->tx_bits[i] = 0; /* spare bit */
+        /* optionally overwrite with test frames */
+
+        if (f->test_frames) {
+            fdmdv_get_test_bits(f->fdmdv, f->tx_bits);
+            fdmdv_get_test_bits(f->fdmdv, &f->tx_bits[bits_per_modem_frame]);
+            //fprintf(stderr, "test frames on tx\n");
+        }
+
+        /* modulate even and odd frames */
+
+        fdmdv_mod(f->fdmdv, tx_fdm, f->tx_bits, &f->tx_sync_bit);
+        assert(f->tx_sync_bit == 1);
+
+        fdmdv_mod(f->fdmdv, &tx_fdm[FDMDV_NOM_SAMPLES_PER_FRAME], &f->tx_bits[bits_per_modem_frame], &f->tx_sync_bit);
+        assert(f->tx_sync_bit == 0);
+
+        assert(2*FDMDV_NOM_SAMPLES_PER_FRAME == f->n_nom_modem_samples);
+
+        for(i=0; i<f->n_nom_modem_samples; i++)
+            mod_out[i] = fcmult(FDMDV_SCALE, tx_fdm[i]);
+    }
+
+
+    if (f->mode == FREEDV_MODE_700) {
+        bits_per_codec_frame = codec2_bits_per_frame(f->codec2);
+        bits_per_modem_frame = COHPSK_BITS_PER_FRAME;
+
+        for (j=0; j<bits_per_modem_frame; j+=bits_per_codec_frame) {
+            codec2_encode(f->codec2, f->packed_codec_bits, speech_in);
+            speech_in += codec2_samples_per_frame(f->codec2);
+
+            /* unpack bits, MSB first */
+
+            bit = 7; byte = 0;
+            for(i=0; i<bits_per_codec_frame; i++) {
+                f->codec_bits[j+i] = (f->packed_codec_bits[byte] >> bit) & 0x1;
+                bit--;
+                if (bit < 0) {
+                    bit = 7;
+                    byte++;
+                }
+            }
+        
+            // spare bits in frame that codec defines.  Use these 2
+            // bits/frame to send txt messages
+
+            data_flag_index = codec2_get_spare_bit_index(f->codec2);
+            
+            for(k=0; k<2; k++) {
+                if (f->nvaricode_bits) {
+                    f->codec_bits[j+data_flag_index+k] = f->tx_varicode_bits[f->varicode_bit_index++];
+                    //fprintf(stderr, "%d %d\n", j+data_flag_index+k, f->codec_bits[j+data_flag_index+k]);
+                    f->nvaricode_bits--;
+                } 
+    
+                if (f->nvaricode_bits == 0) {
+                    /* get new char and encode */
+                    char s[2];
+                    if (f->freedv_get_next_tx_char != NULL) {
+                        s[0] = (*f->freedv_get_next_tx_char)(f->callback_state);
+                        f->nvaricode_bits = varicode_encode(f->tx_varicode_bits, s, VARICODE_MAX_BITS, 1, 1);
+                        f->varicode_bit_index = 0;
+                    }
+                }
+            }
+
+        }
+            
+        /* optionally ovwerwrite the codec bits with test frames */
+
+        if (f->test_frames) {
+            cohpsk_get_test_bits(f->cohpsk, f->codec_bits);
+        }
+
+        /* cohpsk modulator */
+
+        cohpsk_mod(f->cohpsk, tx_fdm, f->codec_bits);
+        if (f->clip)
+            cohpsk_clip(tx_fdm);
+        for(i=0; i<f->n_nom_modem_samples; i++)
+            mod_out[i] = fcmult(FDMDV_SCALE*NORM_PWR, tx_fdm[i]);
+    }
+}
+
+int freedv_nin(struct freedv *f) {
+    return f->nin;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_rx
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 August 2014
+
+  Takes a frame of samples from the radio receiver, demodulates them,
+  then decodes them, producing a frame of decoded speech samples.  
+
+  Both demod_in[] and speech_out[] are 16 bit shorts sampled at 8 kHz.
+  The peak level of demod_in[] is not critical, as the demod works
+  well over a wide range of amplitude scaling.  However it is best to
+  avoid clipping (overload, or samples pinned to +/- 32767).  Suggest
+  scaling so the peak (modem signal plus noise) is between +/-16384
+  and +/-32767.  speech_out[] will peak at just less than +/-32767.
+
+  To account for difference in the transmit and receive sample clock
+  frequencies, the number of demod_in[] samples is time varying.  It
+  is the responsibility of the caller to supply the correct number of
+  samples.  Call freedv_nin() before each call to freedv_rx() to
+  determine how many samples to pass to this function (see example).
+
+  The maximum vlaue of freedv_nin is set by f->n_max_modem_samples,
+  allocate this much storage to your buffers.
+
+  Returns the number of output speech samples available in
+  speech_out[]. When in sync this will typically alternate between 0
+  and f->n_speech_samples.  When out of sync, this will be f->nin.  
+
+  When out of sync, this function echoes the demod_in[] samples to
+  speech_out[].  This allows the user to listen to the channel, which
+  is useful for tuning FreeDV signals or reception of non-FreeDV
+  signals.
+
+\*---------------------------------------------------------------------------*/
+
+
+// short version
+
+int freedv_rx(struct freedv *f, short speech_out[], short demod_in[]) {
+    assert(f != NULL);
+    COMP rx_fdm[f->n_max_modem_samples];
+    int i;
+
+    assert(f->nin <= f->n_max_modem_samples);
+
+    for(i=0; i<f->nin; i++) {
+        rx_fdm[i].real = (float)demod_in[i];
+        rx_fdm[i].imag = 0.0;
+    }
+
+    return freedv_comprx(f, speech_out, rx_fdm);    
+}
+
+
+// float input samples version
+
+int freedv_floatrx(struct freedv *f, short speech_out[], float demod_in[]) {
+    assert(f != NULL);
+    COMP rx_fdm[f->n_max_modem_samples];
+    int  i;
+
+    assert(f->nin <= f->n_max_modem_samples);
+
+    for(i=0; i<f->nin; i++) {
+        rx_fdm[i].real = demod_in[i];
+        rx_fdm[i].imag = 0;
+    }
+
+    return freedv_comprx(f, speech_out, rx_fdm);
+}
+
+// complex input samples version
+
+int freedv_comprx(struct freedv *f, short speech_out[], COMP demod_in[]) {
+    assert(f != NULL);
+    int                 bits_per_codec_frame, bytes_per_codec_frame, bits_per_fdmdv_frame;
+    int                 i, j, bit, byte, nin_prev, nout, k;
+    int                 recd_codeword, codeword1, data_flag_index, n_ascii;
+    short               abit[1];
+    char                ascii_out;
+    int                 reliable_sync_bit;
+
+    assert(f->nin <= f->n_max_modem_samples);
+
+    for(i=0; i<f->nin; i++)
+        demod_in[i] = fcmult(1.0/FDMDV_SCALE, demod_in[i]);
+
+    bits_per_codec_frame  = codec2_bits_per_frame(f->codec2);
+    bytes_per_codec_frame = (bits_per_codec_frame + 7) / 8;
+    nout = f->n_speech_samples;
+
+    if (f->mode == FREEDV_MODE_1600) {
+
+        bits_per_fdmdv_frame  = fdmdv_bits_per_frame(f->fdmdv);
+
+        nin_prev = f->nin;
+        fdmdv_demod(f->fdmdv, f->fdmdv_bits, &reliable_sync_bit, demod_in, &f->nin);
+        fdmdv_get_demod_stats(f->fdmdv, &f->stats);
+        f->sync = f->fdmdv->sync;
+        f->snr_est = f->stats.snr_est;
+
+        if (reliable_sync_bit == 1) {
+            f->evenframe = 1;
+        }
+       
+        if (f->stats.sync) {
+            if (f->evenframe == 0) {
+                memcpy(f->rx_bits, f->fdmdv_bits, bits_per_fdmdv_frame*sizeof(int));
+                nout = 0;
+            }
+            else {
+                memcpy(&f->rx_bits[bits_per_fdmdv_frame], f->fdmdv_bits, bits_per_fdmdv_frame*sizeof(int));
+   
+                if (f->test_frames == 0) {
+                    recd_codeword = 0;
+                    for(i=0; i<8; i++) {
+                        recd_codeword <<= 1;
+                        recd_codeword |= (f->rx_bits[i] & 0x1);
+                    }
+                    for(i=11; i<15; i++) {
+                        recd_codeword <<= 1;
+                        recd_codeword |= (f->rx_bits[i] & 0x1);
+                    }
+                    for(i=bits_per_codec_frame; i<bits_per_codec_frame+11; i++) {
+                        recd_codeword <<= 1;
+                        recd_codeword |= (f->rx_bits[i] & 0x1);
+                    }
+                    codeword1 = golay23_decode(recd_codeword);
+                    f->total_bit_errors += golay23_count_errors(recd_codeword, codeword1);
+                    f->total_bits       += 23;
+
+                    //codeword1 = recd_codeword;
+                    //fprintf(stderr, "received codeword1: 0x%x  decoded codeword1: 0x%x\n", recd_codeword, codeword1);
+           
+                    for(i=0; i<bits_per_codec_frame; i++)
+                        f->codec_bits[i] = f->rx_bits[i];
+
+                    for(i=0; i<8; i++) {
+                        f->codec_bits[i] = (codeword1 >> (22-i)) & 0x1;
+                    }
+                    for(i=8,j=11; i<12; i++,j++) {
+                        f->codec_bits[j] = (codeword1 >> (22-i)) & 0x1;
+                    }
+                    // extract txt msg data bit ------------------------------------------------------------
+
+                    data_flag_index = codec2_get_spare_bit_index(f->codec2);
+                    abit[0] = f->codec_bits[data_flag_index];
+
+                    n_ascii = varicode_decode(&f->varicode_dec_states, &ascii_out, abit, 1, 1);
+                    if (n_ascii && (f->freedv_put_next_rx_char != NULL)) {
+                        (*f->freedv_put_next_rx_char)(f->callback_state, ascii_out);
+                    }
+
+                    // reconstruct missing bit we steal for data bit and decode speech
+
+                    codec2_rebuild_spare_bit(f->codec2, f->codec_bits);
+
+                    // pack bits, MSB received first
+
+                    bit  = 7;
+                    byte = 0;
+                    memset(f->packed_codec_bits, 0,  bytes_per_codec_frame);
+                    for(i=0; i<bits_per_codec_frame; i++) {
+                        f->packed_codec_bits[byte] |= (f->codec_bits[i] << bit);
+                        bit--;
+                        if(bit < 0) {
+                            bit = 7;
+                            byte++;
+                        }
+                    }
+
+                    codec2_decode(f->codec2, speech_out, f->packed_codec_bits);
+                }
+                else {
+                    int   test_frame_sync, bit_errors, ntest_bits, k;
+                    short error_pattern[fdmdv_error_pattern_size(f->fdmdv)];
+                    
+                    for(k=0; k<2; k++) {
+                        /* test frames, so lets sync up to the test frames and count any errors */
+                        fdmdv_put_test_bits(f->fdmdv, &test_frame_sync, error_pattern, &bit_errors, &ntest_bits, &f->rx_bits[k*bits_per_fdmdv_frame]);
+
+                        if (test_frame_sync == 1) {
+                            f->test_frame_sync_state = 1;
+                            f->test_frame_count = 0;
+                        }
+
+                        if (f->test_frame_sync_state) {
+                            if (f->test_frame_count == 0) {
+                                f->total_bit_errors += bit_errors;
+                                f->total_bits += ntest_bits;
+                                if (f->freedv_put_error_pattern != NULL) {
+                                    (*f->freedv_put_error_pattern)(f->error_pattern_callback_state, error_pattern, fdmdv_error_pattern_size(f->fdmdv));
+                                }
+                           }
+                            f->test_frame_count++;
+                            if (f->test_frame_count == 4)
+                                f->test_frame_count = 0;
+                        }
+
+                        //fprintf(stderr, "test_frame_sync: %d test_frame_sync_state: %d bit_errors: %d ntest_bits: %d\n",
+                        //        test_frame_sync, f->test_frame_sync_state, bit_errors, ntest_bits);
+                    }
+                }
+
+
+                /* squelch if beneath SNR threshold or test frames enabled */
+
+                if ((f->squelch_en && (f->stats.snr_est < f->snr_squelch_thresh)) || f->test_frames) {
+                    //fprintf(stderr,"squelch %f %f !\n", f->stats.snr_est, f->snr_squelch_thresh);
+                    for(i=0; i<f->n_speech_samples; i++)
+                        speech_out[i] = 0;
+                }
+
+                nout = f->n_speech_samples;
+
+            }
+
+            /* note this freewheels if reliable sync dissapears on bad channels */
+
+            if (f->evenframe)
+                f->evenframe = 0;
+            else
+                f->evenframe = 1;
+            //fprintf(stderr,"%d\n",  f->evenframe);  
+
+        } /* if (sync) .... */
+        else {
+            /* if not in sync pass through analog samples */
+            /* this lets us "hear" whats going on, e.g. during tuning */
+            
+            //fprintf(stderr, "out of sync\n");
+
+           if (f->squelch_en == 0) {
+                for(i=0; i<nin_prev; i++)
+                    speech_out[i] = FDMDV_SCALE*demod_in[i].real;
+            }
+            else {
+                for(i=0; i<nin_prev; i++)
+                    speech_out[i] = 0;
+             }
+            //fprintf(stderr, "%d %d %d\n", nin_prev, speech_out[0], speech_out[nin_prev-1]);
+            nout = nin_prev;
+        }
+    }
+
+
+    if (f->mode == FREEDV_MODE_700) {
+        float rx_bits[COHPSK_BITS_PER_FRAME];
+        int   sync;
+
+        nin_prev = f->nin;
+       cohpsk_demod(f->cohpsk, rx_bits, &sync, demod_in, &f->nin);
+        f->sync = sync;
+        cohpsk_get_demod_stats(f->cohpsk, &f->stats);
+        f->snr_est = f->stats.snr_est;
+
+       if (sync) {
+
+            if (f->test_frames == 0) {
+                data_flag_index = codec2_get_spare_bit_index(f->codec2);
+
+                /* optional smoothing of codec symbols */
+
+                if (f->smooth_symbols) {
+
+                    for(i=0; i<bits_per_codec_frame; i++) {
+                        rx_bits[i] += rx_bits[i+bits_per_codec_frame];
+                        rx_bits[i+bits_per_codec_frame] = rx_bits[i];
+                    }
+                }
+
+                for (j=0; j<COHPSK_BITS_PER_FRAME; j+=bits_per_codec_frame) {
+                
+                    /* extract txt msg data bits */
+                
+                    for(k=0; k<2; k++)  {
+                        abit[0] = rx_bits[data_flag_index+j+k] < 0.0;
+                    
+                        n_ascii = varicode_decode(&f->varicode_dec_states, &ascii_out, abit, 1, 1);
+                        if (n_ascii && (f->freedv_put_next_rx_char != NULL)) {
+                            (*f->freedv_put_next_rx_char)(f->callback_state, ascii_out);
+                        }
+                    }
+
+                    /* pack bits, MSB received first */
+
+                    bit = 7; byte = 0;
+                    memset(f->packed_codec_bits, 0, bytes_per_codec_frame);
+                    for(i=0; i<bits_per_codec_frame; i++) {
+                        f->packed_codec_bits[byte] |= ((rx_bits[j+i] < 0.0) << bit);
+                        bit--;
+                        if (bit < 0) {
+                            bit = 7;
+                            byte++;
+                        }
+                    }
+
+                    codec2_decode(f->codec2, speech_out, f->packed_codec_bits);
+
+                    if (f->squelch_en && (f->stats.snr_est < f->snr_squelch_thresh)) {
+                        for(i=0; i<f->n_speech_samples; i++)
+                            speech_out[i] = 0; 
+                    }
+                    speech_out += codec2_samples_per_frame(f->codec2);
+                }
+                nout = f->n_speech_samples;
+            }
+            else {
+                short error_pattern[COHPSK_BITS_PER_FRAME];
+                int   bit_errors;
+
+                /* test data, lets see if we can sync to the test data sequence */
+
+                cohpsk_put_test_bits(f->cohpsk, &f->test_frame_sync_state, error_pattern, &bit_errors, rx_bits);
+                if (f->test_frame_sync_state) {
+                    f->total_bit_errors += bit_errors;
+                    f->total_bits       += COHPSK_BITS_PER_FRAME;
+                    if (f->freedv_put_error_pattern != NULL) {
+                        (*f->freedv_put_error_pattern)(f->error_pattern_callback_state, error_pattern, COHPSK_BITS_PER_FRAME);
+                    }
+                }
+
+                for(i=0; i<f->n_speech_samples; i++)
+                    speech_out[i] = 0; 
+                nout = f->n_speech_samples;  
+            }
+            
+        }
+
+        if (sync == 0) {
+            if (f->squelch_en) {
+                for(i=0; i<f->n_speech_samples; i++)
+                    speech_out[i] = 0; 
+                nout = f->n_speech_samples;                 
+            }
+            else {
+                float t,a,b,s;
+                int   t1;
+
+                /* if not in sync pass through analog samples */
+                /* this lets us "hear" whats going on, e.g. during tuning */
+                /* need to linearly interp as Fs in and out slightly different */
+                /* this is a bit crude (compared to analog FreeDV mode)
+                   but it's probably OK for a tuning aid off air signals */
+
+                for(i=0, t=0.0; i<f->n_speech_samples; i++, t+=(float)f->modem_sample_rate/FS) {
+                    t1 = floor(t);
+                    a = t - t1;
+                    b = 1.0 - a;
+
+                    /* avoid running past end of input array */
+                    
+                    if (t1 < (f->nin-1)) 
+                        s = b*demod_in[t1].real + a*demod_in[t1+1].real;       
+                    else
+                        s = b*demod_in[t1].real;
+                    
+                    speech_out[i] = FDMDV_SCALE*s;
+                    /*
+                    if ((i < 10) || (i > 590)) {
+                        printf("i: %d t: %f t1: %d a: %f b: %f s[t1]: %f s[t2]: %f s: %f\n",
+                               i,t,t1,a,b,demod_in[t1].real, demod_in[t1+1].real, s);
+                    }
+                    */
+                }
+                nout = f->n_speech_samples;
+                //fprintf(stderr, "%d %d %d\n", f->n_speech_samples, speech_out[0], speech_out[nin_prev-1]);
+            }
+        }
+            
+
+    }
+     
+    //fprintf(stderr,"f->stats.sync: %d reliable_sync_bit: %d evenframe: %d nout: %d\n", f->stats.sync, reliable_sync_bit, f->evenframe, nout);
+    return nout;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_get_version
+  AUTHOR......: Jim Ahlstrom      
+  DATE CREATED: 28 July 2015
+
+  Return the version of the FreeDV API.  This is meant to help API users determine when
+  incompatible changes have occurred.
+
+\*---------------------------------------------------------------------------*/
+
+int freedv_get_version(void)
+{
+    return VERSION;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_set_callback_txt
+  AUTHOR......: Jim Ahlstrom
+  DATE CREATED: 28 July 2015
+
+  Set the callback functions and the callback state pointer that will be used
+  for the aux txt channel.  The freedv_callback_rx is a function pointer that
+  will be called to return received characters.  The freedv_callback_tx is a
+  function pointer that will be called to send transmitted characters.  The callback
+  state is a user-defined void pointer that will be passed to the callback functions.
+  Any or all can be NULL, and the default is all NULL.
+  The function signatures are:
+    void receive_char(void *callback_state, char c);
+    char transmit_char(void *callback_state);
+
+\*---------------------------------------------------------------------------*/
+
+void freedv_set_callback_txt(struct freedv *f, freedv_callback_rx rx, freedv_callback_tx tx, void *state)
+{
+    f->freedv_put_next_rx_char = rx;
+    f->freedv_get_next_tx_char = tx;
+    f->callback_state = state;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: freedv_get_modem_stats
+  AUTHOR......: Jim Ahlstrom
+  DATE CREATED: 28 July 2015
+
+  Return data from the modem.  The arguments are pointers to the data items.  The
+  pointers can be NULL if the data item is not wanted.
+
+\*---------------------------------------------------------------------------*/
+
+void freedv_get_modem_stats(struct freedv *f, int *sync, float *snr_est)
+{
+    if (f->mode == FREEDV_MODE_1600)
+        fdmdv_get_demod_stats(f->fdmdv, &f->stats);
+    if (f->mode == FREEDV_MODE_700)
+        cohpsk_get_demod_stats(f->cohpsk, &f->stats);
+    if (sync) *sync = f->stats.sync;
+    if (snr_est) *snr_est = f->stats.snr_est;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTIONS...: freedv_set_*
+  AUTHOR......: Jim Ahlstrom
+  DATE CREATED: 28 July 2015
+
+  Set some parameters used by FreeDV.  It is possible to write a macro using ## for
+  this, but I wasn't sure it would be 100% portable.
+
+\*---------------------------------------------------------------------------*/
+
+// Set integers
+void freedv_set_test_frames                            (struct freedv *f, int val) {f->smooth_symbols = val;}
+void freedv_set_squelch_en                             (struct freedv *f, int val) {f->squelch_en = val;}
+// Set floats
+void freedv_set_snr_squelch_thresh             (struct freedv *f, float val) {f->snr_squelch_thresh = val;}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTIONS...: freedv_get_*
+  AUTHOR......: Jim Ahlstrom
+  DATE CREATED: 28 July 2015
+
+  Get some parameters from FreeDV.  It is possible to write a macro using ## for
+  this, but I wasn't sure it would be 100% portable.
+
+\*---------------------------------------------------------------------------*/
+
+// Get integers
+int freedv_get_test_frames                             (struct freedv *f) {return f->test_frames;}
+int freedv_get_n_speech_samples                        (struct freedv *f) {return f->n_speech_samples;}
+int freedv_get_n_max_modem_samples             (struct freedv *f) {return f->n_max_modem_samples;}
+int freedv_get_n_nom_modem_samples             (struct freedv *f) {return f->n_nom_modem_samples;}
+int freedv_get_total_bits                              (struct freedv *f) {return f->total_bits;}
+int freedv_get_total_bit_errors                        (struct freedv *f) {return f->total_bit_errors;}
+// Get floats
+
diff --git a/codec2/tags/0.4/src/freedv_api.h b/codec2/tags/0.4/src/freedv_api.h
new file mode 100644 (file)
index 0000000..a6684f1
--- /dev/null
@@ -0,0 +1,79 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: freedv_api.h
+  AUTHOR......: David Rowe
+  DATE CREATED: August 2014
+                                                                             
+  Library of API functions that implement FreeDV "modes", useful for
+  embedding FreeDV in other programs.  Please see the documentation
+  for each function in freedv_api.c, and the sample freedv_tx.c and
+  freedv_rx.c programs.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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/>.
+*/
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+#ifndef __FREEDV__
+
+// This declares a single-precision (float) complex number
+#include "comp.h"
+
+#define FREEDV_MODE_1600        0
+#define FREEDV_MODE_700         1
+
+struct freedv;
+
+typedef void (*freedv_callback_rx)(void *, char);
+typedef char (*freedv_callback_tx)(void *);
+
+// FreeDV API functions:
+// open, close
+struct freedv *freedv_open(int mode);
+void freedv_close(struct freedv *freedv);
+// Transmit
+void freedv_tx(struct freedv *freedv, short mod_out[], short speech_in[]);
+void freedv_comptx(struct freedv *freedv, COMP mod_out[], short speech_in[]);
+// Receive
+int freedv_nin(struct freedv *freedv);
+int freedv_rx(struct freedv *freedv, short speech_out[], short demod_in[]);
+int freedv_floatrx(struct freedv *freedv, short speech_out[], float demod_in[]);
+int freedv_comprx(struct freedv *freedv, short speech_out[], COMP demod_in[]);
+// Set parameters
+void freedv_set_callback_txt(struct freedv *freedv, freedv_callback_rx rx, freedv_callback_tx tx, void *callback_state);
+void freedv_set_test_frames                    (struct freedv *freedv, int test_frames);
+void freedv_set_smooth_symbols         (struct freedv *freedv, int smooth_symbols);
+void freedv_set_squelch_en                     (struct freedv *freedv, int squelch_en);
+void freedv_set_snr_squelch_thresh     (struct freedv *freedv, float snr_squelch_thresh);
+// Get parameters
+int freedv_get_version(void);
+void freedv_get_modem_stats(struct freedv *freedv, int *sync, float *snr_est);
+int freedv_get_test_frames                     (struct freedv *freedv);
+int freedv_get_n_speech_samples                (struct freedv *freedv);
+int freedv_get_n_max_modem_samples     (struct freedv *freedv);
+int freedv_get_n_nom_modem_samples     (struct freedv *freedv);
+int freedv_get_total_bits                      (struct freedv *freedv);
+int freedv_get_total_bit_errors                (struct freedv *freedv);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/codec2/tags/0.4/src/freedv_api_internal.h b/codec2/tags/0.4/src/freedv_api_internal.h
new file mode 100644 (file)
index 0000000..ac486ea
--- /dev/null
@@ -0,0 +1,109 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: freedv_api_internal.h
+  AUTHOR......: David Rowe
+  DATE CREATED: August 2014
+                                                                             
+  This declares the structure freedv.  A pointer to this structure is
+  returned by the FreeDV API freedv_open() function.  The pointer is used
+  by the other FreeDV API functions declared in freedv_api.h.  This
+  structure is intended to be internal to the FreeDV API.  The public
+  functions are declared in freedv_api.h.  Changes to this structure
+  are expected.  Changes (except additions) to freedv_api.h are
+  discouraged.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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/>.
+*/
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+#ifndef __FREEDV__
+
+#include "varicode.h"
+#include "codec2_fdmdv.h"
+#include "codec2_cohpsk.h"
+
+struct freedv {
+    int                  mode;
+
+    struct CODEC2       *codec2;
+    struct FDMDV        *fdmdv;
+    struct MODEM_STATS   stats;
+    struct COHPSK       *cohpsk;
+
+    int                  n_speech_samples;
+    int                  n_nom_modem_samples;    // size of tx and most rx modem sample buffers
+    int                  n_max_modem_samples;    // make your rx modem sample buffers this big
+
+    int                  modem_sample_rate;      // ATM caller is responsible for meeting this (TBC)
+    int                  clip;                   // non-zero for cohpsk modem output clipping for low PAPR
+
+    unsigned char       *packed_codec_bits;
+    int                 *codec_bits;
+    int                 *tx_bits;
+    int                 *fdmdv_bits;
+    int                 *rx_bits;
+    int                  tx_sync_bit;
+    int                  smooth_symbols;
+    float               *prev_rx_bits;
+
+    int                 *ptest_bits_coh;
+    int                 *ptest_bits_coh_end;
+
+    int                  test_frames;            // set this baby for 1 to tx/rx test frames to look at bit error stats
+    int                  test_frame_sync_state;
+    int                  test_frame_count;
+    int                  total_bits;
+    int                  total_bit_errors;
+    int                  sz_error_pattern;
+
+    /* optional user defined function to pass error pattern when a test frame is received */
+
+    void                *error_pattern_callback_state;
+    void (*freedv_put_error_pattern)(void *error_pattern_callback_state, short error_pattern[], int sz_error_pattern);
+
+    int                  sync;
+    int                  evenframe;
+    float                snr_est;
+    float                snr_squelch_thresh;
+    int                  squelch_en;
+    int                  nin;
+
+    struct VARICODE_DEC  varicode_dec_states;
+    short                tx_varicode_bits[VARICODE_MAX_BITS];
+    int                  nvaricode_bits;
+    int                  varicode_bit_index;
+    
+    /* user defined function ptrs to produce and consume ASCII
+      characters using aux txt channel */
+
+    char (*freedv_get_next_tx_char)(void *callback_state);
+    void (*freedv_put_next_rx_char)(void *callback_state, char c);
+
+    void                *callback_state;
+
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/codec2/tags/0.4/src/freedv_rx.c b/codec2/tags/0.4/src/freedv_rx.c
new file mode 100644 (file)
index 0000000..28a920e
--- /dev/null
@@ -0,0 +1,162 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: freedv_rx.c
+  AUTHOR......: David Rowe
+  DATE CREATED: August 2014
+                                                                             
+  Demo receive program for FreeDV API functions, some side information
+  written to freedv_rx_log.txt
+  Example usage (all one line):
+
+     codec2-dev/build_linux/src$ ./freedv_tx 1600 ../../raw/ve9qrp_10s.raw - | 
+                                 ./freedv_rx 1600 - - | play -t raw -r 8000 -s -2 -
+                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "freedv_api.h"
+
+struct my_callback_state {
+    FILE *ftxt;
+};
+
+void my_put_next_rx_char(void *callback_state, char c) {
+    struct my_callback_state* pstate = (struct my_callback_state*)callback_state;
+    if (pstate->ftxt != NULL) {
+        fprintf(pstate->ftxt, "%c", c);
+    }
+}
+
+int main(int argc, char *argv[]) {
+    FILE                      *fin, *fout, *ftxt;
+    short                     *speech_out;
+    short                     *demod_in;
+    struct freedv             *freedv;
+    int                        nin, nout, frame = 0;
+    struct my_callback_state   my_cb_state;
+    int                        mode;
+    int                        sync;
+    int                        total_bits;
+    int                        total_bit_errors;
+    float                      snr_est;
+    int                        n_speech_samples;
+    int                        n_max_modem_samples;
+
+    if (argc < 4) {
+       printf("usage: %s 1600|700 InputModemSpeechFile OutputSpeechRawFile [--test_frames]\n", argv[0]);
+       printf("e.g    %s 1600 hts1a_fdmdv.raw hts1a_out.raw txtLogFile\n", argv[0]);
+       exit(1);
+    }
+
+    mode = -1;
+    if (!strcmp(argv[1],"1600"))
+        mode = FREEDV_MODE_1600;
+    if (!strcmp(argv[1],"700"))
+        mode = FREEDV_MODE_700;
+    assert(mode != -1);
+
+    if (strcmp(argv[2], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[2],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input raw modem sample file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[3], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[3],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output speech sample file: %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+    
+    freedv = freedv_open(mode);
+    assert(freedv != NULL);
+
+    if ( (argc > 4) && (strcmp(argv[4], "--testframes") == 0) ) {
+               freedv_set_test_frames(freedv, 1);
+    }
+    freedv_set_snr_squelch_thresh(freedv, -100.0);
+    freedv_set_squelch_en(freedv, 1);
+    
+    n_speech_samples = freedv_get_n_speech_samples(freedv);
+    n_max_modem_samples = freedv_get_n_max_modem_samples(freedv);
+    speech_out = (short*)malloc(sizeof(short)*n_speech_samples);
+    assert(speech_out != NULL);
+    demod_in = (short*)malloc(sizeof(short)*n_max_modem_samples);
+    assert(demod_in != NULL);
+
+    ftxt = fopen("freedv_rx_log.txt","wt");
+    assert(ftxt != NULL);
+    my_cb_state.ftxt = ftxt;
+    freedv_set_callback_txt(freedv, &my_put_next_rx_char, NULL, &my_cb_state);
+
+    /* Note we need to work out how many samples demod needs on each
+       call (nin).  This is used to adjust for differences in the tx and rx
+       sample clock frequencies.  Note also the number of output
+       speech samples is time varying (nout). */
+
+    nin = freedv_nin(freedv);
+    while(fread(demod_in, sizeof(short), nin, fin) == nin) {
+        frame++;
+
+        nout = freedv_rx(freedv, speech_out, demod_in);
+        nin = freedv_nin(freedv);
+
+        fwrite(speech_out, sizeof(short), nout, fout);
+        freedv_get_modem_stats(freedv, &sync, &snr_est);
+        total_bit_errors = freedv_get_total_bit_errors(freedv);
+        
+        /* log some side info to the txt file */
+               
+        if (ftxt != NULL) {
+            fprintf(ftxt, "frame: %d  demod sync: %d  demod snr: %3.2f dB  bit errors: %d\n", frame, 
+                    sync, snr_est, total_bit_errors);
+        }
+
+       /* if this is in a pipeline, we probably don't want the usual
+           buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    if (freedv_get_test_frames(freedv)) {
+        total_bits = freedv_get_total_bits(freedv);
+        total_bit_errors = freedv_get_total_bit_errors(freedv);
+        fprintf(stderr, "bits: %d errors: %d BER: %3.2f\n", total_bits, total_bit_errors, (float)total_bit_errors/total_bits);
+    }
+
+    free(speech_out);
+    free(demod_in);
+    freedv_close(freedv);
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/freedv_tx.c b/codec2/tags/0.4/src/freedv_tx.c
new file mode 100644 (file)
index 0000000..a327922
--- /dev/null
@@ -0,0 +1,132 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: freedv_tx.c
+  AUTHOR......: David Rowe
+  DATE CREATED: August 2014
+                                                                             
+  Demo transmit program for FreeDV API functions.
+                                                                     
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include "freedv_api.h"
+
+struct my_callback_state {
+    char  tx_str[80];
+    char *ptx_str;
+};
+
+char my_get_next_tx_char(void *callback_state) {
+    struct my_callback_state* pstate = (struct my_callback_state*)callback_state;
+    char  c = *pstate->ptx_str++;
+    
+    if (*pstate->ptx_str == 0) {
+        pstate->ptx_str = pstate->tx_str;
+    }
+    
+    return c;
+}
+
+int main(int argc, char *argv[]) {
+    FILE                     *fin, *fout;
+    short                    *speech_in;
+    short                    *mod_out;
+    struct freedv            *freedv;
+    struct my_callback_state  my_cb_state;
+    int                       mode;
+    int                       n_speech_samples;
+    int                       n_nom_modem_samples;
+
+    if (argc < 4) {
+       printf("usage: %s 1600|700 InputRawSpeechFile OutputModemRawFile [--testframes]\n", argv[0]);
+       printf("e.g    %s 1600 hts1a.raw hts1a_fdmdv.raw\n", argv[0]);
+       exit(1);
+    }
+
+    mode = -1;
+    if (!strcmp(argv[1],"1600"))
+        mode = FREEDV_MODE_1600;
+    if (!strcmp(argv[1],"700"))
+        mode = FREEDV_MODE_700;
+    assert(mode != -1);
+
+    if (strcmp(argv[2], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[2],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input raw speech sample file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[3], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[3],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output modem sample file: %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+    
+    freedv = freedv_open(mode);
+    assert(freedv != NULL);
+
+    if ((argc > 4) && (strcmp(argv[4], "--testframes") == 0)) {
+               freedv_set_test_frames(freedv, 1);
+    }
+    freedv_set_snr_squelch_thresh(freedv, -100.0);
+    freedv_set_squelch_en(freedv, 1);
+
+    n_speech_samples = freedv_get_n_speech_samples(freedv);
+    n_nom_modem_samples = freedv_get_n_nom_modem_samples(freedv);
+    speech_in = (short*)malloc(sizeof(short)*n_speech_samples);
+    assert(speech_in != NULL);
+    mod_out = (short*)malloc(sizeof(short)*n_nom_modem_samples);
+    assert(mod_out != NULL);
+
+    /* set up callback for txt msg chars */
+
+    sprintf(my_cb_state.tx_str, "cq cq cq hello world\n");
+    my_cb_state.ptx_str = my_cb_state.tx_str;
+    freedv_set_callback_txt(freedv, NULL, &my_get_next_tx_char, &my_cb_state);
+
+    /* OK main loop */
+
+    while(fread(speech_in, sizeof(short), n_speech_samples, fin) == n_speech_samples) {
+        freedv_tx(freedv, mod_out, speech_in);
+        fwrite(mod_out, sizeof(short), n_nom_modem_samples, fout);
+
+       /* if this is in a pipeline, we probably don't want the usual
+           buffering to occur */
+
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    free(speech_in);
+    free(mod_out);
+    freedv_close(freedv);
+    fclose(fin);
+    fclose(fout);
+
+    return 0;
+}
+
diff --git a/codec2/tags/0.4/src/generate_codebook.c b/codec2/tags/0.4/src/generate_codebook.c
new file mode 100644 (file)
index 0000000..0bea80d
--- /dev/null
@@ -0,0 +1,179 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: generate_codebook.c
+  AUTHOR......: Bruce Perens                                        
+  DATE CREATED: 29 Sep 2010                                                     
+                                                                             
+  Generate header files containing LSP quantisers, runs at compile time.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+static const char usage[] =
+"Usage: %s filename array_name [filename ...]\n"
+"\tCreate C code for codebook tables.\n";
+
+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";
+
+static const char header[] =
+"/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */\n\n"
+"/*\n"
+" * This intermediary file and the files that used to create it are under \n"
+" * The LGPL. See the file COPYING.\n"
+" */\n\n"
+"#include \"defines.h\"\n\n";
+
+struct codebook {
+  unsigned int k;
+  unsigned int log2m;
+  unsigned int m;
+  float * cb;
+};
+
+static void
+dump_array(const struct codebook * b, int index)
+{
+  int  limit = b->k * b->m;
+  int  i;
+
+  printf("static const float codes%d[] = {\n", index);
+  for ( i = 0; i < limit; i++ ) {
+    printf("  %g", b->cb[i]);
+    if ( i < limit - 1 )
+      printf(",");
+
+    /* organise VQs by rows, looks prettier */
+    if ( ((i+1) % b->k) == 0 )
+       printf("\n");
+  }
+  printf("};\n");
+}
+
+static void
+dump_structure(const struct codebook * b, int index)
+{
+  printf("  {\n");
+  printf("    %d,\n", b->k);
+  printf("    %g,\n", log(b->m) / log(2));
+  printf("    %d,\n", b->m);
+  printf("    codes%d\n", index);
+  printf("  }");
+}
+
+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(FILE * file, const char * name)
+{
+  char                 line[1024];
+  char *               cursor = line;
+  struct codebook *    b = malloc(sizeof(struct codebook));
+  int                  i;
+  int                  size;
+
+  *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 = (float *)malloc(size * sizeof(float));
+
+  for ( i = 0; i < size; i++ )
+    b->cb[i] = get_float(file, name, &cursor, line, sizeof(line));
+
+  return b;
+}
+
+int
+main(int argc, char * * argv)
+{
+  struct codebook * *  cb = malloc(argc * sizeof(struct codebook *));
+  int                  i;
+
+  if ( argc < 2 ) {
+    fprintf(stderr, usage, argv[0]);
+    fprintf(stderr, format);
+    exit(1);
+  }
+
+  for ( i = 0; i < argc - 2; i++ ) {
+    FILE *     in = fopen(argv[i + 2], "r");
+
+    if ( in == NULL ) {
+      perror(argv[i + 2]);
+      exit(1);
+    }
+
+    cb[i] = load(in, argv[i + 2]);
+
+    fclose(in);
+  }
+
+  printf(header);
+  for ( i = 0; i < argc - 2; i++ ) {
+    printf("  /* %s */\n", argv[i + 2]);
+    dump_array(cb[i], i);
+  }
+  printf("\nconst struct lsp_codebook %s[] = {\n", argv[1]);
+  for ( i = 0; i < argc - 2; i++ ) {
+    printf("  /* %s */\n", argv[i + 2]);
+    dump_structure(cb[i], i);
+    printf(",\n");
+  }
+  printf("  { 0, 0, 0, 0 }\n");
+  printf("};\n");
+
+  return 0;
+}
diff --git a/codec2/tags/0.4/src/genlspdtcb.c b/codec2/tags/0.4/src/genlspdtcb.c
new file mode 100644 (file)
index 0000000..efac19c
--- /dev/null
@@ -0,0 +1,90 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: genlspdtcb.c
+  AUTHOR......: David Rowe                                                     
+  DATE CREATED: 2 Nov 2011
+                                                                             
+  Generates codebooks (quantisation tables) for LSP delta-T VQ.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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/>.
+
+*/
+
+#define MAX_ROWS 10
+
+float lsp1to4[] = {
+    -25,0,25,
+    -25,0,25,
+    -50,0,50,
+    -50,0,50
+};
+
+float lsp5to10[] = {
+    -50,0,50,
+    -50,0,50,
+    -50,0,50,
+    -50,0,50,
+    -50,0,50,
+    -50,0,50
+};
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+void create_codebook_text_file(char filename[], float lsp[], 
+                              int rows, int cols);
+
+int main(void) {
+    create_codebook_text_file("codebook/lspdt1-4.txt",  lsp1to4,  4, 3);
+    create_codebook_text_file("codebook/lspdt5-10.txt", lsp5to10, 6, 3); 
+    return 0;
+}
+
+void create_codebook_text_file(char filename[], float lsp[], 
+                              int rows, int cols) 
+{
+    FILE *f;
+    int   i, digits[MAX_ROWS]; 
+
+    f = fopen(filename, "wt");
+    if (f == NULL) {
+       printf("Can't open codebook text file %s\n", filename);
+       exit(0);
+    }
+
+    for(i=0; i<rows; i++)
+       digits[i] = 0;
+
+    fprintf(f, "%d %d\n", rows, (int)pow(cols, rows));
+
+    do {
+       for(i=0; i<rows; i++)
+           fprintf(f, "%4.0f ", lsp[cols*i + digits[i]]);
+       fprintf(f, "\n");
+       digits[0]++;
+       for(i=0; i<rows-1; i++)
+           if (digits[i]== cols) {
+               digits[i] = 0;
+               digits[i+1]++;
+           }
+    } while (digits[rows-1] != cols);
+       
+    fclose(f);
+}
diff --git a/codec2/tags/0.4/src/golay23.c b/codec2/tags/0.4/src/golay23.c
new file mode 100644 (file)
index 0000000..ada17c3
--- /dev/null
@@ -0,0 +1,419 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: golay23.c
+  AUTHOR......: Robert Morelos-Zaragoza & David Rowe
+  DATE CREATED: 3 March 2013
+
+  To test:
+  
+     src$ gcc golay23.c -o golay23 -Wall -DGOLAY23_UNITTEST -DRUN_TIME_TABLES
+     src$ ./golay23
+
+  To generate tables:
+     src$ gcc golay23.c -o golay23 -Wall -DGOLAY23_MAKETABLES -DRUN_TIME_TABLES
+
+\*---------------------------------------------------------------------------*/
+
+/* File:    golay23.c
+ * Title:   Encoder/decoder for a binary (23,12,7) Golay code
+ * Author:  Robert Morelos-Zaragoza (robert@spectra.eng.hawaii.edu)
+ * Date:    August 1994
+ *
+ * The binary (23,12,7) Golay code is an example of a perfect code, that is,
+ * the number of syndromes equals the number of correctable error patterns.
+ * The minimum distance is 7, so all error patterns of Hamming weight up to
+ * 3 can be corrected. The total number of these error patterns is:
+ *
+ *       Number of errors         Number of patterns
+ *       ----------------         ------------------
+ *              0                         1
+ *              1                        23
+ *              2                       253
+ *              3                      1771
+ *                                     ----
+ *    Total number of error patterns = 2048 = 2^{11} = number of syndromes
+ *                                               --
+ *                number of redundant bits -------^
+ *
+ * Because of its relatively low length (23), dimension (12) and number of
+ * redundant bits (11), the binary (23,12,7) Golay code can be encoded and
+ * decoded simply by using look-up tables. The program below uses a 16K 
+ * encoding table and an 8K decoding table.
+ * 
+ * For more information, suggestions, or other ideas on implementing error
+ * correcting codes, please contact me at (I'm temporarily in Japan, but
+ * below is my U.S. address):
+ *
+ *                    Robert Morelos-Zaragoza
+ *                    770 S. Post Oak Ln. #200
+ *                      Houston, Texas 77056
+ *
+ *             email: robert@spectra.eng.hawaii.edu
+ *
+ *       Homework: Add an overall parity-check bit to get the (24,12,8)
+ *                 extended Golay code.
+ *
+ * COPYRIGHT NOTICE: This computer program is free for non-commercial purposes.
+ * You may implement this program for any non-commercial application. You may 
+ * also implement this program for commercial purposes, provided that you
+ * obtain my written permission. Any modification of this program is covered
+ * by this copyright.
+ *
+ * ==   Copyright (c) 1994  Robert Morelos-Zaragoza. All rights reserved.   ==
+ */
+
+#include "golay23.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define X22             0x00400000   /* vector representation of X^{22} */
+#define X11             0x00000800   /* vector representation of X^{11} */
+#define MASK12          0xfffff800   /* auxiliary vector for testing */
+#define GENPOL          0x00000c75   /* generator polinomial, g(x) */
+
+/* Global variables:
+ *
+ * pattern = error pattern, or information, or received vector
+ * encoding_table[] = encoding table
+ * decoding_table[] = decoding table
+ * data = information bits, i(x)
+ * codeword = code bits = x^{11}i(x) + (x^{11}i(x) mod g(x))
+ * numerr = number of errors = Hamming weight of error polynomial e(x)
+ * position[] = error positions in the vector representation of e(x)
+ * recd = representation of corrupted received polynomial r(x) = c(x) + e(x)
+ * decerror = number of decoding errors
+ * a[] = auxiliary array to generate correctable error patterns
+ */
+
+static int inited =  0;
+
+#ifdef RUN_TIME_TABLES
+static int encoding_table[4096], decoding_table[2048];
+#else
+#include "golayenctable.h"
+#include "golaydectable.h"
+#endif
+
+#ifdef GOLAY23_UNITTEST
+static int position[23] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008,
+                            0x00000010, 0x00000020, 0x00000040, 0x00000080,
+                            0x00000100, 0x00000200, 0x00000400, 0x00000800,
+                            0x00001000, 0x00002000, 0x00004000, 0x00008000,
+                            0x00010000, 0x00020000, 0x00040000, 0x00080000,
+                            0x00100000, 0x00200000, 0x00400000 };
+#endif
+
+#ifdef RUN_TIME_TABLES
+static int arr2int(int a[], int r)
+/*
+ * Convert a binary vector of Hamming weight r, and nonzero positions in
+ * array a[1]...a[r], to a long integer \sum_{i=1}^r 2^{a[i]-1}.
+ */
+{
+   int i;
+   long mul, result = 0, temp;
+   for (i=1; i<=r; i++) {
+      mul = 1;
+      temp = a[i]-1;
+      while (temp--)
+         mul = mul << 1;
+      result += mul;
+      }
+   return(result);
+}
+#endif
+
+void nextcomb(int n, int r, int a[])
+/*
+ * Calculate next r-combination of an n-set.
+ */
+{
+  int  i, j;
+  a[r]++;
+  if (a[r] <= n)
+      return;
+  j = r - 1;
+  while (a[j] == n - r + j)
+     j--;
+  for (i = r; i >= j; i--)
+      a[i] = a[j] + i - j + 1;
+  return;
+}
+
+int get_syndrome(int pattern)
+/*
+ * Compute the syndrome corresponding to the given pattern, i.e., the
+ * remainder after dividing the pattern (when considering it as the vector
+ * representation of a polynomial) by the generator polynomial, GENPOL.
+ * In the program this pattern has several meanings: (1) pattern = infomation
+ * bits, when constructing the encoding table; (2) pattern = error pattern,
+ * when constructing the decoding table; and (3) pattern = received vector, to
+ * obtain its syndrome in decoding.
+ */
+{
+    int aux = X22;
+    if (pattern >= X11)
+       while (pattern & MASK12) {
+           while (!(aux & pattern))
+              aux = aux >> 1;
+           pattern ^= (aux/X11) * GENPOL;
+           }
+    return(pattern);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: golay23_init()   
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 March 2013
+
+  Call this once when you start your program to init the Golay tables.
+
+\*---------------------------------------------------------------------------*/
+
+void golay23_init(void) {
+#ifdef RUN_TIME_TABLES
+   int  i;
+   long temp;
+   int  a[4];
+   int  pattern;
+
+   /*
+    * ---------------------------------------------------------------------
+    *                  Generate ENCODING TABLE
+    *
+    * An entry to the table is an information vector, a 32-bit integer,
+    * whose 12 least significant positions are the information bits. The
+    * resulting value is a codeword in the (23,12,7) Golay code: A 32-bit
+    * integer whose 23 least significant bits are coded bits: Of these, the
+    * 12 most significant bits are information bits and the 11 least
+    * significant bits are redundant bits (systematic encoding).
+    * --------------------------------------------------------------------- 
+    */
+    for (pattern = 0; pattern < 4096; pattern++) {
+        temp = pattern << 11;          /* multiply information by X^{11} */
+        encoding_table[pattern] = temp + get_syndrome(temp);/* add redundancy */
+        }
+
+   /*
+    * ---------------------------------------------------------------------
+    *                  Generate DECODING TABLE
+    *
+    * An entry to the decoding table is a syndrome and the resulting value
+    * is the most likely error pattern. First an error pattern is generated.
+    * Then its syndrome is calculated and used as a pointer to the table
+    * where the error pattern value is stored.
+    * --------------------------------------------------------------------- 
+    *            
+    * (1) Error patterns of WEIGHT 1 (SINGLE ERRORS)
+    */
+    decoding_table[0] = 0;
+    decoding_table[1] = 1;
+    temp = 1; 
+    for (i=2; i<= 23; i++) {
+        temp *= 2;
+        decoding_table[get_syndrome(temp)] = temp;
+        }
+   /*            
+    * (2) Error patterns of WEIGHT 2 (DOUBLE ERRORS)
+    */
+    a[1] = 1; a[2] = 2;
+    temp = arr2int(a,2);
+    decoding_table[get_syndrome(temp)] = temp;
+    for (i=1; i<253; i++) {
+        nextcomb(23,2,a);
+        temp = arr2int(a,2);
+        decoding_table[get_syndrome(temp)] = temp;
+        }
+   /*            
+    * (3) Error patterns of WEIGHT 3 (TRIPLE ERRORS)
+    */
+    a[1] = 1; a[2] = 2; a[3] = 3;
+    temp = arr2int(a,3);
+    decoding_table[get_syndrome(temp)] = temp;
+    for (i=1; i<1771; i++) {
+        nextcomb(23,3,a);
+        temp = arr2int(a,3);
+        decoding_table[get_syndrome(temp)] = temp;
+    }
+#endif
+    inited = 1;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: golay23_encode()   
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 March 2013
+
+  Given 12 bits of data retiurns a 23 bit codeword for transmission
+  over the channel.
+
+\*---------------------------------------------------------------------------*/
+
+int golay23_encode(int data) {
+    assert(inited);
+    assert(data <= 0xfff);
+
+    //printf("data: 0x%x\n", data);
+    return encoding_table[data];
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: golay23_decode()   
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 3 March 2013
+
+  Given a 23 bit received codeword, returns the 12 bit corrected data.
+
+\*---------------------------------------------------------------------------*/
+
+int golay23_decode(int received_codeword) {
+    assert(inited);
+    assert((received_codeword < (1<<23)) && (received_codeword >= 0));
+
+    //printf("syndrome: 0x%x\n", get_syndrome(received_codeword));
+    return received_codeword ^= decoding_table[get_syndrome(received_codeword)];
+}
+
+int golay23_count_errors(int recd_codeword, int corrected_codeword)
+{
+    int errors = 0;
+    int diff, i;
+
+    diff = recd_codeword ^ corrected_codeword;
+    for(i=0; i<23; i++) {
+        if (diff & 0x1)
+            errors++;
+        diff >>= 1;
+    }
+
+    return errors;
+}
+
+#ifdef GOLAY23_UNITTEST
+
+static int golay23_test(int error_pattern) {
+    int data;
+    int codeword;
+    int recd;
+    int pattern;
+    int decerror;
+    int i, tests;
+    
+    decerror = 0;
+    tests = 0;
+
+    for (data = 0; data<(1<<12); data++) {
+
+        codeword = golay23_encode(data);
+        recd = codeword ^ error_pattern;
+        recd = golay23_decode(recd);
+        pattern = (recd ^ codeword) >> 11;
+        for (i=0; i<12; i++)
+            if (pattern & position[i])
+                decerror++;
+        if (decerror) {
+            printf("data: 0x%x codeword: 0x%x recd: 0x%x\n", data, codeword, recd);
+            printf("there were %d decoding errors\n", decerror);
+            exit(1);
+        }
+        tests++;
+    }
+
+    return tests;
+}
+
+int main(void)
+{
+   int i;
+   int  tests;
+   int a[4];
+   int error_pattern;
+
+   golay23_init(); 
+
+   /* ---------------------------------------------------------------------
+    *                        Generate DATA
+    * ---------------------------------------------------------------------
+    */
+
+    /* Test all combinations of data and 1,2 or 3 errors */
+
+    tests = 0;    
+    error_pattern = 1;
+    for (i=0; i< 23; i++) {
+        //printf("error_pattern: 0x%x\n", error_pattern);
+        tests += golay23_test(error_pattern);
+        error_pattern *= 2;
+    }
+    printf("%d 1 bit error tests performed OK!\n", tests);
+
+    tests = 0;
+    a[1] = 1; a[2] = 2;
+    error_pattern = arr2int(a,2);
+    tests += golay23_test(error_pattern);
+    for (i=1; i<253; i++) {
+        nextcomb(23,2,a);
+        error_pattern = arr2int(a,2);
+        //printf("error_pattern: 0x%x\n", error_pattern);
+        tests += golay23_test(error_pattern);
+    }
+    printf("%d 2 bit error tests performed OK!\n", tests);
+
+    tests = 0;
+    a[1] = 1; a[2] = 2; a[3] = 3;
+    error_pattern = arr2int(a,3);
+    tests += golay23_test(error_pattern);
+    for (i=1; i<1771; i++) {
+        nextcomb(23,3,a);
+        error_pattern = arr2int(a,3);
+        //printf("error_pattern: 0x%x\n", error_pattern);
+        tests += golay23_test(error_pattern);
+    }
+    printf("%d 3 bit error tests performed OK!\n", tests);
+
+    return 0;
+}
+#endif
+
+#ifdef GOLAY23_MAKETABLES
+int main(int argc, char *argv[]) {
+    FILE *f;
+    int   i;
+
+    golay23_init();
+
+    f=fopen("golayenctable.h","wt");
+    assert(f != NULL);
+
+    fprintf(f,"/* Generated by golay23.c -DGOLAY23_MAKETABLE */\n\n");
+    fprintf(f,"const int static encoding_table[]={\n");
+    
+    for (i=0; i<4095; i++)
+        fprintf(f,"  0x%x,\n", encoding_table[i]);
+    fprintf(f, "  0x%x\n};\n", encoding_table[i]);
+    fclose(f);
+
+    f=fopen("golaydectable.h","wt");
+    assert(f != NULL);
+
+    fprintf(f,"/* Generated by golay23.c -DGOLAY23_MAKETABLE */\n\n");
+    fprintf(f,"const int static decoding_table[]={\n");
+    
+    for (i=0; i<2047; i++)
+        fprintf(f,"  0x%x,\n", decoding_table[i]);
+    fprintf(f, "  0x%x\n};\n", decoding_table[i]);
+    fclose(f);
+
+    return 0;
+}
+
+#endif
+
+
diff --git a/codec2/tags/0.4/src/golay23.h b/codec2/tags/0.4/src/golay23.h
new file mode 100644 (file)
index 0000000..a916d29
--- /dev/null
@@ -0,0 +1,44 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: golay23.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 3 March 2013
+
+  Header file for Golay FEC.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 __GOLAY23__
+#define __GOLAY23__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void golay23_init(void);
+int  golay23_encode(int data);
+int  golay23_decode(int received_codeword);
+int  golay23_count_errors(int recd_codeword, int corrected_codeword);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/codec2/tags/0.4/src/golaydectable.h b/codec2/tags/0.4/src/golaydectable.h
new file mode 100644 (file)
index 0000000..bfc7670
--- /dev/null
@@ -0,0 +1,2052 @@
+/* Generated by golay23.c -DGOLAY23_MAKETABLE */
+
+const int static decoding_table[]={
+  0x0,
+  0x1,
+  0x2,
+  0x3,
+  0x4,
+  0x5,
+  0x6,
+  0x7,
+  0x8,
+  0x9,
+  0xa,
+  0xb,
+  0xc,
+  0xd,
+  0xe,
+  0x24020,
+  0x10,
+  0x11,
+  0x12,
+  0x13,
+  0x14,
+  0x15,
+  0x16,
+  0x412000,
+  0x18,
+  0x19,
+  0x1a,
+  0x180800,
+  0x1c,
+  0x200300,
+  0x48040,
+  0x1480,
+  0x20,
+  0x21,
+  0x22,
+  0x23,
+  0x24,
+  0x25,
+  0x26,
+  0x24008,
+  0x28,
+  0x29,
+  0x2a,
+  0x24004,
+  0x2c,
+  0x24002,
+  0x24001,
+  0x24000,
+  0x30,
+  0x31,
+  0x32,
+  0x8180,
+  0x34,
+  0xc40,
+  0x301000,
+  0xc0200,
+  0x38,
+  0x43000,
+  0x400600,
+  0x210040,
+  0x90080,
+  0x508000,
+  0x2900,
+  0x24010,
+  0x40,
+  0x41,
+  0x42,
+  0x43,
+  0x44,
+  0x45,
+  0x46,
+  0x280080,
+  0x48,
+  0x49,
+  0x4a,
+  0x2500,
+  0x4c,
+  0x111000,
+  0x48010,
+  0x400a00,
+  0x50,
+  0x51,
+  0x52,
+  0x21200,
+  0x54,
+  0xc20,
+  0x48008,
+  0x104100,
+  0x58,
+  0x404080,
+  0x48004,
+  0x210020,
+  0x48002,
+  0xa2000,
+  0x48000,
+  0x48001,
+  0x60,
+  0x61,
+  0x62,
+  0x540000,
+  0x64,
+  0xc10,
+  0x10300,
+  0xb000,
+  0x68,
+  0x88200,
+  0x1880,
+  0x210010,
+  0x602000,
+  0x40180,
+  0x180400,
+  0x24040,
+  0x70,
+  0xc04,
+  0x86000,
+  0x210008,
+  0xc01,
+  0xc00,
+  0x420080,
+  0xc02,
+  0x120100,
+  0x210002,
+  0x210001,
+  0x210000,
+  0x5200,
+  0xc08,
+  0x48020,
+  0x210004,
+  0x80,
+  0x81,
+  0x82,
+  0x83,
+  0x84,
+  0x85,
+  0x86,
+  0x280040,
+  0x88,
+  0x89,
+  0x8a,
+  0x50200,
+  0x8c,
+  0xa800,
+  0x500100,
+  0x1410,
+  0x90,
+  0x91,
+  0x92,
+  0x8120,
+  0x94,
+  0x160000,
+  0x4a00,
+  0x1408,
+  0x98,
+  0x404040,
+  0x222000,
+  0x1404,
+  0x90020,
+  0x1402,
+  0x1401,
+  0x1400,
+  0xa0,
+  0xa1,
+  0xa2,
+  0x8110,
+  0xa4,
+  0x401200,
+  0x42400,
+  0x110800,
+  0xa8,
+  0x300400,
+  0x1840,
+  0x482000,
+  0x90010,
+  0x40140,
+  0x208200,
+  0x24080,
+  0xb0,
+  0x8102,
+  0x8101,
+  0x8100,
+  0x90008,
+  0x206000,
+  0x420040,
+  0x8104,
+  0x90004,
+  0x20a00,
+  0x144000,
+  0x8108,
+  0x90000,
+  0x90001,
+  0x90002,
+  0x1420,
+  0xc0,
+  0xc1,
+  0xc2,
+  0x280004,
+  0xc4,
+  0x280002,
+  0x280001,
+  0x280000,
+  0xc8,
+  0x404010,
+  0x1820,
+  0x128000,
+  0x20600,
+  0x40120,
+  0x16000,
+  0x280008,
+  0xd0,
+  0x404008,
+  0x110400,
+  0x42800,
+  0x3100,
+  0x18200,
+  0x420020,
+  0x280010,
+  0x404001,
+  0x404000,
+  0x80300,
+  0x404002,
+  0x300800,
+  0x404004,
+  0x48080,
+  0x1440,
+  0xe0,
+  0x32000,
+  0x1808,
+  0x4600,
+  0x10c000,
+  0x40108,
+  0x420010,
+  0x280020,
+  0x1802,
+  0x40104,
+  0x1800,
+  0x1801,
+  0x40101,
+  0x40100,
+  0x1804,
+  0x40102,
+  0x240200,
+  0x181000,
+  0x420004,
+  0x8140,
+  0x420002,
+  0xc80,
+  0x420000,
+  0x420001,
+  0xa400,
+  0x404020,
+  0x1810,
+  0x210080,
+  0x90040,
+  0x40110,
+  0x420008,
+  0x102200,
+  0x100,
+  0x101,
+  0x102,
+  0x103,
+  0x104,
+  0x105,
+  0x106,
+  0x41800,
+  0x108,
+  0x109,
+  0x10a,
+  0x2440,
+  0x10c,
+  0x200210,
+  0x500080,
+  0x98000,
+  0x110,
+  0x111,
+  0x112,
+  0x80a0,
+  0x114,
+  0x200208,
+  0xa0400,
+  0x104040,
+  0x118,
+  0x200204,
+  0x15000,
+  0x460000,
+  0x200201,
+  0x200200,
+  0x2820,
+  0x200202,
+  0x120,
+  0x121,
+  0x122,
+  0x8090,
+  0x124,
+  0x182000,
+  0x10240,
+  0x600400,
+  0x128,
+  0x410800,
+  0x2c0000,
+  0x101200,
+  0x9400,
+  0x400c0,
+  0x2810,
+  0x24100,
+  0x130,
+  0x8082,
+  0x8081,
+  0x8080,
+  0x444000,
+  0x31000,
+  0x2808,
+  0x8084,
+  0x120040,
+  0x84400,
+  0x2804,
+  0x8088,
+  0x2802,
+  0x200220,
+  0x2800,
+  0x2801,
+  0x140,
+  0x141,
+  0x142,
+  0x2408,
+  0x144,
+  0x428000,
+  0x10220,
+  0x104010,
+  0x148,
+  0x2402,
+  0x2401,
+  0x2400,
+  0x84800,
+  0x400a0,
+  0x221000,
+  0x2404,
+  0x150,
+  0xd0000,
+  0x600800,
+  0x104004,
+  0x3080,
+  0x104002,
+  0x104001,
+  0x104000,
+  0x120020,
+  0x9800,
+  0x80280,
+  0x2410,
+  0x410400,
+  0x200240,
+  0x48100,
+  0x104008,
+  0x160,
+  0x205000,
+  0x10204,
+  0xa0800,
+  0x10202,
+  0x40088,
+  0x10200,
+  0x10201,
+  0x120010,
+  0x40084,
+  0x40c000,
+  0x2420,
+  0x40081,
+  0x40080,
+  0x10208,
+  0x40082,
+  0x120008,
+  0x402200,
+  0x41400,
+  0x80c0,
+  0x288000,
+  0xd00,
+  0x10210,
+  0x104020,
+  0x120000,
+  0x120001,
+  0x120002,
+  0x210100,
+  0x120004,
+  0x40090,
+  0x2840,
+  0x481000,
+  0x180,
+  0x181,
+  0x182,
+  0x8030,
+  0x184,
+  0x14400,
+  0x500008,
+  0x22200,
+  0x188,
+  0xa1000,
+  0x500004,
+  0x204800,
+  0x500002,
+  0x40060,
+  0x500000,
+  0x500001,
+  0x190,
+  0x8022,
+  0x8021,
+  0x8020,
+  0x3040,
+  0x480800,
+  0x250000,
+  0x8024,
+  0x40c00,
+  0x112000,
+  0x80240,
+  0x8028,
+  0x2c000,
+  0x200280,
+  0x500010,
+  0x1500,
+  0x1a0,
+  0x8012,
+  0x8011,
+  0x8010,
+  0x220800,
+  0x40048,
+  0x85000,
+  0x8014,
+  0x6200,
+  0x40044,
+  0x30400,
+  0x8018,
+  0x40041,
+  0x40040,
+  0x500020,
+  0x40042,
+  0x8003,
+  0x8002,
+  0x8001,
+  0x8000,
+  0x100600,
+  0x8006,
+  0x8005,
+  0x8004,
+  0x601000,
+  0x800a,
+  0x8009,
+  0x8008,
+  0x90100,
+  0x40050,
+  0x2880,
+  0x800c,
+  0x1c0,
+  0x100a00,
+  0x64000,
+  0x411000,
+  0x3010,
+  0x40028,
+  0x8c00,
+  0x280100,
+  0x218000,
+  0x40024,
+  0x80210,
+  0x2480,
+  0x40021,
+  0x40020,
+  0x500040,
+  0x40022,
+  0x3004,
+  0x220400,
+  0x80208,
+  0x8060,
+  0x3000,
+  0x3001,
+  0x3002,
+  0x104080,
+  0x80202,
+  0x404100,
+  0x80200,
+  0x80201,
+  0x3008,
+  0x40030,
+  0x80204,
+  0x30800,
+  0x480400,
+  0x4000c,
+  0x302000,
+  0x8050,
+  0x40009,
+  0x40008,
+  0x10280,
+  0x4000a,
+  0x40005,
+  0x40004,
+  0x1900,
+  0x40006,
+  0x40001,
+  0x40000,
+  0x40003,
+  0x40002,
+  0x14800,
+  0x8042,
+  0x8041,
+  0x8040,
+  0x3020,
+  0x40018,
+  0x420100,
+  0x8044,
+  0x120080,
+  0x40014,
+  0x80220,
+  0x8048,
+  0x40011,
+  0x40010,
+  0x204400,
+  0x40012,
+  0x200,
+  0x201,
+  0x202,
+  0x203,
+  0x204,
+  0x205,
+  0x206,
+  0x108400,
+  0x208,
+  0x209,
+  0x20a,
+  0x50080,
+  0x20c,
+  0x200110,
+  0x83000,
+  0x400840,
+  0x210,
+  0x211,
+  0x212,
+  0x21040,
+  0x214,
+  0x200108,
+  0x4880,
+  0xc0020,
+  0x218,
+  0x200104,
+  0x400420,
+  0xe000,
+  0x200101,
+  0x200100,
+  0x130000,
+  0x200102,
+  0x220,
+  0x221,
+  0x222,
+  0x202800,
+  0x224,
+  0x401080,
+  0x10140,
+  0xc0010,
+  0x228,
+  0x88040,
+  0x400410,
+  0x101100,
+  0x140800,
+  0x12400,
+  0x208080,
+  0x24200,
+  0x230,
+  0x114000,
+  0x400408,
+  0xc0004,
+  0x2a000,
+  0xc0002,
+  0xc0001,
+  0xc0000,
+  0x400402,
+  0x20880,
+  0x400400,
+  0x400401,
+  0x5040,
+  0x200120,
+  0x400404,
+  0xc0008,
+  0x240,
+  0x241,
+  0x242,
+  0x21010,
+  0x244,
+  0x46000,
+  0x10120,
+  0x400808,
+  0x248,
+  0x88020,
+  0x304000,
+  0x400804,
+  0x20480,
+  0x400802,
+  0x400801,
+  0x400800,
+  0x250,
+  0x21002,
+  0x21001,
+  0x21000,
+  0x580000,
+  0x18080,
+  0x202400,
+  0x21004,
+  0x12800,
+  0x140400,
+  0x80180,
+  0x21008,
+  0x5020,
+  0x200140,
+  0x48200,
+  0x400810,
+  0x260,
+  0x88008,
+  0x10104,
+  0x4480,
+  0x10102,
+  0x320000,
+  0x10100,
+  0x10101,
+  0x88001,
+  0x88000,
+  0x62000,
+  0x88002,
+  0x5010,
+  0x88004,
+  0x10108,
+  0x400820,
+  0x240080,
+  0x402100,
+  0x108800,
+  0x21020,
+  0x5008,
+  0xe00,
+  0x10110,
+  0xc0040,
+  0x5004,
+  0x88010,
+  0x400440,
+  0x210200,
+  0x5000,
+  0x5001,
+  0x5002,
+  0x102080,
+  0x280,
+  0x281,
+  0x282,
+  0x50008,
+  0x284,
+  0x401020,
+  0x4810,
+  0x22100,
+  0x288,
+  0x50002,
+  0x50001,
+  0x50000,
+  0x20440,
+  0x184000,
+  0x208020,
+  0x50004,
+  0x290,
+  0x82400,
+  0x4804,
+  0x700000,
+  0x4802,
+  0x18040,
+  0x4800,
+  0x4801,
+  0x109000,
+  0x20820,
+  0x80140,
+  0x50010,
+  0x442000,
+  0x200180,
+  0x4808,
+  0x1600,
+  0x2a0,
+  0x401004,
+  0x1a0000,
+  0x4440,
+  0x401001,
+  0x401000,
+  0x208008,
+  0x401002,
+  0x6100,
+  0x20810,
+  0x208004,
+  0x50020,
+  0x208002,
+  0x401008,
+  0x208000,
+  0x208001,
+  0x240040,
+  0x20808,
+  0x13000,
+  0x8300,
+  0x100500,
+  0x401010,
+  0x4820,
+  0xc0080,
+  0x20801,
+  0x20800,
+  0x400480,
+  0x20802,
+  0x90200,
+  0x20804,
+  0x208010,
+  0x102040,
+  0x2c0,
+  0x100900,
+  0x40a000,
+  0x4420,
+  0x20408,
+  0x18010,
+  0x141000,
+  0x280200,
+  0x20404,
+  0x203000,
+  0x80110,
+  0x50040,
+  0x20400,
+  0x20401,
+  0x20402,
+  0x400880,
+  0x240020,
+  0x18004,
+  0x80108,
+  0x21080,
+  0x18001,
+  0x18000,
+  0x4840,
+  0x18002,
+  0x80102,
+  0x404200,
+  0x80100,
+  0x80101,
+  0x20410,
+  0x18008,
+  0x80104,
+  0x102020,
+  0x240010,
+  0x4402,
+  0x4401,
+  0x4400,
+  0x82800,
+  0x401040,
+  0x10180,
+  0x4404,
+  0x510000,
+  0x88080,
+  0x1a00,
+  0x4408,
+  0x20420,
+  0x40300,
+  0x208040,
+  0x102010,
+  0x240000,
+  0x240001,
+  0x240002,
+  0x4410,
+  0x240004,
+  0x18020,
+  0x420200,
+  0x102008,
+  0x240008,
+  0x20840,
+  0x80120,
+  0x102004,
+  0x5080,
+  0x102002,
+  0x102001,
+  0x102000,
+  0x300,
+  0x301,
+  0x302,
+  0x484000,
+  0x304,
+  0x200018,
+  0x10060,
+  0x22080,
+  0x308,
+  0x200014,
+  0x28800,
+  0x101020,
+  0x200011,
+  0x200010,
+  0x44400,
+  0x200012,
+  0x310,
+  0x20000c,
+  0x142000,
+  0x10c00,
+  0x200009,
+  0x200008,
+  0x409000,
+  0x20000a,
+  0x200005,
+  0x200004,
+  0x800c0,
+  0x200006,
+  0x200001,
+  0x200000,
+  0x200003,
+  0x200002,
+  0x320,
+  0x60400,
+  0x10044,
+  0x101008,
+  0x10042,
+  0xc800,
+  0x10040,
+  0x10041,
+  0x6080,
+  0x101002,
+  0x101001,
+  0x101000,
+  0x4a0000,
+  0x200030,
+  0x10048,
+  0x101004,
+  0x81800,
+  0x402040,
+  0x224000,
+  0x8280,
+  0x100480,
+  0x200028,
+  0x10050,
+  0xc0100,
+  0x58000,
+  0x200024,
+  0x400500,
+  0x101010,
+  0x200021,
+  0x200020,
+  0x2a00,
+  0x200022,
+  0x340,
+  0x100880,
+  0x10024,
+  0x248000,
+  0x10022,
+  0x81400,
+  0x10020,
+  0x10021,
+  0x441000,
+  0x34000,
+  0x80090,
+  0x2600,
+  0x10a000,
+  0x200050,
+  0x10028,
+  0x400900,
+  0xc400,
+  0x402020,
+  0x80088,
+  0x21100,
+  0x60800,
+  0x200048,
+  0x10030,
+  0x104200,
+  0x80082,
+  0x200044,
+  0x80080,
+  0x80081,
+  0x200041,
+  0x200040,
+  0x80084,
+  0x200042,
+  0x10006,
+  0x402010,
+  0x10004,
+  0x10005,
+  0x10002,
+  0x10003,
+  0x10000,
+  0x10001,
+  0x200c00,
+  0x88100,
+  0x1000c,
+  0x101040,
+  0x1000a,
+  0x40280,
+  0x10008,
+  0x10009,
+  0x402001,
+  0x402000,
+  0x10014,
+  0x402002,
+  0x10012,
+  0x402004,
+  0x10010,
+  0x10011,
+  0x120200,
+  0x402008,
+  0x800a0,
+  0x44800,
+  0x5100,
+  0x200060,
+  0x10018,
+  0x28400,
+  0x380,
+  0x100840,
+  0x201400,
+  0x22004,
+  0xc8000,
+  0x22002,
+  0x22001,
+  0x22000,
+  0x6020,
+  0x408400,
+  0x80050,
+  0x50100,
+  0x11800,
+  0x200090,
+  0x500200,
+  0x22008,
+  0x430000,
+  0x45000,
+  0x80048,
+  0x8220,
+  0x100420,
+  0x200088,
+  0x4900,
+  0x22010,
+  0x80042,
+  0x200084,
+  0x80040,
+  0x80041,
+  0x200081,
+  0x200080,
+  0x80044,
+  0x200082,
+  0x6008,
+  0x290000,
+  0x440800,
+  0x8210,
+  0x100410,
+  0x401100,
+  0x100c0,
+  0x22020,
+  0x6000,
+  0x6001,
+  0x6002,
+  0x101080,
+  0x6004,
+  0x40240,
+  0x208100,
+  0x80c00,
+  0x100404,
+  0x8202,
+  0x8201,
+  0x8200,
+  0x100400,
+  0x100401,
+  0x100402,
+  0x8204,
+  0x6010,
+  0x20900,
+  0x80060,
+  0x8208,
+  0x100408,
+  0x2000a0,
+  0x61000,
+  0x414000,
+  0x100801,
+  0x100800,
+  0x80018,
+  0x100802,
+  0x604000,
+  0x100804,
+  0x100a0,
+  0x22040,
+  0x80012,
+  0x100808,
+  0x80010,
+  0x80011,
+  0x20500,
+  0x40220,
+  0x80014,
+  0xd000,
+  0x8000a,
+  0x100810,
+  0x80008,
+  0x80009,
+  0x3200,
+  0x18100,
+  0x8000c,
+  0x440400,
+  0x80002,
+  0x80003,
+  0x80000,
+  0x80001,
+  0x80006,
+  0x2000c0,
+  0x80004,
+  0x80005,
+  0x29000,
+  0x100820,
+  0x10084,
+  0x4500,
+  0x10082,
+  0x40208,
+  0x10080,
+  0x10081,
+  0x6040,
+  0x40204,
+  0x80030,
+  0x620000,
+  0x40201,
+  0x40200,
+  0x10088,
+  0x40202,
+  0x240100,
+  0x402080,
+  0x80028,
+  0x8240,
+  0x100440,
+  0xa4000,
+  0x10090,
+  0x201800,
+  0x80022,
+  0x11400,
+  0x80020,
+  0x80021,
+  0x408800,
+  0x40210,
+  0x80024,
+  0x102100,
+  0x400,
+  0x401,
+  0x402,
+  0x403,
+  0x404,
+  0x405,
+  0x406,
+  0x108200,
+  0x408,
+  0x409,
+  0x40a,
+  0x2140,
+  0x40c,
+  0x4c0000,
+  0x210800,
+  0x1090,
+  0x410,
+  0x411,
+  0x412,
+  0x244000,
+  0x414,
+  0x860,
+  0xa0100,
+  0x1088,
+  0x418,
+  0x38000,
+  0x400220,
+  0x1084,
+  0x106000,
+  0x1082,
+  0x1081,
+  0x1080,
+  0x420,
+  0x421,
+  0x422,
+  0x91000,
+  0x424,
+  0x850,
+  0x42080,
+  0x600100,
+  0x428,
+  0x300080,
+  0x400210,
+  0x48800,
+  0x9100,
+  0x12200,
+  0x180040,
+  0x24400,
+  0x430,
+  0x844,
+  0x400208,
+  0x122000,
+  0x841,
+  0x840,
+  0x1c000,
+  0x842,
+  0x400202,
+  0x84100,
+  0x400200,
+  0x400201,
+  0x260000,
+  0x848,
+  0x400204,
+  0x10a0,
+  0x440,
+  0x441,
+  0x442,
+  0x2108,
+  0x444,
+  0x830,
+  0x405000,
+  0x70000,
+  0x448,
+  0x2102,
+  0x2101,
+  0x2100,
+  0x20280,
+  0x20c000,
+  0x180020,
+  0x2104,
+  0x450,
+  0x824,
+  0x110080,
+  0x488000,
+  0x821,
+  0x820,
+  0x202200,
+  0x822,
+  0x281000,
+  0x140200,
+  0x24800,
+  0x2110,
+  0x410100,
+  0x828,
+  0x48400,
+  0x10c0,
+  0x460,
+  0x814,
+  0x228000,
+  0x4280,
+  0x811,
+  0x810,
+  0x180008,
+  0x812,
+  0x54000,
+  0x421000,
+  0x180004,
+  0x2120,
+  0x180002,
+  0x818,
+  0x180000,
+  0x180001,
+  0x805,
+  0x804,
+  0x41100,
+  0x806,
+  0x801,
+  0x800,
+  0x803,
+  0x802,
+  0xa080,
+  0x80c,
+  0x400240,
+  0x210400,
+  0x809,
+  0x808,
+  0x180010,
+  0x80a,
+  0x480,
+  0x481,
+  0x482,
+  0x420800,
+  0x484,
+  0x14100,
+  0x42020,
+  0x1018,
+  0x488,
+  0x300020,
+  0x8c000,
+  0x1014,
+  0x20240,
+  0x1012,
+  0x1011,
+  0x1010,
+  0x490,
+  0x82200,
+  0x110040,
+  0x100c,
+  0x608000,
+  0x100a,
+  0x1009,
+  0x1008,
+  0x40900,
+  0x1006,
+  0x1005,
+  0x1004,
+  0x1003,
+  0x1002,
+  0x1001,
+  0x1000,
+  0x4a0,
+  0x300008,
+  0x42004,
+  0x4240,
+  0x42002,
+  0xa8000,
+  0x42000,
+  0x42001,
+  0x300001,
+  0x300000,
+  0x30100,
+  0x300002,
+  0x404800,
+  0x300004,
+  0x42008,
+  0x1030,
+  0x25000,
+  0x450000,
+  0x280800,
+  0x8500,
+  0x100300,
+  0x8c0,
+  0x42010,
+  0x1028,
+  0xa040,
+  0x300010,
+  0x400280,
+  0x1024,
+  0x90400,
+  0x1022,
+  0x1021,
+  0x1020,
+  0x4c0,
+  0x49000,
+  0x110010,
+  0x4220,
+  0x20208,
+  0x502000,
+  0x8900,
+  0x280400,
+  0x20204,
+  0x90800,
+  0x640000,
+  0x2180,
+  0x20200,
+  0x20201,
+  0x20202,
+  0x1050,
+  0x110002,
+  0x220100,
+  0x110000,
+  0x110001,
+  0xc4000,
+  0x8a0,
+  0x110004,
+  0x1048,
+  0xa020,
+  0x404400,
+  0x110008,
+  0x1044,
+  0x20210,
+  0x1042,
+  0x1041,
+  0x1040,
+  0x480100,
+  0x4202,
+  0x4201,
+  0x4200,
+  0x211000,
+  0x890,
+  0x42040,
+  0x4204,
+  0xa010,
+  0x300040,
+  0x1c00,
+  0x4208,
+  0x20220,
+  0x40500,
+  0x180080,
+  0x418000,
+  0xa008,
+  0x884,
+  0x110020,
+  0x4210,
+  0x881,
+  0x880,
+  0x420400,
+  0x882,
+  0xa000,
+  0xa001,
+  0xa002,
+  0xe0000,
+  0xa004,
+  0x888,
+  0x204100,
+  0x1060,
+  0x500,
+  0x501,
+  0x502,
+  0x2048,
+  0x504,
+  0x14080,
+  0xa0010,
+  0x600020,
+  0x508,
+  0x2042,
+  0x2041,
+  0x2040,
+  0x9020,
+  0x120800,
+  0x44200,
+  0x2044,
+  0x510,
+  0x501000,
+  0xa0004,
+  0x10a00,
+  0xa0002,
+  0x4a000,
+  0xa0000,
+  0xa0001,
+  0x40880,
+  0x84020,
+  0x308000,
+  0x2050,
+  0x410040,
+  0x200600,
+  0xa0008,
+  0x1180,
+  0x520,
+  0x60200,
+  0x104800,
+  0x600004,
+  0x9008,
+  0x600002,
+  0x600001,
+  0x600000,
+  0x9004,
+  0x84010,
+  0x30080,
+  0x2060,
+  0x9000,
+  0x9001,
+  0x9002,
+  0x600008,
+  0x212000,
+  0x84008,
+  0x41040,
+  0x8480,
+  0x100280,
+  0x940,
+  0xa0020,
+  0x600010,
+  0x84001,
+  0x84000,
+  0x400300,
+  0x84002,
+  0x9010,
+  0x84004,
+  0x2c00,
+  0x150000,
+  0x540,
+  0x200a,
+  0x2009,
+  0x2008,
+  0x340000,
+  0x81200,
+  0x8880,
+  0x200c,
+  0x2003,
+  0x2002,
+  0x2001,
+  0x2000,
+  0x410010,
+  0x2006,
+  0x2005,
+  0x2004,
+  0xc200,
+  0x220080,
+  0x41020,
+  0x2018,
+  0x410008,
+  0x920,
+  0xa0040,
+  0x104400,
+  0x410004,
+  0x2012,
+  0x2011,
+  0x2010,
+  0x410000,
+  0x410001,
+  0x410002,
+  0x2014,
+  0x480080,
+  0x118000,
+  0x41010,
+  0x2028,
+  0x26000,
+  0x910,
+  0x10600,
+  0x600040,
+  0x200a00,
+  0x2022,
+  0x2021,
+  0x2020,
+  0x9040,
+  0x40480,
+  0x180100,
+  0x2024,
+  0x41002,
+  0x904,
+  0x41000,
+  0x41001,
+  0x901,
+  0x900,
+  0x41004,
+  0x902,
+  0x120400,
+  0x84040,
+  0x41008,
+  0x2030,
+  0x410020,
+  0x908,
+  0x204080,
+  0x28200,
+  0x580,
+  0x14004,
+  0x201200,
+  0x1c0000,
+  0x14001,
+  0x14000,
+  0x8840,
+  0x14002,
+  0x40810,
+  0x408200,
+  0x30020,
+  0x20c0,
+  0x282000,
+  0x14008,
+  0x500400,
+  0x1110,
+  0x40808,
+  0x220040,
+  0x406000,
+  0x8420,
+  0x100220,
+  0x14010,
+  0xa0080,
+  0x1108,
+  0x40800,
+  0x40801,
+  0x40802,
+  0x1104,
+  0x40804,
+  0x1102,
+  0x1101,
+  0x1100,
+  0x480040,
+  0x3800,
+  0x30008,
+  0x8410,
+  0x100210,
+  0x14020,
+  0x42100,
+  0x600080,
+  0x30002,
+  0x300100,
+  0x30000,
+  0x30001,
+  0x9080,
+  0x40440,
+  0x30004,
+  0x80a00,
+  0x100204,
+  0x8402,
+  0x8401,
+  0x8400,
+  0x100200,
+  0x100201,
+  0x100202,
+  0x8404,
+  0x40820,
+  0x84080,
+  0x30010,
+  0x8408,
+  0x100208,
+  0x422000,
+  0x204040,
+  0x1120,
+  0x480020,
+  0x220010,
+  0x8804,
+  0x2088,
+  0x8802,
+  0x14040,
+  0x8800,
+  0x8801,
+  0x105000,
+  0x2082,
+  0x2081,
+  0x2080,
+  0x20300,
+  0x40420,
+  0x8808,
+  0x2084,
+  0x220001,
+  0x220000,
+  0x110100,
+  0x220002,
+  0x3400,
+  0x220004,
+  0x8810,
+  0x440200,
+  0x40840,
+  0x220008,
+  0x80600,
+  0x2090,
+  0x410080,
+  0x188000,
+  0x204020,
+  0x1140,
+  0x480000,
+  0x480001,
+  0x480002,
+  0x4300,
+  0x480004,
+  0x40408,
+  0x8820,
+  0x121000,
+  0x480008,
+  0x40404,
+  0x30040,
+  0x20a0,
+  0x40401,
+  0x40400,
+  0x204010,
+  0x40402,
+  0x480010,
+  0x220020,
+  0x41080,
+  0x8440,
+  0x100240,
+  0x980,
+  0x204008,
+  0x92000,
+  0xa100,
+  0x11200,
+  0x204004,
+  0x500800,
+  0x204002,
+  0x40410,
+  0x204000,
+  0x204001,
+  0x600,
+  0x601,
+  0x602,
+  0x108004,
+  0x604,
+  0x108002,
+  0x108001,
+  0x108000,
+  0x608,
+  0x5800,
+  0x400030,
+  0x2a0000,
+  0x200c0,
+  0x12020,
+  0x44100,
+  0x108008,
+  0x610,
+  0x82080,
+  0x400028,
+  0x10900,
+  0x51000,
+  0x424000,
+  0x202040,
+  0x108010,
+  0x400022,
+  0x140040,
+  0x400020,
+  0x400021,
+  0x88800,
+  0x200500,
+  0x400024,
+  0x1280,
+  0x620,
+  0x60100,
+  0x400018,
+  0x40c0,
+  0x284000,
+  0x12008,
+  0x21800,
+  0x108020,
+  0x400012,
+  0x12004,
+  0x400010,
+  0x400011,
+  0x12001,
+  0x12000,
+  0x400014,
+  0x12002,
+  0x40000a,
+  0x209000,
+  0x400008,
+  0x400009,
+  0x100180,
+  0xa40,
+  0x40000c,
+  0xc0400,
+  0x400002,
+  0x400003,
+  0x400000,
+  0x400001,
+  0x400006,
+  0x12010,
+  0x400004,
+  0x400005,
+  0x640,
+  0x610000,
+  0xc0800,
+  0x40a0,
+  0x20088,
+  0x81100,
+  0x202010,
+  0x108040,
+  0x20084,
+  0x140010,
+  0x19000,
+  0x2300,
+  0x20080,
+  0x20081,
+  0x20082,
+  0x400c00,
+  0xc100,
+  0x140008,
+  0x202004,
+  0x21400,
+  0x202002,
+  0xa20,
+  0x202000,
+  0x202001,
+  0x140001,
+  0x140000,
+  0x400060,
+  0x140002,
+  0x20090,
+  0x140004,
+  0x202008,
+  0x94000,
+  0x103000,
+  0x4082,
+  0x4081,
+  0x4080,
+  0x448000,
+  0xa10,
+  0x10500,
+  0x4084,
+  0x200900,
+  0x88400,
+  0x400050,
+  0x4088,
+  0x200a0,
+  0x12040,
+  0x180200,
+  0x241000,
+  0xb0000,
+  0xa04,
+  0x400048,
+  0x4090,
+  0xa01,
+  0xa00,
+  0x202020,
+  0xa02,
+  0x400042,
+  0x140020,
+  0x400040,
+  0x400041,
+  0x5400,
+  0xa08,
+  0x400044,
+  0x28100,
+  0x680,
+  0x82010,
+  0x201100,
+  0x4060,
+  0x20048,
+  0x240800,
+  0x490000,
+  0x108080,
+  0x20044,
+  0x408100,
+  0x102800,
+  0x50400,
+  0x20040,
+  0x20041,
+  0x20042,
+  0x1210,
+  0x82001,
+  0x82000,
+  0x68000,
+  0x82002,
+  0x100120,
+  0x82004,
+  0x4c00,
+  0x1208,
+  0x214000,
+  0x82008,
+  0x4000a0,
+  0x1204,
+  0x20050,
+  0x1202,
+  0x1201,
+  0x1200,
+  0x18800,
+  0x4042,
+  0x4041,
+  0x4040,
+  0x100110,
+  0x401400,
+  0x42200,
+  0x4044,
+  0xc1000,
+  0x300200,
+  0x400090,
+  0x4048,
+  0x20060,
+  0x12080,
+  0x208400,
+  0x80900,
+  0x100104,
+  0x82020,
+  0x400088,
+  0x4050,
+  0x100100,
+  0x100101,
+  0x100102,
+  0x230000,
+  0x400082,
+  0x20c00,
+  0x400080,
+  0x400081,
+  0x100108,
+  0x4c000,
+  0x400084,
+  0x1220,
+  0x2000c,
+  0x4022,
+  0x4021,
+  0x4020,
+  0x20008,
+  0x20009,
+  0x2000a,
+  0x4024,
+  0x20004,
+  0x20005,
+  0x20006,
+  0x4028,
+  0x20000,
+  0x20001,
+  0x20002,
+  0x20003,
+  0x401800,
+  0x82040,
+  0x110200,
+  0x4030,
+  0x20018,
+  0x18400,
+  0x202080,
+  0x440100,
+  0x20014,
+  0x140080,
+  0x80500,
+  0x208800,
+  0x20010,
+  0x20011,
+  0x20012,
+  0x1240,
+  0x4003,
+  0x4002,
+  0x4001,
+  0x4000,
+  0x20028,
+  0x4006,
+  0x4005,
+  0x4004,
+  0x20024,
+  0x400a,
+  0x4009,
+  0x4008,
+  0x20020,
+  0x20021,
+  0x20022,
+  0x400c,
+  0x240400,
+  0x4012,
+  0x4011,
+  0x4010,
+  0x100140,
+  0xa80,
+  0x89000,
+  0x4014,
+  0xa200,
+  0x11100,
+  0x4000c0,
+  0x4018,
+  0x20030,
+  0x680000,
+  0x50800,
+  0x102400,
+  0x700,
+  0x60020,
+  0x201080,
+  0x10810,
+  0x402800,
+  0x81040,
+  0x44008,
+  0x108100,
+  0x190000,
+  0x408080,
+  0x44004,
+  0x2240,
+  0x44002,
+  0x200410,
+  0x44000,
+  0x44001,
+  0xc040,
+  0x10802,
+  0x10801,
+  0x10800,
+  0x1000a0,
+  0x200408,
+  0xa0200,
+  0x10804,
+  0x23000,
+  0x200404,
+  0x400120,
+  0x10808,
+  0x200401,
+  0x200400,
+  0x44010,
+  0x200402,
+  0x60001,
+  0x60000,
+  0x8a000,
+  0x60002,
+  0x100090,
+  0x60004,
+  0x10440,
+  0x600200,
+  0x200840,
+  0x60008,
+  0x400110,
+  0x101400,
+  0x9200,
+  0x12100,
+  0x44020,
+  0x80880,
+  0x100084,
+  0x60010,
+  0x400108,
+  0x10820,
+  0x100080,
+  0x100081,
+  0x100082,
+  0x7000,
+  0x400102,
+  0x84200,
+  0x400100,
+  0x400101,
+  0x100088,
+  0x200420,
+  0x400104,
+  0x28040,
+  0xc010,
+  0x81004,
+  0x520000,
+  0x2208,
+  0x81001,
+  0x81000,
+  0x10420,
+  0x81002,
+  0x200820,
+  0x2202,
+  0x2201,
+  0x2200,
+  0x20180,
+  0x81008,
+  0x44040,
+  0x2204,
+  0xc000,
+  0xc001,
+  0xc002,
+  0x10840,
+  0xc004,
+  0x81010,
+  0x202100,
+  0x440080,
+  0xc008,
+  0x140100,
+  0x80480,
+  0x2210,
+  0x410200,
+  0x200440,
+  0x101800,
+  0x28020,
+  0x200808,
+  0x60040,
+  0x10404,
+  0x4180,
+  0x10402,
+  0x81020,
+  0x10400,
+  0x10401,
+  0x200800,
+  0x200801,
+  0x200802,
+  0x2220,
+  0x200804,
+  0x504000,
+  0x10408,
+  0x28010,
+  0xc020,
+  0x402400,
+  0x41200,
+  0x380000,
+  0x1000c0,
+  0xb00,
+  0x10410,
+  0x28008,
+  0x200810,
+  0x11080,
+  0x400140,
+  0x28004,
+  0xc2000,
+  0x28002,
+  0x28001,
+  0x28000,
+  0x201002,
+  0x408008,
+  0x201000,
+  0x201001,
+  0x100030,
+  0x14200,
+  0x201004,
+  0x22400,
+  0x408001,
+  0x408000,
+  0x201008,
+  0x408002,
+  0x20140,
+  0x408004,
+  0x44080,
+  0x80820,
+  0x100024,
+  0x82100,
+  0x201010,
+  0x10880,
+  0x100020,
+  0x100021,
+  0x100022,
+  0x440040,
+  0x40a00,
+  0x408010,
+  0x80440,
+  0x124000,
+  0x100028,
+  0x200480,
+  0x1a000,
+  0x1300,
+  0x100014,
+  0x60080,
+  0x201020,
+  0x4140,
+  0x100010,
+  0x100011,
+  0x100012,
+  0x80808,
+  0x6400,
+  0x408020,
+  0x30200,
+  0x80804,
+  0x100018,
+  0x80802,
+  0x80801,
+  0x80800,
+  0x100004,
+  0x100005,
+  0x100006,
+  0x8600,
+  0x100000,
+  0x100001,
+  0x100002,
+  0x100003,
+  0x10000c,
+  0x11040,
+  0x400180,
+  0x242000,
+  0x100008,
+  0x100009,
+  0x10000a,
+  0x80810,
+  0x52000,
+  0x100c00,
+  0x201040,
+  0x4120,
+  0x20108,
+  0x81080,
+  0x8a00,
+  0x440010,
+  0x20104,
+  0x408040,
+  0x80410,
+  0x2280,
+  0x20100,
+  0x20101,
+  0x20102,
+  0x310000,
+  0xc080,
+  0x220200,
+  0x80408,
+  0x440004,
+  0x100060,
+  0x440002,
+  0x440001,
+  0x440000,
+  0x80402,
+  0x11020,
+  0x80400,
+  0x80401,
+  0x20110,
+  0x6800,
+  0x80404,
+  0x440008,
+  0x480200,
+  0x4102,
+  0x4101,
+  0x4100,
+  0x100050,
+  0x20a000,
+  0x10480,
+  0x4104,
+  0x200880,
+  0x11010,
+  0x148000,
+  0x4108,
+  0x20120,
+  0x40600,
+  0x403000,
+  0x80840,
+  0x100044,
+  0x11008,
+  0x22800,
+  0x4110,
+  0x100040,
+  0x100041,
+  0x100042,
+  0x440020,
+  0x11001,
+  0x11000,
+  0x80420,
+  0x11002,
+  0x100048,
+  0x11004,
+  0x204200,
+  0x28080
+};
diff --git a/codec2/tags/0.4/src/golayenctable.h b/codec2/tags/0.4/src/golayenctable.h
new file mode 100644 (file)
index 0000000..048cee8
--- /dev/null
@@ -0,0 +1,4100 @@
+/* Generated by golay23.c -DGOLAY23_MAKETABLE */
+
+const int static encoding_table[]={
+  0x0,
+  0xc75,
+  0x149f,
+  0x18ea,
+  0x254b,
+  0x293e,
+  0x31d4,
+  0x3da1,
+  0x46e3,
+  0x4a96,
+  0x527c,
+  0x5e09,
+  0x63a8,
+  0x6fdd,
+  0x7737,
+  0x7b42,
+  0x81b3,
+  0x8dc6,
+  0x952c,
+  0x9959,
+  0xa4f8,
+  0xa88d,
+  0xb067,
+  0xbc12,
+  0xc750,
+  0xcb25,
+  0xd3cf,
+  0xdfba,
+  0xe21b,
+  0xee6e,
+  0xf684,
+  0xfaf1,
+  0x10366,
+  0x10f13,
+  0x117f9,
+  0x11b8c,
+  0x1262d,
+  0x12a58,
+  0x132b2,
+  0x13ec7,
+  0x14585,
+  0x149f0,
+  0x1511a,
+  0x15d6f,
+  0x160ce,
+  0x16cbb,
+  0x17451,
+  0x17824,
+  0x182d5,
+  0x18ea0,
+  0x1964a,
+  0x19a3f,
+  0x1a79e,
+  0x1abeb,
+  0x1b301,
+  0x1bf74,
+  0x1c436,
+  0x1c843,
+  0x1d0a9,
+  0x1dcdc,
+  0x1e17d,
+  0x1ed08,
+  0x1f5e2,
+  0x1f997,
+  0x206cc,
+  0x20ab9,
+  0x21253,
+  0x21e26,
+  0x22387,
+  0x22ff2,
+  0x23718,
+  0x23b6d,
+  0x2402f,
+  0x24c5a,
+  0x254b0,
+  0x258c5,
+  0x26564,
+  0x26911,
+  0x271fb,
+  0x27d8e,
+  0x2877f,
+  0x28b0a,
+  0x293e0,
+  0x29f95,
+  0x2a234,
+  0x2ae41,
+  0x2b6ab,
+  0x2bade,
+  0x2c19c,
+  0x2cde9,
+  0x2d503,
+  0x2d976,
+  0x2e4d7,
+  0x2e8a2,
+  0x2f048,
+  0x2fc3d,
+  0x305aa,
+  0x309df,
+  0x31135,
+  0x31d40,
+  0x320e1,
+  0x32c94,
+  0x3347e,
+  0x3380b,
+  0x34349,
+  0x34f3c,
+  0x357d6,
+  0x35ba3,
+  0x36602,
+  0x36a77,
+  0x3729d,
+  0x37ee8,
+  0x38419,
+  0x3886c,
+  0x39086,
+  0x39cf3,
+  0x3a152,
+  0x3ad27,
+  0x3b5cd,
+  0x3b9b8,
+  0x3c2fa,
+  0x3ce8f,
+  0x3d665,
+  0x3da10,
+  0x3e7b1,
+  0x3ebc4,
+  0x3f32e,
+  0x3ff5b,
+  0x401ed,
+  0x40d98,
+  0x41572,
+  0x41907,
+  0x424a6,
+  0x428d3,
+  0x43039,
+  0x43c4c,
+  0x4470e,
+  0x44b7b,
+  0x45391,
+  0x45fe4,
+  0x46245,
+  0x46e30,
+  0x476da,
+  0x47aaf,
+  0x4805e,
+  0x48c2b,
+  0x494c1,
+  0x498b4,
+  0x4a515,
+  0x4a960,
+  0x4b18a,
+  0x4bdff,
+  0x4c6bd,
+  0x4cac8,
+  0x4d222,
+  0x4de57,
+  0x4e3f6,
+  0x4ef83,
+  0x4f769,
+  0x4fb1c,
+  0x5028b,
+  0x50efe,
+  0x51614,
+  0x51a61,
+  0x527c0,
+  0x52bb5,
+  0x5335f,
+  0x53f2a,
+  0x54468,
+  0x5481d,
+  0x550f7,
+  0x55c82,
+  0x56123,
+  0x56d56,
+  0x575bc,
+  0x579c9,
+  0x58338,
+  0x58f4d,
+  0x597a7,
+  0x59bd2,
+  0x5a673,
+  0x5aa06,
+  0x5b2ec,
+  0x5be99,
+  0x5c5db,
+  0x5c9ae,
+  0x5d144,
+  0x5dd31,
+  0x5e090,
+  0x5ece5,
+  0x5f40f,
+  0x5f87a,
+  0x60721,
+  0x60b54,
+  0x613be,
+  0x61fcb,
+  0x6226a,
+  0x62e1f,
+  0x636f5,
+  0x63a80,
+  0x641c2,
+  0x64db7,
+  0x6555d,
+  0x65928,
+  0x66489,
+  0x668fc,
+  0x67016,
+  0x67c63,
+  0x68692,
+  0x68ae7,
+  0x6920d,
+  0x69e78,
+  0x6a3d9,
+  0x6afac,
+  0x6b746,
+  0x6bb33,
+  0x6c071,
+  0x6cc04,
+  0x6d4ee,
+  0x6d89b,
+  0x6e53a,
+  0x6e94f,
+  0x6f1a5,
+  0x6fdd0,
+  0x70447,
+  0x70832,
+  0x710d8,
+  0x71cad,
+  0x7210c,
+  0x72d79,
+  0x73593,
+  0x739e6,
+  0x742a4,
+  0x74ed1,
+  0x7563b,
+  0x75a4e,
+  0x767ef,
+  0x76b9a,
+  0x77370,
+  0x77f05,
+  0x785f4,
+  0x78981,
+  0x7916b,
+  0x79d1e,
+  0x7a0bf,
+  0x7acca,
+  0x7b420,
+  0x7b855,
+  0x7c317,
+  0x7cf62,
+  0x7d788,
+  0x7dbfd,
+  0x7e65c,
+  0x7ea29,
+  0x7f2c3,
+  0x7feb6,
+  0x803da,
+  0x80faf,
+  0x81745,
+  0x81b30,
+  0x82691,
+  0x82ae4,
+  0x8320e,
+  0x83e7b,
+  0x84539,
+  0x8494c,
+  0x851a6,
+  0x85dd3,
+  0x86072,
+  0x86c07,
+  0x874ed,
+  0x87898,
+  0x88269,
+  0x88e1c,
+  0x896f6,
+  0x89a83,
+  0x8a722,
+  0x8ab57,
+  0x8b3bd,
+  0x8bfc8,
+  0x8c48a,
+  0x8c8ff,
+  0x8d015,
+  0x8dc60,
+  0x8e1c1,
+  0x8edb4,
+  0x8f55e,
+  0x8f92b,
+  0x900bc,
+  0x90cc9,
+  0x91423,
+  0x91856,
+  0x925f7,
+  0x92982,
+  0x93168,
+  0x93d1d,
+  0x9465f,
+  0x94a2a,
+  0x952c0,
+  0x95eb5,
+  0x96314,
+  0x96f61,
+  0x9778b,
+  0x97bfe,
+  0x9810f,
+  0x98d7a,
+  0x99590,
+  0x999e5,
+  0x9a444,
+  0x9a831,
+  0x9b0db,
+  0x9bcae,
+  0x9c7ec,
+  0x9cb99,
+  0x9d373,
+  0x9df06,
+  0x9e2a7,
+  0x9eed2,
+  0x9f638,
+  0x9fa4d,
+  0xa0516,
+  0xa0963,
+  0xa1189,
+  0xa1dfc,
+  0xa205d,
+  0xa2c28,
+  0xa34c2,
+  0xa38b7,
+  0xa43f5,
+  0xa4f80,
+  0xa576a,
+  0xa5b1f,
+  0xa66be,
+  0xa6acb,
+  0xa7221,
+  0xa7e54,
+  0xa84a5,
+  0xa88d0,
+  0xa903a,
+  0xa9c4f,
+  0xaa1ee,
+  0xaad9b,
+  0xab571,
+  0xab904,
+  0xac246,
+  0xace33,
+  0xad6d9,
+  0xadaac,
+  0xae70d,
+  0xaeb78,
+  0xaf392,
+  0xaffe7,
+  0xb0670,
+  0xb0a05,
+  0xb12ef,
+  0xb1e9a,
+  0xb233b,
+  0xb2f4e,
+  0xb37a4,
+  0xb3bd1,
+  0xb4093,
+  0xb4ce6,
+  0xb540c,
+  0xb5879,
+  0xb65d8,
+  0xb69ad,
+  0xb7147,
+  0xb7d32,
+  0xb87c3,
+  0xb8bb6,
+  0xb935c,
+  0xb9f29,
+  0xba288,
+  0xbaefd,
+  0xbb617,
+  0xbba62,
+  0xbc120,
+  0xbcd55,
+  0xbd5bf,
+  0xbd9ca,
+  0xbe46b,
+  0xbe81e,
+  0xbf0f4,
+  0xbfc81,
+  0xc0237,
+  0xc0e42,
+  0xc16a8,
+  0xc1add,
+  0xc277c,
+  0xc2b09,
+  0xc33e3,
+  0xc3f96,
+  0xc44d4,
+  0xc48a1,
+  0xc504b,
+  0xc5c3e,
+  0xc619f,
+  0xc6dea,
+  0xc7500,
+  0xc7975,
+  0xc8384,
+  0xc8ff1,
+  0xc971b,
+  0xc9b6e,
+  0xca6cf,
+  0xcaaba,
+  0xcb250,
+  0xcbe25,
+  0xcc567,
+  0xcc912,
+  0xcd1f8,
+  0xcdd8d,
+  0xce02c,
+  0xcec59,
+  0xcf4b3,
+  0xcf8c6,
+  0xd0151,
+  0xd0d24,
+  0xd15ce,
+  0xd19bb,
+  0xd241a,
+  0xd286f,
+  0xd3085,
+  0xd3cf0,
+  0xd47b2,
+  0xd4bc7,
+  0xd532d,
+  0xd5f58,
+  0xd62f9,
+  0xd6e8c,
+  0xd7666,
+  0xd7a13,
+  0xd80e2,
+  0xd8c97,
+  0xd947d,
+  0xd9808,
+  0xda5a9,
+  0xda9dc,
+  0xdb136,
+  0xdbd43,
+  0xdc601,
+  0xdca74,
+  0xdd29e,
+  0xddeeb,
+  0xde34a,
+  0xdef3f,
+  0xdf7d5,
+  0xdfba0,
+  0xe04fb,
+  0xe088e,
+  0xe1064,
+  0xe1c11,
+  0xe21b0,
+  0xe2dc5,
+  0xe352f,
+  0xe395a,
+  0xe4218,
+  0xe4e6d,
+  0xe5687,
+  0xe5af2,
+  0xe6753,
+  0xe6b26,
+  0xe73cc,
+  0xe7fb9,
+  0xe8548,
+  0xe893d,
+  0xe91d7,
+  0xe9da2,
+  0xea003,
+  0xeac76,
+  0xeb49c,
+  0xeb8e9,
+  0xec3ab,
+  0xecfde,
+  0xed734,
+  0xedb41,
+  0xee6e0,
+  0xeea95,
+  0xef27f,
+  0xefe0a,
+  0xf079d,
+  0xf0be8,
+  0xf1302,
+  0xf1f77,
+  0xf22d6,
+  0xf2ea3,
+  0xf3649,
+  0xf3a3c,
+  0xf417e,
+  0xf4d0b,
+  0xf55e1,
+  0xf5994,
+  0xf6435,
+  0xf6840,
+  0xf70aa,
+  0xf7cdf,
+  0xf862e,
+  0xf8a5b,
+  0xf92b1,
+  0xf9ec4,
+  0xfa365,
+  0xfaf10,
+  0xfb7fa,
+  0xfbb8f,
+  0xfc0cd,
+  0xfccb8,
+  0xfd452,
+  0xfd827,
+  0xfe586,
+  0xfe9f3,
+  0xff119,
+  0xffd6c,
+  0x1007b4,
+  0x100bc1,
+  0x10132b,
+  0x101f5e,
+  0x1022ff,
+  0x102e8a,
+  0x103660,
+  0x103a15,
+  0x104157,
+  0x104d22,
+  0x1055c8,
+  0x1059bd,
+  0x10641c,
+  0x106869,
+  0x107083,
+  0x107cf6,
+  0x108607,
+  0x108a72,
+  0x109298,
+  0x109eed,
+  0x10a34c,
+  0x10af39,
+  0x10b7d3,
+  0x10bba6,
+  0x10c0e4,
+  0x10cc91,
+  0x10d47b,
+  0x10d80e,
+  0x10e5af,
+  0x10e9da,
+  0x10f130,
+  0x10fd45,
+  0x1104d2,
+  0x1108a7,
+  0x11104d,
+  0x111c38,
+  0x112199,
+  0x112dec,
+  0x113506,
+  0x113973,
+  0x114231,
+  0x114e44,
+  0x1156ae,
+  0x115adb,
+  0x11677a,
+  0x116b0f,
+  0x1173e5,
+  0x117f90,
+  0x118561,
+  0x118914,
+  0x1191fe,
+  0x119d8b,
+  0x11a02a,
+  0x11ac5f,
+  0x11b4b5,
+  0x11b8c0,
+  0x11c382,
+  0x11cff7,
+  0x11d71d,
+  0x11db68,
+  0x11e6c9,
+  0x11eabc,
+  0x11f256,
+  0x11fe23,
+  0x120178,
+  0x120d0d,
+  0x1215e7,
+  0x121992,
+  0x122433,
+  0x122846,
+  0x1230ac,
+  0x123cd9,
+  0x12479b,
+  0x124bee,
+  0x125304,
+  0x125f71,
+  0x1262d0,
+  0x126ea5,
+  0x12764f,
+  0x127a3a,
+  0x1280cb,
+  0x128cbe,
+  0x129454,
+  0x129821,
+  0x12a580,
+  0x12a9f5,
+  0x12b11f,
+  0x12bd6a,
+  0x12c628,
+  0x12ca5d,
+  0x12d2b7,
+  0x12dec2,
+  0x12e363,
+  0x12ef16,
+  0x12f7fc,
+  0x12fb89,
+  0x13021e,
+  0x130e6b,
+  0x131681,
+  0x131af4,
+  0x132755,
+  0x132b20,
+  0x1333ca,
+  0x133fbf,
+  0x1344fd,
+  0x134888,
+  0x135062,
+  0x135c17,
+  0x1361b6,
+  0x136dc3,
+  0x137529,
+  0x13795c,
+  0x1383ad,
+  0x138fd8,
+  0x139732,
+  0x139b47,
+  0x13a6e6,
+  0x13aa93,
+  0x13b279,
+  0x13be0c,
+  0x13c54e,
+  0x13c93b,
+  0x13d1d1,
+  0x13dda4,
+  0x13e005,
+  0x13ec70,
+  0x13f49a,
+  0x13f8ef,
+  0x140659,
+  0x140a2c,
+  0x1412c6,
+  0x141eb3,
+  0x142312,
+  0x142f67,
+  0x14378d,
+  0x143bf8,
+  0x1440ba,
+  0x144ccf,
+  0x145425,
+  0x145850,
+  0x1465f1,
+  0x146984,
+  0x14716e,
+  0x147d1b,
+  0x1487ea,
+  0x148b9f,
+  0x149375,
+  0x149f00,
+  0x14a2a1,
+  0x14aed4,
+  0x14b63e,
+  0x14ba4b,
+  0x14c109,
+  0x14cd7c,
+  0x14d596,
+  0x14d9e3,
+  0x14e442,
+  0x14e837,
+  0x14f0dd,
+  0x14fca8,
+  0x15053f,
+  0x15094a,
+  0x1511a0,
+  0x151dd5,
+  0x152074,
+  0x152c01,
+  0x1534eb,
+  0x15389e,
+  0x1543dc,
+  0x154fa9,
+  0x155743,
+  0x155b36,
+  0x156697,
+  0x156ae2,
+  0x157208,
+  0x157e7d,
+  0x15848c,
+  0x1588f9,
+  0x159013,
+  0x159c66,
+  0x15a1c7,
+  0x15adb2,
+  0x15b558,
+  0x15b92d,
+  0x15c26f,
+  0x15ce1a,
+  0x15d6f0,
+  0x15da85,
+  0x15e724,
+  0x15eb51,
+  0x15f3bb,
+  0x15ffce,
+  0x160095,
+  0x160ce0,
+  0x16140a,
+  0x16187f,
+  0x1625de,
+  0x1629ab,
+  0x163141,
+  0x163d34,
+  0x164676,
+  0x164a03,
+  0x1652e9,
+  0x165e9c,
+  0x16633d,
+  0x166f48,
+  0x1677a2,
+  0x167bd7,
+  0x168126,
+  0x168d53,
+  0x1695b9,
+  0x1699cc,
+  0x16a46d,
+  0x16a818,
+  0x16b0f2,
+  0x16bc87,
+  0x16c7c5,
+  0x16cbb0,
+  0x16d35a,
+  0x16df2f,
+  0x16e28e,
+  0x16eefb,
+  0x16f611,
+  0x16fa64,
+  0x1703f3,
+  0x170f86,
+  0x17176c,
+  0x171b19,
+  0x1726b8,
+  0x172acd,
+  0x173227,
+  0x173e52,
+  0x174510,
+  0x174965,
+  0x17518f,
+  0x175dfa,
+  0x17605b,
+  0x176c2e,
+  0x1774c4,
+  0x1778b1,
+  0x178240,
+  0x178e35,
+  0x1796df,
+  0x179aaa,
+  0x17a70b,
+  0x17ab7e,
+  0x17b394,
+  0x17bfe1,
+  0x17c4a3,
+  0x17c8d6,
+  0x17d03c,
+  0x17dc49,
+  0x17e1e8,
+  0x17ed9d,
+  0x17f577,
+  0x17f902,
+  0x18046e,
+  0x18081b,
+  0x1810f1,
+  0x181c84,
+  0x182125,
+  0x182d50,
+  0x1835ba,
+  0x1839cf,
+  0x18428d,
+  0x184ef8,
+  0x185612,
+  0x185a67,
+  0x1867c6,
+  0x186bb3,
+  0x187359,
+  0x187f2c,
+  0x1885dd,
+  0x1889a8,
+  0x189142,
+  0x189d37,
+  0x18a096,
+  0x18ace3,
+  0x18b409,
+  0x18b87c,
+  0x18c33e,
+  0x18cf4b,
+  0x18d7a1,
+  0x18dbd4,
+  0x18e675,
+  0x18ea00,
+  0x18f2ea,
+  0x18fe9f,
+  0x190708,
+  0x190b7d,
+  0x191397,
+  0x191fe2,
+  0x192243,
+  0x192e36,
+  0x1936dc,
+  0x193aa9,
+  0x1941eb,
+  0x194d9e,
+  0x195574,
+  0x195901,
+  0x1964a0,
+  0x1968d5,
+  0x19703f,
+  0x197c4a,
+  0x1986bb,
+  0x198ace,
+  0x199224,
+  0x199e51,
+  0x19a3f0,
+  0x19af85,
+  0x19b76f,
+  0x19bb1a,
+  0x19c058,
+  0x19cc2d,
+  0x19d4c7,
+  0x19d8b2,
+  0x19e513,
+  0x19e966,
+  0x19f18c,
+  0x19fdf9,
+  0x1a02a2,
+  0x1a0ed7,
+  0x1a163d,
+  0x1a1a48,
+  0x1a27e9,
+  0x1a2b9c,
+  0x1a3376,
+  0x1a3f03,
+  0x1a4441,
+  0x1a4834,
+  0x1a50de,
+  0x1a5cab,
+  0x1a610a,
+  0x1a6d7f,
+  0x1a7595,
+  0x1a79e0,
+  0x1a8311,
+  0x1a8f64,
+  0x1a978e,
+  0x1a9bfb,
+  0x1aa65a,
+  0x1aaa2f,
+  0x1ab2c5,
+  0x1abeb0,
+  0x1ac5f2,
+  0x1ac987,
+  0x1ad16d,
+  0x1add18,
+  0x1ae0b9,
+  0x1aeccc,
+  0x1af426,
+  0x1af853,
+  0x1b01c4,
+  0x1b0db1,
+  0x1b155b,
+  0x1b192e,
+  0x1b248f,
+  0x1b28fa,
+  0x1b3010,
+  0x1b3c65,
+  0x1b4727,
+  0x1b4b52,
+  0x1b53b8,
+  0x1b5fcd,
+  0x1b626c,
+  0x1b6e19,
+  0x1b76f3,
+  0x1b7a86,
+  0x1b8077,
+  0x1b8c02,
+  0x1b94e8,
+  0x1b989d,
+  0x1ba53c,
+  0x1ba949,
+  0x1bb1a3,
+  0x1bbdd6,
+  0x1bc694,
+  0x1bcae1,
+  0x1bd20b,
+  0x1bde7e,
+  0x1be3df,
+  0x1befaa,
+  0x1bf740,
+  0x1bfb35,
+  0x1c0583,
+  0x1c09f6,
+  0x1c111c,
+  0x1c1d69,
+  0x1c20c8,
+  0x1c2cbd,
+  0x1c3457,
+  0x1c3822,
+  0x1c4360,
+  0x1c4f15,
+  0x1c57ff,
+  0x1c5b8a,
+  0x1c662b,
+  0x1c6a5e,
+  0x1c72b4,
+  0x1c7ec1,
+  0x1c8430,
+  0x1c8845,
+  0x1c90af,
+  0x1c9cda,
+  0x1ca17b,
+  0x1cad0e,
+  0x1cb5e4,
+  0x1cb991,
+  0x1cc2d3,
+  0x1ccea6,
+  0x1cd64c,
+  0x1cda39,
+  0x1ce798,
+  0x1cebed,
+  0x1cf307,
+  0x1cff72,
+  0x1d06e5,
+  0x1d0a90,
+  0x1d127a,
+  0x1d1e0f,
+  0x1d23ae,
+  0x1d2fdb,
+  0x1d3731,
+  0x1d3b44,
+  0x1d4006,
+  0x1d4c73,
+  0x1d5499,
+  0x1d58ec,
+  0x1d654d,
+  0x1d6938,
+  0x1d71d2,
+  0x1d7da7,
+  0x1d8756,
+  0x1d8b23,
+  0x1d93c9,
+  0x1d9fbc,
+  0x1da21d,
+  0x1dae68,
+  0x1db682,
+  0x1dbaf7,
+  0x1dc1b5,
+  0x1dcdc0,
+  0x1dd52a,
+  0x1dd95f,
+  0x1de4fe,
+  0x1de88b,
+  0x1df061,
+  0x1dfc14,
+  0x1e034f,
+  0x1e0f3a,
+  0x1e17d0,
+  0x1e1ba5,
+  0x1e2604,
+  0x1e2a71,
+  0x1e329b,
+  0x1e3eee,
+  0x1e45ac,
+  0x1e49d9,
+  0x1e5133,
+  0x1e5d46,
+  0x1e60e7,
+  0x1e6c92,
+  0x1e7478,
+  0x1e780d,
+  0x1e82fc,
+  0x1e8e89,
+  0x1e9663,
+  0x1e9a16,
+  0x1ea7b7,
+  0x1eabc2,
+  0x1eb328,
+  0x1ebf5d,
+  0x1ec41f,
+  0x1ec86a,
+  0x1ed080,
+  0x1edcf5,
+  0x1ee154,
+  0x1eed21,
+  0x1ef5cb,
+  0x1ef9be,
+  0x1f0029,
+  0x1f0c5c,
+  0x1f14b6,
+  0x1f18c3,
+  0x1f2562,
+  0x1f2917,
+  0x1f31fd,
+  0x1f3d88,
+  0x1f46ca,
+  0x1f4abf,
+  0x1f5255,
+  0x1f5e20,
+  0x1f6381,
+  0x1f6ff4,
+  0x1f771e,
+  0x1f7b6b,
+  0x1f819a,
+  0x1f8def,
+  0x1f9505,
+  0x1f9970,
+  0x1fa4d1,
+  0x1fa8a4,
+  0x1fb04e,
+  0x1fbc3b,
+  0x1fc779,
+  0x1fcb0c,
+  0x1fd3e6,
+  0x1fdf93,
+  0x1fe232,
+  0x1fee47,
+  0x1ff6ad,
+  0x1ffad8,
+  0x20031d,
+  0x200f68,
+  0x201782,
+  0x201bf7,
+  0x202656,
+  0x202a23,
+  0x2032c9,
+  0x203ebc,
+  0x2045fe,
+  0x20498b,
+  0x205161,
+  0x205d14,
+  0x2060b5,
+  0x206cc0,
+  0x20742a,
+  0x20785f,
+  0x2082ae,
+  0x208edb,
+  0x209631,
+  0x209a44,
+  0x20a7e5,
+  0x20ab90,
+  0x20b37a,
+  0x20bf0f,
+  0x20c44d,
+  0x20c838,
+  0x20d0d2,
+  0x20dca7,
+  0x20e106,
+  0x20ed73,
+  0x20f599,
+  0x20f9ec,
+  0x21007b,
+  0x210c0e,
+  0x2114e4,
+  0x211891,
+  0x212530,
+  0x212945,
+  0x2131af,
+  0x213dda,
+  0x214698,
+  0x214aed,
+  0x215207,
+  0x215e72,
+  0x2163d3,
+  0x216fa6,
+  0x21774c,
+  0x217b39,
+  0x2181c8,
+  0x218dbd,
+  0x219557,
+  0x219922,
+  0x21a483,
+  0x21a8f6,
+  0x21b01c,
+  0x21bc69,
+  0x21c72b,
+  0x21cb5e,
+  0x21d3b4,
+  0x21dfc1,
+  0x21e260,
+  0x21ee15,
+  0x21f6ff,
+  0x21fa8a,
+  0x2205d1,
+  0x2209a4,
+  0x22114e,
+  0x221d3b,
+  0x22209a,
+  0x222cef,
+  0x223405,
+  0x223870,
+  0x224332,
+  0x224f47,
+  0x2257ad,
+  0x225bd8,
+  0x226679,
+  0x226a0c,
+  0x2272e6,
+  0x227e93,
+  0x228462,
+  0x228817,
+  0x2290fd,
+  0x229c88,
+  0x22a129,
+  0x22ad5c,
+  0x22b5b6,
+  0x22b9c3,
+  0x22c281,
+  0x22cef4,
+  0x22d61e,
+  0x22da6b,
+  0x22e7ca,
+  0x22ebbf,
+  0x22f355,
+  0x22ff20,
+  0x2306b7,
+  0x230ac2,
+  0x231228,
+  0x231e5d,
+  0x2323fc,
+  0x232f89,
+  0x233763,
+  0x233b16,
+  0x234054,
+  0x234c21,
+  0x2354cb,
+  0x2358be,
+  0x23651f,
+  0x23696a,
+  0x237180,
+  0x237df5,
+  0x238704,
+  0x238b71,
+  0x23939b,
+  0x239fee,
+  0x23a24f,
+  0x23ae3a,
+  0x23b6d0,
+  0x23baa5,
+  0x23c1e7,
+  0x23cd92,
+  0x23d578,
+  0x23d90d,
+  0x23e4ac,
+  0x23e8d9,
+  0x23f033,
+  0x23fc46,
+  0x2402f0,
+  0x240e85,
+  0x24166f,
+  0x241a1a,
+  0x2427bb,
+  0x242bce,
+  0x243324,
+  0x243f51,
+  0x244413,
+  0x244866,
+  0x24508c,
+  0x245cf9,
+  0x246158,
+  0x246d2d,
+  0x2475c7,
+  0x2479b2,
+  0x248343,
+  0x248f36,
+  0x2497dc,
+  0x249ba9,
+  0x24a608,
+  0x24aa7d,
+  0x24b297,
+  0x24bee2,
+  0x24c5a0,
+  0x24c9d5,
+  0x24d13f,
+  0x24dd4a,
+  0x24e0eb,
+  0x24ec9e,
+  0x24f474,
+  0x24f801,
+  0x250196,
+  0x250de3,
+  0x251509,
+  0x25197c,
+  0x2524dd,
+  0x2528a8,
+  0x253042,
+  0x253c37,
+  0x254775,
+  0x254b00,
+  0x2553ea,
+  0x255f9f,
+  0x25623e,
+  0x256e4b,
+  0x2576a1,
+  0x257ad4,
+  0x258025,
+  0x258c50,
+  0x2594ba,
+  0x2598cf,
+  0x25a56e,
+  0x25a91b,
+  0x25b1f1,
+  0x25bd84,
+  0x25c6c6,
+  0x25cab3,
+  0x25d259,
+  0x25de2c,
+  0x25e38d,
+  0x25eff8,
+  0x25f712,
+  0x25fb67,
+  0x26043c,
+  0x260849,
+  0x2610a3,
+  0x261cd6,
+  0x262177,
+  0x262d02,
+  0x2635e8,
+  0x26399d,
+  0x2642df,
+  0x264eaa,
+  0x265640,
+  0x265a35,
+  0x266794,
+  0x266be1,
+  0x26730b,
+  0x267f7e,
+  0x26858f,
+  0x2689fa,
+  0x269110,
+  0x269d65,
+  0x26a0c4,
+  0x26acb1,
+  0x26b45b,
+  0x26b82e,
+  0x26c36c,
+  0x26cf19,
+  0x26d7f3,
+  0x26db86,
+  0x26e627,
+  0x26ea52,
+  0x26f2b8,
+  0x26fecd,
+  0x27075a,
+  0x270b2f,
+  0x2713c5,
+  0x271fb0,
+  0x272211,
+  0x272e64,
+  0x27368e,
+  0x273afb,
+  0x2741b9,
+  0x274dcc,
+  0x275526,
+  0x275953,
+  0x2764f2,
+  0x276887,
+  0x27706d,
+  0x277c18,
+  0x2786e9,
+  0x278a9c,
+  0x279276,
+  0x279e03,
+  0x27a3a2,
+  0x27afd7,
+  0x27b73d,
+  0x27bb48,
+  0x27c00a,
+  0x27cc7f,
+  0x27d495,
+  0x27d8e0,
+  0x27e541,
+  0x27e934,
+  0x27f1de,
+  0x27fdab,
+  0x2800c7,
+  0x280cb2,
+  0x281458,
+  0x28182d,
+  0x28258c,
+  0x2829f9,
+  0x283113,
+  0x283d66,
+  0x284624,
+  0x284a51,
+  0x2852bb,
+  0x285ece,
+  0x28636f,
+  0x286f1a,
+  0x2877f0,
+  0x287b85,
+  0x288174,
+  0x288d01,
+  0x2895eb,
+  0x28999e,
+  0x28a43f,
+  0x28a84a,
+  0x28b0a0,
+  0x28bcd5,
+  0x28c797,
+  0x28cbe2,
+  0x28d308,
+  0x28df7d,
+  0x28e2dc,
+  0x28eea9,
+  0x28f643,
+  0x28fa36,
+  0x2903a1,
+  0x290fd4,
+  0x29173e,
+  0x291b4b,
+  0x2926ea,
+  0x292a9f,
+  0x293275,
+  0x293e00,
+  0x294542,
+  0x294937,
+  0x2951dd,
+  0x295da8,
+  0x296009,
+  0x296c7c,
+  0x297496,
+  0x2978e3,
+  0x298212,
+  0x298e67,
+  0x29968d,
+  0x299af8,
+  0x29a759,
+  0x29ab2c,
+  0x29b3c6,
+  0x29bfb3,
+  0x29c4f1,
+  0x29c884,
+  0x29d06e,
+  0x29dc1b,
+  0x29e1ba,
+  0x29edcf,
+  0x29f525,
+  0x29f950,
+  0x2a060b,
+  0x2a0a7e,
+  0x2a1294,
+  0x2a1ee1,
+  0x2a2340,
+  0x2a2f35,
+  0x2a37df,
+  0x2a3baa,
+  0x2a40e8,
+  0x2a4c9d,
+  0x2a5477,
+  0x2a5802,
+  0x2a65a3,
+  0x2a69d6,
+  0x2a713c,
+  0x2a7d49,
+  0x2a87b8,
+  0x2a8bcd,
+  0x2a9327,
+  0x2a9f52,
+  0x2aa2f3,
+  0x2aae86,
+  0x2ab66c,
+  0x2aba19,
+  0x2ac15b,
+  0x2acd2e,
+  0x2ad5c4,
+  0x2ad9b1,
+  0x2ae410,
+  0x2ae865,
+  0x2af08f,
+  0x2afcfa,
+  0x2b056d,
+  0x2b0918,
+  0x2b11f2,
+  0x2b1d87,
+  0x2b2026,
+  0x2b2c53,
+  0x2b34b9,
+  0x2b38cc,
+  0x2b438e,
+  0x2b4ffb,
+  0x2b5711,
+  0x2b5b64,
+  0x2b66c5,
+  0x2b6ab0,
+  0x2b725a,
+  0x2b7e2f,
+  0x2b84de,
+  0x2b88ab,
+  0x2b9041,
+  0x2b9c34,
+  0x2ba195,
+  0x2bade0,
+  0x2bb50a,
+  0x2bb97f,
+  0x2bc23d,
+  0x2bce48,
+  0x2bd6a2,
+  0x2bdad7,
+  0x2be776,
+  0x2beb03,
+  0x2bf3e9,
+  0x2bff9c,
+  0x2c012a,
+  0x2c0d5f,
+  0x2c15b5,
+  0x2c19c0,
+  0x2c2461,
+  0x2c2814,
+  0x2c30fe,
+  0x2c3c8b,
+  0x2c47c9,
+  0x2c4bbc,
+  0x2c5356,
+  0x2c5f23,
+  0x2c6282,
+  0x2c6ef7,
+  0x2c761d,
+  0x2c7a68,
+  0x2c8099,
+  0x2c8cec,
+  0x2c9406,
+  0x2c9873,
+  0x2ca5d2,
+  0x2ca9a7,
+  0x2cb14d,
+  0x2cbd38,
+  0x2cc67a,
+  0x2cca0f,
+  0x2cd2e5,
+  0x2cde90,
+  0x2ce331,
+  0x2cef44,
+  0x2cf7ae,
+  0x2cfbdb,
+  0x2d024c,
+  0x2d0e39,
+  0x2d16d3,
+  0x2d1aa6,
+  0x2d2707,
+  0x2d2b72,
+  0x2d3398,
+  0x2d3fed,
+  0x2d44af,
+  0x2d48da,
+  0x2d5030,
+  0x2d5c45,
+  0x2d61e4,
+  0x2d6d91,
+  0x2d757b,
+  0x2d790e,
+  0x2d83ff,
+  0x2d8f8a,
+  0x2d9760,
+  0x2d9b15,
+  0x2da6b4,
+  0x2daac1,
+  0x2db22b,
+  0x2dbe5e,
+  0x2dc51c,
+  0x2dc969,
+  0x2dd183,
+  0x2dddf6,
+  0x2de057,
+  0x2dec22,
+  0x2df4c8,
+  0x2df8bd,
+  0x2e07e6,
+  0x2e0b93,
+  0x2e1379,
+  0x2e1f0c,
+  0x2e22ad,
+  0x2e2ed8,
+  0x2e3632,
+  0x2e3a47,
+  0x2e4105,
+  0x2e4d70,
+  0x2e559a,
+  0x2e59ef,
+  0x2e644e,
+  0x2e683b,
+  0x2e70d1,
+  0x2e7ca4,
+  0x2e8655,
+  0x2e8a20,
+  0x2e92ca,
+  0x2e9ebf,
+  0x2ea31e,
+  0x2eaf6b,
+  0x2eb781,
+  0x2ebbf4,
+  0x2ec0b6,
+  0x2eccc3,
+  0x2ed429,
+  0x2ed85c,
+  0x2ee5fd,
+  0x2ee988,
+  0x2ef162,
+  0x2efd17,
+  0x2f0480,
+  0x2f08f5,
+  0x2f101f,
+  0x2f1c6a,
+  0x2f21cb,
+  0x2f2dbe,
+  0x2f3554,
+  0x2f3921,
+  0x2f4263,
+  0x2f4e16,
+  0x2f56fc,
+  0x2f5a89,
+  0x2f6728,
+  0x2f6b5d,
+  0x2f73b7,
+  0x2f7fc2,
+  0x2f8533,
+  0x2f8946,
+  0x2f91ac,
+  0x2f9dd9,
+  0x2fa078,
+  0x2fac0d,
+  0x2fb4e7,
+  0x2fb892,
+  0x2fc3d0,
+  0x2fcfa5,
+  0x2fd74f,
+  0x2fdb3a,
+  0x2fe69b,
+  0x2feaee,
+  0x2ff204,
+  0x2ffe71,
+  0x3004a9,
+  0x3008dc,
+  0x301036,
+  0x301c43,
+  0x3021e2,
+  0x302d97,
+  0x30357d,
+  0x303908,
+  0x30424a,
+  0x304e3f,
+  0x3056d5,
+  0x305aa0,
+  0x306701,
+  0x306b74,
+  0x30739e,
+  0x307feb,
+  0x30851a,
+  0x30896f,
+  0x309185,
+  0x309df0,
+  0x30a051,
+  0x30ac24,
+  0x30b4ce,
+  0x30b8bb,
+  0x30c3f9,
+  0x30cf8c,
+  0x30d766,
+  0x30db13,
+  0x30e6b2,
+  0x30eac7,
+  0x30f22d,
+  0x30fe58,
+  0x3107cf,
+  0x310bba,
+  0x311350,
+  0x311f25,
+  0x312284,
+  0x312ef1,
+  0x31361b,
+  0x313a6e,
+  0x31412c,
+  0x314d59,
+  0x3155b3,
+  0x3159c6,
+  0x316467,
+  0x316812,
+  0x3170f8,
+  0x317c8d,
+  0x31867c,
+  0x318a09,
+  0x3192e3,
+  0x319e96,
+  0x31a337,
+  0x31af42,
+  0x31b7a8,
+  0x31bbdd,
+  0x31c09f,
+  0x31ccea,
+  0x31d400,
+  0x31d875,
+  0x31e5d4,
+  0x31e9a1,
+  0x31f14b,
+  0x31fd3e,
+  0x320265,
+  0x320e10,
+  0x3216fa,
+  0x321a8f,
+  0x32272e,
+  0x322b5b,
+  0x3233b1,
+  0x323fc4,
+  0x324486,
+  0x3248f3,
+  0x325019,
+  0x325c6c,
+  0x3261cd,
+  0x326db8,
+  0x327552,
+  0x327927,
+  0x3283d6,
+  0x328fa3,
+  0x329749,
+  0x329b3c,
+  0x32a69d,
+  0x32aae8,
+  0x32b202,
+  0x32be77,
+  0x32c535,
+  0x32c940,
+  0x32d1aa,
+  0x32dddf,
+  0x32e07e,
+  0x32ec0b,
+  0x32f4e1,
+  0x32f894,
+  0x330103,
+  0x330d76,
+  0x33159c,
+  0x3319e9,
+  0x332448,
+  0x33283d,
+  0x3330d7,
+  0x333ca2,
+  0x3347e0,
+  0x334b95,
+  0x33537f,
+  0x335f0a,
+  0x3362ab,
+  0x336ede,
+  0x337634,
+  0x337a41,
+  0x3380b0,
+  0x338cc5,
+  0x33942f,
+  0x33985a,
+  0x33a5fb,
+  0x33a98e,
+  0x33b164,
+  0x33bd11,
+  0x33c653,
+  0x33ca26,
+  0x33d2cc,
+  0x33deb9,
+  0x33e318,
+  0x33ef6d,
+  0x33f787,
+  0x33fbf2,
+  0x340544,
+  0x340931,
+  0x3411db,
+  0x341dae,
+  0x34200f,
+  0x342c7a,
+  0x343490,
+  0x3438e5,
+  0x3443a7,
+  0x344fd2,
+  0x345738,
+  0x345b4d,
+  0x3466ec,
+  0x346a99,
+  0x347273,
+  0x347e06,
+  0x3484f7,
+  0x348882,
+  0x349068,
+  0x349c1d,
+  0x34a1bc,
+  0x34adc9,
+  0x34b523,
+  0x34b956,
+  0x34c214,
+  0x34ce61,
+  0x34d68b,
+  0x34dafe,
+  0x34e75f,
+  0x34eb2a,
+  0x34f3c0,
+  0x34ffb5,
+  0x350622,
+  0x350a57,
+  0x3512bd,
+  0x351ec8,
+  0x352369,
+  0x352f1c,
+  0x3537f6,
+  0x353b83,
+  0x3540c1,
+  0x354cb4,
+  0x35545e,
+  0x35582b,
+  0x35658a,
+  0x3569ff,
+  0x357115,
+  0x357d60,
+  0x358791,
+  0x358be4,
+  0x35930e,
+  0x359f7b,
+  0x35a2da,
+  0x35aeaf,
+  0x35b645,
+  0x35ba30,
+  0x35c172,
+  0x35cd07,
+  0x35d5ed,
+  0x35d998,
+  0x35e439,
+  0x35e84c,
+  0x35f0a6,
+  0x35fcd3,
+  0x360388,
+  0x360ffd,
+  0x361717,
+  0x361b62,
+  0x3626c3,
+  0x362ab6,
+  0x36325c,
+  0x363e29,
+  0x36456b,
+  0x36491e,
+  0x3651f4,
+  0x365d81,
+  0x366020,
+  0x366c55,
+  0x3674bf,
+  0x3678ca,
+  0x36823b,
+  0x368e4e,
+  0x3696a4,
+  0x369ad1,
+  0x36a770,
+  0x36ab05,
+  0x36b3ef,
+  0x36bf9a,
+  0x36c4d8,
+  0x36c8ad,
+  0x36d047,
+  0x36dc32,
+  0x36e193,
+  0x36ede6,
+  0x36f50c,
+  0x36f979,
+  0x3700ee,
+  0x370c9b,
+  0x371471,
+  0x371804,
+  0x3725a5,
+  0x3729d0,
+  0x37313a,
+  0x373d4f,
+  0x37460d,
+  0x374a78,
+  0x375292,
+  0x375ee7,
+  0x376346,
+  0x376f33,
+  0x3777d9,
+  0x377bac,
+  0x37815d,
+  0x378d28,
+  0x3795c2,
+  0x3799b7,
+  0x37a416,
+  0x37a863,
+  0x37b089,
+  0x37bcfc,
+  0x37c7be,
+  0x37cbcb,
+  0x37d321,
+  0x37df54,
+  0x37e2f5,
+  0x37ee80,
+  0x37f66a,
+  0x37fa1f,
+  0x380773,
+  0x380b06,
+  0x3813ec,
+  0x381f99,
+  0x382238,
+  0x382e4d,
+  0x3836a7,
+  0x383ad2,
+  0x384190,
+  0x384de5,
+  0x38550f,
+  0x38597a,
+  0x3864db,
+  0x3868ae,
+  0x387044,
+  0x387c31,
+  0x3886c0,
+  0x388ab5,
+  0x38925f,
+  0x389e2a,
+  0x38a38b,
+  0x38affe,
+  0x38b714,
+  0x38bb61,
+  0x38c023,
+  0x38cc56,
+  0x38d4bc,
+  0x38d8c9,
+  0x38e568,
+  0x38e91d,
+  0x38f1f7,
+  0x38fd82,
+  0x390415,
+  0x390860,
+  0x39108a,
+  0x391cff,
+  0x39215e,
+  0x392d2b,
+  0x3935c1,
+  0x3939b4,
+  0x3942f6,
+  0x394e83,
+  0x395669,
+  0x395a1c,
+  0x3967bd,
+  0x396bc8,
+  0x397322,
+  0x397f57,
+  0x3985a6,
+  0x3989d3,
+  0x399139,
+  0x399d4c,
+  0x39a0ed,
+  0x39ac98,
+  0x39b472,
+  0x39b807,
+  0x39c345,
+  0x39cf30,
+  0x39d7da,
+  0x39dbaf,
+  0x39e60e,
+  0x39ea7b,
+  0x39f291,
+  0x39fee4,
+  0x3a01bf,
+  0x3a0dca,
+  0x3a1520,
+  0x3a1955,
+  0x3a24f4,
+  0x3a2881,
+  0x3a306b,
+  0x3a3c1e,
+  0x3a475c,
+  0x3a4b29,
+  0x3a53c3,
+  0x3a5fb6,
+  0x3a6217,
+  0x3a6e62,
+  0x3a7688,
+  0x3a7afd,
+  0x3a800c,
+  0x3a8c79,
+  0x3a9493,
+  0x3a98e6,
+  0x3aa547,
+  0x3aa932,
+  0x3ab1d8,
+  0x3abdad,
+  0x3ac6ef,
+  0x3aca9a,
+  0x3ad270,
+  0x3ade05,
+  0x3ae3a4,
+  0x3aefd1,
+  0x3af73b,
+  0x3afb4e,
+  0x3b02d9,
+  0x3b0eac,
+  0x3b1646,
+  0x3b1a33,
+  0x3b2792,
+  0x3b2be7,
+  0x3b330d,
+  0x3b3f78,
+  0x3b443a,
+  0x3b484f,
+  0x3b50a5,
+  0x3b5cd0,
+  0x3b6171,
+  0x3b6d04,
+  0x3b75ee,
+  0x3b799b,
+  0x3b836a,
+  0x3b8f1f,
+  0x3b97f5,
+  0x3b9b80,
+  0x3ba621,
+  0x3baa54,
+  0x3bb2be,
+  0x3bbecb,
+  0x3bc589,
+  0x3bc9fc,
+  0x3bd116,
+  0x3bdd63,
+  0x3be0c2,
+  0x3becb7,
+  0x3bf45d,
+  0x3bf828,
+  0x3c069e,
+  0x3c0aeb,
+  0x3c1201,
+  0x3c1e74,
+  0x3c23d5,
+  0x3c2fa0,
+  0x3c374a,
+  0x3c3b3f,
+  0x3c407d,
+  0x3c4c08,
+  0x3c54e2,
+  0x3c5897,
+  0x3c6536,
+  0x3c6943,
+  0x3c71a9,
+  0x3c7ddc,
+  0x3c872d,
+  0x3c8b58,
+  0x3c93b2,
+  0x3c9fc7,
+  0x3ca266,
+  0x3cae13,
+  0x3cb6f9,
+  0x3cba8c,
+  0x3cc1ce,
+  0x3ccdbb,
+  0x3cd551,
+  0x3cd924,
+  0x3ce485,
+  0x3ce8f0,
+  0x3cf01a,
+  0x3cfc6f,
+  0x3d05f8,
+  0x3d098d,
+  0x3d1167,
+  0x3d1d12,
+  0x3d20b3,
+  0x3d2cc6,
+  0x3d342c,
+  0x3d3859,
+  0x3d431b,
+  0x3d4f6e,
+  0x3d5784,
+  0x3d5bf1,
+  0x3d6650,
+  0x3d6a25,
+  0x3d72cf,
+  0x3d7eba,
+  0x3d844b,
+  0x3d883e,
+  0x3d90d4,
+  0x3d9ca1,
+  0x3da100,
+  0x3dad75,
+  0x3db59f,
+  0x3db9ea,
+  0x3dc2a8,
+  0x3dcedd,
+  0x3dd637,
+  0x3dda42,
+  0x3de7e3,
+  0x3deb96,
+  0x3df37c,
+  0x3dff09,
+  0x3e0052,
+  0x3e0c27,
+  0x3e14cd,
+  0x3e18b8,
+  0x3e2519,
+  0x3e296c,
+  0x3e3186,
+  0x3e3df3,
+  0x3e46b1,
+  0x3e4ac4,
+  0x3e522e,
+  0x3e5e5b,
+  0x3e63fa,
+  0x3e6f8f,
+  0x3e7765,
+  0x3e7b10,
+  0x3e81e1,
+  0x3e8d94,
+  0x3e957e,
+  0x3e990b,
+  0x3ea4aa,
+  0x3ea8df,
+  0x3eb035,
+  0x3ebc40,
+  0x3ec702,
+  0x3ecb77,
+  0x3ed39d,
+  0x3edfe8,
+  0x3ee249,
+  0x3eee3c,
+  0x3ef6d6,
+  0x3efaa3,
+  0x3f0334,
+  0x3f0f41,
+  0x3f17ab,
+  0x3f1bde,
+  0x3f267f,
+  0x3f2a0a,
+  0x3f32e0,
+  0x3f3e95,
+  0x3f45d7,
+  0x3f49a2,
+  0x3f5148,
+  0x3f5d3d,
+  0x3f609c,
+  0x3f6ce9,
+  0x3f7403,
+  0x3f7876,
+  0x3f8287,
+  0x3f8ef2,
+  0x3f9618,
+  0x3f9a6d,
+  0x3fa7cc,
+  0x3fabb9,
+  0x3fb353,
+  0x3fbf26,
+  0x3fc464,
+  0x3fc811,
+  0x3fd0fb,
+  0x3fdc8e,
+  0x3fe12f,
+  0x3fed5a,
+  0x3ff5b0,
+  0x3ff9c5,
+  0x40063a,
+  0x400a4f,
+  0x4012a5,
+  0x401ed0,
+  0x402371,
+  0x402f04,
+  0x4037ee,
+  0x403b9b,
+  0x4040d9,
+  0x404cac,
+  0x405446,
+  0x405833,
+  0x406592,
+  0x4069e7,
+  0x40710d,
+  0x407d78,
+  0x408789,
+  0x408bfc,
+  0x409316,
+  0x409f63,
+  0x40a2c2,
+  0x40aeb7,
+  0x40b65d,
+  0x40ba28,
+  0x40c16a,
+  0x40cd1f,
+  0x40d5f5,
+  0x40d980,
+  0x40e421,
+  0x40e854,
+  0x40f0be,
+  0x40fccb,
+  0x41055c,
+  0x410929,
+  0x4111c3,
+  0x411db6,
+  0x412017,
+  0x412c62,
+  0x413488,
+  0x4138fd,
+  0x4143bf,
+  0x414fca,
+  0x415720,
+  0x415b55,
+  0x4166f4,
+  0x416a81,
+  0x41726b,
+  0x417e1e,
+  0x4184ef,
+  0x41889a,
+  0x419070,
+  0x419c05,
+  0x41a1a4,
+  0x41add1,
+  0x41b53b,
+  0x41b94e,
+  0x41c20c,
+  0x41ce79,
+  0x41d693,
+  0x41dae6,
+  0x41e747,
+  0x41eb32,
+  0x41f3d8,
+  0x41ffad,
+  0x4200f6,
+  0x420c83,
+  0x421469,
+  0x42181c,
+  0x4225bd,
+  0x4229c8,
+  0x423122,
+  0x423d57,
+  0x424615,
+  0x424a60,
+  0x42528a,
+  0x425eff,
+  0x42635e,
+  0x426f2b,
+  0x4277c1,
+  0x427bb4,
+  0x428145,
+  0x428d30,
+  0x4295da,
+  0x4299af,
+  0x42a40e,
+  0x42a87b,
+  0x42b091,
+  0x42bce4,
+  0x42c7a6,
+  0x42cbd3,
+  0x42d339,
+  0x42df4c,
+  0x42e2ed,
+  0x42ee98,
+  0x42f672,
+  0x42fa07,
+  0x430390,
+  0x430fe5,
+  0x43170f,
+  0x431b7a,
+  0x4326db,
+  0x432aae,
+  0x433244,
+  0x433e31,
+  0x434573,
+  0x434906,
+  0x4351ec,
+  0x435d99,
+  0x436038,
+  0x436c4d,
+  0x4374a7,
+  0x4378d2,
+  0x438223,
+  0x438e56,
+  0x4396bc,
+  0x439ac9,
+  0x43a768,
+  0x43ab1d,
+  0x43b3f7,
+  0x43bf82,
+  0x43c4c0,
+  0x43c8b5,
+  0x43d05f,
+  0x43dc2a,
+  0x43e18b,
+  0x43edfe,
+  0x43f514,
+  0x43f961,
+  0x4407d7,
+  0x440ba2,
+  0x441348,
+  0x441f3d,
+  0x44229c,
+  0x442ee9,
+  0x443603,
+  0x443a76,
+  0x444134,
+  0x444d41,
+  0x4455ab,
+  0x4459de,
+  0x44647f,
+  0x44680a,
+  0x4470e0,
+  0x447c95,
+  0x448664,
+  0x448a11,
+  0x4492fb,
+  0x449e8e,
+  0x44a32f,
+  0x44af5a,
+  0x44b7b0,
+  0x44bbc5,
+  0x44c087,
+  0x44ccf2,
+  0x44d418,
+  0x44d86d,
+  0x44e5cc,
+  0x44e9b9,
+  0x44f153,
+  0x44fd26,
+  0x4504b1,
+  0x4508c4,
+  0x45102e,
+  0x451c5b,
+  0x4521fa,
+  0x452d8f,
+  0x453565,
+  0x453910,
+  0x454252,
+  0x454e27,
+  0x4556cd,
+  0x455ab8,
+  0x456719,
+  0x456b6c,
+  0x457386,
+  0x457ff3,
+  0x458502,
+  0x458977,
+  0x45919d,
+  0x459de8,
+  0x45a049,
+  0x45ac3c,
+  0x45b4d6,
+  0x45b8a3,
+  0x45c3e1,
+  0x45cf94,
+  0x45d77e,
+  0x45db0b,
+  0x45e6aa,
+  0x45eadf,
+  0x45f235,
+  0x45fe40,
+  0x46011b,
+  0x460d6e,
+  0x461584,
+  0x4619f1,
+  0x462450,
+  0x462825,
+  0x4630cf,
+  0x463cba,
+  0x4647f8,
+  0x464b8d,
+  0x465367,
+  0x465f12,
+  0x4662b3,
+  0x466ec6,
+  0x46762c,
+  0x467a59,
+  0x4680a8,
+  0x468cdd,
+  0x469437,
+  0x469842,
+  0x46a5e3,
+  0x46a996,
+  0x46b17c,
+  0x46bd09,
+  0x46c64b,
+  0x46ca3e,
+  0x46d2d4,
+  0x46dea1,
+  0x46e300,
+  0x46ef75,
+  0x46f79f,
+  0x46fbea,
+  0x47027d,
+  0x470e08,
+  0x4716e2,
+  0x471a97,
+  0x472736,
+  0x472b43,
+  0x4733a9,
+  0x473fdc,
+  0x47449e,
+  0x4748eb,
+  0x475001,
+  0x475c74,
+  0x4761d5,
+  0x476da0,
+  0x47754a,
+  0x47793f,
+  0x4783ce,
+  0x478fbb,
+  0x479751,
+  0x479b24,
+  0x47a685,
+  0x47aaf0,
+  0x47b21a,
+  0x47be6f,
+  0x47c52d,
+  0x47c958,
+  0x47d1b2,
+  0x47ddc7,
+  0x47e066,
+  0x47ec13,
+  0x47f4f9,
+  0x47f88c,
+  0x4805e0,
+  0x480995,
+  0x48117f,
+  0x481d0a,
+  0x4820ab,
+  0x482cde,
+  0x483434,
+  0x483841,
+  0x484303,
+  0x484f76,
+  0x48579c,
+  0x485be9,
+  0x486648,
+  0x486a3d,
+  0x4872d7,
+  0x487ea2,
+  0x488453,
+  0x488826,
+  0x4890cc,
+  0x489cb9,
+  0x48a118,
+  0x48ad6d,
+  0x48b587,
+  0x48b9f2,
+  0x48c2b0,
+  0x48cec5,
+  0x48d62f,
+  0x48da5a,
+  0x48e7fb,
+  0x48eb8e,
+  0x48f364,
+  0x48ff11,
+  0x490686,
+  0x490af3,
+  0x491219,
+  0x491e6c,
+  0x4923cd,
+  0x492fb8,
+  0x493752,
+  0x493b27,
+  0x494065,
+  0x494c10,
+  0x4954fa,
+  0x49588f,
+  0x49652e,
+  0x49695b,
+  0x4971b1,
+  0x497dc4,
+  0x498735,
+  0x498b40,
+  0x4993aa,
+  0x499fdf,
+  0x49a27e,
+  0x49ae0b,
+  0x49b6e1,
+  0x49ba94,
+  0x49c1d6,
+  0x49cda3,
+  0x49d549,
+  0x49d93c,
+  0x49e49d,
+  0x49e8e8,
+  0x49f002,
+  0x49fc77,
+  0x4a032c,
+  0x4a0f59,
+  0x4a17b3,
+  0x4a1bc6,
+  0x4a2667,
+  0x4a2a12,
+  0x4a32f8,
+  0x4a3e8d,
+  0x4a45cf,
+  0x4a49ba,
+  0x4a5150,
+  0x4a5d25,
+  0x4a6084,
+  0x4a6cf1,
+  0x4a741b,
+  0x4a786e,
+  0x4a829f,
+  0x4a8eea,
+  0x4a9600,
+  0x4a9a75,
+  0x4aa7d4,
+  0x4aaba1,
+  0x4ab34b,
+  0x4abf3e,
+  0x4ac47c,
+  0x4ac809,
+  0x4ad0e3,
+  0x4adc96,
+  0x4ae137,
+  0x4aed42,
+  0x4af5a8,
+  0x4af9dd,
+  0x4b004a,
+  0x4b0c3f,
+  0x4b14d5,
+  0x4b18a0,
+  0x4b2501,
+  0x4b2974,
+  0x4b319e,
+  0x4b3deb,
+  0x4b46a9,
+  0x4b4adc,
+  0x4b5236,
+  0x4b5e43,
+  0x4b63e2,
+  0x4b6f97,
+  0x4b777d,
+  0x4b7b08,
+  0x4b81f9,
+  0x4b8d8c,
+  0x4b9566,
+  0x4b9913,
+  0x4ba4b2,
+  0x4ba8c7,
+  0x4bb02d,
+  0x4bbc58,
+  0x4bc71a,
+  0x4bcb6f,
+  0x4bd385,
+  0x4bdff0,
+  0x4be251,
+  0x4bee24,
+  0x4bf6ce,
+  0x4bfabb,
+  0x4c040d,
+  0x4c0878,
+  0x4c1092,
+  0x4c1ce7,
+  0x4c2146,
+  0x4c2d33,
+  0x4c35d9,
+  0x4c39ac,
+  0x4c42ee,
+  0x4c4e9b,
+  0x4c5671,
+  0x4c5a04,
+  0x4c67a5,
+  0x4c6bd0,
+  0x4c733a,
+  0x4c7f4f,
+  0x4c85be,
+  0x4c89cb,
+  0x4c9121,
+  0x4c9d54,
+  0x4ca0f5,
+  0x4cac80,
+  0x4cb46a,
+  0x4cb81f,
+  0x4cc35d,
+  0x4ccf28,
+  0x4cd7c2,
+  0x4cdbb7,
+  0x4ce616,
+  0x4cea63,
+  0x4cf289,
+  0x4cfefc,
+  0x4d076b,
+  0x4d0b1e,
+  0x4d13f4,
+  0x4d1f81,
+  0x4d2220,
+  0x4d2e55,
+  0x4d36bf,
+  0x4d3aca,
+  0x4d4188,
+  0x4d4dfd,
+  0x4d5517,
+  0x4d5962,
+  0x4d64c3,
+  0x4d68b6,
+  0x4d705c,
+  0x4d7c29,
+  0x4d86d8,
+  0x4d8aad,
+  0x4d9247,
+  0x4d9e32,
+  0x4da393,
+  0x4dafe6,
+  0x4db70c,
+  0x4dbb79,
+  0x4dc03b,
+  0x4dcc4e,
+  0x4dd4a4,
+  0x4dd8d1,
+  0x4de570,
+  0x4de905,
+  0x4df1ef,
+  0x4dfd9a,
+  0x4e02c1,
+  0x4e0eb4,
+  0x4e165e,
+  0x4e1a2b,
+  0x4e278a,
+  0x4e2bff,
+  0x4e3315,
+  0x4e3f60,
+  0x4e4422,
+  0x4e4857,
+  0x4e50bd,
+  0x4e5cc8,
+  0x4e6169,
+  0x4e6d1c,
+  0x4e75f6,
+  0x4e7983,
+  0x4e8372,
+  0x4e8f07,
+  0x4e97ed,
+  0x4e9b98,
+  0x4ea639,
+  0x4eaa4c,
+  0x4eb2a6,
+  0x4ebed3,
+  0x4ec591,
+  0x4ec9e4,
+  0x4ed10e,
+  0x4edd7b,
+  0x4ee0da,
+  0x4eecaf,
+  0x4ef445,
+  0x4ef830,
+  0x4f01a7,
+  0x4f0dd2,
+  0x4f1538,
+  0x4f194d,
+  0x4f24ec,
+  0x4f2899,
+  0x4f3073,
+  0x4f3c06,
+  0x4f4744,
+  0x4f4b31,
+  0x4f53db,
+  0x4f5fae,
+  0x4f620f,
+  0x4f6e7a,
+  0x4f7690,
+  0x4f7ae5,
+  0x4f8014,
+  0x4f8c61,
+  0x4f948b,
+  0x4f98fe,
+  0x4fa55f,
+  0x4fa92a,
+  0x4fb1c0,
+  0x4fbdb5,
+  0x4fc6f7,
+  0x4fca82,
+  0x4fd268,
+  0x4fde1d,
+  0x4fe3bc,
+  0x4fefc9,
+  0x4ff723,
+  0x4ffb56,
+  0x50018e,
+  0x500dfb,
+  0x501511,
+  0x501964,
+  0x5024c5,
+  0x5028b0,
+  0x50305a,
+  0x503c2f,
+  0x50476d,
+  0x504b18,
+  0x5053f2,
+  0x505f87,
+  0x506226,
+  0x506e53,
+  0x5076b9,
+  0x507acc,
+  0x50803d,
+  0x508c48,
+  0x5094a2,
+  0x5098d7,
+  0x50a576,
+  0x50a903,
+  0x50b1e9,
+  0x50bd9c,
+  0x50c6de,
+  0x50caab,
+  0x50d241,
+  0x50de34,
+  0x50e395,
+  0x50efe0,
+  0x50f70a,
+  0x50fb7f,
+  0x5102e8,
+  0x510e9d,
+  0x511677,
+  0x511a02,
+  0x5127a3,
+  0x512bd6,
+  0x51333c,
+  0x513f49,
+  0x51440b,
+  0x51487e,
+  0x515094,
+  0x515ce1,
+  0x516140,
+  0x516d35,
+  0x5175df,
+  0x5179aa,
+  0x51835b,
+  0x518f2e,
+  0x5197c4,
+  0x519bb1,
+  0x51a610,
+  0x51aa65,
+  0x51b28f,
+  0x51befa,
+  0x51c5b8,
+  0x51c9cd,
+  0x51d127,
+  0x51dd52,
+  0x51e0f3,
+  0x51ec86,
+  0x51f46c,
+  0x51f819,
+  0x520742,
+  0x520b37,
+  0x5213dd,
+  0x521fa8,
+  0x522209,
+  0x522e7c,
+  0x523696,
+  0x523ae3,
+  0x5241a1,
+  0x524dd4,
+  0x52553e,
+  0x52594b,
+  0x5264ea,
+  0x52689f,
+  0x527075,
+  0x527c00,
+  0x5286f1,
+  0x528a84,
+  0x52926e,
+  0x529e1b,
+  0x52a3ba,
+  0x52afcf,
+  0x52b725,
+  0x52bb50,
+  0x52c012,
+  0x52cc67,
+  0x52d48d,
+  0x52d8f8,
+  0x52e559,
+  0x52e92c,
+  0x52f1c6,
+  0x52fdb3,
+  0x530424,
+  0x530851,
+  0x5310bb,
+  0x531cce,
+  0x53216f,
+  0x532d1a,
+  0x5335f0,
+  0x533985,
+  0x5342c7,
+  0x534eb2,
+  0x535658,
+  0x535a2d,
+  0x53678c,
+  0x536bf9,
+  0x537313,
+  0x537f66,
+  0x538597,
+  0x5389e2,
+  0x539108,
+  0x539d7d,
+  0x53a0dc,
+  0x53aca9,
+  0x53b443,
+  0x53b836,
+  0x53c374,
+  0x53cf01,
+  0x53d7eb,
+  0x53db9e,
+  0x53e63f,
+  0x53ea4a,
+  0x53f2a0,
+  0x53fed5,
+  0x540063,
+  0x540c16,
+  0x5414fc,
+  0x541889,
+  0x542528,
+  0x54295d,
+  0x5431b7,
+  0x543dc2,
+  0x544680,
+  0x544af5,
+  0x54521f,
+  0x545e6a,
+  0x5463cb,
+  0x546fbe,
+  0x547754,
+  0x547b21,
+  0x5481d0,
+  0x548da5,
+  0x54954f,
+  0x54993a,
+  0x54a49b,
+  0x54a8ee,
+  0x54b004,
+  0x54bc71,
+  0x54c733,
+  0x54cb46,
+  0x54d3ac,
+  0x54dfd9,
+  0x54e278,
+  0x54ee0d,
+  0x54f6e7,
+  0x54fa92,
+  0x550305,
+  0x550f70,
+  0x55179a,
+  0x551bef,
+  0x55264e,
+  0x552a3b,
+  0x5532d1,
+  0x553ea4,
+  0x5545e6,
+  0x554993,
+  0x555179,
+  0x555d0c,
+  0x5560ad,
+  0x556cd8,
+  0x557432,
+  0x557847,
+  0x5582b6,
+  0x558ec3,
+  0x559629,
+  0x559a5c,
+  0x55a7fd,
+  0x55ab88,
+  0x55b362,
+  0x55bf17,
+  0x55c455,
+  0x55c820,
+  0x55d0ca,
+  0x55dcbf,
+  0x55e11e,
+  0x55ed6b,
+  0x55f581,
+  0x55f9f4,
+  0x5606af,
+  0x560ada,
+  0x561230,
+  0x561e45,
+  0x5623e4,
+  0x562f91,
+  0x56377b,
+  0x563b0e,
+  0x56404c,
+  0x564c39,
+  0x5654d3,
+  0x5658a6,
+  0x566507,
+  0x566972,
+  0x567198,
+  0x567ded,
+  0x56871c,
+  0x568b69,
+  0x569383,
+  0x569ff6,
+  0x56a257,
+  0x56ae22,
+  0x56b6c8,
+  0x56babd,
+  0x56c1ff,
+  0x56cd8a,
+  0x56d560,
+  0x56d915,
+  0x56e4b4,
+  0x56e8c1,
+  0x56f02b,
+  0x56fc5e,
+  0x5705c9,
+  0x5709bc,
+  0x571156,
+  0x571d23,
+  0x572082,
+  0x572cf7,
+  0x57341d,
+  0x573868,
+  0x57432a,
+  0x574f5f,
+  0x5757b5,
+  0x575bc0,
+  0x576661,
+  0x576a14,
+  0x5772fe,
+  0x577e8b,
+  0x57847a,
+  0x57880f,
+  0x5790e5,
+  0x579c90,
+  0x57a131,
+  0x57ad44,
+  0x57b5ae,
+  0x57b9db,
+  0x57c299,
+  0x57ceec,
+  0x57d606,
+  0x57da73,
+  0x57e7d2,
+  0x57eba7,
+  0x57f34d,
+  0x57ff38,
+  0x580254,
+  0x580e21,
+  0x5816cb,
+  0x581abe,
+  0x58271f,
+  0x582b6a,
+  0x583380,
+  0x583ff5,
+  0x5844b7,
+  0x5848c2,
+  0x585028,
+  0x585c5d,
+  0x5861fc,
+  0x586d89,
+  0x587563,
+  0x587916,
+  0x5883e7,
+  0x588f92,
+  0x589778,
+  0x589b0d,
+  0x58a6ac,
+  0x58aad9,
+  0x58b233,
+  0x58be46,
+  0x58c504,
+  0x58c971,
+  0x58d19b,
+  0x58ddee,
+  0x58e04f,
+  0x58ec3a,
+  0x58f4d0,
+  0x58f8a5,
+  0x590132,
+  0x590d47,
+  0x5915ad,
+  0x5919d8,
+  0x592479,
+  0x59280c,
+  0x5930e6,
+  0x593c93,
+  0x5947d1,
+  0x594ba4,
+  0x59534e,
+  0x595f3b,
+  0x59629a,
+  0x596eef,
+  0x597605,
+  0x597a70,
+  0x598081,
+  0x598cf4,
+  0x59941e,
+  0x59986b,
+  0x59a5ca,
+  0x59a9bf,
+  0x59b155,
+  0x59bd20,
+  0x59c662,
+  0x59ca17,
+  0x59d2fd,
+  0x59de88,
+  0x59e329,
+  0x59ef5c,
+  0x59f7b6,
+  0x59fbc3,
+  0x5a0498,
+  0x5a08ed,
+  0x5a1007,
+  0x5a1c72,
+  0x5a21d3,
+  0x5a2da6,
+  0x5a354c,
+  0x5a3939,
+  0x5a427b,
+  0x5a4e0e,
+  0x5a56e4,
+  0x5a5a91,
+  0x5a6730,
+  0x5a6b45,
+  0x5a73af,
+  0x5a7fda,
+  0x5a852b,
+  0x5a895e,
+  0x5a91b4,
+  0x5a9dc1,
+  0x5aa060,
+  0x5aac15,
+  0x5ab4ff,
+  0x5ab88a,
+  0x5ac3c8,
+  0x5acfbd,
+  0x5ad757,
+  0x5adb22,
+  0x5ae683,
+  0x5aeaf6,
+  0x5af21c,
+  0x5afe69,
+  0x5b07fe,
+  0x5b0b8b,
+  0x5b1361,
+  0x5b1f14,
+  0x5b22b5,
+  0x5b2ec0,
+  0x5b362a,
+  0x5b3a5f,
+  0x5b411d,
+  0x5b4d68,
+  0x5b5582,
+  0x5b59f7,
+  0x5b6456,
+  0x5b6823,
+  0x5b70c9,
+  0x5b7cbc,
+  0x5b864d,
+  0x5b8a38,
+  0x5b92d2,
+  0x5b9ea7,
+  0x5ba306,
+  0x5baf73,
+  0x5bb799,
+  0x5bbbec,
+  0x5bc0ae,
+  0x5bccdb,
+  0x5bd431,
+  0x5bd844,
+  0x5be5e5,
+  0x5be990,
+  0x5bf17a,
+  0x5bfd0f,
+  0x5c03b9,
+  0x5c0fcc,
+  0x5c1726,
+  0x5c1b53,
+  0x5c26f2,
+  0x5c2a87,
+  0x5c326d,
+  0x5c3e18,
+  0x5c455a,
+  0x5c492f,
+  0x5c51c5,
+  0x5c5db0,
+  0x5c6011,
+  0x5c6c64,
+  0x5c748e,
+  0x5c78fb,
+  0x5c820a,
+  0x5c8e7f,
+  0x5c9695,
+  0x5c9ae0,
+  0x5ca741,
+  0x5cab34,
+  0x5cb3de,
+  0x5cbfab,
+  0x5cc4e9,
+  0x5cc89c,
+  0x5cd076,
+  0x5cdc03,
+  0x5ce1a2,
+  0x5cedd7,
+  0x5cf53d,
+  0x5cf948,
+  0x5d00df,
+  0x5d0caa,
+  0x5d1440,
+  0x5d1835,
+  0x5d2594,
+  0x5d29e1,
+  0x5d310b,
+  0x5d3d7e,
+  0x5d463c,
+  0x5d4a49,
+  0x5d52a3,
+  0x5d5ed6,
+  0x5d6377,
+  0x5d6f02,
+  0x5d77e8,
+  0x5d7b9d,
+  0x5d816c,
+  0x5d8d19,
+  0x5d95f3,
+  0x5d9986,
+  0x5da427,
+  0x5da852,
+  0x5db0b8,
+  0x5dbccd,
+  0x5dc78f,
+  0x5dcbfa,
+  0x5dd310,
+  0x5ddf65,
+  0x5de2c4,
+  0x5deeb1,
+  0x5df65b,
+  0x5dfa2e,
+  0x5e0575,
+  0x5e0900,
+  0x5e11ea,
+  0x5e1d9f,
+  0x5e203e,
+  0x5e2c4b,
+  0x5e34a1,
+  0x5e38d4,
+  0x5e4396,
+  0x5e4fe3,
+  0x5e5709,
+  0x5e5b7c,
+  0x5e66dd,
+  0x5e6aa8,
+  0x5e7242,
+  0x5e7e37,
+  0x5e84c6,
+  0x5e88b3,
+  0x5e9059,
+  0x5e9c2c,
+  0x5ea18d,
+  0x5eadf8,
+  0x5eb512,
+  0x5eb967,
+  0x5ec225,
+  0x5ece50,
+  0x5ed6ba,
+  0x5edacf,
+  0x5ee76e,
+  0x5eeb1b,
+  0x5ef3f1,
+  0x5eff84,
+  0x5f0613,
+  0x5f0a66,
+  0x5f128c,
+  0x5f1ef9,
+  0x5f2358,
+  0x5f2f2d,
+  0x5f37c7,
+  0x5f3bb2,
+  0x5f40f0,
+  0x5f4c85,
+  0x5f546f,
+  0x5f581a,
+  0x5f65bb,
+  0x5f69ce,
+  0x5f7124,
+  0x5f7d51,
+  0x5f87a0,
+  0x5f8bd5,
+  0x5f933f,
+  0x5f9f4a,
+  0x5fa2eb,
+  0x5fae9e,
+  0x5fb674,
+  0x5fba01,
+  0x5fc143,
+  0x5fcd36,
+  0x5fd5dc,
+  0x5fd9a9,
+  0x5fe408,
+  0x5fe87d,
+  0x5ff097,
+  0x5ffce2,
+  0x600527,
+  0x600952,
+  0x6011b8,
+  0x601dcd,
+  0x60206c,
+  0x602c19,
+  0x6034f3,
+  0x603886,
+  0x6043c4,
+  0x604fb1,
+  0x60575b,
+  0x605b2e,
+  0x60668f,
+  0x606afa,
+  0x607210,
+  0x607e65,
+  0x608494,
+  0x6088e1,
+  0x60900b,
+  0x609c7e,
+  0x60a1df,
+  0x60adaa,
+  0x60b540,
+  0x60b935,
+  0x60c277,
+  0x60ce02,
+  0x60d6e8,
+  0x60da9d,
+  0x60e73c,
+  0x60eb49,
+  0x60f3a3,
+  0x60ffd6,
+  0x610641,
+  0x610a34,
+  0x6112de,
+  0x611eab,
+  0x61230a,
+  0x612f7f,
+  0x613795,
+  0x613be0,
+  0x6140a2,
+  0x614cd7,
+  0x61543d,
+  0x615848,
+  0x6165e9,
+  0x61699c,
+  0x617176,
+  0x617d03,
+  0x6187f2,
+  0x618b87,
+  0x61936d,
+  0x619f18,
+  0x61a2b9,
+  0x61aecc,
+  0x61b626,
+  0x61ba53,
+  0x61c111,
+  0x61cd64,
+  0x61d58e,
+  0x61d9fb,
+  0x61e45a,
+  0x61e82f,
+  0x61f0c5,
+  0x61fcb0,
+  0x6203eb,
+  0x620f9e,
+  0x621774,
+  0x621b01,
+  0x6226a0,
+  0x622ad5,
+  0x62323f,
+  0x623e4a,
+  0x624508,
+  0x62497d,
+  0x625197,
+  0x625de2,
+  0x626043,
+  0x626c36,
+  0x6274dc,
+  0x6278a9,
+  0x628258,
+  0x628e2d,
+  0x6296c7,
+  0x629ab2,
+  0x62a713,
+  0x62ab66,
+  0x62b38c,
+  0x62bff9,
+  0x62c4bb,
+  0x62c8ce,
+  0x62d024,
+  0x62dc51,
+  0x62e1f0,
+  0x62ed85,
+  0x62f56f,
+  0x62f91a,
+  0x63008d,
+  0x630cf8,
+  0x631412,
+  0x631867,
+  0x6325c6,
+  0x6329b3,
+  0x633159,
+  0x633d2c,
+  0x63466e,
+  0x634a1b,
+  0x6352f1,
+  0x635e84,
+  0x636325,
+  0x636f50,
+  0x6377ba,
+  0x637bcf,
+  0x63813e,
+  0x638d4b,
+  0x6395a1,
+  0x6399d4,
+  0x63a475,
+  0x63a800,
+  0x63b0ea,
+  0x63bc9f,
+  0x63c7dd,
+  0x63cba8,
+  0x63d342,
+  0x63df37,
+  0x63e296,
+  0x63eee3,
+  0x63f609,
+  0x63fa7c,
+  0x6404ca,
+  0x6408bf,
+  0x641055,
+  0x641c20,
+  0x642181,
+  0x642df4,
+  0x64351e,
+  0x64396b,
+  0x644229,
+  0x644e5c,
+  0x6456b6,
+  0x645ac3,
+  0x646762,
+  0x646b17,
+  0x6473fd,
+  0x647f88,
+  0x648579,
+  0x64890c,
+  0x6491e6,
+  0x649d93,
+  0x64a032,
+  0x64ac47,
+  0x64b4ad,
+  0x64b8d8,
+  0x64c39a,
+  0x64cfef,
+  0x64d705,
+  0x64db70,
+  0x64e6d1,
+  0x64eaa4,
+  0x64f24e,
+  0x64fe3b,
+  0x6507ac,
+  0x650bd9,
+  0x651333,
+  0x651f46,
+  0x6522e7,
+  0x652e92,
+  0x653678,
+  0x653a0d,
+  0x65414f,
+  0x654d3a,
+  0x6555d0,
+  0x6559a5,
+  0x656404,
+  0x656871,
+  0x65709b,
+  0x657cee,
+  0x65861f,
+  0x658a6a,
+  0x659280,
+  0x659ef5,
+  0x65a354,
+  0x65af21,
+  0x65b7cb,
+  0x65bbbe,
+  0x65c0fc,
+  0x65cc89,
+  0x65d463,
+  0x65d816,
+  0x65e5b7,
+  0x65e9c2,
+  0x65f128,
+  0x65fd5d,
+  0x660206,
+  0x660e73,
+  0x661699,
+  0x661aec,
+  0x66274d,
+  0x662b38,
+  0x6633d2,
+  0x663fa7,
+  0x6644e5,
+  0x664890,
+  0x66507a,
+  0x665c0f,
+  0x6661ae,
+  0x666ddb,
+  0x667531,
+  0x667944,
+  0x6683b5,
+  0x668fc0,
+  0x66972a,
+  0x669b5f,
+  0x66a6fe,
+  0x66aa8b,
+  0x66b261,
+  0x66be14,
+  0x66c556,
+  0x66c923,
+  0x66d1c9,
+  0x66ddbc,
+  0x66e01d,
+  0x66ec68,
+  0x66f482,
+  0x66f8f7,
+  0x670160,
+  0x670d15,
+  0x6715ff,
+  0x67198a,
+  0x67242b,
+  0x67285e,
+  0x6730b4,
+  0x673cc1,
+  0x674783,
+  0x674bf6,
+  0x67531c,
+  0x675f69,
+  0x6762c8,
+  0x676ebd,
+  0x677657,
+  0x677a22,
+  0x6780d3,
+  0x678ca6,
+  0x67944c,
+  0x679839,
+  0x67a598,
+  0x67a9ed,
+  0x67b107,
+  0x67bd72,
+  0x67c630,
+  0x67ca45,
+  0x67d2af,
+  0x67deda,
+  0x67e37b,
+  0x67ef0e,
+  0x67f7e4,
+  0x67fb91,
+  0x6806fd,
+  0x680a88,
+  0x681262,
+  0x681e17,
+  0x6823b6,
+  0x682fc3,
+  0x683729,
+  0x683b5c,
+  0x68401e,
+  0x684c6b,
+  0x685481,
+  0x6858f4,
+  0x686555,
+  0x686920,
+  0x6871ca,
+  0x687dbf,
+  0x68874e,
+  0x688b3b,
+  0x6893d1,
+  0x689fa4,
+  0x68a205,
+  0x68ae70,
+  0x68b69a,
+  0x68baef,
+  0x68c1ad,
+  0x68cdd8,
+  0x68d532,
+  0x68d947,
+  0x68e4e6,
+  0x68e893,
+  0x68f079,
+  0x68fc0c,
+  0x69059b,
+  0x6909ee,
+  0x691104,
+  0x691d71,
+  0x6920d0,
+  0x692ca5,
+  0x69344f,
+  0x69383a,
+  0x694378,
+  0x694f0d,
+  0x6957e7,
+  0x695b92,
+  0x696633,
+  0x696a46,
+  0x6972ac,
+  0x697ed9,
+  0x698428,
+  0x69885d,
+  0x6990b7,
+  0x699cc2,
+  0x69a163,
+  0x69ad16,
+  0x69b5fc,
+  0x69b989,
+  0x69c2cb,
+  0x69cebe,
+  0x69d654,
+  0x69da21,
+  0x69e780,
+  0x69ebf5,
+  0x69f31f,
+  0x69ff6a,
+  0x6a0031,
+  0x6a0c44,
+  0x6a14ae,
+  0x6a18db,
+  0x6a257a,
+  0x6a290f,
+  0x6a31e5,
+  0x6a3d90,
+  0x6a46d2,
+  0x6a4aa7,
+  0x6a524d,
+  0x6a5e38,
+  0x6a6399,
+  0x6a6fec,
+  0x6a7706,
+  0x6a7b73,
+  0x6a8182,
+  0x6a8df7,
+  0x6a951d,
+  0x6a9968,
+  0x6aa4c9,
+  0x6aa8bc,
+  0x6ab056,
+  0x6abc23,
+  0x6ac761,
+  0x6acb14,
+  0x6ad3fe,
+  0x6adf8b,
+  0x6ae22a,
+  0x6aee5f,
+  0x6af6b5,
+  0x6afac0,
+  0x6b0357,
+  0x6b0f22,
+  0x6b17c8,
+  0x6b1bbd,
+  0x6b261c,
+  0x6b2a69,
+  0x6b3283,
+  0x6b3ef6,
+  0x6b45b4,
+  0x6b49c1,
+  0x6b512b,
+  0x6b5d5e,
+  0x6b60ff,
+  0x6b6c8a,
+  0x6b7460,
+  0x6b7815,
+  0x6b82e4,
+  0x6b8e91,
+  0x6b967b,
+  0x6b9a0e,
+  0x6ba7af,
+  0x6babda,
+  0x6bb330,
+  0x6bbf45,
+  0x6bc407,
+  0x6bc872,
+  0x6bd098,
+  0x6bdced,
+  0x6be14c,
+  0x6bed39,
+  0x6bf5d3,
+  0x6bf9a6,
+  0x6c0710,
+  0x6c0b65,
+  0x6c138f,
+  0x6c1ffa,
+  0x6c225b,
+  0x6c2e2e,
+  0x6c36c4,
+  0x6c3ab1,
+  0x6c41f3,
+  0x6c4d86,
+  0x6c556c,
+  0x6c5919,
+  0x6c64b8,
+  0x6c68cd,
+  0x6c7027,
+  0x6c7c52,
+  0x6c86a3,
+  0x6c8ad6,
+  0x6c923c,
+  0x6c9e49,
+  0x6ca3e8,
+  0x6caf9d,
+  0x6cb777,
+  0x6cbb02,
+  0x6cc040,
+  0x6ccc35,
+  0x6cd4df,
+  0x6cd8aa,
+  0x6ce50b,
+  0x6ce97e,
+  0x6cf194,
+  0x6cfde1,
+  0x6d0476,
+  0x6d0803,
+  0x6d10e9,
+  0x6d1c9c,
+  0x6d213d,
+  0x6d2d48,
+  0x6d35a2,
+  0x6d39d7,
+  0x6d4295,
+  0x6d4ee0,
+  0x6d560a,
+  0x6d5a7f,
+  0x6d67de,
+  0x6d6bab,
+  0x6d7341,
+  0x6d7f34,
+  0x6d85c5,
+  0x6d89b0,
+  0x6d915a,
+  0x6d9d2f,
+  0x6da08e,
+  0x6dacfb,
+  0x6db411,
+  0x6db864,
+  0x6dc326,
+  0x6dcf53,
+  0x6dd7b9,
+  0x6ddbcc,
+  0x6de66d,
+  0x6dea18,
+  0x6df2f2,
+  0x6dfe87,
+  0x6e01dc,
+  0x6e0da9,
+  0x6e1543,
+  0x6e1936,
+  0x6e2497,
+  0x6e28e2,
+  0x6e3008,
+  0x6e3c7d,
+  0x6e473f,
+  0x6e4b4a,
+  0x6e53a0,
+  0x6e5fd5,
+  0x6e6274,
+  0x6e6e01,
+  0x6e76eb,
+  0x6e7a9e,
+  0x6e806f,
+  0x6e8c1a,
+  0x6e94f0,
+  0x6e9885,
+  0x6ea524,
+  0x6ea951,
+  0x6eb1bb,
+  0x6ebdce,
+  0x6ec68c,
+  0x6ecaf9,
+  0x6ed213,
+  0x6ede66,
+  0x6ee3c7,
+  0x6eefb2,
+  0x6ef758,
+  0x6efb2d,
+  0x6f02ba,
+  0x6f0ecf,
+  0x6f1625,
+  0x6f1a50,
+  0x6f27f1,
+  0x6f2b84,
+  0x6f336e,
+  0x6f3f1b,
+  0x6f4459,
+  0x6f482c,
+  0x6f50c6,
+  0x6f5cb3,
+  0x6f6112,
+  0x6f6d67,
+  0x6f758d,
+  0x6f79f8,
+  0x6f8309,
+  0x6f8f7c,
+  0x6f9796,
+  0x6f9be3,
+  0x6fa642,
+  0x6faa37,
+  0x6fb2dd,
+  0x6fbea8,
+  0x6fc5ea,
+  0x6fc99f,
+  0x6fd175,
+  0x6fdd00,
+  0x6fe0a1,
+  0x6fecd4,
+  0x6ff43e,
+  0x6ff84b,
+  0x700293,
+  0x700ee6,
+  0x70160c,
+  0x701a79,
+  0x7027d8,
+  0x702bad,
+  0x703347,
+  0x703f32,
+  0x704470,
+  0x704805,
+  0x7050ef,
+  0x705c9a,
+  0x70613b,
+  0x706d4e,
+  0x7075a4,
+  0x7079d1,
+  0x708320,
+  0x708f55,
+  0x7097bf,
+  0x709bca,
+  0x70a66b,
+  0x70aa1e,
+  0x70b2f4,
+  0x70be81,
+  0x70c5c3,
+  0x70c9b6,
+  0x70d15c,
+  0x70dd29,
+  0x70e088,
+  0x70ecfd,
+  0x70f417,
+  0x70f862,
+  0x7101f5,
+  0x710d80,
+  0x71156a,
+  0x71191f,
+  0x7124be,
+  0x7128cb,
+  0x713021,
+  0x713c54,
+  0x714716,
+  0x714b63,
+  0x715389,
+  0x715ffc,
+  0x71625d,
+  0x716e28,
+  0x7176c2,
+  0x717ab7,
+  0x718046,
+  0x718c33,
+  0x7194d9,
+  0x7198ac,
+  0x71a50d,
+  0x71a978,
+  0x71b192,
+  0x71bde7,
+  0x71c6a5,
+  0x71cad0,
+  0x71d23a,
+  0x71de4f,
+  0x71e3ee,
+  0x71ef9b,
+  0x71f771,
+  0x71fb04,
+  0x72045f,
+  0x72082a,
+  0x7210c0,
+  0x721cb5,
+  0x722114,
+  0x722d61,
+  0x72358b,
+  0x7239fe,
+  0x7242bc,
+  0x724ec9,
+  0x725623,
+  0x725a56,
+  0x7267f7,
+  0x726b82,
+  0x727368,
+  0x727f1d,
+  0x7285ec,
+  0x728999,
+  0x729173,
+  0x729d06,
+  0x72a0a7,
+  0x72acd2,
+  0x72b438,
+  0x72b84d,
+  0x72c30f,
+  0x72cf7a,
+  0x72d790,
+  0x72dbe5,
+  0x72e644,
+  0x72ea31,
+  0x72f2db,
+  0x72feae,
+  0x730739,
+  0x730b4c,
+  0x7313a6,
+  0x731fd3,
+  0x732272,
+  0x732e07,
+  0x7336ed,
+  0x733a98,
+  0x7341da,
+  0x734daf,
+  0x735545,
+  0x735930,
+  0x736491,
+  0x7368e4,
+  0x73700e,
+  0x737c7b,
+  0x73868a,
+  0x738aff,
+  0x739215,
+  0x739e60,
+  0x73a3c1,
+  0x73afb4,
+  0x73b75e,
+  0x73bb2b,
+  0x73c069,
+  0x73cc1c,
+  0x73d4f6,
+  0x73d883,
+  0x73e522,
+  0x73e957,
+  0x73f1bd,
+  0x73fdc8,
+  0x74037e,
+  0x740f0b,
+  0x7417e1,
+  0x741b94,
+  0x742635,
+  0x742a40,
+  0x7432aa,
+  0x743edf,
+  0x74459d,
+  0x7449e8,
+  0x745102,
+  0x745d77,
+  0x7460d6,
+  0x746ca3,
+  0x747449,
+  0x74783c,
+  0x7482cd,
+  0x748eb8,
+  0x749652,
+  0x749a27,
+  0x74a786,
+  0x74abf3,
+  0x74b319,
+  0x74bf6c,
+  0x74c42e,
+  0x74c85b,
+  0x74d0b1,
+  0x74dcc4,
+  0x74e165,
+  0x74ed10,
+  0x74f5fa,
+  0x74f98f,
+  0x750018,
+  0x750c6d,
+  0x751487,
+  0x7518f2,
+  0x752553,
+  0x752926,
+  0x7531cc,
+  0x753db9,
+  0x7546fb,
+  0x754a8e,
+  0x755264,
+  0x755e11,
+  0x7563b0,
+  0x756fc5,
+  0x75772f,
+  0x757b5a,
+  0x7581ab,
+  0x758dde,
+  0x759534,
+  0x759941,
+  0x75a4e0,
+  0x75a895,
+  0x75b07f,
+  0x75bc0a,
+  0x75c748,
+  0x75cb3d,
+  0x75d3d7,
+  0x75dfa2,
+  0x75e203,
+  0x75ee76,
+  0x75f69c,
+  0x75fae9,
+  0x7605b2,
+  0x7609c7,
+  0x76112d,
+  0x761d58,
+  0x7620f9,
+  0x762c8c,
+  0x763466,
+  0x763813,
+  0x764351,
+  0x764f24,
+  0x7657ce,
+  0x765bbb,
+  0x76661a,
+  0x766a6f,
+  0x767285,
+  0x767ef0,
+  0x768401,
+  0x768874,
+  0x76909e,
+  0x769ceb,
+  0x76a14a,
+  0x76ad3f,
+  0x76b5d5,
+  0x76b9a0,
+  0x76c2e2,
+  0x76ce97,
+  0x76d67d,
+  0x76da08,
+  0x76e7a9,
+  0x76ebdc,
+  0x76f336,
+  0x76ff43,
+  0x7706d4,
+  0x770aa1,
+  0x77124b,
+  0x771e3e,
+  0x77239f,
+  0x772fea,
+  0x773700,
+  0x773b75,
+  0x774037,
+  0x774c42,
+  0x7754a8,
+  0x7758dd,
+  0x77657c,
+  0x776909,
+  0x7771e3,
+  0x777d96,
+  0x778767,
+  0x778b12,
+  0x7793f8,
+  0x779f8d,
+  0x77a22c,
+  0x77ae59,
+  0x77b6b3,
+  0x77bac6,
+  0x77c184,
+  0x77cdf1,
+  0x77d51b,
+  0x77d96e,
+  0x77e4cf,
+  0x77e8ba,
+  0x77f050,
+  0x77fc25,
+  0x780149,
+  0x780d3c,
+  0x7815d6,
+  0x7819a3,
+  0x782402,
+  0x782877,
+  0x78309d,
+  0x783ce8,
+  0x7847aa,
+  0x784bdf,
+  0x785335,
+  0x785f40,
+  0x7862e1,
+  0x786e94,
+  0x78767e,
+  0x787a0b,
+  0x7880fa,
+  0x788c8f,
+  0x789465,
+  0x789810,
+  0x78a5b1,
+  0x78a9c4,
+  0x78b12e,
+  0x78bd5b,
+  0x78c619,
+  0x78ca6c,
+  0x78d286,
+  0x78def3,
+  0x78e352,
+  0x78ef27,
+  0x78f7cd,
+  0x78fbb8,
+  0x79022f,
+  0x790e5a,
+  0x7916b0,
+  0x791ac5,
+  0x792764,
+  0x792b11,
+  0x7933fb,
+  0x793f8e,
+  0x7944cc,
+  0x7948b9,
+  0x795053,
+  0x795c26,
+  0x796187,
+  0x796df2,
+  0x797518,
+  0x79796d,
+  0x79839c,
+  0x798fe9,
+  0x799703,
+  0x799b76,
+  0x79a6d7,
+  0x79aaa2,
+  0x79b248,
+  0x79be3d,
+  0x79c57f,
+  0x79c90a,
+  0x79d1e0,
+  0x79dd95,
+  0x79e034,
+  0x79ec41,
+  0x79f4ab,
+  0x79f8de,
+  0x7a0785,
+  0x7a0bf0,
+  0x7a131a,
+  0x7a1f6f,
+  0x7a22ce,
+  0x7a2ebb,
+  0x7a3651,
+  0x7a3a24,
+  0x7a4166,
+  0x7a4d13,
+  0x7a55f9,
+  0x7a598c,
+  0x7a642d,
+  0x7a6858,
+  0x7a70b2,
+  0x7a7cc7,
+  0x7a8636,
+  0x7a8a43,
+  0x7a92a9,
+  0x7a9edc,
+  0x7aa37d,
+  0x7aaf08,
+  0x7ab7e2,
+  0x7abb97,
+  0x7ac0d5,
+  0x7acca0,
+  0x7ad44a,
+  0x7ad83f,
+  0x7ae59e,
+  0x7ae9eb,
+  0x7af101,
+  0x7afd74,
+  0x7b04e3,
+  0x7b0896,
+  0x7b107c,
+  0x7b1c09,
+  0x7b21a8,
+  0x7b2ddd,
+  0x7b3537,
+  0x7b3942,
+  0x7b4200,
+  0x7b4e75,
+  0x7b569f,
+  0x7b5aea,
+  0x7b674b,
+  0x7b6b3e,
+  0x7b73d4,
+  0x7b7fa1,
+  0x7b8550,
+  0x7b8925,
+  0x7b91cf,
+  0x7b9dba,
+  0x7ba01b,
+  0x7bac6e,
+  0x7bb484,
+  0x7bb8f1,
+  0x7bc3b3,
+  0x7bcfc6,
+  0x7bd72c,
+  0x7bdb59,
+  0x7be6f8,
+  0x7bea8d,
+  0x7bf267,
+  0x7bfe12,
+  0x7c00a4,
+  0x7c0cd1,
+  0x7c143b,
+  0x7c184e,
+  0x7c25ef,
+  0x7c299a,
+  0x7c3170,
+  0x7c3d05,
+  0x7c4647,
+  0x7c4a32,
+  0x7c52d8,
+  0x7c5ead,
+  0x7c630c,
+  0x7c6f79,
+  0x7c7793,
+  0x7c7be6,
+  0x7c8117,
+  0x7c8d62,
+  0x7c9588,
+  0x7c99fd,
+  0x7ca45c,
+  0x7ca829,
+  0x7cb0c3,
+  0x7cbcb6,
+  0x7cc7f4,
+  0x7ccb81,
+  0x7cd36b,
+  0x7cdf1e,
+  0x7ce2bf,
+  0x7ceeca,
+  0x7cf620,
+  0x7cfa55,
+  0x7d03c2,
+  0x7d0fb7,
+  0x7d175d,
+  0x7d1b28,
+  0x7d2689,
+  0x7d2afc,
+  0x7d3216,
+  0x7d3e63,
+  0x7d4521,
+  0x7d4954,
+  0x7d51be,
+  0x7d5dcb,
+  0x7d606a,
+  0x7d6c1f,
+  0x7d74f5,
+  0x7d7880,
+  0x7d8271,
+  0x7d8e04,
+  0x7d96ee,
+  0x7d9a9b,
+  0x7da73a,
+  0x7dab4f,
+  0x7db3a5,
+  0x7dbfd0,
+  0x7dc492,
+  0x7dc8e7,
+  0x7dd00d,
+  0x7ddc78,
+  0x7de1d9,
+  0x7dedac,
+  0x7df546,
+  0x7df933,
+  0x7e0668,
+  0x7e0a1d,
+  0x7e12f7,
+  0x7e1e82,
+  0x7e2323,
+  0x7e2f56,
+  0x7e37bc,
+  0x7e3bc9,
+  0x7e408b,
+  0x7e4cfe,
+  0x7e5414,
+  0x7e5861,
+  0x7e65c0,
+  0x7e69b5,
+  0x7e715f,
+  0x7e7d2a,
+  0x7e87db,
+  0x7e8bae,
+  0x7e9344,
+  0x7e9f31,
+  0x7ea290,
+  0x7eaee5,
+  0x7eb60f,
+  0x7eba7a,
+  0x7ec138,
+  0x7ecd4d,
+  0x7ed5a7,
+  0x7ed9d2,
+  0x7ee473,
+  0x7ee806,
+  0x7ef0ec,
+  0x7efc99,
+  0x7f050e,
+  0x7f097b,
+  0x7f1191,
+  0x7f1de4,
+  0x7f2045,
+  0x7f2c30,
+  0x7f34da,
+  0x7f38af,
+  0x7f43ed,
+  0x7f4f98,
+  0x7f5772,
+  0x7f5b07,
+  0x7f66a6,
+  0x7f6ad3,
+  0x7f7239,
+  0x7f7e4c,
+  0x7f84bd,
+  0x7f88c8,
+  0x7f9022,
+  0x7f9c57,
+  0x7fa1f6,
+  0x7fad83,
+  0x7fb569,
+  0x7fb91c,
+  0x7fc25e,
+  0x7fce2b,
+  0x7fd6c1,
+  0x7fdab4,
+  0x7fe715,
+  0x7feb60,
+  0x7ff38a,
+  0x7fffff
+};
diff --git a/codec2/tags/0.4/src/hanning.h b/codec2/tags/0.4/src/hanning.h
new file mode 100644 (file)
index 0000000..81d88dc
--- /dev/null
@@ -0,0 +1,644 @@
+/* Generated by hanning_file() Octave function */
+
+const float hanning[]={
+  0,
+  2.4171e-05,
+  9.66816e-05,
+  0.000217525,
+  0.000386689,
+  0.000604158,
+  0.00086991,
+  0.00118392,
+  0.00154616,
+  0.00195659,
+  0.00241517,
+  0.00292186,
+  0.00347661,
+  0.00407937,
+  0.00473008,
+  0.00542867,
+  0.00617507,
+  0.00696922,
+  0.00781104,
+  0.00870045,
+  0.00963736,
+  0.0106217,
+  0.0116533,
+  0.0127322,
+  0.0138581,
+  0.0150311,
+  0.0162509,
+  0.0175175,
+  0.0188308,
+  0.0201906,
+  0.0215968,
+  0.0230492,
+  0.0245478,
+  0.0260923,
+  0.0276826,
+  0.0293186,
+  0.0310001,
+  0.032727,
+  0.034499,
+  0.036316,
+  0.0381779,
+  0.0400844,
+  0.0420354,
+  0.0440307,
+  0.04607,
+  0.0481533,
+  0.0502802,
+  0.0524506,
+  0.0546643,
+  0.056921,
+  0.0592206,
+  0.0615627,
+  0.0639473,
+  0.0663741,
+  0.0688427,
+  0.0713531,
+  0.0739048,
+  0.0764978,
+  0.0791318,
+  0.0818064,
+  0.0845214,
+  0.0872767,
+  0.0900718,
+  0.0929066,
+  0.0957807,
+  0.0986939,
+  0.101646,
+  0.104636,
+  0.107665,
+  0.110732,
+  0.113836,
+  0.116978,
+  0.120156,
+  0.123372,
+  0.126624,
+  0.129912,
+  0.133235,
+  0.136594,
+  0.139989,
+  0.143418,
+  0.146881,
+  0.150379,
+  0.153911,
+  0.157476,
+  0.161074,
+  0.164705,
+  0.168368,
+  0.172063,
+  0.17579,
+  0.179549,
+  0.183338,
+  0.187158,
+  0.191008,
+  0.194888,
+  0.198798,
+  0.202737,
+  0.206704,
+  0.2107,
+  0.214724,
+  0.218775,
+  0.222854,
+  0.226959,
+  0.231091,
+  0.235249,
+  0.239432,
+  0.243641,
+  0.247874,
+  0.252132,
+  0.256414,
+  0.260719,
+  0.265047,
+  0.269398,
+  0.273772,
+  0.278167,
+  0.282584,
+  0.287021,
+  0.29148,
+  0.295958,
+  0.300456,
+  0.304974,
+  0.30951,
+  0.314065,
+  0.318638,
+  0.323228,
+  0.327835,
+  0.332459,
+  0.3371,
+  0.341756,
+  0.346427,
+  0.351113,
+  0.355814,
+  0.360528,
+  0.365256,
+  0.369997,
+  0.374751,
+  0.379516,
+  0.384293,
+  0.389082,
+  0.393881,
+  0.398691,
+  0.40351,
+  0.408338,
+  0.413176,
+  0.418022,
+  0.422876,
+  0.427737,
+  0.432605,
+  0.43748,
+  0.44236,
+  0.447247,
+  0.452138,
+  0.457034,
+  0.461935,
+  0.466839,
+  0.471746,
+  0.476655,
+  0.481568,
+  0.486481,
+  0.491397,
+  0.496313,
+  0.501229,
+  0.506145,
+  0.511061,
+  0.515976,
+  0.520889,
+  0.5258,
+  0.530708,
+  0.535614,
+  0.540516,
+  0.545414,
+  0.550308,
+  0.555197,
+  0.560081,
+  0.564958,
+  0.56983,
+  0.574695,
+  0.579552,
+  0.584402,
+  0.589244,
+  0.594077,
+  0.598901,
+  0.603715,
+  0.60852,
+  0.613314,
+  0.618097,
+  0.622868,
+  0.627628,
+  0.632375,
+  0.63711,
+  0.641831,
+  0.646538,
+  0.651232,
+  0.655911,
+  0.660574,
+  0.665222,
+  0.669855,
+  0.67447,
+  0.679069,
+  0.683651,
+  0.688215,
+  0.69276,
+  0.697287,
+  0.701795,
+  0.706284,
+  0.710752,
+  0.7152,
+  0.719627,
+  0.724033,
+  0.728418,
+  0.73278,
+  0.73712,
+  0.741437,
+  0.74573,
+  0.75,
+  0.754246,
+  0.758467,
+  0.762663,
+  0.766833,
+  0.770978,
+  0.775097,
+  0.779189,
+  0.783254,
+  0.787291,
+  0.791301,
+  0.795283,
+  0.799236,
+  0.80316,
+  0.807055,
+  0.810921,
+  0.814756,
+  0.81856,
+  0.822334,
+  0.826077,
+  0.829788,
+  0.833468,
+  0.837115,
+  0.840729,
+  0.844311,
+  0.847859,
+  0.851374,
+  0.854855,
+  0.858301,
+  0.861713,
+  0.86509,
+  0.868431,
+  0.871737,
+  0.875007,
+  0.87824,
+  0.881437,
+  0.884598,
+  0.887721,
+  0.890806,
+  0.893854,
+  0.896864,
+  0.899835,
+  0.902768,
+  0.905661,
+  0.908516,
+  0.911331,
+  0.914106,
+  0.916841,
+  0.919536,
+  0.92219,
+  0.924804,
+  0.927376,
+  0.929907,
+  0.932397,
+  0.934845,
+  0.93725,
+  0.939614,
+  0.941935,
+  0.944213,
+  0.946448,
+  0.94864,
+  0.950789,
+  0.952894,
+  0.954955,
+  0.956972,
+  0.958946,
+  0.960874,
+  0.962759,
+  0.964598,
+  0.966393,
+  0.968142,
+  0.969846,
+  0.971505,
+  0.973118,
+  0.974686,
+  0.976207,
+  0.977683,
+  0.979112,
+  0.980495,
+  0.981832,
+  0.983122,
+  0.984365,
+  0.985561,
+  0.986711,
+  0.987813,
+  0.988868,
+  0.989876,
+  0.990837,
+  0.99175,
+  0.992616,
+  0.993434,
+  0.994204,
+  0.994927,
+  0.995601,
+  0.996228,
+  0.996807,
+  0.997337,
+  0.99782,
+  0.998255,
+  0.998641,
+  0.998979,
+  0.999269,
+  0.999511,
+  0.999704,
+  0.999849,
+  0.999946,
+  0.999994,
+  0.999994,
+  0.999946,
+  0.999849,
+  0.999704,
+  0.999511,
+  0.999269,
+  0.998979,
+  0.998641,
+  0.998255,
+  0.99782,
+  0.997337,
+  0.996807,
+  0.996228,
+  0.995601,
+  0.994927,
+  0.994204,
+  0.993434,
+  0.992616,
+  0.99175,
+  0.990837,
+  0.989876,
+  0.988868,
+  0.987813,
+  0.986711,
+  0.985561,
+  0.984365,
+  0.983122,
+  0.981832,
+  0.980495,
+  0.979112,
+  0.977683,
+  0.976207,
+  0.974686,
+  0.973118,
+  0.971505,
+  0.969846,
+  0.968142,
+  0.966393,
+  0.964598,
+  0.962759,
+  0.960874,
+  0.958946,
+  0.956972,
+  0.954955,
+  0.952894,
+  0.950789,
+  0.94864,
+  0.946448,
+  0.944213,
+  0.941935,
+  0.939614,
+  0.93725,
+  0.934845,
+  0.932397,
+  0.929907,
+  0.927376,
+  0.924804,
+  0.92219,
+  0.919536,
+  0.916841,
+  0.914106,
+  0.911331,
+  0.908516,
+  0.905661,
+  0.902768,
+  0.899835,
+  0.896864,
+  0.893854,
+  0.890806,
+  0.887721,
+  0.884598,
+  0.881437,
+  0.87824,
+  0.875007,
+  0.871737,
+  0.868431,
+  0.86509,
+  0.861713,
+  0.858301,
+  0.854855,
+  0.851374,
+  0.847859,
+  0.844311,
+  0.840729,
+  0.837115,
+  0.833468,
+  0.829788,
+  0.826077,
+  0.822334,
+  0.81856,
+  0.814756,
+  0.810921,
+  0.807055,
+  0.80316,
+  0.799236,
+  0.795283,
+  0.791301,
+  0.787291,
+  0.783254,
+  0.779189,
+  0.775097,
+  0.770978,
+  0.766833,
+  0.762663,
+  0.758467,
+  0.754246,
+  0.75,
+  0.74573,
+  0.741437,
+  0.73712,
+  0.73278,
+  0.728418,
+  0.724033,
+  0.719627,
+  0.7152,
+  0.710752,
+  0.706284,
+  0.701795,
+  0.697287,
+  0.69276,
+  0.688215,
+  0.683651,
+  0.679069,
+  0.67447,
+  0.669855,
+  0.665222,
+  0.660574,
+  0.655911,
+  0.651232,
+  0.646538,
+  0.641831,
+  0.63711,
+  0.632375,
+  0.627628,
+  0.622868,
+  0.618097,
+  0.613314,
+  0.60852,
+  0.603715,
+  0.598901,
+  0.594077,
+  0.589244,
+  0.584402,
+  0.579552,
+  0.574695,
+  0.56983,
+  0.564958,
+  0.560081,
+  0.555197,
+  0.550308,
+  0.545414,
+  0.540516,
+  0.535614,
+  0.530708,
+  0.5258,
+  0.520889,
+  0.515976,
+  0.511061,
+  0.506145,
+  0.501229,
+  0.496313,
+  0.491397,
+  0.486481,
+  0.481568,
+  0.476655,
+  0.471746,
+  0.466839,
+  0.461935,
+  0.457034,
+  0.452138,
+  0.447247,
+  0.44236,
+  0.43748,
+  0.432605,
+  0.427737,
+  0.422876,
+  0.418022,
+  0.413176,
+  0.408338,
+  0.40351,
+  0.398691,
+  0.393881,
+  0.389082,
+  0.384293,
+  0.379516,
+  0.374751,
+  0.369997,
+  0.365256,
+  0.360528,
+  0.355814,
+  0.351113,
+  0.346427,
+  0.341756,
+  0.3371,
+  0.332459,
+  0.327835,
+  0.323228,
+  0.318638,
+  0.314065,
+  0.30951,
+  0.304974,
+  0.300456,
+  0.295958,
+  0.29148,
+  0.287021,
+  0.282584,
+  0.278167,
+  0.273772,
+  0.269398,
+  0.265047,
+  0.260719,
+  0.256414,
+  0.252132,
+  0.247874,
+  0.243641,
+  0.239432,
+  0.235249,
+  0.231091,
+  0.226959,
+  0.222854,
+  0.218775,
+  0.214724,
+  0.2107,
+  0.206704,
+  0.202737,
+  0.198798,
+  0.194888,
+  0.191008,
+  0.187158,
+  0.183338,
+  0.179549,
+  0.17579,
+  0.172063,
+  0.168368,
+  0.164705,
+  0.161074,
+  0.157476,
+  0.153911,
+  0.150379,
+  0.146881,
+  0.143418,
+  0.139989,
+  0.136594,
+  0.133235,
+  0.129912,
+  0.126624,
+  0.123372,
+  0.120156,
+  0.116978,
+  0.113836,
+  0.110732,
+  0.107665,
+  0.104636,
+  0.101646,
+  0.0986939,
+  0.0957807,
+  0.0929066,
+  0.0900718,
+  0.0872767,
+  0.0845214,
+  0.0818064,
+  0.0791318,
+  0.0764978,
+  0.0739048,
+  0.0713531,
+  0.0688427,
+  0.0663741,
+  0.0639473,
+  0.0615627,
+  0.0592206,
+  0.056921,
+  0.0546643,
+  0.0524506,
+  0.0502802,
+  0.0481533,
+  0.04607,
+  0.0440307,
+  0.0420354,
+  0.0400844,
+  0.0381779,
+  0.036316,
+  0.034499,
+  0.032727,
+  0.0310001,
+  0.0293186,
+  0.0276826,
+  0.0260923,
+  0.0245478,
+  0.0230492,
+  0.0215968,
+  0.0201906,
+  0.0188308,
+  0.0175175,
+  0.0162509,
+  0.0150311,
+  0.0138581,
+  0.0127322,
+  0.0116533,
+  0.0106217,
+  0.00963736,
+  0.00870045,
+  0.00781104,
+  0.00696922,
+  0.00617507,
+  0.00542867,
+  0.00473008,
+  0.00407937,
+  0.00347661,
+  0.00292186,
+  0.00241517,
+  0.00195659,
+  0.00154616,
+  0.00118392,
+  0.00086991,
+  0.000604158,
+  0.000386689,
+  0.000217525,
+  9.66816e-05,
+  2.4171e-05,
+  0
+};
diff --git a/codec2/tags/0.4/src/ht_coeff.h b/codec2/tags/0.4/src/ht_coeff.h
new file mode 100644 (file)
index 0000000..98c5c6e
--- /dev/null
@@ -0,0 +1,107 @@
+/* Hilbert Transform FIR filter coeffs */
+/* Generated by make_hilb Octave script */
+
+#define HT_N 100
+
+COMP ht_coeff[]={
+  {0.000000,0.000000},
+  {-0.000000,-0.000001},
+  {0.000000,0.000000},
+  {-0.000000,-0.000017},
+  {0.000000,0.000000},
+  {0.000000,-0.000079},
+  {0.000000,0.000000},
+  {0.000000,-0.000217},
+  {0.000000,0.000000},
+  {0.000000,-0.000461},
+  {0.000000,0.000000},
+  {-0.000000,-0.000842},
+  {0.000000,0.000000},
+  {-0.000000,-0.001391},
+  {0.000000,0.000000},
+  {-0.000000,-0.002140},
+  {0.000000,0.000000},
+  {-0.000000,-0.003121},
+  {0.000000,0.000000},
+  {0.000000,-0.004371},
+  {0.000000,0.000000},
+  {0.000000,-0.005928},
+  {0.000000,0.000000},
+  {-0.000000,-0.007839},
+  {0.000000,0.000000},
+  {-0.000000,-0.010159},
+  {0.000000,0.000000},
+  {-0.000000,-0.012957},
+  {0.000000,0.000000},
+  {-0.000000,-0.016327},
+  {0.000000,0.000000},
+  {0.000000,-0.020399},
+  {0.000000,0.000000},
+  {-0.000000,-0.025364},
+  {0.000000,0.000000},
+  {0.000000,-0.031512},
+  {0.000000,0.000000},
+  {0.000000,-0.039319},
+  {0.000000,0.000000},
+  {0.000000,-0.049610},
+  {0.000000,0.000000},
+  {-0.000000,-0.063952},
+  {0.000000,0.000000},
+  {-0.000000,-0.085722},
+  {0.000000,0.000000},
+  {0.000000,-0.123718},
+  {0.000000,0.000000},
+  {0.000000,-0.210249},
+  {0.000000,0.000000},
+  {-0.000000,-0.636250},
+  {0.999748,0.000000},
+  {0.000000,0.634969},
+  {0.000000,0.000000},
+  {0.000000,0.208979},
+  {0.000000,0.000000},
+  {0.000000,0.122467},
+  {0.000000,0.000000},
+  {-0.000000,0.084502},
+  {0.000000,0.000000},
+  {0.000000,0.062771},
+  {0.000000,0.000000},
+  {0.000000,0.048477},
+  {0.000000,0.000000},
+  {0.000000,0.038242},
+  {0.000000,0.000000},
+  {-0.000000,0.030497},
+  {0.000000,0.000000},
+  {0.000000,0.024418},
+  {0.000000,0.000000},
+  {0.000000,0.019527},
+  {0.000000,0.000000},
+  {-0.000000,0.015532},
+  {0.000000,0.000000},
+  {0.000000,0.012242},
+  {0.000000,0.000000},
+  {-0.000000,0.009524},
+  {0.000000,0.000000},
+  {-0.000000,0.007285},
+  {0.000000,0.000000},
+  {-0.000000,0.005454},
+  {0.000000,0.000000},
+  {-0.000000,0.003973},
+  {0.000000,0.000000},
+  {0.000000,0.002796},
+  {0.000000,0.000000},
+  {-0.000000,0.001882},
+  {0.000000,0.000000},
+  {-0.000000,0.001196},
+  {0.000000,0.000000},
+  {-0.000000,0.000701},
+  {0.000000,0.000000},
+  {0.000000,0.000367},
+  {0.000000,0.000000},
+  {0.000000,0.000160},
+  {0.000000,0.000000},
+  {0.000000,0.000051},
+  {0.000000,0.000000},
+  {-0.000000,0.000008},
+  {0.000000,0.000000},
+  {0.000000,0.000000}
+};
\ No newline at end of file
diff --git a/codec2/tags/0.4/src/insert_errors.c b/codec2/tags/0.4/src/insert_errors.c
new file mode 100644 (file)
index 0000000..cbe8323
--- /dev/null
@@ -0,0 +1,120 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: insert_errors.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 20/2/2013
+
+  Inserts errors into a Codec 2 bit stream using error files.  The
+  error files have one 16 bit short per bit, the short is set to 1 if
+  there is an error, or zero otherwise.  The Codec 2 bit stream files
+  are in packed format, i.e. c2enc/c2dec format.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 "codec2.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+    FILE          *fin;
+    FILE          *fout;
+    FILE          *ferror;
+    int            i, start_bit, end_bit, bit;
+    unsigned char  byte;
+    short          error;
+    int            errors, bits;
+    int            bits_per_frame;
+
+    if (argc < 4) {
+       printf("%s InputBitFile OutputBitFile ErrorFile bitsPerFrame [startBit endBit]\n", argv[0]);
+       printf("%s InputBitFile OutputBitFile BER\n", argv[0]);
+       exit(1);
+    }
+
+    if (strcmp(argv[1], "-")  == 0) fin = stdin;
+    else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+         argv[1], strerror(errno));
+       exit(1);
+    }
+
+    if (strcmp(argv[2], "-") == 0) fout = stdout;
+    else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+       fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+         argv[2], strerror(errno));
+       exit(1);
+    }
+
+    if ((ferror = fopen(argv[3],"rb")) == NULL ) {
+       fprintf(stderr, "Error opening error file: %s: %s.\n",
+         argv[3], strerror(errno));
+       exit(1);
+    }
+
+    bits_per_frame = atoi(argv[4]);
+
+    start_bit = 0; end_bit = bits_per_frame;
+    if (argc == 7) {
+       start_bit = atoi(argv[5]);
+       end_bit = atoi(argv[6]);   
+    }
+        
+    bit = 0;
+    bits = errors = 0;
+
+    while(fread(&byte, sizeof(char), 1, fin) == 1) {
+
+        for(i=0; i<8; i++, bits++) {
+            if (bits != bits_per_frame) {
+                if (fread(&error, sizeof(short), 1, ferror)) {
+                    if ((bit >= start_bit) && (bit <= end_bit))
+                        byte ^= error << (7-i);
+                    if (error)
+                        errors++;
+                }
+                else {
+                    fprintf(stderr,"bits: %d ber: %4.3f\n", bits, (float)errors/bits);
+                    fclose (fin); fclose(fout); fclose(ferror);
+                    exit(0);
+                }
+            }
+        }
+
+        fwrite(&byte, sizeof(char), 1, fout);
+        if (bits == bits_per_frame)
+            bits = 0;
+        if (fout == stdout) fflush(stdout);
+        if (fin == stdin) fflush(stdin);         
+    }
+
+    fclose(fin);
+    fclose(fout);
+    fclose(ferror);
+
+    fprintf(stderr,"bits: %d ber: %4.3f\n", bits, (float)errors/bits);
+
+    return 0;
+}
diff --git a/codec2/tags/0.4/src/interp.c b/codec2/tags/0.4/src/interp.c
new file mode 100644 (file)
index 0000000..5862bc2
--- /dev/null
@@ -0,0 +1,325 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: interp.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 9/10/09
+
+  Interpolation of 20ms frames to 10ms frames.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 <assert.h>
+#include <math.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "defines.h"
+#include "interp.h"
+#include "lsp.h"
+#include "quantise.h"
+
+float sample_log_amp(MODEL *model, float w);
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interp()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/10 
+        
+  Given two frames decribed by model parameters 20ms apart, determines
+  the model parameters of the 10ms frame between them.  Assumes
+  voicing is available for middle (interpolated) frame.  Outputs are
+  amplitudes and Wo for the interpolated frame.
+
+  This version can interpolate the amplitudes between two frames of
+  different Wo and L.
+
+  This version works by log linear interpolation, but listening tests
+  showed it creates problems in background noise, e.g. hts2a and mmt1.
+  When this function is used (--dec mode) bg noise appears to be
+  amplitude modulated, and gets louder.  The interp_lsp() function
+  below seems to do a better job.
+  
+\*---------------------------------------------------------------------------*/
+
+void interpolate(
+  MODEL *interp,    /* interpolated model params                     */
+  MODEL *prev,      /* previous frames model params                  */
+  MODEL *next       /* next frames model params                      */
+)
+{
+    int   l;
+    float w,log_amp;
+
+    /* Wo depends on voicing of this and adjacent frames */
+
+    if (interp->voiced) {
+       if (prev->voiced && next->voiced)
+           interp->Wo = (prev->Wo + next->Wo)/2.0;
+       if (!prev->voiced && next->voiced)
+           interp->Wo = next->Wo;
+       if (prev->voiced && !next->voiced)
+           interp->Wo = prev->Wo;
+    }
+    else {
+       interp->Wo = TWO_PI/P_MAX;
+    }
+    interp->L = PI/interp->Wo;
+
+    /* Interpolate amplitudes using linear interpolation in log domain */
+
+    for(l=1; l<=interp->L; l++) {
+       w = l*interp->Wo;
+       log_amp = (sample_log_amp(prev, w) + sample_log_amp(next, w))/2.0;
+       interp->A[l] = powf(10.0, log_amp);
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: sample_log_amp()
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/10 
+        
+  Samples the amplitude envelope at an arbitrary frequency w.  Uses
+  linear interpolation in the log domain to sample between harmonic
+  amplitudes.
+  
+\*---------------------------------------------------------------------------*/
+
+float sample_log_amp(MODEL *model, float w)
+{
+    int   m;
+    float f, log_amp;
+
+    assert(w > 0.0); assert (w <= PI);
+
+    m = floorf(w/model->Wo + 0.5);
+    f = (w - m*model->Wo)/w;
+    assert(f <= 1.0);
+
+    if (m < 1) {
+       log_amp = f*log10f(model->A[1] + 1E-6);
+    }
+    else if ((m+1) > model->L) {
+       log_amp = (1.0-f)*log10f(model->A[model->L] + 1E-6);
+    }
+    else {
+       log_amp = (1.0-f)*log10f(model->A[m] + 1E-6) + 
+                  f*log10f(model->A[m+1] + 1E-6);
+    }
+
+    return log_amp;
+}
+
+#ifdef NOT_NEEDED
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interp_lsp()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 10 Nov 2010
+        
+  Given two frames decribed by model parameters 20ms apart, determines
+  the model parameters of the 10ms frame between them.  Assumes
+  voicing is available for middle (interpolated) frame.  Outputs are
+  amplitudes and Wo for the interpolated frame.
+
+  This version uses interpolation of LSPs, seems to do a better job
+  with bg noise.
+  
+\*---------------------------------------------------------------------------*/
+
+void interpolate_lsp(
+  kiss_fft_cfg  fft_fwd_cfg, 
+  MODEL *interp,    /* interpolated model params                     */
+  MODEL *prev,      /* previous frames model params                  */
+  MODEL *next,      /* next frames model params                      */
+  float *prev_lsps, /* previous frames LSPs                          */
+  float  prev_e,    /* previous frames LPC energy                    */
+  float *next_lsps, /* next frames LSPs                              */
+  float  next_e,    /* next frames LPC energy                        */
+  float *ak_interp, /* interpolated aks for this frame               */
+  float *lsps_interp/* interpolated lsps for this frame              */
+)
+{
+    int   i;
+    float e;
+    float snr;
+
+    /* trap corner case where V est is probably wrong */
+
+    if (interp->voiced && !prev->voiced && !next->voiced) {
+       interp->voiced = 0;
+    }  
+   
+    /* Wo depends on voicing of this and adjacent frames */
+
+    if (interp->voiced) {
+       if (prev->voiced && next->voiced)
+           interp->Wo = (prev->Wo + next->Wo)/2.0;
+       if (!prev->voiced && next->voiced)
+           interp->Wo = next->Wo;
+       if (prev->voiced && !next->voiced)
+           interp->Wo = prev->Wo;
+    }
+    else {
+       interp->Wo = TWO_PI/P_MAX;
+    }
+    interp->L = PI/interp->Wo;
+
+    //printf("  interp: prev_v: %d next_v: %d prev_Wo: %f next_Wo: %f\n",
+    //    prev->voiced, next->voiced, prev->Wo, next->Wo);
+    //printf("  interp: Wo: %1.5f  L: %d\n", interp->Wo, interp->L);
+
+    /* interpolate LSPs */
+
+    for(i=0; i<LPC_ORD; i++) {
+       lsps_interp[i] = (prev_lsps[i] + next_lsps[i])/2.0;
+    }
+
+    /* Interpolate LPC energy in log domain */
+
+    e = powf(10.0, (log10f(prev_e) + log10f(next_e))/2.0);
+    //printf("  interp: e: %f\n", e);
+
+    /* convert back to amplitudes */
+
+    lsp_to_lpc(lsps_interp, ak_interp, LPC_ORD);
+    aks_to_M2(fft_fwd_cfg, ak_interp, LPC_ORD, interp, e, &snr, 0, 0, 1, 1, LPCPF_BETA, LPCPF_GAMMA); 
+    //printf("  interp: ak[1]: %f A[1] %f\n", ak_interp[1], interp->A[1]);
+}
+#endif
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interp_Wo()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22 May 2012
+        
+  Interpolates centre 10ms sample of Wo and L samples given two
+  samples 20ms apart. Assumes voicing is available for centre
+  (interpolated) frame.
+  
+\*---------------------------------------------------------------------------*/
+
+void interp_Wo(
+  MODEL *interp,    /* interpolated model params                     */
+  MODEL *prev,      /* previous frames model params                  */
+  MODEL *next       /* next frames model params                      */
+              )
+{
+    interp_Wo2(interp, prev, next, 0.5);
+}
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interp_Wo2()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22 May 2012
+        
+  Weighted interpolation of two Wo samples.
+  
+\*---------------------------------------------------------------------------*/
+
+void interp_Wo2(
+  MODEL *interp,    /* interpolated model params                     */
+  MODEL *prev,      /* previous frames model params                  */
+  MODEL *next,      /* next frames model params                      */
+  float  weight
+)
+{
+    /* trap corner case where voicing est is probably wrong */
+
+    if (interp->voiced && !prev->voiced && !next->voiced) {
+       interp->voiced = 0;
+    }  
+   
+    /* Wo depends on voicing of this and adjacent frames */
+
+    if (interp->voiced) {
+       if (prev->voiced && next->voiced)
+           interp->Wo = (1.0 - weight)*prev->Wo + weight*next->Wo;
+       if (!prev->voiced && next->voiced)
+           interp->Wo = next->Wo;
+       if (prev->voiced && !next->voiced)
+           interp->Wo = prev->Wo;
+    }
+    else {
+       interp->Wo = TWO_PI/P_MAX;
+    }
+    interp->L = PI/interp->Wo;
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interp_energy()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22 May 2012
+        
+  Interpolates centre 10ms sample of energy given two samples 20ms
+  apart.
+  
+\*---------------------------------------------------------------------------*/
+
+float interp_energy(float prev_e, float next_e)
+{
+    return powf(10.0, (log10f(prev_e) + log10f(next_e))/2.0);
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interp_energy2()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22 May 2012
+        
+  Interpolates centre 10ms sample of energy given two samples 20ms
+  apart.
+  
+\*---------------------------------------------------------------------------*/
+
+float interp_energy2(float prev_e, float next_e, float weight)
+{
+    return powf(10.0, (1.0 - weight)*log10f(prev_e) + weight*log10f(next_e));
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: interpolate_lsp_ver2()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22 May 2012
+        
+  Weighted interpolation of LSPs.
+  
+\*---------------------------------------------------------------------------*/
+
+void interpolate_lsp_ver2(float interp[], float prev[],  float next[], float weight, int order)
+{
+    int i;
+
+    for(i=0; i<order; i++)
+       interp[i] = (1.0 - weight)*prev[i] + weight*next[i];
+}
+
diff --git a/codec2/tags/0.4/src/interp.h b/codec2/tags/0.4/src/interp.h
new file mode 100644 (file)
index 0000000..688fb5a
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: interp.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 9/10/09
+
+  Interpolation of 20ms frames to 10ms frames.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __INTERP__
+#define __INTERP__
+
+#include "kiss_fft.h"
+
+void interpolate(MODEL *interp, MODEL *prev, MODEL *next);
+void interpolate_lsp(kiss_fft_cfg  fft_dec_cfg,
+                    MODEL *interp, MODEL *prev, MODEL *next, 
+                    float *prev_lsps, float  prev_e,
+                    float *next_lsps, float  next_e,
+                    float *ak_interp, float *lsps_interp);
+void interp_Wo(MODEL *interp, MODEL *prev, MODEL *next);
+void interp_Wo2(MODEL *interp, MODEL *prev, MODEL *next, float weight);
+float interp_energy(float prev, float next);
+float interp_energy2(float prev, float next, float weight);
+void interpolate_lsp_ver2(float interp[], float prev[],  float next[], float weight, int order);
+
+#endif
diff --git a/codec2/tags/0.4/src/kiss_fft.c b/codec2/tags/0.4/src/kiss_fft.c
new file mode 100644 (file)
index 0000000..3d1d483
--- /dev/null
@@ -0,0 +1,408 @@
+/*
+Copyright (c) 2003-2010, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "_kiss_fft_guts.h"
+/* The guts header contains all the multiplication and addition macros that are defined for
+ fixed or floating point complex numbers.  It also delares the kf_ internal functions.
+ */
+
+static void kf_bfly2(
+        kiss_fft_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_cfg st,
+        int m
+        )
+{
+    kiss_fft_cpx * Fout2;
+    kiss_fft_cpx * tw1 = st->twiddles;
+    kiss_fft_cpx t;
+    Fout2 = Fout + m;
+    do{
+        C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
+
+        C_MUL (t,  *Fout2 , *tw1);
+        tw1 += fstride;
+        C_SUB( *Fout2 ,  *Fout , t );
+        C_ADDTO( *Fout ,  t );
+        ++Fout2;
+        ++Fout;
+    }while (--m);
+}
+
+static void kf_bfly4(
+        kiss_fft_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_cfg st,
+        const size_t m
+        )
+{
+    kiss_fft_cpx *tw1,*tw2,*tw3;
+    kiss_fft_cpx scratch[6];
+    size_t k=m;
+    const size_t m2=2*m;
+    const size_t m3=3*m;
+
+
+    tw3 = tw2 = tw1 = st->twiddles;
+
+    do {
+        C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4);
+
+        C_MUL(scratch[0],Fout[m] , *tw1 );
+        C_MUL(scratch[1],Fout[m2] , *tw2 );
+        C_MUL(scratch[2],Fout[m3] , *tw3 );
+
+        C_SUB( scratch[5] , *Fout, scratch[1] );
+        C_ADDTO(*Fout, scratch[1]);
+        C_ADD( scratch[3] , scratch[0] , scratch[2] );
+        C_SUB( scratch[4] , scratch[0] , scratch[2] );
+        C_SUB( Fout[m2], *Fout, scratch[3] );
+        tw1 += fstride;
+        tw2 += fstride*2;
+        tw3 += fstride*3;
+        C_ADDTO( *Fout , scratch[3] );
+
+        if(st->inverse) {
+            Fout[m].r = scratch[5].r - scratch[4].i;
+            Fout[m].i = scratch[5].i + scratch[4].r;
+            Fout[m3].r = scratch[5].r + scratch[4].i;
+            Fout[m3].i = scratch[5].i - scratch[4].r;
+        }else{
+            Fout[m].r = scratch[5].r + scratch[4].i;
+            Fout[m].i = scratch[5].i - scratch[4].r;
+            Fout[m3].r = scratch[5].r - scratch[4].i;
+            Fout[m3].i = scratch[5].i + scratch[4].r;
+        }
+        ++Fout;
+    }while(--k);
+}
+
+static void kf_bfly3(
+         kiss_fft_cpx * Fout,
+         const size_t fstride,
+         const kiss_fft_cfg st,
+         size_t m
+         )
+{
+     size_t k=m;
+     const size_t m2 = 2*m;
+     kiss_fft_cpx *tw1,*tw2;
+     kiss_fft_cpx scratch[5];
+     kiss_fft_cpx epi3;
+     epi3 = st->twiddles[fstride*m];
+
+     tw1=tw2=st->twiddles;
+
+     do{
+         C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
+
+         C_MUL(scratch[1],Fout[m] , *tw1);
+         C_MUL(scratch[2],Fout[m2] , *tw2);
+
+         C_ADD(scratch[3],scratch[1],scratch[2]);
+         C_SUB(scratch[0],scratch[1],scratch[2]);
+         tw1 += fstride;
+         tw2 += fstride*2;
+
+         Fout[m].r = Fout->r - HALF_OF(scratch[3].r);
+         Fout[m].i = Fout->i - HALF_OF(scratch[3].i);
+
+         C_MULBYSCALAR( scratch[0] , epi3.i );
+
+         C_ADDTO(*Fout,scratch[3]);
+
+         Fout[m2].r = Fout[m].r + scratch[0].i;
+         Fout[m2].i = Fout[m].i - scratch[0].r;
+
+         Fout[m].r -= scratch[0].i;
+         Fout[m].i += scratch[0].r;
+
+         ++Fout;
+     }while(--k);
+}
+
+static void kf_bfly5(
+        kiss_fft_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_cfg st,
+        int m
+        )
+{
+    kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
+    int u;
+    kiss_fft_cpx scratch[13];
+    kiss_fft_cpx * twiddles = st->twiddles;
+    kiss_fft_cpx *tw;
+    kiss_fft_cpx ya,yb;
+    ya = twiddles[fstride*m];
+    yb = twiddles[fstride*2*m];
+
+    Fout0=Fout;
+    Fout1=Fout0+m;
+    Fout2=Fout0+2*m;
+    Fout3=Fout0+3*m;
+    Fout4=Fout0+4*m;
+
+    tw=st->twiddles;
+    for ( u=0; u<m; ++u ) {
+        C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
+        scratch[0] = *Fout0;
+
+        C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
+        C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
+        C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
+        C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
+
+        C_ADD( scratch[7],scratch[1],scratch[4]);
+        C_SUB( scratch[10],scratch[1],scratch[4]);
+        C_ADD( scratch[8],scratch[2],scratch[3]);
+        C_SUB( scratch[9],scratch[2],scratch[3]);
+
+        Fout0->r += scratch[7].r + scratch[8].r;
+        Fout0->i += scratch[7].i + scratch[8].i;
+
+        scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
+        scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r);
+
+        scratch[6].r =  S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i);
+        scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i);
+
+        C_SUB(*Fout1,scratch[5],scratch[6]);
+        C_ADD(*Fout4,scratch[5],scratch[6]);
+
+        scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r);
+        scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r);
+        scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i);
+        scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i);
+
+        C_ADD(*Fout2,scratch[11],scratch[12]);
+        C_SUB(*Fout3,scratch[11],scratch[12]);
+
+        ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
+    }
+}
+
+/* perform the butterfly for one stage of a mixed radix FFT */
+static void kf_bfly_generic(
+        kiss_fft_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_cfg st,
+        int m,
+        int p
+        )
+{
+    int u,k,q1,q;
+    kiss_fft_cpx * twiddles = st->twiddles;
+    kiss_fft_cpx t;
+    int Norig = st->nfft;
+
+    kiss_fft_cpx * scratch = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx)*p);
+
+    for ( u=0; u<m; ++u ) {
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            scratch[q1] = Fout[ k  ];
+            C_FIXDIV(scratch[q1],p);
+            k += m;
+        }
+
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            int twidx=0;
+            Fout[ k ] = scratch[0];
+            for (q=1;q<p;++q ) {
+                twidx += fstride * k;
+                if (twidx>=Norig) twidx-=Norig;
+                C_MUL(t,scratch[q] , twiddles[twidx] );
+                C_ADDTO( Fout[ k ] ,t);
+            }
+            k += m;
+        }
+    }
+    KISS_FFT_TMP_FREE(scratch);
+}
+
+static
+void kf_work(
+        kiss_fft_cpx * Fout,
+        const kiss_fft_cpx * f,
+        const size_t fstride,
+        int in_stride,
+        int * factors,
+        const kiss_fft_cfg st
+        )
+{
+    kiss_fft_cpx * Fout_beg=Fout;
+    const int p=*factors++; /* the radix  */
+    const int m=*factors++; /* stage's fft length/p */
+    const kiss_fft_cpx * Fout_end = Fout + p*m;
+
+#ifdef _OPENMP
+    // use openmp extensions at the 
+    // top-level (not recursive)
+    if (fstride==1 && p<=5)
+    {
+        int k;
+
+        // execute the p different work units in different threads
+#       pragma omp parallel for
+        for (k=0;k<p;++k) 
+            kf_work( Fout +k*m, f+ fstride*in_stride*k,fstride*p,in_stride,factors,st);
+        // all threads have joined by this point
+
+        switch (p) {
+            case 2: kf_bfly2(Fout,fstride,st,m); break;
+            case 3: kf_bfly3(Fout,fstride,st,m); break; 
+            case 4: kf_bfly4(Fout,fstride,st,m); break;
+            case 5: kf_bfly5(Fout,fstride,st,m); break; 
+            default: kf_bfly_generic(Fout,fstride,st,m,p); break;
+        }
+        return;
+    }
+#endif
+
+    if (m==1) {
+        do{
+            *Fout = *f;
+            f += fstride*in_stride;
+        }while(++Fout != Fout_end );
+    }else{
+        do{
+            // recursive call:
+            // DFT of size m*p performed by doing
+            // p instances of smaller DFTs of size m, 
+            // each one takes a decimated version of the input
+            kf_work( Fout , f, fstride*p, in_stride, factors,st);
+            f += fstride*in_stride;
+        }while( (Fout += m) != Fout_end );
+    }
+
+    Fout=Fout_beg;
+
+    // recombine the p smaller DFTs 
+    switch (p) {
+        case 2: kf_bfly2(Fout,fstride,st,m); break;
+        case 3: kf_bfly3(Fout,fstride,st,m); break; 
+        case 4: kf_bfly4(Fout,fstride,st,m); break;
+        case 5: kf_bfly5(Fout,fstride,st,m); break; 
+        default: kf_bfly_generic(Fout,fstride,st,m,p); break;
+    }
+}
+
+/*  facbuf is populated by p1,m1,p2,m2, ...
+    where 
+    p[i] * m[i] = m[i-1]
+    m0 = n                  */
+static 
+void kf_factor(int n,int * facbuf)
+{
+    int p=4;
+    double floor_sqrt;
+    floor_sqrt = floorf( sqrtf((double)n) );
+
+    /*factor out powers of 4, powers of 2, then any remaining primes */
+    do {
+        while (n % p) {
+            switch (p) {
+                case 4: p = 2; break;
+                case 2: p = 3; break;
+                default: p += 2; break;
+            }
+            if (p > floor_sqrt)
+                p = n;          /* no more factors, skip to end */
+        }
+        n /= p;
+        *facbuf++ = p;
+        *facbuf++ = n;
+    } while (n > 1);
+}
+
+/*
+ *
+ * User-callable function to allocate all necessary storage space for the fft.
+ *
+ * The return value is a contiguous block of memory, allocated with malloc.  As such,
+ * It can be freed with free(), rather than a kiss_fft-specific function.
+ * */
+kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem )
+{
+    kiss_fft_cfg st=NULL;
+    size_t memneeded = sizeof(struct kiss_fft_state)
+        + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/
+
+    if ( lenmem==NULL ) {
+        st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded );
+    }else{
+        if (mem != NULL && *lenmem >= memneeded)
+            st = (kiss_fft_cfg)mem;
+        *lenmem = memneeded;
+    }
+    if (st) {
+        int i;
+        st->nfft=nfft;
+        st->inverse = inverse_fft;
+
+        for (i=0;i<nfft;++i) {
+            const double pi=3.141592653589793238462643383279502884197169399375105820974944;
+            double phase = -2*pi*i / nfft;
+            if (st->inverse)
+                phase *= -1;
+            kf_cexp(st->twiddles+i, phase );
+        }
+
+        kf_factor(nfft,st->factors);
+    }
+    return st;
+}
+
+
+void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride)
+{
+    if (fin == fout) {
+        //NOTE: this is not really an in-place FFT algorithm.
+        //It just performs an out-of-place FFT into a temp buffer
+        kiss_fft_cpx * tmpbuf = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC( sizeof(kiss_fft_cpx)*st->nfft);
+        kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
+        memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft);
+        KISS_FFT_TMP_FREE(tmpbuf);
+    }else{
+        kf_work( fout, fin, 1,in_stride, st->factors,st );
+    }
+}
+
+void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout)
+{
+    kiss_fft_stride(cfg,fin,fout,1);
+}
+
+
+void kiss_fft_cleanup(void)
+{
+    // nothing needed any more
+}
+
+int kiss_fft_next_fast_size(int n)
+{
+    while(1) {
+        int m=n;
+        while ( (m%2) == 0 ) m/=2;
+        while ( (m%3) == 0 ) m/=3;
+        while ( (m%5) == 0 ) m/=5;
+        if (m<=1)
+            break; /* n is completely factorable by twos, threes, and fives */
+        n++;
+    }
+    return n;
+}
diff --git a/codec2/tags/0.4/src/kiss_fft.h b/codec2/tags/0.4/src/kiss_fft.h
new file mode 100644 (file)
index 0000000..64c50f4
--- /dev/null
@@ -0,0 +1,124 @@
+#ifndef KISS_FFT_H
+#define KISS_FFT_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ ATTENTION!
+ If you would like a :
+ -- a utility that will handle the caching of fft objects
+ -- real-only (no imaginary time component ) FFT
+ -- a multi-dimensional FFT
+ -- a command-line utility to perform ffts
+ -- a command-line utility to perform fast-convolution filtering
+
+ Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
+  in the tools/ directory.
+*/
+
+#ifdef USE_SIMD
+# include <xmmintrin.h>
+# define kiss_fft_scalar __m128
+#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16)
+#define KISS_FFT_FREE _mm_free
+#else  
+#define KISS_FFT_MALLOC malloc
+#define KISS_FFT_FREE free
+#endif 
+
+
+#ifdef FIXED_POINT
+#include <sys/types.h> 
+# if (FIXED_POINT == 32)
+#  define kiss_fft_scalar int32_t
+# else 
+#  define kiss_fft_scalar int16_t
+# endif
+#else
+# ifndef kiss_fft_scalar
+/*  default is float */
+#   define kiss_fft_scalar float
+# endif
+#endif
+
+typedef struct {
+    kiss_fft_scalar r;
+    kiss_fft_scalar i;
+}kiss_fft_cpx;
+
+typedef struct kiss_fft_state* kiss_fft_cfg;
+
+/* 
+ *  kiss_fft_alloc
+ *  
+ *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
+ *
+ *  typical usage:      kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
+ *
+ *  The return value from fft_alloc is a cfg buffer used internally
+ *  by the fft routine or NULL.
+ *
+ *  If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
+ *  The returned value should be free()d when done to avoid memory leaks.
+ *  
+ *  The state can be placed in a user supplied buffer 'mem':
+ *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
+ *      then the function places the cfg in mem and the size used in *lenmem
+ *      and returns mem.
+ *  
+ *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
+ *      then the function returns NULL and places the minimum cfg 
+ *      buffer size in *lenmem.
+ * */
+
+kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
+
+/*
+ * kiss_fft(cfg,in_out_buf)
+ *
+ * Perform an FFT on a complex input buffer.
+ * for a forward FFT,
+ * fin should be  f[0] , f[1] , ... ,f[nfft-1]
+ * fout will be   F[0] , F[1] , ... ,F[nfft-1]
+ * Note that each element is complex and can be accessed like
+    f[k].r and f[k].i
+ * */
+void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
+
+/*
+ A more generic version of the above function. It reads its input from every Nth sample.
+ * */
+void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
+
+/* If kiss_fft_alloc allocated a buffer, it is one contiguous 
+   buffer and can be simply free()d when no longer needed*/
+#define kiss_fft_free free
+
+/*
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
+ your compiler output to call this before you exit.
+*/
+void kiss_fft_cleanup(void);
+       
+
+/*
+ * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
+ */
+int kiss_fft_next_fast_size(int n);
+
+/* for real ffts, we need an even size */
+#define kiss_fftr_next_fast_size_real(n) \
+        (kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif
diff --git a/codec2/tags/0.4/src/linreg.c b/codec2/tags/0.4/src/linreg.c
new file mode 100644 (file)
index 0000000..e91a69c
--- /dev/null
@@ -0,0 +1,106 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: linreg.c
+  AUTHOR......: David Rowe
+  DATE CREATED: April 2015
+
+  Linear regression C module based on:
+
+    http://stackoverflow.com/questions/5083465/fast-efficient-least-squares-fit-algorithm-in-c
+
+  Use:
+
+    $ gcc linreg.c -o linreg -D__UNITTEST__ -Wall
+    $ ./linreg
+
+    Then compare yfit results with octave/tlinreg.m
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "linreg.h"
+#include "comp_prim.h"
+
+
+void linreg(COMP *m, COMP *b, float x[], COMP y[], int n)
+{
+    float  sumx  = 0.0;         /* sum of x          */
+    float  sumx2 = 0.0;         /* sum of x^2        */
+    COMP   sumxy = {0.0,0.0};   /* sum of x * y      */
+    COMP   sumy  = {0.0,0.0};   /* sum of y          */
+    COMP   sumy2 = {0.0,0.0};   /* sum of y**2       */
+    float  denom;
+    COMP   zero;
+    int    i;
+
+    for (i=0; i<n; i++) {   
+        sumx  += x[i];       
+        sumx2 += x[i]*x[i];  
+        sumxy = cadd(sumxy, fcmult(x[i], y[i]));
+        sumy  = cadd(sumy, y[i]);      
+        sumy2 = cadd(sumy2, cmult(y[i],y[i])); 
+    }
+
+  denom = (n * sumx2 - sumx*sumx);
+
+  if (denom == 0) {
+      /* singular matrix. can't solve the problem */
+      zero.real = 0.0; zero.imag = 0.0;
+      *m = zero;
+      *b = zero;
+  } else {
+      *m = fcmult(1.0/denom, cadd(fcmult(n, sumxy), cneg(fcmult(sumx,sumy))));
+      *b = fcmult(1.0/denom, cadd(fcmult(sumx2,sumy), cneg(fcmult(sumx, sumxy))));
+  }
+}
+
+
+#ifdef __UNITTEST__
+
+
+static float x[] = {1, 2, 7, 8};
+
+static COMP  y[] = {
+  {-0.70702,  0.70708},
+  {-0.77314,  0.63442},
+  {-0.98083,  0.19511},
+  {-0.99508,  0.09799}
+};
+
+
+int main(void) {
+    float  x1;
+    COMP   m,b,yfit;
+  
+    linreg(&m, &b, x, y, sizeof(x)/sizeof(float));
+
+    for (x1=1; x1<=8; x1++) {
+        yfit = cadd(fcmult(x1, m),b);
+        printf("%f %f\n", yfit.real, yfit.imag); 
+    }
+
+    return 0;
+}
+
+#endif
+
diff --git a/codec2/tags/0.4/src/linreg.h b/codec2/tags/0.4/src/linreg.h
new file mode 100644 (file)
index 0000000..c86dfad
--- /dev/null
@@ -0,0 +1,35 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: linreg.h
+  AUTHOR......: David Rowe
+  DATE CREATED: April 2015
+
+  Linear regression C module based
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __LINREG__
+#define __LINREG__
+
+#include "comp.h"
+
+void linreg(COMP *m, COMP *b, float x[], COMP y[], int n);
+
+#endif
diff --git a/codec2/tags/0.4/src/listensim.sh b/codec2/tags/0.4/src/listensim.sh
new file mode 100755 (executable)
index 0000000..b296cac
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+# listensim.sh
+# David Rowe 10 Sep 2009
+#
+# Listen to files processed with sim.sh
+
+../script/menu.sh $1_uq.raw $1_lpc10.raw $1_lpcpf.raw $1_phase0.raw $1_phase0_lpcpf.raw $2 $3 $4 $5
+
+
diff --git a/codec2/tags/0.4/src/lpc.c b/codec2/tags/0.4/src/lpc.c
new file mode 100644 (file)
index 0000000..4622dc3
--- /dev/null
@@ -0,0 +1,306 @@
+/*---------------------------------------------------------------------------*\
+                                                                           
+  FILE........: lpc.c                                                              
+  AUTHOR......: David Rowe                                                      
+  DATE CREATED: 30 Sep 1990 (!)                                                 
+                                                                          
+  Linear Prediction functions written in C.                                
+                                                                          
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009-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/>.
+*/
+
+#define LPC_MAX_N 512          /* maximum no. of samples in frame */
+#define PI 3.141592654         /* mathematical constant */
+
+#define ALPHA 1.0
+#define BETA  0.94
+
+#include <assert.h>
+#include <math.h>
+#include "defines.h"
+#include "lpc.h"
+
+/*---------------------------------------------------------------------------*\
+                                                                         
+  pre_emp()                                                        
+                                                                         
+  Pre-emphasise (high pass filter with zero close to 0 Hz) a frame of
+  speech samples.  Helps reduce dynamic range of LPC spectrum, giving
+  greater weight and hensea better match to low energy formants.  
+
+  Should be balanced by de-emphasis of the output speech.
+                                                                           
+\*---------------------------------------------------------------------------*/
+
+void pre_emp(
+  float  Sn_pre[], /* output frame of speech samples                     */
+  float  Sn[],    /* input frame of speech samples                      */
+  float *mem,      /* Sn[-1]single sample memory                         */
+  int   Nsam      /* number of speech samples to use                    */
+)
+{
+    int   i;
+
+    for(i=0; i<Nsam; i++) {
+       Sn_pre[i] = Sn[i] - ALPHA * mem[0];
+       mem[0] = Sn[i];
+    }
+
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                                         
+  de_emp()                                                        
+                                                                         
+  De-emphasis filter (low pass filter with polse close to 0 Hz).
+                                                                           
+\*---------------------------------------------------------------------------*/
+
+void de_emp(
+  float  Sn_de[],  /* output frame of speech samples                     */
+  float  Sn[],    /* input frame of speech samples                      */
+  float *mem,      /* Sn[-1]single sample memory                         */
+  int    Nsam     /* number of speech samples to use                    */
+)
+{
+    int   i;
+
+    for(i=0; i<Nsam; i++) {
+       Sn_de[i] = Sn[i] + BETA * mem[0];
+       mem[0] = Sn_de[i];
+    }
+
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                                         
+  hanning_window()                                                        
+                                                                         
+  Hanning windows a frame of speech samples.                              
+                                                                           
+\*---------------------------------------------------------------------------*/
+
+void hanning_window(
+  float Sn[],  /* input frame of speech samples */
+  float Wn[],  /* output frame of windowed samples */
+  int Nsam     /* number of samples */
+)
+{
+  int i;       /* loop variable */
+
+  for(i=0; i<Nsam; i++)
+    Wn[i] = Sn[i]*(0.5 - 0.5*cosf(2*PI*(float)i/(Nsam-1)));
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                           
+  autocorrelate()                                                          
+                                                                          
+  Finds the first P autocorrelation values of an array of windowed speech 
+  samples Sn[].                                                            
+                                                                          
+\*---------------------------------------------------------------------------*/
+
+void autocorrelate(
+  float Sn[],  /* frame of Nsam windowed speech samples */
+  float Rn[],  /* array of P+1 autocorrelation coefficients */
+  int Nsam,    /* number of windowed samples to use */
+  int order    /* order of LPC analysis */
+)
+{
+  int i,j;     /* loop variables */
+
+  for(j=0; j<order+1; j++) {
+    Rn[j] = 0.0;
+    for(i=0; i<Nsam-j; i++)
+      Rn[j] += Sn[i]*Sn[i+j];
+  }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                            
+  levinson_durbin()                                                        
+                                                                           
+  Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff. 
+  (LPCs) where P is the order of the LPC all-pole model. The Levinson-Durbin
+  algorithm is used, and is described in:                                   
+                                                                           
+    J. Makhoul                                                               
+    "Linear prediction, a tutorial review"                                   
+    Proceedings of the IEEE                                                
+    Vol-63, No. 4, April 1975                                               
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void levinson_durbin(
+  float R[],           /* order+1 autocorrelation coeff */
+  float lpcs[],                /* order+1 LPC's */
+  int order            /* order of the LPC analysis */
+)
+{
+  float a[order+1][order+1];
+  float sum, e, k;
+  int i,j;                             /* loop variables */
+
+  e = R[0];                            /* Equation 38a, Makhoul */
+
+  for(i=1; i<=order; i++) {
+    sum = 0.0;
+    for(j=1; j<=i-1; j++)
+      sum += a[i-1][j]*R[i-j];
+    k = -1.0*(R[i] + sum)/e;           /* Equation 38b, Makhoul */
+    if (fabsf(k) > 1.0)
+      k = 0.0;
+
+    a[i][i] = k;
+
+    for(j=1; j<=i-1; j++)
+      a[i][j] = a[i-1][j] + k*a[i-1][i-j];     /* Equation 38c, Makhoul */
+
+    e *= (1-k*k);                              /* Equation 38d, Makhoul */
+  }
+
+  for(i=1; i<=order; i++)
+    lpcs[i] = a[order][i];
+  lpcs[0] = 1.0;  
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  inverse_filter()                                                          
+                                                                           
+  Inverse Filter, A(z).  Produces an array of residual samples from an array
+  of input samples and linear prediction coefficients.                      
+                                                                             
+  The filter memory is stored in the first order samples of the input array.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void inverse_filter(
+  float Sn[],  /* Nsam input samples */
+  float a[],   /* LPCs for this frame of samples */
+  int Nsam,    /* number of samples */
+  float res[], /* Nsam residual samples */
+  int order    /* order of LPC */
+)
+{
+  int i,j;     /* loop variables */
+
+  for(i=0; i<Nsam; i++) {
+    res[i] = 0.0;
+    for(j=0; j<=order; j++)
+      res[i] += Sn[i-j]*a[j];
+  }    
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                            
+ synthesis_filter()                                                        
+                                                                           
+ C version of the Speech Synthesis Filter, 1/A(z).  Given an array of   
+ residual or excitation samples, and the the LP filter coefficients, this
+ function will produce an array of speech samples.  This filter structure is
+ IIR.                                                                       
+                                                                           
+ The synthesis filter has memory as well, this is treated in the same way 
+ as the memory for the inverse filter (see inverse_filter() notes above). 
+ The difference is that the memory for the synthesis filter is stored in  
+ the output array, wheras the memory of the inverse filter is stored in the
+ input array.                                                              
+                                                                           
+ Note: the calling function must update the filter memory.                
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void synthesis_filter(
+  float res[], /* Nsam input residual (excitation) samples */
+  float a[],   /* LPCs for this frame of speech samples */
+  int Nsam,    /* number of speech samples */
+  int order,   /* LPC order */
+  float Sn_[]  /* Nsam output synthesised speech samples */
+)
+{
+  int i,j;     /* loop variables */
+
+  /* Filter Nsam samples */
+
+  for(i=0; i<Nsam; i++) {
+    Sn_[i] = res[i]*a[0];
+    for(j=1; j<=order; j++)
+      Sn_[i] -= Sn_[i-j]*a[j];
+  }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                            
+  find_aks()                                                                 
+                                                                            
+  This function takes a frame of samples, and determines the linear           
+  prediction coefficients for that frame of samples.                         
+                                                                            
+\*---------------------------------------------------------------------------*/
+
+void find_aks(
+  float Sn[],  /* Nsam samples with order sample memory */
+  float a[],   /* order+1 LPCs with first coeff 1.0 */
+  int Nsam,    /* number of input speech samples */
+  int order,   /* order of the LPC analysis */
+  float *E     /* residual energy */
+)
+{
+  float Wn[LPC_MAX_N]; /* windowed frame of Nsam speech samples */
+  float R[order+1];    /* order+1 autocorrelation values of Sn[] */
+  int i;
+
+  assert(Nsam < LPC_MAX_N);
+
+  hanning_window(Sn,Wn,Nsam);
+  autocorrelate(Wn,R,Nsam,order);
+  levinson_durbin(R,a,order);
+
+  *E = 0.0;
+  for(i=0; i<=order; i++)
+    *E += a[i]*R[i];
+  if (*E < 0.0)
+    *E = 1E-12;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                            
+  weight()                                                                  
+                                                                          
+  Weights a vector of LPCs.                                               
+                                                                          
+\*---------------------------------------------------------------------------*/
+
+void weight(
+  float ak[],  /* vector of order+1 LPCs */
+  float gamma, /* weighting factor */
+  int order,   /* num LPCs (excluding leading 1.0) */
+  float akw[]  /* weighted vector of order+1 LPCs */
+)
+{
+  int i;
+  
+  for(i=1; i<=order; i++)
+    akw[i] = ak[i]*powf(gamma,(float)i);
+}
+    
diff --git a/codec2/tags/0.4/src/lpc.h b/codec2/tags/0.4/src/lpc.h
new file mode 100644 (file)
index 0000000..d5385bd
--- /dev/null
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------------*\
+                                                                           
+  FILE........: lpc.h                                                            
+  AUTHOR......: David Rowe                                                      
+  DATE CREATED: 24/8/09                                                   
+                                                                          
+  Linear Prediction functions written in C.                                
+                                                                          
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009-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 __LPC__
+#define __LPC__
+
+#define LPC_MAX_ORDER 20
+
+void pre_emp(float Sn_pre[], float Sn[], float *mem, int Nsam);
+void de_emp(float Sn_se[], float Sn[], float *mem, int Nsam);
+void hanning_window(float Sn[],        float Wn[], int Nsam);
+void autocorrelate(float Sn[], float Rn[], int Nsam, int order);
+void levinson_durbin(float R[],        float lpcs[], int order);
+void inverse_filter(float Sn[], float a[], int Nsam, float res[], int order);
+void synthesis_filter(float res[], float a[], int Nsam,        int order, float Sn_[]);
+void find_aks(float Sn[], float a[], int Nsam, int order, float *E);
+void weight(float ak[],        float gamma, int order, float akw[]);
+
+#endif
diff --git a/codec2/tags/0.4/src/lsp.c b/codec2/tags/0.4/src/lsp.c
new file mode 100644 (file)
index 0000000..192fbbd
--- /dev/null
@@ -0,0 +1,321 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: lsp.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 24/2/93
+
+
+  This file contains functions for LPC to LSP conversion and LSP to
+  LPC conversion. Note that the LSP coefficients are not in radians
+  format but in the x domain of the unit circle.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 "lsp.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/*---------------------------------------------------------------------------*\
+
+  Introduction to Line Spectrum Pairs (LSPs)
+  ------------------------------------------
+
+  LSPs are used to encode the LPC filter coefficients {ak} for
+  transmission over the channel.  LSPs have several properties (like
+  less sensitivity to quantisation noise) that make them superior to
+  direct quantisation of {ak}.
+
+  A(z) is a polynomial of order lpcrdr with {ak} as the coefficients.
+
+  A(z) is transformed to P(z) and Q(z) (using a substitution and some
+  algebra), to obtain something like:
+
+    A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)]  (1)
+
+  As you can imagine A(z) has complex zeros all over the z-plane. P(z)
+  and Q(z) have the very neat property of only having zeros _on_ the
+  unit circle.  So to find them we take a test point z=exp(jw) and
+  evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0
+  and pi.
+
+  The zeros (roots) of P(z) also happen to alternate, which is why we
+  swap coefficients as we find roots.  So the process of finding the
+  LSP frequencies is basically finding the roots of 5th order
+  polynomials.
+
+  The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence
+  the name Line Spectrum Pairs (LSPs).
+
+  To convert back to ak we just evaluate (1), "clocking" an impulse
+  thru it lpcrdr times gives us the impulse response of A(z) which is
+  {ak}.
+
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: cheb_poly_eva()
+  AUTHOR......: David Rowe
+  DATE CREATED: 24/2/93
+
+  This function evalutes a series of chebyshev polynomials
+
+  FIXME: performing memory allocation at run time is very inefficient,
+  replace with stack variables of MAX_P size.
+
+\*---------------------------------------------------------------------------*/
+
+
+static float
+cheb_poly_eva(float *coef,float x,int order)
+/*  float coef[]       coefficients of the polynomial to be evaluated  */
+/*  float x            the point where polynomial is to be evaluated   */
+/*  int order          order of the polynomial                         */
+{
+    int i;
+    float *t,*u,*v,sum;
+    float T[(order / 2) + 1];
+
+    /* Initialise pointers */
+
+    t = T;                             /* T[i-2]                       */
+    *t++ = 1.0;
+    u = t--;                           /* T[i-1]                       */
+    *u++ = x;
+    v = u--;                           /* T[i]                         */
+
+    /* Evaluate chebyshev series formulation using iterative approach  */
+
+    for(i=2;i<=order/2;i++)
+       *v++ = (2*x)*(*u++) - *t++;     /* T[i] = 2*x*T[i-1] - T[i-2]   */
+
+    sum=0.0;                           /* initialise sum to zero       */
+    t = T;                             /* reset pointer                */
+
+    /* Evaluate polynomial and return value also free memory space */
+
+    for(i=0;i<=order/2;i++)
+       sum+=coef[(order/2)-i]**t++;
+
+    return sum;
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: lpc_to_lsp()
+  AUTHOR......: David Rowe
+  DATE CREATED: 24/2/93
+
+  This function converts LPC coefficients to LSP coefficients.
+
+\*---------------------------------------------------------------------------*/
+
+int lpc_to_lsp (float *a, int order, float *freq, int nb, float delta)
+/*  float *a                   lpc coefficients                        */
+/*  int order                  order of LPC coefficients (10)          */
+/*  float *freq                LSP frequencies in radians              */
+/*  int nb                     number of sub-intervals (4)             */
+/*  float delta                        grid spacing interval (0.02)            */
+{
+    float psuml,psumr,psumm,temp_xr,xl,xr,xm = 0;
+    float temp_psumr;
+    int i,j,m,flag,k;
+    float *px;                 /* ptrs of respective P'(z) & Q'(z)     */
+    float *qx;
+    float *p;
+    float *q;
+    float *pt;                 /* ptr used for cheb_poly_eval()
+                                  whether P' or Q'                     */
+    int roots=0;               /* number of roots found                */
+    float Q[order + 1];
+    float P[order + 1];
+
+    flag = 1;                  
+    m = order/2;               /* order of P'(z) & Q'(z) polynimials   */
+
+    /* Allocate memory space for polynomials */
+
+    /* determine P'(z)'s and Q'(z)'s coefficients where
+      P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */
+
+    px = P;                      /* initilaise ptrs */
+    qx = Q;
+    p = px;
+    q = qx;
+    *px++ = 1.0;
+    *qx++ = 1.0;
+    for(i=1;i<=m;i++){
+       *px++ = a[i]+a[order+1-i]-*p++;
+       *qx++ = a[i]-a[order+1-i]+*q++;
+    }
+    px = P;
+    qx = Q;
+    for(i=0;i<m;i++){
+       *px = 2**px;
+       *qx = 2**qx;
+        px++;
+        qx++;
+    }
+    px = P;                    /* re-initialise ptrs                   */
+    qx = Q;
+
+    /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z).
+    Keep alternating between the two polynomials as each zero is found         */
+
+    xr = 0;                    /* initialise xr to zero                */
+    xl = 1.0;                  /* start at point xl = 1                */
+
+
+    for(j=0;j<order;j++){
+       if(j%2)                 /* determines whether P' or Q' is eval. */
+           pt = qx;
+       else
+           pt = px;
+
+       psuml = cheb_poly_eva(pt,xl,order);     /* evals poly. at xl    */
+       flag = 1;
+       while(flag && (xr >= -1.0)){
+           xr = xl - delta ;                   /* interval spacing     */
+           psumr = cheb_poly_eva(pt,xr,order);/* poly(xl-delta_x)      */
+           temp_psumr = psumr;
+           temp_xr = xr;
+
+        /* if no sign change increment xr and re-evaluate
+           poly(xr). Repeat til sign change.  if a sign change has
+           occurred the interval is bisected and then checked again
+           for a sign change which determines in which interval the
+           zero lies in.  If there is no sign change between poly(xm)
+           and poly(xl) set interval between xm and xr else set
+           interval between xl and xr and repeat till root is located
+           within the specified limits  */
+
+           if(((psumr*psuml)<0.0) || (psumr == 0.0)){
+               roots++;
+
+               psumm=psuml;
+               for(k=0;k<=nb;k++){
+                   xm = (xl+xr)/2;             /* bisect the interval  */
+                   psumm=cheb_poly_eva(pt,xm,order);
+                   if(psumm*psuml>0.){
+                       psuml=psumm;
+                       xl=xm;
+                   }
+                   else{
+                       psumr=psumm;
+                       xr=xm;
+                   }
+               }
+
+              /* once zero is found, reset initial interval to xr      */
+              freq[j] = (xm);
+              xl = xm;
+              flag = 0;                /* reset flag for next search   */
+           }
+           else{
+               psuml=temp_psumr;
+               xl=temp_xr;
+           }
+       }
+    }
+
+    /* convert from x domain to radians */
+
+    for(i=0; i<order; i++) {
+       freq[i] = acosf(freq[i]);
+    }
+
+    return(roots);
+}
+
+/*---------------------------------------------------------------------------*\
+
+  FUNCTION....: lsp_to_lpc()
+  AUTHOR......: David Rowe
+  DATE CREATED: 24/2/93
+
+  This function converts LSP coefficients to LPC coefficients.  In the
+  Speex code we worked out a way to simplify this significantly.
+
+\*---------------------------------------------------------------------------*/
+
+void lsp_to_lpc(float *lsp, float *ak, int order)
+/*  float *freq         array of LSP frequencies in radians            */
+/*  float *ak          array of LPC coefficients                       */
+/*  int order          order of LPC coefficients                       */
+
+
+{
+    int i,j;
+    float xout1,xout2,xin1,xin2;
+    float *pw,*n1,*n2,*n3,*n4 = 0;
+    float freq[order];
+    float Wp[(order * 4) + 2];
+    
+    /* convert from radians to the x=cos(w) domain */
+
+    for(i=0; i<order; i++)
+       freq[i] = cosf(lsp[i]);
+
+    pw = Wp;
+
+    /* initialise contents of array */
+
+    for(i=0;i<=4*(order/2)+1;i++){             /* set contents of buffer to 0 */
+       *pw++ = 0.0;
+    }
+
+    /* Set pointers up */
+
+    pw = Wp;
+    xin1 = 1.0;
+    xin2 = 1.0;
+
+    /* reconstruct P(z) and Q(z) by cascading second order polynomials
+      in form 1 - 2xz(-1) +z(-2), where x is the LSP coefficient */
+
+    for(j=0;j<=order;j++){
+       for(i=0;i<(order/2);i++){
+           n1 = pw+(i*4);
+           n2 = n1 + 1;
+           n3 = n2 + 1;
+           n4 = n3 + 1;
+           xout1 = xin1 - 2*(freq[2*i]) * *n1 + *n2;
+           xout2 = xin2 - 2*(freq[2*i+1]) * *n3 + *n4;
+           *n2 = *n1;
+           *n4 = *n3;
+           *n1 = xin1;
+           *n3 = xin2;
+           xin1 = xout1;
+           xin2 = xout2;
+       }
+       xout1 = xin1 + *(n4+1);
+       xout2 = xin2 - *(n4+2);
+       ak[j] = (xout1 + xout2)*0.5;
+       *(n4+1) = xin1;
+       *(n4+2) = xin2;
+
+       xin1 = 0.0;
+       xin2 = 0.0;
+    }
+}
+
diff --git a/codec2/tags/0.4/src/lsp.h b/codec2/tags/0.4/src/lsp.h
new file mode 100644 (file)
index 0000000..5acef01
--- /dev/null
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: lsp.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 24/2/93
+
+
+  This file contains functions for LPC to LSP conversion and LSP to
+  LPC conversion. Note that the LSP coefficients are not in radians
+  format but in the x domain of the unit circle.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __LSP__
+#define __LSP__
+
+int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta);
+void lsp_to_lpc(float *freq, float *ak, int lpcrdr);
+
+#endif
diff --git a/codec2/tags/0.4/src/machdep.h b/codec2/tags/0.4/src/machdep.h
new file mode 100644 (file)
index 0000000..4dff9ba
--- /dev/null
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: machdep.h
+  AUTHOR......: David Rowe
+  DATE CREATED: May 2 2013
+
+  Machine dependant functions, e.g. profiling that requires access to a clock
+  counter register.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 __MACHDEP__
+#define __MACHDEP__
+
+#ifdef PROFILE
+#define PROFILE_VAR(...) unsigned int __VA_ARGS__
+#define PROFILE_SAMPLE(timestamp) timestamp = machdep_profile_sample()
+#define PROFILE_SAMPLE_AND_LOG(timestamp, prev_timestamp, label) \
+    timestamp = machdep_profile_sample_and_log(prev_timestamp, label)
+#define PROFILE_SAMPLE_AND_LOG2(prev_timestamp, label) \
+    machdep_profile_sample_and_log(prev_timestamp, label)
+#else
+#define PROFILE_VAR(...)
+#define PROFILE_SAMPLE(timestamp)
+#define PROFILE_SAMPLE_AND_LOG(timestamp, prev_timestamp, label)
+#define PROFILE_SAMPLE_AND_LOG2(prev_timestamp, label)
+#endif
+
+void         machdep_profile_init(void);
+void         machdep_profile_reset(void);
+unsigned int machdep_profile_sample(void);
+unsigned int machdep_profile_sample_and_log(unsigned int start, char s[]);
+void         machdep_profile_print_logged_samples(void);
+
+#endif
diff --git a/codec2/tags/0.4/src/modem_stats.c b/codec2/tags/0.4/src/modem_stats.c
new file mode 100644 (file)
index 0000000..d13b1a0
--- /dev/null
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: modem_stats.c
+  AUTHOR......: David Rowe
+  DATE CREATED: June 2015
+                                                                             
+  Common functions for returning demod stats from fdmdv and cohpsk modems.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 <assert.h>
+#include <math.h>
+#include "modem_stats.h"
+#include "codec2_fdmdv.h"
+
+void modem_stats_open(struct MODEM_STATS *f) 
+{
+    int i;
+
+    for(i=0; i<2*MODEM_STATS_NSPEC; i++)
+       f->fft_buf[i] = 0.0;
+    f->fft_cfg = kiss_fft_alloc (2*MODEM_STATS_NSPEC, 0, NULL, NULL);
+    assert(f->fft_cfg != NULL);
+}
+
+void modem_stats_close(struct MODEM_STATS *f) 
+{
+    KISS_FFT_FREE(f->fft_cfg);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: modem_stats_get_rx_spectrum()       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 9 June 2012
+
+  Returns the MODEM_STATS_NSPEC point magnitude spectrum of the rx signal in
+  dB. The spectral samples are scaled so that 0dB is the peak, a good
+  range for plotting is 0 to -40dB.
+
+  Note only the real part of the complex input signal is used at
+  present.  A complex variable is used for input for compatability
+  with the other rx signal procesing.
+
+  Successive calls can be used to build up a waterfall or spectrogram
+  plot, by mapping the received levels to colours.
+
+  The time-frequency resolution of the spectrum can be adjusted by varying
+  MODEM_STATS_NSPEC.  Note that a 2* MODEM_STATS_NSPEC size FFT is reqd to get
+  MODEM_STATS_NSPEC output points.  MODEM_STATS_NSPEC must be a power of 2.
+
+  See octave/tget_spec.m for a demo real time spectral display using
+  Octave. This demo averages the output over time to get a smoother
+  display:
+
+     av = 0.9*av + 0.1*mag_dB
+
+\*---------------------------------------------------------------------------*/
+
+void modem_stats_get_rx_spectrum(struct MODEM_STATS *f, float mag_spec_dB[], COMP rx_fdm[], int nin) 
+{
+    int   i,j;
+    COMP  fft_in[2*MODEM_STATS_NSPEC];
+    COMP  fft_out[2*MODEM_STATS_NSPEC];
+    float full_scale_dB;
+
+    /* update buffer of input samples */
+
+    for(i=0; i<2*MODEM_STATS_NSPEC-nin; i++)
+       f->fft_buf[i] = f->fft_buf[i+nin];
+    for(j=0; j<nin; j++,i++)
+       f->fft_buf[i] = rx_fdm[j].real;
+    assert(i == 2*MODEM_STATS_NSPEC);
+
+    /* window and FFT */
+
+    for(i=0; i<2*MODEM_STATS_NSPEC; i++) {
+       fft_in[i].real = f->fft_buf[i] * (0.5 - 0.5*cosf((float)i*2.0*M_PI/(2*MODEM_STATS_NSPEC)));
+       fft_in[i].imag = 0.0;
+    }
+
+    kiss_fft(f->fft_cfg, (kiss_fft_cpx *)fft_in, (kiss_fft_cpx *)fft_out);
+
+    /* FFT scales up a signal of level 1 FDMDV_NSPEC */
+
+    full_scale_dB = 20*log10(MODEM_STATS_NSPEC*FDMDV_SCALE);
+
+    /* scale and convert to dB */
+
+    for(i=0; i<MODEM_STATS_NSPEC; i++) {
+       mag_spec_dB[i]  = 10.0*log10f(fft_out[i].real*fft_out[i].real + fft_out[i].imag*fft_out[i].imag + 1E-12);
+       mag_spec_dB[i] -= full_scale_dB;
+    }
+}
diff --git a/codec2/tags/0.4/src/modem_stats.h b/codec2/tags/0.4/src/modem_stats.h
new file mode 100644 (file)
index 0000000..99dc637
--- /dev/null
@@ -0,0 +1,68 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: modem_stats.h
+  AUTHOR......: David Rowe
+  DATE CREATED: June 2015
+                                                                             
+  Common structure for returning demod stats from fdmdv and cohpsk modems.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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/>.
+*/
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+#ifndef __MODEM_STATS__
+#define __MODEM_STATS__
+
+#include "comp.h"
+#include "kiss_fft.h"
+
+#define MODEM_STATS_NC_MAX 20
+#define MODEM_STATS_NR_MAX 6
+#define MODEM_STATS_NSPEC            512
+#define MODEM_STATS_MAX_F_HZ         4000
+
+struct MODEM_STATS {
+    int    Nc;
+    float  snr_est;                          /* estimated SNR of rx signal in dB (3 kHz noise BW)  */
+    COMP   rx_symbols[MODEM_STATS_NR_MAX][MODEM_STATS_NC_MAX+1]; 
+                                             /* latest received symbols, for scatter plot          */ 
+    int    nr;                               /* number of rows in rx_symbols                       */
+    int    sync;                             /* demod sync state                                   */ 
+    float  foff;                             /* estimated freq offset in Hz                        */       
+    float  rx_timing;                        /* estimated optimum timing offset in samples         */
+    float  clock_offset;                     /* Estimated tx/rx sample clock offset in ppm         */
+
+    /* Buf for FFT/waterfall */
+
+    float        fft_buf[2*MODEM_STATS_NSPEC];
+    kiss_fft_cfg fft_cfg;  
+};
+
+void modem_stats_open(struct MODEM_STATS *f);
+void modem_stats_close(struct MODEM_STATS *f); 
+void modem_stats_get_rx_spectrum(struct MODEM_STATS *f, float mag_spec_dB[], COMP rx_fdm[], int nin);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/codec2/tags/0.4/src/nlp.c b/codec2/tags/0.4/src/nlp.c
new file mode 100644 (file)
index 0000000..4ff11c1
--- /dev/null
@@ -0,0 +1,589 @@
+/*---------------------------------------------------------------------------*\
+                                                 
+  FILE........: nlp.c                                                   
+  AUTHOR......: David Rowe                                      
+  DATE CREATED: 23/3/93                                    
+                                                         
+  Non Linear Pitch (NLP) estimation functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 "nlp.h"
+#include "dump.h"
+#include "kiss_fft.h"
+#undef PROFILE
+#include "machdep.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               DEFINES                                       
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+#define PMAX_M      600                /* maximum NLP analysis window size     */
+#define COEFF       0.95       /* notch filter parameter               */
+#define PE_FFT_SIZE 512                /* DFT size for pitch estimation        */
+#define DEC         5          /* decimation factor                    */
+#define SAMPLE_RATE 8000
+#define PI          3.141592654        /* mathematical constant                */
+#define T           0.1         /* threshold for local minima candidate */
+#define F0_MAX      500
+#define CNLP        0.3                /* post processor constant              */
+#define NLP_NTAP 48            /* Decimation LPF order */
+
+//#undef DUMP
+
+/*---------------------------------------------------------------------------*\
+                                                                            
+                               GLOBALS                                       
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/* 48 tap 600Hz low pass FIR filter coefficients */
+
+const float nlp_fir[] = {
+  -1.0818124e-03,
+  -1.1008344e-03,
+  -9.2768838e-04,
+  -4.2289438e-04,
+   5.5034190e-04,
+   2.0029849e-03,
+   3.7058509e-03,
+   5.1449415e-03,
+   5.5924666e-03,
+   4.3036754e-03,
+   8.0284511e-04,
+  -4.8204610e-03,
+  -1.1705810e-02,
+  -1.8199275e-02,
+  -2.2065282e-02,
+  -2.0920610e-02,
+  -1.2808831e-02,
+   3.2204775e-03,
+   2.6683811e-02,
+   5.5520624e-02,
+   8.6305944e-02,
+   1.1480192e-01,
+   1.3674206e-01,
+   1.4867556e-01,
+   1.4867556e-01,
+   1.3674206e-01,
+   1.1480192e-01,
+   8.6305944e-02,
+   5.5520624e-02,
+   2.6683811e-02,
+   3.2204775e-03,
+  -1.2808831e-02,
+  -2.0920610e-02,
+  -2.2065282e-02,
+  -1.8199275e-02,
+  -1.1705810e-02,
+  -4.8204610e-03,
+   8.0284511e-04,
+   4.3036754e-03,
+   5.5924666e-03,
+   5.1449415e-03,
+   3.7058509e-03,
+   2.0029849e-03,
+   5.5034190e-04,
+  -4.2289438e-04,
+  -9.2768838e-04,
+  -1.1008344e-03,
+  -1.0818124e-03
+};
+
+typedef struct {
+    int           m;
+    float         w[PMAX_M/DEC];     /* DFT window                   */ 
+    float         sq[PMAX_M];       /* squared speech samples       */
+    float         mem_x,mem_y;       /* memory for notch filter      */
+    float         mem_fir[NLP_NTAP]; /* decimation FIR filter memory */
+    kiss_fft_cfg  fft_cfg;           /* kiss FFT config              */
+} NLP;
+
+float test_candidate_mbe(COMP Sw[], COMP W[], float f0);
+float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP Sw[], COMP W[], float *prev_Wo);
+float post_process_sub_multiples(COMP Fw[], 
+                                int pmin, int pmax, float gmax, int gmax_bin,
+                                float *prev_Wo);
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  nlp_create()                                                                  
+                                                                             
+  Initialisation function for NLP pitch estimator.
+
+\*---------------------------------------------------------------------------*/
+
+void *nlp_create(
+int    m                       /* analysis window size */
+)
+{
+    NLP *nlp;
+    int  i;
+
+    assert(m <= PMAX_M);
+
+    nlp = (NLP*)malloc(sizeof(NLP));
+    if (nlp == NULL)
+       return NULL;
+
+    nlp->m = m;
+    for(i=0; i<m/DEC; i++) {
+       nlp->w[i] = 0.5 - 0.5*cosf(2*PI*i/(m/DEC-1));
+    }
+
+    for(i=0; i<PMAX_M; i++)
+       nlp->sq[i] = 0.0;
+    nlp->mem_x = 0.0;
+    nlp->mem_y = 0.0;
+    for(i=0; i<NLP_NTAP; i++)
+       nlp->mem_fir[i] = 0.0;
+
+    nlp->fft_cfg = kiss_fft_alloc (PE_FFT_SIZE, 0, NULL, NULL);
+    assert(nlp->fft_cfg != NULL);
+
+    return (void*)nlp;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  nlp_destroy()
+                                                                             
+  Shut down function for NLP pitch estimator.
+
+\*---------------------------------------------------------------------------*/
+
+void nlp_destroy(void *nlp_state)
+{
+    NLP   *nlp;
+    assert(nlp_state != NULL);
+    nlp = (NLP*)nlp_state;
+
+    KISS_FFT_FREE(nlp->fft_cfg);
+    free(nlp_state);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  nlp()                                                                  
+                                                                             
+  Determines the pitch in samples using the Non Linear Pitch (NLP)
+  algorithm [1]. Returns the fundamental in Hz.  Note that the actual
+  pitch estimate is for the centre of the M sample Sn[] vector, not
+  the current N sample input vector.  This is (I think) a delay of 2.5
+  frames with N=80 samples.  You should align further analysis using
+  this pitch estimate to be centred on the middle of Sn[].
+
+  Two post processors have been tried, the MBE version (as discussed
+  in [1]), and a post processor that checks sub-multiples.  Both
+  suffer occasional gross pitch errors (i.e. neither are perfect).  In
+  the presence of background noise the sub-multiple algorithm tends
+  towards low F0 which leads to better sounding background noise than
+  the MBE post processor.
+
+  A good way to test and develop the NLP pitch estimator is using the
+  tnlp (codec2/unittest) and the codec2/octave/plnlp.m Octave script.
+
+  A pitch tracker searching a few frames forward and backward in time
+  would be a useful addition.
+
+  References:
+
+    [1] http://www.itr.unisa.edu.au/~steven/thesis/dgr.pdf Chapter 4
+                                                              
+\*---------------------------------------------------------------------------*/
+
+float nlp(
+  void *nlp_state, 
+  float  Sn[],                 /* input speech vector */
+  int    n,                    /* frames shift (no. new samples in Sn[]) */
+  int    pmin,                  /* minimum pitch value */
+  int    pmax,                 /* maximum pitch value */
+  float *pitch,                        /* estimated pitch period in samples */
+  COMP   Sw[],                  /* Freq domain version of Sn[] */
+  COMP   W[],                   /* Freq domain window */
+  float *prev_Wo
+)
+{
+    NLP   *nlp;
+    float  notch;                  /* current notch filter output    */
+    COMP   fw[PE_FFT_SIZE];        /* DFT of squared signal (input)  */
+    COMP   Fw[PE_FFT_SIZE];        /* DFT of squared signal (output) */
+    float  gmax;
+    int    gmax_bin;
+    int    m, i,j;
+    float  best_f0;
+    PROFILE_VAR(start, tnotch, filter, peakpick, window, fft, magsq, shiftmem);
+    
+    assert(nlp_state != NULL);
+    nlp = (NLP*)nlp_state;
+    m = nlp->m;
+
+    PROFILE_SAMPLE(start);
+
+    /* Square, notch filter at DC, and LP filter vector */
+
+    for(i=m-n; i<m; i++)           /* square latest speech samples */
+       nlp->sq[i] = Sn[i]*Sn[i];
+
+    for(i=m-n; i<m; i++) {     /* notch filter at DC */
+       notch = nlp->sq[i] - nlp->mem_x;
+       notch += COEFF*nlp->mem_y;
+       nlp->mem_x = nlp->sq[i];
+       nlp->mem_y = notch;
+       nlp->sq[i] = notch + 1.0;  /* With 0 input vectors to codec,
+                                     kiss_fft() would take a long
+                                     time to execute when running in
+                                     real time.  Problem was traced
+                                     to kiss_fft function call in
+                                     this function. Adding this small
+                                     constant fixed problem.  Not
+                                     exactly sure why. */
+    }
+
+    PROFILE_SAMPLE_AND_LOG(tnotch, start, "      square and notch");
+
+    for(i=m-n; i<m; i++) {     /* FIR filter vector */
+
+       for(j=0; j<NLP_NTAP-1; j++)
+           nlp->mem_fir[j] = nlp->mem_fir[j+1];
+       nlp->mem_fir[NLP_NTAP-1] = nlp->sq[i];
+
+       nlp->sq[i] = 0.0;
+       for(j=0; j<NLP_NTAP; j++)
+           nlp->sq[i] += nlp->mem_fir[j]*nlp_fir[j];
+    }
+
+    PROFILE_SAMPLE_AND_LOG(filter, tnotch, "      filter");
+    /* Decimate and DFT */
+
+    for(i=0; i<PE_FFT_SIZE; i++) {
+       fw[i].real = 0.0;
+       fw[i].imag = 0.0;
+    }
+    for(i=0; i<m/DEC; i++) {
+       fw[i].real = nlp->sq[i*DEC]*nlp->w[i];
+    }
+    PROFILE_SAMPLE_AND_LOG(window, filter, "      window");
+    #ifdef DUMP
+    dump_dec(Fw);
+    #endif
+
+    kiss_fft(nlp->fft_cfg, (kiss_fft_cpx *)fw, (kiss_fft_cpx *)Fw);
+    PROFILE_SAMPLE_AND_LOG(fft, window, "      fft");
+
+    for(i=0; i<PE_FFT_SIZE; i++)
+       Fw[i].real = Fw[i].real*Fw[i].real + Fw[i].imag*Fw[i].imag;
+
+    PROFILE_SAMPLE_AND_LOG(magsq, fft, "      mag sq");
+    #ifdef DUMP
+    dump_sq(nlp->sq);
+    dump_Fw(Fw);
+    #endif
+
+    /* find global peak */
+
+    gmax = 0.0;
+    gmax_bin = PE_FFT_SIZE*DEC/pmax;
+    for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) {
+       if (Fw[i].real > gmax) {
+           gmax = Fw[i].real;
+           gmax_bin = i;
+       }
+    }
+    
+    PROFILE_SAMPLE_AND_LOG(peakpick, magsq, "      peak pick");
+
+    //#define POST_PROCESS_MBE
+    #ifdef POST_PROCESS_MBE
+    best_f0 = post_process_mbe(Fw, pmin, pmax, gmax, Sw, W, prev_Wo);
+    #else
+    best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin, prev_Wo);
+    #endif
+
+    PROFILE_SAMPLE_AND_LOG(shiftmem, peakpick,  "      post process");
+
+    /* Shift samples in buffer to make room for new samples */
+
+    for(i=0; i<m-n; i++)
+       nlp->sq[i] = nlp->sq[i+n];
+
+    /* return pitch and F0 estimate */
+
+    *pitch = (float)SAMPLE_RATE/best_f0;
+
+    PROFILE_SAMPLE_AND_LOG2(shiftmem,  "      shift mem");
+
+    PROFILE_SAMPLE_AND_LOG2(start,  "      nlp int");
+
+    return(best_f0);  
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  post_process_sub_multiples() 
+                                                                           
+  Given the global maximma of Fw[] we search integer submultiples for
+  local maxima.  If local maxima exist and they are above an
+  experimentally derived threshold (OK a magic number I pulled out of
+  the air) we choose the submultiple as the F0 estimate.
+
+  The rational for this is that the lowest frequency peak of Fw[]
+  should be F0, as Fw[] can be considered the autocorrelation function
+  of Sw[] (the speech spectrum).  However sometimes due to phase
+  effects the lowest frequency maxima may not be the global maxima.
+
+  This works OK in practice and favours low F0 values in the presence
+  of background noise which means the sinusoidal codec does an OK job
+  of synthesising the background noise.  High F0 in background noise
+  tends to sound more periodic introducing annoying artifacts.
+
+\*---------------------------------------------------------------------------*/
+
+float post_process_sub_multiples(COMP Fw[], 
+                                int pmin, int pmax, float gmax, int gmax_bin,
+                                float *prev_Wo)
+{
+    int   min_bin, cmax_bin;
+    int   mult;
+    float thresh, best_f0;
+    int   b, bmin, bmax, lmax_bin;
+    float lmax;
+    int   prev_f0_bin;
+
+    /* post process estimate by searching submultiples */
+
+    mult = 2;
+    min_bin = PE_FFT_SIZE*DEC/pmax; 
+    cmax_bin = gmax_bin;
+    prev_f0_bin = *prev_Wo*(4000.0/PI)*(PE_FFT_SIZE*DEC)/SAMPLE_RATE;
+    
+    while(gmax_bin/mult >= min_bin) {
+
+       b = gmax_bin/mult;                      /* determine search interval */
+       bmin = 0.8*b;
+       bmax = 1.2*b;
+       if (bmin < min_bin)
+           bmin = min_bin;
+
+       /* lower threshold to favour previous frames pitch estimate,
+           this is a form of pitch tracking */
+
+       if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax))
+           thresh = CNLP*0.5*gmax;
+       else
+           thresh = CNLP*gmax;
+
+       lmax = 0;
+       lmax_bin = bmin;
+       for (b=bmin; b<=bmax; b++)           /* look for maximum in interval */
+           if (Fw[b].real > lmax) {
+               lmax = Fw[b].real;
+               lmax_bin = b;
+           }
+
+       if (lmax > thresh)
+           if ((lmax > Fw[lmax_bin-1].real) && (lmax > Fw[lmax_bin+1].real)) {
+               cmax_bin = lmax_bin;
+           }
+
+       mult++;
+    }
+
+    best_f0 = (float)cmax_bin*SAMPLE_RATE/(PE_FFT_SIZE*DEC);
+
+    return best_f0;
+}
+  
+/*---------------------------------------------------------------------------*\
+                                                                             
+  post_process_mbe() 
+                                                                           
+  Use the MBE pitch estimation algorithm to evaluate pitch candidates.  This
+  works OK but the accuracy at low F0 is affected by NW, the analysis window
+  size used for the DFT of the input speech Sw[].  Also favours high F0 in
+  the presence of background noise which causes periodic artifacts in the
+  synthesised speech.
+
+\*---------------------------------------------------------------------------*/
+
+float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP Sw[], COMP W[], float *prev_Wo)
+{
+  float candidate_f0;
+  float f0,best_f0;            /* fundamental frequency */
+  float e,e_min;                /* MBE cost function */
+  int   i;
+  #ifdef DUMP
+  float e_hz[F0_MAX];
+  #endif
+  #if !defined(NDEBUG) || defined(DUMP)
+  int   bin;
+  #endif
+  float f0_min, f0_max;
+  float f0_start, f0_end;
+
+  f0_min = (float)SAMPLE_RATE/pmax;
+  f0_max = (float)SAMPLE_RATE/pmin;
+
+  /* Now look for local maxima.  Each local maxima is a candidate
+     that we test using the MBE pitch estimation algotithm */
+
+  #ifdef DUMP
+  for(i=0; i<F0_MAX; i++)
+      e_hz[i] = -1;
+  #endif
+  e_min = 1E32;
+  best_f0 = 50;
+  for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) {
+    if ((Fw[i].real > Fw[i-1].real) && (Fw[i].real > Fw[i+1].real)) {
+
+       /* local maxima found, lets test if it's big enough */
+
+       if (Fw[i].real > T*gmax) {
+
+           /* OK, sample MBE cost function over +/- 10Hz range in 2.5Hz steps */
+
+           candidate_f0 = (float)i*SAMPLE_RATE/(PE_FFT_SIZE*DEC);
+           f0_start = candidate_f0-20;
+           f0_end = candidate_f0+20;
+           if (f0_start < f0_min) f0_start = f0_min;
+           if (f0_end > f0_max) f0_end = f0_max;
+
+           for(f0=f0_start; f0<=f0_end; f0+= 2.5) {
+               e = test_candidate_mbe(Sw, W, f0);
+               #if !defined(NDEBUG) || defined(DUMP)
+               bin = floorf(f0); assert((bin > 0) && (bin < F0_MAX));
+               #endif
+               #ifdef DUMP
+                e_hz[bin] = e;
+                #endif
+               if (e < e_min) {
+                   e_min = e;
+                   best_f0 = f0;
+               }
+           }
+
+       }
+    }
+  }
+
+  /* finally sample MBE cost function around previous pitch estimate
+     (form of pitch tracking) */
+
+  candidate_f0 = *prev_Wo * SAMPLE_RATE/TWO_PI;
+  f0_start = candidate_f0-20;
+  f0_end = candidate_f0+20;
+  if (f0_start < f0_min) f0_start = f0_min;
+  if (f0_end > f0_max) f0_end = f0_max;
+
+  for(f0=f0_start; f0<=f0_end; f0+= 2.5) {
+      e = test_candidate_mbe(Sw, W, f0);
+      #if !defined(NDEBUG) || defined(DUMP)
+      bin = floorf(f0); assert((bin > 0) && (bin < F0_MAX));
+      #endif
+      #ifdef DUMP
+      e_hz[bin] = e;
+      #endif
+      if (e < e_min) {
+         e_min = e;
+         best_f0 = f0;
+      }
+  }
+
+  #ifdef DUMP
+  dump_e(e_hz);
+  #endif
+
+  return best_f0;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  test_candidate_mbe()          
+                                                                             
+  Returns the error of the MBE cost function for the input f0.  
+
+  Note: I think a lot of the operations below can be simplified as
+  W[].imag = 0 and has been normalised such that den always equals 1.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+float test_candidate_mbe(
+    COMP  Sw[],
+    COMP  W[],
+    float f0
+)
+{
+    COMP  Sw_[FFT_ENC];   /* DFT of all voiced synthesised signal */
+    int   l,al,bl,m;      /* loop variables */
+    COMP  Am;             /* amplitude sample for this band */
+    int   offset;         /* centers Hw[] about current harmonic */
+    float den;            /* denominator of Am expression */
+    float error;          /* accumulated error between originl and synthesised */
+    float Wo;             /* current "test" fundamental freq. */
+    int   L;
+    
+    L = floorf((SAMPLE_RATE/2.0)/f0);
+    Wo = f0*(2*PI/SAMPLE_RATE);
+
+    error = 0.0;
+
+    /* Just test across the harmonics in the first 1000 Hz (L/4) */
+
+    for(l=1; l<L/4; l++) {
+       Am.real = 0.0;
+       Am.imag = 0.0;
+       den = 0.0;
+       al = ceilf((l - 0.5)*Wo*FFT_ENC/TWO_PI);
+       bl = ceilf((l + 0.5)*Wo*FFT_ENC/TWO_PI);
+
+       /* Estimate amplitude of harmonic assuming harmonic is totally voiced */
+
+       for(m=al; m<bl; m++) {
+           offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5;
+           Am.real += Sw[m].real*W[offset].real + Sw[m].imag*W[offset].imag;
+           Am.imag += Sw[m].imag*W[offset].real - Sw[m].real*W[offset].imag;
+           den += W[offset].real*W[offset].real + W[offset].imag*W[offset].imag;
+        }
+
+        Am.real = Am.real/den;
+        Am.imag = Am.imag/den;
+
+        /* Determine error between estimated harmonic and original */
+
+        for(m=al; m<bl; m++) {
+           offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5;
+           Sw_[m].real = Am.real*W[offset].real - Am.imag*W[offset].imag;
+           Sw_[m].imag = Am.real*W[offset].imag + Am.imag*W[offset].real;
+           error += (Sw[m].real - Sw_[m].real)*(Sw[m].real - Sw_[m].real);
+           error += (Sw[m].imag - Sw_[m].imag)*(Sw[m].imag - Sw_[m].imag);
+       }
+    }
+
+    return error;
+}
+
diff --git a/codec2/tags/0.4/src/nlp.h b/codec2/tags/0.4/src/nlp.h
new file mode 100644 (file)
index 0000000..2d2dada
--- /dev/null
@@ -0,0 +1,38 @@
+/*---------------------------------------------------------------------------*\
+                                                 
+  FILE........: nlp.c                                                   
+  AUTHOR......: David Rowe                                      
+  DATE CREATED: 23/3/93                                    
+                                                         
+  Non Linear Pitch (NLP) estimation functions.                   
+                                                               
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __NLP__
+#define __NLP__
+
+#include "comp.h"
+
+void *nlp_create(int m);
+void nlp_destroy(void *nlp_state);
+float nlp(void *nlp_state, float Sn[], int n, int pmin, int pmax, 
+         float *pitch, COMP Sw[], COMP W[], float *prev_Wo);
+
+#endif
diff --git a/codec2/tags/0.4/src/octave.c b/codec2/tags/0.4/src/octave.c
new file mode 100644 (file)
index 0000000..2ff5ad1
--- /dev/null
@@ -0,0 +1,85 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: octave.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 28 2012
+                                                                             
+  Functions to save C arrays in GNU Octave matrix format.  The output text
+  file can be directly read into Octave using "load filename".
+
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 <stdio.h>
+#include "octave.h"
+
+void octave_save_int(FILE *f, char name[], int data[], int rows, int cols)
+{
+    int r,c;
+
+    fprintf(f, "# name: %s\n", name);
+    fprintf(f, "# type: matrix\n");
+    fprintf(f, "# rows: %d\n", rows);
+    fprintf(f, "# columns: %d\n", cols);
+    
+    for(r=0; r<rows; r++) {
+       for(c=0; c<cols; c++)
+           fprintf(f, " %d", data[r*cols+c]);
+       fprintf(f, "\n");
+    }
+
+    fprintf(f, "\n\n");
+}
+
+void octave_save_float(FILE *f, char name[], float data[], int rows, int cols, int col_len)
+{
+    int r,c;
+
+    fprintf(f, "# name: %s\n", name);
+    fprintf(f, "# type: matrix\n");
+    fprintf(f, "# rows: %d\n", rows);
+    fprintf(f, "# columns: %d\n", cols);
+    
+    for(r=0; r<rows; r++) {
+       for(c=0; c<cols; c++)
+           fprintf(f, " %f", data[r*col_len+c]);
+       fprintf(f, "\n");
+    }
+
+    fprintf(f, "\n\n");
+}
+
+void octave_save_complex(FILE *f, char name[], COMP data[], int rows, int cols, int col_len)
+{
+    int r,c;
+
+    fprintf(f, "# name: %s\n", name);
+    fprintf(f, "# type: complex matrix\n");
+    fprintf(f, "# rows: %d\n", rows);
+    fprintf(f, "# columns: %d\n", cols);
+    
+    for(r=0; r<rows; r++) {
+       for(c=0; c<cols; c++)
+           fprintf(f, " (%f,%f)", data[r*col_len+c].real, data[r*col_len+c].imag);
+       fprintf(f, "\n");
+    }
+
+    fprintf(f, "\n\n");
+}
diff --git a/codec2/tags/0.4/src/octave.h b/codec2/tags/0.4/src/octave.h
new file mode 100644 (file)
index 0000000..be6d8d3
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: octave.h
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 28 2012
+                                                                             
+  Functions to save C arrays in Octave matrix format.  the output text
+  file can be directly read into octave using "load filename".
+
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  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, 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 __OCTAVE__
+#define __OCTAVE__
+
+#include "comp.h"
+
+void octave_save_int(FILE *f, char name[], int data[], int rows, int cols);
+void octave_save_float(FILE *f, char name[], float data[], int rows, int cols, int col_len);
+void octave_save_complex(FILE *f, char name[], COMP data[], int rows, int cols, int col_len);
+
+#endif
diff --git a/codec2/tags/0.4/src/os.h b/codec2/tags/0.4/src/os.h
new file mode 100644 (file)
index 0000000..ee25028
--- /dev/null
@@ -0,0 +1,53 @@
+/* Generate using fir1(47,1/2) in Octave */
+
+const float fdmdv_os_filter[]= {
+    -0.0008215855034550382,
+    -0.0007833023901802921,
+     0.001075563790768233,
+     0.001199092367787555,
+    -0.001765309502928316,
+    -0.002055372115328064,
+     0.002986877604154257,
+     0.003462567920638414,
+    -0.004856570111126334,
+    -0.005563143845031497,
+     0.007533613299748122,
+     0.008563932468880897,
+    -0.01126857129039911,
+    -0.01280782411693687,
+     0.01651443896361847,
+     0.01894875110322284,
+    -0.02421604439474981,
+    -0.02845107338464062,
+     0.03672973563400258,
+     0.04542046150312214,
+    -0.06189165826716491,
+    -0.08721876380763803,
+     0.1496157094199961,
+     0.4497962274137046,
+     0.4497962274137046,
+     0.1496157094199961,
+    -0.08721876380763803,
+    -0.0618916582671649,
+     0.04542046150312216,
+     0.03672973563400257,
+    -0.02845107338464062,
+    -0.02421604439474984,
+     0.01894875110322284,
+     0.01651443896361848,
+    -0.01280782411693687,
+    -0.0112685712903991,
+     0.008563932468880899,
+     0.007533613299748123,
+    -0.005563143845031501,
+    -0.004856570111126346,
+     0.003462567920638419,
+     0.002986877604154259,
+    -0.002055372115328063,
+    -0.001765309502928318,
+     0.001199092367787557,
+     0.001075563790768233,
+    -0.0007833023901802925,
+    -0.0008215855034550383
+};
+
diff --git a/codec2/tags/0.4/src/pack.c b/codec2/tags/0.4/src/pack.c
new file mode 100644 (file)
index 0000000..b062564
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+  Copyright (C) 2010 Perens LLC <bruce@perens.com>
+
+  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 "quantise.h"
+#include <stdio.h>
+
+/* Compile-time constants */
+/* Size of unsigned char in bits. Assumes 8 bits-per-char. */
+static const unsigned int      WordSize = 8;
+
+/* Mask to pick the bit component out of bitIndex. */
+static const unsigned int      IndexMask = 0x7;
+
+/* Used to pick the word component out of bitIndex. */
+static const unsigned int      ShiftRight = 3;
+
+/** Pack a bit field into a bit string, encoding the field in Gray code.
+ *
+ * The output is an array of unsigned char data. The fields are efficiently
+ * packed into the bit string. The Gray coding is a naive attempt to reduce
+ * the effect of single-bit errors, we expect to do a better job as the
+ * codec develops.
+ *
+ * This code would be simpler if it just set one bit at a time in the string,
+ * but would hit the same cache line more often. I'm not sure the complexity
+ * gains us anything here.
+ *
+ * Although field is currently of int type rather than unsigned for
+ * compatibility with the rest of the code, indices are always expected to
+ * be >= 0.
+ */
+void
+pack(
+ unsigned char *       bitArray, /* The output bit string. */
+ unsigned int *                bitIndex, /* Index into the string in BITS, not bytes.*/
+ int                   field,    /* The bit field to be packed. */
+ unsigned int          fieldWidth/* Width of the field in BITS, not bytes. */
+ )
+{
+    pack_natural_or_gray(bitArray, bitIndex, field, fieldWidth, 1);
+}
+
+void
+pack_natural_or_gray(
+ unsigned char *       bitArray,  /* The output bit string. */
+ unsigned int *                bitIndex,  /* Index into the string in BITS, not bytes.*/
+ int                   field,     /* The bit field to be packed. */
+ unsigned int          fieldWidth,/* Width of the field in BITS, not bytes. */
+ unsigned int           gray       /* non-zero for gray coding */
+ )
+{
+  if (gray) {
+    /* Convert the field to Gray code */
+    field = (field >> 1) ^ field;
+  }
+
+  do {
+    unsigned int       bI = *bitIndex;
+    unsigned int       bitsLeft = WordSize - (bI & IndexMask);
+    unsigned int       sliceWidth =
+                        bitsLeft < fieldWidth ? bitsLeft : fieldWidth;
+    unsigned int       wordIndex = bI >> ShiftRight;
+
+    bitArray[wordIndex] |=
+     ((unsigned char)((field >> (fieldWidth - sliceWidth))
+     << (bitsLeft - sliceWidth)));
+    
+    *bitIndex = bI + sliceWidth;
+    fieldWidth -= sliceWidth;
+  } while ( fieldWidth != 0 );
+}
+
+/** Unpack a field from a bit string, converting from Gray code to binary.
+ *
+ */
+int
+unpack(
+ const unsigned char * bitArray, /* The input bit string. */
+ unsigned int *                bitIndex, /* Index into the string in BITS, not bytes.*/
+ unsigned int          fieldWidth/* Width of the field in BITS, not bytes. */
+ )
+{
+    return unpack_natural_or_gray(bitArray, bitIndex, fieldWidth, 1);
+}
+
+/** Unpack a field from a bit string, to binary, optionally using
+ * natural or Gray code.
+ *
+ */
+int
+unpack_natural_or_gray(
+ const unsigned char * bitArray,  /* The input bit string. */
+ unsigned int *                bitIndex,  /* Index into the string in BITS, not bytes.*/
+ unsigned int          fieldWidth,/* Width of the field in BITS, not bytes. */
+ unsigned int           gray       /* non-zero for Gray coding */
+ )
+{
+  unsigned int field = 0;
+  unsigned int t;
+
+  do {
+    unsigned int       bI = *bitIndex;
+    unsigned int       bitsLeft = WordSize - (bI & IndexMask);
+    unsigned int       sliceWidth =
+                        bitsLeft < fieldWidth ? bitsLeft : fieldWidth;
+
+    field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth));
+    
+    *bitIndex = bI + sliceWidth;
+    fieldWidth -= sliceWidth;
+  } while ( fieldWidth != 0 );
+
+  if (gray) {
+    /* Convert from Gray code to binary. Works for maximum 8-bit fields. */
+    t = field ^ (field >> 8);
+    t ^= (t >> 4);
+    t ^= (t >> 2);
+    t ^= (t >> 1);
+  }
+  else {
+    t = field;
+  }
+
+  return t;
+}
diff --git a/codec2/tags/0.4/src/phase.c b/codec2/tags/0.4/src/phase.c
new file mode 100644 (file)
index 0000000..08a2cf4
--- /dev/null
@@ -0,0 +1,199 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: phase.c                                           
+  AUTHOR......: David Rowe                                             
+  DATE CREATED: 1/2/09                                                 
+                                                                             
+  Functions for modelling and synthesising phase.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 "sine.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+/*---------------------------------------------------------------------------*\
+
+   phase_synth_zero_order()
+
+   Synthesises phases based on SNR and a rule based approach.  No phase 
+   parameters are required apart from the SNR (which can be reduced to a
+   1 bit V/UV decision per frame).
+
+   The phase of each harmonic is modelled as the phase of a LPC
+   synthesis filter excited by an impulse.  Unlike the first order
+   model the position of the impulse is not transmitted, so we create
+   an excitation pulse train using a rule based approach.  
+
+   Consider a pulse train with a pulse starting time n=0, with pulses
+   repeated at a rate of Wo, the fundamental frequency.  A pulse train
+   in the time domain is equivalent to harmonics in the frequency
+   domain.  We can make an excitation pulse train using a sum of
+   sinsusoids:
+
+     for(m=1; m<=L; m++)
+       ex[n] = cos(m*Wo*n)
+
+   Note: the Octave script ../octave/phase.m is an example of this if
+   you would like to try making a pulse train.
+
+   The phase of each excitation harmonic is:
+
+     arg(E[m]) = mWo
+
+   where E[m] are the complex excitation (freq domain) samples,
+   arg(x), just returns the phase of a complex sample x.
+
+   As we don't transmit the pulse position for this model, we need to
+   synthesise it.  Now the excitation pulses occur at a rate of Wo.
+   This means the phase of the first harmonic advances by N samples
+   over a synthesis frame of N samples.  For example if Wo is pi/20
+   (200 Hz), then over a 10ms frame (N=80 samples), the phase of the
+   first harmonic would advance (pi/20)*80 = 4*pi or two complete
+   cycles.
+
+   We generate the excitation phase of the fundamental (first
+   harmonic):
+
+     arg[E[1]] = Wo*N;
+
+   We then relate the phase of the m-th excitation harmonic to the
+   phase of the fundamental as:
+
+     arg(E[m]) = m*arg(E[1])
+
+   This E[m] then gets passed through the LPC synthesis filter to
+   determine the final harmonic phase.
+     
+   Comparing to speech synthesised using original phases:
+
+   - Through headphones speech synthesised with this model is not as 
+     good. Through a loudspeaker it is very close to original phases.
+
+   - If there are voicing errors, the speech can sound clicky or
+     staticy.  If V speech is mistakenly declared UV, this model tends to
+     synthesise impulses or clicks, as there is usually very little shift or
+     dispersion through the LPC filter.
+
+   - When combined with LPC amplitude modelling there is an additional
+     drop in quality.  I am not sure why, theory is interformant energy
+     is raised making any phase errors more obvious.
+
+   NOTES:
+
+     1/ This synthesis model is effectively the same as a simple LPC-10
+     vocoders, and yet sounds much better.  Why? Conventional wisdom
+     (AMBE, MELP) says mixed voicing is required for high quality
+     speech.
+
+     2/ I am pretty sure the Lincoln Lab sinusoidal coding guys (like xMBE
+     also from MIT) first described this zero phase model, I need to look
+     up the paper.
+
+     3/ Note that this approach could cause some discontinuities in
+     the phase at the edge of synthesis frames, as no attempt is made
+     to make sure that the phase tracks are continuous (the excitation
+     phases are continuous, but not the final phases after filtering
+     by the LPC spectra).  Technically this is a bad thing.  However
+     this may actually be a good thing, disturbing the phase tracks a
+     bit.  More research needed, e.g. test a synthesis model that adds
+     a small delta-W to make phase tracks line up for voiced
+     harmonics.
+
+\*---------------------------------------------------------------------------*/
+
+void phase_synth_zero_order(
+    kiss_fft_cfg fft_fwd_cfg,     
+    MODEL *model,
+    float *ex_phase,            /* excitation phase of fundamental */
+    COMP   A[]
+)
+{
+    int   m, b;
+    float phi_, new_phi, r;
+    COMP  Ex[MAX_AMP+1];         /* excitation samples */
+    COMP  A_[MAX_AMP+1];         /* synthesised harmonic samples */
+    COMP  H[MAX_AMP+1];           /* LPC freq domain samples */
+
+    r = TWO_PI/(FFT_ENC);
+
+    /* Sample phase at harmonics */
+
+    for(m=1; m<=model->L; m++) {
+        b = (int)(m*model->Wo/r + 0.5);
+        phi_ = -atan2f(A[b].imag, A[b].real);
+        H[m].real = cosf(phi_);
+        H[m].imag = sinf(phi_);
+    }
+
+    /* 
+       Update excitation fundamental phase track, this sets the position
+       of each pitch pulse during voiced speech.  After much experiment
+       I found that using just this frame's Wo improved quality for UV
+       sounds compared to interpolating two frames Wo like this:
+     
+       ex_phase[0] += (*prev_Wo+model->Wo)*N/2;
+    */
+  
+    ex_phase[0] += (model->Wo)*N;
+    ex_phase[0] -= TWO_PI*floorf(ex_phase[0]/TWO_PI + 0.5);
+
+    for(m=1; m<=model->L; m++) {
+      
+        /* generate excitation */
+           
+        if (model->voiced) {
+
+            Ex[m].real = cosf(ex_phase[0]*m);
+            Ex[m].imag = sinf(ex_phase[0]*m);
+        }
+        else {
+
+            /* When a few samples were tested I found that LPC filter
+               phase is not needed in the unvoiced case, but no harm in
+               keeping it.
+            */
+            float phi = TWO_PI*(float)codec2_rand()/CODEC2_RAND_MAX;
+            Ex[m].real = cosf(phi);
+            Ex[m].imag = sinf(phi);
+        }
+
+        /* filter using LPC filter */
+
+        A_[m].real = H[m].real*Ex[m].real - H[m].imag*Ex[m].imag;
+        A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag;
+
+        /* modify sinusoidal phase */
+   
+        new_phi = atan2f(A_[m].imag, A_[m].real+1E-12);
+        model->phi[m] = new_phi;
+    }
+
+}
+
diff --git a/codec2/tags/0.4/src/phase.h b/codec2/tags/0.4/src/phase.h
new file mode 100644 (file)
index 0000000..03e1c50
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: phase.h                                          
+  AUTHOR......: David Rowe                                             
+  DATE CREATED: 1/2/09                                                 
+                                                                             
+  Functions for modelling phase.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __PHASE__
+#define __PHASE__
+
+#include "kiss_fft.h"
+#include "comp.h"
+
+void phase_synth_zero_order(kiss_fft_cfg fft_dec_cfg, 
+                           MODEL *model, 
+                            float *ex_phase,
+                            COMP   A[]);
+
+#endif
diff --git a/codec2/tags/0.4/src/phaseexp.c b/codec2/tags/0.4/src/phaseexp.c
new file mode 100644 (file)
index 0000000..be2ad9b
--- /dev/null
@@ -0,0 +1,1455 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  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 <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 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]));
+    }
+}
+
+
+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];
+
+    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/tags/0.4/src/phaseexp.h b/codec2/tags/0.4/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
diff --git a/codec2/tags/0.4/src/pilot_coeff.h b/codec2/tags/0.4/src/pilot_coeff.h
new file mode 100644 (file)
index 0000000..b284af9
--- /dev/null
@@ -0,0 +1,34 @@
+/* Generated by pilot_coeff_file() Octave function */
+
+const float pilot_coeff[]={
+  0.00223001,
+  0.00301037,
+  0.00471258,
+  0.0075934,
+  0.0118145,
+  0.0174153,
+  0.0242969,
+  0.0322204,
+  0.0408199,
+  0.0496286,
+  0.0581172,
+  0.0657392,
+  0.0719806,
+  0.0764066,
+  0.0787022,
+  0.0787022,
+  0.0764066,
+  0.0719806,
+  0.0657392,
+  0.0581172,
+  0.0496286,
+  0.0408199,
+  0.0322204,
+  0.0242969,
+  0.0174153,
+  0.0118145,
+  0.0075934,
+  0.00471258,
+  0.00301037,
+  0.00223001
+};
diff --git a/codec2/tags/0.4/src/pilots_coh.h b/codec2/tags/0.4/src/pilots_coh.h
new file mode 100644 (file)
index 0000000..9271195
--- /dev/null
@@ -0,0 +1,6 @@
+/* Generated by write_pilot_file() Octave function */
+
+float pilots_coh[][PILOTS_NC]={
+  {  1.000000,  -1.000000,  1.000000,  -1.000000,  1.000000,  -1.000000,  -1.000000},
+  {  -1.000000,  1.000000,  1.000000,  -1.000000,  1.000000,  1.000000,  1.000000}
+};
\ No newline at end of file
diff --git a/codec2/tags/0.4/src/postfilter.c b/codec2/tags/0.4/src/postfilter.c
new file mode 100644 (file)
index 0000000..fc88c0e
--- /dev/null
@@ -0,0 +1,142 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: postfilter.c
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 13/09/09
+                                                                             
+  Postfilter to improve sound quality for speech with high levels of
+  background noise.  Unlike mixed-excitation models requires no bits
+  to be transmitted to handle background noise.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "defines.h"
+#include "comp.h"
+#include "dump.h"
+#include "sine.h"
+#include "postfilter.h"
+
+/*---------------------------------------------------------------------------*\
+
+                                DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+#define BG_THRESH 40.0     /* only consider low levels signals for bg_est */
+#define BG_BETA    0.1     /* averaging filter constant                   */
+#define BG_MARGIN  6.0     /* harmonics this far above BG noise are 
+                             randomised.  Helped make bg noise less 
+                             spikey (impulsive) for mmt1, but speech was
+                              perhaps a little rougher.
+                          */
+
+/*---------------------------------------------------------------------------*\
+
+  postfilter()
+
+  The post filter is designed to help with speech corrupted by
+  background noise.  The zero phase model tends to make speech with
+  background noise sound "clicky".  With high levels of background
+  noise the low level inter-formant parts of the spectrum will contain
+  noise rather than speech harmonics, so modelling them as voiced
+  (i.e. a continuous, non-random phase track) is inaccurate.
+
+  Some codecs (like MBE) have a mixed voicing model that breaks the
+  spectrum into voiced and unvoiced regions.  Several bits/frame
+  (5-12) are required to transmit the frequency selective voicing
+  information.  Mixed excitation also requires accurate voicing
+  estimation (parameter estimators always break occasionally under
+  exceptional conditions).
+
+  In our case we use a post filter approach which requires no
+  additional bits to be transmitted.  The decoder measures the average
+  level of the background noise during unvoiced frames.  If a harmonic
+  is less than this level it is made unvoiced by randomising it's
+  phases.
+
+  This idea is rather experimental.  Some potential problems that may
+  happen:
+  1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track
+     up to speech level?  This would be a bad thing.
+
+  2/ If background noise suddenly dissapears from the source speech does
+     estimate drop quickly?  What is noise suddenly re-appears?
+
+  3/ Background noise with a non-flat sepctrum.  Current algorithm just
+     comsiders scpetrum as a whole, but this could be broken up into
+     bands, each with their own estimator.
+
+  4/ Males and females with the same level of background noise.  Check
+     performance the same.  Changing Wo affects width of each band, may
+     affect bg energy estimates.
+
+  5/ Not sure what happens during long periods of voiced speech
+     e.g. "sshhhhhhh"
+  
+\*---------------------------------------------------------------------------*/
+
+void postfilter(
+  MODEL *model,
+  float *bg_est
+)      
+{
+  int   m, uv;
+  float e, thresh;
+
+  /* determine average energy across spectrum */
+
+  e = 1E-12;
+  for(m=1; m<=model->L; m++)
+      e += model->A[m]*model->A[m];
+  
+  assert(e > 0.0);
+  e = 10.0*log10f(e/model->L);
+
+  /* If beneath threhold, update bg estimate.  The idea
+     of the threshold is to prevent updating during high level
+     speech. */
+
+  if ((e < BG_THRESH) && !model->voiced)
+      *bg_est =  *bg_est*(1.0 - BG_BETA) + e*BG_BETA;
+
+  /* now mess with phases during voiced frames to make any harmonics
+     less then our background estimate unvoiced.
+  */
+
+  uv = 0;
+  thresh = powf(10.0, (*bg_est + BG_MARGIN)/20.0);
+  if (model->voiced)
+      for(m=1; m<=model->L; m++)
+         if (model->A[m] < thresh) {
+             model->phi[m] = TWO_PI*(float)codec2_rand()/CODEC2_RAND_MAX;
+             uv++;
+         }
+
+#ifdef DUMP
+  dump_bg(e, *bg_est, 100.0*uv/model->L);
+#endif
+
+}
diff --git a/codec2/tags/0.4/src/postfilter.h b/codec2/tags/0.4/src/postfilter.h
new file mode 100644 (file)
index 0000000..bf080b1
--- /dev/null
@@ -0,0 +1,33 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: postfilter.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 13/09/09
+                                                                             
+  Postfilter header file.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __POSTFILTER__
+#define __POSTFILTER__
+
+void postfilter(MODEL *model, float *bg_est);
+
+#endif
diff --git a/codec2/tags/0.4/src/quantise.c b/codec2/tags/0.4/src/quantise.c
new file mode 100644 (file)
index 0000000..3e4adfd
--- /dev/null
@@ -0,0 +1,2077 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: quantise.c
+  AUTHOR......: David Rowe                                                     
+  DATE CREATED: 31/5/92                                                       
+                                                                             
+  Quantisation functions for the sinusoidal coder.  
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 <assert.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "defines.h"
+#include "dump.h"
+#include "quantise.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "kiss_fft.h"
+#undef PROFILE
+#include "machdep.h"
+
+#define LSP_DELTA1 0.01         /* grid spacing for LSP root searches */
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                          FUNCTION HEADERS
+
+\*---------------------------------------------------------------------------*/
+
+float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[], 
+                       int order);
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                             FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+int lsp_bits(int i) {
+    return lsp_cb[i].log2m;
+}
+
+int lspd_bits(int i) {
+    return lsp_cbd[i].log2m;
+}
+
+int mel_bits(int i) {
+    return mel_cb[i].log2m;
+}
+
+#ifdef __EXPERIMENTAL__
+int lspdt_bits(int i) {
+    return lsp_cbdt[i].log2m;
+}
+#endif
+
+int lsp_pred_vq_bits(int i) {
+    return lsp_cbjvm[i].log2m;
+}
+
+/*---------------------------------------------------------------------------*\
+
+  quantise_init
+
+  Loads the entire LSP quantiser comprised of several vector quantisers
+  (codebooks).
+
+\*---------------------------------------------------------------------------*/
+
+void quantise_init()
+{
+}
+
+/*---------------------------------------------------------------------------*\
+
+  quantise
+
+  Quantises vec by choosing the nearest vector in codebook cb, and
+  returns the vector index.  The squared error of the quantised vector
+  is added to se.
+
+\*---------------------------------------------------------------------------*/
+
+long quantise(const float * cb, float vec[], float w[], int k, int m, float *se)
+/* float   cb[][K];    current VQ codebook             */
+/* float   vec[];      vector to quantise              */
+/* float   w[];         weighting vector                */
+/* int    k;           dimension of vectors            */
+/* int     m;          size of codebook                */
+/* float   *se;                accumulated squared error       */
+{
+   float   e;          /* current error                */
+   long           besti;       /* best index so far            */
+   float   beste;      /* best error so far            */
+   long           j;
+   int     i;
+   float   diff;
+
+   besti = 0;
+   beste = 1E32;
+   for(j=0; j<m; j++) {
+       e = 0.0;
+       for(i=0; i<k; i++) {
+           diff = cb[j*k+i]-vec[i];
+           e += powf(diff*w[i],2.0);
+       }
+       if (e < beste) {
+           beste = e;
+           besti = j;
+       }
+   }
+
+   *se += beste;
+
+   return(besti);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  encode_lspds_scalar()
+
+  Scalar/VQ LSP difference quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+void encode_lspds_scalar(
+                int   indexes[],
+                float lsp[], 
+                int   order
+) 
+{
+    int   i,k,m;
+    float lsp_hz[order];
+    float lsp__hz[order];
+    float dlsp[order];
+    float dlsp_[order];
+    float wt[order];
+    const float *cb;
+    float se;
+
+    for(i=0; i<order; i++) {
+       wt[i] = 1.0;
+    }
+
+    /* convert from radians to Hz so we can use human readable
+       frequencies */
+
+    for(i=0; i<order; i++)
+       lsp_hz[i] = (4000.0/PI)*lsp[i];
+
+    //printf("\n");
+
+    wt[0] = 1.0;
+    for(i=0; i<order; i++) {
+
+       /* find difference from previous qunatised lsp */
+
+       if (i) 
+           dlsp[i] = lsp_hz[i] - lsp__hz[i-1];     
+       else
+           dlsp[0] = lsp_hz[0];
+
+       k = lsp_cbd[i].k;
+       m = lsp_cbd[i].m;
+       cb = lsp_cbd[i].cb;
+       indexes[i] = quantise(cb, &dlsp[i], wt, k, m, &se);
+       dlsp_[i] = cb[indexes[i]*k];
+
+
+       if (i) 
+           lsp__hz[i] = lsp__hz[i-1] + dlsp_[i];
+       else
+           lsp__hz[0] = dlsp_[0];
+       
+       //printf("%d lsp %3.2f dlsp %3.2f dlsp_ %3.2f lsp_ %3.2f\n", i, lsp_hz[i], dlsp[i], dlsp_[i], lsp__hz[i]);
+    }
+
+}
+
+void decode_lspds_scalar(
+                float lsp_[], 
+                int   indexes[],
+                int   order
+) 
+{
+    int   i,k;
+    float lsp__hz[order];
+    float dlsp_[order];
+    const float *cb;
+
+     for(i=0; i<order; i++) {
+
+       k = lsp_cbd[i].k;
+       cb = lsp_cbd[i].cb;
+       dlsp_[i] = cb[indexes[i]*k];
+
+       if (i) 
+           lsp__hz[i] = lsp__hz[i-1] + dlsp_[i];
+       else
+           lsp__hz[0] = dlsp_[0];
+
+       lsp_[i] = (PI/4000.0)*lsp__hz[i];
+
+       //printf("%d dlsp_ %3.2f lsp_ %3.2f\n", i, dlsp_[i], lsp__hz[i]);
+    }
+
+}
+
+#ifdef __EXPERIMENTAL__
+/*---------------------------------------------------------------------------*\
+                                                                             
+  lspvq_quantise
+
+  Vector LSP quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+void lspvq_quantise(
+  float lsp[], 
+  float lsp_[],
+  int   order
+) 
+{
+    int   i,k,m,ncb, nlsp;
+    float  wt[order], lsp_hz[order];
+    const float *cb;
+    float se;
+    int   index;
+
+    for(i=0; i<order; i++) {
+       wt[i] = 1.0;
+       lsp_hz[i] = 4000.0*lsp[i]/PI;
+    }
+
+    /* scalar quantise LSPs 1,2,3,4 */
+
+    /* simple uniform scalar quantisers */
+
+   for(i=0; i<4; i++) {
+       k = lsp_cb[i].k;
+       m = lsp_cb[i].m;
+       cb = lsp_cb[i].cb;
+       index = quantise(cb, &lsp_hz[i], wt, k, m, &se);
+       lsp_[i] = cb[index*k]*PI/4000.0;
+    }
+
+   //#define WGHT
+#ifdef WGHT
+    for(i=4; i<9; i++) {
+       wt[i] = 1.0/(lsp[i]-lsp[i-1]) + 1.0/(lsp[i+1]-lsp[i]);
+       //printf("wt[%d] = %f\n", i, wt[i]);
+    }
+    wt[9] = 1.0/(lsp[i]-lsp[i-1]);
+#endif
+
+    /* VQ LSPs 5,6,7,8,9,10 */
+
+    ncb = 4;
+    nlsp = 4;
+    k = lsp_cbjnd[ncb].k;
+    m = lsp_cbjnd[ncb].m;
+    cb = lsp_cbjnd[ncb].cb;
+    index = quantise(cb, &lsp_hz[nlsp], &wt[nlsp], k, m, &se);
+    for(i=4; i<order; i++) {
+       lsp_[i] = cb[index*k+i-4]*(PI/4000.0);
+       //printf("%4.f (%4.f) ", lsp_hz[i], cb[index*k+i-4]);
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  lspjnd_quantise
+
+  Experimental JND LSP quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+void lspjnd_quantise(float lsps[], float lsps_[], int order) 
+{
+    int   i,k,m;
+    float  wt[order], lsps_hz[order];
+    const float *cb;
+    float se = 0.0;
+    int   index;
+    for(i=0; i<order; i++) {
+       wt[i] = 1.0;
+    }
+
+    /* convert to Hz */
+
+    for(i=0; i<order; i++) {
+       lsps_hz[i] = lsps[i]*(4000.0/PI);
+       lsps_[i] = lsps[i];
+    }
+
+    /* simple uniform scalar quantisers */
+
+    for(i=0; i<4; i++) {
+       k = lsp_cbjnd[i].k;
+       m = lsp_cbjnd[i].m;
+       cb = lsp_cbjnd[i].cb;
+       index = quantise(cb, &lsps_hz[i], wt, k, m, &se);
+       lsps_[i] = cb[index*k]*(PI/4000.0);
+    }
+
+    /* VQ LSPs 5,6,7,8,9,10 */
+
+    k = lsp_cbjnd[4].k;
+    m = lsp_cbjnd[4].m;
+    cb = lsp_cbjnd[4].cb;
+    index = quantise(cb, &lsps_hz[4], &wt[4], k, m, &se);
+    //printf("k = %d m = %d c[0] %f cb[k] %f\n", k,m,cb[0],cb[k]);
+    //printf("index = %4d: ", index);
+    for(i=4; i<order; i++) {
+       lsps_[i] = cb[index*k+i-4]*(PI/4000.0);
+       //printf("%4.f (%4.f) ", lsps_hz[i], cb[index*k+i-4]);
+    }
+    //printf("\n");
+}
+
+void compute_weights(const float *x, float *w, int ndim);
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  lspdt_quantise
+
+  LSP difference in time quantiser.  Split VQ, encoding LSPs 1-4 with
+  one VQ, and LSPs 5-10 with a second.  Update of previous lsp memory
+  is done outside of this function to handle dT between 10 or 20ms
+  frames.
+
+  mode        action
+  ------------------
+
+  LSPDT_ALL   VQ LSPs 1-4 and 5-10
+  LSPDT_LOW   Just VQ LSPs 1-4, for LSPs 5-10 just copy previous
+  LSPDT_HIGH  Just VQ LSPs 5-10, for LSPs 1-4 just copy previous
+
+\*---------------------------------------------------------------------------*/
+
+void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[], int mode)
+{
+    int   i;
+    float wt[LPC_ORD];
+    float lsps_dt[LPC_ORD];
+#ifdef TRY_LSPDT_VQ
+    int k,m;
+    int   index;
+    const float *cb;
+    float se = 0.0;
+#endif // TRY_LSPDT_VQ
+    
+    //compute_weights(lsps, wt, LPC_ORD);
+    for(i=0; i<LPC_ORD; i++) {
+    wt[i] = 1.0;
+    }
+    //compute_weights(lsps, wt, LPC_ORD );
+
+    for(i=0; i<LPC_ORD; i++) {
+       lsps_dt[i] = lsps[i] - lsps__prev[i];
+       lsps_[i] = lsps__prev[i];
+    }
+
+    //#define TRY_LSPDT_VQ
+#ifdef TRY_LSPDT_VQ
+    /* this actually improves speech a bit, but 40ms updates works surprsingly well.... */
+    k = lsp_cbdt[0].k;
+    m = lsp_cbdt[0].m;
+    cb = lsp_cbdt[0].cb;
+    index = quantise(cb, lsps_dt, wt, k, m, &se);
+    for(i=0; i<LPC_ORD; i++) {
+       lsps_[i] += cb[index*k + i];
+    }
+#endif
+
+}
+#endif
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+#define MAX_ENTRIES 16384
+
+void compute_weights(const float *x, float *w, int ndim)
+{
+  int i;
+  w[0] = MIN(x[0], x[1]-x[0]);
+  for (i=1;i<ndim-1;i++)
+    w[i] = MIN(x[i]-x[i-1], x[i+1]-x[i]);
+  w[ndim-1] = MIN(x[ndim-1]-x[ndim-2], PI-x[ndim-1]);
+  
+  for (i=0;i<ndim;i++)
+    w[i] = 1./(.01+w[i]);
+  //w[0]*=3;
+  //w[1]*=2;
+}
+
+#ifdef __EXPERIMENTAL__
+/* LSP weight calculation ported from m-file function kindly submitted
+   by Anssi, OH3GDD */
+
+void compute_weights_anssi_mode2(const float *x, float *w, int ndim)
+{
+  int i;
+  float d[LPC_ORD];
+
+  assert(ndim == LPC_ORD);
+
+  for(i=0; i<LPC_ORD; i++)
+      d[i] = 1.0;
+
+  d[0] = x[1];
+  for (i=1; i<LPC_ORD-1; i++)
+      d[i] = x[i+1] - x[i-1];
+  d[LPC_ORD-1] = PI - x[8];
+  for (i=0; i<LPC_ORD; i++) {
+        if (x[i]<((400.0/4000.0)*PI))
+            w[i]=5.0/(0.01+d[i]);
+        else if (x[i]<((700.0/4000.0)*PI))
+            w[i]=4.0/(0.01+d[i]);
+        else if (x[i]<((1200.0/4000.0)*PI))
+            w[i]=3.0/(0.01+d[i]);
+        else if (x[i]<((2000.0/4000.0)*PI))
+            w[i]=2.0/(0.01+d[i]);
+        else
+            w[i]=1.0/(0.01+d[i]);
+        
+        w[i]=powf(w[i]+0.3, 0.66);
+  }
+}
+#endif
+
+int find_nearest(const float *codebook, int nb_entries, float *x, int ndim)
+{
+  int i, j;
+  float min_dist = 1e15;
+  int nearest = 0;
+  
+  for (i=0;i<nb_entries;i++)
+  {
+    float dist=0;
+    for (j=0;j<ndim;j++)
+      dist += (x[j]-codebook[i*ndim+j])*(x[j]-codebook[i*ndim+j]);
+    if (dist<min_dist)
+    {
+      min_dist = dist;
+      nearest = i;
+    }
+  }
+  return nearest;
+}
+
+int find_nearest_weighted(const float *codebook, int nb_entries, float *x, const float *w, int ndim)
+{
+  int i, j;
+  float min_dist = 1e15;
+  int nearest = 0;
+  
+  for (i=0;i<nb_entries;i++)
+  {
+    float dist=0;
+    for (j=0;j<ndim;j++)
+      dist += w[j]*(x[j]-codebook[i*ndim+j])*(x[j]-codebook[i*ndim+j]);
+    if (dist<min_dist)
+    {
+      min_dist = dist;
+      nearest = i;
+    }
+  }
+  return nearest;
+}
+
+void lspjvm_quantise(float *x, float *xq, int order)
+{
+  int i, n1, n2, n3;
+  float err[order], err2[order], err3[order];
+  float w[order], w2[order], w3[order];
+  const float *codebook1 = lsp_cbjvm[0].cb;
+  const float *codebook2 = lsp_cbjvm[1].cb;
+  const float *codebook3 = lsp_cbjvm[2].cb;
+
+  w[0] = MIN(x[0], x[1]-x[0]);
+  for (i=1;i<order-1;i++)
+    w[i] = MIN(x[i]-x[i-1], x[i+1]-x[i]);
+  w[order-1] = MIN(x[order-1]-x[order-2], PI-x[order-1]);
+  
+  compute_weights(x, w, order);
+  
+  n1 = find_nearest(codebook1, lsp_cbjvm[0].m, x, order);
+  
+  for (i=0;i<order;i++)
+  {
+    xq[i] = codebook1[order*n1+i];
+    err[i] = x[i] - xq[i];
+  }
+  for (i=0;i<order/2;i++)
+  {
+    err2[i] = err[2*i];  
+    err3[i] = err[2*i+1];
+    w2[i] = w[2*i];  
+    w3[i] = w[2*i+1];
+  }
+  n2 = find_nearest_weighted(codebook2, lsp_cbjvm[1].m, err2, w2, order/2);
+  n3 = find_nearest_weighted(codebook3, lsp_cbjvm[2].m, err3, w3, order/2);
+  
+  for (i=0;i<order/2;i++)
+  {
+    xq[2*i] += codebook2[order*n2/2+i];
+    xq[2*i+1] += codebook3[order*n3/2+i];
+  }
+}
+
+#ifdef __EXPERIMENTAL__
+
+#define MBEST_STAGES 4
+
+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 ordered in order or error, so those 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     */
+) 
+{
+   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 += powf(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, n4;
+  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;
+  const float *codebook4 = lsp_cbvqanssi[3].cb;
+  struct MBEST *mbest_stage1, *mbest_stage2, *mbest_stage3, *mbest_stage4;
+  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);
+  mbest_stage4 = mbest_create(mbest_entries);
+  for(i=0; i<MBEST_STAGES; i++)
+      index[i] = 0;
+  
+  compute_weights_anssi_mode2(x, w, ndim);
+
+  #ifdef DUMP
+  dump_weights(w, ndim);
+  #endif
+
+  /* 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);      
+  }
+  mbest_print("Stage 2:", mbest_stage2);
+
+  /* Stage 3 */
+
+  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);      
+  }
+  mbest_print("Stage 3:", mbest_stage3);
+
+  /* Stage 4 */
+
+  for (j=0; j<mbest_entries; j++) {
+      index[3] = n1 = mbest_stage3->list[j].index[2];
+      index[2] = n2 = mbest_stage3->list[j].index[1];
+      index[1] = n3 = mbest_stage3->list[j].index[0];
+      for(i=0; i<ndim; i++)
+         target[i] = x[i] - codebook1[ndim*n1+i] - codebook2[ndim*n2+i] - codebook3[ndim*n3+i];
+      mbest_search(codebook4, target, w, ndim, lsp_cbvqanssi[3].m, mbest_stage4, index);      
+  }
+  mbest_print("Stage 4:", mbest_stage4);
+
+  n1 = mbest_stage4->list[0].index[3];
+  n2 = mbest_stage4->list[0].index[2];
+  n3 = mbest_stage4->list[0].index[1];
+  n4 = mbest_stage4->list[0].index[0];
+  for (i=0;i<ndim;i++)
+      xq[i] = codebook1[ndim*n1+i] + codebook2[ndim*n2+i] + codebook3[ndim*n3+i] + codebook4[ndim*n4+i];
+
+  mbest_destroy(mbest_stage1);
+  mbest_destroy(mbest_stage2);
+  mbest_destroy(mbest_stage3);
+  mbest_destroy(mbest_stage4);
+}
+#endif
+
+int check_lsp_order(float lsp[], int order)
+{
+    int   i;
+    float tmp;
+    int   swaps = 0;
+
+    for(i=1; i<order; i++)
+       if (lsp[i] < lsp[i-1]) {
+           //fprintf(stderr, "swap %d\n",i);
+           swaps++;
+           tmp = lsp[i-1];
+           lsp[i-1] = lsp[i]-0.1;
+           lsp[i] = tmp+0.1;
+            i = 1; /* start check again, as swap may have caused out of order */
+       }
+
+    return swaps;
+}
+
+void force_min_lsp_dist(float lsp[], int order)
+{
+    int   i;
+
+    for(i=1; i<order; i++)
+       if ((lsp[i]-lsp[i-1]) < 0.01) {
+           lsp[i] += 0.01;
+       }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                                         
+   lpc_post_filter()
+   
+   Applies a post filter to the LPC synthesis filter power spectrum
+   Pw, which supresses the inter-formant energy.
+
+   The algorithm is from p267 (Section 8.6) of "Digital Speech",
+   edited by A.M. Kondoz, 1994 published by Wiley and Sons.  Chapter 8
+   of this text is on the MBE vocoder, and this is a freq domain
+   adaptation of post filtering commonly used in CELP.
+
+   I used the Octave simulation lpcpf.m to get an understanding of the
+   algorithm.
+
+   Requires two more FFTs which is significantly more MIPs.  However
+   it should be possible to implement this more efficiently in the
+   time domain.  Just not sure how to handle relative time delays
+   between the synthesis stage and updating these coeffs.  A smaller
+   FFT size might also be accetable to save CPU.  
+
+   TODO:
+   [ ] sync var names between Octave and C version
+   [ ] doc gain normalisation
+   [ ] I think the first FFT is not rqd as we do the same
+       thing in aks_to_M2().
+
+\*---------------------------------------------------------------------------*/
+
+void lpc_post_filter(kiss_fft_cfg fft_fwd_cfg, COMP Pw[], float ak[], 
+                     int order, int dump, float beta, float gamma, int bass_boost, float E)
+{
+    int   i;
+    COMP  x[FFT_ENC];   /* input to FFTs                */
+    COMP  Ww[FFT_ENC];  /* weighting spectrum           */
+    float Rw[FFT_ENC];  /* R = WA                       */
+    float e_before, e_after, gain;
+    float Pfw;
+    float max_Rw, min_Rw;
+    float coeff;
+    PROFILE_VAR(tstart, tfft1, taw, tfft2, tww, tr);
+
+    PROFILE_SAMPLE(tstart);
+
+    /* Determine weighting filter spectrum W(exp(jw)) ---------------*/
+
+    for(i=0; i<FFT_ENC; i++) {
+       x[i].real = 0.0;
+       x[i].imag = 0.0; 
+    }
+    
+    x[0].real = ak[0];
+    coeff = gamma;
+    for(i=1; i<=order; i++) {
+       x[i].real = ak[i] * coeff;
+        coeff *= gamma;
+    }
+    kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)x, (kiss_fft_cpx *)Ww);
+
+    PROFILE_SAMPLE_AND_LOG(tfft2, taw, "        fft2"); 
+
+    for(i=0; i<FFT_ENC/2; i++) {
+       Ww[i].real = Ww[i].real*Ww[i].real + Ww[i].imag*Ww[i].imag;
+    }
+
+    PROFILE_SAMPLE_AND_LOG(tww, tfft2, "        Ww"); 
+
+    /* Determined combined filter R = WA ---------------------------*/
+
+    max_Rw = 0.0; min_Rw = 1E32;
+    for(i=0; i<FFT_ENC/2; i++) {
+       Rw[i] = sqrtf(Ww[i].real * Pw[i].real);
+       if (Rw[i] > max_Rw)
+           max_Rw = Rw[i];
+       if (Rw[i] < min_Rw)
+           min_Rw = Rw[i];
+
+    }
+
+    PROFILE_SAMPLE_AND_LOG(tr, tww, "        R"); 
+
+    #ifdef DUMP
+    if (dump)
+      dump_Rw(Rw);
+    #endif
+
+    /* create post filter mag spectrum and apply ------------------*/
+    
+    /* measure energy before post filtering */
+
+    e_before = 1E-4;
+    for(i=0; i<FFT_ENC/2; i++)
+       e_before += Pw[i].real;
+
+    /* apply post filter and measure energy  */
+
+    #ifdef DUMP
+    if (dump)
+       dump_Pwb(Pw);
+    #endif
+
+
+    e_after = 1E-4;
+    for(i=0; i<FFT_ENC/2; i++) {
+        Pfw = powf(Rw[i], beta);
+        Pw[i].real *= Pfw * Pfw;
+        e_after += Pw[i].real;
+    }
+    gain = e_before/e_after;
+
+    /* apply gain factor to normalise energy, and LPC Energy */
+
+    gain *= E;
+    for(i=0; i<FFT_ENC/2; i++) {
+       Pw[i].real *= gain;
+    }
+
+    if (bass_boost) {
+        /* add 3dB to first 1 kHz to account for LP effect of PF */
+
+        for(i=0; i<FFT_ENC/8; i++) {
+            Pw[i].real *= 1.4*1.4;
+        }    
+    }
+
+    PROFILE_SAMPLE_AND_LOG2(tr, "        filt"); 
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                                         
+   aks_to_M2()                                                             
+                                                                         
+   Transforms the linear prediction coefficients to spectral amplitude    
+   samples.  This function determines A(m) from the average energy per    
+   band using an FFT.                                                     
+                                                                        
+\*---------------------------------------------------------------------------*/
+
+void aks_to_M2(
+  kiss_fft_cfg  fft_fwd_cfg, 
+  float         ak[],       /* LPC's */
+  int           order,
+  MODEL        *model,      /* sinusoidal model parameters for this frame */
+  float         E,          /* energy term */
+  float        *snr,        /* signal to noise ratio for this frame in dB */
+  int           dump,        /* true to dump sample to dump file */
+  int           sim_pf,      /* true to simulate a post filter */
+  int           pf,          /* true to enable actual LPC post filter */
+  int           bass_boost,  /* enable LPC filter 0-1kHz 3dB boost */
+  float         beta,
+  float         gamma,       /* LPC post filter parameters */
+  COMP          Aw[]         /* output power spectrum */
+)
+{
+  COMP a[FFT_ENC];     /* input to FFT for power spectrum */
+  COMP Pw[FFT_ENC];    /* output power spectrum */
+  int i,m;             /* loop variables */
+  int am,bm;           /* limits of current band */
+  float r;             /* no. rads/bin */
+  float Em;            /* energy in band */
+  float Am;            /* spectral amplitude sample */
+  float signal, noise;
+  PROFILE_VAR(tstart, tfft, tpw, tpf);
+
+  PROFILE_SAMPLE(tstart);
+
+  r = TWO_PI/(FFT_ENC);
+
+  /* Determine DFT of A(exp(jw)) --------------------------------------------*/
+
+  for(i=0; i<FFT_ENC; i++) {
+    a[i].real = 0.0;
+    a[i].imag = 0.0; 
+    Pw[i].real = 0.0;
+    Pw[i].imag = 0.0;
+  }
+
+  for(i=0; i<=order; i++)
+    a[i].real = ak[i];
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)a, (kiss_fft_cpx *)Aw);
+
+  PROFILE_SAMPLE_AND_LOG(tfft, tstart, "      fft"); 
+
+  /* Determine power spectrum P(w) = E/(A(exp(jw))^2 ------------------------*/
+
+  for(i=0; i<FFT_ENC/2; i++) {
+    Pw[i].real = 1.0/(Aw[i].real*Aw[i].real + Aw[i].imag*Aw[i].imag + 1E-6);
+  }
+
+  PROFILE_SAMPLE_AND_LOG(tpw, tfft, "      Pw"); 
+
+  if (pf)
+      lpc_post_filter(fft_fwd_cfg, Pw, ak, order, dump, beta, gamma, bass_boost, E);
+  else {
+      for(i=0; i<FFT_ENC; i++) {
+          Pw[i].real *= E;
+      }
+  }
+
+  PROFILE_SAMPLE_AND_LOG(tpf, tpw, "      LPC post filter"); 
+
+  #ifdef DUMP
+  if (dump) 
+      dump_Pw(Pw);
+  #endif
+
+  /* Determine magnitudes from P(w) ----------------------------------------*/
+
+  /* when used just by decoder {A} might be all zeroes so init signal
+     and noise to prevent log(0) errors */
+
+  signal = 1E-30; noise = 1E-32;
+
+  for(m=1; m<=model->L; m++) {
+      am = (int)((m - 0.5)*model->Wo/r + 0.5);
+      bm = (int)((m + 0.5)*model->Wo/r + 0.5);
+      Em = 0.0;
+
+      for(i=am; i<bm; i++)
+          Em += Pw[i].real;
+      Am = sqrtf(Em);
+
+      signal += model->A[m]*model->A[m];
+      noise  += (model->A[m] - Am)*(model->A[m] - Am);
+
+      /* This code significantly improves perf of LPC model, in
+         particular when combined with phase0.  The LPC spectrum tends
+         to track just under the peaks of the spectral envelope, and
+         just above nulls.  This algorithm does the reverse to
+         compensate - raising the amplitudes of spectral peaks, while
+         attenuating the null.  This enhances the formants, and
+         supresses the energy between formants. */
+
+      if (sim_pf) {
+          if (Am > model->A[m])
+              Am *= 0.7;
+          if (Am < model->A[m])
+              Am *= 1.4;
+      }
+
+      model->A[m] = Am;
+  }
+  *snr = 10.0*log10f(signal/noise);
+
+  PROFILE_SAMPLE_AND_LOG2(tpf, "      rec"); 
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_Wo()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Encodes Wo using a WO_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+int encode_Wo(float Wo, int bits)
+{
+    int   index, Wo_levels = 1<<bits;
+    float Wo_min = TWO_PI/P_MAX;
+    float Wo_max = TWO_PI/P_MIN;
+    float norm;
+
+    norm = (Wo - Wo_min)/(Wo_max - Wo_min);
+    index = floorf(Wo_levels * norm + 0.5);
+    if (index < 0 ) index = 0;
+    if (index > (Wo_levels-1)) index = Wo_levels-1;
+
+    return index;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_Wo()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Decodes Wo using a WO_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_Wo(int index, int bits)
+{
+    float Wo_min = TWO_PI/P_MAX;
+    float Wo_max = TWO_PI/P_MIN;
+    float step;
+    float Wo;
+    int   Wo_levels = 1<<bits;
+
+    step = (Wo_max - Wo_min)/Wo_levels;
+    Wo   = Wo_min + step*(index);
+
+    return Wo;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_log_Wo()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Encodes Wo in the log domain using a WO_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+int encode_log_Wo(float Wo, int bits)
+{
+    int   index, Wo_levels = 1<<bits;
+    float Wo_min = TWO_PI/P_MAX;
+    float Wo_max = TWO_PI/P_MIN;
+    float norm;
+
+    norm = (log10f(Wo) - log10f(Wo_min))/(log10f(Wo_max) - log10f(Wo_min));
+    index = floorf(Wo_levels * norm + 0.5);
+    if (index < 0 ) index = 0;
+    if (index > (Wo_levels-1)) index = Wo_levels-1;
+
+    return index;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_log_Wo()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Decodes Wo using a WO_LEVELS quantiser in the log domain.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_log_Wo(int index, int bits)
+{
+    float Wo_min = TWO_PI/P_MAX;
+    float Wo_max = TWO_PI/P_MIN;
+    float step;
+    float Wo;
+    int   Wo_levels = 1<<bits;
+
+    step = (log10f(Wo_max) - log10f(Wo_min))/Wo_levels;
+    Wo   = log10f(Wo_min) + step*(index);
+
+    return powf(10,Wo);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_Wo_dt()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 6 Nov 2011 
+
+  Encodes Wo difference from last frame.
+
+\*---------------------------------------------------------------------------*/
+
+int encode_Wo_dt(float Wo, float prev_Wo)
+{
+    int   index, mask, max_index, min_index;
+    float Wo_min = TWO_PI/P_MAX;
+    float Wo_max = TWO_PI/P_MIN;
+    float norm;
+
+    norm = (Wo - prev_Wo)/(Wo_max - Wo_min);
+    index = floorf(WO_LEVELS * norm + 0.5);
+    //printf("ENC index: %d ", index);
+
+    /* hard limit */
+    
+    max_index = (1 << (WO_DT_BITS-1)) - 1;
+    min_index = - (max_index+1);
+    if (index > max_index) index = max_index;
+    if (index < min_index) index = min_index;
+    //printf("max_index: %d  min_index: %d hard index: %d ",
+    //    max_index,  min_index, index);
+
+    /* mask so that only LSB WO_DT_BITS remain, bit WO_DT_BITS is the sign bit */
+
+    mask = ((1 << WO_DT_BITS) - 1);
+    index &= mask;
+    //printf("mask: 0x%x index: 0x%x\n", mask, index);
+
+    return index;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_Wo_dt()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 6 Nov 2011 
+
+  Decodes Wo using WO_DT_BITS difference from last frame.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_Wo_dt(int index, float prev_Wo)
+{
+    float Wo_min = TWO_PI/P_MAX;
+    float Wo_max = TWO_PI/P_MIN;
+    float step;
+    float Wo;
+    int   mask;
+
+    /* sign extend index */
+    
+    //printf("DEC index: %d ");
+    if (index & (1 << (WO_DT_BITS-1))) {
+       mask = ~((1 << WO_DT_BITS) - 1);
+       index |= mask;
+    }
+    //printf("DEC mask: 0x%x  index: %d \n", mask, index);
+    
+    step = (Wo_max - Wo_min)/WO_LEVELS;
+    Wo   = prev_Wo + step*(index);
+
+    /* bit errors can make us go out of range leading to all sorts of
+       probs like seg faults */
+
+    if (Wo > Wo_max) Wo = Wo_max;
+    if (Wo < Wo_min) Wo = Wo_min;
+
+    return Wo;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: speech_to_uq_lsps()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Analyse a windowed frame of time domain speech to determine LPCs
+  which are the converted to LSPs for quantisation and transmission
+  over the channel.
+
+\*---------------------------------------------------------------------------*/
+
+float speech_to_uq_lsps(float lsp[],
+                       float ak[],
+                       float Sn[], 
+                       float w[],
+                       int   order
+)
+{
+    int   i, roots;
+    float Wn[M];
+    float R[order+1];
+    float e, E;
+
+    e = 0.0;
+    for(i=0; i<M; i++) {
+       Wn[i] = Sn[i]*w[i];
+       e += Wn[i]*Wn[i];
+    }
+
+    /* trap 0 energy case as LPC analysis will fail */
+    
+    if (e == 0.0) {
+       for(i=0; i<order; i++)
+           lsp[i] = (PI/order)*(float)i;
+       return 0.0;
+    }
+    
+    autocorrelate(Wn, R, M, order);
+    levinson_durbin(R, ak, order);
+  
+    E = 0.0;
+    for(i=0; i<=order; i++)
+       E += ak[i]*R[i];
+    
+    /* 15 Hz BW expansion as I can't hear the difference and it may help
+       help occasional fails in the LSP root finding.  Important to do this
+       after energy calculation to avoid -ve energy values.
+    */
+
+    for(i=0; i<=order; i++)
+       ak[i] *= powf(0.994,(float)i);
+
+    roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1);
+    if (roots != order) {
+       /* if root finding fails use some benign LSP values instead */
+       for(i=0; i<order; i++)
+           lsp[i] = (PI/order)*(float)i;
+    }
+
+    return E;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_lsps_scalar()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Thirty-six bit sclar LSP quantiser. From a vector of unquantised
+  (floating point) LSPs finds the quantised LSP indexes.
+
+\*---------------------------------------------------------------------------*/
+
+void encode_lsps_scalar(int indexes[], float lsp[], int order)
+{
+    int    i,k,m;
+    float  wt[1];
+    float  lsp_hz[order];
+    const float * cb;
+    float se;
+
+    /* convert from radians to Hz so we can use human readable
+       frequencies */
+
+    for(i=0; i<order; i++)
+       lsp_hz[i] = (4000.0/PI)*lsp[i];
+    
+    /* scalar quantisers */
+
+    wt[0] = 1.0;
+    for(i=0; i<order; i++) {
+       k = lsp_cb[i].k;
+       m = lsp_cb[i].m;
+       cb = lsp_cb[i].cb;
+       indexes[i] = quantise(cb, &lsp_hz[i], wt, k, m, &se);
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_lsps_scalar()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  From a vector of quantised LSP indexes, returns the quantised
+  (floating point) LSPs.
+
+\*---------------------------------------------------------------------------*/
+
+void decode_lsps_scalar(float lsp[], int indexes[], int order)
+{
+    int    i,k;
+    float  lsp_hz[order];
+    const float * cb;
+
+    for(i=0; i<order; i++) {
+       k = lsp_cb[i].k;
+       cb = lsp_cb[i].cb;
+       lsp_hz[i] = cb[indexes[i]*k];
+    }
+
+    /* convert back to radians */
+
+    for(i=0; i<order; i++)
+       lsp[i] = (PI/4000.0)*lsp_hz[i];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_mels_scalar()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: April 2015 
+
+  Low bit rate mel coeff encoder.
+
+\*---------------------------------------------------------------------------*/
+
+void encode_mels_scalar(int indexes[], float mels[], int order)
+{
+    int    i,m;
+    float  wt[1];
+    const float * cb;
+    float se, mel_, dmel;
+    
+    /* scalar quantisers */
+
+    wt[0] = 1.0;
+    for(i=0; i<order; i++) {
+       m = mel_cb[i].m;
+       cb = mel_cb[i].cb;
+        if (i%2) {
+            /* on odd mels quantise difference */
+            mel_ = mel_cb[i-1].cb[indexes[i-1]];
+            dmel = mels[i] - mel_;
+            indexes[i] = quantise(cb, &dmel, wt, 1, m, &se);
+            //printf("%d mel: %f mel_: %f dmel: %f index: %d\n", i, mels[i], mel_, dmel, indexes[i]);
+        }
+        else {
+            indexes[i] = quantise(cb, &mels[i], wt, 1, m, &se);
+            //printf("%d mel: %f dmel: %f index: %d\n", i, mels[i], 0.0, indexes[i]);
+        }
+
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_mels_scalar()        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: April 2015 
+
+  From a vector of quantised mel indexes, returns the quantised
+  (floating point) mels.
+
+\*---------------------------------------------------------------------------*/
+
+void decode_mels_scalar(float mels[], int indexes[], int order)
+{
+    int    i;
+    const float * cb;
+
+    for(i=0; i<order; i++) {
+       cb = mel_cb[i].cb;
+        if (i%2) {
+            /* on odd mels quantise difference */
+            mels[i] = mels[i-1] + cb[indexes[i]];
+        }
+        else
+            mels[i] = cb[indexes[i]];
+    }
+
+}
+
+
+#ifdef __EXPERIMENTAL__
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_lsps_diff_freq_vq()          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 15 November 2011
+
+  Twenty-five bit LSP quantiser.  LSPs 1-4 are quantised with scalar
+  LSP differences (in frequency, i.e difference from the previous
+  LSP).  LSPs 5-10 are quantised with a VQ trained generated using
+  vqtrainjnd.c
+
+\*---------------------------------------------------------------------------*/
+
+void encode_lsps_diff_freq_vq(int indexes[], float lsp[], int order)
+{
+    int    i,k,m;
+    float  lsp_hz[order];
+    float lsp__hz[order];
+    float dlsp[order];
+    float dlsp_[order];
+    float wt[order];
+    const float * cb;
+    float se;
+
+    for(i=0; i<order; i++) {
+       wt[i] = 1.0;
+    }
+
+    /* convert from radians to Hz so we can use human readable
+       frequencies */
+
+    for(i=0; i<order; i++)
+       lsp_hz[i] = (4000.0/PI)*lsp[i];
+    
+    /* scalar quantisers for LSP differences 1..4 */
+
+    wt[0] = 1.0;
+    for(i=0; i<4; i++) {
+       if (i) 
+           dlsp[i] = lsp_hz[i] - lsp__hz[i-1];     
+       else
+           dlsp[0] = lsp_hz[0];
+
+       k = lsp_cbd[i].k;
+       m = lsp_cbd[i].m;
+       cb = lsp_cbd[i].cb;
+       indexes[i] = quantise(cb, &dlsp[i], wt, k, m, &se);
+       dlsp_[i] = cb[indexes[i]*k];
+
+       if (i) 
+           lsp__hz[i] = lsp__hz[i-1] + dlsp_[i];
+       else
+           lsp__hz[0] = dlsp_[0];
+    }
+
+    /* VQ LSPs 5,6,7,8,9,10 */
+
+    k = lsp_cbjnd[4].k;
+    m = lsp_cbjnd[4].m;
+    cb = lsp_cbjnd[4].cb;
+    indexes[4] = quantise(cb, &lsp_hz[4], &wt[4], k, m, &se);
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_lsps_diff_freq_vq()          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 15 Nov 2011
+
+  From a vector of quantised LSP indexes, returns the quantised
+  (floating point) LSPs.
+
+\*---------------------------------------------------------------------------*/
+
+void decode_lsps_diff_freq_vq(float lsp_[], int indexes[], int order)
+{
+    int    i,k,m;
+    float  dlsp_[order];
+    float  lsp__hz[order];
+    const float * cb;
+
+    /* scalar LSP differences */
+
+    for(i=0; i<4; i++) {
+       cb = lsp_cbd[i].cb;
+       dlsp_[i] = cb[indexes[i]];
+       if (i) 
+           lsp__hz[i] = lsp__hz[i-1] + dlsp_[i];
+       else
+           lsp__hz[0] = dlsp_[0];
+    }
+
+    /* VQ */
+
+    k = lsp_cbjnd[4].k;
+    m = lsp_cbjnd[4].m;
+    cb = lsp_cbjnd[4].cb;
+    for(i=4; i<order; i++)
+       lsp__hz[i] = cb[indexes[4]*k+i-4];
+
+    /* convert back to radians */
+
+    for(i=0; i<order; i++)
+       lsp_[i] = (PI/4000.0)*lsp__hz[i];
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_lsps_diff_time()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 12 Sep 2012
+
+  Encode difference from preious frames's LSPs using
+  3,3,2,2,2,2,1,1,1,1 scalar quantisers (18 bits total).
+
+\*---------------------------------------------------------------------------*/
+
+void encode_lsps_diff_time(int indexes[], 
+                              float lsps[], 
+                              float lsps__prev[], 
+                              int order)
+{
+    int    i,k,m;
+    float  lsps_dt[order];
+    float  wt[LPC_MAX];
+    const  float * cb;
+    float  se;
+
+    /* Determine difference in time and convert from radians to Hz so
+       we can use human readable frequencies */
+
+    for(i=0; i<order; i++) {
+       lsps_dt[i] = (4000/PI)*(lsps[i] - lsps__prev[i]);
+    }
+    
+    /* scalar quantisers */
+
+    wt[0] = 1.0;
+    for(i=0; i<order; i++) {
+       k = lsp_cbdt[i].k;
+       m = lsp_cbdt[i].m;
+       cb = lsp_cbdt[i].cb;
+       indexes[i] = quantise(cb, &lsps_dt[i], wt, k, m, &se);
+    }
+
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_lsps_diff_time()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 15 Nov 2011
+
+  From a quantised LSP indexes, returns the quantised
+  (floating point) LSPs.
+
+\*---------------------------------------------------------------------------*/
+
+void decode_lsps_diff_time(
+                             float lsps_[], 
+                             int indexes[], 
+                             float lsps__prev[],
+                             int order)
+{
+    int    i,k,m;
+    const  float * cb;
+
+    for(i=0; i<order; i++)
+       lsps_[i] = lsps__prev[i];
+
+    for(i=0; i<order; i++) {
+       k = lsp_cbdt[i].k;
+       cb = lsp_cbdt[i].cb;
+       lsps_[i] += (PI/4000.0)*cb[indexes[i]*k];
+    }
+
+}
+#endif
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_lsps_vq()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 15 Feb 2012
+
+  Multi-stage VQ LSP quantiser developed by Jean-Marc Valin.
+
+\*---------------------------------------------------------------------------*/
+
+void encode_lsps_vq(int *indexes, float *x, float *xq, int order)
+{
+  int i, n1, n2, n3;
+  float err[order], err2[order], err3[order];
+  float w[order], w2[order], w3[order];
+  const float *codebook1 = lsp_cbjvm[0].cb;
+  const float *codebook2 = lsp_cbjvm[1].cb;
+  const float *codebook3 = lsp_cbjvm[2].cb;
+
+  w[0] = MIN(x[0], x[1]-x[0]);
+  for (i=1;i<order-1;i++)
+    w[i] = MIN(x[i]-x[i-1], x[i+1]-x[i]);
+  w[order-1] = MIN(x[order-1]-x[order-2], PI-x[order-1]);
+  
+  compute_weights(x, w, order);
+  
+  n1 = find_nearest(codebook1, lsp_cbjvm[0].m, x, order);
+  
+  for (i=0;i<order;i++)
+  {
+    xq[i]  = codebook1[order*n1+i];
+    err[i] = x[i] - xq[i];
+  }
+  for (i=0;i<order/2;i++)
+  {
+    err2[i] = err[2*i];  
+    err3[i] = err[2*i+1];
+    w2[i] = w[2*i];  
+    w3[i] = w[2*i+1];
+  }
+  n2 = find_nearest_weighted(codebook2, lsp_cbjvm[1].m, err2, w2, order/2);
+  n3 = find_nearest_weighted(codebook3, lsp_cbjvm[2].m, err3, w3, order/2);
+  
+  indexes[0] = n1;
+  indexes[1] = n2;
+  indexes[2] = n3;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_lsps_vq()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 15 Feb 2012
+
+\*---------------------------------------------------------------------------*/
+
+void decode_lsps_vq(int *indexes, float *xq, int order, int stages)
+{
+  int i, n1, n2, n3;
+  const float *codebook1 = lsp_cbjvm[0].cb;
+  const float *codebook2 = lsp_cbjvm[1].cb;
+  const float *codebook3 = lsp_cbjvm[2].cb;
+
+  n1 = indexes[0];
+  n2 = indexes[1];
+  n3 = indexes[2];
+
+  for (i=0;i<order;i++) {
+      xq[i] = codebook1[order*n1+i];
+  }
+  
+  if (stages != 1) {
+      for (i=0;i<order/2;i++) {
+          xq[2*i] += codebook2[order*n2/2+i];
+          xq[2*i+1] += codebook3[order*n3/2+i];
+      }
+  }
+  
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: bw_expand_lsps()            
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Applies Bandwidth Expansion (BW) to a vector of LSPs.  Prevents any
+  two LSPs getting too close together after quantisation.  We know
+  from experiment that LSP quantisation errors < 12.5Hz (25Hz step
+  size) are inaudible so we use that as the minimum LSP separation.
+
+\*---------------------------------------------------------------------------*/
+
+void bw_expand_lsps(float lsp[], int order, float min_sep_low, float min_sep_high)
+{
+    int i;
+
+    for(i=1; i<4; i++) {
+       
+       if ((lsp[i] - lsp[i-1]) < min_sep_low*(PI/4000.0))
+           lsp[i] = lsp[i-1] + min_sep_low*(PI/4000.0);
+       
+    }
+
+    /* As quantiser gaps increased, larger BW expansion was required
+       to prevent twinkly noises.  This may need more experiment for
+       different quanstisers.
+    */
+
+    for(i=4; i<order; i++) {
+       if (lsp[i] - lsp[i-1] < min_sep_high*(PI/4000.0))
+           lsp[i] = lsp[i-1] + min_sep_high*(PI/4000.0);
+    }
+}
+
+void bw_expand_lsps2(float lsp[],
+                   int   order
+)
+{
+    int i;
+
+    for(i=1; i<4; i++) {
+       
+       if ((lsp[i] - lsp[i-1]) < 100.0*(PI/4000.0))
+           lsp[i] = lsp[i-1] + 100.0*(PI/4000.0);
+       
+    }
+
+    /* As quantiser gaps increased, larger BW expansion was required
+       to prevent twinkly noises.  This may need more experiment for
+       different quanstisers.
+    */
+
+    for(i=4; i<order; i++) {
+       if (lsp[i] - lsp[i-1] < 200.0*(PI/4000.0))
+           lsp[i] = lsp[i-1] + 200.0*(PI/4000.0);
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: locate_lsps_jnd_steps()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 27/10/2011 
+
+  Applies a form of Bandwidth Expansion (BW) to a vector of LSPs.
+  Listening tests have determined that "quantising" the position of
+  each LSP to the non-linear steps below introduces a "just noticable
+  difference" in the synthesised speech.
+
+  This operation can be used before quantisation to limit the input
+  data to the quantiser to a number of discrete steps.
+
+  This operation can also be used during quantisation as a form of
+  hysteresis in the calculation of quantiser error.  For example if
+  the quantiser target of lsp1 is 500 Hz, candidate vectors with lsp1
+  of 515 and 495 Hz sound effectively the same.
+
+\*---------------------------------------------------------------------------*/
+
+void locate_lsps_jnd_steps(float lsps[], int order)
+{
+    int   i;
+    float lsp_hz, step;
+
+    assert(order == 10);
+
+    /* quantise to 25Hz steps */
+           
+    step = 25;
+    for(i=0; i<2; i++) {
+       lsp_hz = lsps[i]*4000.0/PI;
+       lsp_hz = floorf(lsp_hz/step + 0.5)*step;
+       lsps[i] = lsp_hz*PI/4000.0;
+       if (i) {
+           if (lsps[i] == lsps[i-1])
+               lsps[i]   += step*PI/4000.0;
+
+       }
+    }
+
+    /* quantise to 50Hz steps */
+
+    step = 50;
+    for(i=2; i<4; i++) {
+       lsp_hz = lsps[i]*4000.0/PI;
+       lsp_hz = floorf(lsp_hz/step + 0.5)*step;
+       lsps[i] = lsp_hz*PI/4000.0;
+       if (i) {
+           if (lsps[i] == lsps[i-1])
+               lsps[i] += step*PI/4000.0;
+
+       }
+    }
+
+    /* quantise to 100Hz steps */
+
+    step = 100;
+    for(i=4; i<10; i++) {
+       lsp_hz = lsps[i]*4000.0/PI;
+       lsp_hz = floorf(lsp_hz/step + 0.5)*step;
+       lsps[i] = lsp_hz*PI/4000.0;
+       if (i) {
+           if (lsps[i] == lsps[i-1])
+               lsps[i] += step*PI/4000.0;
+
+       }
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: apply_lpc_correction()      
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Apply first harmonic LPC correction at decoder.  This helps improve
+  low pitch males after LPC modelling, like hts1a and morig.
+
+\*---------------------------------------------------------------------------*/
+
+void apply_lpc_correction(MODEL *model)
+{
+    if (model->Wo < (PI*150.0/4000)) {
+       model->A[1] *= 0.032;
+    }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_energy()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Encodes LPC energy using an E_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+int encode_energy(float e, int bits)
+{
+    int   index, e_levels = 1<<bits;
+    float e_min = E_MIN_DB;
+    float e_max = E_MAX_DB;
+    float norm;
+
+    e = 10.0*log10f(e);
+    norm = (e - e_min)/(e_max - e_min);
+    index = floorf(e_levels * norm + 0.5);
+    if (index < 0 ) index = 0;
+    if (index > (e_levels-1)) index = e_levels-1;
+
+    return index;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_energy()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Decodes energy using a E_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_energy(int index, int bits)
+{
+    float e_min = E_MIN_DB;
+    float e_max = E_MAX_DB;
+    float step;
+    float e;
+    int   e_levels = 1<<bits;
+
+    step = (e_max - e_min)/e_levels;
+    e    = e_min + step*(index);
+    e    = powf(10.0,e/10.0);
+
+    return e;
+}
+
+#ifdef NOT_USED
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_amplitudes()         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 22/8/2010 
+
+  Given the amplitude quantiser indexes recovers the harmonic
+  amplitudes.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_amplitudes(kiss_fft_cfg  fft_fwd_cfg, 
+                       MODEL *model, 
+                       float  ak[],
+                       int    lsp_indexes[], 
+                       int    energy_index,
+                       float  lsps[],
+                       float *e
+)
+{
+    float snr;
+
+    decode_lsps_scalar(lsps, lsp_indexes, LPC_ORD);
+    bw_expand_lsps(lsps, LPC_ORD);
+    lsp_to_lpc(lsps, ak, LPC_ORD);
+    *e = decode_energy(energy_index);
+    aks_to_M2(ak, LPC_ORD, model, *e, &snr, 1, 0, 0, 1); 
+    apply_lpc_correction(model);
+
+    return snr;
+}
+#endif
+
+static float ge_coeff[2] = {0.8, 0.9};
+
+void compute_weights2(const float *x, const float *xp, float *w)
+{
+  w[0] = 30;
+  w[1] = 1;
+  if (x[1]<0)
+  {
+     w[0] *= .6;
+     w[1] *= .3;
+  }
+  if (x[1]<-10)
+  {
+     w[0] *= .3;
+     w[1] *= .3;
+  }
+  /* Higher weight if pitch is stable */
+  if (fabsf(x[0]-xp[0])<.2)
+  {
+     w[0] *= 2;
+     w[1] *= 1.5;
+  } else if (fabsf(x[0]-xp[0])>.5) /* Lower if not stable */
+  {
+     w[0] *= .5;
+  }
+
+  /* Lower weight for low energy */
+  if (x[1] < xp[1]-10)
+  {
+     w[1] *= .5;
+  }
+  if (x[1] < xp[1]-20)
+  {
+     w[1] *= .5;
+  }
+
+  //w[0] = 30;
+  //w[1] = 1;
+  
+  /* Square the weights because it's applied on the squared error */
+  w[0] *= w[0];
+  w[1] *= w[1];
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: quantise_WoE()      
+  AUTHOR......: Jean-Marc Valin & David Rowe                         
+  DATE CREATED: 29 Feb 2012
+
+  Experimental joint Wo and LPC energy vector quantiser developed by
+  Jean-Marc Valin.  Exploits correlations between the difference in
+  the log pitch and log energy from frame to frame.  For example
+  both the pitch and energy tend to only change by small amounts
+  during voiced speech, however it is important that these changes be
+  coded carefully.  During unvoiced speech they both change a lot but
+  the ear is less sensitve to errors so coarser quantisation is OK.
+
+  The ear is sensitive to log energy and loq pitch so we quantise in
+  these domains.  That way the error measure used to quantise the
+  values is close to way the ear senses errors.
+  
+  See http://jmspeex.livejournal.com/10446.html
+
+\*---------------------------------------------------------------------------*/
+
+void quantise_WoE(MODEL *model, float *e, float xq[])
+{
+  int          i, n1;
+  float        x[2];
+  float        err[2];
+  float        w[2];
+  const float *codebook1 = ge_cb[0].cb;
+  int          nb_entries = ge_cb[0].m;
+  int          ndim = ge_cb[0].k;
+  float Wo_min = TWO_PI/P_MAX;
+  float Wo_max = TWO_PI/P_MIN;
+
+  x[0] = log10f((model->Wo/PI)*4000.0/50.0)/log10f(2);
+  x[1] = 10.0*log10f(1e-4 + *e);
+
+  compute_weights2(x, xq, w);
+  for (i=0;i<ndim;i++)
+    err[i] = x[i]-ge_coeff[i]*xq[i];
+  n1 = find_nearest_weighted(codebook1, nb_entries, err, w, ndim);
+  
+  for (i=0;i<ndim;i++)
+  {
+    xq[i] = ge_coeff[i]*xq[i] + codebook1[ndim*n1+i];
+    err[i] -= codebook1[ndim*n1+i];
+  }
+
+  /*
+    x = log2(4000*Wo/(PI*50));
+    2^x = 4000*Wo/(PI*50)
+    Wo = (2^x)*(PI*50)/4000;
+  */
+  
+  model->Wo = powf(2.0, xq[0])*(PI*50.0)/4000.0;
+
+  /* bit errors can make us go out of range leading to all sorts of
+     probs like seg faults */
+
+  if (model->Wo > Wo_max) model->Wo = Wo_max;
+  if (model->Wo < Wo_min) model->Wo = Wo_min;
+
+  model->L  = PI/model->Wo; /* if we quantise Wo re-compute L */
+
+  *e = powf(10.0, xq[1]/10.0);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: encode_WoE()        
+  AUTHOR......: Jean-Marc Valin & David Rowe                         
+  DATE CREATED: 11 May 2012
+
+  Joint Wo and LPC energy vector quantiser developed my Jean-Marc
+  Valin.  Returns index, and updated states xq[].
+  
+\*---------------------------------------------------------------------------*/
+
+int encode_WoE(MODEL *model, float e, float xq[])
+{
+  int          i, n1;
+  float        x[2];
+  float        err[2];
+  float        w[2];
+  const float *codebook1 = ge_cb[0].cb;
+  int          nb_entries = ge_cb[0].m;
+  int          ndim = ge_cb[0].k;
+
+  assert((1<<WO_E_BITS) == nb_entries);
+
+  if (e < 0.0) e = 0;  /* occasional small negative energies due LPC round off I guess */
+
+  x[0] = log10f((model->Wo/PI)*4000.0/50.0)/log10f(2);
+  x[1] = 10.0*log10f(1e-4 + e);
+
+  compute_weights2(x, xq, w);
+  for (i=0;i<ndim;i++)
+    err[i] = x[i]-ge_coeff[i]*xq[i];
+  n1 = find_nearest_weighted(codebook1, nb_entries, err, w, ndim);
+  
+  for (i=0;i<ndim;i++)
+  {
+    xq[i] = ge_coeff[i]*xq[i] + codebook1[ndim*n1+i];
+    err[i] -= codebook1[ndim*n1+i];
+  }
+
+  //printf("enc: %f %f (%f)(%f) \n", xq[0], xq[1], e, 10.0*log10(1e-4 + e));
+  return n1;
+}
+
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: decode_WoE()        
+  AUTHOR......: Jean-Marc Valin & David Rowe                         
+  DATE CREATED: 11 May 2012
+
+  Joint Wo and LPC energy vector quantiser developed my Jean-Marc
+  Valin.  Given index and states xq[], returns Wo & E, and updates
+  states xq[].
+  
+\*---------------------------------------------------------------------------*/
+
+void decode_WoE(MODEL *model, float *e, float xq[], int n1)
+{
+  int          i;
+  const float *codebook1 = ge_cb[0].cb;
+  int          ndim = ge_cb[0].k;
+  float Wo_min = TWO_PI/P_MAX;
+  float Wo_max = TWO_PI/P_MIN;
+
+  for (i=0;i<ndim;i++)
+  {
+    xq[i] = ge_coeff[i]*xq[i] + codebook1[ndim*n1+i];
+  }
+
+  //printf("dec: %f %f\n", xq[0], xq[1]);
+  model->Wo = powf(2.0, xq[0])*(PI*50.0)/4000.0;
+
+  /* bit errors can make us go out of range leading to all sorts of
+     probs like seg faults */
+
+  if (model->Wo > Wo_max) model->Wo = Wo_max;
+  if (model->Wo < Wo_min) model->Wo = Wo_min;
+
+  model->L  = PI/model->Wo; /* if we quantise Wo re-compute L */
+
+  *e = powf(10.0, xq[1]/10.0);
+}
+
diff --git a/codec2/tags/0.4/src/quantise.h b/codec2/tags/0.4/src/quantise.h
new file mode 100644 (file)
index 0000000..c9246c6
--- /dev/null
@@ -0,0 +1,133 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: quantise.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 31/5/92                                                       
+                                                                             
+  Quantisation functions for the sinusoidal coder.  
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  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 __QUANTISE__
+#define __QUANTISE__
+
+#include "kiss_fft.h"
+#include "comp.h"
+
+#define WO_BITS     7
+#define WO_LEVELS   (1<<WO_BITS)
+#define WO_DT_BITS  3
+
+#define E_BITS      5
+#define E_LEVELS    (1<<E_BITS)
+#define E_MIN_DB   -10.0
+#define E_MAX_DB    40.0
+
+#define LSP_SCALAR_INDEXES    10
+#define LSPD_SCALAR_INDEXES    10
+#define LSP_PRED_VQ_INDEXES    3
+#define LSP_DIFF_FREQ_INDEXES  5
+#define LSP_DIFF_TIME_BITS     7
+
+#define LSPDT_ALL   0
+#define LSPDT_LOW   1
+#define LSPDT_HIGH  2
+
+#define WO_E_BITS   8
+
+#define LPCPF_GAMMA 0.5
+#define LPCPF_BETA  0.2
+
+void quantise_init();
+float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order,
+                          int lsp,float ak[]);
+void aks_to_M2(kiss_fft_cfg fft_fwd_cfg, float ak[], int order, MODEL *model, 
+              float E, float *snr, int dump, int sim_pf, 
+               int pf, int bass_boost, float beta, float gamma, COMP Aw[]);
+
+int   encode_Wo(float Wo, int bits);
+float decode_Wo(int index, int bits);
+int   encode_log_Wo(float Wo, int bits);
+float decode_log_Wo(int index, int bits);
+int   encode_Wo_dt(float Wo, float prev_Wo);
+float decode_Wo_dt(int index, float prev_Wo);
+void  encode_lsps_scalar(int indexes[], float lsp[], int order);
+void  decode_lsps_scalar(float lsp[], int indexes[], int order);
+void  encode_lspds_scalar(int indexes[], float lsp[], int order);
+void  decode_lspds_scalar(float lsp[], int indexes[], int order);
+void  encode_lsps_diff_freq_vq(int indexes[], float lsp[], int order);
+void  decode_lsps_diff_freq_vq(float lsp_[], int indexes[], int order);
+void  encode_lsps_diff_time(int indexes[], 
+                           float lsp[], 
+                           float lsp__prev[], 
+                           int order);
+void decode_lsps_diff_time(float lsp_[], 
+                          int indexes[], 
+                          float lsp__prev[],
+                          int order);
+
+void encode_lsps_vq(int *indexes, float *x, float *xq, int order);
+void decode_lsps_vq(int *indexes, float *xq, int order, int stages);
+
+long quantise(const float * cb, float vec[], float w[], int k, int m, float *se);
+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, int mbest_entries);
+
+void encode_mels_scalar(int mel_indexes[], float mels[], int order);
+void decode_mels_scalar(float mels[], int mel_indexes[], int order);
+
+void quantise_WoE(MODEL *model, float *e, float xq[]);
+int  encode_WoE(MODEL *model, float e, float xq[]);
+void decode_WoE(MODEL *model, float *e, float xq[], int n1);
+
+int encode_energy(float e, int bits);
+float decode_energy(int index, int bits);
+
+void pack(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits);
+void pack_natural_or_gray(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits, unsigned int gray);
+int  unpack(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits);
+int  unpack_natural_or_gray(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits, unsigned int gray);
+
+int lsp_bits(int i);
+int lspd_bits(int i);
+int lspdt_bits(int i);
+int lsp_pred_vq_bits(int i);
+int mel_bits(int i);
+
+void apply_lpc_correction(MODEL *model);
+float speech_to_uq_lsps(float lsp[],
+                       float ak[],
+                       float Sn[], 
+                       float w[],
+                       int   order
+                       );
+int check_lsp_order(float lsp[], int lpc_order);
+void bw_expand_lsps(float lsp[], int order, float min_sep_low, float min_sep_high);
+void bw_expand_lsps2(float lsp[], int order);
+void locate_lsps_jnd_steps(float lsp[], int order);
+float decode_amplitudes(MODEL *model, 
+                       float  ak[],
+                       int    lsp_indexes[], 
+                       int    energy_index,
+                       float  lsps[],
+                       float *e);
+
+#endif
diff --git a/codec2/tags/0.4/src/rn.h b/codec2/tags/0.4/src/rn.h
new file mode 100644 (file)
index 0000000..934f458
--- /dev/null
@@ -0,0 +1,964 @@
+/* Generated by rn_file() Octave function */
+
+const float gt_alpha5_root[]={
+  2.86997e-05,
+  2.2286e-05,
+  1.82863e-05,
+  1.42303e-05,
+  1.04905e-05,
+  6.70859e-06,
+  3.05918e-06,
+  -6.22187e-07,
+  -4.22748e-06,
+  -7.85603e-06,
+  -1.14317e-05,
+  -1.50227e-05,
+  -1.85712e-05,
+  -2.21275e-05,
+  -2.56455e-05,
+  -2.91642e-05,
+  -3.26453e-05,
+  -3.61199e-05,
+  -3.95556e-05,
+  -4.29778e-05,
+  -4.63581e-05,
+  -4.97179e-05,
+  -5.3032e-05,
+  -5.63184e-05,
+  -5.95548e-05,
+  -6.27565e-05,
+  -6.59032e-05,
+  -6.90085e-05,
+  -7.20538e-05,
+  -7.50509e-05,
+  -7.7983e-05,
+  -8.08605e-05,
+  -8.36678e-05,
+  -8.64141e-05,
+  -8.9085e-05,
+  -9.16888e-05,
+  -9.42119e-05,
+  -9.66619e-05,
+  -9.9026e-05,
+  -0.000101311,
+  -0.000103505,
+  -0.000105614,
+  -0.000107627,
+  -0.00010955,
+  -0.000111372,
+  -0.000113099,
+  -0.00011472,
+  -0.000116241,
+  -0.000117652,
+  -0.000118959,
+  -0.000120152,
+  -0.000121235,
+  -0.000122201,
+  -0.000123053,
+  -0.000123784,
+  -0.000124397,
+  -0.000124884,
+  -0.00012525,
+  -0.000125487,
+  -0.000125598,
+  -0.000125578,
+  -0.000125428,
+  -0.000125145,
+  -0.000124729,
+  -0.000124185,
+  -0.000123518,
+  -0.000122709,
+  -0.000121766,
+  -0.000120685,
+  -0.000119471,
+  -0.000118119,
+  -0.000116633,
+  -0.000115009,
+  -0.000113251,
+  -0.000111356,
+  -0.000109326,
+  -0.00010716,
+  -0.00010486,
+  -0.000102424,
+  -9.98553e-05,
+  -9.71528e-05,
+  -9.43199e-05,
+  -9.13551e-05,
+  -8.82623e-05,
+  -8.50404e-05,
+  -8.16936e-05,
+  -7.82211e-05,
+  -7.46271e-05,
+  -7.09109e-05,
+  -6.70773e-05,
+  -6.31256e-05,
+  -5.90607e-05,
+  -5.48823e-05,
+  -5.05954e-05,
+  -4.62001e-05,
+  -4.17016e-05,
+  -3.71002e-05,
+  -3.24015e-05,
+  -2.7606e-05,
+  -2.27195e-05,
+  -1.77428e-05,
+  -1.2682e-05,
+  -7.53795e-06,
+  -2.31702e-06,
+  2.97965e-06,
+  8.34567e-06,
+  1.37796e-05,
+  1.9275e-05,
+  2.483e-05,
+  3.04382e-05,
+  3.60975e-05,
+  4.18011e-05,
+  4.75467e-05,
+  5.33273e-05,
+  5.91403e-05,
+  6.49787e-05,
+  7.08393e-05,
+  7.67152e-05,
+  8.26029e-05,
+  8.84957e-05,
+  9.43895e-05,
+  0.000100278,
+  0.000106157,
+  0.00011202,
+  0.000117864,
+  0.000123681,
+  0.000129468,
+  0.000135218,
+  0.000140929,
+  0.000146583,
+  0.000152183,
+  0.000157725,
+  0.000163202,
+  0.000168608,
+  0.000173938,
+  0.000179183,
+  0.00018434,
+  0.0001894,
+  0.00019436,
+  0.000199211,
+  0.000203949,
+  0.000208568,
+  0.000213063,
+  0.000217426,
+  0.000221654,
+  0.00022574,
+  0.000229678,
+  0.000233463,
+  0.000237089,
+  0.000240551,
+  0.000243843,
+  0.000246959,
+  0.000249895,
+  0.000252644,
+  0.000255202,
+  0.000257562,
+  0.000259721,
+  0.000261672,
+  0.000263411,
+  0.000264933,
+  0.000266234,
+  0.000267308,
+  0.000268152,
+  0.00026876,
+  0.000269128,
+  0.000269253,
+  0.000269129,
+  0.000268754,
+  0.000268123,
+  0.000267232,
+  0.000266079,
+  0.000264658,
+  0.000262968,
+  0.000261006,
+  0.000258767,
+  0.000256251,
+  0.000253453,
+  0.000250373,
+  0.000247007,
+  0.000243354,
+  0.000239412,
+  0.00023518,
+  0.000230655,
+  0.000225837,
+  0.000220723,
+  0.000215314,
+  0.000209608,
+  0.000203605,
+  0.000197304,
+  0.000190706,
+  0.000183812,
+  0.000176621,
+  0.000169145,
+  0.000161363,
+  0.000153275,
+  0.000144895,
+  0.000136224,
+  0.000127266,
+  0.00011802,
+  0.000108491,
+  9.8679e-05,
+  8.85877e-05,
+  7.82196e-05,
+  6.7577e-05,
+  5.66636e-05,
+  4.54822e-05,
+  3.40369e-05,
+  2.23311e-05,
+  1.03695e-05,
+  -1.844e-06,
+  -1.43041e-05,
+  -2.70061e-05,
+  -3.99444e-05,
+  -5.31139e-05,
+  -6.65082e-05,
+  -8.01218e-05,
+  -9.39481e-05,
+  -0.000107981,
+  -0.000122213,
+  -0.000136638,
+  -0.000151248,
+  -0.000166036,
+  -0.000180995,
+  -0.000196115,
+  -0.00021139,
+  -0.000226811,
+  -0.000242369,
+  -0.000258056,
+  -0.000273861,
+  -0.000289776,
+  -0.000305792,
+  -0.000321898,
+  -0.000338084,
+  -0.000354342,
+  -0.00037066,
+  -0.000387027,
+  -0.000403434,
+  -0.00041987,
+  -0.000436324,
+  -0.000452784,
+  -0.00046924,
+  -0.00048568,
+  -0.000502091,
+  -0.000518464,
+  -0.000534785,
+  -0.000551043,
+  -0.000567225,
+  -0.000583319,
+  -0.000599314,
+  -0.000615196,
+  -0.000630955,
+  -0.000646575,
+  -0.000662049,
+  -0.000677361,
+  -0.000692506,
+  -0.000707464,
+  -0.00072229,
+  -0.000736922,
+  -0.000751266,
+  -0.000765372,
+  -0.000779217,
+  -0.000792798,
+  -0.000806094,
+  -0.000819098,
+  -0.000831793,
+  -0.000844168,
+  -0.000856207,
+  -0.000867898,
+  -0.000879227,
+  -0.00089018,
+  -0.000900744,
+  -0.000910906,
+  -0.000920652,
+  -0.00092997,
+  -0.000938844,
+  -0.000947263,
+  -0.000955214,
+  -0.000962682,
+  -0.000969654,
+  -0.000976119,
+  -0.000982062,
+  -0.00098747,
+  -0.000992332,
+  -0.000996634,
+  -0.00100036,
+  -0.00100351,
+  -0.00100606,
+  -0.001008,
+  -0.00100932,
+  -0.00101,
+  -0.00101005,
+  -0.00100943,
+  -0.00100816,
+  -0.0010062,
+  -0.00100356,
+  -0.00100021,
+  -0.000996162,
+  -0.000991392,
+  -0.000985892,
+  -0.000979654,
+  -0.000972668,
+  -0.000964925,
+  -0.000956415,
+  -0.000947131,
+  -0.000937065,
+  -0.000926208,
+  -0.000914552,
+  -0.00090209,
+  -0.000888816,
+  -0.000874721,
+  -0.0008598,
+  -0.000844046,
+  -0.000827453,
+  -0.000810015,
+  -0.000791726,
+  -0.000772581,
+  -0.000752576,
+  -0.000731704,
+  -0.000709965,
+  -0.00068735,
+  -0.000663865,
+  -0.000639509,
+  -0.000614269,
+  -0.000588146,
+  -0.000561139,
+  -0.000533246,
+  -0.000504468,
+  -0.000474802,
+  -0.000444251,
+  -0.000412813,
+  -0.00038049,
+  -0.000347281,
+  -0.000313189,
+  -0.000278215,
+  -0.000242361,
+  -0.000205629,
+  -0.000168024,
+  -0.000129546,
+  -9.02024e-05,
+  -4.99954e-05,
+  -8.93026e-06,
+  3.2988e-05,
+  7.57537e-05,
+  0.000119361,
+  0.000163804,
+  0.000209075,
+  0.000255167,
+  0.000302074,
+  0.000349786,
+  0.000398297,
+  0.000447596,
+  0.000497676,
+  0.000548526,
+  0.000600136,
+  0.000652497,
+  0.000705598,
+  0.000759427,
+  0.000813972,
+  0.000869223,
+  0.000925166,
+  0.000981789,
+  0.00103908,
+  0.00109702,
+  0.00115561,
+  0.00121482,
+  0.00127464,
+  0.00133505,
+  0.00139605,
+  0.00145762,
+  0.00151973,
+  0.00158238,
+  0.00164555,
+  0.00170922,
+  0.00177337,
+  0.00183799,
+  0.00190305,
+  0.00196854,
+  0.00203445,
+  0.00210075,
+  0.00216742,
+  0.00223445,
+  0.00230181,
+  0.00236949,
+  0.00243747,
+  0.00250572,
+  0.00257423,
+  0.00264296,
+  0.00271192,
+  0.00278107,
+  0.00285039,
+  0.00291986,
+  0.00298947,
+  0.00305918,
+  0.00312898,
+  0.00319884,
+  0.00326874,
+  0.00333866,
+  0.00340857,
+  0.00347846,
+  0.00354831,
+  0.00361808,
+  0.00368775,
+  0.00375731,
+  0.00382673,
+  0.00389599,
+  0.00396506,
+  0.00403393,
+  0.00410256,
+  0.00417094,
+  0.00423904,
+  0.00430684,
+  0.00437431,
+  0.00444144,
+  0.0045082,
+  0.00457457,
+  0.00464052,
+  0.00470603,
+  0.00477108,
+  0.00483565,
+  0.00489972,
+  0.00496325,
+  0.00502623,
+  0.00508865,
+  0.00515046,
+  0.00521166,
+  0.00527223,
+  0.00533213,
+  0.00539135,
+  0.00544987,
+  0.00550766,
+  0.00556472,
+  0.005621,
+  0.00567651,
+  0.00573121,
+  0.00578508,
+  0.00583811,
+  0.00589028,
+  0.00594157,
+  0.00599196,
+  0.00604143,
+  0.00608996,
+  0.00613754,
+  0.00618415,
+  0.00622977,
+  0.00627439,
+  0.00631798,
+  0.00636054,
+  0.00640204,
+  0.0064425,
+  0.00648186,
+  0.00652009,
+  0.00655722,
+  0.00659322,
+  0.00662808,
+  0.00666179,
+  0.00669433,
+  0.00672571,
+  0.00675589,
+  0.00678488,
+  0.00681266,
+  0.00683921,
+  0.00686454,
+  0.00688863,
+  0.00691147,
+  0.00693305,
+  0.00695336,
+  0.0069724,
+  0.00699016,
+  0.00700663,
+  0.00702181,
+  0.00703569,
+  0.00704826,
+  0.00705952,
+  0.00706947,
+  0.00707809,
+  0.0070854,
+  0.00709138,
+  0.00709604,
+  0.00709937,
+  0.00710136,
+  0.00710203,
+  0.00710136,
+  0.00709937,
+  0.00709604,
+  0.00709138,
+  0.0070854,
+  0.00707809,
+  0.00706947,
+  0.00705952,
+  0.00704826,
+  0.00703569,
+  0.00702181,
+  0.00700663,
+  0.00699016,
+  0.0069724,
+  0.00695336,
+  0.00693305,
+  0.00691147,
+  0.00688863,
+  0.00686454,
+  0.00683921,
+  0.00681266,
+  0.00678488,
+  0.00675589,
+  0.00672571,
+  0.00669433,
+  0.00666179,
+  0.00662808,
+  0.00659322,
+  0.00655722,
+  0.00652009,
+  0.00648186,
+  0.0064425,
+  0.00640204,
+  0.00636054,
+  0.00631798,
+  0.00627439,
+  0.00622977,
+  0.00618415,
+  0.00613754,
+  0.00608996,
+  0.00604143,
+  0.00599196,
+  0.00594157,
+  0.00589028,
+  0.00583811,
+  0.00578508,
+  0.00573121,
+  0.00567651,
+  0.005621,
+  0.00556472,
+  0.00550766,
+  0.00544987,
+  0.00539135,
+  0.00533213,
+  0.00527223,
+  0.00521166,
+  0.00515046,
+  0.00508865,
+  0.00502623,
+  0.00496325,
+  0.00489972,
+  0.00483565,
+  0.00477108,
+  0.00470603,
+  0.00464052,
+  0.00457457,
+  0.0045082,
+  0.00444144,
+  0.00437431,
+  0.00430684,
+  0.00423904,
+  0.00417094,
+  0.00410256,
+  0.00403393,
+  0.00396506,
+  0.00389599,
+  0.00382673,
+  0.00375731,
+  0.00368775,
+  0.00361808,
+  0.00354831,
+  0.00347846,
+  0.00340857,
+  0.00333866,
+  0.00326874,
+  0.00319884,
+  0.00312898,
+  0.00305918,
+  0.00298947,
+  0.00291986,
+  0.00285039,
+  0.00278107,
+  0.00271192,
+  0.00264296,
+  0.00257423,
+  0.00250572,
+  0.00243747,
+  0.00236949,
+  0.00230181,
+  0.00223445,
+  0.00216742,
+  0.00210075,
+  0.00203445,
+  0.00196854,
+  0.00190305,
+  0.00183799,
+  0.00177337,
+  0.00170922,
+  0.00164555,
+  0.00158238,
+  0.00151973,
+  0.00145762,
+  0.00139605,
+  0.00133505,
+  0.00127464,
+  0.00121482,
+  0.00115561,
+  0.00109702,
+  0.00103908,
+  0.000981789,
+  0.000925166,
+  0.000869223,
+  0.000813972,
+  0.000759427,
+  0.000705598,
+  0.000652497,
+  0.000600136,
+  0.000548526,
+  0.000497676,
+  0.000447596,
+  0.000398297,
+  0.000349786,
+  0.000302074,
+  0.000255167,
+  0.000209075,
+  0.000163804,
+  0.000119361,
+  7.57537e-05,
+  3.2988e-05,
+  -8.93026e-06,
+  -4.99954e-05,
+  -9.02024e-05,
+  -0.000129546,
+  -0.000168024,
+  -0.000205629,
+  -0.000242361,
+  -0.000278215,
+  -0.000313189,
+  -0.000347281,
+  -0.00038049,
+  -0.000412813,
+  -0.000444251,
+  -0.000474802,
+  -0.000504468,
+  -0.000533246,
+  -0.000561139,
+  -0.000588146,
+  -0.000614269,
+  -0.000639509,
+  -0.000663865,
+  -0.00068735,
+  -0.000709965,
+  -0.000731704,
+  -0.000752576,
+  -0.000772581,
+  -0.000791726,
+  -0.000810015,
+  -0.000827453,
+  -0.000844046,
+  -0.0008598,
+  -0.000874721,
+  -0.000888816,
+  -0.00090209,
+  -0.000914552,
+  -0.000926208,
+  -0.000937065,
+  -0.000947131,
+  -0.000956415,
+  -0.000964925,
+  -0.000972668,
+  -0.000979654,
+  -0.000985892,
+  -0.000991392,
+  -0.000996162,
+  -0.00100021,
+  -0.00100356,
+  -0.0010062,
+  -0.00100816,
+  -0.00100943,
+  -0.00101005,
+  -0.00101,
+  -0.00100932,
+  -0.001008,
+  -0.00100606,
+  -0.00100351,
+  -0.00100036,
+  -0.000996634,
+  -0.000992332,
+  -0.00098747,
+  -0.000982062,
+  -0.000976119,
+  -0.000969654,
+  -0.000962682,
+  -0.000955214,
+  -0.000947263,
+  -0.000938844,
+  -0.00092997,
+  -0.000920652,
+  -0.000910906,
+  -0.000900744,
+  -0.00089018,
+  -0.000879227,
+  -0.000867898,
+  -0.000856207,
+  -0.000844168,
+  -0.000831793,
+  -0.000819098,
+  -0.000806094,
+  -0.000792798,
+  -0.000779217,
+  -0.000765372,
+  -0.000751266,
+  -0.000736922,
+  -0.00072229,
+  -0.000707464,
+  -0.000692506,
+  -0.000677361,
+  -0.000662049,
+  -0.000646575,
+  -0.000630955,
+  -0.000615196,
+  -0.000599314,
+  -0.000583319,
+  -0.000567225,
+  -0.000551043,
+  -0.000534785,
+  -0.000518464,
+  -0.000502091,
+  -0.00048568,
+  -0.00046924,
+  -0.000452784,
+  -0.000436324,
+  -0.00041987,
+  -0.000403434,
+  -0.000387027,
+  -0.00037066,
+  -0.000354342,
+  -0.000338084,
+  -0.000321898,
+  -0.000305792,
+  -0.000289776,
+  -0.000273861,
+  -0.000258056,
+  -0.000242369,
+  -0.000226811,
+  -0.00021139,
+  -0.000196115,
+  -0.000180995,
+  -0.000166036,
+  -0.000151248,
+  -0.000136638,
+  -0.000122213,
+  -0.000107981,
+  -9.39481e-05,
+  -8.01218e-05,
+  -6.65082e-05,
+  -5.31139e-05,
+  -3.99444e-05,
+  -2.70061e-05,
+  -1.43041e-05,
+  -1.844e-06,
+  1.03695e-05,
+  2.23311e-05,
+  3.40369e-05,
+  4.54822e-05,
+  5.66636e-05,
+  6.7577e-05,
+  7.82196e-05,
+  8.85877e-05,
+  9.8679e-05,
+  0.000108491,
+  0.00011802,
+  0.000127266,
+  0.000136224,
+  0.000144895,
+  0.000153275,
+  0.000161363,
+  0.000169145,
+  0.000176621,
+  0.000183812,
+  0.000190706,
+  0.000197304,
+  0.000203605,
+  0.000209608,
+  0.000215314,
+  0.000220723,
+  0.000225837,
+  0.000230655,
+  0.00023518,
+  0.000239412,
+  0.000243354,
+  0.000247007,
+  0.000250373,
+  0.000253453,
+  0.000256251,
+  0.000258767,
+  0.000261006,
+  0.000262968,
+  0.000264658,
+  0.000266079,
+  0.000267232,
+  0.000268123,
+  0.000268754,
+  0.000269129,
+  0.000269253,
+  0.000269128,
+  0.00026876,
+  0.000268152,
+  0.000267308,
+  0.000266234,
+  0.000264933,
+  0.000263411,
+  0.000261672,
+  0.000259721,
+  0.000257562,
+  0.000255202,
+  0.000252644,
+  0.000249895,
+  0.000246959,
+  0.000243843,
+  0.000240551,
+  0.000237089,
+  0.000233463,
+  0.000229678,
+  0.00022574,
+  0.000221654,
+  0.000217426,
+  0.000213063,
+  0.000208568,
+  0.000203949,
+  0.000199211,
+  0.00019436,
+  0.0001894,
+  0.00018434,
+  0.000179183,
+  0.000173938,
+  0.000168608,
+  0.000163202,
+  0.000157725,
+  0.000152183,
+  0.000146583,
+  0.000140929,
+  0.000135218,
+  0.000129468,
+  0.000123681,
+  0.000117864,
+  0.00011202,
+  0.000106157,
+  0.000100278,
+  9.43895e-05,
+  8.84957e-05,
+  8.26029e-05,
+  7.67152e-05,
+  7.08393e-05,
+  6.49787e-05,
+  5.91403e-05,
+  5.33273e-05,
+  4.75467e-05,
+  4.18011e-05,
+  3.60975e-05,
+  3.04382e-05,
+  2.483e-05,
+  1.9275e-05,
+  1.37796e-05,
+  8.34567e-06,
+  2.97965e-06,
+  -2.31702e-06,
+  -7.53795e-06,
+  -1.2682e-05,
+  -1.77428e-05,
+  -2.27195e-05,
+  -2.7606e-05,
+  -3.24015e-05,
+  -3.71002e-05,
+  -4.17016e-05,
+  -4.62001e-05,
+  -5.05954e-05,
+  -5.48823e-05,
+  -5.90607e-05,
+  -6.31256e-05,
+  -6.70773e-05,
+  -7.09109e-05,
+  -7.46271e-05,
+  -7.82211e-05,
+  -8.16936e-05,
+  -8.50404e-05,
+  -8.82623e-05,
+  -9.13551e-05,
+  -9.43199e-05,
+  -9.71528e-05,
+  -9.98553e-05,
+  -0.000102424,
+  -0.00010486,
+  -0.00010716,
+  -0.000109326,
+  -0.000111356,
+  -0.000113251,
+  -0.000115009,
+  -0.000116633,
+  -0.000118119,
+  -0.000119471,
+  -0.000120685,
+  -0.000121766,
+  -0.000122709,
+  -0.000123518,
+  -0.000124185,
+  -0.000124729,
+  -0.000125145,
+  -0.000125428,
+  -0.000125578,
+  -0.000125598,
+  -0.000125487,
+  -0.00012525,
+  -0.000124884,
+  -0.000124397,
+  -0.000123784,
+  -0.000123053,
+  -0.000122201,
+  -0.000121235,
+  -0.000120152,
+  -0.000118959,
+  -0.000117652,
+  -0.000116241,
+  -0.00011472,
+  -0.000113099,
+  -0.000111372,
+  -0.00010955,
+  -0.000107627,
+  -0.000105614,
+  -0.000103505,
+  -0.000101311,
+  -9.9026e-05,
+  -9.66619e-05,
+  -9.42119e-05,
+  -9.16888e-05,
+  -8.9085e-05,
+  -8.64141e-05,
+  -8.36678e-05,
+  -8.08605e-05,
+  -7.7983e-05,
+  -7.50509e-05,
+  -7.20538e-05,
+  -6.90085e-05,
+  -6.59032e-05,
+  -6.27565e-05,
+  -5.95548e-05,
+  -5.63184e-05,
+  -5.3032e-05,
+  -4.97179e-05,
+  -4.63581e-05,
+  -4.29778e-05,
+  -3.95556e-05,
+  -3.61199e-05,
+  -3.26453e-05,
+  -2.91642e-05,
+  -2.56455e-05,
+  -2.21275e-05,
+  -1.85712e-05,
+  -1.50227e-05,
+  -1.14317e-05,
+  -7.85603e-06,
+  -4.22748e-06,
+  -6.22187e-07,
+  3.05918e-06,
+  6.70859e-06,
+  1.04905e-05,
+  1.42303e-05,
+  1.82863e-05,
+  2.2286e-05
+};
diff --git a/codec2/tags/0.4/src/rn_coh.h b/codec2/tags/0.4/src/rn_coh.h
new file mode 100644 (file)
index 0000000..d4b3c81
--- /dev/null
@@ -0,0 +1,604 @@
+/* Generated by rn_file() Octave function */
+
+const float gt_alpha5_root_coh[]={
+  4.05576e-05,
+  2.58255e-05,
+  1.58964e-05,
+  5.78773e-06,
+  -3.71244e-06,
+  -1.33229e-05,
+  -2.2664e-05,
+  -3.20611e-05,
+  -4.12734e-05,
+  -5.04935e-05,
+  -5.9545e-05,
+  -6.85565e-05,
+  -7.73902e-05,
+  -8.6137e-05,
+  -9.46835e-05,
+  -0.000103097,
+  -0.000111281,
+  -0.000119289,
+  -0.000127034,
+  -0.000134559,
+  -0.000141789,
+  -0.000148756,
+  -0.000155393,
+  -0.000161723,
+  -0.000167689,
+  -0.000173315,
+  -0.00017854,
+  -0.000183382,
+  -0.000187794,
+  -0.000191793,
+  -0.000195333,
+  -0.000198429,
+  -0.000201038,
+  -0.000203173,
+  -0.000204797,
+  -0.000205922,
+  -0.000206515,
+  -0.00020659,
+  -0.000206117,
+  -0.000205109,
+  -0.000203541,
+  -0.000201427,
+  -0.000198743,
+  -0.000195505,
+  -0.000191693,
+  -0.000187324,
+  -0.000182382,
+  -0.000176885,
+  -0.000170822,
+  -0.00016421,
+  -0.000157041,
+  -0.000149335,
+  -0.000141089,
+  -0.000132323,
+  -0.000123038,
+  -0.000113258,
+  -0.000102985,
+  -9.22439e-05,
+  -8.10442e-05,
+  -6.94109e-05,
+  -5.73536e-05,
+  -4.49012e-05,
+  -3.20661e-05,
+  -1.88794e-05,
+  -5.35615e-06,
+  8.47105e-06,
+  2.25833e-05,
+  3.69472e-05,
+  5.15418e-05,
+  6.63317e-05,
+  8.12934e-05,
+  9.63895e-05,
+  0.000111594,
+  0.000126869,
+  0.000142183,
+  0.000157497,
+  0.000172781,
+  0.000187996,
+  0.000203111,
+  0.000218088,
+  0.000232892,
+  0.000247474,
+  0.000261806,
+  0.000275847,
+  0.000289559,
+  0.000302903,
+  0.000315839,
+  0.00032833,
+  0.000340339,
+  0.000351824,
+  0.000362751,
+  0.00037308,
+  0.000382774,
+  0.000391795,
+  0.000400108,
+  0.000407675,
+  0.000414464,
+  0.000420437,
+  0.000425565,
+  0.000429812,
+  0.000433151,
+  0.000435544,
+  0.000436975,
+  0.000437401,
+  0.000436865,
+  0.000435237,
+  0.00043246,
+  0.000428592,
+  0.000423608,
+  0.000417497,
+  0.00041024,
+  0.000401823,
+  0.000392231,
+  0.000381449,
+  0.000369471,
+  0.000356284,
+  0.000341885,
+  0.000326267,
+  0.00030943,
+  0.000291373,
+  0.000272099,
+  0.000251612,
+  0.000229921,
+  0.000207034,
+  0.000182964,
+  0.000157726,
+  0.000131338,
+  0.000103821,
+  7.51956e-05,
+  4.54842e-05,
+  1.4721e-05,
+  -1.7067e-05,
+  -4.98479e-05,
+  -8.35883e-05,
+  -0.000118248,
+  -0.00015379,
+  -0.000190167,
+  -0.000227336,
+  -0.000265248,
+  -0.000303856,
+  -0.000343104,
+  -0.000382942,
+  -0.00042331,
+  -0.000464152,
+  -0.000505403,
+  -0.000547003,
+  -0.000588883,
+  -0.000630979,
+  -0.000673218,
+  -0.000715533,
+  -0.000757849,
+  -0.000800092,
+  -0.000842187,
+  -0.000884054,
+  -0.000925613,
+  -0.000966788,
+  -0.00100749,
+  -0.00104765,
+  -0.00108717,
+  -0.00112597,
+  -0.00116397,
+  -0.00120108,
+  -0.0012372,
+  -0.00127227,
+  -0.00130617,
+  -0.00133884,
+  -0.00137017,
+  -0.00140008,
+  -0.00142848,
+  -0.00145528,
+  -0.0014804,
+  -0.00150374,
+  -0.00152522,
+  -0.00154475,
+  -0.00156225,
+  -0.00157763,
+  -0.00159081,
+  -0.00160171,
+  -0.00161024,
+  -0.00161633,
+  -0.0016199,
+  -0.00162088,
+  -0.00161917,
+  -0.00161472,
+  -0.00160744,
+  -0.00159729,
+  -0.00158419,
+  -0.00156807,
+  -0.00154888,
+  -0.00152655,
+  -0.00150103,
+  -0.00147227,
+  -0.00144021,
+  -0.00140482,
+  -0.00136604,
+  -0.00132384,
+  -0.00127818,
+  -0.00122903,
+  -0.00117635,
+  -0.00112013,
+  -0.00106033,
+  -0.000996946,
+  -0.000929956,
+  -0.000859348,
+  -0.000785117,
+  -0.000707261,
+  -0.000625779,
+  -0.00054068,
+  -0.000451952,
+  -0.000359651,
+  -0.000263788,
+  -0.00016436,
+  -6.13947e-05,
+  4.5076e-05,
+  0.000155016,
+  0.000268384,
+  0.000385134,
+  0.000505217,
+  0.000628582,
+  0.000755171,
+  0.000884923,
+  0.00101777,
+  0.00115366,
+  0.00129249,
+  0.00143421,
+  0.00157873,
+  0.00172596,
+  0.00187583,
+  0.00202822,
+  0.00218306,
+  0.00234023,
+  0.00249965,
+  0.00266119,
+  0.00282475,
+  0.00299023,
+  0.00315749,
+  0.00332643,
+  0.00349691,
+  0.00366882,
+  0.00384202,
+  0.00401639,
+  0.0041918,
+  0.0043681,
+  0.00454516,
+  0.00472285,
+  0.00490101,
+  0.00507951,
+  0.00525821,
+  0.00543695,
+  0.0056156,
+  0.005794,
+  0.00597201,
+  0.00614947,
+  0.00632623,
+  0.00650216,
+  0.00667708,
+  0.00685086,
+  0.00702335,
+  0.00719439,
+  0.00736383,
+  0.00753153,
+  0.00769734,
+  0.00786111,
+  0.00802269,
+  0.00818194,
+  0.00833872,
+  0.00849289,
+  0.0086443,
+  0.00879283,
+  0.00893832,
+  0.00908066,
+  0.00921971,
+  0.00935534,
+  0.00948743,
+  0.00961585,
+  0.00974049,
+  0.00986123,
+  0.00997795,
+  0.0100905,
+  0.0101989,
+  0.0103029,
+  0.0104025,
+  0.0104976,
+  0.0105881,
+  0.0106738,
+  0.0107548,
+  0.010831,
+  0.0109022,
+  0.0109684,
+  0.0110295,
+  0.0110855,
+  0.0111364,
+  0.011182,
+  0.0112224,
+  0.0112575,
+  0.0112872,
+  0.0113115,
+  0.0113305,
+  0.0113441,
+  0.0113522,
+  0.0113549,
+  0.0113522,
+  0.0113441,
+  0.0113305,
+  0.0113115,
+  0.0112872,
+  0.0112575,
+  0.0112224,
+  0.011182,
+  0.0111364,
+  0.0110855,
+  0.0110295,
+  0.0109684,
+  0.0109022,
+  0.010831,
+  0.0107548,
+  0.0106738,
+  0.0105881,
+  0.0104976,
+  0.0104025,
+  0.0103029,
+  0.0101989,
+  0.0100905,
+  0.00997795,
+  0.00986123,
+  0.00974049,
+  0.00961585,
+  0.00948743,
+  0.00935534,
+  0.00921971,
+  0.00908066,
+  0.00893832,
+  0.00879283,
+  0.0086443,
+  0.00849289,
+  0.00833872,
+  0.00818194,
+  0.00802269,
+  0.00786111,
+  0.00769734,
+  0.00753153,
+  0.00736383,
+  0.00719439,
+  0.00702335,
+  0.00685086,
+  0.00667708,
+  0.00650216,
+  0.00632623,
+  0.00614947,
+  0.00597201,
+  0.005794,
+  0.0056156,
+  0.00543695,
+  0.00525821,
+  0.00507951,
+  0.00490101,
+  0.00472285,
+  0.00454516,
+  0.0043681,
+  0.0041918,
+  0.00401639,
+  0.00384202,
+  0.00366882,
+  0.00349691,
+  0.00332643,
+  0.00315749,
+  0.00299023,
+  0.00282475,
+  0.00266119,
+  0.00249965,
+  0.00234023,
+  0.00218306,
+  0.00202822,
+  0.00187583,
+  0.00172596,
+  0.00157873,
+  0.00143421,
+  0.00129249,
+  0.00115366,
+  0.00101777,
+  0.000884923,
+  0.000755171,
+  0.000628582,
+  0.000505217,
+  0.000385134,
+  0.000268384,
+  0.000155016,
+  4.5076e-05,
+  -6.13947e-05,
+  -0.00016436,
+  -0.000263788,
+  -0.000359651,
+  -0.000451952,
+  -0.00054068,
+  -0.000625779,
+  -0.000707261,
+  -0.000785117,
+  -0.000859348,
+  -0.000929956,
+  -0.000996946,
+  -0.00106033,
+  -0.00112013,
+  -0.00117635,
+  -0.00122903,
+  -0.00127818,
+  -0.00132384,
+  -0.00136604,
+  -0.00140482,
+  -0.00144021,
+  -0.00147227,
+  -0.00150103,
+  -0.00152655,
+  -0.00154888,
+  -0.00156807,
+  -0.00158419,
+  -0.00159729,
+  -0.00160744,
+  -0.00161472,
+  -0.00161917,
+  -0.00162088,
+  -0.0016199,
+  -0.00161633,
+  -0.00161024,
+  -0.00160171,
+  -0.00159081,
+  -0.00157763,
+  -0.00156225,
+  -0.00154475,
+  -0.00152522,
+  -0.00150374,
+  -0.0014804,
+  -0.00145528,
+  -0.00142848,
+  -0.00140008,
+  -0.00137017,
+  -0.00133884,
+  -0.00130617,
+  -0.00127227,
+  -0.0012372,
+  -0.00120108,
+  -0.00116397,
+  -0.00112597,
+  -0.00108717,
+  -0.00104765,
+  -0.00100749,
+  -0.000966788,
+  -0.000925613,
+  -0.000884054,
+  -0.000842187,
+  -0.000800092,
+  -0.000757849,
+  -0.000715533,
+  -0.000673218,
+  -0.000630979,
+  -0.000588883,
+  -0.000547003,
+  -0.000505403,
+  -0.000464152,
+  -0.00042331,
+  -0.000382942,
+  -0.000343104,
+  -0.000303856,
+  -0.000265248,
+  -0.000227336,
+  -0.000190167,
+  -0.00015379,
+  -0.000118248,
+  -8.35883e-05,
+  -4.98479e-05,
+  -1.7067e-05,
+  1.4721e-05,
+  4.54842e-05,
+  7.51956e-05,
+  0.000103821,
+  0.000131338,
+  0.000157726,
+  0.000182964,
+  0.000207034,
+  0.000229921,
+  0.000251612,
+  0.000272099,
+  0.000291373,
+  0.00030943,
+  0.000326267,
+  0.000341885,
+  0.000356284,
+  0.000369471,
+  0.000381449,
+  0.000392231,
+  0.000401823,
+  0.00041024,
+  0.000417497,
+  0.000423608,
+  0.000428592,
+  0.00043246,
+  0.000435237,
+  0.000436865,
+  0.000437401,
+  0.000436975,
+  0.000435544,
+  0.000433151,
+  0.000429812,
+  0.000425565,
+  0.000420437,
+  0.000414464,
+  0.000407675,
+  0.000400108,
+  0.000391795,
+  0.000382774,
+  0.00037308,
+  0.000362751,
+  0.000351824,
+  0.000340339,
+  0.00032833,
+  0.000315839,
+  0.000302903,
+  0.000289559,
+  0.000275847,
+  0.000261806,
+  0.000247474,
+  0.000232892,
+  0.000218088,
+  0.000203111,
+  0.000187996,
+  0.000172781,
+  0.000157497,
+  0.000142183,
+  0.000126869,
+  0.000111594,
+  9.63895e-05,
+  8.12934e-05,
+  6.63317e-05,
+  5.15418e-05,
+  3.69472e-05,
+  2.25833e-05,
+  8.47105e-06,
+  -5.35615e-06,
+  -1.88794e-05,
+  -3.20661e-05,
+  -4.49012e-05,
+  -5.73536e-05,
+  -6.94109e-05,
+  -8.10442e-05,
+  -9.22439e-05,
+  -0.000102985,
+  -0.000113258,
+  -0.000123038,
+  -0.000132323,
+  -0.000141089,
+  -0.000149335,
+  -0.000157041,
+  -0.00016421,
+  -0.000170822,
+  -0.000176885,
+  -0.000182382,
+  -0.000187324,
+  -0.000191693,
+  -0.000195505,
+  -0.000198743,
+  -0.000201427,
+  -0.000203541,
+  -0.000205109,
+  -0.000206117,
+  -0.00020659,
+  -0.000206515,
+  -0.000205922,
+  -0.000204797,
+  -0.000203173,
+  -0.000201038,
+  -0.000198429,
+  -0.000195333,
+  -0.000191793,
+  -0.000187794,
+  -0.000183382,
+  -0.00017854,
+  -0.000173315,
+  -0.000167689,
+  -0.000161723,
+  -0.000155393,
+  -0.000148756,
+  -0.000141789,
+  -0.000134559,
+  -0.000127034,
+  -0.000119289,
+  -0.000111281,
+  -0.000103097,
+  -9.46835e-05,
+  -8.6137e-05,
+  -7.73902e-05,
+  -6.85565e-05,
+  -5.9545e-05,
+  -5.04935e-05,
+  -4.12734e-05,
+  -3.20611e-05,
+  -2.2664e-05,
+  -1.33229e-05,
+  -3.71244e-06,
+  5.78773e-06,
+  1.58964e-05,
+  2.58255e-05
+};
diff --git a/codec2/tags/0.4/src/rxdec_coeff.h b/codec2/tags/0.4/src/rxdec_coeff.h
new file mode 100644 (file)
index 0000000..a08cf9f
--- /dev/null
@@ -0,0 +1,35 @@
+/* Generated by rxdec_file() Octave function */
+
+const float rxdec_coeff[]={
+  -0.00125472,
+  -0.00204605,
+  -0.0019897,
+  0.000163906,
+  0.00490937,
+  0.00986375,
+  0.0096718,
+  -0.000480351,
+  -0.019311,
+  -0.0361822,
+  -0.0341251,
+  0.000827866,
+  0.0690577,
+  0.152812,
+  0.222115,
+  0.249004,
+  0.222115,
+  0.152812,
+  0.0690577,
+  0.000827866,
+  -0.0341251,
+  -0.0361822,
+  -0.019311,
+  -0.000480351,
+  0.0096718,
+  0.00986375,
+  0.00490937,
+  0.000163906,
+  -0.0019897,
+  -0.00204605,
+  -0.00125472
+};
diff --git a/codec2/tags/0.4/src/sim.sh b/codec2/tags/0.4/src/sim.sh
new file mode 100755 (executable)
index 0000000..10152d9
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# sim.sh
+# David Rowe 10 Sep 2009
+
+# Process a source file using the codec 2 simulation.  An output
+# speech file is generated for each major processing step, from the
+# unquantised siusoidal model to fully quantised.  This way we can
+# listen to the effect of each processing step.  Use listensim.sh to
+# test the output files.
+
+../src/c2sim ../raw/$1.raw -o $1_uq.raw
+../src/c2sim ../raw/$1.raw --phase0 -o $1_phase0.raw --postfilter
+../src/c2sim ../raw/$1.raw --lpc 10 -o $1_lpc10.raw --postfilter
+../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter
+../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --dec -o $1_phase0_lpc10_dec.raw --postfilter
+../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp --dec -o $1_phase0_lsp_dec.raw --postfilter
+
+#../src/c2sim ../raw/$1.raw --lpc 10 --lsp -o $1_lsp.raw
+#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter
+#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp.raw --postfilter
+#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp_dec.raw --postfilter --dec
+
diff --git a/codec2/tags/0.4/src/sine.c b/codec2/tags/0.4/src/sine.c
new file mode 100644 (file)
index 0000000..2b6a58f
--- /dev/null
@@ -0,0 +1,647 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: sine.c
+  AUTHOR......: David Rowe                                           
+  DATE CREATED: 19/8/2010
+                                                                             
+  Sinusoidal analysis and synthesis functions.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 1990-2010 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/>.
+*/
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               INCLUDES                                      
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "kiss_fft.h"
+
+#define HPF_BETA 0.125
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               HEADERS                                     
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, 
+                        float pstep);
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               FUNCTIONS                                     
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: make_analysis_window        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11/5/94 
+
+  Init function that generates the time domain analysis window and it's DFT.
+
+\*---------------------------------------------------------------------------*/
+
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[])
+{
+  float m;
+  COMP  wshift[FFT_ENC];
+  COMP  temp;
+  int   i,j;
+
+  /* 
+     Generate Hamming window centered on M-sample pitch analysis window
+  
+  0            M/2           M-1
+  |-------------|-------------|
+        |-------|-------|
+            NW samples
+
+     All our analysis/synthsis is centred on the M/2 sample.               
+  */
+
+  m = 0.0;
+  for(i=0; i<M/2-NW/2; i++)
+    w[i] = 0.0;
+  for(i=M/2-NW/2,j=0; i<M/2+NW/2; i++,j++) {
+    w[i] = 0.5 - 0.5*cosf(TWO_PI*j/(NW-1));
+    m += w[i]*w[i];
+  }
+  for(i=M/2+NW/2; i<M; i++)
+    w[i] = 0.0;
+  /* Normalise - makes freq domain amplitude estimation straight
+     forward */
+
+  m = 1.0/sqrtf(m*FFT_ENC);
+  for(i=0; i<M; i++) {
+    w[i] *= m;
+  }
+
+  /* 
+     Generate DFT of analysis window, used for later processing.  Note
+     we modulo FFT_ENC shift the time domain window w[], this makes the
+     imaginary part of the DFT W[] equal to zero as the shifted w[] is
+     even about the n=0 time axis if NW is odd.  Having the imag part
+     of the DFT W[] makes computation easier.
+
+     0                      FFT_ENC-1
+     |-------------------------|
+
+      ----\               /----
+           \             / 
+            \           /          <- shifted version of window w[n]
+             \         /
+              \       /
+               -------
+
+     |---------|     |---------|      
+       NW/2              NW/2
+  */
+
+  for(i=0; i<FFT_ENC; i++) {
+    wshift[i].real = 0.0;
+    wshift[i].imag = 0.0;
+  }
+  for(i=0; i<NW/2; i++)
+    wshift[i].real = w[i+M/2];
+  for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++)
+   wshift[i].real = w[j];
+
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)wshift, (kiss_fft_cpx *)W);
+
+  /* 
+      Re-arrange W[] to be symmetrical about FFT_ENC/2.  Makes later 
+      analysis convenient.
+
+   Before:
+
+
+     0                 FFT_ENC-1
+     |----------|---------|
+     __                   _       
+       \                 /          
+        \_______________/      
+
+   After:
+
+     0                 FFT_ENC-1
+     |----------|---------|
+               ___                        
+              /   \                
+     ________/     \_______     
+
+  */
+       
+      
+  for(i=0; i<FFT_ENC/2; i++) {
+    temp.real = W[i].real;
+    temp.imag = W[i].imag;
+    W[i].real = W[i+FFT_ENC/2].real;
+    W[i].imag = W[i+FFT_ENC/2].imag;
+    W[i+FFT_ENC/2].real = temp.real;
+    W[i+FFT_ENC/2].imag = temp.imag;
+  }
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: hpf         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16 Nov 2010
+
+  High pass filter with a -3dB point of about 160Hz.
+
+    y(n) = -HPF_BETA*y(n-1) + x(n) - x(n-1)
+\*---------------------------------------------------------------------------*/
+
+float hpf(float x, float states[])
+{
+    states[0] = -HPF_BETA*states[0] + x - states[1];
+    states[1] = x;
+
+    return states[0];
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: dft_speech          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 27/5/94 
+
+  Finds the DFT of the current speech input speech frame.
+
+\*---------------------------------------------------------------------------*/
+
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[])
+{
+  int  i;
+  COMP sw[FFT_ENC];
+
+  for(i=0; i<FFT_ENC; i++) {
+    sw[i].real = 0.0;
+    sw[i].imag = 0.0;
+  }
+
+  /* Centre analysis window on time axis, we need to arrange input
+     to FFT this way to make FFT phases correct */
+  
+  /* move 2nd half to start of FFT input vector */
+
+  for(i=0; i<NW/2; i++)
+    sw[i].real = Sn[i+M/2]*w[i+M/2];
+
+  /* move 1st half to end of FFT input vector */
+
+  for(i=0; i<NW/2; i++)
+    sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2];
+
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)sw, (kiss_fft_cpx *)Sw);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                     
+  FUNCTION....: two_stage_pitch_refinement                     
+  AUTHOR......: David Rowe
+  DATE CREATED: 27/5/94                                
+
+  Refines the current pitch estimate using the harmonic sum pitch
+  estimation technique.
+
+\*---------------------------------------------------------------------------*/
+
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[])
+{
+  float pmin,pmax,pstep;       /* pitch refinment minimum, maximum and step */ 
+
+  /* Coarse refinement */
+
+  pmax = TWO_PI/model->Wo + 5;
+  pmin = TWO_PI/model->Wo - 5;
+  pstep = 1.0;
+  hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
+  
+  /* Fine refinement */
+  
+  pmax = TWO_PI/model->Wo + 1;
+  pmin = TWO_PI/model->Wo - 1;
+  pstep = 0.25;
+  hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
+  
+  /* Limit range */
+  
+  if (model->Wo < TWO_PI/P_MAX)
+    model->Wo = TWO_PI/P_MAX;
+  if (model->Wo > TWO_PI/P_MIN)
+    model->Wo = TWO_PI/P_MIN;
+
+  model->L = floorf(PI/model->Wo);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                
+ FUNCTION....: hs_pitch_refinement                             
+ AUTHOR......: David Rowe                      
+ DATE CREATED: 27/5/94                                                      
+                                                                         
+ Harmonic sum pitch refinement function.                          
+                                                                           
+ pmin   pitch search range minimum         
+ pmax  pitch search range maximum          
+ step   pitch search step size             
+ model current pitch estimate in model.Wo  
+                                                                           
+ model         refined pitch estimate in model.Wo  
+                                                                            
+\*---------------------------------------------------------------------------*/
+
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep)
+{
+  int m;               /* loop variable */
+  int b;               /* bin for current harmonic centre */
+  float E;             /* energy for current pitch*/
+  float Wo;            /* current "test" fundamental freq. */
+  float Wom;           /* Wo that maximises E */
+  float Em;            /* mamimum energy */
+  float r, one_on_r;   /* number of rads/bin */
+  float p;             /* current pitch */
+  
+  /* Initialisation */
+  
+  model->L = PI/model->Wo;     /* use initial pitch est. for L */
+  Wom = model->Wo;
+  Em = 0.0;
+  r = TWO_PI/FFT_ENC;
+  one_on_r = 1.0/r;
+
+  /* Determine harmonic sum for a range of Wo values */
+
+  for(p=pmin; p<=pmax; p+=pstep) {
+    E = 0.0;
+    Wo = TWO_PI/p;
+
+    /* Sum harmonic magnitudes */
+    for(m=1; m<=model->L; m++) {
+        b = (int)(m*Wo*one_on_r + 0.5);
+        E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag;
+    }  
+    /* Compare to see if this is a maximum */
+    
+    if (E > Em) {
+      Em = E;
+      Wom = Wo;
+    }
+  }
+
+  model->Wo = Wom;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FUNCTION....: estimate_amplitudes                          
+  AUTHOR......: David Rowe             
+  DATE CREATED: 27/5/94                               
+                                                                             
+  Estimates the complex amplitudes of the harmonics.    
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase)
+{
+  int   i,m;           /* loop variables */
+  int   am,bm;         /* bounds of current harmonic */
+  int   b;             /* DFT bin of centre of current harmonic */
+  float den;           /* denominator of amplitude expression */
+  float r, one_on_r;   /* number of rads/bin */
+  int   offset;
+  COMP  Am;
+
+  r = TWO_PI/FFT_ENC;
+  one_on_r = 1.0/r;
+
+  for(m=1; m<=model->L; m++) {
+    den = 0.0;
+    am = (int)((m - 0.5)*model->Wo*one_on_r + 0.5);
+    bm = (int)((m + 0.5)*model->Wo*one_on_r + 0.5);
+    b = (int)(m*model->Wo/r + 0.5);
+
+    /* Estimate ampltude of harmonic */
+
+    den = 0.0;
+    Am.real = Am.imag = 0.0;
+    offset = FFT_ENC/2 - (int)(m*model->Wo*one_on_r + 0.5);
+    for(i=am; i<bm; i++) {
+      den += Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag;
+      Am.real += Sw[i].real*W[i + offset].real;
+      Am.imag += Sw[i].imag*W[i + offset].real;
+    }
+
+    model->A[m] = sqrtf(den);
+
+    if (est_phase) {
+
+        /* Estimate phase of harmonic, this is expensive in CPU for
+           embedded devicesso we make it an option */
+
+        model->phi[m] = atan2f(Sw[b].imag,Sw[b].real);
+    }
+  }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  est_voicing_mbe()          
+                                                                             
+  Returns the error of the MBE cost function for a fiven F0.
+
+  Note: I think a lot of the operations below can be simplified as
+  W[].imag = 0 and has been normalised such that den always equals 1.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+float est_voicing_mbe(
+    MODEL *model,
+    COMP   Sw[],
+    COMP   W[],
+    COMP   Sw_[],         /* DFT of all voiced synthesised signal  */
+                          /* useful for debugging/dump file        */
+    COMP   Ew[])          /* DFT of error                          */
+{
+    int   i,l,al,bl,m;    /* loop variables */
+    COMP  Am;             /* amplitude sample for this band */
+    int   offset;         /* centers Hw[] about current harmonic */
+    float den;            /* denominator of Am expression */
+    float error;          /* accumulated error between original and synthesised */
+    float Wo;            
+    float sig, snr;
+    float elow, ehigh, eratio;
+    float sixty;
+
+    sig = 1E-4;
+    for(l=1; l<=model->L/4; l++) {
+       sig += model->A[l]*model->A[l];
+    }
+    for(i=0; i<FFT_ENC; i++) {
+       Sw_[i].real = 0.0;
+       Sw_[i].imag = 0.0;
+       Ew[i].real = 0.0;
+       Ew[i].imag = 0.0;
+    }
+
+    Wo = model->Wo;
+    error = 1E-4;
+
+    /* Just test across the harmonics in the first 1000 Hz (L/4) */
+
+    for(l=1; l<=model->L/4; l++) {
+       Am.real = 0.0;
+       Am.imag = 0.0;
+       den = 0.0;
+       al = ceilf((l - 0.5)*Wo*FFT_ENC/TWO_PI);
+       bl = ceilf((l + 0.5)*Wo*FFT_ENC/TWO_PI);
+
+       /* Estimate amplitude of harmonic assuming harmonic is totally voiced */
+
+        offset = FFT_ENC/2 - l*Wo*FFT_ENC/TWO_PI + 0.5;
+       for(m=al; m<bl; m++) {
+           Am.real += Sw[m].real*W[offset+m].real;
+           Am.imag += Sw[m].imag*W[offset+m].real;
+           den += W[offset+m].real*W[offset+m].real;
+        }
+
+        Am.real = Am.real/den;
+        Am.imag = Am.imag/den;
+
+        /* Determine error between estimated harmonic and original */
+
+        offset = FFT_ENC/2 - l*Wo*FFT_ENC/TWO_PI + 0.5;
+        for(m=al; m<bl; m++) {
+           Sw_[m].real = Am.real*W[offset+m].real;
+           Sw_[m].imag = Am.imag*W[offset+m].real;
+           Ew[m].real = Sw[m].real - Sw_[m].real;
+           Ew[m].imag = Sw[m].imag - Sw_[m].imag;
+           error += Ew[m].real*Ew[m].real;
+           error += Ew[m].imag*Ew[m].imag;
+       }
+    }
+    
+    snr = 10.0*log10f(sig/error);
+    if (snr > V_THRESH)
+       model->voiced = 1;
+    else
+       model->voiced = 0;
+    /* post processing, helps clean up some voicing errors ------------------*/
+
+    /* 
+       Determine the ratio of low freqency to high frequency energy,
+       voiced speech tends to be dominated by low frequency energy,
+       unvoiced by high frequency. This measure can be used to
+       determine if we have made any gross errors.
+    */
+
+    elow = ehigh = 1E-4;
+    for(l=1; l<=model->L/2; l++) {
+       elow += model->A[l]*model->A[l];
+    }
+    for(l=model->L/2; l<=model->L; l++) {
+       ehigh += model->A[l]*model->A[l];
+    }
+    eratio = 10.0*log10f(elow/ehigh);
+
+    /* Look for Type 1 errors, strongly V speech that has been
+       accidentally declared UV */
+
+    if (model->voiced == 0)
+       if (eratio > 10.0)
+           model->voiced = 1;
+
+    /* Look for Type 2 errors, strongly UV speech that has been
+       accidentally declared V */
+
+    if (model->voiced == 1) {
+       if (eratio < -10.0)
+           model->voiced = 0;
+
+       /* A common source of Type 2 errors is the pitch estimator
+          gives a low (50Hz) estimate for UV speech, which gives a
+          good match with noise due to the close harmoonic spacing.
+          These errors are much more common than people with 50Hz3
+          pitch, so we have just a small eratio threshold. */
+
+       sixty = 60.0*TWO_PI/FS;
+       if ((eratio < -4.0) && (model->Wo <= sixty))
+           model->voiced = 0;
+    }
+    //printf(" v: %d snr: %f eratio: %3.2f %f\n",model->voiced,snr,eratio,dF0);
+
+    return snr;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: make_synthesis_window       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11/5/94 
+
+  Init function that generates the trapezoidal (Parzen) sythesis window.
+
+\*---------------------------------------------------------------------------*/
+
+void make_synthesis_window(float Pn[])
+{
+  int   i;
+  float win;
+
+  /* Generate Parzen window in time domain */
+
+  win = 0.0;
+  for(i=0; i<N/2-TW; i++)
+    Pn[i] = 0.0;
+  win = 0.0;
+  for(i=N/2-TW; i<N/2+TW; win+=1.0/(2*TW), i++ )
+    Pn[i] = win;
+  for(i=N/2+TW; i<3*N/2-TW; i++)
+    Pn[i] = 1.0;
+  win = 1.0;
+  for(i=3*N/2-TW; i<3*N/2+TW; win-=1.0/(2*TW), i++)
+    Pn[i] = win;
+  for(i=3*N/2+TW; i<2*N; i++)
+    Pn[i] = 0.0;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FUNCTION....: synthesise                           
+  AUTHOR......: David Rowe             
+  DATE CREATED: 20/2/95                       
+                                                                             
+  Synthesise a speech signal in the frequency domain from the
+  sinusodal model parameters.  Uses overlap-add with a trapezoidal
+  window to smoothly interpolate betwen frames.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void synthesise(
+  kiss_fft_cfg fft_inv_cfg, 
+  float  Sn_[],                /* time domain synthesised signal              */
+  MODEL *model,                /* ptr to model parameters for this frame      */
+  float  Pn[],         /* time domain Parzen window                   */
+  int    shift          /* flag used to handle transition frames       */
+)
+{
+    int   i,l,j,b;     /* loop variables */
+    COMP  Sw_[FFT_DEC];        /* DFT of synthesised signal */
+    COMP  sw_[FFT_DEC];        /* synthesised signal */
+
+    if (shift) {
+       /* Update memories */
+       for(i=0; i<N-1; i++) {
+           Sn_[i] = Sn_[i+N];
+       }
+       Sn_[N-1] = 0.0;
+    }
+
+    for(i=0; i<FFT_DEC; i++) {
+       Sw_[i].real = 0.0;
+       Sw_[i].imag = 0.0;
+    }
+
+    /*
+      Nov 2010 - found that synthesis using time domain cos() functions
+      gives better results for synthesis frames greater than 10ms.  Inverse
+      FFT synthesis using a 512 pt FFT works well for 10ms window.  I think
+      (but am not sure) that the problem is related to the quantisation of
+      the harmonic frequencies to the FFT bin size, e.g. there is a 
+      8000/512 Hz step between FFT bins.  For some reason this makes
+      the speech from longer frame > 10ms sound poor.  The effect can also
+      be seen when synthesising test signals like single sine waves, some
+      sort of amplitude modulation at the frame rate.
+
+      Another possibility is using a larger FFT size (1024 or 2048).
+    */
+
+#define FFT_SYNTHESIS
+#ifdef FFT_SYNTHESIS
+    /* Now set up frequency domain synthesised speech */
+    for(l=1; l<=model->L; l++) {
+    //for(l=model->L/2; l<=model->L; l++) {
+    //for(l=1; l<=model->L/4; l++) {
+       b = (int)(l*model->Wo*FFT_DEC/TWO_PI + 0.5);
+       if (b > ((FFT_DEC/2)-1)) {
+               b = (FFT_DEC/2)-1;
+       }
+       Sw_[b].real = model->A[l]*cosf(model->phi[l]);
+       Sw_[b].imag = model->A[l]*sinf(model->phi[l]);
+       Sw_[FFT_DEC-b].real = Sw_[b].real;
+       Sw_[FFT_DEC-b].imag = -Sw_[b].imag;
+    }
+
+    /* Perform inverse DFT */
+
+    kiss_fft(fft_inv_cfg, (kiss_fft_cpx *)Sw_, (kiss_fft_cpx *)sw_);
+#else
+    /*
+       Direct time domain synthesis using the cos() function.  Works
+       well at 10ms and 20ms frames rates.  Note synthesis window is
+       still used to handle overlap-add between adjacent frames.  This
+       could be simplified as we don't need to synthesise where Pn[]
+       is zero.
+    */
+    for(l=1; l<=model->L; l++) {
+       for(i=0,j=-N+1; i<N-1; i++,j++) {
+           Sw_[FFT_DEC-N+1+i].real += 2.0*model->A[l]*cosf(j*model->Wo*l + model->phi[l]);
+       }
+       for(i=N-1,j=0; i<2*N; i++,j++)
+           Sw_[j].real += 2.0*model->A[l]*cosf(j*model->Wo*l + model->phi[l]);
+    }  
+#endif
+
+    /* Overlap add to previous samples */
+
+    for(i=0; i<N-1; i++) {
+       Sn_[i] += sw_[FFT_DEC-N+1+i].real*Pn[i];
+    }
+
+    if (shift)
+       for(i=N-1,j=0; i<2*N; i++,j++)
+           Sn_[i] = sw_[j].real*Pn[i];
+    else
+       for(i=N-1,j=0; i<2*N; i++,j++)
+           Sn_[i] += sw_[j].real*Pn[i];
+}
+
+
+static unsigned long next = 1;
+
+int codec2_rand(void) {
+    next = next * 1103515245 + 12345;
+    return((unsigned)(next/65536) % 32768);
+}
+
diff --git a/codec2/tags/0.4/src/sine.h b/codec2/tags/0.4/src/sine.h
new file mode 100644 (file)
index 0000000..c7c52cc
--- /dev/null
@@ -0,0 +1,47 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: sine.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 1/11/94
+                                                                             
+  Header file for sinusoidal analysis and synthesis functions.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __SINE__
+#define __SINE__
+
+#include "defines.h"
+#include "comp.h"
+#include "kiss_fft.h"
+
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[]);
+float hpf(float x, float states[]);
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[]);
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase);
+float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[]);
+void make_synthesis_window(float Pn[]);
+void synthesise(kiss_fft_cfg fft_inv_cfg, float Sn_[], MODEL *model, float Pn[], int shift);
+
+#define CODEC2_RAND_MAX 32767
+int codec2_rand(void);
+
+#endif
diff --git a/codec2/tags/0.4/src/ssbfilt_coeff.h b/codec2/tags/0.4/src/ssbfilt_coeff.h
new file mode 100644 (file)
index 0000000..457f03a
--- /dev/null
@@ -0,0 +1,107 @@
+/* 600 - 2600 Hz FIR filter coeffs */
+/* Generated by make_ssbfilt Octave script */
+
+#define SSBFILT_N 100
+
+float ssbfilt_coeff[]={
+  0.000065,
+  -0.000030,
+  0.000041,
+  0.000010,
+  -0.000128,
+  -0.000072,
+  -0.000007,
+  -0.000095,
+  -0.000063,
+  0.000016,
+  -0.000000,
+  0.000022,
+  -0.000115,
+  -0.000233,
+  -0.000023,
+  -0.000315,
+  -0.000725,
+  0.000073,
+  0.000380,
+  -0.000345,
+  0.000895,
+  0.002401,
+  0.001241,
+  0.001409,
+  0.003106,
+  0.001236,
+  -0.001117,
+  -0.001091,
+  -0.003184,
+  -0.005981,
+  -0.006904,
+  -0.007920,
+  -0.005588,
+  -0.002546,
+  -0.003476,
+  0.005155,
+  0.017465,
+  0.010772,
+  0.013033,
+  0.035082,
+  0.018466,
+  -0.010261,
+  0.016676,
+  0.004890,
+  -0.076807,
+  -0.055969,
+  -0.007360,
+  -0.155769,
+  -0.203150,
+  0.179458,
+  0.475523,
+  0.179458,
+  -0.203150,
+  -0.155769,
+  -0.007360,
+  -0.055969,
+  -0.076807,
+  0.004890,
+  0.016676,
+  -0.010261,
+  0.018466,
+  0.035082,
+  0.013033,
+  0.010772,
+  0.017465,
+  0.005155,
+  -0.003476,
+  -0.002546,
+  -0.005588,
+  -0.007920,
+  -0.006904,
+  -0.005981,
+  -0.003184,
+  -0.001091,
+  -0.001117,
+  0.001236,
+  0.003106,
+  0.001409,
+  0.001241,
+  0.002401,
+  0.000895,
+  -0.000345,
+  0.000380,
+  0.000073,
+  -0.000725,
+  -0.000315,
+  -0.000023,
+  -0.000233,
+  -0.000115,
+  0.000022,
+  -0.000000,
+  0.000016,
+  -0.000063,
+  -0.000095,
+  -0.000007,
+  -0.000072,
+  -0.000128,
+  0.000010,
+  0.000041,
+  -0.000030
+};
\ No newline at end of file
diff --git a/codec2/tags/0.4/src/test_bits.h b/codec2/tags/0.4/src/test_bits.h
new file mode 100644 (file)
index 0000000..d1c01a0
--- /dev/null
@@ -0,0 +1,164 @@
+/* Generated by test_bits_file() Octave function */
+
+const int test_bits[]={
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1
+};
diff --git a/codec2/tags/0.4/src/test_bits_coh.h b/codec2/tags/0.4/src/test_bits_coh.h
new file mode 100644 (file)
index 0000000..b01299c
--- /dev/null
@@ -0,0 +1,564 @@
+/* Generated by test_bits_coh_file() Octave function */
+
+const int test_bits_coh[]={
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0
+};
diff --git a/codec2/tags/0.4/src/varicode.c b/codec2/tags/0.4/src/varicode.c
new file mode 100644 (file)
index 0000000..21f7cce
--- /dev/null
@@ -0,0 +1,486 @@
+//==========================================================================
+// Name:            varicode.h
+// Purpose:         Varicode encoded and decode functions
+// Created:         Nov 24, 2012
+// Authors:         David Rowe
+//
+// To test:
+//          $ gcc varicode.c -o varicode -DVARICODE_UNITTEST -Wall
+//          $ ./varicode
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "varicode.h"
+#include "varicode_table.h"
+
+
+/*
+  output is an unpacked array of bits of maximum size max_out.  Note
+  unpacked arrays are a more suitable form for modulator input.
+
+  Code 1 covers the entire ASCII char set.
+*/
+
+int varicode_encode1(short varicode_out[], char ascii_in[], int max_out, int n_in) {
+    int            n_out, index, n_zeros, v_len;
+    unsigned short byte1, byte2, packed;
+
+    n_out = 0;
+
+    while(n_in && (n_out < max_out)) {
+
+        assert((unsigned int)(*ascii_in) < 128);
+
+        index = 2*(unsigned int)(*ascii_in);
+        byte1 = varicode_table1[index];
+        byte2 = varicode_table1[index+1];
+        packed = (byte1 << 8) + byte2;
+
+        //printf("n_in: %d ascii_in: %c index: %d packed 0x%x\n", n_in, *ascii_in, index, packed);
+        ascii_in++;
+
+        n_zeros = 0;
+        v_len = 0;
+        while ((n_zeros < 2) && (n_out < max_out) && (v_len <= VARICODE_MAX_BITS)) {
+            if (packed & 0x8000) {
+                *varicode_out = 1;
+                n_zeros = 0;
+            }
+            else {
+                *varicode_out = 0;
+                n_zeros++;
+            }
+            //printf("packed: 0x%x *varicode_out: %d n_zeros: %d v_len: %d\n", packed, *varicode_out, n_zeros,v_len );
+            packed <<= 1;
+            varicode_out++;
+            n_out++;
+            v_len++;                
+        }
+        assert(v_len <= VARICODE_MAX_BITS);
+
+        n_in--;            
+    }
+
+    return n_out;
+}
+
+
+/*
+  Code 2 covers a subset, but is more efficient that Code 1 (282
+  compared to 1315 bits on unittest) Unsupported characters are
+  replaced by spaces.  We encode/decode two bits at a time.  
+*/
+
+int varicode_encode2(short varicode_out[], char ascii_in[], int max_out, int n_in) {
+    int            n_out, n_zeros, v_len, i;
+    unsigned short packed;
+
+    n_out = 0;
+
+    while(n_in && (n_out < max_out)) {
+
+        packed = varicode_table2[0]; // default to space if char not found
+          
+        // see if our character exists
+        for(i=0; i<sizeof(varicode_table2); i+=2) {
+            if (varicode_table2[i] == *ascii_in)
+                packed = (unsigned short)varicode_table2[i+1] << 8;
+        }
+
+        //printf("n_in: %d ascii_in: %c index: %d packed 0x%x\n", n_in, *ascii_in, index, packed);
+        ascii_in++;
+
+        n_zeros = 0;
+        v_len = 0;
+        while ((n_zeros < 2) && (n_out < max_out) && (v_len <= VARICODE_MAX_BITS)) {
+            if (packed & 0x8000)
+                varicode_out[0] = 1;
+            else
+                varicode_out[0] = 0;
+                    
+            if (packed & 0x4000)
+                varicode_out[1] = 1;
+            else
+                varicode_out[1] = 0;
+                
+            if (packed & 0xc000)
+                n_zeros = 0;
+            else
+                n_zeros += 2;
+
+            //printf("packed: 0x%x *varicode_out: %d n_zeros: %d v_len: %d\n", packed, *varicode_out, n_zeros,v_len );
+            packed <<= 2;
+            varicode_out +=2;
+            n_out += 2;
+            v_len += 2;
+        }
+        assert(v_len <= VARICODE_MAX_BITS);
+
+        n_in--;            
+    }
+
+    assert((n_out % 2) == 0);  /* outputs two bits at a time */
+
+    return n_out;
+}
+
+
+int varicode_encode(short varicode_out[], char ascii_in[], int max_out, int n_in, int code_num) {
+    
+    assert((code_num ==1) || (code_num ==2));
+
+    if (code_num == 1)
+        return varicode_encode1(varicode_out, ascii_in, max_out, n_in);
+    else
+       return  varicode_encode2(varicode_out, ascii_in, max_out, n_in);
+}
+
+
+void varicode_decode_init(struct VARICODE_DEC *dec_states, int code_num)
+{
+    assert((code_num ==1) || (code_num == 2));
+
+    dec_states->state = 0;
+    dec_states->n_zeros = 0;
+    dec_states->v_len = 0;
+    dec_states->packed = 0;
+    dec_states->code_num = code_num;
+    dec_states->n_in = 0;
+    dec_states->in[0] = dec_states->in[1] = 0;
+}
+
+
+void varicode_set_code_num(struct VARICODE_DEC *dec_states, int code_num)
+{
+    assert((code_num == 1) || (code_num == 2));
+    dec_states->code_num = code_num;
+}
+
+
+/* Code 1 decode function, accepts one bit at a time */
+
+static int decode_one_bit(struct VARICODE_DEC *s, char *single_ascii, short varicode_in, int long_code)
+{
+    int            found=0, i;
+    unsigned short byte1, byte2;
+
+    //printf("decode_one_bit : state: %d varicode_in: %d packed: 0x%x n_zeros: %d\n",
+    //       s->state, varicode_in, s->packed, s->n_zeros);
+
+    if (s->state == 0) {
+        if (!varicode_in)
+            return 0;
+        else 
+            s->state = 1;
+    }
+
+    if (s->state == 1) {
+        if (varicode_in) {
+            s->packed |= (0x8000 >> s->v_len);
+            s->n_zeros = 0;
+        }
+        else {
+            s->n_zeros++;
+        }
+        s->v_len++;
+        found = 0;
+
+        /* end of character code */
+
+        if (s->n_zeros == 2) {
+            if (s->v_len) {
+                /* run thru table but note with bit errors we might not actually find a match */
+
+                byte1 = s->packed >> 8;
+                //printf("looking for byte1 : 0x%x ... ", byte1);
+                byte2 = s->packed & 0xff;
+
+                for(i=0; i<128; i++) {
+                    if ((byte1 == varicode_table1[2*i]) && (byte2 == varicode_table1[2*i+1])) {
+                        found = 1;
+                        *single_ascii = i;
+                    }
+                }
+            }
+            varicode_decode_init(s, s->code_num);
+        }
+
+        /* code can run too long if we have a bit error */
+
+        if (s->v_len > VARICODE_MAX_BITS)
+            varicode_decode_init(s, s->code_num);
+    }
+
+    return found;
+}
+
+
+/* Code 2 decode function, accepts two bits at a time */
+
+static int decode_two_bits(struct VARICODE_DEC *s, char *single_ascii, short varicode_in1, short varicode_in2)
+{
+    int            found=0, i;
+    unsigned short byte1;
+
+    if (s->state == 0) {
+        if (!(varicode_in1 || varicode_in2))
+            return 0;
+        else 
+            s->state = 1;
+    }
+
+    if (s->state == 1) {
+        if (varicode_in1)
+            s->packed |= (0x8000 >> s->v_len);
+        if (varicode_in2)
+            s->packed |= (0x4000 >> s->v_len);
+        if (varicode_in1 || varicode_in2)
+            s->n_zeros = 0;
+        else
+            s->n_zeros+=2;
+
+        s->v_len+=2;            
+        found = 0;
+
+        /* end of character code */
+
+        if (s->n_zeros == 2) {
+            if (s->v_len) {
+                /* run thru table but note with bit errors we might not actually find a match */
+
+                byte1 = s->packed >> 8;
+                //printf("looking for byte1 : 0x%x ... ", byte1);
+                for(i=0; i<sizeof(varicode_table2); i+=2) {
+                    //printf("byte1: 0x%x 0x%x\n", byte1, (unsigned char)varicode_table2[i+1]);
+                    if (byte1 == (unsigned char)varicode_table2[i+1]) {
+                        found = 1;
+                        *single_ascii = varicode_table2[i];
+                        //printf("found: %d i=%d char=%c ", found, i, *single_ascii);
+                    }
+                }
+            }
+            varicode_decode_init(s, s->code_num);
+        }
+
+        /* code can run too long if we have a bit error */
+
+        if (s->v_len > VARICODE_MAX_BITS)
+            varicode_decode_init(s, s->code_num);
+    }
+
+    return found;
+}
+
+
+int varicode_decode1(struct VARICODE_DEC *dec_states, char ascii_out[], short varicode_in[], int max_out, int n_in) {
+    int            output, n_out;
+    char           single_ascii = 0;
+
+    n_out = 0;
+
+    //printf("varicode_decode: n_in: %d\n", n_in);
+
+    while(n_in && (n_out < max_out)) {
+        output = decode_one_bit(dec_states, &single_ascii, varicode_in[0], 0);
+        varicode_in++;
+        n_in--;
+
+        if (output) {
+            *ascii_out++ = single_ascii;
+            n_out++;
+        }            
+    }
+
+    return n_out;
+}
+
+
+int varicode_decode2(struct VARICODE_DEC *dec_states, char ascii_out[], short varicode_in[], int max_out, int n_in) {
+    int            output, n_out;
+    char           single_ascii = 0;
+
+    n_out = 0;
+
+    //printf("varicode_decode2: n_in: %d varicode_in[0] %d dec_states->n_in: %d\n", n_in, varicode_in[0], dec_states->n_in);
+    //printf("%d ", varicode_in[0]);
+    while(n_in && (n_out < max_out)) {
+
+        // keep two bit buffer so we can process two at a time
+
+        dec_states->in[0] = dec_states->in[1];
+        dec_states->in[1] = varicode_in[0];
+        dec_states->n_in++;
+        varicode_in++;
+        n_in--;
+
+        if (dec_states->n_in == 2) {
+            output = decode_two_bits(dec_states, &single_ascii, dec_states->in[0], dec_states->in[1]);
+
+            dec_states->n_in = 0;
+            if (output) {
+                //printf("  output: %d single_ascii: 0x%x %c\n", output, (int)single_ascii, single_ascii);
+                *ascii_out++ = single_ascii;
+                n_out++;
+            }            
+        }
+    }
+
+    return n_out;
+}
+
+
+int varicode_decode(struct VARICODE_DEC *dec_states, char ascii_out[], short varicode_in[], int max_out, int n_in) {
+    if (dec_states->code_num == 1)
+        return varicode_decode1(dec_states, ascii_out, varicode_in, max_out, n_in);
+    else
+        return varicode_decode2(dec_states, ascii_out, varicode_in, max_out, n_in);
+}
+
+
+#ifdef VARICODE_UNITTEST
+void test_varicode(int code_num) {
+    char *ascii_in;
+    short *varicode;
+    int  i, n_varicode_bits_out, n_ascii_chars_out, length, half, n_out, j, len;
+    char *ascii_out;
+    struct VARICODE_DEC dec_states;
+
+    if (code_num == 1) {
+        printf("long code:\n");
+        length = sizeof(varicode_table1)/2;
+    }
+    else {
+        printf("short code:\n");
+        length = sizeof(varicode_table2)/2;
+    }
+    //length = 10;
+    ascii_in = (char*)malloc(length);
+    varicode = (short*)malloc(VARICODE_MAX_BITS*sizeof(short)*length);
+    ascii_out = (char*)malloc(length);
+
+    // 1. test all Varicode codes -------------------------------------------------------------
+
+    if (code_num == 1) {
+        for(i=0; i<length; i++)
+            ascii_in[i] = (char)i;
+    }
+    else {
+        for(i=0; i<length; i++)
+            ascii_in[i] = varicode_table2[2*i];
+    }
+    //printf("  ascii_in: %s\n", ascii_in);
+    n_varicode_bits_out = varicode_encode(varicode, ascii_in, VARICODE_MAX_BITS*length, length, code_num);
+
+    printf("  n_varicode_bits_out: %d\n", n_varicode_bits_out);
+    //for(i=0; i<n_varicode_bits_out; i++) {
+    //    printf("%d \n", varicode[i]);
+    //}
+
+    // split decode in half to test how it preserves state between calls 
+
+    varicode_decode_init(&dec_states, code_num);
+    half = n_varicode_bits_out/2;
+    n_ascii_chars_out  = varicode_decode(&dec_states, ascii_out, varicode, length, half);
+    // printf("  n_ascii_chars_out: %d\n", n_ascii_chars_out);
+
+    n_ascii_chars_out += varicode_decode(&dec_states, &ascii_out[n_ascii_chars_out], 
+                                         &varicode[half], length-n_ascii_chars_out, n_varicode_bits_out - half);
+    assert(n_ascii_chars_out == length);
+
+    printf("  n_ascii_chars_out: %d\n", n_ascii_chars_out);
+    printf("  average bits/character: %3.2f\n", (float)n_varicode_bits_out/n_ascii_chars_out);
+
+    //printf("ascii_out: %s\n", ascii_out);
+
+    if (memcmp(ascii_in, ascii_out, length) == 0)
+        printf("  Test 1 Pass\n");
+    else
+        printf("  Test 1 Fail\n");
+
+    // 2. Test some ascii with a run of zeros -----------------------------------------------------
+
+    sprintf(ascii_in, "CQ CQ CQ this is VK5DGR");
+        
+    assert(strlen(ascii_in) < length);
+    if (code_num == 2)
+        for(i=0; i<strlen(ascii_in); i++)
+            ascii_in[i] = tolower(ascii_in[i]);
+
+    for(i=0; i<3; i++) {
+        n_varicode_bits_out = varicode_encode(varicode, ascii_in, VARICODE_MAX_BITS*length, strlen(ascii_in), code_num);
+        n_ascii_chars_out   = varicode_decode(&dec_states, ascii_out, varicode, length, n_varicode_bits_out);
+        ascii_out[n_ascii_chars_out] = 0;
+
+        printf("  ascii_out: %s\n", ascii_out);
+        if (strcmp(ascii_in, ascii_out) == 0)
+            printf("  Test 2 Pass\n");
+        else
+            printf("  Test 2 Fail\n");
+
+        memset(varicode, 0, sizeof(short)*20);
+        n_ascii_chars_out = varicode_decode(&dec_states, ascii_out, varicode, length, 20);
+        assert(n_ascii_chars_out == 0);
+    }
+
+    // 3. Test receiving one bit at a time -----------------------------------------------------
+
+    sprintf(ascii_in, "s=vk5dgr qth=adelaide");
+    len = strlen(ascii_in);
+    ascii_in[len] = 13;
+    ascii_in[len+1] = 0;
+
+    assert(strlen(ascii_in) < length);
+    if (code_num == 2)
+        for(i=0; i<strlen(ascii_in); i++)
+            ascii_in[i] = tolower(ascii_in[i]);
+
+    for(i=0; i<3; i++) {
+        n_varicode_bits_out = varicode_encode(varicode, ascii_in, VARICODE_MAX_BITS*length, strlen(ascii_in), code_num);
+        printf("n_varicode_bits_out: %d\n", n_varicode_bits_out);
+
+        n_ascii_chars_out = 0;
+        for(j=0; j<n_varicode_bits_out; j++) {
+            n_out = varicode_decode(&dec_states, &ascii_out[n_ascii_chars_out], &varicode[j], 1, 1);
+            if (n_out) 
+                n_ascii_chars_out++;
+        }
+        ascii_out[n_ascii_chars_out] = 0;
+
+        printf("  ascii_out: %s\n", ascii_out);
+        if (strcmp(ascii_in, ascii_out) == 0)
+            printf("  Test 3 Pass\n");
+        else
+            printf("  Test 3 Fail\n");
+    }
+
+    free(ascii_in);
+    free(ascii_out);
+    free(varicode);
+}
+
+int main(void) {
+    test_varicode(1);
+    test_varicode(2);
+    return 0;
+}
+#endif
diff --git a/codec2/tags/0.4/src/varicode.h b/codec2/tags/0.4/src/varicode.h
new file mode 100644 (file)
index 0000000..625d1e7
--- /dev/null
@@ -0,0 +1,52 @@
+//==========================================================================
+// Name:            varicode.h
+// Purpose:         Varicode encoded and decode functions
+// Created:         Nov 24, 2012
+// Authors:         David Rowe
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#ifndef __VARICODE__
+#define __VARICODE__
+
+#ifdef __cplusplus
+extern "C" {
+
+#endif
+
+#define VARICODE_MAX_BITS (10+2) /* max varicode bits for each ascii character */
+                                 /* 10 bits for code plus 2 0 bits for inter-character space */
+
+struct VARICODE_DEC {
+    int            state;
+    int            n_zeros;
+    int            v_len;
+    unsigned short packed;
+    int            code_num;
+    int            n_in;
+    int            in[2];
+};
+    
+int varicode_encode(short varicode_out[], char ascii_in[], int max_out, int n_in, int code_num);
+void varicode_decode_init(struct VARICODE_DEC *dec_states, int code_num);
+int varicode_decode(struct VARICODE_DEC *dec_states, char ascii_out[], short varicode_in[], int max_out, int n_in);
+void varicode_set_code_num(struct VARICODE_DEC *dec_states, int code_num);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/codec2/tags/0.4/src/varicode_table.h b/codec2/tags/0.4/src/varicode_table.h
new file mode 100644 (file)
index 0000000..08f38fd
--- /dev/null
@@ -0,0 +1,338 @@
+//==========================================================================
+// Name:            varicode_table.h
+// Purpose:         Varicode look up table
+// Created:         Nov 24, 2012
+// Authors:         Clint Turner, KA7OEI,  Peter Martinez, G3PLX
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+/* The following table defines the PKS31 varicode.  There are 128 entries,
+corresponding to ASCII characters 0-127 with two bytes for each entry.  The bits
+for the varicode are to be shifted out MSB-first for both bytes, with the first byte
+in the table being the first one to be sent.
+
+More than one zero in sequence signifies the end of the character (i.e.
+two zeroes are the intercharacter sequence, so at least two zeroes should always be
+sent before the next character is sent.
+
+This file is constructed with information from the article "PSK31 Fundamentals"
+by Peter Martinez, G3PLX by Clint Turner, KA7OEI
+*/
+unsigned char const varicode_table1[256] =     {
+    0b10101010,
+    0b11000000, // 0 NUL
+    0b10110110,
+    0b11000000, // 1 SOH
+    0b10111011,
+    0b01000000, // 2 STX
+    0b11011101,
+    0b11000000, // 3 ETX
+    0b10111010,
+    0b11000000, // 4 EOT
+    0b11010111,
+    0b11000000, // 5 ENQ
+    0b10111011,
+    0b11000000, // 6 ACK
+    0b10111111,
+    0b01000000, // 7 BEL
+    0b10111111,
+    0b11000000, // 8 BS
+    0b11101111,
+    0b00000000, // 9 HT
+    0b11101000,
+    0b00000000, // 10 LF
+    0b11011011,
+    0b11000000, // 11 VT
+    0b10110111,
+    0b01000000, // 12 FF
+    0b11111000,
+    0b00000000, // 13 CR
+    0b11011101,
+    0b01000000, // 14 SO
+    0b11101010,
+    0b11000000, // 15 SI
+    0b10111101,
+    0b11000000, // 16 DLE
+    0b10111101,
+    0b01000000, // 17 DC1
+    0b11101011,
+    0b01000000, // 18 DC2
+    0b11101011,
+    0b11000000, // 19 DC3
+    0b11010110,
+    0b11000000, // 20 DC4
+    0b11011010,
+    0b11000000, // 21 NAK
+    0b11011011,
+    0b01000000, // 22 SYN
+    0b11010101,
+    0b11000000, // 23 ETB
+    0b11011110,
+    0b11000000, // 24 CAN
+    0b11011111,
+    0b01000000, // 25 EM
+    0b11101101,
+    0b11000000, // 26 SUB
+    0b11010101,
+    0b01000000, // 27 ESC
+    0b11010111,
+    0b01000000, // 28 FS
+    0b11101110,
+    0b11000000, // 29 GS
+    0b10111110,
+    0b11000000, // 30 RS
+    0b11011111,
+    0b11000000, // 31 US
+    0b10000000,
+    0b00000000, // 32 SP
+    0b11111111,
+    0b10000000, // 33 !
+    0b10101111,
+    0b10000000, // 34 "
+    0b11111010,
+    0b10000000, // 35 #
+    0b11101101,
+    0b10000000, // 36 $
+    0b10110101,
+    0b01000000, // 37 %
+    0b10101110,
+    0b11000000, // 38 &
+    0b10111111,
+    0b10000000, // 39 '
+    0b11111011,
+    0b00000000, // 40 (
+    0b11110111,
+    0b00000000, // 41 )
+    0b10110111,
+    0b10000000, // 42 *
+    0b11101111,
+    0b10000000, // 43 +
+    0b11101010,
+    0b00000000, // 44 ,
+    0b11010100,
+    0b00000000, // 45 -
+    0b10101110,
+    0b00000000, // 46 .
+    0b11010111,
+    0b10000000, // 47 /
+    0b10110111,
+    0b00000000, // 48 0
+    0b10111101,
+    0b00000000, // 49 1
+    0b11101101,
+    0b00000000, // 50 2
+    0b11111111,
+    0b00000000, // 51 3
+    0b10111011,
+    0b10000000, // 52 4
+    0b10101101,
+    0b10000000, // 53 5
+    0b10110101,
+    0b10000000, // 54 6
+    0b11010110,
+    0b10000000, // 55 7
+    0b11010101,
+    0b10000000, // 56 8
+    0b11011011,
+    0b10000000, // 57 9
+    0b11110101,
+    0b00000000, // 58 :
+    0b11011110,
+    0b10000000, // 59 ;
+    0b11110110,
+    0b10000000, // 60 <
+    0b10101010,
+    0b00000000, // 61 =
+    0b11101011,
+    0b10000000, // 62 >
+    0b10101011,
+    0b11000000, // 63 ?
+    0b10101111,
+    0b01000000, // 64 @
+    0b11111010,
+    0b00000000, // 65 A
+    0b11101011,
+    0b00000000, // 66 B
+    0b10101101,
+    0b00000000, // 67 C
+    0b10110101,
+    0b00000000, // 68 D
+    0b11101110,
+    0b00000000, // 69 E
+    0b11011011,
+    0b00000000, // 70 F
+    0b11111101,
+    0b00000000, // 71 G
+    0b10101010,
+    0b10000000, // 72 H
+    0b11111110,
+    0b00000000, // 73 I
+    0b11111110,
+    0b10000000, // 74 J
+    0b10111110,
+    0b10000000, // 75 K
+    0b11010111,
+    0b00000000, // 76 L
+    0b10111011,
+    0b00000000, // 77 M
+    0b11011101,
+    0b00000000, // 78 N
+    0b10101011,
+    0b00000000, // 79 O
+    0b11010101,
+    0b00000000, // 80 P
+    0b11101110,
+    0b10000000, // 81 Q
+    0b10101111,
+    0b00000000, // 82 R
+    0b11011110,
+    0b00000000, // 83 S
+    0b11011010,
+    0b00000000, // 84 T
+    0b10101011,
+    0b10000000, // 85 U
+    0b11011010,
+    0b10000000, // 86 V
+    0b10101110,
+    0b10000000, // 87 W
+    0b10111010,
+    0b10000000, // 88 X
+    0b10111101,
+    0b10000000, // 89 Y
+    0b10101011,
+    0b01000000, // 90 Z
+    0b11111011,
+    0b10000000, // 91 [
+    0b11110111,
+    0b10000000, // 92 "\"
+    0b11111101,
+    0b10000000, // 93 ]
+    0b10101111,
+    0b11000000, // 94 ^
+    0b10110110,
+    0b10000000, // 95 _ (underline)
+    0b10110111,
+    0b11000000, // 96 `
+    0b10110000,
+    0b00000000, // 97 a
+    0b10111110,
+    0b00000000, // 98 b
+    0b10111100,
+    0b00000000, // 99 c
+    0b10110100,
+    0b00000000, // 100 d
+    0b11000000,
+    0b00000000, // 101 e
+    0b11110100,
+    0b00000000, // 102 f
+    0b10110110,
+    0b00000000, // 103 g
+    0b10101100,
+    0b00000000, // 104 h
+    0b11010000,
+    0b00000000, // 105 i
+    0b11110101,
+    0b10000000, // 106 j
+    0b10111111,
+    0b00000000, // 107 k
+    0b11011000,
+    0b00000000, // 108 l
+    0b11101100,
+    0b00000000, // 109 m
+    0b11110000,
+    0b00000000, // 110 n
+    0b11100000,
+    0b00000000, // 111 o
+    0b11111100,
+    0b00000000, // 112 p
+    0b11011111,
+    0b10000000, // 113 q
+    0b10101000,
+    0b00000000, // 114 r
+    0b10111000,
+    0b00000000, // 115 s
+    0b10100000,
+    0b00000000, // 116 t
+    0b11011100,
+    0b00000000, // 117 u
+    0b11110110,
+    0b00000000, // 118 v
+    0b11010110,
+    0b00000000, // 119 w
+    0b11011111,
+    0b00000000, // 120 x
+    0b10111010,
+    0b00000000, // 121 y
+    0b11101010,
+    0b10000000, // 122 z
+    0b10101101,
+    0b11000000, // 123 {
+    0b11011101,
+    0b10000000, // 124 |
+    0b10101101,
+    0b01000000, // 125 }
+    0b10110101,
+    0b11000000, // 126 ~
+    0b11101101,
+    0b01000000, // 127 (del)
+};
+
+// This code was used on FDMDV version 1, and is more compact that Code 1, but only covers a subset
+// of the ASCII cahacter set
+char const varicode_table2[] = {
+
+    ' ' ,0b11000000,
+    13  ,0b01000000, // CR, end of message
+    '=' ,0b10000000, 
+    '1' ,0b11110000,
+    '2' ,0b01110000,
+    '3' ,0b10110000,
+    '4' ,0b11010000,
+    '5' ,0b01010000,
+    '6' ,0b10010000,
+    '7' ,0b11100000,
+    '8' ,0b01100000,
+    '9' ,0b10100000,
+    'a' ,0b11111100,
+    'b' ,0b01111100,
+    'c' ,0b10111100,
+    'd' ,0b11011100,
+    'e' ,0b01011100,
+    'f' ,0b10011100,
+    'g' ,0b11101100,
+    'h' ,0b01101100,
+    'i' ,0b10101100,
+    'j' ,0b11110100,
+    'k' ,0b01110100,
+    'l' ,0b10110100,
+    'm' ,0b11010100,
+    'n' ,0b01010100,
+    'o' ,0b10010100,
+    'p' ,0b11100100,
+    'q' ,0b01100100,
+    'r' ,0b10100100,
+    's' ,0b11111000,
+    't' ,0b01111000,
+    'u' ,0b10111000,
+    'v' ,0b11011000,
+    'w' ,0b01011000,
+    'x' ,0b10011000,
+    'y' ,0b11101000,
+    'z' ,0b01101000,
+    '0' ,0b10101000
+};
+
diff --git a/codec2/tags/0.4/stm32/Makefile b/codec2/tags/0.4/stm32/Makefile
new file mode 100644 (file)
index 0000000..95b9316
--- /dev/null
@@ -0,0 +1,399 @@
+# Makefile for stm32f4 Codec 2 test programs
+
+###################################################
+
+FLOAT_TYPE=hard
+
+###################################################
+
+BINPATH=/opt/gcc-arm-none-eabi-4_7-2013q1/bin
+CC=$(BINPATH)/arm-none-eabi-gcc
+OBJCOPY=$(BINPATH)/arm-none-eabi-objcopy
+SIZE=$(BINPATH)/arm-none-eabi-size
+
+###################################################
+
+CFLAGS  = -std=gnu99 -O0 -g -Wall -Tstm32_flash.ld -DSTM32F4XX -DCORTEX_M4
+CFLAGS += -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4
+
+ifeq ($(FLOAT_TYPE), hard)
+CFLAGS += -fsingle-precision-constant -Wdouble-promotion
+#CFLAGS += -fsingle-precision-constant
+CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1
+else
+CFLAGS += -msoft-float
+endif
+
+###################################################
+
+# Definitions for the STM32F4 Standard Peripheral Library
+
+PERIPHLIBURL    = http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware/
+PERIPHLIBZIP    = stm32f4_dsp_stdperiph_lib.zip
+PERIPHLIBVER   = V1.5.0
+PERIPHLIBNAME  = STM32F4xx_DSP_StdPeriph_Lib
+PERIPHLIBDIR   = $(PERIPHLIBNAME)
+CMSIS          = $(PERIPHLIBDIR)/Libraries/CMSIS
+STM32F4LIB     = $(PERIPHLIBDIR)/Libraries/STM32F4xx_StdPeriph_Driver
+STM32F4TEMPLATE        = $(PERIPHLIBDIR)/Project/STM32F4xx_StdPeriph_Templates
+DSPLIB          = $(PERIPHLIBDIR)/Libraries/CMSIS/DSP_Lib
+
+CFLAGS         += -DUSE_STDPERIPH_DRIVER -I$(STM32F4LIB)/inc -I$(STM32F4TEMPLATE)
+CFLAGS         += -I$(CMSIS)/Include -I$(CMSIS)/Device/ST/STM32F4xx/Include
+CFLAGS         += -DARM_MATH_CM4
+
+###################################################
+
+# Codec 2
+
+CODEC2_SRC=../src
+CODEC2_SRCS=\
+$(CODEC2_SRC)/lpc.c \
+$(CODEC2_SRC)/nlp.c \
+$(CODEC2_SRC)/postfilter.c \
+$(CODEC2_SRC)/sine.c \
+$(CODEC2_SRC)/codec2.c \
+$(CODEC2_SRC)/kiss_fft.c \
+$(CODEC2_SRC)/interp.c \
+$(CODEC2_SRC)/lsp.c \
+$(CODEC2_SRC)/phase.c \
+$(CODEC2_SRC)/quantise.c \
+$(CODEC2_SRC)/pack.c \
+$(CODEC2_SRC)/codebook.c \
+$(CODEC2_SRC)/codebookd.c \
+$(CODEC2_SRC)/codebookjvm.c \
+$(CODEC2_SRC)/codebookge.c \
+$(CODEC2_SRC)/dump.c \
+$(CODEC2_SRC)/fdmdv.c \
+$(CODEC2_SRC)/freedv_api.c \
+$(CODEC2_SRC)/varicode.c \
+$(CODEC2_SRC)/golay23.c
+
+CFLAGS += -D__EMBEDDED__ 
+
+#enable this for dump files to help verify optimisation
+#CFLAGS += -DDUMP
+
+CFLAGS += -I../src
+CFLAGS += -I../unittest
+CFLAGS += -Iinc
+
+FFT_TEST_SRCS = \
+$(DSPLIB)/Examples/arm_fft_bin_example/ARM/arm_fft_bin_data.c \
+fft_test.c \
+src/startup_stm32f4xx.s \
+stm32f4_machdep.c \
+gdb_stdio.c \
+../src/kiss_fft.c
+
+###################################################
+
+vpath %.c src
+vpath %.a lib
+
+ROOT=$(shell pwd)
+
+# Library paths
+
+LIBPATHS = 
+
+# Libraries to link
+
+LIBS = libstm32f4.a -lg -lnosys -lm
+
+# startup file
+
+SRCS += src/startup_stm32f4xx.s src/init.c
+
+OBJS = $(SRCS:.c=.o)
+
+###################################################
+
+all: libstm32f4.a codec2_profile.elf fft_test.elf dac_ut.elf dac_play.elf adc_rec.elf pwm_ut.elf fdmdv_profile.elf sm1000_leds_switches_ut.elf sm1000.elf adcdac_ut.elf freedv_tx_profile.elf freedv_rx_profile.elf adc_sd.elf usb_vcp_ut.elf fdmdv_dump_rt.elf tuner_ut.elf fast_dac_ut.elf
+
+dl/$(PERIPHLIBZIP):
+       mkdir -p dl
+       cd dl; wget $(PERIPHLIBURL)/$(PERIPHLIBZIP)
+
+$(PERIPHLIBDIR): dl/$(PERIPHLIBZIP)
+       cd dl; unzip $(PERIPHLIBZIP)
+       mv dl/$(PERIPHLIBDIR) $(PERIPHLIBDIR)
+
+libstm32f4.a: $(PERIPHLIBDIR)
+       $(MAKE) $(STM32F4TEMPLATE)/system_stm32f4xx.o
+       for F in $(STM32F4LIB)/src/*.c ; do $(MAKE) $${F%.c}.o ; done
+       for F in $(CMSIS)/DSP_Lib/Source/*/*.c ; do $(MAKE) $${F%.c}.o ; done
+       find $(PERIPHLIBDIR) -type f -name '*.o' -exec $(AR) crs libstm32f4.a {} ";"    
+
+####################################################
+
+CODEC2_PROFILE_SRCS=\
+src/codec2_profile.c \
+src/gdb_stdio.c \
+src/stm32f4_machdep.c \
+src/startup_stm32f4xx.s \
+src/init.c \
+src/system_stm32f4xx.c
+CODEC2_PROFILE_SRCS += $(CODEC2_SRCS)
+
+codec2_profile.elf: $(CODEC2_PROFILE_SRCS) 
+       $(CC) $(CFLAGS) -DPROFILE $^ -o $@ $(LIBPATHS) $(LIBS)
+
+fft_test.elf: $(FFT_TEST_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+DAC_UT_SRCS=\
+src/dac_ut.c \
+../src/fifo.c \
+src/stm32f4_dac.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+dac_ut.elf: $(DAC_UT_SRCS)
+       $(CC) $(CFLAGS) -O0 $^ -o $@ $(LIBPATHS) $(LIBS)
+       $(OBJCOPY) -O binary dac_ut.elf dac_ut.bin
+
+FAST_DAC_UT_SRCS=\
+src/fast_dac_ut.c \
+../src/fifo.c \
+src/iir_duc.c \
+src/gdb_stdio.c \
+src/stm32f4_dacduc.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+fast_dac_ut.elf: $(FAST_DAC_UT_SRCS)
+       $(CC) $(CFLAGS) -O3 $^ -o $@ $(LIBPATHS) $(LIBS)
+       $(OBJCOPY) -O binary fast_dac_ut.elf fast_dac_ut.bin
+
+ADCDAC_UT_SRCS=\
+src/adcdac_ut.c \
+../src/fifo.c \
+src/stm32f4_dac.c \
+src/stm32f4_adc.c \
+src/sm1000_leds_switches.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+adcdac_ut.elf: $(ADCDAC_UT_SRCS)
+       $(CC) $(CFLAGS) -O0 $^ -o $@ $(LIBPATHS) $(LIBS)
+       $(OBJCOPY) -O binary adcdac_ut.elf adcdac_ut.bin
+
+DAC_PLAY_SRCS=\
+src/dac_play.c \
+../src/fifo.c \
+gdb_stdio.c \
+src/stm32f4_dac.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+dac_play.elf: $(DAC_PLAY_SRCS)
+       $(CC) $(CFLAGS) -O0 $^ -o $@ $(LIBPATHS) $(LIBS)
+
+ADC_REC_SRCS=\
+src/adc_rec.c \
+../src/fifo.c \
+gdb_stdio.c \
+src/stm32f4_adc.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+adc_rec.elf: $(ADC_REC_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+ADC_SD_SRCS=\
+src/adc_sd.c \
+../src/fifo.c \
+gdb_stdio.c \
+src/stm32f4_adc.c \
+src/stm32f4_dac.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+adc_sd.elf: $(ADC_SD_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+PWM_UT_SRCS=\
+gdb_stdio.c \
+src/stm32f4_pwm.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+pwm_ut.elf: $(PWM_UT_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+POWER_UT_SRCS=\
+src/power_ut.c \
+gdb_stdio.c \
+../src/fifo.c \
+src/stm32f4_adc.c \
+src/stm32f4_dac.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c \
+src/stm32f4_machdep.c \
+
+POWER_UT_SRCS += $(CODEC2_SRCS)
+
+power_ut.elf: $(POWER_UT_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+USB_VCP=\
+usb_conf/usb_bsp.c \
+usb_conf/usbd_desc.c \
+usb_conf/usbd_usr.c \
+usb_lib/cdc/usbd_cdc_core.c \
+usb_lib/cdc/usbd_cdc_vcp.c \
+usb_lib/core/usbd_core.c \
+usb_lib/core/usbd_ioreq.c \
+usb_lib/core/usbd_req.c \
+usb_lib/otg/usb_core.c \
+usb_lib/otg/usb_dcd.c \
+usb_lib/otg/usb_dcd_int.c
+
+USB_VCP_UT=\
+src/usb_vcp_ut.c \
+src/stm32f4_usb_vcp.c \
+src/sm1000_leds_switches.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c 
+
+USB_VCP_UT+=$(USB_VCP)
+
+CFLAGS += -Iusb_conf -Iusb_lib/cdc -Iusb_lib/core -Iusb_lib/otg
+
+usb_vcp_ut.elf: $(USB_VCP_UT)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+FDMDV_PROFILE_SRCS=\
+src/fdmdv_profile.c \
+gdb_stdio.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c \
+src/stm32f4_machdep.c
+
+FDMDV_PROFILE_SRCS += $(CODEC2_SRCS)
+
+fdmdv_profile.elf: $(FDMDV_PROFILE_SRCS)
+       $(CC) $(CFLAGS) -DPROFILE $^ -o $@ $(LIBPATHS) $(LIBS)
+
+SM1000_LEDS_SWITCHES_UT_SRCS=\
+src/sm1000_leds_switches_ut.c \
+src/sm1000_leds_switches.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+sm1000_leds_switches_ut.elf: $(SM1000_LEDS_SWITCHES_UT_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+SM1000_SRCS=\
+src/sm1000_main.c \
+src/sm1000_leds_switches.c \
+../src/fifo.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c 
+
+SM1000_SRCS += $(CODEC2_SRCS)
+
+src/stm32f4_dac.o: src/stm32f4_dac.c
+       $(CC) $(CFLAGS)  $^ -c -o $@ 
+
+src/stm32f4_adc.o: src/stm32f4_adc.c
+       $(CC) $(CFLAGS)  $^ -c -o $@ 
+
+sm1000.elf: $(SM1000_SRCS) src/stm32f4_dac.o src/stm32f4_adc.o
+       $(CC) $(CFLAGS) -O3 $^ -o $@ $(LIBPATHS) $(LIBS)
+       $(OBJCOPY) -O binary sm1000.elf sm1000.bin
+
+FREEDV_TX_PROFILE_SRCS=\
+src/freedv_tx_profile.c \
+src/stm32f4_machdep.c \
+gdb_stdio.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c 
+
+FREEDV_TX_PROFILE_SRCS += $(CODEC2_SRCS)
+
+freedv_tx_profile.elf: $(FREEDV_TX_PROFILE_SRCS)
+       $(CC) $(CFLAGS) -DPROFILE $^ -o $@ $(LIBPATHS) $(LIBS)
+
+FREEDV_RX_PROFILE_SRCS=\
+src/freedv_rx_profile.c \
+src/stm32f4_machdep.c \
+gdb_stdio.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c 
+
+FREEDV_RX_PROFILE_SRCS += $(CODEC2_SRCS)
+
+freedv_rx_profile.elf: $(FREEDV_RX_PROFILE_SRCS)
+       $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+
+FDMDV_DUMP_RT_SRCS=\
+src/fdmdv_dump_rt.c \
+src/sm1000_leds_switches.c \
+../src/fifo.c \
+src/debugblinky.c \
+gdb_stdio.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c 
+
+FDMDV_DUMP_RT_SRCS += $(CODEC2_SRCS)
+
+fdmdv_dump_rt.elf: $(FDMDV_DUMP_RT_SRCS) src/stm32f4_dac.o src/stm32f4_adc.o
+       $(CC) $(CFLAGS) -O3 $^ -o $@ $(LIBPATHS) $(LIBS)
+
+# ---------------------------------------------------------------------------
+
+TUNER_UT_SRCS=\
+src/tuner_ut.c \
+gdb_stdio.c \
+../src/fifo.c \
+src/stm32f4_dac.c \
+src/iir_tuner.c \
+src/sm1000_leds_switches.c \
+src/debugblinky.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c \
+../src/fm.c
+
+# this needs to be compiled without the optimiser or ugly things happen
+# would be nice to work out why as ISRs need to run fast
+
+src/stm32f4_adc_tuner.o: src/stm32f4_adc_tuner.c
+       $(CC) $(CFLAGS) $^ -c -o $@ 
+
+tuner_ut.elf: $(TUNER_UT_SRCS) src/stm32f4_adc_tuner.o
+       $(CC) $(CFLAGS) -O3 $^ -o $@ $(LIBPATHS) $(LIBS)
+       $(OBJCOPY) -O binary tuner_ut.elf tuner_ut.bin
+
+# ---------------------------------------------------------------------------------
+
+clean:
+       rm -f *.o
+       rm -f *.elf
+       rm -f libstm32f4.a      
+       find $(PERIPHLIBDIR) -type f -name '*.o' -exec rm {} \;
diff --git a/codec2/tags/0.4/stm32/README.txt b/codec2/tags/0.4/stm32/README.txt
new file mode 100644 (file)
index 0000000..82eda8b
--- /dev/null
@@ -0,0 +1,123 @@
+README.txt
+codec2 support for the stm32f4
+David Rowe May 2013
+
+Introduction
+------------
+
+The Makefile generates several unit tests, stm32f4_codec2.elf is the
+most important.  It's is equivalent to c2demo.c and runs the encoder
+and decoder on raw speech files.  It also gathers and prints profiling
+information and can dump the codec states to compare changes.
+
+gdb_stdio system
+----------------
+
+stutil contains a gdb server that talks to the target firmware.
+stutil has been patched to allow "semihosting": stdio requests on the
+target are re-directed to the host PC.  So if you call printf on the
+target, it appears on the host PC console.  With printf/fread/fwrite
+and gdb it makes developing on bare metal just like developing on any
+command line gcc system.
+
+The root path for files accessed by the target is the path st-util is
+run from.
+
+Getting Started
+---------------
+
+. Install arm toolchain binary
+
+   $ cd ~
+   $ wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q1-update/+download/gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2
+   $ tar xjf gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2
+
+. Build codec2 unit test:
+
+   $ cd codec2_dev/stm32
+   In Makefile: edit the BINPATH variable for your toolchain location
+                edit PERIPHLIBVER for the current version of the peripheral
+                 library, currently V1.3.0
+                delete power_ut.elf target from the all: target
+   $ make
+   after make downloads the peripheral library, you will get a compile error:
+   #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
+   edit STM32F4xx_DSP_StdPeriph_Lib_V1.3.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
+   and at the top of that file, uncomment the appropriate line for your target
+   processor.
+   $ make
+
+. Build stlink:
+
+   $ cd ~
+   $ git clone https://github.com/shenki/stlink.git
+   $ cd stlink
+   ~/stlink$ sudo apt-get install libusb-1.0-0-dev libelf-dev automake 
+   ~/stlink$ ./autogen.sh
+   ~/stlink$ ./configure
+   ~/stlink$ make 
+
+. Place a copy of hts1a.raw in the stlink directory and start st-util:
+
+   ~/stlink$ cp ~/codec2-dev/raw/hts1a.raw stm_in.raw
+   ~/stlink$ sudo ./st-util -f /home/david/codec2-dev/stm32/stm32f4_codec2.elf
+
+. In _another_ console start gdb:
+
+   $ ~/codec2-dev/stm32$ ~/gcc-arm-none-eabi-4_7-2013q1/bin/arm-none-eabi-gdb stm32f4_codec2.elf
+
+   (gdb) tar ext :4242
+
+   (gdb) load
+   `/home/david/codec2-dev/stm32/fft_test.elf' has changed; re-reading symbols.
+    Loading section .isr_vector, size 0x188 lma 0x8000000
+    Loading section .text, size 0x1a4b4 lma 0x8000188
+    Loading section .data, size 0x28f0 lma 0x801a63c
+    Start address 0x800a885, load size 118572
+    Transfer rate: 13 KB/sec, 10779 bytes/write.
+. Power cycle Discovery.
+
+. Stop st-util using ctrl-C, then restart st-util
+
+. Back to gdb:
+
+    (gdb) tar ext :4242
+    A program is being debugged already.  Kill it? (y or n) y
+    Remote connection closed
+    (gdb) tar ext :4242
+    Remote debugging using :4242
+    Reset_Handler () at lib/startup_stm32f4xx.s:69
+    69   movs  r1, #0
+
+   (gdb) c
+   Continuing.
+
+. gdb will prints various debug messages, and the codec output file
+  will be written to ~/stlink.
+  
+  ~/stlink$ play -r 8000 -s -2 stm_out.raw
+
+Process
+-------
+
+1. Profiling macros, grep on TIMER_xxxx
+
+2. Enable DUMP variable in Makefile to dump files, note profiling
+   times will be corrupted by this due to latency in talking to Host
+
+3. Compare outputs using octave/diff_codec.  Example:
+
+   octave:> diff_codec("~/stlink/ref/hts1a_out_1300.raw", "~/stlink/hts1a_out_1300.raw","~/stlink/stm32f4", "~/stlink/ref/stm32f4")
+
+Gotcha
+------
+
+Using printf rather than gdb_stdio_printf, regular stdio functions are
+stubbed out so will link, just nothing will happen.
+
+TODO
+----
+
+ + check if "CFLAGS:  -mlittle-endian -mthumb -mthumb-interwork" needed
+ + double check if _fini hack is OK (src/init.c)
diff --git a/codec2/tags/0.4/stm32/inc/debugblinky.h b/codec2/tags/0.4/stm32/inc/debugblinky.h
new file mode 100644 (file)
index 0000000..0561272
--- /dev/null
@@ -0,0 +1,33 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: debugblinky.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 12 August 2014
+
+  Configures GPIO pins used for debug blinkies
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 __DEBUGBLINKY__
+#define __DEBUGBLINKY__
+
+void init_debug_blinky(void);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/gdb_stdio.h b/codec2/tags/0.4/stm32/inc/gdb_stdio.h
new file mode 100644 (file)
index 0000000..eafabca
--- /dev/null
@@ -0,0 +1,47 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: gdb_stdio.h
+  AUTHOR......: David Rowe
+  DATE CREATED: April 23 2013
+
+  Some stdio I/O functions that perform I/O on the host using gdb.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 __GDB_STDIO__
+#define __GDB_STDIO__
+
+#include <stdio.h>
+#include <stdarg.h>
+
+void gdb_stdio_fprintf(FILE *file, const char *format, ...);
+void gdb_stdio_printf(const char *format, ...);
+FILE *gdb_stdio_fopen(char file_name[], char mode[]);
+void gdb_stdio_fclose(FILE *file);
+int gdb_stdio_fwrite(void *ptr, int size, int nmemb, FILE *file);
+int gdb_stdio_fread(void *ptr, int size, int nmemb, FILE *file);
+
+#define printf gdb_stdio_printf
+#define fopen gdb_stdio_fopen
+#define fclose gdb_stdio_fclose
+#define fread gdb_stdio_fread
+#define fwrite gdb_stdio_fwrite
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/iir_duc.h b/codec2/tags/0.4/stm32/inc/iir_duc.h
new file mode 100644 (file)
index 0000000..b20b0b5
--- /dev/null
@@ -0,0 +1,37 @@
+ /*---------------------------------------------------------------------------*\
+
+  FILE........: iir_duc.h
+  AUTHOR......: Brady O'Brien
+  DATE CREATED: 6 Mar 2015
+
+  Interapolator/Filter for IF upconversion
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 Brady O'Brien
+
+  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 __IIR_DUC_H
+#define __IIR_DUC_H
+#include "comp.h"
+
+void iir_upconv(float modin[],unsigned short dac_out[]);
+void iir_upconv_fixp(int modin[], unsigned short dac_out[]);
+void upconv_48c_80r(COMP comp_8[],int real_80[],int count);
+void upconv_8c_80r(COMP comp_8[],float real_80[],int count);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/iir_tuner.h b/codec2/tags/0.4/stm32/inc/iir_tuner.h
new file mode 100644 (file)
index 0000000..7788a8d
--- /dev/null
@@ -0,0 +1,36 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: iir_tuner.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 20 Feb 2015
+
+  Header file for IIR tuner function.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __IIR_TUNER__
+#define __IIR_TUNER__
+
+#define IIR_TUNER_DEC_50_10_FILT_MEM 100
+
+void iir_tuner(float dec_50[], unsigned short adc_buf[]);
+void iir_tuner_dec_50_to_10(float dec_10[], float dec_50[], int n);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/sm1000_leds_switches.h b/codec2/tags/0.4/stm32/inc/sm1000_leds_switches.h
new file mode 100644 (file)
index 0000000..b98f74d
--- /dev/null
@@ -0,0 +1,46 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: sm1000_leds_switches.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 18 July 2014
+
+  Functions for controlling LEDs and reading switches on SM1000.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 __LEDS_SWITCHES__
+#define __LEDS_SWITCHES__
+
+void sm1000_leds_switches_init(void);
+
+void led_pwr(int state);
+void led_ptt(int state);
+void led_rt(int state);
+void led_err(int state);
+void not_cptt(int state);
+
+int switch_ptt(void);
+int switch_select(void);
+int switch_back(void);
+int ext_ptt(void);
+
+void ColorfulRingOfDeath(int code);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/stm32f4_adc.h b/codec2/tags/0.4/stm32/inc/stm32f4_adc.h
new file mode 100644 (file)
index 0000000..d819fa7
--- /dev/null
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_adc.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 30 May 2014
+
+  Two channel FIFO buffered ADC driver module for STM32F4.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 __STM32F4_ADC__
+#define __STM32F4_ADC__
+
+#define ADC_BUF_SZ   320
+
+void adc_open(int fifo_sz);
+int adc1_read(short buf[], int n); /* ADC1 Pin PA1 */
+int adc2_read(short buf[], int n); /* ADC2 Pin PA2 */
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/stm32f4_adc_tuner.h b/codec2/tags/0.4/stm32/inc/stm32f4_adc_tuner.h
new file mode 100644 (file)
index 0000000..88f16a1
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_adc_tuner.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 19 Feb 2015
+
+  Single channel ADC driver module for STM32F4 that samples pin PA1 at
+  2 MHz and down converts to 50 kHz, with "tuning" centred at 500 kHz.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 __STM32F4_ADC_TUNER__
+#define __STM32F4_ADC_TUNER__
+
+#define ADC_TUNER_M  55   /* decimation rate */
+#define ADC_TUNER_N  160
+#define ADC_TUNER_BUF_SZ  (ADC_TUNER_M*ADC_TUNER_N)
+
+void adc_open(int fifo_sz);
+int adc1_read(short buf[], int n); /* ADC1 Pin PA1 */
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/stm32f4_dac.h b/codec2/tags/0.4/stm32/inc/stm32f4_dac.h
new file mode 100644 (file)
index 0000000..d0b8259
--- /dev/null
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_dac.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 1 June 2013
+
+  Two channel FIFO buffered DAC driver module for STM32F4.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 __STM32F4_DAC__
+#define __STM32F4_DAC__
+
+#define DAC_BUF_SZ   320
+
+void dac_open(int fifo_sz);
+int dac1_write(short buf[], int n); /* DAC1 pin PA4 */
+int dac2_write(short buf[], int n); /* DAC2 pin PA5 */
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/stm32f4_dacduc.h b/codec2/tags/0.4/stm32/inc/stm32f4_dacduc.h
new file mode 100644 (file)
index 0000000..6a1ba20
--- /dev/null
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_dac.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 1 June 2013
+
+  Two channel FIFO buffered DAC driver module for STM32F4. DAC1 is fixed at
+  Fs=2Mhz
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 __STM32F4_DAC__
+#define __STM32F4_DAC__
+
+#define DUC_N 160
+#define DUC_M  25
+#define DUC_48N 96                     //This is 3/5th DUC_N
+#define DAC_DUC_BUF_SZ DUC_M*DUC_N
+#define DAC_BUF_SZ 2048
+
+void fast_dac_open(int dac1_fifo_size,int dac2_fifo_size);
+int dac1_write(short buf[], int n); /* DAC1 pin PA4 */
+int dac2_write(short buf[], int n); /* DAC2 pin PA5 */
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/stm32f4_usb_vcp.h b/codec2/tags/0.4/stm32/inc/stm32f4_usb_vcp.h
new file mode 100644 (file)
index 0000000..384f3f0
--- /dev/null
@@ -0,0 +1,23 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_usb_vcp.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 4 Sep 2014
+
+  USB Virtual COM Port (VCP) module.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef __STM32F4_USB_VCP__
+#define __STM32F4_USB_VCP__
+
+#include <stdint.h>
+
+void usb_vcp_init(void);
+
+int VCP_get_char(uint8_t *buf);
+int VCP_get_string(uint8_t *buf);
+void VCP_put_char(uint8_t buf);
+void VCP_send_str(uint8_t* buf);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/inc/stm32f4xx_conf.h b/codec2/tags/0.4/stm32/inc/stm32f4xx_conf.h
new file mode 100644 (file)
index 0000000..a791166
--- /dev/null
@@ -0,0 +1,94 @@
+/**\r
+  ******************************************************************************\r
+  * @file    stm32f4xx_conf.h  \r
+  * @author  MCD Application Team\r
+  * @version V1.0.0\r
+  * @date    19-September-2011\r
+  * @brief   Library configuration file.\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+  *\r
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>\r
+  ******************************************************************************\r
+  */ \r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __STM32F4xx_CONF_H\r
+#define __STM32F4xx_CONF_H\r
+\r
+#if defined  (HSE_VALUE)\r
+/* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */\r
+ #undef HSE_VALUE\r
+ #define HSE_VALUE    ((uint32_t)8000000) \r
+#endif /* HSE_VALUE */\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+/* Uncomment the line below to enable peripheral header file inclusion */\r
+#include "stm32f4xx_adc.h"\r
+#include "stm32f4xx_can.h"\r
+#include "stm32f4xx_crc.h"\r
+#include "stm32f4xx_cryp.h"\r
+#include "stm32f4xx_dac.h"\r
+#include "stm32f4xx_dbgmcu.h"\r
+#include "stm32f4xx_dcmi.h"\r
+#include "stm32f4xx_dma.h"\r
+#include "stm32f4xx_exti.h"\r
+#include "stm32f4xx_flash.h"\r
+#include "stm32f4xx_fsmc.h"\r
+#include "stm32f4xx_hash.h"\r
+#include "stm32f4xx_gpio.h"\r
+#include "stm32f4xx_i2c.h"\r
+#include "stm32f4xx_iwdg.h"\r
+#include "stm32f4xx_pwr.h"\r
+#include "stm32f4xx_rcc.h"\r
+#include "stm32f4xx_rng.h"\r
+#include "stm32f4xx_rtc.h"\r
+#include "stm32f4xx_sdio.h"\r
+#include "stm32f4xx_spi.h"\r
+#include "stm32f4xx_syscfg.h"\r
+#include "stm32f4xx_tim.h"\r
+#include "stm32f4xx_usart.h"\r
+#include "stm32f4xx_wwdg.h"\r
+#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/* If an external clock source is used, then the value of the following define \r
+   should be set to the value of the external clock source, else, if no external \r
+   clock is used, keep this define commented */\r
+/*#define I2S_EXTERNAL_CLOCK_VAL   12288000 */ /* Value of the external clock in Hz */\r
+\r
+\r
+/* Uncomment the line below to expanse the "assert_param" macro in the \r
+   Standard Peripheral Library drivers code */\r
+/* #define USE_FULL_ASSERT    1 */\r
+\r
+/* Exported macro ------------------------------------------------------------*/\r
+#ifdef  USE_FULL_ASSERT\r
+\r
+/**\r
+  * @brief  The assert_param macro is used for function's parameters check.\r
+  * @param  expr: If expr is false, it calls assert_failed function\r
+  *   which reports the name of the source file and the source\r
+  *   line number of the call that failed. \r
+  *   If expr is true, it returns no value.\r
+  * @retval None\r
+  */\r
+  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))\r
+/* Exported functions ------------------------------------------------------- */\r
+  void assert_failed(uint8_t* file, uint32_t line);\r
+#else\r
+  #define assert_param(expr) ((void)0)\r
+#endif /* USE_FULL_ASSERT */\r
+\r
+#endif /* __STM32F4xx_CONF_H */\r
+\r
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r
diff --git a/codec2/tags/0.4/stm32/src/adc_rec.c b/codec2/tags/0.4/stm32/src/adc_rec.c
new file mode 100644 (file)
index 0000000..c31c899
--- /dev/null
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: adc_rec.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 30 May 2014\r
+\r
+  Records a 16 kHz sample rate raw file from one of the ADC channels,\r
+  which are connected to pins PA1 (ADC1) and PA2 (ADC2).\r
+\r
+  Note the semi-hosting system isn't fast enough to transfer 2 16 kHz\r
+  streams at once.\r
+  \r
+  ~/stlink$ sudo ./st-util -f ~/codec2-dev/stm32/adc_rec.elf\r
+  ~/codec2-dev/stm32$ ~/gcc-arm-none-eabi-4_7-2013q1/bin/arm-none-eabi-gdb adc_rec.elf\r
+  \r
+  (when finished) \r
+  $ play -r 16000 -s -2 ~/stlink/adc.raw\r
+\r
+  adc1 -> "from radio"  \r
+  adc2 -> "mic amp"\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdlib.h>\r
+#include "stm32f4_adc.h"\r
+#include "gdb_stdio.h"\r
+#include "stm32f4xx_gpio.h"\r
+\r
+#define REC_TIME_SECS 10\r
+#define  N  (ADC_BUF_SZ*6)\r
+#define FS  16000\r
+\r
+extern int adc_overflow1;\r
+extern int adc_overflow2;\r
+\r
+int main(void){\r
+    short  buf[N];\r
+    FILE  *fadc;\r
+    int    i, bufs;\r
+\r
+    fadc = fopen("adc.raw", "wb");\r
+    if (fadc == NULL) {\r
+        printf("Error opening input file: adc.raw\n\nTerminating....\n");\r
+        exit(1);\r
+    }\r
+    bufs = FS*REC_TIME_SECS/N;\r
+\r
+    printf("Starting!\n");\r
+    adc_open(4*N);\r
+\r
+    for(i=0; i<bufs; i++) {\r
+        while(adc2_read(buf, N) == -1);\r
+        fwrite(buf, sizeof(short), N, fadc);  \r
+        printf("adc_overflow1: %d  adc_overflow2: %d   \n", adc_overflow1, adc_overflow2);\r
+    }\r
+    fclose(fadc);\r
+\r
+    printf("Finished!\n");\r
+}\r
diff --git a/codec2/tags/0.4/stm32/src/adc_sd.c b/codec2/tags/0.4/stm32/src/adc_sd.c
new file mode 100644 (file)
index 0000000..91414d2
--- /dev/null
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: adc_sd.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 30 May 2014\r
+\r
+  Measures the std deviation of the ADC signals.  Used to check noise\r
+  levels on each ADC.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdlib.h>\r
+#include <math.h>\r
+#include "stm32f4_adc.h"\r
+#include "stm32f4_dac.h"\r
+#include "gdb_stdio.h"\r
+\r
+#define REC_TIME_SECS 10\r
+#define  N  (ADC_BUF_SZ*4)\r
+#define FS  16000\r
+\r
+static float calc_sd(short x[], int n) {\r
+    float sum, mean, sum_diff, sd;\r
+    int   i;\r
+\r
+    sum = 0.0;\r
+    for(i=0; i<n;i++) {\r
+        sum += (float)x[i];\r
+    }\r
+    mean = sum/n;\r
+\r
+    sum_diff = 0.0;\r
+    for(i=0; i<n;i++) {\r
+        sum_diff += ((float)x[i] - mean)*((float)x[i] - mean);\r
+    }\r
+    \r
+    sd = sqrtf(sum_diff/n);\r
+\r
+    return sd;\r
+}\r
+\r
+int main(void){\r
+    short  buf[N];\r
+    float  sd1, sd2;\r
+\r
+    adc_open(2*N);\r
+\r
+    printf("Starting!\n");\r
+    while(1) {\r
+        while(adc1_read(buf, N) == -1);\r
+        sd1 = calc_sd(buf, N);\r
+        while(adc2_read(buf, N) == -1);\r
+        sd2 = calc_sd(buf, N);\r
+\r
+        printf("adc1: %5.1f adc2: %5.1f\n", (double)sd1, (double)sd2);\r
+    }\r
+\r
+}\r
diff --git a/codec2/tags/0.4/stm32/src/adcdac_ut.c b/codec2/tags/0.4/stm32/src/adcdac_ut.c
new file mode 100644 (file)
index 0000000..423f45a
--- /dev/null
@@ -0,0 +1,70 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: adcdac_ut.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: May 31 201310 Aug 2014\r
+\r
+  Echoes ADC2 input (mic) to DAC2 output (speaker) on SM1000.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2013 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include "stm32f4_dac.h"\r
+#include "stm32f4_adc.h"\r
+#include "sm1000_leds_switches.h"\r
+\r
+#define SINE_SAMPLES   32\r
+\r
+\r
+/* 32 sample sine wave which at Fs=16kHz will be 500Hz.  Note samples\r
+   are 16 bit 2's complement, the DAC driver convertsto 12 bit\r
+   unsigned. */\r
+\r
+short aSine[] = {\r
+     -16,    6384,   12528,   18192,   23200,   27232,   30256,   32128,\r
+   32752,   32128,   30256,   27232,   23152,   18192,   12528,    6384,\r
+     -16,   -6416,  -12560,  -18224,  -23184,  -27264,  -30288,  -32160,\r
+  -32768,  -32160,  -30288,  -27264,  -23184,  -18224,  -12560,   -6416\r
+};\r
+\r
+int main(void) {\r
+    short buf[SINE_SAMPLES];\r
+    int   i;\r
+\r
+    dac_open(4*DAC_BUF_SZ);\r
+    adc_open(4*ADC_BUF_SZ);\r
+    sm1000_leds_switches_init();\r
+\r
+    while (1) {\r
+\r
+        /* keep DAC FIFOs topped up */\r
+\r
+        while(adc2_read(buf, SINE_SAMPLES) == -1);\r
+        \r
+        if (!switch_select()) {\r
+            for(i=0; i<SINE_SAMPLES; i++)\r
+                buf[i] = aSine[i];\r
+        }\r
+            \r
+        dac2_write(buf, SINE_SAMPLES);\r
+    }\r
+   \r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/codec2_profile.c b/codec2/tags/0.4/stm32/src/codec2_profile.c
new file mode 100644 (file)
index 0000000..c8c6e0e
--- /dev/null
@@ -0,0 +1,182 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: codec2_profile.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 30 May 2013\r
+\r
+  Profiling Codec 2 operation on the STM32F4.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "gdb_stdio.h"\r
+#include "codec2.h"\r
+#include "dump.h"\r
+#include "sine.h"\r
+#include "machdep.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+static void c2demo(int mode, char inputfile[], char outputfile[])\r
+{\r
+    struct CODEC2 *codec2;\r
+    short         *inbuf, *outbuf;\r
+    unsigned char *bits;\r
+    int            nsam, nbit;\r
+    FILE          *fin, *fout;\r
+    int            frame;\r
+    PROFILE_VAR(enc_start, dec_start);\r
+\r
+    codec2 = codec2_create(mode);\r
+    nsam = codec2_samples_per_frame(codec2);\r
+    outbuf = (short*)malloc(nsam*sizeof(short));\r
+    inbuf = (short*)malloc(nsam*sizeof(short));\r
+    nbit = codec2_bits_per_frame(codec2);\r
+    bits = (unsigned char*)malloc(nbit*sizeof(char));\r
+\r
+    fin = fopen(inputfile, "rb");\r
+    if (fin == NULL) {\r
+        printf("Error opening input file: %s\n\nTerminating....\n",inputfile);\r
+        exit(1);\r
+    }\r
+\r
+    fout = fopen(outputfile, "wb");\r
+    if (fout == NULL) {\r
+        printf("Error opening output file: %s\n\nTerminating....\n",outputfile);\r
+        exit(1);\r
+    }\r
+\r
+    #ifdef DUMP\r
+    dump_on("stm32f4");\r
+    #endif\r
+    frame = 0;\r
+\r
+    while (fread(inbuf, sizeof(short), nsam, fin) == nsam) {\r
+        PROFILE_SAMPLE(enc_start);\r
+        codec2_encode(codec2, bits, inbuf);\r
+        PROFILE_SAMPLE_AND_LOG(dec_start, enc_start, "  enc");     \r
+       codec2_decode(codec2, outbuf, bits);\r
+        PROFILE_SAMPLE_AND_LOG2(dec_start, "  dec");     \r
+        PROFILE_SAMPLE_AND_LOG2(enc_start, "  enc & dec");     \r
+        fwrite((char*)outbuf, sizeof(short), nsam, fout);\r
+        printf("frame: %d\n", ++frame);\r
+        machdep_profile_print_logged_samples();\r
+    }\r
+\r
+    #ifdef DUMP\r
+    dump_off("sm32f4");\r
+    #endif\r
+\r
+    fclose(fin);\r
+    fclose(fout);\r
+    free(inbuf);\r
+    free(outbuf);\r
+    free(bits);\r
+    codec2_destroy(codec2);\r
+}\r
+\r
+#define SPEED_TEST_SAMPLES 24000\r
+\r
+static void c2speedtest(int mode, char inputfile[])\r
+{\r
+    struct CODEC2 *codec2;\r
+    short         *inbuf, *outbuf, *pinbuf;\r
+    unsigned char *bits;\r
+    int            nsam, nbit, nframes;\r
+    FILE          *fin;\r
+    int            f, nread;\r
+\r
+    codec2 = codec2_create(mode);\r
+    nsam = codec2_samples_per_frame(codec2);\r
+    nframes = SPEED_TEST_SAMPLES/nsam;\r
+    outbuf = (short*)malloc(nsam*sizeof(short));\r
+    inbuf = (short*)malloc(SPEED_TEST_SAMPLES*sizeof(short));\r
+    nbit = codec2_bits_per_frame(codec2);\r
+    bits = (unsigned char*)malloc(nbit*sizeof(char));\r
+\r
+    fin = fopen(inputfile, "rb");\r
+    if (fin == NULL) {\r
+        printf("Error opening input file: %s\nTerminating....\n",inputfile);\r
+        exit(1);\r
+    }\r
+\r
+    nread = fread(inbuf, sizeof(short), SPEED_TEST_SAMPLES, fin);\r
+    if (nread != SPEED_TEST_SAMPLES) {\r
+        printf("error reading %s, %d samples reqd, %d read\n", \r
+               inputfile, SPEED_TEST_SAMPLES, nread);\r
+    }\r
+    fclose(fin);\r
+    \r
+    pinbuf = inbuf;\r
+    for(f=0; f<nframes; f++) {\r
+       GPIOD->ODR = (1 << 13);\r
+        codec2_encode(codec2, bits, pinbuf);\r
+        pinbuf += nsam;\r
+       GPIOD->ODR &= ~(1 << 13);\r
+       codec2_decode(codec2, outbuf, bits);\r
+    }\r
+\r
+    free(inbuf);\r
+    free(outbuf);\r
+    free(bits);\r
+    codec2_destroy(codec2);\r
+}\r
+\r
+void gpio_init() {\r
+    RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // enable the clock to GPIOD \r
+    GPIOD->MODER = (1 << 26);            // set pin 13 to be general \r
+                                         // purpose output\r
+}\r
+\r
+int main(int argc, char *argv[]) {\r
+    gpio_init();\r
+    machdep_profile_init ();\r
\r
+    printf("Starting c2demo\n");\r
+\r
+    /* File I/O test for profiling or (with #define DUMP)\r
+       dumping states for optimisation and tiuning */\r
+\r
+    c2demo(CODEC2_MODE_1600, "stm_in.raw", "stm_out.raw");\r
+\r
+    printf("Starting c2 speed test\n");\r
+    \r
+    /* Another test of execution speed. Look at PD13 with a\r
+       oscilliscope.  On time is enc, off is dec */\r
+\r
+    c2speedtest(CODEC2_MODE_1600, "stm_in.raw");\r
+\r
+    printf("Finished\n");\r
+\r
+    return 0;\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/dac_it.c b/codec2/tags/0.4/stm32/src/dac_it.c
new file mode 100644 (file)
index 0000000..2b614fc
--- /dev/null
@@ -0,0 +1,205 @@
+/**\r
+  ******************************************************************************\r
+  * @file    DMA/DMA_FLASHToRAM/stm32f4xx_it.c \r
+  * @author  MCD Application Team\r
+  * @version V1.1.0\r
+  * @date    18-January-2013\r
+  * @brief   Main Interrupt Service Routines.\r
+  *          This file provides template for all exceptions handler and \r
+  *          peripherals interrupt service routine.\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>\r
+  *\r
+  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
+  * You may not use this file except in compliance with the License.\r
+  * You may obtain a copy of the License at:\r
+  *\r
+  *        http://www.st.com/software_license_agreement_liberty_v2\r
+  *\r
+  * Unless required by applicable law or agreed to in writing, software \r
+  * distributed under the License is distributed on an "AS IS" BASIS, \r
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  * See the License for the specific language governing permissions and\r
+  * limitations under the License.\r
+  *\r
+  ******************************************************************************\r
+  */\r
+int interrupts;\r
+\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "dac_it.h"\r
+\r
+/** @addtogroup STM32F4xx_StdPeriph_Examples\r
+  * @{\r
+  */\r
+\r
+/** @addtogroup DMA_FLASHToRAM\r
+  * @{\r
+  */  \r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/******************************************************************************/\r
+/*            Cortex-M4 Processor Exceptions Handlers                         */\r
+/******************************************************************************/\r
+\r
+/**\r
+  * @brief   This function handles NMI exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void NMI_Handler(void)\r
+{\r
+}\r
+\r
+/**\r
+  * @brief  This function handles Hard Fault exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void HardFault_Handler(void)\r
+{\r
+  /* Go to infinite loop when Hard Fault exception occurs */\r
+  while (1)\r
+  {\r
+  }\r
+}\r
+\r
+/**\r
+  * @brief  This function handles Memory Manage exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void MemManage_Handler(void)\r
+{\r
+  /* Go to infinite loop when Memory Manage exception occurs */\r
+  while (1)\r
+  {\r
+  }\r
+}\r
+\r
+/**\r
+  * @brief  This function handles Bus Fault exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void BusFault_Handler(void)\r
+{\r
+  /* Go to infinite loop when Bus Fault exception occurs */\r
+  while (1)\r
+  {\r
+  }\r
+}\r
+\r
+/**\r
+  * @brief  This function handles Usage Fault exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void UsageFault_Handler(void)\r
+{\r
+  /* Go to infinite loop when Usage Fault exception occurs */\r
+  while (1)\r
+  {\r
+  }\r
+}\r
+\r
+/**\r
+  * @brief  This function handles SVCall exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void SVC_Handler(void)\r
+{\r
+}\r
+\r
+/**\r
+  * @brief  This function handles Debug Monitor exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void DebugMon_Handler(void)\r
+{\r
+}\r
+\r
+/**\r
+  * @brief  This function handles PendSVC exception.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void PendSV_Handler(void)\r
+{\r
+}\r
+\r
+/**\r
+  * @brief  This function handles SysTick Handler.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void SysTick_Handler(void)\r
+{\r
+}\r
+\r
+/******************************************************************************/\r
+/*                 STM32F4xx Peripherals Interrupt Handlers                   */\r
+/*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */\r
+/*  available peripheral interrupt handler's name please refer to the startup */\r
+/*  file (startup_stm32f40xx.s/startup_stm32f427x.s).                         */\r
+/******************************************************************************/\r
+\r
+/**\r
+  * @brief  This function handles DMA Stream interrupt request.\r
+  * @param  None\r
+  * @retval None\r
+  */\r
+void DMA1_Stream6_IRQHandler(void)\r
+{\r
+\r
+  /* Transfer half empty interrupt */\r
+\r
+  if(DMA_GetITStatus(DMA1_Stream6, DMA_IT_HTIF6) != RESET))\r
+  {\r
+      /* fill first half from fifo */\r
+\r
+      fifo_read(DMA1_Stream6_fifo, dac_buf, DAC_BUF_SZ/2);\r
+\r
+      /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+      DMA_ClearITPendingBit(DMA1_Stream6, DMA_IT_HTIF6);  \r
+\r
+      interrupts++;\r
+  }\r
+\r
+  /* Transfer complete interrupt */\r
+\r
+  if(DMA_GetITStatus(DMA1_Stream6, DMA_IT_TCIF6) != RESET))\r
+  {\r
+      /* fill second half from fifo */\r
+\r
+      fifo_read(DMA1_Stream6_fifo, &dac_buf[DAC_BUF_SZ/2], DAC_BUF_SZ/2);\r
+\r
+      /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+      DMA_ClearITPendingBit(DMA1_Stream6, DMA_IT_TCIF6);  \r
+\r
+      interrupts++;\r
+  }\r
+}\r
+\r
+/**\r
+  * @}\r
+  */ \r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
diff --git a/codec2/tags/0.4/stm32/src/dac_play.c b/codec2/tags/0.4/stm32/src/dac_play.c
new file mode 100644 (file)
index 0000000..96777eb
--- /dev/null
@@ -0,0 +1,63 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: dac_play.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 1 June 2013\r
+\r
+  Plays a 16 kHz sample rate raw file to the STM32F4 DACs. DAC1 is\r
+  connected to pin PA4, DAC2 is connected to pin PA5.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2013 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdlib.h>\r
+#include "stm32f4_dac.h"\r
+#include "gdb_stdio.h"\r
+\r
+#define N    (5*DAC_BUF_SZ)\r
+\r
+int main(void) {\r
+    short  buf[N];\r
+    FILE  *fplay;\r
+\r
+    dac_open(2*N);\r
+\r
+    while(1) {\r
+        fplay = fopen("stm_in.raw", "rb");\r
+        if (fplay == NULL) {\r
+            printf("Error opening input file: stm_in.raw\n\nTerminating....\n");\r
+            exit(1);\r
+        }\r
+    \r
+        printf("Starting!\n");\r
+\r
+        while(fread(buf, sizeof(short), N, fplay) == N) {\r
+            while(dac1_write(buf, N) == -1);\r
+            while(dac2_write(buf, N) == -1);\r
+        }  \r
+\r
+        printf("Finished!\n");\r
+        fclose(fplay);\r
+    }\r
+\r
+    /* let FIFO empty */\r
+\r
+    while(1);\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/dac_ut.c b/codec2/tags/0.4/stm32/src/dac_ut.c
new file mode 100644 (file)
index 0000000..bfe9def
--- /dev/null
@@ -0,0 +1,59 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: dac_ut.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: May 31 2013\r
+\r
+  Plays a 500 Hz sine wave sampled at 16 kHz out of PA5 on a Discovery board,\r
+  or the speaker output of the SM1000.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2013 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include "stm32f4_dac.h"\r
+\r
+#define SINE_SAMPLES   32\r
+\r
+\r
+/* 32 sample sine wave which at Fs=16kHz will be 500Hz.  Note samples\r
+   are 16 bit 2's complement, the DAC driver convertsto 12 bit\r
+   unsigned. */\r
+\r
+short aSine[] = {\r
+     -16,    6384,   12528,   18192,   23200,   27232,   30256,   32128,\r
+   32752,   32128,   30256,   27232,   23152,   18192,   12528,    6384,\r
+     -16,   -6416,  -12560,  -18224,  -23184,  -27264,  -30288,  -32160,\r
+  -32768,  -32160,  -30288,  -27264,  -23184,  -18224,  -12560,   -6416\r
+};\r
+\r
+int main(void) {\r
+\r
+    dac_open(4*DAC_BUF_SZ);\r
+\r
+    while (1) {\r
+\r
+        /* keep DAC FIFOs topped up */\r
+\r
+        dac1_write((short*)aSine, SINE_SAMPLES);\r
+        dac2_write((short*)aSine, SINE_SAMPLES);\r
+    }\r
+   \r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/debugblinky.c b/codec2/tags/0.4/stm32/src/debugblinky.c
new file mode 100644 (file)
index 0000000..7e38fd1
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: debugblinky.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 12 August 2014\r
+\r
+  Configures GPIO pins used for debug blinkies\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include "stm32f4xx.h"\r
+\r
+void init_debug_blinky(void) {\r
+    GPIO_InitTypeDef GPIO_InitStruct;\r
+\r
+    /* PE0-3 used to indicate activity */\r
+\r
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);\r
+\r
+    GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;\r
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;                 \r
+    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;     \r
+    GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;         \r
+    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;      \r
+    GPIO_Init(GPIOE, &GPIO_InitStruct);                \r
+\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/fast_dac_ut.c b/codec2/tags/0.4/stm32/src/fast_dac_ut.c
new file mode 100644 (file)
index 0000000..faa8865
--- /dev/null
@@ -0,0 +1,115 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: dac_ut.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: May 31 2013\r
+\r
+  Plays a 500 Hz sine wave sampled at 16 kHz out of PA5 on a Discovery board,\r
+  or the speaker output of the SM1000.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2013 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include "stm32f4_dacduc.h"\r
+#include "iir_duc.h"\r
+#include "stm32f4xx.h"\r
+#include <stm32f4xx_tim.h>\r
+#include <stm32f4xx_rcc.h>\r
+#include "gdb_stdio.h"\r
+#include "comp.h"\r
+//#include "gmsk_test_dat_m4.h"\r
+#define SINE_SAMPLES  32\r
+\r
+\r
+/* 32 sample sine wave which at Fs=16kHz will be 500Hz.  Note samples\r
+   are 16 bit 2's complement, the DAC driver convertsto 12 bit\r
+   unsigned. */\r
+   \r
+short aWave[] = {4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,\r
+       4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,4095,0,};\r
+\r
+short aSine[] = {1600, 3200, 1601, 0, 1600, 3200, 1601, 0, 1600, 3200, 1601, 0, 1600, 3200, 1601, 0, 1600, 3200, 1601, 0, 1600, 3200, 1601, 0, 1600, 3200, 1600, 0, 1600, 3200, 1601, 0\r
+};\r
+\r
+//Sine at Fs/4\r
+float f4sine[] = {1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,\r
+1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,\r
+1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,\r
+1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,1,0,-1,0,};\r
+\r
+//Intermediate 80k real before tx\r
+int tx_imm[DUC_N];\r
+\r
+//Complex input to chain\r
+COMP comp_in[DUC_N/10];\r
+\r
+unsigned short outbuf[DAC_DUC_BUF_SZ];\r
+\r
+void setup_timer()\r
+{\r
+    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);\r
+\r
+    TIM_TimeBaseInitTypeDef timerInitStructure; \r
+    timerInitStructure.TIM_Prescaler = 84;\r
+    timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;\r
+    timerInitStructure.TIM_Period = 0x8FFFFFFF;\r
+    timerInitStructure.TIM_ClockDivision = 0;\r
+    timerInitStructure.TIM_RepetitionCounter = 0;\r
+    TIM_TimeBaseInit(TIM2, &timerInitStructure);\r
+    TIM_Cmd(TIM2, ENABLE);\r
+}\r
+\r
+int main(void) {\r
+    int tstart,tup,tend,cyc,i;\r
+\r
+    memset((void*)outbuf,0,sizeof(short)*DAC_DUC_BUF_SZ);\r
+    setup_timer();\r
+    fast_dac_open(2*DAC_DUC_BUF_SZ,2*DAC_BUF_SZ);\r
+    tstart=tend=tup=cyc=0;\r
+    //Initalize complex input with signal at zero\r
+    for(i=0;i<DUC_48N;i++){\r
+        comp_in[i].real=1;\r
+        comp_in[i].imag=0;\r
+    }\r
+    while (1) {\r
+       cyc++;\r
+        //if(cyc>GMSK_TEST_LEN)\r
+        //    cyc=0;\r
+       if(cyc%10000==0){\r
+                printf("48c80r takes %d uSecs\n",tup-tstart);\r
+               printf("iir upconvert takes %d uSecs\n",tend-tup);\r
+       }\r
+        tstart = TIM_GetCounter(TIM2);\r
+\r
+        upconv_48c_80r(comp_in,tx_imm,1);\r
+\r
+       tup = TIM_GetCounter(TIM2);\r
+\r
+       iir_upconv_fixp(tx_imm,outbuf);\r
+\r
+       tend = TIM_GetCounter(TIM2);\r
+\r
+        //Sit and spin until we can get more samples into the dac \r
+       while(dac1_write((short*)outbuf,DAC_DUC_BUF_SZ)<0);\r
+    }\r
+   \r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/fdmdv_dump_rt.c b/codec2/tags/0.4/stm32/src/fdmdv_dump_rt.c
new file mode 100644 (file)
index 0000000..00cdcca
--- /dev/null
@@ -0,0 +1,154 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: fdmdv_dump_rt.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 9 Sep 2014\r
+\r
+ Runs the fdmdv demod in real time for a few seconds then dumps some\r
+ modem info to a text file for plotting in Octave.  Way to verify the\r
+ "from radio" SM1000 hardware, ADC, and demod on the SM1000.\r
+\r
+ Requires FreeDV signal to be sent to CN6 of SM1000.\r
+\r
+ Octave:\r
+\r
+   load scatter.txt\r
+   l=length(scatter)\r
+   plot(scatter(:,1:2:l),scatter(:,2:2:l),'+')\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include <stm32f4xx_gpio.h>\r
+#include "stm32f4_adc.h"\r
+#include "stm32f4_dac.h"\r
+#include "freedv_api.h"\r
+#include "codec2_fdmdv.h"\r
+#include "sm1000_leds_switches.h"\r
+#include "gdb_stdio.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fprintf gdb_stdio_fprintf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+#define FREEDV_NSAMPLES_16K (2*FREEDV_NSAMPLES)\r
+#define START_LOG_FRAMES 100\r
+#define LOG_FRAMES       10\r
+#define STOP_LOG_FRAMES  (START_LOG_FRAMES+LOG_FRAMES)\r
+#define NC  16\r
+\r
+int main(void) {\r
+    struct freedv *f;\r
+    short          adc16k[FDMDV_OS_TAPS_16K+FREEDV_NSAMPLES_16K];\r
+    short          dac16k[FREEDV_NSAMPLES_16K];\r
+    short          adc8k[FREEDV_NSAMPLES];\r
+    short          dac8k[FDMDV_OS_TAPS_8K+FREEDV_NSAMPLES];\r
\r
+    int            nin, nout, i, j, frames, lines;\r
+\r
+    COMP          *symb, *psymb;\r
+\r
+    /* init all the drivers for various peripherals */\r
+\r
+    sm1000_leds_switches_init();\r
+    dac_open(4*DAC_BUF_SZ);\r
+    adc_open(4*ADC_BUF_SZ);\r
+    f = freedv_open(FREEDV_MODE_1600);\r
+\r
+    /* clear filter memories */\r
+\r
+    for(i=0; i<FDMDV_OS_TAPS_16K; i++)\r
+       adc16k[i] = 0.0;\r
+    for(i=0; i<FDMDV_OS_TAPS_8K; i++)\r
+       dac8k[i] = 0.0;\r
+\r
+    /* allocate storage for the symbols */\r
+\r
+#define TMP\r
+#ifdef TMP\r
+    symb = (COMP*)malloc(sizeof(COMP)*(NC+1)*(STOP_LOG_FRAMES - START_LOG_FRAMES));\r
+    assert(symb != NULL);\r
+    psymb = symb;\r
+    frames = 0;\r
+    lines = 0;\r
+#endif\r
+    while(1)  {\r
+\r
+        /* Receive --------------------------------------------------------------------------*/\r
+\r
+        /* ADC1 is the demod in signal from the radio rx, DAC2 is the SM1000 speaker */\r
+\r
+        nin = freedv_nin(f);   \r
+        nout = nin;\r
+        f->total_bit_errors = 0;\r
+\r
+        if (adc1_read(&adc16k[FDMDV_OS_TAPS_16K], 2*nin) == 0) {\r
+            GPIOE->ODR = (1 << 3);\r
+            fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], nin);\r
+            nout = freedv_rx(f, &dac8k[FDMDV_OS_TAPS_8K], adc8k);\r
+            fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], nout);              \r
+            dac2_write(dac16k, 2*nout);\r
+            led_ptt(0); led_rt(f->fdmdv_stats.sync); led_err(f->total_bit_errors);\r
+            GPIOE->ODR &= ~(1 << 3);\r
+\r
+#define TMP1\r
+#ifdef TMP1\r
+            if (f->fdmdv_stats.sync)\r
+                frames++;\r
+            if ((frames >= START_LOG_FRAMES) && (lines < LOG_FRAMES)) {\r
+                for(i=0; i<=f->fdmdv_stats.Nc; i++)\r
+                    psymb[i] = f->fdmdv_stats.rx_symbols[i];\r
+                psymb += (f->fdmdv_stats.Nc+1);\r
+                lines++;\r
+            }\r
\r
+            if (frames >= STOP_LOG_FRAMES) {\r
+                FILE *ft = fopen("scatter.txt", "wt");\r
+                assert(ft != NULL);\r
+                printf("Writing scatter file....\n");\r
+                for(j=0; j<LOG_FRAMES; j++) {\r
+                    for(i=0; i<=f->fdmdv_stats.Nc; i++) {\r
+                        fprintf(ft, "%f\t%f\t", \r
+                                (double)symb[j*(f->fdmdv_stats.Nc+1)+i].real,\r
+                                (double)symb[j*(f->fdmdv_stats.Nc+1)+i].imag);\r
+                        printf("line: %d\n", j);\r
+                    }\r
+                    fprintf(ft, "\n");\r
+                }\r
+                fclose(ft);\r
+                printf("SNR = %3.2f dB\nfinished!\n", (double)f->fdmdv_stats.snr_est);\r
+                while(1);\r
+            }\r
+#endif\r
+        }\r
+      \r
+    } /* while(1) ... */\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/fdmdv_profile.c b/codec2/tags/0.4/stm32/src/fdmdv_profile.c
new file mode 100644 (file)
index 0000000..06dc512
--- /dev/null
@@ -0,0 +1,149 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: fdmdv_profile.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 18 July 2014\r
+\r
+  Profiling FDMDV modem operation on the STM32F4.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "gdb_stdio.h"\r
+#include "codec2_fdmdv.h"\r
+#include "dump.h"\r
+#include "sine.h"\r
+#include "machdep.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+#define TEST_FRAMES 25\r
+#define CHANNEL_BUF_SIZE (10*FDMDV_NOM_SAMPLES_PER_FRAME)\r
+\r
+static int  channel_count = 0;\r
+static COMP channel[CHANNEL_BUF_SIZE];\r
+\r
+static void channel_in(COMP tx_fdm[], int nout) {\r
+    int i;\r
+\r
+    /* add M tx samples to end of buffer */\r
+\r
+    assert((channel_count + nout) < CHANNEL_BUF_SIZE);\r
+    for(i=0; i<nout; i++)\r
+        channel[channel_count+i] = tx_fdm[i];\r
+    channel_count += M;\r
+}\r
+\r
+static void channel_out(COMP rx_fdm[], int nin) {\r
+    int i,j;\r
+\r
+    /* take nin samples from start of buffer */\r
+\r
+    for(i=0; i<nin; i++) {\r
+        rx_fdm[i] = channel[i];\r
+    }\r
+\r
+    /* shift buffer back */\r
+\r
+    for(i=0,j=nin; j<channel_count; i++,j++)\r
+        channel[i] = channel[j];\r
+    channel_count -= nin;\r
+}\r
+\r
+int main(int argc, char *argv[]) {\r
+    struct FDMDV       *fdmdv;\r
+    int                 bits_per_fdmdv_frame,  bits_per_codec_frame;\r
+    int                *tx_bits;\r
+    int                *rx_bits;\r
+    int                *codec_bits;\r
+    COMP                tx_fdm[2*FDMDV_NOM_SAMPLES_PER_FRAME];\r
+    COMP                rx_fdm[FDMDV_NOM_SAMPLES_PER_FRAME];\r
+    int                 i, j, nin, reliable_sync_bit[2], sync_bit, bit_errors, ntest_bits, test_frame_sync;\r
+    short              *error_pattern;\r
+    struct FDMDV_STATS  stats;\r
+    PROFILE_VAR(mod_start, demod_start);\r
+\r
+    machdep_profile_init ();\r
+    fdmdv = fdmdv_create(FDMDV_NC);\r
+\r
+    bits_per_fdmdv_frame = fdmdv_bits_per_frame(fdmdv);\r
+    bits_per_codec_frame = 2*fdmdv_bits_per_frame(fdmdv);\r
+    tx_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame); assert(tx_bits != NULL);\r
+    rx_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame); assert(rx_bits != NULL);\r
+    codec_bits = (int*)malloc(sizeof(int)*bits_per_codec_frame); assert(rx_bits != NULL);\r
+    error_pattern = (short*)malloc(fdmdv_error_pattern_size(fdmdv)*sizeof(int)); assert(error_pattern != NULL);\r
+\r
+    nin = FDMDV_NOM_SAMPLES_PER_FRAME;\r
+    test_frame_sync = 0;\r
+\r
+    for(i=0; i<TEST_FRAMES; i++) {\r
+       fdmdv_get_test_bits(fdmdv, tx_bits);\r
+       fdmdv_get_test_bits(fdmdv, &tx_bits[bits_per_fdmdv_frame]);\r
+\r
+        PROFILE_SAMPLE(mod_start);\r
+\r
+       fdmdv_mod(fdmdv, tx_fdm, tx_bits, &sync_bit);\r
+       assert(sync_bit == 1);\r
+       fdmdv_mod(fdmdv, &tx_fdm[FDMDV_NOM_SAMPLES_PER_FRAME], &tx_bits[bits_per_fdmdv_frame], &sync_bit);\r
+       assert(sync_bit == 0);\r
+        channel_in(tx_fdm, 2*FDMDV_NOM_SAMPLES_PER_FRAME);\r
+\r
+        PROFILE_SAMPLE_AND_LOG(demod_start, mod_start, "  mod");     \r
+\r
+        for(j=0; j<2; j++) {\r
+            channel_out(rx_fdm, nin);\r
+            fdmdv_demod(fdmdv, rx_bits, &reliable_sync_bit[j], rx_fdm, &nin);\r
+            if (reliable_sync_bit[j] == 0)\r
+                memcpy(codec_bits, rx_bits, bits_per_fdmdv_frame*sizeof(int));\r
+            else {\r
+                memcpy(&codec_bits[bits_per_fdmdv_frame], rx_bits, bits_per_fdmdv_frame*sizeof(int));\r
+                fdmdv_put_test_bits(fdmdv, &test_frame_sync, error_pattern, &bit_errors, &ntest_bits, codec_bits);\r
+                fdmdv_put_test_bits(fdmdv, &test_frame_sync, error_pattern, &bit_errors, &ntest_bits, &codec_bits[bits_per_fdmdv_frame]);\r
+            }\r
+        }\r
+        PROFILE_SAMPLE_AND_LOG2(demod_start, "  demod");     \r
+        PROFILE_SAMPLE_AND_LOG2(mod_start, "  mod & demod");     \r
+\r
+        fdmdv_get_demod_stats(fdmdv, &stats);\r
+\r
+        printf("frame: %d sync: %d reliable_sync_bit: %d %d SNR: %3.2f test_frame_sync: %d\n", \r
+               i, stats.sync, reliable_sync_bit[0], reliable_sync_bit[1], (double)stats.snr_est, \r
+               test_frame_sync);\r
+        machdep_profile_print_logged_samples();\r
+    }\r
+\r
+    fdmdv_destroy(fdmdv);\r
+\r
+    return 0;\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/fft_test.c b/codec2/tags/0.4/stm32/src/fft_test.c
new file mode 100644 (file)
index 0000000..cc838d1
--- /dev/null
@@ -0,0 +1,176 @@
+/* ---------------------------------------------------------------------- \r
+* Copyright (C) 2010 ARM Limited. All rights reserved.   \r
+*  \r
+* $Date:        29. November 2010  \r
+* $Revision:   V1.0.3  \r
+*  \r
+* Project:         CMSIS DSP Library  \r
+* Title:           arm_fft_bin_example_f32.c             \r
+*  \r
+* Description: Example code demonstrating calculation of Max energy bin of  \r
+*                              frequency domain of input signal. \r
+* \r
+* Target Processor: Cortex-M4/Cortex-M3  \r
+*\r
+*\r
+* Version 1.0.3 2010/11/29 \r
+*    Re-organized the CMSIS folders and updated documentation. \r
+* \r
+* Version 1.0.1 2010/10/05 KK \r
+*    Production release and review comments incorporated.  \r
+*\r
+* Version 1.0.0 2010/09/20 KK\r
+*    Production release and review comments incorporated.\r
+* ------------------------------------------------------------------- */ \r
\r
+/** \r
+ * @ingroup groupExamples \r
+ */ \r
\r
+/**    \r
+ * @defgroup FrequencyBin Frequency Bin Example    \r
+ * \r
+ * \par Description\r
+ * \par\r
+ * Demonstrates the calculation of the maximum energy bin in the frequency \r
+ * domain of the input signal with the use of Complex FFT, Complex \r
+ * Magnitude, and Maximum functions. \r
+ * \r
+ * \par Algorithm:\r
+ * \par\r
+ * The input test signal contains a 10 kHz signal with uniformly distributed white noise.  \r
+ * Calculating the FFT of the input signal will give us the maximum energy of the \r
+ * bin corresponding to the input frequency of 10 kHz.  \r
+ * \r
+ * \par Block Diagram:\r
+ * \image html FFTBin.gif "Block Diagram"\r
+ * \par\r
+ * The figure below shows the time domain signal of 10 kHz signal with \r
+ * uniformly distributed white noise, and the next figure shows the input\r
+ * in the frequency domain. The bin with maximum energy corresponds to 10 kHz signal. \r
+ * \par\r
+ * \image html FFTBinInput.gif "Input signal in Time domain" \r
+ * \image html FFTBinOutput.gif "Input signal in Frequency domain"\r
+ *\r
+ * \par Variables Description:\r
+ * \par\r
+ * \li \c testInput_f32_10khz points to the input data\r
+ * \li \c testOutput points to the output data\r
+ * \li \c fftSize length of FFT\r
+ * \li \c ifftFlag flag for the selection of CFFT/CIFFT\r
+ * \li \c doBitReverse Flag for selection of normal order or bit reversed order\r
+ * \li \c refIndex reference index value at which maximum energy of bin ocuurs\r
+ * \li \c testIndex calculated index value at which maximum energy of bin ocuurs\r
+ * \r
+ * \par CMSIS DSP Software Library Functions Used:\r
+ * \par\r
+ * - arm_cfft_radix4_init_f32()\r
+ * - arm_cfft_radix4_f32()\r
+ * - arm_cmplx_mag_f32()\r
+ * - arm_max_f32()\r
+ *\r
+ * <b> Refer  </b> \r
+ * \link arm_fft_bin_example_f32.c \endlink\r
+ * \r
+ */ \r
\r
\r
+/** \example arm_fft_bin_example_f32.c \r
+  */  \r
+\r
+     \r
+#include "arm_math.h" \r
+#include "gdb_stdio.h"\r
+#include "machdep.h"\r
+#include "kiss_fft.h"\r
\r
+#define TEST_LENGTH_SAMPLES 1024\r
\r
+/* ------------------------------------------------------------------- \r
+* External Input and Output buffer Declarations for FFT Bin Example \r
+* ------------------------------------------------------------------- */ \r
+extern float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES]; \r
+static float32_t testOutput[TEST_LENGTH_SAMPLES/2]; \r
+static float32_t kiss_complex_out[TEST_LENGTH_SAMPLES]; \r
\r
+/* ------------------------------------------------------------------ \r
+* Global variables for FFT Bin Example \r
+* ------------------------------------------------------------------- */ \r
+uint32_t fftSize = TEST_LENGTH_SAMPLES/2; \r
+uint32_t ifftFlag = 0; \r
+uint32_t doBitReverse = 1; \r
\r
+/* Reference index at which max energy of bin ocuurs */ \r
+uint32_t refIndex = 213, testIndex = 0; \r
\r
+/* ---------------------------------------------------------------------- \r
+* Max magnitude FFT Bin test \r
+* ------------------------------------------------------------------- */ \r
\r
+void SystemInit(void);\r
+\r
+int main(void) \r
+{ \r
+   \r
+       arm_status status; \r
+       arm_cfft_radix2_instance_f32 S; \r
+       float32_t maxValue; \r
+        unsigned int fft_start, kiss_fft_start;\r
+        kiss_fft_cfg fft_fwd_cfg;\r
+\r
+        SystemInit();\r
+        machdep_profile_init();\r
+        fft_fwd_cfg = kiss_fft_alloc(fftSize, 0, NULL, NULL);\r
+        kiss_fft_start = machdep_profile_sample();     \r
+        kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)testInput_f32_10khz, \r
+                 (kiss_fft_cpx *)kiss_complex_out);\r
+        machdep_profile_sample_and_log(kiss_fft_start, "  kiss_fft");     \r
\r
+       status = ARM_MATH_SUCCESS; \r
+        \r
+       /* Initialize the CFFT/CIFFT module */  \r
+       status = arm_cfft_radix2_init_f32(&S, fftSize, ifftFlag, doBitReverse);          \r
+\r
+       /* Process the data through the CFFT/CIFFT module */ \r
+        fft_start = machdep_profile_sample();  \r
+        arm_cfft_radix2_f32(&S, testInput_f32_10khz); \r
+        machdep_profile_sample_and_log(fft_start, "  fft");     \r
+        machdep_profile_print_logged_samples();\r
+\r
+       /* Process the data through the Complex Magnitude Module for  \r
+       calculating the magnitude at each bin */ \r
+       arm_cmplx_mag_f32(testInput_f32_10khz, testOutput,fftSize);  \r
+        \r
+       /* Calculates maxValue and returns corresponding BIN value */ \r
+       arm_max_f32(testOutput, fftSize, &maxValue, &testIndex); \r
+        \r
+       if(testIndex !=  refIndex) \r
+       { \r
+               status = ARM_MATH_TEST_FAILURE; \r
+       } \r
+        \r
+       /* ---------------------------------------------------------------------- \r
+       ** Loop here if the signals fail the PASS check. \r
+       ** This denotes a test failure \r
+       ** ------------------------------------------------------------------- */ \r
+        \r
+       if( status != ARM_MATH_SUCCESS) \r
+       { \r
+               while(1); \r
+       } \r
+\r
+    while(1);                             /* main function does not return */\r
+\r
+    return 0;\r
+} \r
\r
+ /** \endlink */ \r
\r
\r
+/*\r
+ * Dummy function to avoid compiler error\r
+ */\r
+void _init() { }\r
+\r
+\r
\r
diff --git a/codec2/tags/0.4/stm32/src/freedv_rx_profile.c b/codec2/tags/0.4/stm32/src/freedv_rx_profile.c
new file mode 100644 (file)
index 0000000..5c0d216
--- /dev/null
@@ -0,0 +1,131 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: freedv_rx_profile.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 13 August 2014\r
+\r
+  Profiling freedv_rx() operation on the STM32F4.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#define PROFILE\r
+\r
+#include <assert.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "gdb_stdio.h"\r
+#include "freedv_api.h"\r
+#include "machdep.h"\r
+#include "codec2_fdmdv.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#define fprintf gdb_stdio_fprintf\r
+#endif\r
+\r
+#define FREEDV_NSAMPLES_16K (2*FREEDV_NSAMPLES)\r
+\r
+int main(int argc, char *argv[]) {\r
+    struct freedv *f;\r
+    short          adc16k[FDMDV_OS_TAPS_16K+FREEDV_NSAMPLES_16K];\r
+    short          dac16k[FREEDV_NSAMPLES_16K];\r
+    short          adc8k[FREEDV_NSAMPLES];\r
+    short          dac8k[FDMDV_OS_TAPS_8K+FREEDV_NSAMPLES];\r
+    FILE          *fin, *fout, *ftotal;\r
+    int            frame, nin_16k, nin, i, nout = 0;\r
+    struct FDMDV_STATS  stats;\r
+    PROFILE_VAR(fdmdv_16_to_8_start, freedv_rx_start, fdmdv_8_to_16_start);\r
+\r
+    machdep_profile_init();\r
+\r
+    f = freedv_open(FREEDV_MODE_1600);\r
+\r
+    // Receive ---------------------------------------------------------------------\r
+\r
+    frame = 0;\r
+\r
+    fin = fopen("mod_16k.raw", "rb");\r
+    if (fin == NULL) {\r
+        printf("Error opening input file\n");\r
+        exit(1);\r
+    }\r
+\r
+    fout = fopen("speechout_16k.raw", "wb");\r
+    if (fout == NULL) {\r
+        printf("Error opening output file\n");\r
+        exit(1);\r
+    }\r
+\r
+    ftotal = fopen("total.txt", "wt");\r
+    assert(ftotal != NULL);\r
+\r
+    /* clear filter memories */\r
+\r
+    for(i=0; i<FDMDV_OS_TAPS_16K; i++)\r
+       adc16k[i] = 0.0;\r
+    for(i=0; i<FDMDV_OS_TAPS_8K; i++)\r
+       dac8k[i] = 0.0;\r
+    \r
+    nin = freedv_nin(f);\r
+    nin_16k = 2*nin;\r
+    nout = nin;\r
+    while (fread(&adc16k[FDMDV_OS_TAPS_16K], sizeof(short), nin_16k, fin) == nin_16k) {\r
+\r
+        PROFILE_SAMPLE(fdmdv_16_to_8_start);\r
+\r
+        fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], nin);\r
+\r
+        PROFILE_SAMPLE_AND_LOG(freedv_rx_start, fdmdv_16_to_8_start, "  fdmdv_16_to_8");\r
+\r
+        nout = freedv_rx(f, &dac8k[FDMDV_OS_TAPS_8K], adc8k);\r
+        nin = freedv_nin(f); nin_16k = 2*nin;\r
+        fdmdv_get_demod_stats(f->fdmdv, &stats);\r
+\r
+        PROFILE_SAMPLE_AND_LOG(fdmdv_8_to_16_start, freedv_rx_start, "  freedv_rx");     \r
+\r
+        fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], nout);              \r
+\r
+        PROFILE_SAMPLE_AND_LOG2(fdmdv_8_to_16_start, "  fdmdv_8_to_16");\r
+\r
+        fprintf(ftotal, "%d\n", machdep_profile_sample() - fdmdv_16_to_8_start);\r
+        machdep_profile_print_logged_samples();\r
+\r
+        fwrite(dac16k, sizeof(short), 2*nout, fout);\r
+        fdmdv_get_demod_stats(f->fdmdv, &stats);\r
+        printf("frame: %d nin_16k: %d sync: %d SNR: %3.2f \n", \r
+               ++frame, nin_16k, stats.sync, (double)stats.snr_est);\r
+    }\r
+\r
+    fclose(fin);\r
+    fclose(fout);\r
+    fclose(ftotal);\r
+\r
+    return 0;\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/freedv_tx_profile.c b/codec2/tags/0.4/stm32/src/freedv_tx_profile.c
new file mode 100644 (file)
index 0000000..7391c52
--- /dev/null
@@ -0,0 +1,89 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: freedv_tx_profile.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 13 August 2014\r
+\r
+  Profiling freedv_tx() operation on the STM32F4.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "gdb_stdio.h"\r
+#include "freedv_api.h"\r
+#include "machdep.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+int main(int argc, char *argv[]) {\r
+    struct freedv *f;\r
+    short          inbuf[FREEDV_NSAMPLES], outbuf[FREEDV_NSAMPLES];\r
+    FILE          *fin, *fout;\r
+    int            frame;\r
+    PROFILE_VAR(freedv_start);\r
+\r
+    machdep_profile_init();\r
+\r
+    f = freedv_open(FREEDV_MODE_1600);\r
+\r
+    // Transmit ---------------------------------------------------------------------\r
+\r
+    fin = fopen("stm_in.raw", "rb");\r
+    if (fin == NULL) {\r
+        printf("Error opening input file\n");\r
+        exit(1);\r
+    }\r
+\r
+    fout = fopen("mod.raw", "wb");\r
+    if (fout == NULL) {\r
+        printf("Error opening output file\n");\r
+        exit(1);\r
+    }\r
+\r
+    frame = 0;\r
+\r
+    while (fread(inbuf, sizeof(short), FREEDV_NSAMPLES, fin) == FREEDV_NSAMPLES) {\r
+        PROFILE_SAMPLE(freedv_start);\r
+        freedv_tx(f, outbuf, inbuf);\r
+        PROFILE_SAMPLE_AND_LOG2(freedv_start, "  freedv_tx");     \r
+       \r
+        fwrite(outbuf, sizeof(short), FREEDV_NSAMPLES, fout);\r
+        printf("frame: %d\n", ++frame);\r
+        machdep_profile_print_logged_samples();\r
+   }\r
+\r
+    fclose(fin);\r
+    fclose(fout);\r
+\r
+    return 0;\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/gdb_stdio.c b/codec2/tags/0.4/stm32/src/gdb_stdio.c
new file mode 100644 (file)
index 0000000..942d7ba
--- /dev/null
@@ -0,0 +1,125 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: gdb_stdio.c
+  AUTHOR......: David Rowe
+  DATE CREATED: April 23 2013
+
+  Some stdio I/O functions that perform I/O on the host using gdb.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include "gdb_stdio.h"
+
+#define MAX_STR 2048
+
+/* command codes we use to signal host */
+
+#define GDB_STDIO_PRINTF  1
+#define GDB_STDIO_FOPEN   2
+#define GDB_STDIO_FCLOSE  3
+#define GDB_STDIO_FWRITE  4
+#define GDB_STDIO_FREAD   5
+#define GDB_STDIO_FPRINTF 6
+
+/* globals we use to communicate with host */
+
+volatile int   gdb_stdio_func = 0;
+volatile int   gdb_stdio_ret = 0;
+volatile char *gdb_stdio_pstr1;
+volatile char *gdb_stdio_pstr2;
+volatile int   gdb_stdio_strlen1;
+volatile int   gdb_stdio_strlen2;
+volatile FILE *gdb_stdio_file;
+volatile void *gdb_stdio_ptr;
+volatile int   gdb_stdio_size;
+volatile int   gdb_stdio_nmem;
+
+void gdb_stdio_fprintf(FILE *file, const char *format, ...) {
+    va_list arg;
+    char str[MAX_STR];
+
+    va_start(arg, format);
+    vsnprintf(str, MAX_STR, format, arg);
+    va_end(arg);
+    gdb_stdio_file = file;
+    gdb_stdio_pstr1 = str;
+    gdb_stdio_strlen1 = strlen(str);
+
+    gdb_stdio_func = GDB_STDIO_FPRINTF;
+    while(gdb_stdio_func);
+}
+
+void gdb_stdio_printf(const char *format, ...) {
+    va_list arg;
+    char str[MAX_STR];
+
+    va_start(arg, format);
+    vsnprintf(str, MAX_STR, format, arg);
+    va_end(arg);
+    gdb_stdio_pstr1 = str;
+    gdb_stdio_strlen1 = strlen(str);
+
+    gdb_stdio_func = GDB_STDIO_PRINTF;
+    while(gdb_stdio_func);
+}
+
+FILE *gdb_stdio_fopen(char file_name[], char mode[]) {
+    gdb_stdio_pstr1 = file_name;
+    gdb_stdio_pstr2 = mode;
+    gdb_stdio_strlen1 = strlen(file_name);
+    gdb_stdio_strlen2 = strlen(mode);
+
+    gdb_stdio_func = GDB_STDIO_FOPEN;
+    while(gdb_stdio_func);
+    return (FILE*)gdb_stdio_ret;
+}
+
+void gdb_stdio_fclose(FILE *file) {
+    gdb_stdio_file = file;
+
+    gdb_stdio_func = GDB_STDIO_FCLOSE;
+    while(gdb_stdio_func);
+}
+
+int gdb_stdio_fwrite(void *ptr, int size, int nmem, FILE *file) {
+    gdb_stdio_ptr = ptr;
+    gdb_stdio_size = size;
+    gdb_stdio_nmem = nmem;
+    gdb_stdio_file = file;
+    gdb_stdio_func = GDB_STDIO_FWRITE;
+    while(gdb_stdio_func);
+    return gdb_stdio_ret;       
+}
+
+int gdb_stdio_fread(void *ptr, int size, int nmem, FILE *file) {
+    gdb_stdio_ptr = ptr;
+    gdb_stdio_size = size;
+    gdb_stdio_nmem = nmem;
+    gdb_stdio_file = file;
+    gdb_stdio_func = GDB_STDIO_FREAD;
+    while(gdb_stdio_func);
+    return gdb_stdio_ret;       
+}
+
diff --git a/codec2/tags/0.4/stm32/src/iir_duc.c b/codec2/tags/0.4/stm32/src/iir_duc.c
new file mode 100644 (file)
index 0000000..47262f7
--- /dev/null
@@ -0,0 +1,371 @@
+ /*---------------------------------------------------------------------------*\
+
+  FILE........: iir_duc.c
+  AUTHOR......: Brady O'Brien
+  DATE CREATED: 6 Mar 2015
+
+  Interapolator/Filter for IF upconversion
+
+  Unit testing:
+  
+    ~/codec2-dev/stm32$ gcc -D__UNITTEST__ -Iinc src/iir_duc.c -o iir_duc -lm -Wall -I../src/
+    ~/codec2-dev/stm32$ ./iir_duc
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 Brady O'Brien
+
+  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 "stm32f4_dacduc.h"
+#include "iir_duc.h"
+
+#define BETA1                    0.99002                       // B1MUL/(2**B1SHFT)
+#define B1MUL                   32441  
+#define B1SMUL                  -38328
+#define B1SHFT                  15                             // 10 bits gives us plenty of headroom between 31 bits of int and 14 bits of ADC
+#define B2MUL                   24593                          // This actually matches BETA2 exactly with the supplied BETA1
+#define B2SHFT                  15                             // 10 is also the lowest we can go without beta1=1
+#define BETA2                    (1.0 - (1.0-BETA1)*DUC_M)     // B2MUL/(2**B2SHFT)
+#define IN_SCALE                 2.0                            //Input scaling factor. Should be as large as the amplitude of the incoming samples
+#define DAC_SCALE                4096                           //Maximum output to DAC
+#define DAC_SCALE_2             2040
+
+
+//IIR and FIR filter states. Global for go fast.
+float f_1,f_2,f;
+int   n_1,n_2,n,m_1,m_2,m;
+
+/*
+   Upconvert and bandpass filter a chunk of spectrum from Fs/M to Fs. We're going for 700khz here.
+   modin needs to be DUC_N long and dac_out needs to be DUC_N*DUC_M long. This 
+*/
+
+void iir_upconv(float modin[], unsigned short dac_out[]){
+    int i,j,k;
+    int m;
+    k=0;
+    //Iterate through input samples and apply pre-eq FIR, interpolate, and apply BPF IIR
+    for(i=0;i<DUC_N;i++){
+        f = modin[i]+f_2*BETA2;
+        f_2 = f_1;
+        f_1 = modin[i];                                             //Scale fir output and convert to fixed.
+        m = (int)((f/(IN_SCALE))*DAC_SCALE_2);                      //Scale fir output and convert to fixed
+        n = m + ((B1SMUL*n_1)>>B1SHFT) - ((B1MUL*n_2)>>B1SHFT);   //Apply one cycle of IIR. This feeds the fir-ed sample into the output filter
+        n_2 = n_1;
+        n_1 = n;
+        dac_out[k]=(unsigned short)(n+DAC_SCALE_2);
+        k++;
+        //now do the rest of the filtering. Because we're zero-stuffing we can neglect the sample from the fir filter.
+        for(j=1;j<DUC_M;j++,k++){
+            n = ((B1SMUL*n_1)>>B1SHFT) - ((B1MUL*n_2)>>B1SHFT);
+            n_2 = n_1;
+            n_1 = n;
+            dac_out[k]=(unsigned short)((n)+DAC_SCALE_2);
+        }
+    }
+}
+
+/*
+   Upconvert and bandpass filter a chunk of spectrum from Fs/M to Fs. We're going for 700khz here.
+   modin needs to be DUC_N long and dac_out needs to be DUC_N*DUC_M long. This 
+*/
+
+void iir_upconv_fixp(int modin[], unsigned short dac_out[]){
+    int i,j,k;
+    int l;
+    k=0;
+    //Iterate through input samples and apply pre-eq FIR, interpolate, and apply BPF IIR
+    for(i=0;i<DUC_N;i++){
+        l = modin[i];//(modin[i]*10)>>4;
+        m = l+((m_2*B2MUL)>>B2SHFT);
+        m_2 = m_1;
+        m_1 = l;                                             //Scale fir output and convert to fixed.
+        //m = (int)((f/(IN_SCALE))*DAC_SCALE_2);                      //Scale fir output and convert to fixed
+        n = m + ((B1SMUL*n_1)>>B1SHFT) - ((B1MUL*n_2)>>B1SHFT);   //Apply one cycle of IIR. This feeds the fir-ed sample into the output filter
+        n_2 = n_1;
+        n_1 = n;
+        dac_out[k]=(unsigned short)(n+DAC_SCALE_2);
+        k++;
+        //now do the rest of the filtering. Because we're zero-stuffing we can neglect the sample from the fir filter.
+        for(j=1;j<DUC_M;j++,k++){
+            n = ((B1SMUL*n_1)>>B1SHFT) - ((B1MUL*n_2)>>B1SHFT);
+            n_2 = n_1;
+            n_1 = n;
+            dac_out[k]=(unsigned short)((n)+DAC_SCALE_2);
+        }
+    }
+}
+
+#define F48C80R_LEN 25
+#define F48C80R_MUL 4096
+static int js3 = 0;                           //Index for downsampling
+static int js5 = 0;                           //Index for upsampling
+static unsigned int w48c80r;                  //Phase for real to comp conversion
+static int ptr_48c80r;                        //Pointer in fir delay lines
+static int fir_48c80r[];                      //Fir filter coeffs
+static int fir_48c80r_re[F48C80R_LEN*2];      //Real delay line. Can probably be made much smaller.
+static int fir_48c80r_im[F48C80R_LEN*2];      //Imag delay line. Can probably be made much smaller.
+static int * sel_48c80r[2] = {fir_48c80r_re,fir_48c80r_im};    //Selector used to optimize out branches in inner loops
+
+/*
+   Interpolate and shift from 48k complex to 80k real, centered on Fs/4.
+    comp_8 - Input samples - 8Kc complex - must be DUC_48N*count long
+    upout - Output samples - must be DUC_N*count long
+    count - how many chunks of samples must be processed
+*/
+
+void upconv_48c_80r(COMP comp_48[],int real_80[],int count){
+    int i,j,k;         //Loop counters
+    int ret;         //Temp vars
+    int nr,ni;         //Temp vars
+    int inidx = 0;     //Input index
+    int outidx = 0;
+    int ncs_48c80r[3];
+    for(i=0;i<count;i++){ //Iterate through sample blocks
+        for(j=0;j<DUC_N*3;j++){ //Iterate through high rate intermediate 
+            if(js5==0){              //Upsample by 5
+                nr=(int)(comp_48[inidx].real*F48C80R_MUL);
+                ni=(int)(comp_48[inidx].imag*F48C80R_MUL);
+                fir_48c80r_re[ptr_48c80r] = nr;
+                fir_48c80r_im[ptr_48c80r] = ni;
+                fir_48c80r_re[ptr_48c80r+F48C80R_LEN] = nr;
+                fir_48c80r_im[ptr_48c80r+F48C80R_LEN] = ni;
+                inidx++;
+                js5=5; 
+                if(ptr_48c80r>=F48C80R_LEN)
+                    ptr_48c80r-=F48C80R_LEN;
+            }
+            if(js3==0){               //Downsample by 3
+                ni=0;
+                /*This loop computes the FIR filter. It only computes from either the re or the im delay line,
+                    depending on comp->re phase It also skips all 'zeros' in the delay line */
+                for(k=js5;k<F48C80R_LEN;k+=5)
+                    ni+=(fir_48c80r[k]*sel_48c80r[w48c80r&0x1][ptr_48c80r+k]);   
+                ncs_48c80r[0]=ni;
+                ncs_48c80r[2]=-ni;
+                ret=(ncs_48c80r[w48c80r&0x2]);
+                real_80[outidx]=ret>>14; //Scale back result; should probably just return int
+                outidx++;
+                js3=3;
+                w48c80r+=3;
+            }
+            ptr_48c80r++;
+            js3--;
+            js5--;
+        }
+    }
+}
+
+#define F8C80R_LEN 42                                     //Number of taps in the 8C80R filters
+#define F8C80R_MUL 4096
+static int int1r,int2r,int3r,int4r,int5r,cmb1r,cmb2r,cmb3r,cmb4r,cmb5r; //States for re combs and integrators
+static int int1i,int2i,int3i,int4i,int5i,cmb1i,cmb2i,cmb3i,cmb4i,cmb5i; //States for im combs and integrators
+static int ptr_8c80r;                                       //circular buffer ptr fir_8c80r_re
+static int w8c80r = 0;                                      //Omega for upconversion
+
+static int fir_8c80r_cic_i[];                               //FIR Coeffs
+static int fir_8c80r_re[F8C80R_LEN*2];                      //FIR delay line for re
+static int fir_8c80r_im[F8C80R_LEN*2];                      //FIR delay line for im
+
+/*
+   Interpolate and shift from 8k complex to 80k real, centered on Fs/4.
+    comp_8 - Input samples - 8Kc complex - must be (DUC_N/10)*count long
+    upout - Output samples - must be DUC_N*count long
+    count - how many chunks of samples must be processed
+*/
+
+void upconv_8c_80r(COMP comp_8[],float real_80[],int count){
+    int i,j,k;                           //Loop indices
+    float ret;                     //Temporary variables
+    int nr,ni;
+    int cmbr,cmbi,cmbrr,cmbii,rein,imin; //More temporaries
+    int inidx = 0;                       //Index of input
+    int outidx = 0;                      //Index of output
+    for(i=0;i<count;i++){                //Iterate through chunks of samples
+        for(j=0;j<DUC_N/5;j++){
+            if(j&0x1){ //If j is odd, stuff a zero, otherwise get a sample
+                nr = 0;
+                ni = 0;
+            } else {
+                nr = (int)(comp_8[inidx].real*F8C80R_MUL);
+                ni = (int)(comp_8[inidx].imag*F8C80R_MUL);
+                inidx++;
+            }
+            // Put the sample in the delay line
+            fir_8c80r_re[ptr_8c80r]=nr;
+            fir_8c80r_im[ptr_8c80r]=ni;
+            fir_8c80r_re[ptr_8c80r+F8C80R_LEN]=nr;
+            fir_8c80r_im[ptr_8c80r+F8C80R_LEN]=ni;
+            nr=0; ni=0;
+            //Some special initilization voodoo is done here.
+            //We skip all of the zeros by setting up the loop this way
+            for(k=(j&0x1);k<F8C80R_LEN;k+=2){
+                nr+=(fir_8c80r_cic_i[k]*fir_8c80r_re[ptr_8c80r+k])>>14;
+                ni+=(fir_8c80r_cic_i[k]*fir_8c80r_im[ptr_8c80r+k])>>14;
+            }
+            ptr_8c80r++;                          //Spin the dealy line index
+            if(ptr_8c80r>=F8C80R_LEN)
+                ptr_8c80r=0;
+            rein=nr;
+            imin=ni;
+            cmbr =  rein - cmb1r; cmb1r = rein;   //Comb 1 real
+            cmbrr = cmbr - cmb2r; cmb2r = cmbr;   //Comb 2 real
+            cmbr = cmbrr - cmb3r; cmb3r = cmbrr;  //Comb 3 real
+            cmbrr = cmbr - cmb4r; cmb4r = cmbr;   //Comb 4 real
+           cmbr = cmbrr - cmb5r; cmb5r = cmbrr;
+
+            cmbi =  imin - cmb1i; cmb1i = imin;   //Comb 1 im
+            cmbii = cmbi - cmb2i; cmb2i = cmbi;   //Comb 2 im
+            cmbi = cmbii - cmb3i; cmb3i = cmbii;  //Comb 3 im
+            cmbii = cmbi - cmb4i; cmb4i = cmbi;   //Comb 4 im
+            cmbi = cmbii - cmb5i; cmb5i = cmbii;   //Comb 4 im
+            //Do first cycle of integration
+            int1r = cmbr + int1r;                //Integrator stage 1 re
+            int2r = int1r + int2r;                //Integrator stage 2 re
+            int3r = int2r + int3r;                //Integrator stage 3 re
+            int4r = int3r + int4r;                //Integrator stage 4 re
+            int5i = int4i + int5i; 
+
+            int1i = cmbi + int1i;                //Integrator stage 1 im
+            int2i = int1i + int2i;                //Integrator stage 2 im
+            int3i = int2i + int3i;                //Integrator stage 3 im
+            int4i = int3i + int4i;                //Integrator stage 4 im
+            int5r = int4r + int5r; 
+            //Convert this complex into real and cancel out the gain from CIC
+            //This should probably spit out integers instead of going back to float
+            switch(w8c80r&0x3){                   //Do comp->real conversion by hand
+                case 0:ret=(float)(-int5i>>7);break;
+                case 1:ret=(float)(int5r>>7);break;
+                case 2:ret=(float)(int5i>>7);break;
+                case 3:ret=(float)(-int5r>>7);break;
+            }
+            real_80[outidx] = ret/8192;   //Divide by 4096 to cancel out gain
+            outidx++;
+            w8c80r++;     //spin omega
+            //Next 4 stages of integration. Stage 1 can be ignored because of zero stuffing.
+            for(k=1;k<5;k++){
+                int2r = int1r + int2r;            //Integrator stage 2 re
+                int3r = int2r + int3r;            //Integrator stage 3 re
+                int4r = int3r + int4r;            //Integrator stage 4 re
+               int5r = int4r + int5r; 
+                int2i = int1i + int2i;            //Integrator stage 2 im
+                int3i = int2i + int3i;            //Integrator stage 3 im
+                int4i = int3i + int4i;            //Integrator stage 4 im
+               int5i = int4i + int5i; 
+                switch(w8c80r&0x3){               //Do comp->real conversion by hand
+                    case 0:ret=(float)(-int5i>>7);break;
+                    case 1:ret=(float)(int5r>>7);break;
+                    case 2:ret=(float)(int5i>>7);break;
+                    case 3:ret=(float)(-int5r>>7);break;
+                }
+                real_80[outidx] = ret/8192;  //Cancel out gain from all that.
+                outidx++;
+               w8c80r++;
+            }
+        }
+    } 
+}
+
+#ifdef __UNITTEST__
+
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+#define FS     80000
+#define AMP_MAX 1
+
+#define NOUT_BUFS    500
+#define NIN          (NOUT_BUFS*DUC_N)
+#define NOUT         (NIN*DUC_M)
+
+void synth_line(float us[], float f, float amp, int n) {
+    float w, sam;
+    int   i;
+
+    w = 2*M_PI*f/(float)FS;
+
+    for(i=0; i<n; i++) {
+        sam = amp*AMP_MAX*cos(w*i);
+        us[i] += sam;
+    }
+}
+
+COMP       in[48000];
+int       s[NIN];
+float      fout[NIN];
+unsigned short todac[NOUT];
+
+int main(void) {
+    float          w;
+    FILE          *f;
+    int            i;
+
+    for(i=0;i<48000;i++){
+        //Tone at Fs/4 +/- 3K
+       w = 2.*M_PI*1000./(float)(FS/10);
+        in[i].real=cos((float)i*w);
+        //in[i].imag=.1*sin((float)i*w);
+        //in[i].real=0;
+        //in[i].real=1;
+        in[i].imag=0;
+    }
+
+    //Impulse to give us an idea of our filter bands
+    in[0].imag=0.70710678118;
+    in[0].real=0.70710678118;
+    
+    //interpolate from 8k comp to 80k real
+    upconv_48c_80r(in,s,NOUT_BUFS);
+    for(i=0;i<NOUT_BUFS;i++)
+        iir_upconv_fixp(&s[i*(DUC_N)],&todac[i*(DUC_N*DUC_M)]);
+    
+    f = fopen("iir_duc_s.txt", "wt");  assert(f != NULL);
+    for(i=0; i<NIN; i++)
+        fprintf(f, "%d\n", s[i]);
+    fprintf(f, "\n");
+    fclose(f);
+
+    f = fopen("iir_duc.txt", "wt");  assert(f != NULL);
+    for(i=0; i<NOUT; i++)
+        fprintf(f, "%d\n", todac[i]);
+    fprintf(f, "\n");
+    fclose(f);
+    return 0;
+}
+
+#endif
+
+
+//Coeffs for fixed point fir LPF and CIC precompensation
+static int fir_8c80r_cic_i[] = {
+    0,    0,   -2,   16,  -16,  -20,   26,   37,  -47,  -68,
+   83,  116, -139, -187,  219,  294, -339, -461,  528,  766,
+ -882,-1540, 1730, 6117, 6117, 1730,-1540, -882,  766,  528,
+ -461, -339,  294,  219, -187, -139,  116,   83,  -68,  -47,
+   37,   26,
+};
+
+//Coeffs for fir filter used in 48k comp to 80k real conversion
+static int fir_48c80r[] = {
+  -21,  -41,  -74, -109, -115,  -42,  153,  493,  958, 1483,
+ 1970, 2316, 2441, 2316, 1970, 1483,  958,  493,  153,  -42, 
+ -115, -109,  -74,  -41,  -21,
+};
+
+
diff --git a/codec2/tags/0.4/stm32/src/iir_tuner.c b/codec2/tags/0.4/stm32/src/iir_tuner.c
new file mode 100644 (file)
index 0000000..87d0ad2
--- /dev/null
@@ -0,0 +1,319 @@
+ /*---------------------------------------------------------------------------*\
+
+  FILE........: iir_tuner.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 20 Feb 2015
+
+  Filter/decimator function, broken out to this file so we can unit
+  test easily.  
+
+  Unit testing:
+  
+    ~/codec2-dev/stm32$ gcc -D__UNITTEST__ -Iinc src/iir_tuner.c -o iir_tuner -lm -Wall
+    ~/codec2-dev/stm32$ ./iir_tuner
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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/>.
+*/
+
+#ifdef __UNITTEST__
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+
+#endif
+
+#include "stm32f4_adc_tuner.h"
+#include "iir_tuner.h"
+
+/* Filter coefficients of IIR tuner (BETA1) and FIR equaliser (BETA2).
+   Note neat trick to relate BETA2 to BETA1 by the decimation rate */
+
+#define BETA1                    .9990234375                   // B1MUL/(2**B1SHFT)
+#define B1MUL                   1023                           
+#define B1SMUL                  1204
+#define B1SHFT                  10                             // 10 bits gives us plenty of headroom between 31 bits of int and 14 bits of ADC
+#define B2MUL                   979                            // This actually matches BETA2 exactly with the supplied BETA1
+#define B2SHFT                  10                             // 10 is also the lowest we can go without beta1=1
+#define BETA2                    (1.0 - (1.0-BETA1)*ADC_TUNER_M)// B2MUL/(2**B2SHFT)
+
+#define FIXED_IIR                                               //Define this to compile a fixed point IIR filter
+
+/* filter states - we keep them global due to the need for speed */
+
+#ifdef FIXED_IIR
+int n_2, n_1, o_2, o_1;
+#else
+float y_2, y_1, z_2, z_1;
+#endif
+
+/*
+   ADC -> signed conversion - IIR BPF - Decimate - FIR Equaliser -> FIFO
+*/
+
+void iir_tuner(float dec_50[], unsigned short adc_buf[]) {
+    int i, j, k;
+    float x, y, z;
+    int n, m, o;
+
+    for(i=0, j=0; i<ADC_TUNER_BUF_SZ/2; j++) {
+
+        /* IIR BPF centred at Fs/4.  All your MIPs are belong to this
+           loop. */
+        for(k=0; k<ADC_TUNER_M; k++,i++) {
+            #ifdef FIXED_IIR
+            m = (int)adc_buf[i];
+            n = m - ((B1SMUL*n_1)>>B1SHFT) - ((B1MUL*n_2)>>B1SHFT);
+            n_2 = n_1;
+            n_1 = n;
+            #else
+           x = (int)adc_buf[i] - 32768;
+           y = x - (BETA1*y_2);
+           y_2 = y_1;
+            y_1 = y;
+            #endif
+        }
+
+        /* Equaliser FIR filter, notch at Fs/(4*ADC_TUNER_M) to smooth out 
+           IIR BPF passband response */
+        #ifdef FIXED_IIR
+       o = n + ((B2MUL*o_2)>>B2SHFT);
+       dec_50[j] = (float)o;
+       o_2 = o_1;
+       o_1 = n;
+        #else
+       z=y+BETA2*z_2;        
+       dec_50[j] = z;
+        z_2 = z_1;
+        z_1 = y;
+        #endif
+       
+    }
+}
+
+
+/* BPF at 12.5 kHz +/- 2000 Hz, and decimate down to Fs = 10kHz */
+
+static float fir_50_to_10[];
+void iir_tuner_dec_50_to_10(float dec_10[], float dec_50[], int n) {
+    int   i,j,k;
+    float acc;
+
+    for(i=0,k=0; i<n; i+=5,k++) {
+        acc = 0.0;
+        for(j=0; j<IIR_TUNER_DEC_50_10_FILT_MEM; j++)
+            acc += dec_50[i-j]*fir_50_to_10[j];
+        dec_10[k] = acc;
+    }
+        
+}
+
+
+#ifdef __UNITTEST__
+
+#define FS      2000000
+#define AMP_MAX 32767
+
+#define NOUT_BUFS    100
+#define NOUT         (NOUT_BUFS*ADC_TUNER_N)
+#define NIN          (NOUT*ADC_TUNER_M)
+
+void synth_line(unsigned short us[], float f, float amp, int n) {
+    float w, sam;
+    int   i;
+
+    w = 2*M_PI*f/(float)FS;
+
+    for(i=0; i<n; i++) {
+        sam = amp*AMP_MAX*cos(w*i);
+        us[i] += (unsigned short)(sam + 0.5);
+    }
+}
+
+
+int main(void) {
+    float          f1,f2,f3,f4;
+    unsigned short s[NIN];
+    float          dec_50[IIR_TUNER_DEC_50_10_FILT_MEM+NOUT];
+    float          dec_10[NOUT/5];
+    FILE          *f;
+    int            i,j,k;
+    short          dec_10_short;
+
+    /* test Fs=2E6 unsigned short to Fs=50E3 float tuner/resampler -----------------------*/
+
+    f1 = 700E3;
+    f2 = f1 + 8E3;       /* wanted */
+    f3 = f1 - 7E3;       /* wanted */
+    f4 = f1 - 207E3;     /* out of band, should be greatly attenuated */
+
+    for(i=0; i<NIN; i++)
+        s[i] = 32767;
+    synth_line(s, f2, 0.1, NIN);
+    synth_line(s, f3, 0.05, NIN);
+    synth_line(s, f4, 0.1, NIN);
+    for(i=0, j=0; i<NIN; i+=ADC_TUNER_BUF_SZ/2, j+=ADC_TUNER_N/2) {
+        iir_tuner(&dec_50[j], &s[i]);
+    }
+    
+    f = fopen("iir_tuner_s.txt", "wt");  assert(f != NULL);
+    for(i=0; i<NIN; i++)
+        fprintf(f, "%d\n", s[i]);
+    fprintf(f, "\n");
+    fclose(f);
+
+    f = fopen("iir_tuner.txt", "wt");  assert(f != NULL);
+    for(i=0; i<NOUT; i++)
+        fprintf(f, "%f\n", dec_50[i]);
+    fprintf(f, "\n");
+    fclose(f);
+
+    /* test FS=2E6 unsigned short -> Fs=10kHz short ---------------------------------------------*/
+
+    for(i=0; i<NIN; i++)
+        s[i] = 32767;
+    for(i=1; i<NIN; i+=4)
+        s[i] += 32767;
+    for(i=3; i<NIN; i+=4)
+        s[i] -= 32767;
+
+    for(i=0, j=0, k=0; i<NIN; i+=ADC_TUNER_BUF_SZ/2, j+=ADC_TUNER_N/2, k+=(ADC_TUNER_N/2)/5) {
+        iir_tuner(&dec_50[IIR_TUNER_DEC_50_10_FILT_MEM+j], &s[i]);
+        iir_tuner_dec_50_to_10(&dec_10[k], &dec_50[IIR_TUNER_DEC_50_10_FILT_MEM+j], ADC_TUNER_N/2);
+    }
+
+    f = fopen("iir_tuner2.txt", "wt");  assert(f != NULL);
+    for(i=0; i<NOUT/5; i++) {
+        dec_10_short = dec_10[i]/ADC_TUNER_M;
+        fprintf(f, "%d\n", dec_10_short);
+    }
+    fprintf(f, "\n");
+    fclose(f);
+
+    return 0;
+}
+
+#endif
+
+/* Band pass FIR filter coefficents centred on Fs/4, used before Fs=50kHz to Fs=10kHz */
+
+static float fir_50_to_10[] = {
+    -1.71502876e-07,
+    -3.93029078e-05,
+    -5.30743362e-04,
+    1.17938704e-04,
+    1.09727519e-03,
+    -1.90605585e-04,
+    -1.61350037e-03,
+    2.37746793e-04,
+    1.86947117e-03,
+    -2.28459776e-04,
+    -1.56457257e-03,
+    1.33627883e-04,
+    4.28669971e-04,
+    5.51555269e-05,
+    1.60217953e-03,
+    -3.09989338e-04,
+    -4.22595074e-03,
+    5.63604865e-04,
+    6.71504730e-03,
+    -7.23797964e-04,
+    -8.02135199e-03,
+    7.03165104e-04,
+    7.05924883e-03,
+    -4.54750532e-04,
+    -3.11212393e-03,
+    2.24463518e-08,
+    -3.75334414e-03,
+    5.63496992e-04,
+    1.24113249e-02,
+    -1.08145162e-03,
+    -2.06694342e-02,
+    1.38572694e-03,
+    2.55955103e-02,
+    -1.34897285e-03,
+    -2.41472078e-02,
+    9.32473244e-04,
+    1.39715800e-02,
+    -2.09763900e-04,
+    5.83111135e-03,
+    -6.44614872e-04,
+    -3.42028021e-02,
+    1.40049434e-03,
+    6.80569757e-02,
+    -1.83898122e-03,
+    -1.02710848e-01,
+    1.82014182e-03,
+    1.32754277e-01,
+    -1.32936318e-03,
+    -1.53163914e-01,
+    4.86473969e-04,
+    1.60393264e-01,
+    4.86473969e-04,
+    -1.53163914e-01,
+    -1.32936318e-03,
+    1.32754277e-01,
+    1.82014182e-03,
+    -1.02710848e-01,
+    -1.83898122e-03,
+    6.80569757e-02,
+    1.40049434e-03,
+    -3.42028021e-02,
+    -6.44614872e-04,
+    5.83111135e-03,
+    -2.09763900e-04,
+    1.39715800e-02,
+    9.32473244e-04,
+    -2.41472078e-02,
+    -1.34897285e-03,
+    2.55955103e-02,
+    1.38572694e-03,
+    -2.06694342e-02,
+    -1.08145162e-03,
+    1.24113249e-02,
+    5.63496992e-04,
+    -3.75334414e-03,
+    2.24463518e-08,
+    -3.11212393e-03,
+    -4.54750532e-04,
+    7.05924883e-03,
+    7.03165104e-04,
+    -8.02135199e-03,
+    -7.23797964e-04,
+    6.71504730e-03,
+    5.63604865e-04,
+    -4.22595074e-03,
+    -3.09989338e-04,
+    1.60217953e-03,
+    5.51555269e-05,
+    4.28669971e-04,
+    1.33627883e-04,
+    -1.56457257e-03,
+    -2.28459776e-04,
+    1.86947117e-03,
+    2.37746793e-04,
+    -1.61350037e-03,
+    -1.90605585e-04,
+    1.09727519e-03,
+    1.17938704e-04,
+    -5.30743362e-04,
+    -3.93029078e-05,
+    -1.71502876e-07
+};
+
diff --git a/codec2/tags/0.4/stm32/src/init.c b/codec2/tags/0.4/stm32/src/init.c
new file mode 100644 (file)
index 0000000..527141d
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * Dummy function to avoid compiler error
+ */
+void _init() {
+
+}
+void _fini() {
+
+}
+
diff --git a/codec2/tags/0.4/stm32/src/power_ut.c b/codec2/tags/0.4/stm32/src/power_ut.c
new file mode 100644 (file)
index 0000000..267d5f9
--- /dev/null
@@ -0,0 +1,135 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: power_ut.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 30 May 2014\r
+\r
+  Runs Codec 2, ADC, and DAC, to fully exercise STM32C so we can a feel for\r
+  run-time power consumption for SM1000 and hence dimension regulators.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "stm32f4_adc.h"\r
+#include "stm32f4_dac.h"\r
+#include "gdb_stdio.h"\r
+#include "codec2.h"\r
+#include "dump.h"\r
+#include "sine.h"\r
+#include "machdep.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+#define SPEED_TEST_SAMPLES 24000\r
+\r
+/* modification of test used to measure codec2 execuation speed.  We read/write ADC/DAC\r
+   but dont do anything with the samples, as they are at 16 kHz and codec needs 8 kHz.  Just\r
+   trying to exercise everything to get a feel for power consumption */\r
+\r
+static void c2speedtest(int mode, char inputfile[])\r
+{\r
+    struct CODEC2 *codec2;\r
+    short         *inbuf, *outbuf, *pinbuf, *dummy_buf;\r
+    unsigned char *bits;\r
+    int            nsam, nbit, nframes;\r
+    FILE          *fin;\r
+    int            f, nread;\r
+\r
+    codec2 = codec2_create(mode);\r
+    nsam = codec2_samples_per_frame(codec2);\r
+    nframes = SPEED_TEST_SAMPLES/nsam;\r
+    outbuf = (short*)malloc(nsam*sizeof(short));\r
+    inbuf = (short*)malloc(SPEED_TEST_SAMPLES*sizeof(short));\r
+    nbit = codec2_bits_per_frame(codec2);\r
+    bits = (unsigned char*)malloc(nbit*sizeof(char));\r
+    dummy_buf = (short*)malloc(2*nsam*sizeof(short));\r
+\r
+    fin = fopen(inputfile, "rb");\r
+    if (fin == NULL) {\r
+        printf("Error opening input file: %s\nTerminating....\n",inputfile);\r
+        exit(1);\r
+    }\r
+\r
+    printf("reading samples ....\n");\r
+    nread = fread(inbuf, sizeof(short), SPEED_TEST_SAMPLES, fin);\r
+    if (nread != SPEED_TEST_SAMPLES) {\r
+        printf("error reading %s, %d samples reqd, %d read\n", \r
+               inputfile, SPEED_TEST_SAMPLES, nread);\r
+    }\r
+    fclose(fin);\r
+    \r
+    pinbuf = inbuf;\r
+    for(f=0; f<nframes; f++) {\r
+        //printf("read ADC\n");\r
+        while(adc1_read(dummy_buf, nsam*2) == -1);  /* runs at Fs = 16kHz */\r
+\r
+        //printf("Codec 2 enc\n");\r
+       GPIOD->ODR = (1 << 13);\r
+        codec2_encode(codec2, bits, pinbuf);\r
+        pinbuf += nsam;\r
+       GPIOD->ODR &= ~(1 << 13);\r
+        //printf("Codec 2 dec\n");\r
+       codec2_decode(codec2, outbuf, bits);\r
+        \r
+        //printf("write to DAC\n");\r
+        while(dac1_write(dummy_buf, nsam*2) == -1); /* runs at Fs = 16kHz */\r
+        //printf(".");\r
+    }\r
+\r
+    free(inbuf);\r
+    free(outbuf);\r
+    free(bits);\r
+    codec2_destroy(codec2);\r
+}\r
+\r
+void gpio_init() {\r
+    RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // enable the clock to GPIOD \r
+    GPIOD->MODER = (1 << 26);            // set pin 13 to be general \r
+                                         // purpose output\r
+}\r
+\r
+int main(int argc, char *argv[]) {\r
+    SystemInit();\r
+    gpio_init();\r
+    machdep_profile_init ();\r
+    adc_open(4*DAC_BUF_SZ);\r
+    dac_open(4*DAC_BUF_SZ);\r
+\r
+    printf("Starting power_ut\n");\r
+\r
+    c2speedtest(CODEC2_MODE_1600, "stm_in.raw");\r
+\r
+    printf("Finished\n");\r
+\r
+    return 0;\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/sine.c b/codec2/tags/0.4/stm32/src/sine.c
new file mode 100644 (file)
index 0000000..254a61e
--- /dev/null
@@ -0,0 +1,648 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: sine.c
+  AUTHOR......: David Rowe                                           
+  DATE CREATED: 19/8/2010
+                                                                             
+  Sinusoidal analysis and synthesis functions.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 1990-2010 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/>.
+*/
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               INCLUDES                                      
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "kiss_fft.h"
+
+#define HPF_BETA 0.125
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               HEADERS                                     
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, 
+                        float pstep);
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               FUNCTIONS                                     
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: make_analysis_window        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11/5/94 
+
+  Init function that generates the time domain analysis window and it's DFT.
+
+\*---------------------------------------------------------------------------*/
+
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[])
+{
+  float m;
+  COMP  wshift[FFT_ENC];
+  COMP  temp;
+  int   i,j;
+
+  /* 
+     Generate Hamming window centered on M-sample pitch analysis window
+  
+  0            M/2           M-1
+  |-------------|-------------|
+        |-------|-------|
+            NW samples
+
+     All our analysis/synthsis is centred on the M/2 sample.               
+  */
+
+  m = 0.0;
+  for(i=0; i<M/2-NW/2; i++)
+    w[i] = 0.0;
+  for(i=M/2-NW/2,j=0; i<M/2+NW/2; i++,j++) {
+    w[i] = 0.5 - 0.5*cosf(TWO_PI*j/(NW-1));
+    m += w[i]*w[i];
+  }
+  for(i=M/2+NW/2; i<M; i++)
+    w[i] = 0.0;
+  /* Normalise - makes freq domain amplitude estimation straight
+     forward */
+
+  m = 1.0/sqrtf(m*FFT_ENC);
+  for(i=0; i<M; i++) {
+    w[i] *= m;
+  }
+
+  /* 
+     Generate DFT of analysis window, used for later processing.  Note
+     we modulo FFT_ENC shift the time domain window w[], this makes the
+     imaginary part of the DFT W[] equal to zero as the shifted w[] is
+     even about the n=0 time axis if NW is odd.  Having the imag part
+     of the DFT W[] makes computation easier.
+
+     0                      FFT_ENC-1
+     |-------------------------|
+
+      ----\               /----
+           \             / 
+            \           /          <- shifted version of window w[n]
+             \         /
+              \       /
+               -------
+
+     |---------|     |---------|      
+       NW/2              NW/2
+  */
+
+  for(i=0; i<FFT_ENC; i++) {
+    wshift[i].real = 0.0;
+    wshift[i].imag = 0.0;
+  }
+  for(i=0; i<NW/2; i++)
+    wshift[i].real = w[i+M/2];
+  for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++)
+   wshift[i].real = w[j];
+
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)wshift, (kiss_fft_cpx *)W);
+
+  /* 
+      Re-arrange W[] to be symmetrical about FFT_ENC/2.  Makes later 
+      analysis convenient.
+
+   Before:
+
+
+     0                 FFT_ENC-1
+     |----------|---------|
+     __                   _       
+       \                 /          
+        \_______________/      
+
+   After:
+
+     0                 FFT_ENC-1
+     |----------|---------|
+               ___                        
+              /   \                
+     ________/     \_______     
+
+  */
+       
+      
+  for(i=0; i<FFT_ENC/2; i++) {
+    temp.real = W[i].real;
+    temp.imag = W[i].imag;
+    W[i].real = W[i+FFT_ENC/2].real;
+    W[i].imag = W[i+FFT_ENC/2].imag;
+    W[i+FFT_ENC/2].real = temp.real;
+    W[i+FFT_ENC/2].imag = temp.imag;
+  }
+
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: hpf         
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16 Nov 2010
+
+  High pass filter with a -3dB point of about 160Hz.
+
+    y(n) = -HPF_BETA*y(n-1) + x(n) - x(n-1)
+\*---------------------------------------------------------------------------*/
+
+float hpf(float x, float states[])
+{
+    states[0] += -HPF_BETA*states[0] + x - states[1];
+    states[1] = x;
+
+    return states[0];
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: dft_speech          
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 27/5/94 
+
+  Finds the DFT of the current speech input speech frame.
+
+\*---------------------------------------------------------------------------*/
+
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[])
+{
+  int  i;
+  COMP sw[FFT_ENC];
+
+  for(i=0; i<FFT_ENC; i++) {
+    sw[i].real = 0.0;
+    sw[i].imag = 0.0;
+  }
+
+  /* Centre analysis window on time axis, we need to arrange input
+     to FFT this way to make FFT phases correct */
+  
+  /* move 2nd half to start of FFT input vector */
+
+  for(i=0; i<NW/2; i++)
+    sw[i].real = Sn[i+M/2]*w[i+M/2];
+
+  /* move 1st half to end of FFT input vector */
+
+  for(i=0; i<NW/2; i++)
+    sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2];
+
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)sw, (kiss_fft_cpx *)Sw);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                     
+  FUNCTION....: two_stage_pitch_refinement                     
+  AUTHOR......: David Rowe
+  DATE CREATED: 27/5/94                                
+
+  Refines the current pitch estimate using the harmonic sum pitch
+  estimation technique.
+
+\*---------------------------------------------------------------------------*/
+
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[])
+{
+  float pmin,pmax,pstep;       /* pitch refinment minimum, maximum and step */ 
+
+  /* Coarse refinement */
+
+  pmax = TWO_PI/model->Wo + 5;
+  pmin = TWO_PI/model->Wo - 5;
+  pstep = 1.0;
+  hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
+  
+  /* Fine refinement */
+  
+  pmax = TWO_PI/model->Wo + 1;
+  pmin = TWO_PI/model->Wo - 1;
+  pstep = 0.25;
+  hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
+  
+  /* Limit range */
+  
+  if (model->Wo < TWO_PI/P_MAX)
+    model->Wo = TWO_PI/P_MAX;
+  if (model->Wo > TWO_PI/P_MIN)
+    model->Wo = TWO_PI/P_MIN;
+
+  model->L = floor(PI/model->Wo);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                
+ FUNCTION....: hs_pitch_refinement                             
+ AUTHOR......: David Rowe                      
+ DATE CREATED: 27/5/94                                                      
+                                                                         
+ Harmonic sum pitch refinement function.                          
+                                                                           
+ pmin   pitch search range minimum         
+ pmax  pitch search range maximum          
+ step   pitch search step size             
+ model current pitch estimate in model.Wo  
+                                                                           
+ model         refined pitch estimate in model.Wo  
+                                                                            
+\*---------------------------------------------------------------------------*/
+
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep)
+{
+  int m;               /* loop variable */
+  int b;               /* bin for current harmonic centre */
+  float E;             /* energy for current pitch*/
+  float Wo;            /* current "test" fundamental freq. */
+  float Wom;           /* Wo that maximises E */
+  float Em;            /* mamimum energy */
+  float r, one_on_r;   /* number of rads/bin */
+  float p;             /* current pitch */
+  
+  /* Initialisation */
+  
+  model->L = PI/model->Wo;     /* use initial pitch est. for L */
+  Wom = model->Wo;
+  Em = 0.0;
+  r = TWO_PI/FFT_ENC;
+  one_on_r = 1.0/r;
+
+  /* Determine harmonic sum for a range of Wo values */
+
+  for(p=pmin; p<=pmax; p+=pstep) {
+    E = 0.0;
+    Wo = TWO_PI/p;
+
+    /* Sum harmonic magnitudes */
+    for(m=1; m<=model->L; m++) {
+        b = (int)(m*Wo*one_on_r + 0.5);
+        E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag;
+    }  
+    /* Compare to see if this is a maximum */
+    
+    if (E > Em) {
+      Em = E;
+      Wom = Wo;
+    }
+  }
+
+  model->Wo = Wom;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FUNCTION....: estimate_amplitudes                          
+  AUTHOR......: David Rowe             
+  DATE CREATED: 27/5/94                               
+                                                                             
+  Estimates the complex amplitudes of the harmonics.    
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase)
+{
+  int   i,m;           /* loop variables */
+  int   am,bm;         /* bounds of current harmonic */
+  int   b;             /* DFT bin of centre of current harmonic */
+  float den;           /* denominator of amplitude expression */
+  float r, one_on_r;   /* number of rads/bin */
+  int   offset;
+  COMP  Am;
+
+  r = TWO_PI/FFT_ENC;
+  one_on_r = 1.0/r;
+
+  for(m=1; m<=model->L; m++) {
+    den = 0.0;
+    am = (int)((m - 0.5)*model->Wo*one_on_r + 0.5);
+    bm = (int)((m + 0.5)*model->Wo*one_on_r + 0.5);
+    b = (int)(m*model->Wo/r + 0.5);
+
+    /* Estimate ampltude of harmonic */
+
+    den = 0.0;
+    Am.real = Am.imag = 0.0;
+    offset = FFT_ENC/2 - (int)(m*model->Wo*one_on_r + 0.5);
+    for(i=am; i<bm; i++) {
+      den += Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag;
+      Am.real += Sw[i].real*W[i + offset].real;
+      Am.imag += Sw[i].imag*W[i + offset].real;
+    }
+
+    model->A[m] = sqrtf(den);
+
+    if (est_phase) {
+
+        /* Estimate phase of harmonic, this is expensive in CPU for
+           embedded devicesso we make it an option */
+
+        model->phi[m] = atan2(Sw[b].imag,Sw[b].real);
+    }
+  }
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  est_voicing_mbe()          
+                                                                             
+  Returns the error of the MBE cost function for a fiven F0.
+
+  Note: I think a lot of the operations below can be simplified as
+  W[].imag = 0 and has been normalised such that den always equals 1.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+float est_voicing_mbe(
+    MODEL *model,
+    COMP   Sw[],
+    COMP   W[],
+    COMP   Sw_[],         /* DFT of all voiced synthesised signal  */
+                          /* useful for debugging/dump file        */
+    COMP   Ew[],          /* DFT of error                          */
+    float prev_Wo)
+{
+    int   i,l,al,bl,m;    /* loop variables */
+    COMP  Am;             /* amplitude sample for this band */
+    int   offset;         /* centers Hw[] about current harmonic */
+    float den;            /* denominator of Am expression */
+    float error;          /* accumulated error between original and synthesised */
+    float Wo;            
+    float sig, snr;
+    float elow, ehigh, eratio;
+    float sixty;
+
+    sig = 1E-4;
+    for(l=1; l<=model->L/4; l++) {
+       sig += model->A[l]*model->A[l];
+    }
+    for(i=0; i<FFT_ENC; i++) {
+       Sw_[i].real = 0.0;
+       Sw_[i].imag = 0.0;
+       Ew[i].real = 0.0;
+       Ew[i].imag = 0.0;
+    }
+
+    Wo = model->Wo;
+    error = 1E-4;
+
+    /* Just test across the harmonics in the first 1000 Hz (L/4) */
+
+    for(l=1; l<=model->L/4; l++) {
+       Am.real = 0.0;
+       Am.imag = 0.0;
+       den = 0.0;
+       al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI);
+       bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI);
+
+       /* Estimate amplitude of harmonic assuming harmonic is totally voiced */
+
+        offset = FFT_ENC/2 - l*Wo*FFT_ENC/TWO_PI + 0.5;
+       for(m=al; m<bl; m++) {
+           Am.real += Sw[m].real*W[offset+m].real;
+           Am.imag += Sw[m].imag*W[offset+m].real;
+           den += W[offset+m].real*W[offset+m].real;
+        }
+
+        Am.real = Am.real/den;
+        Am.imag = Am.imag/den;
+
+        /* Determine error between estimated harmonic and original */
+
+        offset = FFT_ENC/2 - l*Wo*FFT_ENC/TWO_PI + 0.5;
+        for(m=al; m<bl; m++) {
+           Sw_[m].real = Am.real*W[offset+m].real;
+           Sw_[m].imag = Am.imag*W[offset+m].real;
+           Ew[m].real = Sw[m].real - Sw_[m].real;
+           Ew[m].imag = Sw[m].imag - Sw_[m].imag;
+           error += Ew[m].real*Ew[m].real;
+           error += Ew[m].imag*Ew[m].imag;
+       }
+    }
+    
+    snr = 10.0*log10f(sig/error);
+    if (snr > V_THRESH)
+       model->voiced = 1;
+    else
+       model->voiced = 0;
+    /* post processing, helps clean up some voicing errors ------------------*/
+
+    /* 
+       Determine the ratio of low freqency to high frequency energy,
+       voiced speech tends to be dominated by low frequency energy,
+       unvoiced by high frequency. This measure can be used to
+       determine if we have made any gross errors.
+    */
+
+    elow = ehigh = 1E-4;
+    for(l=1; l<=model->L/2; l++) {
+       elow += model->A[l]*model->A[l];
+    }
+    for(l=model->L/2; l<=model->L; l++) {
+       ehigh += model->A[l]*model->A[l];
+    }
+    eratio = 10.0*log10f(elow/ehigh);
+
+    /* Look for Type 1 errors, strongly V speech that has been
+       accidentally declared UV */
+
+    if (model->voiced == 0)
+       if (eratio > 10.0)
+           model->voiced = 1;
+
+    /* Look for Type 2 errors, strongly UV speech that has been
+       accidentally declared V */
+
+    if (model->voiced == 1) {
+       if (eratio < -10.0)
+           model->voiced = 0;
+
+       /* A common source of Type 2 errors is the pitch estimator
+          gives a low (50Hz) estimate for UV speech, which gives a
+          good match with noise due to the close harmoonic spacing.
+          These errors are much more common than people with 50Hz3
+          pitch, so we have just a small eratio threshold. */
+
+       sixty = 60.0*TWO_PI/FS;
+       if ((eratio < -4.0) && (model->Wo <= sixty))
+           model->voiced = 0;
+    }
+    //printf(" v: %d snr: %f eratio: %3.2f %f\n",model->voiced,snr,eratio,dF0);
+
+    return snr;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: make_synthesis_window       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 11/5/94 
+
+  Init function that generates the trapezoidal (Parzen) sythesis window.
+
+\*---------------------------------------------------------------------------*/
+
+void make_synthesis_window(float Pn[])
+{
+  int   i;
+  float win;
+
+  /* Generate Parzen window in time domain */
+
+  win = 0.0;
+  for(i=0; i<N/2-TW; i++)
+    Pn[i] = 0.0;
+  win = 0.0;
+  for(i=N/2-TW; i<N/2+TW; win+=1.0/(2*TW), i++ )
+    Pn[i] = win;
+  for(i=N/2+TW; i<3*N/2-TW; i++)
+    Pn[i] = 1.0;
+  win = 1.0;
+  for(i=3*N/2-TW; i<3*N/2+TW; win-=1.0/(2*TW), i++)
+    Pn[i] = win;
+  for(i=3*N/2+TW; i<2*N; i++)
+    Pn[i] = 0.0;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FUNCTION....: synthesise                           
+  AUTHOR......: David Rowe             
+  DATE CREATED: 20/2/95                       
+                                                                             
+  Synthesise a speech signal in the frequency domain from the
+  sinusodal model parameters.  Uses overlap-add with a trapezoidal
+  window to smoothly interpolate betwen frames.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+void synthesise(
+  kiss_fft_cfg fft_inv_cfg, 
+  float  Sn_[],                /* time domain synthesised signal              */
+  MODEL *model,                /* ptr to model parameters for this frame      */
+  float  Pn[],         /* time domain Parzen window                   */
+  int    shift          /* flag used to handle transition frames       */
+)
+{
+    int   i,l,j,b;     /* loop variables */
+    COMP  Sw_[FFT_DEC];        /* DFT of synthesised signal */
+    COMP  sw_[FFT_DEC];        /* synthesised signal */
+
+    if (shift) {
+       /* Update memories */
+       for(i=0; i<N-1; i++) {
+           Sn_[i] = Sn_[i+N];
+       }
+       Sn_[N-1] = 0.0;
+    }
+
+    for(i=0; i<FFT_DEC; i++) {
+       Sw_[i].real = 0.0;
+       Sw_[i].imag = 0.0;
+    }
+
+    /*
+      Nov 2010 - found that synthesis using time domain cos() functions
+      gives better results for synthesis frames greater than 10ms.  Inverse
+      FFT synthesis using a 512 pt FFT works well for 10ms window.  I think
+      (but am not sure) that the problem is related to the quantisation of
+      the harmonic frequencies to the FFT bin size, e.g. there is a 
+      8000/512 Hz step between FFT bins.  For some reason this makes
+      the speech from longer frame > 10ms sound poor.  The effect can also
+      be seen when synthesising test signals like single sine waves, some
+      sort of amplitude modulation at the frame rate.
+
+      Another possibility is using a larger FFT size (1024 or 2048).
+    */
+
+#define FFT_SYNTHESIS
+#ifdef FFT_SYNTHESIS
+    /* Now set up frequency domain synthesised speech */
+    for(l=1; l<=model->L; l++) {
+    //for(l=model->L/2; l<=model->L; l++) {
+    //for(l=1; l<=model->L/4; l++) {
+       b = (int)(l*model->Wo*FFT_DEC/TWO_PI + 0.5);
+       if (b > ((FFT_DEC/2)-1)) {
+               b = (FFT_DEC/2)-1;
+       }
+       Sw_[b].real = model->A[l]*cosf(model->phi[l]);
+       Sw_[b].imag = model->A[l]*sinf(model->phi[l]);
+       Sw_[FFT_DEC-b].real = Sw_[b].real;
+       Sw_[FFT_DEC-b].imag = -Sw_[b].imag;
+    }
+
+    /* Perform inverse DFT */
+
+    kiss_fft(fft_inv_cfg, (kiss_fft_cpx *)Sw_, (kiss_fft_cpx *)sw_);
+#else
+    /*
+       Direct time domain synthesis using the cos() function.  Works
+       well at 10ms and 20ms frames rates.  Note synthesis window is
+       still used to handle overlap-add between adjacent frames.  This
+       could be simplified as we don't need to synthesise where Pn[]
+       is zero.
+    */
+    for(l=1; l<=model->L; l++) {
+       for(i=0,j=-N+1; i<N-1; i++,j++) {
+           Sw_[FFT_DEC-N+1+i].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]);
+       }
+       for(i=N-1,j=0; i<2*N; i++,j++)
+           Sw_[j].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]);
+    }  
+#endif
+
+    /* Overlap add to previous samples */
+
+    for(i=0; i<N-1; i++) {
+       Sn_[i] += sw_[FFT_DEC-N+1+i].real*Pn[i];
+    }
+
+    if (shift)
+       for(i=N-1,j=0; i<2*N; i++,j++)
+           Sn_[i] = sw_[j].real*Pn[i];
+    else
+       for(i=N-1,j=0; i<2*N; i++,j++)
+           Sn_[i] += sw_[j].real*Pn[i];
+}
+
+
+static unsigned long next = 1;
+
+int codec2_rand(void) {
+    next = next * 1103515245 + 12345;
+    return((unsigned)(next/65536) % 32768);
+}
+
diff --git a/codec2/tags/0.4/stm32/src/sine.h b/codec2/tags/0.4/stm32/src/sine.h
new file mode 100644 (file)
index 0000000..da7dc28
--- /dev/null
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: sine.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: 1/11/94
+                                                                             
+  Header file for sinusoidal analysis and synthesis functions.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __SINE__
+#define __SINE__
+
+#include "defines.h"
+#include "comp.h"
+#include "kiss_fft.h"
+
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[]);
+float hpf(float x, float states[]);
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[]);
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase);
+float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[], 
+                     float prev_Wo);
+void make_synthesis_window(float Pn[]);
+void synthesise(kiss_fft_cfg fft_inv_cfg, float Sn_[], MODEL *model, float Pn[], int shift);
+
+#define CODEC2_RAND_MAX 32767
+int codec2_rand(void);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/src/sm1000_leds_switches.c b/codec2/tags/0.4/stm32/src/sm1000_leds_switches.c
new file mode 100644 (file)
index 0000000..e630cf0
--- /dev/null
@@ -0,0 +1,160 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: sm1000_leds_switches.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 18 July 2014
+
+  Functions for controlling LEDs and reading switches on the SM1000.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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/>.
+*/
+
+#define _CPTT          GPIO_Pin_10
+#define LED_PWR        GPIO_Pin_12
+#define LED_PTT        GPIO_Pin_13
+#define LED_RT         GPIO_Pin_14
+#define LED_ERR        GPIO_Pin_15
+#define SWITCH_PTT     GPIO_Pin_7
+#define SWITCH_SELECT  GPIO_Pin_0
+#define SWITCH_BACK    GPIO_Pin_1
+#define EXT_PTT        GPIO_Pin_8
+
+#include <stm32f4xx.h>
+#include <stm32f4xx_gpio.h>
+#include "sm1000_leds_switches.h"
+
+void sm1000_leds_switches_init(void) {
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
+
+    /* output pins */
+
+    GPIO_InitStruct.GPIO_Pin = LED_PWR | LED_PTT | LED_RT | LED_ERR | _CPTT;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;                 
+    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;      
+    GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;         
+    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;      
+    GPIO_Init(GPIOD, &GPIO_InitStruct);                
+
+    /* input pins */
+
+    GPIO_InitStruct.GPIO_Pin = SWITCH_PTT | SWITCH_SELECT | SWITCH_BACK;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;          
+    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz; 
+    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; /* we have our own external pull ups */      
+    GPIO_Init(GPIOD, &GPIO_InitStruct);        
+
+    GPIO_InitStruct.GPIO_Pin = EXT_PTT;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;          
+    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz; 
+    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;     /* use internal pull up */   
+    GPIO_Init(GPIOD, &GPIO_InitStruct);        
+
+       
+}
+
+void led_pwr(int state) {
+    if (state)
+        GPIOD->ODR |= (1 << 12);
+    else
+        GPIOD->ODR &= ~(1 << 12);
+}
+
+void led_ptt(int state) {
+    if (state)
+        GPIOD->ODR |= (1 << 13);
+    else
+        GPIOD->ODR &= ~(1 << 13);
+}
+
+void led_rt(int state) {
+    if (state)
+        GPIOD->ODR |= (1 << 14);
+    else
+        GPIOD->ODR &= ~(1 << 14);
+}
+
+void led_err(int state) {
+    if (state)
+        GPIOD->ODR |= (1 << 15);
+    else
+        GPIOD->ODR &= ~(1 << 15);
+}
+
+void not_cptt(int state) {
+    if (state)
+        GPIOD->ODR |= (1 << 10);
+    else
+        GPIOD->ODR &= ~(1 << 10);
+}
+
+int switch_ptt(void) {
+    return GPIOD->IDR & (1 << 7);
+}
+
+int switch_select(void) {
+    return GPIOD->IDR & (1 << 0);
+}
+
+int switch_back(void) {
+    return GPIOD->IDR & (1 << 1);
+}
+
+int ext_ptt(void) {
+    return GPIOD->IDR & (1 << 8);
+}
+
+/*
+  FUNCTION: ColorfulRingOfDeath()
+  AUTHOR..: xenovacivus
+
+  Colourful ring of death, blink LEDs like crazy forever if something
+  really nasty happens.  Adapted from USB Virtual COM Port (VCP)
+  module adapted from code I found here:
+
+    https://github.com/xenovacivus/STM32DiscoveryVCP
+
+  Call this to indicate a failure.  Blinks the STM32F4 discovery LEDs
+  in sequence.  At 168Mhz, the blinking will be very fast - about 5
+  Hz.  Keep that in mind when debugging, knowing the clock speed
+  might help with debugging.
+*/
+
+int mycode; /* examine this with debugger if it dies */
+
+void ColorfulRingOfDeath(int code) {
+    mycode = code;
+    uint16_t ring = 1;
+    while (1) {
+        uint32_t count = 0;
+        while (count++ < 5000000);
+
+        GPIOD->BSRRH = (ring << 12);
+        ring = ring << 1;
+        if (ring >= 1<<4) {
+            ring = 1;
+        }
+        GPIOD->BSRRL = (ring << 12);
+    }
+}
+void HardFault_Handler(void) { ColorfulRingOfDeath(1); }
+void MemManage_Handler(void) { ColorfulRingOfDeath(2); }
+void BusFault_Handler(void)  { ColorfulRingOfDeath(3); }
+void UsageFault_Handler(void){ ColorfulRingOfDeath(4); }
diff --git a/codec2/tags/0.4/stm32/src/sm1000_leds_switches_ut.c b/codec2/tags/0.4/stm32/src/sm1000_leds_switches_ut.c
new file mode 100644 (file)
index 0000000..ae0e8fe
--- /dev/null
@@ -0,0 +1,41 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: sm1000_leds_switches_ut.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: August 5 2014\r
+\r
+  Unit Test program for the SM1000 switches and LEDs driver.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include "sm1000_leds_switches.h"\r
+\r
+int main(void) {\r
+    sm1000_leds_switches_init();\r
+\r
+    while(1) {\r
+        led_pwr(switch_select());\r
+        led_ptt(switch_ptt());\r
+        led_rt(switch_back());\r
+        led_err(!switch_back());\r
+    }\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/sm1000_main.c b/codec2/tags/0.4/stm32/src/sm1000_main.c
new file mode 100644 (file)
index 0000000..b40fa51
--- /dev/null
@@ -0,0 +1,246 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: sm1000_main.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: August 5 2014\r
+\r
+  Main program for SM1000.\r
+\r
+  TODO\r
+\r
+  [ ] make led blink 1-2-3 times for "mode"\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2014 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include "stm32f4_adc.h"\r
+#include "stm32f4_dac.h"\r
+#include "freedv_api.h"\r
+#include "codec2_fdmdv.h"\r
+#include "sm1000_leds_switches.h"\r
+#include <stm32f4xx_gpio.h>\r
+#include <stdlib.h>\r
+\r
+#define FREEDV_NSAMPLES_16K (2*FREEDV_NSAMPLES)\r
+\r
+#define FIFTY_MS  50\r
+#define MAX_MODES  3\r
+#define ANALOG     0\r
+#define DV         1\r
+#define TONE       2\r
+\r
+#define SS_IDLE           0\r
+#define SS_DEBOUNCE_DOWN  1\r
+#define SS_WAIT_BUTTON_UP 2\r
+#define SS_DEBOUNCE_UP    3\r
+\r
+typedef struct {\r
+    int state;\r
+    int mode;\r
+} SWITCH_STATE;\r
+\r
+unsigned int downTicker;\r
+\r
+void SysTick_Handler(void);\r
+void iterate_select_state_machine(SWITCH_STATE *ss);\r
+\r
+#define SINE_SAMPLES   32\r
+\r
+/* 32 sample sine wave which at Fs=16kHz will be 500Hz.  Note samples\r
+   are 16 bit 2's complement, the DAC driver convertsto 12 bit\r
+   unsigned. */\r
+\r
+short aSine[] = {\r
+     -16,    6384,   12528,   18192,   23200,   27232,   30256,   32128,\r
+   32752,   32128,   30256,   27232,   23152,   18192,   12528,    6384,\r
+     -16,   -6416,  -12560,  -18224,  -23184,  -27264,  -30288,  -32160,\r
+  -32768,  -32160,  -30288,  -27264,  -23184,  -18224,  -12560,   -6416\r
+};\r
+\r
+int main(void) {\r
+    struct freedv *f;\r
+    short          adc16k[FDMDV_OS_TAPS_16K+FREEDV_NSAMPLES_16K];\r
+    short          dac16k[FREEDV_NSAMPLES_16K];\r
+    short          adc8k[FREEDV_NSAMPLES];\r
+    short          dac8k[FDMDV_OS_TAPS_8K+FREEDV_NSAMPLES];\r
+    SWITCH_STATE   ss;\r
+    int            nin, nout, i;\r
+\r
+    /* init all the drivers for various peripherals */\r
+\r
+    SysTick_Config(SystemCoreClock/168000); /* 1 kHz SysTick */\r
+    sm1000_leds_switches_init();\r
+    dac_open(4*DAC_BUF_SZ);\r
+    adc_open(4*ADC_BUF_SZ);\r
+    f = freedv_open(FREEDV_MODE_1600);\r
+\r
+    /* put outputs into a known state */\r
+\r
+    led_pwr(1); led_ptt(0); led_rt(0); led_err(0); not_cptt(1);\r
+\r
+    /* clear filter memories */\r
+\r
+    for(i=0; i<FDMDV_OS_TAPS_16K; i++)\r
+       adc16k[i] = 0.0;\r
+    for(i=0; i<FDMDV_OS_TAPS_8K; i++)\r
+       dac8k[i] = 0.0;\r
+\r
+    ss.state = SS_IDLE;\r
+    ss.mode  = ANALOG;\r
+\r
+    while(1) {\r
+        \r
+        iterate_select_state_machine(&ss);\r
+\r
+        if (switch_ptt() || (ext_ptt() == 0)) {\r
+            \r
+            /* Transmit -------------------------------------------------------------------------*/\r
+\r
+            /* ADC2 is the SM1000 microphone, DAC1 is the modulator signal we send to radio tx */\r
+\r
+            if (adc2_read(&adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES_16K) == 0) {\r
+                GPIOE->ODR = (1 << 3);\r
+\r
+                /* clipping indicator */\r
+\r
+                led_err(0);\r
+                for (i=0; i<FREEDV_NSAMPLES_16K; i++) {\r
+                    if (abs(adc16k[FDMDV_OS_TAPS_16K+i]) > 28000)\r
+                        led_err(1);\r
+                }\r
+\r
+                fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES);\r
+\r
+                if (ss.mode == ANALOG) {\r
+                    for(i=0; i<FREEDV_NSAMPLES; i++)\r
+                        dac8k[FDMDV_OS_TAPS_8K+i] = adc8k[i];\r
+                    fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], FREEDV_NSAMPLES);              \r
+                    dac1_write(dac16k, FREEDV_NSAMPLES_16K);\r
+                }\r
+                if (ss.mode == DV) {\r
+                    freedv_tx(f, &dac8k[FDMDV_OS_TAPS_8K], adc8k);\r
+                    for(i=0; i<FREEDV_NSAMPLES; i++)\r
+                        dac8k[FDMDV_OS_TAPS_8K+i] *= 0.398; /* 8dB back off from peak */\r
+                    fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], FREEDV_NSAMPLES);              \r
+                    dac1_write(dac16k, FREEDV_NSAMPLES_16K);\r
+                }\r
+                if (ss.mode == TONE) {\r
+                    short buf[SINE_SAMPLES];\r
+                    for(i=0; i<FREEDV_NSAMPLES; i++)\r
+                        buf[i] = aSine[i]*0.398; /* 8dB back off from peak */                   \r
+                    while(dac1_write(buf, SINE_SAMPLES) == 0);\r
+                }\r
+\r
+                led_ptt(1); led_rt(0); led_err(0); not_cptt(0);\r
+                GPIOE->ODR &= ~(1 << 3);\r
+            }\r
+\r
+        }\r
+        else {\r
+            \r
+            /* Receive --------------------------------------------------------------------------*/\r
+\r
+            not_cptt(1); led_ptt(0); \r
+\r
+            /* ADC1 is the demod in signal from the radio rx, DAC2 is the SM1000 speaker */\r
+\r
+            if (ss.mode == ANALOG) {\r
+\r
+                /* force analog bypass when select down */\r
+\r
+                if (adc1_read(&adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES_16K) == 0) {\r
+                    fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES);\r
+                    for(i=0; i<FREEDV_NSAMPLES; i++)\r
+                        dac8k[FDMDV_OS_TAPS_8K+i] = adc8k[i];\r
+                    fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], FREEDV_NSAMPLES);              \r
+                    dac2_write(dac16k, FREEDV_NSAMPLES_16K);\r
+                    led_rt(0); led_err(0);\r
+               }\r
+            }\r
+            else {\r
+\r
+                /* regular DV mode */\r
+\r
+                nin = freedv_nin(f);   \r
+                nout = nin;\r
+                f->total_bit_errors = 0;\r
+\r
+                if (adc1_read(&adc16k[FDMDV_OS_TAPS_16K], 2*nin) == 0) {\r
+                    GPIOE->ODR = (1 << 3);\r
+                    fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], nin);\r
+                    nout = freedv_rx(f, &dac8k[FDMDV_OS_TAPS_8K], adc8k);\r
+                    fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], nout);              \r
+                    dac2_write(dac16k, 2*nout);\r
+                    led_rt(f->fdmdv_stats.sync); led_err(f->total_bit_errors);\r
+                    GPIOE->ODR &= ~(1 << 3);\r
+                }\r
+            }\r
+\r
+        }\r
+    } /* while(1) ... */\r
+}\r
+\r
+/*\r
+ * SysTick Interrupt Handler\r
+ */\r
+\r
+void SysTick_Handler(void)\r
+{\r
+    if (downTicker > 0) {\r
+        downTicker--;\r
+    }\r
+}\r
+\r
+/* Select button state machine.  Debounces switches and enables cycling\r
+   through ANALOG-DV-TONE modes */\r
+\r
+void iterate_select_state_machine(SWITCH_STATE *ss) {\r
+    int next_state;\r
+\r
+    next_state = ss->state;\r
+    switch(ss->state) {\r
+        case SS_IDLE:\r
+            if (switch_select() == 0) {\r
+                downTicker = FIFTY_MS;\r
+                next_state = SS_DEBOUNCE_DOWN;\r
+            }\r
+            break;\r
+        case SS_DEBOUNCE_DOWN:\r
+            if (downTicker == 0) {\r
+                ss->mode++;\r
+                if (ss->mode >= MAX_MODES)\r
+                    ss->mode = 0;\r
+                next_state = SS_WAIT_BUTTON_UP;\r
+            }\r
+            break;\r
+        case SS_WAIT_BUTTON_UP:\r
+            if (switch_select() == 1) {\r
+                downTicker = FIFTY_MS;\r
+                next_state = SS_DEBOUNCE_UP;\r
+            }\r
+            break;\r
+        case SS_DEBOUNCE_UP:\r
+            if (downTicker == 0) {\r
+                next_state = SS_IDLE;\r
+            }\r
+            break;\r
+   }\r
+    ss->state = next_state;\r
+}\r
+            \r
diff --git a/codec2/tags/0.4/stm32/src/startup_stm32f4xx.s b/codec2/tags/0.4/stm32/src/startup_stm32f4xx.s
new file mode 100644 (file)
index 0000000..658ab36
--- /dev/null
@@ -0,0 +1,512 @@
+/**\r
+  ******************************************************************************\r
+  * @file      startup_stm32f4xx.s\r
+  * @author    MCD Application Team\r
+  * @version   V1.0.0\r
+  * @date      30-September-2011\r
+  * @brief     STM32F4xx Devices vector table for Atollic TrueSTUDIO toolchain.\r
+  *            This module performs:\r
+  *                - Set the initial SP\r
+  *                - Set the initial PC == Reset_Handler,\r
+  *                - Set the vector table entries with the exceptions ISR address\r
+  *                - Configure the clock system and the external SRAM mounted on\r
+  *                  STM324xG-EVAL board to be used as data memory (optional,\r
+  *                  to be enabled by user)\r
+  *                - Branches to main in the C library (which eventually\r
+  *                  calls main()).\r
+  *            After Reset the Cortex-M4 processor is in Thread mode,\r
+  *            priority is Privileged, and the Stack is set to Main.\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+  *\r
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>\r
+  ******************************************************************************\r
+  */\r
+\r
+  .syntax unified\r
+  .cpu cortex-m3\r
+  .fpu softvfp\r
+  .thumb\r
+\r
+.global  g_pfnVectors\r
+.global  Default_Handler\r
+\r
+/* start address for the initialization values of the .data section.\r
+defined in linker script */\r
+.word  _sidata\r
+/* start address for the .data section. defined in linker script */\r
+.word  _sdata\r
+/* end address for the .data section. defined in linker script */\r
+.word  _edata\r
+/* start address for the .bss section. defined in linker script */\r
+.word  _sbss\r
+/* end address for the .bss section. defined in linker script */\r
+.word  _ebss\r
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */\r
+\r
+/**\r
+ * @brief  This is the code that gets called when the processor first\r
+ *          starts execution following a reset event. Only the absolutely\r
+ *          necessary set is performed, after which the application\r
+ *          supplied main() routine is called.\r
+ * @param  None\r
+ * @retval : None\r
+*/\r
+\r
+    .section  .text.Reset_Handler\r
+  .weak  Reset_Handler\r
+  .type  Reset_Handler, %function\r
+Reset_Handler:\r
+\r
+/* Copy the data segment initializers from flash to SRAM */\r
+  movs  r1, #0\r
+  b  LoopCopyDataInit\r
+\r
+CopyDataInit:\r
+  ldr  r3, =_sidata\r
+  ldr  r3, [r3, r1]\r
+  str  r3, [r0, r1]\r
+  adds  r1, r1, #4\r
+\r
+LoopCopyDataInit:\r
+  ldr  r0, =_sdata\r
+  ldr  r3, =_edata\r
+  adds  r2, r0, r1\r
+  cmp  r2, r3\r
+  bcc  CopyDataInit\r
+  ldr  r2, =_sbss\r
+  b  LoopFillZerobss\r
+/* Zero fill the bss segment. */\r
+FillZerobss:\r
+  movs  r3, #0\r
+  str  r3, [r2], #4\r
+\r
+LoopFillZerobss:\r
+  ldr  r3, = _ebss\r
+  cmp  r2, r3\r
+  bcc  FillZerobss\r
+\r
+/* Call the clock system intitialization function.*/\r
+  bl  SystemInit\r
+/* Call static constructors */\r
+    bl __libc_init_array\r
+/* Call the application's entry point.*/\r
+  bl  main\r
+  bx  lr\r
+.size  Reset_Handler, .-Reset_Handler\r
+\r
+/**\r
+ * @brief  This is the code that gets called when the processor receives an\r
+ *         unexpected interrupt.  This simply enters an infinite loop, preserving\r
+ *         the system state for examination by a debugger.\r
+ * @param  None\r
+ * @retval None\r
+*/\r
+    .section  .text.Default_Handler,"ax",%progbits\r
+Default_Handler:\r
+Infinite_Loop:\r
+  b  Infinite_Loop\r
+  .size  Default_Handler, .-Default_Handler\r
+/******************************************************************************\r
+*\r
+* The minimal vector table for a Cortex M3. Note that the proper constructs\r
+* must be placed on this to ensure that it ends up at physical address\r
+* 0x0000.0000.\r
+*\r
+*******************************************************************************/\r
+   .section  .isr_vector,"a",%progbits\r
+  .type  g_pfnVectors, %object\r
+  .size  g_pfnVectors, .-g_pfnVectors\r
+\r
+\r
+g_pfnVectors:\r
+  .word  _estack\r
+  .word  Reset_Handler\r
+  .word  NMI_Handler\r
+  .word  HardFault_Handler\r
+  .word  MemManage_Handler\r
+  .word  BusFault_Handler\r
+  .word  UsageFault_Handler\r
+  .word  0\r
+  .word  0\r
+  .word  0\r
+  .word  0\r
+  .word  SVC_Handler\r
+  .word  DebugMon_Handler\r
+  .word  0\r
+  .word  PendSV_Handler\r
+  .word  SysTick_Handler\r
+\r
+  /* External Interrupts */\r
+  .word     WWDG_IRQHandler                   /* Window WatchDog              */\r
+  .word     PVD_IRQHandler                    /* PVD through EXTI Line detection */\r
+  .word     TAMP_STAMP_IRQHandler             /* Tamper and TimeStamps through the EXTI line */\r
+  .word     RTC_WKUP_IRQHandler               /* RTC Wakeup through the EXTI line */\r
+  .word     FLASH_IRQHandler                  /* FLASH                        */\r
+  .word     RCC_IRQHandler                    /* RCC                          */\r
+  .word     EXTI0_IRQHandler                  /* EXTI Line0                   */\r
+  .word     EXTI1_IRQHandler                  /* EXTI Line1                   */\r
+  .word     EXTI2_IRQHandler                  /* EXTI Line2                   */\r
+  .word     EXTI3_IRQHandler                  /* EXTI Line3                   */\r
+  .word     EXTI4_IRQHandler                  /* EXTI Line4                   */\r
+  .word     DMA1_Stream0_IRQHandler           /* DMA1 Stream 0                */\r
+  .word     DMA1_Stream1_IRQHandler           /* DMA1 Stream 1                */\r
+  .word     DMA1_Stream2_IRQHandler           /* DMA1 Stream 2                */\r
+  .word     DMA1_Stream3_IRQHandler           /* DMA1 Stream 3                */\r
+  .word     DMA1_Stream4_IRQHandler           /* DMA1 Stream 4                */\r
+  .word     DMA1_Stream5_IRQHandler           /* DMA1 Stream 5                */\r
+  .word     DMA1_Stream6_IRQHandler           /* DMA1 Stream 6                */\r
+  .word     ADC_IRQHandler                    /* ADC1, ADC2 and ADC3s         */\r
+  .word     CAN1_TX_IRQHandler                /* CAN1 TX                      */\r
+  .word     CAN1_RX0_IRQHandler               /* CAN1 RX0                     */\r
+  .word     CAN1_RX1_IRQHandler               /* CAN1 RX1                     */\r
+  .word     CAN1_SCE_IRQHandler               /* CAN1 SCE                     */\r
+  .word     EXTI9_5_IRQHandler                /* External Line[9:5]s          */\r
+  .word     TIM1_BRK_TIM9_IRQHandler          /* TIM1 Break and TIM9          */\r
+  .word     TIM1_UP_TIM10_IRQHandler          /* TIM1 Update and TIM10        */\r
+  .word     TIM1_TRG_COM_TIM11_IRQHandler     /* TIM1 Trigger and Commutation and TIM11 */\r
+  .word     TIM1_CC_IRQHandler                /* TIM1 Capture Compare         */\r
+  .word     TIM2_IRQHandler                   /* TIM2                         */\r
+  .word     TIM3_IRQHandler                   /* TIM3                         */\r
+  .word     TIM4_IRQHandler                   /* TIM4                         */\r
+  .word     I2C1_EV_IRQHandler                /* I2C1 Event                   */\r
+  .word     I2C1_ER_IRQHandler                /* I2C1 Error                   */\r
+  .word     I2C2_EV_IRQHandler                /* I2C2 Event                   */\r
+  .word     I2C2_ER_IRQHandler                /* I2C2 Error                   */\r
+  .word     SPI1_IRQHandler                   /* SPI1                         */\r
+  .word     SPI2_IRQHandler                   /* SPI2                         */\r
+  .word     USART1_IRQHandler                 /* USART1                       */\r
+  .word     USART2_IRQHandler                 /* USART2                       */\r
+  .word     USART3_IRQHandler                 /* USART3                       */\r
+  .word     EXTI15_10_IRQHandler              /* External Line[15:10]s        */\r
+  .word     RTC_Alarm_IRQHandler              /* RTC Alarm (A and B) through EXTI Line */\r
+  .word     OTG_FS_WKUP_IRQHandler            /* USB OTG FS Wakeup through EXTI line */\r
+  .word     TIM8_BRK_TIM12_IRQHandler         /* TIM8 Break and TIM12         */\r
+  .word     TIM8_UP_TIM13_IRQHandler          /* TIM8 Update and TIM13        */\r
+  .word     TIM8_TRG_COM_TIM14_IRQHandler     /* TIM8 Trigger and Commutation and TIM14 */\r
+  .word     TIM8_CC_IRQHandler                /* TIM8 Capture Compare         */\r
+  .word     DMA1_Stream7_IRQHandler           /* DMA1 Stream7                 */\r
+  .word     FSMC_IRQHandler                   /* FSMC                         */\r
+  .word     SDIO_IRQHandler                   /* SDIO                         */\r
+  .word     TIM5_IRQHandler                   /* TIM5                         */\r
+  .word     SPI3_IRQHandler                   /* SPI3                         */\r
+  .word     UART4_IRQHandler                  /* UART4                        */\r
+  .word     UART5_IRQHandler                  /* UART5                        */\r
+  .word     TIM6_DAC_IRQHandler               /* TIM6 and DAC1&2 underrun errors */\r
+  .word     TIM7_IRQHandler                   /* TIM7                         */\r
+  .word     DMA2_Stream0_IRQHandler           /* DMA2 Stream 0                */\r
+  .word     DMA2_Stream1_IRQHandler           /* DMA2 Stream 1                */\r
+  .word     DMA2_Stream2_IRQHandler           /* DMA2 Stream 2                */\r
+  .word     DMA2_Stream3_IRQHandler           /* DMA2 Stream 3                */\r
+  .word     DMA2_Stream4_IRQHandler           /* DMA2 Stream 4                */\r
+  .word     ETH_IRQHandler                    /* Ethernet                     */\r
+  .word     ETH_WKUP_IRQHandler               /* Ethernet Wakeup through EXTI line */\r
+  .word     CAN2_TX_IRQHandler                /* CAN2 TX                      */\r
+  .word     CAN2_RX0_IRQHandler               /* CAN2 RX0                     */\r
+  .word     CAN2_RX1_IRQHandler               /* CAN2 RX1                     */\r
+  .word     CAN2_SCE_IRQHandler               /* CAN2 SCE                     */\r
+  .word     OTG_FS_IRQHandler                 /* USB OTG FS                   */\r
+  .word     DMA2_Stream5_IRQHandler           /* DMA2 Stream 5                */\r
+  .word     DMA2_Stream6_IRQHandler           /* DMA2 Stream 6                */\r
+  .word     DMA2_Stream7_IRQHandler           /* DMA2 Stream 7                */\r
+  .word     USART6_IRQHandler                 /* USART6                       */\r
+  .word     I2C3_EV_IRQHandler                /* I2C3 event                   */\r
+  .word     I2C3_ER_IRQHandler                /* I2C3 error                   */\r
+  .word     OTG_HS_EP1_OUT_IRQHandler         /* USB OTG HS End Point 1 Out   */\r
+  .word     OTG_HS_EP1_IN_IRQHandler          /* USB OTG HS End Point 1 In    */\r
+  .word     OTG_HS_WKUP_IRQHandler            /* USB OTG HS Wakeup through EXTI */\r
+  .word     OTG_HS_IRQHandler                 /* USB OTG HS                   */\r
+  .word     DCMI_IRQHandler                   /* DCMI                         */\r
+  .word     CRYP_IRQHandler                   /* CRYP crypto                  */\r
+  .word     HASH_RNG_IRQHandler               /* Hash and Rng                 */\r
+  .word     FPU_IRQHandler                    /* FPU                          */\r
+\r
+\r
+/*******************************************************************************\r
+*\r
+* Provide weak aliases for each Exception handler to the Default_Handler.\r
+* As they are weak aliases, any function with the same name will override\r
+* this definition.\r
+*\r
+*******************************************************************************/\r
+   .weak      NMI_Handler\r
+   .thumb_set NMI_Handler,Default_Handler\r
+\r
+   .weak      HardFault_Handler\r
+   .thumb_set HardFault_Handler,Default_Handler\r
+\r
+   .weak      MemManage_Handler\r
+   .thumb_set MemManage_Handler,Default_Handler\r
+\r
+   .weak      BusFault_Handler\r
+   .thumb_set BusFault_Handler,Default_Handler\r
+\r
+   .weak      UsageFault_Handler\r
+   .thumb_set UsageFault_Handler,Default_Handler\r
+\r
+   .weak      SVC_Handler\r
+   .thumb_set SVC_Handler,Default_Handler\r
+\r
+   .weak      DebugMon_Handler\r
+   .thumb_set DebugMon_Handler,Default_Handler\r
+\r
+   .weak      PendSV_Handler\r
+   .thumb_set PendSV_Handler,Default_Handler\r
+\r
+   .weak      SysTick_Handler\r
+   .thumb_set SysTick_Handler,Default_Handler\r
+\r
+   .weak      WWDG_IRQHandler\r
+   .thumb_set WWDG_IRQHandler,Default_Handler\r
+\r
+   .weak      PVD_IRQHandler\r
+   .thumb_set PVD_IRQHandler,Default_Handler\r
+\r
+   .weak      TAMP_STAMP_IRQHandler\r
+   .thumb_set TAMP_STAMP_IRQHandler,Default_Handler\r
+\r
+   .weak      RTC_WKUP_IRQHandler\r
+   .thumb_set RTC_WKUP_IRQHandler,Default_Handler\r
+\r
+   .weak      FLASH_IRQHandler\r
+   .thumb_set FLASH_IRQHandler,Default_Handler\r
+\r
+   .weak      RCC_IRQHandler\r
+   .thumb_set RCC_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI0_IRQHandler\r
+   .thumb_set EXTI0_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI1_IRQHandler\r
+   .thumb_set EXTI1_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI2_IRQHandler\r
+   .thumb_set EXTI2_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI3_IRQHandler\r
+   .thumb_set EXTI3_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI4_IRQHandler\r
+   .thumb_set EXTI4_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream0_IRQHandler\r
+   .thumb_set DMA1_Stream0_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream1_IRQHandler\r
+   .thumb_set DMA1_Stream1_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream2_IRQHandler\r
+   .thumb_set DMA1_Stream2_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream3_IRQHandler\r
+   .thumb_set DMA1_Stream3_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream4_IRQHandler\r
+   .thumb_set DMA1_Stream4_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream5_IRQHandler\r
+   .thumb_set DMA1_Stream5_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream6_IRQHandler\r
+   .thumb_set DMA1_Stream6_IRQHandler,Default_Handler\r
+\r
+   .weak      ADC_IRQHandler\r
+   .thumb_set ADC_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN1_TX_IRQHandler\r
+   .thumb_set CAN1_TX_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN1_RX0_IRQHandler\r
+   .thumb_set CAN1_RX0_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN1_RX1_IRQHandler\r
+   .thumb_set CAN1_RX1_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN1_SCE_IRQHandler\r
+   .thumb_set CAN1_SCE_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI9_5_IRQHandler\r
+   .thumb_set EXTI9_5_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM1_BRK_TIM9_IRQHandler\r
+   .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM1_UP_TIM10_IRQHandler\r
+   .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM1_TRG_COM_TIM11_IRQHandler\r
+   .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM1_CC_IRQHandler\r
+   .thumb_set TIM1_CC_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM2_IRQHandler\r
+   .thumb_set TIM2_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM3_IRQHandler\r
+   .thumb_set TIM3_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM4_IRQHandler\r
+   .thumb_set TIM4_IRQHandler,Default_Handler\r
+\r
+   .weak      I2C1_EV_IRQHandler\r
+   .thumb_set I2C1_EV_IRQHandler,Default_Handler\r
+\r
+   .weak      I2C1_ER_IRQHandler\r
+   .thumb_set I2C1_ER_IRQHandler,Default_Handler\r
+\r
+   .weak      I2C2_EV_IRQHandler\r
+   .thumb_set I2C2_EV_IRQHandler,Default_Handler\r
+\r
+   .weak      I2C2_ER_IRQHandler\r
+   .thumb_set I2C2_ER_IRQHandler,Default_Handler\r
+\r
+   .weak      SPI1_IRQHandler\r
+   .thumb_set SPI1_IRQHandler,Default_Handler\r
+\r
+   .weak      SPI2_IRQHandler\r
+   .thumb_set SPI2_IRQHandler,Default_Handler\r
+\r
+   .weak      USART1_IRQHandler\r
+   .thumb_set USART1_IRQHandler,Default_Handler\r
+\r
+   .weak      USART2_IRQHandler\r
+   .thumb_set USART2_IRQHandler,Default_Handler\r
+\r
+   .weak      USART3_IRQHandler\r
+   .thumb_set USART3_IRQHandler,Default_Handler\r
+\r
+   .weak      EXTI15_10_IRQHandler\r
+   .thumb_set EXTI15_10_IRQHandler,Default_Handler\r
+\r
+   .weak      RTC_Alarm_IRQHandler\r
+   .thumb_set RTC_Alarm_IRQHandler,Default_Handler\r
+\r
+   .weak      OTG_FS_WKUP_IRQHandler\r
+   .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM8_BRK_TIM12_IRQHandler\r
+   .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM8_UP_TIM13_IRQHandler\r
+   .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM8_TRG_COM_TIM14_IRQHandler\r
+   .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM8_CC_IRQHandler\r
+   .thumb_set TIM8_CC_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA1_Stream7_IRQHandler\r
+   .thumb_set DMA1_Stream7_IRQHandler,Default_Handler\r
+\r
+   .weak      FSMC_IRQHandler\r
+   .thumb_set FSMC_IRQHandler,Default_Handler\r
+\r
+   .weak      SDIO_IRQHandler\r
+   .thumb_set SDIO_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM5_IRQHandler\r
+   .thumb_set TIM5_IRQHandler,Default_Handler\r
+\r
+   .weak      SPI3_IRQHandler\r
+   .thumb_set SPI3_IRQHandler,Default_Handler\r
+\r
+   .weak      UART4_IRQHandler\r
+   .thumb_set UART4_IRQHandler,Default_Handler\r
+\r
+   .weak      UART5_IRQHandler\r
+   .thumb_set UART5_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM6_DAC_IRQHandler\r
+   .thumb_set TIM6_DAC_IRQHandler,Default_Handler\r
+\r
+   .weak      TIM7_IRQHandler\r
+   .thumb_set TIM7_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream0_IRQHandler\r
+   .thumb_set DMA2_Stream0_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream1_IRQHandler\r
+   .thumb_set DMA2_Stream1_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream2_IRQHandler\r
+   .thumb_set DMA2_Stream2_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream3_IRQHandler\r
+   .thumb_set DMA2_Stream3_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream4_IRQHandler\r
+   .thumb_set DMA2_Stream4_IRQHandler,Default_Handler\r
+\r
+   .weak      ETH_IRQHandler\r
+   .thumb_set ETH_IRQHandler,Default_Handler\r
+\r
+   .weak      ETH_WKUP_IRQHandler\r
+   .thumb_set ETH_WKUP_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN2_TX_IRQHandler\r
+   .thumb_set CAN2_TX_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN2_RX0_IRQHandler\r
+   .thumb_set CAN2_RX0_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN2_RX1_IRQHandler\r
+   .thumb_set CAN2_RX1_IRQHandler,Default_Handler\r
+\r
+   .weak      CAN2_SCE_IRQHandler\r
+   .thumb_set CAN2_SCE_IRQHandler,Default_Handler\r
+\r
+   .weak      OTG_FS_IRQHandler\r
+   .thumb_set OTG_FS_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream5_IRQHandler\r
+   .thumb_set DMA2_Stream5_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream6_IRQHandler\r
+   .thumb_set DMA2_Stream6_IRQHandler,Default_Handler\r
+\r
+   .weak      DMA2_Stream7_IRQHandler\r
+   .thumb_set DMA2_Stream7_IRQHandler,Default_Handler\r
+\r
+   .weak      USART6_IRQHandler\r
+   .thumb_set USART6_IRQHandler,Default_Handler\r
+\r
+   .weak      I2C3_EV_IRQHandler\r
+   .thumb_set I2C3_EV_IRQHandler,Default_Handler\r
+\r
+   .weak      I2C3_ER_IRQHandler\r
+   .thumb_set I2C3_ER_IRQHandler,Default_Handler\r
+\r
+   .weak      OTG_HS_EP1_OUT_IRQHandler\r
+   .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler\r
+\r
+   .weak      OTG_HS_EP1_IN_IRQHandler\r
+   .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler\r
+\r
+   .weak      OTG_HS_WKUP_IRQHandler\r
+   .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler\r
+\r
+   .weak      OTG_HS_IRQHandler\r
+   .thumb_set OTG_HS_IRQHandler,Default_Handler\r
+\r
+   .weak      DCMI_IRQHandler\r
+   .thumb_set DCMI_IRQHandler,Default_Handler\r
+\r
+   .weak      CRYP_IRQHandler\r
+   .thumb_set CRYP_IRQHandler,Default_Handler\r
+\r
+   .weak      HASH_RNG_IRQHandler\r
+   .thumb_set HASH_RNG_IRQHandler,Default_Handler\r
+\r
+   .weak      FPU_IRQHandler\r
+   .thumb_set FPU_IRQHandler,Default_Handler\r
+\r
+/*******************   (C)   COPYRIGHT   2011   STMicroelectronics   *****END   OF   FILE****/\r
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_adc.c b/codec2/tags/0.4/stm32/src/stm32f4_adc.c
new file mode 100644 (file)
index 0000000..cecdbe1
--- /dev/null
@@ -0,0 +1,272 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_adc.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 4 June 2013
+
+  Two channel ADC driver module for STM32F4.  Pin PA1 connects to ADC1, pin
+  PA2 connects to ADC2.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stm32f4xx_adc.h"
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_rcc.h"
+#include "codec2_fifo.h"
+#include "stm32f4_adc.h"
+#include "debugblinky.h"
+
+struct FIFO *adc1_fifo;
+struct FIFO *adc2_fifo;
+unsigned short adc_buf[ADC_BUF_SZ];
+int adc_overflow1, adc_overflow2;
+int half,full;
+
+#define ADCx_DR_ADDRESS          ((uint32_t)0x4001204C)
+#define DMA_CHANNELx             DMA_Channel_0
+#define DMA_STREAMx              DMA2_Stream0
+#define ADCx                     ADC1
+
+void adc_configure();
+
+static void tim2_config(void);
+
+void adc_open(int fifo_sz) {
+    adc1_fifo = fifo_create(fifo_sz);
+    assert(adc1_fifo != NULL);
+    adc2_fifo = fifo_create(fifo_sz);
+    assert(adc2_fifo != NULL);
+
+    tim2_config();
+    adc_configure();
+    init_debug_blinky();
+}
+
+/* n signed 16 bit samples in buf[] if return != -1 */
+
+int adc1_read(short buf[], int n) {   
+    return fifo_read(adc1_fifo, buf, n);
+}
+
+/* n signed 16 bit samples in buf[] if return != -1 */
+
+int adc2_read(short buf[], int n) {   
+    return fifo_read(adc2_fifo, buf, n);
+}
+
+
+static void tim2_config(void)
+{
+  TIM_TimeBaseInitTypeDef    TIM_TimeBaseStructure;
+
+  /* TIM2 Periph clock enable */
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
+  
+  /* --------------------------------------------------------
+  
+  TIM2 input clock (TIM2CLK) is set to 2 * APB1 clock (PCLK1), since
+  APB1 prescaler is different from 1 (see system_stm32f4xx.c and Fig
+  13 clock tree figure in DM0031020.pdf).
+
+     Sample rate Fs = 2*PCLK1/TIM_ClockDivision 
+                    = (HCLK/2)/TIM_ClockDivision
+                    
+  ----------------------------------------------------------- */
+
+  /* Time base configuration */
+
+  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); 
+  TIM_TimeBaseStructure.TIM_Period = 5250;          
+  TIM_TimeBaseStructure.TIM_Prescaler = 0;       
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0;    
+  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  
+  TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
+
+  /* TIM2 TRGO selection */
+
+  TIM_SelectOutputTrigger(TIM2, TIM_TRGOSource_Update);
+  
+  /* TIM2 enable counter */
+
+  TIM_Cmd(TIM2, ENABLE);
+}
+
+
+void adc_configure(){
+    ADC_InitTypeDef  ADC_init_structure; 
+    GPIO_InitTypeDef GPIO_initStructre; 
+    DMA_InitTypeDef  DMA_InitStructure;
+    NVIC_InitTypeDef NVIC_InitStructure;
+
+    // Clock configuration
+
+    RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1,ENABLE);
+    RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOAEN,ENABLE);
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);
+
+    // Analog pin configuration ADC1->PA1, ADC2->PA2 
+
+    GPIO_initStructre.GPIO_Pin =  GPIO_Pin_1 | GPIO_Pin_2;    
+    GPIO_initStructre.GPIO_Mode = GPIO_Mode_AN;     
+    GPIO_initStructre.GPIO_PuPd = GPIO_PuPd_NOPULL; 
+    GPIO_Init(GPIOA,&GPIO_initStructre);            
+
+    // ADC structure configuration
+
+    ADC_DeInit();
+    ADC_init_structure.ADC_DataAlign = ADC_DataAlign_Left;
+    ADC_init_structure.ADC_Resolution = ADC_Resolution_12b;
+    ADC_init_structure.ADC_ContinuousConvMode = DISABLE; 
+    ADC_init_structure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_TRGO;
+    ADC_init_structure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_Rising;
+    ADC_init_structure.ADC_NbrOfConversion = 2;
+    ADC_init_structure.ADC_ScanConvMode = ENABLE;
+    ADC_Init(ADCx,&ADC_init_structure);
+
+    // Select the channel to be read from
+
+    ADC_RegularChannelConfig(ADCx,ADC_Channel_1,1,ADC_SampleTime_144Cycles);
+    ADC_RegularChannelConfig(ADCx,ADC_Channel_2,2,ADC_SampleTime_144Cycles);
+    //ADC_VBATCmd(ENABLE); 
+
+    /* DMA  configuration **************************************/
+
+    DMA_DeInit(DMA_STREAMx);
+    DMA_InitStructure.DMA_Channel = DMA_CHANNELx;  
+    DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)ADCx_DR_ADDRESS;
+    DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)adc_buf;
+    DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
+    DMA_InitStructure.DMA_BufferSize = ADC_BUF_SZ;
+    DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
+    DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
+    DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
+    DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
+    DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
+    DMA_InitStructure.DMA_Priority = DMA_Priority_High;
+    DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         
+    DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
+    DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
+    DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
+    DMA_Init(DMA_STREAMx, &DMA_InitStructure);
+
+    /* Enable DMA request after last transfer (Single-ADC mode) */
+
+    ADC_DMARequestAfterLastTransferCmd(ADCx, ENABLE);
+
+    /* Enable ADC1 DMA */
+
+    ADC_DMACmd(ADCx, ENABLE);
+
+    /* DMA2_Stream0 enable */
+
+    DMA_Cmd(DMA_STREAMx, ENABLE);
+
+    /* Enable DMA Half & Complete interrupts */
+
+    DMA_ITConfig(DMA2_Stream0, DMA_IT_TC | DMA_IT_HT, ENABLE);
+
+    /* Enable the DMA Stream IRQ Channel */
+
+    NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream0_IRQn;
+    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+    NVIC_Init(&NVIC_InitStructure);     
+
+    // Enable and start ADC conversion
+
+    ADC_Cmd(ADC1,ENABLE);
+    ADC_SoftwareStartConv(ADC1);
+}
+
+/*
+  This function handles DMA Stream interrupt request.
+*/
+
+void DMA2_Stream0_IRQHandler(void) {
+    int i, j, sam;
+    short signed_buf1[ADC_BUF_SZ/2];
+    short signed_buf2[ADC_BUF_SZ/2];
+
+    GPIOE->ODR |= (1 << 0);
+
+    /* Half transfer interrupt */
+
+    if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_HTIF0) != RESET) {
+        half++;
+
+        /* convert to signed */
+
+        for(i=0, j=0; i<ADC_BUF_SZ/2; i+=2,j++) {
+            sam = (int)adc_buf[i] - 32768;
+            signed_buf1[j] = sam;
+            sam = (int)adc_buf[i+1] - 32768;
+            signed_buf2[j] = sam;
+        }
+        /* write first half to fifo */
+
+        if (fifo_write(adc1_fifo, signed_buf1, ADC_BUF_SZ/4) == -1) {
+            adc_overflow1++;
+        }
+        if (fifo_write(adc2_fifo, signed_buf2, ADC_BUF_SZ/4) == -1) {
+            adc_overflow2++;
+        }
+
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */
+
+        DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_HTIF0);  
+    }
+
+    /* Transfer complete interrupt */
+
+    if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0) != RESET) {
+        full++;
+
+        /* convert to signed */
+
+        for(i=0, j=0; i<ADC_BUF_SZ/2; i+=2,j++) {
+            sam = (int)adc_buf[ADC_BUF_SZ/2 + i] - 32768;
+            signed_buf1[j] = sam;
+            sam = (int)adc_buf[ADC_BUF_SZ/2 + i+1] - 32768;
+            signed_buf2[j] = sam;
+        }
+
+        /* write second half to fifo */
+
+        if (fifo_write(adc1_fifo, signed_buf1, ADC_BUF_SZ/4) == -1) {
+            adc_overflow1++;
+        }
+        if (fifo_write(adc2_fifo, signed_buf2, ADC_BUF_SZ/4) == -1) {
+            adc_overflow2++;
+        }
+
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */
+
+        DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_TCIF0);  
+    }
+
+    GPIOE->ODR &= ~(1 << 0);
+}
+
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_adc_tuner.c b/codec2/tags/0.4/stm32/src/stm32f4_adc_tuner.c
new file mode 100644 (file)
index 0000000..d083c59
--- /dev/null
@@ -0,0 +1,268 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_adc_tuner.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 19 Feb 2015
+
+  Single channel ADC driver module for STM32F4 that samples pin PA1 at
+  2 MHz and down converts to 50 kHz, with "tuning" centred at 500 kHz.
+
+  See codec2-dev/octave.m for a simulation model.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2015 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 <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stm32f4xx_adc.h"
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_rcc.h"
+#include "codec2_fifo.h"
+#include "stm32f4_adc_tuner.h"
+#include "debugblinky.h"
+#include "iir_tuner.h"
+
+struct FIFO *adc1_fifo;
+unsigned short adc_buf[ADC_TUNER_BUF_SZ];
+int adc_overflow1;
+int half,full;
+
+#define ADCx_DR_ADDRESS          ((uint32_t)0x4001204C)
+#define DMA_CHANNELx             DMA_Channel_0
+#define DMA_STREAMx              DMA2_Stream0
+#define ADCx                     ADC1
+
+void adc_configure();
+
+static void tim2_config(void);
+
+
+void adc_open(int fifo_sz) {
+    adc1_fifo = fifo_create(fifo_sz);
+    assert(adc1_fifo != NULL);
+
+    tim2_config();
+    adc_configure();
+    init_debug_blinky();
+}
+
+
+/* n signed 16 bit samples in buf[] if return != -1 */
+
+int adc1_read(short buf[], int n) {   
+    return fifo_read(adc1_fifo, buf, n);
+}
+
+
+static void tim2_config(void)
+{
+  TIM_TimeBaseInitTypeDef    TIM_TimeBaseStructure;
+
+  /* TIM2 Periph clock enable */
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
+  
+  /* --------------------------------------------------------
+  
+  TIM2 input clock (TIM2CLK) is set to 2 * APB1 clock (PCLK1), since
+  APB1 prescaler is different from 1 (see system_stm32f4xx.c and Fig
+  13 clock tree figure in DM0031020.pdf).
+
+     Sample rate Fs = 2*PCLK1/)TIM_ClockDivision+1)
+                    = (HCLK/2)/(TIM_ClockDivision+1)
+                    
+  Note from David: The +1 was discovered empirically, still not sure
+  if it's right.
+
+  ----------------------------------------------------------- */
+
+  /* Time base configuration */
+
+  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); 
+  TIM_TimeBaseStructure.TIM_Period = 41;          
+  TIM_TimeBaseStructure.TIM_Prescaler = 0;       
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0;    
+  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  
+  TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
+
+  /* TIM2 TRGO selection */
+
+  TIM_SelectOutputTrigger(TIM2, TIM_TRGOSource_Update);
+  
+  /* TIM2 enable counter */
+
+  TIM_Cmd(TIM2, ENABLE);
+}
+
+
+void adc_configure() {
+    ADC_InitTypeDef  ADC_init_structure; 
+    GPIO_InitTypeDef GPIO_initStructre; 
+    DMA_InitTypeDef  DMA_InitStructure;
+    NVIC_InitTypeDef NVIC_InitStructure;
+
+    // Clock configuration
+
+    RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1,ENABLE);
+    RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOAEN,ENABLE);
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);
+
+    // Analog pin configuration ADC1->PA1
+
+    GPIO_initStructre.GPIO_Pin =  GPIO_Pin_1;    
+    GPIO_initStructre.GPIO_Mode = GPIO_Mode_AN;     
+    GPIO_initStructre.GPIO_PuPd = GPIO_PuPd_NOPULL; 
+    GPIO_Init(GPIOA,&GPIO_initStructre);            
+
+    // ADC structure configuration
+
+    ADC_DeInit();
+    ADC_init_structure.ADC_DataAlign = ADC_DataAlign_Left;
+    ADC_init_structure.ADC_Resolution = ADC_Resolution_12b;
+    ADC_init_structure.ADC_ContinuousConvMode = DISABLE; 
+    ADC_init_structure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_TRGO;
+    ADC_init_structure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_Rising;
+    ADC_init_structure.ADC_NbrOfConversion = 1;
+    ADC_Init(ADCx,&ADC_init_structure);
+
+    // Select the channel to be read from
+
+    ADC_RegularChannelConfig(ADCx,ADC_Channel_1,1,ADC_SampleTime_3Cycles);
+
+    /* DMA  configuration **************************************/
+
+    DMA_DeInit(DMA_STREAMx);
+    DMA_InitStructure.DMA_Channel = DMA_CHANNELx;  
+    DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)ADCx_DR_ADDRESS;
+    DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)adc_buf;
+    DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
+    DMA_InitStructure.DMA_BufferSize = ADC_TUNER_BUF_SZ;
+    DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
+    DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
+    DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
+    DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
+    DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
+    DMA_InitStructure.DMA_Priority = DMA_Priority_High;
+    DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         
+    DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
+    DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
+    DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
+    DMA_Init(DMA_STREAMx, &DMA_InitStructure);
+
+    /* Enable DMA request after last transfer (Single-ADC mode) */
+
+    ADC_DMARequestAfterLastTransferCmd(ADCx, ENABLE);
+
+    /* Enable ADC1 DMA */
+
+    ADC_DMACmd(ADCx, ENABLE);
+
+    /* DMA2_Stream0 enable */
+
+    DMA_Cmd(DMA_STREAMx, ENABLE);
+
+    /* Enable DMA Half & Complete interrupts */
+
+    DMA_ITConfig(DMA2_Stream0, DMA_IT_TC | DMA_IT_HT, ENABLE);
+
+    /* Enable the DMA Stream IRQ Channel */
+
+    NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream0_IRQn;
+    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+    NVIC_Init(&NVIC_InitStructure);     
+
+    // Enable and start ADC conversion
+
+    ADC_Cmd(ADC1,ENABLE);
+    ADC_SoftwareStartConv(ADC1);
+}
+
+
+/*
+  This function handles DMA Stream interrupt request.
+
+  ADC_TUNER_BUF_SZ = 45 * 160 = 7200, so one interrupt every 7200/2 = 3600 samples
+  or interrupts at a rate of 2E6/3600 = 555.56 Hz.
+*/
+
+void DMA2_Stream0_IRQHandler(void) {
+    float dec_buf[ADC_TUNER_N/2];
+    int i;
+
+    /* PE0 is asserted high for the duration of this ISR */
+
+    GPIOE->ODR |= (1 << 0);
+
+    //#define DUMMY_SIGNAL
+    #ifdef DUMMY_SIGNAL
+
+    /* Fs/4 sine wave, right in the middle of the pass band ! */
+
+    for(i=0; i<ADC_TUNER_BUF_SZ; i++)
+        adc_buf[i] = 32767;
+    for(i=1; i<ADC_TUNER_BUF_SZ; i+=4)
+        adc_buf[i] += 32767;
+    for(i=3; i<ADC_TUNER_BUF_SZ; i+=4)
+        adc_buf[i] -= 32767;
+
+    #endif
+
+    /* Half transfer interrupt */
+
+    if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_HTIF0) != RESET) {
+        half++;
+
+        iir_tuner(dec_buf, adc_buf);
+
+        /* write first half to fifo */
+
+        if (fifo_write(adc1_fifo, (short*)dec_buf, ADC_TUNER_N) == -1) {
+            adc_overflow1++;
+        }
+
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */
+
+        DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_HTIF0);  
+    }
+
+    /* Transfer complete interrupt */
+
+    if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0) != RESET) {
+        full++;
+
+        iir_tuner(dec_buf, &adc_buf[ADC_TUNER_BUF_SZ/2]);
+
+        /* write second half to fifo */
+
+        if (fifo_write(adc1_fifo, (short*)dec_buf, ADC_TUNER_N) == -1) {
+            adc_overflow1++;
+        }
+
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */
+
+        DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_TCIF0);  
+    }
+
+    GPIOE->ODR &= ~(1 << 0);
+}
+
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_dac.c b/codec2/tags/0.4/stm32/src/stm32f4_dac.c
new file mode 100644 (file)
index 0000000..75416a3
--- /dev/null
@@ -0,0 +1,398 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: stm32f4_dac.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 1 June 2013\r
+\r
+  DAC driver module for STM32F4. DAC1 is connected to pin PA4, DAC2\r
+  is connected to pin PA5.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2013 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "stm32f4xx.h"\r
+#include "codec2_fifo.h"\r
+#include "stm32f4_dac.h"\r
+#include "debugblinky.h"\r
+\r
+/* write to these registers for 12 bit left aligned data, as per data sheet \r
+   make sure 4 least sig bits set to 0 */\r
+\r
+#define DAC_DHR12R1_ADDRESS    0x40007408\r
+#define DAC_DHR12R2_ADDRESS    0x40007414\r
+\r
+#define DAC_MAX      4096            /* maximum amplitude */\r
+\r
+/* y=mx+c mapping of samples16 bit shorts to DAC samples.  Table: 74\r
+   of data sheet indicates With DAC buffer on, DAC range is limited to\r
+   0x0E0 to 0xF1C at VREF+ = 3.6 V, we have Vref=3.3V which is close.\r
+ */\r
+\r
+#define M ((3868.0-224.0)/65536.0)\r
+#define C 2047.0\r
+\r
+static struct FIFO *dac1_fifo;\r
+static struct FIFO *dac2_fifo;\r
+\r
+static unsigned short dac1_buf[DAC_BUF_SZ];\r
+static unsigned short dac2_buf[DAC_BUF_SZ];\r
+\r
+static void tim6_config(void);\r
+static void dac1_config(void);\r
+static void dac2_config(void);\r
+\r
+int dac_underflow;\r
+\r
+void dac_open(int fifo_size) {\r
+\r
+    memset(dac1_buf, 32768, sizeof(short)*DAC_BUF_SZ);\r
+    memset(dac2_buf, 32768, sizeof(short)*DAC_BUF_SZ);\r
+\r
+    /* Create fifos */\r
+\r
+    dac1_fifo = fifo_create(fifo_size);\r
+    dac2_fifo = fifo_create(fifo_size);\r
+    assert(dac1_fifo != NULL);\r
+    assert(dac2_fifo != NULL);\r
+\r
+    /* Turn on the clocks we need -----------------------------------------------*/\r
+\r
+    /* DMA1 clock enable */\r
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);\r
+    /* GPIOA clock enable (to be used with DAC) */\r
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);                         \r
+    /* DAC Periph clock enable */\r
+    RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);\r
+\r
+    /* GPIO Pin configuration DAC1->PA.4, DAC2->PA.5 configuration --------------*/\r
+\r
+    GPIO_InitTypeDef GPIO_InitStructure;\r
+    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;\r
+    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;\r
+    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
+    GPIO_Init(GPIOA, &GPIO_InitStructure);\r
+\r
+    /* Timer and DAC 1 & 2 Configuration ----------------------------------------*/\r
+\r
+    tim6_config();  \r
+    dac1_config();\r
+    dac2_config();\r
+\r
+    init_debug_blinky();\r
+}\r
+\r
+/* Call these puppies to send samples to the DACs.  For your\r
+   convenience they accept signed 16 bit samples. */\r
+\r
+int dac1_write(short buf[], int n) {   \r
+    return fifo_write(dac1_fifo, buf, n);\r
+}\r
+\r
+int dac2_write(short buf[], int n) {   \r
+    return fifo_write(dac2_fifo, buf, n);\r
+}\r
+\r
+static void tim6_config(void)\r
+{\r
+  TIM_TimeBaseInitTypeDef    TIM_TimeBaseStructure;\r
+\r
+  /* TIM6 Periph clock enable */\r
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE);\r
+  \r
+  /* --------------------------------------------------------\r
+  \r
+  TIM6 input clock (TIM6CLK) is set to 2 * APB1 clock (PCLK1), since\r
+  APB1 prescaler is different from 1 (see system_stm32f4xx.c and Fig\r
+  13 clock tree figure in DM0031020.pdf).\r
+\r
+     Sample rate Fs = 2*PCLK1/TIM_ClockDivision \r
+                    = (HCLK/2)/TIM_ClockDivision\r
+                    \r
+  ----------------------------------------------------------- */\r
+\r
+  /* Time base configuration */\r
+\r
+  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); \r
+  TIM_TimeBaseStructure.TIM_Period = 5250;          \r
+  TIM_TimeBaseStructure.TIM_Prescaler = 0;       \r
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0;    \r
+  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  \r
+  TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure);\r
+\r
+  /* TIM6 TRGO selection */\r
+\r
+  TIM_SelectOutputTrigger(TIM6, TIM_TRGOSource_Update);\r
+  \r
+  /* TIM6 enable counter */\r
+\r
+  TIM_Cmd(TIM6, ENABLE);\r
+}\r
+\r
+static void dac1_config(void)\r
+{\r
+  DAC_InitTypeDef  DAC_InitStructure;\r
+  DMA_InitTypeDef  DMA_InitStructure;\r
+  NVIC_InitTypeDef NVIC_InitStructure;\r
+  \r
+  /* DAC channel 1 Configuration */\r
+\r
+  /* \r
+     This line fixed a bug that cost me 5 days, bad wave amplitude\r
+     value, and some STM32F4 periph library bugs caused triangle wave\r
+     geneartion to be enable resulting in a low level tone on the\r
+     SM1000, that we thought was caused by analog issues like layour\r
+     or power supply biasing\r
+  */\r
+  DAC_StructInit(&DAC_InitStructure); \r
+\r
+  DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO; \r
+  DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;\r
+  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;\r
+  DAC_Init(DAC_Channel_1, &DAC_InitStructure);\r
+\r
+  /* DMA1_Stream5 channel7 configuration **************************************/\r
+  /* Table 35 page 219 of the monster data sheet */\r
+\r
+  DMA_DeInit(DMA1_Stream5);\r
+  DMA_InitStructure.DMA_Channel = DMA_Channel_7;  \r
+  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)DAC_DHR12R1_ADDRESS;\r
+  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)dac1_buf;\r
+  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;\r
+  DMA_InitStructure.DMA_BufferSize = DAC_BUF_SZ;\r
+  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;\r
+  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;\r
+  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;\r
+  DMA_InitStructure.DMA_Priority = DMA_Priority_High;\r
+  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         \r
+  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;\r
+  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;\r
+  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;\r
+  DMA_Init(DMA1_Stream5, &DMA_InitStructure);\r
+\r
+  /* Enable DMA Half & Complete interrupts */\r
+\r
+  DMA_ITConfig(DMA1_Stream5, DMA_IT_TC | DMA_IT_HT, ENABLE);\r
+\r
+  /* Enable the DMA Stream IRQ Channel */\r
+\r
+  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream5_IRQn;\r
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
+  NVIC_Init(&NVIC_InitStructure);     \r
+\r
+  /* Enable DMA1_Stream5 */\r
+\r
+  DMA_Cmd(DMA1_Stream5, ENABLE);\r
+\r
+  /* Enable DAC Channel 1 */\r
+\r
+  DAC_Cmd(DAC_Channel_1, ENABLE);\r
+\r
+  /* Enable DMA for DAC Channel 1 */\r
+\r
+  DAC_DMACmd(DAC_Channel_1, ENABLE);\r
+}\r
+\r
+static void dac2_config(void)\r
+{\r
+  DAC_InitTypeDef  DAC_InitStructure;\r
+  DMA_InitTypeDef DMA_InitStructure;\r
+  NVIC_InitTypeDef NVIC_InitStructure;\r
+  \r
+  /* DAC channel 2 Configuration (see notes in dac1_config() above) */\r
+\r
+  DAC_StructInit(&DAC_InitStructure);\r
+  DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO;\r
+  DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;\r
+  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;\r
+  DAC_Init(DAC_Channel_2, &DAC_InitStructure);\r
+\r
+  /* DMA1_Stream6 channel7 configuration **************************************/\r
+\r
+  DMA_DeInit(DMA1_Stream6);\r
+  DMA_InitStructure.DMA_Channel = DMA_Channel_7;  \r
+  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)DAC_DHR12R2_ADDRESS;\r
+  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)dac2_buf;\r
+  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;\r
+  DMA_InitStructure.DMA_BufferSize = DAC_BUF_SZ;\r
+  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;\r
+  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;\r
+  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;\r
+  DMA_InitStructure.DMA_Priority = DMA_Priority_High;\r
+  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         \r
+  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;\r
+  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;\r
+  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;\r
+  DMA_Init(DMA1_Stream6, &DMA_InitStructure);\r
+\r
+  /* Enable DMA Half & Complete interrupts */\r
+\r
+  DMA_ITConfig(DMA1_Stream6, DMA_IT_TC | DMA_IT_HT, ENABLE);\r
+\r
+  /* Enable the DMA Stream IRQ Channel */\r
+\r
+  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream6_IRQn;\r
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
+  NVIC_Init(&NVIC_InitStructure);     \r
+\r
+  /* Enable DMA1_Stream6 */\r
+\r
+  DMA_Cmd(DMA1_Stream6, ENABLE);\r
+\r
+  /* Enable DAC Channel 2 */\r
+\r
+  DAC_Cmd(DAC_Channel_2, ENABLE);\r
+\r
+  /* Enable DMA for DAC Channel 2 */\r
+\r
+  DAC_DMACmd(DAC_Channel_2, ENABLE);\r
+\r
+}\r
+\r
+/******************************************************************************/\r
+/*                 STM32F4xx Peripherals Interrupt Handlers                   */\r
+/*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */\r
+/*  available peripheral interrupt handler's name please refer to the startup */\r
+/*  file (startup_stm32f40xx.s/startup_stm32f427x.s).                         */\r
+/******************************************************************************/\r
+\r
+/*\r
+  This function handles DMA1 Stream 5 interrupt request for DAC1.\r
+*/\r
+\r
+void DMA1_Stream5_IRQHandler(void) {\r
+    int i, j, sam;\r
+    short signed_buf[DAC_BUF_SZ/2];\r
+\r
+    GPIOE->ODR |= (1 << 1);\r
+\r
+    /* Transfer half empty interrupt - refill first half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_HTIF5) != RESET) {\r
+        /* fill first half from fifo */\r
+\r
+        if (fifo_read(dac1_fifo, signed_buf, DAC_BUF_SZ/2) == -1) {\r
+            memset(signed_buf, 0, sizeof(short)*DAC_BUF_SZ/2);\r
+            dac_underflow++;\r
+        }\r
+\r
+        /* convert to unsigned */\r
+\r
+        for(i=0; i<DAC_BUF_SZ/2; i++) {\r
+            sam = (int)(M*(float)signed_buf[i] + C);\r
+            dac1_buf[i] = (unsigned short)sam;\r
+        }\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_HTIF5);  \r
+    }\r
+\r
+    /* Transfer complete interrupt - refill 2nd half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_TCIF5) != RESET) {\r
+        /* fill second half from fifo */\r
+\r
+        if (fifo_read(dac1_fifo, signed_buf, DAC_BUF_SZ/2) == -1) {\r
+            memset(signed_buf, 0, sizeof(short)*DAC_BUF_SZ/2);\r
+            dac_underflow++;\r
+        }\r
+\r
+        /* convert to unsigned */\r
+\r
+        for(i=0, j=DAC_BUF_SZ/2; i<DAC_BUF_SZ/2; i++,j++) {\r
+            sam = (int)(M*(float)signed_buf[i] + C);\r
+            dac1_buf[j] = (unsigned short)sam;\r
+        }\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_TCIF5);  \r
+    }\r
+\r
+    GPIOE->ODR &= ~(1 << 1);\r
+}\r
+\r
+/*\r
+  This function handles DMA1 Stream 6 interrupt request for DAC2.\r
+*/\r
+\r
+void DMA1_Stream6_IRQHandler(void) {\r
+    int i, j, sam;\r
+    short signed_buf[DAC_BUF_SZ/2];\r
+\r
+    GPIOE->ODR |= (1 << 2);\r
+\r
+    /* Transfer half empty interrupt - refill first half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream6, DMA_IT_HTIF6) != RESET) {\r
+        /* fill first half from fifo */\r
+\r
+        if (fifo_read(dac2_fifo, signed_buf, DAC_BUF_SZ/2) == -1) {\r
+            memset(signed_buf, 0, sizeof(short)*DAC_BUF_SZ/2);\r
+            dac_underflow++;\r
+        }\r
+\r
+        /* convert to unsigned */\r
+\r
+        for(i=0; i<DAC_BUF_SZ/2; i++) {\r
+            sam = (int)(M*(float)signed_buf[i] + C);\r
+            dac2_buf[i] = (unsigned short)sam;\r
+        }\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+        DMA_ClearITPendingBit(DMA1_Stream6, DMA_IT_HTIF6);  \r
+    }\r
+\r
+    /* Transfer complete interrupt - refill 2nd half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream6, DMA_IT_TCIF6) != RESET) {\r
+        /* fill second half from fifo */\r
+\r
+        if (fifo_read(dac2_fifo, signed_buf, DAC_BUF_SZ/2) == -1) {\r
+            memset(signed_buf, 0, sizeof(short)*DAC_BUF_SZ/2);\r
+            dac_underflow++;\r
+        }\r
+\r
+        /* convert to unsigned  */\r
+\r
+        for(i=0, j=DAC_BUF_SZ/2; i<DAC_BUF_SZ/2; i++,j++) {\r
+            sam = (int)(M*(float)signed_buf[i] + C);\r
+            dac2_buf[j] = (unsigned short)sam;\r
+        }\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+        DMA_ClearITPendingBit(DMA1_Stream6, DMA_IT_TCIF6);  \r
+    }\r
+\r
+    GPIOE->ODR &= ~(1 << 2);\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_dacduc.c b/codec2/tags/0.4/stm32/src/stm32f4_dacduc.c
new file mode 100644 (file)
index 0000000..ec683c3
--- /dev/null
@@ -0,0 +1,416 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: stm32f4_dac.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 1 June 2013\r
+\r
+  DAC driver module for STM32F4. DAC1 if fixed at Fs of 2Mhz.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2013 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "stm32f4xx.h"\r
+#include "codec2_fifo.h"\r
+#include "stm32f4_dacduc.h"\r
+#include "debugblinky.h"\r
\r
+/* write to these registers for 12 bit left aligned data, as per data sheet \r
+   make sure 4 least sig bits set to 0 */\r
+\r
+#define DAC_DHR12R1_ADDRESS    0x40007408\r
+#define DAC_DHR12R2_ADDRESS    0x40007414\r
+\r
+#define DAC_MAX      4096            /* maximum amplitude */\r
+\r
+/* y=mx+c mapping of samples16 bit shorts to DAC samples.  Table: 74\r
+   of data sheet indicates With DAC buffer on, DAC range is limited to\r
+   0x0E0 to 0xF1C at VREF+ = 3.6 V, we have Vref=3.3V which is close.\r
+ */\r
+\r
+#define M ((3868.0-224.0)/65536.0)\r
+#define C 2047.0\r
+\r
+\r
+static struct FIFO *dac1_fifo;\r
+static struct FIFO *dac2_fifo;\r
+\r
+static unsigned short dac1_buf[DAC_DUC_BUF_SZ];\r
+static unsigned short dac2_buf[DAC_BUF_SZ];\r
+\r
+static void tim6_config(void);\r
+static void tim7_config(void);\r
+static void dac1_config(void);\r
+static void dac2_config(void);\r
+\r
+int dac_underflow;\r
+\r
+void fast_dac_open(int dac1_fifo_size,int dac2_fifo_size) {\r
+\r
+    memset(dac1_buf, 32768, sizeof(short)*DAC_DUC_BUF_SZ);\r
+    memset(dac2_buf, 32768, sizeof(short)*DAC_BUF_SZ);\r
+\r
+    /* Create fifos */\r
+\r
+    dac1_fifo = fifo_create(dac1_fifo_size);\r
+    dac2_fifo = fifo_create(dac2_fifo_size);\r
+    assert(dac1_fifo != NULL);\r
+    assert(dac2_fifo != NULL);\r
+\r
+    /* Turn on the clocks we need -----------------------------------------------*/\r
+\r
+    /* DMA1 clock enable */\r
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);\r
+    /* GPIOA clock enable (to be used with DAC) */\r
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);                         \r
+    /* DAC Periph clock enable */\r
+    RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);\r
+\r
+    /* GPIO Pin configuration DAC1->PA.4, DAC2->PA.5 configuration --------------*/\r
+\r
+    GPIO_InitTypeDef GPIO_InitStructure;\r
+    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;\r
+    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;\r
+    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
+    GPIO_Init(GPIOA, &GPIO_InitStructure);\r
+\r
+    /* Timer and DAC 1 & 2 Configuration ----------------------------------------*/\r
+    tim7_config();\r
+    tim6_config();  \r
+    dac1_config();\r
+    dac2_config();\r
+\r
+    init_debug_blinky();\r
+}\r
+\r
+\r
+/* Call these puppies to send samples to the DACs.  For your\r
+   convenience they accept signed 16 bit samples. */\r
+\r
+int dac1_write(short buf[], int n) {   \r
+    return fifo_write(dac1_fifo, buf, n);\r
+}\r
+\r
+int dac2_write(short buf[], int n) {   \r
+    return fifo_write(dac2_fifo, buf, n);\r
+}\r
+\r
+static void tim6_config(void)\r
+{\r
+  TIM_TimeBaseInitTypeDef    TIM_TimeBaseStructure;\r
+\r
+  /* TIM6 Periph clock enable */\r
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE);\r
+  \r
+  /* --------------------------------------------------------\r
+  \r
+  TIM6 input clock (TIM6CLK) is set to 2 * APB1 clock (PCLK1), since\r
+  APB1 prescaler is different from 1 (see system_stm32f4xx.c and Fig\r
+  13 clock tree figure in DM0031020.pdf).\r
+\r
+     Sample rate Fs = 2*PCLK1/TIM_ClockDivision \r
+                    = (HCLK/2)/TIM_ClockDivision\r
+                    \r
+  ----------------------------------------------------------- */\r
+\r
+  /* Time base configuration */\r
+\r
+  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); \r
+  TIM_TimeBaseStructure.TIM_Period = 5250;          \r
+  TIM_TimeBaseStructure.TIM_Prescaler = 0;       \r
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0;    \r
+  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  \r
+  TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure);\r
+\r
+  /* TIM6 TRGO selection */\r
+\r
+  TIM_SelectOutputTrigger(TIM6, TIM_TRGOSource_Update);\r
+  \r
+  /* TIM6 enable counter */\r
+\r
+  TIM_Cmd(TIM6, ENABLE);\r
+}\r
+\r
+/* Sets up tim7 to run at a high sample rate */\r
+void tim7_config(void)\r
+{\r
+  /* Set up tim7 */\r
+\r
+\r
+  TIM_TimeBaseInitTypeDef    TIM_TimeBaseStructure;\r
+\r
+  /* TIM7 Periph clock enable */\r
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM7, ENABLE);\r
+  \r
+  /* --------------------------------------------------------\r
+\r
+  \r
+  TIM7 input clock (TIM7CLK) is set to 2 * APB1 clock (PCLK1), since\r
+  APB1 prescaler is different from 1 (see system_stm32f4xx.c and Fig\r
+  13 clock tree figure in DM0031020.pdf).\r
+\r
+     Sample rate Fs = 2*PCLK1/TIM_ClockDivision \r
+                    = (HCLK/2)/TIM_ClockDivision\r
+                    \r
+  ----------------------------------------------------------- */\r
+\r
+  /* Time base configuration */\r
+\r
+  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); \r
+  TIM_TimeBaseStructure.TIM_Period = 41;          \r
+  TIM_TimeBaseStructure.TIM_Prescaler = 0;       \r
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0;    \r
+  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  \r
+  TIM_TimeBaseInit(TIM7, &TIM_TimeBaseStructure);\r
+\r
+  /* TIM7 TRGO selection */\r
+\r
+  TIM_SelectOutputTrigger(TIM7, TIM_TRGOSource_Update);\r
+  \r
+  /* TIM7 enable counter */\r
+\r
+  TIM_Cmd(TIM7, ENABLE);\r
+}\r
+\r
+static void dac1_config(void)\r
+{\r
+  DAC_InitTypeDef  DAC_InitStructure;\r
+  DMA_InitTypeDef  DMA_InitStructure;\r
+  NVIC_InitTypeDef NVIC_InitStructure;\r
+  \r
+  /* DAC channel 1 Configuration */\r
+\r
+  /* \r
+     This line fixed a bug that cost me 5 days, bad wave amplitude\r
+     value, and some STM32F4 periph library bugs caused triangle wave\r
+     geneartion to be enable resulting in a low level tone on the\r
+     SM1000, that we thought was caused by analog issues like layour\r
+     or power supply biasing\r
+  */\r
+  DAC_StructInit(&DAC_InitStructure); \r
+\r
+  DAC_InitStructure.DAC_Trigger = DAC_Trigger_T7_TRGO; \r
+  DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;\r
+\r
+  /*External buffering is needed to get nice square samples at Fs=2Mhz. See DM00129215.pdf */\r
+  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;\r
+  DAC_Init(DAC_Channel_1, &DAC_InitStructure);\r
+\r
+  /* DMA1_Stream5 channel7 configuration **************************************/\r
+  /* Table 35 page 219 of the monster data sheet */\r
+\r
+  DMA_DeInit(DMA1_Stream5);\r
+  DMA_InitStructure.DMA_Channel = DMA_Channel_7;  \r
+  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)DAC_DHR12R1_ADDRESS;\r
+  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)dac1_buf;\r
+  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;\r
+  DMA_InitStructure.DMA_BufferSize = DAC_DUC_BUF_SZ;\r
+  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;\r
+  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;\r
+  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;\r
+  DMA_InitStructure.DMA_Priority = DMA_Priority_High;\r
+  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         \r
+  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;\r
+  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;\r
+  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;\r
+  DMA_Init(DMA1_Stream5, &DMA_InitStructure);\r
+\r
+  /* Enable DMA Half & Complete interrupts */\r
+\r
+  DMA_ITConfig(DMA1_Stream5, DMA_IT_TC | DMA_IT_HT, ENABLE);\r
+\r
+  /* Enable the DMA Stream IRQ Channel */\r
+\r
+  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream5_IRQn;\r
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
+  NVIC_Init(&NVIC_InitStructure);     \r
+\r
+  /* Enable DMA1_Stream5 */\r
+\r
+  DMA_Cmd(DMA1_Stream5, ENABLE);\r
+\r
+  /* Enable DAC Channel 1 */\r
+\r
+  DAC_Cmd(DAC_Channel_1, ENABLE);\r
+\r
+  /* Enable DMA for DAC Channel 1 */\r
+\r
+  DAC_DMACmd(DAC_Channel_1, ENABLE);\r
+}\r
+\r
+static void dac2_config(void)\r
+{\r
+  DAC_InitTypeDef  DAC_InitStructure;\r
+  DMA_InitTypeDef DMA_InitStructure;\r
+  NVIC_InitTypeDef NVIC_InitStructure;\r
+  \r
+  /* DAC channel 2 Configuration (see notes in dac1_config() above) */\r
+\r
+  DAC_StructInit(&DAC_InitStructure);\r
+  DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO;\r
+  DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;\r
+  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;\r
+  DAC_Init(DAC_Channel_2, &DAC_InitStructure);\r
+\r
+  /* DMA1_Stream6 channel7 configuration **************************************/\r
+\r
+  DMA_DeInit(DMA1_Stream6);\r
+  DMA_InitStructure.DMA_Channel = DMA_Channel_7;  \r
+  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)DAC_DHR12R2_ADDRESS;\r
+  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)dac2_buf;\r
+  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;\r
+  DMA_InitStructure.DMA_BufferSize = DAC_BUF_SZ;\r
+  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;\r
+  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;\r
+  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;\r
+  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;\r
+  DMA_InitStructure.DMA_Priority = DMA_Priority_High;\r
+  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         \r
+  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;\r
+  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;\r
+  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;\r
+  DMA_Init(DMA1_Stream6, &DMA_InitStructure);\r
+\r
+  /* Enable DMA Half & Complete interrupts */\r
+\r
+  DMA_ITConfig(DMA1_Stream6, DMA_IT_TC | DMA_IT_HT, ENABLE);\r
+\r
+  /* Enable the DMA Stream IRQ Channel */\r
+\r
+  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream6_IRQn;\r
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\r
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
+  NVIC_Init(&NVIC_InitStructure);     \r
+\r
+  /* Enable DMA1_Stream6 */\r
+\r
+  DMA_Cmd(DMA1_Stream6, ENABLE);\r
+\r
+  /* Enable DAC Channel 2 */\r
+\r
+  DAC_Cmd(DAC_Channel_2, ENABLE);\r
+\r
+  /* Enable DMA for DAC Channel 2 */\r
+\r
+  DAC_DMACmd(DAC_Channel_2, ENABLE);\r
+\r
+}\r
+\r
+/******************************************************************************/\r
+/*                 STM32F4xx Peripherals Interrupt Handlers                   */\r
+/*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */\r
+/*  available peripheral interrupt handler's name please refer to the startup */\r
+/*  file (startup_stm32f40xx.s/startup_stm32f427x.s).                         */\r
+/******************************************************************************/\r
+\r
+/*\r
+  This function handles DMA1 Stream 5 interrupt request for DAC1.\r
+*/\r
+\r
+void DMA1_Stream5_IRQHandler(void) {\r
+    GPIOE->ODR |= (1 << 1);\r
+\r
+    /* Transfer half empty interrupt - refill first half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_HTIF5) != RESET) {\r
+        /* fill first half from fifo */\r
+       fifo_read(dac1_fifo, (short*)dac1_buf, DAC_DUC_BUF_SZ/2);\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_HTIF5);  \r
+    }\r
+\r
+    /* Transfer complete interrupt - refill 2nd half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_TCIF5) != RESET) {\r
+        /* fill second half from fifo */\r
+       fifo_read(dac1_fifo, (short*)(dac1_buf+DAC_DUC_BUF_SZ/2), DAC_DUC_BUF_SZ/2);\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_TCIF5);  \r
+    }\r
+\r
+    GPIOE->ODR &= ~(1 << 1);\r
+}\r
+\r
+/*\r
+  This function handles DMA1 Stream 6 interrupt request for DAC2.\r
+*/\r
+\r
+void DMA1_Stream6_IRQHandler(void) {\r
+    int i, j, sam;\r
+    short signed_buf[DAC_BUF_SZ/2];\r
+\r
+    GPIOE->ODR |= (1 << 2);\r
+\r
+    /* Transfer half empty interrupt - refill first half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream6, DMA_IT_HTIF6) != RESET) {\r
+        /* fill first half from fifo */\r
+\r
+        if (fifo_read(dac2_fifo, signed_buf, DAC_BUF_SZ/2) == -1) {\r
+            memset(signed_buf, 0, sizeof(short)*DAC_BUF_SZ/2);\r
+            dac_underflow++;\r
+        }\r
+\r
+        /* convert to unsigned */\r
+\r
+        for(i=0; i<DAC_BUF_SZ/2; i++) {\r
+            sam = (int)(M*(float)signed_buf[i] + C);\r
+            dac2_buf[i] = (unsigned short)sam;\r
+        }\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+        DMA_ClearITPendingBit(DMA1_Stream6, DMA_IT_HTIF6);  \r
+    }\r
+\r
+    /* Transfer complete interrupt - refill 2nd half */\r
+\r
+    if(DMA_GetITStatus(DMA1_Stream6, DMA_IT_TCIF6) != RESET) {\r
+        /* fill second half from fifo */\r
+\r
+        if (fifo_read(dac2_fifo, signed_buf, DAC_BUF_SZ/2) == -1) {\r
+            memset(signed_buf, 0, sizeof(short)*DAC_BUF_SZ/2);\r
+            dac_underflow++;\r
+        }\r
+\r
+        /* convert to unsigned  */\r
+\r
+        for(i=0, j=DAC_BUF_SZ/2; i<DAC_BUF_SZ/2; i++,j++) {\r
+            sam = (int)(M*(float)signed_buf[i] + C);\r
+            dac2_buf[j] = (unsigned short)sam;\r
+        }\r
+\r
+        /* Clear DMA Stream Transfer Complete interrupt pending bit */\r
+\r
+        DMA_ClearITPendingBit(DMA1_Stream6, DMA_IT_TCIF6);  \r
+    }\r
+\r
+    GPIOE->ODR &= ~(1 << 2);\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_machdep.c b/codec2/tags/0.4/stm32/src/stm32f4_machdep.c
new file mode 100644 (file)
index 0000000..5dd39c4
--- /dev/null
@@ -0,0 +1,86 @@
+
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_machdep.c
+  AUTHOR......: David Rowe
+  DATE CREATED: May 2 2013
+
+  STM32F4 implementation of the machine dependant timer functions,
+  e.g. profiling using a clock cycle counter..
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 <string.h>
+#include "machdep.h"
+#include "gdb_stdio.h"
+
+volatile unsigned int *DWT_CYCCNT   = (volatile unsigned int *)0xE0001004; 
+volatile unsigned int *DWT_CONTROL  = (volatile unsigned int *)0xE0001000;
+volatile unsigned int *SCB_DEMCR    = (volatile unsigned int *)0xE000EDFC;
+#define CORE_CLOCK 168E6
+#define BUF_SZ     4096
+
+static char buf[BUF_SZ];
+
+void machdep_profile_init(void)
+{
+    static int enabled = 0;
+    if (!enabled) {
+        *SCB_DEMCR = *SCB_DEMCR | 0x01000000;
+        *DWT_CYCCNT = 0; // reset the counter
+        *DWT_CONTROL = *DWT_CONTROL | 1 ; // enable the counter
+        enabled = 1;
+    }
+    *buf = 0;
+}
+
+void machdep_profile_reset(void)
+{
+    *DWT_CYCCNT = 0; // reset the counter
+}
+
+unsigned int machdep_profile_sample(void) {
+    return *DWT_CYCCNT;
+}
+
+/* log to a buffer, we only call printf after timing finished as it is slow */
+
+unsigned int machdep_profile_sample_and_log(unsigned int start, char s[])
+{
+    char  tmp[80];
+    float msec;
+
+    unsigned int dwt = *DWT_CYCCNT - start;
+    msec = 1000.0*(float)dwt/CORE_CLOCK;
+    sprintf(tmp, "%s %5.2f msecs\n",s,(double)msec);
+    if ((strlen(buf) + strlen(tmp)) < BUF_SZ)
+        strcat(buf, tmp);
+    return *DWT_CYCCNT;
+}
+
+void machdep_profile_print_logged_samples(void)
+{
+    gdb_stdio_printf("%s", buf);
+    *buf = 0;
+}
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_pwm.c b/codec2/tags/0.4/stm32/src/stm32f4_pwm.c
new file mode 100644 (file)
index 0000000..2d467e0
--- /dev/null
@@ -0,0 +1,239 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_pwm.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 26 June 2013
+
+  PWM  driver module for STM32F4.
+
+  TODO:
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2013 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 <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include "gdb_stdio.h"
+
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_rcc.h"
+#define TIM1_CCR3_ADDRESS    0x4001003C
+//#define TIM1_CCR3_ADDRESS    0x4001223C
+#define SINE_SAMPLES         32
+
+TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
+TIM_OCInitTypeDef  TIM_OCInitStructure;
+uint16_t uhTimerPeriod;
+uint16_t aSRC_Buffer[SINE_SAMPLES] = {0, 0, 0};
+
+/* 32 sample sine wave which at Fs=16kHz will be 500Hz.  Not sampels
+   are 16 bit 2's complement, the DAC driver convertsto 12 bit
+   unsigned. */
+
+short aSine[SINE_SAMPLES] = {
+    -16,    6384,   12528,  18192,   23200,   27232,   30256,   32128,   32752,   32128,
+    30256,   27232,   23152,   18192,   12528,    6384,     -16,   -6416,  -12560,  -18224,
+    -23184,  -27264,  -30288,  -32160,  -32768,  -32160,  -30288,  -27264,  -23184,  -18224,
+    -12560,   -6416
+};
+
+void Timer1Config();
+
+#define FS  16000
+
+int main(void){
+    Timer1Config();
+    while(1);
+}
+
+/* DR: TIM_Config configures a couple of I/O pins for PWM output from
+   Timer1 Channel 3.  Note I dont think any of this is needed, except
+   perhaps to check timer frequency.  Can be removed down the track. */
+
+/**
+  * @brief  Configure the TIM1 Pins.
+  * @param  None
+  * @retval None
+  */
+static void TIM_Config(void)
+{
+  GPIO_InitTypeDef GPIO_InitStructure;
+  DMA_InitTypeDef DMA_InitStructure;
+  
+  /* GPIOA and GPIOB clock enable */
+  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB, ENABLE);
+
+  /* GPIOA Configuration: Channel 3 as alternate function push-pull */
+
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 ;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
+  GPIO_Init(GPIOA, &GPIO_InitStructure); 
+  GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_TIM1);
+
+  /* GPIOB Configuration: Channel 3N as alternate function push-pull */
+
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
+  GPIO_Init(GPIOB, &GPIO_InitStructure);
+  GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_TIM1);
+
+#ifdef DR_OFF
+  /* DMA clock enable */
+  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2 , ENABLE);
+
+  DMA_DeInit(DMA2_Stream6);
+  DMA_InitStructure.DMA_Channel = DMA_Channel_6;  
+  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(TIM1_CCR3_ADDRESS) ;
+  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)aSRC_Buffer;
+  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
+  DMA_InitStructure.DMA_BufferSize = SINE_SAMPLES;
+  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
+  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
+  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
+  DMA_InitStructure.DMA_MemoryDataSize = DMA_PeripheralDataSize_HalfWord;
+  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
+  DMA_InitStructure.DMA_Priority = DMA_Priority_High;
+  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
+  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
+  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
+  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
+
+  DMA_Init(DMA2_Stream6, &DMA_InitStructure);
+#endif
+}
+
+void Timer1Config() {
+    int i;
+
+    /* TIM Configuration */
+
+    TIM_Config();
+
+    /* TIM1 example -------------------------------------------------
+  
+       TIM1 input clock (TIM1CLK) is set to 2 * APB2 clock (PCLK2), since APB2 
+       prescaler is different from 1.   
+       TIM1CLK = 2 * PCLK2  
+       PCLK2 = HCLK / 2 
+       => TIM1CLK = 2 * (HCLK / 2) = HCLK = SystemCoreClock
+  
+       TIM1CLK = SystemCoreClock, Prescaler = 0, TIM1 counter clock = SystemCoreClock
+       SystemCoreClock is set to 168 MHz for STM32F4xx devices.
+
+       The objective is to configure TIM1 channel 3 to generate complementary PWM
+       signal with a frequency equal to F KHz:
+       - TIM1_Period = (SystemCoreClock / F) - 1
+
+       The number of this repetitive requests is defined by the TIM1 Repetion counter,
+       each 3 Update Requests, the TIM1 Channel 3 Duty Cycle changes to the next new 
+       value defined by the aSRC_Buffer.
+  
+       Note: 
+       SystemCoreClock variable holds HCLK frequency and is defined in system_stm32f4xx.c file.
+       Each time the core clock (HCLK) changes, user had to call SystemCoreClockUpdate()
+       function to update SystemCoreClock variable value. Otherwise, any configuration
+       based on this variable will be incorrect.  
+       -----------------------------------------------------------------------------*/
+  
+    /* Compute the value to be set in ARR regiter to generate signal frequency at FS */
+
+#ifdef TMP
+    uhTimerPeriod = (SystemCoreClock / FS ) - 1;
+    //gdb_stdio_printf("uhTimerPeriod = %d\n", uhTimerPeriod);
+
+    /* Compute CCR1 values to generate a duty cycle at 50% */
+
+    for(i=0; i<SINE_SAMPLES; i++) {
+        aSRC_Buffer[i] = uhTimerPeriod *((int)aSine[i] + 32768)/(32768*2);
+    }
+#else
+    uhTimerPeriod = (SystemCoreClock / 28000000) - 1;
+    aSRC_Buffer[0] =   uhTimerPeriod/2 + 1;
+    
+#endif
+
+    /* TIM1 clock enable */
+
+    RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
+
+    /* Time Base configuration */
+
+    TIM_DeInit(TIM1);
+    TIM_TimeBaseStructure.TIM_Prescaler = 0;
+    TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
+    TIM_TimeBaseStructure.TIM_Period = uhTimerPeriod;
+    TIM_TimeBaseStructure.TIM_ClockDivision = 0;
+    TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
+
+    TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
+
+
+    #define TMP2
+#ifdef TMP2
+    /* Channel 3 Configuration in PWM mode */
+
+    TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;
+    TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
+    TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
+    TIM_OCInitStructure.TIM_Pulse = aSRC_Buffer[0];
+    TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
+    TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
+    TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
+    TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
+
+    TIM_OC3Init(TIM1, &TIM_OCInitStructure);
+
+    /* Enable preload feature */
+    TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);
+#else
+    /* Channel 3 Configuration in PWM mode */
+
+    TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;
+    TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
+    //TIM_OCInitStructure.TIM_Pulse = aSRC_Buffer[0];
+
+    //TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
+    //TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
+
+    //TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
+    //TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
+    //TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
+
+    TIM_OC3Init(TIM1, &TIM_OCInitStructure);
+
+    //TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);
+#endif
+    /* TIM1 counter enable */
+    TIM_Cmd(TIM1, ENABLE);
+  
+    /* DMA enable*/
+    //DMA_Cmd(DMA2_Stream6, ENABLE);
+  
+    /* TIM1 Update DMA Request enable */
+    //TIM_DMACmd(TIM1, TIM_DMA_CC3, ENABLE);
+
+    /* Main Output Enable */
+    TIM_CtrlPWMOutputs(TIM1, ENABLE);
+}
diff --git a/codec2/tags/0.4/stm32/src/stm32f4_usb_vcp.c b/codec2/tags/0.4/stm32/src/stm32f4_usb_vcp.c
new file mode 100644 (file)
index 0000000..f30ecfb
--- /dev/null
@@ -0,0 +1,90 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: stm32f4_usb_vcp.c
+  AUTHOR......: xenovacivus
+  DATE CREATED: 3 Sep 2014
+
+  USB Virtual COM Port (VCP) module adapted from code I found here:
+
+    https://github.com/xenovacivus/STM32DiscoveryVCP
+
+\*---------------------------------------------------------------------------*/
+
+#include "stm32f4xx_conf.h"
+#include "stm32f4xx.h"
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_rcc.h"
+#include "stm32f4xx_exti.h"
+#include "usbd_cdc_core.h"
+#include "usbd_usr.h"
+#include "usbd_desc.h"
+#include "usbd_cdc_vcp.h"
+#include "usb_dcd_int.h"
+#include "sm1000_leds_switches.h"
+#include "stm32f4_usb_vcp.h"
+
+/*
+ * The USB data must be 4 byte aligned if DMA is enabled. This macro handles
+ * the alignment, if necessary (it's actually magic, but don't tell anyone).
+ */
+__ALIGN_BEGIN USB_OTG_CORE_HANDLE  USB_OTG_dev __ALIGN_END;
+
+
+/*
+ * Define prototypes for interrupt handlers here. The conditional "extern"
+ * ensures the weak declarations from startup_stm32f4xx.c are overridden.
+ */
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+void NMI_Handler(void);
+void HardFault_Handler(void);
+void MemManage_Handler(void);
+void BusFault_Handler(void);
+void UsageFault_Handler(void);
+void SVC_Handler(void);
+void DebugMon_Handler(void);
+void PendSV_Handler(void);
+void OTG_FS_IRQHandler(void);
+void OTG_FS_WKUP_IRQHandler(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+void usb_vcp_init() {
+       /* Setup USB */
+       USBD_Init(&USB_OTG_dev,
+                   USB_OTG_FS_CORE_ID,
+                   &USR_desc,
+                   &USBD_CDC_cb,
+                   &USR_cb);
+}
+
+
+/*
+ * Interrupt Handlers
+ */
+
+void NMI_Handler(void)       {}
+void SVC_Handler(void)       {}
+void DebugMon_Handler(void)  {}
+void PendSV_Handler(void)    {}
+
+void OTG_FS_IRQHandler(void)
+{
+  USBD_OTG_ISR_Handler (&USB_OTG_dev);
+}
+
+void OTG_FS_WKUP_IRQHandler(void)
+{
+  if(USB_OTG_dev.cfg.low_power)
+  {
+    *(uint32_t *)(0xE000ED10) &= 0xFFFFFFF9 ;
+    SystemInit();
+    USB_OTG_UngateClock(&USB_OTG_dev);
+  }
+  EXTI_ClearITPendingBit(EXTI_Line18);
+}
diff --git a/codec2/tags/0.4/stm32/src/system_stm32f4xx.c b/codec2/tags/0.4/stm32/src/system_stm32f4xx.c
new file mode 100644 (file)
index 0000000..8695313
--- /dev/null
@@ -0,0 +1,584 @@
+/**\r
+ ******************************************************************************\r
+ * @file    system_stm32f4xx.c\r
+ * @author  MCD Application Team\r
+ * @version V1.0.1\r
+ * @date    10-July-2012\r
+ * @brief   CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.\r
+ *          This file contains the system clock configuration for STM32F4xx devices,\r
+ *          and is generated by the clock configuration tool\r
+ *          stm32f4xx_Clock_Configuration_V1.0.1.xls\r
+ *\r
+ * 1.  This file provides two functions and one global variable to be called from\r
+ *     user application:\r
+ *      - SystemInit(): Setups the system clock (System clock source, PLL Multiplier\r
+ *                      and Divider factors, AHB/APBx prescalers and Flash settings),\r
+ *                      depending on the configuration made in the clock xls tool.\r
+ *                      This function is called at startup just after reset and\r
+ *                      before branch to main program. This call is made inside\r
+ *                      the "startup_stm32f4xx.s" file.\r
+ *\r
+ *      - SystemCoreClock variable: Contains the core clock (HCLK), it can be used\r
+ *                                  by the user application to setup the SysTick\r
+ *                                  timer or configure other parameters.\r
+ *\r
+ *      - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must\r
+ *                                 be called whenever the core clock is changed\r
+ *                                 during program execution.\r
+ *\r
+ * 2. After each device reset the HSI (16 MHz) is used as system clock source.\r
+ *    Then SystemInit() function is called, in "startup_stm32f4xx.s" file, to\r
+ *    configure the system clock before to branch to main program.\r
+ *\r
+ * 3. If the system clock source selected by user fails to startup, the SystemInit()\r
+ *    function will do nothing and HSI still used as system clock source. User can\r
+ *    add some code to deal with this issue inside the SetSysClock() function.\r
+ *\r
+ * 4. The default value of HSE crystal is set to 25MHz, refer to "HSE_VALUE" define\r
+ *    in "stm32f4xx.h" file. When HSE is used as system clock source, directly or\r
+ *    through PLL, and you are using different crystal you have to adapt the HSE\r
+ *    value to your own configuration.\r
+ *\r
+ * 5. This file configures the system clock as follows:\r
+ *=============================================================================\r
+ *=============================================================================\r
+ *        Supported STM32F4xx device revision    | Rev A\r
+ *-----------------------------------------------------------------------------\r
+ *        System Clock source                    | PLL (HSE)\r
+ *-----------------------------------------------------------------------------\r
+ *        SYSCLK(Hz)                             | 168000000\r
+ *-----------------------------------------------------------------------------\r
+ *        HCLK(Hz)                               | 168000000\r
+ *-----------------------------------------------------------------------------\r
+ *        AHB Prescaler                          | 1\r
+ *-----------------------------------------------------------------------------\r
+ *        APB1 Prescaler                         | 4\r
+ *-----------------------------------------------------------------------------\r
+ *        APB2 Prescaler                         | 2\r
+ *-----------------------------------------------------------------------------\r
+ *        HSE Frequency(Hz)                      | 8000000\r
+ *-----------------------------------------------------------------------------\r
+ *        PLL_M                                  | 8\r
+ *-----------------------------------------------------------------------------\r
+ *        PLL_N                                  | 336\r
+ *-----------------------------------------------------------------------------\r
+ *        PLL_P                                  | 2\r
+ *-----------------------------------------------------------------------------\r
+ *        PLL_Q                                  | 7\r
+ *-----------------------------------------------------------------------------\r
+ *        PLLI2S_N                               | 352\r
+ *-----------------------------------------------------------------------------\r
+ *        PLLI2S_R                               | 2\r
+ *-----------------------------------------------------------------------------\r
+ *        I2S input clock(Hz)                    | 176000000\r
+ *                                               |\r
+ *        To achieve the following I2S config:   |\r
+ *         - Master clock output (MCKO): OFF     |\r
+ *         - Frame wide                : 16bit   |\r
+ *         - Error %                   : 0,0000  |\r
+ *         - Prescaler Odd factor (ODD): 1       |\r
+ *         - Linear prescaler (DIV)    : 14      |\r
+ *-----------------------------------------------------------------------------\r
+ *        VDD(V)                                 | 3,3\r
+ *-----------------------------------------------------------------------------\r
+ *        Main regulator output voltage          | Scale1 mode\r
+ *-----------------------------------------------------------------------------\r
+ *        Flash Latency(WS)                      | 5\r
+ *-----------------------------------------------------------------------------\r
+ *        Prefetch Buffer                        | OFF\r
+ *-----------------------------------------------------------------------------\r
+ *        Instruction cache                      | ON\r
+ *-----------------------------------------------------------------------------\r
+ *        Data cache                             | ON\r
+ *-----------------------------------------------------------------------------\r
+ *        Require 48MHz for USB OTG FS,          | Enabled\r
+ *        SDIO and RNG clock                     |\r
+ *-----------------------------------------------------------------------------\r
+ *=============================================================================\r
+ ******************************************************************************\r
+ * @attention\r
+ *\r
+ * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+ * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
+ * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
+ * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
+ * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
+ * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+ *\r
+ * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>\r
+ ******************************************************************************\r
+ */\r
+\r
+/** @addtogroup CMSIS\r
+ * @{\r
+ */\r
+\r
+/** @addtogroup stm32f4xx_system\r
+ * @{\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_Includes\r
+ * @{\r
+ */\r
+\r
+#include "stm32f4xx.h"\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_TypesDefinitions\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_Defines\r
+ * @{\r
+ */\r
+\r
+/************************* Miscellaneous Configuration ************************/\r
+/*!< Uncomment the following line if you need to use external SRAM mounted\r
+     on STM324xG_EVAL board as data memory  */\r
+/* #define DATA_IN_ExtSRAM */\r
+\r
+/*!< Uncomment the following line if you need to relocate your vector Table in\r
+     Internal SRAM. */\r
+/* #define VECT_TAB_SRAM */\r
+#define VECT_TAB_OFFSET  0x00 /*!< Vector Table base offset field. \r
+                                   This value must be a multiple of 0x200. */\r
+/******************************************************************************/\r
+\r
+/************************* PLL Parameters *************************************/\r
+/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */\r
+#define PLL_M      8\r
+#define PLL_N      336\r
+\r
+/* SYSCLK = PLL_VCO / PLL_P */\r
+#define PLL_P      2\r
+\r
+/* USB OTG FS, SDIO and RNG Clock =  PLL_VCO / PLLQ */\r
+#define PLL_Q      7\r
+\r
+/* PLLI2S_VCO = (HSE_VALUE Or HSI_VALUE / PLL_M) * PLLI2S_N\r
+   I2SCLK = PLLI2S_VCO / PLLI2S_R */\r
+#define START_I2SCLOCK         0\r
+#define PLLI2S_N               352\r
+#define PLLI2S_R               2\r
+\r
+/******************************************************************************/\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_Macros\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_Variables\r
+ * @{\r
+ */\r
+\r
+uint32_t SystemCoreClock = 168000000;\r
+\r
+__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes\r
+ * @{\r
+ */\r
+\r
+static void SetSysClock(void);\r
+#ifdef DATA_IN_ExtSRAM\r
+static void SystemInit_ExtMemCtl(void);\r
+#endif /* DATA_IN_ExtSRAM */\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/** @addtogroup STM32F4xx_System_Private_Functions\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @brief  Setup the microcontroller system\r
+ *         Initialize the Embedded Flash Interface, the PLL and update the\r
+ *         SystemFrequency variable.\r
+ * @param  None\r
+ * @retval None\r
+ */\r
+void SystemInit(void)\r
+{\r
+       /* FPU settings ------------------------------------------------------------*/\r
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)\r
+       SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */\r
+#endif\r
+       /* Reset the RCC clock configuration to the default reset state ------------*/\r
+       /* Set HSION bit */\r
+       RCC->CR |= (uint32_t)0x00000001;\r
+\r
+       /* Reset CFGR register */\r
+       RCC->CFGR = 0x00000000;\r
+\r
+       /* Reset HSEON, CSSON and PLLON bits */\r
+       RCC->CR &= (uint32_t)0xFEF6FFFF;\r
+\r
+       /* Reset PLLCFGR register */\r
+       RCC->PLLCFGR = 0x24003010;\r
+\r
+       /* Reset HSEBYP bit */\r
+       RCC->CR &= (uint32_t)0xFFFBFFFF;\r
+\r
+       /* Disable all interrupts */\r
+       RCC->CIR = 0x00000000;\r
+\r
+#ifdef DATA_IN_ExtSRAM\r
+       SystemInit_ExtMemCtl();\r
+#endif /* DATA_IN_ExtSRAM */\r
+\r
+       /* Configure the System clock source, PLL Multiplier and Divider factors,\r
+     AHB/APBx prescalers and Flash settings ----------------------------------*/\r
+       SetSysClock();\r
+\r
+       /* Configure the Vector Table location add offset address ------------------*/\r
+#ifdef VECT_TAB_SRAM\r
+       SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */\r
+#else\r
+       SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */\r
+#endif\r
+}\r
+\r
+/**\r
+ * @brief  Update SystemCoreClock variable according to Clock Register Values.\r
+ *         The SystemCoreClock variable contains the core clock (HCLK), it can\r
+ *         be used by the user application to setup the SysTick timer or configure\r
+ *         other parameters.\r
+ *\r
+ * @note   Each time the core clock (HCLK) changes, this function must be called\r
+ *         to update SystemCoreClock variable value. Otherwise, any configuration\r
+ *         based on this variable will be incorrect.\r
+ *\r
+ * @note   - The system frequency computed by this function is not the real\r
+ *           frequency in the chip. It is calculated based on the predefined\r
+ *           constant and the selected clock source:\r
+ *\r
+ *           - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)\r
+ *\r
+ *           - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)\r
+ *\r
+ *           - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)\r
+ *             or HSI_VALUE(*) multiplied/divided by the PLL factors.\r
+ *\r
+ *         (*) HSI_VALUE is a constant defined in stm32f4xx.h file (default value\r
+ *             16 MHz) but the real value may vary depending on the variations\r
+ *             in voltage and temperature.\r
+ *\r
+ *         (**) HSE_VALUE is a constant defined in stm32f4xx.h file (default value\r
+ *              25 MHz), user has to ensure that HSE_VALUE is same as the real\r
+ *              frequency of the crystal used. Otherwise, this function may\r
+ *              have wrong result.\r
+ *\r
+ *         - The result of this function could be not correct when using fractional\r
+ *           value for HSE crystal.\r
+ *\r
+ * @param  None\r
+ * @retval None\r
+ */\r
+void SystemCoreClockUpdate(void)\r
+{\r
+       uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;\r
+\r
+       /* Get SYSCLK source -------------------------------------------------------*/\r
+       tmp = RCC->CFGR & RCC_CFGR_SWS;\r
+\r
+       switch (tmp)\r
+       {\r
+       case 0x00:  /* HSI used as system clock source */\r
+               SystemCoreClock = HSI_VALUE;\r
+               break;\r
+       case 0x04:  /* HSE used as system clock source */\r
+               SystemCoreClock = HSE_VALUE;\r
+               break;\r
+       case 0x08:  /* PLL used as system clock source */\r
+\r
+               /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N\r
+         SYSCLK = PLL_VCO / PLL_P\r
+                */\r
+               pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;\r
+               pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;\r
+\r
+               if (pllsource != 0)\r
+               {\r
+                       /* HSE used as PLL clock source */\r
+                       pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);\r
+               }\r
+               else\r
+               {\r
+                       /* HSI used as PLL clock source */\r
+                       pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);\r
+               }\r
+\r
+               pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;\r
+               SystemCoreClock = pllvco/pllp;\r
+               break;\r
+       default:\r
+               SystemCoreClock = HSI_VALUE;\r
+               break;\r
+       }\r
+       /* Compute HCLK frequency --------------------------------------------------*/\r
+       /* Get HCLK prescaler */\r
+       tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];\r
+       /* HCLK frequency */\r
+       SystemCoreClock >>= tmp;\r
+}\r
+\r
+/**\r
+ * @brief  Configures the System clock source, PLL Multiplier and Divider factors,\r
+ *         AHB/APBx prescalers and Flash settings\r
+ * @Note   This function should be called only once the RCC clock configuration\r
+ *         is reset to the default reset state (done in SystemInit() function).\r
+ * @param  None\r
+ * @retval None\r
+ */\r
+static void SetSysClock(void)\r
+{\r
+       /******************************************************************************/\r
+       /*            PLL (clocked by HSE) used as System clock source                */\r
+       /******************************************************************************/\r
+       __IO uint32_t StartUpCounter = 0, HSEStatus = 0;\r
+\r
+       /* Enable HSE */\r
+       RCC->CR |= ((uint32_t)RCC_CR_HSEON);\r
+\r
+       /* Wait till HSE is ready and if Time out is reached exit */\r
+       do\r
+       {\r
+               HSEStatus = RCC->CR & RCC_CR_HSERDY;\r
+               StartUpCounter++;\r
+       } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));\r
+\r
+       if ((RCC->CR & RCC_CR_HSERDY) != RESET)\r
+       {\r
+               HSEStatus = (uint32_t)0x01;\r
+       }\r
+       else\r
+       {\r
+               HSEStatus = (uint32_t)0x00;\r
+       }\r
+\r
+       if (HSEStatus == (uint32_t)0x01)\r
+       {\r
+               /* Select regulator voltage output Scale 1 mode, System frequency up to 168 MHz */\r
+               RCC->APB1ENR |= RCC_APB1ENR_PWREN;\r
+               PWR->CR |= PWR_CR_VOS;\r
+\r
+               /* HCLK = SYSCLK / 1*/\r
+               RCC->CFGR |= RCC_CFGR_HPRE_DIV1;\r
+\r
+               /* PCLK2 = HCLK / 2*/\r
+               RCC->CFGR |= RCC_CFGR_PPRE2_DIV2;\r
+\r
+               /* PCLK1 = HCLK / 4*/\r
+               RCC->CFGR |= RCC_CFGR_PPRE1_DIV4;\r
+\r
+               /* Configure the main PLL */\r
+               RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) |\r
+                               (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24);\r
+\r
+               /* Enable the main PLL */\r
+               RCC->CR |= RCC_CR_PLLON;\r
+\r
+               /* Wait till the main PLL is ready */\r
+               while((RCC->CR & RCC_CR_PLLRDY) == 0)\r
+               {\r
+               }\r
+\r
+               /* Configure Flash prefetch, Instruction cache, Data cache and wait state */\r
+               FLASH->ACR = FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS;\r
+\r
+               /* Select the main PLL as system clock source */\r
+               RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));\r
+               RCC->CFGR |= RCC_CFGR_SW_PLL;\r
+\r
+               /* Wait till the main PLL is used as system clock source */\r
+               while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);\r
+               {\r
+               }\r
+       }\r
+       else\r
+       { /* If HSE fails to start-up, the application will have wrong clock\r
+         configuration. User can add here some code to deal with this error */\r
+       }\r
+\r
+\r
+       /******************************************************************************/\r
+       /*                          I2S clock configuration                           */\r
+       /******************************************************************************/\r
+\r
+#if START_I2SCLOCK\r
+       /* PLLI2S clock used as I2S clock source */\r
+       RCC->CFGR &= ~RCC_CFGR_I2SSRC;\r
+\r
+       /* Configure PLLI2S */\r
+       RCC->PLLI2SCFGR = (PLLI2S_N << 6) | (PLLI2S_R << 28);\r
+\r
+       /* Enable PLLI2S */\r
+       RCC->CR |= ((uint32_t)RCC_CR_PLLI2SON);\r
+\r
+       /* Wait till PLLI2S is ready */\r
+       while((RCC->CR & RCC_CR_PLLI2SRDY) == 0)\r
+       {\r
+       }\r
+#endif\r
+}\r
+\r
+/**\r
+ * @brief  Setup the external memory controller. Called in startup_stm32f4xx.s\r
+ *          before jump to __main\r
+ * @param  None\r
+ * @retval None\r
+ */\r
+#ifdef DATA_IN_ExtSRAM\r
+/**\r
+ * @brief  Setup the external memory controller.\r
+ *         Called in startup_stm32f4xx.s before jump to main.\r
+ *         This function configures the external SRAM mounted on STM324xG_EVAL board\r
+ *         This SRAM will be used as program data memory (including heap and stack).\r
+ * @param  None\r
+ * @retval None\r
+ */\r
+void SystemInit_ExtMemCtl(void)\r
+{\r
+       /*-- GPIOs Configuration -----------------------------------------------------*/\r
+       /*\r
+ +-------------------+--------------------+------------------+------------------+\r
+ +                       SRAM pins assignment                                   +\r
+ +-------------------+--------------------+------------------+------------------+\r
+ | PD0  <-> FSMC_D2  | PE0  <-> FSMC_NBL0 | PF0  <-> FSMC_A0 | PG0 <-> FSMC_A10 | \r
+ | PD1  <-> FSMC_D3  | PE1  <-> FSMC_NBL1 | PF1  <-> FSMC_A1 | PG1 <-> FSMC_A11 | \r
+ | PD4  <-> FSMC_NOE | PE3  <-> FSMC_A19  | PF2  <-> FSMC_A2 | PG2 <-> FSMC_A12 | \r
+ | PD5  <-> FSMC_NWE | PE4  <-> FSMC_A20  | PF3  <-> FSMC_A3 | PG3 <-> FSMC_A13 | \r
+ | PD8  <-> FSMC_D13 | PE7  <-> FSMC_D4   | PF4  <-> FSMC_A4 | PG4 <-> FSMC_A14 | \r
+ | PD9  <-> FSMC_D14 | PE8  <-> FSMC_D5   | PF5  <-> FSMC_A5 | PG5 <-> FSMC_A15 | \r
+ | PD10 <-> FSMC_D15 | PE9  <-> FSMC_D6   | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | \r
+ | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7   | PF13 <-> FSMC_A7 |------------------+\r
+ | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8   | PF14 <-> FSMC_A8 | \r
+ | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9   | PF15 <-> FSMC_A9 | \r
+ | PD14 <-> FSMC_D0  | PE13 <-> FSMC_D10  |------------------+\r
+ | PD15 <-> FSMC_D1  | PE14 <-> FSMC_D11  |\r
+ |                   | PE15 <-> FSMC_D12  |\r
+ +-------------------+--------------------+\r
+        */\r
+       /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */\r
+       RCC->AHB1ENR   = 0x00000078;\r
+\r
+       /* Connect PDx pins to FSMC Alternate function */\r
+       GPIOD->AFR[0]  = 0x00cc00cc;\r
+       GPIOD->AFR[1]  = 0xcc0ccccc;\r
+       /* Configure PDx pins in Alternate function mode */\r
+       GPIOD->MODER   = 0xaaaa0a0a;\r
+       /* Configure PDx pins speed to 100 MHz */\r
+       GPIOD->OSPEEDR = 0xffff0f0f;\r
+       /* Configure PDx pins Output type to push-pull */\r
+       GPIOD->OTYPER  = 0x00000000;\r
+       /* No pull-up, pull-down for PDx pins */\r
+       GPIOD->PUPDR   = 0x00000000;\r
+\r
+       /* Connect PEx pins to FSMC Alternate function */\r
+       GPIOE->AFR[0]  = 0xc00cc0cc;\r
+       GPIOE->AFR[1]  = 0xcccccccc;\r
+       /* Configure PEx pins in Alternate function mode */\r
+       GPIOE->MODER   = 0xaaaa828a;\r
+       /* Configure PEx pins speed to 100 MHz */\r
+       GPIOE->OSPEEDR = 0xffffc3cf;\r
+       /* Configure PEx pins Output type to push-pull */\r
+       GPIOE->OTYPER  = 0x00000000;\r
+       /* No pull-up, pull-down for PEx pins */\r
+       GPIOE->PUPDR   = 0x00000000;\r
+\r
+       /* Connect PFx pins to FSMC Alternate function */\r
+       GPIOF->AFR[0]  = 0x00cccccc;\r
+       GPIOF->AFR[1]  = 0xcccc0000;\r
+       /* Configure PFx pins in Alternate function mode */\r
+       GPIOF->MODER   = 0xaa000aaa;\r
+       /* Configure PFx pins speed to 100 MHz */\r
+       GPIOF->OSPEEDR = 0xff000fff;\r
+       /* Configure PFx pins Output type to push-pull */\r
+       GPIOF->OTYPER  = 0x00000000;\r
+       /* No pull-up, pull-down for PFx pins */\r
+       GPIOF->PUPDR   = 0x00000000;\r
+\r
+       /* Connect PGx pins to FSMC Alternate function */\r
+       GPIOG->AFR[0]  = 0x00cccccc;\r
+       GPIOG->AFR[1]  = 0x000000c0;\r
+       /* Configure PGx pins in Alternate function mode */\r
+       GPIOG->MODER   = 0x00080aaa;\r
+       /* Configure PGx pins speed to 100 MHz */\r
+       GPIOG->OSPEEDR = 0x000c0fff;\r
+       /* Configure PGx pins Output type to push-pull */\r
+       GPIOG->OTYPER  = 0x00000000;\r
+       /* No pull-up, pull-down for PGx pins */\r
+       GPIOG->PUPDR   = 0x00000000;\r
+\r
+       /*-- FSMC Configuration ------------------------------------------------------*/\r
+       /* Enable the FSMC interface clock */\r
+       RCC->AHB3ENR         = 0x00000001;\r
+\r
+       /* Configure and enable Bank1_SRAM2 */\r
+       FSMC_Bank1->BTCR[2]  = 0x00001015;\r
+       FSMC_Bank1->BTCR[3]  = 0x00010603;\r
+       FSMC_Bank1E->BWTR[2] = 0x0fffffff;\r
+       /*\r
+  Bank1_SRAM2 is configured as follow:\r
+\r
+  p.FSMC_AddressSetupTime = 3;\r
+  p.FSMC_AddressHoldTime = 0;\r
+  p.FSMC_DataSetupTime = 6;\r
+  p.FSMC_BusTurnAroundDuration = 1;\r
+  p.FSMC_CLKDivision = 0;\r
+  p.FSMC_DataLatency = 0;\r
+  p.FSMC_AccessMode = FSMC_AccessMode_A;\r
+\r
+  FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;\r
+  FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;\r
+  FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM;\r
+  FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;\r
+  FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;\r
+  FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;  \r
+  FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;\r
+  FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;\r
+  FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;\r
+  FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;\r
+  FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;\r
+  FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;\r
+  FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;\r
+  FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;\r
+  FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;\r
+        */\r
+}\r
+#endif /* DATA_IN_ExtSRAM */\r
+\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/**\r
+ * @}\r
+ */\r
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r
diff --git a/codec2/tags/0.4/stm32/src/timer_ut.c b/codec2/tags/0.4/stm32/src/timer_ut.c
new file mode 100644 (file)
index 0000000..967c87d
--- /dev/null
@@ -0,0 +1,179 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: timer_ut.c
+  AUTHOR......: David Rowe
+  DATE CREATED: 3 Jan 2014
+
+  Unit test STM32F4 timer hardware.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 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 <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_rcc.h"
+#include "gdb_stdio.h"
+
+#define TIM1_CCR3_ADDRESS    0x4001223C
+
+TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
+TIM_OCInitTypeDef  TIM_OCInitStructure;
+TIM_BDTRInitTypeDef TIM_BDTRInitStructure;
+uint16_t uhTimerPeriod;
+uint16_t aSRC_Buffer[3] = {0, 0, 0};
+
+void Timer1Config();
+#define FS  3500000
+
+int main(void){
+    Timer1Config();
+ }
+
+/* DR: TIM_Config configures a couple of I/O pins for PWM output from
+   Timer1 Channel 3.  Note I dont think any of this is needed, except
+   perhaps to check timer frequency.  Can be removed down the track. */
+
+/**
+  * @brief  Configure the TIM1 Pins.
+  * @param  None
+  * @retval None
+  */
+static void TIM_Config(void)
+{
+  GPIO_InitTypeDef GPIO_InitStructure;
+  
+  /* GPIOA and GPIOB clock enable */
+  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB, ENABLE);
+
+  /* GPIOA Configuration: Channel 3 as alternate function push-pull */
+  /* Discovery board pin PA10 */
+
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 ;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
+  GPIO_Init(GPIOA, &GPIO_InitStructure); 
+  GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_TIM1);
+
+  /* GPIOB Configuration: Channel 3N as alternate function push-pull */
+  /* Discovery board pin PB15 */
+
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
+  GPIO_Init(GPIOB, &GPIO_InitStructure);
+  GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_TIM1);
+}
+
+void Timer1Config() {
+
+    /* TIM Configuration */
+
+    TIM_Config();
+
+    /* TIM1 example -------------------------------------------------
+  
+       TIM1 input clock (TIM1CLK) is set to 2 * APB2 clock (PCLK2), since APB2 
+       prescaler is different from 1.   
+       TIM1CLK = 2 * PCLK2  
+       PCLK2 = HCLK / 2 
+       => TIM1CLK = 2 * (HCLK / 2) = HCLK = SystemCoreClock
+  
+       TIM1CLK = SystemCoreClock, Prescaler = 0, TIM1 counter clock = SystemCoreClock
+       SystemCoreClock is set to 168 MHz for STM32F4xx devices.
+
+       The objective is to configure TIM1 channel 3 to generate complementary PWM
+       signal with a frequency equal to F KHz:
+       - TIM1_Period = (SystemCoreClock / F) - 1
+
+       The number of this repetitive requests is defined by the TIM1 Repetion counter,
+       each 3 Update Requests, the TIM1 Channel 3 Duty Cycle changes to the next new 
+       value defined by the aSRC_Buffer.
+  
+       Note: 
+       SystemCoreClock variable holds HCLK frequency and is defined in system_stm32f4xx.c file.
+       Each time the core clock (HCLK) changes, user had to call SystemCoreClockUpdate()
+       function to update SystemCoreClock variable value. Otherwise, any configuration
+       based on this variable will be incorrect.  
+       -----------------------------------------------------------------------------*/
+  
+    /* Compute the value to be set in ARR regiter to generate signal frequency at FS Hz */
+    uhTimerPeriod = (SystemCoreClock / FS ) - 1;
+    /* Compute CCR1 value to generate a duty cycle at 50% */
+    aSRC_Buffer[0] = (uint16_t) (((uint32_t) 5 * (uhTimerPeriod - 1)) / 10);
+    /* Compute CCR1 value to generate a duty cycle at 37.5% */
+    aSRC_Buffer[1] = (uint16_t) (((uint32_t) 375 * (uhTimerPeriod - 1)) / 1000);
+    /* Compute CCR1 value to generate a duty cycle at 25% */
+    aSRC_Buffer[2] = (uint16_t) (((uint32_t) 25 * (uhTimerPeriod - 1)) / 100);
+
+    /* TIM1 Peripheral Configuration -------------------------------------------*/
+    /* TIM1 clock enable */
+    RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
+
+    /* Time Base configuration */
+
+    TIM_DeInit(TIM1);
+    TIM_TimeBaseStructure.TIM_Prescaler = 0;
+    TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
+    TIM_TimeBaseStructure.TIM_Period = uhTimerPeriod;
+    TIM_TimeBaseStructure.TIM_ClockDivision = 0;
+    TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
+
+    TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
+
+    /* Channel 3 Configuration in PWM mode */
+
+    /* I think we just ned to enable channel 3 somehow, but without
+       (or optionally with) actual ouput to a GPIO pin.  */
+
+    TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;
+    TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
+    TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
+    TIM_OCInitStructure.TIM_Pulse = aSRC_Buffer[0];
+    TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
+    TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
+    TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
+    TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
+
+    TIM_OC3Init(TIM1, &TIM_OCInitStructure);
+
+    /* Enable preload feature */
+    TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);
+  
+    /* Automatic Output enable, Break, dead time and lock configuration*/
+    TIM_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable;
+    TIM_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable;
+    //TIM_BDTRInitStructure.TIM_LOCKLevel = TIM_LOCKLevel_1;
+    TIM_BDTRInitStructure.TIM_DeadTime = 11;
+    //TIM_BDTRInitStructure.TIM_Break = TIM_Break_Enable;
+    //TIM_BDTRInitStructure.TIM_BreakPolarity = TIM_BreakPolarity_High;
+    TIM_BDTRInitStructure.TIM_AutomaticOutput = TIM_AutomaticOutput_Enable;
+
+    TIM_BDTRConfig(TIM1, &TIM_BDTRInitStructure);
+
+    /* TIM1 counter enable */
+    TIM_Cmd(TIM1, ENABLE);
+  
+    /* Main Output Enable */
+    TIM_CtrlPWMOutputs(TIM1, ENABLE);
+}
+
diff --git a/codec2/tags/0.4/stm32/src/tuner_ut.c b/codec2/tags/0.4/stm32/src/tuner_ut.c
new file mode 100644 (file)
index 0000000..ac52200
--- /dev/null
@@ -0,0 +1,122 @@
+/*---------------------------------------------------------------------------*\\r
+\r
+  FILE........: tuner_ut.c\r
+  AUTHOR......: David Rowe\r
+  DATE CREATED: 20 Feb 2015\r
+\r
+  Unit test for high speed ADC radio tuner, samples signal centred at\r
+  500kHz using Fs=2 MHz and uploads to host at Fs=10 kHz.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+  Copyright (C) 2015 David Rowe\r
+\r
+  All rights reserved.\r
+\r
+  This program is free software; you can redistribute it and/or modify\r
+  it under the terms of the GNU Lesser General Public License version 2.1, as\r
+  published by the Free Software Foundation.  This program is\r
+  distributed in the hope that it will be useful, but WITHOUT ANY\r
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\r
+  License for more details.\r
+\r
+  You should have received a copy of the GNU Lesser General Public License\r
+  along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include "gdb_stdio.h"\r
+#include "stm32f4_dac.h"\r
+#include "stm32f4_adc_tuner.h"\r
+#include "iir_tuner.h"\r
+#include "sm1000_leds_switches.h"\r
+#include "../src/codec2_fm.h"\r
+#include "stm32f4xx.h"\r
+\r
+#define REC_TIME_SECS 10\r
+#define FS            50000\r
+#define N             5000\r
+\r
+extern int adc_overflow1;\r
+\r
+int main(void) {\r
+    float  tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM+N/2];\r
+    float  fm_out[N/2];\r
+    //float  dec_10[(N/2)/5];\r
+    short  dec_10_short[(N/2)];\r
+    int    bufs, i, j, k, fifo_sz, bn;\r
+    FILE  *ftuner;\r
+    struct FM *fm;\r
+\r
+    ftuner = fopen("tuner.raw", "wb");\r
+    if (ftuner == NULL) {\r
+        printf("Error opening input file: tuner.raw\n\nTerminating....\n");\r
+        exit(1);\r
+    }\r
+    bufs = FS*REC_TIME_SECS/N;\r
+    fifo_sz = ((4*N/ADC_TUNER_N)+1)*ADC_TUNER_N;\r
+    printf("Starting! bufs: %d %d\n", bufs, fifo_sz);\r
\r
+    //dac_open(DAC_BUF_SZ);\r
+    adc_open(fifo_sz);\r
+    sm1000_leds_switches_init();\r
+\r
+    fm         = fm_create(N/2);\r
+    fm->Fs     = 44400.0;\r
+    fm->fm_max = 3000.0;\r
+    fm->fd     = 5000.0;\r
+    fm->fc     = fm->Fs/4;\r
+\r
+    i = 0; bn = 0;\r
+    while(1) {\r
+        /* wait for buffer of Fs=50kHz tuner output samples */\r
+\r
+        while(adc1_read((short *)&tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM], N) == -1);\r
+\r
+        /* The semi-hosting system can only handle Fs=16kHz and below so resample down\r
+           to Fs=10 kHz and convert to shorts */\r
+\r
+        #ifdef SSB\r
+        iir_tuner_dec_50_to_10(dec_10, &tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM], N/2);\r
+        for(j=0; j<IIR_TUNER_DEC_50_10_FILT_MEM; j++)\r
+            tuner_out[j] = tuner_out[j+N/2];\r
+        for(j=0; j<(N/2)/5; j++)\r
+            dec_10_short[j] = dec_10[j]/ADC_TUNER_M;\r
+        #else\r
+        GPIOE->ODR |= (1 << 3);\r
+        /*\r
+        for(j=0; j<N/2; j++)\r
+            tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM+j] = 0;\r
+        for(j=1; j<N/2; j+=4)\r
+            tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM+j] = 100;\r
+        for(j=3; j<N/2; j+=4)\r
+            tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM+j] = -100;\r
+        */\r
+        fm_demod(fm, fm_out, &tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM]);\r
+        GPIOE->ODR &= ~(1 << 3);\r
+\r
+        for(j=0,k=0; j<N/2; j+=5,k++)\r
+            dec_10_short[k+bn] = 16384*fm_out[j];\r
+        bn += (N/2)/5;\r
+        #endif\r
+\r
+        if ((bn == N/2) && (i < bufs)) {\r
+            //for(j=0; j<N/2; j++)\r
+            //    dec_10_short[j] = tuner_out[IIR_TUNER_DEC_50_10_FILT_MEM+j];\r
+            fwrite(dec_10_short, sizeof(short), (N/2), ftuner);\r
+            bn = 0;\r
+            i += 5;\r
+            //fwrite(dec_10_short, sizeof(short), (N/2)/5, ftuner);\r
+            //printf("%d %d\n", i, adc_overflow1);\r
+        }\r
+        if (i == bufs) {\r
+            printf("finished! %d\n", adc_overflow1);\r
+            fclose(ftuner);\r
+            i++;\r
+        }\r
+    }\r
+}\r
+\r
diff --git a/codec2/tags/0.4/stm32/src/usb_vcp_ut.c b/codec2/tags/0.4/stm32/src/usb_vcp_ut.c
new file mode 100644 (file)
index 0000000..74aa59e
--- /dev/null
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: usb_vcp_ut.c
+  AUTHOR......: xenovacivus
+  DATE CREATED: 31 August 2014
+
+  USB Virtual COM Port (VCP) unit test that I found here:
+
+    https://github.com/xenovacivus/STM32DiscoveryVCP
+
+  Remarkably, it compiled and ran first time, and even the LEDs blink
+  as advertised, they just happen to match the LEDs on the SM1000!
+
+  When I fired up Minicom, it echoed characters:
+
+    $ sudo minicom -D /dev/ttyACM0
+\*---------------------------------------------------------------------------*/
+
+#include <stm32f4xx.h>
+#include <stm32f4xx_gpio.h>
+#include "stm32f4_usb_vcp.h"
+#include "sm1000_leds_switches.h"
+
+volatile uint32_t ticker, downTicker;
+
+int main(void) {
+
+    sm1000_leds_switches_init();
+    usb_vcp_init();
+    SysTick_Config(SystemCoreClock/1000);
+
+    while (1) {
+
+        /* Blink the orange LED at 1Hz */
+
+        if (500 == ticker) {
+            GPIOD->BSRRH = GPIO_Pin_13;
+        }
+        else if (1000 == ticker) {
+            ticker = 0;
+            GPIOD->BSRRL = GPIO_Pin_13;
+        }
+
+
+        /* If there's data on the virtual serial port:
+         *  - Echo it back
+         *  - Turn the green LED on for 10ms
+         */
+        uint8_t theByte;
+        if (VCP_get_char(&theByte)) {
+            VCP_put_char(theByte);
+
+
+            GPIOD->BSRRL = GPIO_Pin_12;
+            downTicker = 10;
+        }
+        if (0 == downTicker) {
+            GPIOD->BSRRH = GPIO_Pin_12;
+        }
+    }
+
+    return 0;
+}
+
+/*
+ * Interrupt Handler
+ */
+
+void SysTick_Handler(void)
+{
+       ticker++;
+       if (downTicker > 0)
+       {
+               downTicker--;
+       }
+}
+
diff --git a/codec2/tags/0.4/stm32/src/usb_vsp_ut.c b/codec2/tags/0.4/stm32/src/usb_vsp_ut.c
new file mode 100644 (file)
index 0000000..8f0c9f4
--- /dev/null
@@ -0,0 +1,192 @@
+
+#define HSE_VALUE ((uint32_t)8000000) /* STM32 discovery uses a 8Mhz external crystal */
+
+#include "stm32f4xx_conf.h"
+#include "stm32f4xx.h"
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_rcc.h"
+#include "stm32f4xx_exti.h"
+#include "usbd_cdc_core.h"
+#include "usbd_usr.h"
+#include "usbd_desc.h"
+#include "usbd_cdc_vcp.h"
+#include "usb_dcd_int.h"
+
+volatile uint32_t ticker, downTicker;
+
+/*
+ * The USB data must be 4 byte aligned if DMA is enabled. This macro handles
+ * the alignment, if necessary (it's actually magic, but don't tell anyone).
+ */
+__ALIGN_BEGIN USB_OTG_CORE_HANDLE  USB_OTG_dev __ALIGN_END;
+
+
+void init();
+void ColorfulRingOfDeath(void);
+
+/*
+ * Define prototypes for interrupt handlers here. The conditional "extern"
+ * ensures the weak declarations from startup_stm32f4xx.c are overridden.
+ */
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+void SysTick_Handler(void);
+void NMI_Handler(void);
+void HardFault_Handler(void);
+void MemManage_Handler(void);
+void BusFault_Handler(void);
+void UsageFault_Handler(void);
+void SVC_Handler(void);
+void DebugMon_Handler(void);
+void PendSV_Handler(void);
+void OTG_FS_IRQHandler(void);
+void OTG_FS_WKUP_IRQHandler(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+int main(void)
+{
+       /* Set up the system clocks */
+       SystemInit();
+
+       /* Initialize USB, IO, SysTick, and all those other things you do in the morning */
+       init();
+
+
+       while (1)
+       {
+               /* Blink the orange LED at 1Hz */
+               if (500 == ticker)
+               {
+                       GPIOD->BSRRH = GPIO_Pin_13;
+               }
+               else if (1000 == ticker)
+               {
+                       ticker = 0;
+                       GPIOD->BSRRL = GPIO_Pin_13;
+               }
+
+
+               /* If there's data on the virtual serial port:
+                *  - Echo it back
+                *  - Turn the green LED on for 10ms
+                */
+               uint8_t theByte;
+               if (VCP_get_char(&theByte))
+               {
+                       VCP_put_char(theByte);
+
+
+                       GPIOD->BSRRL = GPIO_Pin_12;
+                       downTicker = 10;
+               }
+               if (0 == downTicker)
+               {
+                       GPIOD->BSRRH = GPIO_Pin_12;
+               }
+       }
+
+       return 0;
+}
+
+
+void init()
+{
+       /* STM32F4 discovery LEDs */
+       GPIO_InitTypeDef LED_Config;
+
+       /* Always remember to turn on the peripheral clock...  If not, you may be up till 3am debugging... */
+       RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
+       LED_Config.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
+       LED_Config.GPIO_Mode = GPIO_Mode_OUT;
+       LED_Config.GPIO_OType = GPIO_OType_PP;
+       LED_Config.GPIO_Speed = GPIO_Speed_25MHz;
+       LED_Config.GPIO_PuPd = GPIO_PuPd_NOPULL;
+       GPIO_Init(GPIOD, &LED_Config);
+
+
+
+       /* Setup SysTick or CROD! */
+       if (SysTick_Config(SystemCoreClock / 1000))
+       {
+               ColorfulRingOfDeath();
+       }
+
+
+       /* Setup USB */
+       USBD_Init(&USB_OTG_dev,
+                   USB_OTG_FS_CORE_ID,
+                   &USR_desc,
+                   &USBD_CDC_cb,
+                   &USR_cb);
+
+       return;
+}
+
+/*
+ * Call this to indicate a failure.  Blinks the STM32F4 discovery LEDs
+ * in sequence.  At 168Mhz, the blinking will be very fast - about 5 Hz.
+ * Keep that in mind when debugging, knowing the clock speed might help
+ * with debugging.
+ */
+void ColorfulRingOfDeath(void)
+{
+       uint16_t ring = 1;
+       while (1)
+       {
+               uint32_t count = 0;
+               while (count++ < 500000);
+
+               GPIOD->BSRRH = (ring << 12);
+               ring = ring << 1;
+               if (ring >= 1<<4)
+               {
+                       ring = 1;
+               }
+               GPIOD->BSRRL = (ring << 12);
+       }
+}
+
+/*
+ * Interrupt Handlers
+ */
+
+void SysTick_Handler(void)
+{
+       ticker++;
+       if (downTicker > 0)
+       {
+               downTicker--;
+       }
+}
+
+void NMI_Handler(void)       {}
+void HardFault_Handler(void) { ColorfulRingOfDeath(); }
+void MemManage_Handler(void) { ColorfulRingOfDeath(); }
+void BusFault_Handler(void)  { ColorfulRingOfDeath(); }
+void UsageFault_Handler(void){ ColorfulRingOfDeath(); }
+void SVC_Handler(void)       {}
+void DebugMon_Handler(void)  {}
+void PendSV_Handler(void)    {}
+
+void OTG_FS_IRQHandler(void)
+{
+  USBD_OTG_ISR_Handler (&USB_OTG_dev);
+}
+
+void OTG_FS_WKUP_IRQHandler(void)
+{
+  if(USB_OTG_dev.cfg.low_power)
+  {
+    *(uint32_t *)(0xE000ED10) &= 0xFFFFFFF9 ;
+    SystemInit();
+    USB_OTG_UngateClock(&USB_OTG_dev);
+  }
+  EXTI_ClearITPendingBit(EXTI_Line18);
+}
diff --git a/codec2/tags/0.4/stm32/stlink/elfsym.c b/codec2/tags/0.4/stm32/stlink/elfsym.c
new file mode 100644 (file)
index 0000000..1a62981
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+  elfsym.c
+
+  Read symbol adresses from a .elf file.
+
+  Based on libelf-howto.c from: http://em386.blogspot.com
+
+  Unit test with:
+
+  gcc elfsym.c -o elfsym -D__UNITTEST__ -Wall -lelf
+  ./elfsym elf_file.elf
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <libelf.h>
+#include <gelf.h>
+#include "elfsym.h"
+
+#define ERR -1
+
+int elfsym_open(char file[]) {
+    int fd;                    /* File Descriptor             */
+    char *base_ptr;            /* ptr to our object in memory */
+    struct stat elf_stats;     /* fstat struct                */
+    
+    if((fd = open(file, O_RDWR)) == ERR) {
+        printf("couldnt open %s\n", file);
+        return ERR;
+    }
+
+    if((fstat(fd, &elf_stats))) {
+        printf("could not fstat %s\n", file);
+        close(fd);
+        return ERR;
+    }
+
+    if((base_ptr = (char *) malloc(elf_stats.st_size)) == NULL) {
+        fprintf(stderr, "could not malloc\n");
+        close(fd);
+        return ERR;
+    }
+
+    if((read(fd, base_ptr, elf_stats.st_size)) < elf_stats.st_size) {
+        fprintf(stderr, "could not read %s\n", file);
+        free(base_ptr);
+        close(fd);
+        return ERR;
+    }
+
+    /* Check libelf version first */
+
+    if(elf_version(EV_CURRENT) == EV_NONE) {
+        fprintf(stderr, "WARNING Elf Library is out of date!\n");
+    }
+
+    free(base_ptr);
+
+    return fd;
+}
+
+
+void elfsym_close(int fd) {
+    close(fd);
+}
+
+unsigned int elfsym_get_symbol_address(int fd, char symbol_name[])
+{
+    Elf_Scn     *scn;              /* Section Descriptor          */
+    Elf_Data    *edata;            /* Data Descriptor             */
+    GElf_Sym     sym;             /* Symbol                      */
+    GElf_Shdr    shdr;             /* Section Header              */
+    Elf         *elf;              /* Our Elf pointer for libelf  */
+    unsigned int symbol_address;
+    int          symbol_count;
+    int          i;
+
+    /* Iterate through section headers, stop when we find symbols,
+       and check for match */
+
+    elf = elf_begin(fd, ELF_C_READ, NULL);
+    if (elf == 0) {
+        fprintf(stderr, "could not elf_begin\n");
+    }
+    symbol_address = 0;
+    scn = NULL;
+
+    while((scn = elf_nextscn(elf, scn)) != 0) {
+        gelf_getshdr(scn, &shdr);
+        
+        // When we find a section header marked SHT_SYMTAB stop and get symbols
+        edata = NULL;
+        if(shdr.sh_type == SHT_SYMTAB) {
+            // edata points to our symbol table
+            edata = elf_getdata(scn, edata);
+
+            // how many symbols are there? this number comes from the size of
+            // the section divided by the entry size
+            symbol_count = shdr.sh_size / shdr.sh_entsize;
+
+            // loop through to grab all symbols
+            for(i = 0; i < symbol_count; i++) {                        
+                // libelf grabs the symbol data using gelf_getsym()
+                gelf_getsym(edata, i, &sym);
+                
+                if (strcmp(symbol_name,
+                           elf_strptr(elf, shdr.sh_link, sym.st_name)) == 0) {
+                    symbol_address = sym.st_value;
+                }
+            }
+
+        }
+    }
+
+    return symbol_address;
+}
+
+#ifdef __UNITTEST__
+
+int main(int argc, char *argv[])
+{
+    int           fd;
+    unsigned int  flag_addr, ptr_addr, file_addr, len_addr;
+
+    fd = elfsym_open(argv[1]);
+    flag_addr = elfsym_get_symbol_address(fd, "syscalls_gdb_flag");
+    ptr_addr = elfsym_get_symbol_address(fd, "syscalls_gdb_ptr");
+    file_addr = elfsym_get_symbol_address(fd, "syscalls_gdb_file");
+    len_addr = elfsym_get_symbol_address(fd, "syscalls_gdb_len");
+    elfsym_close(fd);
+
+    printf("flag_addr: 0x%x\n", flag_addr);
+    printf("ptr_addr: 0x%x\n", ptr_addr);
+    printf("file_addr: 0x%x\n", file_addr);
+    printf("len_addr: 0x%x\n", len_addr);
+
+    return 0;
+}
+
+#endif
diff --git a/codec2/tags/0.4/stm32/stlink/elfsym.h b/codec2/tags/0.4/stm32/stlink/elfsym.h
new file mode 100644 (file)
index 0000000..fcd287a
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+  elfsym.h
+
+  Read symbol adresses from a .elf file.
+*/
+
+#ifndef __ELFSYM__
+#define __ELFSYM__
+
+int elfsym_open(char file[]);
+void elfsym_close(int fd);
+unsigned int elfsym_get_symbol_address(int fd, char symbol_name[]);
+
+#endif
diff --git a/codec2/tags/0.4/stm32/stlink/stlink.patch b/codec2/tags/0.4/stm32/stlink/stlink.patch
new file mode 100644 (file)
index 0000000..74cf240
--- /dev/null
@@ -0,0 +1,428 @@
+diff --git Makefile.am Makefile.am
+index a315dd7..7406216 100644
+--- Makefile.am
++++ Makefile.am
+@@ -7,7 +7,7 @@ bin_PROGRAMS = st-flash st-util
+ noinst_LIBRARIES      = libstlink.a
+ st_flash_SOURCES = flash/main.c
+-st_util_SOURCES = gdbserver/gdb-remote.c gdbserver/gdb-remote.h gdbserver/gdb-server.c mingw/mingw.c mingw/mingw.h
++st_util_SOURCES = gdbserver/gdb-remote.c gdbserver/gdb-remote.h gdbserver/gdb-server.c gdbserver/elfsym.c mingw/mingw.c mingw/mingw.h
+ CFILES = \
+       src/stlink-common.c \
+@@ -24,14 +24,14 @@ HFILES     = \
+ libstlink_a_SOURCES   =       $(CFILES) $(HFILES)
+-libstlink_a_CPPFLAGS  = -std=gnu99 -Wall -Wextra -O2
++libstlink_a_CPPFLAGS  = -std=gnu99 -Wall -Wextra -g
+ libstlink_a_LIBADD = $(LIBOBJS)
+ st_flash_LDADD        =       libstlink.a
+-st_flash_CPPFLAGS     = -std=gnu99 -Wall -Wextra -O2 -I$(top_srcdir)/src -I$(top_srcdir)/mingw
++st_flash_CPPFLAGS     = -std=gnu99 -Wall -Wextra -g  -I$(top_srcdir)/src -I$(top_srcdir)/mingw
+-st_util_LDADD =       libstlink.a
+-st_util_CPPFLAGS      = -std=gnu99 -Wall -Wextra -O2 -I$(top_srcdir)/src -I$(top_srcdir)/mingw
++st_util_LDADD =       libstlink.a -lelf
++st_util_CPPFLAGS      = -std=gnu99 -Wall -Wextra -g -I$(top_srcdir)/src -I$(top_srcdir)/mingw
+ EXTRA_DIST = autogen.sh
+diff --git gdbserver/Makefile gdbserver/Makefile
+index bd5c73d..6763388 100644
+--- gdbserver/Makefile
++++ gdbserver/Makefile
+@@ -1,12 +1,11 @@
+ PRG := st-util
+-OBJS = gdb-remote.o gdb-server.o
++OBJS = gdb-remote.o gdb-server.o elfsym.o
+ CFLAGS+=-g -Wall -Werror -std=gnu99 -I../src
+ LDFLAGS=-L.. -lstlink
+ # libusb location
+-LDFLAGS+=`pkg-config --libs libusb-1.0`
+-CFLAGS+=`pkg-config --cflags libusb-1.0`
++LDFLAGS+=`pkg-config --libs libusb-1.0` -lelfCFLAGS+=`pkg-config --cflags libusb-1.0`
+ all: $(PRG)
+diff --git gdbserver/gdb-server.c gdbserver/gdb-server.c
+index f92fc05..e54d136 100644
+--- gdbserver/gdb-server.c
++++ gdbserver/gdb-server.c
+@@ -1,11 +1,12 @@
+ /* -*- tab-width:8 -*- */
+-#define DEBUG 0
++//#define DEBUG 0
+ /*
+  Copyright (C)  2011 Peter Zotov <whitequark@whitequark.org>
+  Use of this source code is governed by a BSD-style
+  license that can be found in the LICENSE file.
+ */
++#include <assert.h>
+ #include <getopt.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -20,14 +21,29 @@
+ #include <arpa/inet.h>
+ #include <signal.h>
+ #endif
++#include <sys/stat.h>
++#include <unistd.h>
++#include <fcntl.h>
+ #include <stlink-common.h>
+ #include "gdb-remote.h"
++#include "elfsym.h"
+ #define DEFAULT_LOGGING_LEVEL 50
+ #define DEFAULT_GDB_LISTEN_PORT 4242
++/* stdio command codes from target */
++
++#define GDB_STDIO_PRINTF  1
++#define GDB_STDIO_FOPEN   2
++#define GDB_STDIO_FCLOSE  3
++#define GDB_STDIO_FWRITE  4
++#define GDB_STDIO_FREAD   5
++#define GDB_STDIO_FPRINTF 6
++
++#define MAX_STR 256
++
+ #define STRINGIFY_inner(name) #name
+ #define STRINGIFY(name) STRINGIFY_inner(name)
+@@ -46,11 +62,12 @@ typedef struct _st_state_t {
+     // "/dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTE531X6-if00-port0" is only 58 chars
+     char devicename[100];
+     int logging_level;
+-      int listen_port;
++    int listen_port;
++    char elf_filename[255];
+ } st_state_t;
+-int serve(stlink_t *sl, int port);
++int serve(stlink_t *sl, int port, char *elf_filename);
+ char* make_memory_map(stlink_t *sl);
+@@ -76,13 +93,14 @@ int parse_options(int argc, char** argv, st_state_t *st) {
+       "  -p 4242, --listen_port=1234\n"
+       "\t\t\tSet the gdb server listen port. "
+       "(default port: " STRINGIFY(DEFAULT_GDB_LISTEN_PORT) ")\n"
++      "  -f <elf_filename>\tenable File I/O of target executable elf_filename"
+       ;
+     int option_index = 0;
+     int c;
+     int q;
+-    while ((c = getopt_long(argc, argv, "hv::d:s:1p:", long_options, &option_index)) != -1) {
++    while ((c = getopt_long(argc, argv, "hv::d:s:1p:1f:", long_options, &option_index)) != -1) {
+         switch (c) {
+         case 0:
+             printf("XXXXX Shouldn't really normally come here, only if there's no corresponding option\n");
+@@ -110,25 +128,29 @@ int parse_options(int argc, char** argv, st_state_t *st) {
+                 strcpy(st->devicename, optarg);
+             }
+             break;
+-              case '1':
+-                      st->stlink_version = 1;
+-                      break;
+-              case 's':
+-                      sscanf(optarg, "%i", &q);
+-                      if (q < 0 || q > 2) {
+-                              fprintf(stderr, "stlink version %d unknown!\n", q);
+-                              exit(EXIT_FAILURE);
+-                      }
+-                      st->stlink_version = q;
+-                      break;
+-              case 'p':
+-                      sscanf(optarg, "%i", &q);
+-                      if (q < 0) {
+-                              fprintf(stderr, "Can't use a negative port to listen on: %d\n", q);
+-                              exit(EXIT_FAILURE);
+-                      }
+-                      st->listen_port = q;
+-                      break;
++        case '1':
++            st->stlink_version = 1;
++            break;
++        case 's':
++            sscanf(optarg, "%i", &q);
++            if (q < 0 || q > 2) {
++                fprintf(stderr, "stlink version %d unknown!\n", q);
++                exit(EXIT_FAILURE);
++            }
++            st->stlink_version = q;
++            break;
++        case 'p':
++            sscanf(optarg, "%i", &q);
++            if (q < 0) {
++                fprintf(stderr, "Can't use a negative port to listen on: %d\n", q);
++                exit(EXIT_FAILURE);
++            }
++            st->listen_port = q;
++            break;
++        case 'f':
++            sscanf(optarg, "%s", st->elf_filename);
++            printf("-f arg; %s\n", st->elf_filename);
++            break;
+         }
+     }
+@@ -162,7 +184,7 @@ int main(int argc, char** argv) {
+               sl = stlink_v1_open(state.logging_level);
+               if(sl == NULL) return 1;
+               break;
+-    }
++        }
+       printf("Chip ID is %08x, Core ID is  %08x.\n", sl->chip_id, sl->core_id);
+@@ -177,7 +199,7 @@ int main(int argc, char** argv) {
+       }
+ #endif
+-      while(serve(sl, state.listen_port) == 0);
++      while(serve(sl, state.listen_port, state.elf_filename) == 0);
+ #ifdef __MINGW32__
+ winsock_error:
+@@ -625,7 +647,179 @@ error:
+       return error;
+ }
+-int serve(stlink_t *sl, int port) {
++static unsigned int func_addr, ret_addr, pstr1_addr, pstr2_addr;
++static unsigned int strlen1_addr, strlen2_addr, file_addr, ptr_addr;
++static unsigned int size_addr, nmem_addr;
++
++static void write_buffer(stlink_t *sl, int target_addr, char* buf, size_t size) {
++    /* write the buffer right after the loader */
++    size_t chunk = size & ~0x3;
++    size_t rem   = size & 0x3;
++
++    if (chunk) {
++        memcpy(sl->q_buf, buf, chunk);
++        stlink_write_mem32(sl, target_addr, chunk);
++    }
++    if (rem) {
++        memcpy(sl->q_buf, buf+chunk, rem);
++        stlink_write_mem8(sl, target_addr+chunk, rem);
++    }
++}
++
++static void read_buffer(stlink_t *sl, int target_addr, char* buf, size_t size) {
++    unsigned adj_start = target_addr % 4;
++    unsigned count_rnd = (size + adj_start + 4 - 1) / 4 * 4;
++    size_t i;
++
++    stlink_read_mem32(sl, target_addr - adj_start, count_rnd);
++
++    for(i=0; i<size; i++)
++        buf[i] = sl->q_buf[i + adj_start];
++}
++
++static void fileio(stlink_t *sl)
++{
++    int   func, pstr1, pstr2, strlen1, strlen2, ptr, size, nmem;
++    int   ret = 0;
++    FILE *file;
++    char  file_name[MAX_STR];
++    char  mode[MAX_STR];
++    char *buf;
++
++    stlink_read_mem32(sl, func_addr, 4);
++    func = read_uint32(sl->q_buf, 0);
++
++    /* func != 0 means target has requested a system call */
++
++    switch(func) {
++
++    case GDB_STDIO_PRINTF:
++        stlink_read_mem32(sl, pstr1_addr, 4);
++        pstr1 = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, strlen1_addr, 4);
++        strlen1 = read_uint32(sl->q_buf, 0);
++        buf = (char*)malloc(strlen1+1);
++        assert(buf != NULL);
++        read_buffer(sl, pstr1, buf, strlen1);
++        buf[strlen1] = 0;
++      #ifdef DEBUG
++        //printf("gdb_stdio printf pstr1: 0x%0x strlen1: %d  buf: %s\n", pstr1, strlen1, buf);
++        #endif
++        fputs(buf, stdout);
++        free(buf);
++
++       break;
++
++    case GDB_STDIO_FPRINTF:
++        stlink_read_mem32(sl, file_addr, 4);
++        file = (FILE*)read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, pstr1_addr, 4);
++        pstr1 = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, strlen1_addr, 4);
++        strlen1 = read_uint32(sl->q_buf, 0);
++        buf = (char*)malloc(strlen1+1);
++        assert(buf != NULL);
++        read_buffer(sl, pstr1, buf, strlen1);
++        buf[strlen1] = 0;
++      #ifdef DEBUG
++        //printf("gdb_stdio fprintf pstr1: 0x%0x strlen1: %d  buf: %s file: 0x%x\n", pstr1, strlen1, buf, (unsigned int)file);
++        #endif
++        fputs(buf, file);
++        free(buf);
++
++       break;
++
++    case GDB_STDIO_FOPEN:
++        stlink_read_mem32(sl, pstr1_addr, 4);
++        pstr1 = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, strlen1_addr, 4);
++        strlen1 = read_uint32(sl->q_buf, 0);
++        assert(strlen1 < MAX_STR);
++        read_buffer(sl, pstr1, file_name, strlen1);
++        file_name[strlen1] = 0;
++
++        stlink_read_mem32(sl, pstr2_addr, 4);
++        pstr2 = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, strlen2_addr, 4);
++        strlen2 = read_uint32(sl->q_buf, 0);
++        assert(strlen2 < MAX_STR);
++        read_buffer(sl, pstr2, mode, strlen2);
++        mode[strlen2] = 0;
++
++        file = fopen(file_name, mode);
++
++        ret = (int)file;
++      #ifdef DEBUG
++        printf("gdb_stdio fopen file_name: %s mode: %s file: 0x%x\n", file_name, mode, (unsigned int)file);
++        #endif
++        break;
++
++    case GDB_STDIO_FCLOSE:
++        stlink_read_mem32(sl, file_addr, 4);
++        file = (FILE*)read_uint32(sl->q_buf, 0);
++        fclose(file);
++
++      #ifdef DEBUG
++        printf("gdb_stdio fclose file: 0x%x\n", (unsigned int)file);
++        #endif
++        break;
++
++    case GDB_STDIO_FWRITE:
++        stlink_read_mem32(sl, ptr_addr, 4);
++        ptr = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, size_addr, 4);
++        size = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, nmem_addr, 4);
++        nmem = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, file_addr, 4);
++        file = (FILE*)read_uint32(sl->q_buf, 0);
++
++        buf = (char*)malloc(size*nmem);
++        assert(buf != NULL);
++        read_buffer(sl, ptr, buf, size*nmem);
++        ret = fwrite(buf, size, nmem, file);
++        free(buf);
++      #ifdef DEBUG
++        printf("gdb_stdio fwrite ptr: 0x%x size: %d nmem: %d file: 0x%x\n", 
++               ptr, size, nmem, (unsigned int)file);
++        #endif
++        break;
++
++    case GDB_STDIO_FREAD:
++        stlink_read_mem32(sl, ptr_addr, 4);
++        ptr = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, size_addr, 4);
++        size = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, nmem_addr, 4);
++        nmem = read_uint32(sl->q_buf, 0);
++        stlink_read_mem32(sl, file_addr, 4);
++        file = (FILE*)read_uint32(sl->q_buf, 0);
++
++        buf = (char*)malloc(size*nmem);
++        assert(buf != NULL);
++        ret = fread(buf, size, nmem, file);
++        write_buffer(sl, ptr, buf, size*nmem);
++        free(buf);
++
++      #ifdef DEBUG
++        printf("gdb_stdio fread ptr: 0x%x size: %d nmem: %d file: 0x%x\n", 
++               ptr, size, nmem, (unsigned int)file);
++        #endif
++        break;
++    }
++       
++    if (func) {
++        memcpy(sl->q_buf, &ret, sizeof(int));
++        stlink_write_mem32(sl, ret_addr, 4);
++
++        func = 0;
++        memcpy(sl->q_buf, &func, sizeof(int));
++        stlink_write_mem32(sl, func_addr, 4);
++    }
++}
++
++
++int serve(stlink_t *sl, int port, char *elf_filename) {
+       int sock = socket(AF_INET, SOCK_STREAM, 0);
+       if(sock < 0) {
+               perror("socket");
+@@ -650,7 +844,33 @@ int serve(stlink_t *sl, int port) {
+               perror("listen");
+               return 1;
+       }
+-\r
++
++        /* init for file I/O */
++
++        func_addr = ret_addr = pstr1_addr = pstr2_addr = strlen1_addr = strlen2_addr = 0;
++        file_addr = ptr_addr = size_addr = nmem_addr = 0;
++
++        printf("elf_filename: %s----------------------------------\n", elf_filename);
++        if (*elf_filename != 0) {
++            int fd = elfsym_open(elf_filename);
++            if (fd == -1)
++                exit(0);
++            func_addr = elfsym_get_symbol_address(fd, "gdb_stdio_func");
++            ret_addr = elfsym_get_symbol_address(fd, "gdb_stdio_ret");
++            pstr1_addr = elfsym_get_symbol_address(fd, "gdb_stdio_pstr1");
++            pstr2_addr = elfsym_get_symbol_address(fd, "gdb_stdio_pstr2");
++            strlen1_addr = elfsym_get_symbol_address(fd, "gdb_stdio_strlen1");
++            strlen2_addr = elfsym_get_symbol_address(fd, "gdb_stdio_strlen2");
++            file_addr = elfsym_get_symbol_address(fd, "gdb_stdio_file");
++            ptr_addr = elfsym_get_symbol_address(fd, "gdb_stdio_ptr");
++            size_addr = elfsym_get_symbol_address(fd, "gdb_stdio_size");
++            nmem_addr = elfsym_get_symbol_address(fd, "gdb_stdio_nmem");
++            elfsym_close(fd);
++            #ifdef DEBUG
++            printf("func_addr: 0x%x\n", func_addr);
++            #endif
++        }
++
+ start_again:
+       stlink_force_debug(sl);
+       stlink_reset(sl);
+@@ -924,8 +1144,13 @@ start_again:
+                               if(sl->core_stat == STLINK_CORE_HALTED) {
+                                       break;
+                               }
++                                
++                                /* file I/O if enabled */
++
++                                if (*elf_filename != 0)
++                                    fileio(sl);
+-                              usleep(100000);
++                              usleep(10000);
+                       }
+                       reply = strdup("S05"); // TRAP
diff --git a/codec2/tags/0.4/stm32/stm32_flash.ld b/codec2/tags/0.4/stm32/stm32_flash.ld
new file mode 100644 (file)
index 0000000..6822ffa
--- /dev/null
@@ -0,0 +1,116 @@
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20020000;    /* end of 128K RAM on AHB bus*/
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0;      /* required amount of heap  */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
+  RAM (rwx)       : ORIGIN = 0x20000000, LENGTH = 128K
+  CCM (rwx)       : ORIGIN = 0x10000000, LENGTH = 64K
+}
+
+SECTIONS
+{
+  .isr_vector :
+  {
+    . = ALIGN(4);
+    KEEP(*(.isr_vector))
+    . = ALIGN(4);
+  } >FLASH
+
+  .text :
+  {
+    . = ALIGN(4);
+    *(.text)           /* .text sections (code) */
+    *(.text*)          /* .text* sections (code) */
+    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
+    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
+    *(.glue_7)         /* glue arm to thumb code */
+    *(.glue_7t)        /* glue thumb to arm code */
+       *(.eh_frame)
+
+    KEEP (*(.init))
+    KEEP (*(.fini))
+
+    . = ALIGN(4);
+    _etext = .;        /* define a global symbols at end of code */
+    _exit = .;
+  } >FLASH
+
+
+   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+    .ARM : {
+    __exidx_start = .;
+      *(.ARM.exidx*)
+      __exidx_end = .;
+    } >FLASH
+
+  .preinit_array     :
+  {
+    PROVIDE_HIDDEN (__preinit_array_start = .);
+    KEEP (*(.preinit_array*))
+    PROVIDE_HIDDEN (__preinit_array_end = .);
+  } >FLASH
+  .init_array :
+  {
+    PROVIDE_HIDDEN (__init_array_start = .);
+    KEEP (*(SORT(.init_array.*)))
+    KEEP (*(.init_array*))
+    PROVIDE_HIDDEN (__init_array_end = .);
+  } >FLASH
+  .fini_array :
+  {
+    PROVIDE_HIDDEN (__fini_array_start = .);
+    KEEP (*(.fini_array*))
+    KEEP (*(SORT(.fini_array.*)))
+    PROVIDE_HIDDEN (__fini_array_end = .);
+  } >FLASH
+
+  /* used by the startup to initialize data */
+  _sidata = .;
+
+  /* Initialized data sections goes into RAM, load LMA copy after code */
+  .data : AT ( _sidata )
+  {
+    . = ALIGN(4);
+    _sdata = .;        /* create a global symbol at data start */
+    *(.data)           /* .data sections */
+    *(.data*)          /* .data* sections */
+
+    . = ALIGN(4);
+    _edata = .;        /* define a global symbol at data end */
+  } >RAM
+
+  /* Uninitialized data section */
+  . = ALIGN(4);
+  .bss :
+  {
+    /* This is used by the startup in order to initialize the .bss secion */
+    _sbss = .;         /* define a global symbol at bss start */
+    __bss_start__ = _sbss;
+    *(.bss)
+    *(.bss*)
+    *(COMMON)
+
+    . = ALIGN(4);
+    _ebss = .;         /* define a global symbol at bss end */
+    __bss_end__ = _ebss;
+  } >RAM
+
+  /* User_heap_stack section, used to check that there is enough RAM left */
+  ._user_heap_stack :
+  {
+    . = ALIGN(4);
+    PROVIDE ( end = . );
+    PROVIDE ( _end = . );
+    . = . + _Min_Heap_Size;
+    . = . + _Min_Stack_Size;
+    . = ALIGN(4);
+  } >RAM
+}
diff --git a/codec2/tags/0.4/stm32/stm32_ram.ld b/codec2/tags/0.4/stm32/stm32_ram.ld
new file mode 100644 (file)
index 0000000..88c735a
--- /dev/null
@@ -0,0 +1,116 @@
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20020000;    /* end of 128K RAM on AHB bus*/
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0;      /* required amount of heap  */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
+  RAM (rwx)       : ORIGIN = 0x20000000, LENGTH = 128K
+  CCM (rwx)       : ORIGIN = 0x10000000, LENGTH = 64K
+}
+
+SECTIONS
+{
+  .isr_vector :
+  {
+    . = ALIGN(4);
+    KEEP(*(.isr_vector))
+    . = ALIGN(4);
+  } >RAM
+
+  .text :
+  {
+    . = ALIGN(4);
+    *(.text)           /* .text sections (code) */
+    *(.text*)          /* .text* sections (code) */
+    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
+    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
+    *(.glue_7)         /* glue arm to thumb code */
+    *(.glue_7t)        /* glue thumb to arm code */
+       *(.eh_frame)
+
+    KEEP (*(.init))
+    KEEP (*(.fini))
+
+    . = ALIGN(4);
+    _etext = .;        /* define a global symbols at end of code */
+    _exit = .;
+  } >RAM
+
+
+   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
+    .ARM : {
+    __exidx_start = .;
+      *(.ARM.exidx*)
+      __exidx_end = .;
+    } >RAM
+
+  .preinit_array     :
+  {
+    PROVIDE_HIDDEN (__preinit_array_start = .);
+    KEEP (*(.preinit_array*))
+    PROVIDE_HIDDEN (__preinit_array_end = .);
+  } >RAM
+  .init_array :
+  {
+    PROVIDE_HIDDEN (__init_array_start = .);
+    KEEP (*(SORT(.init_array.*)))
+    KEEP (*(.init_array*))
+    PROVIDE_HIDDEN (__init_array_end = .);
+  } >RAM
+  .fini_array :
+  {
+    PROVIDE_HIDDEN (__fini_array_start = .);
+    KEEP (*(.fini_array*))
+    KEEP (*(SORT(.fini_array.*)))
+    PROVIDE_HIDDEN (__fini_array_end = .);
+  } >RAM
+
+  /* used by the startup to initialize data */
+  _sidata = .;
+
+  /* Initialized data sections goes into RAM, load LMA copy after code */
+  .data : AT ( _sidata )
+  {
+    . = ALIGN(4);
+    _sdata = .;        /* create a global symbol at data start */
+    *(.data)           /* .data sections */
+    *(.data*)          /* .data* sections */
+
+    . = ALIGN(4);
+    _edata = .;        /* define a global symbol at data end */
+  } >RAM
+
+  /* Uninitialized data section */
+  . = ALIGN(4);
+  .bss :
+  {
+    /* This is used by the startup in order to initialize the .bss secion */
+    _sbss = .;         /* define a global symbol at bss start */
+    __bss_start__ = _sbss;
+    *(.bss)
+    *(.bss*)
+    *(COMMON)
+
+    . = ALIGN(4);
+    _ebss = .;         /* define a global symbol at bss end */
+    __bss_end__ = _ebss;
+  } >RAM
+
+  /* User_heap_stack section, used to check that there is enough RAM left */
+  ._user_heap_stack :
+  {
+    . = ALIGN(4);
+    PROVIDE ( end = . );
+    PROVIDE ( _end = . );
+    . = . + _Min_Heap_Size;
+    . = . + _Min_Stack_Size;
+    . = ALIGN(4);
+  } >RAM
+}
diff --git a/codec2/tags/0.4/stm32/usb_conf/usb_bsp.c b/codec2/tags/0.4/stm32/usb_conf/usb_bsp.c
new file mode 100644 (file)
index 0000000..e16e150
--- /dev/null
@@ -0,0 +1,337 @@
+/**
+  ******************************************************************************
+  * @file    usb_bsp.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    19-September-2011
+  * @brief   This file is responsible to offer board support package and is
+  *          configurable by user.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_bsp.h"
+#include "usbd_conf.h"
+#include "stm32f4xx_conf.h"
+#include "stm32f4xx_gpio.h"
+#include "stm32f4xx_exti.h"
+#include "stm32f4xx_rcc.h"
+#include "misc.h"
+
+
+void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev) {
+
+}
+
+void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state) {
+
+}
+
+
+/**
+* @brief  USB_OTG_BSP_Init
+*         Initilizes BSP configurations
+* @param  None
+* @retval None
+*/
+
+void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)
+{
+  GPIO_InitTypeDef GPIO_InitStructure;
+
+#ifndef USE_ULPI_PHY
+#ifdef USB_OTG_FS_LOW_PWR_MGMT_SUPPORT
+  EXTI_InitTypeDef EXTI_InitStructure;
+  NVIC_InitTypeDef NVIC_InitStructure;
+#endif
+#endif
+
+
+ #ifdef USE_USB_OTG_FS
+
+  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA , ENABLE);
+
+  /* Configure SOF VBUS ID DM DP Pins */
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8  |
+    GPIO_Pin_9  |
+      GPIO_Pin_11 |
+        GPIO_Pin_12;
+
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
+  GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource8,GPIO_AF_OTG1_FS) ;
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_OTG1_FS) ;
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource11,GPIO_AF_OTG1_FS) ;
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource12,GPIO_AF_OTG1_FS) ;
+
+  /* this for ID line debug */
+
+
+  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_10;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_Init(GPIOA, &GPIO_InitStructure);
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_OTG1_FS) ;
+
+  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
+  RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ;
+ #else // USE_USB_OTG_HS
+
+  #ifdef USE_ULPI_PHY // ULPI
+  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
+                         RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOH |
+                           RCC_AHB1Periph_GPIOI, ENABLE);
+
+
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource3, GPIO_AF_OTG2_HS) ; // D0
+  GPIO_PinAFConfig(GPIOA,GPIO_PinSource5, GPIO_AF_OTG2_HS) ; // CLK
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource0, GPIO_AF_OTG2_HS) ; // D1
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource1, GPIO_AF_OTG2_HS) ; // D2
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource5, GPIO_AF_OTG2_HS) ; // D7
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_OTG2_HS) ; // D3
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_OTG2_HS) ; // D4
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource12,GPIO_AF_OTG2_HS) ; // D5
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_OTG2_HS) ; // D6
+  GPIO_PinAFConfig(GPIOH,GPIO_PinSource4, GPIO_AF_OTG2_HS) ; // NXT
+  GPIO_PinAFConfig(GPIOI,GPIO_PinSource11,GPIO_AF_OTG2_HS) ; // DIR
+  GPIO_PinAFConfig(GPIOC,GPIO_PinSource0, GPIO_AF_OTG2_HS) ; // STP
+
+  // CLK
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 ;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+  // D0
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3  ;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
+  GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+
+
+  // D1 D2 D3 D4 D5 D6 D7
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1  |
+    GPIO_Pin_5 | GPIO_Pin_10 |
+      GPIO_Pin_11| GPIO_Pin_12 |
+        GPIO_Pin_13 ;
+
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
+  GPIO_Init(GPIOB, &GPIO_InitStructure);
+
+
+  // STP
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0  ;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_Init(GPIOC, &GPIO_InitStructure);
+
+  //NXT
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_Init(GPIOH, &GPIO_InitStructure);
+
+
+  //DIR
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 ;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_Init(GPIOI, &GPIO_InitStructure);
+
+
+  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS |
+                         RCC_AHB1Periph_OTG_HS_ULPI, ENABLE) ;
+
+  #else
+   #ifdef USE_I2C_PHY
+  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOB , ENABLE);
+  /* Configure RESET INTN SCL SDA (Phy/I2C) Pins */
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 |
+    GPIO_Pin_1 |
+      GPIO_Pin_10 |
+        GPIO_Pin_11;
+
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_Init(GPIOB, &GPIO_InitStructure);
+
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource0,GPIO_AF_OTG2_FS) ;
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource1,GPIO_AF_OTG2_FS) ;
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_OTG2_FS) ;
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_OTG2_FS);
+  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS, ENABLE) ;
+
+   #else
+
+  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB , ENABLE);
+
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12  |
+    GPIO_Pin_13 |
+      GPIO_Pin_14 |
+        GPIO_Pin_15;
+
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
+  GPIO_Init(GPIOB, &GPIO_InitStructure);
+
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource12, GPIO_AF_OTG2_FS) ;
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_OTG2_FS) ;
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource14,GPIO_AF_OTG2_FS) ;
+  GPIO_PinAFConfig(GPIOB,GPIO_PinSource15,GPIO_AF_OTG2_FS) ;
+  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS, ENABLE) ;
+   #endif
+  #endif // USE_ULPI_PHY
+
+ #endif //USB_OTG_HS
+
+
+  /* enable the PWR clock */
+  RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, ENABLE);
+
+  /* Configure the Key button in EXTI mode */
+  //STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_EXTI);
+
+#ifdef USB_OTG_FS_LOW_PWR_MGMT_SUPPORT
+  EXTI_ClearITPendingBit(EXTI_Line18);
+
+  EXTI_InitStructure.EXTI_Line = EXTI_Line18;
+  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
+  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
+  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
+  EXTI_Init(&EXTI_InitStructure);
+
+  EXTI_ClearITPendingBit(EXTI_Line18);
+
+  NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn;
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+  NVIC_Init(&NVIC_InitStructure);
+
+  EXTI_ClearITPendingBit(EXTI_Line18);
+#endif
+
+#ifdef USB_OTG_HS_LOW_PWR_MGMT_SUPPORT
+  EXTI_ClearITPendingBit(EXTI_Line20);
+
+  EXTI_InitStructure.EXTI_Line = EXTI_Line20;
+  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
+  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
+  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
+  EXTI_Init(&EXTI_InitStructure);
+
+  EXTI_ClearITPendingBit(EXTI_Line20);
+
+  NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_WKUP_IRQn;
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+  NVIC_Init(&NVIC_InitStructure);
+
+  EXTI_ClearITPendingBit(EXTI_Line20);
+#endif
+
+  EXTI_ClearITPendingBit(EXTI_Line0);
+}
+/**
+* @brief  USB_OTG_BSP_EnableInterrupt
+*         Enabele USB Global interrupt
+* @param  None
+* @retval None
+*/
+void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev)
+{
+  NVIC_InitTypeDef NVIC_InitStructure;
+
+  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
+#ifdef USE_USB_OTG_HS
+  NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_IRQn;
+#else
+  NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn;
+#endif
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+  NVIC_Init(&NVIC_InitStructure);
+#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED
+  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
+  NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_EP1_OUT_IRQn;
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+  NVIC_Init(&NVIC_InitStructure);
+
+  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
+  NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_EP1_IN_IRQn;
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+  NVIC_Init(&NVIC_InitStructure);
+#endif
+}
+/**
+* @brief  USB_OTG_BSP_uDelay
+*         This function provides delay time in micro sec
+* @param  usec : Value of delay required in micro sec
+* @retval None
+*/
+void USB_OTG_BSP_uDelay (const uint32_t usec)
+{
+  uint32_t count = 0;
+  const uint32_t utime = (120 * usec / 7);
+  do
+  {
+    if ( ++count > utime )
+    {
+      return ;
+    }
+  }
+  while (1);
+}
+
+
+/**
+* @brief  USB_OTG_BSP_mDelay
+*          This function provides delay time in milli sec
+* @param  msec : Value of delay required in milli sec
+* @retval None
+*/
+void USB_OTG_BSP_mDelay (const uint32_t msec)
+{
+  USB_OTG_BSP_uDelay(msec * 1000);
+}
+/**
+* @}
+*/
+
+/**
+* @}
+*/
+
+/**
+* @}
+*/
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_conf/usb_bsp.h b/codec2/tags/0.4/stm32/usb_conf/usb_bsp.h
new file mode 100644 (file)
index 0000000..0584e9b
--- /dev/null
@@ -0,0 +1,97 @@
+/**
+  ******************************************************************************
+  * @file    usb_bsp.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Specific api's relative to the used hardware platform
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USB_BSP__H__
+#define __USB_BSP__H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_core.h"
+#include "stm32f4xx.h"
+
+/** @addtogroup USB_OTG_DRIVER
+  * @{
+  */
+  
+/** @defgroup USB_BSP
+  * @brief This file is the 
+  * @{
+  */ 
+
+
+/** @defgroup USB_BSP_Exported_Defines
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_BSP_Exported_Types
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_BSP_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_BSP_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_BSP_Exported_FunctionsPrototype
+  * @{
+  */ 
+void BSP_Init(void);
+
+void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev);
+void USB_OTG_BSP_uDelay (const uint32_t usec);
+void USB_OTG_BSP_mDelay (const uint32_t msec);
+void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev);
+#ifdef USE_HOST_MODE
+void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev);
+void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state);
+#endif
+/**
+  * @}
+  */ 
+
+#endif //__USB_BSP__H__
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_conf/usb_conf.h b/codec2/tags/0.4/stm32/usb_conf/usb_conf.h
new file mode 100644 (file)
index 0000000..736e649
--- /dev/null
@@ -0,0 +1,287 @@
+/**
+  ******************************************************************************
+  * @file    usb_conf.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   general low level driver configuration
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USB_CONF__H__
+#define __USB_CONF__H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f4xx.h"
+
+
+/** @addtogroup USB_OTG_DRIVER
+  * @{
+  */
+  
+/** @defgroup USB_CONF
+  * @brief USB low level driver configuration file
+  * @{
+  */ 
+
+/** @defgroup USB_CONF_Exported_Defines
+  * @{
+  */ 
+
+/* USB Core and PHY interface configuration.
+   Tip: To avoid modifying these defines each time you need to change the USB
+        configuration, you can declare the needed define in your toolchain
+        compiler preprocessor.
+   */
+#ifndef USE_USB_OTG_FS
+#define USE_USB_OTG_FS
+#endif /* USE_USB_OTG_FS */
+
+#ifndef USE_USB_OTG_HS
+ //#define USE_USB_OTG_HS
+#endif /* USE_USB_OTG_HS */
+
+#ifndef USE_ULPI_PHY
+#define USE_ULPI_PHY
+#endif /* USE_ULPI_PHY */
+
+#ifndef USE_EMBEDDED_PHY
+ //#define USE_EMBEDDED_PHY
+#endif /* USE_EMBEDDED_PHY */
+
+#ifndef USE_I2C_PHY
+ //#define USE_I2C_PHY
+#endif /* USE_I2C_PHY */
+
+
+#ifdef USE_USB_OTG_FS 
+ #define USB_OTG_FS_CORE
+#endif
+
+#ifdef USE_USB_OTG_HS
+ #define USB_OTG_HS_CORE
+#endif
+
+/*******************************************************************************
+*                      FIFO Size Configuration in Device mode
+*  
+*  (i) Receive data FIFO size = RAM for setup packets + 
+*                   OUT endpoint control information +
+*                   data OUT packets + miscellaneous
+*      Space = ONE 32-bits words
+*     --> RAM for setup packets = 10 spaces
+*        (n is the nbr of CTRL EPs the device core supports) 
+*     --> OUT EP CTRL info      = 1 space
+*        (one space for status information written to the FIFO along with each 
+*        received packet)
+*     --> data OUT packets      = (Largest Packet Size / 4) + 1 spaces 
+*        (MINIMUM to receive packets)
+*     --> OR data OUT packets  = at least 2*(Largest Packet Size / 4) + 1 spaces 
+*        (if high-bandwidth EP is enabled or multiple isochronous EPs)
+*     --> miscellaneous = 1 space per OUT EP
+*        (one space for transfer complete status information also pushed to the 
+*        FIFO with each endpoint's last packet)
+*
+*  (ii)MINIMUM RAM space required for each IN EP Tx FIFO = MAX packet size for 
+*       that particular IN EP. More space allocated in the IN EP Tx FIFO results
+*       in a better performance on the USB and can hide latencies on the AHB.
+*
+*  (iii) TXn min size = 16 words. (n  : Transmit FIFO index)
+*   (iv) When a TxFIFO is not used, the Configuration should be as follows: 
+*       case 1 :  n > m    and Txn is not used    (n,m  : Transmit FIFO indexes)
+*       --> Txm can use the space allocated for Txn.
+*       case2  :  n < m    and Txn is not used    (n,m  : Transmit FIFO indexes)
+*       --> Txn should be configured with the minimum space of 16 words
+*  (v) The FIFO is used optimally when used TxFIFOs are allocated in the top 
+*       of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.
+*******************************************************************************/
+
+/*******************************************************************************
+*                     FIFO Size Configuration in Host mode
+*
+*  (i) Receive data FIFO size = (Largest Packet Size / 4) + 1 or
+*                             2x (Largest Packet Size / 4) + 1,  If a
+*                             high-bandwidth channel or multiple isochronous
+*                             channels are enabled
+*
+*  (ii) For the host nonperiodic Transmit FIFO is the largest maximum packet size
+*      for all supported nonperiodic OUT channels. Typically, a space
+*      corresponding to two Largest Packet Size is recommended.
+*
+*  (iii) The minimum amount of RAM required for Host periodic Transmit FIFO is
+*        the largest maximum packet size for all supported periodic OUT channels.
+*        If there is at least one High Bandwidth Isochronous OUT endpoint,
+*        then the space must be at least two times the maximum packet size for
+*        that channel.
+*******************************************************************************/
+/****************** USB OTG HS CONFIGURATION **********************************/
+#ifdef USB_OTG_HS_CORE
+ #define RX_FIFO_HS_SIZE                          512
+ #define TX0_FIFO_HS_SIZE                         512
+ #define TX1_FIFO_HS_SIZE                         512
+ #define TX2_FIFO_HS_SIZE                          0
+ #define TX3_FIFO_HS_SIZE                          0
+ #define TX4_FIFO_HS_SIZE                          0
+ #define TX5_FIFO_HS_SIZE                          0
+ #define TXH_NP_HS_FIFOSIZ                         96
+ #define TXH_P_HS_FIFOSIZ                          96
+
+ //#define USB_OTG_HS_LOW_PWR_MGMT_SUPPORT
+ //#define USB_OTG_HS_SOF_OUTPUT_ENABLED
+
+ //#define USB_OTG_INTERNAL_VBUS_ENABLED
+ #define USB_OTG_EXTERNAL_VBUS_ENABLED
+
+ #ifdef USE_ULPI_PHY
+  #define USB_OTG_ULPI_PHY_ENABLED
+ #endif
+ #ifdef USE_EMBEDDED_PHY
+   #define USB_OTG_EMBEDDED_PHY_ENABLED
+ #endif
+ #ifdef USE_I2C_PHY
+  #define USB_OTG_I2C_PHY_ENABLED
+ #endif
+ #define USB_OTG_HS_INTERNAL_DMA_ENABLED
+ #define USB_OTG_HS_DEDICATED_EP1_ENABLED
+#endif
+
+/****************** USB OTG FS CONFIGURATION **********************************/
+#ifdef USB_OTG_FS_CORE
+ #define RX_FIFO_FS_SIZE                          128
+ #define TX0_FIFO_FS_SIZE                          64
+ #define TX1_FIFO_FS_SIZE                         128
+ #define TX2_FIFO_FS_SIZE                          0
+ #define TX3_FIFO_FS_SIZE                          0
+ #define TXH_NP_FS_FIFOSIZ                         96
+ #define TXH_P_FS_FIFOSIZ                          96
+
+ //#define USB_OTG_FS_LOW_PWR_MGMT_SUPPORT
+ //#define USB_OTG_FS_SOF_OUTPUT_ENABLED
+#endif
+
+/****************** USB OTG MODE CONFIGURATION ********************************/
+//#define USE_HOST_MODE
+#define USE_DEVICE_MODE
+//#define USE_OTG_MODE
+
+
+#ifndef USB_OTG_FS_CORE
+ #ifndef USB_OTG_HS_CORE
+    #error  "USB_OTG_HS_CORE or USB_OTG_FS_CORE should be defined"
+ #endif
+#endif
+
+
+#ifndef USE_DEVICE_MODE
+ #ifndef USE_HOST_MODE
+    #error  "USE_DEVICE_MODE or USE_HOST_MODE should be defined"
+ #endif
+#endif
+
+#ifndef USE_USB_OTG_HS
+ #ifndef USE_USB_OTG_FS
+    #error  "USE_USB_OTG_HS or USE_USB_OTG_FS should be defined"
+ #endif
+#else //USE_USB_OTG_HS
+ #ifndef USE_ULPI_PHY
+  #ifndef USE_EMBEDDED_PHY
+   #ifndef USE_I2C_PHY
+     #error  "USE_ULPI_PHY or USE_EMBEDDED_PHY or USE_I2C_PHY should be defined"
+   #endif
+  #endif
+ #endif
+#endif
+
+/****************** C Compilers dependant keywords ****************************/
+/* In HS mode and when the DMA is used, all variables and data structures dealing
+   with the DMA during the transaction process should be 4-bytes aligned */    
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined   (__GNUC__)        /* GNU Compiler */
+    #define __ALIGN_END    __attribute__ ((aligned (4)))
+    #define __ALIGN_BEGIN         
+  #else                           
+    #define __ALIGN_END
+    #if defined   (__CC_ARM)      /* ARM Compiler */
+      #define __ALIGN_BEGIN    __align(4)  
+    #elif defined (__ICCARM__)    /* IAR Compiler */
+      #define __ALIGN_BEGIN 
+    #elif defined  (__TASKING__)  /* TASKING Compiler */
+      #define __ALIGN_BEGIN    __align(4) 
+    #endif /* __CC_ARM */  
+  #endif /* __GNUC__ */ 
+#else
+  #define __ALIGN_BEGIN
+  #define __ALIGN_END   
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+
+/* __packed keyword used to decrease the data type alignment to 1-byte */
+#if defined (__CC_ARM)         /* ARM Compiler */
+  #define __packed    __packed
+#elif defined (__ICCARM__)     /* IAR Compiler */
+  #define __packed    __packed
+#elif defined   ( __GNUC__ )   /* GNU Compiler */                        
+  #define __packed    __attribute__ ((__packed__))
+#elif defined   (__TASKING__)  /* TASKING Compiler */
+  #define __packed    __unaligned
+#endif /* __CC_ARM */
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_CONF_Exported_Types
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_CONF_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CONF_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CONF_Exported_FunctionsPrototype
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+#endif //__USB_CONF__H__
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_conf/usbd_conf.h b/codec2/tags/0.4/stm32/usb_conf/usbd_conf.h
new file mode 100644 (file)
index 0000000..0ecf0b3
--- /dev/null
@@ -0,0 +1,95 @@
+/**
+  ******************************************************************************
+  * @file    usbd_conf.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   USB Device configuration file
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_CONF__H__
+#define __USBD_CONF__H__
+
+/** @defgroup USB_CONF_Exported_Defines
+  * @{
+  */ 
+#define USBD_CFG_MAX_NUM                1
+#define USBD_ITF_MAX_NUM                1
+#define USB_MAX_STR_DESC_SIZ            100 
+
+/** @defgroup USB_VCP_Class_Layer_Parameter
+  * @{
+  */ 
+#define CDC_IN_EP                       0x81  /* EP1 for data IN */
+#define CDC_OUT_EP                      0x01  /* EP1 for data OUT */
+#define CDC_CMD_EP                      0x82  /* EP2 for CDC commands */
+
+/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
+#ifdef USE_USB_OTG_HS
+ #define CDC_DATA_MAX_PACKET_SIZE       512  /* Endpoint IN & OUT Packet size */
+ #define CDC_CMD_PACKET_SZE             8    /* Control Endpoint Packet size */
+
+ #define CDC_IN_FRAME_INTERVAL          40   /* Number of micro-frames between IN transfers */
+ #define APP_RX_DATA_SIZE               2048 /* Total size of IN buffer: 
+                                                APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL*8 */
+#else
+ #define CDC_DATA_MAX_PACKET_SIZE       64   /* Endpoint IN & OUT Packet size */
+ #define CDC_CMD_PACKET_SZE             8    /* Control Endpoint Packet size */
+
+ #define CDC_IN_FRAME_INTERVAL          5    /* Number of frames between IN transfers */
+ #define APP_RX_DATA_SIZE               2048 /* Total size of IN buffer: 
+                                                APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */
+#endif /* USE_USB_OTG_HS */
+
+#define APP_FOPS                        VCP_fops
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CONF_Exported_Types
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_CONF_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CONF_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CONF_Exported_FunctionsPrototype
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+#endif //__USBD_CONF__H__
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_conf/usbd_desc.c b/codec2/tags/0.4/stm32/usb_conf/usbd_desc.c
new file mode 100644 (file)
index 0000000..3693030
--- /dev/null
@@ -0,0 +1,324 @@
+/**
+  ******************************************************************************
+  * @file    usbd_desc.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    19-September-2011
+  * @brief   This file provides the USBD descriptors and string formating method.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include <assert.h>
+#include "usbd_core.h"
+#include "usbd_desc.h"
+#include "usbd_req.h"
+#include "usbd_conf.h"
+#include "usb_regs.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+
+
+/** @defgroup USBD_DESC 
+  * @brief USBD descriptors module
+  * @{
+  */ 
+
+/** @defgroup USBD_DESC_Private_TypesDefinitions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DESC_Private_Defines
+  * @{
+  */ 
+
+#define USBD_VID                        0x0483
+
+#define USBD_PID                        0x5740
+
+/** @defgroup USB_String_Descriptors
+  * @{
+  */ 
+#define USBD_LANGID_STRING              0x409
+#define USBD_MANUFACTURER_STRING        "STMicroelectronics"
+
+#define USBD_PRODUCT_HS_STRING          "STM32 Virtual ComPort in HS mode"
+#define USBD_SERIALNUMBER_HS_STRING     "00000000050B"
+
+#define USBD_PRODUCT_FS_STRING          "STM32 Virtual ComPort in FS Mode"
+#define USBD_SERIALNUMBER_FS_STRING     "00000000050C"
+
+#define USBD_CONFIGURATION_HS_STRING    "VCP Config"
+#define USBD_INTERFACE_HS_STRING        "VCP Interface"
+
+#define USBD_CONFIGURATION_FS_STRING    "VCP Config"
+#define USBD_INTERFACE_FS_STRING        "VCP Interface"
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DESC_Private_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DESC_Private_Variables
+  * @{
+  */ 
+
+USBD_DEVICE USR_desc =
+{
+  USBD_USR_DeviceDescriptor,
+  USBD_USR_LangIDStrDescriptor, 
+  USBD_USR_ManufacturerStrDescriptor,
+  USBD_USR_ProductStrDescriptor,
+  USBD_USR_SerialStrDescriptor,
+  USBD_USR_ConfigStrDescriptor,
+  USBD_USR_InterfaceStrDescriptor,
+  
+};
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+/* USB Standard Device Descriptor */
+__ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END =
+  {
+    0x12,                       /*bLength */
+    USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
+    0x00,                       /*bcdUSB */
+    0x02,
+    0x00,                       /*bDeviceClass*/
+    0x00,                       /*bDeviceSubClass*/
+    0x00,                       /*bDeviceProtocol*/
+    USB_OTG_MAX_EP0_SIZE,      /*bMaxPacketSize*/
+    LOBYTE(USBD_VID),           /*idVendor*/
+    HIBYTE(USBD_VID),           /*idVendor*/
+    LOBYTE(USBD_PID),           /*idVendor*/
+    HIBYTE(USBD_PID),           /*idVendor*/
+    0x00,                       /*bcdDevice rel. 2.00*/
+    0x02,
+    USBD_IDX_MFC_STR,           /*Index of manufacturer  string*/
+    USBD_IDX_PRODUCT_STR,       /*Index of product string*/
+    USBD_IDX_SERIAL_STR,        /*Index of serial number string*/
+    USBD_CFG_MAX_NUM            /*bNumConfigurations*/
+  } ; /* USB_DeviceDescriptor */
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+/* USB Standard Device Descriptor */
+__ALIGN_BEGIN uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END =
+{
+  USB_LEN_DEV_QUALIFIER_DESC,
+  USB_DESC_TYPE_DEVICE_QUALIFIER,
+  0x00,
+  0x02,
+  0x00,
+  0x00,
+  0x00,
+  0x40,
+  0x01,
+  0x00,
+};
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+/* USB Standard Device Descriptor */
+__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID] __ALIGN_END =
+{
+     USB_SIZ_STRING_LANGID,         
+     USB_DESC_TYPE_STRING,       
+     LOBYTE(USBD_LANGID_STRING),
+     HIBYTE(USBD_LANGID_STRING), 
+};
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DESC_Private_FunctionPrototypes
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DESC_Private_Functions
+  * @{
+  */ 
+
+/**
+* @brief  USBD_USR_DeviceDescriptor 
+*         return the device descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length)
+{
+  *length = sizeof(USBD_DeviceDesc);
+  return USBD_DeviceDesc;
+}
+
+/**
+* @brief  USBD_USR_LangIDStrDescriptor 
+*         return the LangID string descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length)
+{
+  *length =  sizeof(USBD_LangIDDesc);  
+  return USBD_LangIDDesc;
+}
+
+
+/**
+* @brief  USBD_USR_ProductStrDescriptor 
+*         return the product string descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_ProductStrDescriptor( uint8_t speed , uint16_t *length)
+{
+  
+  if(speed == 0)
+  {   
+    USBD_GetString ((uint8_t*)USBD_PRODUCT_HS_STRING, USBD_StrDesc, length);
+  }
+  else
+  {
+    USBD_GetString ((uint8_t*)USBD_PRODUCT_FS_STRING, USBD_StrDesc, length);
+  }
+  
+  assert(*length < USB_MAX_STR_DESC_SIZ);
+
+  return USBD_StrDesc;
+}
+
+/**
+* @brief  USBD_USR_ManufacturerStrDescriptor 
+*         return the manufacturer string descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_ManufacturerStrDescriptor( uint8_t speed , uint16_t *length)
+{
+  USBD_GetString ((uint8_t*)USBD_MANUFACTURER_STRING, USBD_StrDesc, length);
+  assert(*length < USB_MAX_STR_DESC_SIZ);
+  return USBD_StrDesc;
+}
+
+/**
+* @brief  USBD_USR_SerialStrDescriptor 
+*         return the serial number string descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length)
+{
+  if(speed  == USB_OTG_SPEED_HIGH)
+  {    
+    USBD_GetString ((uint8_t*)USBD_SERIALNUMBER_HS_STRING, USBD_StrDesc, length);
+  }
+  else
+  {
+    USBD_GetString ((uint8_t*)USBD_SERIALNUMBER_FS_STRING, USBD_StrDesc, length);
+  }
+  assert(*length < USB_MAX_STR_DESC_SIZ);
+  return USBD_StrDesc;
+}
+
+/**
+* @brief  USBD_USR_ConfigStrDescriptor 
+*         return the configuration string descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length)
+{
+  if(speed  == USB_OTG_SPEED_HIGH)
+  {  
+    USBD_GetString ((uint8_t*)USBD_CONFIGURATION_HS_STRING, USBD_StrDesc, length);
+  }
+  else
+  {
+    USBD_GetString ((uint8_t*)USBD_CONFIGURATION_FS_STRING, USBD_StrDesc, length);
+  }
+  assert(*length < USB_MAX_STR_DESC_SIZ);
+  return USBD_StrDesc;  
+}
+
+
+/**
+* @brief  USBD_USR_InterfaceStrDescriptor 
+*         return the interface string descriptor
+* @param  speed : current device speed
+* @param  length : pointer to data length variable
+* @retval pointer to descriptor buffer
+*/
+uint8_t *  USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length)
+{
+  if(speed == 0)
+  {
+    USBD_GetString ((uint8_t*)USBD_INTERFACE_HS_STRING, USBD_StrDesc, length);
+  }
+  else
+  {
+    USBD_GetString ((uint8_t*)USBD_INTERFACE_FS_STRING, USBD_StrDesc, length);
+  }
+  assert(*length < USB_MAX_STR_DESC_SIZ);
+  return USBD_StrDesc;  
+}
+
+/**
+  * @}
+  */ 
+
+
+/**
+  * @}
+  */ 
+
+
+/**
+  * @}
+  */ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_conf/usbd_desc.h b/codec2/tags/0.4/stm32/usb_conf/usbd_desc.h
new file mode 100644 (file)
index 0000000..ed999dc
--- /dev/null
@@ -0,0 +1,114 @@
+/**
+  ******************************************************************************
+  * @file    usbd_desc.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    19-September-2011
+  * @brief   header file for the usbd_desc.c file
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __USB_DESC_H
+#define __USB_DESC_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_def.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+  
+/** @defgroup USB_DESC
+  * @brief general defines for the usb device library file
+  * @{
+  */ 
+
+/** @defgroup USB_DESC_Exported_Defines
+  * @{
+  */
+#define USB_DEVICE_DESCRIPTOR_TYPE              0x01
+#define USB_CONFIGURATION_DESCRIPTOR_TYPE       0x02
+#define USB_STRING_DESCRIPTOR_TYPE              0x03
+#define USB_INTERFACE_DESCRIPTOR_TYPE           0x04
+#define USB_ENDPOINT_DESCRIPTOR_TYPE            0x05
+#define USB_SIZ_DEVICE_DESC                     18
+#define USB_SIZ_STRING_LANGID                   4
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DESC_Exported_TypesDefinitions
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_DESC_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_DESC_Exported_Variables
+  * @{
+  */ 
+extern  uint8_t USBD_DeviceDesc  [USB_SIZ_DEVICE_DESC];
+extern  uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ];
+extern  uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; 
+extern  uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC];
+extern  uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID];
+extern  USBD_DEVICE USR_desc; 
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_DESC_Exported_FunctionsPrototype
+  * @{
+  */ 
+
+
+uint8_t *     USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length);
+uint8_t *     USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length);
+uint8_t *     USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length);
+uint8_t *     USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length);
+uint8_t *     USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length);
+uint8_t *     USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length);
+uint8_t *     USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length);
+
+#ifdef USB_SUPPORT_USER_STRING_DESC
+uint8_t *     USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length);  
+#endif /* USB_SUPPORT_USER_STRING_DESC */  
+  
+/**
+  * @}
+  */ 
+
+#endif /* __USBD_DESC_H */
+
+/**
+  * @}
+  */ 
+
+/**
+* @}
+*/ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_conf/usbd_usr.c b/codec2/tags/0.4/stm32/usb_conf/usbd_usr.c
new file mode 100644 (file)
index 0000000..395400d
--- /dev/null
@@ -0,0 +1,126 @@
+/**
+  ******************************************************************************
+  * @file    usbd_usr.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    19-September-2011
+  * @brief   This file includes the user application layer
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+#include "usbd_usr.h"
+#include "usbd_ioreq.h"
+
+USBD_Usr_cb_TypeDef USR_cb =
+{
+  USBD_USR_Init,
+  USBD_USR_DeviceReset,
+  USBD_USR_DeviceConfigured,
+  USBD_USR_DeviceSuspended,
+  USBD_USR_DeviceResumed,
+  
+  USBD_USR_DeviceConnected,
+  USBD_USR_DeviceDisconnected,
+};
+
+
+/**
+* @brief  USBD_USR_Init 
+*         Displays the message on LCD for host lib initialization
+* @param  None
+* @retval None
+*/
+void USBD_USR_Init(void)
+{   
+
+}
+
+/**
+* @brief  USBD_USR_DeviceReset 
+*         Displays the message on LCD on device Reset Event
+* @param  speed : device speed
+* @retval None
+*/
+void USBD_USR_DeviceReset(uint8_t speed )
+{
+ switch (speed)
+ {
+   case USB_OTG_SPEED_HIGH: 
+     break;
+
+  case USB_OTG_SPEED_FULL: 
+     break;
+ default:
+     break;
+     
+ }
+}
+
+
+/**
+* @brief  USBD_USR_DeviceConfigured
+*         Displays the message on LCD on device configuration Event
+* @param  None
+* @retval Staus
+*/
+void USBD_USR_DeviceConfigured (void)
+{
+}
+
+
+/**
+* @brief  USBD_USR_DeviceConnected
+*         Displays the message on LCD on device connection Event
+* @param  None
+* @retval Staus
+*/
+void USBD_USR_DeviceConnected (void)
+{
+}
+
+
+/**
+* @brief  USBD_USR_DeviceDisonnected
+*         Displays the message on LCD on device disconnection Event
+* @param  None
+* @retval Staus
+*/
+void USBD_USR_DeviceDisconnected (void)
+{
+}
+
+/**
+* @brief  USBD_USR_DeviceSuspended 
+*         Displays the message on LCD on device suspend Event
+* @param  None
+* @retval None
+*/
+void USBD_USR_DeviceSuspended(void)
+{
+  /* Users can do their application actions here for the USB-Reset */
+}
+
+
+/**
+* @brief  USBD_USR_DeviceResumed 
+*         Displays the message on LCD on device resume Event
+* @param  None
+* @retval None
+*/
+void USBD_USR_DeviceResumed(void)
+{
+  /* Users can do their application actions here for the USB-Reset */
+}
+
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_core.c b/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_core.c
new file mode 100644 (file)
index 0000000..8d1f15d
--- /dev/null
@@ -0,0 +1,811 @@
+/**
+  ******************************************************************************
+  * @file    usbd_cdc_core.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   This file provides the high layer firmware functions to manage the 
+  *          following functionalities of the USB CDC Class:
+  *           - Initialization and Configuration of high and low layer
+  *           - Enumeration as CDC Device (and enumeration for each implemented memory interface)
+  *           - OUT/IN data transfer
+  *           - Command IN transfer (class requests management)
+  *           - Error management
+  *           
+  *  @verbatim
+  *      
+  *          ===================================================================      
+  *                                CDC Class Driver Description
+  *          =================================================================== 
+  *           This driver manages the "Universal Serial Bus Class Definitions for Communications Devices
+  *           Revision 1.2 November 16, 2007" and the sub-protocol specification of "Universal Serial Bus 
+  *           Communications Class Subclass Specification for PSTN Devices Revision 1.2 February 9, 2007"
+  *           This driver implements the following aspects of the specification:
+  *             - Device descriptor management
+  *             - Configuration descriptor management
+  *             - Enumeration as CDC device with 2 data endpoints (IN and OUT) and 1 command endpoint (IN)
+  *             - Requests management (as described in section 6.2 in specification)
+  *             - Abstract Control Model compliant
+  *             - Union Functional collection (using 1 IN endpoint for control)
+  *             - Data interface class
+
+  *           @note
+  *             For the Abstract Control Model, this core allows only transmitting the requests to
+  *             lower layer dispatcher (ie. usbd_cdc_vcp.c/.h) which should manage each request and
+  *             perform relative actions.
+  * 
+  *           These aspects may be enriched or modified for a specific user application.
+  *          
+  *            This driver doesn't implement the following aspects of the specification 
+  *            (but it is possible to manage these features with some modifications on this driver):
+  *             - Any class-specific aspect relative to communication classes should be managed by user application.
+  *             - All communication classes other than PSTN are not managed
+  *      
+  *  @endverbatim
+  *                                  
+  ******************************************************************************               
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_cdc_core.h"
+#include "usbd_desc.h"
+#include "usbd_req.h"
+
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+
+
+/** @defgroup usbd_cdc 
+  * @brief usbd core module
+  * @{
+  */ 
+
+/** @defgroup usbd_cdc_Private_TypesDefinitions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup usbd_cdc_Private_Defines
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup usbd_cdc_Private_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup usbd_cdc_Private_FunctionPrototypes
+  * @{
+  */
+
+/*********************************************
+   CDC Device library callbacks
+ *********************************************/
+static uint8_t  usbd_cdc_Init        (void  *pdev, uint8_t cfgidx);
+static uint8_t  usbd_cdc_DeInit      (void  *pdev, uint8_t cfgidx);
+static uint8_t  usbd_cdc_Setup       (void  *pdev, USB_SETUP_REQ *req);
+static uint8_t  usbd_cdc_EP0_RxReady  (void *pdev);
+static uint8_t  usbd_cdc_DataIn      (void *pdev, uint8_t epnum);
+static uint8_t  usbd_cdc_DataOut     (void *pdev, uint8_t epnum);
+static uint8_t  usbd_cdc_SOF         (void *pdev);
+
+/*********************************************
+   CDC specific management functions
+ *********************************************/
+static void Handle_USBAsynchXfer  (void *pdev);
+static uint8_t  *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length);
+#ifdef USE_USB_OTG_HS  
+static uint8_t  *USBD_cdc_GetOtherCfgDesc (uint8_t speed, uint16_t *length);
+#endif
+/**
+  * @}
+  */ 
+
+/** @defgroup usbd_cdc_Private_Variables
+  * @{
+  */ 
+extern CDC_IF_Prop_TypeDef  APP_FOPS;
+extern uint8_t USBD_DeviceDesc   [USB_SIZ_DEVICE_DESC];
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint8_t usbd_cdc_CfgDesc  [USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END ;
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint8_t usbd_cdc_OtherCfgDesc  [USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END ;
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN static __IO uint32_t  usbd_cdc_AltSet  __ALIGN_END = 0;
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint8_t USB_Rx_Buffer   [CDC_DATA_MAX_PACKET_SIZE] __ALIGN_END ;
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint8_t APP_Rx_Buffer   [APP_RX_DATA_SIZE] __ALIGN_END ; 
+
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint8_t CmdBuff[CDC_CMD_PACKET_SZE] __ALIGN_END ;
+
+uint32_t APP_Rx_ptr_in  = 0;
+uint32_t APP_Rx_ptr_out = 0;
+uint32_t APP_Rx_length  = 0;
+
+uint8_t  USB_Tx_State = 0;
+
+static uint32_t cdcCmd = 0xFF;
+static uint32_t cdcLen = 0;
+
+/* CDC interface class callbacks structure */
+USBD_Class_cb_TypeDef  USBD_CDC_cb = 
+{
+  usbd_cdc_Init,
+  usbd_cdc_DeInit,
+  usbd_cdc_Setup,
+  NULL,                 /* EP0_TxSent, */
+  usbd_cdc_EP0_RxReady,
+  usbd_cdc_DataIn,
+  usbd_cdc_DataOut,
+  usbd_cdc_SOF,
+  NULL,
+  NULL,     
+  USBD_cdc_GetCfgDesc,
+#ifdef USE_USB_OTG_HS   
+  USBD_cdc_GetOtherCfgDesc, /* use same cobfig as per FS */
+#endif /* USE_USB_OTG_HS  */
+};
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+/* USB CDC device Configuration Descriptor */
+__ALIGN_BEGIN uint8_t usbd_cdc_CfgDesc[USB_CDC_CONFIG_DESC_SIZ]  __ALIGN_END =
+{
+  /*Configuration Descriptor*/
+  0x09,   /* bLength: Configuration Descriptor size */
+  USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */
+  USB_CDC_CONFIG_DESC_SIZ,                /* wTotalLength:no of returned bytes */
+  0x00,
+  0x02,   /* bNumInterfaces: 2 interface */
+  0x01,   /* bConfigurationValue: Configuration value */
+  0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
+  0xC0,   /* bmAttributes: self powered */
+  0x32,   /* MaxPower 0 mA */
+  
+  /*---------------------------------------------------------------------------*/
+  
+  /*Interface Descriptor */
+  0x09,   /* bLength: Interface Descriptor size */
+  USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
+  /* Interface descriptor type */
+  0x00,   /* bInterfaceNumber: Number of Interface */
+  0x00,   /* bAlternateSetting: Alternate setting */
+  0x01,   /* bNumEndpoints: One endpoints used */
+  0x02,   /* bInterfaceClass: Communication Interface Class */
+  0x02,   /* bInterfaceSubClass: Abstract Control Model */
+  0x01,   /* bInterfaceProtocol: Common AT commands */
+  0x00,   /* iInterface: */
+  
+  /*Header Functional Descriptor*/
+  0x05,   /* bLength: Endpoint Descriptor size */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x00,   /* bDescriptorSubtype: Header Func Desc */
+  0x10,   /* bcdCDC: spec release number */
+  0x01,
+  
+  /*Call Management Functional Descriptor*/
+  0x05,   /* bFunctionLength */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x01,   /* bDescriptorSubtype: Call Management Func Desc */
+  0x00,   /* bmCapabilities: D0+D1 */
+  0x01,   /* bDataInterface: 1 */
+  
+  /*ACM Functional Descriptor*/
+  0x04,   /* bFunctionLength */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
+  0x02,   /* bmCapabilities */
+  
+  /*Union Functional Descriptor*/
+  0x05,   /* bFunctionLength */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x06,   /* bDescriptorSubtype: Union func desc */
+  0x00,   /* bMasterInterface: Communication class interface */
+  0x01,   /* bSlaveInterface0: Data Class Interface */
+  
+  /*Endpoint 2 Descriptor*/
+  0x07,                           /* bLength: Endpoint Descriptor size */
+  USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
+  CDC_CMD_EP,                     /* bEndpointAddress */
+  0x03,                           /* bmAttributes: Interrupt */
+  LOBYTE(CDC_CMD_PACKET_SZE),     /* wMaxPacketSize: */
+  HIBYTE(CDC_CMD_PACKET_SZE),
+#ifdef USE_USB_OTG_HS
+  0x10,                           /* bInterval: */
+#else
+  0xFF,                           /* bInterval: */
+#endif /* USE_USB_OTG_HS */
+  
+  /*---------------------------------------------------------------------------*/
+  
+  /*Data class interface descriptor*/
+  0x09,   /* bLength: Endpoint Descriptor size */
+  USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
+  0x01,   /* bInterfaceNumber: Number of Interface */
+  0x00,   /* bAlternateSetting: Alternate setting */
+  0x02,   /* bNumEndpoints: Two endpoints used */
+  0x0A,   /* bInterfaceClass: CDC */
+  0x00,   /* bInterfaceSubClass: */
+  0x00,   /* bInterfaceProtocol: */
+  0x00,   /* iInterface: */
+  
+  /*Endpoint OUT Descriptor*/
+  0x07,   /* bLength: Endpoint Descriptor size */
+  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */
+  CDC_OUT_EP,                        /* bEndpointAddress */
+  0x02,                              /* bmAttributes: Bulk */
+  LOBYTE(CDC_DATA_MAX_PACKET_SIZE),  /* wMaxPacketSize: */
+  HIBYTE(CDC_DATA_MAX_PACKET_SIZE),
+  0x00,                              /* bInterval: ignore for Bulk transfer */
+  
+  /*Endpoint IN Descriptor*/
+  0x07,   /* bLength: Endpoint Descriptor size */
+  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */
+  CDC_IN_EP,                         /* bEndpointAddress */
+  0x02,                              /* bmAttributes: Bulk */
+  LOBYTE(CDC_DATA_MAX_PACKET_SIZE),  /* wMaxPacketSize: */
+  HIBYTE(CDC_DATA_MAX_PACKET_SIZE),
+  0x00                               /* bInterval: ignore for Bulk transfer */
+} ;
+
+#ifdef USE_USB_OTG_HS
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ 
+__ALIGN_BEGIN uint8_t usbd_cdc_OtherCfgDesc[USB_CDC_CONFIG_DESC_SIZ]  __ALIGN_END =
+{ 
+  0x09,   /* bLength: Configuation Descriptor size */
+  USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION,   
+  USB_CDC_CONFIG_DESC_SIZ,
+  0x00,
+  0x02,   /* bNumInterfaces: 2 interfaces */
+  0x01,   /* bConfigurationValue: */
+  0x04,   /* iConfiguration: */
+  0xC0,   /* bmAttributes: */
+  0x32,   /* MaxPower 100 mA */  
+  
+  /*Interface Descriptor */
+  0x09,   /* bLength: Interface Descriptor size */
+  USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
+  /* Interface descriptor type */
+  0x00,   /* bInterfaceNumber: Number of Interface */
+  0x00,   /* bAlternateSetting: Alternate setting */
+  0x01,   /* bNumEndpoints: One endpoints used */
+  0x02,   /* bInterfaceClass: Communication Interface Class */
+  0x02,   /* bInterfaceSubClass: Abstract Control Model */
+  0x01,   /* bInterfaceProtocol: Common AT commands */
+  0x00,   /* iInterface: */
+  
+  /*Header Functional Descriptor*/
+  0x05,   /* bLength: Endpoint Descriptor size */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x00,   /* bDescriptorSubtype: Header Func Desc */
+  0x10,   /* bcdCDC: spec release number */
+  0x01,
+  
+  /*Call Management Functional Descriptor*/
+  0x05,   /* bFunctionLength */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x01,   /* bDescriptorSubtype: Call Management Func Desc */
+  0x00,   /* bmCapabilities: D0+D1 */
+  0x01,   /* bDataInterface: 1 */
+  
+  /*ACM Functional Descriptor*/
+  0x04,   /* bFunctionLength */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
+  0x02,   /* bmCapabilities */
+  
+  /*Union Functional Descriptor*/
+  0x05,   /* bFunctionLength */
+  0x24,   /* bDescriptorType: CS_INTERFACE */
+  0x06,   /* bDescriptorSubtype: Union func desc */
+  0x00,   /* bMasterInterface: Communication class interface */
+  0x01,   /* bSlaveInterface0: Data Class Interface */
+  
+  /*Endpoint 2 Descriptor*/
+  0x07,                           /* bLength: Endpoint Descriptor size */
+  USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
+  CDC_CMD_EP,                     /* bEndpointAddress */
+  0x03,                           /* bmAttributes: Interrupt */
+  LOBYTE(CDC_CMD_PACKET_SZE),     /* wMaxPacketSize: */
+  HIBYTE(CDC_CMD_PACKET_SZE),
+  0xFF,                           /* bInterval: */
+  
+  /*---------------------------------------------------------------------------*/
+  
+  /*Data class interface descriptor*/
+  0x09,   /* bLength: Endpoint Descriptor size */
+  USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
+  0x01,   /* bInterfaceNumber: Number of Interface */
+  0x00,   /* bAlternateSetting: Alternate setting */
+  0x02,   /* bNumEndpoints: Two endpoints used */
+  0x0A,   /* bInterfaceClass: CDC */
+  0x00,   /* bInterfaceSubClass: */
+  0x00,   /* bInterfaceProtocol: */
+  0x00,   /* iInterface: */
+  
+  /*Endpoint OUT Descriptor*/
+  0x07,   /* bLength: Endpoint Descriptor size */
+  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */
+  CDC_OUT_EP,                        /* bEndpointAddress */
+  0x02,                              /* bmAttributes: Bulk */
+  0x40,                              /* wMaxPacketSize: */
+  0x00,
+  0x00,                              /* bInterval: ignore for Bulk transfer */
+  
+  /*Endpoint IN Descriptor*/
+  0x07,   /* bLength: Endpoint Descriptor size */
+  USB_ENDPOINT_DESCRIPTOR_TYPE,     /* bDescriptorType: Endpoint */
+  CDC_IN_EP,                        /* bEndpointAddress */
+  0x02,                             /* bmAttributes: Bulk */
+  0x40,                             /* wMaxPacketSize: */
+  0x00,
+  0x00                              /* bInterval */
+};
+#endif /* USE_USB_OTG_HS  */
+
+/**
+  * @}
+  */ 
+
+/** @defgroup usbd_cdc_Private_Functions
+  * @{
+  */ 
+
+/**
+  * @brief  usbd_cdc_Init
+  *         Initilaize the CDC interface
+  * @param  pdev: device instance
+  * @param  cfgidx: Configuration index
+  * @retval status
+  */
+static uint8_t  usbd_cdc_Init (void  *pdev, 
+                               uint8_t cfgidx)
+{
+  uint8_t *pbuf;
+
+  /* Open EP IN */
+  DCD_EP_Open(pdev,
+              CDC_IN_EP,
+              CDC_DATA_IN_PACKET_SIZE,
+              USB_OTG_EP_BULK);
+  
+  /* Open EP OUT */
+  DCD_EP_Open(pdev,
+              CDC_OUT_EP,
+              CDC_DATA_OUT_PACKET_SIZE,
+              USB_OTG_EP_BULK);
+  
+  /* Open Command IN EP */
+  DCD_EP_Open(pdev,
+              CDC_CMD_EP,
+              CDC_CMD_PACKET_SZE,
+              USB_OTG_EP_INT);
+  
+  pbuf = (uint8_t *)USBD_DeviceDesc;
+  pbuf[4] = DEVICE_CLASS_CDC;
+  pbuf[5] = DEVICE_SUBCLASS_CDC;
+  
+  /* Initialize the Interface physical components */
+  APP_FOPS.pIf_Init();
+
+  /* Prepare Out endpoint to receive next packet */
+  DCD_EP_PrepareRx(pdev,
+                   CDC_OUT_EP,
+                   (uint8_t*)(USB_Rx_Buffer),
+                   CDC_DATA_OUT_PACKET_SIZE);
+  
+  return USBD_OK;
+}
+
+/**
+  * @brief  usbd_cdc_Init
+  *         DeInitialize the CDC layer
+  * @param  pdev: device instance
+  * @param  cfgidx: Configuration index
+  * @retval status
+  */
+static uint8_t  usbd_cdc_DeInit (void  *pdev, 
+                                 uint8_t cfgidx)
+{
+  /* Open EP IN */
+  DCD_EP_Close(pdev,
+              CDC_IN_EP);
+  
+  /* Open EP OUT */
+  DCD_EP_Close(pdev,
+              CDC_OUT_EP);
+  
+  /* Open Command IN EP */
+  DCD_EP_Close(pdev,
+              CDC_CMD_EP);
+
+  /* Restore default state of the Interface physical components */
+  APP_FOPS.pIf_DeInit();
+  
+  return USBD_OK;
+}
+
+/**
+  * @brief  usbd_cdc_Setup
+  *         Handle the CDC specific requests
+  * @param  pdev: instance
+  * @param  req: usb requests
+  * @retval status
+  */
+static uint8_t  usbd_cdc_Setup (void  *pdev, 
+                                USB_SETUP_REQ *req)
+{
+  uint16_t len;
+  uint8_t  *pbuf;
+  
+  switch (req->bmRequest & USB_REQ_TYPE_MASK)
+  {
+    /* CDC Class Requests -------------------------------*/
+  case USB_REQ_TYPE_CLASS :
+      /* Check if the request is a data setup packet */
+      if (req->wLength)
+      {
+        /* Check if the request is Device-to-Host */
+        if (req->bmRequest & 0x80)
+        {
+          /* Get the data to be sent to Host from interface layer */
+          APP_FOPS.pIf_Ctrl(req->bRequest, CmdBuff, req->wLength);
+          
+          /* Send the data to the host */
+          USBD_CtlSendData (pdev, 
+                            CmdBuff,
+                            req->wLength);          
+        }
+        else /* Host-to-Device requeset */
+        {
+          /* Set the value of the current command to be processed */
+          cdcCmd = req->bRequest;
+          cdcLen = req->wLength;
+          
+          /* Prepare the reception of the buffer over EP0
+          Next step: the received data will be managed in usbd_cdc_EP0_TxSent() 
+          function. */
+          USBD_CtlPrepareRx (pdev,
+                             CmdBuff,
+                             req->wLength);          
+        }
+      }
+      else /* No Data request */
+      {
+        /* Transfer the command to the interface layer */
+        APP_FOPS.pIf_Ctrl(req->bRequest, NULL, 0);
+      }
+      
+      return USBD_OK;
+      
+    default:
+      USBD_CtlError (pdev, req);
+      return USBD_FAIL;
+    
+      
+      
+    /* Standard Requests -------------------------------*/
+  case USB_REQ_TYPE_STANDARD:
+    switch (req->bRequest)
+    {
+    case USB_REQ_GET_DESCRIPTOR: 
+      if( (req->wValue >> 8) == CDC_DESCRIPTOR_TYPE)
+      {
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+        pbuf = usbd_cdc_Desc;   
+#else
+        pbuf = usbd_cdc_CfgDesc + 9 + (9 * USBD_ITF_MAX_NUM);
+#endif 
+        len = MIN(USB_CDC_DESC_SIZ , req->wLength);
+      }
+      
+      USBD_CtlSendData (pdev, 
+                        pbuf,
+                        len);
+      break;
+      
+    case USB_REQ_GET_INTERFACE :
+      USBD_CtlSendData (pdev,
+                        (uint8_t *)&usbd_cdc_AltSet,
+                        1);
+      break;
+      
+    case USB_REQ_SET_INTERFACE :
+      if ((uint8_t)(req->wValue) < USBD_ITF_MAX_NUM)
+      {
+        usbd_cdc_AltSet = (uint8_t)(req->wValue);
+      }
+      else
+      {
+        /* Call the error management function (command will be nacked */
+        USBD_CtlError (pdev, req);
+      }
+      break;
+    }
+  }
+  return USBD_OK;
+}
+
+/**
+  * @brief  usbd_cdc_EP0_RxReady
+  *         Data received on control endpoint
+  * @param  pdev: device device instance
+  * @retval status
+  */
+static uint8_t  usbd_cdc_EP0_RxReady (void  *pdev)
+{ 
+  if (cdcCmd != NO_CMD)
+  {
+    /* Process the data */
+    APP_FOPS.pIf_Ctrl(cdcCmd, CmdBuff, cdcLen);
+    
+    /* Reset the command variable to default value */
+    cdcCmd = NO_CMD;
+  }
+  
+  return USBD_OK;
+}
+
+/**
+  * @brief  usbd_audio_DataIn
+  *         Data sent on non-control IN endpoint
+  * @param  pdev: device instance
+  * @param  epnum: endpoint number
+  * @retval status
+  */
+static uint8_t  usbd_cdc_DataIn (void *pdev, uint8_t epnum)
+{
+  uint16_t USB_Tx_ptr;
+  uint16_t USB_Tx_length;
+
+  if (USB_Tx_State == 1)
+  {
+    if (APP_Rx_length == 0) 
+    {
+      USB_Tx_State = 0;
+    }
+    else 
+    {
+      if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE){
+        USB_Tx_ptr = APP_Rx_ptr_out;
+        USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
+        
+        APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;
+        APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;    
+      }
+      else 
+      {
+        USB_Tx_ptr = APP_Rx_ptr_out;
+        USB_Tx_length = APP_Rx_length;
+        
+        APP_Rx_ptr_out += APP_Rx_length;
+        APP_Rx_length = 0;
+      }
+      
+      /* Prepare the available data buffer to be sent on IN endpoint */
+      DCD_EP_Tx (pdev,
+                 CDC_IN_EP,
+                 (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
+                 USB_Tx_length);
+    }
+  }  
+  
+  return USBD_OK;
+}
+
+/**
+  * @brief  usbd_audio_DataOut
+  *         Data received on non-control Out endpoint
+  * @param  pdev: device instance
+  * @param  epnum: endpoint number
+  * @retval status
+  */
+static uint8_t  usbd_cdc_DataOut (void *pdev, uint8_t epnum)
+{      
+  uint16_t USB_Rx_Cnt;
+  
+  /* Get the received data buffer and update the counter */
+  USB_Rx_Cnt = ((USB_OTG_CORE_HANDLE*)pdev)->dev.out_ep[epnum].xfer_count;
+  
+  /* USB data will be immediately processed, this allow next USB traffic being 
+     NAKed till the end of the application Xfer */
+  APP_FOPS.pIf_DataRx(USB_Rx_Buffer, USB_Rx_Cnt);
+  
+  /* Prepare Out endpoint to receive next packet */
+  DCD_EP_PrepareRx(pdev,
+                   CDC_OUT_EP,
+                   (uint8_t*)(USB_Rx_Buffer),
+                   CDC_DATA_OUT_PACKET_SIZE);
+
+  return USBD_OK;
+}
+
+/**
+  * @brief  usbd_audio_SOF
+  *         Start Of Frame event management
+  * @param  pdev: instance
+  * @param  epnum: endpoint number
+  * @retval status
+  */
+static uint8_t  usbd_cdc_SOF (void *pdev)
+{      
+  static uint32_t FrameCount = 0;
+  
+  if (FrameCount++ == CDC_IN_FRAME_INTERVAL)
+  {
+    /* Reset the frame counter */
+    FrameCount = 0;
+    
+    /* Check the data to be sent through IN pipe */
+    Handle_USBAsynchXfer(pdev);
+  }
+  
+  return USBD_OK;
+}
+
+/**
+  * @brief  Handle_USBAsynchXfer
+  *         Send data to USB
+  * @param  pdev: instance
+  * @retval None
+  */
+static void Handle_USBAsynchXfer (void *pdev)
+{
+  uint16_t USB_Tx_ptr;
+  uint16_t USB_Tx_length;
+  
+  if(USB_Tx_State != 1)
+  {
+    if (APP_Rx_ptr_out == APP_RX_DATA_SIZE)
+    {
+      APP_Rx_ptr_out = 0;
+    }
+    
+    if(APP_Rx_ptr_out == APP_Rx_ptr_in) 
+    {
+      USB_Tx_State = 0; 
+      return;
+    }
+    
+    if(APP_Rx_ptr_out > APP_Rx_ptr_in) /* rollback */
+    { 
+      APP_Rx_length = APP_RX_DATA_SIZE - APP_Rx_ptr_out;
+    
+    }
+    else 
+    {
+      APP_Rx_length = APP_Rx_ptr_in - APP_Rx_ptr_out;
+     
+    }
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+     APP_Rx_length &= ~0x03;
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+    
+    if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE)
+    {
+      USB_Tx_ptr = APP_Rx_ptr_out;
+      USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
+      
+      APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;       
+      APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;
+    }
+    else
+    {
+      USB_Tx_ptr = APP_Rx_ptr_out;
+      USB_Tx_length = APP_Rx_length;
+      
+      APP_Rx_ptr_out += APP_Rx_length;
+      APP_Rx_length = 0;
+    }
+    USB_Tx_State = 1; 
+
+    DCD_EP_Tx (pdev,
+               CDC_IN_EP,
+               (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
+               USB_Tx_length);
+  }  
+  
+}
+
+/**
+  * @brief  USBD_cdc_GetCfgDesc 
+  *         Return configuration descriptor
+  * @param  speed : current device speed
+  * @param  length : pointer data length
+  * @retval pointer to descriptor buffer
+  */
+static uint8_t  *USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length)
+{
+  *length = sizeof (usbd_cdc_CfgDesc);
+  return usbd_cdc_CfgDesc;
+}
+
+/**
+  * @brief  USBD_cdc_GetCfgDesc 
+  *         Return configuration descriptor
+  * @param  speed : current device speed
+  * @param  length : pointer data length
+  * @retval pointer to descriptor buffer
+  */
+#ifdef USE_USB_OTG_HS 
+static uint8_t  *USBD_cdc_GetOtherCfgDesc (uint8_t speed, uint16_t *length)
+{
+  *length = sizeof (usbd_cdc_OtherCfgDesc);
+  return usbd_cdc_OtherCfgDesc;
+}
+#endif
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_core.h b/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_core.h
new file mode 100644 (file)
index 0000000..926f42e
--- /dev/null
@@ -0,0 +1,137 @@
+/**
+  ******************************************************************************
+  * @file    usbd_cdc_core.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   header file for the usbd_cdc_core.c file.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+
+#ifndef __USB_CDC_CORE_H_
+#define __USB_CDC_CORE_H_
+
+#include  "usbd_ioreq.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+  
+/** @defgroup usbd_cdc
+  * @brief This file is the Header file for USBD_cdc.c
+  * @{
+  */ 
+
+
+/** @defgroup usbd_cdc_Exported_Defines
+  * @{
+  */ 
+#define USB_CDC_CONFIG_DESC_SIZ                (67)
+#define USB_CDC_DESC_SIZ                       (67-9)
+
+#define CDC_DESCRIPTOR_TYPE                     0x21
+
+#define DEVICE_CLASS_CDC                        0x02
+#define DEVICE_SUBCLASS_CDC                     0x00
+
+
+#define USB_DEVICE_DESCRIPTOR_TYPE              0x01
+#define USB_CONFIGURATION_DESCRIPTOR_TYPE       0x02
+#define USB_STRING_DESCRIPTOR_TYPE              0x03
+#define USB_INTERFACE_DESCRIPTOR_TYPE           0x04
+#define USB_ENDPOINT_DESCRIPTOR_TYPE            0x05
+
+#define STANDARD_ENDPOINT_DESC_SIZE             0x09
+
+#define CDC_DATA_IN_PACKET_SIZE                 *(uint16_t *)(((USB_OTG_CORE_HANDLE *)pdev)->dev.pConfig_descriptor + 57)
+        
+#define CDC_DATA_OUT_PACKET_SIZE                *(uint16_t *)(((USB_OTG_CORE_HANDLE *)pdev)->dev.pConfig_descriptor + 64)
+
+/*---------------------------------------------------------------------*/
+/*  CDC definitions                                                    */
+/*---------------------------------------------------------------------*/
+
+/**************************************************/
+/* CDC Requests                                   */
+/**************************************************/
+#define SEND_ENCAPSULATED_COMMAND               0x00
+#define GET_ENCAPSULATED_RESPONSE               0x01
+#define SET_COMM_FEATURE                        0x02
+#define GET_COMM_FEATURE                        0x03
+#define CLEAR_COMM_FEATURE                      0x04
+#define SET_LINE_CODING                         0x20
+#define GET_LINE_CODING                         0x21
+#define SET_CONTROL_LINE_STATE                  0x22
+#define SEND_BREAK                              0x23
+#define NO_CMD                                  0xFF
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_CORE_Exported_TypesDefinitions
+  * @{
+  */
+typedef struct _CDC_IF_PROP
+{
+  uint16_t (*pIf_Init)     (void);   
+  uint16_t (*pIf_DeInit)   (void);   
+  uint16_t (*pIf_Ctrl)     (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
+  uint16_t (*pIf_DataTx)   (uint8_t* Buf, uint32_t Len);
+  uint16_t (*pIf_DataRx)   (uint8_t* Buf, uint32_t Len);
+}
+CDC_IF_Prop_TypeDef;
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_CORE_Exported_Macros
+  * @{
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_CORE_Exported_Variables
+  * @{
+  */ 
+
+extern USBD_Class_cb_TypeDef  USBD_CDC_cb;
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CORE_Exported_Functions
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+#endif  // __USB_CDC_CORE_H_
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_vcp.c b/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_vcp.c
new file mode 100644 (file)
index 0000000..84ae648
--- /dev/null
@@ -0,0 +1,280 @@
+/**
+ ******************************************************************************
+ * @file    usbd_cdc_vcp.c
+ * @author  MCD Application Team
+ * @version V1.0.0
+ * @date    22-July-2011
+ * @brief   Generic media access Layer.
+ ******************************************************************************
+ * @attention
+ *
+ * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+ * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+ * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+ * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+ * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+ * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+ *
+ * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+ ******************************************************************************
+ */
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 
+#pragma     data_alignment = 4 
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_cdc_vcp.h"
+#include "stm32f4xx_conf.h"
+#include "stm32f4xx_usart.h"
+
+/* Private variables ---------------------------------------------------------*/
+LINE_CODING linecoding = {
+               115200, /* baud rate*/
+               0x00, /* stop bits-1*/
+               0x00, /* parity - none*/
+               0x08 /* nb. of bits 8*/
+};
+
+USART_InitTypeDef USART_InitStructure;
+
+/* These are external variables imported from CDC core to be used for IN 
+ transfer management. */
+extern uint8_t APP_Rx_Buffer[]; /* Write CDC received data in this buffer.
+ These data will be sent over USB IN endpoint
+ in the CDC core functions. */
+extern uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to
+ start address when writing received data
+ in the buffer APP_Rx_Buffer. */
+
+/* Private function prototypes -----------------------------------------------*/
+static uint16_t VCP_Init(void);
+static uint16_t VCP_DeInit(void);
+static uint16_t VCP_Ctrl(uint32_t Cmd, uint8_t* Buf, uint32_t Len);
+static uint16_t VCP_DataTx(uint8_t* Buf, uint32_t Len);
+static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len);
+
+CDC_IF_Prop_TypeDef VCP_fops = { VCP_Init, VCP_DeInit, VCP_Ctrl, VCP_DataTx,
+               VCP_DataRx };
+
+/* Private functions ---------------------------------------------------------*/
+/**
+ * @brief  VCP_Init
+ *         Initializes the Media on the STM32
+ * @param  None
+ * @retval Result of the opeartion (USBD_OK in all cases)
+ */
+static uint16_t VCP_Init(void) {
+       return USBD_OK;
+}
+
+/**
+ * @brief  VCP_DeInit
+ *         DeInitializes the Media on the STM32
+ * @param  None
+ * @retval Result of the opeartion (USBD_OK in all cases)
+ */
+static uint16_t VCP_DeInit(void) {
+       return USBD_OK;
+}
+
+/**
+ * @brief  VCP_Ctrl
+ *         Manage the CDC class requests
+ * @param  Cmd: Command code
+ * @param  Buf: Buffer containing command data (request parameters)
+ * @param  Len: Number of data to be sent (in bytes)
+ * @retval Result of the opeartion (USBD_OK in all cases)
+ */
+static uint16_t VCP_Ctrl(uint32_t Cmd, uint8_t* Buf, uint32_t Len) {
+       switch (Cmd) {
+       case SEND_ENCAPSULATED_COMMAND:
+               /* Not  needed for this driver */
+               break;
+
+       case GET_ENCAPSULATED_RESPONSE:
+               /* Not  needed for this driver */
+               break;
+
+       case SET_COMM_FEATURE:
+               /* Not  needed for this driver */
+               break;
+
+       case GET_COMM_FEATURE:
+               /* Not  needed for this driver */
+               break;
+
+       case CLEAR_COMM_FEATURE:
+               /* Not  needed for this driver */
+               break;
+
+       case SET_LINE_CODING:
+               /* Not  needed for this driver */
+               break;
+
+       case GET_LINE_CODING:
+               Buf[0] = (uint8_t) (linecoding.bitrate);
+               Buf[1] = (uint8_t) (linecoding.bitrate >> 8);
+               Buf[2] = (uint8_t) (linecoding.bitrate >> 16);
+               Buf[3] = (uint8_t) (linecoding.bitrate >> 24);
+               Buf[4] = linecoding.format;
+               Buf[5] = linecoding.paritytype;
+               Buf[6] = linecoding.datatype;
+               break;
+
+       case SET_CONTROL_LINE_STATE:
+               /* Not  needed for this driver */
+               break;
+
+       case SEND_BREAK:
+               /* Not  needed for this driver */
+               break;
+
+       default:
+               break;
+       }
+
+       return USBD_OK;
+}
+
+/**
+ * @brief  putchar
+ *         Sends one char over the USB serial link.
+ * @param  buf: char to be sent
+ * @retval none
+ */
+
+void VCP_put_char(uint8_t buf) {
+       VCP_DataTx(&buf, 1);
+}
+
+void VCP_send_str(uint8_t* buf) {
+       uint32_t i = 0;
+       while (*(buf + i)) {
+               i++;
+       }
+       VCP_DataTx(buf, i);
+}
+
+void VCP_send_buffer(uint8_t* buf, int len) {
+       VCP_DataTx(buf, len);
+}
+
+/**
+ * @brief  VCP_DataTx
+ *         CDC received data to be send over USB IN endpoint are managed in
+ *         this function.
+ * @param  Buf: Buffer of data to be sent
+ * @param  Len: Number of data to be sent (in bytes)
+ * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
+ */
+static uint16_t VCP_DataTx(uint8_t* Buf, uint32_t Len) {
+       uint32_t i = 0;
+       while (i < Len) {
+               APP_Rx_Buffer[APP_Rx_ptr_in] = *(Buf + i);
+               APP_Rx_ptr_in++;
+               i++;
+               /* To avoid buffer overflow */
+               if (APP_Rx_ptr_in == APP_RX_DATA_SIZE) {
+                       APP_Rx_ptr_in = 0;
+               }
+       }
+
+       return USBD_OK;
+}
+
+/**
+ * @brief  VCP_DataRx
+ *         Data received over USB OUT endpoint are sent over CDC interface
+ *         through this function.
+ *
+ *         @note
+ *         This function will block any OUT packet reception on USB endpoint
+ *         until exiting this function. If you exit this function before transfer
+ *         is complete on CDC interface (ie. using DMA controller) it will result
+ *         in receiving more data while previous ones are still not sent.
+ *
+ * @param  Buf: Buffer of data to be received
+ * @param  Len: Number of data received (in bytes)
+ * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
+ */
+
+#define APP_TX_BUF_SIZE 128
+uint8_t APP_Tx_Buffer[APP_TX_BUF_SIZE];
+uint32_t APP_tx_ptr_head;
+uint32_t APP_tx_ptr_tail;
+
+static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len) {
+       uint32_t i;
+
+       for (i = 0; i < Len; i++) {
+               APP_Tx_Buffer[APP_tx_ptr_head] = *(Buf + i);
+               APP_tx_ptr_head++;
+               if (APP_tx_ptr_head == APP_TX_BUF_SIZE)
+                       APP_tx_ptr_head = 0;
+
+               if (APP_tx_ptr_head == APP_tx_ptr_tail)
+                       return USBD_FAIL;
+       }
+
+       return USBD_OK;
+}
+
+int VCP_get_char(uint8_t *buf) {
+       if (APP_tx_ptr_head == APP_tx_ptr_tail)
+               return 0;
+
+       *buf = APP_Tx_Buffer[APP_tx_ptr_tail];
+       APP_tx_ptr_tail++;
+       if (APP_tx_ptr_tail == APP_TX_BUF_SIZE)
+               APP_tx_ptr_tail = 0;
+
+       return 1;
+}
+
+int VCP_get_string(uint8_t *buf) {
+       if (APP_tx_ptr_head == APP_tx_ptr_tail)
+               return 0;
+
+       while (!APP_Tx_Buffer[APP_tx_ptr_tail]
+                       || APP_Tx_Buffer[APP_tx_ptr_tail] == '\n'
+                       || APP_Tx_Buffer[APP_tx_ptr_tail] == '\r') {
+               APP_tx_ptr_tail++;
+               if (APP_tx_ptr_tail == APP_TX_BUF_SIZE)
+                       APP_tx_ptr_tail = 0;
+               if (APP_tx_ptr_head == APP_tx_ptr_tail)
+                       return 0;
+       }
+
+       int i = 0;
+       do {
+               *(buf + i) = APP_Tx_Buffer[i + APP_tx_ptr_tail];
+               i++;
+
+               if ((APP_tx_ptr_tail + i) == APP_TX_BUF_SIZE)
+                       i = -APP_tx_ptr_tail;
+               if (APP_tx_ptr_head == (APP_tx_ptr_tail + i))
+                       return 0;
+
+       } while (APP_Tx_Buffer[APP_tx_ptr_tail + i]
+                       && APP_Tx_Buffer[APP_tx_ptr_tail + i] != '\n'
+                       && APP_Tx_Buffer[APP_tx_ptr_tail + i] != '\r');
+
+       *(buf + i) = 0;
+       APP_tx_ptr_tail += i;
+       if (APP_tx_ptr_tail >= APP_TX_BUF_SIZE)
+               APP_tx_ptr_tail -= APP_TX_BUF_SIZE;
+       return i;
+}
+
+/**
+ * @brief  EVAL_COM_IRQHandler
+ *
+ * @param  None.
+ * @retval None.
+ */
+void EVAL_COM_IRQHandler(void) {
+
+}
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_vcp.h b/codec2/tags/0.4/stm32/usb_lib/cdc/usbd_cdc_vcp.h
new file mode 100644 (file)
index 0000000..98c4d82
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+  ******************************************************************************
+  * @file    usbd_cdc_vcp.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   Header for usbd_cdc_vcp.c file.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_CDC_VCP_H
+#define __USBD_CDC_VCP_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f4xx_conf.h"
+
+#include "usbd_cdc_core.h"
+#include "usbd_conf.h"
+#include <stdint.h>
+
+/* Exported typef ------------------------------------------------------------*/
+/* The following structures groups all needed parameters to be configured for the 
+   ComPort. These parameters can modified on the fly by the host through CDC class
+   command class requests. */
+typedef struct
+{
+  uint32_t bitrate;
+  uint8_t  format;
+  uint8_t  paritytype;
+  uint8_t  datatype;
+}LINE_CODING;
+
+/* Exported constants --------------------------------------------------------*/
+/* The following define is used to route the USART IRQ handler to be used.
+   The IRQ handler function is implemented in the usbd_cdc_vcp.c file. */
+#ifdef USE_STM322xG_EVAL
+ #define EVAL_COM_IRQHandler            USART3_IRQHandler
+#elif defined(USE_STM3210C_EVAL)
+ #define EVAL_COM_IRQHandler            USART2_IRQHandler
+#endif /* USE_STM322xG_EVAL */
+
+void VCP_put_char(uint8_t buf);
+void VCP_send_str(uint8_t* buf);
+int VCP_get_char(uint8_t *buf);
+int VCP_get_string(uint8_t *buf);
+void VCP_send_buffer(uint8_t* buf, int len);
+
+#define DEFAULT_CONFIG                  0
+#define OTHER_CONFIG                    1
+
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+#endif /* __USBD_CDC_VCP_H */
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_core.c b/codec2/tags/0.4/stm32/usb_lib/core/usbd_core.c
new file mode 100644 (file)
index 0000000..2a51d3a
--- /dev/null
@@ -0,0 +1,476 @@
+/**
+  ******************************************************************************
+  * @file    usbd_core.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011 
+  * @brief   This file provides all the USBD core functions.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_core.h"
+#include "usbd_req.h"
+#include "usbd_ioreq.h"
+#include "usb_dcd_int.h"
+#include "usb_bsp.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+* @{
+*/
+
+
+/** @defgroup USBD_CORE 
+* @brief usbd core module
+* @{
+*/ 
+
+/** @defgroup USBD_CORE_Private_TypesDefinitions
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USBD_CORE_Private_Defines
+* @{
+*/ 
+
+/**
+* @}
+*/ 
+
+
+/** @defgroup USBD_CORE_Private_Macros
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+
+
+/** @defgroup USBD_CORE_Private_FunctionPrototypes
+* @{
+*/ 
+static uint8_t USBD_SetupStage(USB_OTG_CORE_HANDLE *pdev);
+static uint8_t USBD_DataOutStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
+static uint8_t USBD_DataInStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
+static uint8_t USBD_SOF(USB_OTG_CORE_HANDLE  *pdev);
+static uint8_t USBD_Reset(USB_OTG_CORE_HANDLE  *pdev);
+static uint8_t USBD_Suspend(USB_OTG_CORE_HANDLE  *pdev);
+static uint8_t USBD_Resume(USB_OTG_CORE_HANDLE  *pdev);
+#ifdef VBUS_SENSING_ENABLED
+static uint8_t USBD_DevConnected(USB_OTG_CORE_HANDLE  *pdev);
+static uint8_t USBD_DevDisconnected(USB_OTG_CORE_HANDLE  *pdev);
+#endif
+static uint8_t USBD_IsoINIncomplete(USB_OTG_CORE_HANDLE  *pdev);
+static uint8_t USBD_IsoOUTIncomplete(USB_OTG_CORE_HANDLE  *pdev);
+/**
+* @}
+*/ 
+
+/** @defgroup USBD_CORE_Private_Variables
+* @{
+*/ 
+
+
+
+USBD_DCD_INT_cb_TypeDef USBD_DCD_INT_cb = 
+{
+  USBD_DataOutStage,
+  USBD_DataInStage,
+  USBD_SetupStage,
+  USBD_SOF,
+  USBD_Reset,
+  USBD_Suspend,
+  USBD_Resume,
+  USBD_IsoINIncomplete,
+  USBD_IsoOUTIncomplete,
+#ifdef VBUS_SENSING_ENABLED
+USBD_DevConnected, 
+USBD_DevDisconnected,    
+#endif  
+};
+
+USBD_DCD_INT_cb_TypeDef  *USBD_DCD_INT_fops = &USBD_DCD_INT_cb;
+/**
+* @}
+*/ 
+
+/** @defgroup USBD_CORE_Private_Functions
+* @{
+*/ 
+
+/**
+* @brief  USBD_Init
+*         Initailizes the device stack and load the class driver
+* @param  pdev: device instance
+* @param  core_address: USB OTG core ID
+* @param  class_cb: Class callback structure address
+* @param  usr_cb: User callback structure address
+* @retval None
+*/
+void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
+               USB_OTG_CORE_ID_TypeDef coreID,
+               USBD_DEVICE *pDevice,                  
+               USBD_Class_cb_TypeDef *class_cb, 
+               USBD_Usr_cb_TypeDef *usr_cb)
+{
+  /* Hardware Init */
+  USB_OTG_BSP_Init(pdev);  
+  
+  USBD_DeInit(pdev);
+  
+  /*Register class and user callbacks */
+  pdev->dev.class_cb = class_cb;
+  pdev->dev.usr_cb = usr_cb;  
+  pdev->dev.usr_device = pDevice;    
+  
+  /* set USB OTG core params */
+  DCD_Init(pdev , coreID);
+  
+  /* Upon Init call usr callback */
+  pdev->dev.usr_cb->Init();
+  
+  /* Enable Interrupts */
+  USB_OTG_BSP_EnableInterrupt(pdev);
+}
+
+/**
+* @brief  USBD_DeInit 
+*         Re-Initialize th deviuce library
+* @param  pdev: device instance
+* @retval status: status
+*/
+USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev)
+{
+  /* Software Init */
+  
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_SetupStage 
+*         Handle the setup stage
+* @param  pdev: device instance
+* @retval status
+*/
+static uint8_t USBD_SetupStage(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_SETUP_REQ req;
+  
+  USBD_ParseSetupRequest(pdev , &req);
+  
+  switch (req.bmRequest & 0x1F) 
+  {
+  case USB_REQ_RECIPIENT_DEVICE:   
+    USBD_StdDevReq (pdev, &req);
+    break;
+    
+  case USB_REQ_RECIPIENT_INTERFACE:     
+    USBD_StdItfReq(pdev, &req);
+    break;
+    
+  case USB_REQ_RECIPIENT_ENDPOINT:        
+    USBD_StdEPReq(pdev, &req);   
+    break;
+    
+  default:           
+    DCD_EP_Stall(pdev , req.bmRequest & 0x80);
+    break;
+  }  
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_DataOutStage 
+*         Handle data out stage
+* @param  pdev: device instance
+* @param  epnum: endpoint index
+* @retval status
+*/
+static uint8_t USBD_DataOutStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
+{
+  USB_OTG_EP *ep;
+  
+  if(epnum == 0) 
+  {
+    ep = &pdev->dev.out_ep[0];
+    if ( pdev->dev.device_state == USB_OTG_EP0_DATA_OUT)
+    {
+      if(ep->rem_data_len > ep->maxpacket)
+      {
+        ep->rem_data_len -=  ep->maxpacket;
+        
+        if(pdev->cfg.dma_enable == 1)
+        {
+          /* in slave mode this, is handled by the RxSTSQLvl ISR */
+          ep->xfer_buff += ep->maxpacket; 
+        }        
+        USBD_CtlContinueRx (pdev, 
+                            ep->xfer_buff,
+                            MIN(ep->rem_data_len ,ep->maxpacket));
+      }
+      else
+      {
+        if((pdev->dev.class_cb->EP0_RxReady != NULL)&&
+           (pdev->dev.device_status == USB_OTG_CONFIGURED))
+        {
+          pdev->dev.class_cb->EP0_RxReady(pdev); 
+        }
+        USBD_CtlSendStatus(pdev);
+      }
+    }
+  }
+  else if((pdev->dev.class_cb->DataOut != NULL)&&
+          (pdev->dev.device_status == USB_OTG_CONFIGURED))
+  {
+    pdev->dev.class_cb->DataOut(pdev, epnum); 
+  }  
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_DataInStage 
+*         Handle data in stage
+* @param  pdev: device instance
+* @param  epnum: endpoint index
+* @retval status
+*/
+static uint8_t USBD_DataInStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
+{
+  USB_OTG_EP *ep;
+  
+  if(epnum == 0) 
+  {
+    ep = &pdev->dev.in_ep[0];
+    if ( pdev->dev.device_state == USB_OTG_EP0_DATA_IN)
+    {
+      if(ep->rem_data_len > ep->maxpacket)
+      {
+        ep->rem_data_len -=  ep->maxpacket;
+        if(pdev->cfg.dma_enable == 1)
+        {
+          /* in slave mode this, is handled by the TxFifoEmpty ISR */
+          ep->xfer_buff += ep->maxpacket;
+        }
+        USBD_CtlContinueSendData (pdev, 
+                                  ep->xfer_buff, 
+                                  ep->rem_data_len);
+      }
+      else
+      { /* last packet is MPS multiple, so send ZLP packet */
+        if((ep->total_data_len % ep->maxpacket == 0) &&
+           (ep->total_data_len >= ep->maxpacket) &&
+             (ep->total_data_len < ep->ctl_data_len ))
+        {
+          
+          USBD_CtlContinueSendData(pdev , NULL, 0);
+          ep->ctl_data_len = 0;
+        }
+        else
+        {
+          if((pdev->dev.class_cb->EP0_TxSent != NULL)&&
+             (pdev->dev.device_status == USB_OTG_CONFIGURED))
+          {
+            pdev->dev.class_cb->EP0_TxSent(pdev); 
+          }          
+          USBD_CtlReceiveStatus(pdev);
+        }
+      }
+    }
+  }
+  else if((pdev->dev.class_cb->DataIn != NULL)&& 
+          (pdev->dev.device_status == USB_OTG_CONFIGURED))
+  {
+    pdev->dev.class_cb->DataIn(pdev, epnum); 
+  }  
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_Reset 
+*         Handle Reset event
+* @param  pdev: device instance
+* @retval status
+*/
+
+static uint8_t USBD_Reset(USB_OTG_CORE_HANDLE  *pdev)
+{
+  /* Open EP0 OUT */
+  DCD_EP_Open(pdev,
+              0x00,
+              USB_OTG_MAX_EP0_SIZE,
+              EP_TYPE_CTRL);
+  
+  /* Open EP0 IN */
+  DCD_EP_Open(pdev,
+              0x80,
+              USB_OTG_MAX_EP0_SIZE,
+              EP_TYPE_CTRL);
+  
+  /* Upon Reset call usr call back */
+  pdev->dev.device_status = USB_OTG_DEFAULT;
+  pdev->dev.usr_cb->DeviceReset(pdev->cfg.speed);
+  
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_Resume 
+*         Handle Resume event
+* @param  pdev: device instance
+* @retval status
+*/
+
+static uint8_t USBD_Resume(USB_OTG_CORE_HANDLE  *pdev)
+{
+  /* Upon Resume call usr call back */
+  pdev->dev.usr_cb->DeviceResumed(); 
+  pdev->dev.device_status = USB_OTG_CONFIGURED;  
+  return USBD_OK;
+}
+
+
+/**
+* @brief  USBD_Suspend 
+*         Handle Suspend event
+* @param  pdev: device instance
+* @retval status
+*/
+
+static uint8_t USBD_Suspend(USB_OTG_CORE_HANDLE  *pdev)
+{
+  
+  pdev->dev.device_status  = USB_OTG_SUSPENDED;
+  /* Upon Resume call usr call back */
+  pdev->dev.usr_cb->DeviceSuspended(); 
+  return USBD_OK;
+}
+
+
+/**
+* @brief  USBD_SOF 
+*         Handle SOF event
+* @param  pdev: device instance
+* @retval status
+*/
+
+static uint8_t USBD_SOF(USB_OTG_CORE_HANDLE  *pdev)
+{
+  if(pdev->dev.class_cb->SOF)
+  {
+    pdev->dev.class_cb->SOF(pdev); 
+  }
+  return USBD_OK;
+}
+/**
+* @brief  USBD_SetCfg 
+*        Configure device and start the interface
+* @param  pdev: device instance
+* @param  cfgidx: configuration index
+* @retval status
+*/
+
+USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE  *pdev, uint8_t cfgidx)
+{
+  pdev->dev.class_cb->Init(pdev, cfgidx); 
+  
+  /* Upon set config call usr call back */
+  pdev->dev.usr_cb->DeviceConfigured();
+  return USBD_OK; 
+}
+
+/**
+* @brief  USBD_ClrCfg 
+*         Clear current configuration
+* @param  pdev: device instance
+* @param  cfgidx: configuration index
+* @retval status: USBD_Status
+*/
+USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE  *pdev, uint8_t cfgidx)
+{
+  pdev->dev.class_cb->DeInit(pdev, cfgidx);   
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_IsoINIncomplete 
+*         Handle iso in incomplete event
+* @param  pdev: device instance
+* @retval status
+*/
+static uint8_t USBD_IsoINIncomplete(USB_OTG_CORE_HANDLE  *pdev)
+{
+  pdev->dev.class_cb->IsoINIncomplete(pdev);   
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_IsoOUTIncomplete 
+*         Handle iso out incomplete event
+* @param  pdev: device instance
+* @retval status
+*/
+static uint8_t USBD_IsoOUTIncomplete(USB_OTG_CORE_HANDLE  *pdev)
+{
+  pdev->dev.class_cb->IsoOUTIncomplete(pdev);   
+  return USBD_OK;
+}
+
+#ifdef VBUS_SENSING_ENABLED
+/**
+* @brief  USBD_DevConnected 
+*         Handle device connection event
+* @param  pdev: device instance
+* @retval status
+*/
+static uint8_t USBD_DevConnected(USB_OTG_CORE_HANDLE  *pdev)
+{
+  pdev->dev.usr_cb->DeviceConnected();
+  return USBD_OK;
+}
+
+/**
+* @brief  USBD_DevDisconnected 
+*         Handle device disconnection event
+* @param  pdev: device instance
+* @retval status
+*/
+static uint8_t USBD_DevDisconnected(USB_OTG_CORE_HANDLE  *pdev)
+{
+  pdev->dev.usr_cb->DeviceDisconnected();
+  pdev->dev.class_cb->DeInit(pdev, 0);
+  return USBD_OK;
+}
+#endif
+/**
+* @}
+*/ 
+
+
+/**
+* @}
+*/ 
+
+
+/**
+* @}
+*/ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_core.h b/codec2/tags/0.4/stm32/usb_lib/core/usbd_core.h
new file mode 100644 (file)
index 0000000..fb20acf
--- /dev/null
@@ -0,0 +1,114 @@
+/**
+  ******************************************************************************
+  * @file    usbd_core.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   Header file for usbd_core.c
+  ******************************************************************************
+  * @attention  
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_CORE_H
+#define __USBD_CORE_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_dcd.h"
+#include "usbd_def.h"
+#include "usbd_conf.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+  
+/** @defgroup USBD_CORE
+  * @brief This file is the Header file for usbd_core.c file
+  * @{
+  */ 
+
+
+/** @defgroup USBD_CORE_Exported_Defines
+  * @{
+  */ 
+
+typedef enum {
+  USBD_OK   = 0,
+  USBD_BUSY,
+  USBD_FAIL,
+}USBD_Status;
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_CORE_Exported_TypesDefinitions
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_CORE_Exported_Macros
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_CORE_Exported_Variables
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_CORE_Exported_FunctionsPrototype
+  * @{
+  */ 
+void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
+               USB_OTG_CORE_ID_TypeDef coreID, 
+               USBD_DEVICE *pDevice,                  
+               USBD_Class_cb_TypeDef *class_cb, 
+               USBD_Usr_cb_TypeDef *usr_cb);
+
+USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev);
+
+USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE  *pdev, uint8_t cfgidx);
+
+USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE  *pdev, uint8_t cfgidx);
+
+/**
+  * @}
+  */ 
+
+#endif /* __USBD_CORE_H */
+
+/**
+  * @}
+  */ 
+
+/**
+* @}
+*/ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
+
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_def.h b/codec2/tags/0.4/stm32/usb_lib/core/usbd_def.h
new file mode 100644 (file)
index 0000000..a8c8671
--- /dev/null
@@ -0,0 +1,149 @@
+/**
+  ******************************************************************************
+  * @file    usbd_def.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   general defines for the usb device library 
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __USBD_DEF_H
+#define __USBD_DEF_H
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_conf.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+  
+/** @defgroup USB_DEF
+  * @brief general defines for the usb device library file
+  * @{
+  */ 
+
+/** @defgroup USB_DEF_Exported_Defines
+  * @{
+  */ 
+
+#ifndef NULL
+#define NULL    0
+#endif
+
+#define  USB_LEN_DEV_QUALIFIER_DESC                     0x0A
+#define  USB_LEN_DEV_DESC                               0x12
+#define  USB_LEN_CFG_DESC                               0x09
+#define  USB_LEN_IF_DESC                                0x09
+#define  USB_LEN_EP_DESC                                0x07
+#define  USB_LEN_OTG_DESC                               0x03
+
+#define  USBD_IDX_LANGID_STR                            0x00 
+#define  USBD_IDX_MFC_STR                               0x01 
+#define  USBD_IDX_PRODUCT_STR                           0x02
+#define  USBD_IDX_SERIAL_STR                            0x03 
+#define  USBD_IDX_CONFIG_STR                            0x04 
+#define  USBD_IDX_INTERFACE_STR                         0x05 
+
+#define  USB_REQ_TYPE_STANDARD                          0x00
+#define  USB_REQ_TYPE_CLASS                             0x20
+#define  USB_REQ_TYPE_VENDOR                            0x40
+#define  USB_REQ_TYPE_MASK                              0x60
+
+#define  USB_REQ_RECIPIENT_DEVICE                       0x00
+#define  USB_REQ_RECIPIENT_INTERFACE                    0x01
+#define  USB_REQ_RECIPIENT_ENDPOINT                     0x02
+#define  USB_REQ_RECIPIENT_MASK                         0x03
+
+#define  USB_REQ_GET_STATUS                             0x00
+#define  USB_REQ_CLEAR_FEATURE                          0x01
+#define  USB_REQ_SET_FEATURE                            0x03
+#define  USB_REQ_SET_ADDRESS                            0x05
+#define  USB_REQ_GET_DESCRIPTOR                         0x06
+#define  USB_REQ_SET_DESCRIPTOR                         0x07
+#define  USB_REQ_GET_CONFIGURATION                      0x08
+#define  USB_REQ_SET_CONFIGURATION                      0x09
+#define  USB_REQ_GET_INTERFACE                          0x0A
+#define  USB_REQ_SET_INTERFACE                          0x0B
+#define  USB_REQ_SYNCH_FRAME                            0x0C
+
+#define  USB_DESC_TYPE_DEVICE                              1
+#define  USB_DESC_TYPE_CONFIGURATION                       2
+#define  USB_DESC_TYPE_STRING                              3
+#define  USB_DESC_TYPE_INTERFACE                           4
+#define  USB_DESC_TYPE_ENDPOINT                            5
+#define  USB_DESC_TYPE_DEVICE_QUALIFIER                    6
+#define  USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION           7
+
+
+#define USB_CONFIG_REMOTE_WAKEUP                           2
+#define USB_CONFIG_SELF_POWERED                            1
+
+#define USB_FEATURE_EP_HALT                                0
+#define USB_FEATURE_REMOTE_WAKEUP                          1
+#define USB_FEATURE_TEST_MODE                              2
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_DEF_Exported_TypesDefinitions
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_DEF_Exported_Macros
+  * @{
+  */ 
+#define  SWAPBYTE(addr)        (((uint16_t)(*((uint8_t *)(addr)))) + \
+                               (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
+
+#define LOBYTE(x)  ((uint8_t)(x & 0x00FF))
+#define HIBYTE(x)  ((uint8_t)((x & 0xFF00) >>8))
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_DEF_Exported_Variables
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_DEF_Exported_FunctionsPrototype
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+#endif /* __USBD_DEF_H */
+
+/**
+  * @}
+  */ 
+
+/**
+* @}
+*/ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_ioreq.c b/codec2/tags/0.4/stm32/usb_lib/core/usbd_ioreq.c
new file mode 100644 (file)
index 0000000..6964766
--- /dev/null
@@ -0,0 +1,237 @@
+/**
+  ******************************************************************************
+  * @file    usbd_ioreq.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   This file provides the IO requests APIs for control endpoints.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_ioreq.h"
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+
+
+/** @defgroup USBD_IOREQ 
+  * @brief control I/O requests module
+  * @{
+  */ 
+
+/** @defgroup USBD_IOREQ_Private_TypesDefinitions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_IOREQ_Private_Defines
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_IOREQ_Private_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_IOREQ_Private_Variables
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_IOREQ_Private_FunctionPrototypes
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_IOREQ_Private_Functions
+  * @{
+  */ 
+
+/**
+* @brief  USBD_CtlSendData
+*         send data on the ctl pipe
+* @param  pdev: device instance
+* @param  buff: pointer to data buffer
+* @param  len: length of data to be sent
+* @retval status
+*/
+USBD_Status  USBD_CtlSendData (USB_OTG_CORE_HANDLE  *pdev, 
+                               uint8_t *pbuf,
+                               uint16_t len)
+{
+  USBD_Status ret = USBD_OK;
+  
+  pdev->dev.in_ep[0].total_data_len = len;
+  pdev->dev.in_ep[0].rem_data_len   = len;
+  pdev->dev.device_state = USB_OTG_EP0_DATA_IN;
+
+  DCD_EP_Tx (pdev, 0, pbuf, len);
+  return ret;
+}
+
+/**
+* @brief  USBD_CtlContinueSendData
+*         continue sending data on the ctl pipe
+* @param  pdev: device instance
+* @param  buff: pointer to data buffer
+* @param  len: length of data to be sent
+* @retval status
+*/
+USBD_Status  USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE  *pdev, 
+                                       uint8_t *pbuf,
+                                       uint16_t len)
+{
+  USBD_Status ret = USBD_OK;
+  
+  DCD_EP_Tx (pdev, 0, pbuf, len);
+  
+  
+  return ret;
+}
+
+/**
+* @brief  USBD_CtlPrepareRx
+*         receive data on the ctl pipe
+* @param  pdev: USB OTG device instance
+* @param  buff: pointer to data buffer
+* @param  len: length of data to be received
+* @retval status
+*/
+USBD_Status  USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE  *pdev,
+                                  uint8_t *pbuf,                                  
+                                  uint16_t len)
+{
+  USBD_Status ret = USBD_OK;
+  
+  pdev->dev.out_ep[0].total_data_len = len;
+  pdev->dev.out_ep[0].rem_data_len   = len;
+  pdev->dev.device_state = USB_OTG_EP0_DATA_OUT;
+  
+  DCD_EP_PrepareRx (pdev,
+                    0,
+                    pbuf,
+                    len);
+  
+
+  return ret;
+}
+
+/**
+* @brief  USBD_CtlContinueRx
+*         continue receive data on the ctl pipe
+* @param  pdev: USB OTG device instance
+* @param  buff: pointer to data buffer
+* @param  len: length of data to be received
+* @retval status
+*/
+USBD_Status  USBD_CtlContinueRx (USB_OTG_CORE_HANDLE  *pdev, 
+                                          uint8_t *pbuf,                                          
+                                          uint16_t len)
+{
+  USBD_Status ret = USBD_OK;
+  
+  DCD_EP_PrepareRx (pdev,
+                    0,                     
+                    pbuf,                         
+                    len);
+  return ret;
+}
+/**
+* @brief  USBD_CtlSendStatus
+*         send zero lzngth packet on the ctl pipe
+* @param  pdev: USB OTG device instance
+* @retval status
+*/
+USBD_Status  USBD_CtlSendStatus (USB_OTG_CORE_HANDLE  *pdev)
+{
+  USBD_Status ret = USBD_OK;
+  pdev->dev.device_state = USB_OTG_EP0_STATUS_IN;
+  DCD_EP_Tx (pdev,
+             0,
+             NULL, 
+             0); 
+  
+  USB_OTG_EP0_OutStart(pdev);  
+  
+  return ret;
+}
+
+/**
+* @brief  USBD_CtlReceiveStatus
+*         receive zero lzngth packet on the ctl pipe
+* @param  pdev: USB OTG device instance
+* @retval status
+*/
+USBD_Status  USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE  *pdev)
+{
+  USBD_Status ret = USBD_OK;
+  pdev->dev.device_state = USB_OTG_EP0_STATUS_OUT;  
+  DCD_EP_PrepareRx ( pdev,
+                    0,
+                    NULL,
+                    0);  
+
+  USB_OTG_EP0_OutStart(pdev);
+  
+  return ret;
+}
+
+
+/**
+* @brief  USBD_GetRxCount
+*         returns the received data length
+* @param  pdev: USB OTG device instance
+*         epnum: endpoint index
+* @retval Rx Data blength
+*/
+uint16_t  USBD_GetRxCount (USB_OTG_CORE_HANDLE  *pdev , uint8_t epnum)
+{
+  return pdev->dev.out_ep[epnum].xfer_count;
+}
+
+/**
+  * @}
+  */ 
+
+
+/**
+  * @}
+  */ 
+
+
+/**
+  * @}
+  */ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_ioreq.h b/codec2/tags/0.4/stm32/usb_lib/core/usbd_ioreq.h
new file mode 100644 (file)
index 0000000..ca755f2
--- /dev/null
@@ -0,0 +1,115 @@
+/**
+  ******************************************************************************
+  * @file    usbd_ioreq.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   header file for the usbd_ioreq.c file
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __USBD_IOREQ_H_
+#define __USBD_IOREQ_H_
+
+/* Includes ------------------------------------------------------------------*/
+#include  "usbd_def.h"
+#include  "usbd_core.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+  
+/** @defgroup USBD_IOREQ
+  * @brief header file for the usbd_ioreq.c file
+  * @{
+  */ 
+
+/** @defgroup USBD_IOREQ_Exported_Defines
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_IOREQ_Exported_Types
+  * @{
+  */
+
+
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_IOREQ_Exported_Macros
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_IOREQ_Exported_Variables
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
+  * @{
+  */ 
+
+USBD_Status  USBD_CtlSendData (USB_OTG_CORE_HANDLE  *pdev, 
+                               uint8_t *buf,
+                               uint16_t len);
+
+USBD_Status  USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE  *pdev, 
+                               uint8_t *pbuf,
+                               uint16_t len);
+
+USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE  *pdev, 
+                               uint8_t *pbuf,                                 
+                               uint16_t len);
+
+USBD_Status  USBD_CtlContinueRx (USB_OTG_CORE_HANDLE  *pdev, 
+                              uint8_t *pbuf,                                          
+                              uint16_t len);
+
+USBD_Status  USBD_CtlSendStatus (USB_OTG_CORE_HANDLE  *pdev);
+
+USBD_Status  USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE  *pdev);
+
+uint16_t  USBD_GetRxCount (USB_OTG_CORE_HANDLE  *pdev , 
+                           uint8_t epnum);
+
+/**
+  * @}
+  */ 
+
+#endif /* __USBD_IOREQ_H_ */
+
+/**
+  * @}
+  */ 
+
+/**
+* @}
+*/ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_req.c b/codec2/tags/0.4/stm32/usb_lib/core/usbd_req.c
new file mode 100644 (file)
index 0000000..f08d26c
--- /dev/null
@@ -0,0 +1,868 @@
+/**
+  ******************************************************************************
+  * @file    usbd_req.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011  
+  * @brief   This file provides the standard USB requests following chapter 9.
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_req.h"
+#include "usbd_ioreq.h"
+#include "usbd_desc.h"
+
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+
+
+/** @defgroup USBD_REQ 
+  * @brief USB standard requests module
+  * @{
+  */ 
+
+/** @defgroup USBD_REQ_Private_TypesDefinitions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_REQ_Private_Defines
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_REQ_Private_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_REQ_Private_Variables
+  * @{
+  */ 
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */  
+__ALIGN_BEGIN uint32_t USBD_ep_status __ALIGN_END  = 0; 
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint32_t  USBD_default_cfg __ALIGN_END  = 0;
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint32_t  USBD_cfg_status __ALIGN_END  = 0;  
+
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
+  #if defined ( __ICCARM__ ) /*!< IAR Compiler */
+    #pragma data_alignment=4   
+  #endif
+#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
+__ALIGN_BEGIN uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ] __ALIGN_END ;
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_REQ_Private_FunctionPrototypes
+  * @{
+  */ 
+static void USBD_GetDescriptor(USB_OTG_CORE_HANDLE  *pdev, 
+                               USB_SETUP_REQ *req);
+
+static void USBD_SetAddress(USB_OTG_CORE_HANDLE  *pdev, 
+                            USB_SETUP_REQ *req);
+
+static void USBD_SetConfig(USB_OTG_CORE_HANDLE  *pdev, 
+                           USB_SETUP_REQ *req);
+
+static void USBD_GetConfig(USB_OTG_CORE_HANDLE  *pdev, 
+                           USB_SETUP_REQ *req);
+
+static void USBD_GetStatus(USB_OTG_CORE_HANDLE  *pdev, 
+                           USB_SETUP_REQ *req);
+
+static void USBD_SetFeature(USB_OTG_CORE_HANDLE  *pdev, 
+                            USB_SETUP_REQ *req);
+
+static void USBD_ClrFeature(USB_OTG_CORE_HANDLE  *pdev, 
+                            USB_SETUP_REQ *req);
+
+static uint8_t USBD_GetLen(uint8_t *buf);
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_REQ_Private_Functions
+  * @{
+  */ 
+
+
+/**
+* @brief  USBD_StdDevReq
+*         Handle standard usb device requests
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+USBD_Status  USBD_StdDevReq (USB_OTG_CORE_HANDLE  *pdev, USB_SETUP_REQ  *req)
+{
+  USBD_Status ret = USBD_OK;  
+  
+  switch (req->bRequest) 
+  {
+  case USB_REQ_GET_DESCRIPTOR: 
+    
+    USBD_GetDescriptor (pdev, req) ;
+    break;
+    
+  case USB_REQ_SET_ADDRESS:                      
+    USBD_SetAddress(pdev, req);
+    break;
+    
+  case USB_REQ_SET_CONFIGURATION:                    
+    USBD_SetConfig (pdev , req);
+    break;
+    
+  case USB_REQ_GET_CONFIGURATION:                 
+    USBD_GetConfig (pdev , req);
+    break;
+    
+  case USB_REQ_GET_STATUS:                                  
+    USBD_GetStatus (pdev , req);
+    break;
+    
+    
+  case USB_REQ_SET_FEATURE:   
+    USBD_SetFeature (pdev , req);    
+    break;
+    
+  case USB_REQ_CLEAR_FEATURE:                                   
+    USBD_ClrFeature (pdev , req);
+    break;
+    
+  default:  
+    USBD_CtlError(pdev , req);
+    break;
+  }
+  
+  return ret;
+}
+
+/**
+* @brief  USBD_StdItfReq
+*         Handle standard usb interface requests
+* @param  pdev: USB OTG device instance
+* @param  req: usb request
+* @retval status
+*/
+USBD_Status  USBD_StdItfReq (USB_OTG_CORE_HANDLE  *pdev, USB_SETUP_REQ  *req)
+{
+  USBD_Status ret = USBD_OK; 
+  
+  switch (pdev->dev.device_status) 
+  {
+  case USB_OTG_CONFIGURED:
+    
+    if (LOBYTE(req->wIndex) <= USBD_ITF_MAX_NUM) 
+    {
+      pdev->dev.class_cb->Setup (pdev, req); 
+      
+      if((req->wLength == 0)&& (ret == USBD_OK))
+      {
+         USBD_CtlSendStatus(pdev);
+      }
+    } 
+    else 
+    {                                               
+       USBD_CtlError(pdev , req);
+    }
+    break;
+    
+  default:
+     USBD_CtlError(pdev , req);
+    break;
+  }
+  return ret;
+}
+
+/**
+* @brief  USBD_StdEPReq
+*         Handle standard usb endpoint requests
+* @param  pdev: USB OTG device instance
+* @param  req: usb request
+* @retval status
+*/
+USBD_Status  USBD_StdEPReq (USB_OTG_CORE_HANDLE  *pdev, USB_SETUP_REQ  *req)
+{
+  
+  uint8_t   ep_addr;
+  USBD_Status ret = USBD_OK; 
+  
+  ep_addr  = LOBYTE(req->wIndex);   
+  
+  switch (req->bRequest) 
+  {
+    
+  case USB_REQ_SET_FEATURE :
+    
+    switch (pdev->dev.device_status) 
+    {
+    case USB_OTG_ADDRESSED:          
+      if ((ep_addr != 0x00) && (ep_addr != 0x80)) 
+      {
+        DCD_EP_Stall(pdev , ep_addr);
+      }
+      break;   
+      
+    case USB_OTG_CONFIGURED:   
+      if (req->wValue == USB_FEATURE_EP_HALT)
+      {
+        if ((ep_addr != 0x00) && (ep_addr != 0x80)) 
+        { 
+          DCD_EP_Stall(pdev , ep_addr);
+          
+        }
+      }
+      pdev->dev.class_cb->Setup (pdev, req);   
+      USBD_CtlSendStatus(pdev);
+      
+      break;
+      
+    default:                         
+      USBD_CtlError(pdev , req);
+      break;    
+    }
+    break;
+    
+  case USB_REQ_CLEAR_FEATURE :
+    
+    switch (pdev->dev.device_status) 
+    {
+    case USB_OTG_ADDRESSED:          
+      if ((ep_addr != 0x00) && (ep_addr != 0x80)) 
+      {
+        DCD_EP_Stall(pdev , ep_addr);
+      }
+      break;   
+      
+    case USB_OTG_CONFIGURED:   
+      if (req->wValue == USB_FEATURE_EP_HALT)
+      {
+        if ((ep_addr != 0x00) && (ep_addr != 0x80)) 
+        {        
+          DCD_EP_ClrStall(pdev , ep_addr);
+          pdev->dev.class_cb->Setup (pdev, req);
+        }
+        USBD_CtlSendStatus(pdev);
+      }
+      break;
+      
+    default:                         
+       USBD_CtlError(pdev , req);
+      break;    
+    }
+    break;
+    
+  case USB_REQ_GET_STATUS:                  
+    switch (pdev->dev.device_status) 
+    {
+    case USB_OTG_ADDRESSED:          
+      if ((ep_addr != 0x00) && (ep_addr != 0x80)) 
+      {
+        DCD_EP_Stall(pdev , ep_addr);
+      }
+      break;   
+      
+    case USB_OTG_CONFIGURED:         
+      
+      
+      if ((ep_addr & 0x80)== 0x80)
+      {
+        if(pdev->dev.in_ep[ep_addr & 0x7F].is_stall)
+        {
+          USBD_ep_status = 0x0001;     
+        }
+        else
+        {
+          USBD_ep_status = 0x0000;  
+        }
+      }
+      else if ((ep_addr & 0x80)== 0x00)
+      {
+        if(pdev->dev.out_ep[ep_addr].is_stall)
+        {
+          USBD_ep_status = 0x0001;     
+        }
+        
+        else 
+        {
+          USBD_ep_status = 0x0000;     
+        }      
+      }
+      USBD_CtlSendData (pdev,
+                        (uint8_t *)&USBD_ep_status,
+                        2);
+      break;
+      
+    default:                         
+       USBD_CtlError(pdev , req);
+      break;
+    }
+    break;
+    
+  default:
+    break;
+  }
+  return ret;
+}
+/**
+* @brief  USBD_GetDescriptor
+*         Handle Get Descriptor requests
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_GetDescriptor(USB_OTG_CORE_HANDLE  *pdev, 
+                               USB_SETUP_REQ *req)
+{
+  uint16_t len;
+  uint8_t *pbuf;
+  
+  switch (req->wValue >> 8)
+  {
+  case USB_DESC_TYPE_DEVICE:
+    pbuf = pdev->dev.usr_device->GetDeviceDescriptor(pdev->cfg.speed, &len);
+    if ((req->wLength == 64) ||( pdev->dev.device_status == USB_OTG_DEFAULT))  
+    {                  
+      len = 8;
+    }
+    break;
+    
+  case USB_DESC_TYPE_CONFIGURATION:
+      pbuf   = (uint8_t *)pdev->dev.class_cb->GetConfigDescriptor(pdev->cfg.speed, &len);
+#ifdef USB_OTG_HS_CORE
+    if((pdev->cfg.speed == USB_OTG_SPEED_FULL )&&
+       (pdev->cfg.phy_itface  == USB_OTG_ULPI_PHY))
+    {
+      pbuf   = (uint8_t *)pdev->dev.class_cb->GetOtherConfigDescriptor(pdev->cfg.speed, &len);
+    }
+#endif  
+    pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
+    pdev->dev.pConfig_descriptor = pbuf;    
+    break;
+    
+  case USB_DESC_TYPE_STRING:
+    switch ((uint8_t)(req->wValue))
+    {
+    case USBD_IDX_LANGID_STR:
+     pbuf = pdev->dev.usr_device->GetLangIDStrDescriptor(pdev->cfg.speed, &len);        
+      break;
+      
+    case USBD_IDX_MFC_STR:
+      pbuf = pdev->dev.usr_device->GetManufacturerStrDescriptor(pdev->cfg.speed, &len);
+      break;
+      
+    case USBD_IDX_PRODUCT_STR:
+      pbuf = pdev->dev.usr_device->GetProductStrDescriptor(pdev->cfg.speed, &len);
+      break;
+      
+    case USBD_IDX_SERIAL_STR:
+      pbuf = pdev->dev.usr_device->GetSerialStrDescriptor(pdev->cfg.speed, &len);
+      break;
+      
+    case USBD_IDX_CONFIG_STR:
+      pbuf = pdev->dev.usr_device->GetConfigurationStrDescriptor(pdev->cfg.speed, &len);
+      break;
+      
+    case USBD_IDX_INTERFACE_STR:
+      pbuf = pdev->dev.usr_device->GetInterfaceStrDescriptor(pdev->cfg.speed, &len);
+      break;
+      
+    default:
+#ifdef USB_SUPPORT_USER_STRING_DESC
+      pbuf = pdev->dev.class_cb->GetUsrStrDescriptor(pdev->cfg.speed, (req->wValue) , &len);
+      break;
+#else      
+       USBD_CtlError(pdev , req);
+      return;
+#endif /* USBD_CtlError(pdev , req); */      
+    }
+    break;
+  case USB_DESC_TYPE_DEVICE_QUALIFIER:                   
+#ifdef USB_OTG_HS_CORE
+    if(pdev->cfg.speed == USB_OTG_SPEED_HIGH  )   
+    {
+      
+      pbuf   = (uint8_t *)pdev->dev.class_cb->GetConfigDescriptor(pdev->cfg.speed, &len);
+            
+      USBD_DeviceQualifierDesc[4]= pbuf[14];
+      USBD_DeviceQualifierDesc[5]= pbuf[15];
+      USBD_DeviceQualifierDesc[6]= pbuf[16];
+      
+      pbuf = USBD_DeviceQualifierDesc;
+      len  = USB_LEN_DEV_QUALIFIER_DESC;
+      break;
+    }
+    else
+    {
+      USBD_CtlError(pdev , req);
+      return;
+    }
+#else
+      USBD_CtlError(pdev , req);
+      return;
+#endif    
+
+  case USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION:
+#ifdef USB_OTG_HS_CORE   
+
+    if(pdev->cfg.speed == USB_OTG_SPEED_HIGH  )   
+    {
+      pbuf   = (uint8_t *)pdev->dev.class_cb->GetOtherConfigDescriptor(pdev->cfg.speed, &len);
+      pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION;
+      break; 
+    }
+    else
+    {
+      USBD_CtlError(pdev , req);
+      return;
+    }
+#else
+      USBD_CtlError(pdev , req);
+      return;
+#endif     
+
+    
+  default: 
+     USBD_CtlError(pdev , req);
+    return;
+  }
+  
+  if((len != 0)&& (req->wLength != 0))
+  {
+    
+    len = MIN(len , req->wLength);
+    
+    USBD_CtlSendData (pdev, 
+                      pbuf,
+                      len);
+  }
+  
+}
+
+/**
+* @brief  USBD_SetAddress
+*         Set device address
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_SetAddress(USB_OTG_CORE_HANDLE  *pdev, 
+                            USB_SETUP_REQ *req)
+{
+  uint8_t  dev_addr; 
+  
+  if ((req->wIndex == 0) && (req->wLength == 0)) 
+  {
+    dev_addr = (uint8_t)(req->wValue) & 0x7F;     
+    
+    if (pdev->dev.device_status == USB_OTG_CONFIGURED) 
+    {
+      USBD_CtlError(pdev , req);
+    } 
+    else 
+    {
+      pdev->dev.device_address = dev_addr;
+      DCD_EP_SetAddress(pdev, dev_addr);               
+      USBD_CtlSendStatus(pdev);                         
+      
+      if (dev_addr != 0) 
+      {
+        pdev->dev.device_status  = USB_OTG_ADDRESSED;
+      } 
+      else 
+      {
+        pdev->dev.device_status  = USB_OTG_DEFAULT; 
+      }
+    }
+  } 
+  else 
+  {
+     USBD_CtlError(pdev , req);                        
+  } 
+}
+
+/**
+* @brief  USBD_SetConfig
+*         Handle Set device configuration request
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_SetConfig(USB_OTG_CORE_HANDLE  *pdev, 
+                           USB_SETUP_REQ *req)
+{
+  
+  static uint8_t  cfgidx;
+  
+  cfgidx = (uint8_t)(req->wValue);                 
+  
+  if (cfgidx > USBD_CFG_MAX_NUM ) 
+  {            
+     USBD_CtlError(pdev , req);                              
+  } 
+  else 
+  {
+    switch (pdev->dev.device_status) 
+    {
+    case USB_OTG_ADDRESSED:
+      if (cfgidx) 
+      {                                                                                                                                                                                                        
+        pdev->dev.device_config = cfgidx;
+        pdev->dev.device_status = USB_OTG_CONFIGURED;
+        USBD_SetCfg(pdev , cfgidx);
+        USBD_CtlSendStatus(pdev);
+      }
+      else 
+      {
+         USBD_CtlSendStatus(pdev);
+      }
+      break;
+      
+    case USB_OTG_CONFIGURED:
+      if (cfgidx == 0) 
+      {                           
+        pdev->dev.device_status = USB_OTG_ADDRESSED;
+        pdev->dev.device_config = cfgidx;          
+        USBD_ClrCfg(pdev , cfgidx);
+        USBD_CtlSendStatus(pdev);
+        
+      } 
+      else  if (cfgidx != pdev->dev.device_config) 
+      {
+        /* Clear old configuration */
+        USBD_ClrCfg(pdev , pdev->dev.device_config);
+        
+        /* set new configuration */
+        pdev->dev.device_config = cfgidx;
+        USBD_SetCfg(pdev , cfgidx);
+        USBD_CtlSendStatus(pdev);
+      }
+      else
+      {
+        USBD_CtlSendStatus(pdev);
+      }
+      break;
+      
+    default:                                   
+       USBD_CtlError(pdev , req);                     
+      break;
+    }
+  }
+}
+
+/**
+* @brief  USBD_GetConfig
+*         Handle Get device configuration request
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_GetConfig(USB_OTG_CORE_HANDLE  *pdev, 
+                           USB_SETUP_REQ *req)
+{
+  if (req->wLength != 1) 
+  {                   
+     USBD_CtlError(pdev , req);
+  }
+  else 
+  {
+    switch (pdev->dev.device_status )  
+    {
+    case USB_OTG_ADDRESSED:                     
+      
+      USBD_CtlSendData (pdev, 
+                        (uint8_t *)&USBD_default_cfg,
+                        1);
+      break;
+      
+    case USB_OTG_CONFIGURED:                   
+      
+      USBD_CtlSendData (pdev, 
+                        &pdev->dev.device_config,
+                        1);
+      break;
+      
+    default:
+       USBD_CtlError(pdev , req);
+      break;
+    }
+  }
+}
+
+/**
+* @brief  USBD_GetStatus
+*         Handle Get Status request
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_GetStatus(USB_OTG_CORE_HANDLE  *pdev, 
+                           USB_SETUP_REQ *req)
+{
+  
+  switch (pdev->dev.device_status) 
+  {
+  case USB_OTG_ADDRESSED:
+  case USB_OTG_CONFIGURED:
+    
+    if (pdev->dev.DevRemoteWakeup) 
+    {
+      USBD_cfg_status = USB_CONFIG_SELF_POWERED | USB_CONFIG_REMOTE_WAKEUP;                                
+    }
+    else
+    {
+      USBD_cfg_status = USB_CONFIG_SELF_POWERED;   
+    }
+    
+    USBD_CtlSendData (pdev, 
+                      (uint8_t *)&USBD_cfg_status,
+                      1);
+    break;
+    
+  default :
+    USBD_CtlError(pdev , req);                        
+    break;
+  }
+}
+
+
+/**
+* @brief  USBD_SetFeature
+*         Handle Set device feature request
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_SetFeature(USB_OTG_CORE_HANDLE  *pdev, 
+                            USB_SETUP_REQ *req)
+{
+
+  USB_OTG_DCTL_TypeDef     dctl;
+  uint8_t test_mode = 0;
+  if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
+  {
+    pdev->dev.DevRemoteWakeup = 1;  
+    pdev->dev.class_cb->Setup (pdev, req);   
+    USBD_CtlSendStatus(pdev);
+  }
+
+  else if ((req->wValue == USB_FEATURE_TEST_MODE) && 
+           ((req->wIndex & 0xFF) == 0))
+  {
+    dctl.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCTL);
+    
+    test_mode = req->wIndex >> 8;
+    switch (test_mode) 
+    {
+    case 1: // TEST_J
+      dctl.b.tstctl = 1;
+      break;
+      
+    case 2: // TEST_K  
+      dctl.b.tstctl = 2;
+      break;
+      
+    case 3: // TEST_SE0_NAK
+      dctl.b.tstctl = 3;
+      break;
+      
+    case 4: // TEST_PACKET
+      dctl.b.tstctl = 4;
+      break;
+      
+    case 5: // TEST_FORCE_ENABLE
+      dctl.b.tstctl = 5;
+      break;
+    }
+    USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCTL, dctl.d32);
+    USBD_CtlSendStatus(pdev);
+  }
+
+}
+
+
+/**
+* @brief  USBD_ClrFeature
+*         Handle clear device feature request
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval status
+*/
+static void USBD_ClrFeature(USB_OTG_CORE_HANDLE  *pdev, 
+                            USB_SETUP_REQ *req)
+{
+  switch (pdev->dev.device_status)
+  {
+  case USB_OTG_ADDRESSED:
+  case USB_OTG_CONFIGURED:
+    if (req->wValue == USB_FEATURE_REMOTE_WAKEUP) 
+    {
+      pdev->dev.DevRemoteWakeup = 0; 
+      pdev->dev.class_cb->Setup (pdev, req);   
+      USBD_CtlSendStatus(pdev);
+    }
+    break;
+    
+  default :
+     USBD_CtlError(pdev , req);
+    break;
+  }
+}
+
+/**
+* @brief  USBD_ParseSetupRequest 
+*         Copy buffer into setup structure
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval None
+*/
+
+void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE  *pdev,
+                            USB_SETUP_REQ *req)
+{
+  req->bmRequest     = *(uint8_t *)  (pdev->dev.setup_packet);
+  req->bRequest      = *(uint8_t *)  (pdev->dev.setup_packet +  1);
+  req->wValue        = SWAPBYTE      (pdev->dev.setup_packet +  2);
+  req->wIndex        = SWAPBYTE      (pdev->dev.setup_packet +  4);
+  req->wLength       = SWAPBYTE      (pdev->dev.setup_packet +  6);
+  
+  pdev->dev.in_ep[0].ctl_data_len = req->wLength  ;
+  pdev->dev.device_state = USB_OTG_EP0_SETUP;
+}
+
+/**
+* @brief  USBD_CtlError 
+*         Handle USB low level Error
+* @param  pdev: device instance
+* @param  req: usb request
+* @retval None
+*/
+
+void USBD_CtlError( USB_OTG_CORE_HANDLE  *pdev,
+                            USB_SETUP_REQ *req)
+{
+  if((req->bmRequest & 0x80) == 0x80)
+  {
+    DCD_EP_Stall(pdev , 0x80);
+  }
+  else 
+  {
+    if(req->wLength == 0)
+    {
+       DCD_EP_Stall(pdev , 0x80);
+    }
+    else
+    {
+      DCD_EP_Stall(pdev , 0);
+    }
+  }
+  USB_OTG_EP0_OutStart(pdev);  
+}
+
+
+/**
+  * @brief  USBD_GetString
+  *         Convert Ascii string into unicode one
+  * @param  desc : descriptor buffer
+  * @param  unicode : Formatted string buffer (unicode)
+  * @param  len : descriptor length
+  * @retval None
+  */
+void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len)
+{
+  uint8_t idx = 0;
+  
+  if (desc != NULL) 
+  {
+    *len =  USBD_GetLen(desc) * 2 + 2;    
+    unicode[idx++] = *len;
+    unicode[idx++] =  USB_DESC_TYPE_STRING;
+    
+    while (*desc != NULL) 
+    {
+      unicode[idx++] = *desc++;
+      unicode[idx++] =  0x00;
+    }
+  } 
+}
+
+/**
+  * @brief  USBD_GetLen
+  *         return the string length
+   * @param  buf : pointer to the ascii string buffer
+  * @retval string length
+  */
+static uint8_t USBD_GetLen(uint8_t *buf)
+{
+    uint8_t  len = 0;
+
+    while (*buf != NULL) 
+    {
+        len++;
+        buf++;
+    }
+
+    return len;
+}
+/**
+  * @}
+  */ 
+
+
+/**
+  * @}
+  */ 
+
+
+/**
+  * @}
+  */ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_req.h b/codec2/tags/0.4/stm32/usb_lib/core/usbd_req.h
new file mode 100644 (file)
index 0000000..9aa9e44
--- /dev/null
@@ -0,0 +1,102 @@
+/**
+  ******************************************************************************
+  * @file    usbd_req.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   header file for the usbd_req.c file
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __USB_REQUEST_H_
+#define __USB_REQUEST_H_
+
+/* Includes ------------------------------------------------------------------*/
+#include  "usbd_def.h"
+#include  "usbd_core.h"
+#include  "usbd_conf.h"
+
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+  * @{
+  */
+  
+/** @defgroup USBD_REQ
+  * @brief header file for the usbd_ioreq.c file
+  * @{
+  */ 
+
+/** @defgroup USBD_REQ_Exported_Defines
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USBD_REQ_Exported_Types
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_REQ_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_REQ_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_REQ_Exported_FunctionsPrototype
+  * @{
+  */ 
+
+USBD_Status  USBD_StdDevReq (USB_OTG_CORE_HANDLE  *pdev, USB_SETUP_REQ  *req);
+USBD_Status  USBD_StdItfReq (USB_OTG_CORE_HANDLE  *pdev, USB_SETUP_REQ  *req);
+USBD_Status  USBD_StdEPReq (USB_OTG_CORE_HANDLE  *pdev, USB_SETUP_REQ  *req);
+void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE  *pdev,
+                                    USB_SETUP_REQ *req);
+
+void USBD_CtlError( USB_OTG_CORE_HANDLE  *pdev,
+                            USB_SETUP_REQ *req);
+
+void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len);
+/**
+  * @}
+  */ 
+
+#endif /* __USB_REQUEST_H_ */
+
+/**
+  * @}
+  */ 
+
+/**
+* @}
+*/ 
+
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/core/usbd_usr.h b/codec2/tags/0.4/stm32/usb_lib/core/usbd_usr.h
new file mode 100644 (file)
index 0000000..44e7b1d
--- /dev/null
@@ -0,0 +1,135 @@
+/**
+  ******************************************************************************
+  * @file    usbd_usr.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    22-July-2011
+  * @brief   Header file for usbd_usr.c
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_USR_H__
+#define __USBD_USR_H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_core.h"
+
+
+/** @addtogroup USBD_USER
+  * @{
+  */
+
+/** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS
+  * @{
+  */
+
+/** @defgroup USBD_USR
+  * @brief This file is the Header file for usbd_usr.c
+  * @{
+  */ 
+
+
+/** @defgroup USBD_USR_Exported_Types
+  * @{
+  */ 
+
+extern  USBD_Usr_cb_TypeDef USR_cb;
+extern  USBD_Usr_cb_TypeDef USR_FS_cb;
+extern  USBD_Usr_cb_TypeDef USR_HS_cb;
+
+
+
+/**
+  * @}
+  */ 
+
+
+
+/** @defgroup USBD_USR_Exported_Defines
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_USR_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_USR_Exported_Variables
+  * @{
+  */ 
+
+void     USBD_USR_Init(void);
+void     USBD_USR_DeviceReset (uint8_t speed);
+void     USBD_USR_DeviceConfigured (void);
+void     USBD_USR_DeviceSuspended(void);
+void     USBD_USR_DeviceResumed(void);
+
+void     USBD_USR_DeviceConnected(void);
+void     USBD_USR_DeviceDisconnected(void); 
+
+void     USBD_USR_FS_Init(void);
+void     USBD_USR_FS_DeviceReset (uint8_t speed);
+void     USBD_USR_FS_DeviceConfigured (void);
+void     USBD_USR_FS_DeviceSuspended(void);
+void     USBD_USR_FS_DeviceResumed(void);
+
+void     USBD_USR_FS_DeviceConnected(void);
+void     USBD_USR_FS_DeviceDisconnected(void);  
+
+void     USBD_USR_HS_Init(void);
+void     USBD_USR_HS_DeviceReset (uint8_t speed);
+void     USBD_USR_HS_DeviceConfigured (void);
+void     USBD_USR_HS_DeviceSuspended(void);
+void     USBD_USR_HS_DeviceResumed(void);
+
+void     USBD_USR_HS_DeviceConnected(void);
+void     USBD_USR_HS_DeviceDisconnected(void);  
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USBD_USR_Exported_FunctionsPrototype
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+#endif /*__USBD_USR_H__*/
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
+
+
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_core.c b/codec2/tags/0.4/stm32/usb_lib/otg/usb_core.c
new file mode 100644 (file)
index 0000000..74e432a
--- /dev/null
@@ -0,0 +1,2187 @@
+/**
+  ******************************************************************************
+  * @file    usb_core.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   USB-OTG Core Layer
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_core.h"
+#include "usb_bsp.h"
+
+
+/** @addtogroup USB_OTG_DRIVER
+* @{
+*/
+
+/** @defgroup USB_CORE 
+* @brief This file includes the USB-OTG Core Layer
+* @{
+*/
+
+
+/** @defgroup USB_CORE_Private_Defines
+* @{
+*/ 
+
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_CORE_Private_TypesDefinitions
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+
+/** @defgroup USB_CORE_Private_Macros
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_CORE_Private_Variables
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_CORE_Private_FunctionPrototypes
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_CORE_Private_Functions
+* @{
+*/ 
+
+/**
+* @brief  USB_OTG_EnableCommonInt
+*         Initializes the commmon interrupts, used in both device and modes
+* @param  pdev : Selected device
+* @retval None
+*/
+static void USB_OTG_EnableCommonInt(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTMSK_TypeDef  int_mask;
+  
+  int_mask.d32 = 0;
+  /* Clear any pending USB_OTG Interrupts */
+#ifndef USE_OTG_MODE
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GOTGINT, 0xFFFFFFFF);
+#endif
+  /* Clear any pending interrupts */
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GINTSTS, 0xFFFFFFFF);
+  /* Enable the interrupts in the INTMSK */
+  int_mask.b.wkupintr = 1;
+  int_mask.b.usbsuspend = 1; 
+  
+#ifdef USE_OTG_MODE
+  int_mask.b.otgintr = 1;
+  int_mask.b.sessreqintr = 1;
+  int_mask.b.conidstschng = 1;
+#endif
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GINTMSK, int_mask.d32);
+}
+
+/**
+* @brief  USB_OTG_CoreReset : Soft reset of the core
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+static USB_OTG_STS USB_OTG_CoreReset(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  __IO USB_OTG_GRSTCTL_TypeDef  greset;
+  uint32_t count = 0;
+  
+  greset.d32 = 0;
+  /* Wait for AHB master IDLE state. */
+  do
+  {
+    USB_OTG_BSP_uDelay(3);
+    greset.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GRSTCTL);
+    if (++count > 200000)
+    {
+      return USB_OTG_OK;
+    }
+  }
+  while (greset.b.ahbidle == 0);
+  /* Core Soft Reset */
+  count = 0;
+  greset.b.csftrst = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GRSTCTL, greset.d32 );
+  do
+  {
+    greset.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GRSTCTL);
+    if (++count > 200000)
+    {
+      break;
+    }
+  }
+  while (greset.b.csftrst == 1);
+  /* Wait for 3 PHY Clocks*/
+  USB_OTG_BSP_uDelay(3);
+  return status;
+}
+
+/**
+* @brief  USB_OTG_WritePacket : Writes a packet into the Tx FIFO associated 
+*         with the EP
+* @param  pdev : Selected device
+* @param  src : source pointer
+* @param  ch_ep_num : end point number
+* @param  bytes : No. of bytes
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_WritePacket(USB_OTG_CORE_HANDLE *pdev, 
+                                uint8_t             *src, 
+                                uint8_t             ch_ep_num, 
+                                uint16_t            len)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  if (pdev->cfg.dma_enable == 0)
+  {
+    uint32_t count32b= 0 , i= 0;
+    __IO uint32_t *fifo;
+    
+    count32b =  (len + 3) / 4;
+    fifo = pdev->regs.DFIFO[ch_ep_num];
+    for (i = 0; i < count32b; i++, src+=4)
+    {
+      USB_OTG_WRITE_REG32( fifo, *((__packed uint32_t *)src) );
+    }
+  }
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_ReadPacket : Reads a packet from the Rx FIFO
+* @param  pdev : Selected device
+* @param  dest : Destination Pointer
+* @param  bytes : No. of bytes
+* @retval None
+*/
+void *USB_OTG_ReadPacket(USB_OTG_CORE_HANDLE *pdev, 
+                         uint8_t *dest, 
+                         uint16_t len)
+{
+  uint32_t i=0;
+  uint32_t count32b = (len + 3) / 4;
+  
+  __IO uint32_t *fifo = pdev->regs.DFIFO[0];
+  
+  for ( i = 0; i < count32b; i++, dest += 4 )
+  {
+    *(__packed uint32_t *)dest = USB_OTG_READ_REG32(fifo);
+    
+  }
+  return ((void *)dest);
+}
+
+/**
+* @brief  USB_OTG_SelectCore 
+*         Initialize core registers address.
+* @param  pdev : Selected device
+* @param  coreID : USB OTG Core ID
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_SelectCore(USB_OTG_CORE_HANDLE *pdev, 
+                               USB_OTG_CORE_ID_TypeDef coreID)
+{
+  uint32_t i , baseAddress = 0;
+  USB_OTG_STS status = USB_OTG_OK;
+  
+  pdev->cfg.dma_enable       = 0;
+  
+  /* at startup the core is in FS mode */
+  pdev->cfg.speed            = USB_OTG_SPEED_FULL;
+  pdev->cfg.mps              = USB_OTG_FS_MAX_PACKET_SIZE ;    
+    
+  /* initialize device cfg following its address */
+  if (coreID == USB_OTG_FS_CORE_ID)
+  {
+    baseAddress                = USB_OTG_FS_BASE_ADDR;
+    pdev->cfg.coreID           = USB_OTG_FS_CORE_ID;
+    pdev->cfg.host_channels    = 8 ;
+    pdev->cfg.dev_endpoints    = 4 ;
+    pdev->cfg.TotalFifoSize    = 320; /* in 32-bits */
+    pdev->cfg.phy_itface       = USB_OTG_EMBEDDED_PHY;     
+    
+#ifdef USB_OTG_FS_SOF_OUTPUT_ENABLED    
+    pdev->cfg.Sof_output       = 1;    
+#endif 
+    
+#ifdef USB_OTG_FS_LOW_PWR_MGMT_SUPPORT    
+    pdev->cfg.low_power        = 1;    
+#endif     
+  }
+  else if (coreID == USB_OTG_HS_CORE_ID)
+  {
+    baseAddress                = USB_OTG_HS_BASE_ADDR;
+    pdev->cfg.coreID           = USB_OTG_HS_CORE_ID;    
+    pdev->cfg.host_channels    = 12 ;
+    pdev->cfg.dev_endpoints    = 6 ;
+    pdev->cfg.TotalFifoSize    = 1280;/* in 32-bits */
+    
+#ifdef USB_OTG_ULPI_PHY_ENABLED
+    pdev->cfg.phy_itface       = USB_OTG_ULPI_PHY;
+#else    
+ #ifdef USB_OTG_EMBEDDED_PHY_ENABLED
+    pdev->cfg.phy_itface       = USB_OTG_EMBEDDED_PHY;
+ #else   
+   #ifdef USB_OTG_I2C_PHY_ENABLED    
+    pdev->cfg.phy_itface       = USB_OTG_I2C_PHY; 
+   #endif
+ #endif  
+#endif      
+    
+#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED    
+    pdev->cfg.dma_enable       = 1;    
+#endif
+    
+#ifdef USB_OTG_HS_SOF_OUTPUT_ENABLED    
+    pdev->cfg.Sof_output       = 1;    
+#endif 
+    
+#ifdef USB_OTG_HS_LOW_PWR_MGMT_SUPPORT    
+    pdev->cfg.low_power        = 1;    
+#endif 
+    
+  }
+  
+  pdev->regs.GREGS = (USB_OTG_GREGS *)(baseAddress + \
+    USB_OTG_CORE_GLOBAL_REGS_OFFSET);
+  pdev->regs.DREGS =  (USB_OTG_DREGS  *)  (baseAddress + \
+    USB_OTG_DEV_GLOBAL_REG_OFFSET);
+  
+  for (i = 0; i < pdev->cfg.dev_endpoints; i++)
+  {
+    pdev->regs.INEP_REGS[i]  = (USB_OTG_INEPREGS *)  \
+      (baseAddress + USB_OTG_DEV_IN_EP_REG_OFFSET + \
+        (i * USB_OTG_EP_REG_OFFSET));
+    pdev->regs.OUTEP_REGS[i] = (USB_OTG_OUTEPREGS *) \
+      (baseAddress + USB_OTG_DEV_OUT_EP_REG_OFFSET + \
+        (i * USB_OTG_EP_REG_OFFSET));
+  }
+  pdev->regs.HREGS = (USB_OTG_HREGS *)(baseAddress + \
+    USB_OTG_HOST_GLOBAL_REG_OFFSET);
+  pdev->regs.HPRT0 = (uint32_t *)(baseAddress + USB_OTG_HOST_PORT_REGS_OFFSET);
+  
+  for (i = 0; i < pdev->cfg.host_channels; i++)
+  {
+    pdev->regs.HC_REGS[i] = (USB_OTG_HC_REGS *)(baseAddress + \
+      USB_OTG_HOST_CHAN_REGS_OFFSET + \
+        (i * USB_OTG_CHAN_REGS_OFFSET));
+  }
+  for (i = 0; i < pdev->cfg.host_channels; i++)
+  {
+    pdev->regs.DFIFO[i] = (uint32_t *)(baseAddress + USB_OTG_DATA_FIFO_OFFSET +\
+      (i * USB_OTG_DATA_FIFO_SIZE));
+  }
+  pdev->regs.PCGCCTL = (uint32_t *)(baseAddress + USB_OTG_PCGCCTL_OFFSET);
+  
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_CoreInit
+*         Initializes the USB_OTG controller registers and prepares the core
+*         device mode or host mode operation.
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_CoreInit(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_GUSBCFG_TypeDef  usbcfg;
+  USB_OTG_GCCFG_TypeDef    gccfg;
+  USB_OTG_GI2CCTL_TypeDef  i2cctl;
+  USB_OTG_GAHBCFG_TypeDef  ahbcfg;
+  
+  usbcfg.d32 = 0;
+  gccfg.d32 = 0;
+  ahbcfg.d32 = 0;
+  
+
+  
+  if (pdev->cfg.phy_itface == USB_OTG_ULPI_PHY)
+  {
+    gccfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GCCFG);
+    gccfg.b.pwdn = 0;
+    
+    if (pdev->cfg.Sof_output)
+    {
+      gccfg.b.sofouten = 1;   
+    }
+    USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GCCFG, gccfg.d32);
+    
+    /* Init The ULPI Interface */
+    usbcfg.d32 = 0;
+    usbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);
+    
+    usbcfg.b.physel            = 0; /* HS Interface */
+#ifdef USB_OTG_INTERNAL_VBUS_ENABLED
+    usbcfg.b.ulpi_ext_vbus_drv = 0; /* Use internal VBUS */
+#else
+ #ifdef USB_OTG_EXTERNAL_VBUS_ENABLED    
+    usbcfg.b.ulpi_ext_vbus_drv = 1; /* Use external VBUS */
+ #endif
+#endif 
+    usbcfg.b.term_sel_dl_pulse = 0; /* Data line pulsing using utmi_txvalid */    
+    usbcfg.b.ulpi_utmi_sel     = 1; /* ULPI seleInterfacect */
+    
+    usbcfg.b.phyif             = 0; /* 8 bits */
+    usbcfg.b.ddrsel            = 0; /* single data rate */
+    
+    usbcfg.b.ulpi_fsls = 0;
+    usbcfg.b.ulpi_clk_sus_m = 0;
+    USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GUSBCFG, usbcfg.d32);
+    
+    /* Reset after a PHY select  */
+    USB_OTG_CoreReset(pdev);
+    
+    if(pdev->cfg.dma_enable == 1)
+    {
+      
+      ahbcfg.b.hburstlen = 5; /* 64 x 32-bits*/
+      ahbcfg.b.dmaenable = 1;
+      USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GAHBCFG, ahbcfg.d32);
+      
+    }    
+  }
+  else /* FS interface (embedded Phy or I2C Phy) */
+  {
+    
+    usbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);;
+    usbcfg.b.physel  = 1; /* FS Interface */
+    USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GUSBCFG, usbcfg.d32);
+    /* Reset after a PHY select and set Host mode */
+    USB_OTG_CoreReset(pdev);
+    /* Enable the I2C interface and deactivate the power down*/
+    gccfg.d32 = 0;
+    gccfg.b.pwdn = 1;
+    
+    if(pdev->cfg.phy_itface == USB_OTG_I2C_PHY)
+    {
+      gccfg.b.i2cifen = 1;
+    }   
+    gccfg.b.vbussensingA = 1 ;
+    gccfg.b.vbussensingB = 1 ;     
+#ifndef VBUS_SENSING_ENABLED
+    gccfg.b.disablevbussensing = 1; 
+#endif    
+    
+    if(pdev->cfg.Sof_output)
+    {
+      gccfg.b.sofouten = 1;  
+    }
+    
+    USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GCCFG, gccfg.d32);
+    USB_OTG_BSP_mDelay(20);
+    /* Program GUSBCFG.OtgUtmifsSel to I2C*/
+    usbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);
+    
+    if(pdev->cfg.phy_itface == USB_OTG_I2C_PHY)
+    {
+      usbcfg.b.otgutmifssel = 1;
+    }
+    
+    USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GUSBCFG, usbcfg.d32);
+    
+    if(pdev->cfg.phy_itface == USB_OTG_I2C_PHY)
+    {
+      /*Program GI2CCTL.I2CEn*/
+      i2cctl.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GI2CCTL);
+      i2cctl.b.i2cdevaddr = 1;
+      i2cctl.b.i2cen = 0;
+      i2cctl.b.dat_se0 = 1;
+      i2cctl.b.addr = 0x2D;
+      USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GI2CCTL, i2cctl.d32);
+      
+      USB_OTG_BSP_mDelay(200);
+      
+      i2cctl.b.i2cen = 1;
+      USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GI2CCTL, i2cctl.d32);
+      USB_OTG_BSP_mDelay(200);
+    }
+  }
+  /* case the HS core is working in FS mode */
+  if(pdev->cfg.dma_enable == 1)
+  {
+    
+    ahbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GAHBCFG);
+    ahbcfg.b.hburstlen = 5; /* 64 x 32-bits*/
+    ahbcfg.b.dmaenable = 1;
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GAHBCFG, ahbcfg.d32);
+    
+  }
+  /* initialize OTG features */
+#ifdef  USE_OTG_MODE
+  usbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);
+  usbcfg.b.hnpcap = 1;
+  usbcfg.b.srpcap = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GUSBCFG, usbcfg.d32);
+  USB_OTG_EnableCommonInt(pdev);
+#endif
+  return status;
+}
+/**
+* @brief  USB_OTG_EnableGlobalInt
+*         Enables the controller's Global Int in the AHB Config reg
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EnableGlobalInt(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_GAHBCFG_TypeDef  ahbcfg;
+  
+  ahbcfg.d32 = 0;
+  ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */
+  USB_OTG_MODIFY_REG32(&pdev->regs.GREGS->GAHBCFG, 0, ahbcfg.d32);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_DisableGlobalInt
+*         Enables the controller's Global Int in the AHB Config reg
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_DisableGlobalInt(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_GAHBCFG_TypeDef  ahbcfg;
+  ahbcfg.d32 = 0;
+  ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */
+  USB_OTG_MODIFY_REG32(&pdev->regs.GREGS->GAHBCFG, ahbcfg.d32, 0);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_FlushTxFifo : Flush a Tx FIFO
+* @param  pdev : Selected device
+* @param  num : FO num
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_FlushTxFifo (USB_OTG_CORE_HANDLE *pdev , uint32_t num )
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  __IO USB_OTG_GRSTCTL_TypeDef  greset;
+  
+  uint32_t count = 0;
+  greset.d32 = 0;
+  greset.b.txfflsh = 1;
+  greset.b.txfnum  = num;
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GRSTCTL, greset.d32 );
+  do
+  {
+    greset.d32 = USB_OTG_READ_REG32( &pdev->regs.GREGS->GRSTCTL);
+    if (++count > 200000)
+    {
+      break;
+    }
+  }
+  while (greset.b.txfflsh == 1);
+  /* Wait for 3 PHY Clocks*/
+  USB_OTG_BSP_uDelay(3);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_FlushRxFifo : Flush a Rx FIFO
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_FlushRxFifo( USB_OTG_CORE_HANDLE *pdev )
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  __IO USB_OTG_GRSTCTL_TypeDef  greset;
+  uint32_t count = 0;
+  
+  greset.d32 = 0;
+  greset.b.rxfflsh = 1;
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GRSTCTL, greset.d32 );
+  do
+  {
+    greset.d32 = USB_OTG_READ_REG32( &pdev->regs.GREGS->GRSTCTL);
+    if (++count > 200000)
+    {
+      break;
+    }
+  }
+  while (greset.b.rxfflsh == 1);
+  /* Wait for 3 PHY Clocks*/
+  USB_OTG_BSP_uDelay(3);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_SetCurrentMode : Set ID line
+* @param  pdev : Selected device
+* @param  mode :  (Host/device)
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_SetCurrentMode(USB_OTG_CORE_HANDLE *pdev , uint8_t mode)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_GUSBCFG_TypeDef  usbcfg;
+  
+  usbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);
+  
+  usbcfg.b.force_host = 0;
+  usbcfg.b.force_dev = 0;
+  
+  if ( mode == HOST_MODE)
+  {
+    usbcfg.b.force_host = 1;
+  }
+  else if ( mode == DEVICE_MODE)
+  {
+    usbcfg.b.force_dev = 1;
+  }
+  
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GUSBCFG, usbcfg.d32);
+  USB_OTG_BSP_mDelay(50);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_GetMode : Get current mode
+* @param  pdev : Selected device
+* @retval current mode
+*/
+uint32_t USB_OTG_GetMode(USB_OTG_CORE_HANDLE *pdev)
+{
+  return (USB_OTG_READ_REG32(&pdev->regs.GREGS->GINTSTS ) & 0x1);
+}
+
+
+/**
+* @brief  USB_OTG_IsDeviceMode : Check if it is device mode
+* @param  pdev : Selected device
+* @retval num_in_ep
+*/
+uint8_t USB_OTG_IsDeviceMode(USB_OTG_CORE_HANDLE *pdev)
+{
+  return (USB_OTG_GetMode(pdev) != HOST_MODE);
+}
+
+
+/**
+* @brief  USB_OTG_IsHostMode : Check if it is host mode
+* @param  pdev : Selected device
+* @retval num_in_ep
+*/
+uint8_t USB_OTG_IsHostMode(USB_OTG_CORE_HANDLE *pdev)
+{
+  return (USB_OTG_GetMode(pdev) == HOST_MODE);
+}
+
+
+/**
+* @brief  USB_OTG_ReadCoreItr : returns the Core Interrupt register
+* @param  pdev : Selected device
+* @retval Status
+*/
+uint32_t USB_OTG_ReadCoreItr(USB_OTG_CORE_HANDLE *pdev)
+{
+  uint32_t v = 0;
+  v = USB_OTG_READ_REG32(&pdev->regs.GREGS->GINTSTS);
+  v &= USB_OTG_READ_REG32(&pdev->regs.GREGS->GINTMSK);
+  return v;
+}
+
+
+/**
+* @brief  USB_OTG_ReadOtgItr : returns the USB_OTG Interrupt register
+* @param  pdev : Selected device
+* @retval Status
+*/
+uint32_t USB_OTG_ReadOtgItr (USB_OTG_CORE_HANDLE *pdev)
+{
+  return (USB_OTG_READ_REG32 (&pdev->regs.GREGS->GOTGINT));
+}
+
+#ifdef USE_HOST_MODE
+/**
+* @brief  USB_OTG_CoreInitHost : Initializes USB_OTG controller for host mode
+* @param  pdev : Selected device
+* @retval status
+*/
+USB_OTG_STS USB_OTG_CoreInitHost(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS                     status = USB_OTG_OK;
+  USB_OTG_FSIZ_TypeDef            nptxfifosize;
+  USB_OTG_FSIZ_TypeDef            ptxfifosize;  
+  USB_OTG_HCFG_TypeDef            hcfg;
+  
+#ifdef USE_OTG_MODE
+  USB_OTG_OTGCTL_TypeDef          gotgctl;
+#endif
+  
+  uint32_t                        i = 0;
+  
+  nptxfifosize.d32 = 0;  
+  ptxfifosize.d32 = 0;
+#ifdef USE_OTG_MODE
+  gotgctl.d32 = 0;
+#endif
+  hcfg.d32 = 0;
+  
+  
+  /* configure charge pump IO */
+  USB_OTG_BSP_ConfigVBUS(pdev);
+  
+  /* Restart the Phy Clock */
+  USB_OTG_WRITE_REG32(pdev->regs.PCGCCTL, 0);
+  
+  /* Initialize Host Configuration Register */
+  USB_OTG_InitFSLSPClkSel(pdev , HCFG_48_MHZ); /* in init phase */
+  
+  hcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.HREGS->HCFG);
+  hcfg.b.fslssupp = 0;
+  USB_OTG_WRITE_REG32(&pdev->regs.HREGS->HCFG, hcfg.d32);
+  
+  /* Configure data FIFO sizes */
+  /* Rx FIFO */
+#ifdef USB_OTG_FS_CORE
+  if(pdev->cfg.coreID == USB_OTG_FS_CORE_ID)
+  {
+    /* set Rx FIFO size */
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GRXFSIZ, RX_FIFO_FS_SIZE);
+    nptxfifosize.b.startaddr = RX_FIFO_FS_SIZE;   
+    nptxfifosize.b.depth = TXH_NP_FS_FIFOSIZ;  
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->DIEPTXF0_HNPTXFSIZ, nptxfifosize.d32);
+    
+    ptxfifosize.b.startaddr = RX_FIFO_FS_SIZE + TXH_NP_FS_FIFOSIZ;
+    ptxfifosize.b.depth     = TXH_P_FS_FIFOSIZ;
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->HPTXFSIZ, ptxfifosize.d32);      
+  }
+#endif
+#ifdef USB_OTG_HS_CORE  
+   if (pdev->cfg.coreID == USB_OTG_HS_CORE_ID)
+  {
+   /* set Rx FIFO size */
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GRXFSIZ, RX_FIFO_HS_SIZE);
+    nptxfifosize.b.startaddr = RX_FIFO_HS_SIZE;   
+    nptxfifosize.b.depth = TXH_NP_HS_FIFOSIZ;  
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->DIEPTXF0_HNPTXFSIZ, nptxfifosize.d32);
+    
+    ptxfifosize.b.startaddr = RX_FIFO_HS_SIZE + TXH_NP_HS_FIFOSIZ;
+    ptxfifosize.b.depth     = TXH_P_HS_FIFOSIZ;
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->HPTXFSIZ, ptxfifosize.d32);      
+  }
+#endif  
+  
+#ifdef USE_OTG_MODE
+  /* Clear Host Set HNP Enable in the USB_OTG Control Register */
+  gotgctl.b.hstsethnpen = 1;
+  USB_OTG_MODIFY_REG32( &pdev->regs.GREGS->GOTGCTL, gotgctl.d32, 0);
+#endif
+  
+  /* Make sure the FIFOs are flushed. */
+  USB_OTG_FlushTxFifo(pdev, 0x10 );         /* all Tx FIFOs */
+  USB_OTG_FlushRxFifo(pdev);
+  
+  
+  /* Clear all pending HC Interrupts */
+  for (i = 0; i < pdev->cfg.host_channels; i++)
+  {
+    USB_OTG_WRITE_REG32( &pdev->regs.HC_REGS[i]->HCINT, 0xFFFFFFFF );
+    USB_OTG_WRITE_REG32( &pdev->regs.HC_REGS[i]->HCGINTMSK, 0 );
+  }
+#ifndef USE_OTG_MODE
+  USB_OTG_DriveVbus(pdev, 1);
+#endif
+  
+  USB_OTG_EnableHostInt(pdev);
+  return status;
+}
+
+/**
+* @brief  USB_OTG_IsEvenFrame 
+*         This function returns the frame number for sof packet
+* @param  pdev : Selected device
+* @retval Frame number
+*/
+uint8_t USB_OTG_IsEvenFrame (USB_OTG_CORE_HANDLE *pdev) 
+{
+  return !(USB_OTG_READ_REG32(&pdev->regs.HREGS->HFNUM) & 0x1);
+}
+
+/**
+* @brief  USB_OTG_DriveVbus : set/reset vbus
+* @param  pdev : Selected device
+* @param  state : VBUS state
+* @retval None
+*/
+void USB_OTG_DriveVbus (USB_OTG_CORE_HANDLE *pdev, uint8_t state)
+{
+  USB_OTG_HPRT0_TypeDef     hprt0;
+  
+  hprt0.d32 = 0;
+  
+  /* enable disable the external charge pump */
+  USB_OTG_BSP_DriveVBUS(pdev, state);
+  
+  /* Turn on the Host port power. */
+  hprt0.d32 = USB_OTG_ReadHPRT0(pdev);
+  if ((hprt0.b.prtpwr == 0 ) && (state == 1 ))
+  {
+    hprt0.b.prtpwr = 1;
+    USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
+  }
+  if ((hprt0.b.prtpwr == 1 ) && (state == 0 ))
+  {
+    hprt0.b.prtpwr = 0;
+    USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
+  }
+  
+  USB_OTG_BSP_mDelay(200);
+}
+/**
+* @brief  USB_OTG_EnableHostInt: Enables the Host mode interrupts
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EnableHostInt(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS       status = USB_OTG_OK;
+  USB_OTG_GINTMSK_TypeDef  intmsk;
+  intmsk.d32 = 0;
+  /* Disable all interrupts. */
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTMSK, 0);
+  
+  /* Clear any pending interrupts. */
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTSTS, 0xFFFFFFFF);
+  
+  /* Enable the common interrupts */
+  USB_OTG_EnableCommonInt(pdev);
+  
+  if (pdev->cfg.dma_enable == 0)
+  {  
+    intmsk.b.rxstsqlvl  = 1;
+  }  
+  intmsk.b.portintr   = 1;
+  intmsk.b.hcintr     = 1;
+  intmsk.b.disconnect = 1;  
+  intmsk.b.sofintr    = 1;  
+  intmsk.b.incomplisoout  = 1; 
+  USB_OTG_MODIFY_REG32(&pdev->regs.GREGS->GINTMSK, intmsk.d32, intmsk.d32);
+  return status;
+}
+
+/**
+* @brief  USB_OTG_InitFSLSPClkSel : Initializes the FSLSPClkSel field of the 
+*         HCFG register on the PHY type
+* @param  pdev : Selected device
+* @param  freq : clock frequency
+* @retval None
+*/
+void USB_OTG_InitFSLSPClkSel(USB_OTG_CORE_HANDLE *pdev , uint8_t freq)
+{
+  USB_OTG_HCFG_TypeDef   hcfg;
+  
+  hcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.HREGS->HCFG);
+  hcfg.b.fslspclksel = freq;
+  USB_OTG_WRITE_REG32(&pdev->regs.HREGS->HCFG, hcfg.d32);
+}
+
+
+/**
+* @brief  USB_OTG_ReadHPRT0 : Reads HPRT0 to modify later
+* @param  pdev : Selected device
+* @retval HPRT0 value
+*/
+uint32_t USB_OTG_ReadHPRT0(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_HPRT0_TypeDef  hprt0;
+  
+  hprt0.d32 = USB_OTG_READ_REG32(pdev->regs.HPRT0);
+  hprt0.b.prtena = 0;
+  hprt0.b.prtconndet = 0;
+  hprt0.b.prtenchng = 0;
+  hprt0.b.prtovrcurrchng = 0;
+  return hprt0.d32;
+}
+
+
+/**
+* @brief  USB_OTG_ReadHostAllChannels_intr : Register PCD Callbacks
+* @param  pdev : Selected device
+* @retval Status
+*/
+uint32_t USB_OTG_ReadHostAllChannels_intr (USB_OTG_CORE_HANDLE *pdev)
+{
+  return (USB_OTG_READ_REG32 (&pdev->regs.HREGS->HAINT));
+}
+
+
+/**
+* @brief  USB_OTG_ResetPort : Reset Host Port
+* @param  pdev : Selected device
+* @retval status
+* @note : (1)The application must wait at least 10 ms (+ 10 ms security)
+*   before clearing the reset bit.
+*/
+uint32_t USB_OTG_ResetPort(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_HPRT0_TypeDef  hprt0;
+  
+  hprt0.d32 = USB_OTG_ReadHPRT0(pdev);
+  hprt0.b.prtrst = 1;
+  USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
+  USB_OTG_BSP_mDelay (10);                                /* See Note #1 */
+  hprt0.b.prtrst = 0;
+  USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
+  USB_OTG_BSP_mDelay (20);   
+  return 1;
+}
+
+
+/**
+* @brief  USB_OTG_HC_Init : Prepares a host channel for transferring packets
+* @param  pdev : Selected device
+* @param  hc_num : channel number
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_HC_Init(USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  uint32_t intr_enable = 0;
+  USB_OTG_HCGINTMSK_TypeDef  hcintmsk;
+  USB_OTG_GINTMSK_TypeDef    gintmsk;
+  USB_OTG_HCCHAR_TypeDef     hcchar;
+  USB_OTG_HCINTn_TypeDef     hcint;
+  
+  
+  gintmsk.d32 = 0;
+  hcintmsk.d32 = 0;
+  hcchar.d32 = 0;
+  
+  /* Clear old interrupt conditions for this host channel. */
+  hcint.d32 = 0xFFFFFFFF;
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINT, hcint.d32);
+  
+  /* Enable channel interrupts required for this transfer. */
+  hcintmsk.d32 = 0;
+  
+  if (pdev->cfg.dma_enable == 1)
+  {
+    hcintmsk.b.ahberr = 1;
+  }
+  
+  switch (pdev->host.hc[hc_num].ep_type) 
+  {
+  case EP_TYPE_CTRL:
+  case EP_TYPE_BULK:
+    hcintmsk.b.xfercompl = 1;
+    hcintmsk.b.stall = 1;
+    hcintmsk.b.xacterr = 1;
+    hcintmsk.b.datatglerr = 1;
+    hcintmsk.b.nak = 1;  
+    if (pdev->host.hc[hc_num].ep_is_in) 
+    {
+      hcintmsk.b.bblerr = 1;
+    } 
+    else 
+    {
+      hcintmsk.b.nyet = 1;
+      if (pdev->host.hc[hc_num].do_ping) 
+      {
+        hcintmsk.b.ack = 1;
+      }
+    }
+    break;
+  case EP_TYPE_INTR:
+    hcintmsk.b.xfercompl = 1;
+    hcintmsk.b.nak = 1;
+    hcintmsk.b.stall = 1;
+    hcintmsk.b.xacterr = 1;
+    hcintmsk.b.datatglerr = 1;
+    hcintmsk.b.frmovrun = 1;
+    
+    if (pdev->host.hc[hc_num].ep_is_in) 
+    {
+      hcintmsk.b.bblerr = 1;
+    }
+    
+    break;
+  case EP_TYPE_ISOC:
+    hcintmsk.b.xfercompl = 1;
+    hcintmsk.b.frmovrun = 1;
+    hcintmsk.b.ack = 1;
+    
+    if (pdev->host.hc[hc_num].ep_is_in) 
+    {
+      hcintmsk.b.xacterr = 1;
+      hcintmsk.b.bblerr = 1;
+    }
+    break;
+  }
+  
+  
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK, hcintmsk.d32);
+  
+  
+  /* Enable the top level host channel interrupt. */
+  intr_enable = (1 << hc_num);
+  USB_OTG_MODIFY_REG32(&pdev->regs.HREGS->HAINTMSK, 0, intr_enable);
+  
+  /* Make sure host channel interrupts are enabled. */
+  gintmsk.b.hcintr = 1;
+  USB_OTG_MODIFY_REG32(&pdev->regs.GREGS->GINTMSK, 0, gintmsk.d32);
+  
+  /* Program the HCCHAR register */
+  hcchar.d32 = 0;
+  hcchar.b.devaddr = pdev->host.hc[hc_num].dev_addr;
+  hcchar.b.epnum   = pdev->host.hc[hc_num].ep_num;
+  hcchar.b.epdir   = pdev->host.hc[hc_num].ep_is_in;
+  hcchar.b.lspddev = (pdev->host.hc[hc_num].speed == HPRT0_PRTSPD_LOW_SPEED);
+  hcchar.b.eptype  = pdev->host.hc[hc_num].ep_type;
+  hcchar.b.mps     = pdev->host.hc[hc_num].max_packet;
+  if (pdev->host.hc[hc_num].ep_type == HCCHAR_INTR)
+  {
+    hcchar.b.oddfrm  = 1;
+  }
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR, hcchar.d32);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_HC_StartXfer : Start transfer
+* @param  pdev : Selected device
+* @param  hc_num : channel number
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_HC_StartXfer(USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_HCCHAR_TypeDef   hcchar;
+  USB_OTG_HCTSIZn_TypeDef  hctsiz;
+  USB_OTG_HNPTXSTS_TypeDef hnptxsts; 
+  USB_OTG_HPTXSTS_TypeDef  hptxsts; 
+  USB_OTG_GINTMSK_TypeDef  intmsk;
+  uint16_t                 len_words = 0;   
+  
+  uint16_t num_packets;
+  uint16_t max_hc_pkt_count;
+  
+  max_hc_pkt_count = 256;
+  hctsiz.d32 = 0;
+  hcchar.d32 = 0;
+  intmsk.d32 = 0;
+  
+  /* Compute the expected number of packets associated to the transfer */
+  if (pdev->host.hc[hc_num].xfer_len > 0)
+  {
+    num_packets = (pdev->host.hc[hc_num].xfer_len + \
+      pdev->host.hc[hc_num].max_packet - 1) / pdev->host.hc[hc_num].max_packet;
+    
+    if (num_packets > max_hc_pkt_count)
+    {
+      num_packets = max_hc_pkt_count;
+      pdev->host.hc[hc_num].xfer_len = num_packets * \
+        pdev->host.hc[hc_num].max_packet;
+    }
+  }
+  else
+  {
+    num_packets = 1;
+  }
+  if (pdev->host.hc[hc_num].ep_is_in)
+  {
+    pdev->host.hc[hc_num].xfer_len = num_packets * \
+      pdev->host.hc[hc_num].max_packet;
+  }
+  /* Initialize the HCTSIZn register */
+  hctsiz.b.xfersize = pdev->host.hc[hc_num].xfer_len;
+  hctsiz.b.pktcnt = num_packets;
+  hctsiz.b.pid = pdev->host.hc[hc_num].data_pid;
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCTSIZ, hctsiz.d32);
+  
+  if (pdev->cfg.dma_enable == 1)
+  {
+    USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCDMA, (unsigned int)pdev->host.hc[hc_num].xfer_buff);
+  }
+  
+  
+  hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR);
+  hcchar.b.oddfrm = USB_OTG_IsEvenFrame(pdev);
+  
+  /* Set host channel enable */
+  hcchar.b.chen = 1;
+  hcchar.b.chdis = 0;
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR, hcchar.d32);
+
+  if (pdev->cfg.dma_enable == 0) /* Slave mode */
+  {  
+    if((pdev->host.hc[hc_num].ep_is_in == 0) && 
+        (pdev->host.hc[hc_num].xfer_len > 0))
+    {
+      switch(pdev->host.hc[hc_num].ep_type) 
+      {
+        /* Non periodic transfer */
+      case EP_TYPE_CTRL:
+      case EP_TYPE_BULK:
+        
+        hnptxsts.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->HNPTXSTS);
+        len_words = (pdev->host.hc[hc_num].xfer_len + 3) / 4;
+        
+        /* check if there is enough space in FIFO space */
+        if(len_words > hnptxsts.b.nptxfspcavail)
+        {
+          /* need to process data in nptxfempty interrupt */
+          intmsk.b.nptxfempty = 1;
+          USB_OTG_MODIFY_REG32( &pdev->regs.GREGS->GINTMSK, 0, intmsk.d32);  
+        }
+        
+        break;
+        /* Periodic transfer */
+      case EP_TYPE_INTR:
+      case EP_TYPE_ISOC:
+        hptxsts.d32 = USB_OTG_READ_REG32(&pdev->regs.HREGS->HPTXSTS);
+        len_words = (pdev->host.hc[hc_num].xfer_len + 3) / 4;
+        /* check if there is enough space in FIFO space */
+        if(len_words > hptxsts.b.ptxfspcavail) /* split the transfer */
+        {
+          /* need to process data in ptxfempty interrupt */
+          intmsk.b.ptxfempty = 1;
+          USB_OTG_MODIFY_REG32( &pdev->regs.GREGS->GINTMSK, 0, intmsk.d32);  
+        }
+        break;
+        
+      default:
+        break;
+      }
+      
+      /* Write packet into the Tx FIFO. */
+      USB_OTG_WritePacket(pdev, 
+                          pdev->host.hc[hc_num].xfer_buff , 
+                          hc_num, pdev->host.hc[hc_num].xfer_len);
+    }
+  }
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_HC_Halt : Halt channel
+* @param  pdev : Selected device
+* @param  hc_num : channel number
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_HC_Halt(USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_HNPTXSTS_TypeDef            nptxsts;
+  USB_OTG_HPTXSTS_TypeDef             hptxsts;
+  USB_OTG_HCCHAR_TypeDef              hcchar;
+  
+  nptxsts.d32 = 0;
+  hptxsts.d32 = 0;
+  hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR);
+  hcchar.b.chen = 1;
+  hcchar.b.chdis = 1;
+  
+  /* Check for space in the request queue to issue the halt. */
+  if (hcchar.b.eptype == HCCHAR_CTRL || hcchar.b.eptype == HCCHAR_BULK)
+  {
+    nptxsts.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->HNPTXSTS);
+    if (nptxsts.b.nptxqspcavail == 0)
+    {
+      hcchar.b.chen = 0;
+    }
+  }
+  else
+  {
+    hptxsts.d32 = USB_OTG_READ_REG32(&pdev->regs.HREGS->HPTXSTS);
+    if (hptxsts.b.ptxqspcavail == 0)
+    {
+      hcchar.b.chen = 0;
+    }
+  }
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR, hcchar.d32);
+  return status;
+}
+
+/**
+* @brief  Issue a ping token
+* @param  None
+* @retval : None
+*/
+USB_OTG_STS USB_OTG_HC_DoPing(USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num)
+{
+  USB_OTG_STS               status = USB_OTG_OK;
+  USB_OTG_HCCHAR_TypeDef    hcchar;
+  USB_OTG_HCTSIZn_TypeDef   hctsiz;  
+  hctsiz.d32 = 0;
+  hctsiz.b.dopng = 1;
+  hctsiz.b.pktcnt = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCTSIZ, hctsiz.d32);
+  
+  hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR);
+  hcchar.b.chen = 1;
+  hcchar.b.chdis = 0;
+  USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCCHAR, hcchar.d32);
+  return status;  
+}
+
+/**
+* @brief  Stop the device and clean up fifo's
+* @param  None
+* @retval : None
+*/
+void USB_OTG_StopHost(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_HCCHAR_TypeDef  hcchar;
+  uint32_t                i;
+  
+  USB_OTG_WRITE_REG32(&pdev->regs.HREGS->HAINTMSK , 0);
+  USB_OTG_WRITE_REG32(&pdev->regs.HREGS->HAINT,      0xFFFFFFFF);
+  /* Flush out any leftover queued requests. */
+  
+  for (i = 0; i < pdev->cfg.host_channels; i++)
+  {
+    hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[i]->HCCHAR);
+    hcchar.b.chen = 0;
+    hcchar.b.chdis = 1;
+    hcchar.b.epdir = 0;
+    USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[i]->HCCHAR, hcchar.d32);
+  }
+  
+  /* Flush the FIFO */
+  USB_OTG_FlushRxFifo(pdev);
+  USB_OTG_FlushTxFifo(pdev ,  0x10 );  
+}
+#endif
+#ifdef USE_DEVICE_MODE
+/*         PCD Core Layer       */
+
+/**
+* @brief  USB_OTG_InitDevSpeed :Initializes the DevSpd field of DCFG register 
+*         depending the PHY type and the enumeration speed of the device.
+* @param  pdev : Selected device
+* @retval : None
+*/
+void USB_OTG_InitDevSpeed(USB_OTG_CORE_HANDLE *pdev , uint8_t speed)
+{
+  USB_OTG_DCFG_TypeDef   dcfg;
+  
+  dcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCFG);
+  dcfg.b.devspd = speed;
+  USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCFG, dcfg.d32);
+}
+
+
+/**
+* @brief  USB_OTG_CoreInitDev : Initializes the USB_OTG controller registers 
+*         for device mode
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_CoreInitDev (USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS             status       = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  uint32_t i;
+  USB_OTG_DCFG_TypeDef    dcfg;
+  USB_OTG_FSIZ_TypeDef    nptxfifosize;
+  USB_OTG_FSIZ_TypeDef    txfifosize;
+  USB_OTG_DIEPMSK_TypeDef msk;
+  USB_OTG_DTHRCTL_TypeDef dthrctl;  
+  
+  depctl.d32 = 0;
+  dcfg.d32 = 0;
+  nptxfifosize.d32 = 0;
+  txfifosize.d32 = 0;
+  msk.d32 = 0;
+  
+  /* Restart the Phy Clock */
+  USB_OTG_WRITE_REG32(pdev->regs.PCGCCTL, 0);
+  /* Device configuration register */
+  dcfg.d32 = USB_OTG_READ_REG32( &pdev->regs.DREGS->DCFG);
+  dcfg.b.perfrint = DCFG_FRAME_INTERVAL_80;
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DCFG, dcfg.d32 );
+  
+#ifdef USB_OTG_FS_CORE
+  if(pdev->cfg.coreID == USB_OTG_FS_CORE_ID  )
+  {  
+    
+    /* Set Full speed phy */
+    USB_OTG_InitDevSpeed (pdev , USB_OTG_SPEED_PARAM_FULL);
+    
+    /* set Rx FIFO size */
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GRXFSIZ, RX_FIFO_FS_SIZE);
+    
+    /* EP0 TX*/
+    nptxfifosize.b.depth     = TX0_FIFO_FS_SIZE;
+    nptxfifosize.b.startaddr = RX_FIFO_FS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF0_HNPTXFSIZ, nptxfifosize.d32 );
+    
+    
+    /* EP1 TX*/
+    txfifosize.b.startaddr = nptxfifosize.b.startaddr + nptxfifosize.b.depth;
+    txfifosize.b.depth = TX1_FIFO_FS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[0], txfifosize.d32 );
+    
+    
+    /* EP2 TX*/
+    txfifosize.b.startaddr += txfifosize.b.depth;
+    txfifosize.b.depth = TX2_FIFO_FS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[1], txfifosize.d32 );
+    
+    
+    /* EP3 TX*/  
+    txfifosize.b.startaddr += txfifosize.b.depth;
+    txfifosize.b.depth = TX3_FIFO_FS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[2], txfifosize.d32 );
+  }
+#endif
+#ifdef USB_OTG_HS_CORE
+  if(pdev->cfg.coreID == USB_OTG_HS_CORE_ID  )
+  {
+    
+    /* Set High speed phy */
+    
+    if(pdev->cfg.phy_itface  == USB_OTG_ULPI_PHY)
+    {
+       USB_OTG_InitDevSpeed (pdev , USB_OTG_SPEED_PARAM_HIGH);
+    }
+    else /* set High speed phy in Full speed mode */
+    {
+      USB_OTG_InitDevSpeed (pdev , USB_OTG_SPEED_PARAM_HIGH_IN_FULL);
+    }
+    
+    /* set Rx FIFO size */
+    USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GRXFSIZ, RX_FIFO_HS_SIZE);
+    
+    /* EP0 TX*/
+    nptxfifosize.b.depth     = TX0_FIFO_HS_SIZE;
+    nptxfifosize.b.startaddr = RX_FIFO_HS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF0_HNPTXFSIZ, nptxfifosize.d32 );
+    
+    
+    /* EP1 TX*/
+    txfifosize.b.startaddr = nptxfifosize.b.startaddr + nptxfifosize.b.depth;
+    txfifosize.b.depth = TX1_FIFO_HS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[0], txfifosize.d32 );
+    
+    
+    /* EP2 TX*/
+    txfifosize.b.startaddr += txfifosize.b.depth;
+    txfifosize.b.depth = TX2_FIFO_HS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[1], txfifosize.d32 );
+    
+    
+    /* EP3 TX*/  
+    txfifosize.b.startaddr += txfifosize.b.depth;
+    txfifosize.b.depth = TX3_FIFO_HS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[2], txfifosize.d32 );
+    
+    /* EP4 TX*/
+    txfifosize.b.startaddr += txfifosize.b.depth;
+    txfifosize.b.depth = TX4_FIFO_HS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[3], txfifosize.d32 );
+    
+    
+    /* EP5 TX*/  
+    txfifosize.b.startaddr += txfifosize.b.depth;
+    txfifosize.b.depth = TX5_FIFO_HS_SIZE;
+    USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF[4], txfifosize.d32 );
+  }
+#endif  
+  /* Flush the FIFOs */
+  USB_OTG_FlushTxFifo(pdev , 0x10); /* all Tx FIFOs */
+  USB_OTG_FlushRxFifo(pdev);
+  /* Clear all pending Device Interrupts */
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DIEPMSK, 0 );
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DOEPMSK, 0 );
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DAINT, 0xFFFFFFFF );
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DAINTMSK, 0 );
+  
+  for (i = 0; i < pdev->cfg.dev_endpoints; i++)
+  {
+    depctl.d32 = USB_OTG_READ_REG32(&pdev->regs.INEP_REGS[i]->DIEPCTL);
+    if (depctl.b.epena)
+    {
+      depctl.d32 = 0;
+      depctl.b.epdis = 1;
+      depctl.b.snak = 1;
+    }
+    else
+    {
+      depctl.d32 = 0;
+    }
+    USB_OTG_WRITE_REG32( &pdev->regs.INEP_REGS[i]->DIEPCTL, depctl.d32);
+    USB_OTG_WRITE_REG32( &pdev->regs.INEP_REGS[i]->DIEPTSIZ, 0);
+    USB_OTG_WRITE_REG32( &pdev->regs.INEP_REGS[i]->DIEPINT, 0xFF);
+  }
+  for (i = 0; i <  pdev->cfg.dev_endpoints; i++)
+  {
+    USB_OTG_DEPCTL_TypeDef  depctl;
+    depctl.d32 = USB_OTG_READ_REG32(&pdev->regs.OUTEP_REGS[i]->DOEPCTL);
+    if (depctl.b.epena)
+    {
+      depctl.d32 = 0;
+      depctl.b.epdis = 1;
+      depctl.b.snak = 1;
+    }
+    else
+    {
+      depctl.d32 = 0;
+    }
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[i]->DOEPCTL, depctl.d32);
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[i]->DOEPTSIZ, 0);
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[i]->DOEPINT, 0xFF);
+  }
+  msk.d32 = 0;
+  msk.b.txfifoundrn = 1;
+  USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPMSK, msk.d32, msk.d32);
+  
+  if (pdev->cfg.dma_enable == 1)
+  {
+    dthrctl.d32 = 0;
+    dthrctl.b.non_iso_thr_en = 1;
+    dthrctl.b.iso_thr_en = 1;
+    dthrctl.b.tx_thr_len = 64;
+    dthrctl.b.rx_thr_en = 1;
+    dthrctl.b.rx_thr_len = 64;
+    USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DTHRCTL, dthrctl.d32);  
+  }
+  USB_OTG_EnableDevInt(pdev);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_EnableDevInt : Enables the Device mode interrupts
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EnableDevInt(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_GINTMSK_TypeDef  intmsk;
+  
+  intmsk.d32 = 0;
+  
+  /* Disable all interrupts. */
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GINTMSK, 0);
+  /* Clear any pending interrupts */
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GINTSTS, 0xFFFFFFFF);
+  /* Enable the common interrupts */
+  USB_OTG_EnableCommonInt(pdev);
+  
+  if (pdev->cfg.dma_enable == 0)
+  {
+    intmsk.b.rxstsqlvl = 1;
+  }
+  
+  /* Enable interrupts matching to the Device mode ONLY */
+  intmsk.b.usbsuspend = 1;
+  intmsk.b.usbreset   = 1;
+  intmsk.b.enumdone   = 1;
+  intmsk.b.inepintr   = 1;
+  intmsk.b.outepintr  = 1;
+  intmsk.b.sofintr    = 1; 
+
+  intmsk.b.incomplisoin    = 1; 
+  intmsk.b.incomplisoout    = 1;   
+#ifdef VBUS_SENSING_ENABLED
+  intmsk.b.sessreqintr    = 1; 
+  intmsk.b.otgintr    = 1;    
+#endif  
+  USB_OTG_MODIFY_REG32( &pdev->regs.GREGS->GINTMSK, intmsk.d32, intmsk.d32);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_GetDeviceSpeed
+*         Get the device speed from the device status register
+* @param  None
+* @retval status
+*/
+enum USB_OTG_SPEED USB_OTG_GetDeviceSpeed (USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_DSTS_TypeDef  dsts;
+  enum USB_OTG_SPEED speed = USB_SPEED_UNKNOWN;
+  
+  
+  dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
+  
+  switch (dsts.b.enumspd)
+  {
+  case DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ:
+    speed = USB_SPEED_HIGH;
+    break;
+  case DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ:
+  case DSTS_ENUMSPD_FS_PHY_48MHZ:
+    speed = USB_SPEED_FULL;
+    break;
+    
+  case DSTS_ENUMSPD_LS_PHY_6MHZ:
+    speed = USB_SPEED_LOW;
+    break;
+  }
+  
+  return speed;
+}
+/**
+* @brief  enables EP0 OUT to receive SETUP packets and configures EP0
+*   for transmitting packets
+* @param  None
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS  USB_OTG_EP0Activate(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_STS             status = USB_OTG_OK;
+  USB_OTG_DSTS_TypeDef    dsts;
+  USB_OTG_DEPCTL_TypeDef  diepctl;
+  USB_OTG_DCTL_TypeDef    dctl;
+  
+  dctl.d32 = 0;
+  /* Read the Device Status and Endpoint 0 Control registers */
+  dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
+  diepctl.d32 = USB_OTG_READ_REG32(&pdev->regs.INEP_REGS[0]->DIEPCTL);
+  /* Set the MPS of the IN EP based on the enumeration speed */
+  switch (dsts.b.enumspd)
+  {
+  case DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ:
+  case DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ:
+  case DSTS_ENUMSPD_FS_PHY_48MHZ:
+    diepctl.b.mps = DEP0CTL_MPS_64;
+    break;
+  case DSTS_ENUMSPD_LS_PHY_6MHZ:
+    diepctl.b.mps = DEP0CTL_MPS_8;
+    break;
+  }
+  USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[0]->DIEPCTL, diepctl.d32);
+  dctl.b.cgnpinnak = 1;
+  USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, dctl.d32, dctl.d32);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_EPActivate : Activates an EP
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EPActivate(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  USB_OTG_DAINT_TypeDef  daintmsk;
+  __IO uint32_t *addr;
+  
+  
+  depctl.d32 = 0;
+  daintmsk.d32 = 0;
+  /* Read DEPCTLn register */
+  if (ep->is_in == 1)
+  {
+    addr = &pdev->regs.INEP_REGS[ep->num]->DIEPCTL;
+    daintmsk.ep.in = 1 << ep->num;
+  }
+  else
+  {
+    addr = &pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL;
+    daintmsk.ep.out = 1 << ep->num;
+  }
+  /* If the EP is already active don't change the EP Control
+  * register. */
+  depctl.d32 = USB_OTG_READ_REG32(addr);
+  if (!depctl.b.usbactep)
+  {
+    depctl.b.mps    = ep->maxpacket;
+    depctl.b.eptype = ep->type;
+    depctl.b.txfnum = ep->tx_fifo_num;
+    depctl.b.setd0pid = 1;
+    depctl.b.usbactep = 1;
+    USB_OTG_WRITE_REG32(addr, depctl.d32);
+  }
+  /* Enable the Interrupt for this EP */
+#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED
+  if((ep->num == 1)&&(pdev->cfg.coreID == USB_OTG_HS_CORE_ID))
+  {
+    USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DEACHMSK, 0, daintmsk.d32);
+  }
+  else
+#endif   
+    USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DAINTMSK, 0, daintmsk.d32);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_EPDeactivate : Deactivates an EP
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EPDeactivate(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  USB_OTG_DAINT_TypeDef  daintmsk;
+  __IO uint32_t *addr;
+  
+  depctl.d32 = 0;
+  daintmsk.d32 = 0;  
+  /* Read DEPCTLn register */
+  if (ep->is_in == 1)
+  {
+    addr = &pdev->regs.INEP_REGS[ep->num]->DIEPCTL;
+    daintmsk.ep.in = 1 << ep->num;
+  }
+  else
+  {
+    addr = &pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL;
+    daintmsk.ep.out = 1 << ep->num;
+  }
+  depctl.b.usbactep = 0;
+  USB_OTG_WRITE_REG32(addr, depctl.d32);
+  /* Disable the Interrupt for this EP */
+  
+#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED
+  if((ep->num == 1)&&(pdev->cfg.coreID == USB_OTG_HS_CORE_ID))
+  {
+    USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DEACHMSK, daintmsk.d32, 0);
+  }
+  else
+#endif    
+    USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DAINTMSK, daintmsk.d32, 0);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_EPStartXfer : Handle the setup for data xfer for an EP and 
+*         starts the xfer
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EPStartXfer(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef     depctl;
+  USB_OTG_DEPXFRSIZ_TypeDef  deptsiz;
+  USB_OTG_DSTS_TypeDef       dsts;    
+  uint32_t fifoemptymsk = 0;  
+  
+  depctl.d32 = 0;
+  deptsiz.d32 = 0;
+  /* IN endpoint */
+  if (ep->is_in == 1)
+  {
+    depctl.d32  = USB_OTG_READ_REG32(&(pdev->regs.INEP_REGS[ep->num]->DIEPCTL));
+    deptsiz.d32 = USB_OTG_READ_REG32(&(pdev->regs.INEP_REGS[ep->num]->DIEPTSIZ));
+    /* Zero Length Packet? */
+    if (ep->xfer_len == 0)
+    {
+      deptsiz.b.xfersize = 0;
+      deptsiz.b.pktcnt = 1;
+    }
+    else
+    {
+      /* Program the transfer size and packet count
+      * as follows: xfersize = N * maxpacket +
+      * short_packet pktcnt = N + (short_packet
+      * exist ? 1 : 0)
+      */
+      deptsiz.b.xfersize = ep->xfer_len;
+      deptsiz.b.pktcnt = (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket;
+
+      if (ep->type == EP_TYPE_ISOC)
+      {
+        deptsiz.b.mc = 1;
+      }       
+    }
+    USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[ep->num]->DIEPTSIZ, deptsiz.d32);
+    
+    if (pdev->cfg.dma_enable == 1)
+    {
+      USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[ep->num]->DIEPDMA, ep->dma_addr);
+    }
+    else
+    {
+      if (ep->type != EP_TYPE_ISOC)
+      {
+        /* Enable the Tx FIFO Empty Interrupt for this EP */
+        if (ep->xfer_len > 0)
+        {
+          fifoemptymsk = 1 << ep->num;
+          USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPEMPMSK, 0, fifoemptymsk);
+        }
+      }
+    }
+    
+    
+    if (ep->type == EP_TYPE_ISOC)
+    {
+      dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
+      
+      if (((dsts.b.soffn)&0x1) == 0)
+      {
+        depctl.b.setd1pid = 1;
+      }
+      else
+      {
+        depctl.b.setd0pid = 1;
+      }
+    } 
+    
+    /* EP enable, IN data in FIFO */
+    depctl.b.cnak = 1;
+    depctl.b.epena = 1;
+    USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[ep->num]->DIEPCTL, depctl.d32);
+
+    if (ep->type == EP_TYPE_ISOC)
+    {
+      USB_OTG_WritePacket(pdev, ep->xfer_buff, ep->num, ep->xfer_len);   
+    }    
+  }
+  else
+  {
+    /* OUT endpoint */
+    depctl.d32  = USB_OTG_READ_REG32(&(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL));
+    deptsiz.d32 = USB_OTG_READ_REG32(&(pdev->regs.OUTEP_REGS[ep->num]->DOEPTSIZ));
+    /* Program the transfer size and packet count as follows:
+    * pktcnt = N
+    * xfersize = N * maxpacket
+    */
+    if (ep->xfer_len == 0)
+    {
+      deptsiz.b.xfersize = ep->maxpacket;
+      deptsiz.b.pktcnt = 1;
+    }
+    else
+    {
+      deptsiz.b.pktcnt = (ep->xfer_len + (ep->maxpacket - 1)) / ep->maxpacket;
+      deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket;
+    }
+    USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPTSIZ, deptsiz.d32);
+    
+    if (pdev->cfg.dma_enable == 1)
+    {
+      USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPDMA, ep->dma_addr);
+    }
+    
+    if (ep->type == EP_TYPE_ISOC)
+    {
+      if (ep->even_odd_frame)
+      {
+        depctl.b.setd1pid = 1;
+      }
+      else
+      {
+        depctl.b.setd0pid = 1;
+      }
+    }
+    /* EP enable */
+    depctl.b.cnak = 1;
+    depctl.b.epena = 1;
+    USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL, depctl.d32);
+  }
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_EP0StartXfer : Handle the setup for a data xfer for EP0 and 
+*         starts the xfer
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EP0StartXfer(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
+{
+  USB_OTG_STS                 status = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef      depctl;
+  USB_OTG_DEP0XFRSIZ_TypeDef  deptsiz;
+  USB_OTG_INEPREGS          *in_regs;
+  uint32_t fifoemptymsk = 0;
+  
+  depctl.d32   = 0;
+  deptsiz.d32  = 0;
+  /* IN endpoint */
+  if (ep->is_in == 1)
+  {
+    in_regs = pdev->regs.INEP_REGS[0];
+    depctl.d32  = USB_OTG_READ_REG32(&in_regs->DIEPCTL);
+    deptsiz.d32 = USB_OTG_READ_REG32(&in_regs->DIEPTSIZ);
+    /* Zero Length Packet? */
+    if (ep->xfer_len == 0)
+    {
+      deptsiz.b.xfersize = 0;
+      deptsiz.b.pktcnt = 1;
+      
+    }
+    else
+    {
+      if (ep->xfer_len > ep->maxpacket)
+      {
+        ep->xfer_len = ep->maxpacket;
+        deptsiz.b.xfersize = ep->maxpacket;
+      }
+      else
+      {
+        deptsiz.b.xfersize = ep->xfer_len;
+      }
+      deptsiz.b.pktcnt = 1;
+    }
+    USB_OTG_WRITE_REG32(&in_regs->DIEPTSIZ, deptsiz.d32);
+    
+    if (pdev->cfg.dma_enable == 1)
+    {
+      USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[ep->num]->DIEPDMA, ep->dma_addr);  
+    }
+    
+    /* EP enable, IN data in FIFO */
+    depctl.b.cnak = 1;
+    depctl.b.epena = 1;
+    USB_OTG_WRITE_REG32(&in_regs->DIEPCTL, depctl.d32);
+    
+    
+    
+    if (pdev->cfg.dma_enable == 0)
+    {
+      /* Enable the Tx FIFO Empty Interrupt for this EP */
+      if (ep->xfer_len > 0)
+      {
+        {
+          fifoemptymsk |= 1 << ep->num;
+          USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPEMPMSK, 0, fifoemptymsk);
+        }
+      }
+    }
+  }
+  else
+  {
+    /* OUT endpoint */
+    depctl.d32  = USB_OTG_READ_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL);
+    deptsiz.d32 = USB_OTG_READ_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPTSIZ);
+    /* Program the transfer size and packet count as follows:
+    * xfersize = N * (maxpacket + 4 - (maxpacket % 4))
+    * pktcnt = N           */
+    if (ep->xfer_len == 0)
+    {
+      deptsiz.b.xfersize = ep->maxpacket;
+      deptsiz.b.pktcnt = 1;
+    }
+    else
+    {
+      ep->xfer_len = ep->maxpacket;
+      deptsiz.b.xfersize = ep->maxpacket;
+      deptsiz.b.pktcnt = 1;
+    }
+    USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPTSIZ, deptsiz.d32);
+    if (pdev->cfg.dma_enable == 1)
+    {
+      USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[ep->num]->DOEPDMA, ep->dma_addr);
+    }
+    /* EP enable */
+    depctl.b.cnak = 1;
+    depctl.b.epena = 1;
+    USB_OTG_WRITE_REG32 (&(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL), depctl.d32);
+    
+  }
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_EPSetStall : Set the EP STALL
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EPSetStall(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  __IO uint32_t *depctl_addr;
+  
+  depctl.d32 = 0;
+  if (ep->is_in == 1)
+  {
+    depctl_addr = &(pdev->regs.INEP_REGS[ep->num]->DIEPCTL);
+    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
+    /* set the disable and stall bits */
+    if (depctl.b.epena)
+    {
+      depctl.b.epdis = 1;
+    }
+    depctl.b.stall = 1;
+    USB_OTG_WRITE_REG32(depctl_addr, depctl.d32);
+  }
+  else
+  {
+    depctl_addr = &(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL);
+    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
+    /* set the stall bit */
+    depctl.b.stall = 1;
+    USB_OTG_WRITE_REG32(depctl_addr, depctl.d32);
+  }
+  return status;
+}
+
+
+/**
+* @brief  Clear the EP STALL
+* @param  pdev : Selected device
+* @retval USB_OTG_STS : status
+*/
+USB_OTG_STS USB_OTG_EPClearStall(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
+{
+  USB_OTG_STS status = USB_OTG_OK;
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  __IO uint32_t *depctl_addr;
+  
+  depctl.d32 = 0;
+  
+  if (ep->is_in == 1)
+  {
+    depctl_addr = &(pdev->regs.INEP_REGS[ep->num]->DIEPCTL);
+  }
+  else
+  {
+    depctl_addr = &(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL);
+  }
+  depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
+  /* clear the stall bits */
+  depctl.b.stall = 0;
+  if (ep->type == EP_TYPE_INTR || ep->type == EP_TYPE_BULK)
+  {
+    depctl.b.setd0pid = 1; /* DATA0 */
+  }
+  USB_OTG_WRITE_REG32(depctl_addr, depctl.d32);
+  return status;
+}
+
+
+/**
+* @brief  USB_OTG_ReadDevAllOutEp_itr : returns OUT endpoint interrupt bits
+* @param  pdev : Selected device
+* @retval OUT endpoint interrupt bits
+*/
+uint32_t USB_OTG_ReadDevAllOutEp_itr(USB_OTG_CORE_HANDLE *pdev)
+{
+  uint32_t v;
+  v  = USB_OTG_READ_REG32(&pdev->regs.DREGS->DAINT);
+  v &= USB_OTG_READ_REG32(&pdev->regs.DREGS->DAINTMSK);
+  return ((v & 0xffff0000) >> 16);
+}
+
+
+/**
+* @brief  USB_OTG_ReadDevOutEP_itr : returns Device OUT EP Interrupt register
+* @param  pdev : Selected device
+* @param  ep : end point number
+* @retval Device OUT EP Interrupt register
+*/
+uint32_t USB_OTG_ReadDevOutEP_itr(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
+{
+  uint32_t v;
+  v  = USB_OTG_READ_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT);
+  v &= USB_OTG_READ_REG32(&pdev->regs.DREGS->DOEPMSK);
+  return v;
+}
+
+
+/**
+* @brief  USB_OTG_ReadDevAllInEPItr : Get int status register
+* @param  pdev : Selected device
+* @retval int status register
+*/
+uint32_t USB_OTG_ReadDevAllInEPItr(USB_OTG_CORE_HANDLE *pdev)
+{
+  uint32_t v;
+  v = USB_OTG_READ_REG32(&pdev->regs.DREGS->DAINT);
+  v &= USB_OTG_READ_REG32(&pdev->regs.DREGS->DAINTMSK);
+  return (v & 0xffff);
+}
+
+/**
+* @brief  configures EPO to receive SETUP packets
+* @param  None
+* @retval : None
+*/
+void USB_OTG_EP0_OutStart(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_DEP0XFRSIZ_TypeDef  doeptsize0;
+  doeptsize0.d32 = 0;
+  doeptsize0.b.supcnt = 3;
+  doeptsize0.b.pktcnt = 1;
+  doeptsize0.b.xfersize = 8 * 3;
+  USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[0]->DOEPTSIZ, doeptsize0.d32 );
+  
+  if (pdev->cfg.dma_enable == 1)
+  {
+    USB_OTG_DEPCTL_TypeDef  doepctl;
+    doepctl.d32 = 0;
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[0]->DOEPDMA, 
+                        (uint32_t)&pdev->dev.setup_packet);
+    
+    /* EP enable */
+    doepctl.d32 = USB_OTG_READ_REG32(&pdev->regs.OUTEP_REGS[0]->DOEPCTL);
+    doepctl.b.epena = 1;
+    doepctl.d32 = 0x80008000;
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[0]->DOEPCTL, doepctl.d32);
+  }
+}
+
+/**
+* @brief  USB_OTG_RemoteWakeup : active remote wakeup signalling
+* @param  None
+* @retval : None
+*/
+void USB_OTG_ActiveRemoteWakeup(USB_OTG_CORE_HANDLE *pdev)
+{
+  
+  USB_OTG_DCTL_TypeDef     dctl;
+  USB_OTG_DSTS_TypeDef     dsts;
+  USB_OTG_PCGCCTL_TypeDef  power;  
+  
+  if (pdev->dev.DevRemoteWakeup) 
+  {
+    dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
+    if(dsts.b.suspsts == 1)
+    {
+      if(pdev->cfg.low_power)
+      {
+        /* un-gate USB Core clock */
+        power.d32 = USB_OTG_READ_REG32(&pdev->regs.PCGCCTL);
+        power.b.gatehclk = 0;
+        power.b.stoppclk = 0;
+        USB_OTG_WRITE_REG32(pdev->regs.PCGCCTL, power.d32);
+      }   
+      /* active Remote wakeup signaling */
+      dctl.d32 = 0;
+      dctl.b.rmtwkupsig = 1;
+      USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, 0, dctl.d32);
+      USB_OTG_BSP_mDelay(5);
+      USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, dctl.d32, 0 );
+    }
+  }
+}
+
+
+/**
+* @brief  USB_OTG_UngateClock : active USB Core clock
+* @param  None
+* @retval : None
+*/
+void USB_OTG_UngateClock(USB_OTG_CORE_HANDLE *pdev)
+{
+  if(pdev->cfg.low_power)
+  {
+    
+    USB_OTG_DSTS_TypeDef     dsts;
+    USB_OTG_PCGCCTL_TypeDef  power; 
+    
+    dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
+    
+    if(dsts.b.suspsts == 1)
+    {
+      /* un-gate USB Core clock */
+      power.d32 = USB_OTG_READ_REG32(&pdev->regs.PCGCCTL);
+      power.b.gatehclk = 0;
+      power.b.stoppclk = 0;
+      USB_OTG_WRITE_REG32(pdev->regs.PCGCCTL, power.d32);
+      
+    }
+  }
+}
+
+/**
+* @brief  Stop the device and clean up fifo's
+* @param  None
+* @retval : None
+*/
+void USB_OTG_StopDevice(USB_OTG_CORE_HANDLE *pdev)
+{
+  uint32_t i;
+  
+  pdev->dev.device_status = 1;
+    
+  for (i = 0; i < pdev->cfg.dev_endpoints ; i++)
+  {
+    USB_OTG_WRITE_REG32( &pdev->regs.INEP_REGS[i]->DIEPINT, 0xFF);
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[i]->DOEPINT, 0xFF);
+  }
+
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DIEPMSK, 0 );
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DOEPMSK, 0 );
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DAINTMSK, 0 );
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DAINT, 0xFFFFFFFF );  
+  
+  /* Flush the FIFO */
+  USB_OTG_FlushRxFifo(pdev);
+  USB_OTG_FlushTxFifo(pdev ,  0x10 );  
+}
+
+/**
+* @brief  returns the EP Status
+* @param  pdev : Selected device
+*         ep : endpoint structure
+* @retval : EP status
+*/
+
+uint32_t USB_OTG_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,USB_OTG_EP *ep)
+{
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  __IO uint32_t *depctl_addr;
+  uint32_t Status = 0;  
+  
+  depctl.d32 = 0;
+  if (ep->is_in == 1)
+  {
+    depctl_addr = &(pdev->regs.INEP_REGS[ep->num]->DIEPCTL);
+    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
+    
+    if (depctl.b.stall == 1)  
+      Status = USB_OTG_EP_TX_STALL;
+    else if (depctl.b.naksts == 1)
+      Status = USB_OTG_EP_TX_NAK;
+    else 
+      Status = USB_OTG_EP_TX_VALID;     
+
+  }
+  else
+  {
+    depctl_addr = &(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL);
+    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
+    if (depctl.b.stall == 1)  
+      Status = USB_OTG_EP_RX_STALL;
+    else if (depctl.b.naksts == 1)
+      Status = USB_OTG_EP_RX_NAK;
+    else 
+      Status = USB_OTG_EP_RX_VALID; 
+  } 
+  
+  /* Return the current status */
+  return Status;
+}
+
+/**
+* @brief  Set the EP Status
+* @param  pdev : Selected device
+*         Status : new Status
+*         ep : EP structure
+* @retval : None
+*/
+void USB_OTG_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep , uint32_t Status)
+{
+  USB_OTG_DEPCTL_TypeDef  depctl;
+  __IO uint32_t *depctl_addr;
+  
+  depctl.d32 = 0;
+
+  /* Process for IN endpoint */
+  if (ep->is_in == 1)
+  {
+    depctl_addr = &(pdev->regs.INEP_REGS[ep->num]->DIEPCTL);
+    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
+    
+    if (Status == USB_OTG_EP_TX_STALL)  
+    {
+      USB_OTG_EPSetStall(pdev, ep); return;
+    }
+    else if (Status == USB_OTG_EP_TX_NAK)
+      depctl.b.snak = 1;
+    else if (Status == USB_OTG_EP_TX_VALID)
+    {
+      if (depctl.b.stall == 1)
+      {  
+        ep->even_odd_frame = 0;
+        USB_OTG_EPClearStall(pdev, ep);
+        return;
+      }      
+      depctl.b.cnak = 1;
+      depctl.b.usbactep = 1; 
+      depctl.b.epena = 1;
+    }
+    else if (Status == USB_OTG_EP_TX_DIS)
+      depctl.b.usbactep = 0;
+  } 
+  else /* Process for OUT endpoint */
+  {
+    depctl_addr = &(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL);
+    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);    
+    
+    if (Status == USB_OTG_EP_RX_STALL)  {
+      depctl.b.stall = 1;
+    }
+    else if (Status == USB_OTG_EP_RX_NAK)
+      depctl.b.snak = 1;
+    else if (Status == USB_OTG_EP_RX_VALID)
+    {
+      if (depctl.b.stall == 1)
+      {  
+        ep->even_odd_frame = 0;
+        USB_OTG_EPClearStall(pdev, ep);
+        return;
+      }  
+      depctl.b.cnak = 1;
+      depctl.b.usbactep = 1;    
+      depctl.b.epena = 1;
+    }
+    else if (Status == USB_OTG_EP_RX_DIS)
+    {
+      depctl.b.usbactep = 0;    
+    }
+  }
+
+  USB_OTG_WRITE_REG32(depctl_addr, depctl.d32); 
+}
+
+#endif
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_core.h b/codec2/tags/0.4/stm32/usb_lib/otg/usb_core.h
new file mode 100644 (file)
index 0000000..82a09e1
--- /dev/null
@@ -0,0 +1,408 @@
+/**
+  ******************************************************************************
+  * @file    usb_core.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Header of the Core Layer
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USB_CORE_H__
+#define __USB_CORE_H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_conf.h"
+#include "usb_regs.h"
+#include "usb_defines.h"
+
+
+/** @addtogroup USB_OTG_DRIVER
+  * @{
+  */
+  
+/** @defgroup USB_CORE
+  * @brief usb otg driver core layer
+  * @{
+  */ 
+
+
+/** @defgroup USB_CORE_Exported_Defines
+  * @{
+  */ 
+
+#define USB_OTG_EP0_IDLE                          0
+#define USB_OTG_EP0_SETUP                         1
+#define USB_OTG_EP0_DATA_IN                       2
+#define USB_OTG_EP0_DATA_OUT                      3
+#define USB_OTG_EP0_STATUS_IN                     4
+#define USB_OTG_EP0_STATUS_OUT                    5
+#define USB_OTG_EP0_STALL                         6
+
+#define USB_OTG_EP_TX_DIS       0x0000
+#define USB_OTG_EP_TX_STALL     0x0010
+#define USB_OTG_EP_TX_NAK       0x0020
+#define USB_OTG_EP_TX_VALID     0x0030
+#define USB_OTG_EP_RX_DIS       0x0000
+#define USB_OTG_EP_RX_STALL     0x1000
+#define USB_OTG_EP_RX_NAK       0x2000
+#define USB_OTG_EP_RX_VALID     0x3000
+/**
+  * @}
+  */ 
+#define   MAX_DATA_LENGTH                        0xFF
+
+/** @defgroup USB_CORE_Exported_Types
+  * @{
+  */ 
+
+
+typedef enum {
+  USB_OTG_OK = 0,
+  USB_OTG_FAIL
+}USB_OTG_STS;
+
+typedef enum {
+  HC_IDLE = 0,
+  HC_XFRC,
+  HC_HALTED,
+  HC_NAK,
+  HC_NYET,
+  HC_STALL,
+  HC_XACTERR,  
+  HC_BBLERR,   
+  HC_DATATGLERR,  
+}HC_STATUS;
+
+typedef enum {
+  URB_IDLE = 0,
+  URB_DONE,
+  URB_NOTREADY,
+  URB_ERROR,
+  URB_STALL
+}URB_STATE;
+
+typedef enum {
+  CTRL_START = 0,
+  CTRL_XFRC,
+  CTRL_HALTED,
+  CTRL_NAK,
+  CTRL_STALL,
+  CTRL_XACTERR,  
+  CTRL_BBLERR,   
+  CTRL_DATATGLERR,  
+  CTRL_FAIL
+}CTRL_STATUS;
+
+
+typedef struct USB_OTG_hc
+{
+  uint8_t       dev_addr ;
+  uint8_t       ep_num;
+  uint8_t       ep_is_in;
+  uint8_t       speed;
+  uint8_t       do_ping;  
+  uint8_t       ep_type;
+  uint16_t      max_packet;
+  uint8_t       data_pid;
+  uint8_t       *xfer_buff;
+  uint32_t      xfer_len;
+  uint32_t      xfer_count;  
+  uint8_t       toggle_in;
+  uint8_t       toggle_out;
+  uint32_t       dma_addr;  
+}
+USB_OTG_HC , *PUSB_OTG_HC;
+
+typedef struct USB_OTG_ep
+{
+  uint8_t        num;
+  uint8_t        is_in;
+  uint8_t        is_stall;  
+  uint8_t        type;
+  uint8_t        data_pid_start;
+  uint8_t        even_odd_frame;
+  uint16_t       tx_fifo_num;
+  uint32_t       maxpacket;
+  /* transaction level variables*/
+  uint8_t        *xfer_buff;
+  uint32_t       dma_addr;  
+  uint32_t       xfer_len;
+  uint32_t       xfer_count;
+  /* Transfer level variables*/  
+  uint32_t       rem_data_len;
+  uint32_t       total_data_len;
+  uint32_t       ctl_data_len;  
+
+}
+
+USB_OTG_EP , *PUSB_OTG_EP;
+
+
+
+typedef struct USB_OTG_core_cfg
+{
+  uint8_t       host_channels;
+  uint8_t       dev_endpoints;
+  uint8_t       speed;
+  uint8_t       dma_enable;
+  uint16_t      mps;
+  uint16_t      TotalFifoSize;
+  uint8_t       phy_itface;
+  uint8_t       Sof_output;
+  uint8_t       low_power;
+  uint8_t       coreID;
+}
+USB_OTG_CORE_CFGS, *PUSB_OTG_CORE_CFGS;
+
+
+
+typedef  struct  usb_setup_req {
+    
+    uint8_t   bmRequest;                      
+    uint8_t   bRequest;                           
+    uint16_t  wValue;                             
+    uint16_t  wIndex;                             
+    uint16_t  wLength;                            
+} USB_SETUP_REQ;
+
+typedef struct _Device_TypeDef
+{
+  uint8_t  *(*GetDeviceDescriptor)( uint8_t speed , uint16_t *length);  
+  uint8_t  *(*GetLangIDStrDescriptor)( uint8_t speed , uint16_t *length); 
+  uint8_t  *(*GetManufacturerStrDescriptor)( uint8_t speed , uint16_t *length);  
+  uint8_t  *(*GetProductStrDescriptor)( uint8_t speed , uint16_t *length);  
+  uint8_t  *(*GetSerialStrDescriptor)( uint8_t speed , uint16_t *length);  
+  uint8_t  *(*GetConfigurationStrDescriptor)( uint8_t speed , uint16_t *length);  
+  uint8_t  *(*GetInterfaceStrDescriptor)( uint8_t speed , uint16_t *length);   
+} USBD_DEVICE, *pUSBD_DEVICE;
+
+typedef struct USB_OTG_hPort
+{
+  void (*Disconnect) (void *phost);
+  void (*Connect) (void *phost); 
+  uint8_t ConnStatus;
+  uint8_t DisconnStatus;
+  uint8_t ConnHandled;
+  uint8_t DisconnHandled;
+} USB_OTG_hPort_TypeDef;
+
+typedef struct _Device_cb
+{
+  uint8_t  (*Init)         (void *pdev , uint8_t cfgidx);
+  uint8_t  (*DeInit)       (void *pdev , uint8_t cfgidx);
+ /* Control Endpoints*/
+  uint8_t  (*Setup)        (void *pdev , USB_SETUP_REQ  *req);  
+  uint8_t  (*EP0_TxSent)   (void *pdev );    
+  uint8_t  (*EP0_RxReady)  (void *pdev );  
+  /* Class Specific Endpoints*/
+  uint8_t  (*DataIn)       (void *pdev , uint8_t epnum);   
+  uint8_t  (*DataOut)      (void *pdev , uint8_t epnum); 
+  uint8_t  (*SOF)          (void *pdev); 
+  uint8_t  (*IsoINIncomplete)  (void *pdev); 
+  uint8_t  (*IsoOUTIncomplete)  (void *pdev);   
+
+  uint8_t  *(*GetConfigDescriptor)( uint8_t speed , uint16_t *length); 
+#ifdef USB_OTG_HS_CORE 
+  uint8_t  *(*GetOtherConfigDescriptor)( uint8_t speed , uint16_t *length);   
+#endif
+
+#ifdef USB_SUPPORT_USER_STRING_DESC 
+  uint8_t  *(*GetUsrStrDescriptor)( uint8_t speed ,uint8_t index,  uint16_t *length);   
+#endif  
+  
+} USBD_Class_cb_TypeDef;
+
+
+
+typedef struct _USBD_USR_PROP
+{
+  void (*Init)(void);   
+  void (*DeviceReset)(uint8_t speed); 
+  void (*DeviceConfigured)(void);
+  void (*DeviceSuspended)(void);
+  void (*DeviceResumed)(void);  
+  
+  void (*DeviceConnected)(void);  
+  void (*DeviceDisconnected)(void);    
+  
+}
+USBD_Usr_cb_TypeDef;
+
+typedef struct _DCD
+{
+  uint8_t        device_config;
+  uint8_t        device_state;
+  uint8_t        device_status;
+  uint8_t        device_address;
+  uint32_t       DevRemoteWakeup;
+  USB_OTG_EP     in_ep   [USB_OTG_MAX_TX_FIFOS];
+  USB_OTG_EP     out_ep  [USB_OTG_MAX_TX_FIFOS];
+  uint8_t        setup_packet [8*3];
+  USBD_Class_cb_TypeDef         *class_cb;
+  USBD_Usr_cb_TypeDef           *usr_cb;
+  USBD_DEVICE                   *usr_device;  
+  uint8_t        *pConfig_descriptor;
+ }
+DCD_DEV , *DCD_PDEV;
+
+
+typedef struct _HCD
+{
+  uint8_t                  Rx_Buffer [MAX_DATA_LENGTH];  
+  __IO uint32_t            ConnSts;
+  __IO uint32_t            ErrCnt[USB_OTG_MAX_TX_FIFOS];
+  __IO uint32_t            XferCnt[USB_OTG_MAX_TX_FIFOS];
+  __IO HC_STATUS           HC_Status[USB_OTG_MAX_TX_FIFOS];  
+  __IO URB_STATE           URB_State[USB_OTG_MAX_TX_FIFOS];
+  USB_OTG_HC               hc [USB_OTG_MAX_TX_FIFOS];
+  uint16_t                 channel [USB_OTG_MAX_TX_FIFOS];
+  USB_OTG_hPort_TypeDef    *port_cb;  
+}
+HCD_DEV , *USB_OTG_USBH_PDEV;
+
+
+typedef struct _OTG
+{
+  uint8_t    OTG_State;
+  uint8_t    OTG_PrevState;  
+  uint8_t    OTG_Mode;    
+}
+OTG_DEV , *USB_OTG_USBO_PDEV;
+
+typedef struct USB_OTG_handle
+{
+  USB_OTG_CORE_CFGS    cfg;
+  USB_OTG_CORE_REGS    regs;
+#ifdef USE_DEVICE_MODE
+  DCD_DEV     dev;
+#endif
+#ifdef USE_HOST_MODE
+  HCD_DEV     host;
+#endif
+#ifdef USE_OTG_MODE
+  OTG_DEV     otg;
+#endif
+}
+USB_OTG_CORE_HANDLE , *PUSB_OTG_CORE_HANDLE;
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_CORE_Exported_Macros
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CORE_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_CORE_Exported_FunctionsPrototype
+  * @{
+  */ 
+
+
+USB_OTG_STS  USB_OTG_CoreInit        (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_SelectCore      (USB_OTG_CORE_HANDLE *pdev, 
+                                      USB_OTG_CORE_ID_TypeDef coreID);
+USB_OTG_STS  USB_OTG_EnableGlobalInt (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_DisableGlobalInt(USB_OTG_CORE_HANDLE *pdev);
+void*           USB_OTG_ReadPacket   (USB_OTG_CORE_HANDLE *pdev ,
+    uint8_t *dest,
+    uint16_t len);
+USB_OTG_STS  USB_OTG_WritePacket     (USB_OTG_CORE_HANDLE *pdev ,
+    uint8_t *src,
+    uint8_t ch_ep_num,
+    uint16_t len);
+USB_OTG_STS  USB_OTG_FlushTxFifo     (USB_OTG_CORE_HANDLE *pdev , uint32_t num);
+USB_OTG_STS  USB_OTG_FlushRxFifo     (USB_OTG_CORE_HANDLE *pdev);
+
+uint32_t     USB_OTG_ReadCoreItr     (USB_OTG_CORE_HANDLE *pdev);
+uint32_t     USB_OTG_ReadOtgItr      (USB_OTG_CORE_HANDLE *pdev);
+uint8_t      USB_OTG_IsHostMode      (USB_OTG_CORE_HANDLE *pdev);
+uint8_t      USB_OTG_IsDeviceMode    (USB_OTG_CORE_HANDLE *pdev);
+uint32_t     USB_OTG_GetMode         (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_PhyInit         (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_SetCurrentMode  (USB_OTG_CORE_HANDLE *pdev,
+    uint8_t mode);
+
+/*********************** HOST APIs ********************************************/
+#ifdef USE_HOST_MODE
+USB_OTG_STS  USB_OTG_CoreInitHost    (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_EnableHostInt   (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_HC_Init         (USB_OTG_CORE_HANDLE *pdev, uint8_t hc_num);
+USB_OTG_STS  USB_OTG_HC_Halt         (USB_OTG_CORE_HANDLE *pdev, uint8_t hc_num);
+USB_OTG_STS  USB_OTG_HC_StartXfer    (USB_OTG_CORE_HANDLE *pdev, uint8_t hc_num);
+USB_OTG_STS  USB_OTG_HC_DoPing       (USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num);
+uint32_t     USB_OTG_ReadHostAllChannels_intr    (USB_OTG_CORE_HANDLE *pdev);
+uint32_t     USB_OTG_ResetPort       (USB_OTG_CORE_HANDLE *pdev);
+uint32_t     USB_OTG_ReadHPRT0       (USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_DriveVbus       (USB_OTG_CORE_HANDLE *pdev, uint8_t state);
+void         USB_OTG_InitFSLSPClkSel (USB_OTG_CORE_HANDLE *pdev ,uint8_t freq);
+uint8_t      USB_OTG_IsEvenFrame     (USB_OTG_CORE_HANDLE *pdev) ;
+void         USB_OTG_StopHost        (USB_OTG_CORE_HANDLE *pdev);
+#endif
+/********************* DEVICE APIs ********************************************/
+#ifdef USE_DEVICE_MODE
+USB_OTG_STS  USB_OTG_CoreInitDev         (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_EnableDevInt        (USB_OTG_CORE_HANDLE *pdev);
+uint32_t     USB_OTG_ReadDevAllInEPItr           (USB_OTG_CORE_HANDLE *pdev);
+enum USB_OTG_SPEED USB_OTG_GetDeviceSpeed (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_EP0Activate (USB_OTG_CORE_HANDLE *pdev);
+USB_OTG_STS  USB_OTG_EPActivate  (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep);
+USB_OTG_STS  USB_OTG_EPDeactivate(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep);
+USB_OTG_STS  USB_OTG_EPStartXfer (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep);
+USB_OTG_STS  USB_OTG_EP0StartXfer(USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep);
+USB_OTG_STS  USB_OTG_EPSetStall          (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep);
+USB_OTG_STS  USB_OTG_EPClearStall        (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep);
+uint32_t     USB_OTG_ReadDevAllOutEp_itr (USB_OTG_CORE_HANDLE *pdev);
+uint32_t     USB_OTG_ReadDevOutEP_itr    (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
+uint32_t     USB_OTG_ReadDevAllInEPItr   (USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_InitDevSpeed        (USB_OTG_CORE_HANDLE *pdev , uint8_t speed);
+uint8_t      USBH_IsEvenFrame (USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_EP0_OutStart(USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_ActiveRemoteWakeup(USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_UngateClock(USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_StopDevice(USB_OTG_CORE_HANDLE *pdev);
+void         USB_OTG_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep , uint32_t Status);
+uint32_t     USB_OTG_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,USB_OTG_EP *ep);
+#endif
+/**
+  * @}
+  */ 
+
+#endif  /* __USB_CORE_H__ */
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd.c b/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd.c
new file mode 100644 (file)
index 0000000..a74522f
--- /dev/null
@@ -0,0 +1,475 @@
+/**
+  ******************************************************************************
+  * @file    usb_dcd.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Peripheral Device Interface Layer
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+#include "usb_conf.h"
+#ifdef USE_DEVICE_MODE
+/* Includes ------------------------------------------------------------------*/
+#include "usb_dcd.h"
+#include "usb_bsp.h"
+
+
+/** @addtogroup USB_OTG_DRIVER
+* @{
+*/
+
+/** @defgroup USB_DCD 
+* @brief This file is the interface between EFSL ans Host mass-storage class
+* @{
+*/
+
+
+/** @defgroup USB_DCD_Private_Defines
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_Private_TypesDefinitions
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+
+/** @defgroup USB_DCD_Private_Macros
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_Private_Variables
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_Private_FunctionPrototypes
+* @{
+*/ 
+
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_Private_Functions
+* @{
+*/ 
+
+
+
+void DCD_Init(USB_OTG_CORE_HANDLE *pdev , 
+              USB_OTG_CORE_ID_TypeDef coreID)
+{
+  uint32_t i;
+  USB_OTG_EP *ep;
+  
+  USB_OTG_SelectCore (pdev , coreID);
+  
+  pdev->dev.device_status = USB_OTG_DEFAULT;
+  pdev->dev.device_address = 0;
+  
+  /* Init ep structure */
+  for (i = 0; i < pdev->cfg.dev_endpoints ; i++)
+  {
+    ep = &pdev->dev.in_ep[i];
+    /* Init ep structure */
+    ep->is_in = 1;
+    ep->num = i;
+    ep->tx_fifo_num = i;
+    /* Control until ep is actvated */
+    ep->type = EP_TYPE_CTRL;
+    ep->maxpacket =  USB_OTG_MAX_EP0_SIZE;
+    ep->xfer_buff = 0;
+    ep->xfer_len = 0;
+  }
+  
+  for (i = 0; i < pdev->cfg.dev_endpoints; i++)
+  {
+    ep = &pdev->dev.out_ep[i];
+    /* Init ep structure */
+    ep->is_in = 0;
+    ep->num = i;
+    ep->tx_fifo_num = i;
+    /* Control until ep is activated */
+    ep->type = EP_TYPE_CTRL;
+    ep->maxpacket = USB_OTG_MAX_EP0_SIZE;
+    ep->xfer_buff = 0;
+    ep->xfer_len = 0;
+  }
+  
+  USB_OTG_DisableGlobalInt(pdev);
+  
+  /*Init the Core (common init.) */
+  USB_OTG_CoreInit(pdev);
+
+
+  /* Force Device Mode*/
+  USB_OTG_SetCurrentMode(pdev, DEVICE_MODE);
+  
+  /* Init Device */
+  USB_OTG_CoreInitDev(pdev);
+  
+  
+  /* Enable USB Global interrupt */
+  USB_OTG_EnableGlobalInt(pdev);
+}
+
+
+/**
+* @brief  Configure an EP
+* @param pdev : Device instance
+* @param epdesc : Endpoint Descriptor
+* @retval : status
+*/
+uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev , 
+                     uint8_t ep_addr,
+                     uint16_t ep_mps,
+                     uint8_t ep_type)
+{
+  USB_OTG_EP *ep;
+  
+  if ((ep_addr & 0x80) == 0x80)
+  {
+    ep = &pdev->dev.in_ep[ep_addr & 0x7F];
+  }
+  else
+  {
+    ep = &pdev->dev.out_ep[ep_addr & 0x7F];
+  }
+  ep->num   = ep_addr & 0x7F;
+  
+  ep->is_in = (0x80 & ep_addr) != 0;
+  ep->maxpacket = ep_mps;
+  ep->type = ep_type;
+  if (ep->is_in)
+  {
+    /* Assign a Tx FIFO */
+    ep->tx_fifo_num = ep->num;
+  }
+  /* Set initial data PID. */
+  if (ep_type == USB_OTG_EP_BULK )
+  {
+    ep->data_pid_start = 0;
+  }
+  USB_OTG_EPActivate(pdev , ep );
+  return 0;
+}
+/**
+* @brief  called when an EP is disabled
+* @param pdev: device instance
+* @param ep_addr: endpoint address
+* @retval : status
+*/
+uint32_t DCD_EP_Close(USB_OTG_CORE_HANDLE *pdev , uint8_t  ep_addr)
+{
+  USB_OTG_EP *ep;
+  
+  if ((ep_addr&0x80) == 0x80)
+  {
+    ep = &pdev->dev.in_ep[ep_addr & 0x7F];
+  }
+  else
+  {
+    ep = &pdev->dev.out_ep[ep_addr & 0x7F];
+  }
+  ep->num   = ep_addr & 0x7F;
+  ep->is_in = (0x80 & ep_addr) != 0;
+  USB_OTG_EPDeactivate(pdev , ep );
+  return 0;
+}
+
+
+/**
+* @brief  DCD_EP_PrepareRx
+* @param pdev: device instance
+* @param ep_addr: endpoint address
+* @param pbuf: pointer to Rx buffer
+* @param buf_len: data length
+* @retval : status
+*/
+uint32_t   DCD_EP_PrepareRx( USB_OTG_CORE_HANDLE *pdev,
+                            uint8_t   ep_addr,
+                            uint8_t *pbuf,                        
+                            uint16_t  buf_len)
+{
+  USB_OTG_EP *ep;
+  
+  ep = &pdev->dev.out_ep[ep_addr & 0x7F];
+  
+  /*setup and start the Xfer */
+  ep->xfer_buff = pbuf;  
+  ep->xfer_len = buf_len;
+  ep->xfer_count = 0;
+  ep->is_in = 0;
+  ep->num = ep_addr & 0x7F;
+  
+  if (pdev->cfg.dma_enable == 1)
+  {
+    ep->dma_addr = (uint32_t)pbuf;  
+  }
+  
+  if ( ep->num == 0 )
+  {
+    USB_OTG_EP0StartXfer(pdev , ep);
+  }
+  else
+  {
+    USB_OTG_EPStartXfer(pdev, ep );
+  }
+  return 0;
+}
+
+/**
+* @brief  Transmit data over USB
+* @param pdev: device instance
+* @param ep_addr: endpoint address
+* @param pbuf: pointer to Tx buffer
+* @param buf_len: data length
+* @retval : status
+*/
+uint32_t  DCD_EP_Tx ( USB_OTG_CORE_HANDLE *pdev,
+                     uint8_t   ep_addr,
+                     uint8_t   *pbuf,
+                     uint32_t   buf_len)
+{
+  USB_OTG_EP *ep;
+  
+  ep = &pdev->dev.in_ep[ep_addr & 0x7F];
+  
+  /* Setup and start the Transfer */
+  ep->is_in = 1;
+  ep->num = ep_addr & 0x7F;  
+  ep->xfer_buff = pbuf;
+  ep->dma_addr = (uint32_t)pbuf;  
+  ep->xfer_count = 0;
+  ep->xfer_len  = buf_len;
+  
+  if ( ep->num == 0 )
+  {
+    USB_OTG_EP0StartXfer(pdev , ep);
+  }
+  else
+  {
+    USB_OTG_EPStartXfer(pdev, ep );
+  }
+  return 0;
+}
+
+
+/**
+* @brief  Stall an endpoint.
+* @param pdev: device instance
+* @param epnum: endpoint address
+* @retval : status
+*/
+uint32_t  DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev, uint8_t   epnum)
+{
+  USB_OTG_EP *ep;
+  if ((0x80 & epnum) == 0x80)
+  {
+    ep = &pdev->dev.in_ep[epnum & 0x7F];
+  }
+  else
+  {
+    ep = &pdev->dev.out_ep[epnum];
+  }
+
+  ep->is_stall = 1;
+  ep->num   = epnum & 0x7F;
+  ep->is_in = ((epnum & 0x80) == 0x80);
+  
+  USB_OTG_EPSetStall(pdev , ep);
+  return (0);
+}
+
+
+/**
+* @brief  Clear stall condition on endpoints.
+* @param pdev: device instance
+* @param epnum: endpoint address
+* @retval : status
+*/
+uint32_t  DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev, uint8_t epnum)
+{
+  USB_OTG_EP *ep;
+  if ((0x80 & epnum) == 0x80)
+  {
+    ep = &pdev->dev.in_ep[epnum & 0x7F];    
+  }
+  else
+  {
+    ep = &pdev->dev.out_ep[epnum];
+  }
+  
+  ep->is_stall = 0;  
+  ep->num   = epnum & 0x7F;
+  ep->is_in = ((epnum & 0x80) == 0x80);
+  
+  USB_OTG_EPClearStall(pdev , ep);
+  return (0);
+}
+
+
+/**
+* @brief  This Function flushes the FIFOs.
+* @param pdev: device instance
+* @param epnum: endpoint address
+* @retval : status
+*/
+uint32_t  DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
+{
+
+  if ((epnum & 0x80) == 0x80)
+  {
+    USB_OTG_FlushTxFifo(pdev, epnum & 0x7F);
+  }
+  else
+  {
+    USB_OTG_FlushRxFifo(pdev);
+  }
+
+  return (0);
+}
+
+
+/**
+* @brief  This Function set USB device address
+* @param pdev: device instance
+* @param address: new device address
+* @retval : status
+*/
+void  DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev, uint8_t address)
+{
+  USB_OTG_DCFG_TypeDef  dcfg;
+  dcfg.d32 = 0;
+  dcfg.b.devaddr = address;
+  USB_OTG_MODIFY_REG32( &pdev->regs.DREGS->DCFG, 0, dcfg.d32);
+}
+
+/**
+* @brief  Connect device (enable internal pull-up)
+* @param pdev: device instance
+* @retval : None
+*/
+void  DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev)
+{
+#ifndef USE_OTG_MODE
+  USB_OTG_DCTL_TypeDef  dctl;
+  dctl.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCTL);
+  /* Connect device */
+  dctl.b.sftdiscon  = 0;
+  USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCTL, dctl.d32);
+  USB_OTG_BSP_mDelay(3);
+#endif
+}
+
+
+/**
+* @brief  Disconnect device (disable internal pull-up)
+* @param pdev: device instance
+* @retval : None
+*/
+void  DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev)
+{
+#ifndef USE_OTG_MODE
+  USB_OTG_DCTL_TypeDef  dctl;
+  dctl.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCTL);
+  /* Disconnect device for 3ms */
+  dctl.b.sftdiscon  = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCTL, dctl.d32);
+  USB_OTG_BSP_mDelay(3);
+#endif
+}
+
+
+/**
+* @brief  returns the EP Status
+* @param  pdev : Selected device
+*         epnum : endpoint address
+* @retval : EP status
+*/
+
+uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,uint8_t epnum)
+{
+  USB_OTG_EP *ep;
+  uint32_t Status = 0;  
+  
+  if ((0x80 & epnum) == 0x80)
+  {
+    ep = &pdev->dev.in_ep[epnum & 0x7F];    
+  }
+  else
+  {
+    ep = &pdev->dev.out_ep[epnum];
+  }
+  
+  Status = USB_OTG_GetEPStatus(pdev ,ep);
+
+  /* Return the current status */
+  return Status;
+}
+
+/**
+* @brief  Set the EP Status
+* @param  pdev : Selected device
+*         Status : new Status
+*         epnum : EP address
+* @retval : None
+*/
+void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum , uint32_t Status)
+{
+  USB_OTG_EP *ep;
+  
+  if ((0x80 & epnum) == 0x80)
+  {
+    ep = &pdev->dev.in_ep[epnum & 0x7F];    
+  }
+  else
+  {
+    ep = &pdev->dev.out_ep[epnum];
+  }
+  
+   USB_OTG_SetEPStatus(pdev ,ep , Status);
+}
+
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/
+#endif
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd.h b/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd.h
new file mode 100644 (file)
index 0000000..6bfd899
--- /dev/null
@@ -0,0 +1,158 @@
+/**
+  ******************************************************************************
+  * @file    usb_dcd.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Peripheral Driver Header file
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __DCD_H__
+#define __DCD_H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_core.h"
+
+
+/** @addtogroup USB_OTG_DRIVER
+* @{
+*/
+
+/** @defgroup USB_DCD
+* @brief This file is the 
+* @{
+*/ 
+
+
+/** @defgroup USB_DCD_Exported_Defines
+* @{
+*/ 
+#define USB_OTG_EP_CONTROL                       0
+#define USB_OTG_EP_ISOC                          1
+#define USB_OTG_EP_BULK                          2
+#define USB_OTG_EP_INT                           3
+#define USB_OTG_EP_MASK                          3
+
+/*  Device Status */
+#define USB_OTG_DEFAULT                          1
+#define USB_OTG_ADDRESSED                        2
+#define USB_OTG_CONFIGURED                       3
+#define USB_OTG_SUSPENDED                        4
+
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_Exported_Types
+* @{
+*/ 
+/********************************************************************************
+Data structure type
+********************************************************************************/
+typedef struct
+{
+  uint8_t  bLength;
+  uint8_t  bDescriptorType;
+  uint8_t  bEndpointAddress;
+  uint8_t  bmAttributes;
+  uint16_t wMaxPacketSize;
+  uint8_t  bInterval;
+}
+EP_DESCRIPTOR , *PEP_DESCRIPTOR;
+
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_Exported_Macros
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+/** @defgroup USB_DCD_Exported_Variables
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+/** @defgroup USB_DCD_Exported_FunctionsPrototype
+* @{
+*/ 
+/********************************************************************************
+EXPORTED FUNCTION FROM THE USB-OTG LAYER
+********************************************************************************/
+void       DCD_Init(USB_OTG_CORE_HANDLE *pdev ,
+                    USB_OTG_CORE_ID_TypeDef coreID);
+
+void        DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev);
+void        DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev);
+void        DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev,
+                               uint8_t address);
+uint32_t    DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev , 
+                     uint8_t ep_addr,
+                     uint16_t ep_mps,
+                     uint8_t ep_type);
+
+uint32_t    DCD_EP_Close  (USB_OTG_CORE_HANDLE *pdev,
+                                uint8_t  ep_addr);
+
+
+uint32_t   DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev,
+                        uint8_t   ep_addr,                                  
+                        uint8_t *pbuf,                                  
+                        uint16_t  buf_len);
+  
+uint32_t    DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev,
+                               uint8_t  ep_addr,
+                               uint8_t  *pbuf,
+                               uint32_t   buf_len);
+uint32_t    DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev,
+                              uint8_t   epnum);
+uint32_t    DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev,
+                                  uint8_t epnum);
+uint32_t    DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev,
+                               uint8_t epnum);
+uint32_t    DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev);
+
+uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,
+                         uint8_t epnum);
+
+void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , 
+                      uint8_t epnum , 
+                      uint32_t Status);
+
+/**
+* @}
+*/ 
+
+
+#endif //__DCD_H__
+
+
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd_int.c b/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd_int.c
new file mode 100644 (file)
index 0000000..5b47017
--- /dev/null
@@ -0,0 +1,889 @@
+/**
+  ******************************************************************************
+  * @file    usb_dcd_int.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Peripheral Device interrupt subroutines
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+#include "usb_conf.h"
+#ifdef USE_DEVICE_MODE
+/* Includes ------------------------------------------------------------------*/
+#include "usb_dcd_int.h"
+/** @addtogroup USB_OTG_DRIVER
+* @{
+*/
+
+/** @defgroup USB_DCD_INT 
+* @brief This file contains the interrupt subroutines for the Device mode.
+* @{
+*/
+
+
+/** @defgroup USB_DCD_INT_Private_Defines
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_INT_Private_TypesDefinitions
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+
+/** @defgroup USB_DCD_INT_Private_Macros
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_INT_Private_Variables
+* @{
+*/ 
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_INT_Private_FunctionPrototypes
+* @{
+*/ 
+/* static functions */
+static uint32_t DCD_ReadDevInEP (USB_OTG_CORE_HANDLE *pdev, uint8_t epnum);
+
+/* Interrupt Handlers */
+static uint32_t DCD_HandleInEP_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_HandleOutEP_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_HandleSof_ISR(USB_OTG_CORE_HANDLE *pdev);
+
+static uint32_t DCD_HandleRxStatusQueueLevel_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_WriteEmptyTxFifo(USB_OTG_CORE_HANDLE *pdev , uint32_t epnum);
+
+static uint32_t DCD_HandleUsbReset_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_HandleEnumDone_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_HandleResume_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_HandleUSBSuspend_ISR(USB_OTG_CORE_HANDLE *pdev);
+
+static uint32_t DCD_IsoINIncomplete_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_IsoOUTIncomplete_ISR(USB_OTG_CORE_HANDLE *pdev);
+#ifdef VBUS_SENSING_ENABLED
+static uint32_t DCD_SessionRequest_ISR(USB_OTG_CORE_HANDLE *pdev);
+static uint32_t DCD_OTG_ISR(USB_OTG_CORE_HANDLE *pdev);
+#endif
+
+/**
+* @}
+*/ 
+
+
+/** @defgroup USB_DCD_INT_Private_Functions
+* @{
+*/ 
+
+
+#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED  
+/**
+* @brief  USBD_OTG_EP1OUT_ISR_Handler
+*         handles all USB Interrupts
+* @param  pdev: device instance
+* @retval status
+*/
+uint32_t USBD_OTG_EP1OUT_ISR_Handler (USB_OTG_CORE_HANDLE *pdev)
+{
+  
+  USB_OTG_DOEPINTn_TypeDef  doepint;
+  USB_OTG_DEPXFRSIZ_TypeDef  deptsiz;  
+  
+  doepint.d32 = USB_OTG_READ_REG32(&pdev->regs.OUTEP_REGS[1]->DOEPINT);
+  doepint.d32&= USB_OTG_READ_REG32(&pdev->regs.DREGS->DOUTEP1MSK);
+  
+  /* Transfer complete */
+  if ( doepint.b.xfercompl )
+  {
+    /* Clear the bit in DOEPINTn for this interrupt */
+    CLEAR_OUT_EP_INTR(1, xfercompl);
+    if (pdev->cfg.dma_enable == 1)
+    {
+      deptsiz.d32 = USB_OTG_READ_REG32(&(pdev->regs.OUTEP_REGS[1]->DOEPTSIZ));
+      /*ToDo : handle more than one single MPS size packet */
+      pdev->dev.out_ep[1].xfer_count = pdev->dev.out_ep[1].maxpacket - \
+        deptsiz.b.xfersize;
+    }    
+    /* Inform upper layer: data ready */
+    /* RX COMPLETE */
+    USBD_DCD_INT_fops->DataOutStage(pdev , 1);
+    
+  }
+  
+  /* Endpoint disable  */
+  if ( doepint.b.epdisabled )
+  {
+    /* Clear the bit in DOEPINTn for this interrupt */
+    CLEAR_OUT_EP_INTR(1, epdisabled);
+  }
+  /* AHB Error */
+  if ( doepint.b.ahberr )
+  {
+    CLEAR_OUT_EP_INTR(1, ahberr);
+  } 
+  return 1;
+}
+
+/**
+* @brief  USBD_OTG_EP1IN_ISR_Handler
+*         handles all USB Interrupts
+* @param  pdev: device instance
+* @retval status
+*/
+uint32_t USBD_OTG_EP1IN_ISR_Handler (USB_OTG_CORE_HANDLE *pdev)
+{
+  
+  USB_OTG_DIEPINTn_TypeDef  diepint;
+  uint32_t fifoemptymsk, msk, emp;
+  
+  msk = USB_OTG_READ_REG32(&pdev->regs.DREGS->DINEP1MSK);
+  emp = USB_OTG_READ_REG32(&pdev->regs.DREGS->DIEPEMPMSK);
+  msk |= ((emp >> 1 ) & 0x1) << 7;
+  diepint.d32  = USB_OTG_READ_REG32(&pdev->regs.INEP_REGS[1]->DIEPINT) & msk;  
+  
+  if ( diepint.b.xfercompl )
+  {
+    fifoemptymsk = 0x1 << 1;
+    USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPEMPMSK, fifoemptymsk, 0);
+    CLEAR_IN_EP_INTR(1, xfercompl);
+    /* TX COMPLETE */
+    USBD_DCD_INT_fops->DataInStage(pdev , 1);
+  }
+  if ( diepint.b.ahberr )
+  {
+    CLEAR_IN_EP_INTR(1, ahberr);
+  }
+  if ( diepint.b.epdisabled )
+  {
+    CLEAR_IN_EP_INTR(1, epdisabled);
+  }  
+  if ( diepint.b.timeout )
+  {
+    CLEAR_IN_EP_INTR(1, timeout);
+  }
+  if (diepint.b.intktxfemp)
+  {
+    CLEAR_IN_EP_INTR(1, intktxfemp);
+  }
+  if (diepint.b.intknepmis)
+  {
+    CLEAR_IN_EP_INTR(1, intknepmis);
+  }
+  if (diepint.b.inepnakeff)
+  {
+    CLEAR_IN_EP_INTR(1, inepnakeff);
+  }
+  if (diepint.b.emptyintr)
+  {
+    DCD_WriteEmptyTxFifo(pdev , 1);
+    CLEAR_IN_EP_INTR(1, emptyintr);
+  }
+  return 1;
+}
+#endif
+
+/**
+* @brief  STM32_USBF_OTG_ISR_Handler
+*         handles all USB Interrupts
+* @param  pdev: device instance
+* @retval status
+*/
+uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef  gintr_status;
+  uint32_t retval = 0;
+  
+  if (USB_OTG_IsDeviceMode(pdev)) /* ensure that we are in device mode */
+  {
+    gintr_status.d32 = USB_OTG_ReadCoreItr(pdev);
+    if (!gintr_status.d32) /* avoid spurious interrupt */
+    {
+      return 0;
+    }
+    
+    if (gintr_status.b.outepintr)
+    {
+      retval |= DCD_HandleOutEP_ISR(pdev);
+    }    
+    
+    if (gintr_status.b.inepint)
+    {
+      retval |= DCD_HandleInEP_ISR(pdev);
+    }
+    
+    if (gintr_status.b.modemismatch)
+    {
+      USB_OTG_GINTSTS_TypeDef  gintsts;
+      
+      /* Clear interrupt */
+      gintsts.d32 = 0;
+      gintsts.b.modemismatch = 1;
+      USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTSTS, gintsts.d32);
+    }
+    
+    if (gintr_status.b.wkupintr)
+    {
+      retval |= DCD_HandleResume_ISR(pdev);
+    }
+    
+    if (gintr_status.b.usbsuspend)
+    {
+      retval |= DCD_HandleUSBSuspend_ISR(pdev);
+    }
+    if (gintr_status.b.sofintr)
+    {
+      retval |= DCD_HandleSof_ISR(pdev);
+      
+    }
+    
+    if (gintr_status.b.rxstsqlvl)
+    {
+      retval |= DCD_HandleRxStatusQueueLevel_ISR(pdev);
+      
+    }
+    
+    if (gintr_status.b.usbreset)
+    {
+      retval |= DCD_HandleUsbReset_ISR(pdev);
+      
+    }
+    if (gintr_status.b.enumdone)
+    {
+      retval |= DCD_HandleEnumDone_ISR(pdev);
+    }
+    
+    if (gintr_status.b.incomplisoin)
+    {
+      retval |= DCD_IsoINIncomplete_ISR(pdev);
+    }
+
+    if (gintr_status.b.incomplisoout)
+    {
+      retval |= DCD_IsoOUTIncomplete_ISR(pdev);
+    }    
+#ifdef VBUS_SENSING_ENABLED
+    if (gintr_status.b.sessreqintr)
+    {
+      retval |= DCD_SessionRequest_ISR(pdev);
+    }
+
+    if (gintr_status.b.otgintr)
+    {
+      retval |= DCD_OTG_ISR(pdev);
+    }   
+#endif    
+  }
+  return retval;
+}
+
+#ifdef VBUS_SENSING_ENABLED
+/**
+* @brief  DCD_SessionRequest_ISR
+*         Indicates that the USB_OTG controller has detected a connection
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_SessionRequest_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef  gintsts;  
+  USBD_DCD_INT_fops->DevConnected (pdev);
+
+  /* Clear interrupt */
+  gintsts.d32 = 0;
+  gintsts.b.sessreqintr = 1;
+  USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GINTSTS, gintsts.d32);   
+  return 1;
+}
+
+/**
+* @brief  DCD_OTG_ISR
+*         Indicates that the USB_OTG controller has detected an OTG event:
+*                 used to detect the end of session i.e. disconnection
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_OTG_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+
+  USB_OTG_GOTGINT_TypeDef  gotgint;
+
+  gotgint.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GOTGINT);
+  
+  if (gotgint.b.sesenddet)
+  {
+    USBD_DCD_INT_fops->DevDisconnected (pdev);
+  }
+  /* Clear OTG interrupt */
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GOTGINT, gotgint.d32); 
+  return 1;
+}
+#endif
+/**
+* @brief  DCD_HandleResume_ISR
+*         Indicates that the USB_OTG controller has detected a resume or
+*                 remote Wake-up sequence
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleResume_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef  gintsts;
+  USB_OTG_DCTL_TypeDef     devctl;
+  USB_OTG_PCGCCTL_TypeDef  power;
+  
+  if(pdev->cfg.low_power)
+  {
+    /* un-gate USB Core clock */
+    power.d32 = USB_OTG_READ_REG32(&pdev->regs.PCGCCTL);
+    power.b.gatehclk = 0;
+    power.b.stoppclk = 0;
+    USB_OTG_WRITE_REG32(pdev->regs.PCGCCTL, power.d32);
+  }
+  
+  /* Clear the Remote Wake-up Signaling */
+  devctl.d32 = 0;
+  devctl.b.rmtwkupsig = 1;
+  USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, devctl.d32, 0);
+  
+  /* Inform upper layer by the Resume Event */
+  USBD_DCD_INT_fops->Resume (pdev);
+  
+  /* Clear interrupt */
+  gintsts.d32 = 0;
+  gintsts.b.wkupintr = 1;
+  USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GINTSTS, gintsts.d32);
+  return 1;
+}
+
+/**
+* @brief  USB_OTG_HandleUSBSuspend_ISR
+*         Indicates that SUSPEND state has been detected on the USB
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleUSBSuspend_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef  gintsts;
+  USB_OTG_PCGCCTL_TypeDef  power;
+  USB_OTG_DSTS_TypeDef     dsts;
+  
+  USBD_DCD_INT_fops->Suspend (pdev);      
+  
+  dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
+    
+  /* Clear interrupt */
+  gintsts.d32 = 0;
+  gintsts.b.usbsuspend = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTSTS, gintsts.d32);
+  
+  if((pdev->cfg.low_power) && (dsts.b.suspsts == 1))
+  {
+       /*  switch-off the clocks */
+    power.d32 = 0;
+    power.b.stoppclk = 1;
+    USB_OTG_MODIFY_REG32(pdev->regs.PCGCCTL, 0, power.d32);  
+    
+    power.b.gatehclk = 1;
+    USB_OTG_MODIFY_REG32(pdev->regs.PCGCCTL, 0, power.d32);
+    
+    /* Request to enter Sleep mode after exit from current ISR */
+    SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk);
+  }
+  return 1;
+}
+
+/**
+* @brief  DCD_HandleInEP_ISR
+*         Indicates that an IN EP has a pending Interrupt
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleInEP_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_DIEPINTn_TypeDef  diepint;
+  
+  uint32_t ep_intr;
+  uint32_t epnum = 0;
+  uint32_t fifoemptymsk;
+  diepint.d32 = 0;
+  ep_intr = USB_OTG_ReadDevAllInEPItr(pdev);
+  
+  while ( ep_intr )
+  {
+    if (ep_intr&0x1) /* In ITR */
+    {
+      diepint.d32 = DCD_ReadDevInEP(pdev , epnum); /* Get In ITR status */
+      if ( diepint.b.xfercompl )
+      {
+        fifoemptymsk = 0x1 << epnum;
+        USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPEMPMSK, fifoemptymsk, 0);
+        CLEAR_IN_EP_INTR(epnum, xfercompl);
+        /* TX COMPLETE */
+        USBD_DCD_INT_fops->DataInStage(pdev , epnum);
+        
+        if (pdev->cfg.dma_enable == 1)
+        {
+          if((epnum == 0) && (pdev->dev.device_state == USB_OTG_EP0_STATUS_IN))
+          {
+            /* prepare to rx more setup packets */
+            USB_OTG_EP0_OutStart(pdev);
+          }
+        }           
+      }
+      if ( diepint.b.ahberr )
+      {
+        CLEAR_IN_EP_INTR(epnum, ahberr);
+      }
+      if ( diepint.b.timeout )
+      {
+        CLEAR_IN_EP_INTR(epnum, timeout);
+      }
+      if (diepint.b.intktxfemp)
+      {
+        CLEAR_IN_EP_INTR(epnum, intktxfemp);
+      }
+      if (diepint.b.intknepmis)
+      {
+        CLEAR_IN_EP_INTR(epnum, intknepmis);
+      }
+      if (diepint.b.inepnakeff)
+      {
+        CLEAR_IN_EP_INTR(epnum, inepnakeff);
+      }
+      if ( diepint.b.epdisabled )
+      {
+        CLEAR_IN_EP_INTR(epnum, epdisabled);
+      }       
+      if (diepint.b.emptyintr)
+      {
+        
+        DCD_WriteEmptyTxFifo(pdev , epnum);
+        
+        CLEAR_IN_EP_INTR(epnum, emptyintr);
+      }
+    }
+    epnum++;
+    ep_intr >>= 1;
+  }
+  
+  return 1;
+}
+
+/**
+* @brief  DCD_HandleOutEP_ISR
+*         Indicates that an OUT EP has a pending Interrupt
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleOutEP_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  uint32_t ep_intr;
+  USB_OTG_DOEPINTn_TypeDef  doepint;
+  USB_OTG_DEPXFRSIZ_TypeDef  deptsiz;
+  uint32_t epnum = 0;
+  
+  doepint.d32 = 0;
+  
+  /* Read in the device interrupt bits */
+  ep_intr = USB_OTG_ReadDevAllOutEp_itr(pdev);
+  
+  while ( ep_intr )
+  {
+    if (ep_intr&0x1)
+    {
+      
+      doepint.d32 = USB_OTG_ReadDevOutEP_itr(pdev, epnum);
+      
+      /* Transfer complete */
+      if ( doepint.b.xfercompl )
+      {
+        /* Clear the bit in DOEPINTn for this interrupt */
+        CLEAR_OUT_EP_INTR(epnum, xfercompl);
+        if (pdev->cfg.dma_enable == 1)
+        {
+          deptsiz.d32 = USB_OTG_READ_REG32(&(pdev->regs.OUTEP_REGS[epnum]->DOEPTSIZ));
+          /*ToDo : handle more than one single MPS size packet */
+          pdev->dev.out_ep[epnum].xfer_count = pdev->dev.out_ep[epnum].maxpacket - \
+            deptsiz.b.xfersize;
+        }
+        /* Inform upper layer: data ready */
+        /* RX COMPLETE */
+        USBD_DCD_INT_fops->DataOutStage(pdev , epnum);
+        
+        if (pdev->cfg.dma_enable == 1)
+        {
+          if((epnum == 0) && (pdev->dev.device_state == USB_OTG_EP0_STATUS_OUT))
+          {
+            /* prepare to rx more setup packets */
+            USB_OTG_EP0_OutStart(pdev);
+          }
+        }        
+      }
+      /* Endpoint disable  */
+      if ( doepint.b.epdisabled )
+      {
+        /* Clear the bit in DOEPINTn for this interrupt */
+        CLEAR_OUT_EP_INTR(epnum, epdisabled);
+      }
+      /* AHB Error */
+      if ( doepint.b.ahberr )
+      {
+        CLEAR_OUT_EP_INTR(epnum, ahberr);
+      }
+      /* Setup Phase Done (control EPs) */
+      if ( doepint.b.setup )
+      {
+        
+        /* inform the upper layer that a setup packet is available */
+        /* SETUP COMPLETE */
+        USBD_DCD_INT_fops->SetupStage(pdev);
+        CLEAR_OUT_EP_INTR(epnum, setup);
+      }
+    }
+    epnum++;
+    ep_intr >>= 1;
+  }
+  return 1;
+}
+
+/**
+* @brief  DCD_HandleSof_ISR
+*         Handles the SOF Interrupts
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleSof_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef  GINTSTS;
+  
+  
+  USBD_DCD_INT_fops->SOF(pdev);
+  
+  /* Clear interrupt */
+  GINTSTS.d32 = 0;
+  GINTSTS.b.sofintr = 1;
+  USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GINTSTS, GINTSTS.d32);
+  
+  return 1;
+}
+
+/**
+* @brief  DCD_HandleRxStatusQueueLevel_ISR
+*         Handles the Rx Status Queue Level Interrupt
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleRxStatusQueueLevel_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTMSK_TypeDef  int_mask;
+  USB_OTG_DRXSTS_TypeDef   status;
+  USB_OTG_EP *ep;
+  
+  /* Disable the Rx Status Queue Level interrupt */
+  int_mask.d32 = 0;
+  int_mask.b.rxstsqlvl = 1;
+  USB_OTG_MODIFY_REG32( &pdev->regs.GREGS->GINTMSK, int_mask.d32, 0);
+  
+  /* Get the Status from the top of the FIFO */
+  status.d32 = USB_OTG_READ_REG32( &pdev->regs.GREGS->GRXSTSP );
+  
+  ep = &pdev->dev.out_ep[status.b.epnum];
+  
+  switch (status.b.pktsts)
+  {
+  case STS_GOUT_NAK:
+    break;
+  case STS_DATA_UPDT:
+    if (status.b.bcnt)
+    {
+      USB_OTG_ReadPacket(pdev,ep->xfer_buff, status.b.bcnt);
+      ep->xfer_buff += status.b.bcnt;
+      ep->xfer_count += status.b.bcnt;
+    }
+    break;
+  case STS_XFER_COMP:
+    break;
+  case STS_SETUP_COMP:
+    break;
+  case STS_SETUP_UPDT:
+    /* Copy the setup packet received in FIFO into the setup buffer in RAM */
+    USB_OTG_ReadPacket(pdev , pdev->dev.setup_packet, 8);
+    ep->xfer_count += status.b.bcnt;
+    break;
+  default:
+    break;
+  }
+  
+  /* Enable the Rx Status Queue Level interrupt */
+  USB_OTG_MODIFY_REG32( &pdev->regs.GREGS->GINTMSK, 0, int_mask.d32);
+  
+  return 1;
+}
+
+/**
+* @brief  DCD_WriteEmptyTxFifo
+*         check FIFO for the next packet to be loaded
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_WriteEmptyTxFifo(USB_OTG_CORE_HANDLE *pdev, uint32_t epnum)
+{
+  USB_OTG_DTXFSTSn_TypeDef  txstatus;
+  USB_OTG_EP *ep;
+  uint32_t len = 0;
+  uint32_t len32b;
+  txstatus.d32 = 0;
+  
+  ep = &pdev->dev.in_ep[epnum];    
+  
+  len = ep->xfer_len - ep->xfer_count;
+  
+  if (len > ep->maxpacket)
+  {
+    len = ep->maxpacket;
+  }
+  
+  len32b = (len + 3) / 4;
+  txstatus.d32 = USB_OTG_READ_REG32( &pdev->regs.INEP_REGS[epnum]->DTXFSTS);
+  
+  
+  
+  while  (txstatus.b.txfspcavail > len32b &&
+          ep->xfer_count < ep->xfer_len &&
+            ep->xfer_len != 0)
+  {
+    /* Write the FIFO */
+    len = ep->xfer_len - ep->xfer_count;
+    
+    if (len > ep->maxpacket)
+    {
+      len = ep->maxpacket;
+    }
+    len32b = (len + 3) / 4;
+    
+    USB_OTG_WritePacket (pdev , ep->xfer_buff, epnum, len);
+    
+    ep->xfer_buff  += len;
+    ep->xfer_count += len;
+    
+    txstatus.d32 = USB_OTG_READ_REG32(&pdev->regs.INEP_REGS[epnum]->DTXFSTS);
+  }
+  
+  return 1;
+}
+
+/**
+* @brief  DCD_HandleUsbReset_ISR
+*         This interrupt occurs when a USB Reset is detected
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleUsbReset_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_DAINT_TypeDef    daintmsk;
+  USB_OTG_DOEPMSK_TypeDef  doepmsk;
+  USB_OTG_DIEPMSK_TypeDef  diepmsk;
+  USB_OTG_DCFG_TypeDef     dcfg;
+  USB_OTG_DCTL_TypeDef     dctl;
+  USB_OTG_GINTSTS_TypeDef  gintsts;
+  uint32_t i;
+  
+  dctl.d32 = 0;
+  daintmsk.d32 = 0;
+  doepmsk.d32 = 0;
+  diepmsk.d32 = 0;
+  dcfg.d32 = 0;
+  gintsts.d32 = 0;
+  
+  /* Clear the Remote Wake-up Signaling */
+  dctl.b.rmtwkupsig = 1;
+  USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, dctl.d32, 0 );
+  
+  /* Flush the Tx FIFO */
+  USB_OTG_FlushTxFifo(pdev ,  0 );
+  
+  for (i = 0; i < pdev->cfg.dev_endpoints ; i++)
+  {
+    USB_OTG_WRITE_REG32( &pdev->regs.INEP_REGS[i]->DIEPINT, 0xFF);
+    USB_OTG_WRITE_REG32( &pdev->regs.OUTEP_REGS[i]->DOEPINT, 0xFF);
+  }
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DAINT, 0xFFFFFFFF );
+  
+  daintmsk.ep.in = 1;
+  daintmsk.ep.out = 1;
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DAINTMSK, daintmsk.d32 );
+  
+  doepmsk.b.setup = 1;
+  doepmsk.b.xfercompl = 1;
+  doepmsk.b.ahberr = 1;
+  doepmsk.b.epdisabled = 1;
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DOEPMSK, doepmsk.d32 );
+#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED   
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DOUTEP1MSK, doepmsk.d32 );
+#endif
+  diepmsk.b.xfercompl = 1;
+  diepmsk.b.timeout = 1;
+  diepmsk.b.epdisabled = 1;
+  diepmsk.b.ahberr = 1;
+  diepmsk.b.intknepmis = 1;
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DIEPMSK, diepmsk.d32 );
+#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED  
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DINEP1MSK, diepmsk.d32 );
+#endif
+  /* Reset Device Address */
+  dcfg.d32 = USB_OTG_READ_REG32( &pdev->regs.DREGS->DCFG);
+  dcfg.b.devaddr = 0;
+  USB_OTG_WRITE_REG32( &pdev->regs.DREGS->DCFG, dcfg.d32);
+  
+  
+  /* setup EP0 to receive SETUP packets */
+  USB_OTG_EP0_OutStart(pdev);
+  
+  /* Clear interrupt */
+  gintsts.d32 = 0;
+  gintsts.b.usbreset = 1;
+  USB_OTG_WRITE_REG32 (&pdev->regs.GREGS->GINTSTS, gintsts.d32);
+  
+  /*Reset internal state machine */
+  USBD_DCD_INT_fops->Reset(pdev);
+  return 1;
+}
+
+/**
+* @brief  DCD_HandleEnumDone_ISR
+*         Read the device status register and set the device speed
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_HandleEnumDone_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef  gintsts;
+  USB_OTG_GUSBCFG_TypeDef  gusbcfg;
+  
+  USB_OTG_EP0Activate(pdev);
+  
+  /* Set USB turn-around time based on device speed and PHY interface. */
+  gusbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);
+  
+  /* Full or High speed */
+  if ( USB_OTG_GetDeviceSpeed(pdev) == USB_SPEED_HIGH)
+  {
+    pdev->cfg.speed            = USB_OTG_SPEED_HIGH;
+    pdev->cfg.mps              = USB_OTG_HS_MAX_PACKET_SIZE ;    
+    gusbcfg.b.usbtrdtim = 9;
+  }
+  else
+  {
+    pdev->cfg.speed            = USB_OTG_SPEED_FULL;
+    pdev->cfg.mps              = USB_OTG_FS_MAX_PACKET_SIZE ;  
+    gusbcfg.b.usbtrdtim = 5;
+  }
+  
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GUSBCFG, gusbcfg.d32);
+  
+  /* Clear interrupt */
+  gintsts.d32 = 0;
+  gintsts.b.enumdone = 1;
+  USB_OTG_WRITE_REG32( &pdev->regs.GREGS->GINTSTS, gintsts.d32 );
+  return 1;
+}
+
+
+/**
+* @brief  DCD_IsoINIncomplete_ISR
+*         handle the ISO IN incomplete interrupt
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_IsoINIncomplete_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef gintsts;  
+  
+  gintsts.d32 = 0;
+
+  USBD_DCD_INT_fops->IsoINIncomplete (pdev); 
+  
+  /* Clear interrupt */
+  gintsts.b.incomplisoin = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTSTS, gintsts.d32);
+  
+  return 1;
+}
+
+/**
+* @brief  DCD_IsoOUTIncomplete_ISR
+*         handle the ISO OUT incomplete interrupt
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_IsoOUTIncomplete_ISR(USB_OTG_CORE_HANDLE *pdev)
+{
+  USB_OTG_GINTSTS_TypeDef gintsts;  
+  
+  gintsts.d32 = 0;
+
+  USBD_DCD_INT_fops->IsoOUTIncomplete (pdev); 
+  
+  /* Clear interrupt */
+  gintsts.b.incomplisoout = 1;
+  USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTSTS, gintsts.d32);
+  return 1;
+}
+/**
+* @brief  DCD_ReadDevInEP
+*         Reads ep flags
+* @param  pdev: device instance
+* @retval status
+*/
+static uint32_t DCD_ReadDevInEP (USB_OTG_CORE_HANDLE *pdev, uint8_t epnum)
+{
+  uint32_t v, msk, emp;
+  msk = USB_OTG_READ_REG32(&pdev->regs.DREGS->DIEPMSK);
+  emp = USB_OTG_READ_REG32(&pdev->regs.DREGS->DIEPEMPMSK);
+  msk |= ((emp >> epnum) & 0x1) << 7;
+  v = USB_OTG_READ_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT) & msk;
+  return v;
+}
+
+
+
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/ 
+
+/**
+* @}
+*/
+#endif
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd_int.h b/codec2/tags/0.4/stm32/usb_lib/otg/usb_dcd_int.h
new file mode 100644 (file)
index 0000000..9df1a41
--- /dev/null
@@ -0,0 +1,121 @@
+/**
+  ******************************************************************************
+  * @file    usb_dcd_int.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Peripheral Device Interface Layer
+  ******************************************************************************
+  * @attention 
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef USB_DCD_INT_H__
+#define USB_DCD_INT_H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_dcd.h"
+
+
+
+/** @addtogroup USB_OTG_DRIVER
+  * @{
+  */
+  
+/** @defgroup USB_DCD_INT
+  * @brief This file is the 
+  * @{
+  */ 
+
+
+/** @defgroup USB_DCD_INT_Exported_Defines
+  * @{
+  */ 
+
+typedef struct _USBD_DCD_INT
+{
+  uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
+  uint8_t (* DataInStage)  (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
+  uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev);  
+  
+  uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev);
+  uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev);   
+  
+}USBD_DCD_INT_cb_TypeDef;
+
+extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops;
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_DCD_INT_Exported_Types
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_DCD_INT_Exported_Macros
+  * @{
+  */ 
+
+#define CLEAR_IN_EP_INTR(epnum,intr) \
+  diepint.d32=0; \
+  diepint.b.intr = 1; \
+  USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32);
+
+#define CLEAR_OUT_EP_INTR(epnum,intr) \
+  doepint.d32=0; \
+  doepint.b.intr = 1; \
+  USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT,doepint.d32);
+
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_DCD_INT_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_DCD_INT_Exported_FunctionsPrototype
+  * @{
+  */ 
+
+uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev);
+
+/**
+  * @}
+  */ 
+
+
+#endif // USB_DCD_INT_H__
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_defines.h b/codec2/tags/0.4/stm32/usb_lib/otg/usb_defines.h
new file mode 100644 (file)
index 0000000..b119c25
--- /dev/null
@@ -0,0 +1,244 @@
+/**
+  ******************************************************************************
+  * @file    usb_defines.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   Header of the Core Layer
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USB_DEF_H__
+#define __USB_DEF_H__
+
+/* Includes ------------------------------------------------------------------*/
+#include  "usb_conf.h"
+
+/** @addtogroup USB_OTG_DRIVER
+  * @{
+  */
+  
+/** @defgroup USB_DEFINES
+  * @brief This file is the 
+  * @{
+  */ 
+
+
+/** @defgroup USB_DEFINES_Exported_Defines
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup _CORE_DEFINES_
+  * @{
+  */
+
+#define USB_OTG_SPEED_PARAM_HIGH 0
+#define USB_OTG_SPEED_PARAM_HIGH_IN_FULL 1
+#define USB_OTG_SPEED_PARAM_FULL 3
+
+#define USB_OTG_SPEED_HIGH      0
+#define USB_OTG_SPEED_FULL      1
+
+#define USB_OTG_ULPI_PHY      1
+#define USB_OTG_EMBEDDED_PHY  2
+#define USB_OTG_I2C_PHY       3
+
+/**
+  * @}
+  */
+
+
+/** @defgroup _GLOBAL_DEFINES_
+  * @{
+  */
+#define GAHBCFG_TXFEMPTYLVL_EMPTY              1
+#define GAHBCFG_TXFEMPTYLVL_HALFEMPTY          0
+#define GAHBCFG_GLBINT_ENABLE                  1
+#define GAHBCFG_INT_DMA_BURST_SINGLE           0
+#define GAHBCFG_INT_DMA_BURST_INCR             1
+#define GAHBCFG_INT_DMA_BURST_INCR4            3
+#define GAHBCFG_INT_DMA_BURST_INCR8            5
+#define GAHBCFG_INT_DMA_BURST_INCR16           7
+#define GAHBCFG_DMAENABLE                      1
+#define GAHBCFG_TXFEMPTYLVL_EMPTY              1
+#define GAHBCFG_TXFEMPTYLVL_HALFEMPTY          0
+#define GRXSTS_PKTSTS_IN                       2
+#define GRXSTS_PKTSTS_IN_XFER_COMP             3
+#define GRXSTS_PKTSTS_DATA_TOGGLE_ERR          5
+#define GRXSTS_PKTSTS_CH_HALTED                7
+/**
+  * @}
+  */
+
+
+/** @defgroup _OnTheGo_DEFINES_
+  * @{
+  */
+#define MODE_HNP_SRP_CAPABLE                   0
+#define MODE_SRP_ONLY_CAPABLE                  1
+#define MODE_NO_HNP_SRP_CAPABLE                2
+#define MODE_SRP_CAPABLE_DEVICE                3
+#define MODE_NO_SRP_CAPABLE_DEVICE             4
+#define MODE_SRP_CAPABLE_HOST                  5
+#define MODE_NO_SRP_CAPABLE_HOST               6
+#define A_HOST                                 1
+#define A_SUSPEND                              2
+#define A_PERIPHERAL                           3
+#define B_PERIPHERAL                           4
+#define B_HOST                                 5
+#define DEVICE_MODE                            0
+#define HOST_MODE                              1
+#define OTG_MODE                               2
+/**
+  * @}
+  */
+
+
+/** @defgroup __DEVICE_DEFINES_
+  * @{
+  */
+#define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ     0
+#define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ     1
+#define DSTS_ENUMSPD_LS_PHY_6MHZ               2
+#define DSTS_ENUMSPD_FS_PHY_48MHZ              3
+
+#define DCFG_FRAME_INTERVAL_80                 0
+#define DCFG_FRAME_INTERVAL_85                 1
+#define DCFG_FRAME_INTERVAL_90                 2
+#define DCFG_FRAME_INTERVAL_95                 3
+
+#define DEP0CTL_MPS_64                         0
+#define DEP0CTL_MPS_32                         1
+#define DEP0CTL_MPS_16                         2
+#define DEP0CTL_MPS_8                          3
+
+#define EP_SPEED_LOW                           0
+#define EP_SPEED_FULL                          1
+#define EP_SPEED_HIGH                          2
+
+#define EP_TYPE_CTRL                           0
+#define EP_TYPE_ISOC                           1
+#define EP_TYPE_BULK                           2
+#define EP_TYPE_INTR                           3
+#define EP_TYPE_MSK                            3
+
+#define STS_GOUT_NAK                           1
+#define STS_DATA_UPDT                          2
+#define STS_XFER_COMP                          3
+#define STS_SETUP_COMP                         4
+#define STS_SETUP_UPDT                         6
+/**
+  * @}
+  */
+
+
+/** @defgroup __HOST_DEFINES_
+  * @{
+  */
+#define HC_PID_DATA0                           0
+#define HC_PID_DATA2                           1
+#define HC_PID_DATA1                           2
+#define HC_PID_SETUP                           3
+
+#define HPRT0_PRTSPD_HIGH_SPEED                0
+#define HPRT0_PRTSPD_FULL_SPEED                1
+#define HPRT0_PRTSPD_LOW_SPEED                 2
+
+#define HCFG_30_60_MHZ                         0
+#define HCFG_48_MHZ                            1
+#define HCFG_6_MHZ                             2
+
+#define HCCHAR_CTRL                            0
+#define HCCHAR_ISOC                            1
+#define HCCHAR_BULK                            2
+#define HCCHAR_INTR                            3
+
+#define  MIN(a, b)      (((a) < (b)) ? (a) : (b))
+
+/**
+  * @}
+  */
+
+
+/** @defgroup USB_DEFINES_Exported_Types
+  * @{
+  */ 
+
+typedef enum
+{
+  USB_OTG_HS_CORE_ID = 0,
+  USB_OTG_FS_CORE_ID = 1
+}USB_OTG_CORE_ID_TypeDef;
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_DEFINES_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_DEFINES_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_DEFINES_Exported_FunctionsPrototype
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+/** @defgroup Internal_Macro's
+  * @{
+  */
+#define USB_OTG_READ_REG32(reg)  (*(__IO uint32_t *)reg)
+#define USB_OTG_WRITE_REG32(reg,value) (*(__IO uint32_t *)reg = value)
+#define USB_OTG_MODIFY_REG32(reg,clear_mask,set_mask) \
+  USB_OTG_WRITE_REG32(reg, (((USB_OTG_READ_REG32(reg)) & ~clear_mask) | set_mask ) )
+
+/********************************************************************************
+                              ENUMERATION TYPE
+********************************************************************************/
+enum USB_OTG_SPEED {
+  USB_SPEED_UNKNOWN = 0,
+  USB_SPEED_LOW,
+  USB_SPEED_FULL,
+  USB_SPEED_HIGH
+};
+
+#endif //__USB_DEFINES__H__
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/stm32/usb_lib/otg/usb_regs.h b/codec2/tags/0.4/stm32/usb_lib/otg/usb_regs.h
new file mode 100644 (file)
index 0000000..cd71ddf
--- /dev/null
@@ -0,0 +1,1206 @@
+/**
+  ******************************************************************************
+  * @file    usb_regs.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    22-July-2011
+  * @brief   hardware registers
+  ******************************************************************************
+  * @attention
+  *
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+  *
+  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USB_OTG_REGS_H__
+#define __USB_OTG_REGS_H__
+
+/* Includes ------------------------------------------------------------------*/
+#include "usb_conf.h"
+
+
+/** @addtogroup USB_OTG_DRIVER
+  * @{
+  */
+  
+/** @defgroup USB_REGS
+  * @brief This file is the 
+  * @{
+  */ 
+
+
+/** @defgroup USB_REGS_Exported_Defines
+  * @{
+  */ 
+
+#define USB_OTG_HS_BASE_ADDR                 0x40040000
+#define USB_OTG_FS_BASE_ADDR                 0x50000000
+
+#define USB_OTG_CORE_GLOBAL_REGS_OFFSET      0x000
+#define USB_OTG_DEV_GLOBAL_REG_OFFSET        0x800
+#define USB_OTG_DEV_IN_EP_REG_OFFSET         0x900
+#define USB_OTG_EP_REG_OFFSET                0x20
+#define USB_OTG_DEV_OUT_EP_REG_OFFSET        0xB00
+#define USB_OTG_HOST_GLOBAL_REG_OFFSET       0x400
+#define USB_OTG_HOST_PORT_REGS_OFFSET        0x440
+#define USB_OTG_HOST_CHAN_REGS_OFFSET        0x500
+#define USB_OTG_CHAN_REGS_OFFSET             0x20
+#define USB_OTG_PCGCCTL_OFFSET               0xE00
+#define USB_OTG_DATA_FIFO_OFFSET             0x1000
+#define USB_OTG_DATA_FIFO_SIZE               0x1000
+
+
+#define USB_OTG_MAX_TX_FIFOS                 15
+
+#define USB_OTG_HS_MAX_PACKET_SIZE           512
+#define USB_OTG_FS_MAX_PACKET_SIZE           64
+#define USB_OTG_MAX_EP0_SIZE                 64
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_REGS_Exported_Types
+  * @{
+  */ 
+
+/** @defgroup __USB_OTG_Core_register
+  * @{
+  */
+typedef struct _USB_OTG_GREGS  //000h
+{
+  __IO uint32_t GOTGCTL;      /* USB_OTG Control and Status Register    000h*/
+  __IO uint32_t GOTGINT;      /* USB_OTG Interrupt Register             004h*/
+  __IO uint32_t GAHBCFG;      /* Core AHB Configuration Register    008h*/
+  __IO uint32_t GUSBCFG;      /* Core USB Configuration Register    00Ch*/
+  __IO uint32_t GRSTCTL;      /* Core Reset Register                010h*/
+  __IO uint32_t GINTSTS;      /* Core Interrupt Register            014h*/
+  __IO uint32_t GINTMSK;      /* Core Interrupt Mask Register       018h*/
+  __IO uint32_t GRXSTSR;      /* Receive Sts Q Read Register        01Ch*/
+  __IO uint32_t GRXSTSP;      /* Receive Sts Q Read & POP Register  020h*/
+  __IO uint32_t GRXFSIZ;      /* Receive FIFO Size Register         024h*/
+  __IO uint32_t DIEPTXF0_HNPTXFSIZ;   /* EP0 / Non Periodic Tx FIFO Size Register 028h*/
+  __IO uint32_t HNPTXSTS;     /* Non Periodic Tx FIFO/Queue Sts reg 02Ch*/
+  __IO uint32_t GI2CCTL;      /* I2C Access Register                030h*/
+  uint32_t Reserved34;  /* PHY Vendor Control Register        034h*/
+  __IO uint32_t GCCFG;        /* General Purpose IO Register        038h*/
+  __IO uint32_t CID;          /* User ID Register                   03Ch*/
+  uint32_t  Reserved40[48];   /* Reserved                      040h-0FFh*/
+  __IO uint32_t HPTXFSIZ; /* Host Periodic Tx FIFO Size Reg     100h*/
+  __IO uint32_t DIEPTXF[USB_OTG_MAX_TX_FIFOS];/* dev Periodic Transmit FIFO */
+}
+USB_OTG_GREGS;
+/**
+  * @}
+  */
+
+
+/** @defgroup __device_Registers
+  * @{
+  */
+typedef struct _USB_OTG_DREGS // 800h
+{
+  __IO uint32_t DCFG;         /* dev Configuration Register   800h*/
+  __IO uint32_t DCTL;         /* dev Control Register         804h*/
+  __IO uint32_t DSTS;         /* dev Status Register (RO)     808h*/
+  uint32_t Reserved0C;           /* Reserved                     80Ch*/
+  __IO uint32_t DIEPMSK;   /* dev IN Endpoint Mask         810h*/
+  __IO uint32_t DOEPMSK;  /* dev OUT Endpoint Mask        814h*/
+  __IO uint32_t DAINT;     /* dev All Endpoints Itr Reg    818h*/
+  __IO uint32_t DAINTMSK; /* dev All Endpoints Itr Mask   81Ch*/
+  uint32_t  Reserved20;          /* Reserved                     820h*/
+  uint32_t Reserved9;       /* Reserved                     824h*/
+  __IO uint32_t DVBUSDIS;    /* dev VBUS discharge Register  828h*/
+  __IO uint32_t DVBUSPULSE;  /* dev VBUS Pulse Register      82Ch*/
+  __IO uint32_t DTHRCTL;     /* dev thr                      830h*/
+  __IO uint32_t DIEPEMPMSK; /* dev empty msk             834h*/
+  __IO uint32_t DEACHINT;    /* dedicated EP interrupt       838h*/
+  __IO uint32_t DEACHMSK;    /* dedicated EP msk             83Ch*/  
+  uint32_t Reserved40;      /* dedicated EP mask           840h*/
+  __IO uint32_t DINEP1MSK;  /* dedicated EP mask           844h*/
+  uint32_t  Reserved44[15];      /* Reserved                 844-87Ch*/
+  __IO uint32_t DOUTEP1MSK; /* dedicated EP msk            884h*/   
+}
+USB_OTG_DREGS;
+/**
+  * @}
+  */
+
+
+/** @defgroup __IN_Endpoint-Specific_Register
+  * @{
+  */
+typedef struct _USB_OTG_INEPREGS
+{
+  __IO uint32_t DIEPCTL; /* dev IN Endpoint Control Reg 900h + (ep_num * 20h) + 00h*/
+  uint32_t Reserved04;             /* Reserved                       900h + (ep_num * 20h) + 04h*/
+  __IO uint32_t DIEPINT; /* dev IN Endpoint Itr Reg     900h + (ep_num * 20h) + 08h*/
+  uint32_t Reserved0C;             /* Reserved                       900h + (ep_num * 20h) + 0Ch*/
+  __IO uint32_t DIEPTSIZ; /* IN Endpoint Txfer Size   900h + (ep_num * 20h) + 10h*/
+  __IO uint32_t DIEPDMA; /* IN Endpoint DMA Address Reg    900h + (ep_num * 20h) + 14h*/
+  __IO uint32_t DTXFSTS;/*IN Endpoint Tx FIFO Status Reg 900h + (ep_num * 20h) + 18h*/
+  uint32_t Reserved18;             /* Reserved  900h+(ep_num*20h)+1Ch-900h+ (ep_num * 20h) + 1Ch*/
+}
+USB_OTG_INEPREGS;
+/**
+  * @}
+  */
+
+
+/** @defgroup __OUT_Endpoint-Specific_Registers
+  * @{
+  */
+typedef struct _USB_OTG_OUTEPREGS
+{
+  __IO uint32_t DOEPCTL;       /* dev OUT Endpoint Control Reg  B00h + (ep_num * 20h) + 00h*/
+  __IO uint32_t DOUTEPFRM;   /* dev OUT Endpoint Frame number B00h + (ep_num * 20h) + 04h*/
+  __IO uint32_t DOEPINT;              /* dev OUT Endpoint Itr Reg      B00h + (ep_num * 20h) + 08h*/
+  uint32_t Reserved0C;                    /* Reserved                         B00h + (ep_num * 20h) + 0Ch*/
+  __IO uint32_t DOEPTSIZ; /* dev OUT Endpoint Txfer Size   B00h + (ep_num * 20h) + 10h*/
+  __IO uint32_t DOEPDMA;              /* dev OUT Endpoint DMA Address  B00h + (ep_num * 20h) + 14h*/
+  uint32_t Reserved18[2];                 /* Reserved B00h + (ep_num * 20h) + 18h - B00h + (ep_num * 20h) + 1Ch*/
+}
+USB_OTG_OUTEPREGS;
+/**
+  * @}
+  */
+
+
+/** @defgroup __Host_Mode_Register_Structures
+  * @{
+  */
+typedef struct _USB_OTG_HREGS
+{
+  __IO uint32_t HCFG;             /* Host Configuration Register    400h*/
+  __IO uint32_t HFIR;      /* Host Frame Interval Register   404h*/
+  __IO uint32_t HFNUM;         /* Host Frame Nbr/Frame Remaining 408h*/
+  uint32_t Reserved40C;                   /* Reserved                       40Ch*/
+  __IO uint32_t HPTXSTS;   /* Host Periodic Tx FIFO/ Queue Status 410h*/
+  __IO uint32_t HAINT;   /* Host All Channels Interrupt Register 414h*/
+  __IO uint32_t HAINTMSK;   /* Host All Channels Interrupt Mask 418h*/
+}
+USB_OTG_HREGS;
+/**
+  * @}
+  */
+
+
+/** @defgroup __Host_Channel_Specific_Registers
+  * @{
+  */
+typedef struct _USB_OTG_HC_REGS
+{
+  __IO uint32_t HCCHAR;
+  __IO uint32_t HCSPLT;
+  __IO uint32_t HCINT;
+  __IO uint32_t HCGINTMSK;
+  __IO uint32_t HCTSIZ;
+  __IO uint32_t HCDMA;
+  uint32_t Reserved[2];
+}
+USB_OTG_HC_REGS;
+/**
+  * @}
+  */
+
+
+/** @defgroup __otg_Core_registers
+  * @{
+  */
+typedef struct USB_OTG_core_regs //000h
+{
+  USB_OTG_GREGS         *GREGS;
+  USB_OTG_DREGS         *DREGS;
+  USB_OTG_HREGS         *HREGS;
+  USB_OTG_INEPREGS      *INEP_REGS[USB_OTG_MAX_TX_FIFOS];
+  USB_OTG_OUTEPREGS     *OUTEP_REGS[USB_OTG_MAX_TX_FIFOS];
+  USB_OTG_HC_REGS       *HC_REGS[USB_OTG_MAX_TX_FIFOS];
+  __IO uint32_t         *HPRT0;
+  __IO uint32_t         *DFIFO[USB_OTG_MAX_TX_FIFOS];
+  __IO uint32_t         *PCGCCTL;
+}
+USB_OTG_CORE_REGS , *PUSB_OTG_CORE_REGS;
+typedef union _USB_OTG_OTGCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t sesreqscs :
+    1;
+uint32_t sesreq :
+    1;
+uint32_t Reserved2_7 :
+    6;
+uint32_t hstnegscs :
+    1;
+uint32_t hnpreq :
+    1;
+uint32_t hstsethnpen :
+    1;
+uint32_t devhnpen :
+    1;
+uint32_t Reserved12_15 :
+    4;
+uint32_t conidsts :
+    1;
+uint32_t Reserved17 :
+    1;
+uint32_t asesvld :
+    1;
+uint32_t bsesvld :
+    1;
+uint32_t currmod :
+    1;
+uint32_t Reserved21_31 :
+    11;
+  }
+  b;
+} USB_OTG_OTGCTL_TypeDef ;
+typedef union _USB_OTG_GOTGINT_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t Reserved0_1 :
+    2;
+uint32_t sesenddet :
+    1;
+uint32_t Reserved3_7 :
+    5;
+uint32_t sesreqsucstschng :
+    1;
+uint32_t hstnegsucstschng :
+    1;
+uint32_t reserver10_16 :
+    7;
+uint32_t hstnegdet :
+    1;
+uint32_t adevtoutchng :
+    1;
+uint32_t debdone :
+    1;
+uint32_t Reserved31_20 :
+    12;
+  }
+  b;
+} USB_OTG_GOTGINT_TypeDef ;
+typedef union _USB_OTG_GAHBCFG_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t glblintrmsk :
+    1;
+uint32_t hburstlen :
+    4;
+uint32_t dmaenable :
+    1;
+uint32_t Reserved :
+    1;
+uint32_t nptxfemplvl_txfemplvl :
+    1;
+uint32_t ptxfemplvl :
+    1;
+uint32_t Reserved9_31 :
+    23;
+  }
+  b;
+} USB_OTG_GAHBCFG_TypeDef ;
+typedef union _USB_OTG_GUSBCFG_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t toutcal :
+    3;
+uint32_t phyif :
+    1;
+uint32_t ulpi_utmi_sel :
+    1;
+uint32_t fsintf :
+    1;
+uint32_t physel :
+    1;
+uint32_t ddrsel :
+    1;
+uint32_t srpcap :
+    1;
+uint32_t hnpcap :
+    1;
+uint32_t usbtrdtim :
+    4;
+uint32_t nptxfrwnden :
+    1;
+uint32_t phylpwrclksel :
+    1;
+uint32_t otgutmifssel :
+    1;
+uint32_t ulpi_fsls :
+    1;
+uint32_t ulpi_auto_res :
+    1;
+uint32_t ulpi_clk_sus_m :
+    1;
+uint32_t ulpi_ext_vbus_drv :
+    1;
+uint32_t ulpi_int_vbus_indicator :
+    1;
+uint32_t term_sel_dl_pulse :
+    1;
+uint32_t Reserved :
+    6;
+uint32_t force_host :
+    1;
+uint32_t force_dev :
+    1;
+uint32_t corrupt_tx :
+    1;
+  }
+  b;
+} USB_OTG_GUSBCFG_TypeDef ;
+typedef union _USB_OTG_GRSTCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t csftrst :
+    1;
+uint32_t hsftrst :
+    1;
+uint32_t hstfrm :
+    1;
+uint32_t intknqflsh :
+    1;
+uint32_t rxfflsh :
+    1;
+uint32_t txfflsh :
+    1;
+uint32_t txfnum :
+    5;
+uint32_t Reserved11_29 :
+    19;
+uint32_t dmareq :
+    1;
+uint32_t ahbidle :
+    1;
+  }
+  b;
+} USB_OTG_GRSTCTL_TypeDef ;
+typedef union _USB_OTG_GINTMSK_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t Reserved0 :
+    1;
+uint32_t modemismatch :
+    1;
+uint32_t otgintr :
+    1;
+uint32_t sofintr :
+    1;
+uint32_t rxstsqlvl :
+    1;
+uint32_t nptxfempty :
+    1;
+uint32_t ginnakeff :
+    1;
+uint32_t goutnakeff :
+    1;
+uint32_t Reserved8 :
+    1;
+uint32_t i2cintr :
+    1;
+uint32_t erlysuspend :
+    1;
+uint32_t usbsuspend :
+    1;
+uint32_t usbreset :
+    1;
+uint32_t enumdone :
+    1;
+uint32_t isooutdrop :
+    1;
+uint32_t eopframe :
+    1;
+uint32_t Reserved16 :
+    1;
+uint32_t epmismatch :
+    1;
+uint32_t inepintr :
+    1;
+uint32_t outepintr :
+    1;
+uint32_t incomplisoin :
+    1;
+uint32_t incomplisoout :
+    1;
+uint32_t Reserved22_23 :
+    2;
+uint32_t portintr :
+    1;
+uint32_t hcintr :
+    1;
+uint32_t ptxfempty :
+    1;
+uint32_t Reserved27 :
+    1;
+uint32_t conidstschng :
+    1;
+uint32_t disconnect :
+    1;
+uint32_t sessreqintr :
+    1;
+uint32_t wkupintr :
+    1;
+  }
+  b;
+} USB_OTG_GINTMSK_TypeDef ;
+typedef union _USB_OTG_GINTSTS_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t curmode :
+    1;
+uint32_t modemismatch :
+    1;
+uint32_t otgintr :
+    1;
+uint32_t sofintr :
+    1;
+uint32_t rxstsqlvl :
+    1;
+uint32_t nptxfempty :
+    1;
+uint32_t ginnakeff :
+    1;
+uint32_t goutnakeff :
+    1;
+uint32_t Reserved8 :
+    1;
+uint32_t i2cintr :
+    1;
+uint32_t erlysuspend :
+    1;
+uint32_t usbsuspend :
+    1;
+uint32_t usbreset :
+    1;
+uint32_t enumdone :
+    1;
+uint32_t isooutdrop :
+    1;
+uint32_t eopframe :
+    1;
+uint32_t intimerrx :
+    1;
+uint32_t epmismatch :
+    1;
+uint32_t inepint:
+    1;
+uint32_t outepintr :
+    1;
+uint32_t incomplisoin :
+    1;
+uint32_t incomplisoout :
+    1;
+uint32_t Reserved22_23 :
+    2;
+uint32_t portintr :
+    1;
+uint32_t hcintr :
+    1;
+uint32_t ptxfempty :
+    1;
+uint32_t Reserved27 :
+    1;
+uint32_t conidstschng :
+    1;
+uint32_t disconnect :
+    1;
+uint32_t sessreqintr :
+    1;
+uint32_t wkupintr :
+    1;
+  }
+  b;
+} USB_OTG_GINTSTS_TypeDef ;
+typedef union _USB_OTG_DRXSTS_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t epnum :
+    4;
+uint32_t bcnt :
+    11;
+uint32_t dpid :
+    2;
+uint32_t pktsts :
+    4;
+uint32_t fn :
+    4;
+uint32_t Reserved :
+    7;
+  }
+  b;
+} USB_OTG_DRXSTS_TypeDef ;
+typedef union _USB_OTG_GRXSTS_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t chnum :
+    4;
+uint32_t bcnt :
+    11;
+uint32_t dpid :
+    2;
+uint32_t pktsts :
+    4;
+uint32_t Reserved :
+    11;
+  }
+  b;
+} USB_OTG_GRXFSTS_TypeDef ;
+typedef union _USB_OTG_FSIZ_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t startaddr :
+    16;
+uint32_t depth :
+    16;
+  }
+  b;
+} USB_OTG_FSIZ_TypeDef ;
+typedef union _USB_OTG_HNPTXSTS_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t nptxfspcavail :
+    16;
+uint32_t nptxqspcavail :
+    8;
+uint32_t nptxqtop_terminate :
+    1;
+uint32_t nptxqtop_timer :
+    2;
+uint32_t nptxqtop :
+    2;
+uint32_t chnum :
+    2;    
+uint32_t Reserved :
+    1;
+  }
+  b;
+} USB_OTG_HNPTXSTS_TypeDef ;
+typedef union _USB_OTG_DTXFSTSn_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t txfspcavail :
+    16;
+uint32_t Reserved :
+    16;
+  }
+  b;
+} USB_OTG_DTXFSTSn_TypeDef ;
+typedef union _USB_OTG_GI2CCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t rwdata :
+    8;
+uint32_t regaddr :
+    8;
+uint32_t addr :
+    7;
+uint32_t i2cen :
+    1;
+uint32_t ack :
+    1;
+uint32_t i2csuspctl :
+    1;
+uint32_t i2cdevaddr :
+    2;
+uint32_t dat_se0:
+    1;
+uint32_t Reserved :
+    1;
+uint32_t rw :
+    1;
+uint32_t bsydne :
+    1;
+  }
+  b;
+} USB_OTG_GI2CCTL_TypeDef ;
+typedef union _USB_OTG_GCCFG_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t Reserved_in :
+    16;
+uint32_t pwdn :
+    1;
+uint32_t i2cifen :
+    1;
+uint32_t vbussensingA :
+    1;
+uint32_t vbussensingB :
+    1;
+uint32_t sofouten :
+    1;
+uint32_t disablevbussensing :
+    1;
+uint32_t Reserved_out :
+    10;
+  }
+  b;
+} USB_OTG_GCCFG_TypeDef ;
+
+typedef union _USB_OTG_DCFG_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t devspd :
+    2;
+uint32_t nzstsouthshk :
+    1;
+uint32_t Reserved3 :
+    1;
+uint32_t devaddr :
+    7;
+uint32_t perfrint :
+    2;
+uint32_t Reserved13_17 :
+    5;
+uint32_t epmscnt :
+    4;
+  }
+  b;
+} USB_OTG_DCFG_TypeDef ;
+typedef union _USB_OTG_DCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t rmtwkupsig :
+    1;
+uint32_t sftdiscon :
+    1;
+uint32_t gnpinnaksts :
+    1;
+uint32_t goutnaksts :
+    1;
+uint32_t tstctl :
+    3;
+uint32_t sgnpinnak :
+    1;
+uint32_t cgnpinnak :
+    1;
+uint32_t sgoutnak :
+    1;
+uint32_t cgoutnak :
+    1;
+uint32_t Reserved :
+    21;
+  }
+  b;
+} USB_OTG_DCTL_TypeDef ;
+typedef union _USB_OTG_DSTS_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t suspsts :
+    1;
+uint32_t enumspd :
+    2;
+uint32_t errticerr :
+    1;
+uint32_t Reserved4_7:
+    4;
+uint32_t soffn :
+    14;
+uint32_t Reserved22_31 :
+    10;
+  }
+  b;
+} USB_OTG_DSTS_TypeDef ;
+typedef union _USB_OTG_DIEPINTn_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfercompl :
+    1;
+uint32_t epdisabled :
+    1;
+uint32_t ahberr :
+    1;
+uint32_t timeout :
+    1;
+uint32_t intktxfemp :
+    1;
+uint32_t intknepmis :
+    1;
+uint32_t inepnakeff :
+    1;
+uint32_t emptyintr :
+    1;
+uint32_t txfifoundrn :
+    1;
+uint32_t Reserved08_31 :
+    23;
+  }
+  b;
+} USB_OTG_DIEPINTn_TypeDef ;
+typedef union _USB_OTG_DIEPINTn_TypeDef   USB_OTG_DIEPMSK_TypeDef ;
+typedef union _USB_OTG_DOEPINTn_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfercompl :
+    1;
+uint32_t epdisabled :
+    1;
+uint32_t ahberr :
+    1;
+uint32_t setup :
+    1;
+uint32_t Reserved04_31 :
+    28;
+  }
+  b;
+} USB_OTG_DOEPINTn_TypeDef ;
+typedef union _USB_OTG_DOEPINTn_TypeDef   USB_OTG_DOEPMSK_TypeDef ;
+
+typedef union _USB_OTG_DAINT_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t in :
+    16;
+uint32_t out :
+    16;
+  }
+  ep;
+} USB_OTG_DAINT_TypeDef ;
+
+typedef union _USB_OTG_DTHRCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t non_iso_thr_en :
+    1;
+uint32_t iso_thr_en :
+    1;
+uint32_t tx_thr_len :
+    9;
+uint32_t Reserved11_15 :
+    5;
+uint32_t rx_thr_en :
+    1;
+uint32_t rx_thr_len :
+    9;
+uint32_t Reserved26_31 :
+    6;
+  }
+  b;
+} USB_OTG_DTHRCTL_TypeDef ;
+typedef union _USB_OTG_DEPCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t mps :
+    11;
+uint32_t reserved :
+    4;
+uint32_t usbactep :
+    1;
+uint32_t dpid :
+    1;
+uint32_t naksts :
+    1;
+uint32_t eptype :
+    2;
+uint32_t snp :
+    1;
+uint32_t stall :
+    1;
+uint32_t txfnum :
+    4;
+uint32_t cnak :
+    1;
+uint32_t snak :
+    1;
+uint32_t setd0pid :
+    1;
+uint32_t setd1pid :
+    1;
+uint32_t epdis :
+    1;
+uint32_t epena :
+    1;
+  }
+  b;
+} USB_OTG_DEPCTL_TypeDef ;
+typedef union _USB_OTG_DEPXFRSIZ_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfersize :
+    19;
+uint32_t pktcnt :
+    10;
+uint32_t mc :
+    2;
+uint32_t Reserved :
+    1;
+  }
+  b;
+} USB_OTG_DEPXFRSIZ_TypeDef ;
+typedef union _USB_OTG_DEP0XFRSIZ_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfersize :
+    7;
+uint32_t Reserved7_18 :
+    12;
+uint32_t pktcnt :
+    2;
+uint32_t Reserved20_28 :
+    9;
+uint32_t supcnt :
+    2;
+    uint32_t Reserved31;
+  }
+  b;
+} USB_OTG_DEP0XFRSIZ_TypeDef ;
+typedef union _USB_OTG_HCFG_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t fslspclksel :
+    2;
+uint32_t fslssupp :
+    1;
+  }
+  b;
+} USB_OTG_HCFG_TypeDef ;
+typedef union _USB_OTG_HFRMINTRVL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t frint :
+    16;
+uint32_t Reserved :
+    16;
+  }
+  b;
+} USB_OTG_HFRMINTRVL_TypeDef ;
+
+typedef union _USB_OTG_HFNUM_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t frnum :
+    16;
+uint32_t frrem :
+    16;
+  }
+  b;
+} USB_OTG_HFNUM_TypeDef ;
+typedef union _USB_OTG_HPTXSTS_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t ptxfspcavail :
+    16;
+uint32_t ptxqspcavail :
+    8;
+uint32_t ptxqtop_terminate :
+    1;
+uint32_t ptxqtop_timer :
+    2;
+uint32_t ptxqtop :
+    2;
+uint32_t chnum :
+    2;
+uint32_t ptxqtop_odd :
+    1;
+  }
+  b;
+} USB_OTG_HPTXSTS_TypeDef ;
+typedef union _USB_OTG_HPRT0_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t prtconnsts :
+    1;
+uint32_t prtconndet :
+    1;
+uint32_t prtena :
+    1;
+uint32_t prtenchng :
+    1;
+uint32_t prtovrcurract :
+    1;
+uint32_t prtovrcurrchng :
+    1;
+uint32_t prtres :
+    1;
+uint32_t prtsusp :
+    1;
+uint32_t prtrst :
+    1;
+uint32_t Reserved9 :
+    1;
+uint32_t prtlnsts :
+    2;
+uint32_t prtpwr :
+    1;
+uint32_t prttstctl :
+    4;
+uint32_t prtspd :
+    2;
+uint32_t Reserved19_31 :
+    13;
+  }
+  b;
+} USB_OTG_HPRT0_TypeDef ;
+typedef union _USB_OTG_HAINT_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t chint :
+    16;
+uint32_t Reserved :
+    16;
+  }
+  b;
+} USB_OTG_HAINT_TypeDef ;
+typedef union _USB_OTG_HAINTMSK_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t chint :
+    16;
+uint32_t Reserved :
+    16;
+  }
+  b;
+} USB_OTG_HAINTMSK_TypeDef ;
+typedef union _USB_OTG_HCCHAR_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t mps :
+    11;
+uint32_t epnum :
+    4;
+uint32_t epdir :
+    1;
+uint32_t Reserved :
+    1;
+uint32_t lspddev :
+    1;
+uint32_t eptype :
+    2;
+uint32_t multicnt :
+    2;
+uint32_t devaddr :
+    7;
+uint32_t oddfrm :
+    1;
+uint32_t chdis :
+    1;
+uint32_t chen :
+    1;
+  }
+  b;
+} USB_OTG_HCCHAR_TypeDef ;
+typedef union _USB_OTG_HCSPLT_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t prtaddr :
+    7;
+uint32_t hubaddr :
+    7;
+uint32_t xactpos :
+    2;
+uint32_t compsplt :
+    1;
+uint32_t Reserved :
+    14;
+uint32_t spltena :
+    1;
+  }
+  b;
+} USB_OTG_HCSPLT_TypeDef ;
+typedef union _USB_OTG_HCINTn_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfercompl :
+    1;
+uint32_t chhltd :
+    1;
+uint32_t ahberr :
+    1;
+uint32_t stall :
+    1;
+uint32_t nak :
+    1;
+uint32_t ack :
+    1;
+uint32_t nyet :
+    1;
+uint32_t xacterr :
+    1;
+uint32_t bblerr :
+    1;
+uint32_t frmovrun :
+    1;
+uint32_t datatglerr :
+    1;
+uint32_t Reserved :
+    21;
+  }
+  b;
+} USB_OTG_HCINTn_TypeDef ;
+typedef union _USB_OTG_HCTSIZn_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfersize :
+    19;
+uint32_t pktcnt :
+    10;
+uint32_t pid :
+    2;
+uint32_t dopng :
+    1;
+  }
+  b;
+} USB_OTG_HCTSIZn_TypeDef ;
+typedef union _USB_OTG_HCGINTMSK_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t xfercompl :
+    1;
+uint32_t chhltd :
+    1;
+uint32_t ahberr :
+    1;
+uint32_t stall :
+    1;
+uint32_t nak :
+    1;
+uint32_t ack :
+    1;
+uint32_t nyet :
+    1;
+uint32_t xacterr :
+    1;
+uint32_t bblerr :
+    1;
+uint32_t frmovrun :
+    1;
+uint32_t datatglerr :
+    1;
+uint32_t Reserved :
+    21;
+  }
+  b;
+} USB_OTG_HCGINTMSK_TypeDef ;
+typedef union _USB_OTG_PCGCCTL_TypeDef 
+{
+  uint32_t d32;
+  struct
+  {
+uint32_t stoppclk :
+    1;
+uint32_t gatehclk :
+    1;
+uint32_t Reserved :
+    30;
+  }
+  b;
+} USB_OTG_PCGCCTL_TypeDef ;
+
+/**
+  * @}
+  */ 
+
+
+/** @defgroup USB_REGS_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_REGS_Exported_Variables
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup USB_REGS_Exported_FunctionsPrototype
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+
+#endif //__USB_OTG_REGS_H__
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
+
diff --git a/codec2/tags/0.4/wav/all.wav b/codec2/tags/0.4/wav/all.wav
new file mode 100644 (file)
index 0000000..ba37838
Binary files /dev/null and b/codec2/tags/0.4/wav/all.wav differ
diff --git a/codec2/tags/0.4/wav/cross.wav b/codec2/tags/0.4/wav/cross.wav
new file mode 100644 (file)
index 0000000..f9f2d04
Binary files /dev/null and b/codec2/tags/0.4/wav/cross.wav differ
diff --git a/codec2/tags/0.4/wav/cross_melp2400.wav b/codec2/tags/0.4/wav/cross_melp2400.wav
new file mode 100644 (file)
index 0000000..0b314b8
Binary files /dev/null and b/codec2/tags/0.4/wav/cross_melp2400.wav differ
diff --git a/codec2/tags/0.4/wav/f2400.wav b/codec2/tags/0.4/wav/f2400.wav
new file mode 100644 (file)
index 0000000..35c41d9
Binary files /dev/null and b/codec2/tags/0.4/wav/f2400.wav differ
diff --git a/codec2/tags/0.4/wav/forig.wav b/codec2/tags/0.4/wav/forig.wav
new file mode 100644 (file)
index 0000000..81f3f9f
Binary files /dev/null and b/codec2/tags/0.4/wav/forig.wav differ
diff --git a/codec2/tags/0.4/wav/forig_ambe2000.wav b/codec2/tags/0.4/wav/forig_ambe2000.wav
new file mode 100644 (file)
index 0000000..35b27cf
Binary files /dev/null and b/codec2/tags/0.4/wav/forig_ambe2000.wav differ
diff --git a/codec2/tags/0.4/wav/forig_speex_8k.wav b/codec2/tags/0.4/wav/forig_speex_8k.wav
new file mode 100644 (file)
index 0000000..ac816f9
Binary files /dev/null and b/codec2/tags/0.4/wav/forig_speex_8k.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a.wav b/codec2/tags/0.4/wav/hts1a.wav
new file mode 100644 (file)
index 0000000..f605089
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a_ambe2000.wav b/codec2/tags/0.4/wav/hts1a_ambe2000.wav
new file mode 100644 (file)
index 0000000..f1f107b
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a_ambe2000.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a_c2_v0.1.wav b/codec2/tags/0.4/wav/hts1a_c2_v0.1.wav
new file mode 100644 (file)
index 0000000..f41c70c
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a_c2_v0.1.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a_c2_v0.1a.wav b/codec2/tags/0.4/wav/hts1a_c2_v0.1a.wav
new file mode 100644 (file)
index 0000000..60bc3f0
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a_c2_v0.1a.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a_g729a.wav b/codec2/tags/0.4/wav/hts1a_g729a.wav
new file mode 100644 (file)
index 0000000..f475775
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a_g729a.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a_lpc10.wav b/codec2/tags/0.4/wav/hts1a_lpc10.wav
new file mode 100644 (file)
index 0000000..0a73f92
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a_lpc10.wav differ
diff --git a/codec2/tags/0.4/wav/hts1a_speex_8k.wav b/codec2/tags/0.4/wav/hts1a_speex_8k.wav
new file mode 100644 (file)
index 0000000..c192ee0
Binary files /dev/null and b/codec2/tags/0.4/wav/hts1a_speex_8k.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a.wav b/codec2/tags/0.4/wav/hts2a.wav
new file mode 100644 (file)
index 0000000..644b536
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a_ambe2000.wav b/codec2/tags/0.4/wav/hts2a_ambe2000.wav
new file mode 100644 (file)
index 0000000..432959b
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a_ambe2000.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a_c2_v0.1.wav b/codec2/tags/0.4/wav/hts2a_c2_v0.1.wav
new file mode 100644 (file)
index 0000000..7f0e0f1
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a_c2_v0.1.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a_c2_v0.1a.wav b/codec2/tags/0.4/wav/hts2a_c2_v0.1a.wav
new file mode 100644 (file)
index 0000000..3e60bca
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a_c2_v0.1a.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a_g729a.wav b/codec2/tags/0.4/wav/hts2a_g729a.wav
new file mode 100644 (file)
index 0000000..7709a1c
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a_g729a.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a_lpc10.wav b/codec2/tags/0.4/wav/hts2a_lpc10.wav
new file mode 100644 (file)
index 0000000..a1cfde5
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a_lpc10.wav differ
diff --git a/codec2/tags/0.4/wav/hts2a_speex_8k.wav b/codec2/tags/0.4/wav/hts2a_speex_8k.wav
new file mode 100644 (file)
index 0000000..98293b6
Binary files /dev/null and b/codec2/tags/0.4/wav/hts2a_speex_8k.wav differ
diff --git a/codec2/tags/0.4/wav/m2400.wav b/codec2/tags/0.4/wav/m2400.wav
new file mode 100644 (file)
index 0000000..a1fe1a5
Binary files /dev/null and b/codec2/tags/0.4/wav/m2400.wav differ
diff --git a/codec2/tags/0.4/wav/mmt1.wav b/codec2/tags/0.4/wav/mmt1.wav
new file mode 100644 (file)
index 0000000..b0526cb
Binary files /dev/null and b/codec2/tags/0.4/wav/mmt1.wav differ
diff --git a/codec2/tags/0.4/wav/mmt1_ambe2000.wav b/codec2/tags/0.4/wav/mmt1_ambe2000.wav
new file mode 100644 (file)
index 0000000..db11834
Binary files /dev/null and b/codec2/tags/0.4/wav/mmt1_ambe2000.wav differ
diff --git a/codec2/tags/0.4/wav/mmt1_c2_v01a.wav b/codec2/tags/0.4/wav/mmt1_c2_v01a.wav
new file mode 100644 (file)
index 0000000..6f80052
Binary files /dev/null and b/codec2/tags/0.4/wav/mmt1_c2_v01a.wav differ
diff --git a/codec2/tags/0.4/wav/mmt1_lpc10.wav b/codec2/tags/0.4/wav/mmt1_lpc10.wav
new file mode 100644 (file)
index 0000000..848ef23
Binary files /dev/null and b/codec2/tags/0.4/wav/mmt1_lpc10.wav differ
diff --git a/codec2/tags/0.4/wav/mmt1_speex_8k.wav b/codec2/tags/0.4/wav/mmt1_speex_8k.wav
new file mode 100644 (file)
index 0000000..f0191a2
Binary files /dev/null and b/codec2/tags/0.4/wav/mmt1_speex_8k.wav differ
diff --git a/codec2/tags/0.4/wav/morig.wav b/codec2/tags/0.4/wav/morig.wav
new file mode 100644 (file)
index 0000000..eaf52d1
Binary files /dev/null and b/codec2/tags/0.4/wav/morig.wav differ
diff --git a/codec2/tags/0.4/wav/morig_ambe2000.wav b/codec2/tags/0.4/wav/morig_ambe2000.wav
new file mode 100644 (file)
index 0000000..977611b
Binary files /dev/null and b/codec2/tags/0.4/wav/morig_ambe2000.wav differ
diff --git a/codec2/tags/0.4/wav/morig_speex_8k.wav b/codec2/tags/0.4/wav/morig_speex_8k.wav
new file mode 100644 (file)
index 0000000..d62d19b
Binary files /dev/null and b/codec2/tags/0.4/wav/morig_speex_8k.wav differ
diff --git a/codec2/tags/0.4/wav/ve9qrp.wav b/codec2/tags/0.4/wav/ve9qrp.wav
new file mode 100644 (file)
index 0000000..38454a5
Binary files /dev/null and b/codec2/tags/0.4/wav/ve9qrp.wav differ
diff --git a/codec2/tags/0.4/wav/vk5qi.wav b/codec2/tags/0.4/wav/vk5qi.wav
new file mode 100644 (file)
index 0000000..b1aaed9
Binary files /dev/null and b/codec2/tags/0.4/wav/vk5qi.wav differ
diff --git a/codec2/tags/0.4/wav/x200_ext.wav b/codec2/tags/0.4/wav/x200_ext.wav
new file mode 100644 (file)
index 0000000..38c5c4b
Binary files /dev/null and b/codec2/tags/0.4/wav/x200_ext.wav differ
diff --git a/codec2/tags/0.4/wav/x200_int.wav b/codec2/tags/0.4/wav/x200_int.wav
new file mode 100644 (file)
index 0000000..4828c2f
Binary files /dev/null and b/codec2/tags/0.4/wav/x200_int.wav differ
diff --git a/fdmdv2/tags/.gitignore b/fdmdv2/tags/.gitignore
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/fdmdv2/tags/0.99-Beta/.clang/.gitignore b/fdmdv2/tags/0.99-Beta/.clang/.gitignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/fdmdv2/tags/0.99-Beta/CMakeLists.txt b/fdmdv2/tags/0.99-Beta/CMakeLists.txt
new file mode 100644 (file)
index 0000000..40e95e3
--- /dev/null
@@ -0,0 +1,487 @@
+#
+# FreeDV - HF Digital Voice for Radio Amateurs
+#
+# CMake configuration contributed by Richard Shaw (KF5OIM)
+# Please report questions, comments, problems, or patches to the freetel
+# mailing list: https://lists.sourceforge.net/lists/listinfo/freetel-codec2
+#
+
+cmake_minimum_required(VERSION 2.8)
+
+# Prevent in-source builds to protect automake/autoconf config.
+# If an in-source build is attempted, you will still need to clean up a few
+# files manually.
+set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+  message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not "   
+   "allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a "
+   "separate build directory and run cmake from there.")
+endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+
+# Set local module path.
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
+
+project(FreeDV)
+
+#
+# Set FreeDV version and generate src/version.h
+#
+set(FREEDV_VERSION_MAJOR 0)
+set(FREEDV_VERSION_MINOR 99)
+set(FREEDV_VERSION_PATCH FALSE)
+set(FREEDV_VERSION ${FREEDV_VERSION_MAJOR}.${FREEDV_VERSION_MINOR})
+if(FREEDV_VERSION_PATCH)
+    set(FREEDV_VERSION ${FREEDV_VERSION}.${FREEDV_VERSION_PATCH})
+endif()
+set(FREEDV_VERSION_SUFFIX "Beta")
+if(FREEDV_VERSION_SUFFIX)
+    set(FREEDV_VERSION_STRING "${FREEDV_VERSION} ${FREEDV_VERSION_SUFFIX}")
+endif()
+message(STATUS "FreeDV version: ${FREEDV_VERSION_STRING}")
+configure_file(cmake/version.h.in src/version.h @ONLY)
+
+# Set default build type
+if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "Release")
+    message(STATUS "Build type not specified, defaulting to ${CMAKE_BUILD_TYPE}")
+endif(NOT CMAKE_BUILD_TYPE)
+
+
+# Work around for not using a svn working copy.
+add_definitions(-D_NO_AUTOTOOLS_)
+find_program(SVNVERSION_PATH svnversion)
+if(SVNVERSION_PATH)
+    execute_process(COMMAND ${SVNVERSION_PATH} .
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        RESULT_VARIABLE SVN_REVISION_RESULT
+        OUTPUT_VARIABLE SVN_CURRENT_REVISION
+        ERROR_QUIET
+    )
+else()
+    set(SVN_REVISION_RESULT 1)
+endif()
+if(SVN_REVISION_RESULT EQUAL 0)
+string(STRIP ${SVN_CURRENT_REVISION} SVN_REVISION)
+add_definitions(-DSVN_REVISION="${SVN_REVISION}")
+else()
+add_definitions(-DSVN_REVISION="Unversioned directory")
+endif()
+
+
+# Set default build flags.
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+
+#
+# Setup cmake options
+#
+set(CMAKE_VERBOSE_MAKEFILE TRUE CACHE BOOL "Verbose makefile.")
+set(USE_STATIC_DEPS FALSE CACHE BOOL 
+    "Download and build static libraries instead of system libraries.")
+set(USE_STATIC_PORTAUDIO FALSE CACHE BOOL 
+    "Download and build static portaudio instead of the system library.")
+set(USE_STATIC_SNDFILE FALSE CACHE BOOL
+    "Download and build static sndfile instead of the system library.")
+set(USE_STATIC_SAMPLERATE FALSE CACHE BOOL
+    "Download and build static samplerate instead of the system library.")
+set(USE_STATIC_SOX FALSE CACHE BOOL
+    "Download and build static sox instead of the system library.")
+set(USE_STATIC_CODEC2 FALSE CACHE BOOL
+    "Download and build static codec2 instead of the system library.")
+set(USE_STATIC_SPEEXDSP FALSE CACHE BOOL
+    "Download and build static speex instead of the system library.")
+set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL
+    "Download and build static wxWidgets instead of the system library.")
+
+if(USE_STATIC_DEPS)
+    set(USE_STATIC_PORTAUDIO TRUE FORCE)
+    set(USE_STATIC_SNDFILE TRUE FORCE)
+    set(USE_STATIC_SAMPLERATE TRUE FORCE)
+    set(USE_STATIC_SOX TRUE FORCE)
+    set(USE_STATIC_CODEC2 TRUE FORCE)
+endif(USE_STATIC_DEPS)
+
+#
+# Pull in external wxWidgets target if performing static build.
+#
+if(BOOTSTRAP_WXWIDGETS)
+    message(STATUS "Adding wxWidgets build target...")
+    include(cmake/BuildWxWidgets.cmake)
+endif(BOOTSTRAP_WXWIDGETS)
+
+#
+# Perform bootstrap build of wxWidgets
+#
+if(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG})
+    message(STATUS "Will perform bootstrap build of wxWidgets.
+   After make step completes, re-run cmake and make again to perform FreeDV build.")
+#
+# Continue normal build if not bootstrapping wxWidgets or is already built.
+#
+else(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG})
+
+
+#
+# Various hacks and work arounds for building under MinGW.
+#
+if(MINGW)
+    message(STATUS "System is MinGW.")
+    # Setup HOST variable.
+    include(cmake/MinGW.cmake)
+    # This sets up the exe icon for windows under mingw.
+    set(RES_FILES "")
+    set(RES_FILES "${CMAKE_SOURCE_DIR}/contrib/freedv.rc")
+    set(CMAKE_RC_COMPILER_INIT windres)
+    enable_language(RC)
+    set(CMAKE_RC_COMPILE_OBJECT
+        "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
+    # These are DLOPEN'ed and can't be automatically pulled in by dependency.
+    foreach(RUNTIME
+        hamlib-adat.dll
+        hamlib-alinco.dll
+        hamlib-amsat.dll
+        hamlib-aor.dll
+        hamlib-ars.dll
+        hamlib-celestron.dll
+        hamlib-drake.dll
+        hamlib-dummy.dll
+        hamlib-easycomm.dll
+        hamlib-flexradio.dll
+        hamlib-fodtrack.dll
+        hamlib-gs232a.dll
+        hamlib-heathkit.dll
+        hamlib-icom.dll
+        hamlib-jrc.dll
+        hamlib-kachina.dll
+        hamlib-kenwood.dll
+        hamlib-kit.dll
+        hamlib-lowe.dll
+        hamlib-m2.dll
+        hamlib-pcr.dll
+        hamlib-prm80.dll
+        hamlib-racal.dll
+        hamlib-rft.dll
+        hamlib-rotorez.dll
+        hamlib-rs.dll
+        hamlib-sartek.dll
+        hamlib-skanti.dll
+        hamlib-spid.dll
+        hamlib-tapr.dll
+        hamlib-tentec.dll
+        hamlib-ts7400.dll
+        hamlib-tuner.dll
+        hamlib-uniden.dll
+        hamlib-winradio.dll
+        hamlib-wj.dll
+        hamlib-yaesu.dll)
+        message(STATUS "Checking for ${RUNTIME}")
+        find_library(${RUNTIME}_LIB ${RUNTIME}
+            PATH_SUFFIXES hamlib)
+        message(STATUS "runtime found: ${${RUNTIME}_LIB}")
+        list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${${RUNTIME}_LIB})
+    endforeach()
+    include(InstallRequiredSystemLibraries)
+endif(MINGW)
+
+# Math library is automatic on MinGW
+if(UNIX)
+    set(CMAKE_REQUIRED_INCLUDES math.h)
+    set(CMAKE_REQUIRED_LIBRARIES m)
+endif(UNIX)
+
+# Find some standard headers and functions.
+include(CheckIncludeFiles)
+check_include_files("limits.h" HAVE_LIMITS_H)
+check_include_files("stddef.h" HAVE_STDDEF_H)
+check_include_files("stdlib.h" HAVE_STDLIB_H)
+check_include_files("string.h" HAVE_STRING_H)
+
+include(CheckTypeSize)
+check_type_size("int" SIZEOF_INT)
+
+include(CheckFunctionExists)
+check_function_exists(floor HAVE_FLOOR)
+check_function_exists(memset HAVE_MEMSET)
+check_function_exists(pow HAVE_POW)
+check_function_exists(sqrt HAVE_SQRT)
+
+# fdmdv2_main.h requires patching to find config.h as it current looks in the
+# source directory and the generated file goes in the binary directory.
+configure_file ("${PROJECT_SOURCE_DIR}/cmake/config.h.in"
+                "${PROJECT_BINARY_DIR}/config.h" )
+include_directories(${PROJECT_BINARY_DIR})
+add_definitions(-DHAVE_CONFIG_H)
+
+# Pthread Library
+find_package(Threads REQUIRED)
+message(STATUS "Threads library flags: ${CMAKE_THREAD_LIBS_INIT}")
+
+#
+# Find codec2
+#
+if(NOT USE_STATIC_CODEC2)
+    message(STATUS "Looking for codec2...")
+    find_package(codec2 CONFIG QUIET)
+    if(codec2_FOUND)
+        get_target_property(CODEC2_LIBRARY codec2 LOCATION)
+        message(STATUS "  codec2 library: ${CODEC2_LIBRARY}")
+        message(STATUS "  codec2 headers: ${codec2_INCLUDE_DIRS}")
+    else()
+        # Try to find manually
+        find_path(CODEC2_INCLUDE_DIRS codec2.h
+                  PATH_SUFFIXES codec2)
+        find_library(CODEC2_LIBRARY NAMES codec2)
+        if(CODEC2_LIBRARY AND CODEC2_INCLUDE_DIRS)
+            message(STATUS "  codec2 library: ${CODEC2_LIBRARY}")
+            message(STATUS "  codec2 headers: ${CODEC2_INCLUDE_DIRS}")
+            list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY})
+            include_directories(${CODEC2_INCLUDE_DIRS})
+        else()
+            message(FATAL_ERROR "codec2 library not found.
+Linux: 
+Codec2 may not be in your distribution so build yourself or use the cmake option to build statically into FreeDV.
+Windws:
+It's easiest to use the cmake option: USE_STATIC_CODEC2"
+        )
+        endif()
+    endif()
+else(NOT USE_STATIC_CODEC2)
+    message(STATUS "Will attempt static build of codec2.")
+    include(cmake/BuildCodec2.cmake)
+endif(NOT USE_STATIC_CODEC2)
+
+#
+# Find or build portaudio Library
+#
+if(NOT USE_STATIC_PORTAUDIO)
+    message(STATUS "Looking for portaudio...")
+    find_package(Portaudio REQUIRED)
+    if(PORTAUDIO_FOUND)
+        message(STATUS "  portaudio library: ${PORTAUDIO_LIBRARIES}")
+        message(STATUS "  portaudio headers: ${PORTAUDIO_INCLUDE_DIRS}")
+        list(APPEND FREEDV_LINK_LIBS ${PORTAUDIO_LIBRARIES})
+        include_directories(${PORTAUDIO_INCLUDE_DIRS})
+    else()
+        message(FATAL_ERROR "portaudio library not found.
+On Linux systems try installing:
+    portaudio-devel  (RPM based systems)
+    libportaudio-dev (DEB based systems)
+On Windows it's easiest to use the cmake option: USE_STATIC_PORTAUDIO"
+        )
+    endif()
+    if(NOT ${PORTAUDIO_VERSION} EQUAL 19)
+        message(WARNING "Portaudio versions other than 19 are known to have issues. You have been warned!")
+    endif()
+else(NOT USE_STATIC_PORTAUDIO)
+    message(STATUS "Will attempt static build of portaudio.")
+    include(cmake/BuildPortaudio.cmake)
+endif(NOT USE_STATIC_PORTAUDIO)
+
+#
+# Hamlib library
+#
+message(STATUS "Looking for hamlib...")
+find_path(HAMLIB_INCLUDE_DIR hamlib/rig.h)
+find_library(HAMLIB_LIBRARY hamlib)
+message(STATUS "Hamlib library: ${HAMLIB_LIBRARY}")
+message(STATUS "Hamlib headers: ${HAMLIB_INCLUDE_DIR}")
+if(HAMLIB_LIBRARY AND HAMLIB_INCLUDE_DIR)
+    message(STATUS "Hamlib library found.")
+    include_directories(${HAMLIB_INCLUDE_DIR})
+    list(APPEND FREEDV_LINK_LIBS ${HAMLIB_LIBRARY})
+else(HAMLIB_LIBRARY AND HAMLIB_INCLUDE_DIR)
+    message(FATAL_ERROR "hamlib not found.
+On Linux systems try installing:
+    hamlib-devel  (RPM based systems)
+    libhamlib-dev (DEB based systems)"
+    )
+endif(HAMLIB_LIBRARY AND HAMLIB_INCLUDE_DIR)
+
+
+#
+# Samplerate Library
+#
+if(NOT USE_STATIC_SAMPLERATE)
+    message(STATUS "Looking for samplerate...")
+    find_library(LIBSAMPLERATE samplerate)
+    find_path(LIBSAMPLERATE_INCLUDE_DIR samplerate.h)
+    message(STATUS "  samplerate library: ${LIBSAMPLERATE}")
+    message(STATUS "  samplerate headers: ${LIBSAMPLERATE_INCLUDE_DIR}")
+    if(LIBSAMPLERATE AND LIBSAMPLERATE_INCLUDE_DIR)
+        list(APPEND FREEDV_LINK_LIBS ${LIBSAMPLERATE})
+        include_directories(${LIBSAMPLERATE_INCLUDE_DIR})
+    else(LIBSTAMPLERATE AND LIBSAMPLERATE_INCLUDE_DIR)
+        message(FATAL_ERROR "samplerate library not found.
+On Linux systems try installing:
+    samplerate-devel  (RPM based systems)
+    libsamplerate-dev (DEB based systems)
+On Windows it's easiest to use the cmake option: USE_STATIC_SAMPLERATE"
+        )
+    endif(LIBSAMPLERATE AND LIBSAMPLERATE_INCLUDE_DIR)
+else(NOT USE_STATIC_SAMPLERATE)
+    message(STATUS "Will attempt static build of samplerate.")
+    include(cmake/BuildSamplerate.cmake)
+endif(NOT USE_STATIC_SAMPLERATE)
+
+#
+# Find sox library
+#
+if(NOT USE_STATIC_SOX)
+    message(STATUS "Looking for sox...")
+    find_library(LIBSOX_LIBRARY sox)
+    find_path(LIBSOX_INCLUDE_DIR NAMES sox/sox.h sox.h)
+    message(STATUS "  sox library: ${LIBSOX_LIBRARY}")
+    message(STATUS "  sox headers: ${LIBSOX_INCLUDE_DIR}")
+    if(LIBSOX_LIBRARY AND LIBSOX_INCLUDE_DIR)
+        list(APPEND FREEDV_LINK_LIBS ${LIBSOX_LIBRARY})
+        include_directories(${LIBSOX_INCLUDE_DIR})
+    else(LIBSOX_LIBRARY AND LIBSOX_INCLUDE_DIR)
+        message(FATAL_ERROR "sox library not found.
+On Linux systems try installing:
+    sox-devel (RPM based systems)
+    libsox-dev (DEB based systems)
+On Windows it's easiest to use the cmake option: USE_STATIC_SOX"
+        )
+    endif(LIBSOX_LIBRARY AND LIBSOX_INCLUDE_DIR)
+else(NOT USE_STATIC_SOX)
+    message(STATUS "Will attempt static build of sox.")
+    include(cmake/BuildSox.cmake)
+endif(NOT USE_STATIC_SOX)
+
+#    
+# sndfile Library
+#
+if(NOT USE_STATIC_SNDFILE)
+    message(STATUS "Looking for sndfile...")
+    find_library(LIBSNDFILE sndfile)
+    find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h)
+    message(STATUS "  sndfile library: ${LIBSNDFILE}")
+    message(STATUS "  sndfile headers: ${LIBSNDFILE_INCLUDE_DIR}")
+    if(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR)
+        list(APPEND FREEDV_LINK_LIBS ${LIBSNDFILE})
+    else(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR)
+        message(FATAL_ERROR "sndfile library not found.
+On Linux systems try installing:
+    libsndfile-devel (RPM based systems)
+    libsndfile-dev   (DEB based systems)
+On Windows it's easiest to use the cmake option: USE_STATIC_SNDFILE"
+        )
+    endif(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR)
+else(NOT USE_STATIC_SNDFILE)
+    message(STATUS "Will attempt static build of sndfile.")
+    include(cmake/BuildSndfile.cmake)
+endif(NOT USE_STATIC_SNDFILE)
+
+#
+# Find wxWidgets
+#
+if(NOT BOOTSTRAP_WXWIDGETS)
+    set(WXCONFIG "" CACHE FILEPATH "Location of wx-config binary.")
+    set(WXRC "" CACHE FILEPATH "Location of wxrc binary.")
+endif(NOT BOOTSTRAP_WXWIDGETS)
+#if(BOOTSTRAP_WXWIDGETS)
+#    set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config")
+#    set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc")
+#    list(APPEND FREEDV_STATIC_DEPS wxWidgets)
+#endif(BOOTSTRAP_WXWIDGETS)
+message(STATUS "Looking for wxWidgets...")
+if(WXCONFIG)
+    message(STATUS "wx-config: ${WXCONFIG}")
+    set(wxWidgets_CONFIG_EXECUTABLE ${WXCONFIG})
+endif(WXCONFIG)
+if(WXRC)
+    message(STATUS "wxrc: ${WXRC}")
+    set(wxWidgets_wxrc_EXECUTABLE ${WXRC})
+endif(WXRC)
+set(WX_VERSION_MIN 3.0.0)
+find_package(wxWidgets REQUIRED core base aui html net adv)
+execute_process(COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --version
+    OUTPUT_VARIABLE WX_VERSION)
+string(STRIP ${WX_VERSION} WX_VERSION)
+if(WX_VERSION VERSION_EQUAL ${WX_VERSION_MIN}
+    OR WX_VERSION VERSION_GREATER ${WX_VERSION_MIN})
+   message(STATUS "wxWidgets version: ${WX_VERSION}")
+else()
+    message(FATAL_ERROR "wxWidgets must be installed on your system.
+Please check that wx-config is in path, the directory
+where wxWidgets libraries are installed (returned by
+'wx-config --libs' or 'wx-config --static --libs' command)
+is in LD_LIBRARY_PATH or equivalent variable and
+wxWidgets version is ${WX_VERSION_MIN} or above.")
+endif()
+if(wxWidgets_FOUND)
+    include("${wxWidgets_USE_FILE}")
+    list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES})
+endif(wxWidgets_FOUND)
+
+#
+# Find speex library
+#
+if(NOT USE_STATIC_SPEEXDSP)
+    message(STATUS "Looking for Speex DSP library.")
+    find_path(SPEEXDSP_INCLUDE_DIR speex/speex.h)
+    find_library(SPEEXDSP_LIBRARY speexdsp)
+    message(STATUS "  Speex DSP headers: ${SPEEXDSP_INCLUDE_DIR}")
+    message(STATUS "  Speex DSP library: ${SPEEXDSP_LIBRARY}")
+    if(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY)
+        include_directories(${SPEEXDSP_INCLUDE_DIR})
+        list(APPEND FREEDV_LINK_LIBS ${SPEEXDSP_LIBRARY})
+    else(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY)
+        message(FATAL_ERROR "Speex DSP library not found!")
+    endif(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY)
+else()
+    message(STATUS "Will attempt static build of speex.")
+    include(cmake/BuildSpeex.cmake)
+endif()
+    
+#Freedv 
+add_subdirectory(src)
+
+# Icons and desktop file
+add_subdirectory(contrib)
+
+message(STATUS "Build type will be: ${CMAKE_BUILD_TYPE}")
+
+#
+# Cpack NSIS configuration for Windows.
+#
+if(WIN32)
+    # Detect if we're doing a 32-bit or 64-bit windows build.
+    if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+        set(CMAKE_CL_64 TRUE)
+    endif()
+    if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
+        set(CPACK_STRIP_FILES TRUE)
+    endif()
+    configure_file(cmake/GetDependencies.cmake.in cmake/GetDependencies.cmake
+        @ONLY
+    )
+    install(SCRIPT ${CMAKE_BINARY_DIR}/cmake/GetDependencies.cmake)
+    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HF Digital Voice for Radio Amateurs")
+    set(CPACK_PACKAGE_VENDOR "CMake")
+    #set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+    set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
+    set(CPACK_PACKAGE_VERSION_MAJOR ${FREEDV_VERSION_MAJOR})
+    set(CPACK_PACKAGE_VERSION_MINOR ${FREEDV_VERSION_MINOR})
+    # CPack expects a patch level version so set it here and override if we
+    # are actually setting one.
+    set(CPACK_PACKAGE_VERSION_PATCH 0)
+    if(FREEDV_VERSION_PATCH)
+        set(CPACK_PACKAGE_VERSION_PATCH ${FREEDV_VERSION_PATCH})
+    endif()
+    if(FREEDV_VERSION_SUFFIX)
+        set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${FREEDV_VERSION_SUFFIX}")
+    endif()
+    # There is a bug in NSI that does not handle full unix paths properly. Make
+    # sure there is at least one set of four (4) backlasshes.
+    #set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
+    set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\freedv.exe")
+    set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+    set(CPACK_NSIS_PACKAGE_NAME "FreeDV")
+    set(CPACK_NSIS_URL_INFO_ABOUT "http://freedv.org")
+    set(CPACK_NSIS_MODIFY_PATH OFF)
+    set(CPACK_NSIS_MENU_LINKS "http://freedv.org" "FreeDV Homepage")
+    include(CPack)
+endif(WIN32)
+
+endif(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG})
diff --git a/fdmdv2/tags/0.99-Beta/COPYING b/fdmdv2/tags/0.99-Beta/COPYING
new file mode 100644 (file)
index 0000000..cfd4e99
--- /dev/null
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, see
+    <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/fdmdv2/tags/0.99-Beta/README.txt b/fdmdv2/tags/0.99-Beta/README.txt
new file mode 100644 (file)
index 0000000..f28f204
--- /dev/null
@@ -0,0 +1,274 @@
+==================================
+ Building and installing on Linux
+==================================
+
+Quickstart 1
+-----------
+
+Builds static versions of wxWidgets, portaudio, codec2-dev, which are commonly
+missing on many Linux systems, or of the wrong (older) version.
+
+1/ Assuming the fdmdv2-dev source is checked out into ~/fdmdv2-dev:
+
+  $ sudo apt-get install libgtk2.0-dev libhamlib-dev libsamplerate-dev libasound2-dev libao-dev
+  $ cd fdmdv2-dev
+  $ mkdir build_linux
+  $ cd build_linux
+  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE ~/fdmdv2-dev
+  $ make
+
+2/ Then you can configure FreeDV using your local codec-dev, something like:
+
+  $ cmake -DCMAKE_BUILD_TYPE=Debug -DBOOTSTRAP_WXWIDGETS=TRUE -DCODEC2_INCLUDE_DIRS=/path/to/codec2-dev/src -DCODEC2_LIBRARY=/path/to/codec2-dev/build_linux/src/libcodec2.so -DUSE_STATIC_CODEC2=FALSE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../
+
+3/ OR build a local copy of codec2-dev:
+
+  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DUSE_STATIC_CODEC2=TRUE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../
+  
+4/ Build and run FreeDV:
+
+   $ make
+   $ ./src/freedv
+
+Quickstart 2
+------------
+
+1/ Assuming you have all the dependant libraries:
+
+  $ cd /path/to/fdmdv2
+  $ mkdir build_linux
+  $ cd build_linux
+  $ cmake ../ (defaults to /usr/local, use CMAKE_INSTALL_PREFIX to override)
+  (if no errors)
+  $ make
+  (as root)
+  $ make install
+
+
+=======================================================
+ Building for Windows on Ubuntu Linux (Cross compiling)
+=======================================================
+
+1/ Install the cross compiling toolchain:
+
+  $ sudo apt-get install mingw-w64
+
+2/ Patch cmake using: http://www.cmake.org/gitweb?p=stage/cmake.git;a=patch;h=33286235048495ceafb636d549d9a4e8891967ae
+
+3/ Checkout a fresh copy of codec2-dev and build for Windows, pointing to the generate_codebook built by a linux build of generate_codebook, using this cmake line
+
+  $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../fdmdv2-dev/cmake/Toolchain-Ubuntu-mingw32.cmake -DUNITTEST=FALSE -DGENERATE_CODEBOOK=/home/david/codec2-dev/build_linux/src/generate_codebook 
+
+4/ Build WxWidgets
+
+  $ cd /path/to/fdmdv2-dev
+  $ mkdir build_windows
+  $ cd build_windows
+  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE .. -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DCMAKE_BUILD_TYPE=Debug
+  $ make
+
+5/ Download and install the Windows version of Hamlib:
+
+  $ wget http://internode.dl.sourceforge.net/project/hamlib/hamlib/1.2.15.3/hamlib-win32-1.2.15.3.zip
+  $ unzip hamlib-win32-1.2.15.3.zip
+
+6/ Build All the libraries and FreeDV:
+
+  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SNDFILE=TRUE -DUSE_STATIC_SAMPLERATE=TRUE -DUSE_STATIC_SOX=TRUE -DUSE_STATIC_CODEC2=FALSE -DCODEC2_INCLUDE_DIRS=/home/david/tmp/codec2-dev/src -DCODEC2_LIBRARY=/home/david/tmp/codec2-dev/build_windows/src/libcodec2.dll.a -DHAMLIB_INCLUDE_DIR=hamlib-win32-1.2.15.3/include -DHAMLIB_LIBRARY=hamlib-win32-1.2.15.3/lib/gcc/libhamlib.dll.a -DCMAKE_BUILD_TYPE=Debug ..
+  $ make
+
+====================================
+ Building and installing on Windows
+====================================
+
+The windows build is similar to linux and follows the same basic workflow,
+however, while codec2 and FreeDV (fdmdv2) build well on windows, some of the
+dependencies do not. For that reson current windows releases are cross-compiled
+from linux.
+
+Only MinGW is supported. While it is likely possible to perform a pure MinGW
+build, installing MSYS2 will make your life easier.
+
+CMake may not automatically detect that you're in the MSYS environment. If this
+occurs you need to pass cmake the proper generator:
+
+cmake -G"MSYS Makefiles" [other options] </path/to/source>
+
+===============================
+ Bootstrapping wxWidgets build
+===============================
+
+If wxWidgets (>= 3.0) is not available then one option is to have CMake boot-
+strap the build for FreeDV.
+
+This is required because the tool wx-config is used to get the correct compiler
+and linker flags of the wxWidgets components needed by FreeDV. Since this is
+normally done at configure time, not during "make", it is not possible for CMake
+or have this information prior to building wxWidgets.
+
+In order to work around this issue you can "bootstrap" the wxWidgets build using
+the CMake option, "BOOTSTRAP_WXWIDGETS". wxWidgets will be built using static
+libraries.
+
+NOTE: This forces "USE_STATIC_WXWIDGETS" to be true internally regarless of the
+value set manually.
+
+(from any directory, but empty directory outside of the source is prefered.)
+$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE /path/to/fdmdv2
+$ make
+(wxWidgets is downloaded and built)
+$ cmake .
+(wxWidgets build should be detected)
+$ make
+(if all goes well, as root)
+$ make install
+
+====================================
+ Building and installing on OSX
+====================================
+
+====================================
+ Building and installing on FreeBSD
+====================================
+
+As per "Quickstart 2" above but change build_linux to build_freebsd
+
+=======
+Editing
+=======
+
+Please make sure your text editor does not insert tabs, and
+used indents of 4 spaces.  The following .emacs code was used to
+configure emacs:
+
+(setq-default indent-tabs-mode nil)
+
+(add-hook 'c-mode-common-hook
+          (function (lambda ()
+                      (setq c-basic-offset 4)
+                      )))
+
+====
+TODO
+====
+
+[ ] Open R&D questions
+    + Goal is to develop an open source DV mode that performs comparably to SSB
+    [ ] Does 700 perform OK next to SSB?
+        + approx same tx pk level (hard to measure exactly)
+        + try some low SNR channels
+        + try some fast fading/nasty channels
+    [ ] Is 700 speech quality acceptable?
+
+[X] test frames 
+    [X] freedv API support
+    [X] BER displayed on GUI for 700 and 1600
+    [X] plot error patterns for 700 and 1600
+        + callback for error patterns, or poll via stats interface
+    [X] plot error histograms for 700 and 1600
+        + map bit error to carrier, have done this in tcohpsk?
+        + how to reset histogram?  On error reset?
+        + histogram screen ... new code?
+        + test with filter
+
+[X] Bugs
+    [X] resync issue
+    [X] equalise power on 700 and 1600
+    [X] research real and complex PAPR
+    [X] waterfall and spectrum in analog mode
+    [X] The waterfall in analog mode appears to quit working sometimes?
+
+    [X] On TX, intermittently PTT will cause signal to be heard in speakers.  Toggle PTT or 
+        Stop/Start toggle and then starts working.
+    [X] Squelch control on 1600 mode will not open up squelch to 0 (appears to be around 2 dB)
+    [X] space bar keys PTT when entering text info box
+    [X] checksum based txt reception
+        + only print if valid
+    [X] IC7200 audio breakup
+    [ ] short varicode doesn't work
+        + #ifdef-ed out for now
+        + cld be broken in freedv_api
+    [X] On 700 audio sounds tinny and clicky when out of sync compared to 1600 why?
+        + clue: only when analog not pressed
+        + this was 7.5 to 8kHz interpolator bug
+    [X] spectrum and waterfall scale changes when analog pressed
+    [X] ocassional test frames error counter goes crazy
+    [ ] 700 syncs up to 1000Hz sine waves
+        + shouldn't trigger sync logic, will be a problem with carriers
+    [ ] "clip" led, encourage people to adjust gain to hit that occ when speaking
+    [ ] Win32 record from radio time
+
+[ ] FreeDV 700 improvements
+    [ ] bpf filter after clipping to remove clicks
+        [ ] tcohpsk first, measure PAPR, impl loss
+    [ ] error masking
+        [ ] C version
+        [ ] training off air?  Switchable?
+        [ ] excitation params
+        [ ] training
+    [ ] plotting other demod stats like ch ampl and phase ests
+    [ ] profile with perf, different libresample routine
+    [ ] check for occassional freedv 700 loss of sync
+        + scatter seems to jump
+    [ ] switchable diversity (narrowband) option
+        + measure difference on a few channels
+        + blog
+
+[X] win32
+    [X] X-compile works
+    [X] basic installer
+    [X] Win32 installer
+        + Richard has taken care of this
+
+[ ] Small fixes
+    [X] Playfile bug
+    [X] running again
+    [X] bump ver number
+    [X] long varicode default
+    [X] option to _not_ require checksum, on by default
+    [X] default squelch 2dB
+    [X] scatter diagram tweaks
+        + e.g. meaningful plots on fading channels in real time 
+        [X] agc with hysteresis
+            + changed to log steps
+        [X] longer persistance
+            + changed to 6 seconds
+        [X] diversity addtions on 700
+            + still not real obvious on plot
+            + might be useful to make this switchable
+    [X] scatter diagram different colours/carrier
+    [X] remember what mode you were in
+    [ ] cmd line file decode
+    [ ] Waterfall direction
+    [ ] documentation or use, walk through, you tube, blog posts
+
+[ ] Web support for Presence/spotting hooks
+
+=================
+USER GUIDE NOTES
+=================
+
+TODO: Put this in a more usable form, video tutorials etc
+
+1/ Error Histogram.  Displays BER of each carrier when in "test frame"
+ mode.  As each QPSK carrier has 2 bits there are 2*Nc histogram
+ points.
+
+ Ideally all carriers will have about the same BER (+/- 20% after 5000
+ total bit errors).  However problems can occur with filtering in the
+ tx path.  If one carrier has less power, then it will have a higher
+ BER.  The errors in this carrier will tend to dominate overall
+ BER. For example if one carrier is attenuated due to SSB filter
+ ripple in the tx path then the BER on that carrier will be higher.
+ This is bad news for DV.
+
+ Suggested usage: Transmit FreeDV in test frame mode.  Use a 2nd rx
+ (or get a friend) to monitor your rx signal with FreeDV in test frame
+ mode.  Adjust your rx SNR to get a BER of a few % (e.g. reduce tx power,
+ use a short antenna for the rx, point your beam away, adjust rx RF
+ gain).  Monitor the error histogram for a few minutes, until you have
+ say 5000 total bit errors.  You have a problem if the BER of any
+ carrier is more than 20% different from the rest.
+
+  A typical issue will be one carrier at 1.0, the others at 0.5,
+  indicating the poorer carrier BER is twice the larger.
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildCodec2.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildCodec2.cmake
new file mode 100644 (file)
index 0000000..471eef8
--- /dev/null
@@ -0,0 +1,23 @@
+set(SPEEXDSP_CMAKE_ARGS -DBUILD_SHARED_LIBS=FALSE -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external/dist)
+
+if(USE_STATIC_SPEEXDSP)
+    list(APPEND SPEEXDSP_CMAKE_ARGS 
+        -DSPEEXDSP_LIBRARIES=${CMAKE_BINARY_DIR}/external/dist/lib/libspeexdsp.a
+        -DSPEEXDSP_INCLUDE_DIR=${CMAKE_BINARY_DIR}/external/dist/include)
+endif()
+
+if(CMAKE_CROSSCOMPILING)
+    set(CODEC2_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(codec2
+   SVN_REPOSITORY https://svn.code.sf.net/p/freetel/code/codec2-dev
+   CMAKE_ARGS ${CODEC2_CMAKE_ARGS} ${SPEEXDSP_CMAKE_ARGS}
+   INSTALL_COMMAND ""
+)
+set(CODEC2_LIBRARIES
+    ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/libcodec2.a)
+include_directories(${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2/src)
+list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARIES})
+list(APPEND FREEDV_STATIC_DEPS codec2)
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildPortaudio.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildPortaudio.cmake
new file mode 100644 (file)
index 0000000..cc33d06
--- /dev/null
@@ -0,0 +1,52 @@
+set(PORTAUDIO_TARBALL "pa_stable_v19_20111121")
+
+# required linking libraries on linux. Not sure about windows.
+find_library(ALSA_LIBRARIES asound)
+
+if(UNIX AND NOT ALSA_LIBRARIES)
+    message(ERROR "Could not find alsa library which is required for portaudio.
+On Linux systems try installing:
+    alsa-lib-devel  (RPM based systems)
+    libasound2-dev  (DEB based systems)"
+    )
+endif()
+
+# Make sure that configure knows what system we're using when cross-compiling.
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    include(cmake/MinGW.cmake)
+    set(CONFIGURE_COMMAND ./configure --build=${HOST} --host=${HOST} --target=${HOST} --enable-cxx --without-jack --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist)
+else()
+    set(CONFIGURE_COMMAND ./configure --enable-cxx --without-jack --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist)
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(portaudio
+    URL http://www.portaudio.com/archives/${PORTAUDIO_TARBALL}.tgz
+    BUILD_IN_SOURCE 1
+    INSTALL_DIR external/dist
+    CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+    BUILD_COMMAND $(MAKE)
+    INSTALL_COMMAND $(MAKE) install
+)
+if(WIN32)
+    set(PORTAUDIO_LIBRARIES 
+        ${CMAKE_BINARY_DIR}/external/dist/lib/libportaudio.a
+        ${CMAKE_BINARY_DIR}/external/dist/lib/libportaudiocpp.a
+)
+else(WIN32)
+    find_library(RT rt)
+    find_library(ASOUND asound)
+    set(PORTAUDIO_LIBRARIES
+        ${CMAKE_BINARY_DIR}/external/dist/lib/libportaudio.a
+        ${CMAKE_BINARY_DIR}/external/dist/lib/libportaudiocpp.a
+        ${RT}
+        ${ASOUND}
+    )
+endif(WIN32)
+include_directories(${CMAKE_BINARY_DIR}/external/dist/include)
+
+# Add the portaudio library to the list of libraries that must be linked.
+list(APPEND FREEDV_LINK_LIBS ${PORTAUDIO_LIBRARIES})
+
+# Setup a dependency so that this gets built before linking to freedv.
+list(APPEND FREEDV_STATIC_DEPS portaudio)
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildSamplerate.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildSamplerate.cmake
new file mode 100644 (file)
index 0000000..aa09f85
--- /dev/null
@@ -0,0 +1,27 @@
+set(SAMPLERATE_TARBALL "libsamplerate-0.1.8")
+
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    set(CONFIGURE_COMMAND ./configure --build=${HOST} --host=${HOST} --target=${HOST} --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-sndfile)
+else()
+    set(CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist)
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(samplerate
+    URL http://www.mega-nerd.com/SRC/${SAMPLERATE_TARBALL}.tar.gz 
+    BUILD_IN_SOURCE 1
+    INSTALL_DIR external/dist
+    CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+    BUILD_COMMAND $(MAKE)
+    INSTALL_COMMAND $(MAKE) install
+)
+if(WIN32)
+    set(SAMPLERATE_LIBRARIES
+        ${CMAKE_BINARY_DIR}/external/dist/lib/libsamplerate.a)
+else(WIN32)
+    set(SAMPLERATE_LIBRARIES
+        ${CMAKE_BINARY_DIR}/external/dist/lib/libsamplerate.a)
+endif(WIN32)
+include_directories(${CMAKE_BINARY_DIR}/external/dist/include)
+list(APPEND FREEDV_LINK_LIBS ${SAMPLERATE_LIBRARIES})
+list(APPEND FREEDV_STATIC_DEPS samplerate)
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildSndfile.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildSndfile.cmake
new file mode 100644 (file)
index 0000000..43233fb
--- /dev/null
@@ -0,0 +1,26 @@
+set(SNDFILE_TARBALL "libsndfile-1.0.25")
+
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    set(CONFIGURE_COMMAND ./configure --host=${HOST}  --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs --disable-shared)
+else()
+    set(CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs --disable-shared --disable-external-libs)
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(sndfile
+    URL http://www.mega-nerd.com/libsndfile/files/${SNDFILE_TARBALL}.tar.gz
+    BUILD_IN_SOURCE 1
+    INSTALL_DIR external/dist
+    CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+    BUILD_COMMAND $(MAKE) V=1
+    INSTALL_COMMAND $(MAKE) install
+)
+if(MINGW)
+    set(SNDFILE_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libsndfile.a)
+else()
+    set(SNDFILE_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libsndfile.a)
+endif()
+
+include_directories(${CMAKE_BINARY_DIR}/external/dist/include)
+list(APPEND FREEDV_LINK_LIBS ${SNDFILE_LIBRARIES})
+list(APPEND FREEDV_STATIC_DEPS sndfile)
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildSox.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildSox.cmake
new file mode 100644 (file)
index 0000000..d54488b
--- /dev/null
@@ -0,0 +1,48 @@
+set(SOX_TARBALL "sox-14.4.1")
+
+# required linking libraries on linux. Not sure about windows.
+find_library(ALSA_LIBRARIES asound)
+find_library(AO_LIBRARIES ao)
+find_library(GSM_LIBRARIES gsm)
+
+if(UNIX AND NOT ALSA_LIBRARIES)
+    message(ERROR "Could not find alsa library.
+On Linux systems try installing:
+    alsa-lib-devel  (RPM based systems)
+    libasound2-dev  (DEB based systems)"
+    )
+endif(UNIX AND NOT ALSA_LIBRARIES)
+
+if(UNIX AND NOT AO_LIBRARIES)
+    message(ERROR "Could not find libao.
+On Linux systems try installing:
+    libao-devel  (RPM based systems)
+    libao-dev    (DEB based systems)"
+    )
+endif(UNIX AND NOT AO_LIBRARIES)
+
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    set(CONFIGURE_COMMAND ./configure --host=${HOST} --enable-shared=no --without-id3tag --without-png --disable-gomp --with-oggvorbis=no --with-oss=no --with-flac=no --with-amrnb=no --with-amrwb=no --with-mp3=no --with-wavpack=no --disable-dl-sndfile --with-pulseaudio=no --without-magic --with-gsm --prefix=${CMAKE_BINARY_DIR}/external/dist)
+else()
+    set(CONFIGURE_COMMAND ./configure --enable-shared=no --without-id3tag --without-png --disable-gomp --with-oggvorbis=no --with-oss=no --with-flac=no --with-amrnb=no --with-amrwb=no --with-mp3=no --with-wavpack=no --disable-dl-sndfile --with-pulseaudio=no --without-magic --with-gsm --prefix=${CMAKE_BINARY_DIR}/external/dist)
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(sox
+    URL http://downloads.sourceforge.net/sox/${SOX_TARBALL}.tar.gz
+    BUILD_IN_SOURCE 1
+    INSTALL_DIR external/dist
+    CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+    BUILD_COMMAND $(MAKE) V=1
+    INSTALL_COMMAND $(MAKE) install
+)
+set(SOX_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libsox.a)
+if(UNIX)
+    list(APPEND SOX_LIBRARIES ${ALSA_LIBRARIES} ${AO_LIBRARIES} ${GSM_LIBRARIES})
+endif()
+if(MINGW)
+    list(APPEND SOX_LIBRARIES winmm)
+endif()
+include_directories(${CMAKE_BINARY_DIR}/external/dist/include)
+list(APPEND FREEDV_LINK_LIBS ${SOX_LIBRARIES})
+list(APPEND FREEDV_STATIC_DEPS sox)
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildSpeex.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildSpeex.cmake
new file mode 100644 (file)
index 0000000..262d558
--- /dev/null
@@ -0,0 +1,26 @@
+set(SPEEXDSP_TARBALL "speexdsp-1.2rc3.tar.gz")
+
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    include(cmake/MinGW.cmake)
+    set(CONFIGURE_COMMAND ./configure --host=${HOST} --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-examples)
+else()
+    set(CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-examples)
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(speex
+   URL http://downloads.xiph.org/releases/speex/${SPEEXDSP_TARBALL}
+   BUILD_IN_SOURCE 1
+   INSTALL_DIR external/dist
+   CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+   BUILD_COMMAND $(MAKE)
+   INSTALL_COMMAND $(MAKE) install
+)
+
+set(SPEEXDSP_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libspeexdsp.a)
+include_directories(${CMAKE_BINARY_DIR}/external/dist/include)
+list(APPEND FREEDV_LINK_LIBS ${SPEEXDSP_LIBRARIES})
+list(APPEND FREEDV_STATIC_DEPS speex)
+if(USE_STATIC_CODEC2)
+    add_dependencies(codec2 speex)
+endif()
diff --git a/fdmdv2/tags/0.99-Beta/cmake/BuildWxWidgets.cmake b/fdmdv2/tags/0.99-Beta/cmake/BuildWxWidgets.cmake
new file mode 100644 (file)
index 0000000..901d806
--- /dev/null
@@ -0,0 +1,43 @@
+set(WXWIDGETS_TARBALL "wxWidgets-3.0.2")
+
+# If we're cross-compiling then we need to set the target host manually.
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    include(cmake/MinGW.cmake)
+endif()
+
+# If not cross-compiling then use the built-in makefile, otherwise use standard configure.
+if(MINGW AND NOT CMAKE_CROSSCOMPILING)
+#    set(CONFIGURE_COMMAND "true")
+#    set(MAKE_COMMAND $(MAKE) -C build/msw -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release PREFIX=${CMAKE_BINARY_DIR}/external/dist)
+    set(CONFIGURE_COMMAND ./configure --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist)
+       set(MAKE_COMMAND $(MAKE))
+endif()
+
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    set(CONFIGURE_COMMAND ./configure --build=${HOST} --host=${HOST} --target=${HOST} --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist)
+       set(MAKE_COMMAND $(MAKE))
+endif()
+
+if(NOT MINGW)
+    set(CONFIGURE_COMMAND ./configure --host=${HOST} --target=${HOST} --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist)
+       set(MAKE_COMMAND $(MAKE))
+endif()
+
+include(ExternalProject)
+ExternalProject_Add(wxWidgets
+    URL http://downloads.sourceforge.net/wxwindows/${WXWIDGETS_TARBALL}.tar.bz2
+    BUILD_IN_SOURCE 1
+    INSTALL_DIR external/dist
+    CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+    BUILD_COMMAND ${MAKE_COMMAND}
+    INSTALL_COMMAND $(MAKE) install
+)
+
+ExternalProject_Get_Property(wxWidgets install_dir)
+message(STATUS "wxWidgets install dir: ${install_dir}")
+if(NOT WXCONFIG)
+    set(WXCONFIG "${install_dir}/bin/wx-config")
+endif()
+if(EXISTS ${WXCONFIG})
+    set(BS_WX_DONE TRUE)
+endif()
diff --git a/fdmdv2/tags/0.99-Beta/cmake/FindPortaudio.cmake b/fdmdv2/tags/0.99-Beta/cmake/FindPortaudio.cmake
new file mode 100644 (file)
index 0000000..158e20e
--- /dev/null
@@ -0,0 +1,107 @@
+# - Try to find Portaudio
+# Once done this will define
+#
+#  PORTAUDIO_FOUND - system has Portaudio
+#  PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
+#  PORTAUDIO_LIBRARIES - Link these to use Portaudio
+#  PORTAUDIO_DEFINITIONS - Compiler switches required for using Portaudio
+#  PORTAUDIO_VERSION - Portaudio version
+#
+#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+  # in cache already
+  set(PORTAUDIO_FOUND TRUE)
+else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+  if (NOT WIN32)
+   include(FindPkgConfig)
+   pkg_check_modules(PORTAUDIO2 portaudio-2.0)
+  endif (NOT WIN32)
+
+  if (PORTAUDIO2_FOUND)
+    set(PORTAUDIO_INCLUDE_DIRS
+      ${PORTAUDIO2_INCLUDE_DIRS}
+    )
+    if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+      set(PORTAUDIO_LIBRARIES "${PORTAUDIO2_LIBRARY_DIRS}/lib${PORTAUDIO2_LIBRARIES}.dylib")
+    else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+      set(PORTAUDIO_LIBRARIES
+        ${PORTAUDIO2_LIBRARIES}
+      )
+    endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    set(PORTAUDIO_VERSION
+      19
+    )
+    set(PORTAUDIO_FOUND TRUE)
+  else (PORTAUDIO2_FOUND)
+    find_path(PORTAUDIO_INCLUDE_DIR
+      NAMES
+        portaudio.h
+      PATHS
+        /usr/include
+        /usr/local/include
+        /opt/local/include
+        /sw/include
+    )
+   
+    find_library(PORTAUDIO_LIBRARY
+      NAMES
+        portaudio
+      PATHS
+        /usr/lib
+        /usr/local/lib
+        /opt/local/lib
+        /sw/lib
+    )
+   
+    find_path(PORTAUDIO_LIBRARY_DIR
+      NAMES
+        portaudio
+      PATHS
+        /usr/lib
+        /usr/local/lib
+        /opt/local/lib
+        /sw/lib
+    )
+   
+    set(PORTAUDIO_INCLUDE_DIRS
+      ${PORTAUDIO_INCLUDE_DIR}
+    )
+    set(PORTAUDIO_LIBRARIES
+      ${PORTAUDIO_LIBRARY}
+    )
+   
+    set(PORTAUDIO_LIBRARY_DIRS
+      ${PORTAUDIO_LIBRARY_DIR}
+    )
+   
+    set(PORTAUDIO_VERSION
+      18
+    )
+   
+    if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
+       set(PORTAUDIO_FOUND TRUE)
+    endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
+   
+    if (PORTAUDIO_FOUND)
+      if (NOT Portaudio_FIND_QUIETLY)
+        message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}")
+      endif (NOT Portaudio_FIND_QUIETLY)
+    else (PORTAUDIO_FOUND)
+      if (Portaudio_FIND_REQUIRED)
+        message(FATAL_ERROR "Could not find Portaudio")
+      endif (Portaudio_FIND_REQUIRED)
+    endif (PORTAUDIO_FOUND)
+  endif (PORTAUDIO2_FOUND)
+
+
+  # show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view
+  mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+
+endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+
diff --git a/fdmdv2/tags/0.99-Beta/cmake/GetDependencies.cmake.in b/fdmdv2/tags/0.99-Beta/cmake/GetDependencies.cmake.in
new file mode 100644 (file)
index 0000000..93204dd
--- /dev/null
@@ -0,0 +1,25 @@
+# As this script is run in a new cmake instance, it does not have access to
+# the existing cache variables. Pass them in via the configure_file command.
+set(CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@)
+set(CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@)
+set(UNIX @UNIX@)
+set(WIN32 @WIN32@)
+set(CMAKE_CROSSCOMPILING @CMAKE_CROSSCOMPILING@)
+set(CMAKE_FIND_LIBRARY_SUFFIXES @CMAKE_FIND_LIBRARY_SUFFIXES@)
+set(CMAKE_FIND_LIBRARY_PREFIXES @CMAKE_FIND_LIBRARY_PREFIXES@)
+set(CMAKE_SYSTEM_LIBRARY_PATH @CMAKE_SYSTEM_LIBRARY_PATH@)
+set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@)
+
+set(FREEDV_EXE ${CMAKE_BINARY_DIR}/src/freedv.exe)
+
+include(GetPrerequisites)
+get_prerequisites("${FREEDV_EXE}" _deps 1 1 "" "${CMAKE_SYSTEM_LIBRARY_PATH}")
+foreach(_runtime ${_deps})
+    message("Looking for ${_runtime}")
+    find_library(RUNTIME_${_runtime} ${_runtime})
+    message("${RUNTIME_${_runtime}}")
+    if(RUNTIME_${_runtime})
+        file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
+        TYPE EXECUTABLE FILES "${RUNTIME_${_runtime}}")
+    endif()
+endforeach()
diff --git a/fdmdv2/tags/0.99-Beta/cmake/MinGW.cmake b/fdmdv2/tags/0.99-Beta/cmake/MinGW.cmake
new file mode 100644 (file)
index 0000000..333c1dc
--- /dev/null
@@ -0,0 +1,8 @@
+# If we're cross-compiling then we need to set the target host manually.
+if(MINGW AND CMAKE_CROSSCOMPILING)
+    if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+        set(HOST x86_64-w64-mingw32)
+    else()
+        set(HOST i686-w64-mingw32)
+    endif()
+endif()
diff --git a/fdmdv2/tags/0.99-Beta/cmake/Toolchain-Ubuntu-mingw32.cmake b/fdmdv2/tags/0.99-Beta/cmake/Toolchain-Ubuntu-mingw32.cmake
new file mode 100644 (file)
index 0000000..3507d72
--- /dev/null
@@ -0,0 +1,25 @@
+# Sample toolchain file for building for Windows from an Ubuntu Linux system.
+#
+# Typical usage:
+#    *) install cross compiler: `sudo apt-get install mingw-w64 g++-mingw-w64`
+#    *) cd build
+#    *) cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-Ubuntu-mingw32.cmake ..
+
+set(CMAKE_SYSTEM_NAME Windows)
+set(TOOLCHAIN_PREFIX i686-w64-mingw32)
+
+# cross compilers to use for C and C++
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
+
+# target environment on the build host system
+#   set 1st to dir with the cross compiler's C/C++ headers/libs
+set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
+
+# modify default behavior of FIND_XXX() commands to
+# search for headers/libs in the target environment and
+# search for programs in the build host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/fdmdv2/tags/0.99-Beta/cmake/config.h.in b/fdmdv2/tags/0.99-Beta/cmake/config.h.in
new file mode 100644 (file)
index 0000000..8e3ab76
--- /dev/null
@@ -0,0 +1,19 @@
+/*--------------------------------------------------------------------------
+ ** This file is autogenerated from config.h.in 
+ ** during the cmake configuration of your project. If you need to make changes
+ ** edit the original file NOT THIS FILE.
+ ** --------------------------------------------------------------------------*/
+#ifndef _CONFIGURATION_HEADER_GUARD_H_
+#define _CONFIGURATION_HEADER_GUARD_H_
+
+#define SIZEOF_INT @SIZEOF_INT@
+#cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@
+#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@
+#cmakedefine HAVE_STDDEF_H @HAVE_STDDEF_H@
+#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@
+#cmakedefine HAVE_STRING_H @HAVE_STRING_H@
+#cmakedefine HAVE_FLOOR @HAVE_FLOOR@
+#cmakedefine HAVE_MEMSET @HAVE_MEMSET@
+#cmakedefine HAVE_POW @HAVE_POW@
+#cmakedefine HAVE_SQRT @HAVE_SQRT@
+#endif
diff --git a/fdmdv2/tags/0.99-Beta/cmake/version.h.in b/fdmdv2/tags/0.99-Beta/cmake/version.h.in
new file mode 100644 (file)
index 0000000..43b3b7a
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef FREEDV_VER_DOT_H
+#define FREEDV_VER_DOT_H 1
+
+#define FREEDV_VERSION_MAJOR @FREEDV_VERSION_MAJOR@
+#define FREEDV_VERSION_MINOR @FREEDV_VERSION_MINOR@
+#define FREEDV_VERSION_PATCH @FREEDV_VERSION_PATCH@
+#define FREEDV_VERSION_SUFFIX "@FREEDV_VERSION_SUFFIX@"
+
+#define FREEDV_VERSION "@FREEDV_VERSION_STRING@"
+
+#endif //FREEDV_VER_DOT_H
diff --git a/fdmdv2/tags/0.99-Beta/contrib/CMakeLists.txt b/fdmdv2/tags/0.99-Beta/contrib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3f4b7e0
--- /dev/null
@@ -0,0 +1,22 @@
+# Install icons if we're on most *nix systems.
+if(UNIX AND NOT APPLE)
+    set(ICON_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor
+        CACHE PATH "Prefix to use for installing icons.")
+    install(FILES freedv48x48.png
+        DESTINATION ${ICON_INSTALL_PREFIX}/48x48/apps
+        RENAME freedv.png)
+    install(FILES freedv64x64.png
+        DESTINATION ${ICON_INSTALL_PREFIX}/64x64/apps
+        RENAME freedv.png)
+    install(FILES freedv128x128.png
+        DESTINATION ${ICON_INSTALL_PREFIX}/128x128/apps
+        RENAME freedv.png)
+    install(FILES freedv256x256.png
+        DESTINATION ${ICON_INSTALL_PREFIX}/256x256/apps
+        RENAME freedv.png)
+
+    set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/applications
+        CACHE PATH "Location to install desktop files.")
+    install(FILES freedv.desktop
+        DESTINATION ${DESKTOP_INSTALL_DIR})
+endif(UNIX AND NOT APPLE)
diff --git a/fdmdv2/tags/0.99-Beta/contrib/LICENSE b/fdmdv2/tags/0.99-Beta/contrib/LICENSE
new file mode 100644 (file)
index 0000000..dc8853a
--- /dev/null
@@ -0,0 +1,393 @@
+Attribution 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+     Considerations for licensors: Our public licenses are
+     intended for use by those authorized to give the public
+     permission to use material in ways otherwise restricted by
+     copyright and certain other rights. Our licenses are
+     irrevocable. Licensors should read and understand the terms
+     and conditions of the license they choose before applying it.
+     Licensors should also secure all rights necessary before
+     applying our licenses so that the public can reuse the
+     material as expected. Licensors should clearly mark any
+     material not subject to the license. This includes other CC-
+     licensed material, or material used under an exception or
+     limitation to copyright. More considerations for licensors:
+       wiki.creativecommons.org/Considerations_for_licensors
+
+     Considerations for the public: By using one of our public
+     licenses, a licensor grants the public permission to use the
+     licensed material under specified terms and conditions. If
+     the licensor's permission is not necessary for any reason--for
+     example, because of any applicable exception or limitation to
+     copyright--then that use is not regulated by the license. Our
+     licenses grant only permissions under copyright and certain
+     other rights that a licensor has authority to grant. Use of
+     the licensed material may still be restricted for other
+     reasons, including because others have copyright or other
+     rights in the material. A licensor may make special requests,
+     such as asking that all changes be marked or described.
+     Although not required by our licenses, you are encouraged to
+     respect those requests where reasonable. More_considerations
+     for the public: 
+       wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution 4.0 International Public License ("Public License"). To the
+extent this Public License may be interpreted as a contract, You are
+granted the Licensed Rights in consideration of Your acceptance of
+these terms and conditions, and the Licensor grants You such rights in
+consideration of benefits the Licensor receives from making the
+Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+  a. Adapted Material means material subject to Copyright and Similar
+     Rights that is derived from or based upon the Licensed Material
+     and in which the Licensed Material is translated, altered,
+     arranged, transformed, or otherwise modified in a manner requiring
+     permission under the Copyright and Similar Rights held by the
+     Licensor. For purposes of this Public License, where the Licensed
+     Material is a musical work, performance, or sound recording,
+     Adapted Material is always produced where the Licensed Material is
+     synched in timed relation with a moving image.
+
+  b. Adapter's License means the license You apply to Your Copyright
+     and Similar Rights in Your contributions to Adapted Material in
+     accordance with the terms and conditions of this Public License.
+
+  c. Copyright and Similar Rights means copyright and/or similar rights
+     closely related to copyright including, without limitation,
+     performance, broadcast, sound recording, and Sui Generis Database
+     Rights, without regard to how the rights are labeled or
+     categorized. For purposes of this Public License, the rights
+     specified in Section 2(b)(1)-(2) are not Copyright and Similar
+     Rights.
+
+  d. Effective Technological Measures means those measures that, in the
+     absence of proper authority, may not be circumvented under laws
+     fulfilling obligations under Article 11 of the WIPO Copyright
+     Treaty adopted on December 20, 1996, and/or similar international
+     agreements.
+
+  e. Exceptions and Limitations means fair use, fair dealing, and/or
+     any other exception or limitation to Copyright and Similar Rights
+     that applies to Your use of the Licensed Material.
+
+  f. Licensed Material means the artistic or literary work, database,
+     or other material to which the Licensor applied this Public
+     License.
+
+  g. Licensed Rights means the rights granted to You subject to the
+     terms and conditions of this Public License, which are limited to
+     all Copyright and Similar Rights that apply to Your use of the
+     Licensed Material and that the Licensor has authority to license.
+
+  h. Licensor means the individual(s) or entity(ies) granting rights
+     under this Public License.
+
+  i. Share means to provide material to the public by any means or
+     process that requires permission under the Licensed Rights, such
+     as reproduction, public display, public performance, distribution,
+     dissemination, communication, or importation, and to make material
+     available to the public including in ways that members of the
+     public may access the material from a place and at a time
+     individually chosen by them.
+
+  j. Sui Generis Database Rights means rights other than copyright
+     resulting from Directive 96/9/EC of the European Parliament and of
+     the Council of 11 March 1996 on the legal protection of databases,
+     as amended and/or succeeded, as well as other essentially
+     equivalent rights anywhere in the world.
+
+  k. You means the individual or entity exercising the Licensed Rights
+     under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+  a. License grant.
+
+       1. Subject to the terms and conditions of this Public License,
+          the Licensor hereby grants You a worldwide, royalty-free,
+          non-sublicensable, non-exclusive, irrevocable license to
+          exercise the Licensed Rights in the Licensed Material to:
+
+            a. reproduce and Share the Licensed Material, in whole or
+               in part; and
+
+            b. produce, reproduce, and Share Adapted Material.
+
+       2. Exceptions and Limitations. For the avoidance of doubt, where
+          Exceptions and Limitations apply to Your use, this Public
+          License does not apply, and You do not need to comply with
+          its terms and conditions.
+
+       3. Term. The term of this Public License is specified in Section
+          6(a).
+
+       4. Media and formats; technical modifications allowed. The
+          Licensor authorizes You to exercise the Licensed Rights in
+          all media and formats whether now known or hereafter created,
+          and to make technical modifications necessary to do so. The
+          Licensor waives and/or agrees not to assert any right or
+          authority to forbid You from making technical modifications
+          necessary to exercise the Licensed Rights, including
+          technical modifications necessary to circumvent Effective
+          Technological Measures. For purposes of this Public License,
+          simply making modifications authorized by this Section 2(a)
+          (4) never produces Adapted Material.
+
+       5. Downstream recipients.
+
+            a. Offer from the Licensor -- Licensed Material. Every
+               recipient of the Licensed Material automatically
+               receives an offer from the Licensor to exercise the
+               Licensed Rights under the terms and conditions of this
+               Public License.
+
+            b. No downstream restrictions. You may not offer or impose
+               any additional or different terms or conditions on, or
+               apply any Effective Technological Measures to, the
+               Licensed Material if doing so restricts exercise of the
+               Licensed Rights by any recipient of the Licensed
+               Material.
+
+       6. No endorsement. Nothing in this Public License constitutes or
+          may be construed as permission to assert or imply that You
+          are, or that Your use of the Licensed Material is, connected
+          with, or sponsored, endorsed, or granted official status by,
+          the Licensor or others designated to receive attribution as
+          provided in Section 3(a)(1)(A)(i).
+
+  b. Other rights.
+
+       1. Moral rights, such as the right of integrity, are not
+          licensed under this Public License, nor are publicity,
+          privacy, and/or other similar personality rights; however, to
+          the extent possible, the Licensor waives and/or agrees not to
+          assert any such rights held by the Licensor to the limited
+          extent necessary to allow You to exercise the Licensed
+          Rights, but not otherwise.
+
+       2. Patent and trademark rights are not licensed under this
+          Public License.
+
+       3. To the extent possible, the Licensor waives any right to
+          collect royalties from You for the exercise of the Licensed
+          Rights, whether directly or through a collecting society
+          under any voluntary or waivable statutory or compulsory
+          licensing scheme. In all other cases the Licensor expressly
+          reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+  a. Attribution.
+
+       1. If You Share the Licensed Material (including in modified
+          form), You must:
+
+            a. retain the following if it is supplied by the Licensor
+               with the Licensed Material:
+
+                 i. identification of the creator(s) of the Licensed
+                    Material and any others designated to receive
+                    attribution, in any reasonable manner requested by
+                    the Licensor (including by pseudonym if
+                    designated);
+
+                ii. a copyright notice;
+
+               iii. a notice that refers to this Public License;
+
+                iv. a notice that refers to the disclaimer of
+                    warranties;
+
+                 v. a URI or hyperlink to the Licensed Material to the
+                    extent reasonably practicable;
+
+            b. indicate if You modified the Licensed Material and
+               retain an indication of any previous modifications; and
+
+            c. indicate the Licensed Material is licensed under this
+               Public License, and include the text of, or the URI or
+               hyperlink to, this Public License.
+
+       2. You may satisfy the conditions in Section 3(a)(1) in any
+          reasonable manner based on the medium, means, and context in
+          which You Share the Licensed Material. For example, it may be
+          reasonable to satisfy the conditions by providing a URI or
+          hyperlink to a resource that includes the required
+          information.
+
+       3. If requested by the Licensor, You must remove any of the
+          information required by Section 3(a)(1)(A) to the extent
+          reasonably practicable.
+
+       4. If You Share Adapted Material You produce, the Adapter's
+          License You apply must not prevent recipients of the Adapted
+          Material from complying with this Public License.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+  a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+     to extract, reuse, reproduce, and Share all or a substantial
+     portion of the contents of the database;
+
+  b. if You include all or a substantial portion of the database
+     contents in a database in which You have Sui Generis Database
+     Rights, then the database in which You have Sui Generis Database
+     Rights (but not its individual contents) is Adapted Material; and
+
+  c. You must comply with the conditions in Section 3(a) if You Share
+     all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+  a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+     EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+     AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+     ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+     IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+     WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+     PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+     ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+     KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+     ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+  b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+     TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+     NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+     INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+     COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+     USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+     ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+     DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+     IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+  c. The disclaimer of warranties and limitation of liability provided
+     above shall be interpreted in a manner that, to the extent
+     possible, most closely approximates an absolute disclaimer and
+     waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+  a. This Public License applies for the term of the Copyright and
+     Similar Rights licensed here. However, if You fail to comply with
+     this Public License, then Your rights under this Public License
+     terminate automatically.
+
+  b. Where Your right to use the Licensed Material has terminated under
+     Section 6(a), it reinstates:
+
+       1. automatically as of the date the violation is cured, provided
+          it is cured within 30 days of Your discovery of the
+          violation; or
+
+       2. upon express reinstatement by the Licensor.
+
+     For the avoidance of doubt, this Section 6(b) does not affect any
+     right the Licensor may have to seek remedies for Your violations
+     of this Public License.
+
+  c. For the avoidance of doubt, the Licensor may also offer the
+     Licensed Material under separate terms or conditions or stop
+     distributing the Licensed Material at any time; however, doing so
+     will not terminate this Public License.
+
+  d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+     License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+  a. The Licensor shall not be bound by any additional or different
+     terms or conditions communicated by You unless expressly agreed.
+
+  b. Any arrangements, understandings, or agreements regarding the
+     Licensed Material not stated herein are separate from and
+     independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+  a. For the avoidance of doubt, this Public License does not, and
+     shall not be interpreted to, reduce, limit, restrict, or impose
+     conditions on any use of the Licensed Material that could lawfully
+     be made without permission under this Public License.
+
+  b. To the extent possible, if any provision of this Public License is
+     deemed unenforceable, it shall be automatically reformed to the
+     minimum extent necessary to make it enforceable. If the provision
+     cannot be reformed, it shall be severed from this Public License
+     without affecting the enforceability of the remaining terms and
+     conditions.
+
+  c. No term or condition of this Public License will be waived and no
+     failure to comply consented to unless expressly agreed to by the
+     Licensor.
+
+  d. Nothing in this Public License constitutes or may be interpreted
+     as a limitation upon, or waiver of, any privileges and immunities
+     that apply to the Licensor or You, including from the legal
+     processes of any jurisdiction or authority.
+
+
+=======================================================================
+
+Creative Commons is not a party to its public licenses.
+Notwithstanding, Creative Commons may elect to apply one of its public
+licenses to material it publishes and in those instances will be
+considered the "Licensor." Except for the limited purpose of indicating
+that material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the public
+licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv.desktop b/fdmdv2/tags/0.99-Beta/contrib/freedv.desktop
new file mode 100644 (file)
index 0000000..96e8293
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Name=FreeDV
+Exec=freedv
+Icon=freedv
+Type=Application
+Terminal=false
+Categories=GTK;GNOME;AudioVideo;Audio;HamRadio;
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv.ico b/fdmdv2/tags/0.99-Beta/contrib/freedv.ico
new file mode 100644 (file)
index 0000000..e6b9a20
Binary files /dev/null and b/fdmdv2/tags/0.99-Beta/contrib/freedv.ico differ
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv.rc b/fdmdv2/tags/0.99-Beta/contrib/freedv.rc
new file mode 100644 (file)
index 0000000..2e6655d
--- /dev/null
@@ -0,0 +1 @@
+id ICON "./freedv.ico"
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv128x128.png b/fdmdv2/tags/0.99-Beta/contrib/freedv128x128.png
new file mode 100644 (file)
index 0000000..5190a77
Binary files /dev/null and b/fdmdv2/tags/0.99-Beta/contrib/freedv128x128.png differ
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv256x256.png b/fdmdv2/tags/0.99-Beta/contrib/freedv256x256.png
new file mode 100644 (file)
index 0000000..b3eb5d7
Binary files /dev/null and b/fdmdv2/tags/0.99-Beta/contrib/freedv256x256.png differ
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv48x48.png b/fdmdv2/tags/0.99-Beta/contrib/freedv48x48.png
new file mode 100644 (file)
index 0000000..bd5efc6
Binary files /dev/null and b/fdmdv2/tags/0.99-Beta/contrib/freedv48x48.png differ
diff --git a/fdmdv2/tags/0.99-Beta/contrib/freedv64x64.png b/fdmdv2/tags/0.99-Beta/contrib/freedv64x64.png
new file mode 100644 (file)
index 0000000..eb89773
Binary files /dev/null and b/fdmdv2/tags/0.99-Beta/contrib/freedv64x64.png differ
diff --git a/fdmdv2/tags/0.99-Beta/credits.txt b/fdmdv2/tags/0.99-Beta/credits.txt
new file mode 100644 (file)
index 0000000..431e399
--- /dev/null
@@ -0,0 +1,13 @@
+Credits (code or ideas borrowed from):
+==============================================
+Dave Witten and David Rowe (obviously)
+Mel Whitten K0PFX (material and moral support)
+Bruce Perens (cheerleader, promotion and publicity)
+Mooneer Salem KG6AOV(Mac OSX Patch)
+Soeren Straarup OZ2DAK (FreeBSD Port)
+Don Mak
+Steve Nance (K5FR)
+Joel Stanley (Hamlib prototyping) and Mark Jessop (Mac OSX) 
+James Ahlstrom (Quisk)
+FLDIGI
+All the folks on the digital voice google group...
diff --git a/fdmdv2/tags/0.99-Beta/db/current b/fdmdv2/tags/0.99-Beta/db/current
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/fdmdv2/tags/0.99-Beta/db/format b/fdmdv2/tags/0.99-Beta/db/format
new file mode 100644 (file)
index 0000000..db06890
--- /dev/null
@@ -0,0 +1,2 @@
+4
+layout sharded 1000
diff --git a/fdmdv2/tags/0.99-Beta/db/fs-type b/fdmdv2/tags/0.99-Beta/db/fs-type
new file mode 100644 (file)
index 0000000..4fdd953
--- /dev/null
@@ -0,0 +1 @@
+fsfs
diff --git a/fdmdv2/tags/0.99-Beta/db/fsfs.conf b/fdmdv2/tags/0.99-Beta/db/fsfs.conf
new file mode 100644 (file)
index 0000000..cc08ceb
--- /dev/null
@@ -0,0 +1,38 @@
+### This file controls the configuration of the FSFS filesystem.\r
+\r
+[memcached-servers]\r
+### These options name memcached servers used to cache internal FSFS\r
+### data.  See http://www.danga.com/memcached/ for more information on\r
+### memcached.  To use memcached with FSFS, run one or more memcached\r
+### servers, and specify each of them as an option like so:\r
+# first-server = 127.0.0.1:11211\r
+# remote-memcached = mymemcached.corp.example.com:11212\r
+### The option name is ignored; the value is of the form HOST:PORT.\r
+### memcached servers can be shared between multiple repositories;\r
+### however, if you do this, you *must* ensure that repositories have\r
+### distinct UUIDs and paths, or else cached data from one repository\r
+### might be used by another accidentally.  Note also that memcached has\r
+### no authentication for reads or writes, so you must ensure that your\r
+### memcached servers are only accessible by trusted users.\r
+\r
+[caches]\r
+### When a cache-related error occurs, normally Subversion ignores it\r
+### and continues, logging an error if the server is appropriately\r
+### configured (and ignoring it with file:// access).  To make\r
+### Subversion never ignore cache errors, uncomment this line.\r
+# fail-stop = true\r
+\r
+[rep-sharing]\r
+### To conserve space, the filesystem can optionally avoid storing\r
+### duplicate representations.  This comes at a slight cost in\r
+### performance, as maintaining a database of shared representations can\r
+### increase commit times.  The space savings are dependent upon the size\r
+### of the repository, the number of objects it contains and the amount of\r
+### duplication between them, usually a function of the branching and\r
+### merging process.\r
+###\r
+### The following parameter enables rep-sharing in the repository.  It can\r
+### be switched on and off at will, but for best space-saving results\r
+### should be enabled consistently over the life of the repository.\r
+### rep-sharing is enabled by default.\r
+# enable-rep-sharing = true\r
diff --git a/fdmdv2/tags/0.99-Beta/db/min-unpacked-rev b/fdmdv2/tags/0.99-Beta/db/min-unpacked-rev
new file mode 100644 (file)
index 0000000..573541a
--- /dev/null
@@ -0,0 +1 @@
+0
diff --git a/fdmdv2/tags/0.99-Beta/db/rep-cache.db b/fdmdv2/tags/0.99-Beta/db/rep-cache.db
new file mode 100644 (file)
index 0000000..63c6f0b
Binary files /dev/null and b/fdmdv2/tags/0.99-Beta/db/rep-cache.db differ
diff --git a/fdmdv2/tags/0.99-Beta/db/revprops/0/0 b/fdmdv2/tags/0.99-Beta/db/revprops/0/0
new file mode 100644 (file)
index 0000000..d0b90de
--- /dev/null
@@ -0,0 +1,5 @@
+K 8
+svn:date
+V 27
+2012-08-21T18:27:59.389906Z
+END
diff --git a/fdmdv2/tags/0.99-Beta/db/revprops/0/1 b/fdmdv2/tags/0.99-Beta/db/revprops/0/1
new file mode 100644 (file)
index 0000000..0af71a2
--- /dev/null
@@ -0,0 +1,13 @@
+K 10
+svn:author
+V 9
+OFA-Staff
+K 8
+svn:date
+V 27
+2012-08-21T18:28:08.741468Z
+K 7
+svn:log
+V 25
+Imported folder structure
+END
diff --git a/fdmdv2/tags/0.99-Beta/db/revs/0/0 b/fdmdv2/tags/0.99-Beta/db/revs/0/0
new file mode 100644 (file)
index 0000000..10f5c45
--- /dev/null
@@ -0,0 +1,11 @@
+PLAIN
+END
+ENDREP
+id: 0.0.r0/17
+type: dir
+count: 0
+text: 0 0 4 4 2d2977d1c96f487abe4a1e202dd03b4e
+cpath: /
+
+
+17 107
diff --git a/fdmdv2/tags/0.99-Beta/db/revs/0/1 b/fdmdv2/tags/0.99-Beta/db/revs/0/1
new file mode 100644 (file)
index 0000000..fd802a9
--- /dev/null
@@ -0,0 +1,49 @@
+id: 3-1.0.r1/0
+type: dir
+count: 0
+cpath: /tags
+copyroot: 0 /
+
+id: 0-1.0.r1/62
+type: dir
+count: 0
+cpath: /trunk
+copyroot: 0 /
+
+id: 2-1.0.r1/126
+type: dir
+count: 0
+cpath: /branches
+copyroot: 0 /
+
+PLAIN
+K 8
+branches
+V 16
+dir 2-1.0.r1/126
+K 4
+tags
+V 14
+dir 3-1.0.r1/0
+K 5
+trunk
+V 15
+dir 0-1.0.r1/62
+END
+ENDREP
+id: 0.0.r1/306
+type: dir
+pred: 0.0.r0/17
+count: 1
+text: 1 194 99 99 7b6cc14dddba4e09be5255b475d1a0a8
+cpath: /
+copyroot: 0 /
+
+_0.0.t0-0 add-dir false false /trunk
+
+_2.0.t0-0 add-dir false false /branches
+
+_3.0.t0-0 add-dir false false /tags
+
+
+306 431
diff --git a/fdmdv2/tags/0.99-Beta/db/transactions/.gitignore b/fdmdv2/tags/0.99-Beta/db/transactions/.gitignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/fdmdv2/tags/0.99-Beta/db/txn-current b/fdmdv2/tags/0.99-Beta/db/txn-current
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/fdmdv2/tags/0.99-Beta/db/txn-current-lock b/fdmdv2/tags/0.99-Beta/db/txn-current-lock
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/fdmdv2/tags/0.99-Beta/db/txn-protorevs/.gitignore b/fdmdv2/tags/0.99-Beta/db/txn-protorevs/.gitignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/fdmdv2/tags/0.99-Beta/db/uuid b/fdmdv2/tags/0.99-Beta/db/uuid
new file mode 100644 (file)
index 0000000..0f36297
--- /dev/null
@@ -0,0 +1 @@
+a56d66ce-6468-4744-9be7-52ce95ca47a4
diff --git a/fdmdv2/tags/0.99-Beta/db/write-lock b/fdmdv2/tags/0.99-Beta/db/write-lock
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/fdmdv2/tags/0.99-Beta/src/CMakeLists.txt b/fdmdv2/tags/0.99-Beta/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..44ccfe7
--- /dev/null
@@ -0,0 +1,44 @@
+set(FREEDV_SOURCES
+    dlg_audiooptions.cpp
+    dlg_filter.cpp
+    dlg_options.cpp
+    dlg_ptt.cpp
+    fdmdv2_main.cpp
+    fdmdv2_pa_wrapper.cpp
+    fdmdv2_plot.cpp
+    fdmdv2_plot_scalar.cpp
+    fdmdv2_plot_scatter.cpp
+    fdmdv2_plot_spectrum.cpp
+    fdmdv2_plot_waterfall.cpp
+    hamlib.cpp
+    topFrame.cpp
+    sox_biquad.c
+    comp.h
+    dlg_audiooptions.h
+    dlg_filter.h
+    dlg_options.h
+    dlg_ptt.h
+    fdmdv2_defines.h
+    fdmdv2_main.h
+    fdmdv2_pa_wrapper.h
+    fdmdv2_plot.h
+    fdmdv2_plot_scalar.h
+    fdmdv2_plot_scatter.h
+    fdmdv2_plot_spectrum.h
+    fdmdv2_plot_waterfall.h
+    hamlib.h
+    sox_biquad.h
+    sox.h
+    topFrame.h
+    version.h
+)
+
+# WIN32 is needed for Windows GUI apps and is ignored for UNIX like systems.
+add_executable(freedv WIN32 ${FREEDV_SOURCES} ${RES_FILES})
+target_link_libraries(freedv ${FREEDV_LINK_LIBS})
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+if(FREEDV_STATIC_DEPS)
+    add_dependencies(freedv ${FREEDV_STATIC_DEPS})
+endif(FREEDV_STATIC_DEPS)
+install(TARGETS freedv
+    RUNTIME DESTINATION bin)
diff --git a/fdmdv2/tags/0.99-Beta/src/Makefile.win32 b/fdmdv2/tags/0.99-Beta/src/Makefile.win32
new file mode 100644 (file)
index 0000000..932e851
--- /dev/null
@@ -0,0 +1,52 @@
+# src/Makefile.win32
+# David Rowe 26 Oct 2012
+#
+# Makefile for Win32 on msys/Mingw to help David R get up to speed
+#
+# $ make -f Makefile.Win32
+
+CODEC2_PATH=$(HOME)/codec2-dev
+INCLUDE_PATH=/usr/local/include
+
+WX_CONFIG=wx-config
+WX_CPPFLAGS = $(shell $(WX_CONFIG) --cxxflags) -D__WXDEBUG__
+WX_LIBS = $(shell $(WX_CONFIG) --libs core, base, aui, adv, net)
+SVN_REVISION=$(shell svnversion)
+CODEC2_INC=$(CODEC2_PATH)/src 
+CODEC2_LIB=$(CODEC2_PATH)/build_win32/src/
+
+CPP_FLAGS = -D_NO_AUTOTOOLS_ -I$(INCLUDE_PATH) $(WX_CPPFLAGS) -I$(CODEC2_INC) -I../extern/include -I. -g -Wall -DSVN_REVISION=\"$(SVN_REVISION)\"
+LIBS = $(WX_LIBS) -L$(CODEC2_LIB) -lcodec2 -lm -lportaudiocpp -lportaudio -lpthread -lsndfile -lsamplerate -lhamlib -lsox -lspeexdsp
+
+OBJS = topFrame.o \
+fdmdv2_main.o \
+fdmdv2_plot.o \
+fdmdv2_plot_scalar.o \
+fdmdv2_plot_scatter.o \
+fdmdv2_plot_spectrum.o \
+fdmdv2_plot_waterfall.o \
+fdmdv2_pa_wrapper.o \
+dlg_audiooptions.o \
+dlg_ptt.o \
+dlg_options.o \
+dlg_filter.o \
+sox_biquad.o \
+hamlib.o \
+../../codec2-dev/src/golay23.o
+
+HDRS = version.h dlg_audiooptions.h dlg_ptt.h dlg_filter.h fdmdv2_main.h fdmdv2_defines.h fdmdv2_plot.h fdmdv2_plot_scalar.h fdmdv2_plot_waterfall.h fdmdv2_plot_scatter.h fdmdv2_plot_spectrum.h fdmdv2_pa_wrapper.h topFrame.h dlg_audiooptions.h topFrame.h varicode.h ../../codec2-dev/src/golay23.h hamlib.h
+
+all: freedv
+
+freedv: $(OBJS) 
+       g++ -o freedv $(OBJS) $(CPP_FLAGS) $(LIBS)
+
+%.o: %.cpp $(HDRS) Makefile.win32
+       g++ $(CPP_FLAGS) -c $< -o $@
+
+%.o: %.c $(HDRS) Makefile.win32
+       gcc $(CPP_FLAGS) -c $< -o $@
+
+clean:
+       rm -f *.o fdmdv2
+
diff --git a/fdmdv2/tags/0.99-Beta/src/comp.h b/fdmdv2/tags/0.99-Beta/src/comp.h
new file mode 100644 (file)
index 0000000..a3a1bd9
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+
+  FILE........: comp.h
+  AUTHOR......: David Rowe
+  DATE CREATED: 24/08/09
+
+  Complex number definition.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2009 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 __COMP__
+#define __COMP__
+
+/* Complex number */
+
+typedef struct
+{
+    float real;
+    float imag;
+} COMP;
+
+#endif
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_audiooptions.cpp b/fdmdv2/tags/0.99-Beta/src/dlg_audiooptions.cpp
new file mode 100644 (file)
index 0000000..7d23a08
--- /dev/null
@@ -0,0 +1,1264 @@
+//=========================================================================
+// Name:            AudioOptsDialog.cpp
+// Purpose:         Implements an Audio options selection dialog.
+//
+// Authors:         David Rowe, David Witten
+// License:
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//=========================================================================
+#include "fdmdv2_main.h"
+#include "dlg_audiooptions.h"
+
+// constants for test waveform plots
+
+#define TEST_WAVEFORM_X          180
+#define TEST_WAVEFORM_Y          180
+#define TEST_WAVEFORM_PLOT_TIME  2.0
+#define TEST_WAVEFORM_PLOT_FS    400
+#define TEST_BUF_SIZE           1024
+#define TEST_FS                 48000.0
+#define TEST_DT                 0.1      // time between plot updates in seconds
+#define TEST_WAVEFORM_PLOT_BUF  ((int)(DT*400))
+
+void AudioOptsDialog::Pa_Init(void)
+{
+    m_isPaInitialized = false;
+
+    if((pa_err = Pa_Initialize()) == paNoError)
+    {
+        m_isPaInitialized = true;
+    }
+    else
+    {
+        wxMessageBox(wxT("Port Audio failed to initialize"), wxT("Pa_Initialize"), wxOK);
+        return;
+    }
+}
+
+
+void AudioOptsDialog::buildTestControls(PlotScalar **plotScalar, wxButton **btnTest, 
+                                        wxPanel *parentPanel, wxBoxSizer *bSizer, wxString buttonLabel)
+{
+    wxBoxSizer* bSizer1 = new wxBoxSizer(wxVERTICAL);
+
+    wxPanel *panel = new wxPanel(parentPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
+    *plotScalar = new PlotScalar((wxFrame*) panel, 1, TEST_WAVEFORM_PLOT_TIME, 1.0/TEST_WAVEFORM_PLOT_FS, -1, 1, 1, 0.2, "", 1);
+    (*plotScalar)->SetClientSize(wxSize(TEST_WAVEFORM_X,TEST_WAVEFORM_Y));
+    bSizer1->Add(panel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 8);
+
+    *btnTest = new wxButton(parentPanel, wxID_ANY, buttonLabel, wxDefaultPosition, wxDefaultSize);
+    bSizer1->Add(*btnTest, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
+
+    bSizer->Add(bSizer1, 0, wxALIGN_CENTER_HORIZONTAL |wxALIGN_CENTER_VERTICAL );
+}
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// AudioOptsDialog()
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, title, pos, size, style)
+{
+    this->SetSizeHints(wxSize(850, 600), wxDefaultSize);
+
+    Pa_Init();
+
+    wxBoxSizer* mainSizer;
+    mainSizer = new wxBoxSizer(wxVERTICAL);
+    m_panel1 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
+    wxBoxSizer* bSizer4;
+    bSizer4 = new wxBoxSizer(wxVERTICAL);
+    m_notebook1 = new wxNotebook(m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM);
+    m_panelRx = new wxPanel(m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
+    wxBoxSizer* bSizer20;
+    bSizer20 = new wxBoxSizer(wxVERTICAL);
+    wxGridSizer* gSizer4;
+    gSizer4 = new wxGridSizer(2, 1, 0, 0);
+
+    // Rx In -----------------------------------------------------------------------
+
+    wxStaticBoxSizer* sbSizer2;
+    sbSizer2 = new wxStaticBoxSizer(new wxStaticBox(m_panelRx, wxID_ANY, _("From Radio")), wxHORIZONTAL);
+
+    wxBoxSizer* bSizer811a = new wxBoxSizer(wxVERTICAL);
+
+    m_listCtrlRxInDevices = new wxListCtrl(m_panelRx, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES);
+    bSizer811a->Add(m_listCtrlRxInDevices, 1, wxALL|wxEXPAND, 1);
+
+    wxBoxSizer* bSizer811;
+    bSizer811 = new wxBoxSizer(wxHORIZONTAL);
+    m_staticText51 = new wxStaticText(m_panelRx, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText51->Wrap(-1);
+    bSizer811->Add(m_staticText51, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
+    m_textCtrlRxIn = new wxTextCtrl(m_panelRx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    bSizer811->Add(m_textCtrlRxIn, 1, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    m_staticText6 = new wxStaticText(m_panelRx, wxID_ANY, _("Sample Rate:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText6->Wrap(-1);
+    bSizer811->Add(m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
+    m_cbSampleRateRxIn = new wxComboBox(m_panelRx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(90,-1), 0, NULL, wxCB_DROPDOWN);
+    bSizer811->Add(m_cbSampleRateRxIn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+
+    bSizer811a->Add(bSizer811, 0, wxEXPAND, 5);
+
+    sbSizer2->Add(bSizer811a, 1, wxEXPAND, 2);
+    buildTestControls(&m_plotScalarRxIn, &m_btnRxInTest, m_panelRx, sbSizer2, _("Rec 2s"));
+
+    gSizer4->Add(sbSizer2, 1, wxEXPAND, 5);
+
+    // Rx Out -----------------------------------------------------------------------
+
+    wxStaticBoxSizer* sbSizer3;
+    sbSizer3 = new wxStaticBoxSizer(new wxStaticBox(m_panelRx, wxID_ANY, _("To Speaker/Headphones")), wxHORIZONTAL);
+
+    wxBoxSizer* bSizer81a = new wxBoxSizer(wxVERTICAL);
+
+    m_listCtrlRxOutDevices = new wxListCtrl(m_panelRx, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES);
+    bSizer81a->Add(m_listCtrlRxOutDevices, 1, wxALL|wxEXPAND, 1);
+
+    wxBoxSizer* bSizer81;
+    bSizer81 = new wxBoxSizer(wxHORIZONTAL);
+    m_staticText9 = new wxStaticText(m_panelRx, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText9->Wrap(-1);
+    bSizer81->Add(m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    m_textCtrlRxOut = new wxTextCtrl(m_panelRx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    bSizer81->Add(m_textCtrlRxOut, 1, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    m_staticText10 = new wxStaticText(m_panelRx, wxID_ANY, _("Sample Rate:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText10->Wrap(-1);
+    bSizer81->Add(m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
+    m_cbSampleRateRxOut = new wxComboBox(m_panelRx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(90,-1), 0, NULL, wxCB_DROPDOWN);
+    bSizer81->Add(m_cbSampleRateRxOut, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+
+    bSizer81a->Add(bSizer81, 0, wxEXPAND, 5);
+
+    sbSizer3->Add(bSizer81a, 1, wxEXPAND, 2);
+    buildTestControls(&m_plotScalarRxOut, &m_btnRxOutTest, m_panelRx, sbSizer3, _("Play 2s"));
+    gSizer4->Add(sbSizer3, 1, wxEXPAND, 2);
+    bSizer20->Add(gSizer4, 1, wxEXPAND, 1);
+    m_panelRx->SetSizer(bSizer20);
+    m_panelRx->Layout();
+    bSizer20->Fit(m_panelRx);
+    m_notebook1->AddPage(m_panelRx, _("Receive"), true);
+
+    // Tx Tab -------------------------------------------------------------------------------
+
+    m_panelTx = new wxPanel(m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
+    wxBoxSizer* bSizer18;
+    bSizer18 = new wxBoxSizer(wxVERTICAL);
+    wxGridSizer* gSizer2;
+    gSizer2 = new wxGridSizer(2, 1, 0, 0);
+
+    // Tx In ----------------------------------------------------------------------------------
+
+    wxStaticBoxSizer* sbSizer22;
+    sbSizer22 = new wxStaticBoxSizer(new wxStaticBox(m_panelTx, wxID_ANY, _("From Microphone")), wxHORIZONTAL);
+
+    wxBoxSizer* bSizer83a = new wxBoxSizer(wxVERTICAL);
+
+    m_listCtrlTxInDevices = new wxListCtrl(m_panelTx, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES);
+    bSizer83a->Add(m_listCtrlTxInDevices, 1, wxALL|wxEXPAND, 1);
+    wxBoxSizer* bSizer83;
+    bSizer83 = new wxBoxSizer(wxHORIZONTAL);
+    m_staticText12 = new wxStaticText(m_panelTx, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText12->Wrap(-1);
+    bSizer83->Add(m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
+    m_textCtrlTxIn = new wxTextCtrl(m_panelTx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    bSizer83->Add(m_textCtrlTxIn, 1, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    m_staticText11 = new wxStaticText(m_panelTx, wxID_ANY, _("Sample Rate:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText11->Wrap(-1);
+    bSizer83->Add(m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
+    m_cbSampleRateTxIn = new wxComboBox(m_panelTx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(90,-1), 0, NULL, wxCB_DROPDOWN);
+    bSizer83->Add(m_cbSampleRateTxIn, 0, wxALL, 1);
+
+    bSizer83a->Add(bSizer83, 0, wxEXPAND, 5);
+
+    sbSizer22->Add(bSizer83a, 1, wxEXPAND, 2);
+    buildTestControls(&m_plotScalarTxIn, &m_btnTxInTest, m_panelTx, sbSizer22, _("Rec 2s"));
+
+    gSizer2->Add(sbSizer22, 1, wxEXPAND, 5);
+
+    // Tx Out ----------------------------------------------------------------------------------
+
+    wxStaticBoxSizer* sbSizer21;
+    sbSizer21 = new wxStaticBoxSizer(new wxStaticBox(m_panelTx, wxID_ANY, _("To Radio")), wxHORIZONTAL);
+
+    wxBoxSizer* bSizer82a = new wxBoxSizer(wxVERTICAL);
+
+    m_listCtrlTxOutDevices = new wxListCtrl(m_panelTx, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES);
+    bSizer82a->Add(m_listCtrlTxOutDevices, 1, wxALL|wxEXPAND, 2);
+    wxBoxSizer* bSizer82;
+    bSizer82 = new wxBoxSizer(wxHORIZONTAL);
+    m_staticText81 = new wxStaticText(m_panelTx, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText81->Wrap(-1);
+    bSizer82->Add(m_staticText81, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    m_textCtrlTxOut = new wxTextCtrl(m_panelTx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    bSizer82->Add(m_textCtrlTxOut, 1, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    m_staticText71 = new wxStaticText(m_panelTx, wxID_ANY, _("Sample Rate:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText71->Wrap(-1);
+    bSizer82->Add(m_staticText71, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
+    m_cbSampleRateTxOut = new wxComboBox(m_panelTx, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(90,-1), 0, NULL, wxCB_DROPDOWN);
+    bSizer82->Add(m_cbSampleRateTxOut, 0, wxALL, 1);
+
+    bSizer82a->Add(bSizer82, 0, wxEXPAND, 5);
+
+    sbSizer21->Add(bSizer82a, 1, wxEXPAND, 2);
+    buildTestControls(&m_plotScalarTxOut, &m_btnTxOutTest, m_panelTx, sbSizer21, _("Play 2s"));
+
+    gSizer2->Add(sbSizer21, 1, wxEXPAND, 5);
+    bSizer18->Add(gSizer2, 1, wxEXPAND, 1);
+    m_panelTx->SetSizer(bSizer18);
+    m_panelTx->Layout();
+    bSizer18->Fit(m_panelTx);
+    m_notebook1->AddPage(m_panelTx, _("Transmit"), false);
+
+    // API Tab -------------------------------------------------------------------
+
+    m_panelAPI = new wxPanel(m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
+    wxBoxSizer* bSizer12;
+    bSizer12 = new wxBoxSizer(wxHORIZONTAL);
+    wxGridSizer* gSizer31;
+    gSizer31 = new wxGridSizer(2, 1, 0, 0);
+    wxStaticBoxSizer* sbSizer1;
+    sbSizer1 = new wxStaticBoxSizer(new wxStaticBox(m_panelAPI, wxID_ANY, _("PortAudio")), wxVERTICAL);
+
+    wxGridSizer* gSizer3;
+    gSizer3 = new wxGridSizer(4, 2, 0, 0);
+
+    m_staticText7 = new wxStaticText(m_panelAPI, wxID_ANY, _("PortAudio Version String:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText7->Wrap(-1);
+    gSizer3->Add(m_staticText7, 1, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 10);
+    m_textStringVer = new wxStaticText(m_panelAPI, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    gSizer3->Add(m_textStringVer, 1, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 10);
+
+    m_staticText8 = new wxStaticText(m_panelAPI, wxID_ANY, _("PortAudio Int Version:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText8->Wrap(-1);
+    gSizer3->Add(m_staticText8, 1, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 10);
+    m_textIntVer = new wxStaticText(m_panelAPI, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(45,-1), 0);
+    gSizer3->Add(m_textIntVer, 1, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 10);
+
+    m_staticText5 = new wxStaticText(m_panelAPI, wxID_ANY, _("Device Count:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText5->Wrap(-1);
+    gSizer3->Add(m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 10);
+    m_textCDevCount = new wxStaticText(m_panelAPI, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(45,-1), 0);
+    gSizer3->Add(m_textCDevCount, 1, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 10);
+
+    m_staticText4 = new wxStaticText(m_panelAPI, wxID_ANY, _("API Count:"), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText4->Wrap(-1);
+    gSizer3->Add(m_staticText4, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 10);
+    m_textAPICount = new wxStaticText(m_panelAPI, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(45,-1), 0);
+    m_textAPICount->SetMaxSize(wxSize(45,-1));
+    gSizer3->Add(m_textAPICount, 1, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 10);
+
+    sbSizer1->Add(gSizer3, 1, wxEXPAND, 2);
+    gSizer31->Add(sbSizer1, 1, wxEXPAND, 2);
+    wxStaticBoxSizer* sbSizer6;
+    sbSizer6 = new wxStaticBoxSizer(new wxStaticBox(m_panelAPI, wxID_ANY, _("Other")), wxVERTICAL);
+    gSizer31->Add(sbSizer6, 1, wxEXPAND, 5);
+    bSizer12->Add(gSizer31, 1, wxEXPAND, 5);
+    m_panelAPI->SetSizer(bSizer12);
+    m_panelAPI->Layout();
+    bSizer12->Fit(m_panelAPI);
+    m_notebook1->AddPage(m_panelAPI, _("API Info"), false);
+    bSizer4->Add(m_notebook1, 1, wxEXPAND | wxALL, 0);
+    m_panel1->SetSizer(bSizer4);
+    m_panel1->Layout();
+    bSizer4->Fit(m_panel1);
+    mainSizer->Add(m_panel1, 1, wxEXPAND | wxALL, 1);
+
+    wxBoxSizer* bSizer6;
+    bSizer6 = new wxBoxSizer(wxHORIZONTAL);
+    m_btnRefresh = new wxButton(this, wxID_ANY, _("Refresh"), wxDefaultPosition, wxDefaultSize, 0);
+    bSizer6->Add(m_btnRefresh, 0, wxALIGN_CENTER|wxALL, 2);
+
+    m_sdbSizer1 = new wxStdDialogButtonSizer();
+
+    m_sdbSizer1OK = new wxButton(this, wxID_OK);
+    m_sdbSizer1->AddButton(m_sdbSizer1OK);
+
+    m_sdbSizer1Cancel = new wxButton(this, wxID_CANCEL);
+    m_sdbSizer1->AddButton(m_sdbSizer1Cancel);
+
+    m_sdbSizer1Apply = new wxButton(this, wxID_APPLY);
+    m_sdbSizer1->AddButton(m_sdbSizer1Apply);
+
+    m_sdbSizer1->Realize();
+
+    bSizer6->Add(m_sdbSizer1, 1, wxALIGN_CENTER_VERTICAL, 2);
+    mainSizer->Add(bSizer6, 0, wxEXPAND, 2);
+    this->SetSizer(mainSizer);
+    this->Layout();
+    this->Centre(wxBOTH);
+//    this->Centre(wxBOTH);
+
+    m_notebook1->SetSelection(0);
+
+    showAPIInfo();
+    m_RxInDevices.m_listDevices   = m_listCtrlRxInDevices;
+    m_RxInDevices.direction       = AUDIO_IN;
+    m_RxInDevices.m_textDevice    = m_textCtrlRxIn;
+    m_RxInDevices.m_cbSampleRate  = m_cbSampleRateRxIn;
+
+    m_RxOutDevices.m_listDevices  = m_listCtrlRxOutDevices;
+    m_RxOutDevices.direction      = AUDIO_OUT;
+    m_RxOutDevices.m_textDevice   = m_textCtrlRxOut;
+    m_RxOutDevices.m_cbSampleRate = m_cbSampleRateRxOut;
+
+    m_TxInDevices.m_listDevices   = m_listCtrlTxInDevices;
+    m_TxInDevices.direction       = AUDIO_IN;
+    m_TxInDevices.m_textDevice    = m_textCtrlTxIn;
+    m_TxInDevices.m_cbSampleRate  = m_cbSampleRateTxIn;
+
+    m_TxOutDevices.m_listDevices  = m_listCtrlTxOutDevices;
+    m_TxOutDevices.direction      = AUDIO_OUT;
+    m_TxOutDevices.m_textDevice   = m_textCtrlTxOut;
+    m_TxOutDevices.m_cbSampleRate = m_cbSampleRateTxOut;
+
+    populateParams(m_RxInDevices);
+    populateParams(m_RxOutDevices);
+    populateParams(m_TxInDevices);
+    populateParams(m_TxOutDevices);
+
+    m_listCtrlRxInDevices->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( AudioOptsDialog::OnRxInDeviceSelect ), NULL, this );
+    m_listCtrlRxOutDevices->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( AudioOptsDialog::OnRxOutDeviceSelect ), NULL, this );
+    m_listCtrlTxInDevices->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( AudioOptsDialog::OnTxInDeviceSelect ), NULL, this );
+    m_listCtrlTxOutDevices->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( AudioOptsDialog::OnTxOutDeviceSelect ), NULL, this );
+
+    // wire up test buttons
+    m_btnRxInTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnRxInTest ), NULL, this );
+    m_btnRxOutTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnRxOutTest ), NULL, this );
+    m_btnTxInTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnTxInTest ), NULL, this );
+    m_btnTxOutTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnTxOutTest ), NULL, this );
+
+    m_btnRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnRefreshClick ), NULL, this );
+    m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnApplyAudioParameters ), NULL, this );
+    m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnCancelAudioParameters ), NULL, this );
+    m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnOkAudioParameters ), NULL, this );
+/*
+        void OnClose( wxCloseEvent& event ) { event.Skip(); }
+        void OnHibernate( wxActivateEvent& event ) { event.Skip(); }
+        void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
+        void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
+*/
+//    this->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(AudioOptsDialog::OnClose));
+    this->Connect(wxEVT_HIBERNATE, wxActivateEventHandler(AudioOptsDialog::OnHibernate));
+    this->Connect(wxEVT_ICONIZE, wxIconizeEventHandler(AudioOptsDialog::OnIconize));
+    this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(AudioOptsDialog::OnInitDialog));
+}
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// ~AudioOptsDialog()
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+AudioOptsDialog::~AudioOptsDialog()
+{
+    Pa_Terminate();
+
+    // Disconnect Events
+    this->Disconnect(wxEVT_HIBERNATE, wxActivateEventHandler(AudioOptsDialog::OnHibernate));
+    this->Disconnect(wxEVT_ICONIZE, wxIconizeEventHandler(AudioOptsDialog::OnIconize));
+    this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(AudioOptsDialog::OnInitDialog));
+
+    m_listCtrlRxInDevices->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(AudioOptsDialog::OnRxInDeviceSelect), NULL, this);
+    m_listCtrlRxOutDevices->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(AudioOptsDialog::OnRxOutDeviceSelect), NULL, this);
+    m_listCtrlTxInDevices->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(AudioOptsDialog::OnTxInDeviceSelect), NULL, this);
+    m_listCtrlTxOutDevices->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(AudioOptsDialog::OnTxOutDeviceSelect), NULL, this);
+
+    m_btnRxInTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnRxInTest ), NULL, this );
+    m_btnRxOutTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnRxOutTest ), NULL, this );
+    m_btnTxInTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnTxInTest ), NULL, this );
+    m_btnTxOutTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AudioOptsDialog::OnTxOutTest ), NULL, this );
+
+    m_btnRefresh->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AudioOptsDialog::OnRefreshClick), NULL, this);
+    m_sdbSizer1Apply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AudioOptsDialog::OnApplyAudioParameters), NULL, this);
+    m_sdbSizer1Cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AudioOptsDialog::OnCancelAudioParameters), NULL, this);
+    m_sdbSizer1OK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AudioOptsDialog::OnOkAudioParameters), NULL, this);
+
+}
+
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnInitDialog( wxInitDialogEvent& event )
+{
+    ExchangeData(EXCHANGE_DATA_IN);
+}
+
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//
+// helper function to look up name of devNum, and if it exists write
+// name to textCtrl.  Used to trap dissapearing devices.
+//-------------------------------------------------------------------------
+int AudioOptsDialog::setTextCtrlIfDevNumValid(wxTextCtrl *textCtrl, wxListCtrl *listCtrl, int devNum)
+{
+    int i, aDevNum, found_devNum;
+
+    // ignore last list entry as it is the "none" entry
+
+    found_devNum = 0;
+    for(i=0; i<listCtrl->GetItemCount()-1; i++) {
+        aDevNum = wxAtoi(listCtrl->GetItemText(i, 1));
+        //printf("aDevNum: %d devNum: %d\n", aDevNum, devNum);
+        if (aDevNum == devNum) {
+            found_devNum = 1;
+            textCtrl->SetValue(listCtrl->GetItemText(i, 0) + " (" + wxString::Format(wxT("%i"),devNum) + ")");
+            printf("setting focus of %d\n", i);
+            listCtrl->SetItemState(i, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
+        }
+    }
+
+    if (found_devNum) 
+        return devNum;
+    else {
+        textCtrl->SetValue("none");
+        return -1;
+    }
+}
+
+//-------------------------------------------------------------------------
+// ExchangeData()
+//-------------------------------------------------------------------------
+int AudioOptsDialog::ExchangeData(int inout)
+{
+    if(inout == EXCHANGE_DATA_IN)
+    {
+        // Map sound card device numbers to tx/rx device numbers depending
+        // on number of sound cards in use
+
+        printf("EXCHANGE_DATA_IN:\n");
+        printf("  g_nSoundCards: %d\n", g_nSoundCards);
+        printf("  g_soundCard1InDeviceNum: %d\n", g_soundCard1InDeviceNum);
+        printf("  g_soundCard1OutDeviceNum: %d\n", g_soundCard1OutDeviceNum);
+        printf("  g_soundCard1SampleRate: %d\n", g_soundCard1SampleRate);
+        printf("  g_soundCard2InDeviceNum: %d\n", g_soundCard2InDeviceNum);
+        printf("  g_soundCard2OutDeviceNum: %d\n", g_soundCard2OutDeviceNum);
+        printf("  g_soundCard2SampleRate: %d\n", g_soundCard2SampleRate);
+
+        if (g_nSoundCards == 0) {
+            m_textCtrlRxIn ->SetValue("none"); rxInAudioDeviceNum  = -1;
+            m_textCtrlRxOut->SetValue("none"); rxOutAudioDeviceNum = -1;
+            m_textCtrlTxIn ->SetValue("none"); txInAudioDeviceNum  = -1;
+            m_textCtrlTxOut->SetValue("none"); txOutAudioDeviceNum = -1;           
+        }
+
+        if (g_nSoundCards == 1) {
+            rxInAudioDeviceNum  = setTextCtrlIfDevNumValid(m_textCtrlRxIn, 
+                                                           m_listCtrlRxInDevices, 
+                                                           g_soundCard1InDeviceNum);
+
+            rxOutAudioDeviceNum = setTextCtrlIfDevNumValid(m_textCtrlRxOut, 
+                                                           m_listCtrlRxOutDevices, 
+                                                           g_soundCard1OutDeviceNum);
+
+            if ((rxInAudioDeviceNum != -1) && (rxInAudioDeviceNum != -1)) {
+                m_cbSampleRateRxIn->SetValue(wxString::Format(wxT("%i"),g_soundCard1SampleRate));
+                m_cbSampleRateRxOut->SetValue(wxString::Format(wxT("%i"),g_soundCard1SampleRate));
+            }
+
+            m_textCtrlTxIn ->SetValue("none"); txInAudioDeviceNum  = -1;
+            m_textCtrlTxOut->SetValue("none"); txOutAudioDeviceNum = -1;           
+        }
+
+        if (g_nSoundCards == 2) {
+            rxInAudioDeviceNum  = setTextCtrlIfDevNumValid(m_textCtrlRxIn, 
+                                                           m_listCtrlRxInDevices, 
+                                                           g_soundCard1InDeviceNum);
+
+            rxOutAudioDeviceNum = setTextCtrlIfDevNumValid(m_textCtrlRxOut, 
+                                                           m_listCtrlRxOutDevices, 
+                                                           g_soundCard2OutDeviceNum);
+
+            txInAudioDeviceNum  = setTextCtrlIfDevNumValid(m_textCtrlTxIn, 
+                                                           m_listCtrlTxInDevices, 
+                                                           g_soundCard2InDeviceNum);
+
+            txOutAudioDeviceNum = setTextCtrlIfDevNumValid(m_textCtrlTxOut, 
+                                                           m_listCtrlTxOutDevices, 
+                                                           g_soundCard1OutDeviceNum);
+
+            if ((rxInAudioDeviceNum != -1) && (txOutAudioDeviceNum != -1)) {
+                m_cbSampleRateRxIn->SetValue(wxString::Format(wxT("%i"),g_soundCard1SampleRate));
+                m_cbSampleRateTxOut->SetValue(wxString::Format(wxT("%i"),g_soundCard1SampleRate));
+            }
+
+            if ((txInAudioDeviceNum != -1) && (rxOutAudioDeviceNum != -1)) {
+                m_cbSampleRateTxIn->SetValue(wxString::Format(wxT("%i"),g_soundCard2SampleRate));
+                m_cbSampleRateRxOut->SetValue(wxString::Format(wxT("%i"),g_soundCard2SampleRate));
+            }
+        }
+        printf("  rxInAudioDeviceNum: %d\n  rxOutAudioDeviceNum: %d\n  txInAudioDeviceNum: %d\n  txOutAudioDeviceNum: %d\n",
+               rxInAudioDeviceNum, rxOutAudioDeviceNum, txInAudioDeviceNum, txOutAudioDeviceNum);
+    }
+
+    if(inout == EXCHANGE_DATA_OUT)
+    {
+        int valid_one_card_config = 0;
+        int valid_two_card_config = 0;
+        wxString sampleRate1, sampleRate2;
+
+        printf("EXCHANGE_DATA_OUT:\n");
+        printf("  rxInAudioDeviceNum: %d\n  rxOutAudioDeviceNum: %d\n  txInAudioDeviceNum: %d\n  txOutAudioDeviceNum: %d\n",
+               rxInAudioDeviceNum, rxOutAudioDeviceNum, txInAudioDeviceNum, txOutAudioDeviceNum);
+
+        // ---------------------------------------------------------------
+        // check we have a valid 1 or 2 sound card configuration
+        // ---------------------------------------------------------------
+
+        // one sound card config, tx device numbers should be set to -1 
+
+        if ((rxInAudioDeviceNum != -1) && (rxOutAudioDeviceNum != -1) &&
+            (txInAudioDeviceNum == -1) && (txOutAudioDeviceNum == -1)) {
+            valid_one_card_config = 1; 
+
+            // in and out sample rate must be the same, as there is one callback
+            
+            sampleRate1 = m_cbSampleRateRxIn->GetValue();
+            if (!sampleRate1.IsSameAs(m_cbSampleRateRxOut->GetValue())) {
+                wxMessageBox(wxT("With a single sound card the Sample Rate of "
+                                 "From Radio and To Speaker/Headphones must be the same."), wxT(""), wxOK);
+                return -1;
+            }
+        }
+
+        // two card configuration
+
+        if ((rxInAudioDeviceNum != -1) && (rxOutAudioDeviceNum != -1) &&
+            (txInAudioDeviceNum != -1) && (txOutAudioDeviceNum != -1)) {
+
+            valid_two_card_config = 1; 
+
+            // Check we haven't doubled up on sound devices
+
+            if (rxInAudioDeviceNum == txInAudioDeviceNum) {
+                wxMessageBox(wxT("You must use different devices for From Radio and From Microphone"), wxT(""), wxOK);
+                return -1;
+            }
+
+            if (rxOutAudioDeviceNum == txOutAudioDeviceNum) {
+                wxMessageBox(wxT("You must use different devices for To Radio and To Speaker/Headphones"), wxT(""), wxOK);
+                return -1;
+            }
+
+            // Check sample rates for callback 1 devices are the same,
+            // as input and output are handled synchronously by one
+            // portaudio callback
+            
+            sampleRate1 = m_cbSampleRateRxIn->GetValue();
+            if (!sampleRate1.IsSameAs(m_cbSampleRateTxOut->GetValue())) {
+                wxMessageBox(wxT("With two sound cards the Sample Rate "
+                                 "of From Radio and To Radio must be the same."), wxT(""), wxOK);
+                return -1;
+            }
+            // check sample rate for callback 2 devices is the same
+
+            sampleRate2 = m_cbSampleRateTxIn->GetValue();
+            if (!sampleRate2.IsSameAs(m_cbSampleRateRxOut->GetValue())) {
+                wxMessageBox(wxT("With two sound cards the Sample Rate of "
+                                 "From Microphone and To Speaker/Headphones must be the same."), wxT(""), wxOK);
+                return -1;
+            }
+        }
+
+        printf("  valid_one_card_config: %d  valid_two_card_config: %d\n", valid_one_card_config, valid_two_card_config);
+
+        if (!valid_one_card_config && !valid_two_card_config) {
+            wxMessageBox(wxT("Invalid one or two sound card configuration"), wxT(""), wxOK);
+            return -1;
+        }
+
+        // ---------------------------------------------------------------
+        // Map Rx/TX device numbers to sound card device numbers used
+        // in callbacks. Portaudio uses one callback per sound card so
+        // we have to be soundcard oriented at run time rather than
+        // Tx/Rx oriented as in this dialog.
+        // ---------------------------------------------------------------
+        g_nSoundCards = 0;
+        g_soundCard1InDeviceNum = g_soundCard1OutDeviceNum = g_soundCard2InDeviceNum = g_soundCard2OutDeviceNum = -1;
+
+        if (valid_one_card_config) {
+
+            // Only callback 1 used
+
+            g_nSoundCards = 1;
+            g_soundCard1InDeviceNum  = rxInAudioDeviceNum;
+            g_soundCard1OutDeviceNum = rxOutAudioDeviceNum;
+            g_soundCard1SampleRate = wxAtoi(sampleRate1);
+        }
+
+        if (valid_two_card_config) {
+            g_nSoundCards = 2;
+            g_soundCard1InDeviceNum  = rxInAudioDeviceNum;
+            g_soundCard1OutDeviceNum = txOutAudioDeviceNum;
+            g_soundCard1SampleRate   = wxAtoi(sampleRate1);
+            g_soundCard2InDeviceNum  = txInAudioDeviceNum;
+            g_soundCard2OutDeviceNum = rxOutAudioDeviceNum;
+            g_soundCard2SampleRate   = wxAtoi(sampleRate2);
+        }
+
+        printf("  g_nSoundCards: %d\n", g_nSoundCards);
+        printf("  g_soundCard1InDeviceNum: %d\n", g_soundCard1InDeviceNum);
+        printf("  g_soundCard1OutDeviceNum: %d\n", g_soundCard1OutDeviceNum);
+        printf("  g_soundCard1SampleRate: %d\n", g_soundCard1SampleRate);
+        printf("  g_soundCard2InDeviceNum: %d\n", g_soundCard2InDeviceNum);
+        printf("  g_soundCard2OutDeviceNum: %d\n", g_soundCard2OutDeviceNum);
+        printf("  g_soundCard2SampleRate: %d\n", g_soundCard2SampleRate);
+
+        wxConfigBase *pConfig = wxConfigBase::Get();
+        pConfig->Write(wxT("/Audio/soundCard1InDeviceNum"),       g_soundCard1InDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard1OutDeviceNum"),      g_soundCard1OutDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard1SampleRate"),        g_soundCard1SampleRate );
+
+        pConfig->Write(wxT("/Audio/soundCard2InDeviceNum"),       g_soundCard2InDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard2OutDeviceNum"),      g_soundCard2OutDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard2SampleRate"),        g_soundCard2SampleRate );
+
+        pConfig->Flush();
+        delete wxConfigBase::Set((wxConfigBase *) NULL);
+    }
+
+    return 0;
+}
+
+//-------------------------------------------------------------------------
+// buildListOfSupportedSampleRates()
+//-------------------------------------------------------------------------
+int AudioOptsDialog:: buildListOfSupportedSampleRates(wxComboBox *cbSampleRate, int devNum, int in_out)
+{
+    // every sound device has a different list of supported sample rates, so
+    // we work out which ones are supported and populate the list ctrl
+
+    static double standardSampleRates[] =
+    {
+        8000.0,     9600.0,
+        11025.0,    12000.0,
+        16000.0,    22050.0,
+        24000.0,    32000.0,
+        44100.0,    48000.0,
+        88200.0,    96000.0,
+        192000.0,   -1          // negative terminated  list
+    };
+
+    const PaDeviceInfo  *deviceInfo;
+    PaStreamParameters   inputParameters, outputParameters;
+    PaError              err;
+    wxString             str;
+    int                  i, numSampleRates;
+
+    deviceInfo = Pa_GetDeviceInfo(devNum);
+    if (deviceInfo == NULL) {
+        printf("Pa_GetDeviceInfo(%d) failed!\n", devNum);
+        cbSampleRate->Clear();
+        return 0;
+    }
+
+    inputParameters.device = devNum;
+    inputParameters.channelCount = deviceInfo->maxInputChannels;
+    inputParameters.sampleFormat = paInt16;
+    inputParameters.suggestedLatency = 0;
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+        
+    outputParameters.device = devNum;
+    outputParameters.channelCount = deviceInfo->maxOutputChannels;
+    outputParameters.sampleFormat = paInt16;
+    outputParameters.suggestedLatency = 0;
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+    
+    cbSampleRate->Clear();
+    //printf("devNum %d supports: ", devNum);
+    numSampleRates = 0;
+    for(i = 0; standardSampleRates[i] > 0; i++)
+    {      
+        if (in_out == AUDIO_IN)
+            err = Pa_IsFormatSupported(&inputParameters, NULL, standardSampleRates[i]);
+        else
+            err = Pa_IsFormatSupported(NULL, &outputParameters, standardSampleRates[i]);
+
+        if( err == paFormatIsSupported ) {
+            str.Printf("%i", (int)standardSampleRates[i]);
+            cbSampleRate->AppendString(str);
+            printf("%i ", (int)standardSampleRates[i]);
+            numSampleRates++;
+        }
+    }
+    printf("\n");
+
+    return numSampleRates;
+}
+
+//-------------------------------------------------------------------------
+// showAPIInfo()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::showAPIInfo()
+{
+    wxString    strval;
+    int         apiVersion;
+    int         apiCount        = 0;
+    int         numDevices      = 0;
+
+    strval = Pa_GetVersionText();
+    m_textStringVer->SetLabel(strval);
+
+    apiVersion = Pa_GetVersion();
+    strval.Printf(wxT("%d"), apiVersion);
+    m_textIntVer->SetLabel(strval);
+
+    apiCount = Pa_GetHostApiCount();
+    strval.Printf(wxT("%d"), apiCount);
+    m_textAPICount->SetLabel(strval);
+
+    numDevices = Pa_GetDeviceCount();
+    strval.Printf(wxT("%d"), numDevices);
+    m_textCDevCount->SetLabel(strval);
+}
+
+//-------------------------------------------------------------------------
+// populateParams()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::populateParams(AudioInfoDisplay ai)
+{
+    const       PaDeviceInfo *deviceInfo = NULL;
+    wxListCtrl* ctrl    = ai.m_listDevices;
+    int         in_out  = ai.direction;
+    long        idx;
+    int         numDevices;
+    wxListItem  listItem;
+    wxString    buf;
+    int         devn;
+    int         col = 0;
+
+    numDevices = Pa_GetDeviceCount();
+
+    if(ctrl->GetColumnCount() > 0)
+    {
+        ctrl->ClearAll();
+    }
+
+    listItem.SetAlign(wxLIST_FORMAT_LEFT);
+    listItem.SetText(wxT("Device"));
+    idx = ctrl->InsertColumn(col, listItem);
+    ctrl->SetColumnWidth(col++, 300);
+
+    listItem.SetAlign(wxLIST_FORMAT_CENTRE);
+    listItem.SetText(wxT("ID"));
+    idx = ctrl->InsertColumn(col, listItem);
+    ctrl->SetColumnWidth(col++, 45);
+
+    listItem.SetAlign(wxLIST_FORMAT_LEFT);
+    listItem.SetText(wxT("API"));
+    idx = ctrl->InsertColumn(col, listItem);
+    ctrl->SetColumnWidth(col++, 100);
+
+    if(in_out == AUDIO_IN)
+    {
+        listItem.SetAlign(wxLIST_FORMAT_CENTRE);
+        listItem.SetText(wxT("Default Sample Rate"));
+        idx = ctrl->InsertColumn(col, listItem);
+        ctrl->SetColumnWidth(col++, 160);
+    }
+    else if(in_out == AUDIO_OUT)
+    {
+        listItem.SetAlign(wxLIST_FORMAT_CENTRE);
+        listItem.SetText(wxT("Default Sample Rate"));
+        idx = ctrl->InsertColumn(col, listItem);
+        ctrl->SetColumnWidth(col++, 160);
+    }
+
+    #ifdef LATENCY
+    listItem.SetAlign(wxLIST_FORMAT_CENTRE);
+    listItem.SetText(wxT("Min Latency"));
+    ctrl->InsertColumn(col, listItem);
+    ctrl->SetColumnWidth(col++, 100);
+
+    listItem.SetAlign(wxLIST_FORMAT_CENTRE);
+    listItem.SetText(wxT("Max Latency"));
+    ctrl->InsertColumn(col, listItem);
+    ctrl->SetColumnWidth(col++, 100);
+    #endif
+
+    for(devn = 0; devn < numDevices; devn++)
+    {
+        buf.Printf(wxT(""));
+        deviceInfo = Pa_GetDeviceInfo(devn);
+        if( ((in_out == AUDIO_IN) && (deviceInfo->maxInputChannels > 0)) ||
+            ((in_out == AUDIO_OUT) && (deviceInfo->maxOutputChannels > 0)))
+        {
+            col = 0;
+            buf.Printf(wxT("%s"), deviceInfo->name);
+            idx = ctrl->InsertItem(ctrl->GetItemCount(), buf);
+            col++;
+                
+            buf.Printf(wxT("%d"), devn);
+            ctrl->SetItem(idx, col++, buf);
+
+            buf.Printf(wxT("%s"), Pa_GetHostApiInfo(deviceInfo->hostApi)->name);
+            ctrl->SetItem(idx, col++, buf);
+
+            buf.Printf(wxT("%i"), (int)deviceInfo->defaultSampleRate);
+            ctrl->SetItem(idx, col++, buf);
+
+            #ifdef LATENCY
+            if (in_out == AUDIO_IN)
+                buf.Printf(wxT("%8.4f"), deviceInfo->defaultLowInputLatency);
+            else
+                buf.Printf(wxT("%8.4f"), deviceInfo->defaultLowOutputLatency);               
+            ctrl->SetItem(idx, col++, buf);
+
+            if (in_out == AUDIO_IN)
+                buf.Printf(wxT("%8.4f"), deviceInfo->defaultHighInputLatency);
+            else
+                 buf.Printf(wxT("%8.4f"), deviceInfo->defaultHighOutputLatency);             
+            ctrl->SetItem(idx, col++, buf);
+            #endif
+        }        
+    }
+
+    // add "none" option at end
+
+    buf.Printf(wxT("%s"), "none");
+    idx = ctrl->InsertItem(ctrl->GetItemCount(), buf);
+}
+
+//-------------------------------------------------------------------------
+// OnDeviceSelect()
+//
+// helper function to set up "Device:" and "Sample Rate:" fields when
+// we click on a line in the list of devices box
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnDeviceSelect(wxComboBox *cbSampleRate, 
+                                     wxTextCtrl *textCtrl, 
+                                     int        *devNum, 
+                                     wxListCtrl *listCtrlDevices, 
+                                     int         index,
+                                     int         in_out)
+{
+
+    wxString devName = listCtrlDevices->GetItemText(index, 0);
+     if (devName.IsSameAs("none")) {
+        *devNum = -1;
+        textCtrl->SetValue("none");
+    }
+    else {
+        *devNum = wxAtoi(listCtrlDevices->GetItemText(index, 1));
+        textCtrl->SetValue(devName + " (" + wxString::Format(wxT("%i"),*devNum) + ")");
+
+        int numSampleRates = buildListOfSupportedSampleRates(cbSampleRate, *devNum, in_out);
+        if (numSampleRates) {
+            wxString defSampleRate = listCtrlDevices->GetItemText(index, 3);        
+            cbSampleRate->SetValue(defSampleRate);
+        }
+        else {
+             cbSampleRate->SetValue("None");           
+        }
+    }
+}
+
+//-------------------------------------------------------------------------
+// OnRxInDeviceSelect()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnRxInDeviceSelect(wxListEvent& evt)
+{
+    OnDeviceSelect(m_cbSampleRateRxIn, 
+                   m_textCtrlRxIn, 
+                   &rxInAudioDeviceNum, 
+                   m_listCtrlRxInDevices, 
+                   evt.GetIndex(),
+                   AUDIO_IN);
+}
+
+//-------------------------------------------------------------------------
+// OnRxOutDeviceSelect()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnRxOutDeviceSelect(wxListEvent& evt)
+{
+    OnDeviceSelect(m_cbSampleRateRxOut, 
+                   m_textCtrlRxOut, 
+                   &rxOutAudioDeviceNum, 
+                   m_listCtrlRxOutDevices, 
+                   evt.GetIndex(),
+                   AUDIO_OUT);
+}
+
+//-------------------------------------------------------------------------
+// OnTxInDeviceSelect()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnTxInDeviceSelect(wxListEvent& evt)
+{
+    OnDeviceSelect(m_cbSampleRateTxIn, 
+                   m_textCtrlTxIn, 
+                   &txInAudioDeviceNum, 
+                   m_listCtrlTxInDevices, 
+                   evt.GetIndex(),
+                   AUDIO_IN);
+}
+
+//-------------------------------------------------------------------------
+// OnTxOutDeviceSelect()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnTxOutDeviceSelect(wxListEvent& evt)
+{
+    OnDeviceSelect(m_cbSampleRateTxOut, 
+                   m_textCtrlTxOut, 
+                   &txOutAudioDeviceNum, 
+                   m_listCtrlTxOutDevices, 
+                   evt.GetIndex(),
+                   AUDIO_OUT);
+}
+
+//-------------------------------------------------------------------------
+// plotDeviceInputForAFewSecs()
+//
+// opens a record device and plots the input speech for a few seconds.  This is "modal" using
+// synchronous portaudio functions, so the GUI will not respond until after test sample has been
+// taken
+//-------------------------------------------------------------------------
+void AudioOptsDialog::plotDeviceInputForAFewSecs(int devNum, PlotScalar *plotScalar) {
+    PaStreamParameters  inputParameters;
+    const PaDeviceInfo *deviceInfo = NULL;
+    PaStream           *stream = NULL;
+    PaError             err;
+    short               in48k_stereo_short[2*TEST_BUF_SIZE];
+    short               in48k_short[TEST_BUF_SIZE];
+    short               in8k_short[TEST_BUF_SIZE];
+    int                 numDevices, nBufs, i, j, src_error,inputChannels;
+    float               t;
+    SRC_STATE          *src;
+    FIFO               *fifo;
+
+    // a basic sanity check
+    numDevices = Pa_GetDeviceCount();
+    if (devNum >= numDevices)
+        return;
+    if (devNum < 0)
+        return;
+    printf("devNum %d\n", devNum);
+
+    fifo = fifo_create((int)(DT*TEST_WAVEFORM_PLOT_FS*2)); assert(fifo != NULL);
+    src = src_new(SRC_SINC_FASTEST, 1, &src_error); assert(src != NULL);
+
+    // work out how many input channels this device supports.
+
+    deviceInfo = Pa_GetDeviceInfo(devNum);
+    if (deviceInfo == NULL) {
+        wxMessageBox(wxT("Couldn't get device info from Port Audio for Sound Card "), wxT("Error"), wxOK);
+        return;
+    }
+    if (deviceInfo->maxInputChannels == 1)
+        inputChannels = 1;
+    else
+        inputChannels = 2;
+
+    // open device
+
+    inputParameters.device = devNum;
+    inputParameters.channelCount = inputChannels;
+    inputParameters.sampleFormat = paInt16;
+    inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency;
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+
+    nBufs = TEST_WAVEFORM_PLOT_TIME*TEST_FS/TEST_BUF_SIZE;
+    printf("inputChannels: %d nBufs %d\n", inputChannels, nBufs);
+
+    err = Pa_OpenStream(
+              &stream,
+              &inputParameters,
+              NULL,
+              TEST_FS,
+              TEST_BUF_SIZE,
+              paClipOff,    
+              NULL,       // no callback, use blocking API
+              NULL ); 
+    if (err != paNoError) {
+        wxMessageBox(wxT("Couldn't initialise sound device."), wxT("Error"), wxOK);       
+        return;
+    }
+
+    err = Pa_StartStream(stream);
+    if (err != paNoError) {
+        wxMessageBox(wxT("Couldn't start sound device."), wxT("Error"), wxOK);       
+        return;
+    }
+
+    for(i=0, t=0.0; i<nBufs; i++, t+=(float)TEST_BUF_SIZE/TEST_FS) {
+        Pa_ReadStream(stream, in48k_stereo_short, TEST_BUF_SIZE);
+        if (inputChannels == 2) {
+            for(j=0; j<TEST_BUF_SIZE; j++)
+                in48k_short[j] = in48k_stereo_short[2*j]; // left channel only
+        }
+        else {
+            for(j=0; j<TEST_BUF_SIZE; j++)
+                in48k_short[j] = in48k_stereo_short[j]; 
+        }
+        int n8k = resample(src, in8k_short, in48k_short, 8000, TEST_FS, TEST_BUF_SIZE, TEST_BUF_SIZE);
+        resample_for_plot(fifo, in8k_short, n8k, FS);
+
+        // every TEST_DT seconds update plot, unfortunately plot
+        // doesnt get updated to end as we are blocking events in this
+        // function
+
+        if (t > TEST_DT) {
+            t -= TEST_DT;
+            short plotSamples[TEST_WAVEFORM_PLOT_BUF];
+            if (fifo_read(fifo, plotSamples, TEST_WAVEFORM_PLOT_BUF))
+                memset(plotSamples, 0, TEST_WAVEFORM_PLOT_BUF*sizeof(short));
+            plotScalar->add_new_short_samples(0, plotSamples, TEST_WAVEFORM_PLOT_BUF, 32767);
+            plotScalar->Refresh();
+       }
+    }
+   
+    err = Pa_StopStream(stream);
+    if (err != paNoError) {
+        wxMessageBox(wxT("Couldn't stop sound device."), wxT("Error"), wxOK);       
+        return;
+    }
+    Pa_CloseStream(stream);
+
+    fifo_destroy(fifo);
+    src_delete(src);
+}
+
+//-------------------------------------------------------------------------
+// plotDeviceOutputForAFewSecs()
+//
+// opens a play device and plays a tone for a few seconds.  This is "modal" using
+// synchronous portaudio functions, so the GUI will not respond until after test sample has been
+// taken.  Also plots a pretty picture like the record versions
+//-------------------------------------------------------------------------
+void AudioOptsDialog::plotDeviceOutputForAFewSecs(int devNum, PlotScalar *plotScalar) {
+    PaStreamParameters  outputParameters;
+    const PaDeviceInfo *deviceInfo = NULL;
+    PaStream           *stream = NULL;
+    PaError             err;
+    short               out48k_stereo_short[2*TEST_BUF_SIZE];
+    short               out48k_short[TEST_BUF_SIZE];
+    short               out8k_short[TEST_BUF_SIZE];
+    int                 numDevices, nBufs, i, j, src_error, n, outputChannels;
+    float               t;
+    SRC_STATE          *src;
+    FIFO               *fifo;
+
+    // a basic sanity check
+    numDevices = Pa_GetDeviceCount();
+    if (devNum >= numDevices)
+        return;
+    if (devNum < 0)
+        return;
+
+    fifo = fifo_create((int)(DT*TEST_WAVEFORM_PLOT_FS*2)); assert(fifo != NULL);
+    src = src_new(SRC_SINC_FASTEST, 1, &src_error); assert(src != NULL);
+
+    // work out how many output channels this device supports.
+
+    deviceInfo = Pa_GetDeviceInfo(devNum);
+    if (deviceInfo == NULL) {
+        wxMessageBox(wxT("Couldn't get device info from Port Audio for Sound Card "), wxT("Error"), wxOK);
+        return;
+    }
+    if (deviceInfo->maxOutputChannels == 1)
+        outputChannels = 1;
+    else
+        outputChannels = 2;
+
+    printf("outputChannels: %d\n", outputChannels);
+
+    outputParameters.device = devNum;
+    outputParameters.channelCount = outputChannels;
+    outputParameters.sampleFormat = paInt16;
+    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    nBufs = TEST_WAVEFORM_PLOT_TIME*TEST_FS/TEST_BUF_SIZE;
+
+    err = Pa_OpenStream(
+              &stream,
+              NULL,
+              &outputParameters,
+              TEST_FS,
+              TEST_BUF_SIZE,
+              paClipOff,    
+              NULL,       // no callback, use blocking API
+              NULL ); 
+    if (err != paNoError) {
+        wxMessageBox(wxT("Couldn't initialise sound device."), wxT("Error"), wxOK);       
+        return;
+    }
+
+    err = Pa_StartStream(stream);
+    if (err != paNoError) {
+        wxMessageBox(wxT("Couldn't start sound device."), wxT("Error"), wxOK);       
+        return;
+    }
+
+    for(i=0, t=0.0, n=0; i<nBufs; i++, t+=(float)TEST_BUF_SIZE/TEST_FS) {
+        for(j=0; j<TEST_BUF_SIZE; j++,n++) {
+            out48k_short[j] = 2000.0*cos(6.2832*(n++)*400.0/TEST_FS);
+            if (outputChannels == 2) {
+                out48k_stereo_short[2*j] = out48k_short[j];   // left channel
+                out48k_stereo_short[2*j+1] = out48k_short[j]; // right channel
+            }
+            else {
+                out48k_stereo_short[j] = out48k_short[j];     // mono
+            }
+        }
+        Pa_WriteStream(stream, out48k_stereo_short, TEST_BUF_SIZE);
+
+        // convert back to 8kHz just for plotting
+        int n8k = resample(src, out8k_short, out48k_short, 8000, TEST_FS, TEST_BUF_SIZE, TEST_BUF_SIZE);
+        resample_for_plot(fifo, out8k_short, n8k, FS);
+
+        // every TEST_DT seconds update plot
+
+        if (t > TEST_DT) {
+            t -= TEST_DT;
+            short plotSamples[TEST_WAVEFORM_PLOT_BUF];
+            if (fifo_read(fifo, plotSamples, TEST_WAVEFORM_PLOT_BUF))
+                memset(plotSamples, 0, TEST_WAVEFORM_PLOT_BUF*sizeof(short));
+            plotScalar->add_new_short_samples(0, plotSamples, TEST_WAVEFORM_PLOT_BUF, 32767);
+            plotScalar->Refresh();
+       }
+    }
+   
+    err = Pa_StopStream(stream);
+    if (err != paNoError) {
+        wxMessageBox(wxT("Couldn't stop sound device."), wxT("Error"), wxOK);       
+        return;
+    }
+    Pa_CloseStream(stream);
+
+    fifo_destroy(fifo);
+    src_delete(src);
+}
+
+//-------------------------------------------------------------------------
+// OnRxInTest()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnRxInTest(wxCommandEvent& event)
+{
+    plotDeviceInputForAFewSecs(rxInAudioDeviceNum, m_plotScalarRxIn);
+}
+
+//-------------------------------------------------------------------------
+// OnRxOutTest()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnRxOutTest(wxCommandEvent& event)
+{
+    plotDeviceOutputForAFewSecs(rxOutAudioDeviceNum, m_plotScalarRxOut);
+}
+
+//-------------------------------------------------------------------------
+// OnTxInTest()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnTxInTest(wxCommandEvent& event)
+{
+    plotDeviceInputForAFewSecs(txInAudioDeviceNum, m_plotScalarTxIn);
+}
+
+//-------------------------------------------------------------------------
+// OnTxOutTest()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnTxOutTest(wxCommandEvent& event)
+{
+    plotDeviceOutputForAFewSecs(txOutAudioDeviceNum, m_plotScalarTxOut);
+}
+
+//-------------------------------------------------------------------------
+// OnRefreshClick()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnRefreshClick(wxCommandEvent& event)
+{
+    // restart portaudio, to re-sample available devices
+
+    Pa_Terminate();
+    Pa_Init();
+
+    m_notebook1->SetSelection(0);
+    showAPIInfo();
+    populateParams(m_RxInDevices);
+    populateParams(m_RxOutDevices);
+    populateParams(m_TxInDevices);
+    populateParams(m_TxOutDevices);
+
+    // some devices may have dissapeared, so possibily change sound
+    // card config
+
+    ExchangeData(EXCHANGE_DATA_IN);
+}
+
+//-------------------------------------------------------------------------
+// OnApplyAudioParameters()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnApplyAudioParameters(wxCommandEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_OUT);
+    if(m_isPaInitialized)
+    {
+        if((pa_err = Pa_Terminate()) == paNoError)
+        {
+            m_isPaInitialized = false;
+        }
+        else
+        {
+            wxMessageBox(wxT("Port Audio failed to Terminate"), wxT("Pa_Terminate"), wxOK);
+        }
+    }
+}
+
+//-------------------------------------------------------------------------
+// OnCancelAudioParameters()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnCancelAudioParameters(wxCommandEvent& event)
+{
+    if(m_isPaInitialized)
+    {
+        if((pa_err = Pa_Terminate()) == paNoError)
+        {
+            m_isPaInitialized = false;
+        }
+        else
+        {
+            wxMessageBox(wxT("Port Audio failed to Terminate"), wxT("Pa_Terminate"), wxOK);
+        }
+    }
+    EndModal(wxCANCEL);
+}
+
+//-------------------------------------------------------------------------
+// OnOkAudioParameters()
+//-------------------------------------------------------------------------
+void AudioOptsDialog::OnOkAudioParameters(wxCommandEvent& event)
+{
+    int status = ExchangeData(EXCHANGE_DATA_OUT);
+
+    // We only accept OK if config sucessful
+
+    printf("status: %d m_isPaInitialized: %d\n", status, m_isPaInitialized);
+    if (status == 0) {
+        if(m_isPaInitialized)
+        {
+            if((pa_err = Pa_Terminate()) == paNoError)
+            {
+                printf("terminated OK\n");
+                m_isPaInitialized = false;
+            }
+            else
+            {
+                wxMessageBox(wxT("Port Audio failed to Terminate"), wxT("Pa_Terminate"), wxOK);
+            }
+        }
+        EndModal(wxOK);
+    }
+
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_audiooptions.h b/fdmdv2/tags/0.99-Beta/src/dlg_audiooptions.h
new file mode 100644 (file)
index 0000000..7a78b59
--- /dev/null
@@ -0,0 +1,176 @@
+//=========================================================================
+// Name:          AudioInfoDisplay.h
+// Purpose:       Declares simple wxWidgets application with GUI
+//                created using wxFormBuilder.
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//=========================================================================
+#ifndef __AudioOptsDialog__
+#define __AudioOptsDialog__
+
+#include "fdmdv2_main.h"
+
+#define ID_AUDIO_OPTIONS    1000
+#define AUDIO_IN            0
+#define AUDIO_OUT           1
+
+#include "portaudio.h"
+#ifdef WIN32
+#if PA_USE_ASIO
+#include "pa_asio.h"
+#endif
+#endif
+#include "codec2_fifo.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// AudioInfoDisplay
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class AudioInfoDisplay
+{
+    public:
+        wxListCtrl*     m_listDevices;
+        int             direction;
+        wxTextCtrl*     m_textDevice;
+        wxComboBox*     m_cbSampleRate;
+};
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// class AudioOptsDialog
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class AudioOptsDialog : public wxDialog
+{
+    private:
+
+    protected:
+        PaError         pa_err;
+        bool            m_isPaInitialized;
+
+        int             rxInAudioDeviceNum;
+        int             rxOutAudioDeviceNum;
+        int             txInAudioDeviceNum;
+        int             txOutAudioDeviceNum;
+
+        void buildTestControls(PlotScalar **plotScalar, wxButton **btnTest, 
+                               wxPanel *parentPanel, wxBoxSizer *bSizer, wxString buttonLabel);
+        void plotDeviceInputForAFewSecs(int devNum, PlotScalar *plotScalar);
+        void plotDeviceOutputForAFewSecs(int devNum, PlotScalar *plotScalar);
+
+        int buildListOfSupportedSampleRates(wxComboBox *cbSampleRate, int devNum, int in_out);
+        void populateParams(AudioInfoDisplay);
+        void showAPIInfo();
+        int setTextCtrlIfDevNumValid(wxTextCtrl *textCtrl, wxListCtrl *listCtrl, int devNum);
+        void Pa_Init(void);
+        void OnDeviceSelect(wxComboBox *cbSampleRate, 
+                            wxTextCtrl *textCtrl, 
+                            int        *devNum, 
+                            wxListCtrl *listCtrlDevices, 
+                            int         index,
+                            int         in_out);
+
+        AudioInfoDisplay m_RxInDevices;
+        AudioInfoDisplay m_RxOutDevices;
+        AudioInfoDisplay m_TxInDevices;
+        AudioInfoDisplay m_TxOutDevices;
+        wxPanel* m_panel1;
+        wxNotebook* m_notebook1;
+
+        wxPanel* m_panelRx;
+
+        wxListCtrl* m_listCtrlRxInDevices;
+        wxStaticText* m_staticText51;
+        wxTextCtrl* m_textCtrlRxIn;
+        wxStaticText* m_staticText6;
+        wxComboBox* m_cbSampleRateRxIn;
+
+        wxButton* m_btnRxInTest;
+        PlotScalar* m_plotScalarRxIn;
+
+        wxListCtrl* m_listCtrlRxOutDevices;
+        wxStaticText* m_staticText9;
+        wxTextCtrl* m_textCtrlRxOut;
+        wxStaticText* m_staticText10;
+        wxComboBox* m_cbSampleRateRxOut;
+
+        wxButton* m_btnRxOutTest;
+        PlotScalar* m_plotScalarRxOut;
+
+        wxPanel* m_panelTx;
+
+        wxListCtrl* m_listCtrlTxInDevices;
+        wxStaticText* m_staticText12;
+        wxTextCtrl* m_textCtrlTxIn;
+        wxStaticText* m_staticText11;
+        wxComboBox* m_cbSampleRateTxIn;
+
+        wxButton* m_btnTxInTest;
+        PlotScalar* m_plotScalarTxIn;
+
+        wxListCtrl* m_listCtrlTxOutDevices;
+        wxStaticText* m_staticText81;
+        wxTextCtrl* m_textCtrlTxOut;
+        wxStaticText* m_staticText71;
+        wxComboBox* m_cbSampleRateTxOut;
+
+        wxButton* m_btnTxOutTest;
+        PlotScalar* m_plotScalarTxOut;
+
+        wxPanel* m_panelAPI;
+
+        wxStaticText* m_staticText7;
+        wxStaticText* m_textStringVer;
+        wxStaticText* m_staticText8;
+        wxStaticText* m_textIntVer;
+        wxStaticText* m_staticText5;
+        wxStaticText* m_textCDevCount;
+        wxStaticText* m_staticText4;
+        wxStaticText* m_textAPICount;
+        wxButton* m_btnRefresh;
+        wxStdDialogButtonSizer* m_sdbSizer1;
+        wxButton* m_sdbSizer1OK;
+        wxButton* m_sdbSizer1Apply;
+        wxButton* m_sdbSizer1Cancel;
+
+        // Virtual event handlers, overide them in your derived class
+        //virtual void OnActivateApp( wxActivateEvent& event ) { event.Skip(); }
+//        virtual void OnCloseFrame( wxCloseEvent& event ) { event.Skip(); }
+
+        void OnRxInDeviceSelect( wxListEvent& event );
+
+        void OnRxInTest( wxCommandEvent& event );
+        void OnRxOutTest( wxCommandEvent& event );
+        void OnTxInTest( wxCommandEvent& event );
+        void OnTxOutTest( wxCommandEvent& event );
+
+        void OnRxOutDeviceSelect( wxListEvent& event );
+        void OnTxInDeviceSelect( wxListEvent& event );
+        void OnTxOutDeviceSelect( wxListEvent& event );
+        void OnRefreshClick( wxCommandEvent& event );
+        void OnApplyAudioParameters( wxCommandEvent& event );
+        void OnCancelAudioParameters( wxCommandEvent& event );
+        void OnOkAudioParameters( wxCommandEvent& event );
+        // Virtual event handlers, overide them in your derived class
+        void OnClose( wxCloseEvent& event ) { event.Skip(); }
+        void OnHibernate( wxActivateEvent& event ) { event.Skip(); }
+        void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
+        void OnInitDialog( wxInitDialogEvent& event );
+
+    public:
+
+        AudioOptsDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Audio Config"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 300,300 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+        ~AudioOptsDialog();
+        int ExchangeData(int inout);
+};
+#endif //__AudioOptsDialog__
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_filter.cpp b/fdmdv2/tags/0.99-Beta/src/dlg_filter.cpp
new file mode 100644 (file)
index 0000000..0de8e8c
--- /dev/null
@@ -0,0 +1,786 @@
+//==========================================================================
+// Name:            dlg_filter.cpp
+// Purpose:         Dialog for controlling Codec audio filtering
+// Date:            Nov 25 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include "dlg_filter.h"
+
+#define SLIDER_MAX 100
+#define SLIDER_LENGTH 100
+
+#define FILTER_MIN_MAG_DB -20.0
+#define FILTER_MAX_MAG_DB  20.0
+
+#define MAX_FREQ_BASS      600.00
+#define MAX_FREQ_TREBLE   3900.00
+#define MAX_FREQ_DEF      3000.00
+
+#define MIN_GAIN          -20
+#define MAX_GAIN           20
+
+#define MAX_LOG10_Q         1.0
+#define MIN_LOG10_Q        -1.0 
+
+// DFT parameters
+
+#define IMP_AMP           2000.0                     // amplitude of impulse
+#define NIMP              50                         // number of samples in impulse response
+#define F_STEP_DFT        10.0                       // frequency steps to sample spectrum
+#define F_MAG_N           (int)(MAX_F_HZ/F_STEP_DFT) // number of frequency steps
+
+extern struct freedv      *g_pfreedv;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class FilterDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+FilterDlg::FilterDlg(wxWindow* parent, bool running, bool *newMicInFilter, bool *newSpkOutFilter,
+                     wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, title, pos, size, style)
+{
+    m_running = running;
+    m_newMicInFilter = newMicInFilter;
+    m_newSpkOutFilter = newSpkOutFilter;
+
+    this->SetSizeHints(wxDefaultSize, wxDefaultSize);
+
+    wxBoxSizer* bSizer30;
+    bSizer30 = new wxBoxSizer(wxVERTICAL);
+
+    // LPC Post Filter --------------------------------------------------------
+
+    wxStaticBoxSizer* lpcpfs = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("LPC Post Filter")), wxHORIZONTAL);
+
+    wxBoxSizer* left = new wxBoxSizer(wxVERTICAL);
+
+    m_codec2LPCPostFilterEnable = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition,wxDefaultSize, wxCHK_2STATE);
+    left->Add(m_codec2LPCPostFilterEnable);
+
+    m_codec2LPCPostFilterBassBoost = new wxCheckBox(this, wxID_ANY, _("0-1 kHz 3dB Boost"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    left->Add(m_codec2LPCPostFilterBassBoost);
+    lpcpfs->Add(left, 0, wxALL, 5);
+
+    newLPCPFControl(&m_codec2LPCPostFilterBeta, &m_staticTextBeta, lpcpfs, "Beta");
+    newLPCPFControl(&m_codec2LPCPostFilterGamma, &m_staticTextGamma, lpcpfs, "Gamma");
+
+    m_LPCPostFilterDefault = new wxButton(this, wxID_ANY, wxT("Default"));
+    lpcpfs->Add(m_LPCPostFilterDefault, 0, wxALL|wxALIGN_CENTRE_HORIZONTAL|wxALIGN_CENTRE_VERTICAL, 5);
+
+    bSizer30->Add(lpcpfs, 0, wxALL, 0);
+
+    // Speex pre-processor --------------------------------------------------
+
+    wxStaticBoxSizer* sbSizer_speexpp;
+    wxStaticBox *sb_speexpp = new wxStaticBox(this, wxID_ANY, _("Speex Mic Audio Pre-Processor"));
+    sbSizer_speexpp = new wxStaticBoxSizer(sb_speexpp, wxVERTICAL);
+
+    m_ckboxSpeexpp = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sb_speexpp->SetToolTip(_("Enable noise supression, dereverberation, AGC of mic signal"));
+    sbSizer_speexpp->Add(m_ckboxSpeexpp, wxALIGN_LEFT, 2);
+
+    bSizer30->Add(sbSizer_speexpp, 0, wxALL, 0);   
+
+    // EQ Filters -----------------------------------------------------------
+
+    wxStaticBoxSizer* eqMicInSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Mic In Equaliser")), wxVERTICAL);
+    wxBoxSizer* eqMicInSizer1 = new wxBoxSizer(wxHORIZONTAL);
+    wxBoxSizer* eqMicInSizer2 = new wxBoxSizer(wxHORIZONTAL);
+
+    m_MicInBass   = newEQ(eqMicInSizer1, "Bass"  , MAX_FREQ_BASS, disableQ);
+    m_MicInTreble = newEQ(eqMicInSizer1, "Treble", MAX_FREQ_TREBLE, disableQ);
+    eqMicInSizer->Add(eqMicInSizer1);
+
+    m_MicInEnable = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition,wxDefaultSize, wxCHK_2STATE);
+    eqMicInSizer2->Add(m_MicInEnable,0,wxALIGN_CENTRE_VERTICAL|wxRIGHT,10);
+    m_MicInMid    = newEQ(eqMicInSizer2, "Mid"   , MAX_FREQ_DEF, enableQ);
+    m_MicInDefault = new wxButton(this, wxID_ANY, wxT("Default"));
+    eqMicInSizer2->Add(m_MicInDefault,0,wxALIGN_CENTRE_VERTICAL|wxLEFT,20);
+    eqMicInSizer->Add(eqMicInSizer2);
+
+    wxStaticBoxSizer* eqSpkOutSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Speaker Out Equaliser")), wxVERTICAL);
+    wxBoxSizer* eqSpkOutSizer1 = new wxBoxSizer(wxHORIZONTAL);
+    wxBoxSizer* eqSpkOutSizer2 = new wxBoxSizer(wxHORIZONTAL);
+
+    m_SpkOutBass   = newEQ(eqSpkOutSizer1, "Bass"  , MAX_FREQ_BASS, disableQ);
+    m_SpkOutTreble = newEQ(eqSpkOutSizer1, "Treble", MAX_FREQ_TREBLE, disableQ);
+    eqSpkOutSizer->Add(eqSpkOutSizer1);
+
+    m_SpkOutEnable = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition,wxDefaultSize, wxCHK_2STATE);
+    eqSpkOutSizer2->Add(m_SpkOutEnable,0,wxALIGN_CENTRE_VERTICAL|wxRIGHT,10);
+    m_SpkOutMid    = newEQ(eqSpkOutSizer2, "Mid"   , MAX_FREQ_DEF, enableQ);
+    m_SpkOutDefault = new wxButton(this, wxID_ANY, wxT("Default"));
+    eqSpkOutSizer2->Add(m_SpkOutDefault,0,wxALIGN_CENTRE_VERTICAL|wxLEFT,20);
+    eqSpkOutSizer->Add(eqSpkOutSizer2);
+    
+    bSizer30->Add(eqMicInSizer, 0, wxALL, 0);
+    bSizer30->Add(eqSpkOutSizer, 0, wxALL, 0);
+
+    // Storgage for spectrum magnitude plots ------------------------------------
+
+    m_MicInMagdB = new float[F_MAG_N];
+    for(int i=0; i<F_MAG_N; i++)
+        m_MicInMagdB[i] = 0.0;
+
+    m_SpkOutMagdB = new float[F_MAG_N];
+    for(int i=0; i<F_MAG_N; i++)
+        m_SpkOutMagdB[i] = 0.0;
+
+    // Spectrum Plots -----------------------------------------------------------
+
+    long nb_style = wxAUI_NB_BOTTOM | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS;
+    m_auiNotebook = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(-1,200), nb_style);
+    m_auiNotebook->SetFont(wxFont(8, 70, 90, 90, false, wxEmptyString));
+
+    bSizer30->Add(m_auiNotebook, 0, wxEXPAND|wxALL, 3);
+    
+    m_MicInFreqRespPlot = new PlotSpectrum((wxFrame*) m_auiNotebook, m_MicInMagdB, F_MAG_N, FILTER_MIN_MAG_DB, FILTER_MAX_MAG_DB);
+    m_auiNotebook->AddPage(m_MicInFreqRespPlot, _("Microphone In Equaliser"));
+
+    m_SpkOutFreqRespPlot = new PlotSpectrum((wxFrame*)m_auiNotebook, m_SpkOutMagdB, F_MAG_N, FILTER_MIN_MAG_DB, FILTER_MAX_MAG_DB);
+    m_auiNotebook->AddPage(m_SpkOutFreqRespPlot, _("Speaker Out Equaliser"));
+
+    //  OK - Cancel buttons at the bottom --------------------------
+
+    wxBoxSizer* bSizer31 = new wxBoxSizer(wxHORIZONTAL);
+
+    m_sdbSizer5OK = new wxButton(this, wxID_OK);
+    bSizer31->Add(m_sdbSizer5OK, 0, wxALL, 2);
+
+    m_sdbSizer5Cancel = new wxButton(this, wxID_CANCEL);
+    bSizer31->Add(m_sdbSizer5Cancel, 0, wxALL, 2);
+
+    bSizer30->Add(bSizer31, 0, wxALIGN_RIGHT|wxALL, 0);
+
+    this->SetSizer(bSizer30);
+    this->Layout();
+
+    this->Centre(wxBOTH);
+    // Connect Events -------------------------------------------------------
+
+    this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(FilterDlg::OnInitDialog));
+
+    m_codec2LPCPostFilterEnable->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnEnable), NULL, this);
+    m_codec2LPCPostFilterBassBoost->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnBassBoost), NULL, this);
+    m_codec2LPCPostFilterBeta->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnBetaScroll), NULL, this);
+    m_codec2LPCPostFilterGamma->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnGammaScroll), NULL, this);
+    m_LPCPostFilterDefault->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnLPCPostFilterDefault), NULL, this);
+
+    m_ckboxSpeexpp->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnSpeexppEnable), NULL, this);
+
+    m_MicInBass.sliderFreq->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInBassFreqScroll), NULL, this);
+    m_MicInBass.sliderGain->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInBassGainScroll), NULL, this);
+    m_MicInTreble.sliderFreq->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInTrebleFreqScroll), NULL, this);
+    m_MicInTreble.sliderGain->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInTrebleGainScroll), NULL, this);
+    m_MicInMid.sliderFreq->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInMidFreqScroll), NULL, this);
+    m_MicInMid.sliderGain->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInMidGainScroll), NULL, this);
+    m_MicInMid.sliderQ->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInMidQScroll), NULL, this);
+    m_MicInEnable->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnMicInEnable), NULL, this);
+    m_MicInDefault->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnMicInDefault), NULL, this);
+
+    m_SpkOutBass.sliderFreq->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutBassFreqScroll), NULL, this);
+    m_SpkOutBass.sliderGain->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutBassGainScroll), NULL, this);
+    m_SpkOutTreble.sliderFreq->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutTrebleFreqScroll), NULL, this);
+    m_SpkOutTreble.sliderGain->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutTrebleGainScroll), NULL, this);
+    m_SpkOutMid.sliderFreq->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutMidFreqScroll), NULL, this);
+    m_SpkOutMid.sliderGain->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutMidGainScroll), NULL, this);
+    m_SpkOutMid.sliderQ->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutMidQScroll), NULL, this);
+    m_SpkOutEnable->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnSpkOutEnable), NULL, this);
+    m_SpkOutDefault->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnSpkOutDefault), NULL, this);
+
+    m_sdbSizer5Cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnCancel), NULL, this);
+    m_sdbSizer5OK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnOK), NULL, this);
+
+}
+
+//-------------------------------------------------------------------------
+// ~FilterDlg()
+//-------------------------------------------------------------------------
+FilterDlg::~FilterDlg()
+{
+    delete m_MicInMagdB;
+    delete m_SpkOutMagdB;
+
+    // Disconnect Events
+
+    this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(FilterDlg::OnInitDialog));
+
+    m_codec2LPCPostFilterEnable->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnEnable), NULL, this);
+    m_codec2LPCPostFilterBassBoost->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnBassBoost), NULL, this);
+    m_codec2LPCPostFilterBeta->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnBetaScroll), NULL, this);
+    m_codec2LPCPostFilterGamma->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnGammaScroll), NULL, this);
+    m_LPCPostFilterDefault->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnLPCPostFilterDefault), NULL, this);
+
+    m_MicInBass.sliderFreq->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInBassFreqScroll), NULL, this);
+    m_MicInBass.sliderGain->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInBassGainScroll), NULL, this);
+    m_MicInTreble.sliderFreq->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInTrebleFreqScroll), NULL, this);
+    m_MicInTreble.sliderGain->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInTrebleGainScroll), NULL, this);
+    m_MicInMid.sliderFreq->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInMidFreqScroll), NULL, this);
+    m_MicInMid.sliderGain->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInMidGainScroll), NULL, this);
+    m_MicInMid.sliderQ->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnMicInMidQScroll), NULL, this);
+    m_MicInEnable->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnMicInEnable), NULL, this);
+    m_MicInDefault->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnMicInDefault), NULL, this);
+
+    m_SpkOutBass.sliderFreq->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutBassFreqScroll), NULL, this);
+    m_SpkOutBass.sliderGain->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutBassGainScroll), NULL, this);
+    m_SpkOutTreble.sliderFreq->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutTrebleFreqScroll), NULL, this);
+    m_SpkOutTreble.sliderGain->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutTrebleGainScroll), NULL, this);
+    m_SpkOutMid.sliderFreq->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutMidFreqScroll), NULL, this);
+    m_SpkOutMid.sliderGain->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutMidGainScroll), NULL, this);
+    m_SpkOutMid.sliderQ->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnSpkOutMidQScroll), NULL, this);
+    m_SpkOutEnable->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(FilterDlg::OnSpkOutEnable), NULL, this);
+    m_SpkOutDefault->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnSpkOutDefault), NULL, this);
+
+    m_sdbSizer5Cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnCancel), NULL, this);
+    m_sdbSizer5OK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnOK), NULL, this);
+}
+
+void FilterDlg::newLPCPFControl(wxSlider **slider, wxStaticText **stValue, wxSizer *s, wxString controlName)
+{
+    wxBoxSizer *bs = new wxBoxSizer(wxHORIZONTAL);
+
+    wxStaticText* st = new wxStaticText(this, wxID_ANY, controlName, wxDefaultPosition, wxSize(70,-1), wxALIGN_RIGHT);
+    bs->Add(st, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
+
+    *slider = new wxSlider(this, wxID_ANY, 0, 0, SLIDER_MAX, wxDefaultPosition, wxSize(SLIDER_LENGTH,wxDefaultCoord));
+    bs->Add(*slider, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
+
+    *stValue = new wxStaticText(this, wxID_ANY, wxT("0.0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
+    bs->Add(*stValue, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 2);
+
+    s->Add(bs, 0);
+}
+
+void FilterDlg::newEQControl(wxSlider** slider, wxStaticText** value, wxStaticBoxSizer *bs, wxString controlName)
+{
+    wxStaticText* label = new wxStaticText(this, wxID_ANY, controlName, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
+    bs->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 0);
+
+    *slider = new wxSlider(this, wxID_ANY, 0, 0, SLIDER_MAX, wxDefaultPosition, wxSize(SLIDER_LENGTH,wxDefaultCoord));
+    bs->Add(*slider, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
+
+    *value = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(40,-1), wxALIGN_LEFT);
+    bs->Add(*value, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5);
+}
+
+EQ FilterDlg::newEQ(wxSizer *bs, wxString eqName, float maxFreqHz, bool enableQ)
+{
+    EQ eq;
+
+    wxStaticBoxSizer *bsEQ = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, eqName), wxHORIZONTAL);
+
+    newEQControl(&eq.sliderFreq, &eq.valueFreq, bsEQ, "Freq"); 
+    eq.maxFreqHz = maxFreqHz; 
+    eq.sliderFreqId = eq.sliderFreq->GetId();
+
+    newEQControl(&eq.sliderGain, &eq.valueGain, bsEQ, "Gain");
+    if (enableQ)
+        newEQControl(&eq.sliderQ, &eq.valueQ, bsEQ, "Q");
+    else
+        eq.sliderQ = NULL;
+
+    bs->Add(bsEQ);
+
+    return eq;
+}
+
+//-------------------------------------------------------------------------
+// ExchangeData()
+//-------------------------------------------------------------------------
+void FilterDlg::ExchangeData(int inout, bool storePersistent)
+{
+    wxConfigBase *pConfig = wxConfigBase::Get();
+    if(inout == EXCHANGE_DATA_IN)
+    {
+        // LPC Post filter
+
+        m_codec2LPCPostFilterEnable->SetValue(wxGetApp().m_codec2LPCPostFilterEnable);
+        m_codec2LPCPostFilterBassBoost->SetValue(wxGetApp().m_codec2LPCPostFilterBassBoost);
+        m_beta = wxGetApp().m_codec2LPCPostFilterBeta; setBeta();
+        m_gamma = wxGetApp().m_codec2LPCPostFilterGamma; setGamma();
+
+        // Speex Pre-Processor
+
+        m_ckboxSpeexpp->SetValue(wxGetApp().m_speexpp_enable);
+
+        // Mic In Equaliser
+
+        m_MicInBass.freqHz = wxGetApp().m_MicInBassFreqHz; 
+        m_MicInBass.freqHz = limit(m_MicInBass.freqHz, 1.0, MAX_FREQ_BASS);
+        setFreq(&m_MicInBass);
+        m_MicInBass.gaindB = wxGetApp().m_MicInBassGaindB;
+        m_MicInBass.gaindB = limit(m_MicInBass.gaindB, MIN_GAIN, MAX_GAIN);
+        setGain(&m_MicInBass);
+
+        m_MicInTreble.freqHz = wxGetApp().m_MicInTrebleFreqHz;
+        m_MicInTreble.freqHz = limit(m_MicInTreble.freqHz, 1.0, MAX_FREQ_TREBLE);
+        setFreq(&m_MicInTreble);
+        m_MicInTreble.gaindB = wxGetApp().m_MicInTrebleGaindB; 
+        m_MicInTreble.gaindB = limit(m_MicInTreble.gaindB, MIN_GAIN, MAX_GAIN);
+        setGain(&m_MicInTreble);
+
+        m_MicInMid.freqHz = wxGetApp().m_MicInMidFreqHz; 
+        m_MicInMid.freqHz = limit(m_MicInMid.freqHz, 1.0, MAX_FREQ_TREBLE);
+        setFreq(&m_MicInMid);
+        m_MicInMid.gaindB = wxGetApp().m_MicInMidGaindB; 
+        m_MicInMid.gaindB = limit(m_MicInMid.gaindB, MIN_GAIN, MAX_GAIN);
+        setGain(&m_MicInMid);
+        m_MicInMid.Q = wxGetApp().m_MicInMidQ;
+        m_MicInMid.Q = limit(m_MicInMid.Q, pow(10.0,MIN_LOG10_Q), pow(10.0, MAX_LOG10_Q));
+        setQ(&m_MicInMid);
+
+        m_MicInEnable->SetValue(wxGetApp().m_MicInEQEnable);
+
+        plotMicInFilterSpectrum();
+        // Spk Out Equaliser
+
+        m_SpkOutBass.freqHz = wxGetApp().m_SpkOutBassFreqHz;
+        m_SpkOutBass.freqHz = limit(m_SpkOutBass.freqHz, 1.0, MAX_FREQ_BASS);
+        setFreq(&m_SpkOutBass);
+        m_SpkOutBass.gaindB = wxGetApp().m_SpkOutBassGaindB; 
+        m_SpkOutBass.gaindB = limit(m_SpkOutBass.gaindB, MIN_GAIN, MAX_GAIN);
+        setGain(&m_SpkOutBass);
+
+        m_SpkOutTreble.freqHz = wxGetApp().m_SpkOutTrebleFreqHz; 
+        m_SpkOutTreble.freqHz = limit(m_SpkOutTreble.freqHz, 1.0, MAX_FREQ_TREBLE);
+        setFreq(&m_SpkOutTreble);
+        m_SpkOutTreble.gaindB = wxGetApp().m_SpkOutTrebleGaindB; 
+        m_SpkOutTreble.gaindB = limit(m_SpkOutTreble.gaindB, MIN_GAIN, MAX_GAIN);
+        setGain(&m_SpkOutTreble);
+
+        m_SpkOutMid.freqHz = wxGetApp().m_SpkOutMidFreqHz;
+        m_SpkOutMid.freqHz = limit(m_SpkOutMid.freqHz, 1.0, MAX_FREQ_TREBLE);
+        setFreq(&m_SpkOutMid);
+        m_SpkOutMid.gaindB = wxGetApp().m_SpkOutMidGaindB;
+        m_SpkOutMid.gaindB = limit(m_SpkOutMid.gaindB, MIN_GAIN, MAX_GAIN);
+        setGain(&m_SpkOutMid);
+        m_SpkOutMid.Q = wxGetApp().m_SpkOutMidQ;
+        m_SpkOutMid.Q = limit(m_SpkOutMid.Q, pow(10.0,MIN_LOG10_Q), pow(10.0, MAX_LOG10_Q));
+        setQ(&m_SpkOutMid);
+
+        m_SpkOutEnable->SetValue(wxGetApp().m_SpkOutEQEnable);
+
+        plotSpkOutFilterSpectrum();
+    }
+    if(inout == EXCHANGE_DATA_OUT)
+    {
+        // LPC Post filter
+
+        wxGetApp().m_codec2LPCPostFilterEnable     = m_codec2LPCPostFilterEnable->GetValue();
+        wxGetApp().m_codec2LPCPostFilterBassBoost  = m_codec2LPCPostFilterBassBoost->GetValue();
+        wxGetApp().m_codec2LPCPostFilterBeta       = m_beta;
+        wxGetApp().m_codec2LPCPostFilterGamma      = m_gamma;
+
+        // Speex Pre-Processor
+
+        wxGetApp().m_speexpp_enable = m_ckboxSpeexpp->GetValue();
+
+        // Mic In Equaliser
+
+        wxGetApp().m_MicInBassFreqHz = m_MicInBass.freqHz;
+        wxGetApp().m_MicInBassGaindB = m_MicInBass.gaindB;
+
+        wxGetApp().m_MicInTrebleFreqHz = m_MicInTreble.freqHz;
+        wxGetApp().m_MicInTrebleGaindB = m_MicInTreble.gaindB;
+
+        wxGetApp().m_MicInMidFreqHz = m_MicInMid.freqHz;
+        wxGetApp().m_MicInMidGaindB = m_MicInMid.gaindB;
+        wxGetApp().m_MicInMidQ = m_MicInMid.Q;
+
+        // Spk Out Equaliser
+
+        wxGetApp().m_SpkOutBassFreqHz = m_SpkOutBass.freqHz;
+        wxGetApp().m_SpkOutBassGaindB = m_SpkOutBass.gaindB;
+
+        wxGetApp().m_SpkOutTrebleFreqHz = m_SpkOutTreble.freqHz;
+        wxGetApp().m_SpkOutTrebleGaindB = m_SpkOutTreble.gaindB;
+
+        wxGetApp().m_SpkOutMidFreqHz = m_SpkOutMid.freqHz;
+        wxGetApp().m_SpkOutMidGaindB = m_SpkOutMid.gaindB;
+        wxGetApp().m_SpkOutMidQ = m_SpkOutMid.Q;
+
+        if (storePersistent) {
+            pConfig->Write(wxT("/Filter/codec2LPCPostFilterEnable"),     wxGetApp().m_codec2LPCPostFilterEnable);
+            pConfig->Write(wxT("/Filter/codec2LPCPostFilterBassBoost"),  wxGetApp().m_codec2LPCPostFilterBassBoost);
+            pConfig->Write(wxT("/Filter/codec2LPCPostFilterBeta"),       (int)(m_beta*100.0));
+            pConfig->Write(wxT("/Filter/codec2LPCPostFilterGamma"),      (int)(m_gamma*100.0));
+
+            pConfig->Write(wxT("/Filter/speexpp_enable"),                wxGetApp().m_speexpp_enable);
+
+            pConfig->Write(wxT("/Filter/MicInBassFreqHz"), (int)m_MicInBass.freqHz);
+            pConfig->Write(wxT("/Filter/MicInBassGaindB"), (int)(10.0*m_MicInBass.gaindB));
+            pConfig->Write(wxT("/Filter/MicInTrebleFreqHz"), (int)m_MicInTreble.freqHz);
+            pConfig->Write(wxT("/Filter/MicInTrebleGaindB"), (int)(10.0*m_MicInTreble.gaindB));
+            pConfig->Write(wxT("/Filter/MicInMidFreqHz"), (int)m_MicInMid.freqHz);
+            pConfig->Write(wxT("/Filter/MicInMidGaindB"), (int)(10.0*m_MicInMid.gaindB));
+            pConfig->Write(wxT("/Filter/MicInMidQ"), (int)(100.0*m_MicInMid.Q));
+
+            pConfig->Write(wxT("/Filter/SpkOutBassFreqHz"), (int)m_SpkOutBass.freqHz);
+            pConfig->Write(wxT("/Filter/SpkOutBassGaindB"), (int)(10.0*m_SpkOutBass.gaindB));
+            pConfig->Write(wxT("/Filter/SpkOutTrebleFreqHz"), (int)m_SpkOutTreble.freqHz);
+            pConfig->Write(wxT("/Filter/SpkOutTrebleGaindB"), (int)(10.0*m_SpkOutTreble.gaindB));
+            pConfig->Write(wxT("/Filter/SpkOutMidQ"), (int)(100.0*m_SpkOutMid.Q));
+            pConfig->Write(wxT("/Filter/SpkOutMidFreqHz"), (int)m_SpkOutMid.freqHz);
+            pConfig->Write(wxT("/Filter/SpkOutMidGaindB"), (int)(10.0*m_SpkOutMid.gaindB));
+
+            pConfig->Flush();
+        }
+    }
+    delete wxConfigBase::Set((wxConfigBase *) NULL);
+}
+
+float FilterDlg::limit(float value, float min, float max) {
+    if (value < min) return min;
+    if (value > max) return max;
+    return value;
+}
+
+//-------------------------------------------------------------------------
+// OnCancel()
+//-------------------------------------------------------------------------
+void FilterDlg::OnCancel(wxCommandEvent& event)
+{
+    this->EndModal(wxID_CANCEL);
+}
+
+//-------------------------------------------------------------------------
+// OnDefault()
+//-------------------------------------------------------------------------
+
+void FilterDlg::OnLPCPostFilterDefault(wxCommandEvent& event)
+{
+    m_beta = CODEC2_LPC_PF_BETA; setBeta();
+    m_gamma = CODEC2_LPC_PF_GAMMA; setGamma();
+    m_codec2LPCPostFilterEnable->SetValue(true);
+    m_codec2LPCPostFilterBassBoost->SetValue(true);
+}
+
+void FilterDlg::OnMicInDefault(wxCommandEvent& event)
+{
+    m_MicInBass.freqHz = 100.0;
+    m_MicInBass.gaindB = 0.0;
+    setFreq(&m_MicInBass); setGain(&m_MicInBass); 
+
+    m_MicInTreble.freqHz = 3000.0;
+    m_MicInTreble.gaindB = 0.0;
+    setFreq(&m_MicInTreble); setGain(&m_MicInTreble); 
+
+    m_MicInMid.freqHz = 1500.0;
+    m_MicInMid.gaindB = 0.0;
+    m_MicInMid.Q = 1.0;
+    setFreq(&m_MicInMid); setGain(&m_MicInMid); setQ(&m_MicInMid); 
+
+    plotMicInFilterSpectrum();    
+}
+
+void FilterDlg::OnSpkOutDefault(wxCommandEvent& event)
+{
+    m_SpkOutBass.freqHz = 100.0;
+    m_SpkOutBass.gaindB = 0.0;
+    setFreq(&m_SpkOutBass); setGain(&m_SpkOutBass); 
+
+    m_SpkOutTreble.freqHz = 3000.0;
+    m_SpkOutTreble.gaindB = 0.0;
+    setFreq(&m_SpkOutTreble); setGain(&m_SpkOutTreble); 
+
+    m_SpkOutMid.freqHz = 1500.0;
+    m_SpkOutMid.gaindB = 0.0;
+    m_SpkOutMid.Q = 1.0;
+    setFreq(&m_SpkOutMid); setGain(&m_SpkOutMid); setQ(&m_SpkOutMid); 
+
+    plotSpkOutFilterSpectrum();    
+}
+
+//-------------------------------------------------------------------------
+// OnOK()
+//-------------------------------------------------------------------------
+void FilterDlg::OnOK(wxCommandEvent& event)
+{
+    //printf("FilterDlg::OnOK\n");
+    ExchangeData(EXCHANGE_DATA_OUT, true);
+    this->EndModal(wxID_OK);
+}
+
+//-------------------------------------------------------------------------
+// OnClose()
+//-------------------------------------------------------------------------
+void FilterDlg::OnClose(wxCloseEvent& event)
+{
+    this->EndModal(wxID_OK);
+}
+
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//-------------------------------------------------------------------------
+void FilterDlg::OnInitDialog(wxInitDialogEvent& event)
+{
+    //printf("FilterDlg::OnInitDialog\n");
+    ExchangeData(EXCHANGE_DATA_IN, false);
+    //printf("m_beta: %f\n", m_beta);
+}
+
+void FilterDlg::setBeta(void) {
+    wxString buf;
+    buf.Printf(wxT("%3.2f"), m_beta);
+    m_staticTextBeta->SetLabel(buf);
+    int slider = (int)(m_beta*SLIDER_MAX + 0.5);
+    m_codec2LPCPostFilterBeta->SetValue(slider);
+}
+
+void FilterDlg::setCodec2(void) {
+    if (m_running) {
+        assert(g_pfreedv->codec2 != NULL);
+        codec2_set_lpc_post_filter(g_pfreedv->codec2, 
+                               m_codec2LPCPostFilterEnable->GetValue(), 
+                               m_codec2LPCPostFilterBassBoost->GetValue(), 
+                               m_beta, m_gamma);
+    }
+}
+
+void FilterDlg::setGamma(void) {
+    wxString buf;
+    buf.Printf(wxT("%3.2f"), m_gamma);
+    m_staticTextGamma->SetLabel(buf);
+    int slider = (int)(m_gamma*SLIDER_MAX + 0.5);
+    m_codec2LPCPostFilterGamma->SetValue(slider);
+}
+
+void FilterDlg::OnEnable(wxScrollEvent& event) {
+    setCodec2();    
+}
+
+void FilterDlg::OnBassBoost(wxScrollEvent& event) {
+    setCodec2();    
+}
+
+void FilterDlg::OnBetaScroll(wxScrollEvent& event) {
+    m_beta = (float)m_codec2LPCPostFilterBeta->GetValue()/SLIDER_MAX;
+    setBeta();
+    setCodec2();
+}
+
+void FilterDlg::OnGammaScroll(wxScrollEvent& event) {
+    m_gamma = (float)m_codec2LPCPostFilterGamma->GetValue()/SLIDER_MAX;
+    setGamma();
+    setCodec2();
+}
+
+// immediately change enable flags rather using ExchangeData() so we can switch on and off at run time
+
+void FilterDlg::OnSpeexppEnable(wxScrollEvent& event) {
+    wxGetApp().m_speexpp_enable = m_ckboxSpeexpp->GetValue();
+}
+
+void FilterDlg::OnMicInEnable(wxScrollEvent& event) {
+    wxGetApp().m_MicInEQEnable = m_MicInEnable->GetValue();
+}
+
+void FilterDlg::OnSpkOutEnable(wxScrollEvent& event) {
+    wxGetApp().m_SpkOutEQEnable = m_SpkOutEnable->GetValue();
+    //printf("wxGetApp().m_SpkOutEQEnable: %d\n", wxGetApp().m_SpkOutEQEnable);
+}
+
+void FilterDlg::setFreq(EQ *eq)
+{
+    wxString buf;
+    buf.Printf(wxT("%3.0f"), eq->freqHz);
+    eq->valueFreq->SetLabel(buf);
+    int slider = (int)((eq->freqHz/eq->maxFreqHz)*SLIDER_MAX + 0.5);
+    eq->sliderFreq->SetValue(slider);
+}
+
+void FilterDlg::sliderToFreq(EQ *eq, bool micIn)
+{
+    eq->freqHz = ((float)eq->sliderFreq->GetValue()/SLIDER_MAX)*eq->maxFreqHz;
+    if (eq->freqHz < 1.0) eq->freqHz = 1.0; // sox doesn't like 0 Hz;
+    setFreq(eq);
+    if (micIn) {
+        plotMicInFilterSpectrum();
+        adjRunTimeMicInFilter();
+    }
+    else {
+        plotSpkOutFilterSpectrum();
+        adjRunTimeSpkOutFilter();
+    }
+}
+
+void FilterDlg::setGain(EQ *eq)
+{
+    wxString buf;
+    buf.Printf(wxT("%3.1f"), eq->gaindB);
+    eq->valueGain->SetLabel(buf);
+    int slider = (int)(((eq->gaindB-MIN_GAIN)/(MAX_GAIN-MIN_GAIN))*SLIDER_MAX + 0.5);
+    eq->sliderGain->SetValue(slider);
+}
+
+void FilterDlg::sliderToGain(EQ *eq, bool micIn)
+{
+    float range = MAX_GAIN-MIN_GAIN;
+    
+    eq->gaindB = MIN_GAIN + range*((float)eq->sliderGain->GetValue()/SLIDER_MAX);
+    //printf("gaindB: %f\n", eq->gaindB);
+    setGain(eq);
+    if (micIn) {
+        plotMicInFilterSpectrum();
+        adjRunTimeMicInFilter();
+    }
+    else {
+        plotSpkOutFilterSpectrum();
+        adjRunTimeSpkOutFilter();
+    }
+        
+}
+
+void FilterDlg::setQ(EQ *eq)
+{
+    wxString buf;
+    buf.Printf(wxT("%2.1f"), eq->Q);
+    eq->valueQ->SetLabel(buf);
+
+    float log10_range = MAX_LOG10_Q - MIN_LOG10_Q;
+
+    int slider = (int)(((log10(eq->Q+1E-6)-MIN_LOG10_Q)/log10_range)*SLIDER_MAX + 0.5);
+    eq->sliderQ->SetValue(slider);
+}
+
+void FilterDlg::sliderToQ(EQ *eq, bool micIn)
+{
+    float log10_range = MAX_LOG10_Q - MIN_LOG10_Q;
+    
+    float sliderNorm = (float)eq->sliderQ->GetValue()/SLIDER_MAX;
+    float log10Q =  MIN_LOG10_Q + sliderNorm*(log10_range);
+    eq->Q = pow(10.0, log10Q);
+    //printf("log10Q: %f eq->Q: %f\n", log10Q, eq->Q);
+    setQ(eq);
+    if (micIn) {
+        plotMicInFilterSpectrum();
+        adjRunTimeMicInFilter();
+    }
+    else {
+        plotSpkOutFilterSpectrum();
+        adjRunTimeSpkOutFilter();
+    }
+}
+
+void FilterDlg::plotMicInFilterSpectrum(void) {
+    plotFilterSpectrum(&m_MicInBass, &m_MicInMid, &m_MicInTreble, m_MicInFreqRespPlot, m_MicInMagdB);
+}
+
+void FilterDlg::plotSpkOutFilterSpectrum(void) {
+    plotFilterSpectrum(&m_SpkOutBass, &m_SpkOutMid, &m_SpkOutTreble, m_SpkOutFreqRespPlot, m_SpkOutMagdB);
+}
+
+void FilterDlg::adjRunTimeMicInFilter(void) {
+    // signal an adjustment in running filter coeffs
+
+    if (m_running) {
+        ExchangeData(EXCHANGE_DATA_OUT, false);
+        *m_newMicInFilter = true;
+    }
+}
+        
+void FilterDlg::adjRunTimeSpkOutFilter(void) {
+    // signal an adjustment in running filter coeffs
+
+    if (m_running) {
+        ExchangeData(EXCHANGE_DATA_OUT, false);
+        *m_newSpkOutFilter = true;
+    }
+}
+        
+
+void FilterDlg::plotFilterSpectrum(EQ *eqBass, EQ *eqMid, EQ *eqTreble, PlotSpectrum* freqRespPlot, float *magdB) {
+    char  *argBass[10];
+    char  *argTreble[10];
+    char  *argMid[10];
+    char   argstorage[10][80];
+    float magBass[F_MAG_N];
+    float magTreble[F_MAG_N];
+    float magMid[F_MAG_N];
+    int   i;
+
+    for(i=0; i<10; i++) {
+        argBass[i] = &argstorage[i][0];
+        argTreble[i] = &argstorage[i][0];
+        argMid[i] = &argstorage[i][0];
+    }
+    sprintf(argBass[0], "bass");                
+    sprintf(argBass[1], "%f", eqBass->gaindB+1E-6);
+    sprintf(argBass[2], "%f", eqBass->freqHz);      
+
+    calcFilterSpectrum(magBass, 2, argBass);
+
+    sprintf(argTreble[0], "treble");                
+    sprintf(argTreble[1], "%f", eqTreble->gaindB+1E-6);
+    sprintf(argTreble[2], "%f", eqTreble->freqHz);      
+
+    calcFilterSpectrum(magTreble, 2, argTreble);
+
+    sprintf(argTreble[0], "equalizer");                
+    sprintf(argTreble[1], "%f", eqMid->freqHz);      
+    sprintf(argTreble[2], "%f", eqMid->Q);      
+    sprintf(argTreble[3], "%f", eqMid->gaindB+1E-6);
+
+    calcFilterSpectrum(magMid, 3, argMid);
+
+    for(i=0; i<F_MAG_N; i++)
+        magdB[i] = magBass[i] + magMid[i] + magTreble[i];
+    freqRespPlot->m_newdata = true;
+    freqRespPlot->Refresh();
+}
+
+void FilterDlg::calcFilterSpectrum(float magdB[], int argc, char *argv[]) {
+    void       *sbq;
+    short       in[NIMP];
+    short       out[NIMP];
+    COMP        X[F_MAG_N];
+    float       f, w;
+    int         i, k;
+
+    // find impulse response -----------------------------------
+
+    for(i=0; i<NIMP; i++)
+        in[i] = 0;
+    in[0] = IMP_AMP;
+
+    //printf("argv[0]: %s argv[1]: %s\n", argv[0], argv[1]);
+    sbq = sox_biquad_create(argc, (const char **)argv);
+
+    sox_biquad_filter(sbq, out, in, NIMP);
+    //for(i=0; i<NIMP; i++)
+    //    printf("%d\n", out[i]);
+   
+    sox_biquad_destroy(sbq);
+
+    //for(i=0; i<NIMP; i++)
+    //    out[i] = 0.0;
+    //out[0] = IMP_AMP;
+
+    // calculate discrete time continous frequency Fourer transform
+    // doing this from first principles rather than FFT for no good reason
+
+    for(f=0,i=0; f<MAX_F_HZ; f+=F_STEP_DFT,i++) {
+        w = M_PI*f/(FS/2);
+        X[i].real = 0.0; X[i].imag = 0.0;
+        for(k=0; k<NIMP; k++) {
+            X[i].real += ((float)out[k]/IMP_AMP) * cos(w*k);
+            X[i].imag -= ((float)out[k]/IMP_AMP) * sin(w*k);
+        }
+        magdB[i] = 10.0*log10(X[i].real* X[i].real + X[i].imag*X[i].imag + 1E-12);
+        //printf("f: %f X[%d] = %f %f magdB = %f\n", f, i, X[i].real, X[i].imag,  magdB[i]);
+    }
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_filter.h b/fdmdv2/tags/0.99-Beta/src/dlg_filter.h
new file mode 100644 (file)
index 0000000..82c43df
--- /dev/null
@@ -0,0 +1,166 @@
+//==========================================================================
+// Name:            dlg_filter.h
+// Purpose:         Dialog for controlling Codec audio filtering
+// Created:         Nov 25 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#ifndef __FILTER_DIALOG__
+#define __FILTER_DIALOG__
+
+#include "fdmdv2_main.h"
+
+enum {disableQ = false, enableQ = true};
+
+typedef struct { 
+    wxSlider     *sliderFreq;
+    wxStaticText *valueFreq;
+    wxSlider     *sliderGain;
+    wxStaticText *valueGain;
+    wxSlider     *sliderQ;
+    wxStaticText *valueQ;
+
+    int       sliderFreqId;
+    int       sliderGainId;
+    int       sliderQId;
+    
+    float     freqHz;
+    float     gaindB;
+    float     Q;
+
+    float     maxFreqHz;
+} EQ;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class FilterDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class FilterDlg : public wxDialog
+{
+    public:
+    FilterDlg( wxWindow* parent, bool running, bool *newMicInFilter, bool *newSpkOutFilter,
+               wxWindowID id = wxID_ANY, const wxString& title = _("Filter"), 
+               const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800, 630 ), 
+               long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+        ~FilterDlg();
+
+        void    ExchangeData(int inout, bool storePersistent);
+
+    protected:
+        // Handlers for events.
+        void    OnCancel(wxCommandEvent& event);
+        void    OnOK(wxCommandEvent& event);
+        void    OnClose(wxCloseEvent& event);
+        void    OnInitDialog(wxInitDialogEvent& event);
+        void    OnLPCPostFilterDefault(wxCommandEvent& event);
+
+        void    OnBetaScroll(wxScrollEvent& event);
+        void    OnGammaScroll(wxScrollEvent& event);
+        void    OnEnable(wxScrollEvent& event);
+        void    OnBassBoost(wxScrollEvent& event);
+
+        void    OnSpeexppEnable(wxScrollEvent& event);
+
+        void    OnMicInBassFreqScroll(wxScrollEvent& event) { sliderToFreq(&m_MicInBass, true); }
+        void    OnMicInBassGainScroll(wxScrollEvent& event) { sliderToGain(&m_MicInBass, true); }
+        void    OnMicInTrebleFreqScroll(wxScrollEvent& event) { sliderToFreq(&m_MicInTreble, true); }
+        void    OnMicInTrebleGainScroll(wxScrollEvent& event) { sliderToGain(&m_MicInTreble, true); }
+        void    OnMicInMidFreqScroll(wxScrollEvent& event) { sliderToFreq(&m_MicInMid, true); }
+        void    OnMicInMidGainScroll(wxScrollEvent& event) { sliderToGain(&m_MicInMid, true); }
+        void    OnMicInMidQScroll(wxScrollEvent& event) { sliderToQ(&m_MicInMid, true); }
+        void    OnMicInEnable(wxScrollEvent& event);
+        void    OnMicInDefault(wxCommandEvent& event);
+
+        void    OnSpkOutBassFreqScroll(wxScrollEvent& event) { sliderToFreq(&m_SpkOutBass, false); }
+        void    OnSpkOutBassGainScroll(wxScrollEvent& event) { sliderToGain(&m_SpkOutBass, false); }
+        void    OnSpkOutTrebleFreqScroll(wxScrollEvent& event) { sliderToFreq(&m_SpkOutTreble, false); }
+        void    OnSpkOutTrebleGainScroll(wxScrollEvent& event) { sliderToGain(&m_SpkOutTreble, false); }
+        void    OnSpkOutMidFreqScroll(wxScrollEvent& event) { sliderToFreq(&m_SpkOutMid, false); }
+        void    OnSpkOutMidGainScroll(wxScrollEvent& event) { sliderToGain(&m_SpkOutMid, false); }
+        void    OnSpkOutMidQScroll(wxScrollEvent& event) { sliderToQ(&m_SpkOutMid, false); }
+        void    OnSpkOutEnable(wxScrollEvent& event);
+        void    OnSpkOutDefault(wxCommandEvent& event);
+
+        wxStaticText* m_staticText8;
+        wxCheckBox*   m_codec2LPCPostFilterEnable;
+        wxStaticText* m_staticText9;
+        wxCheckBox*   m_codec2LPCPostFilterBassBoost;
+        wxStaticText* m_staticText91;
+        wxSlider*     m_codec2LPCPostFilterBeta;
+        wxStaticText* m_staticTextBeta;
+        wxStaticText* m_staticText911;
+        wxSlider*     m_codec2LPCPostFilterGamma;
+        wxStaticText* m_staticTextGamma;
+        wxButton*     m_LPCPostFilterDefault;
+
+        wxCheckBox*   m_ckboxSpeexpp;
+
+        wxStdDialogButtonSizer* m_sdbSizer5;
+        wxButton*     m_sdbSizer5OK;
+        wxButton*     m_sdbSizer5Cancel;
+        PlotSpectrum* m_MicInFreqRespPlot;
+        PlotSpectrum* m_SpkOutFreqRespPlot;
+        
+        wxCheckBox*   m_MicInEnable;
+        wxButton*     m_MicInDefault;
+        wxCheckBox*   m_SpkOutEnable;
+        wxButton*     m_SpkOutDefault;
+
+        float        *m_MicInMagdB;
+        float        *m_SpkOutMagdB;
+
+     private:
+        bool          m_running;
+        float         m_beta;
+        float         m_gamma;
+
+        void          setBeta(void);  // sets slider and static text from m_beta
+        void          setGamma(void); // sets slider and static text from m_gamma
+        void          setCodec2(void);
+        void          newEQControl(wxSlider** slider, wxStaticText** value, wxStaticBoxSizer *bs, wxString controlName);
+        EQ            newEQ(wxSizer *bs, wxString eqName, float maxFreqHz, bool enableQ);
+        void          newLPCPFControl(wxSlider **slider, wxStaticText **stValue, wxSizer *sbs, wxString controlName);
+        wxAuiNotebook *m_auiNotebook;
+        void          setFreq(EQ *eq);
+        void          setGain(EQ *eq);
+        void          setQ(EQ *eq);
+        void          sliderToFreq(EQ *eq, bool micIn);
+        void          sliderToGain(EQ *eq, bool micIn);
+        void          sliderToQ(EQ *eq, bool micIn);
+        void          plotFilterSpectrum(EQ *eqBass, EQ *eqMid, EQ* eqTreble, PlotSpectrum* freqRespPlot, float *magdB);
+        void          calcFilterSpectrum(float magdB[], int arc, char *argv[]);
+        void          plotMicInFilterSpectrum(void);
+        void          plotSpkOutFilterSpectrum(void);
+        void          adjRunTimeMicInFilter(void);
+        void          adjRunTimeSpkOutFilter(void);
+
+        EQ            m_MicInBass;
+        EQ            m_MicInMid;
+        EQ            m_MicInTreble;
+
+        EQ            m_SpkOutBass;
+        EQ            m_SpkOutMid;
+        EQ            m_SpkOutTreble;
+
+        float         limit(float value, float min, float max);
+        bool          *m_newMicInFilter;
+        bool          *m_newSpkOutFilter;
+
+};
+
+#endif // __FILTER_DIALOG__
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_options.cpp b/fdmdv2/tags/0.99-Beta/src/dlg_options.cpp
new file mode 100644 (file)
index 0000000..9189feb
--- /dev/null
@@ -0,0 +1,363 @@
+//==========================================================================
+// Name:            dlg_options.cpp
+// Purpose:         Dialog for controlling misc FreeDV options
+// Date:            May 24 2013
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#include "dlg_options.h"
+extern bool g_modal;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class OptionsDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, title, pos, size, style)
+{
+
+    this->SetSizeHints(wxDefaultSize, wxDefaultSize);
+
+    wxBoxSizer* bSizer30;
+    bSizer30 = new wxBoxSizer(wxVERTICAL);
+
+    //------------------------------
+    // Test Frames check box
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_testFrames;
+    wxStaticBox *sb_testFrames = new wxStaticBox(this, wxID_ANY, _("Test Frames"));
+    sbSizer_testFrames = new wxStaticBoxSizer(sb_testFrames, wxHORIZONTAL);
+
+    m_ckboxTestFrame = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    m_ckboxTestFrame->SetToolTip(_("Send frames of known bits instead of compressed voice"));
+    sbSizer_testFrames->Add(m_ckboxTestFrame, 0, wxALIGN_LEFT, 0);
+
+    m_ckboxChannelNoise = new wxCheckBox(this, wxID_ANY, _("Channel Noise"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    m_ckboxChannelNoise->SetToolTip(_("Add simulated AWGN channel noise to received signal"));
+    sbSizer_testFrames->Add(m_ckboxChannelNoise, 0, wxALIGN_LEFT, 0);
+
+    bSizer30->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    //------------------------------
+    // FreeDV 700 Options
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_freedv700;
+    wxStaticBox *sb_freedv700 = new wxStaticBox(this, wxID_ANY, _("FreeDV 700 Clipping"));
+    sbSizer_freedv700 = new wxStaticBoxSizer(sb_freedv700, wxHORIZONTAL);
+
+    m_ckboxFreeDV700txClip = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    m_ckboxFreeDV700txClip->SetToolTip(_("Clip FreeDv 700 tx waveform to reduce Peak to Average Power Ratio (PAPR)"));
+    sbSizer_freedv700->Add(m_ckboxFreeDV700txClip, 0, wxALIGN_LEFT, 0);
+
+    bSizer30->Add(sbSizer_freedv700,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    //------------------------------
+    // Txt Msg Text Box
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_callSign;
+    wxStaticBox *sb_textMsg = new wxStaticBox(this, wxID_ANY, _("Txt Msg"));
+    sbSizer_callSign = new wxStaticBoxSizer(sb_textMsg, wxVERTICAL);
+
+    m_txtCtrlCallSign = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    m_txtCtrlCallSign->SetToolTip(_("Txt Msg you can send along with Voice"));
+    sbSizer_callSign->Add(m_txtCtrlCallSign, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3);
+
+    bSizer30->Add(sbSizer_callSign,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+    //------------------------------
+    // Txt Encoding 
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_encoding = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Text Encoding")), wxHORIZONTAL);
+
+#ifdef SHORT_VARICODE
+    m_rb_textEncoding1 = new wxRadioButton( this, wxID_ANY, wxT("Long varicode"), wxDefaultPosition, wxDefaultSize, 0);
+    m_rb_textEncoding1->SetValue(true);
+    sbSizer_encoding->Add(m_rb_textEncoding1, 0, wxALIGN_LEFT|wxALL, 1);
+    m_rb_textEncoding2 = new wxRadioButton( this, wxID_ANY, wxT("Short Varicode"), wxDefaultPosition, wxDefaultSize, 0);
+    sbSizer_encoding->Add(m_rb_textEncoding2, 0, wxALIGN_LEFT|wxALL, 1);
+#endif
+
+    m_ckboxEnableChecksum = new wxCheckBox(this, wxID_ANY, _("Use Checksum on Rx"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sbSizer_encoding->Add(m_ckboxEnableChecksum, 0, wxALIGN_LEFT, 0);
+
+    bSizer30->Add(sbSizer_encoding,0, wxALL|wxEXPAND, 3);
+    //------------------------------
+    // Event processing
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_events;
+    wxStaticBox *sb_events = new wxStaticBox(this, wxID_ANY, _("Event Processing"));
+    sbSizer_events = new wxStaticBoxSizer(sb_events, wxVERTICAL);
+
+    // event processing enable and spam timer
+
+    wxStaticBoxSizer* sbSizer_events_top;
+    wxStaticBox* sb_events1 = new wxStaticBox(this, wxID_ANY, _(""));    
+    sbSizer_events_top = new wxStaticBoxSizer(sb_events1, wxHORIZONTAL);
+
+    m_ckbox_events = new wxCheckBox(this, wxID_ANY, _("Enable System Calls    Syscall Spam Timer"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sb_events->SetToolTip(_("Enable processing of events and generation of system calls"));
+    sbSizer_events_top->Add(m_ckbox_events, 0, 0, 5);
+    m_txt_spam_timer = new wxTextCtrl(this, wxID_ANY,  wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0, wxTextValidator(wxFILTER_DIGITS));
+    m_txt_spam_timer->SetToolTip(_("Many matching events can cause a flood of syscalls. Set minimum time (seconds) between syscalls for each event here"));
+    sbSizer_events_top->Add(m_txt_spam_timer, 0, 0, 5);
+    m_rb_spam_timer = new wxRadioButton( this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+    m_rb_spam_timer->SetForegroundColour( wxColour(0, 255, 0 ) );
+    sbSizer_events_top->Add(m_rb_spam_timer, 0, 0, 10);
+    sbSizer_events->Add(sbSizer_events_top, 0, 0, 5);
+
+    // list of regexps
+
+    wxStaticBoxSizer* sbSizer_regexp = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Regular Expressions to Process Events")), wxHORIZONTAL);
+    m_txt_events_regexp_match = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,100), wxTE_MULTILINE);
+    m_txt_events_regexp_match->SetToolTip(_("Enter regular expressions to match events"));
+    sbSizer_regexp->Add(m_txt_events_regexp_match, 1, wxEXPAND, 5);
+    m_txt_events_regexp_replace = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,100), wxTE_MULTILINE);
+    m_txt_events_regexp_replace->SetToolTip(_("Enter regular expressions to replace events"));
+    sbSizer_regexp->Add(m_txt_events_regexp_replace, 1, wxEXPAND, 5);
+    sbSizer_events->Add(sbSizer_regexp, 1, wxEXPAND, 5);
+
+    // log of events and responses
+
+    wxStaticBoxSizer* sbSizer_event_log = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Log of Events and Responses")), wxVERTICAL);
+    wxBoxSizer* bSizer33 = new wxBoxSizer(wxHORIZONTAL);
+    m_txt_events_in = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,50), wxTE_MULTILINE | wxTE_READONLY);
+    bSizer33->Add(m_txt_events_in, 1, wxEXPAND, 5);
+    m_txt_events_out = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,50), wxTE_MULTILINE | wxTE_READONLY);
+    bSizer33->Add(m_txt_events_out, 1, wxEXPAND, 5);
+    sbSizer_event_log->Add(bSizer33, 1, wxEXPAND, 5);
+    sbSizer_events->Add(sbSizer_event_log, 1, wxEXPAND, 5);
+
+    bSizer30->Add(sbSizer_events,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    //------------------------------
+    // UDP control port
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_udp;
+    wxStaticBox* sb_udp = new wxStaticBox(this, wxID_ANY, _("UDP Control Port"));
+    sbSizer_udp = new wxStaticBoxSizer(sb_udp, wxHORIZONTAL);
+    m_ckbox_udp_enable = new wxCheckBox(this, wxID_ANY, _("Enable UDP Control Port    UDP Port Number:"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sb_udp->SetToolTip(_("Enable control of FreeDV via UDP port"));
+    sbSizer_udp->Add(m_ckbox_udp_enable, 0,  wxALIGN_CENTER_HORIZONTAL, 5);
+    m_txt_udp_port = new wxTextCtrl(this, wxID_ANY,  wxEmptyString, wxDefaultPosition, wxSize(50,-1), 0, wxTextValidator(wxFILTER_DIGITS));
+    sbSizer_udp->Add(m_txt_udp_port, 0, wxALIGN_CENTER_HORIZONTAL, 5);
+
+    bSizer30->Add(sbSizer_udp,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    //------------------------------
+    // OK - Cancel - Apply Buttons 
+    //------------------------------
+
+    wxBoxSizer* bSizer31 = new wxBoxSizer(wxHORIZONTAL);
+
+    m_sdbSizer5OK = new wxButton(this, wxID_OK);
+    bSizer31->Add(m_sdbSizer5OK, 0, wxALL, 2);
+
+    m_sdbSizer5Cancel = new wxButton(this, wxID_CANCEL);
+    bSizer31->Add(m_sdbSizer5Cancel, 0, wxALL, 2);
+
+    m_sdbSizer5Apply = new wxButton(this, wxID_APPLY);
+    bSizer31->Add(m_sdbSizer5Apply, 0, wxALL, 2);
+
+    bSizer30->Add(bSizer31, 0, wxALIGN_RIGHT|wxALL, 0);
+
+    this->SetSizer(bSizer30);
+    this->Layout();
+
+    this->Centre(wxBOTH);
+    // Connect Events -------------------------------------------------------
+
+    this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(OptionsDlg::OnInitDialog));
+
+    m_sdbSizer5OK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnOK), NULL, this);
+    m_sdbSizer5Cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnCancel), NULL, this);
+    m_sdbSizer5Apply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnApply), NULL, this);
+
+    m_ckboxFreeDV700txClip->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
+
+    event_in_serial = 0;
+    event_out_serial = 0;
+}
+
+//-------------------------------------------------------------------------
+// ~OptionsDlg()
+//-------------------------------------------------------------------------
+OptionsDlg::~OptionsDlg()
+{
+
+    // Disconnect Events
+
+    this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(OptionsDlg::OnInitDialog));
+
+    m_sdbSizer5OK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnOK), NULL, this);
+    m_sdbSizer5Cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnCancel), NULL, this);
+    m_sdbSizer5Apply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnApply), NULL, this);
+    m_ckboxFreeDV700txClip->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
+}
+
+
+//-------------------------------------------------------------------------
+// ExchangeData()
+//-------------------------------------------------------------------------
+void OptionsDlg::ExchangeData(int inout, bool storePersistent)
+{
+    wxConfigBase *pConfig = wxConfigBase::Get();
+
+    if(inout == EXCHANGE_DATA_IN)
+    {
+        m_txtCtrlCallSign->SetValue(wxGetApp().m_callSign);
+        m_ckboxTestFrame->SetValue(wxGetApp().m_testFrames);
+        m_ckboxChannelNoise->SetValue(wxGetApp().m_channel_noise);
+
+        m_ckbox_events->SetValue(wxGetApp().m_events);
+        m_txt_spam_timer->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_events_spam_timer));
+
+        m_txt_events_regexp_match->SetValue(wxGetApp().m_events_regexp_match);
+        m_txt_events_regexp_replace->SetValue(wxGetApp().m_events_regexp_replace);
+        
+        m_ckbox_udp_enable->SetValue(wxGetApp().m_udp_enable);
+        m_txt_udp_port->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_udp_port));
+
+#ifdef SHORT_VARICODE
+        if (wxGetApp().m_textEncoding == 1)
+            m_rb_textEncoding1->SetValue(true);
+        if (wxGetApp().m_textEncoding == 2)
+            m_rb_textEncoding2->SetValue(true);
+#endif
+        m_ckboxEnableChecksum->SetValue(wxGetApp().m_enable_checksum);
+
+        m_ckboxFreeDV700txClip->SetValue(wxGetApp().m_FreeDV700txClip);
+    }
+
+    if(inout == EXCHANGE_DATA_OUT)
+    {
+        wxGetApp().m_callSign      = m_txtCtrlCallSign->GetValue();
+        wxGetApp().m_testFrames    = m_ckboxTestFrame->GetValue();
+        wxGetApp().m_channel_noise = m_ckboxChannelNoise->GetValue();
+
+        wxGetApp().m_events        = m_ckbox_events->GetValue();
+        long spam_timer;
+        m_txt_spam_timer->GetValue().ToLong(&spam_timer);
+        wxGetApp().m_events_spam_timer = (int)spam_timer;
+
+        // make sure regexp lists are terminated by a \n
+
+        if (m_txt_events_regexp_match->GetValue().Last() != '\n') {
+            m_txt_events_regexp_match->SetValue(m_txt_events_regexp_match->GetValue()+'\n');
+        }
+        if (m_txt_events_regexp_replace->GetValue().Last() != '\n') {
+            m_txt_events_regexp_replace->SetValue(m_txt_events_regexp_replace->GetValue()+'\n');
+        }
+        wxGetApp().m_events_regexp_match = m_txt_events_regexp_match->GetValue();
+        wxGetApp().m_events_regexp_replace = m_txt_events_regexp_replace->GetValue();
+        wxGetApp().m_udp_enable     = m_ckbox_udp_enable->GetValue();
+        long port;
+        m_txt_udp_port->GetValue().ToLong(&port);
+        wxGetApp().m_udp_port       = (int)port;
+
+#ifdef SHORT_VARICODE
+        if (m_rb_textEncoding1->GetValue())
+            wxGetApp().m_textEncoding = 1;
+        if (m_rb_textEncoding2->GetValue())
+            wxGetApp().m_textEncoding = 2;
+#endif
+        wxGetApp().m_enable_checksum = m_ckboxEnableChecksum->GetValue();
+
+        wxGetApp().m_FreeDV700txClip = m_ckboxFreeDV700txClip->GetValue();
+
+        if (storePersistent) {
+            pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
+#ifdef SHORT_VARICODE
+            pConfig->Write(wxT("/Data/TextEncoding"), wxGetApp().m_textEncoding);
+#endif
+            pConfig->Write(wxT("/Data/EnableChecksumOnMsgRx"), wxGetApp().m_enable_checksum);
+
+            pConfig->Write(wxT("/Events/enable"), wxGetApp().m_events);
+            pConfig->Write(wxT("/Events/spam_timer"), wxGetApp().m_events_spam_timer);
+            pConfig->Write(wxT("/Events/regexp_match"), wxGetApp().m_events_regexp_match);
+            pConfig->Write(wxT("/Events/regexp_replace"), wxGetApp().m_events_regexp_replace);
+            
+            pConfig->Write(wxT("/UDP/enable"), wxGetApp().m_udp_enable);
+            pConfig->Write(wxT("/UDP/port"),  wxGetApp().m_udp_port);
+
+            pConfig->Write(wxT("/FreeDV700/txClip"), wxGetApp().m_FreeDV700txClip);
+
+            pConfig->Flush();
+        }
+    }
+    delete wxConfigBase::Set((wxConfigBase *) NULL);
+}
+
+//-------------------------------------------------------------------------
+// OnOK()
+//-------------------------------------------------------------------------
+void OptionsDlg::OnOK(wxCommandEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_OUT, true);
+    //this->EndModal(wxID_OK);
+    g_modal = false;
+    this->Show(false);
+}
+
+//-------------------------------------------------------------------------
+// OnCancel()
+//-------------------------------------------------------------------------
+void OptionsDlg::OnCancel(wxCommandEvent& event)
+{
+    //this->EndModal(wxID_CANCEL);
+    g_modal = false;
+    this->Show(false);
+}
+
+//-------------------------------------------------------------------------
+// OnApply()
+//-------------------------------------------------------------------------
+void OptionsDlg::OnApply(wxCommandEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_OUT, true);
+}
+
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//-------------------------------------------------------------------------
+void OptionsDlg::OnInitDialog(wxInitDialogEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_IN, false);
+}
+
+// immediately change flags rather using ExchangeData() so we can switch on and off at run time
+
+void OptionsDlg::OnFreeDV700txClip(wxScrollEvent& event) {
+    wxGetApp().m_FreeDV700txClip = m_ckboxFreeDV700txClip->GetValue();
+}
+
+
+void OptionsDlg::updateEventLog(wxString event_in, wxString event_out) {
+    wxString event_in_with_serial, event_out_with_serial; 
+    event_in_with_serial.Printf(_T("[%d] %s"), event_in_serial++, event_in);
+    event_out_with_serial.Printf(_T("[%d] %s"), event_out_serial++, event_out);
+
+    m_txt_events_in->AppendText(event_in_with_serial+"\n");
+    m_txt_events_out->AppendText(event_out_with_serial+"\n");
+}
+
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_options.h b/fdmdv2/tags/0.99-Beta/src/dlg_options.h
new file mode 100644 (file)
index 0000000..fe355ac
--- /dev/null
@@ -0,0 +1,99 @@
+//==========================================================================
+// Name:            dlg_options.h
+// Purpose:         Dialog for controlling misc FreeDV options
+// Created:         Nov 25 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#ifndef __OPTIONS_DIALOG__
+#define __OPTIONS_DIALOG__
+
+#include "fdmdv2_main.h"
+#include "fdmdv2_defines.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class OptionsDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class OptionsDlg : public wxDialog
+{
+    public:
+    OptionsDlg( wxWindow* parent,
+               wxWindowID id = wxID_ANY, const wxString& title = _("Options"), 
+                const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,630), 
+               long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+        ~OptionsDlg();
+
+        void    ExchangeData(int inout, bool storePersistent);
+        void    updateEventLog(wxString event_in, wxString event_out);
+
+        bool    enableEventsChecked() {return m_ckbox_events->GetValue();}
+
+        void SetSpamTimerLight(bool state) {
+
+            // Colours don't work on Windows
+
+            if (state) {
+                m_rb_spam_timer->SetForegroundColour( wxColour( 255,0 , 0 ) ); // red
+                m_rb_spam_timer->SetValue(true);
+            }
+            else {
+                m_rb_spam_timer->SetForegroundColour( wxColour( 0, 255, 0 ) ); // green
+                m_rb_spam_timer->SetValue(false);
+            }
+        }
+
+
+    protected:
+        // Handlers for events.
+        void    OnOK(wxCommandEvent& event);
+        void    OnCancel(wxCommandEvent& event);
+        void    OnApply(wxCommandEvent& event);
+        void    OnClose(wxCloseEvent& event);
+        void    OnInitDialog(wxInitDialogEvent& event);
+        void    OnFreeDV700txClip(wxScrollEvent& event);
+
+        wxTextCtrl   *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge
+        wxCheckBox   *m_ckboxTestFrame;
+        wxCheckBox   *m_ckboxChannelNoise;
+        wxCheckBox   *m_ckboxFreeDV700txClip;
+
+        wxRadioButton *m_rb_textEncoding1;
+        wxRadioButton *m_rb_textEncoding2;
+        wxCheckBox    *m_ckboxEnableChecksum;
+
+        wxCheckBox   *m_ckbox_events;
+        wxTextCtrl   *m_txt_events_regexp_match;
+        wxTextCtrl   *m_txt_events_regexp_replace;
+        wxTextCtrl   *m_txt_events_in;
+        wxTextCtrl   *m_txt_events_out;
+        wxTextCtrl   *m_txt_spam_timer;
+        wxRadioButton *m_rb_spam_timer;
+
+        wxCheckBox   *m_ckbox_udp_enable;
+        wxTextCtrl   *m_txt_udp_port;
+
+        wxButton*     m_sdbSizer5OK;
+        wxButton*     m_sdbSizer5Cancel;
+        wxButton*     m_sdbSizer5Apply;
+
+        unsigned int  event_in_serial, event_out_serial;
+
+     private:
+};
+
+#endif // __OPTIONS_DIALOG__
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_ptt.cpp b/fdmdv2/tags/0.99-Beta/src/dlg_ptt.cpp
new file mode 100644 (file)
index 0000000..2643c1d
--- /dev/null
@@ -0,0 +1,416 @@
+//==========================================================================
+// Name:            dlg_ptt.cpp
+// Purpose:         Subclasses dialog GUI for PTT Config. Creates simple 
+//                  wxWidgets dialog GUI to select real/virtual Comm ports.
+// Date:            May 11 2012
+// Authors:         David Rowe, David Witten, Joel Stanley
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include "dlg_ptt.h"
+#include "fdmdv2_main.h"
+
+#ifdef __WIN32__
+#include <wx/msw/registry.h>
+#endif
+#ifdef __FreeBSD__
+#include <glob.h>
+#include <string.h>
+#endif
+
+#include <sstream>
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class ComPortsDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, title, pos, size, style)
+{
+    wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
+    this->SetSizer(mainSizer);
+    
+    //----------------------------------------------------------------------
+    // Half Duplex Flag for VOX PTT
+    //----------------------------------------------------------------------
+
+    // DR: should this be on options dialog?
+
+    wxStaticBoxSizer* staticBoxSizer28 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("VOX PTT Settings")), wxHORIZONTAL);
+    m_ckHalfDuplex = new wxCheckBox(this, wxID_ANY, _("Half Duplex"), wxDefaultPosition, wxSize(-1,-1), 0);
+    staticBoxSizer28->Add(m_ckHalfDuplex, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+    m_ckLeftChannelVoxTone = new wxCheckBox(this, wxID_ANY, _("Left Channel Vox Tone"), wxDefaultPosition, wxSize(-1,-1), 0);
+    staticBoxSizer28->Add(m_ckLeftChannelVoxTone, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+    mainSizer->Add(staticBoxSizer28, 0, wxEXPAND, 5);
+
+    //----------------------------------------------------------------------
+    // Hamlib for CAT PTT
+    //----------------------------------------------------------------------
+
+    wxStaticBoxSizer* staticBoxSizer18 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Hamlib Settings")), wxVERTICAL);
+
+    wxBoxSizer* gridSizer100 = new wxBoxSizer(wxHORIZONTAL);
+
+    /* Use Hamlib for PTT checkbox. */
+    m_ckUseHamlibPTT = new wxCheckBox(this, wxID_ANY, _("Use Hamlib PTT"), wxDefaultPosition, wxSize(-1, -1), 0);
+    m_ckUseHamlibPTT->SetValue(false);
+    gridSizer100->Add(m_ckUseHamlibPTT, 0, wxALIGN_CENTER_VERTICAL, 0);
+
+    /* Hamlib Rig Type combobox. */
+    gridSizer100->Add(new wxStaticText(this, wxID_ANY, _("Rig Model:"), wxDefaultPosition, wxDefaultSize, 0), 
+                      0, wxALIGN_CENTER_VERTICAL | wxLEFT, 20);
+    m_cbRigName = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0, NULL, wxCB_DROPDOWN);
+    /* TODO(Joel): this is a hack. At the least, need to gurantee that m_hamLib
+     * exists. */
+    wxGetApp().m_hamlib->populateComboBox(m_cbRigName);
+    m_cbRigName->SetSelection(wxGetApp().m_intHamlibRig);
+    gridSizer100->Add(m_cbRigName, 0, wxALIGN_CENTER_VERTICAL, 0);
+
+    /* Hamlib Serial Port combobox. */
+    gridSizer100->Add(new wxStaticText(this, wxID_ANY, _("Serial Device:"), wxDefaultPosition, wxDefaultSize, 0), 
+                      0, wxALIGN_CENTER_VERTICAL | wxLEFT, 20);
+    m_cbSerialPort = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(140, -1), 0, NULL, wxCB_DROPDOWN);
+    gridSizer100->Add(m_cbSerialPort, 0, wxALIGN_CENTER_VERTICAL, 0);
+
+    staticBoxSizer18->Add(gridSizer100, 1);
+    mainSizer->Add(staticBoxSizer18, 1);
+
+    //----------------------------------------------------------------------
+    // Serial port PTT
+    //----------------------------------------------------------------------
+
+    wxStaticBoxSizer* staticBoxSizer17 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Serial Port Settings")), wxVERTICAL);
+    mainSizer->Add(staticBoxSizer17, 1, wxEXPAND, 5);
+    wxStaticBoxSizer* staticBoxSizer31 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("PTT Port")), wxVERTICAL);
+    staticBoxSizer17->Add(staticBoxSizer31, 1, wxEXPAND, 5);
+
+#ifdef __WXMSW__
+    m_ckUseSerialPTT = new wxCheckBox(this, wxID_ANY, _("Use Serial Port PTT"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckUseSerialPTT->SetValue(false);
+    staticBoxSizer31->Add(m_ckUseSerialPTT, 0, wxALIGN_LEFT, 20);
+
+    wxArrayString m_listCtrlPortsArr;
+    m_listCtrlPorts = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(-1,45), m_listCtrlPortsArr, wxLB_SINGLE | wxLB_SORT);
+    staticBoxSizer31->Add(m_listCtrlPorts, 1, wxALIGN_CENTER, 0);
+#endif
+
+#ifdef __WXGTK__
+    wxBoxSizer* bSizer83;
+    bSizer83 = new wxBoxSizer(wxHORIZONTAL);
+
+    wxGridSizer* gridSizer200 = new wxGridSizer(1, 3, 0, 0);
+    
+    m_ckUseSerialPTT = new wxCheckBox(this, wxID_ANY, _("Use Serial Port PTT"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckUseSerialPTT->SetValue(false);
+    gridSizer200->Add(m_ckUseSerialPTT, 1, wxALIGN_CENTER|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
+
+    m_staticText12 = new wxStaticText(this, wxID_ANY, _("Serial Device:  "), wxDefaultPosition, wxDefaultSize, 0);
+    m_staticText12->Wrap(-1);
+    gridSizer200->Add(m_staticText12, 1,wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
+
+    m_cbCtlDevicePath = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(140, -1), 0, NULL, wxCB_DROPDOWN);
+    gridSizer200->Add(m_cbCtlDevicePath, 1, wxEXPAND|wxALIGN_CENTER|wxALIGN_RIGHT, 2);
+    
+    bSizer83->Add(gridSizer200, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 2);
+    staticBoxSizer31->Add(bSizer83, 1, wxALIGN_CENTER_VERTICAL|wxALL, 1);
+#endif
+
+    wxBoxSizer* boxSizer19 = new wxBoxSizer(wxVERTICAL);
+    staticBoxSizer17->Add(boxSizer19, 1, wxEXPAND, 5);
+    wxStaticBoxSizer* staticBoxSizer16 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Signal polarity")), wxHORIZONTAL);
+    boxSizer19->Add(staticBoxSizer16, 1, wxEXPAND|wxALIGN_CENTER|wxALIGN_RIGHT, 5);
+
+    wxGridSizer* gridSizer17 = new wxGridSizer(2, 2, 0, 0);
+    staticBoxSizer16->Add(gridSizer17, 1, wxEXPAND|wxALIGN_RIGHT, 5);
+
+    m_rbUseDTR = new wxRadioButton(this, wxID_ANY, _("Use DTR"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_rbUseDTR->SetToolTip(_("Toggle DTR line for PTT"));
+    m_rbUseDTR->SetValue(1);
+    gridSizer17->Add(m_rbUseDTR, 0, wxALIGN_CENTER|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
+
+    m_ckDTRPos = new wxCheckBox(this, wxID_ANY, _("DTR = +V"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckDTRPos->SetToolTip(_("Set Polarity of the DTR line"));
+    m_ckDTRPos->SetValue(false);
+    gridSizer17->Add(m_ckDTRPos, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5);
+
+    m_rbUseRTS = new wxRadioButton(this, wxID_ANY, _("Use RTS"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_rbUseRTS->SetToolTip(_("Toggle the RTS pin for PTT"));
+    m_rbUseRTS->SetValue(1);
+    gridSizer17->Add(m_rbUseRTS, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5);
+
+    m_ckRTSPos = new wxCheckBox(this, wxID_ANY, _("RTS = +V"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckRTSPos->SetValue(false);
+    m_ckRTSPos->SetToolTip(_("Set Polarity of the RTS line"));
+    gridSizer17->Add(m_ckRTSPos, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5);
+
+    //----------------------------------------------------------------------
+    // OK - Cancel - Apply
+    //----------------------------------------------------------------------
+
+    wxBoxSizer* boxSizer12 = new wxBoxSizer(wxHORIZONTAL);
+
+    m_buttonOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_buttonOK->SetDefault();
+    boxSizer12->Add(m_buttonOK, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
+
+    m_buttonCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(-1,-1), 0);
+    boxSizer12->Add(m_buttonCancel, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
+
+    m_buttonApply = new wxButton(this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxSize(-1,-1), 0);
+    boxSizer12->Add(m_buttonApply, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
+
+    mainSizer->Add(boxSizer12, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5);
+
+    if ( GetSizer() ) 
+    {
+         GetSizer()->Fit(this);
+    }
+    Centre(wxBOTH);
+
+    // Connect events
+    this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(ComPortsDlg::OnInitDialog), NULL, this);
+    m_ckUseHamlibPTT->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTUseHamLibClicked), NULL, this);
+    m_ckUseSerialPTT->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTUseSerialClicked), NULL, this);
+    m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
+    m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
+    m_buttonApply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
+}
+
+//-------------------------------------------------------------------------
+// ~ComPortsDlg()
+//-------------------------------------------------------------------------
+ComPortsDlg::~ComPortsDlg()
+{
+    // Disconnect Events
+    this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(ComPortsDlg::OnInitDialog), NULL, this);
+    m_ckUseHamlibPTT->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTUseHamLibClicked), NULL, this);
+    m_ckUseSerialPTT->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTUseSerialClicked), NULL, this);
+    m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
+    m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
+    m_buttonApply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
+}
+
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//-------------------------------------------------------------------------
+void ComPortsDlg::OnInitDialog(wxInitDialogEvent& event)
+{
+    populatePortList();
+    ExchangeData(EXCHANGE_DATA_IN);
+}
+
+//-------------------------------------------------------------------------
+// populatePortList()
+//-------------------------------------------------------------------------
+void ComPortsDlg::populatePortList()
+{
+#ifdef __WXMSW__
+    m_listCtrlPorts->Clear();
+    m_cbSerialPort->Clear();
+    wxArrayString aStr;
+    wxRegKey key(wxRegKey::HKLM, _T("HARDWARE\\DEVICEMAP\\SERIALCOMM"));
+    if(!key.Exists())
+    {
+        return;
+    }
+    else
+    {
+        // Get the number of subkeys and enumerate them.
+        if(!key.Open(wxRegKey::Read))
+        {
+            return;
+        }    
+        size_t subkeys;
+        size_t values;
+        if(!key.GetKeyInfo(&subkeys, NULL, &values, NULL))
+        {
+            return;
+        }
+        if(!key.HasValues())
+        {
+            return;
+        }
+        wxString key_name;
+        long el = 1;
+        key.GetFirstValue(key_name, el);
+        wxString valType;
+        wxString key_data;
+        for(unsigned int i = 0; i < values; i++)
+        {
+            key.QueryValue(key_name, key_data);
+            //wxPrintf("Value:  %s Data: %s\n", key_name, key_data);
+            aStr.Add(key_data, 1);
+            key.GetNextValue(key_name, el);
+        }
+    }
+    m_listCtrlPorts->Append(aStr);
+    m_cbSerialPort->Append(aStr);
+#endif
+#ifdef __WXGTK__
+    m_cbSerialPort->Clear();
+    m_cbCtlDevicePath->Clear();
+#ifdef __FreeBSD__
+       glob_t  gl;
+       if(glob("/dev/tty*", GLOB_MARK, NULL, &gl)==0) {
+               for(unsigned int i=0; i<gl.gl_pathc; i++) {
+                       if(gl.gl_pathv[i][strlen(gl.gl_pathv[i])-1]=='/')
+                               continue;
+                               
+                       /* Exclude pseudo TTYs */
+                       if(gl.gl_pathv[i][8] >= 'l' && gl.gl_pathv[i][8] <= 's')
+                               continue;
+                       if(gl.gl_pathv[i][8] >= 'L' && gl.gl_pathv[i][8] <= 'S')
+                               continue;
+
+                       /* Exclude virtual TTYs */
+                       if(gl.gl_pathv[i][8] == 'v')
+                               continue;
+
+                       /* Exclude initial-state and lock-state devices */
+                       if(strchr(gl.gl_pathv[i], '.') != NULL)
+                               continue;
+
+                       m_cbSerialPort->Append(gl.gl_pathv[i]);
+                       m_cbCtlDevicePath->Append(gl.gl_pathv[i]);
+               }
+               globfree(&gl);
+       }
+#else
+    /* TODO(Joel): http://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them */
+    m_cbSerialPort->Append("/dev/ttyUSB0");
+    m_cbSerialPort->Append("/dev/ttyUSB1");
+    m_cbSerialPort->Append("/dev/ttyS0");
+    m_cbSerialPort->Append("/dev/ttyS1");
+    m_cbCtlDevicePath->Clear();
+    m_cbCtlDevicePath->Append("/dev/ttyUSB0");
+    m_cbCtlDevicePath->Append("/dev/ttyUSB1");
+    m_cbCtlDevicePath->Append("/dev/ttyS0");
+    m_cbCtlDevicePath->Append("/dev/ttyS1");
+#endif
+#endif
+}
+
+//-------------------------------------------------------------------------
+// ExchangeData()
+//-------------------------------------------------------------------------
+void ComPortsDlg::ExchangeData(int inout)
+{
+    wxConfigBase *pConfig = wxConfigBase::Get();
+    wxString str;
+    
+    if(inout == EXCHANGE_DATA_IN)
+    {
+        m_ckHalfDuplex->SetValue(wxGetApp().m_boolHalfDuplex);
+        m_ckLeftChannelVoxTone->SetValue(wxGetApp().m_leftChannelVoxTone);
+
+        m_ckUseHamlibPTT->SetValue(wxGetApp().m_boolHamlibUseForPTT);
+        m_cbRigName->SetSelection(wxGetApp().m_intHamlibRig);
+        m_cbSerialPort->SetValue(wxGetApp().m_strHamlibSerialPort);
+
+        m_ckUseSerialPTT->SetValue(wxGetApp().m_boolUseSerialPTT);
+        str = wxGetApp().m_strRigCtrlPort;
+#ifdef __WXMSW__
+        m_listCtrlPorts->SetStringSelection(str);
+#endif
+#ifdef __WXGTK__
+        m_cbCtlDevicePath->SetValue(str);
+#endif
+        m_rbUseRTS->SetValue(wxGetApp().m_boolUseRTS);
+        m_ckRTSPos->SetValue(wxGetApp().m_boolRTSPos);
+        m_rbUseDTR->SetValue(wxGetApp().m_boolUseDTR);
+        m_ckDTRPos->SetValue(wxGetApp().m_boolDTRPos);
+    }
+    if(inout == EXCHANGE_DATA_OUT)
+    {
+        wxGetApp().m_boolHalfDuplex = m_ckHalfDuplex->GetValue();
+        pConfig->Write(wxT("/Rig/HalfDuplex"), wxGetApp().m_boolHalfDuplex);
+        wxGetApp().m_leftChannelVoxTone = m_ckLeftChannelVoxTone->GetValue();
+        pConfig->Write(wxT("/Rig/leftChannelVoxTone"), wxGetApp().m_leftChannelVoxTone);
+
+        /* Hamlib settings. */
+
+        wxGetApp().m_boolHamlibUseForPTT = m_ckUseHamlibPTT->GetValue();
+        wxGetApp().m_intHamlibRig = m_cbRigName->GetSelection();
+        wxGetApp().m_strHamlibSerialPort = m_cbSerialPort->GetValue();
+
+        pConfig->Write(wxT("/Hamlib/UseForPTT"), wxGetApp().m_boolHamlibUseForPTT);
+        pConfig->Write(wxT("/Hamlib/RigName"), wxGetApp().m_intHamlibRig);
+        pConfig->Write(wxT("/Hamlib/SerialPort"), wxGetApp().m_strHamlibSerialPort);
+
+        /* Serial settings */
+
+        wxGetApp().m_boolUseSerialPTT           = m_ckUseSerialPTT->IsChecked();
+#ifdef __WXMSW__
+        wxGetApp().m_strRigCtrlPort             = m_listCtrlPorts->GetStringSelection();
+#endif
+#ifdef __WXGTK__
+        wxGetApp().m_strRigCtrlPort             = m_cbCtlDevicePath->GetValue();
+#endif
+        wxGetApp().m_boolUseRTS                 = m_rbUseRTS->GetValue();
+        wxGetApp().m_boolRTSPos                 = m_ckRTSPos->IsChecked();
+        wxGetApp().m_boolUseDTR                 = m_rbUseDTR->GetValue();
+        wxGetApp().m_boolDTRPos                 = m_ckDTRPos->IsChecked();
+        
+        pConfig->Write(wxT("/Rig/UseSerialPTT"),    wxGetApp().m_boolUseSerialPTT);
+        pConfig->Write(wxT("/Rig/Port"),            wxGetApp().m_strRigCtrlPort); 
+        pConfig->Write(wxT("/Rig/UseRTS"),          wxGetApp().m_boolUseRTS);
+        pConfig->Write(wxT("/Rig/RTSPolarity"),     wxGetApp().m_boolRTSPos);
+        pConfig->Write(wxT("/Rig/UseDTR"),          wxGetApp().m_boolUseDTR);
+        pConfig->Write(wxT("/Rig/DTRPolarity"),     wxGetApp().m_boolDTRPos);
+
+        pConfig->Flush();
+    }
+    delete wxConfigBase::Set((wxConfigBase *) NULL);
+}
+
+//-------------------------------------------------------------------------
+// PTTUseHamLibClicked()
+//-------------------------------------------------------------------------
+void ComPortsDlg::PTTUseHamLibClicked(wxCommandEvent& event)
+{
+    m_ckUseSerialPTT->SetValue(false);    
+}
+
+//-------------------------------------------------------------------------
+// PTTUseSerialClicked()
+//-------------------------------------------------------------------------
+void ComPortsDlg::PTTUseSerialClicked(wxCommandEvent& event)
+{
+    m_ckUseHamlibPTT->SetValue(false);
+}
+
+//-------------------------------------------------------------------------
+// OnApply()
+//-------------------------------------------------------------------------
+void ComPortsDlg::OnApply(wxCommandEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_OUT);
+}
+
+//-------------------------------------------------------------------------
+// OnCancel()
+//-------------------------------------------------------------------------
+void ComPortsDlg::OnCancel(wxCommandEvent& event)
+{
+    this->EndModal(wxID_CANCEL);
+}
+
+//-------------------------------------------------------------------------
+// OnClose()
+//-------------------------------------------------------------------------
+void ComPortsDlg::OnOK(wxCommandEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_OUT);
+    this->EndModal(wxID_OK);
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/dlg_ptt.h b/fdmdv2/tags/0.99-Beta/src/dlg_ptt.h
new file mode 100644 (file)
index 0000000..8fa9b9d
--- /dev/null
@@ -0,0 +1,91 @@
+//==========================================================================
+// Name:            dlg_ptt.h
+// Purpose:         Subclasses dialog GUI for PTT Config.
+//                  
+// Created:         May. 11, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __COMPORTS_DIALOG__
+#define __COMPORTS_DIALOG__
+
+#include "fdmdv2_main.h"
+#include "hamlib.h"
+#include <wx/settings.h>
+#include <wx/xrc/xmlres.h>
+#include <wx/xrc/xh_bmp.h>
+#include <wx/dialog.h>
+#include <wx/sizer.h>
+#include <wx/statbox.h>
+#include <wx/checkbox.h>
+#include <wx/listbox.h>
+#include <wx/radiobut.h>
+#include <wx/button.h>
+#include <wx/spinctrl.h>
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class ComPortsDlg
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class ComPortsDlg : public wxDialog
+{
+     public:
+        ComPortsDlg(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PTT Config"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(450,300), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
+        virtual ~ComPortsDlg();
+        void    ExchangeData(int inout);
+
+    protected:
+        wxCheckBox* m_ckHalfDuplex;
+        wxCheckBox* m_ckLeftChannelVoxTone;
+
+        /* Hamlib settings.*/
+
+        wxCheckBox *m_ckUseHamlibPTT;
+        wxComboBox *m_cbRigName;
+        wxComboBox *m_cbSerialPort;
+
+        Hamlib *m_hamlib;
+
+        /* Serial Settings */
+
+        wxListBox     *m_listCtrlPorts;
+        wxCheckBox    *m_ckUseSerialPTT;
+        wxStaticText  *m_staticText12;
+        wxComboBox    *m_cbCtlDevicePath;
+        wxRadioButton *m_rbUseDTR;
+        wxCheckBox    *m_ckRTSPos;
+        wxRadioButton *m_rbUseRTS;
+        wxCheckBox    *m_ckDTRPos;
+
+        /* Ok - Cancel - Apply */
+
+        wxButton* m_buttonOK;
+        wxButton* m_buttonCancel;
+        wxButton* m_buttonApply;
+
+
+protected:
+        void populatePortList();
+
+        void PTTUseHamLibClicked(wxCommandEvent& event);
+        void PTTUseSerialClicked(wxCommandEvent& event);
+
+        void OnOK(wxCommandEvent& event);
+        void OnCancel(wxCommandEvent& event);
+        void OnApply(wxCommandEvent& event);
+        virtual void OnInitDialog(wxInitDialogEvent& event);
+};
+
+#endif // __COMPORTS_DIALOG__
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_defines.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_defines.h
new file mode 100644 (file)
index 0000000..64aa606
--- /dev/null
@@ -0,0 +1,102 @@
+//==========================================================================
+// Name:            fdmdv2_defines.h
+// Purpose:         Definitions used by plots derived from fdmdv2_plot class.
+// Created:         August 27, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __FDMDV2_DEFINES__
+#define __FDMDV2_DEFINES__
+
+#include "wx/wx.h"
+#include "freedv_api.h"
+#include "freedv_api_internal.h"
+
+// Spectrogram and Waterfall
+
+#define MIN_MAG_DB        -40.0     // min of spectrogram/waterfall magnitude axis
+#define MAX_MAG_DB          0.0     // max of spectrogram/waterfall magnitude axis
+#define STEP_MAG_DB         5.0     // magnitude axis step
+#define BETA                0.95    // constant for time averaging spectrum data
+#define MIN_F_HZ            0       // min freq on Waterfall and Spectrum
+#define MAX_F_HZ            3000    // max freq on Waterfall and Spectrum
+#define STEP_F_HZ           500     // major (e.g. text legend) freq step on Waterfall and Spectrum graticule
+#define STEP_MINOR_F_HZ     100     // minor (ticks) freq step on Waterfall and Spectrum graticule
+#define WATERFALL_SECS_Y    30      // number of seconds respresented by y axis of waterfall
+#define WATERFALL_SECS_STEP 5       // graticule y axis steps of waterfall
+#define DT                  0.1     // time between real time graphing updates
+#define FS                  8000    // FDMDV modem sample rate
+
+// Scatter diagram 
+
+#define SCATTER_MEM_SECS    10
+// (symbols/frame)/(graphics update period) = symbols/s sent to scatter memory
+// memory (symbols) = secs of memory * symbols/sec
+#define SCATTER_MEM_SYMS_MAX    ((int)(SCATTER_MEM_SECS*((FDMDV_NC_MAX+1)/DT)))
+
+// Waveform plotting constants
+
+#define WAVEFORM_PLOT_FS    400                            // sample rate (points/s) of waveform plotted to screen
+#define WAVEFORM_PLOT_TIME  5                              // length or entire waveform on screen
+#define WAVEFORM_PLOT_BUF   ((int)(DT*WAVEFORM_PLOT_FS))   // number of new samples we plot per DT
+
+// sample rate I/O & conversion constants
+
+#define MAX_FPB             8096                           // maximum value of portAudio framesPerBuffer
+#define PA_FPB              1024                           // nominal value of portAudio framesPerBuffer
+#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 MEM8                (FDMDV_OS_TAPS/FDMDV_OS)
+#define N48                 (N8*SAMPLE_RATE/FS)            // processing buffer size at 48 kHz
+#define NUM_CHANNELS        2                              // I think most sound cards prefer stereo we will convert to mono
+#define VOX_TONE_FREQ       1000.0                         // optional left channel vox tone freq
+#define VOX_TONE_AMP        30000                          // optional left channel vox tone amp
+
+#define MAX_BITS_PER_CODEC_FRAME 64                            // 1600 bit/s mode
+#define MAX_BYTES_PER_CODEC_FRAME (MAX_BITS_PER_CODEC_FRAME/8)
+#define MAX_BITS_PER_FDMDV_FRAME 40                            // 2000 bit/s mode
+
+// Squelch
+#define SQ_DEFAULT_SNR       2.0
+
+// Level Gauge
+#define FROM_RADIO_MAX       0.8
+#define FROM_MIC_MAX         0.8
+#define LEVEL_BETA           0.99
+
+// SNR
+#define SNRSLOW_BETA        0.5                           // time constant for slow SNR for display
+
+// Text messaging Data
+#define MAX_CALLSIGN         80
+#define MAX_EVENT_LOG        10
+#define MAX_EVENT_RULES      100
+   
+enum
+{
+    ID_ROTATE_LEFT = wxID_HIGHEST + 1,
+    ID_ROTATE_RIGHT,
+    ID_RESIZE,
+    ID_PAINT_BG
+};
+
+// Codec 2 LPC Post Filter defaults, from codec-dev/src/quantise.c
+
+#define CODEC2_LPC_PF_GAMMA 0.5
+#define CODEC2_LPC_PF_BETA  0.2
+
+
+#endif  //__FDMDV2_DEFINES__
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_main.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_main.cpp
new file mode 100644 (file)
index 0000000..2adec2c
--- /dev/null
@@ -0,0 +1,3686 @@
+//==========================================================================
+// Name:            fdmdv2_main.cpp
+//
+// Purpose:         FreeDV main()
+// Created:         Apr. 9, 2012
+// Authors:         David Rowe, David Witten
+//
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#include "fdmdv2_main.h"
+
+#define wxUSE_FILEDLG   1
+#define wxUSE_LIBPNG    1
+#define wxUSE_LIBJPEG   1
+#define wxUSE_GIF       1
+#define wxUSE_PCX       1
+#define wxUSE_LIBTIFF   1
+
+//-------------------------------------------------------------------
+// Bunch of globals used for communication with sound card call
+// back functions
+// ------------------------------------------------------------------
+
+int g_in, g_out;
+
+// Global Codec2 & modem states - just one reqd for tx & rx
+int                 g_Nc;
+int                 g_mode;
+struct freedv      *g_pfreedv;
+struct MODEM_STATS  g_stats;
+float               g_pwr_scale;
+int                 g_clip;
+
+// test Frames
+int                 g_testFrames;
+int                 g_test_frame_sync_state;
+int                 g_test_frame_count;
+int                 g_total_bits;
+int                 g_total_bit_errors;
+int                 g_channel_noise;
+float               g_sig_pwr_av = 0.0;
+struct FIFO        *g_error_pattern_fifo;
+short              *g_error_hist;
+// time averaged magnitude spectrum used for waterfall and spectrum display
+float               g_avmag[MODEM_STATS_NSPEC];
+
+// GUI controls that affect rx and tx processes
+int   g_SquelchActive;
+float g_SquelchLevel;
+int   g_analog;
+int   g_split;
+int   g_tx;
+float g_snr;
+bool  g_half_duplex;
+bool  g_modal;
+
+// sending and receiving Call Sign data
+struct FIFO         *g_txDataInFifo;
+struct FIFO         *g_rxDataOutFifo;
+
+// tx/rx processing states
+int                 g_State;
+paCallBackData     *g_rxUserdata;
+
+// FIFOs used for plotting waveforms
+struct FIFO        *g_plotDemodInFifo;
+struct FIFO        *g_plotSpeechOutFifo;
+struct FIFO        *g_plotSpeechInFifo;
+
+// Soundcard config
+int                 g_nSoundCards;
+int                 g_soundCard1InDeviceNum;
+int                 g_soundCard1OutDeviceNum;
+int                 g_soundCard1SampleRate;
+int                 g_soundCard2InDeviceNum;
+int                 g_soundCard2OutDeviceNum;
+int                 g_soundCard2SampleRate;
+
+// playing and recording from sound files
+
+SNDFILE            *g_sfPlayFile;
+bool                g_playFileToMicIn;
+bool                g_loopPlayFileToMicIn;
+int                 g_playFileToMicInEventId;
+
+SNDFILE            *g_sfRecFile;
+bool                g_recFileFromRadio;
+unsigned int        g_recFromRadioSamples;
+int                 g_recFileFromRadioEventId;
+
+SNDFILE            *g_sfPlayFileFromRadio;
+bool                g_playFileFromRadio;
+int                 g_sfFs;
+bool                g_loopPlayFileFromRadio;
+int                 g_playFileFromRadioEventId;
+float               g_blink;
+
+wxWindow           *g_parent;
+
+// Click to tune rx and tx frequency offset states
+float               g_RxFreqOffsetHz;
+COMP                g_RxFreqOffsetPhaseRect;
+float               g_TxFreqOffsetHz;
+COMP                g_TxFreqOffsetPhaseRect;
+
+// experimental mutex to make sound card callbacks mutually exclusive
+// TODO: review code and see if we need this any more, as fifos should
+// now be thread safe
+
+wxMutex g_mutexProtectingCallbackData;
+
+// Speex pre-processor states
+
+SpeexPreprocessState *g_speex_st;
+
+// WxWidgets - initialize the application
+IMPLEMENT_APP(MainApp);
+
+//FILE *ft;
+FILE *g_logfile;
+
+//-------------------------------------------------------------------------
+// OnInit()
+//-------------------------------------------------------------------------
+bool MainApp::OnInit()
+{
+    if(!wxApp::OnInit())
+    {
+        return false;
+    }
+    SetVendorName(wxT("CODEC2-Project"));
+    SetAppName(wxT("FreeDV"));      // not needed, it's the default value
+
+    // DR - this is wrong define so won't be used on windows build, should be __WXMSW__
+    // So registry will be used for Win32
+#ifdef _WXMSW_
+    // Force use of file-based configuration persistance on Windows platforma
+    wxConfig *pConfig = new wxConfig();
+    wxFileConfig *pFConfig = new wxFileConfig(wxT("FreeDV"), wxT("CODEC2-Project"), wxT("FreeDV.conf"), wxT("FreeDV.conf"),  wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
+    pConfig->Set(pFConfig);
+    pConfig->SetRecordDefaults();
+#else
+    wxConfigBase *pConfig = wxConfigBase::Get();
+    pConfig->SetRecordDefaults();
+#endif
+
+    m_rTopWindow = wxRect(0, 0, 0, 0);
+    m_strRxInAudio.Empty();
+    m_strRxOutAudio.Empty();
+    m_textVoiceInput.Empty();
+    m_textVoiceOutput.Empty();
+    m_strSampleRate.Empty();
+    m_strBitrate.Empty();
+    // Create the main application window
+    frame = new MainFrame(NULL);
+    SetTopWindow(frame);
+    // Should guarantee that the first plot tab defined is the one
+    // displayed. But it doesn't when built from command line.  Why?
+    frame->m_auiNbookCtrl->ChangeSelection(0);
+    frame->Layout();
+    frame->Show();
+    g_parent =frame;
+
+    //ft = fopen("tmp.raw","wb");
+    //assert(ft != NULL);
+
+    return true;
+}
+
+//-------------------------------------------------------------------------
+// OnExit()
+//-------------------------------------------------------------------------
+int MainApp::OnExit()
+{
+    return 0;
+}
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class MainFrame(wxFrame* pa->ent) : TopFrame(parent)
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
+{
+    m_zoom              = 1.;
+
+    #ifdef __WXMSW__
+    g_logfile = fopen("log.txt","wt");
+    #else
+    g_logfile = stderr;
+    #endif
+
+    SetMinSize(wxSize(400,400));
+
+    // Init Hamlib library, but we dont start talking to any rigs yet
+
+    wxGetApp().m_hamlib = new Hamlib();
+
+    tools->AppendSeparator();
+    wxMenuItem* m_menuItemToolsConfigDelete;
+    m_menuItemToolsConfigDelete = new wxMenuItem(tools, wxID_ANY, wxString(_("&Restore defaults")) , wxT("Delete config file/keys and restore defaults"), wxITEM_NORMAL);
+    this->Connect(m_menuItemToolsConfigDelete->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnDeleteConfig));
+
+    tools->Append(m_menuItemToolsConfigDelete);
+
+    wxConfigBase *pConfig = wxConfigBase::Get();
+
+    // restore frame position and size
+    int x = pConfig->Read(wxT("/MainFrame/left"),       20);
+    int y = pConfig->Read(wxT("/MainFrame/top"),        20);
+    int w = pConfig->Read(wxT("/MainFrame/width"),     800);
+    int h = pConfig->Read(wxT("/MainFrame/height"),    550);
+
+    // sanitise frame position as a first pass at Win32 registry bug
+
+    fprintf(g_logfile, "x = %d y = %d w = %d h = %d\n", x,y,w,h);
+    if (x < 0 || x > 2048) x = 20;
+    if (y < 0 || y > 2048) y = 20;
+    if (w < 0 || w > 2048) w = 800;
+    if (h < 0 || h > 2048) h = 550;
+
+    wxGetApp().m_show_wf            = pConfig->Read(wxT("/MainFrame/show_wf"),           1);
+    wxGetApp().m_show_spect         = pConfig->Read(wxT("/MainFrame/show_spect"),        1);
+    wxGetApp().m_show_scatter       = pConfig->Read(wxT("/MainFrame/show_scatter"),      1);
+    wxGetApp().m_show_timing        = pConfig->Read(wxT("/MainFrame/show_timing"),       1);
+    wxGetApp().m_show_freq          = pConfig->Read(wxT("/MainFrame/show_freq"),         1);
+    wxGetApp().m_show_speech_in     = pConfig->Read(wxT("/MainFrame/show_speech_in"),    1);
+    wxGetApp().m_show_speech_out    = pConfig->Read(wxT("/MainFrame/show_speech_out"),   1);
+    wxGetApp().m_show_demod_in      = pConfig->Read(wxT("/MainFrame/show_demod_in"),     1);
+    wxGetApp().m_show_test_frame_errors = pConfig->Read(wxT("/MainFrame/show_test_frame_errors"),     1);
+    wxGetApp().m_show_test_frame_errors_hist = pConfig->Read(wxT("/MainFrame/show_test_frame_errors_hist"),     1);
+
+    wxGetApp().m_rxNbookCtrl        = pConfig->Read(wxT("/MainFrame/rxNbookCtrl"),    (long)0);
+
+    g_SquelchActive = pConfig->Read(wxT("/Audio/SquelchActive"), (long)0);
+    g_SquelchLevel = pConfig->Read(wxT("/Audio/SquelchLevel"), (int)(SQ_DEFAULT_SNR*2));
+    g_SquelchLevel /= 2.0;
+
+    Move(x, y);
+    SetClientSize(w, h);
+    
+    if(wxGetApp().m_show_wf)
+    {
+        // Add Waterfall Plot window
+        m_panelWaterfall = new PlotWaterfall((wxFrame*) m_auiNbookCtrl, false, 0);
+        m_panelWaterfall->SetToolTip(_("Left click to tune, Right click to toggle mono/colour"));
+        m_auiNbookCtrl->AddPage(m_panelWaterfall, _("Waterfall"), true, wxNullBitmap);
+    }
+    if(wxGetApp().m_show_spect)
+    {
+        // Add Spectrum Plot window
+        m_panelSpectrum = new PlotSpectrum((wxFrame*) m_auiNbookCtrl, g_avmag,
+                                           MODEM_STATS_NSPEC*((float)MAX_F_HZ/MODEM_STATS_MAX_F_HZ));
+        m_panelSpectrum->SetToolTip(_("Left click to tune"));
+        m_auiNbookCtrl->AddPage(m_panelSpectrum, _("Spectrum"), true, wxNullBitmap);
+    }
+    if(wxGetApp().m_show_scatter)
+    {
+        // Add Scatter Plot window
+        m_panelScatter = new PlotScatter((wxFrame*) m_auiNbookCtrl);
+        m_auiNbookCtrl->AddPage(m_panelScatter, _("Scatter"), true, wxNullBitmap);
+    }
+    if(wxGetApp().m_show_demod_in)
+    {
+        // Add Demod Input window
+        m_panelDemodIn = new PlotScalar((wxFrame*) m_auiNbookCtrl, 1, WAVEFORM_PLOT_TIME, 1.0/WAVEFORM_PLOT_FS, -1, 1, 1, 0.2, "%2.1f", 0);
+        m_auiNbookCtrl->AddPage(m_panelDemodIn, _("Frm Radio"), true, wxNullBitmap);
+        g_plotDemodInFifo = fifo_create(2*WAVEFORM_PLOT_BUF);
+    }
+
+    if(wxGetApp().m_show_speech_in)
+    {
+        // Add Speech Input window
+        m_panelSpeechIn = new PlotScalar((wxFrame*) m_auiNbookCtrl, 1, WAVEFORM_PLOT_TIME, 1.0/WAVEFORM_PLOT_FS, -1, 1, 1, 0.2, "%2.1f", 0);
+        m_auiNbookCtrl->AddPage(m_panelSpeechIn, _("Frm Mic"), true, wxNullBitmap);
+        g_plotSpeechInFifo = fifo_create(4*WAVEFORM_PLOT_BUF);
+    }
+
+    if(wxGetApp().m_show_speech_out)
+    {
+        // Add Speech Output window
+        m_panelSpeechOut = new PlotScalar((wxFrame*) m_auiNbookCtrl, 1, WAVEFORM_PLOT_TIME, 1.0/WAVEFORM_PLOT_FS, -1, 1, 1, 0.2, "%2.1f", 0);
+        m_auiNbookCtrl->AddPage(m_panelSpeechOut, _("To Spkr/Hdphns"), true, wxNullBitmap);
+        g_plotSpeechOutFifo = fifo_create(2*WAVEFORM_PLOT_BUF);
+    }
+
+    if(wxGetApp().m_show_timing)
+    {
+        // Add Timing Offset window
+        m_panelTimeOffset = new PlotScalar((wxFrame*) m_auiNbookCtrl, 1, 5.0, DT, -0.5, 0.5, 1, 0.1, "%2.1f", 0);
+        m_auiNbookCtrl->AddPage(m_panelTimeOffset, L"Timing \u0394", true, wxNullBitmap);
+    }
+    if(wxGetApp().m_show_freq)
+    {
+        // Add Frequency Offset window
+        m_panelFreqOffset = new PlotScalar((wxFrame*) m_auiNbookCtrl, 1, 5.0, DT, -200, 200, 1, 50, "%3.0fHz", 0);
+        m_auiNbookCtrl->AddPage(m_panelFreqOffset, L"Frequency \u0394", true, wxNullBitmap);
+    }
+
+    if(wxGetApp().m_show_test_frame_errors)
+    {
+        // Add Test Frame Errors window
+        m_panelTestFrameErrors = new PlotScalar((wxFrame*) m_auiNbookCtrl, 2*MODEM_STATS_NC_MAX, 30.0, DT, 0, 2*MODEM_STATS_NC_MAX+2, 1, 1, "", 1);
+        m_auiNbookCtrl->AddPage(m_panelTestFrameErrors, L"Test Frame Errors", true, wxNullBitmap);
+    }
+
+    if(wxGetApp().m_show_test_frame_errors_hist)
+    {
+        // Add Test Frame Errors window
+        m_panelTestFrameErrorsHist = new PlotScalar((wxFrame*) m_auiNbookCtrl, 1, 1.0, 1.0/(2*FDMDV_NC_MAX), 0.0, 1.0, 1.0/FDMDV_NC_MAX, 0.1, "%3.2f", 0);
+        m_auiNbookCtrl->AddPage(m_panelTestFrameErrorsHist, L"Test Frame Histogram", true, wxNullBitmap);
+    }
+
+    wxGetApp().m_framesPerBuffer = pConfig->Read(wxT("/Audio/framesPerBuffer"), PA_FPB);
+
+    g_soundCard1InDeviceNum  = pConfig->Read(wxT("/Audio/soundCard1InDeviceNum"),         -1);
+    g_soundCard1OutDeviceNum = pConfig->Read(wxT("/Audio/soundCard1OutDeviceNum"),        -1);
+    g_soundCard1SampleRate   = pConfig->Read(wxT("/Audio/soundCard1SampleRate"),          -1);
+
+    g_soundCard2InDeviceNum  = pConfig->Read(wxT("/Audio/soundCard2InDeviceNum"),         -1);
+    g_soundCard2OutDeviceNum = pConfig->Read(wxT("/Audio/soundCard2OutDeviceNum"),        -1);
+    g_soundCard2SampleRate   = pConfig->Read(wxT("/Audio/soundCard2SampleRate"),          -1);
+
+    g_nSoundCards = 0;
+    if ((g_soundCard1InDeviceNum > -1) && (g_soundCard1OutDeviceNum > -1)) {
+        g_nSoundCards = 1;
+        if ((g_soundCard2InDeviceNum > -1) && (g_soundCard2OutDeviceNum > -1))
+            g_nSoundCards = 2;
+    }
+
+    wxGetApp().m_playFileToMicInPath = pConfig->Read("/File/playFileToMicInPath",   wxT(""));
+    wxGetApp().m_recFileFromRadioPath = pConfig->Read("/File/recFileFromRadioPath", wxT(""));
+    wxGetApp().m_recFileFromRadioSecs = pConfig->Read("/File/recFileFromRadioSecs", 30);
+    wxGetApp().m_playFileFromRadioPath = pConfig->Read("/File/playFileFromRadioPath", wxT(""));
+
+    // PTT -------------------------------------------------------------------
+
+    wxGetApp().m_boolHalfDuplex     = pConfig->ReadBool(wxT("/Rig/HalfDuplex"),     true);
+    wxGetApp().m_leftChannelVoxTone = pConfig->ReadBool("/Rig/leftChannelVoxTone",  false);
+    wxGetApp().m_boolHamlibUseForPTT = pConfig->ReadBool("/Hamlib/UseForPTT", false);
+    wxGetApp().m_intHamlibRig = pConfig->ReadLong("/Hamlib/RigName", 0);
+    wxGetApp().m_strHamlibSerialPort = pConfig->Read("/Hamlib/SerialPort", "");
+    
+    wxGetApp().m_boolUseSerialPTT   = pConfig->ReadBool(wxT("/Rig/UseSerialPTT"),   false);
+    wxGetApp().m_strRigCtrlPort     = pConfig->Read(wxT("/Rig/Port"),               wxT(""));
+    wxGetApp().m_boolUseRTS         = pConfig->ReadBool(wxT("/Rig/UseRTS"),         true);
+    wxGetApp().m_boolRTSPos         = pConfig->ReadBool(wxT("/Rig/RTSPolarity"),    true);
+    wxGetApp().m_boolUseDTR         = pConfig->ReadBool(wxT("/Rig/UseDTR"),         false);
+    wxGetApp().m_boolDTRPos         = pConfig->ReadBool(wxT("/Rig/DTRPolarity"),    false);
+    com_handle = COM_HANDLE_INVALID;
+
+    // -----------------------------------------------------------------------
+
+    bool slow = false; // prevents compile error when using default bool
+    wxGetApp().m_snrSlow = pConfig->Read("/Audio/snrSlow", slow);
+
+    bool t = true;     // prevents compile error when using default bool
+    wxGetApp().m_codec2LPCPostFilterEnable     = pConfig->Read(wxT("/Filter/codec2LPCPostFilterEnable"),    t);
+    wxGetApp().m_codec2LPCPostFilterBassBoost  = pConfig->Read(wxT("/Filter/codec2LPCPostFilterBassBoost"), t);
+    wxGetApp().m_codec2LPCPostFilterGamma      = (float)pConfig->Read(wxT("/Filter/codec2LPCPostFilterGamma"),     CODEC2_LPC_PF_GAMMA*100)/100.0;
+    wxGetApp().m_codec2LPCPostFilterBeta       = (float)pConfig->Read(wxT("/Filter/codec2LPCPostFilterBeta"),      CODEC2_LPC_PF_BETA*100)/100.0;
+    //printf("main(): m_codec2LPCPostFilterBeta: %f\n", wxGetApp().m_codec2LPCPostFilterBeta);
+
+    wxGetApp().m_speexpp_enable     = pConfig->Read(wxT("/Filter/speexpp_enable"),    t);
+
+    wxGetApp().m_MicInBassFreqHz = (float)pConfig->Read(wxT("/Filter/MicInBassFreqHz"),    1);
+    wxGetApp().m_MicInBassGaindB = (float)pConfig->Read(wxT("/Filter/MicInBassGaindB"),    (long)0)/10.0;
+    wxGetApp().m_MicInTrebleFreqHz = (float)pConfig->Read(wxT("/Filter/MicInTrebleFreqHz"),    1);
+    wxGetApp().m_MicInTrebleGaindB = (float)pConfig->Read(wxT("/Filter/MicInTrebleGaindB"),    (long)0)/10.0;
+    wxGetApp().m_MicInMidFreqHz = (float)pConfig->Read(wxT("/Filter/MicInMidFreqHz"),    1);
+    wxGetApp().m_MicInMidGaindB = (float)pConfig->Read(wxT("/Filter/MicInMidGaindB"),    (long)0)/10.0;
+    wxGetApp().m_MicInMidQ = (float)pConfig->Read(wxT("/Filter/MicInMidQ"),              (long)100)/100.0;
+
+    bool f = false;
+    wxGetApp().m_MicInEQEnable = (float)pConfig->Read(wxT("/Filter/MicInEQEnable"), f);
+
+    wxGetApp().m_SpkOutBassFreqHz = (float)pConfig->Read(wxT("/Filter/SpkOutBassFreqHz"),    1);
+    wxGetApp().m_SpkOutBassGaindB = (float)pConfig->Read(wxT("/Filter/SpkOutBassGaindB"),    (long)0)/10.0;
+    wxGetApp().m_SpkOutTrebleFreqHz = (float)pConfig->Read(wxT("/Filter/SpkOutTrebleFreqHz"),    1);
+    wxGetApp().m_SpkOutTrebleGaindB = (float)pConfig->Read(wxT("/Filter/SpkOutTrebleGaindB"),    (long)0)/10.0;
+    wxGetApp().m_SpkOutMidFreqHz = (float)pConfig->Read(wxT("/Filter/SpkOutMidFreqHz"),    1);
+    wxGetApp().m_SpkOutMidGaindB = (float)pConfig->Read(wxT("/Filter/SpkOutMidGaindB"),    (long)0)/10.0;
+    wxGetApp().m_SpkOutMidQ = (float)pConfig->Read(wxT("/Filter/SpkOutMidQ"),                (long)100)/100.0;
+
+    wxGetApp().m_SpkOutEQEnable = (float)pConfig->Read(wxT("/Filter/SpkOutEQEnable"), f);
+
+    wxGetApp().m_callSign = pConfig->Read("/Data/CallSign", wxT(""));
+    wxGetApp().m_textEncoding = pConfig->Read("/Data/TextEncoding", 1);
+    wxGetApp().m_enable_checksum = pConfig->Read("/Data/EnableChecksumOnMsgRx", f);
+
+    wxGetApp().m_events = pConfig->Read("/Events/enable", f);
+    wxGetApp().m_events_spam_timer = (int)pConfig->Read(wxT("/Events/spam_timer"), 10);
+    wxGetApp().m_events_regexp_match = pConfig->Read("/Events/regexp_match", wxT("s=(.*)"));
+    wxGetApp().m_events_regexp_replace = pConfig->Read("/Events/regexp_replace", 
+                                                       wxT("curl http://qso.freedv.org/cgi-bin/onspot.cgi?s=\\1"));
+    // make sure regexp lists are terminated by a \n
+
+    if (wxGetApp().m_events_regexp_match.Last() != '\n') {
+        wxGetApp().m_events_regexp_match = wxGetApp().m_events_regexp_match+'\n';
+    }
+    if (wxGetApp().m_events_regexp_replace.Last() != '\n') {
+        wxGetApp().m_events_regexp_replace = wxGetApp().m_events_regexp_replace+'\n';
+    }
+
+    wxGetApp().m_udp_enable = (float)pConfig->Read(wxT("/UDP/enable"), f);
+    wxGetApp().m_udp_port = (int)pConfig->Read(wxT("/UDP/port"), 3000);
+
+    wxGetApp().m_FreeDV700txClip = (float)pConfig->Read(wxT("/FreeDV700/txClip"), t);
+
+    int mode  = pConfig->Read(wxT("/Audio/mode"), (long)0);
+    if (mode == 0)
+        m_rb1600->SetValue(1);
+    if (mode == 1)
+        m_rb700->SetValue(1);
+        
+    pConfig->SetPath(wxT("/"));
+
+//    this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
+    //m_togRxID->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnRxIDUI), NULL, this);
+    //m_togTxID->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTxIDUI), NULL, this);
+    m_togBtnOnOff->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnOnOffUI), NULL, this);
+    m_togBtnSplit->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnSplitClickUI), NULL, this);
+    m_togBtnAnalog->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnAnalogClickUI), NULL, this);
+    //m_togBtnALC->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnALCClickUI), NULL, this);
+   // m_btnTogPTT->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnPTT_UI), NULL, this);
+
+    m_togBtnSplit->Disable();
+    //m_togRxID->Disable();
+    //m_togTxID->Disable();
+    m_togBtnAnalog->Disable();
+    m_btnTogPTT->Disable();
+    //m_togBtnALC->Disable();
+
+    // squelch settings
+    char sqsnr[15];
+    m_sliderSQ->SetValue((int)((g_SquelchLevel+5.0)*2.0));
+    sprintf(sqsnr, "%4.1f", g_SquelchLevel);
+    wxString sqsnr_string(sqsnr);
+    m_textSQ->SetLabel(sqsnr_string);
+    m_ckboxSQ->SetValue(g_SquelchActive);
+
+    // SNR settings
+
+    m_ckboxSNR->SetValue(wxGetApp().m_snrSlow);
+    setsnrBeta(wxGetApp().m_snrSlow);
+
+#ifdef _USE_TIMER
+    Bind(wxEVT_TIMER, &MainFrame::OnTimer, this);       // ID_MY_WINDOW);
+    m_plotTimer.SetOwner(this, ID_TIMER_WATERFALL);
+    //m_panelWaterfall->Refresh();
+#endif
+
+    m_RxRunning = false;
+
+#ifdef _USE_ONIDLE
+    Connect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this);
+#endif //_USE_ONIDLE
+
+    g_sfPlayFile = NULL;
+    g_playFileToMicIn = false;
+    g_loopPlayFileToMicIn = false;
+
+    g_sfRecFile = NULL;
+    g_recFileFromRadio = false;
+
+    g_sfPlayFileFromRadio = NULL;
+    g_playFileFromRadio = false;
+    g_loopPlayFileFromRadio = false;
+
+    // init click-tune states
+
+    g_RxFreqOffsetHz = 0.0;
+    g_RxFreqOffsetPhaseRect.real = cos(0.0);
+    g_RxFreqOffsetPhaseRect.imag = sin(0.0);
+    m_panelWaterfall->setRxFreq(FDMDV_FCENTRE - g_RxFreqOffsetHz);
+    m_panelSpectrum->setRxFreq(FDMDV_FCENTRE - g_RxFreqOffsetHz);
+
+    g_TxFreqOffsetHz = 0.0;
+    g_TxFreqOffsetPhaseRect.real = cos(0.0);
+    g_TxFreqOffsetPhaseRect.imag = sin(0.0);
+
+    g_tx = 0;
+    g_split = 0;
+
+    // data states
+    g_txDataInFifo = fifo_create(MAX_CALLSIGN*VARICODE_MAX_BITS);
+    g_rxDataOutFifo = fifo_create(MAX_CALLSIGN*VARICODE_MAX_BITS);
+
+    sox_biquad_start();
+    golay23_init();
+
+    g_testFrames = 0;
+    g_test_frame_sync_state = 0;
+    g_total_bit_errors = 0;
+    g_total_bits = 0;
+    wxGetApp().m_testFrames = false;
+
+    g_modal = false;
+
+    // Start UDP listener thread
+
+    m_UDPThread = NULL;
+    startUDPThread();
+
+    optionsDlg = new OptionsDlg(NULL);
+    m_schedule_restore = false;
+
+}
+
+//-------------------------------------------------------------------------
+// ~MainFrame()
+//-------------------------------------------------------------------------
+MainFrame::~MainFrame()
+{
+    int x;
+    int y;
+    int w;
+    int h;
+
+    //fclose(ft);
+    #ifdef __WXMSW__
+    fclose(g_logfile);
+    #endif
+
+    if (optionsDlg != NULL) {
+        delete optionsDlg;
+        optionsDlg = NULL;
+    }
+
+    stopUDPThread();
+
+    /* TOOD(Joel): the ownership of m_hamlib is probably wrong. */
+    if (wxGetApp().m_hamlib) delete wxGetApp().m_hamlib;
+
+    //MainApp *pApp = wxGetApp();
+    wxConfigBase *pConfig = wxConfigBase::Get();
+    if(pConfig)
+    {
+        if (!IsIconized()) {
+            GetClientSize(&w, &h);
+
+            // big hack - for some reason height shrinks by this much
+            // every time FreeDV runs!  I have no idea why
+
+            h += 23;
+
+            GetPosition(&x, &y);
+            printf("x = %d y = %d w = %d h = %d\n", x,y,w,h);
+            pConfig->Write(wxT("/MainFrame/left"),               (long) x);
+            pConfig->Write(wxT("/MainFrame/top"),                (long) y);
+            pConfig->Write(wxT("/MainFrame/width"),              (long) w);
+            pConfig->Write(wxT("/MainFrame/height"),             (long) h);
+        }
+        pConfig->Write(wxT("/MainFrame/show_wf"),           wxGetApp().m_show_wf);
+        pConfig->Write(wxT("/MainFrame/show_spect"),        wxGetApp().m_show_spect);
+        pConfig->Write(wxT("/MainFrame/show_scatter"),      wxGetApp().m_show_scatter);
+        pConfig->Write(wxT("/MainFrame/show_timing"),       wxGetApp().m_show_timing);
+        pConfig->Write(wxT("/MainFrame/show_freq"),         wxGetApp().m_show_freq);
+        pConfig->Write(wxT("/MainFrame/show_speech_in"),    wxGetApp().m_show_speech_in);
+        pConfig->Write(wxT("/MainFrame/show_speech_out"),   wxGetApp().m_show_speech_out);
+        pConfig->Write(wxT("/MainFrame/show_demod_in"),     wxGetApp().m_show_demod_in);
+        pConfig->Write(wxT("/MainFrame/show_test_frame_errors"), wxGetApp().m_show_test_frame_errors);
+        pConfig->Write(wxT("/MainFrame/show_test_frame_errors_hist"), wxGetApp().m_show_test_frame_errors_hist);
+
+        pConfig->Write(wxT("/MainFrame/rxNbookCtrl"), wxGetApp().m_rxNbookCtrl);
+
+        pConfig->Write(wxT("/Audio/SquelchActive"),         g_SquelchActive);
+        pConfig->Write(wxT("/Audio/SquelchLevel"),          (int)(g_SquelchLevel*2.0));
+
+        pConfig->Write(wxT("/Audio/framesPerBuffer"),       wxGetApp().m_framesPerBuffer);
+
+        pConfig->Write(wxT("/Audio/soundCard1InDeviceNum"),   g_soundCard1InDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard1OutDeviceNum"),  g_soundCard1OutDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard1SampleRate"),    g_soundCard1SampleRate );
+
+        pConfig->Write(wxT("/Audio/soundCard2InDeviceNum"),   g_soundCard2InDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard2OutDeviceNum"),  g_soundCard2OutDeviceNum);
+        pConfig->Write(wxT("/Audio/soundCard2SampleRate"),    g_soundCard2SampleRate );
+
+        pConfig->Write(wxT("/Rig/HalfDuplex"),              wxGetApp().m_boolHalfDuplex);
+        pConfig->Write(wxT("/Rig/leftChannelVoxTone"),      wxGetApp().m_leftChannelVoxTone);
+        pConfig->Write("/Hamlib/UseForPTT", wxGetApp().m_boolHamlibUseForPTT);
+        pConfig->Write("/Hamlib/RigName", wxGetApp().m_intHamlibRig);
+        pConfig->Write("/Hamlib/SerialPort", wxGetApp().m_strHamlibSerialPort);
+
+
+        pConfig->Write(wxT("/File/playFileToMicInPath"),    wxGetApp().m_playFileToMicInPath);
+        pConfig->Write(wxT("/File/recFileFromRadioPath"),   wxGetApp().m_recFileFromRadioPath);
+        pConfig->Write(wxT("/File/recFileFromRadioSecs"),   wxGetApp().m_recFileFromRadioSecs);
+        pConfig->Write(wxT("/File/playFileFromRadioPath"),  wxGetApp().m_playFileFromRadioPath);
+
+        pConfig->Write(wxT("/Audio/snrSlow"), wxGetApp().m_snrSlow);
+
+        pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
+        pConfig->Write(wxT("/Data/TextEncoding"), wxGetApp().m_textEncoding);
+        pConfig->Write(wxT("/Data/EnableChecksumOnMsgRx"), wxGetApp().m_enable_checksum);
+        pConfig->Write(wxT("/Events/enable"), wxGetApp().m_events);
+        pConfig->Write(wxT("/Events/spam_timer"), wxGetApp().m_events_spam_timer);
+        pConfig->Write(wxT("/Events/regexp_match"), wxGetApp().m_events_regexp_match);
+        pConfig->Write(wxT("/Events/regexp_replace"), wxGetApp().m_events_regexp_replace);
+        pConfig->Write(wxT("/UDP/enable"), wxGetApp().m_udp_enable);
+        pConfig->Write(wxT("/UDP/port"),  wxGetApp().m_udp_port);
+
+        pConfig->Write(wxT("/Filter/MicInEQEnable"), wxGetApp().m_MicInEQEnable);
+        pConfig->Write(wxT("/Filter/SpkOutEQEnable"), wxGetApp().m_SpkOutEQEnable);
+
+        pConfig->Write(wxT("/FreeDV700/txClip"), wxGetApp().m_FreeDV700txClip);
+
+        int mode;
+        if (m_rb1600->GetValue())
+            mode = 0;
+        if (m_rb700->GetValue())
+            mode = 1;
+        pConfig->Write(wxT("/Audio/mode"), mode);
+    }
+
+    //m_togRxID->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnRxIDUI), NULL, this);
+    //m_togTxID->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTxIDUI), NULL, this);
+    m_togBtnOnOff->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnOnOffUI), NULL, this);
+    m_togBtnSplit->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnSplitClickUI), NULL, this);
+    m_togBtnAnalog->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnAnalogClickUI), NULL, this);
+    //m_togBtnALC->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnALCClickUI), NULL, this);
+    //m_btnTogPTT->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnPTT_UI), NULL, this);
+
+    sox_biquad_finish();
+
+    if (m_RxRunning)
+    {
+        stopRxStream();
+    }
+    if (g_sfPlayFile != NULL)
+    {
+        sf_close(g_sfPlayFile);
+        g_sfPlayFile = NULL;
+    }
+    if (g_sfRecFile != NULL)
+    {
+        sf_close(g_sfRecFile);
+        g_sfRecFile = NULL;
+    }
+#ifdef _USE_TIMER
+    if(m_plotTimer.IsRunning())
+    {
+        m_plotTimer.Stop();
+        Unbind(wxEVT_TIMER, &MainFrame::OnTimer, this);
+    }
+#endif //_USE_TIMER
+
+#ifdef _USE_ONIDLE
+    Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this);
+#endif // _USE_ONIDLE
+
+    delete wxConfigBase::Set((wxConfigBase *) NULL);
+}
+
+//----------------------------------------------------------------
+// closeComPort() closes the currently open com port
+//----------------------------------------------------------------
+void MainFrame::closeComPort(void)
+{
+#ifdef _WIN32
+       CloseHandle(com_handle);
+#else
+       close(com_handle);
+#endif
+       com_handle = COM_HANDLE_INVALID;
+}
+
+//----------------------------------------------------------------
+// openComPort() opens the com port specified by the string
+// ie: "COM1" on Windows or "/dev/ttyu0" on FreeBSD
+//----------------------------------------------------------------
+bool MainFrame::openComPort(const char *name)
+{
+       if(com_handle != COM_HANDLE_INVALID)
+               closeComPort();
+#ifdef _WIN32
+       {
+               COMMCONFIG CC;
+               DWORD CCsize=sizeof(CC);
+               COMMTIMEOUTS timeouts;
+               DCB     dcb;
+
+               if(GetDefaultCommConfigA(name, &CC, &CCsize)) {
+                       CC.dcb.fOutxCtsFlow             = FALSE;
+                       CC.dcb.fOutxDsrFlow             = FALSE;
+                       CC.dcb.fDtrControl              = DTR_CONTROL_DISABLE;
+                       CC.dcb.fDsrSensitivity  = FALSE;
+                       CC.dcb.fRtsControl              = RTS_CONTROL_DISABLE;
+                       SetDefaultCommConfigA(name, &CC, CCsize);
+               }
+
+               if((com_handle=CreateFileA(name
+                       ,GENERIC_READ|GENERIC_WRITE     /* Access */
+                       ,0                                                              /* Share mode */
+                       ,NULL                                                   /* Security attributes */
+                       ,OPEN_EXISTING                                  /* Create access */
+                       ,FILE_ATTRIBUTE_NORMAL                  /* File attributes */
+                       ,NULL                                                   /* Template */
+                       ))==INVALID_HANDLE_VALUE)
+                       return false;
+
+               if(GetCommTimeouts(com_handle, &timeouts)) {
+                       timeouts.ReadIntervalTimeout=MAXDWORD;
+                       timeouts.ReadTotalTimeoutMultiplier=0;
+                       timeouts.ReadTotalTimeoutConstant=0;            // No-wait read timeout
+                       timeouts.WriteTotalTimeoutMultiplier=0;
+                       timeouts.WriteTotalTimeoutConstant=5000;        // 5 seconds
+                       SetCommTimeouts(com_handle,&timeouts);
+               }
+
+               /* Force N-8-1 mode: */
+               if(GetCommState(com_handle, &dcb)==TRUE) {
+                       dcb.ByteSize            = 8;
+                       dcb.Parity                      = NOPARITY;
+                       dcb.StopBits            = ONESTOPBIT;
+                       dcb.DCBlength           = sizeof(DCB);
+                       dcb.fBinary                     = TRUE;
+                       dcb.fOutxCtsFlow        = FALSE;
+                       dcb.fOutxDsrFlow        = FALSE;
+                       dcb.fDtrControl         = DTR_CONTROL_DISABLE;
+                       dcb.fDsrSensitivity     = FALSE;
+                       dcb.fTXContinueOnXoff= TRUE;
+                       dcb.fOutX                       = FALSE;
+                       dcb.fInX                        = FALSE;
+                       dcb.fRtsControl         = RTS_CONTROL_DISABLE;
+                       dcb.fAbortOnError       = FALSE;
+                       SetCommState(com_handle, &dcb);
+               }
+       }
+#else
+       {
+               struct termios t;
+
+               if((com_handle=open(name, O_NONBLOCK|O_RDWR))==COM_HANDLE_INVALID)
+                       return false;
+
+               if(tcgetattr(com_handle, &t)==-1) {
+                       close(com_handle);
+                       com_handle = COM_HANDLE_INVALID;
+                       return false;
+               }
+
+               t.c_iflag = (
+                                         IGNBRK   /* ignore BREAK condition */
+                                       | IGNPAR   /* ignore (discard) parity errors */
+                                       );
+               t.c_oflag = 0;  /* No output processing */
+               t.c_cflag = (
+                                         CS8         /* 8 bits */
+                                       | CREAD       /* enable receiver */
+               /*
+               Fun snippet from the FreeBSD manpage:
+
+                        If CREAD is set, the receiver is enabled.  Otherwise, no character is
+                        received.  Not all hardware supports this bit.  In fact, this flag is
+                        pretty silly and if it were not part of the termios specification it
+                        would be omitted.
+               */
+                                       | CLOCAL      /* ignore modem status lines */
+                                       );
+               t.c_lflag = 0;  /* No local modes */
+               if(tcsetattr(com_handle, TCSANOW, &t)==-1) {
+                       close(com_handle);
+                       com_handle = COM_HANDLE_INVALID;
+                       return false;
+               }
+               
+       }
+#endif
+       return true;
+}
+
+#ifdef _USE_ONIDLE
+void MainFrame::OnIdle(wxIdleEvent &evt) {
+}
+#endif
+
+//----------------------------------------------------------------
+// (raise|lower)(RTS|DTR)()
+//
+// Raises/lowers the specified signal
+//----------------------------------------------------------------
+void MainFrame::raiseDTR(void)
+{
+       if(com_handle == COM_HANDLE_INVALID)
+               return;
+#ifdef _WIN32
+       EscapeCommFunction(com_handle, SETDTR);
+#else
+       {       // For C89 happiness
+               int flags = TIOCM_DTR;
+               ioctl(com_handle, TIOCMBIS, &flags);
+       }
+#endif
+}
+void MainFrame::raiseRTS(void)
+{
+       if(com_handle == COM_HANDLE_INVALID)
+               return;
+#ifdef _WIN32
+       EscapeCommFunction(com_handle, SETRTS);
+#else
+       {       // For C89 happiness
+               int flags = TIOCM_RTS;
+               ioctl(com_handle, TIOCMBIS, &flags);
+       }
+#endif
+}
+void MainFrame::lowerDTR(void)
+{
+       if(com_handle == COM_HANDLE_INVALID)
+               return;
+#ifdef _WIN32
+       EscapeCommFunction(com_handle, CLRDTR);
+#else
+       {       // For C89 happiness
+               int flags = TIOCM_DTR;
+               ioctl(com_handle, TIOCMBIC, &flags);
+       }
+#endif
+}
+void MainFrame::lowerRTS(void)
+{
+       if(com_handle == COM_HANDLE_INVALID)
+               return;
+#ifdef _WIN32
+       EscapeCommFunction(com_handle, CLRRTS);
+#else
+       {       // For C89 happiness
+               int flags = TIOCM_RTS;
+               ioctl(com_handle, TIOCMBIC, &flags);
+       }
+#endif
+}
+
+
+#ifdef _USE_TIMER
+//----------------------------------------------------------------
+// OnTimer()
+//
+// when the timer fires every DT seconds we update the GUI displays.
+// the tabs only the plot that is visible actually gets updated, this
+// keeps CPU load reasonable
+//----------------------------------------------------------------
+void MainFrame::OnTimer(wxTimerEvent &evt)
+{
+
+    int r,c;
+
+    if (m_panelWaterfall->checkDT()) {
+        m_panelWaterfall->setRxFreq(FDMDV_FCENTRE - g_RxFreqOffsetHz);
+        m_panelWaterfall->m_newdata = true;
+        m_panelWaterfall->Refresh();
+    }
+
+    m_panelSpectrum->setRxFreq(FDMDV_FCENTRE - g_RxFreqOffsetHz);
+    m_panelSpectrum->m_newdata = true;
+    m_panelSpectrum->Refresh();
+
+    /* update scatter plot -----------------------------------------------------------------*/
+
+    for (r=0; r<g_stats.nr; r++) {
+        
+        if (g_pfreedv->mode == FREEDV_MODE_1600) {
+            m_panelScatter->add_new_samples(&g_stats.rx_symbols[r][0]);
+        }
+
+        if (g_pfreedv->mode == FREEDV_MODE_700) {
+
+            /* 
+               FreeDV 700 uses diversity, so combine symbols for
+               scatter plot, as combined symbols are used for
+               demodulation.  Note we need to use a copy of the
+               symbols, as we are not sure when the stats will be
+               updated.
+            */
+
+            COMP rx_symbols_copy[g_Nc/2];
+
+            for(c=0; c<g_Nc/2; c++)
+                rx_symbols_copy[c] = cadd(g_stats.rx_symbols[r][c], g_stats.rx_symbols[r][c+g_Nc/2]);
+            m_panelScatter->add_new_samples(rx_symbols_copy);
+        }
+       
+    }
+
+    m_panelScatter->Refresh();
+
+    // Oscilliscope type speech plots -------------------------------------------------------
+
+    short speechInPlotSamples[WAVEFORM_PLOT_BUF];
+    if (fifo_read(g_plotSpeechInFifo, speechInPlotSamples, WAVEFORM_PLOT_BUF)) {
+        memset(speechInPlotSamples, 0, WAVEFORM_PLOT_BUF*sizeof(short));
+        //fprintf(stderr, "empty!\n");
+    }
+    m_panelSpeechIn->add_new_short_samples(0, speechInPlotSamples, WAVEFORM_PLOT_BUF, 32767);
+    m_panelSpeechIn->Refresh();
+
+    short speechOutPlotSamples[WAVEFORM_PLOT_BUF];
+    if (fifo_read(g_plotSpeechOutFifo, speechOutPlotSamples, WAVEFORM_PLOT_BUF))
+        memset(speechOutPlotSamples, 0, WAVEFORM_PLOT_BUF*sizeof(short));
+    m_panelSpeechOut->add_new_short_samples(0, speechOutPlotSamples, WAVEFORM_PLOT_BUF, 32767);
+    m_panelSpeechOut->Refresh();
+
+    short demodInPlotSamples[WAVEFORM_PLOT_BUF];
+    if (fifo_read(g_plotDemodInFifo, demodInPlotSamples, WAVEFORM_PLOT_BUF)) {
+        memset(demodInPlotSamples, 0, WAVEFORM_PLOT_BUF*sizeof(short));
+    }
+    m_panelDemodIn->add_new_short_samples(0,demodInPlotSamples, WAVEFORM_PLOT_BUF, 32767);
+    m_panelDemodIn->Refresh();
+
+    // Demod states -----------------------------------------------------------------------
+
+    m_panelTimeOffset->add_new_sample(0, (float)g_stats.rx_timing/FDMDV_NOM_SAMPLES_PER_FRAME);
+    m_panelTimeOffset->Refresh();
+
+    m_panelFreqOffset->add_new_sample(0, g_stats.foff);
+    m_panelFreqOffset->Refresh();
+
+    // SNR text box and gauge ------------------------------------------------------------
+
+    // LP filter g_stats.snr_est some more to stabilise the
+    // display. g_stats.snr_est already has some low pass filtering
+    // but we need it fairly fast to activate squelch.  So we
+    // optionally perform some further filtering for the display
+    // version of SNR.  The "Slow" checkbox controls the amount of
+    // filtering.  The filtered snr also controls the squelch
+
+    g_snr = m_snrBeta*g_snr + (1.0 - m_snrBeta)*g_stats.snr_est;
+    float snr_limited = g_snr;
+    if (snr_limited < -5.0) snr_limited = -5.0;
+    if (snr_limited > 20.0) snr_limited = 20.0;
+
+    char snr[15];
+    sprintf(snr, "%d", (int)(g_snr+0.5)); // round to nearest dB
+
+    //printf("snr_est: %f m_snrBeta: %f g_snr: %f snr_limited: %f\n", g_stats.snr_est,  m_snrBeta, g_snr, snr_limited);
+
+    wxString snr_string(snr);
+    m_textSNR->SetLabel(snr_string);
+    m_gaugeSNR->SetValue((int)(snr_limited+5));
+
+    // Level Gauge -----------------------------------------------------------------------
+
+    float tooHighThresh;
+    if (!g_tx && m_RxRunning)
+    {
+        // receive mode - display From Radio peaks
+        // peak from this DT sampling period
+        int maxDemodIn = 0;
+        for(int i=0; i<WAVEFORM_PLOT_BUF; i++)
+            if (maxDemodIn < abs(demodInPlotSamples[i]))
+                maxDemodIn = abs(demodInPlotSamples[i]);
+
+        // peak from last second
+        if (maxDemodIn > m_maxLevel)
+            m_maxLevel = maxDemodIn;
+
+        tooHighThresh = FROM_RADIO_MAX;
+    }
+    else
+    {
+        // transmit mode - display From Mic peaks
+
+        // peak from this DT sampling period
+        int maxSpeechIn = 0;
+        for(int i=0; i<WAVEFORM_PLOT_BUF; i++)
+            if (maxSpeechIn < abs(speechInPlotSamples[i]))
+                maxSpeechIn = abs(speechInPlotSamples[i]);
+
+        // peak from last second
+        if (maxSpeechIn > m_maxLevel)
+            m_maxLevel = maxSpeechIn;
+
+       tooHighThresh = FROM_MIC_MAX;
+    }
+
+    // Peak Reading meter: updates peaks immediately, then slowly decays
+    int maxScaled = (int)(100.0 * ((float)m_maxLevel/32767.0));
+    m_gaugeLevel->SetValue(maxScaled);
+    //printf("maxScaled: %d\n", maxScaled);
+    if (((float)maxScaled/100) > tooHighThresh)
+        m_textLevel->SetLabel("Too High");
+    else
+        m_textLevel->SetLabel("");
+
+    m_maxLevel *= LEVEL_BETA;
+
+    // sync LED (Colours don't work on Windows) ------------------------
+
+    if (g_State) {
+        m_rbSync->SetForegroundColour( wxColour( 0, 255, 0 ) ); // green
+        m_rbSync->SetValue(true);
+    }
+    else {
+        m_rbSync->SetForegroundColour( wxColour( 255, 0, 0 ) ); // red
+        m_rbSync->SetValue(false);
+    }
+
+    // send Callsign ----------------------------------------------------
+
+    char callsign[MAX_CALLSIGN];
+    strncpy(callsign, (const char*) wxGetApp().m_callSign.mb_str(wxConvUTF8), MAX_CALLSIGN-1);
+
+    // buffer 1 txt message to ensure tx data fifo doesn't "run dry"
+
+    if ((unsigned)fifo_used(g_txDataInFifo) < strlen(callsign)) {
+        unsigned int  i;
+
+        //fprintf(g_logfile, "tx callsign: %s.\n", callsign);
+
+        /* optionally append checksum */
+
+        if (wxGetApp().m_enable_checksum) {
+
+            unsigned char checksum = 0;
+            char callsign_checksum_cr[MAX_CALLSIGN+1];
+
+            for(i=0; i<strlen(callsign); i++)
+                checksum += callsign[i];
+            sprintf(callsign_checksum_cr, "%s%2x", callsign, checksum);
+            callsign_checksum_cr[strlen(callsign)+2] = 13;
+            callsign_checksum_cr[strlen(callsign)+3] = 0;
+            strcpy(callsign, callsign_checksum_cr);
+        }
+        else {
+            callsign[strlen(callsign)] = 13;
+            callsign[strlen(callsign)+1] = 0;
+        }
+
+        //fprintf(g_logfile, "tx callsign: %s.\n", callsign);
+
+        // write chars to tx data fifo
+
+        for(i=0; i<strlen(callsign); i++) {
+            short ashort = (short)callsign[i];
+            fifo_write(g_txDataInFifo, &ashort, 1);
+        }
+    }
+
+    // See if any Callsign info received --------------------------------
+
+    short ashort;
+    while (fifo_read(g_rxDataOutFifo, &ashort, 1) == 0) {
+
+        if ((ashort == 13) || ((m_pcallsign - m_callsign) > MAX_CALLSIGN-1)) {
+            // CR completes line
+            *m_pcallsign = 0;
+            
+            /* Checksums can be disabled, e.g. for compatability with
+               older vesions.  In that case we print msg but don't do
+               any event processing.  If checksums enabled, only print
+               out when checksum is good. */
+
+            if (wxGetApp().m_enable_checksum) {
+                // lets see if checksum is OK
+            
+                unsigned char checksum_rx = 0;
+                if (strlen(m_callsign) > 2) {
+                    for(unsigned int i=0; i<strlen(m_callsign)-2; i++)
+                        checksum_rx += m_callsign[i];
+                }
+                unsigned int checksum_tx;
+                int ret = sscanf(&m_callsign[strlen(m_callsign)-2], "%2x", &checksum_tx);
+                //fprintf(g_logfile, "rx callsign: %s.\n  checksum tx: %02x checksum rx: %02x\n", m_callsign, checksum_tx, checksum_rx);
+
+                wxString s;
+                if (ret && (checksum_tx == checksum_rx)) {
+                    m_callsign[strlen(m_callsign)-2] = 0;
+                    s.Printf("%s", m_callsign);
+                    m_txtCtrlCallSign->SetValue(s);
+
+                    char s1[MAX_CALLSIGN];
+                    sprintf(s1,"rx_txtmsg %s", m_callsign);
+                    processTxtEvent(s1);
+
+                    m_checksumGood++;
+                    s.Printf("%d", m_checksumGood);
+                    m_txtChecksumGood->SetLabel(s);              
+                }
+                else {
+                    m_checksumBad++;
+                    s.Printf("%d", m_checksumBad);
+                    m_txtChecksumBad->SetLabel(s);        
+                }
+            }
+
+            //fprintf(g_logfile,"resetting callsign %s %ld\n", m_callsign, m_pcallsign-m_callsign);
+            // reset ptr to start of string
+            m_pcallsign = m_callsign;
+        }
+        else {
+            //fprintf(g_logfile, "new char %d %c\n", ashort, (char)ashort);
+            *m_pcallsign++ = (char)ashort;
+        }
+
+        /* If checksums disabled, display txt chars as they arrive */
+
+        if (!wxGetApp().m_enable_checksum) {
+            m_txtCtrlCallSign->SetValue(m_callsign);
+        }
+    }
+
+    // Run time update of EQ filters -----------------------------------
+    if (m_newMicInFilter || m_newSpkOutFilter) {
+        g_mutexProtectingCallbackData.Lock();
+        deleteEQFilters(g_rxUserdata);
+        designEQFilters(g_rxUserdata);
+        g_mutexProtectingCallbackData.Unlock();
+        m_newMicInFilter = m_newSpkOutFilter = false;
+    }
+    g_rxUserdata->micInEQEnable = wxGetApp().m_MicInEQEnable;
+    g_rxUserdata->spkOutEQEnable = wxGetApp().m_SpkOutEQEnable;
+
+    // Run time update of FreeDV 700 tx clipper
+
+    g_pfreedv->clip = (int)wxGetApp().m_FreeDV700txClip;
+
+    // Test Frame Bit Error Updates ------------------------------------
+
+    // Toggle test frame mode at run time
+
+    if (!g_pfreedv->test_frames && wxGetApp().m_testFrames) {
+
+        // reset stats on check box off to on transition
+
+        g_pfreedv->test_frames = 1;
+        g_pfreedv->test_frame_sync_state = 0;
+        g_pfreedv->total_bits = 0;
+        g_pfreedv->total_bit_errors = 0;
+    }
+    g_pfreedv->test_frames =  wxGetApp().m_testFrames;
+    g_channel_noise =  wxGetApp().m_channel_noise;
+
+    if (g_State) {
+        char bits[80], errors[80], ber[80];
+
+        // update stats on main page
+
+        sprintf(bits, "Bits: %d", (int)g_pfreedv->total_bits); wxString bits_string(bits); m_textBits->SetLabel(bits_string);
+        sprintf(errors, "Errs: %d", (int)g_pfreedv->total_bit_errors); wxString errors_string(errors); m_textErrors->SetLabel(errors_string);
+        float b = (float)g_pfreedv->total_bit_errors/(1E-6+g_pfreedv->total_bits);
+        sprintf(ber, "BER: %4.3f", b); wxString ber_string(ber); m_textBER->SetLabel(ber_string);
+
+        // update error plots
+
+        int sz_error_pattern = g_pfreedv->sz_error_pattern;
+        short error_pattern[sz_error_pattern];
+
+        if (fifo_read(g_error_pattern_fifo, error_pattern, sz_error_pattern) == 0) {
+            int i,b;
+
+            /* both modes map IQ to alternate bits, but one same carrier */
+
+            if (g_pfreedv->mode == FREEDV_MODE_1600) {
+                /* FreeDV 1600 mapping from error pattern to bit on each carrier */
+
+                for(b=0; b<g_Nc*2; b++) {
+                    for(i=b; i<sz_error_pattern; i+= 2*g_Nc) {
+                        m_panelTestFrameErrors->add_new_sample(b, b + 0.8*error_pattern[i]);
+                        g_error_hist[b] += error_pattern[i];
+                    }
+                    //if (b%2)
+                    //    printf("g_error_hist[%d]: %d\n", b/2, g_error_hist[b/2]);
+                }
+
+                int max_hist = 0;
+                for(b=0; b<g_Nc; b++)
+                    if (g_error_hist[b] > max_hist)
+                        max_hist = g_error_hist[b];
+
+                m_panelTestFrameErrorsHist->add_new_short_samples(0, g_error_hist, 2*FDMDV_NC_MAX, max_hist);
+            }
+       
+            if (g_pfreedv->mode == FREEDV_MODE_700) {
+                int c;
+
+                /* FreeDV 700 mapping from error pattern to bit on each
+                   carrier.  Note we don't have access to carriers before
+                   diversity re-combination, so this won't give us the full
+                   picture, we have to assume Nc/2 carriers. */
+
+                for(i=0; i<sz_error_pattern; i++) {
+                    c = i/4;
+                    m_panelTestFrameErrors->add_new_sample(c, c + 0.8*error_pattern[i]);
+                    g_error_hist[c] += error_pattern[i];
+                    //printf("i: %d c: %d\n", i, c);
+                }
+
+                int max_hist = 0;
+                for(b=0; b<g_Nc; b++)
+                    if (g_error_hist[b] > max_hist)
+                        max_hist = g_error_hist[b];
+                m_panelTestFrameErrorsHist->add_new_short_samples(0, g_error_hist, 2*FDMDV_NC_MAX, max_hist);                
+            }
+            m_panelTestFrameErrors->Refresh();       
+            m_panelTestFrameErrorsHist->Refresh();
+        }
+    }
+
+    // command from UDP thread that is best processed in main thread to avoid seg faults
+
+    if (m_schedule_restore) {
+        if (IsIconized())
+            Restore();
+        m_schedule_restore = false;
+    }
+
+    // Light Spam Timer LED if at least one timer is running
+
+    int i;
+    optionsDlg->SetSpamTimerLight(false);
+    for(i=0; i<MAX_EVENT_RULES; i++)
+        if (spamTimer[i].IsRunning())
+            optionsDlg->SetSpamTimerLight(true);        
+
+    // Blink file playback status line
+
+    if (g_playFileFromRadio) {
+        g_blink += DT;
+        //fprintf(g_logfile, "g_blink: %f\n", g_blink);
+        if ((g_blink >= 1.0) && (g_blink < 2.0))
+            SetStatusText(wxT("Playing into from radio"), 0);
+        if (g_blink >= 2.0) {
+            SetStatusText(wxT(""), 0);
+            g_blink = 0.0;
+        }
+    }
+
+}
+#endif
+
+
+//-------------------------------------------------------------------------
+// OnCloseFrame()
+//-------------------------------------------------------------------------
+void MainFrame::OnCloseFrame(wxCloseEvent& event)
+{
+    Pa_Terminate();
+    Destroy();
+}
+
+//-------------------------------------------------------------------------
+// OnTop()
+//-------------------------------------------------------------------------
+void MainFrame::OnTop(wxCommandEvent& event)
+{
+    int style = GetWindowStyle();
+
+    if (style & wxSTAY_ON_TOP)
+    {
+        style &= ~wxSTAY_ON_TOP;
+    }
+    else
+    {
+        style |= wxSTAY_ON_TOP;
+    }
+    SetWindowStyle(style);
+}
+
+//-------------------------------------------------------------------------
+// OnDeleteConfig()
+//-------------------------------------------------------------------------
+void MainFrame::OnDeleteConfig(wxCommandEvent&)
+{
+    wxConfigBase *pConfig = wxConfigBase::Get();
+    if(pConfig->DeleteAll())
+    {
+        wxLogMessage(wxT("Config file/registry key successfully deleted."));
+
+        delete wxConfigBase::Set(NULL);
+        wxConfigBase::DontCreateOnDemand();
+    }
+    else
+    {
+        wxLogError(wxT("Deleting config file/registry key failed."));
+    }
+}
+
+//-------------------------------------------------------------------------
+// Paint()
+//-------------------------------------------------------------------------
+void MainFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+    wxPaintDC dc(this);
+
+    if(GetMenuBar()->IsChecked(ID_PAINT_BG))
+    {
+        dc.Clear();
+    }
+    dc.SetUserScale(m_zoom, m_zoom);
+}
+
+//-------------------------------------------------------------------------
+// OnCmdSliderScroll()
+//-------------------------------------------------------------------------
+void MainFrame::OnCmdSliderScroll(wxScrollEvent& event)
+{
+    char sqsnr[15];
+    g_SquelchLevel = (float)m_sliderSQ->GetValue()/2.0 - 5.0;   
+    sprintf(sqsnr, "%4.1f", g_SquelchLevel); // 0.5 dB steps
+    wxString sqsnr_string(sqsnr);
+    m_textSQ->SetLabel(sqsnr_string);
+
+    event.Skip();
+}
+
+//-------------------------------------------------------------------------
+// OnCheckSQClick()
+//-------------------------------------------------------------------------
+void MainFrame::OnCheckSQClick(wxCommandEvent& event)
+{
+    if(!g_SquelchActive)
+    {
+        g_SquelchActive = true;
+    }
+    else
+    {
+        g_SquelchActive = false;
+    }
+}
+
+void MainFrame::setsnrBeta(bool snrSlow)
+{
+    if(snrSlow)
+    {
+        m_snrBeta = 0.95; // make this closer to 1.0 to smooth SNR est further
+    }
+    else
+    {
+        m_snrBeta = 0.0; // no smoothing of SNR estimate from demodulator
+    }
+}
+
+//-------------------------------------------------------------------------
+// OnCheckSQClick()
+//-------------------------------------------------------------------------
+void MainFrame::OnCheckSNRClick(wxCommandEvent& event)
+{
+    wxGetApp().m_snrSlow = m_ckboxSNR->GetValue();
+    setsnrBeta(wxGetApp().m_snrSlow);
+    //printf("m_snrSlow: %d\n", (int)wxGetApp().m_snrSlow);
+}
+
+// check for space bar press (only when running)
+
+int MainApp::FilterEvent(wxEvent& event)
+{
+    if ((event.GetEventType() == wxEVT_KEY_DOWN) && 
+        (((wxKeyEvent&)event).GetKeyCode() == WXK_SPACE))
+        {
+            // only use space to toggle PTT if we are running and no modal dialogs (like options) up
+            //fprintf(stderr,"frame->m_RxRunning: %d g_modal: %d\n",
+            //        frame->m_RxRunning, g_modal);
+            if (frame->m_RxRunning && !g_modal) {
+                if (frame->m_btnTogPTT->GetValue())
+                    frame->m_btnTogPTT->SetValue(false);
+                else
+                    frame->m_btnTogPTT->SetValue(true);
+
+                frame->togglePTT();
+
+                return true; // absorb space so we don't toggle control with focus (e.g. Start)
+
+            }
+        }
+
+    return -1;
+}
+
+//-------------------------------------------------------------------------
+// OnTogBtnPTT ()
+//-------------------------------------------------------------------------
+void MainFrame::OnTogBtnPTT (wxCommandEvent& event)
+{
+    togglePTT();
+    event.Skip();
+}
+
+void MainFrame::togglePTT(void) {
+
+    // Change tabbed page in centre panel depending on PTT state
+
+    if (g_tx)
+    {
+        // tx-> rx transition, swap to the page we were on for last rx
+        m_auiNbookCtrl->ChangeSelection(wxGetApp().m_rxNbookCtrl);
+    }
+    else
+    {
+        // rx-> tx transition, swap to Mic In page to monitor speech
+        wxGetApp().m_rxNbookCtrl = m_auiNbookCtrl->GetSelection();
+        m_auiNbookCtrl->ChangeSelection(m_auiNbookCtrl->GetPageIndex((wxWindow *)m_panelSpeechIn));
+        char e[80]; sprintf(e,"ptt"); processTxtEvent(e);
+    }
+
+    g_tx = m_btnTogPTT->GetValue();
+
+    // Hamlib PTT
+
+    if (wxGetApp().m_boolHamlibUseForPTT) {        
+        Hamlib *hamlib = wxGetApp().m_hamlib; 
+        if (wxGetApp().m_boolHamlibUseForPTT && hamlib != NULL) {
+            hamlib->ptt(g_tx);
+        }
+    }
+
+    // Serial PTT
+
+    /*  Truth table:
+
+          g_tx   RTSPos   RTS
+          -------------------
+          0      1        0
+          1      1        1
+          0      0        1
+          1      0        0
+
+          exclusive NOR
+    */
+
+    if(wxGetApp().m_boolUseSerialPTT && (com_handle != COM_HANDLE_INVALID)) {
+        if (wxGetApp().m_boolUseRTS) {
+            printf("g_tx: %d m_boolRTSPos: %d serialLine: %d\n", g_tx, wxGetApp().m_boolRTSPos, g_tx == wxGetApp().m_boolRTSPos);
+            if (g_tx == wxGetApp().m_boolRTSPos)
+                raiseRTS();
+            else
+                lowerRTS();
+        }
+        if (wxGetApp().m_boolUseDTR) {
+            printf("g_tx: %d m_boolDTRPos: %d serialLine: %d\n", g_tx, wxGetApp().m_boolDTRPos, g_tx == wxGetApp().m_boolDTRPos);
+            if (g_tx == wxGetApp().m_boolDTRPos)
+                raiseDTR();
+            else
+                lowerDTR();
+        }
+    }
+
+    // reset level gauge
+
+    m_maxLevel = 0;
+    m_textLevel->SetLabel(wxT(""));
+    m_gaugeLevel->SetValue(0);
+}
+
+//-------------------------------------------------------------------------
+// OnTogBtnRxID()
+//-------------------------------------------------------------------------
+void MainFrame::OnTogBtnRxID(wxCommandEvent& event)
+{
+    // empty any junk in rx data FIFO
+    short junk;
+    while(fifo_read(g_rxDataOutFifo,&junk,1) == 0);
+    event.Skip();
+}
+
+//-------------------------------------------------------------------------
+// OnTogBtnTxID()
+//-------------------------------------------------------------------------
+void MainFrame::OnTogBtnTxID(wxCommandEvent& event)
+{
+    event.Skip();
+}
+
+void MainFrame::OnTogBtnSplitClick(wxCommandEvent& event) {
+    if (g_split)
+        g_split = 0;
+    else
+        g_split = 1;
+    event.Skip();
+}
+
+//-------------------------------------------------------------------------
+// OnTogBtnAnalogClick()
+//-------------------------------------------------------------------------
+void MainFrame::OnTogBtnAnalogClick (wxCommandEvent& event)
+{
+    if (g_analog == 0) {
+        g_analog = 1;
+        m_panelSpectrum->setFreqScale(MODEM_STATS_NSPEC*((float)MAX_F_HZ/(FS/2)));
+        m_panelWaterfall->setFs(FS);
+    }
+    else {
+        g_analog = 0;
+        m_panelSpectrum->setFreqScale(MODEM_STATS_NSPEC*((float)MAX_F_HZ/(g_pfreedv->modem_sample_rate/2)));
+        m_panelWaterfall->setFs(g_pfreedv->modem_sample_rate);
+    }
+
+    g_State = 0;
+    g_stats.snr_est = 0;
+
+    event.Skip();
+}
+
+void MainFrame::OnCallSignReset(wxCommandEvent& event)
+{
+    m_pcallsign = m_callsign;
+    memset(m_callsign, 0, MAX_CALLSIGN);
+    wxString s;
+    s.Printf("%s", m_callsign);
+    m_txtCtrlCallSign->SetValue(s);
+    m_checksumGood = m_checksumBad = 0;
+    m_txtChecksumGood->SetLabel(_("0"));
+    m_txtChecksumBad->SetLabel(_("0"));
+}
+
+void MainFrame::OnBerReset(wxCommandEvent& event)
+{
+    g_pfreedv->total_bits = 0;
+    g_pfreedv->total_bit_errors = 0;
+    int i;
+    for(i=0; i<2*g_Nc; i++)
+        g_error_hist[i] = 0;
+    
+}
+
+#ifdef ALC
+//-------------------------------------------------------------------------
+// OnTogBtnALCClick()
+//-------------------------------------------------------------------------
+void MainFrame::OnTogBtnALCClick(wxCommandEvent& event)
+{
+    wxMessageBox(wxT("Got Click!"), wxT("OnTogBtnALCClick"), wxOK);
+
+    event.Skip();
+}
+#endif
+
+// extra panel added to file open dialog to add loop checkbox
+MyExtraPlayFilePanel::MyExtraPlayFilePanel(wxWindow *parent): wxPanel(parent)
+{
+    m_cb = new wxCheckBox(this, -1, wxT("Loop"));
+    m_cb->SetToolTip(_("When checked file will repeat forever"));
+    m_cb->SetValue(g_loopPlayFileToMicIn);
+
+    // bug: I can't this to align right.....
+    wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
+    sizerTop->Add(m_cb, 0, wxALIGN_RIGHT, 0);
+    SetSizerAndFit(sizerTop);
+}
+
+static wxWindow* createMyExtraPlayFilePanel(wxWindow *parent)
+{
+    return new MyExtraPlayFilePanel(parent);
+}
+
+//-------------------------------------------------------------------------
+// OnPlayFileToMicIn()
+//-------------------------------------------------------------------------
+void MainFrame::OnPlayFileToMicIn(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+
+    if(g_playFileToMicIn)
+    {
+        g_mutexProtectingCallbackData.Lock();
+        g_playFileToMicIn = false;
+        sf_close(g_sfPlayFile);
+        SetStatusText(wxT(""));
+        g_mutexProtectingCallbackData.Unlock();
+    }
+    else
+    {
+        wxString    soundFile;
+        SF_INFO     sfInfo;
+
+        wxFileDialog openFileDialog(
+                                    this,
+                                    wxT("Play File to Mic In"),
+                                    wxGetApp().m_playFileToMicInPath,
+                                    wxEmptyString,
+                                    wxT("WAV and RAW files (*.wav;*.raw)|*.wav;*.raw|")
+                                    wxT("All files (*.*)|*.*"),
+                                    wxFD_OPEN | wxFD_FILE_MUST_EXIST
+                                    );
+
+        // add the loop check box
+        openFileDialog.SetExtraControlCreator(&createMyExtraPlayFilePanel);
+
+        if(openFileDialog.ShowModal() == wxID_CANCEL)
+        {
+            return;     // the user changed their mind...
+        }
+
+        wxString fileName, extension;
+        soundFile = openFileDialog.GetPath();
+        wxFileName::SplitPath(soundFile, &wxGetApp().m_playFileToMicInPath, &fileName, &extension);
+        //wxLogDebug("m_playFileToMicInPath: %s", wxGetApp().m_playFileToMicInPath);
+        sfInfo.format = 0;
+
+        if(!extension.IsEmpty())
+        {
+            extension.LowerCase();
+            if(extension == wxT("raw"))
+            {
+                sfInfo.format     = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
+                sfInfo.channels   = 1;
+                sfInfo.samplerate = FS;
+            }
+        }
+        g_sfPlayFile = sf_open(soundFile, SFM_READ, &sfInfo);
+        if(g_sfPlayFile == NULL)
+        {
+            wxString strErr = sf_strerror(NULL);
+            wxMessageBox(strErr, wxT("Couldn't open sound file"), wxOK);
+            return;
+        }
+
+        wxWindow * const ctrl = openFileDialog.GetExtraControl();
+
+        // Huh?! I just copied wxWidgets-2.9.4/samples/dialogs ....
+        g_loopPlayFileToMicIn = static_cast<MyExtraPlayFilePanel*>(ctrl)->getLoopPlayFileToMicIn();
+
+        SetStatusText(wxT("Playing File: ") + fileName + wxT(" to Mic Input") , 0);
+        g_playFileToMicIn = true;
+    }
+}
+
+//-------------------------------------------------------------------------
+// OnPlayFileFromRadio()
+// This puppy "plays" a recorded file into the demodulator input, allowing us
+// to replay off air signals.
+//-------------------------------------------------------------------------
+void MainFrame::OnPlayFileFromRadio(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+
+    printf("OnPlayFileFromRadio:: %d\n", (int)g_playFileFromRadio);
+    if (g_playFileFromRadio)
+    {
+        printf("OnPlayFileFromRadio:: Stop\n");
+        g_mutexProtectingCallbackData.Lock();
+        g_playFileFromRadio = false;
+        sf_close(g_sfPlayFileFromRadio);
+        SetStatusText(wxT(""),0);
+        SetStatusText(wxT(""),1);
+        g_mutexProtectingCallbackData.Unlock();
+    }
+    else
+    {
+        wxString    soundFile;
+        SF_INFO     sfInfo;
+
+        wxFileDialog openFileDialog(
+                                    this,
+                                    wxT("Play File - From Radio"),
+                                    wxGetApp().m_playFileFromRadioPath,
+                                    wxEmptyString,
+                                    wxT("WAV and RAW files (*.wav;*.raw)|*.wav;*.raw|")
+                                    wxT("All files (*.*)|*.*"),
+                                    wxFD_OPEN | wxFD_FILE_MUST_EXIST
+                                    );
+
+        // add the loop check box
+        openFileDialog.SetExtraControlCreator(&createMyExtraPlayFilePanel);
+
+        if(openFileDialog.ShowModal() == wxID_CANCEL)
+        {
+            return;     // the user changed their mind...
+        }
+
+        wxString fileName, extension;
+        soundFile = openFileDialog.GetPath();
+        wxFileName::SplitPath(soundFile, &wxGetApp().m_playFileFromRadioPath, &fileName, &extension);
+        //wxLogDebug("m_playFileToFromRadioPath: %s", wxGetApp().m_playFileFromRadioPath);
+        sfInfo.format = 0;
+
+        if(!extension.IsEmpty())
+        {
+            extension.LowerCase();
+            if(extension == wxT("raw"))
+            {
+                sfInfo.format     = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
+                sfInfo.channels   = 1;
+                sfInfo.samplerate = g_pfreedv->modem_sample_rate;
+            }
+        }
+        g_sfPlayFileFromRadio = sf_open(soundFile, SFM_READ, &sfInfo);
+        g_sfFs = sfInfo.samplerate;
+        if(g_sfPlayFileFromRadio == NULL)
+        {
+            wxString strErr = sf_strerror(NULL);
+            wxMessageBox(strErr, wxT("Couldn't open sound file"), wxOK);
+            return;
+        }
+
+        wxWindow * const ctrl = openFileDialog.GetExtraControl();
+
+        // Huh?! I just copied wxWidgets-2.9.4/samples/dialogs ....
+        g_loopPlayFileFromRadio = static_cast<MyExtraPlayFilePanel*>(ctrl)->getLoopPlayFileToMicIn();
+
+        SetStatusText(wxT("Playing into from radio"), 0);
+        if(extension == wxT("raw")) {
+            wxString stringnumber = wxString::Format(wxT("%d"), (int)sfInfo.samplerate);
+            SetStatusText(wxT("raw file assuming Fs=") + stringnumber, 1);          
+        }
+        fprintf(g_logfile, "OnPlayFileFromRadio:: Playing File\n");
+        g_playFileFromRadio = true;
+        g_blink = 0.0;
+    }
+}
+
+// extra panel added to file save dialog to set number of seconds to record for
+
+MyExtraRecFilePanel::MyExtraRecFilePanel(wxWindow *parent): wxPanel(parent)
+{
+    wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
+
+    wxStaticText* staticText = new wxStaticText(this, wxID_ANY, _("Seconds:"), wxDefaultPosition, wxDefaultSize, 0);
+    sizerTop->Add(staticText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    m_secondsToRecord = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    m_secondsToRecord->SetToolTip(_("Number of seconds to record for"));
+    m_secondsToRecord->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_recFileFromRadioSecs));
+    sizerTop->Add(m_secondsToRecord, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    SetSizerAndFit(sizerTop);
+}
+
+static wxWindow* createMyExtraRecFilePanel(wxWindow *parent)
+{
+    return new MyExtraRecFilePanel(parent);
+}
+
+//-------------------------------------------------------------------------
+// OnRecFileFromRadio()
+//-------------------------------------------------------------------------
+void MainFrame::OnRecFileFromRadio(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+
+    if (g_recFileFromRadio) {
+        printf("Stopping Record....\n");
+        g_mutexProtectingCallbackData.Lock();
+        g_recFileFromRadio = false;
+        sf_close(g_sfRecFile);
+        SetStatusText(wxT(""));
+        g_mutexProtectingCallbackData.Unlock();
+    }
+    else {
+
+        wxString    soundFile;
+        SF_INFO     sfInfo;
+
+         wxFileDialog openFileDialog(
+                                    this,
+                                    wxT("Record File From Radio"),
+                                    wxGetApp().m_recFileFromRadioPath,
+                                    wxEmptyString,
+                                    wxT("WAV and RAW files (*.wav;*.raw)|*.wav;*.raw|")
+                                    wxT("All files (*.*)|*.*"),
+                                    wxFD_SAVE
+                                    );
+
+        // add the loop check box
+        openFileDialog.SetExtraControlCreator(&createMyExtraRecFilePanel);
+
+        if(openFileDialog.ShowModal() == wxID_CANCEL)
+        {
+            return;     // the user changed their mind...
+        }
+
+        wxString fileName, extension;
+        soundFile = openFileDialog.GetPath();
+        wxFileName::SplitPath(soundFile, &wxGetApp().m_recFileFromRadioPath, &fileName, &extension);
+        wxLogDebug("m_recFileFromRadioPath: %s", wxGetApp().m_recFileFromRadioPath);
+        wxLogDebug("soundFile: %s", soundFile);
+        sfInfo.format = 0;
+
+        if(!extension.IsEmpty())
+        {
+            extension.LowerCase();
+            if(extension == wxT("raw"))
+            {
+                sfInfo.format     = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
+                sfInfo.channels   = 1;
+                sfInfo.samplerate = g_pfreedv->modem_sample_rate;
+            }
+            else if(extension == wxT("wav"))
+            {
+                sfInfo.format     = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+                sfInfo.channels   = 1;
+                sfInfo.samplerate = g_pfreedv->modem_sample_rate;
+            } else {
+                wxMessageBox(wxT("Invalid file format"), wxT("Record File From Radio"), wxOK);
+                return;
+            }
+        }
+        else {
+            wxMessageBox(wxT("Invalid file format"), wxT("Record File From Radio"), wxOK);
+            return;
+        }
+
+        // Bug: on Win32 I cant read m_recFileFromRadioSecs, so have hard coded it
+#ifdef __WIN32__
+        long secs = wxGetApp().m_recFileFromRadioSecs;
+        g_recFromRadioSamples = FS*(unsigned int)secs;
+#else
+        // work out number of samples to record
+
+        wxWindow * const ctrl = openFileDialog.GetExtraControl();
+        wxString secsString = static_cast<MyExtraRecFilePanel*>(ctrl)->getSecondsToRecord();
+        wxLogDebug("test: %s secsString: %s\n", wxT("testing 123"), secsString);
+
+        long secs;
+        if (secsString.ToLong(&secs)) {
+            wxGetApp().m_recFileFromRadioSecs = (unsigned int)secs;
+            //printf(" secondsToRecord: %d\n",  (unsigned int)secs);
+            g_recFromRadioSamples = FS*(unsigned int)secs;
+            //printf("g_recFromRadioSamples: %d\n", g_recFromRadioSamples);
+        }
+        else {
+            wxMessageBox(wxT("Invalid number of Seconds"), wxT("Record File From Radio"), wxOK);
+            return;
+        }
+#endif
+
+        g_sfRecFile = sf_open(soundFile, SFM_WRITE, &sfInfo);
+        if(g_sfRecFile == NULL)
+        {
+            wxString strErr = sf_strerror(NULL);
+            wxMessageBox(strErr, wxT("Couldn't open sound file"), wxOK);
+            return;
+        }
+
+        SetStatusText(wxT("Recording File: ") + fileName + wxT(" From Radio") , 0);
+        g_recFileFromRadio = true;
+    }
+
+}
+
+//-------------------------------------------------------------------------
+// OnExit()
+//-------------------------------------------------------------------------
+void MainFrame::OnExit(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+#ifdef _USE_TIMER
+    m_plotTimer.Stop();
+#endif // _USE_TIMER
+    if(g_sfPlayFile != NULL)
+    {
+        sf_close(g_sfPlayFile);
+        g_sfPlayFile = NULL;
+    }
+    if(g_sfRecFile != NULL)
+    {
+        sf_close(g_sfRecFile);
+        g_sfRecFile = NULL;
+    }
+    if(m_RxRunning)
+    {
+        stopRxStream();
+    }
+    m_togBtnSplit->Disable();
+    //m_togRxID->Disable();
+    //m_togTxID->Disable();
+    m_togBtnAnalog->Disable();
+    //m_togBtnALC->Disable();
+    //m_btnTogPTT->Disable();
+    Pa_Terminate();
+    Destroy();
+}
+
+//-------------------------------------------------------------------------
+// OnExitClick()
+//-------------------------------------------------------------------------
+void MainFrame::OnExitClick(wxCommandEvent& event)
+{
+    OnExit(event);
+}
+
+//-------------------------------------------------------------------------
+// OnToolsAudio()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsAudio(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+    int rv = 0;
+    AudioOptsDialog *dlg = new AudioOptsDialog(NULL);
+    rv = dlg->ShowModal();
+    if(rv == wxID_OK)
+    {
+        dlg->ExchangeData(EXCHANGE_DATA_OUT);
+    }
+    delete dlg;
+}
+
+//-------------------------------------------------------------------------
+// OnToolsAudioUI()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsAudioUI(wxUpdateUIEvent& event)
+{
+    event.Enable(!m_RxRunning);
+}
+
+//-------------------------------------------------------------------------
+// OnToolsFilter()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsFilter(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+    FilterDlg *dlg = new FilterDlg(NULL, m_RxRunning, &m_newMicInFilter, &m_newSpkOutFilter);
+    dlg->ShowModal();
+    delete dlg;
+}
+
+//-------------------------------------------------------------------------
+// OnToolsOptions()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsOptions(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+    g_modal = true;
+    //fprintf(stderr,"g_modal: %d\n", g_modal);
+    optionsDlg->Show();
+}
+
+//-------------------------------------------------------------------------
+// OnToolsOptionsUI()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsOptionsUI(wxUpdateUIEvent& event)
+{
+}
+
+//-------------------------------------------------------------------------
+// OnToolsComCfg()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsComCfg(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+
+    ComPortsDlg *dlg = new ComPortsDlg(NULL);
+
+    int rv = dlg->ShowModal();
+
+    // test Hamlib/Serial set up
+
+    if(rv == wxID_OK)
+    {
+        if (wxGetApp().m_boolHamlibUseForPTT) {
+            OpenHamlibRig();
+            wxGetApp().m_hamlib->close();
+        }
+        if (wxGetApp().m_boolUseSerialPTT) {
+            SetupSerialPort();
+            CloseSerialPort();
+        }
+    }
+
+    delete dlg;
+}
+
+//-------------------------------------------------------------------------
+// OnToolsComCfgUI()
+//-------------------------------------------------------------------------
+void MainFrame::OnToolsComCfgUI(wxUpdateUIEvent& event)
+{
+    event.Enable(!m_RxRunning);
+}
+
+//-------------------------------------------------------------------------
+// OnHelpCheckUpdates()
+//-------------------------------------------------------------------------
+void MainFrame::OnHelpCheckUpdates(wxCommandEvent& event)
+{
+    wxMessageBox("Got Click!", "OnHelpCheckUpdates", wxOK);
+    event.Skip();
+}
+
+//-------------------------------------------------------------------------
+// OnHelpCheckUpdatesUI()
+//-------------------------------------------------------------------------
+void MainFrame::OnHelpCheckUpdatesUI(wxUpdateUIEvent& event)
+{
+    event.Enable(false);
+}
+
+//-------------------------------------------------------------------------
+//OnHelpAbout()
+//-------------------------------------------------------------------------
+void MainFrame::OnHelpAbout(wxCommandEvent& event)
+{
+    wxUnusedVar(event);
+#ifdef _USE_ABOUT_DIALOG
+    int rv = 0;
+    AboutDlg *dlg = new AboutDlg(NULL);
+    rv = dlg->ShowModal();
+    if(rv == wxID_OK)
+    {
+        dlg->ExchangeData(EXCHANGE_DATA_OUT);
+    }
+    delete dlg;
+#else
+    wxString svnLatestRev("Can't determine latest SVN revision.");
+
+    // Try to determine current SVN revision from the Internet
+    wxURL url(wxT("http://svn.code.sf.net/p/freetel/code/fdmdv2/"));
+
+    if(url.GetError() == wxURL_NOERR)
+    {
+        wxString htmldata;
+        wxInputStream *in = url.GetInputStream();
+
+        if(in && in->IsOk())
+        {
+            //printf("In OK\n");
+            wxStringOutputStream html_stream(&htmldata);
+            in->Read(html_stream);
+            //wxLogDebug(htmldata);
+
+            wxString s("<h2>p/freetel/code - Revision ");
+            int startIndex = htmldata.find(s) + s.Length();
+            int endIndex = htmldata.find(wxT(": /fdmdv2</h2>"));
+            svnLatestRev = wxT("Latest svn revision: ") + htmldata.SubString(startIndex, endIndex-1);
+            //printf("startIndex: %d endIndex: %d\n", startIndex, endIndex);
+       }
+       delete in;
+    }
+
+    wxString msg;
+    msg.Printf( wxT("FreeDV %s\n\n")
+                wxT("Open Source Narrow Band Digital Voice over Radio\n\n")
+                wxT("For Help and Support visit: http://freedv.org\n\n")
+
+                wxT("How much have you spent on Ham gear this year?  How did it compare to FreeDV? ")
+                wxT("FreeDV repesents an open and free future for digital voice over Ham Radio. ")
+                wxT("Please help by donating just $10 here: http://freedv.org\n\n")
+
+                wxT("GNU Public License V2.1\n\n")
+                wxT("Copyright (c) David Witten KD0EAG and David Rowe VK5DGR\n\n")
+                wxT("svn revision: %s\n") + svnLatestRev, FREEDV_VERSION, SVN_REVISION);
+
+    wxMessageBox(msg, wxT("About"), wxOK | wxICON_INFORMATION, this);
+
+#endif // _USE_ABOUT_DIALOG
+#ifdef USE_SIMPLE_ABOUT_DIALOG
+    wxUnusedVar(event);
+    wxAboutDialogInfo info;
+    info.SetCopyright(_("HAMLib Test"));
+    info.SetLicence(_("GPL v2 or later"));
+    info.SetDescription(_("Short description goes here"));
+    ::wxAboutBox(info);
+#endif // USE_SIMPLE_ABOUT_DIALOG
+
+}
+
+
+// Attempt to talk to rig using Hamlib
+
+bool MainFrame::OpenHamlibRig() {
+    if (wxGetApp().m_boolHamlibUseForPTT != true)
+       return false;
+    if (wxGetApp().m_intHamlibRig == 0)
+        return false;
+    if (wxGetApp().m_hamlib == NULL)
+        return false;
+
+    int rig = wxGetApp().m_intHamlibRig;
+    wxString port = wxGetApp().m_strHamlibSerialPort;
+    bool status = wxGetApp().m_hamlib->connect(rig, port.mb_str(wxConvUTF8));
+    if (status == false)
+        wxMessageBox("Couldn't connect to Radio with hamlib", wxT("About"), wxOK | wxICON_ERROR, this);
+    return status;
+} 
+
+//-------------------------------------------------------------------------
+// OnTogBtnOnOff()
+//-------------------------------------------------------------------------
+void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
+{
+    wxString startStop = m_togBtnOnOff->GetLabel();
+
+    // we are attempting to start
+
+    if (startStop.IsSameAs("Start"))
+    {
+        //
+        // Start Running -------------------------------------------------
+        //
+
+        // modify some button states when running
+
+        m_togBtnSplit->Enable();
+        m_togBtnAnalog->Enable();
+        m_togBtnOnOff->SetLabel(wxT("Stop"));
+        m_btnTogPTT->Enable();
+
+        m_rb1600->Disable();
+        m_rb700->Disable();
+
+        // determine what mode we are using
+
+        if (m_rb1600->GetValue()) {
+            g_mode = FREEDV_MODE_1600;
+            g_Nc = 16;
+            m_panelScatter->setNc(g_Nc);
+        }
+        if (m_rb700->GetValue()) {
+            g_mode = FREEDV_MODE_700;
+            g_Nc = 14;
+            m_panelScatter->setNc(g_Nc/2-1);  /* due to diversity, -1 due to no pilot like FreeDV 1600 */
+        }
+   
+        // init freedv states
+
+        g_pfreedv = freedv_open(g_mode);
+        g_pfreedv->callback_state = NULL;
+        g_pfreedv->freedv_get_next_tx_char = &my_get_next_tx_char;
+        g_pfreedv->freedv_put_next_rx_char = &my_put_next_rx_char;
+
+        g_pfreedv->error_pattern_callback_state = (void*)m_panelTestFrameErrors;
+        g_pfreedv->freedv_put_error_pattern = &my_freedv_put_error_pattern;
+        g_error_pattern_fifo = fifo_create(2*g_pfreedv->sz_error_pattern);
+        g_error_hist = new short[FDMDV_NC_MAX*2];
+        int i;
+        for(i=0; i<2*FDMDV_NC_MAX; i++)
+            g_error_hist[i] = 0;
+
+        //if (g_mode == FREEDV_MODE_700)
+        //    cohpsk_set_verbose(g_pfreedv->cohpsk, 1);
+
+        //cohpsk_set_verbose(g_pfreedv->cohpsk, 1);
+        assert(g_pfreedv != NULL);
+        modem_stats_open(&g_stats);
+
+        // Init Speex pre-processor states
+        // by inspecting Speex source it seems that only denoiser is on be default
+
+        g_speex_st = speex_preprocess_state_init(g_pfreedv->n_speech_samples, FS); 
+
+        // adjust spectrum and waterfall freq scaling base on mode
+
+        m_panelSpectrum->setFreqScale(MODEM_STATS_NSPEC*((float)MAX_F_HZ/(g_pfreedv->modem_sample_rate/2)));
+        m_panelWaterfall->setFs(g_pfreedv->modem_sample_rate);
+
+        // adjust scatter diagram for Number of FDM carriers
+
+        // init Codec 2 LPC Post Filter
+
+        codec2_set_lpc_post_filter(g_pfreedv->codec2,
+                                   wxGetApp().m_codec2LPCPostFilterEnable,
+                                   wxGetApp().m_codec2LPCPostFilterBassBoost,
+                                   wxGetApp().m_codec2LPCPostFilterBeta,
+                                   wxGetApp().m_codec2LPCPostFilterGamma);
+
+        g_State = 0;
+        g_snr = 0.0;
+        g_half_duplex = wxGetApp().m_boolHalfDuplex;
+
+        m_pcallsign = m_callsign;
+        memset(m_callsign, 0, sizeof(m_callsign));
+        m_checksumGood = m_checksumBad = 0;
+        wxString s;
+        s.Printf("%d", m_checksumGood);
+        m_txtChecksumGood->SetLabel(s);              
+        s.Printf("%d", m_checksumBad);
+        m_txtChecksumBad->SetLabel(s);        
+
+        m_maxLevel = 0;
+        m_textLevel->SetLabel(wxT(""));
+        m_gaugeLevel->SetValue(0);
+
+        // Init text msg decoding
+
+        varicode_set_code_num(&g_pfreedv->varicode_dec_states, wxGetApp().m_textEncoding);
+        //printf("m_textEncoding = %d\n", wxGetApp().m_textEncoding);
+        //printf("g_stats.snr: %f\n", g_stats.snr_est);
+
+        // attempt to start PTT ......
+        
+        if (wxGetApp().m_boolHamlibUseForPTT)
+            OpenHamlibRig();
+        if (wxGetApp().m_boolUseSerialPTT) {
+            SetupSerialPort();
+        }
+
+        // attempt to start sound cards and tx/rx processing
+
+        startRxStream();
+
+        if (m_RxRunning)
+        {
+#ifdef _USE_TIMER
+            m_plotTimer.Start(_REFRESH_TIMER_PERIOD, wxTIMER_CONTINUOUS);
+#endif // _USE_TIMER
+        }
+        char e[80]; sprintf(e,"start"); processTxtEvent(e);
+    }
+
+    // Stop was pressed or start up failed
+
+    if (startStop.IsSameAs("Stop") || !m_RxRunning ) {
+
+        //
+        // Stop Running -------------------------------------------------
+        //
+
+        optionsDlg->SetSpamTimerLight(false);
+
+#ifdef _USE_TIMER
+        m_plotTimer.Stop();
+#endif // _USE_TIMER
+
+        // ensure we are not transmitting and shut down audio processing
+
+        if (wxGetApp().m_boolHamlibUseForPTT) {
+            Hamlib *hamlib = wxGetApp().m_hamlib; 
+            if (wxGetApp().m_boolHamlibUseForPTT && hamlib != NULL) {
+                hamlib->ptt(false);
+                hamlib->close();
+            }
+        }
+
+        if (wxGetApp().m_boolUseSerialPTT)
+            CloseSerialPort();
+
+        m_btnTogPTT->SetValue(false);
+
+        stopRxStream();
+
+        // free up states
+
+        modem_stats_close(&g_stats);
+        delete g_error_hist;
+        fifo_destroy(g_error_pattern_fifo);
+        freedv_close(g_pfreedv);
+        speex_preprocess_state_destroy(g_speex_st);
+        m_newMicInFilter = m_newSpkOutFilter = true;
+
+        m_togBtnSplit->Disable();
+        //m_togRxID->Disable();
+        //m_togTxID->Disable();
+        m_togBtnAnalog->Disable();
+        m_btnTogPTT->Disable();
+        m_togBtnOnOff->SetLabel(wxT("Start"));
+        m_rb1600->Enable();
+        m_rb700->Enable();
+#ifdef DISABLED_FEATURE
+        m_rb1400old->Enable();
+        m_rb1600Wide->Enable();
+        m_rb1400->Enable();
+        m_rb2000->Enable();
+#endif
+        char e[80]; sprintf(e,"stop"); processTxtEvent(e);
+    }
+}
+
+//-------------------------------------------------------------------------
+// stopRxStream()
+//-------------------------------------------------------------------------
+void MainFrame::stopRxStream()
+{
+    if(m_RxRunning)
+    {
+        m_RxRunning = false;
+
+        fprintf(g_logfile, "waiting for thread to stop");
+        m_txRxThread->m_run = 0;
+        m_txRxThread->Wait();
+        fprintf(g_logfile, "thread stopped");
+
+        m_rxInPa->stop();
+        m_rxInPa->streamClose();
+        delete m_rxInPa;
+        if(m_rxOutPa != m_rxInPa) {
+                       m_rxOutPa->stop();
+                       m_rxOutPa->streamClose();
+                       delete m_rxOutPa;
+               }
+
+        if (g_nSoundCards == 2) {
+            m_txInPa->stop();
+            m_txInPa->streamClose();
+            delete m_txInPa;
+            if(m_txInPa != m_txOutPa) {
+                               m_txOutPa->stop();
+                               m_txOutPa->streamClose();
+                               delete m_txOutPa;
+                       }
+        }
+
+        destroy_fifos();
+        destroy_src();
+        deleteEQFilters(g_rxUserdata);
+        delete g_rxUserdata;
+    }
+}
+
+void MainFrame::destroy_fifos(void)
+{
+    fifo_destroy(g_rxUserdata->infifo1);
+    fifo_destroy(g_rxUserdata->outfifo1);
+    fifo_destroy(g_rxUserdata->infifo2);
+    fifo_destroy(g_rxUserdata->outfifo2);
+    fifo_destroy(g_rxUserdata->rxinfifo);
+    fifo_destroy(g_rxUserdata->rxoutfifo);
+}
+
+void MainFrame::destroy_src(void)
+{
+    src_delete(g_rxUserdata->insrc1);
+    src_delete(g_rxUserdata->outsrc1);
+    src_delete(g_rxUserdata->insrc2);
+    src_delete(g_rxUserdata->outsrc2);
+    src_delete(g_rxUserdata->insrcsf);
+}
+
+void  MainFrame::initPortAudioDevice(PortAudioWrap *pa, int inDevice, int outDevice,
+                                     int soundCard, int sampleRate, int inputChannels)
+{
+    // Note all of the wrapper functions below just set values in a
+    // portaudio struct so can't return any errors. So no need to trap
+    // any errors in this function.
+
+    // init input params
+
+    pa->setInputDevice(inDevice);
+    if(inDevice != paNoDevice) {
+        pa->setInputChannelCount(inputChannels);           // stereo input
+        pa->setInputSampleFormat(PA_SAMPLE_TYPE);
+        pa->setInputLatency(pa->getInputDefaultLowLatency());
+        pa->setInputHostApiStreamInfo(NULL);
+    }
+
+    pa->setOutputDevice(paNoDevice);
+    
+    // init output params
+    
+    pa->setOutputDevice(outDevice);
+    if(outDevice != paNoDevice) {
+        pa->setOutputChannelCount(2);                      // stereo output
+        pa->setOutputSampleFormat(PA_SAMPLE_TYPE);
+        pa->setOutputLatency(pa->getOutputDefaultLowLatency());
+        pa->setOutputHostApiStreamInfo(NULL);
+    }
+
+    // init params that affect input and output
+
+    /*
+      On Linux, setting this to wxGetApp().m_framesPerBuffer caused
+      intermittant break up on the audio from my IC7200 on Ubuntu 14.
+      After a day of bug hunting I found that 0, as recommended by the
+      PortAudio docunmentation, fixed the problem.
+    */
+
+    //pa->setFramesPerBuffer(wxGetApp().m_framesPerBuffer);
+    pa->setFramesPerBuffer(0);
+
+    pa->setSampleRate(sampleRate);
+    pa->setStreamFlags(paClipOff);
+}
+
+//-------------------------------------------------------------------------
+// startRxStream()
+//-------------------------------------------------------------------------
+void MainFrame::startRxStream()
+{
+    int   src_error;
+    const PaDeviceInfo *deviceInfo1 = NULL, *deviceInfo2 = NULL;
+    int   inputChannels1, inputChannels2;
+    bool  two_rx=false;
+    bool  two_tx=false;
+
+    if(!m_RxRunning) {
+        m_RxRunning = true;
+
+        if(Pa_Initialize())
+        {
+            wxMessageBox(wxT("Port Audio failed to initialize"), wxT("Pa_Initialize"), wxOK);
+        }
+
+        m_rxInPa = new PortAudioWrap();
+        if(g_soundCard1InDeviceNum != g_soundCard1OutDeviceNum)
+            two_rx=true;
+        if(g_soundCard2InDeviceNum != g_soundCard2OutDeviceNum)
+            two_tx=true;
+        
+        fprintf(g_logfile, "two_rx: %d two_tx: %d\n", two_rx, two_tx);
+        if(two_rx)
+            m_rxOutPa = new PortAudioWrap();
+        else
+            m_rxOutPa = m_rxInPa;
+
+        if (g_nSoundCards == 0) {
+            wxMessageBox(wxT("No Sound Cards configured, use Tools - Audio Config to configure"), wxT("Error"), wxOK);
+            delete m_rxInPa;
+            if(two_rx)
+                delete m_rxOutPa;
+            m_RxRunning = false;
+            return;
+        }
+
+        // Init Sound card 1 ----------------------------------------------
+        // sanity check on sound card device numbers
+
+        if ((m_rxInPa->getDeviceCount() <= g_soundCard1InDeviceNum) ||
+            (m_rxOutPa->getDeviceCount() <= g_soundCard1OutDeviceNum)) {
+            wxMessageBox(wxT("Sound Card 1 not present"), wxT("Error"), wxOK);
+            delete m_rxInPa;
+            if(two_rx)
+                               delete m_rxOutPa;
+            m_RxRunning = false;
+            return;
+        }
+
+        // work out how many input channels this device supports.
+
+        deviceInfo1 = Pa_GetDeviceInfo(g_soundCard1InDeviceNum);
+        if (deviceInfo1 == NULL) {
+            wxMessageBox(wxT("Couldn't get device info from Port Audio for Sound Card 1"), wxT("Error"), wxOK);
+            delete m_rxInPa;
+            if(two_rx)
+                               delete m_rxOutPa;
+            m_RxRunning = false;
+            return;
+        }
+        if (deviceInfo1->maxInputChannels == 1)
+            inputChannels1 = 1;
+        else
+            inputChannels1 = 2;
+
+        if(two_rx) {
+            initPortAudioDevice(m_rxInPa, g_soundCard1InDeviceNum, paNoDevice, 1,
+                            g_soundCard1SampleRate, inputChannels1);
+            initPortAudioDevice(m_rxOutPa, paNoDevice, g_soundCard1OutDeviceNum, 1,
+                            g_soundCard1SampleRate, inputChannels1);
+               }
+        else
+            initPortAudioDevice(m_rxInPa, g_soundCard1InDeviceNum, g_soundCard1OutDeviceNum, 1,
+                            g_soundCard1SampleRate, inputChannels1);
+
+        // Init Sound Card 2 ------------------------------------------------
+
+        if (g_nSoundCards == 2) {
+
+            m_txInPa = new PortAudioWrap();
+            if(two_tx)
+                m_txOutPa = new PortAudioWrap();
+            else
+                m_txOutPa = m_txInPa;
+
+            // sanity check on sound card device numbers
+
+            //printf("m_txInPa->getDeviceCount(): %d\n", m_txInPa->getDeviceCount());
+            //printf("g_soundCard2InDeviceNum: %d\n", g_soundCard2InDeviceNum);
+            //printf("g_soundCard2OutDeviceNum: %d\n", g_soundCard2OutDeviceNum);
+
+            if ((m_txInPa->getDeviceCount() <= g_soundCard2InDeviceNum) ||
+                (m_txOutPa->getDeviceCount() <= g_soundCard2OutDeviceNum)) {
+                wxMessageBox(wxT("Sound Card 2 not present"), wxT("Error"), wxOK);
+                delete m_rxInPa;
+                if(two_rx)
+                    delete m_rxOutPa;
+                delete m_txInPa;
+                if(two_tx)
+                    delete m_txOutPa;
+                m_RxRunning = false;
+                return;
+            }
+
+            deviceInfo2 = Pa_GetDeviceInfo(g_soundCard2InDeviceNum);
+            if (deviceInfo2 == NULL) {
+                wxMessageBox(wxT("Couldn't get device info from Port Audio for Sound Card 1"), wxT("Error"), wxOK);
+                delete m_rxInPa;
+                if(two_rx)
+                                       delete m_rxOutPa;
+                delete m_txInPa;
+                if(two_tx)
+                                       delete m_txOutPa;
+                m_RxRunning = false;
+                return;
+            }
+            if (deviceInfo2->maxInputChannels == 1)
+                inputChannels2 = 1;
+            else
+                inputChannels2 = 2;
+
+            if(two_tx) {
+                               initPortAudioDevice(m_txInPa, g_soundCard2InDeviceNum, paNoDevice, 2,
+                                g_soundCard2SampleRate, inputChannels2);
+                               initPortAudioDevice(m_txOutPa, paNoDevice, g_soundCard2OutDeviceNum, 2,
+                                g_soundCard2SampleRate, inputChannels2);
+                       }
+                       else
+                               initPortAudioDevice(m_txInPa, g_soundCard2InDeviceNum, g_soundCard2OutDeviceNum, 2,
+                                g_soundCard2SampleRate, inputChannels2);
+        }
+
+        // Init call back data structure ----------------------------------------------
+
+        g_rxUserdata = new paCallBackData;
+        g_rxUserdata->inputChannels1 = inputChannels1;
+        if (deviceInfo2 != NULL)
+            g_rxUserdata->inputChannels2 = inputChannels2;
+
+        // init sample rate conversion states
+
+        g_rxUserdata->insrc1 = src_new(SRC_SINC_FASTEST, 1, &src_error);
+        assert(g_rxUserdata->insrc1 != NULL);
+        g_rxUserdata->outsrc1 = src_new(SRC_SINC_FASTEST, 1, &src_error);
+        assert(g_rxUserdata->outsrc1 != NULL);
+        g_rxUserdata->insrc2 = src_new(SRC_SINC_FASTEST, 1, &src_error);
+        assert(g_rxUserdata->insrc2 != NULL);
+        g_rxUserdata->outsrc2 = src_new(SRC_SINC_FASTEST, 1, &src_error);
+        assert(g_rxUserdata->outsrc2 != NULL);
+
+        g_rxUserdata->insrcsf = src_new(SRC_SINC_FASTEST, 1, &src_error);
+        assert(g_rxUserdata->insrcsf != NULL);
+
+        // create FIFOs used to interface between different buffer sizes
+
+        g_rxUserdata->infifo1 = fifo_create(8*N48);
+        g_rxUserdata->outfifo1 = fifo_create(10*N48);
+        g_rxUserdata->outfifo2 = fifo_create(8*N48);
+        g_rxUserdata->infifo2 = fifo_create(8*N48);
+        printf("N48: %d\n", N48);
+
+        g_rxUserdata->rxinfifo = fifo_create(3 * g_pfreedv->n_speech_samples);
+        g_rxUserdata->rxoutfifo = fifo_create(2 * g_pfreedv->n_speech_samples);
+
+        // Init Equaliser Filters ------------------------------------------------------
+
+        m_newMicInFilter = m_newSpkOutFilter = true;
+        designEQFilters(g_rxUserdata);
+        g_rxUserdata->micInEQEnable = wxGetApp().m_MicInEQEnable;
+        g_rxUserdata->spkOutEQEnable = wxGetApp().m_SpkOutEQEnable;
+
+        // optional tone in left channel to reliably trigger vox
+        
+        g_rxUserdata->leftChannelVoxTone = wxGetApp().m_leftChannelVoxTone;
+        g_rxUserdata->voxTonePhase = 0;
+
+        // Start sound card 1 ----------------------------------------------------------
+
+        m_rxInPa->setUserData(g_rxUserdata);
+        m_rxErr = m_rxInPa->setCallback(rxCallback);
+
+        m_rxErr = m_rxInPa->streamOpen();
+
+        if(m_rxErr != paNoError) {
+            wxMessageBox(wxT("Sound Card 1 Open/Setup error."), wxT("Error"), wxOK);
+                       delete m_rxInPa;
+                       if(two_rx)
+                               delete m_rxOutPa;
+                       delete m_txInPa;
+                       if(two_tx)
+                               delete m_txOutPa;
+            destroy_fifos();
+            destroy_src();
+            deleteEQFilters(g_rxUserdata);
+            delete g_rxUserdata;
+            m_RxRunning = false;
+            return;
+        }
+
+        m_rxErr = m_rxInPa->streamStart();
+        if(m_rxErr != paNoError) {
+            wxMessageBox(wxT("Sound Card 1 Stream Start Error."), wxT("Error"), wxOK);
+                       delete m_rxInPa;
+                       if(two_rx)
+                               delete m_rxOutPa;
+                       delete m_txInPa;
+                       if(two_tx)
+                               delete m_txOutPa;
+            destroy_fifos();
+            destroy_src();
+            deleteEQFilters(g_rxUserdata);
+            delete g_rxUserdata;
+            m_RxRunning = false;
+            return;
+        }
+
+        // Start separate output stream if needed
+
+        if(two_rx) {
+            m_rxOutPa->setUserData(g_rxUserdata);
+            m_rxErr = m_rxOutPa->setCallback(rxCallback);
+
+            m_rxErr = m_rxOutPa->streamOpen();
+
+            if(m_rxErr != paNoError) {
+                wxMessageBox(wxT("Sound Card 1 Second Stream Open/Setup error."), wxT("Error"), wxOK);
+                delete m_rxInPa;
+                delete m_rxOutPa;
+                delete m_txOutPa;
+                if(two_tx)
+                    delete m_txOutPa;
+                destroy_fifos();
+                destroy_src();
+                deleteEQFilters(g_rxUserdata);
+                delete g_rxUserdata;
+                m_RxRunning = false;
+                return;
+            }
+
+            m_rxErr = m_rxOutPa->streamStart();
+            if(m_rxErr != paNoError) {
+                wxMessageBox(wxT("Sound Card 1 Second Stream Start Error."), wxT("Error"), wxOK);
+                m_rxInPa->stop();
+                m_rxInPa->streamClose();
+                delete m_rxInPa;
+                delete m_rxOutPa;
+                delete m_txOutPa;
+                if(two_tx)
+                    delete m_txOutPa;
+                destroy_fifos();
+                destroy_src();
+                deleteEQFilters(g_rxUserdata);
+                delete g_rxUserdata;
+                m_RxRunning = false;
+                return;
+            }
+        }
+
+        // Start sound card 2 ----------------------------------------------------------
+
+        if (g_nSoundCards == 2) {
+
+            // question: can we use same callback data
+            // (g_rxUserdata)or both sound card callbacks?  Is there a
+            // chance of them both being called at the same time?  We
+            // could need a mutex ...
+
+            m_txInPa->setUserData(g_rxUserdata);
+            m_txErr = m_txInPa->setCallback(txCallback);
+            m_txErr = m_txInPa->streamOpen();
+
+            if(m_txErr != paNoError) {
+                fprintf(stderr, "Err: %d\n", m_txErr);
+                wxMessageBox(wxT("Sound Card 2 Open/Setup error."), wxT("Error"), wxOK);
+                m_rxInPa->stop();
+                m_rxInPa->streamClose();
+                delete m_rxInPa;
+                if(two_rx) {
+                    m_rxOutPa->stop();
+                    m_rxOutPa->streamClose();
+                    delete m_rxOutPa;
+                }
+                delete m_txInPa;
+                if(two_tx)
+                    delete m_txOutPa;
+                destroy_fifos();
+                destroy_src();
+                deleteEQFilters(g_rxUserdata);
+                delete g_rxUserdata;
+                m_RxRunning = false;
+                return;
+            }
+            m_txErr = m_txInPa->streamStart();
+            if(m_txErr != paNoError) {
+                wxMessageBox(wxT("Sound Card 2 Start Error."), wxT("Error"), wxOK);
+                m_rxInPa->stop();
+                m_rxInPa->streamClose();
+                delete m_rxInPa;
+                if(two_rx) {
+                    m_rxOutPa->stop();
+                    m_rxOutPa->streamClose();
+                    delete m_rxOutPa;
+                }
+                delete m_txInPa;
+                if(two_tx)
+                    delete m_txOutPa;
+                destroy_fifos();
+                destroy_src();
+                deleteEQFilters(g_rxUserdata);
+                delete g_rxUserdata;
+                m_RxRunning = false;
+                return;
+            }
+
+            // Start separate output stream if needed
+
+            if (two_tx) {
+
+                // question: can we use same callback data
+                // (g_rxUserdata)or both sound card callbacks?  Is there a
+                // chance of them both being called at the same time?  We
+                // could need a mutex ...
+
+                m_txOutPa->setUserData(g_rxUserdata);
+                m_txErr = m_txOutPa->setCallback(txCallback);
+                m_txErr = m_txOutPa->streamOpen();
+
+                if(m_txErr != paNoError) {
+                    wxMessageBox(wxT("Sound Card 2 Second Stream Open/Setup error."), wxT("Error"), wxOK);
+                    m_rxInPa->stop();
+                    m_rxInPa->streamClose();
+                    delete m_rxInPa;
+                    if(two_rx) {
+                        m_rxOutPa->stop();
+                        m_rxOutPa->streamClose();
+                        delete m_rxOutPa;
+                    }
+                    m_txInPa->stop();
+                    m_txInPa->streamClose();
+                    delete m_txInPa;
+                    delete m_txOutPa;
+                    destroy_fifos();
+                    destroy_src();
+                    deleteEQFilters(g_rxUserdata);
+                    delete g_rxUserdata;
+                    m_RxRunning = false;
+                    return;
+                }
+                m_txErr = m_txOutPa->streamStart();
+                if(m_txErr != paNoError) {
+                    wxMessageBox(wxT("Sound Card 2 Second Stream Start Error."), wxT("Error"), wxOK);
+                    m_rxInPa->stop();
+                    m_rxInPa->streamClose();
+                    m_txInPa->stop();
+                    m_txInPa->streamClose();
+                    delete m_txInPa;
+                    if(two_rx) {
+                        m_rxOutPa->stop();
+                        m_rxOutPa->streamClose();
+                        delete m_rxOutPa;
+                    }
+                    delete m_txInPa;
+                    delete m_txOutPa;
+                    destroy_fifos();
+                    destroy_src();
+                    deleteEQFilters(g_rxUserdata);
+                    delete g_rxUserdata;
+                    m_RxRunning = false;
+                    return;
+                }
+            }
+        }
+
+        // start tx/rx processing thread
+
+        m_txRxThread = new txRxThread;
+
+        if ( m_txRxThread->Create() != wxTHREAD_NO_ERROR )
+        {
+            wxLogError(wxT("Can't create thread!"));
+        }
+
+        m_txRxThread->SetPriority(WXTHREAD_MAX_PRIORITY);
+
+        if ( m_txRxThread->Run() != wxTHREAD_NO_ERROR )
+        {
+            wxLogError(wxT("Can't start thread!"));
+        }
+
+    }
+}
+
+
+void MainFrame::processTxtEvent(char event[]) {
+    int rule = 0;
+
+    //printf("processTxtEvent:\n");
+    //printf("  event: %s\n", event);
+
+    // process with regexp and issue system command
+
+    // Each regexp in our list is separated by a newline.  We want to try all of them.
+
+    wxString event_str(event);
+    int match_end, replace_end;
+    match_end = replace_end = 0;
+    wxString regexp_match_list = wxGetApp().m_events_regexp_match;
+    wxString regexp_replace_list = wxGetApp().m_events_regexp_replace;
+
+    bool found_match = false;
+
+    while (((match_end = regexp_match_list.Find('\n')) != wxNOT_FOUND) && (rule < MAX_EVENT_RULES)) {
+        //printf("match_end: %d\n", match_end);
+        if ((replace_end = regexp_replace_list.Find('\n')) != wxNOT_FOUND) {
+            //printf("replace_end = %d\n", replace_end);
+
+            // candidate match and replace regexps strings exist, so lets try them
+
+            wxString regexp_match = regexp_match_list.SubString(0, match_end-1);
+            wxString regexp_replace = regexp_replace_list.SubString(0, replace_end-1);
+            //printf("match: %s replace: %s\n", (const char *)regexp_match.c_str(), (const char *)regexp_replace.c_str());
+            wxRegEx re(regexp_match);
+            //printf("  checking for match against: %s\n", (const char *)regexp_match.c_str());
+
+            // if we found a match, lets run the replace regexp and issue the system command
+
+            wxString event_str_rep = event_str;
+
+            if (re.Replace(&event_str_rep, regexp_replace) != 0) {
+                //printf("  found match!\n");
+                found_match = true;
+
+                bool enableSystem = false;
+                if (wxGetApp().m_events)
+                    enableSystem = true;
+
+                // no syscall if spam timer still running
+
+                if (spamTimer[rule].IsRunning()) {
+                    enableSystem = false;
+                    //printf("  spam timer running\n");
+                }
+
+                const char *event_out = event_str_rep.ToUTF8();
+                wxString event_out_with_return_code;
+
+                if (enableSystem) {
+                    int ret = wxExecute(event_str_rep);
+                    event_out_with_return_code.Printf(_T("%s -> returned %d"), event_out, ret);
+                    spamTimer[rule].Start((wxGetApp().m_events_spam_timer)*1000, wxTIMER_ONE_SHOT);
+                }
+                else
+                    event_out_with_return_code.Printf(_T("%s T: %d"), event_out, spamTimer[rule].IsRunning());
+
+                // update event log GUI if currently displayed
+                
+                if (optionsDlg != NULL) {                  
+                    optionsDlg->updateEventLog(wxString(event), event_out_with_return_code);                     
+                }
+            }
+        }
+        regexp_match_list = regexp_match_list.SubString(match_end+1, regexp_match_list.length());
+        regexp_replace_list = regexp_replace_list.SubString(replace_end+1, regexp_replace_list.length());
+
+        rule++;
+    }
+    if ((optionsDlg != NULL) && !found_match) {                  
+        optionsDlg->updateEventLog(wxString(event), _("<no match>"));                     
+    }
+}
+
+
+#define SBQ_MAX_ARGS 4
+
+void *MainFrame::designAnEQFilter(const char filterType[], float freqHz, float gaindB, float Q)
+{
+    char  *arg[SBQ_MAX_ARGS];
+    char   argstorage[SBQ_MAX_ARGS][80];
+    void  *sbq;
+    int    i, argc;
+
+    assert((strcmp(filterType, "bass") == 0)   ||
+           (strcmp(filterType, "treble") == 0) ||
+           (strcmp(filterType, "equalizer") == 0));
+
+    for(i=0; i<SBQ_MAX_ARGS; i++) {
+        arg[i] = &argstorage[i][0];
+        arg[i] = &argstorage[i][0];
+        arg[i] = &argstorage[i][0];
+    }
+
+    argc = 0;
+
+    if ((strcmp(filterType, "bass") == 0) || (strcmp(filterType, "treble") == 0)) {
+        sprintf(arg[argc++], "%s", filterType);
+        sprintf(arg[argc++], "%f", gaindB+1E-6);
+        sprintf(arg[argc++], "%f", freqHz);
+    }
+
+    if (strcmp(filterType, "equalizer") == 0) {
+        sprintf(arg[argc++], "%s", filterType);
+        sprintf(arg[argc++], "%f", freqHz);
+        sprintf(arg[argc++], "%f", Q);
+        sprintf(arg[argc++], "%f", gaindB+1E-6);
+    }
+
+    assert(argc <= SBQ_MAX_ARGS);
+
+    sbq = sox_biquad_create(argc-1, (const char **)arg);
+
+    return sbq;
+}
+
+void  MainFrame::designEQFilters(paCallBackData *cb)
+{
+    // init Mic In Equaliser Filters
+
+    if (m_newMicInFilter) {
+        //printf("designing new Min In filters\n");
+        cb->sbqMicInBass   = designAnEQFilter("bass", wxGetApp().m_MicInBassFreqHz, wxGetApp().m_MicInBassGaindB);
+        cb->sbqMicInTreble = designAnEQFilter("treble", wxGetApp().m_MicInTrebleFreqHz, wxGetApp().m_MicInTrebleGaindB);
+        cb->sbqMicInMid    = designAnEQFilter("equalizer", wxGetApp().m_MicInMidFreqHz, wxGetApp().m_MicInMidGaindB, wxGetApp().m_MicInMidQ);
+    }
+
+    // init Spk Out Equaliser Filters
+
+    if (m_newSpkOutFilter) {
+        //printf("designing new Spk Out filters\n");
+        //printf("designEQFilters: wxGetApp().m_SpkOutBassFreqHz: %f\n",wxGetApp().m_SpkOutBassFreqHz);
+        cb->sbqSpkOutBass   = designAnEQFilter("bass", wxGetApp().m_SpkOutBassFreqHz, wxGetApp().m_SpkOutBassGaindB);
+        cb->sbqSpkOutTreble = designAnEQFilter("treble", wxGetApp().m_SpkOutTrebleFreqHz, wxGetApp().m_SpkOutTrebleGaindB);
+        cb->sbqSpkOutMid    = designAnEQFilter("equalizer", wxGetApp().m_SpkOutMidFreqHz, wxGetApp().m_SpkOutMidGaindB, wxGetApp().m_SpkOutMidQ);
+    }
+}
+
+void  MainFrame::deleteEQFilters(paCallBackData *cb)
+{
+    if (m_newMicInFilter) {
+        sox_biquad_destroy(cb->sbqMicInBass);
+        sox_biquad_destroy(cb->sbqMicInTreble);
+        sox_biquad_destroy(cb->sbqMicInMid);
+    }
+    if (m_newSpkOutFilter) {
+        sox_biquad_destroy(cb->sbqSpkOutBass);
+        sox_biquad_destroy(cb->sbqSpkOutTreble);
+        sox_biquad_destroy(cb->sbqSpkOutMid);
+    }
+}
+
+// returns number of output samples generated by resampling
+int resample(SRC_STATE *src,
+            short      output_short[],
+            short      input_short[],
+            int        output_sample_rate,
+            int        input_sample_rate,
+            int        length_output_short, // maximum output array length in samples
+            int        length_input_short
+            )
+{
+    SRC_DATA src_data;
+    float    input[N48*4];
+    float    output[N48*4];
+    int      ret;
+
+    assert(src != NULL);
+    assert(length_input_short <= N48*4);
+    assert(length_output_short <= N48*4);
+
+    src_short_to_float_array(input_short, input, length_input_short);
+
+    src_data.data_in = input;
+    src_data.data_out = output;
+    src_data.input_frames = length_input_short;
+    src_data.output_frames = length_output_short;
+    src_data.end_of_input = 0;
+    src_data.src_ratio = (float)output_sample_rate/input_sample_rate;
+
+    ret = src_process(src, &src_data);
+    assert(ret == 0);
+
+    assert(src_data.output_frames_gen <= length_output_short);
+    src_float_to_short_array(output, output_short, src_data.output_frames_gen);
+
+    return src_data.output_frames_gen;
+}
+
+
+// Decimates samples using an algorithm that produces nice plots of
+// speech signals at a low sample rate.  We want a low sample rate so
+// we don't hammer the graphics system too hard.  Saves decimated data
+// to a fifo for plotting on screen.
+void resample_for_plot(struct FIFO *plotFifo, short buf[], int length, int fs)
+{
+    int decimation = fs/WAVEFORM_PLOT_FS;
+    int nSamples, sample;
+    int i, st, en, max, min;
+    short dec_samples[length];
+
+    nSamples = length/decimation;
+
+    for(sample = 0; sample < nSamples; sample += 2)
+    {
+        st = decimation*sample;
+        en = decimation*(sample+2);
+        max = min = 0;
+        for(i=st; i<en; i++ )
+        {
+            if (max < buf[i]) max = buf[i];
+            if (min > buf[i]) min = buf[i];
+        }
+        dec_samples[sample] = max;
+        dec_samples[sample+1] = min;
+    }
+    fifo_write(plotFifo, dec_samples, nSamples);
+}
+
+void txRxProcessing()
+{
+
+    paCallBackData  *cbData = g_rxUserdata;
+
+    // Buffers re-used by tx and rx processing
+    // signals in in48k/out48k are at a maximum sample rate of 48k, could be 44.1kHz
+    // depending on sound hardware.
+
+    short           in8k_short[4*N8];
+    short           in48k_short[4*N48];
+    short           out8k_short[4*N8];
+    short           out48k_short[4*N48];
+    int             nout, samplerate, n_samples;
+
+    //fprintf(g_logfile, "start infifo1: %5d outfifo2: %5d\n", fifo_used(cbData->infifo1), fifo_used(cbData->outfifo2));
+
+    // FreeDV 700 uses a modem sample rate of 7500 Hz which requires some special treatment
+
+    if (g_analog) 
+        samplerate = FS;
+    else
+        samplerate = g_pfreedv->modem_sample_rate;
+
+    //
+    //  RX side processing --------------------------------------------
+    //
+
+    // while we have enough input samples available ...
+
+    int nsam = g_soundCard1SampleRate * (float)N8/FS;
+    assert(nsam <= N48);
+    g_mutexProtectingCallbackData.Lock();
+    while ((fifo_read(cbData->infifo1, in48k_short, nsam) == 0) && ((g_half_duplex && !g_tx) || !g_half_duplex)) 
+    {
+        g_mutexProtectingCallbackData.Unlock();
+        unsigned int n8k;
+
+        n8k = resample(cbData->insrc1, in8k_short, in48k_short, samplerate, g_soundCard1SampleRate, N8, nsam);
+        assert(n8k <= N8);
+
+        // optionally save "from radio" signal (write demod input to file)
+        // Really useful for testing and development as it allows us
+        // to repeat tests using off air signals
+
+        g_mutexProtectingCallbackData.Lock();
+        if (g_recFileFromRadio && (g_sfRecFile != NULL)) {
+            //printf("g_recFromRadioSamples: %d  n8k: %d \n", g_recFromRadioSamples);
+            if (g_recFromRadioSamples < n8k) {
+                sf_write_short(g_sfRecFile, in8k_short, g_recFromRadioSamples);
+                wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, g_recFileFromRadioEventId );
+                // call stop/start record menu item, should be thread safe
+                g_parent->GetEventHandler()->AddPendingEvent( event );
+                g_recFromRadioSamples = 0;
+                //printf("finished recording g_recFromRadioSamples: %d n8k: %d!\n", g_recFileFromRadio, n8k);
+            }
+            else {
+                sf_write_short(g_sfRecFile, in8k_short, n8k);
+                g_recFromRadioSamples -= n8k;
+            }
+        }
+        g_mutexProtectingCallbackData.Unlock();
+
+        // optionally read "from radio" signal from file (read demod input from file)
+
+        g_mutexProtectingCallbackData.Lock();
+        if (g_playFileFromRadio && (g_sfPlayFileFromRadio != NULL)) {
+            unsigned int nsf = n8k*g_sfFs/samplerate;
+            short        insf_short[nsf];
+            unsigned int n = sf_read_short(g_sfPlayFileFromRadio, insf_short, nsf);
+            n8k = resample(cbData->insrcsf, in8k_short, insf_short, samplerate, g_sfFs, N8, nsf);
+            //fprintf(g_logfile, "n: %d nsnf: %d n8k: %d\n", n, nsf, n8k);
+            assert(n8k <= N8);
+
+            if (n == 0) {
+                if (g_loopPlayFileFromRadio)
+                    sf_seek(g_sfPlayFileFromRadio, 0, SEEK_SET);
+                else {
+                    printf("playFileFromRadio finished, issuing event!\n");
+                    wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, g_playFileFromRadioEventId );
+                    // call stop/start play menu item, should be thread safe
+                    g_parent->GetEventHandler()->AddPendingEvent( event );
+                }
+            }
+        }
+        g_mutexProtectingCallbackData.Unlock();
+
+        resample_for_plot(g_plotDemodInFifo, in8k_short, n8k, samplerate);
+
+        // send latest squelch level to FreeDV API, as it handles squelch internally
+
+        g_pfreedv->squelch_en = g_SquelchActive;
+        g_pfreedv->snr_squelch_thresh = g_SquelchLevel;
+        //fprintf(g_logfile, "snr_squelch_thresh: %f\n",  g_pfreedv->snr_squelch_thresh);
+
+        // Get some audio to send to headphones/speaker.  If in analog
+        // mode we pass thru the "from radio" audio to the
+        // headphones/speaker.
+
+        if (g_analog) {
+            memcpy(out8k_short, in8k_short, sizeof(short)*n8k);
+            
+            // compute rx spectrum 
+
+            COMP  rx_fdm[n8k];
+            float rx_spec[MODEM_STATS_NSPEC];
+            unsigned int   i;
+
+            for(i=0; i<n8k; i++) {
+                rx_fdm[i].real = in8k_short[i];
+                rx_fdm[i].imag = 0.0;
+            }            
+            modem_stats_get_rx_spectrum(&g_stats, rx_spec, rx_fdm, n8k);
+
+            // Average rx spectrum data using a simple IIR low pass filter
+
+            for(i = 0; i<MODEM_STATS_NSPEC; i++) {
+                g_avmag[i] = BETA * g_avmag[i] + (1.0 - BETA) * rx_spec[i];
+            }
+        }
+        else {
+            fifo_write(cbData->rxinfifo, in8k_short, n8k);
+            per_frame_rx_processing(cbData->rxoutfifo, cbData->rxinfifo);
+            memset(out8k_short, 0, sizeof(short)*N8);
+            fifo_read(cbData->rxoutfifo, out8k_short, N8);
+        }
+
+
+        // Optional Spk Out EQ Filtering, need mutex as filter can change at run time
+        g_mutexProtectingCallbackData.Lock();
+        if (cbData->spkOutEQEnable) {
+            sox_biquad_filter(cbData->sbqSpkOutBass,   out8k_short, out8k_short, N8);
+            sox_biquad_filter(cbData->sbqSpkOutTreble, out8k_short, out8k_short, N8);
+            sox_biquad_filter(cbData->sbqSpkOutMid,    out8k_short, out8k_short, N8);
+        }
+        g_mutexProtectingCallbackData.Unlock();
+
+        resample_for_plot(g_plotSpeechOutFifo, out8k_short, N8, FS);
+
+        g_mutexProtectingCallbackData.Lock();
+        if (g_nSoundCards == 1) {
+            nout = resample(cbData->outsrc2, out48k_short, out8k_short, g_soundCard1SampleRate, FS, N48, N8);
+            fifo_write(cbData->outfifo1, out48k_short, nout);
+        }
+        else {
+            nout = resample(cbData->outsrc2, out48k_short, out8k_short, g_soundCard2SampleRate, FS, N48, N8);
+            fifo_write(cbData->outfifo2, out48k_short, nout);
+        }
+    }
+    g_mutexProtectingCallbackData.Unlock();
+
+    //
+    //  TX side processing --------------------------------------------
+    //
+
+    if ((g_nSoundCards == 2) && ((g_half_duplex && g_tx) || !g_half_duplex)) {
+        int ret;
+
+        // Make sure we have q few frames of modulator output
+        // samples.  This also locks the modulator to the sample rate
+        // of sound card 1.  We want to make sure that modulator
+        // samples are uninterrupted by differences in sample rate
+        // between this sound card and sound card 2.
+
+        g_mutexProtectingCallbackData.Lock();
+        while((unsigned)fifo_used(cbData->outfifo1) < 6*N48)
+        {
+            g_mutexProtectingCallbackData.Unlock();
+
+            int   nsam = g_soundCard2SampleRate * g_pfreedv->n_speech_samples/FS;
+            assert(nsam <= 4*N48);
+
+            // infifo2 is written to by another sound card so it may
+            // over or underflow, but we don't realy care.  It will
+            // just result in a short interruption in audio being fed
+            // to codec2_enc, possibly making a click every now and
+            // again in the decoded audio at the other end.
+
+            // zero speech input just in case infifo2 underflows
+            memset(in48k_short, 0, nsam*sizeof(short));
+            fifo_read(cbData->infifo2, in48k_short, nsam);
+
+            nout = resample(cbData->insrc2, in8k_short, in48k_short, FS, g_soundCard2SampleRate, 4*N8, nsam);
+
+            // optionally use file for mic input signal
+
+            g_mutexProtectingCallbackData.Lock();
+            if (g_playFileToMicIn && (g_sfPlayFile != NULL)) {
+                int n = sf_read_short(g_sfPlayFile, in8k_short, nout);
+                //fprintf(stderr, "n: %d nout: %d\n", n, nout);
+                if (n != nout) {
+                    if (g_loopPlayFileToMicIn)
+                        sf_seek(g_sfPlayFile, 0, SEEK_SET);
+                    else {
+                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, g_playFileToMicInEventId );
+                        // call stop/start play menu item, should be thread safe
+                        g_parent->GetEventHandler()->AddPendingEvent( event );
+                    }
+                }
+            }
+            g_mutexProtectingCallbackData.Unlock();
+
+            // Optional Speex pre-processor for acoustic noise reduction
+
+            if (wxGetApp().m_speexpp_enable) {
+                speex_preprocess_run(g_speex_st, in8k_short);
+            }
+
+            // Optional Mic In EQ Filtering, need mutex as filter can change at run time
+
+            g_mutexProtectingCallbackData.Lock();
+            if (cbData->micInEQEnable) {
+                sox_biquad_filter(cbData->sbqMicInBass, in8k_short, in8k_short, nout);
+                sox_biquad_filter(cbData->sbqMicInTreble, in8k_short, in8k_short, nout);
+                sox_biquad_filter(cbData->sbqMicInMid, in8k_short, in8k_short, nout);
+            }
+            g_mutexProtectingCallbackData.Unlock();
+
+            resample_for_plot(g_plotSpeechInFifo, in8k_short, nout, FS);
+
+            n_samples = g_pfreedv->n_nom_modem_samples;
+
+            if (g_analog) {
+                n_samples = g_pfreedv->n_speech_samples;
+
+                // Boost the "from mic" -> "to radio" audio in analog
+                // mode.  The need for the gain was found by
+                // experiment - analog SSB sounded too quiet compared
+                // to digital. With digital voice we generally drive
+                // the "to radio" (SSB radio mic input) at about 25%
+                // of the peak level for normal SSB voice. So we
+                // introduce 6dB gain to make analog SSB sound the
+                // same level as the digital.  Watch out for clipping.
+                for(int i=0; i<n_samples; i++) {
+                    float out = (float)in8k_short[i]*2.0;
+                    if (out > 32767) out = 32767.0;
+                    if (out < -32767) out = -32767.0;
+                    out8k_short[i] = out;
+                }
+            }
+            else {
+                COMP tx_fdm[g_pfreedv->n_nom_modem_samples];
+                COMP tx_fdm_offset[g_pfreedv->n_nom_modem_samples];
+                int  i;
+
+                freedv_comptx(g_pfreedv, tx_fdm, in8k_short);
+  
+                fdmdv_freq_shift_coh(tx_fdm_offset, tx_fdm, g_TxFreqOffsetHz, g_pfreedv->modem_sample_rate, &g_TxFreqOffsetPhaseRect, g_pfreedv->n_nom_modem_samples);
+                for(i=0; i<g_pfreedv->n_nom_modem_samples; i++)
+                    out8k_short[i] = tx_fdm_offset[i].real;
+            }
+
+            // output one frame of modem signal
+            nout = resample(cbData->outsrc1, out48k_short, out8k_short, g_soundCard1SampleRate, samplerate, N48*4, n_samples);
+            g_mutexProtectingCallbackData.Lock();
+            ret = fifo_write(cbData->outfifo1, out48k_short, nout);
+            //fprintf(stderr,"nout: %d ret: %d N48*4: %d\n", nout, ret, N48*4);
+
+            assert(ret != -1);
+        }
+        g_mutexProtectingCallbackData.Unlock();
+    }
+   
+    //fprintf(g_logfile, "  end infifo1: %5d outfifo2: %5d\n", fifo_used(cbData->infifo1), fifo_used(cbData->outfifo2));
+
+}
+
+//----------------------------------------------------------------
+// per_frame_rx_processing()
+//----------------------------------------------------------------
+
+void per_frame_rx_processing(
+                                            FIFO    *output_fifo,   // decoded speech samples
+                                            FIFO    *input_fifo
+                                        )
+{
+    short               input_buf[g_pfreedv->n_max_modem_samples];
+    short               output_buf[g_pfreedv->n_speech_samples];
+    COMP                rx_fdm[g_pfreedv->n_max_modem_samples];
+    COMP                rx_fdm_offset[g_pfreedv->n_max_modem_samples];
+    float               rx_spec[MODEM_STATS_NSPEC];
+    int                 i;
+    int                 nin, nin_prev, nout;
+
+    nin = freedv_nin(g_pfreedv);
+    while (fifo_read(input_fifo, input_buf, nin) == 0)
+    {
+        assert(nin <= g_pfreedv->n_max_modem_samples);
+
+        nin_prev = nin;
+        //fwrite(input_buf, sizeof(short), nin, ft);
+
+        // demod per frame processing
+        for(i=0; i<nin; i++)
+        {
+            rx_fdm[i].real = (float)input_buf[i];
+            rx_fdm[i].imag = 0.0;
+        }
+       
+        if (g_channel_noise) {
+            float snr;
+
+            /* enough noise to get a couple of % errors */
+
+            if (g_pfreedv->mode == FREEDV_MODE_1600)
+                snr = 2.0;
+             if (g_pfreedv->mode == FREEDV_MODE_700)
+                snr = -1.0;           
+            fdmdv_simulate_channel(&g_sig_pwr_av, rx_fdm, nin, snr);
+        }
+        fdmdv_freq_shift_coh(rx_fdm_offset, rx_fdm, g_RxFreqOffsetHz, g_pfreedv->modem_sample_rate, &g_RxFreqOffsetPhaseRect, nin);
+        nout = freedv_comprx(g_pfreedv, output_buf, rx_fdm_offset);
+        
+        fifo_write(output_fifo, output_buf, nout);
+        
+        nin = freedv_nin(g_pfreedv);
+        g_State = g_pfreedv->sync;
+        //fprintf(g_logfile, "g_State: %d g_stats.sync: %d snr: %f \n", g_State, g_stats.sync, f->snr);
+
+        // compute rx spectrum 
+
+        modem_stats_get_rx_spectrum(&g_stats, rx_spec, rx_fdm, nin_prev);
+        // Average rx spectrum data using a simple IIR low pass filter
+
+        for(i = 0; i<MODEM_STATS_NSPEC; i++) {
+            g_avmag[i] = BETA * g_avmag[i] + (1.0 - BETA) * rx_spec[i];
+        }
+
+        if (g_pfreedv->mode == FREEDV_MODE_1600)
+            fdmdv_get_demod_stats(g_pfreedv->fdmdv, &g_stats);
+        if (g_pfreedv->mode == FREEDV_MODE_700)
+            cohpsk_get_demod_stats(g_pfreedv->cohpsk, &g_stats);
+
+    }
+}
+
+
+//-------------------------------------------------------------------------
+// rxCallback()
+//
+// Sound card 1 callback from PortAudio, that is used for processing rx
+// side:
+//
+// + infifo1 is the "from radio" off air modem signal from the SSB rx that we send to the demod.
+// + In single sound card mode outfifo1 is the "to speaker/headphones" decoded speech output.
+// + In dual sound card mode outfifo1 is the "to radio" modulator signal to the SSB tx.
+//
+//-------------------------------------------------------------------------
+int MainFrame::rxCallback(
+                            const void      *inputBuffer,
+                            void            *outputBuffer,
+                            unsigned long   framesPerBuffer,
+                            const PaStreamCallbackTimeInfo* timeInfo,
+                            PaStreamCallbackFlags statusFlags,
+                            void            *userData
+                         )
+{
+    paCallBackData  *cbData = (paCallBackData*)userData;
+    short           *rptr    = (short*)inputBuffer;
+    short           *wptr    = (short*)outputBuffer;
+
+    short           indata[MAX_FPB];
+    short           outdata[MAX_FPB];
+
+    unsigned int    i;
+
+    (void) timeInfo;
+    (void) statusFlags;
+
+    wxMutexLocker lock(g_mutexProtectingCallbackData);
+
+    //fprintf(g_logfile, "cb1 statusFlags: 0x%x framesPerBuffer: %d rptr: 0x%x wptr: 0x%x \n", (int)statusFlags,
+    //        framesPerBuffer, rptr, wptr);
+
+    //
+    //  RX side processing --------------------------------------------
+    //
+
+    // assemble a mono buffer and write to FIFO
+
+    assert(framesPerBuffer < MAX_FPB);
+
+    if(rptr) {
+        //fprintf(g_logfile,"in %ld %d\n",  framesPerBuffer, g_in++);
+        //g_indata += framesPerBuffer;
+        for(i = 0; i < framesPerBuffer; i++, rptr += cbData->inputChannels1)
+            indata[i] = rptr[0];                       
+        if (fifo_write(cbData->infifo1, indata, framesPerBuffer)) {
+            //fprintf(g_logfile, "infifo1 full\n");
+        }
+        //fifo_write(cbData->outfifo1, indata, framesPerBuffer);
+    }
+
+    // OK now set up output samples for this callback
+
+    if(wptr) {
+        //fprintf(g_logfile,"out %ld %d\n",  framesPerBuffer, g_out++);
+        if (fifo_read(cbData->outfifo1, outdata, framesPerBuffer) == 0) {
+
+            // write signal to both channels
+
+            for(i = 0; i < framesPerBuffer; i++, wptr += 2) {
+                if (cbData->leftChannelVoxTone) {
+                    cbData->voxTonePhase += 2.0*M_PI*VOX_TONE_FREQ/g_soundCard1SampleRate;
+                    cbData->voxTonePhase -= 2.0*M_PI*floor(cbData->voxTonePhase/(2.0*M_PI));
+                    wptr[0] = VOX_TONE_AMP*cos(cbData->voxTonePhase);                              
+                    //printf("%f %d\n", cbData->voxTonePhase, wptr[0]);
+                }
+                else
+                    wptr[0] = outdata[i];
+                               
+                wptr[1] = outdata[i];
+            }
+        }
+        else {
+            //fprintf(g_logfile, "outfifo1 empty\n");
+            // zero output if no data available
+            for(i = 0; i < framesPerBuffer; i++, wptr += 2) {
+                wptr[0] = 0;
+                wptr[1] = 0;
+            }
+        }
+    }
+
+    return paContinue;
+}
+
+
+//-------------------------------------------------------------------------
+// txCallback()
+//-------------------------------------------------------------------------
+int MainFrame::txCallback(
+                            const void *inputBuffer,
+                            void *outputBuffer,
+                            unsigned long framesPerBuffer,
+                            const PaStreamCallbackTimeInfo *outTime,
+                            PaStreamCallbackFlags statusFlags,
+                            void *userData
+                        )
+{
+    paCallBackData  *cbData = (paCallBackData*)userData;
+    unsigned int    i;
+    short           *rptr    = (short*)inputBuffer;
+    short           *wptr    = (short*)outputBuffer;
+    short           indata[MAX_FPB];
+    short           outdata[MAX_FPB];
+
+    wxMutexLocker lock(g_mutexProtectingCallbackData);
+
+    //    if (statusFlags)
+    //    printf("cb2 statusFlags: 0x%x\n", (int)statusFlags);
+
+    // assemble a mono buffer and write to FIFO
+
+    assert(framesPerBuffer < MAX_FPB);
+
+    if(rptr) {
+        for(i = 0; i < framesPerBuffer; i++, rptr += cbData->inputChannels2)
+            indata[i] = rptr[0];                        
+    }
+
+    //#define SC2_LOOPBACK
+#ifdef SC2_LOOPBACK
+    //TODO: This doesn't work unless using the same soundcard!
+
+    if(wptr) {
+        for(i = 0; i < framesPerBuffer; i++, wptr += 2) {
+            wptr[0] = indata[i];
+            wptr[1] = indata[i];
+        }
+    }
+
+#else
+    if(rptr) {
+        if (fifo_write(cbData->infifo2, indata, framesPerBuffer)) {
+            //fprintf(g_logfile, "infifo2 full\n");
+        }
+    }
+
+    // OK now set up output samples for this callback
+
+    if(wptr) {
+        if (fifo_read(cbData->outfifo2, outdata, framesPerBuffer) == 0) {
+               
+            // write signal to both channels */
+            for(i = 0; i < framesPerBuffer; i++, wptr += 2) {
+                wptr[0] = outdata[i];
+                wptr[1] = outdata[i];
+            }
+        }
+        else {
+            //fprintf(g_logfile, "outfifo2 empty\n");
+            // zero output if no data available
+            for(i = 0; i < framesPerBuffer; i++, wptr += 2) {
+                wptr[0] = 0;
+                wptr[1] = 0;
+            }
+        }
+    }
+#endif
+    return paContinue;
+}
+
+// Callback from plot_spectrum & plot_waterfall.  would be nice to
+// work out a way to do this without globals.
+
+void fdmdv2_clickTune(float freq) {
+
+    // The demod is hard-wired to expect a centre frequency of
+    // FDMDV_FCENTRE.  So we want to take the signal centered on the
+    // click tune freq and re-centre it on FDMDV_FCENTRE.  For example
+    // if the click tune freq is 1500Hz, and FDMDV_CENTRE is 1200 Hz,
+    // we need to shift the input signal centred on 1500Hz down to
+    // 1200Hz, an offset of -300Hz.
+
+    if (g_split) {
+        g_RxFreqOffsetHz = FDMDV_FCENTRE - freq;
+    }
+    else {
+        g_TxFreqOffsetHz = freq - FDMDV_FCENTRE;
+        g_RxFreqOffsetHz = FDMDV_FCENTRE - freq;
+    }
+}
+
+//----------------------------------------------------------------
+// SetupSerialPort()
+//----------------------------------------------------------------
+void MainFrame::SetupSerialPort(void)
+{
+    if(!wxGetApp().m_strRigCtrlPort.IsEmpty())
+    {
+        if(openComPort(wxGetApp().m_strRigCtrlPort.c_str()))
+        {
+            // always start PTT in Rx state
+            SerialPTTRx();
+        }
+        else
+        {
+            wxMessageBox("Couldn't open Serial Port", wxT("About"), wxOK | wxICON_ERROR, this);
+        }
+    }
+}
+
+void MainFrame::SerialPTTRx(void)
+{
+    printf("m_boolUseRTS: %d m_boolRTSPos: %d m_boolUseDTR: %d m_boolDTRPos: %d\n",
+           wxGetApp().m_boolUseRTS, wxGetApp().m_boolRTSPos, wxGetApp().m_boolUseDTR, wxGetApp().m_boolDTRPos);
+
+        if(wxGetApp().m_boolRTSPos) // RTS cleared LOW
+            lowerRTS();
+        else                        // RTS cleared HIGH
+            raiseRTS();
+
+        if(wxGetApp().m_boolDTRPos) // DTR cleared LOW
+            lowerDTR();
+        else                        // DTR cleared HIGH
+            raiseDTR();
+}
+
+//----------------------------------------------------------------
+// CloseSerialPort()
+//----------------------------------------------------------------
+void MainFrame::CloseSerialPort(void)
+{
+    if (com_handle != COM_HANDLE_INVALID) {
+        // always end with PTT in rx state
+
+        SerialPTTRx();
+
+               closeComPort();
+    }
+}
+
+
+//----------------------------------------------------------------
+// PollUDP() - see if any commands on UDP port
+//----------------------------------------------------------------
+
+// test this puppy with netcat: 
+//   $ echo "hello" | nc -u -q1 localhost 3000
+
+int MainFrame::PollUDP(void)
+{
+    // this will block until message received, so we put it in it's own thread
+
+    char buf[1024];
+    char reply[80];
+    size_t n = m_udp_sock->RecvFrom(m_udp_addr, buf, sizeof(buf)).LastCount();
+
+    if (n) {
+        wxString bufstr = wxString::From8BitData(buf, n);
+        bufstr.Trim();
+        wxString ipaddr = m_udp_addr.IPAddress();
+        printf("Received: \"%s\" from %s:%u\n",
+               (const char *)bufstr.c_str(),
+               (const char *)ipaddr.c_str(), m_udp_addr.Service());
+
+        // for security only accept commands from local host
+
+        sprintf(reply,"nope\n");
+        if (ipaddr.Cmp(_("127.0.0.1")) == 0) {
+
+            // process commands
+
+            if (bufstr.Cmp(_("restore")) == 0) {
+                m_schedule_restore = true;  // Make Restore happen in main thread to avoid crashing
+                sprintf(reply,"ok\n");
+            }
+                
+            wxString itemToSet, val;
+            if (bufstr.StartsWith(_("set "), &itemToSet)) {
+                if (itemToSet.StartsWith("txtmsg ", &val)) {
+                    // note: if options dialog is open this will get overwritten
+                    wxGetApp().m_callSign = val;
+                }  
+                sprintf(reply,"ok\n");
+            }
+                
+        }
+        else {
+            printf("We only accept messages from locahost!\n");
+        }
+
+       if ( m_udp_sock->SendTo(m_udp_addr, reply, strlen(reply)).LastCount() != strlen(reply)) {
+           printf("ERROR: failed to send data\n");
+        }
+    }
+
+    return n;
+}
+
+void MainFrame::startUDPThread(void) {
+    printf("starting UDP thread!\n");
+    m_UDPThread = new UDPThread;
+    m_UDPThread->mf = this;
+    if (m_UDPThread->Create() != wxTHREAD_NO_ERROR ) {
+        wxLogError(wxT("Can't create thread!"));
+    }
+    if (m_UDPThread->Run() != wxTHREAD_NO_ERROR ) {
+        wxLogError(wxT("Can't start thread!"));
+        delete m_UDPThread;
+    }
+}
+
+void MainFrame::stopUDPThread(void) {
+    printf("stopping UDP thread!\n");
+    if ((m_UDPThread != NULL) && m_UDPThread->m_run) {
+        m_UDPThread->m_run = 0;
+        m_UDPThread->Wait();
+        m_UDPThread = NULL;
+    }
+}
+
+void *UDPThread::Entry() {
+    printf("UDP thread started!\n");
+    while (m_run) {
+        if (wxGetApp().m_udp_enable) {
+            printf("m_udp_enable\n");
+            mf->m_udp_addr.Service(wxGetApp().m_udp_port);
+            mf->m_udp_sock = new wxDatagramSocket(mf->m_udp_addr, wxSOCKET_NOWAIT);
+
+            while (m_run && wxGetApp().m_udp_enable) {
+                if (mf->PollUDP() == 0) {
+                    wxThread::Sleep(20);
+                }
+            }
+
+            delete mf->m_udp_sock;
+        }
+        wxThread::Sleep(20);
+    }
+    return NULL;
+}
+
+
+char my_get_next_tx_char(void *callback_state) {
+    short ch = 0;
+    
+    fifo_read(g_txDataInFifo, &ch, 1);
+    //fprintf(stderr, "get_next_tx_char: %c\n", (char)ch);
+    return (char)ch;
+}
+
+void my_put_next_rx_char(void *callback_state, char c) {
+    short ch = (short)c;
+    //fprintf(stderr, "put_next_rx_char: %c\n", (char)c);
+    fifo_write(g_rxDataOutFifo, &ch, 1);
+}
+
+// Callback from FreeDv API to update error plots
+
+void my_freedv_put_error_pattern(void *state, short error_pattern[], int sz_error_pattern) {
+    fifo_write(g_error_pattern_fifo, error_pattern, sz_error_pattern);
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_main.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_main.h
new file mode 100644 (file)
index 0000000..25a1e70
--- /dev/null
@@ -0,0 +1,614 @@
+//==========================================================================
+// Name:            fdmdv2_main.h
+//
+// Purpose:         Declares simple wxWidgets application with GUI.
+// Created:         Apr. 9, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General 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 General License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __FDMDV2_MAIN__
+#define __FDMDV2_MAIN__
+
+#include "version.h"
+#ifndef _NO_AUTOTOOLS_
+#include "../config.h"
+#endif
+#include <wx/wx.h>
+
+#include <wx/tglbtn.h>
+#include <wx/app.h>
+//#include <wx/aboutdlg.h>
+#include "wx/rawbmp.h"
+#include "wx/file.h"
+#include "wx/filename.h"
+#include "wx/config.h"
+#include <wx/fileconf.h>
+#include "wx/graphics.h"
+#include "wx/mstream.h"
+#include "wx/wfstream.h"
+#include "wx/quantize.h"
+#include "wx/scopedptr.h"
+#include "wx/stopwatch.h"
+#include "wx/versioninfo.h"
+#include <wx/sound.h>
+#include <wx/url.h>
+#include <wx/sstream.h>
+#include <wx/listbox.h>
+#include <wx/textdlg.h>
+#include <wx/regex.h>
+#include <wx/socket.h>
+
+#include <samplerate.h>
+
+#include <hamlib.h> 
+#include <stdint.h>
+#include <speex/speex_preprocess.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <termios.h>
+#include <sys/ioctl.h>
+#endif
+
+#include "codec2.h"
+#include "codec2_fdmdv.h"
+#include "codec2_fifo.h"
+#include "golay23.h"
+#include "modem_stats.h"
+
+#include "topFrame.h"
+#include "dlg_ptt.h"
+#include "dlg_options.h"
+#include "fdmdv2_plot.h"
+#include "fdmdv2_plot_scalar.h"
+#include "fdmdv2_plot_scatter.h"
+#include "fdmdv2_plot_waterfall.h"
+#include "fdmdv2_plot_spectrum.h"
+#include "fdmdv2_pa_wrapper.h"
+#include "sndfile.h"
+#include "portaudio.h"
+#include "dlg_audiooptions.h"
+#include "dlg_filter.h"
+#include "dlg_options.h"
+#include "varicode.h"
+#include "sox_biquad.h"
+#include "comp_prim.h"
+
+#define _USE_TIMER              1
+#define _USE_ONIDLE             1
+#define _DUMMY_DATA             1
+//#define _AUDIO_PASSTHROUGH    1
+#define _REFRESH_TIMER_PERIOD   (DT*1000)
+//#define _USE_ABOUT_DIALOG       1
+
+enum {
+        ID_START = wxID_HIGHEST,
+        ID_TIMER_WATERFALL,
+        ID_TIMER_SPECTRUM,
+        ID_TIMER_SCATTER,
+        ID_TIMER_SCALAR
+     };
+
+#define EXCHANGE_DATA_IN    0
+#define EXCHANGE_DATA_OUT   1
+
+#ifdef _WIN32
+#define COM_HANDLE_INVALID                     INVALID_HANDLE_VALUE
+typedef HANDLE      com_handle_t;
+#else
+#define COM_HANDLE_INVALID                     -1
+typedef int         com_handle_t;
+#endif
+
+extern int                 g_nSoundCards;
+extern int                 g_soundCard1InDeviceNum;
+extern int                 g_soundCard1OutDeviceNum;
+extern int                 g_soundCard1SampleRate;
+extern int                 g_soundCard2InDeviceNum;
+extern int                 g_soundCard2OutDeviceNum;
+extern int                 g_soundCard2SampleRate;
+
+class MainFrame;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class MainApp
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class MainApp : public wxApp
+{
+    public:
+        virtual bool        OnInit();
+        virtual int         OnExit();
+
+        wxString            m_strVendName;
+        wxString            m_StrAppName;
+
+        wxString            m_textNumChOut;
+        wxString            m_textNumChIn;
+
+        wxString            m_strRxInAudio;
+        wxString            m_strRxOutAudio;
+        wxString            m_textVoiceInput;
+        wxString            m_textVoiceOutput;
+        wxString            m_strSampleRate;
+        wxString            m_strBitrate;
+
+        // PTT -----------------------------------
+
+        bool                m_boolHalfDuplex;
+
+        bool                m_boolHamlibUseForPTT;
+        unsigned int        m_intHamlibRig;
+        wxString            m_strHamlibSerialPort;
+        Hamlib              *m_hamlib;
+
+        bool                m_boolUseSerialPTT;
+        wxString            m_strRigCtrlPort;
+        bool                m_boolUseRTS;
+        bool                m_boolRTSPos;
+        bool                m_boolUseDTR;
+        bool                m_boolDTRPos;
+
+        // Play/Rec files
+
+        wxString            m_playFileToMicInPath;
+        wxString            m_recFileFromRadioPath;
+        unsigned int        m_recFileFromRadioSecs;
+        wxString            m_playFileFromRadioPath;
+
+        // Options dialog
+
+        wxString            m_callSign;
+        bool                m_events;
+        int                 m_events_spam_timer;
+        unsigned int        m_textEncoding;
+        bool                m_enable_checksum;
+        wxString            m_events_regexp_match;
+        wxString            m_events_regexp_replace;
+
+        bool                m_snrSlow;
+
+        // LPC Post Filter
+        bool                m_codec2LPCPostFilterEnable;
+        bool                m_codec2LPCPostFilterBassBoost;
+        float               m_codec2LPCPostFilterGamma;
+        float               m_codec2LPCPostFilterBeta;
+        
+        // Speex Pre-Processor
+        bool                m_speexpp_enable;
+
+        // Mic In Equaliser
+        float               m_MicInBassFreqHz;
+        float               m_MicInBassGaindB;
+        float               m_MicInTrebleFreqHz;
+        float               m_MicInTrebleGaindB;
+        float               m_MicInMidFreqHz;
+        float               m_MicInMidGaindB;
+        float               m_MicInMidQ;
+        bool                m_MicInEQEnable;
+
+        // Spk Out Equaliser
+        float               m_SpkOutBassFreqHz;
+        float               m_SpkOutBassGaindB;
+        float               m_SpkOutTrebleFreqHz;
+        float               m_SpkOutTrebleGaindB;
+        float               m_SpkOutMidFreqHz;
+        float               m_SpkOutMidGaindB;
+        float               m_SpkOutMidQ;
+        bool                m_SpkOutEQEnable;
+
+        // Flags for displaying windows
+        int                 m_show_wf;
+        int                 m_show_spect;
+        int                 m_show_scatter;
+        int                 m_show_timing;
+        int                 m_show_freq;
+        int                 m_show_speech_in;
+        int                 m_show_speech_out;
+        int                 m_show_demod_in;
+        int                 m_show_test_frame_errors;
+        int                 m_show_test_frame_errors_hist;
+
+        // optional vox trigger tone
+        bool                m_leftChannelVoxTone;
+
+        // UDP control port
+        bool                m_udp_enable;
+        int                 m_udp_port;
+
+        // notebook display after tx->rxtransition
+        int                 m_rxNbookCtrl;
+
+        wxRect              m_rTopWindow;
+
+        int                 m_framesPerBuffer;
+
+        bool                loadConfig();
+        bool                saveConfig();
+
+        // misc
+
+        bool       m_testFrames;
+        bool       m_channel_noise;
+        float      m_channel_snr_dB;
+
+        int        FilterEvent(wxEvent& event);
+        MainFrame *frame;
+
+        bool       m_FreeDV700txClip;
+    protected:
+};
+
+// declare global static function wxGetApp()
+DECLARE_APP(MainApp)
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// paCallBackData
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+typedef struct
+{
+    // libresample states for 48 to 8 kHz conversions
+
+    SRC_STATE      *insrc1;
+    SRC_STATE      *outsrc1;
+    SRC_STATE      *insrc2;
+    SRC_STATE      *outsrc2;
+    SRC_STATE      *insrcsf;
+
+    // FIFOs attached to first sound card
+
+    struct FIFO    *infifo1;
+    struct FIFO    *outfifo1;
+
+    // FIFOs attached to second sound card
+    struct FIFO    *infifo2;
+    struct FIFO    *outfifo2;
+
+    // FIFOs for rx process
+    struct FIFO    *rxinfifo;
+    struct FIFO    *rxoutfifo;
+
+    int             inputChannels1, inputChannels2;
+
+    // EQ filter states
+    void           *sbqMicInBass;
+    void           *sbqMicInTreble;
+    void           *sbqMicInMid;
+    void           *sbqSpkOutBass;
+    void           *sbqSpkOutTreble;
+    void           *sbqSpkOutMid;
+
+    bool            micInEQEnable;
+    bool            spkOutEQEnable;
+
+    // optional loud tone on left channel to reliably trigger vox
+    bool            leftChannelVoxTone;
+    float           voxTonePhase;
+
+} paCallBackData;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// panel with custom loop checkbox for play file dialog
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class MyExtraPlayFilePanel : public wxPanel
+{
+public:
+    MyExtraPlayFilePanel(wxWindow *parent);
+    void setLoopPlayFileToMicIn(bool checked) { m_cb->SetValue(checked); }
+    bool getLoopPlayFileToMicIn(void) { return m_cb->GetValue(); }
+private:
+    wxCheckBox *m_cb;
+};
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// panel with custom Seconds-to-record control for record file dialog
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class MyExtraRecFilePanel : public wxPanel
+{
+public:
+    MyExtraRecFilePanel(wxWindow *parent);
+    ~MyExtraRecFilePanel() 
+    {
+        wxLogDebug("Destructor\n");
+    }
+    void setSecondsToRecord(wxString value) { m_secondsToRecord->SetValue(value); }
+    wxString getSecondsToRecord(void) 
+    { 
+        wxLogDebug("getSecondsToRecord: %s\n",m_secondsToRecord->GetValue());
+        return m_secondsToRecord->GetValue(); 
+    }
+private:
+    wxTextCtrl *m_secondsToRecord;
+};
+
+class txRxThread;
+class UDPThread;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class MainFrame
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class MainFrame : public TopFrame
+{
+    public:
+        MainFrame(wxWindow *parent);
+        virtual ~MainFrame();
+
+        PlotSpectrum*           m_panelSpectrum;
+        PlotWaterfall*          m_panelWaterfall;
+        PlotScatter*            m_panelScatter;
+        PlotScalar*             m_panelTimeOffset;
+        PlotScalar*             m_panelFreqOffset;
+        PlotScalar*             m_panelSpeechIn;
+        PlotScalar*             m_panelSpeechOut;
+        PlotScalar*             m_panelDemodIn;
+        PlotScalar*             m_panelTestFrameErrors;
+        PlotScalar*             m_panelTestFrameErrorsHist;
+
+        bool                    m_RxRunning;
+
+        PortAudioWrap           *m_rxInPa;
+        PortAudioWrap           *m_rxOutPa;
+        PortAudioWrap           *m_txInPa;
+        PortAudioWrap           *m_txOutPa;
+
+        PaError                 m_rxErr;
+        PaError                 m_txErr;
+        
+        txRxThread*             m_txRxThread;
+
+        bool                    OpenHamlibRig();
+        void                    SetupSerialPort(void);
+        void                    CloseSerialPort(void);
+        void                    SerialPTTRx(void);
+
+        bool                    m_modal;
+
+#ifdef _USE_TIMER
+        wxTimer                 m_plotTimer;
+#endif
+
+    void destroy_fifos(void);
+    void destroy_src(void);
+    void autoDetectSoundCards(PortAudioWrap *pa);
+
+        static int rxCallback(
+                                const void *inBuffer,
+                                void *outBuffer,
+                                unsigned long framesPerBuffer,
+                                const PaStreamCallbackTimeInfo *outTime,
+                                PaStreamCallbackFlags statusFlags,
+                                void *userData
+                             );
+        static int txCallback(
+                                const void *inBuffer,
+                                void *outBuffer,
+                                unsigned long framesPerBuffer,
+                                const PaStreamCallbackTimeInfo *outTime,
+                                PaStreamCallbackFlags statusFlags,
+                                void *userData
+                             );
+
+
+    void initPortAudioDevice(PortAudioWrap *pa, int inDevice, int outDevice, 
+                             int soundCard, int sampleRate, int inputChannels);
+
+    void togglePTT(void);
+
+    wxIPV4address           m_udp_addr;
+    wxDatagramSocket       *m_udp_sock;
+    UDPThread              *m_UDPThread;
+    void                    startUDPThread(void);
+    void                    stopUDPThread(void);
+    int                     PollUDP();
+    bool                    m_schedule_restore;
+
+    protected:
+
+#ifdef _WIN32
+#define COM_HANDLE_INVALID                     INVALID_HANDLE_VALUE
+        com_handle_t  com_handle;
+#else
+#define COM_HANDLE_INVALID                     -1
+        com_handle_t  com_handle;
+#endif
+        void raiseDTR(void);
+        void lowerDTR(void);
+        void raiseRTS(void);
+        void lowerRTS(void);
+        bool openComPort(const char *port);
+        void closeComPort(void);
+
+        void setsnrBeta(bool snrSlow);
+
+        // protected event handlers
+        virtual void OnCloseFrame(wxCloseEvent& event);
+        void OnExitClick(wxCommandEvent& event);
+
+        void startTxStream();
+        void startRxStream();
+        void stopTxStream();
+        void stopRxStream();
+        void abortTxStream();
+        void abortRxStream();
+        
+        void OnTop(wxCommandEvent& event);
+        void OnExit( wxCommandEvent& event );
+
+        void OnToolsAudio( wxCommandEvent& event );
+        void OnToolsAudioUI( wxUpdateUIEvent& event );
+        void OnToolsComCfg( wxCommandEvent& event );
+        void OnToolsComCfgUI( wxUpdateUIEvent& event );
+        void OnToolsFilter( wxCommandEvent& event );
+        void OnToolsOptions(wxCommandEvent& event);
+        void OnToolsOptionsUI(wxUpdateUIEvent& event);
+
+        void OnPlayFileToMicIn( wxCommandEvent& event );
+        void OnRecFileFromRadio( wxCommandEvent& event );
+        void OnPlayFileFromRadio( wxCommandEvent& event );
+
+        void OnHelpCheckUpdates( wxCommandEvent& event );
+        void OnHelpCheckUpdatesUI( wxUpdateUIEvent& event );
+        void OnHelpAbout( wxCommandEvent& event );
+        void OnCmdSliderScroll( wxScrollEvent& event );
+//        void OnSliderScrollBottom( wxScrollEvent& event );
+//        void OnCmdSliderScrollChanged( wxScrollEvent& event );
+//        void OnSliderScrollTop( wxScrollEvent& event );
+        void OnCheckSQClick( wxCommandEvent& event );
+        void OnCheckSNRClick( wxCommandEvent& event );
+
+        // Toggle Buttons
+        void OnTogBtnSplitClick(wxCommandEvent& event);
+        void OnTogBtnAnalogClick(wxCommandEvent& event);
+        void OnTogBtnRxID( wxCommandEvent& event );
+        void OnTogBtnTxID( wxCommandEvent& event );
+        void OnTogBtnPTT( wxCommandEvent& event );
+        void OnTogBtnOnOff( wxCommandEvent& event );
+
+        void OnCallSignReset( wxCommandEvent& event );
+        void OnBerReset( wxCommandEvent& event );
+
+        //System Events
+        void OnPaint(wxPaintEvent& event);
+        void OnSize( wxSizeEvent& event );
+        void OnUpdateUI( wxUpdateUIEvent& event );
+        void OnDeleteConfig(wxCommandEvent&);
+#ifdef _USE_TIMER
+        void OnTimer(wxTimerEvent &evt);
+#endif
+#ifdef _USE_ONIDLE
+        void OnIdle(wxIdleEvent &evt);
+#endif
+
+    private:
+        bool        m_useMemory;
+        wxTextCtrl* m_tc;
+        int         m_zoom;
+        float       m_snrBeta;
+        
+        // Callsign/text messaging
+        char        m_callsign[MAX_CALLSIGN];
+        char       *m_pcallsign;
+        unsigned int m_checksumGood;
+        unsigned int m_checksumBad;
+        
+        // Events
+        void        processTxtEvent(char event[]);
+        class OptionsDlg *optionsDlg;
+        wxTimer     spamTimer[MAX_EVENT_RULES];
+
+        // level Gauge
+        float       m_maxLevel;
+        // flags to indicate when new EQ filters need to be designed
+
+        bool        m_newMicInFilter;
+        bool        m_newSpkOutFilter;
+
+        void*       designAnEQFilter(const char filterType[], float freqHz, float gaindB, float Q = 0.0);
+        void        designEQFilters(paCallBackData *cb);
+        void        deleteEQFilters(paCallBackData *cb);
+};
+
+void txRxProcessing();
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// class txRxThread - experimental tx/rx processing thread
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class txRxThread : public wxThread
+{
+public:
+    txRxThread(void) : wxThread(wxTHREAD_JOINABLE) { m_run = 1; }
+
+    // thread execution starts here
+    void *Entry() 
+    {
+        while (m_run) 
+        {
+            txRxProcessing();        
+            wxThread::Sleep(20);
+        }
+        return NULL;
+    }
+
+    // called when the thread exits - whether it terminates normally or is
+    // stopped with Delete() (but not when it is Kill()ed!)
+    void OnExit() { }
+
+public:
+    bool  m_run;
+};
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// class UDPThread - waits for UDP messages
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class UDPThread : public wxThread
+{
+public:
+    UDPThread(void) : wxThread(wxTHREAD_JOINABLE) { m_run = 1; }
+
+    // thread execution starts here
+    void *Entry();
+
+    // called when the thread exits - whether it terminates normally or is
+    // stopped with Delete() (but not when it is Kill()ed!)
+    void OnExit() { }
+
+public:
+    MainFrame              *mf;
+    bool                    m_run;
+};
+
+void resample_for_plot(struct FIFO *plotFifo, short buf[], int length, int fs);
+
+int resample(SRC_STATE *src,
+             short      output_short[],
+             short      input_short[],
+             int        output_sample_rate,
+             int        input_sample_rate,
+             int        length_output_short, // maximum output array length in samples
+             int        length_input_short
+             );
+void txRxProcessing();
+void per_frame_rx_processing(
+                                        FIFO    *output_fifo,   // decoded speech samples
+                                        FIFO    *input_fifo     // modem samples input to demod
+                                    );
+
+// FreeDv API calls this when there is a test frame that needs a-plottin'
+
+void my_freedv_put_error_pattern(void *state, short error_pattern[], int sz_error_pattern);
+
+// FreeDv API calls these puppies when it needs/receives a text char 
+
+char my_get_next_tx_char(void *callback_state);
+void my_put_next_rx_char(void *callback_state, char c);
+
+#endif //__FDMDV2_MAIN__
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_pa_wrapper.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_pa_wrapper.cpp
new file mode 100644 (file)
index 0000000..2f67ca2
--- /dev/null
@@ -0,0 +1,324 @@
+//==========================================================================
+// Name:            fdmdv2_pa_wrapper.cpp
+// Purpose:         Implements a wrapper class around the PortAudio library.
+// Created:         August 12, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include "fdmdv2_pa_wrapper.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// PortAudioWrap()
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PortAudioWrap::PortAudioWrap()
+{
+    m_pStream                   = NULL;
+    m_pUserData                 = NULL;
+    m_samplerate                = 0;
+    m_framesPerBuffer           = 0;
+    m_statusFlags               = 0;
+    m_pStreamCallback           = NULL;
+    m_pStreamFinishedCallback   = NULL;
+    m_pTimeInfo                 = 0;
+    m_newdata                   = false;
+
+//    loadData();
+}
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// ~PortAudioWrap()
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PortAudioWrap::~PortAudioWrap()
+{
+}
+
+//----------------------------------------------------------------
+// streamOpen()
+//----------------------------------------------------------------
+PaError PortAudioWrap::streamOpen()
+{
+    return Pa_OpenStream(
+                            &m_pStream,
+                            m_inputBuffer.device == paNoDevice ? NULL : &m_inputBuffer,
+                            m_outputBuffer.device == paNoDevice ? NULL : &m_outputBuffer,
+                            m_samplerate,
+                            m_framesPerBuffer,
+                            m_statusFlags,
+                            *m_pStreamCallback,
+                            m_pUserData
+                        );
+}
+
+//----------------------------------------------------------------
+// streamStart()
+//----------------------------------------------------------------
+PaError PortAudioWrap::streamStart()
+{
+    return Pa_StartStream(m_pStream);
+}
+
+//----------------------------------------------------------------
+// streamClose()
+//----------------------------------------------------------------
+PaError PortAudioWrap::streamClose()
+{
+    if(isOpen())
+    {
+        PaError rv = Pa_CloseStream(m_pStream);
+        return rv;
+    }
+    else
+    {
+        return paNoError;
+    }
+}
+
+//----------------------------------------------------------------
+// terminate()
+//----------------------------------------------------------------
+void PortAudioWrap::terminate()
+{
+    if(Pa_IsStreamStopped(m_pStream) != paNoError)
+    {
+        Pa_StopStream(m_pStream);
+    }
+    Pa_Terminate();
+}
+
+//----------------------------------------------------------------
+// stop()
+//----------------------------------------------------------------
+void PortAudioWrap::stop()
+{
+    Pa_StopStream(m_pStream);
+}
+
+//----------------------------------------------------------------
+// abort()
+//----------------------------------------------------------------
+void PortAudioWrap::abort()
+{
+    Pa_AbortStream(m_pStream);
+}
+
+//----------------------------------------------------------------
+// isStopped()
+//----------------------------------------------------------------
+bool PortAudioWrap::isStopped() const
+{
+    PaError ret = Pa_IsStreamStopped(m_pStream);
+    return ret;
+}
+
+//----------------------------------------------------------------
+// isActive()
+//----------------------------------------------------------------
+bool PortAudioWrap::isActive() const
+{
+    PaError ret = Pa_IsStreamActive(m_pStream);
+    return ret;
+}
+
+//----------------------------------------------------------------
+// isOpen()
+//----------------------------------------------------------------
+bool PortAudioWrap::isOpen() const
+{
+    return (m_pStream != NULL);
+}
+
+//----------------------------------------------------------------
+// getDefaultInputDevice()
+//----------------------------------------------------------------
+PaDeviceIndex PortAudioWrap::getDefaultInputDevice()
+{
+    return Pa_GetDefaultInputDevice();
+}
+
+//----------------------------------------------------------------
+// getDefaultOutputDevice()
+//----------------------------------------------------------------
+PaDeviceIndex PortAudioWrap::getDefaultOutputDevice()
+{
+    return Pa_GetDefaultOutputDevice();
+}
+
+//----------------------------------------------------------------
+// setInputChannelCount()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setInputChannelCount(int count)
+{
+    m_inputBuffer.channelCount = count;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// getInputChannelCount()
+//----------------------------------------------------------------
+PaError PortAudioWrap::getInputChannelCount()
+{
+    return m_inputBuffer.channelCount;
+}
+
+//----------------------------------------------------------------
+// setInputSampleFormat()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setInputSampleFormat(PaSampleFormat format)
+{
+    m_inputBuffer.sampleFormat = format;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setInputLatency()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setInputLatency(PaTime latency)
+{
+    m_inputBuffer.suggestedLatency = latency;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setInputHostApiStreamInfo()
+//----------------------------------------------------------------
+void PortAudioWrap::setInputHostApiStreamInfo(void *info)
+{
+    m_inputBuffer.hostApiSpecificStreamInfo = info;
+}
+
+//----------------------------------------------------------------
+// getInputDefaultLowLatency()
+//----------------------------------------------------------------
+PaTime  PortAudioWrap::getInputDefaultLowLatency()
+{
+    return Pa_GetDeviceInfo(m_inputBuffer.device)->defaultLowInputLatency;
+}
+
+//----------------------------------------------------------------
+// setOutputChannelCount()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setOutputChannelCount(int count)
+{
+    m_outputBuffer.channelCount = count;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// getOutputChannelCount()
+//----------------------------------------------------------------
+const int PortAudioWrap::getOutputChannelCount()
+{
+    return m_outputBuffer.channelCount;
+}
+
+//----------------------------------------------------------------
+// getDeviceName()
+//----------------------------------------------------------------
+const char *PortAudioWrap::getDeviceName(PaDeviceIndex dev)
+{
+    const PaDeviceInfo *info;
+    info = Pa_GetDeviceInfo(dev);
+    return info->name;
+}
+
+//----------------------------------------------------------------
+// setOutputSampleFormat()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setOutputSampleFormat(PaSampleFormat format)
+{
+    m_outputBuffer.sampleFormat = format;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setOutputLatency()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setOutputLatency(PaTime latency)
+{
+    m_outputBuffer.suggestedLatency = latency;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setOutputHostApiStreamInfo()
+//----------------------------------------------------------------
+void PortAudioWrap::setOutputHostApiStreamInfo(void *info)
+{
+    m_outputBuffer.hostApiSpecificStreamInfo = info;
+}
+
+//----------------------------------------------------------------
+// getOutputDefaultLowLatency()
+//----------------------------------------------------------------
+PaTime  PortAudioWrap::getOutputDefaultLowLatency()
+{
+    return Pa_GetDeviceInfo(m_outputBuffer.device)->defaultLowOutputLatency;
+}
+
+//----------------------------------------------------------------
+// setFramesPerBuffer()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setFramesPerBuffer(unsigned long size)
+{
+    m_framesPerBuffer = size;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setSampleRate()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setSampleRate(unsigned long rate)
+{
+    m_samplerate = rate;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setStreamFlags()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setStreamFlags(PaStreamFlags flags)
+{
+    m_statusFlags = flags;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setInputDevice()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setInputDevice(PaDeviceIndex index)
+{
+    m_inputBuffer.device = index;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setOutputDevice()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setOutputDevice(PaDeviceIndex index)
+{
+    m_outputBuffer.device = index;
+    return paNoError;
+}
+
+//----------------------------------------------------------------
+// setCallback()
+//----------------------------------------------------------------
+PaError PortAudioWrap::setCallback(PaStreamCallback *callback)
+{
+    m_pStreamCallback = callback;
+    return paNoError;
+}
+
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_pa_wrapper.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_pa_wrapper.h
new file mode 100644 (file)
index 0000000..3d216c0
--- /dev/null
@@ -0,0 +1,115 @@
+//==========================================================================
+// Name:            fdmdv2_pa_wrapper.h
+// Purpose:         Defines a wrapper class around PortAudio
+// Created:         August 12, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <stdio.h>
+#include <math.h>
+#include "fdmdv2_defines.h"
+#include "codec2_fdmdv.h"
+#include "codec2.h"
+#include "portaudio.h"
+
+#define PA_SAMPLE_TYPE      paInt16         //paFloat32
+#define FRAMES_PER_BUFFER   (64)
+
+typedef float SAMPLE;
+
+class PortAudioWrap
+{
+    public:
+        PortAudioWrap();
+        ~PortAudioWrap();
+
+//        float                           m_av_mag[FDMDV_NSPEC];
+
+    private:
+        PaStream                        *m_pStream;
+        void                            *m_pUserData;
+        PaStreamCallback                *m_pStreamCallback;
+        PaStreamFinishedCallback        *m_pStreamFinishedCallback;
+        const PaStreamCallbackTimeInfo  *m_pTimeInfo;
+        struct FDMDV                    *m_pFDMDV_state;
+        PaStreamParameters              m_inputBuffer;
+        PaStreamParameters              m_outputBuffer;
+        int                             m_samplerate;
+        unsigned long                   m_framesPerBuffer;
+        PaStreamCallbackFlags           m_statusFlags;
+        bool                            m_newdata;
+
+    public:
+
+        void                averageData(float mag_dB[]);
+
+        int                 getDeviceCount() { return Pa_GetDeviceCount(); }
+        PaDeviceIndex       getDefaultInputDevice();
+        PaDeviceIndex       getDefaultOutputDevice();
+        PaStreamParameters  *getDeviceInfo(PaDeviceIndex idx);
+
+        PaError             setFramesPerBuffer(unsigned long size);
+        PaError             setSampleRate(unsigned long size);
+
+        PaError             setStreamFlags(PaStreamFlags flags);
+        PaError             setCallback(PaStreamCallback *m_pStreamCallback);
+        PaError             setStreamCallback(PaStream *stream, PaStreamCallback* callback) { m_pStreamCallback = callback; return 0;}
+        PaError             setStreamFinishedCallback(PaStream *stream, PaStreamFinishedCallback* m_pStreamFinishedCallback);
+
+        void                setInputBuffer(const PaStreamParameters& inputBuffer)   {this->m_inputBuffer = inputBuffer;}
+        PaError             setInputDevice(PaDeviceIndex dev);
+        PaError             setInputChannelCount(int count);
+        int                 getInputChannelCount();
+        PaError             setInputSampleFormat(PaSampleFormat format);
+        PaError             setInputSampleRate(PaSampleFormat format);
+        PaError             setInputLatency(PaTime latency);
+        void                setInputHostApiStreamInfo(void *info = NULL);
+        PaTime              getInputDefaultLowLatency();
+        const char          *getDeviceName(PaDeviceIndex dev);
+
+        PaError             setOutputDevice(PaDeviceIndex dev);
+        PaError             setOutputChannelCount(int count);
+        const int           getOutputChannelCount();
+        PaError             setOutputSampleFormat(PaSampleFormat format);
+        PaError             setOutputLatency(PaTime latency);
+        void                setOutputHostApiStreamInfo(void *info = NULL);
+        PaTime              getOutputDefaultLowLatency();
+
+        void                setFdmdvState(FDMDV* fdmdv_state)                       {this->m_pFDMDV_state = fdmdv_state;}
+        void                setOutputBuffer(const PaStreamParameters& outputBuffer) {this->m_outputBuffer = outputBuffer;}
+        void                setTimeInfo(PaStreamCallbackTimeInfo* timeInfo)         {this->m_pTimeInfo = timeInfo;}
+        void                setUserData(void* userData)                             {this->m_pUserData = userData;}
+        unsigned long       getFramesPerBuffer() const                              {return m_framesPerBuffer;}
+        const               PaStreamParameters& getInputBuffer() const              {return m_inputBuffer;}
+        const               PaStreamParameters& getOutputBuffer() const             {return m_outputBuffer;}
+        const               PaStreamCallbackFlags& getStatusFlags() const           {return m_statusFlags;}
+
+        FDMDV*              getFdmdvState()                                         {return m_pFDMDV_state;}
+        int                 getSamplerate() const                                   {return m_samplerate;}
+        PaStream*           getStream()                                             {return m_pStream;}
+        void                *getUserData()                                          {return m_pUserData;}
+        bool                getDataAvail()                                          {return m_newdata;}
+        PaError             streamStart();
+        PaError             streamClose();
+        PaError             streamOpen();
+        void                terminate();
+        void                stop();
+        void                abort();
+        bool                isOpen() const;
+        bool                isStopped() const;
+        bool                isActive() const;
+//        void                loadData();
+};
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot.cpp
new file mode 100644 (file)
index 0000000..1b85cd9
--- /dev/null
@@ -0,0 +1,283 @@
+//==========================================================================
+// Name:            fdmdv2_plot.cpp
+// Purpose:         Implements simple wxWidgets application with GUI.
+// Created:         Apr. 9, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <string.h>
+#include "fdmdv2_plot.h"
+
+BEGIN_EVENT_TABLE(PlotPanel, wxPanel)
+    EVT_PAINT           (PlotPanel::OnPaint)
+    EVT_MOTION          (PlotPanel::OnMouseMove)
+    EVT_LEFT_DOWN       (PlotPanel::OnMouseLeftDown)
+    EVT_LEFT_UP         (PlotPanel::OnMouseLeftUp)
+    EVT_RIGHT_DOWN      (PlotPanel::OnMouseRightDown)
+    EVT_MOUSEWHEEL      (PlotPanel::OnMouseWheelMoved)
+    EVT_SIZE            (PlotPanel::OnSize)
+    EVT_SHOW            (PlotPanel::OnShow)
+END_EVENT_TABLE()
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlotPanel(wxFrame* parent) : wxPanel(parent)
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PlotPanel::PlotPanel(wxFrame* parent) : wxPanel(parent)
+{
+    m_pNoteBook         = (wxAuiNotebook *) parent;
+    m_pTopFrame         = (MainFrame *)m_pNoteBook->GetParent();
+    m_zoomFactor        = 1.0;
+    m_pBmp              = NULL;
+    m_pPix              = NULL;
+    m_firstPass         = true;
+    m_line_color        = 0;
+    m_newdata           = false;
+    m_clip              = false;
+    m_use_bitmap        = true;
+    m_rubberBand        = false;
+    m_mouseDown         = false;
+    m_penShortDash      = wxPen(wxColor(0xA0, 0xA0, 0xA0), 1, wxPENSTYLE_SHORT_DASH);
+    m_penDotDash        = wxPen(wxColor(0xD0, 0xD0, 0xD0), 1, wxPENSTYLE_DOT_DASH);
+    m_penSolid          = wxPen(wxColor(0x00, 0x00, 0x00), 1, wxPENSTYLE_SOLID);
+    SetBackgroundStyle(wxBG_STYLE_PAINT);
+    SetLabelSize(10.0);
+}
+
+//-------------------------------------------------------------------------
+// ~PlotPanel()
+//-------------------------------------------------------------------------
+PlotPanel::~PlotPanel()
+{
+    if(m_pBmp != NULL)
+    {
+        delete m_pBmp;
+    }
+}
+
+//-------------------------------------------------------------------------
+// GetLabelSize()
+//-------------------------------------------------------------------------
+double PlotPanel::GetLabelSize()
+{
+    return m_label_size;
+}
+
+//-------------------------------------------------------------------------
+// SetLabelSize()
+//-------------------------------------------------------------------------
+void PlotPanel::SetLabelSize(double size)
+{
+    m_label_size = size;
+}
+
+//-------------------------------------------------------------------------
+// OnShow()
+//-------------------------------------------------------------------------
+void PlotPanel::OnShow(wxShowEvent& event)
+{
+    this->Refresh();
+}
+
+//-------------------------------------------------------------------------
+// OnErase()
+//-------------------------------------------------------------------------
+void PlotPanel::OnErase(wxEraseEvent& event)
+{
+    event.Skip();
+}
+
+//-------------------------------------------------------------------------
+// OnSize()
+//-------------------------------------------------------------------------
+void PlotPanel::OnSize(wxSizeEvent& event)
+{
+    m_rCtrlPrev = m_rCtrl;
+    m_rCtrl     = GetClientRect();
+    if(m_use_bitmap)
+    {
+        if(!m_oImage.IsOk())
+        {
+            m_oImage.Create(m_rCtrl.GetWidth(), m_rCtrl.GetHeight(), true);
+        }
+        else
+        {
+            m_oImage.Rescale(m_rCtrl.GetWidth(), m_rCtrl.GetHeight());
+        }
+        m_pBmp = new wxBitmap(m_oImage, wxBITMAP_SCREEN_DEPTH);
+        m_firstPass = true;
+    }
+    this->Refresh();
+}
+
+//-------------------------------------------------------------------------
+// OnMouseMove()
+//-------------------------------------------------------------------------
+void PlotPanel::OnMouseMove(wxMouseEvent& event)
+{
+//    if(m_mouseDown)
+//    {
+//        paintNow();
+//    }
+}
+
+//-------------------------------------------------------------------------
+// OnMouseLeftDown()
+//-------------------------------------------------------------------------
+void PlotPanel::OnMouseLeftDown(wxMouseEvent& event)
+{
+}
+
+//-------------------------------------------------------------------------
+// OnMouseRightDown()
+//-------------------------------------------------------------------------
+void PlotPanel::OnMouseRightDown(wxMouseEvent& event)
+{
+}
+
+//-------------------------------------------------------------------------
+// OnMouseWheelMoved()
+//-------------------------------------------------------------------------
+void PlotPanel::OnMouseWheelMoved(wxMouseEvent& event)
+{
+}
+
+//-------------------------------------------------------------------------
+// OnMouseLeftUp()
+//-------------------------------------------------------------------------
+void PlotPanel::OnMouseLeftUp(wxMouseEvent& event)
+{
+    m_mouseDown = false;
+}
+
+//-------------------------------------------------------------------------
+// SetZoomFactor()
+//-------------------------------------------------------------------------
+double PlotPanel::SetZoomFactor(double zf)
+{
+    if((zf > 0) && (zf < 5.0))
+    {
+        m_zoomFactor = zf;
+    }
+    return zf;
+}
+
+//-------------------------------------------------------------------------
+// GetZoomFactor()
+//-------------------------------------------------------------------------
+double PlotPanel::GetZoomFactor(double zf)
+{
+    return m_zoomFactor;
+}
+
+//-------------------------------------------------------------------------
+// draw()
+//-------------------------------------------------------------------------
+void PlotPanel::draw(wxAutoBufferedPaintDC& pDC)
+{
+    printf("PlotPanel::draw()");
+    wxMemoryDC m_mDC;
+    m_mDC.SelectObject(*m_pBmp);
+    m_rCtrl  = GetClientRect();
+    m_rGrid  = m_rCtrl;
+
+    m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2)));
+    m_rGrid.Offset(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER);
+
+    pDC.Clear();
+    m_rPlot = wxRect(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_rGrid.GetWidth(), m_rGrid.GetHeight());
+    if(m_firstPass)
+    {
+        m_firstPass = false;
+        m_mDC.FloodFill(0, 0, VERY_LTGREY_COLOR);
+
+        // Draw a filled rectangle with aborder
+        wxBrush ltGraphBkgBrush = wxBrush(DARK_BLUE_COLOR);
+        m_mDC.SetBrush(ltGraphBkgBrush);
+        m_mDC.SetPen(wxPen(BLACK_COLOR, 0));
+        m_mDC.DrawRectangle(m_rPlot);
+    }
+    if(m_newdata)
+    {
+        m_newdata = false;
+        int t = m_rPlot.GetTop();
+        int l = m_rPlot.GetLeft();
+//        int r = m_rPlot.GetRight();
+        int h = m_rPlot.GetHeight();
+        int w = m_rPlot.GetWidth();
+        pDC.Blit(l, t, w, h, &m_mDC, l, t);
+    }
+    drawGraticule(pDC);
+    m_mDC.SetBrush(wxNullBrush);
+    m_mDC.SelectObject(wxNullBitmap);
+}
+
+//-------------------------------------------------------------------------
+// drawGraticule()
+//-------------------------------------------------------------------------
+void PlotPanel::drawGraticule(wxAutoBufferedPaintDC& pDC)
+{
+    int p;
+    char buf[15];
+    wxString s;
+
+    // Vertical gridlines
+    pDC.SetPen(m_penShortDash);
+    for(p = (PLOT_BORDER + XLEFT_OFFSET + GRID_INCREMENT); p < ((m_rGrid.GetWidth() - XLEFT_OFFSET) + GRID_INCREMENT); p += GRID_INCREMENT)
+    {
+        pDC.DrawLine(p, (m_rGrid.GetHeight() + PLOT_BORDER), p, PLOT_BORDER);
+    }
+    // Horizontal gridlines
+    pDC.SetPen(m_penDotDash);
+    for(p = (m_rGrid.GetHeight() - GRID_INCREMENT); p > PLOT_BORDER; p -= GRID_INCREMENT)
+    {
+        pDC.DrawLine(PLOT_BORDER + XLEFT_OFFSET, (p + PLOT_BORDER), (m_rGrid.GetWidth() + PLOT_BORDER + XLEFT_OFFSET), (p + PLOT_BORDER));
+    }
+    // Label the X-Axis
+    pDC.SetPen(wxPen(GREY_COLOR, 1));
+    for(p = GRID_INCREMENT; p < (m_rGrid.GetWidth() - YBOTTOM_OFFSET); p += GRID_INCREMENT)
+    {
+        sprintf(buf, "%1.1f Hz",(double)(p / 10));
+        pDC.DrawText(buf, p - PLOT_BORDER + XLEFT_OFFSET, m_rGrid.GetHeight() + YBOTTOM_OFFSET/2);
+    }
+    // Label the Y-Axis
+    //for(p = GRID_INCREMENT; p < (h - YBOTTOM_OFFSET); p += GRID_INCREMENT)
+    for(p = (m_rGrid.GetHeight() - GRID_INCREMENT); p > PLOT_BORDER; p -= GRID_INCREMENT)
+    {
+        sprintf(buf, "%1.0f", (double)((m_rGrid.GetHeight() - p) * -10));
+        pDC.DrawText(buf, XLEFT_TEXT_OFFSET, p);
+    }
+}
+
+//-------------------------------------------------------------------------
+// paintEvent()
+//
+// Called by the system of by wxWidgets when the panel needs
+// to be redrawn. You can also trigger this call by calling
+// Refresh()/Update().
+//-------------------------------------------------------------------------
+void PlotPanel::OnPaint(wxPaintEvent & evt)
+{
+    wxAutoBufferedPaintDC pdc(this);
+    draw(pdc);
+}
+
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot.h
new file mode 100644 (file)
index 0000000..25309d3
--- /dev/null
@@ -0,0 +1,150 @@
+//==========================================================================
+// Name:            fdmdv2_plot.h
+// Purpose:         Declares simple wxWidgets application with GUI
+// Created:         Apr. 10, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+//#include "fdmdv2_main.h"
+#ifndef __FDMDV2_PLOT__
+#define __FDMDV2_PLOT__
+#include <wx/wx.h>
+#include <wx/aui/auibook.h>
+#include <wx/rawbmp.h>
+#include <wx/image.h>
+#include <wx/dcbuffer.h>
+
+#define MAX_ZOOM            7
+#define MAX_BMP_X           (400 * MAX_ZOOM)
+#define MAX_BMP_Y           (400 * MAX_ZOOM)
+#define DATA_LINE_HEIGHT    10
+#define TEXT_BASELINE_OFFSET_Y  -5
+
+
+#define wxUSE_FILEDLG       1
+#define wxUSE_LIBPNG        1
+#define wxUSE_LIBJPEG       1
+#define wxUSE_GIF           1
+#define wxUSE_PCX           1
+#define wxUSE_LIBTIFF       1
+
+#define PLOT_BORDER         12
+#define XLEFT_OFFSET        40
+#define XLEFT_TEXT_OFFSET   6
+#define YBOTTOM_OFFSET      20
+#define YBOTTOM_TEXT_OFFSET 15
+#define GRID_INCREMENT      50
+
+#define BLACK_COLOR         wxColor(0x00, 0x00, 0x00)
+#define GREY_COLOR          wxColor(0x80, 0x80, 0x80)
+#define DARK_GREY_COLOR     wxColor(0x40, 0x40, 0x40)
+#define MEDIUM_GREY_COLOR   wxColor(0xC0, 0xC0, 0xC0)
+#define LIGHT_GREY_COLOR    wxColor(0xE0, 0xE0, 0xE0)
+#define VERY_LTGREY_COLOR   wxColor(0xF8, 0xF8, 0xF8)
+#define WHITE_COLOR         wxColor(0xFF, 0xFF, 0xFF)
+
+#define DARK_BLUE_COLOR     wxColor(0x00, 0x00, 0x60)
+#define BLUE_COLOR          wxColor(0x00, 0x00, 0xFF)
+#define LIGHT_BLUE_COLOR    wxColor(0x80, 0x80, 0xFF)
+
+#define RED_COLOR           wxColor(0xFF, 0x5E, 0x5E)
+#define LIGHT_RED_COLOR     wxColor(0xFF, 0xE0, 0xE0)
+#define DARK_RED_COLOR      wxColor(0xFF, 0x00, 0x00)
+#define PINK_COLOR          wxColor(0xFF, 0x80, 0xFF)
+
+#define LIGHT_GREEN_COLOR   wxColor(0xE3, 0xFF, 0xE0)
+#define GREEN_COLOR         wxColor(0x95, 0xFF, 0x8A)
+#define DARK_GREEN_COLOR    wxColor(0x20, 0xFF, 0x08)
+#define VERY_GREEN_COLOR    wxColor(0x00, 0xFF, 0x00)
+
+#define YELLOW_COLOR        wxColor(0xFF, 0xFF, 0x5E)
+#define LIGHT_YELLOW_COLOR  wxColor(0xFF, 0xFF, 0xB5)
+#define DARK_YELLOW_COLOR   wxColor(0xFF, 0xFF, 0x08)
+
+class MainFrame;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlotPanel
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class PlotPanel : public wxPanel
+{
+    public:
+        PlotPanel(wxFrame* parent);
+        ~PlotPanel();
+        wxPen               m_penShortDash;
+        wxPen               m_penDotDash;
+        wxPen               m_penSolid;
+        wxRect              m_rCtrlPrev;
+        wxRect              m_rCtrl;
+        wxRect              m_rGrid;
+        wxRect              m_rPlot;
+        MainFrame           *m_pTopFrame;
+        wxAuiNotebook       *m_pNoteBook;
+        double              m_label_size;
+        wxSize              m_Bufsz;
+        bool                m_newdata;
+        wxImage             m_oImage;
+        wxBitmap            *m_pBmp;
+        wxNativePixelData   *m_pPix;
+
+        // some useful events
+        void            OnMouseMove(wxMouseEvent& event);
+        virtual void    OnMouseLeftDown(wxMouseEvent& event);
+        void            OnMouseLeftUp(wxMouseEvent& event);
+        virtual void    OnMouseRightDown(wxMouseEvent& event);
+        void            OnMouseWheelMoved(wxMouseEvent& event);
+        void            OnClose(wxCloseEvent& event ){ event.Skip(); }
+        void            OnSize( wxSizeEvent& event );
+        void            OnErase(wxEraseEvent& event);
+        void            OnPaint(wxPaintEvent& event);
+        //void OnUpdateUI( wxUpdateUIEvent& event ){ event.Skip(); }
+
+        void            paintEvent(wxPaintEvent & evt);
+        virtual void    draw(wxAutoBufferedPaintDC&  pdc);
+        virtual void    drawGraticule(wxAutoBufferedPaintDC&  pdc);
+        virtual double  SetZoomFactor(double zf);
+        virtual double  GetZoomFactor(double zf);
+        virtual void    OnShow(wxShowEvent& event);
+        virtual double  GetLabelSize();
+        virtual void    SetLabelSize(double size);
+
+    protected:
+        int             m_x;
+        int             m_y;
+        int             m_left;
+        int             m_top;
+        int             m_prev_w;
+        int             m_prev_h;
+        int             m_prev_x;
+        int             m_prev_y;
+        bool            m_use_bitmap;
+        bool            m_clip;
+        bool            m_rubberBand;
+        bool            m_mouseDown;
+        bool            m_firstPass;
+        double          m_zoomFactor;
+        int             m_greyscale;
+        int             m_line_color;
+    DECLARE_EVENT_TABLE()
+};
+#endif //__FDMDV2_PLOT__
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scalar.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scalar.cpp
new file mode 100644 (file)
index 0000000..7a07f46
--- /dev/null
@@ -0,0 +1,281 @@
+//==========================================================================
+// Name:            fdmdv2_plot_scalar.cpp
+// Purpose:         Plots scalar amplitude against time
+// Created:         June 22, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <string.h>
+#include "wx/wx.h"
+#include "fdmdv2_main.h"
+#include "fdmdv2_plot_scalar.h"
+
+BEGIN_EVENT_TABLE(PlotScalar, PlotPanel)
+    EVT_PAINT           (PlotScalar::OnPaint)
+    EVT_MOTION          (PlotScalar::OnMouseMove)
+    EVT_MOUSEWHEEL      (PlotScalar::OnMouseWheelMoved)
+    EVT_SIZE            (PlotScalar::OnSize)
+    EVT_SHOW            (PlotScalar::OnShow)
+//    EVT_ERASE_BACKGROUND(PlotScalar::OnErase)
+END_EVENT_TABLE()
+
+//----------------------------------------------------------------
+// PlotScalar()
+//----------------------------------------------------------------
+PlotScalar::PlotScalar(wxFrame* parent, 
+                       int    channels,           // number on channels to plot
+                      float  t_secs,             // time covered by entire x axis in seconds
+                      float  sample_period_secs, // time between each sample in seconds
+                      float  a_min,              // min ampltude of samples being plotted
+                      float  a_max,              // max ampltude of samples being plotted
+                      float  graticule_t_step,   // time step of x (time) axis graticule in seconds
+                      float  graticule_a_step,   // step of amplitude axis graticule
+                      const char a_fmt[],        // printf format string for amplitude axis labels
+                       int    mini                // true for mini-plot - don't draw graticule
+                      ): PlotPanel(parent)
+{
+    int i;
+
+    m_rCtrl = GetClientRect();
+
+    m_channels = channels;
+    m_t_secs = t_secs;
+    m_sample_period_secs = sample_period_secs;
+    m_a_min = a_min;
+    m_a_max = a_max;
+    m_graticule_t_step = graticule_t_step;
+    m_graticule_a_step = graticule_a_step;
+    assert(strlen(a_fmt) < 15);
+    strcpy(m_a_fmt, a_fmt);
+    m_mini = mini;
+
+    // work out number of samples we will store and allocate storage
+
+    m_samples = m_t_secs/m_sample_period_secs;
+    m_mem = new float[m_samples*m_channels];
+
+    for(i = 0; i < m_samples*m_channels; i++)
+    {
+        m_mem[i] = 0.0;
+    }
+}
+
+//----------------------------------------------------------------
+// ~PlotScalar()
+//----------------------------------------------------------------
+PlotScalar::~PlotScalar()
+{
+    delete m_mem;
+}
+
+//----------------------------------------------------------------
+// add_new_sample()
+//----------------------------------------------------------------
+void PlotScalar::add_new_sample(int channel, float sample)
+{
+    int i;
+    int offset = channel*m_samples;
+
+    assert(channel < m_channels);
+
+    for(i = 0; i < m_samples-1; i++)
+    {
+        m_mem[offset+i] = m_mem[offset+i+1];
+    }
+    m_mem[offset+m_samples-1] = sample;
+}
+
+//----------------------------------------------------------------
+// add_new_samples()
+//----------------------------------------------------------------
+void  PlotScalar::add_new_short_samples(int channel, short samples[], int length, float scale_factor)
+{
+    int i;
+    int offset = channel*m_samples;
+
+    assert(channel < m_channels);
+
+    for(i = 0; i < m_samples-length; i++)
+        m_mem[offset+i] = m_mem[offset+i+length];
+    for(; i < m_samples; i++)
+       m_mem[offset+i] = (float)*samples++/scale_factor;
+}
+
+//----------------------------------------------------------------
+// draw()
+//----------------------------------------------------------------
+void PlotScalar::draw(wxAutoBufferedPaintDC&  dc)
+{
+    float index_to_px;
+    float a_to_py;
+    int   i;
+    int   x, y;
+    int   prev_x, prev_y;
+    float a;
+
+    m_rCtrl = GetClientRect();
+    m_rGrid = m_rCtrl;
+    if (!m_mini)
+        m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2)));
+
+    //printf("h %d w %d\n", m_rCtrl.GetWidth(), m_rCtrl.GetHeight());
+    //printf("h %d w %d\n", m_rGrid.GetWidth(), m_rGrid.GetHeight());
+
+    // black background
+
+    dc.Clear();
+    if (m_mini)
+        m_rPlot = wxRect(0, 0, m_rGrid.GetWidth(), m_rGrid.GetHeight());        
+    else
+        m_rPlot = wxRect(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_rGrid.GetWidth(), m_rGrid.GetHeight());
+   
+    wxBrush ltGraphBkgBrush = wxBrush(BLACK_COLOR);
+    dc.SetBrush(ltGraphBkgBrush);
+    dc.SetPen(wxPen(BLACK_COLOR, 0));
+    dc.DrawRectangle(m_rPlot);
+
+    index_to_px = (float)m_rGrid.GetWidth()/m_samples;
+    a_to_py = (float)m_rGrid.GetHeight()/(m_a_max - m_a_min);
+
+    wxPen pen;
+    pen.SetColour(DARK_GREEN_COLOR);
+    pen.SetWidth(1);
+    dc.SetPen(pen);
+
+    // draw all samples
+
+    prev_x = prev_y = 0; // stop warning
+
+    // plot each channel 
+
+    int offset;
+    for(offset=0; offset<m_channels*m_samples; offset+=m_samples) {
+
+        for(i = 0; i < m_samples; i++) {
+            x = index_to_px * i;
+            a = m_mem[offset+i];
+            if (a < m_a_min) a = m_a_min;
+            if (a > m_a_max) a = m_a_max;
+
+            // invert y axis and offset by minimum
+
+            y = m_rGrid.GetHeight() - a_to_py * a + m_a_min*a_to_py;
+
+            // put inside plot window
+
+            if (!m_mini) {
+                x += PLOT_BORDER + XLEFT_OFFSET;
+                y += PLOT_BORDER;
+            }
+
+            if (i)
+                dc.DrawLine(x, y, prev_x, prev_y);
+            prev_x = x; prev_y = y;
+        }
+    }
+
+    drawGraticule(dc);
+}
+
+//-------------------------------------------------------------------------
+// drawGraticule()
+//-------------------------------------------------------------------------
+void PlotScalar::drawGraticule(wxAutoBufferedPaintDC&  dc)
+{
+    float    t, a;
+    int      x, y, text_w, text_h;
+    char     buf[15];
+    wxString s;
+    float    sec_to_px;
+    float    a_to_py;
+
+    wxBrush ltGraphBkgBrush;
+    ltGraphBkgBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT);
+    ltGraphBkgBrush.SetColour(*wxBLACK);
+    dc.SetBrush(ltGraphBkgBrush);
+    dc.SetPen(wxPen(BLACK_COLOR, 1));
+
+    sec_to_px = (float)m_rGrid.GetWidth()/m_t_secs;
+    a_to_py = (float)m_rGrid.GetHeight()/(m_a_max - m_a_min);
+
+    // upper LH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER)
+    // lower RH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET + m_rGrid.GetWidth(), 
+    //                                   PLOT_BORDER + m_rGrid.GetHeight())
+
+    // Vertical gridlines
+
+    dc.SetPen(m_penShortDash);
+    for(t=0; t<=m_t_secs; t+=m_graticule_t_step) {
+       x = t*sec_to_px;
+       if (m_mini) {
+            dc.DrawLine(x, m_rGrid.GetHeight(), x, 0);
+        }
+        else {
+            x += PLOT_BORDER + XLEFT_OFFSET;
+            dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, PLOT_BORDER);
+        }
+        if (!m_mini) {
+            sprintf(buf, "%2.1fs", t);
+            GetTextExtent(buf, &text_w, &text_h);
+            dc.DrawText(buf, x - text_w/2, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET);
+        }
+    }
+
+    // Horizontal gridlines
+
+    dc.SetPen(m_penDotDash);
+    for(a=m_a_min; a<m_a_max; a+=m_graticule_a_step) {
+       y = m_rGrid.GetHeight() - a*a_to_py + m_a_min*a_to_py;
+       if (m_mini) {
+            dc.DrawLine(0, y, m_rGrid.GetWidth(), y);
+        }
+        else {
+            y += PLOT_BORDER;
+            dc.DrawLine(PLOT_BORDER + XLEFT_OFFSET, y, 
+                        (m_rGrid.GetWidth() + PLOT_BORDER + XLEFT_OFFSET), y);
+        }
+        if (!m_mini) {
+            sprintf(buf, m_a_fmt, a);
+            GetTextExtent(buf, &text_w, &text_h);
+            dc.DrawText(buf, PLOT_BORDER + XLEFT_OFFSET - text_w - XLEFT_TEXT_OFFSET, y-text_h/2);
+        }
+   }
+
+
+}
+
+//----------------------------------------------------------------
+// OnPaint()
+//----------------------------------------------------------------
+void PlotScalar::OnPaint(wxPaintEvent& event)
+{
+    wxAutoBufferedPaintDC dc(this);
+    draw(dc);
+}
+
+//----------------------------------------------------------------
+// OnSize()
+//----------------------------------------------------------------
+void PlotScalar::OnSize(wxSizeEvent& event)
+{
+}
+
+//----------------------------------------------------------------
+// OnShow()
+//----------------------------------------------------------------
+void PlotScalar::OnShow(wxShowEvent& event)
+{
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scalar.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scalar.h
new file mode 100644 (file)
index 0000000..7043987
--- /dev/null
@@ -0,0 +1,73 @@
+//==========================================================================
+// Name:            fdmdv2_plot_scalar.h
+// Purpose:         Defines a scalar plot derivative of fdmdv2_plot.
+// Created:         June 22, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __FDMDV2_PLOT_SCALAR__
+#define __FDMDV2_PLOT_SCALAR__
+
+#include "fdmdv2_plot.h"
+#include "fdmdv2_defines.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlotScalar
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class PlotScalar: public PlotPanel
+{
+    public:
+
+    PlotScalar(wxFrame* parent,
+               int   channels,
+              float t_secs, 
+              float sample_period_secs,
+              float a_min,
+              float a_max,
+              float graticule_t_step,   
+              float graticule_a_step,
+              const char  a_fmt[],
+               int   mini
+              );
+        ~PlotScalar();
+         void add_new_sample(int channel, float sample);
+         void add_new_short_samples(int channel, short samples[], int length, float scale_factor);
+
+    protected:
+
+         int      m_channels;
+        float    m_t_secs;
+        float    m_sample_period_secs;
+        float    m_a_min;
+        float    m_a_max;
+        float    m_graticule_t_step;   
+        float    m_graticule_a_step;
+        char     m_a_fmt[15];
+         int      m_mini;
+        int      m_samples;
+        float   *m_mem;              
+
+        void draw(wxAutoBufferedPaintDC&  dc);
+       void drawGraticule(wxAutoBufferedPaintDC&  dc);
+        void OnPaint(wxPaintEvent& event);
+        void OnSize(wxSizeEvent& event);
+        void OnShow(wxShowEvent& event);
+
+        DECLARE_EVENT_TABLE()
+};
+
+#endif // __FDMDV2_PLOT_SCALAR__
+
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scatter.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scatter.cpp
new file mode 100644 (file)
index 0000000..3c0b155
--- /dev/null
@@ -0,0 +1,199 @@
+//==========================================================================
+// Name:            fdmdv2_plot_scatter.cpp
+// Purpose:         A scatter plot derivative of fdmdv2_plot.
+// Created:         June 24, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <string.h>
+#include "wx/wx.h"
+#include "fdmdv2_plot_scatter.h"
+
+BEGIN_EVENT_TABLE(PlotScatter, PlotPanel)
+    EVT_PAINT           (PlotScatter::OnPaint)
+    EVT_MOTION          (PlotScatter::OnMouseMove)
+    EVT_MOUSEWHEEL      (PlotScatter::OnMouseWheelMoved)
+    EVT_SIZE            (PlotScatter::OnSize)
+    EVT_SHOW            (PlotScatter::OnShow)
+//    EVT_ERASE_BACKGROUND(PlotScatter::OnErase)
+END_EVENT_TABLE()
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// PlotScatter
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PlotScatter::PlotScatter(wxFrame* parent) : PlotPanel(parent)
+{
+    int i;
+
+    for(i=0; i < SCATTER_MEM_SYMS_MAX; i++)
+    {
+        m_mem[i].real = 0.0;
+        m_mem[i].imag = 0.0;
+    }
+
+    m_filter_max_xy = 0.1;
+
+    // defaults so we start off with something sensible
+
+    Nsym = 14+1;
+    scatterMemSyms = ((int)(SCATTER_MEM_SECS*(Nsym/DT)));
+    assert(scatterMemSyms <= SCATTER_MEM_SYMS_MAX);
+        
+}
+
+// changing number of carriers changes number of symbols to plot
+void PlotScatter::setNc(int Nc) {
+    Nsym = Nc+1;
+    assert(Nsym <= (FDMDV_NC_MAX+1));
+    scatterMemSyms = ((int)(SCATTER_MEM_SECS*(Nsym/DT)));
+    assert(scatterMemSyms <= SCATTER_MEM_SYMS_MAX);
+}
+
+//----------------------------------------------------------------
+// draw()
+//----------------------------------------------------------------
+void PlotScatter::draw(wxAutoBufferedPaintDC& dc)
+{
+    float x_scale;
+    float y_scale;
+    int   i;
+    int   x;
+    int   y;
+    wxColour sym_to_colour[] = {wxColor(0,0,255), 
+                                wxColor(0,255,0),
+                                wxColor(0,255,255),
+                                wxColor(255,0,0),
+                                wxColor(255,0,255), 
+                                wxColor(255,255,0),
+                                wxColor(255,255,255),
+                                wxColor(0,0,255), 
+                                wxColor(0,255,0),
+                                wxColor(0,255,255),
+                                wxColor(255,0,0),
+                                wxColor(255,0,255), 
+                                wxColor(255,255,0),
+                                wxColor(255,255,255),
+                                wxColor(0,0,255), 
+                                wxColor(0,255,0),
+                                wxColor(0,255,255),
+                                wxColor(255,0,0),
+                                wxColor(255,0,255)
+    };
+
+    m_rCtrl = GetClientRect();
+    m_rGrid = m_rCtrl;
+    m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2)));
+
+    // black background
+
+    dc.Clear();
+    m_rPlot = wxRect(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_rGrid.GetWidth(), m_rGrid.GetHeight());
+    wxBrush ltGraphBkgBrush = wxBrush(BLACK_COLOR);
+    dc.SetBrush(ltGraphBkgBrush);
+    dc.SetPen(wxPen(BLACK_COLOR, 0));
+    dc.DrawRectangle(m_rPlot);
+    wxPen pen;
+    pen.SetWidth(1); // note this is ignored by DrawPoint
+
+    // automatically scale, first measure the maximum value
+
+    float max_xy = 1E-12;
+    float real,imag;
+    for(i=0; i< scatterMemSyms; i++) {
+        real = fabs(m_mem[i].real);
+        imag = fabs(m_mem[i].imag);
+        if (real > max_xy)
+            max_xy = real;
+        if (imag > max_xy)
+            max_xy = imag;
+    }
+
+    // smooth it out and set a lower limit to prevent didev by 0 issues
+
+    m_filter_max_xy = BETA*m_filter_max_xy + (1 - BETA)*2.5*max_xy;
+    if (m_filter_max_xy < 0.001)
+        m_filter_max_xy = 0.001;
+
+    // quantise to log steps to prevent scatter scaling bobbing about too
+    // much as scaling varies
+
+    float quant_m_filter_max_xy = exp(floor(0.5+log(m_filter_max_xy)));
+    //printf("max_xy: %f m_filter_max_xy: %f quant_m_filter_max_xy: %f\n", max_xy, m_filter_max_xy, quant_m_filter_max_xy);
+
+    x_scale = (float)m_rGrid.GetWidth()/quant_m_filter_max_xy;
+    y_scale = (float)m_rGrid.GetHeight()/quant_m_filter_max_xy;
+
+    // draw all samples
+
+    for(i = 0; i < scatterMemSyms; i++)
+    {
+        x = x_scale * m_mem[i].real + m_rGrid.GetWidth()/2;
+        y = y_scale * m_mem[i].imag + m_rGrid.GetHeight()/2;
+       x += PLOT_BORDER + XLEFT_OFFSET;
+       y += PLOT_BORDER;
+        pen.SetColour(sym_to_colour[i%Nsym]);
+        dc.SetPen(pen);
+       dc.DrawPoint(x, y);
+    }
+}
+
+//----------------------------------------------------------------
+// add_new_samples()
+//----------------------------------------------------------------
+void PlotScatter::add_new_samples(COMP samples[])
+{
+    int i,j;
+
+    // shift memory
+
+    for(i = 0; i < scatterMemSyms - Nsym; i++)
+    {
+        m_mem[i] = m_mem[i+Nsym];
+    }
+
+    // new samples
+
+    for(j=0; i < scatterMemSyms; i++,j++)
+    {
+        m_mem[i] = samples[j];
+    }
+}
+
+//----------------------------------------------------------------
+// OnPaint()
+//----------------------------------------------------------------
+void PlotScatter::OnPaint(wxPaintEvent& event)
+{
+    wxAutoBufferedPaintDC dc(this);
+    draw(dc);
+}
+
+//----------------------------------------------------------------
+// OnSize()
+//----------------------------------------------------------------
+void PlotScatter::OnSize(wxSizeEvent& event)
+{
+    // todo: clear screen
+}
+
+//----------------------------------------------------------------
+// OnShow()
+//----------------------------------------------------------------
+void PlotScatter::OnShow(wxShowEvent& event)
+{
+}
+
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scatter.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_scatter.h
new file mode 100644 (file)
index 0000000..702f633
--- /dev/null
@@ -0,0 +1,56 @@
+//==========================================================================
+// Name:            fdmdv2_plot_scatter.h
+// Purpose:         A scatter plot derivative of fdmdv2_plot.
+// Created:         June 24, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __FDMDV2_PLOT_SCATTER__
+#define __FDMDV2_PLOT_SCATTER__
+
+#include "comp.h"
+#include "fdmdv2_plot.h"
+#include "fdmdv2_defines.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlotScatter
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class PlotScatter : public PlotPanel
+{
+    public:
+        PlotScatter(wxFrame* parent);
+        ~PlotScatter(){};
+       void add_new_samples(COMP samples[]);
+       void setNc(int Nc);
+
+    protected:
+        COMP m_mem[SCATTER_MEM_SYMS_MAX];
+        COMP m_new_samples[FDMDV_NC_MAX+1];
+
+        void draw(wxAutoBufferedPaintDC&  dc);
+        void OnPaint(wxPaintEvent& event);
+        void OnSize(wxSizeEvent& event);
+        void OnShow(wxShowEvent& event);
+
+        DECLARE_EVENT_TABLE()
+
+    private:
+        int   Nsym;
+        int   scatterMemSyms;
+        float m_filter_max_xy;
+};
+
+#endif //__FDMDV2_PLOT_SCATTER__
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_spectrum.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_spectrum.cpp
new file mode 100644 (file)
index 0000000..d9c72d0
--- /dev/null
@@ -0,0 +1,266 @@
+//==========================================================================
+// Name:            fdmdv2_plot_waterfall.cpp
+// Purpose:         Implements a waterfall plot derivative of fdmdv2_plot.
+// Created:         June 23, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <string.h>
+#include "wx/wx.h"
+
+#include "fdmdv2_main.h"
+
+extern float g_avmag[];                 // average mag data passed to draw() 
+void fdmdv2_clickTune(float frequency); // callback to pass new click freq
+
+BEGIN_EVENT_TABLE(PlotSpectrum, PlotPanel)
+    EVT_MOTION          (PlotSpectrum::OnMouseMove)
+    EVT_LEFT_DOWN       (PlotSpectrum::OnMouseLeftDown)
+    EVT_LEFT_UP         (PlotSpectrum::OnMouseLeftUp)
+    EVT_MOUSEWHEEL      (PlotSpectrum::OnMouseWheelMoved)
+    EVT_PAINT           (PlotSpectrum::OnPaint)
+    EVT_SHOW            (PlotSpectrum::OnShow)
+END_EVENT_TABLE()
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlotSpectrum
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PlotSpectrum::PlotSpectrum(wxFrame* parent, float *magdB, int n_magdB, 
+                           float min_mag_db, float max_mag_db, bool clickTune): PlotPanel(parent)
+{
+    m_greyscale     = 0;
+    m_Bufsz         = GetMaxClientSize();
+    m_newdata       = false;
+    m_firstPass     = true;
+    m_line_color    = 0;
+    SetLabelSize(10.0);
+
+    m_magdB         = magdB;
+    m_n_magdB       = n_magdB;     // number of points in magdB that covers 0 ... MAX_F_HZ of spectrum
+    m_max_mag_db    = max_mag_db;
+    m_min_mag_db    = min_mag_db;
+    m_rxFreq        = 0.0;
+    m_clickTune     = clickTune;
+}
+
+//----------------------------------------------------------------
+// ~PlotSpectrum()
+//----------------------------------------------------------------
+PlotSpectrum::~PlotSpectrum()
+{
+}
+
+//----------------------------------------------------------------
+// OnSize()
+//----------------------------------------------------------------
+void PlotSpectrum::OnSize(wxSizeEvent& event) {
+}
+
+//----------------------------------------------------------------
+// OnPaint()
+//----------------------------------------------------------------
+void PlotSpectrum::OnPaint(wxPaintEvent& event)
+{
+    wxAutoBufferedPaintDC dc(this);
+    draw(dc);
+}
+
+//----------------------------------------------------------------
+// OnShow()
+//----------------------------------------------------------------
+void PlotSpectrum::OnShow(wxShowEvent& event)
+{
+}
+
+//----------------------------------------------------------------
+// draw()
+//----------------------------------------------------------------
+void PlotSpectrum::draw(wxAutoBufferedPaintDC& dc)
+{
+    m_rCtrl  = GetClientRect();
+
+    // m_rGrid is coords of inner window we actually plot to.  We deflate it a bit
+    // to leave room for axis labels.  We need to work this out every time we draw
+    // as OnSize() may not be called before OnPaint(), for example when a new tab
+    // is selected
+
+    m_rGrid  = m_rCtrl;
+    m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2)));
+
+    dc.Clear();
+
+    // black background
+
+    m_rPlot = wxRect(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_rGrid.GetWidth(), m_rGrid.GetHeight());
+    wxBrush ltGraphBkgBrush = wxBrush(BLACK_COLOR);
+    dc.SetBrush(ltGraphBkgBrush);
+    dc.SetPen(wxPen(BLACK_COLOR, 0));
+    dc.DrawRectangle(m_rPlot);
+
+    // draw spectrum
+
+    int   x, y, prev_x, prev_y, index;
+    float index_to_px, mag_dB_to_py, mag;
+
+    m_newdata = false;
+
+    wxPen pen;
+    pen.SetColour(DARK_GREEN_COLOR);
+    pen.SetWidth(1);
+    dc.SetPen(pen);
+
+    index_to_px = (float)m_rGrid.GetWidth()/m_n_magdB;
+    mag_dB_to_py = (float)m_rGrid.GetHeight()/(m_max_mag_db - m_min_mag_db);
+
+    prev_x = PLOT_BORDER + XLEFT_OFFSET;
+    prev_y = PLOT_BORDER;
+    for(index = 0; index < m_n_magdB; index++)
+    {
+        x = index*index_to_px;
+        mag = m_magdB[index];
+        if (mag > m_max_mag_db) mag = m_max_mag_db;
+        if (mag < m_min_mag_db) mag = m_min_mag_db;
+        y = -(mag - m_max_mag_db) * mag_dB_to_py;
+
+        x += PLOT_BORDER + XLEFT_OFFSET;
+        y += PLOT_BORDER;
+
+        if (index)
+            dc.DrawLine(x, y, prev_x, prev_y);
+        prev_x = x; prev_y = y;
+    }
+
+    // and finally draw Graticule
+
+    drawGraticule(dc);
+
+}
+
+//-------------------------------------------------------------------------
+// drawGraticule()
+//-------------------------------------------------------------------------
+void PlotSpectrum::drawGraticule(wxAutoBufferedPaintDC&  dc)
+{
+    int      x, y, text_w, text_h;
+    char     buf[15];
+    wxString s;
+    float    f, mag, freq_hz_to_px, mag_dB_to_py;
+
+    wxBrush ltGraphBkgBrush;
+    ltGraphBkgBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT);
+    ltGraphBkgBrush.SetColour(*wxBLACK);
+    dc.SetBrush(ltGraphBkgBrush);
+    dc.SetPen(wxPen(BLACK_COLOR, 1));
+
+    freq_hz_to_px = (float)m_rGrid.GetWidth()/(MAX_F_HZ-MIN_F_HZ);
+    mag_dB_to_py = (float)m_rGrid.GetHeight()/(m_max_mag_db - m_min_mag_db);
+
+    // upper LH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER)
+    // lower RH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET + m_rGrid.GetWidth(), 
+    //                                   PLOT_BORDER + m_rGrid.GetHeight())
+
+    // Check if small screen size means text will overlap
+
+    int textXStep = STEP_F_HZ*freq_hz_to_px;
+    int textYStep = STEP_MAG_DB*mag_dB_to_py;
+    sprintf(buf, "%4.0fHz", (float)MAX_F_HZ - STEP_F_HZ);
+    GetTextExtent(buf, &text_w, &text_h);
+    int overlappedText = (text_w > textXStep) || (text_h > textYStep);
+    //printf("text_w: %d textXStep: %d text_h: %d textYStep: %d  overlappedText: %d\n", text_w, textXStep, 
+    //      text_h, textYStep, overlappedText);
+
+    // Vertical gridlines
+
+    for(f=STEP_F_HZ; f<MAX_F_HZ; f+=STEP_F_HZ) {
+       x = f*freq_hz_to_px;
+       x += PLOT_BORDER + XLEFT_OFFSET;
+
+        dc.SetPen(m_penShortDash);
+        dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, PLOT_BORDER);
+        dc.SetPen(wxPen(BLACK_COLOR, 1));
+        dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET);
+
+        sprintf(buf, "%4.0fHz", f);
+       GetTextExtent(buf, &text_w, &text_h);
+        if (!overlappedText)
+            dc.DrawText(buf, x - text_w/2, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET);
+    }
+
+    dc.SetPen(wxPen(BLACK_COLOR, 1));
+    for(f=STEP_MINOR_F_HZ; f<MAX_F_HZ; f+=STEP_MINOR_F_HZ) 
+    {
+        x = f*freq_hz_to_px;
+        x += PLOT_BORDER + XLEFT_OFFSET;
+        dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET-5);
+    }
+    
+    // Horizontal gridlines
+
+    dc.SetPen(m_penDotDash);
+    for(mag=m_min_mag_db; mag<=m_max_mag_db; mag+=STEP_MAG_DB) {
+       y = -(mag - m_max_mag_db) * mag_dB_to_py;
+       y += PLOT_BORDER;
+       dc.DrawLine(PLOT_BORDER + XLEFT_OFFSET, y, 
+                   (m_rGrid.GetWidth() + PLOT_BORDER + XLEFT_OFFSET), y);
+        sprintf(buf, "%3.0fdB", mag);
+       GetTextExtent(buf, &text_w, &text_h);
+        if (!overlappedText)
+            dc.DrawText(buf, PLOT_BORDER + XLEFT_OFFSET - text_w - XLEFT_TEXT_OFFSET, y-text_h/2);
+    }
+
+    // red rx tuning line
+    
+    if (m_rxFreq != 0.0) {
+        dc.SetPen(wxPen(RED_COLOR, 2));
+        x = m_rxFreq*freq_hz_to_px;
+        x += PLOT_BORDER + XLEFT_OFFSET;
+        //printf("m_rxFreq %f x %d\n", m_rxFreq, x);
+        dc.DrawLine(x, m_rGrid.GetHeight()+ PLOT_BORDER, x, m_rCtrl.GetHeight());
+    }
+
+}
+
+//-------------------------------------------------------------------------
+// OnMouseDown()
+//-------------------------------------------------------------------------
+void PlotSpectrum::OnMouseLeftDown(wxMouseEvent& event)
+{
+    m_mouseDown = true;
+    wxClientDC dc(this);
+
+    wxPoint pt(event.GetLogicalPosition(dc));
+
+    // map x coord to edges of actual plot
+    pt.x -= PLOT_BORDER + XLEFT_OFFSET;
+    pt.y -= PLOT_BORDER;
+
+    // valid click if inside of plot
+    if ((pt.x >= 0) && (pt.x <= m_rGrid.GetWidth()) && (pt.y >=0) && m_clickTune) {
+        float freq_hz_to_px = (float)m_rGrid.GetWidth()/(MAX_F_HZ-MIN_F_HZ);
+        float clickFreq = (float)pt.x/freq_hz_to_px;
+
+        // see PlotWaterfall::OnMouseDown()
+
+        fdmdv2_clickTune(clickFreq);
+    }
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_spectrum.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_spectrum.h
new file mode 100644 (file)
index 0000000..353f312
--- /dev/null
@@ -0,0 +1,58 @@
+//==========================================================================
+// Name:            fdmdv2_plot_spectrum.h
+// Purpose:         Defines a spectrum plot derived from fdmdv2_plot class.
+// Created:         June 22, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __FDMDV2_PLOT_SPECTRUM__
+#define __FDMDV2_PLOT_SPECTRUM__
+
+#include "fdmdv2_plot.h"
+#include "fdmdv2_defines.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class Waterfall
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class PlotSpectrum : public PlotPanel
+{
+    public:
+    PlotSpectrum(wxFrame* parent, float *magdB, int n_magdB, 
+                 float min_mag_db=MIN_MAG_DB, float max_mag_db=MAX_MAG_DB, bool clickTune=true);
+        ~PlotSpectrum();
+        void setRxFreq(float rxFreq) { m_rxFreq = rxFreq; }
+        void setFreqScale(int n_magdB) { m_n_magdB = n_magdB; }
+
+    protected:
+        void        OnPaint(wxPaintEvent& event);
+        void        OnSize(wxSizeEvent& event);
+        void        OnShow(wxShowEvent& event);
+        void        drawGraticule(wxAutoBufferedPaintDC& dc);
+        void        draw(wxAutoBufferedPaintDC& dc);
+        void        OnMouseLeftDown(wxMouseEvent& event);
+
+   private:
+        float       m_rxFreq;
+        float       m_max_mag_db;
+        float       m_min_mag_db;
+        float      *m_magdB;
+        int         m_n_magdB;  
+        bool        m_clickTune;
+
+        DECLARE_EVENT_TABLE()
+};
+
+#endif //__FDMDV2_PLOT_SPECTRUM__
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_waterfall.cpp b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_waterfall.cpp
new file mode 100644 (file)
index 0000000..4a8b447
--- /dev/null
@@ -0,0 +1,483 @@
+//==========================================================================
+// Name:            fdmdv2_plot_waterfall.cpp
+// Purpose:         Implements a waterfall plot derivative of fdmdv2_plot.
+// Created:         June 22, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <string.h>
+#include "wx/wx.h"
+#include "fdmdv2_main.h"
+
+extern float g_avmag[];                 // av mag spec passed in to draw() 
+void fdmdv2_clickTune(float frequency); // callback to pass new click freq
+
+BEGIN_EVENT_TABLE(PlotWaterfall, PlotPanel)
+    EVT_PAINT           (PlotWaterfall::OnPaint)
+    EVT_MOTION          (PlotWaterfall::OnMouseMove)
+    EVT_LEFT_DOWN       (PlotWaterfall::OnMouseLeftDown)
+    EVT_RIGHT_DOWN      (PlotWaterfall::OnMouseRightDown)
+    EVT_LEFT_UP         (PlotWaterfall::OnMouseLeftUp)
+    EVT_MOUSEWHEEL      (PlotWaterfall::OnMouseWheelMoved)
+    EVT_SIZE            (PlotWaterfall::OnSize)
+    EVT_SHOW            (PlotWaterfall::OnShow)
+END_EVENT_TABLE()
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class WaterfallPlot
+//
+// @class   WaterfallPlot
+// @author  David Witten
+// @date    $(Date)
+// @file    $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+PlotWaterfall::PlotWaterfall(wxFrame* parent, bool graticule, int colour): PlotPanel(parent)
+{
+
+    for(int i = 0; i < 255; i++)
+    {
+        m_heatmap_lut[i] = heatmap((float)i, 0.0, 255.0);
+    }
+    m_graticule     = graticule;
+    m_colour        = colour;
+    m_Bufsz         = GetMaxClientSize();
+    m_newdata       = false;
+    m_firstPass     = true;
+    m_line_color    = 0;
+    m_modem_stats_max_f_hz = MODEM_STATS_MAX_F_HZ;
+
+    SetLabelSize(10.0);
+
+    m_pBmp = NULL;
+    m_max_mag = MAX_MAG_DB;
+    m_min_mag = MIN_MAG_DB;
+}
+
+// When the window size gets set we can work outthe size of the window
+// we plot in and allocate a bit map of the correct size
+void PlotWaterfall::OnSize(wxSizeEvent& event) 
+{
+    // resize bit map
+
+    delete m_pBmp;
+    
+    m_rCtrl  = GetClientRect();
+
+    // m_rGrid is coords of inner window we actually plot to.  We deflate it a bit
+    // to leave room for axis labels.
+
+    m_rGrid  = m_rCtrl;
+    m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2)));
+
+    // we want a bit map the size of m_rGrid
+
+    m_pBmp = new wxBitmap(m_rGrid.GetWidth(), m_rGrid.GetHeight(), 24);
+
+    m_dT = DT;
+}
+
+//----------------------------------------------------------------
+// paintEvent()
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+// Called by the system of by wxWidgets when the panel needs
+// to be redrawn. You can also trigger this call by calling
+// Refresh()/Update().
+//----------------------------------------------------------------
+void PlotWaterfall::OnPaint(wxPaintEvent & evt)
+{
+    wxAutoBufferedPaintDC dc(this);
+    draw(dc);
+}
+
+//----------------------------------------------------------------
+// OnShow()
+//----------------------------------------------------------------
+void PlotWaterfall::OnShow(wxShowEvent& event)
+{
+}
+
+//----------------------------------------------------------------
+// ~PlotWaterfall()
+//----------------------------------------------------------------
+PlotWaterfall::~PlotWaterfall()
+{
+}
+
+//----------------------------------------------------------------
+// heatmap()
+// map val to a rgb colour
+// from http://eddiema.ca/2011/01/21/c-sharp-heatmaps/
+//----------------------------------------------------------------
+unsigned PlotWaterfall::heatmap(float val, float min, float max)
+{
+    unsigned r = 0;
+    unsigned g = 0;
+    unsigned b = 0;
+
+    val = (val - min) / (max - min);
+    if(val <= 0.2)
+    {
+        b = (unsigned)((val / 0.2) * 255);
+    }
+    else if(val >  0.2 &&  val <= 0.7)
+    {
+        b = (unsigned)((1.0 - ((val - 0.2) / 0.5)) * 255);
+    }
+    if(val >= 0.2 &&  val <= 0.6)
+    {
+        g = (unsigned)(((val - 0.2) / 0.4) * 255);
+    }
+    else if(val >  0.6 &&  val <= 0.9)
+    {
+        g = (unsigned)((1.0 - ((val - 0.6) / 0.3)) * 255);
+    }
+    if(val >= 0.5)
+    {
+        r = (unsigned)(((val - 0.5) / 0.5) * 255);
+    }
+    //printf("%f %x %x %x\n", val, r, g, b);
+    return  (b << 16) + (g << 8) + r;
+}
+
+bool PlotWaterfall::checkDT(void)
+{
+    // Check dY is > 1 pixel before proceeding. For small screens
+    // and large WATERFALL_SECS_Y we might have less than one
+    // block per pixel.  In this case increase m_dT and perform draw
+    // less often
+
+    float px_per_sec = (float)m_rGrid.GetHeight() / WATERFALL_SECS_Y;
+    float dy = m_dT * px_per_sec;
+    
+    if (dy < 1.0) {
+        m_dT += DT;
+        return false;
+    }
+    else
+        return true;
+}
+
+//----------------------------------------------------------------
+// draw()
+//----------------------------------------------------------------
+void PlotWaterfall::draw(wxAutoBufferedPaintDC& dc)
+{
+
+    m_rCtrl  = GetClientRect();
+
+    // m_rGrid is coords of inner window we actually plot to.  We deflate it a bit
+    // to leave room for axis labels.
+
+    m_rGrid = m_rCtrl;
+    m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2)));
+
+    if (m_pBmp == NULL) 
+    {
+        // we want a bit map the size of m_rGrid
+        m_pBmp = new wxBitmap(m_rGrid.GetWidth(), m_rGrid.GetHeight(), 24);
+    }
+
+    dc.Clear();
+
+    if(m_newdata)
+    {
+        m_newdata = false;
+        plotPixelData();
+        dc.DrawBitmap(*m_pBmp, PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER);
+        m_dT = DT;
+    }
+    else 
+    {
+
+        // no data to plot so just erase to black.  Blue looks nicer
+        // but is same colour as low amplitude signal
+
+        // Bug on Linux: When Stop is pressed this code doesn't erase
+        // the lower 25% of the Waterfall Window
+
+        m_rPlot = wxRect(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_rGrid.GetWidth(), m_rGrid.GetHeight());
+        wxBrush ltGraphBkgBrush = wxBrush(BLACK_COLOR);
+        dc.SetBrush(ltGraphBkgBrush);
+        dc.SetPen(wxPen(BLACK_COLOR, 0));
+        dc.DrawRectangle(m_rPlot);
+    }
+    drawGraticule(dc);
+}
+
+//-------------------------------------------------------------------------
+// drawGraticule()
+//-------------------------------------------------------------------------
+void PlotWaterfall::drawGraticule(wxAutoBufferedPaintDC& dc)
+{
+    int      x, y, text_w, text_h;
+    char     buf[15];
+    wxString s;
+    float    f, time, freq_hz_to_px, time_s_to_py;
+
+    wxBrush ltGraphBkgBrush;
+    ltGraphBkgBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT);
+    ltGraphBkgBrush.SetColour(*wxBLACK);
+    dc.SetBrush(ltGraphBkgBrush);
+    dc.SetPen(wxPen(BLACK_COLOR, 1));
+
+    freq_hz_to_px = (float)m_rGrid.GetWidth()/(MAX_F_HZ-MIN_F_HZ);
+    time_s_to_py = (float)m_rGrid.GetHeight()/WATERFALL_SECS_Y;
+
+    // upper LH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER)
+    // lower RH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET + m_rGrid.GetWidth(), 
+    //                                   PLOT_BORDER + m_rGrid.GetHeight())
+
+    // Check if small screen size means text will overlap
+
+    int textXStep = STEP_F_HZ*freq_hz_to_px;
+    int textYStep = WATERFALL_SECS_STEP*time_s_to_py;
+    sprintf(buf, "%4.0fHz", (float)MAX_F_HZ - STEP_F_HZ);
+    GetTextExtent(buf, &text_w, &text_h);
+    int overlappedText = (text_w > textXStep) || (text_h > textYStep);
+
+    // Major Vertical gridlines and legend
+    //dc.SetPen(m_penShortDash);
+    for(f=STEP_F_HZ; f<MAX_F_HZ; f+=STEP_F_HZ) 
+    {
+        x = f*freq_hz_to_px;
+        x += PLOT_BORDER + XLEFT_OFFSET;
+
+        if (m_graticule)
+            dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, PLOT_BORDER);
+        else
+            dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET);
+            
+        sprintf(buf, "%4.0fHz", f);
+        GetTextExtent(buf, &text_w, &text_h);
+        if (!overlappedText)
+            dc.DrawText(buf, x - text_w/2, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET);
+    }
+
+    for(f=STEP_MINOR_F_HZ; f<MAX_F_HZ; f+=STEP_MINOR_F_HZ) 
+    {
+        x = f*freq_hz_to_px;
+        x += PLOT_BORDER + XLEFT_OFFSET;
+        dc.DrawLine(x, m_rGrid.GetHeight() + PLOT_BORDER, x, m_rGrid.GetHeight() + PLOT_BORDER + YBOTTOM_TEXT_OFFSET-5);
+    }
+    
+    // Horizontal gridlines
+    dc.SetPen(m_penDotDash);
+    for(time=0; time<=WATERFALL_SECS_Y; time+=WATERFALL_SECS_STEP) {
+       y = m_rGrid.GetHeight() - time*time_s_to_py;
+       y += PLOT_BORDER;
+
+        if (m_graticule)
+            dc.DrawLine(PLOT_BORDER + XLEFT_OFFSET, y, 
+                        (m_rGrid.GetWidth() + PLOT_BORDER + XLEFT_OFFSET), y);
+        sprintf(buf, "%3.0fs", time);
+       GetTextExtent(buf, &text_w, &text_h);
+        if (!overlappedText)
+            dc.DrawText(buf, PLOT_BORDER + XLEFT_OFFSET - text_w - XLEFT_TEXT_OFFSET, y-text_h/2);
+   }
+
+    // red rx tuning line
+    dc.SetPen(wxPen(RED_COLOR, 2));
+    x = m_rxFreq*freq_hz_to_px;
+    x += PLOT_BORDER + XLEFT_OFFSET;
+    //printf("m_rxFreq %f x %d\n", m_rxFreq, x);
+    dc.DrawLine(x, m_rGrid.GetHeight()+ PLOT_BORDER, x, m_rCtrl.GetHeight());
+    
+}
+
+//-------------------------------------------------------------------------
+// plotPixelData()
+//-------------------------------------------------------------------------
+void PlotWaterfall::plotPixelData()
+{
+    float       spec_index_per_px;
+    float       intensity_per_dB;
+    float       px_per_sec;
+    int         index;
+    float       dy;
+    int         dy_blocks;
+    int         b;
+    int         px;
+    int         py;
+    int         intensity;
+
+    /*
+      Design Notes:
+
+      The height in pixels represents WATERFALL_SECS_Y of data.  Every DT
+      seconds we get a vector of MODEM_STATS_NSPEC spectrum samples which we use
+      to update the last row.  The height of each row is dy pixels, which
+      maps to DT seconds.  We call each dy high rectangle of pixels a
+      block.
+
+    */
+
+    // determine dy, the height of one "block"
+    px_per_sec = (float)m_rGrid.GetHeight() / WATERFALL_SECS_Y;
+    dy = m_dT * px_per_sec;
+
+    // number of dy high blocks in spectrogram
+    dy_blocks = m_rGrid.GetHeight()/ dy;
+
+    // update min and max amplitude estimates
+    float max_mag = MIN_MAG_DB;
+
+    int min_fft_bin=((float)200/m_modem_stats_max_f_hz)*MODEM_STATS_NSPEC;
+    int max_fft_bin=((float)2800/m_modem_stats_max_f_hz)*MODEM_STATS_NSPEC;
+
+    for(int i=min_fft_bin; i<max_fft_bin; i++) 
+    {
+        if (g_avmag[i] > max_mag)
+        {
+            max_mag = g_avmag[i];
+        }
+    }
+
+    m_max_mag = BETA*m_max_mag + (1 - BETA)*max_mag;
+    m_min_mag = max_mag - 20.0;
+    //printf("max_mag: %f m_max_mag: %f\n", max_mag, m_max_mag);
+    intensity_per_dB  = (float)256 /(MAX_MAG_DB - MIN_MAG_DB);
+    //intensity_per_dB  = (float)256 /(m_max_mag - m_min_mag);
+    spec_index_per_px = ((float)(MAX_F_HZ)/(float)m_modem_stats_max_f_hz)*(float)MODEM_STATS_NSPEC / (float) m_rGrid.GetWidth();
+
+    /*
+    printf("h %d w %d px_per_sec %d dy %d dy_blocks %d spec_index_per_px: %f\n", 
+       m_rGrid.GetHeight(), m_rGrid.GetWidth(), px_per_sec, 
+       dy, dy_blocks, spec_index_per_px);
+    */
+
+    // Shift previous bit map up one row of blocks ----------------------------
+    wxNativePixelData data(*m_pBmp);
+    wxNativePixelData::Iterator bitMapStart(data);
+    wxNativePixelData::Iterator p = bitMapStart;
+
+    for(b = 0; b < dy_blocks - 1; b++) 
+    {
+        wxNativePixelData::Iterator psrc = bitMapStart;
+        wxNativePixelData::Iterator pdest = bitMapStart;
+        pdest.OffsetY(data, dy * b);
+        psrc.OffsetY(data, dy * (b+1));
+
+        // copy one line of blocks
+
+        for(py = 0; py < dy; py++) 
+        {
+            wxNativePixelData::Iterator pdestRowStart = pdest;
+            wxNativePixelData::Iterator psrcRowStart = psrc;
+
+            for(px = 0; px < m_rGrid.GetWidth(); px++) 
+            {
+                pdest.Red() = psrc.Red();
+                pdest.Green() = psrc.Green();
+                pdest.Blue() = psrc.Blue();
+                pdest++;
+                psrc++;
+            }
+            pdest = pdestRowStart;
+            pdest.OffsetY(data, 1);
+            psrc = psrcRowStart;
+            psrc.OffsetY(data, 1);         
+        }
+    }
+
+    // Draw last line of blocks using latest amplitude data ------------------
+    p = bitMapStart;
+    p.OffsetY(data, dy *(dy_blocks - 1));
+    for(py = 0; py < dy; py++)
+    {
+        wxNativePixelData::Iterator rowStart = p;
+
+        for(px = 0; px < m_rGrid.GetWidth(); px++)
+        {
+            index = px * spec_index_per_px;
+            assert(index < MODEM_STATS_NSPEC);
+
+            intensity = intensity_per_dB * (g_avmag[index] - m_min_mag);
+            if(intensity > 255) intensity = 255;
+            if (intensity < 0) intensity = 0;
+            //printf("%d %f %d \n", index, g_avmag[index], intensity);
+
+            switch (m_colour) {
+            case 0:
+                p.Red() = m_heatmap_lut[intensity] & 0xff;
+                p.Green() = (m_heatmap_lut[intensity] >> 8) & 0xff;
+                p.Blue() = (m_heatmap_lut[intensity] >> 16) & 0xff;
+                break;
+            case 1:
+                p.Red() = intensity;
+                p.Green() = intensity;
+                p.Blue() = intensity;       
+                break;
+            case 2:
+                p.Red() = intensity;
+                p.Green() = intensity;
+                if (intensity < 127)
+                    p.Blue() = intensity*2;
+                else
+                    p.Blue() = 255;
+                        
+                break;
+            }
+            ++p;
+        }
+        p = rowStart;
+        p.OffsetY(data, 1);
+    }
+
+}
+
+//-------------------------------------------------------------------------
+// OnMouseLeftDown()
+//-------------------------------------------------------------------------
+void PlotWaterfall::OnMouseLeftDown(wxMouseEvent& event)
+{
+    m_mouseDown = true;
+    wxClientDC dc(this);
+
+    wxPoint pt(event.GetLogicalPosition(dc));
+
+    // map x coord to edges of actual plot
+    pt.x -= PLOT_BORDER + XLEFT_OFFSET;
+    pt.y -= PLOT_BORDER;
+
+    // valid click if inside of plot
+    if ((pt.x >= 0) && (pt.x <= m_rGrid.GetWidth()) && (pt.y >=0)) 
+    {
+        float freq_hz_to_px = (float)m_rGrid.GetWidth()/(MAX_F_HZ-MIN_F_HZ);
+        float clickFreq = (float)pt.x/freq_hz_to_px;
+
+        // communicate back to other threads
+        fdmdv2_clickTune(clickFreq);
+    }
+}
+
+//-------------------------------------------------------------------------
+// OnMouseRightDown()
+//-------------------------------------------------------------------------
+void PlotWaterfall::OnMouseRightDown(wxMouseEvent& event)
+{
+    m_colour++;
+    if (m_colour == 3)
+        m_colour = 0;
+}
+
diff --git a/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_waterfall.h b/fdmdv2/tags/0.99-Beta/src/fdmdv2_plot_waterfall.h
new file mode 100644 (file)
index 0000000..77058fd
--- /dev/null
@@ -0,0 +1,73 @@
+//==========================================================================
+// Name:            fdmdv2_plot_waterfall.h
+// Purpose:         Defines a waterfall plot derivative of fdmdv2_plot.
+// Created:         June 22, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#ifndef __FDMDV2_PLOT_WATERFALL__
+#define __FDMDV2_PLOT_WATERFALL__
+
+#include "fdmdv2_plot.h"
+#include "fdmdv2_defines.h"
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+// Class PlotWaterfall
+//
+// @class $(Name)
+// @author $(User)
+// @date $(Date)
+// @file $(CurrentFileName).$(CurrentFileExt)
+// @brief
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
+class PlotWaterfall : public PlotPanel
+{
+    public:
+    PlotWaterfall(wxFrame* parent, bool graticule, int colour);
+        ~PlotWaterfall();
+        bool checkDT(void);
+        void setGreyscale(bool greyscale) { m_greyscale = greyscale; }
+        void setRxFreq(float rxFreq) { m_rxFreq = rxFreq; }
+        void setFs(int fs) { m_modem_stats_max_f_hz = fs/2; }
+
+    protected:
+        unsigned    m_heatmap_lut[256];
+
+        unsigned    heatmap(float val, float min, float max);
+
+        void        OnPaint(wxPaintEvent & evt);
+        void        OnSize(wxSizeEvent& event);
+        void        OnShow(wxShowEvent& event);
+        void        drawGraticule(wxAutoBufferedPaintDC&  dc);
+        void        draw(wxAutoBufferedPaintDC& dc);
+        void        plotPixelData();
+        void        OnMouseLeftDown(wxMouseEvent& event);
+        void        OnMouseRightDown(wxMouseEvent& event);
+
+    private:
+        float       m_dT;
+        float       m_rxFreq;
+        bool        m_graticule;
+        float       m_min_mag;
+        float       m_max_mag;
+        int         m_colour;
+        int         m_modem_stats_max_f_hz;
+
+        DECLARE_EVENT_TABLE()
+};
+
+#endif //__FDMDV2_PLOT_WATERFALL__
diff --git a/fdmdv2/tags/0.99-Beta/src/hamlib.cpp b/fdmdv2/tags/0.99-Beta/src/hamlib.cpp
new file mode 100644 (file)
index 0000000..575f36a
--- /dev/null
@@ -0,0 +1,127 @@
+//==========================================================================
+// Name:            hamlib.cpp
+//
+// Purpose:         Hamlib integration for FreeDV
+// Created:         May 2013
+// Authors:         Joel Stanley
+//
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include <hamlib.h>
+
+#include <vector>
+#include <algorithm>
+
+using namespace std;
+
+typedef std::vector<const struct rig_caps *> riglist_t;
+
+static bool rig_cmp(const struct rig_caps *rig1, const struct rig_caps *rig2);
+static int build_list(const struct rig_caps *rig, rig_ptr_t);
+
+Hamlib::Hamlib() : m_rig(NULL) {
+    /* Stop hamlib from spewing info to stderr. */
+    rig_set_debug(RIG_DEBUG_NONE);
+
+    /* Create sorted list of rigs. */
+    rig_load_all_backends();
+    rig_list_foreach(build_list, &m_rigList);
+    sort(m_rigList.begin(), m_rigList.end(), rig_cmp);
+
+    /* Reset debug output. */
+    rig_set_debug(RIG_DEBUG_VERBOSE);
+
+       m_rig = NULL;
+}
+
+Hamlib::~Hamlib() {
+       if(m_rig)
+               close();
+}
+
+static int build_list(const struct rig_caps *rig, rig_ptr_t rigList) {
+    ((riglist_t *)rigList)->push_back(rig); 
+    return 1;
+}
+
+static bool rig_cmp(const struct rig_caps *rig1, const struct rig_caps *rig2) {
+    /* Compare manufacturer. */
+    int r = strcasecmp(rig1->mfg_name, rig2->mfg_name);
+    if (r != 0)
+        return r < 0;
+
+    /* Compare model. */
+    r = strcasecmp(rig1->model_name, rig2->model_name);
+    if (r != 0)
+        return r < 0;
+
+    /* Compare rig ID. */
+    return rig1->rig_model < rig2->rig_model;
+}
+
+void Hamlib::populateComboBox(wxComboBox *cb) {
+
+    riglist_t::const_iterator rig = m_rigList.begin();
+    for (; rig !=m_rigList.end(); rig++) {
+        char name[128];
+        snprintf(name, 128, "%s %s", (*rig)->mfg_name, (*rig)->model_name); 
+        cb->Append(name);
+    }
+}
+
+bool Hamlib::connect(unsigned int rig_index, const char *serial_port) {
+    /* Look up model from index. */
+    if (rig_index >= m_rigList.size()) {
+        return false;
+    }
+    printf("rig: %s %s (%d)\n", m_rigList[rig_index]->mfg_name,
+            m_rigList[rig_index]->model_name, m_rigList[rig_index]->rig_model);
+
+       if(m_rig) {
+               printf("Closing old hamlib instance!\n");
+               close();
+       }
+
+    /* Initialise, configure and open. */
+    m_rig = rig_init(m_rigList[rig_index]->rig_model);
+    /* TODO: Also use baud rate from the screen. */
+    if (!m_rig)
+        return false;
+    token_t token = rig_token_lookup(m_rig, "rig_pathname");
+    if (rig_set_conf(m_rig, token, serial_port) != RIG_OK) {
+        return false;
+    }
+    if (rig_open(m_rig) == RIG_OK) {
+        return true;
+    }
+    return false;
+}
+
+bool Hamlib::ptt(bool press) {
+       if(!m_rig)
+               return false;
+    /* TODO(Joel): make ON_DATA and ON configurable. */
+    ptt_t on = press ? RIG_PTT_ON : RIG_PTT_OFF;
+    /* TODO(Joel): what should the VFO option be? */
+    return rig_set_ptt(m_rig, RIG_VFO_CURR, on) == RIG_OK;
+}
+
+void Hamlib::close(void) {
+       if(m_rig) {
+               rig_close(m_rig);
+               rig_cleanup(m_rig);
+               m_rig = NULL;
+       }
+}
diff --git a/fdmdv2/tags/0.99-Beta/src/hamlib.h b/fdmdv2/tags/0.99-Beta/src/hamlib.h
new file mode 100644 (file)
index 0000000..fe3496f
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef HAMLIB_H
+#define HAMLIB_H
+
+extern "C" {
+#include <hamlib/rig.h>
+}
+#include <wx/combobox.h>
+#include <vector>
+
+class Hamlib {
+
+    public:
+        Hamlib();
+        ~Hamlib();
+        void populateComboBox(wxComboBox *cb);
+        bool connect(unsigned int rig_index, const char *serial_port);
+        bool ptt(bool press);
+        void close(void);
+
+        typedef std::vector<const struct rig_caps *> riglist_t;
+
+    private:
+        RIG *m_rig;
+        /* Sorted list of rigs. */
+        riglist_t m_rigList;
+};
+
+#endif /*HAMLIB_H*/
diff --git a/fdmdv2/tags/0.99-Beta/src/sox.h b/fdmdv2/tags/0.99-Beta/src/sox.h
new file mode 100644 (file)
index 0000000..07aedeb
--- /dev/null
@@ -0,0 +1,2608 @@
+/* libSoX Library Public Interface
+ *
+ * Copyright 1999-2011 Chris Bagwell and SoX Contributors.
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose.  This copyright notice must be maintained.
+ * Chris Bagwell And SoX Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+/** @file
+Contains the interface exposed to clients of the libSoX library.
+Symbols starting with "sox_" or "SOX_" are part of the public interface for
+libSoX clients (applications that consume libSoX). Symbols starting with
+"lsx_" or "LSX_" are internal use by libSoX and plugins.
+LSX_ and lsx_ symbols should not be used by libSoX-based applications.
+*/
+
+#ifndef SOX_H
+#define SOX_H /**< Client API: This macro is defined if sox.h has been included. */
+
+#include <limits.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* Suppress warnings from use of type long long. */
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+/*****************************************************************************
+API decoration macros:
+Mostly for documentation purposes. For some compilers, decorations also affect
+code generation, influence compiler warnings or activate compiler
+optimizations.
+*****************************************************************************/
+
+/**
+Plugins API:
+Attribute required on all functions exported by libSoX and on all function
+pointer types used by the libSoX API.
+*/
+#ifdef __GNUC__
+#define LSX_API  __attribute__ ((cdecl)) /* libSoX function */
+#elif _MSC_VER
+#define LSX_API  __cdecl /* libSoX function */
+#else
+#define LSX_API /* libSoX function */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter or local variable to suppress warnings about
+the variable being unused (especially in macro-generated code).
+*/
+#ifdef __GNUC__
+#define LSX_UNUSED  __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */
+#else
+#define LSX_UNUSED /* Parameter or local variable is intentionally unused. */
+#endif
+
+/**
+Plugins API:
+LSX_PRINTF12: Attribute applied to a function to indicate that it requires
+a printf-style format string for arg1 and that printf parameters start at
+arg2.
+*/
+#ifdef __GNUC__
+#define LSX_PRINTF12  __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */
+#else
+#define LSX_PRINTF12 /* Function has printf-style arguments. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that it has no side effects and
+depends only its input parameters and global memory. If called repeatedly, it
+returns the same result each time.
+*/
+#ifdef __GNUC__
+#define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */
+#else
+#define LSX_RETURN_PURE /* Function is pure. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the
+return value is always a pointer to a valid object (never NULL).
+*/
+#ifdef _Ret_
+#define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */
+#else
+#define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the return value is always a
+pointer to a valid array (never NULL).
+*/
+#ifdef _Ret_valid_
+#define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */
+#else
+#define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the return value is always a
+pointer to a valid 0-terminated array (never NULL).
+*/
+#ifdef _Ret_z_
+#define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */
+#else
+#define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the returned pointer may be
+null.
+*/
+#ifdef _Ret_opt_
+#define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */
+#else
+#define LSX_RETURN_OPT /* Function may return NULL. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to one const element of the pointed-to type (never NULL).
+*/
+#ifdef _In_
+#define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */
+#else
+#define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to a const 0-terminated string (never NULL).
+*/
+#ifdef _In_z_
+#define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */
+#else
+#define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a const
+pointer to a 0-terminated printf format string.
+*/
+#ifdef _Printf_format_string_
+#define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */
+#else
+#define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to (len) const initialized elements of the pointed-to type, where
+(len) is the name of another parameter.
+@param len The parameter that contains the number of elements in the array.
+*/
+#ifdef _In_count_
+#define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */
+#else
+#define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to (len) const bytes of initialized data, where (len) is the name of
+another parameter.
+@param len The parameter that contains the number of bytes in the array.
+*/
+#ifdef _In_bytecount_
+#define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */
+#else
+#define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is either NULL
+or a valid pointer to one const element of the pointed-to type.
+*/
+#ifdef _In_opt_
+#define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */
+#else
+#define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is either NULL
+or a valid pointer to a const 0-terminated string.
+*/
+#ifdef _In_opt_z_
+#define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */
+#else
+#define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to one initialized element of the pointed-to type (never NULL). The
+function may modify the element.
+*/
+#ifdef _Inout_
+#define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */
+#else
+#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to (len) initialized elements of the pointed-to type (never NULL). The
+function may modify the elements.
+@param len The parameter that contains the number of elements in the array.
+*/
+#ifdef _Inout_count_x_
+#define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */
+#else
+#define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for one element of the pointed-to type (never
+NULL). The function will initialize the element.
+*/
+#ifdef _Out_
+#define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */
+#else
+#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for (len) bytes of data (never NULL), where (len)
+is the name of another parameter. The function may write up to len bytes of
+data to this memory.
+@param len The parameter that contains the number of bytes in the array.
+*/
+#ifdef _Out_bytecap_
+#define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */
+#else
+#define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for (len) elements of the pointed-to type (never
+NULL), where (len) is the name of another parameter. On return, (filled)
+elements will have been initialized, where (filled) is either the dereference
+of another pointer parameter (for example "*written") or the "return"
+parameter (indicating that the function returns the number of elements
+written).
+@param len The parameter that contains the number of elements in the array.
+@param filled The dereference of the parameter that receives the number of elements written to the array, or "return" if the value is returned.
+*/
+#ifdef _Out_cap_post_count_
+#define LSX_PARAM_OUT_CAP_POST_COUNT(len,filled) _Out_cap_post_count_(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */
+#else
+#define LSX_PARAM_OUT_CAP_POST_COUNT(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for (len) elements of the pointed-to type (never
+NULL), where (len) is the name of another parameter. On return, (filled+1)
+elements will have been initialized, with the last element having been
+initialized to 0, where (filled) is either the dereference of another pointer
+parameter (for example, "*written") or the "return" parameter (indicating that
+the function returns the number of elements written).
+@param len The parameter that contains the number of elements in the array.
+@param filled The dereference of the parameter that receives the number of elements written to the array (not counting the terminating null), or "return" if the value is returned.
+*/
+#ifdef _Out_z_cap_post_count_
+#define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len,filled) _Out_z_cap_post_count_(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled+1) elements will have been initialized, and the array will be 0-terminated. */
+#else
+#define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled+1) elements will have been initialized, and the array will be 0-terminated. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is either NULL
+or a valid pointer to memory sufficient for one element of the pointed-to
+type. The function will initialize the element.
+*/
+#ifdef _Out_opt_
+#define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */
+#else
+#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer (never NULL) to another pointer which may be NULL when the function is
+invoked.
+*/
+#ifdef _Deref_pre_maybenull_
+#define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */
+#else
+#define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer (never NULL) to another pointer which will be NULL when the function
+returns.
+*/
+#ifdef _Deref_post_null_
+#define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
+#else
+#define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer (never NULL) to another pointer which will be non-NULL when the
+function returns.
+*/
+#ifdef _Deref_post_notnull_
+#define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
+#else
+#define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
+#endif
+
+/**
+Plugins API:
+Expression that "uses" a potentially-unused variable to avoid compiler
+warnings (especially in macro-generated code).
+*/
+#ifdef _PREFAST_
+#define LSX_USE_VAR(x)  ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */
+#else
+#define LSX_USE_VAR(x)  ((void)(x)) /* Parameter or variable is intentionally unused. */
+#endif
+
+/**
+Plugins API:
+Compile-time assertion. Causes a compile error if the expression is false.
+@param e  The expression to test. If expression is false, compilation will fail.
+@param f  A unique identifier for the test, for example foo_must_not_be_zero.
+*/
+#define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)}
+
+/*****************************************************************************
+Basic typedefs:
+*****************************************************************************/
+
+/**
+Client API:
+Signed twos-complement 8-bit type. Typically defined as signed char.
+*/
+#if SCHAR_MAX==127 && SCHAR_MIN==(-128)
+typedef signed char sox_int8_t;
+#elif CHAR_MAX==127 && CHAR_MIN==(-128)
+typedef char sox_int8_t;
+#else
+#error Unable to determine an appropriate definition for sox_int8_t.
+#endif
+
+/**
+Client API:
+Unsigned 8-bit type. Typically defined as unsigned char.
+*/
+#if UCHAR_MAX==0xff
+typedef unsigned char sox_uint8_t;
+#elif CHAR_MAX==0xff && CHAR_MIN==0
+typedef char sox_uint8_t;
+#else
+#error Unable to determine an appropriate definition for sox_uint8_t.
+#endif
+
+/**
+Client API:
+Signed twos-complement 16-bit type. Typically defined as short.
+*/
+#if SHRT_MAX==32767 && SHRT_MIN==(-32768)
+typedef short sox_int16_t;
+#elif INT_MAX==32767 && INT_MIN==(-32768)
+typedef int sox_int16_t;
+#else
+#error Unable to determine an appropriate definition for sox_int16_t.
+#endif
+
+/**
+Client API:
+Unsigned 16-bit type. Typically defined as unsigned short.
+*/
+#if USHRT_MAX==0xffff
+typedef unsigned short sox_uint16_t;
+#elif UINT_MAX==0xffff
+typedef unsigned int sox_uint16_t;
+#else
+#error Unable to determine an appropriate definition for sox_uint16_t.
+#endif
+
+/**
+Client API:
+Signed twos-complement 32-bit type. Typically defined as int.
+*/
+#if INT_MAX==2147483647 && INT_MIN==(-2147483647-1)
+typedef int sox_int32_t;
+#elif LONG_MAX==2147483647 && LONG_MIN==(-2147483647-1)
+typedef long sox_int32_t;
+#else
+#error Unable to determine an appropriate definition for sox_int32_t.
+#endif
+
+/**
+Client API:
+Unsigned 32-bit type. Typically defined as unsigned int.
+*/
+#if UINT_MAX==0xffffffff
+typedef unsigned int sox_uint32_t;
+#elif ULONG_MAX==0xffffffff
+typedef unsigned long sox_uint32_t;
+#else
+#error Unable to determine an appropriate definition for sox_uint32_t.
+#endif
+
+/**
+Client API:
+Signed twos-complement 64-bit type. Typically defined as long or long long.
+*/
+#if LONG_MAX==9223372036854775807 && LONG_MIN==(-9223372036854775807-1)
+typedef long sox_int64_t;
+#elif defined(_MSC_VER)
+typedef __int64 sox_int64_t;
+#else
+typedef long long sox_int64_t;
+#endif
+
+/**
+Client API:
+Unsigned 64-bit type. Typically defined as unsigned long or unsigned long long.
+*/
+#if ULONG_MAX==0xffffffffffffffff
+typedef unsigned long sox_uint64_t;
+#elif defined(_MSC_VER)
+typedef unsigned __int64 sox_uint64_t;
+#else
+typedef unsigned long long sox_uint64_t;
+#endif
+
+#ifndef _DOXYGEN_
+lsx_static_assert(sizeof(sox_int8_t)==1,   sox_int8_size);
+lsx_static_assert(sizeof(sox_uint8_t)==1,  sox_uint8_size);
+lsx_static_assert(sizeof(sox_int16_t)==2,  sox_int16_size);
+lsx_static_assert(sizeof(sox_uint16_t)==2, sox_uint16_size);
+lsx_static_assert(sizeof(sox_int32_t)==4,  sox_int32_size);
+lsx_static_assert(sizeof(sox_uint32_t)==4, sox_uint32_size);
+lsx_static_assert(sizeof(sox_int64_t)==8,  sox_int64_size);
+lsx_static_assert(sizeof(sox_uint64_t)==8, sox_uint64_size);
+#endif
+
+/**
+Client API:
+Alias for sox_int32_t (beware of the extra byte).
+*/
+typedef sox_int32_t sox_int24_t;
+
+/**
+Client API:
+Alias for sox_uint32_t (beware of the extra byte).
+*/
+typedef sox_uint32_t sox_uint24_t;
+
+/**
+Client API:
+Native SoX audio sample type (alias for sox_int32_t).
+*/
+typedef sox_int32_t sox_sample_t;
+
+/**
+Client API:
+Samples per second is stored as a double.
+*/
+typedef double sox_rate_t;
+
+/**
+Client API:
+File's metadata, access via sox_*_comments functions.
+*/
+typedef char * * sox_comments_t;
+
+/*****************************************************************************
+Enumerations:
+*****************************************************************************/
+
+/**
+Client API:
+Boolean type, assignment (but not necessarily binary) compatible with C++ bool.
+*/
+typedef enum sox_bool {
+    sox_false, /**< False = 0. */
+    sox_true   /**< True = 1. */
+} sox_bool;
+
+/**
+Client API:
+no, yes, or default (default usually implies some kind of auto-detect logic).
+*/
+typedef enum sox_option_t {
+    sox_option_no,      /**< Option specified as no = 0. */
+    sox_option_yes,     /**< Option specified as yes = 1. */
+    sox_option_default  /**< Option unspecified = 2. */
+} sox_option_t;
+
+/**
+Client API:
+The libSoX-specific error codes.
+libSoX functions may return these codes or others that map from errno codes.
+*/
+enum sox_error_t {
+  SOX_SUCCESS = 0,     /**< Function succeeded = 0 */
+  SOX_EOF = -1,        /**< End Of File or other error = -1 */
+  SOX_EHDR = 2000,     /**< Invalid Audio Header = 2000 */
+  SOX_EFMT,            /**< Unsupported data format = 2001 */
+  SOX_ENOMEM,          /**< Can't alloc memory = 2002 */
+  SOX_EPERM,           /**< Operation not permitted = 2003 */
+  SOX_ENOTSUP,         /**< Operation not supported = 2004 */
+  SOX_EINVAL           /**< Invalid argument = 2005 */
+};
+
+/**
+Client API:
+Flags indicating whether optional features are present in this build of libSoX.
+*/
+typedef enum sox_version_flags_t {
+    sox_version_none = 0,         /**< No special features = 0. */
+    sox_version_have_popen = 1,   /**< popen = 1. */
+    sox_version_have_magic = 2,   /**< magic = 2. */
+    sox_version_have_threads = 4, /**< threads = 4. */
+    sox_version_have_memopen = 8  /**< memopen = 8. */
+} sox_version_flags_t;
+
+/**
+Client API:
+Format of sample data.
+*/
+typedef enum sox_encoding_t {
+  SOX_ENCODING_UNKNOWN   , /**< encoding has not yet been determined */
+
+  SOX_ENCODING_SIGN2     , /**< signed linear 2's comp: Mac */
+  SOX_ENCODING_UNSIGNED  , /**< unsigned linear: Sound Blaster */
+  SOX_ENCODING_FLOAT     , /**< floating point (binary format) */
+  SOX_ENCODING_FLOAT_TEXT, /**< floating point (text format) */
+  SOX_ENCODING_FLAC      , /**< FLAC compression */
+  SOX_ENCODING_HCOM      , /**< Mac FSSD files with Huffman compression */
+  SOX_ENCODING_WAVPACK   , /**< WavPack with integer samples */
+  SOX_ENCODING_WAVPACKF  , /**< WavPack with float samples */
+  SOX_ENCODING_ULAW      , /**< u-law signed logs: US telephony, SPARC */
+  SOX_ENCODING_ALAW      , /**< A-law signed logs: non-US telephony, Psion */
+  SOX_ENCODING_G721      , /**< G.721 4-bit ADPCM */
+  SOX_ENCODING_G723      , /**< G.723 3 or 5 bit ADPCM */
+  SOX_ENCODING_CL_ADPCM  , /**< Creative Labs 8 --> 2,3,4 bit Compressed PCM */
+  SOX_ENCODING_CL_ADPCM16, /**< Creative Labs 16 --> 4 bit Compressed PCM */
+  SOX_ENCODING_MS_ADPCM  , /**< Microsoft Compressed PCM */
+  SOX_ENCODING_IMA_ADPCM , /**< IMA Compressed PCM */
+  SOX_ENCODING_OKI_ADPCM , /**< Dialogic/OKI Compressed PCM */
+  SOX_ENCODING_DPCM      , /**< Differential PCM: Fasttracker 2 (xi) */
+  SOX_ENCODING_DWVW      , /**< Delta Width Variable Word */
+  SOX_ENCODING_DWVWN     , /**< Delta Width Variable Word N-bit */
+  SOX_ENCODING_GSM       , /**< GSM 6.10 33byte frame lossy compression */
+  SOX_ENCODING_MP3       , /**< MP3 compression */
+  SOX_ENCODING_VORBIS    , /**< Vorbis compression */
+  SOX_ENCODING_AMR_WB    , /**< AMR-WB compression */
+  SOX_ENCODING_AMR_NB    , /**< AMR-NB compression */
+  SOX_ENCODING_CVSD      , /**< Continuously Variable Slope Delta modulation */
+  SOX_ENCODING_LPC10     , /**< Linear Predictive Coding */
+
+  SOX_ENCODINGS            /**< End of list marker */
+} sox_encoding_t;
+
+/**
+Client API:
+Flags for sox_encodings_info_t: lossless/lossy1/lossy2.
+*/
+typedef enum sox_encodings_flags_t {
+  sox_encodings_none   = 0, /**< no flags specified (implies lossless encoding) = 0. */
+  sox_encodings_lossy1 = 1, /**< encode, decode: lossy once = 1. */
+  sox_encodings_lossy2 = 2  /**< encode, decode, encode, decode: lossy twice = 2. */
+} sox_encodings_flags_t;
+
+/**
+Client API:
+Type of plot.
+*/
+typedef enum sox_plot_t {
+    sox_plot_off,     /**< No plot = 0. */
+    sox_plot_octave,  /**< Octave plot = 1. */
+    sox_plot_gnuplot, /**< Gnuplot plot = 2. */
+    sox_plot_data     /**< Plot data = 3. */
+} sox_plot_t;
+
+/**
+Client API:
+Loop modes: upper 4 bits mask the loop blass, lower 4 bits describe
+the loop behaviour, for example single shot, bidirectional etc.
+*/
+enum sox_loop_flags_t {
+  sox_loop_none = 0,          /**< single-shot = 0 */
+  sox_loop_forward = 1,       /**< forward loop = 1 */
+  sox_loop_forward_back = 2,  /**< forward/back loop = 2 */
+  sox_loop_8 = 32,            /**< 8 loops (??) = 32 */
+  sox_loop_sustain_decay = 64 /**< AIFF style, one sustain & one decay loop = 64 */
+};
+
+/**
+Plugins API:
+Is file a real file, a pipe, or a url?
+*/
+typedef enum lsx_io_type
+{
+    lsx_io_file, /**< File is a real file = 0. */
+    lsx_io_pipe, /**< File is a pipe (no seeking) = 1. */
+    lsx_io_url   /**< File is a URL (no seeking) = 2. */
+} lsx_io_type;
+
+/*****************************************************************************
+Macros:
+*****************************************************************************/
+
+/**
+Client API:
+Compute a 32-bit integer API version from three 8-bit parts.
+@param a Major version.
+@param b Minor version.
+@param c Revision or build number.
+@returns 32-bit integer API version 0x000a0b0c.
+*/
+#define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+
+/**
+Client API:
+The API version of the sox.h file. It is not meant to follow the version
+number of SoX but it has historically. Please do not count on
+SOX_LIB_VERSION_CODE staying in sync with the libSoX version.
+*/
+#define SOX_LIB_VERSION_CODE   SOX_LIB_VERSION(14, 4, 0)
+
+/**
+Client API:
+Returns the smallest (negative) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer;
+for example, SOX_INT_MIN(8) = 0x80, SOX_INT_MIN(16) = 0x8000, etc.
+@param bits Size of value for which to calculate minimum.
+@returns the smallest (negative) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer.
+*/
+#define SOX_INT_MIN(bits) (1 <<((bits)-1))
+
+/**
+Client API:
+Returns the largest (positive) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer;
+for example, SOX_INT_MAX(8) = 0x7F, SOX_INT_MAX(16) = 0x7FFF, etc.
+@param bits Size of value for which to calculate maximum.
+@returns the largest (positive) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer.
+*/
+#define SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits)))
+
+/**
+Client API:
+Returns the largest value storable in an unsigned integer with the specified
+number of bits; for example, SOX_UINT_MAX(8) = 0xFF,
+SOX_UINT_MAX(16) = 0xFFFF, etc.
+@param bits Size of value for which to calculate maximum.
+@returns the largest value storable in an unsigned integer with the specified
+number of bits.
+*/
+#define SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits))
+
+/**
+Client API:
+Returns 0x7F.
+*/
+#define SOX_INT8_MAX  SOX_INT_MAX(8)
+
+/**
+Client API:
+Returns 0x7FFF.
+*/
+#define SOX_INT16_MAX SOX_INT_MAX(16)
+
+/**
+Client API:
+Returns 0x7FFFFF.
+*/
+#define SOX_INT24_MAX SOX_INT_MAX(24)
+
+/**
+Client API:
+Returns 0x7FFFFFFF.
+*/
+#define SOX_INT32_MAX SOX_INT_MAX(32)
+
+/**
+Client API:
+Bits in a sox_sample_t = 32.
+*/
+#define SOX_SAMPLE_PRECISION 32
+
+/**
+Client API:
+Max value for sox_sample_t = 0x7FFFFFFF.
+*/
+#define SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32)
+
+/**
+Client API:
+Min value for sox_sample_t = 0x80000000.
+*/
+#define SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32)
+
+
+/*                Conversions: Linear PCM <--> sox_sample_t
+ *
+ *   I/O      Input    sox_sample_t Clips?   Input    sox_sample_t Clips?
+ *  Format   Minimum     Minimum     I O    Maximum     Maximum     I O
+ *  ------  ---------  ------------ -- --   --------  ------------ -- --
+ *  Float     -inf         -1        y n      inf      1 - 5e-10    y n
+ *  Int8      -128        -128       n n      127     127.9999999   n y
+ *  Int16    -32768      -32768      n n     32767    32767.99998   n y
+ *  Int24   -8388608    -8388608     n n    8388607   8388607.996   n y
+ *  Int32  -2147483648 -2147483648   n n   2147483647 2147483647    n n
+ *
+ * Conversions are as accurate as possible (with rounding).
+ *
+ * Rounding: halves toward +inf, all others to nearest integer.
+ *
+ * Clips? shows whether on not there is the possibility of a conversion
+ * clipping to the minimum or maximum value when inputing from or outputing
+ * to a given type.
+ *
+ * Unsigned integers are converted to and from signed integers by flipping
+ * the upper-most bit then treating them as signed integers.
+ */
+
+/**
+Client API:
+Declares the temporary local variables that are required when using SOX
+conversion macros.
+*/
+#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
+  double sox_macro_temp_double LSX_UNUSED
+
+/**
+Client API:
+Sign bit for sox_sample_t = 0x80000000.
+*/
+#define SOX_SAMPLE_NEG SOX_INT_MIN(32)
+
+/**
+Client API:
+Converts sox_sample_t to an unsigned integer of width (bits).
+@param bits  Width of resulting sample (1 through 32).
+@param d     Input sample to be converted.
+@param clips Variable that is incremented if the result is too big.
+@returns Unsigned integer of width (bits).
+*/
+#define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \
+  (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips)^SOX_INT_MIN(bits))
+
+/**
+Client API:
+Converts sox_sample_t to a signed integer of width (bits).
+@param bits  Width of resulting sample (1 through 32).
+@param d     Input sample to be converted.
+@param clips Variable that is incremented if the result is too big.
+@returns Signed integer of width (bits).
+*/
+#define SOX_SAMPLE_TO_SIGNED(bits,d,clips) \
+  (sox_int##bits##_t)(LSX_USE_VAR(sox_macro_temp_double),sox_macro_temp_sample=(d),sox_macro_temp_sample>SOX_SAMPLE_MAX-(1<<(31-bits))?++(clips),SOX_INT_MAX(bits):((sox_uint32_t)(sox_macro_temp_sample+(1<<(31-bits))))>>(32-bits))
+
+/**
+Client API:
+Converts signed integer of width (bits) to sox_sample_t.
+@param bits Width of input sample (1 through 32).
+@param d    Input sample to be converted.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_TO_SAMPLE(bits,d)((sox_sample_t)(d)<<(32-bits))
+
+/**
+Client API:
+Converts unsigned integer of width (bits) to sox_sample_t.
+@param bits Width of input sample (1 through 32).
+@param d    Input sample to be converted.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_TO_SAMPLE(bits,d)(SOX_SIGNED_TO_SAMPLE(bits,d)^SOX_SAMPLE_NEG)
+
+/**
+Client API:
+Converts unsigned 8-bit integer to sox_sample_t.
+@param d     Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_8BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(8,d)
+
+/**
+Client API:
+Converts signed 8-bit integer to sox_sample_t.
+@param d    Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_8BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(8,d)
+
+/**
+Client API:
+Converts unsigned 16-bit integer to sox_sample_t.
+@param d     Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_16BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(16,d)
+
+/**
+Client API:
+Converts signed 16-bit integer to sox_sample_t.
+@param d    Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_16BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(16,d)
+
+/**
+Client API:
+Converts unsigned 24-bit integer to sox_sample_t.
+@param d     Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_24BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(24,d)
+
+/**
+Client API:
+Converts signed 24-bit integer to sox_sample_t.
+@param d    Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_24BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(24,d)
+
+/**
+Client API:
+Converts unsigned 32-bit integer to sox_sample_t.
+@param d     Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_32BIT_TO_SAMPLE(d,clips) ((sox_sample_t)(d)^SOX_SAMPLE_NEG)
+
+/**
+Client API:
+Converts signed 32-bit integer to sox_sample_t.
+@param d    Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(d)
+
+/**
+Client API:
+Converts 32-bit float to sox_sample_t.
+@param d     Input sample to be converted, range [-1, 1).
+@param clips Variable to increment if the input sample is too large or too small.
+@returns SoX native sample value.
+*/
+#define SOX_FLOAT_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<SOX_SAMPLE_MIN?++(clips),SOX_SAMPLE_MIN:sox_macro_temp_double>=SOX_SAMPLE_MAX+1.?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?++(clips),SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double)
+
+/**
+Client API:
+Converts 64-bit float to sox_sample_t.
+@param d     Input sample to be converted, range [-1, 1).
+@param clips Variable to increment if the input sample is too large or too small.
+@returns SoX native sample value.
+*/
+#define SOX_FLOAT_64BIT_TO_SAMPLE(d,clips) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<0?sox_macro_temp_double<=SOX_SAMPLE_MIN-.5?++(clips),SOX_SAMPLE_MIN:sox_macro_temp_double-.5:sox_macro_temp_double>=SOX_SAMPLE_MAX+.5?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?++(clips),SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double+.5)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 8-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_8BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an signed 8-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_SIGNED_8BIT(d,clips) SOX_SAMPLE_TO_SIGNED(8,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 16-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_16BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to a signed 16-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_SIGNED_16BIT(d,clips) SOX_SAMPLE_TO_SIGNED(16,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 24-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_24BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to a signed 24-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_SIGNED_24BIT(d,clips) SOX_SAMPLE_TO_SIGNED(24,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 32-bit integer.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_32BIT(d,clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
+
+/**
+Client API:
+Converts SoX native sample to a signed 32-bit integer.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+*/
+#define SOX_SAMPLE_TO_SIGNED_32BIT(d,clips) (sox_int32_t)(d)
+
+/**
+Client API:
+Converts SoX native sample to a 32-bit float.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_FLOAT_32BIT(d,clips) (LSX_USE_VAR(sox_macro_temp_double),sox_macro_temp_sample=(d),sox_macro_temp_sample>SOX_SAMPLE_MAX-128?++(clips),1:(((sox_macro_temp_sample+128)&~255)*(1./(SOX_SAMPLE_MAX+1.))))
+
+/**
+Client API:
+Converts SoX native sample to a 64-bit float.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+*/
+#define SOX_SAMPLE_TO_FLOAT_64BIT(d,clips) ((d)*(1./(SOX_SAMPLE_MAX+1.)))
+
+/**
+Client API:
+Clips a value of a type that is larger then sox_sample_t (for example, int64)
+to sox_sample_t's limits and increment a counter if clipping occurs.
+@param samp Value (lvalue) to be clipped, updated as necessary.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+*/
+#define SOX_SAMPLE_CLIP_COUNT(samp, clips) \
+  do { \
+    if (samp > SOX_SAMPLE_MAX) \
+      { samp = SOX_SAMPLE_MAX; clips++; } \
+    else if (samp < SOX_SAMPLE_MIN) \
+      { samp = SOX_SAMPLE_MIN; clips++; } \
+  } while (0)
+
+/**
+Client API:
+Clips a value of a type that is larger then sox_sample_t (for example, int64)
+to sox_sample_t's limits and increment a counter if clipping occurs.
+@param d Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_ROUND_CLIP_COUNT(d, clips) \
+  ((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
+        : (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)
+
+/**
+Client API:
+Clips a value to the limits of a signed integer of the specified width
+and increment a counter if clipping occurs.
+@param bits Width (in bits) of target integer type.
+@param i Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_INTEGER_CLIP_COUNT(bits,i,clips) ( \
+  (i) >(1 << ((bits)-1))- 1? ++(clips),(1 << ((bits)-1))- 1 : \
+  (i) <-1 << ((bits)-1)    ? ++(clips),-1 << ((bits)-1) : (i))
+
+/**
+Client API:
+Clips a value to the limits of a 16-bit signed integer and increment a counter
+if clipping occurs.
+@param i Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_16BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(16,i,clips)
+
+/**
+Client API:
+Clips a value to the limits of a 24-bit signed integer and increment a counter
+if clipping occurs.
+@param i Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_24BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(24,i,clips)
+
+#define SOX_SIZE_MAX ((size_t)(-1)) /**< Client API: Maximum value of size_t. */
+
+#define SOX_UNSPEC 0                         /**< Client API: Members of sox_signalinfo_t are set to SOX_UNSPEC (= 0) if the actual value is not yet known. */
+#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1) /**< Client API: sox_signalinfo_t.length is set to SOX_UNKNOWN_LEN (= -1) within the effects chain if the actual length is not known. Format handlers currently use SOX_UNSPEC instead. */
+#define SOX_IGNORE_LENGTH (sox_uint64_t)(-2) /**< Client API: sox_signalinfo_t.length is set to SOX_IGNORE_LENGTH (= -2) to indicate that a format handler should ignore length information in file headers. */
+
+#define SOX_DEFAULT_CHANNELS  2     /**< Client API: Default channel count is 2 (stereo). */
+#define SOX_DEFAULT_RATE      48000 /**< Client API: Default rate is 48000Hz. */
+#define SOX_DEFAULT_PRECISION 16    /**< Client API: Default precision is 16 bits per sample. */
+#define SOX_DEFAULT_ENCODING  SOX_ENCODING_SIGN2 /**< Client API: Default encoding is SIGN2 (linear 2's complement PCM). */
+
+#define SOX_LOOP_NONE          ((unsigned char)sox_loop_none)          /**< Client API: single-shot = 0 */
+#define SOX_LOOP_8             ((unsigned char)sox_loop_8)             /**< Client API: 8 loops = 32 */
+#define SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay) /**< Client API: AIFF style, one sustain & one decay loop = 64 */
+
+#define SOX_MAX_NLOOPS         8 /**< Client API: Maximum number of loops supported by sox_oob_t = 8. */
+
+#define SOX_FILE_NOSTDIO 0x0001 /**< Client API: Does not use stdio routines */
+#define SOX_FILE_DEVICE  0x0002 /**< Client API: File is an audio device */
+#define SOX_FILE_PHONY   0x0004 /**< Client API: Phony file/device (for example /dev/null) */
+#define SOX_FILE_REWIND  0x0008 /**< Client API: File should be rewound to write header */
+#define SOX_FILE_BIT_REV 0x0010 /**< Client API: Is file bit-reversed? */
+#define SOX_FILE_NIB_REV 0x0020 /**< Client API: Is file nibble-reversed? */
+#define SOX_FILE_ENDIAN  0x0040 /**< Client API: Is file format endian? */
+#define SOX_FILE_ENDBIG  0x0080 /**< Client API: For endian file format, is it big endian? */
+#define SOX_FILE_MONO    0x0100 /**< Client API: Do channel restrictions allow mono? */
+#define SOX_FILE_STEREO  0x0200 /**< Client API: Do channel restrictions allow stereo? */
+#define SOX_FILE_QUAD    0x0400 /**< Client API: Do channel restrictions allow quad? */
+
+#define SOX_FILE_CHANS   (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD) /**< Client API: No channel restrictions */
+#define SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0)                             /**< Client API: File is little-endian */
+#define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG)               /**< Client API: File is big-endian */
+
+#define SOX_EFF_CHAN     1           /**< Client API: Effect might alter the number of channels */
+#define SOX_EFF_RATE     2           /**< Client API: Effect might alter sample rate */
+#define SOX_EFF_PREC     4           /**< Client API: Effect does its own calculation of output sample precision (otherwise a default value is taken, depending on the presence of SOX_EFF_MODIFY) */
+#define SOX_EFF_LENGTH   8           /**< Client API: Effect might alter audio length (as measured in time units, not necessarily in samples) */
+#define SOX_EFF_MCHAN    16          /**< Client API: Effect handles multiple channels internally */
+#define SOX_EFF_NULL     32          /**< Client API: Effect does nothing (can be optimized out of chain) */
+#define SOX_EFF_DEPRECATED 64        /**< Client API: Effect will soon be removed from SoX */
+#define SOX_EFF_GAIN     128         /**< Client API: Effect does not support gain -r */
+#define SOX_EFF_MODIFY   256         /**< Client API: Effect does not modify sample values (but might remove or duplicate samples or insert zeros) */
+#define SOX_EFF_ALPHA    512         /**< Client API: Effect is experimental/incomplete */
+#define SOX_EFF_INTERNAL 1024        /**< Client API: Effect present in libSoX but not valid for use by SoX command-line tools */
+
+/**
+Client API:
+When used as the "whence" parameter of sox_seek, indicates that the specified
+offset is relative to the beginning of the file.
+*/
+#define SOX_SEEK_SET 0
+
+/*****************************************************************************
+Forward declarations:
+*****************************************************************************/
+
+typedef struct sox_format_t sox_format_t;
+typedef struct sox_effect_t sox_effect_t;
+typedef struct sox_effect_handler_t sox_effect_handler_t;
+typedef struct sox_format_handler_t sox_format_handler_t;
+
+/*****************************************************************************
+Function pointers:
+*****************************************************************************/
+
+/**
+Client API:
+Callback to write a message to an output device (console or log file),
+used by sox_globals_t.output_message_handler.
+*/
+typedef void (LSX_API * sox_output_message_handler_t)(
+    unsigned level,                       /* 1 = FAIL, 2 = WARN, 3 = INFO, 4 = DEBUG, 5 = DEBUG_MORE, 6 = DEBUG_MOST. */
+    LSX_PARAM_IN_Z char const * filename, /* Source code __FILENAME__ from which message originates. */
+    LSX_PARAM_IN_PRINTF char const * fmt, /* Message format string. */
+    LSX_PARAM_IN va_list ap               /* Message format parameters. */
+    );
+
+/**
+Client API:
+Callback to retrieve information about a format handler,
+used by sox_format_tab_t.fn.
+@returns format handler information.
+*/
+typedef sox_format_handler_t const * (LSX_API * sox_format_fn_t)(void);
+
+/**
+Client API:
+Callback to get information about an effect handler,
+used by the table returned from sox_get_effect_fns(void).
+@returns Pointer to information about an effect handler.
+*/
+typedef sox_effect_handler_t const * (LSX_API *sox_effect_fn_t)(void);
+
+/**
+Client API:
+Callback to initialize reader (decoder), used by
+sox_format_handler.startread.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_startread)(
+    LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+    );
+
+/**
+Client API:
+Callback to read (decode) a block of samples,
+used by sox_format_handler.read.
+@returns number of samples read, or 0 if unsuccessful.
+*/
+typedef size_t (LSX_API * sox_format_handler_read)(
+    LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+    LSX_PARAM_OUT_CAP_POST_COUNT(len,return) sox_sample_t *buf, /**< Buffer from which to read samples. */
+    size_t len /**< Number of samples available in buf. */
+    );
+
+/**
+Client API:
+Callback to close reader (decoder),
+used by sox_format_handler.stopread.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_stopread)(
+    LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+    );
+
+/**
+Client API:
+Callback to initialize writer (encoder),
+used by sox_format_handler.startwrite.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_startwrite)(
+    LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+    );
+
+/**
+Client API:
+Callback to write (encode) a block of samples,
+used by sox_format_handler.write.
+@returns number of samples written, or 0 if unsuccessful.
+*/
+typedef size_t (LSX_API * sox_format_handler_write)(
+    LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+    LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf, /**< Buffer to which samples are written. */
+    size_t len /**< Capacity of buf, measured in samples. */
+    );
+
+/**
+Client API:
+Callback to close writer (decoder),
+used by sox_format_handler.stopwrite.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_stopwrite)(
+    LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+    );
+
+/**
+Client API:
+Callback to reposition reader,
+used by sox_format_handler.seek.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_seek)(
+    LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+    sox_uint64_t offset /**< Sample offset to which reader should be positioned. */
+    );
+
+/**
+Client API:
+Callback to parse command-line arguments (called once per effect),
+used by sox_effect_handler.getopts.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_getopts)(
+    LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect pointer. */
+    int argc, /**< Number of arguments in argv. */
+    LSX_PARAM_IN_COUNT(argc) char *argv[] /**< Array of command-line arguments. */
+    );
+
+/**
+Client API:
+Callback to initialize effect (called once per flow),
+used by sox_effect_handler.start.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_start)(
+    LSX_PARAM_INOUT sox_effect_t * effp /**< Effect pointer. */
+    );
+
+/**
+Client API:
+Callback to process samples,
+used by sox_effect_handler.flow.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_flow)(
+    LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect pointer. */
+    LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const * ibuf, /**< Buffer from which to read samples. */
+    LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t * obuf, /**< Buffer to which samples are written. */
+    LSX_PARAM_INOUT size_t *isamp, /**< On entry, contains capacity of ibuf; on exit, contains number of samples consumed. */
+    LSX_PARAM_INOUT size_t *osamp /**< On entry, contains capacity of obuf; on exit, contains number of samples written. */
+    );
+
+/**
+Client API:
+Callback to finish getting output after input is complete,
+used by sox_effect_handler.drain.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_drain)(
+    LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect pointer. */
+    LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t *obuf, /**< Buffer to which samples are written. */
+    LSX_PARAM_INOUT size_t *osamp /**< On entry, contains capacity of obuf; on exit, contains number of samples written. */
+    );
+
+/**
+Client API:
+Callback to shut down effect (called once per flow),
+used by sox_effect_handler.stop.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_stop)(
+    LSX_PARAM_INOUT sox_effect_t * effp /**< Effect pointer. */
+    );
+
+/**
+Client API:
+Callback to shut down effect (called once per effect),
+used by sox_effect_handler.kill.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_kill)(
+    LSX_PARAM_INOUT sox_effect_t * effp /**< Effect pointer. */
+    );
+
+/**
+Client API:
+Callback called while flow is running (called once per buffer),
+used by sox_flow_effects.callback.
+@returns SOX_SUCCESS to continue, other value to abort flow.
+*/
+typedef int (LSX_API * sox_flow_effects_callback)(
+    sox_bool all_done,
+    void * client_data
+    );
+
+/**
+Client API:
+Callback for enumerating the contents of a playlist,
+used by the sox_parse_playlist function.
+@returns SOX_SUCCESS if successful, any other value to abort playlist enumeration.
+*/
+typedef int (LSX_API * sox_playlist_callback_t)(
+    void * callback_data,
+    LSX_PARAM_IN_Z char const * filename
+    );
+
+/*****************************************************************************
+Structures:
+*****************************************************************************/
+
+/**
+Client API:
+Information about a build of libSoX, returned from the sox_version_info
+function.
+*/
+typedef struct sox_version_info_t {
+    size_t       size;         /**< structure size = sizeof(sox_version_info_t) */
+    sox_version_flags_t flags; /**< feature flags = popen | magic | threads | memopen */
+    sox_uint32_t version_code; /**< version number = 0x140400 */
+    char const * version;      /**< version string = sox_version(), for example, "14.4.0" */
+    char const * version_extra;/**< version extra info or null = "PACKAGE_EXTRA", for example, "beta" */
+    char const * time;         /**< build time = "__DATE__ __TIME__", for example, "Jan  7 2010 03:31:50" */
+    char const * distro;       /**< distro or null = "DISTRO", for example, "Debian" */
+    char const * compiler;     /**< compiler info or null, for example, "msvc 160040219" */
+    char const * arch;         /**< arch, for example, "1248 48 44 L OMP" */
+    /* new info should be added at the end for version backwards-compatibility. */
+} sox_version_info_t;
+
+/**
+Client API:
+Global parameters (for effects & formats), returned from the sox_get_globals
+function.
+*/
+typedef struct sox_globals_t {
+/* public: */
+  unsigned     verbosity; /**< messages are only written if globals.verbosity >= message.level */
+  sox_output_message_handler_t output_message_handler; /**< client-specified message output callback */
+  sox_bool     repeatable; /**< true to use pre-determined timestamps and PRNG seed */
+
+  /**
+  Default size (in bytes) used by libSoX for blocks of sample data.
+  Plugins should use similarly-sized buffers to get best performance.
+  */
+  size_t       bufsiz;
+
+  /**
+  Default size (in bytes) used by libSoX for blocks of input sample data.
+  Plugins should use similarly-sized buffers to get best performance.
+  */
+  size_t       input_bufsiz;
+
+  sox_int32_t  ranqd1; /**< Can be used to re-seed libSoX's PRNG */
+
+  char const * stdin_in_use_by;  /**< Private: tracks the name of the handler currently using stdin */
+  char const * stdout_in_use_by; /**< Private: tracks the name of the handler currently using stdout */
+  char const * subsystem;        /**< Private: tracks the name of the handler currently writing an output message */
+  char       * tmp_path;         /**< Private: client-configured path to use for temporary files */
+  sox_bool     use_magic;        /**< Private: true if client has requested use of 'magic' file-type detection */
+  sox_bool     use_threads;      /**< Private: true if client has requested parallel effects processing */
+} sox_globals_t;
+
+/**
+Client API:
+Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown.
+*/
+typedef struct sox_signalinfo_t {
+  sox_rate_t       rate;         /**< samples per second, 0 if unknown */
+  unsigned         channels;     /**< number of sound channels, 0 if unknown */
+  unsigned         precision;    /**< bits per sample, 0 if unknown */
+  sox_uint64_t     length;       /**< samples * chans in file, 0 if unknown, -1 if unspecified */
+  double           * mult;       /**< Effects headroom multiplier; may be null */
+} sox_signalinfo_t;
+
+/**
+Client API:
+Basic information about an encoding.
+*/
+typedef struct sox_encodings_info_t {
+  sox_encodings_flags_t flags; /**< lossy once (lossy1), lossy twice (lossy2), or lossless (none). */
+  char const * name;           /**< encoding name. */
+  char const * desc;           /**< encoding description. */
+} sox_encodings_info_t;
+
+/**
+Client API:
+Encoding parameters.
+*/
+typedef struct sox_encodinginfo_t {
+  sox_encoding_t encoding; /**< format of sample numbers */
+  unsigned bits_per_sample;/**< 0 if unknown or variable; uncompressed value if lossless; compressed value if lossy */
+  double compression;      /**< compression factor (where applicable) */
+
+  /**
+  Should bytes be reversed? If this is default during sox_open_read or
+  sox_open_write, libSoX will set them to either no or yes according to the
+  machine or format default.
+  */
+  sox_option_t reverse_bytes;
+
+  /**
+  Should nibbles be reversed? If this is default during sox_open_read or
+  sox_open_write, libSoX will set them to either no or yes according to the
+  machine or format default.
+  */
+  sox_option_t reverse_nibbles;
+
+  /**
+  Should bits be reversed? If this is default during sox_open_read or
+  sox_open_write, libSoX will set them to either no or yes according to the
+  machine or format default.
+  */
+  sox_option_t reverse_bits;
+
+  /**
+  If set to true, the format should reverse its default endianness.
+  */
+  sox_bool opposite_endian;
+} sox_encodinginfo_t;
+
+/**
+Client API:
+Looping parameters (out-of-band data).
+*/
+typedef struct sox_loopinfo_t {
+  sox_uint64_t  start;  /**< first sample */
+  sox_uint64_t  length; /**< length */
+  unsigned      count;  /**< number of repeats, 0=forever */
+  unsigned char type;   /**< 0=no, 1=forward, 2=forward/back (see sox_loop_* for valid values). */
+} sox_loopinfo_t;
+
+/**
+Client API:
+Instrument information.
+*/
+typedef struct sox_instrinfo_t{
+  signed char MIDInote;   /**< for unity pitch playback */
+  signed char MIDIlow;    /**< MIDI pitch-bend low range */
+  signed char MIDIhi;     /**< MIDI pitch-bend high range */
+  unsigned char loopmode; /**< 0=no, 1=forward, 2=forward/back (see sox_loop_* values) */
+  unsigned nloops;  /**< number of active loops (max SOX_MAX_NLOOPS). */
+} sox_instrinfo_t;
+
+/**
+Client API:
+File buffer info.  Holds info so that data can be read in blocks.
+*/
+typedef struct sox_fileinfo_t {
+  char          *buf;                 /**< Pointer to data buffer */
+  size_t        size;                 /**< Size of buffer in bytes */
+  size_t        count;                /**< Count read into buffer */
+  size_t        pos;                  /**< Position in buffer */
+} sox_fileinfo_t;
+
+/**
+Client API:
+Handler structure defined by each format.
+*/
+struct sox_format_handler_t {
+  unsigned     sox_lib_version_code;  /**< Checked on load; must be 1st in struct*/
+  char         const * description;   /**< short description of format */
+  char         const * const * names; /**< null-terminated array of filename extensions that are handled by this format */
+  unsigned int flags;                 /**< File flags (SOX_FILE_* values). */
+  sox_format_handler_startread startread; /**< called to initialize reader (decoder) */
+  sox_format_handler_read read;       /**< called to read (decode) a block of samples */
+  sox_format_handler_stopread stopread; /**< called to close reader (decoder); may be null if no closing necessary */
+  sox_format_handler_startwrite startwrite; /**< called to initialize writer (encoder) */
+  sox_format_handler_write write;     /**< called to write (encode) a block of samples */
+  sox_format_handler_stopwrite stopwrite; /**< called to close writer (decoder); may be null if no closing necessary */
+  sox_format_handler_seek seek;       /**< called to reposition reader; may be null if not supported */
+
+  /**
+  Array of values indicating the encodings and precisions supported for
+  writing (encoding). Precisions specified with default precision first.
+  Encoding, precision, precision, ..., 0, repeat. End with one more 0.
+  Example:
+  unsigned const * formats = {
+    SOX_ENCODING_SIGN2, 16, 24, 0, // Support SIGN2 at 16 and 24 bits, default to 16 bits.
+    SOX_ENCODING_UNSIGNED, 8, 0,   // Support UNSIGNED at 8 bits, default to 8 bits.
+    0 // No more supported encodings.
+  };
+  */
+  unsigned     const * write_formats;
+
+  /**
+  Array of sample rates (samples per second) supported for writing (encoding).
+  NULL if all (or almost all) rates are supported. End with 0.
+  */
+  sox_rate_t   const * write_rates;
+
+  /**
+  SoX will automatically allocate a buffer in which the handler can store data.
+  Specify the size of the buffer needed here. Usually this will be sizeof(your_struct).
+  The buffer will be allocated and zeroed before the call to startread/startwrite.
+  The buffer will be freed after the call to stopread/stopwrite.
+  The buffer will be provided via format.priv in each call to the handler.
+  */
+  size_t       priv_size;
+};
+
+/**
+Client API:
+Comments, instrument info, loop info (out-of-band data).
+*/
+typedef struct sox_oob_t{
+  /* Decoded: */
+  sox_comments_t   comments;              /**< Comment strings in id=value format. */
+  sox_instrinfo_t  instr;                 /**< Instrument specification */
+  sox_loopinfo_t   loops[SOX_MAX_NLOOPS]; /**< Looping specification */
+
+  /* TBD: Non-decoded chunks, etc: */
+} sox_oob_t;
+
+/**
+Client API:
+Data passed to/from the format handler
+*/
+struct sox_format_t {
+  char             * filename;      /**< File name */
+
+  /**
+  Signal specifications for reader (decoder) or writer (encoder):
+  sample rate, number of channels, precision, length, headroom multiplier.
+  Any info specified by the user is here on entry to startread or
+  startwrite. Info will be SOX_UNSPEC if the user provided no info.
+  At exit from startread, should be completely filled in, using
+  either data from the file's headers (if available) or whatever
+  the format is guessing/assuming (if header data is not available).
+  At exit from startwrite, should be completely filled in, using
+  either the data that was specified, or values chosen by the format
+  based on the format's defaults or capabilities.
+  */
+  sox_signalinfo_t signal;
+
+  /**
+  Encoding specifications for reader (decoder) or writer (encoder):
+  encoding (sample format), bits per sample, compression rate, endianness.
+  Should be filled in by startread. Values specified should be used
+  by startwrite when it is configuring the encoding parameters.
+  */
+  sox_encodinginfo_t encoding;
+
+  char             * filetype;      /**< Type of file, as determined by header inspection or libmagic. */
+  sox_oob_t        oob;             /**< comments, instrument info, loop info (out-of-band data) */
+  sox_bool         seekable;        /**< Can seek on this file */
+  char             mode;            /**< Read or write mode ('r' or 'w') */
+  sox_uint64_t     olength;         /**< Samples * chans written to file */
+  sox_uint64_t     clips;           /**< Incremented if clipping occurs */
+  int              sox_errno;       /**< Failure error code */
+  char             sox_errstr[256]; /**< Failure error text */
+  void             * fp;            /**< File stream pointer */
+  lsx_io_type      io_type;         /**< Stores whether this is a file, pipe or URL */
+  sox_uint64_t     tell_off;        /**< Current offset within file */
+  sox_uint64_t     data_start;      /**< Offset at which headers end and sound data begins (set by lsx_check_read_params) */
+  sox_format_handler_t handler;     /**< Format handler for this file */
+  void             * priv;          /**< Format handler's private data area */
+};
+
+/**
+Client API:
+Information about a loaded format handler, including the format name and a
+function pointer that can be invoked to get additional information about the
+format.
+*/
+typedef struct sox_format_tab_t {
+  char *name;         /**< Name of format handler */
+  sox_format_fn_t fn; /**< Function to call to get format handler's information */
+} sox_format_tab_t;
+
+/**
+Client API:
+Global parameters for effects.
+*/
+typedef struct sox_effects_globals_t {
+  sox_plot_t plot;         /**< To help the user choose effect & options */
+  sox_globals_t * global_info; /**< Pointer to associated SoX globals */
+} sox_effects_globals_t;
+
+/**
+Client API:
+Effect handler information.
+*/
+struct sox_effect_handler_t {
+  char const * name;  /**< Effect name */
+  char const * usage; /**< Short explanation of parameters accepted by effect */
+  unsigned int flags; /**< Combination of SOX_EFF_* flags */
+  sox_effect_handler_getopts getopts; /**< Called to parse command-line arguments (called once per effect). */
+  sox_effect_handler_start start;     /**< Called to initialize effect (called once per flow). */
+  sox_effect_handler_flow flow;       /**< Called to process samples. */
+  sox_effect_handler_drain drain;     /**< Called to finish getting output after input is complete. */
+  sox_effect_handler_stop stop;       /**< Called to shut down effect (called once per flow). */
+  sox_effect_handler_kill kill;       /**< Called to shut down effect (called once per effect). */
+  size_t       priv_size;             /**< Size of private data SoX should pre-allocate for effect */
+};
+
+/**
+Client API:
+Effect information.
+*/
+struct sox_effect_t {
+  sox_effects_globals_t    * global_info; /**< global effect parameters */
+  sox_signalinfo_t         in_signal;     /**< Information about the incoming data stream */
+  sox_signalinfo_t         out_signal;    /**< Information about the outgoing data stream */
+  sox_encodinginfo_t       const * in_encoding;  /**< Information about the incoming data encoding */
+  sox_encodinginfo_t       const * out_encoding; /**< Information about the outgoing data encoding */
+  sox_effect_handler_t     handler;   /**< The handler for this effect */
+  sox_sample_t             * obuf;    /**< output buffer */
+  size_t                   obeg;      /**< output buffer: start of valid data section */
+  size_t                   oend;      /**< output buffer: one past valid data section (oend-obeg is length of current content) */
+  size_t               imin;          /**< minimum input buffer content required for calling this effect's flow function; set via lsx_effect_set_imin() */
+  sox_uint64_t         clips;         /**< increment if clipping occurs */
+  size_t               flows;         /**< 1 if MCHAN, number of chans otherwise */
+  size_t               flow;          /**< flow number */
+  void                 * priv;        /**< Effect's private data area (each flow has a separate copy) */
+};
+
+/**
+Client API:
+Chain of effects to be applied to a stream.
+*/
+typedef struct sox_effects_chain_t {
+  sox_effect_t **effects;                  /**< Table of effects to be applied to a stream */
+  unsigned table_size;                     /**< Number of entries in effects table */
+  unsigned length;                         /**< Number of effects to be applied */
+  sox_sample_t **ibufc;                    /**< Channel interleave buffer */
+  sox_sample_t **obufc;                    /**< Channel interleave buffer */
+  sox_effects_globals_t global_info;       /**< Copy of global effects settings */
+  sox_encodinginfo_t const * in_enc;       /**< Input encoding */
+  sox_encodinginfo_t const * out_enc;      /**< Output encoding */
+} sox_effects_chain_t;
+
+/*****************************************************************************
+Functions:
+*****************************************************************************/
+
+/**
+Client API:
+Returns version number string of libSoX, for example, "14.4.0".
+@returns The version number string of libSoX, for example, "14.4.0".
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+char const *
+LSX_API
+sox_version(void);
+
+/**
+Client API:
+Returns information about this build of libsox.
+@returns Pointer to a version information structure.
+*/
+LSX_RETURN_VALID LSX_RETURN_PURE
+sox_version_info_t const *
+LSX_API
+sox_version_info(void);
+
+/**
+Client API:
+Returns a pointer to the structure with libSoX's global settings.
+@returns a pointer to the structure with libSoX's global settings.
+*/
+LSX_RETURN_VALID LSX_RETURN_PURE
+sox_globals_t *
+LSX_API
+sox_get_globals(void);
+
+/**
+Client API:
+Deprecated macro that returns the structure with libSoX's global settings
+as an lvalue.
+*/
+#define sox_globals (*sox_get_globals())
+
+/**
+Client API:
+Returns a pointer to the list of available encodings.
+End of list indicated by name == NULL.
+@returns pointer to the list of available encodings.
+*/
+LSX_RETURN_ARRAY LSX_RETURN_PURE
+sox_encodings_info_t const *
+LSX_API
+sox_get_encodings_info(void);
+
+/**
+Client API:
+Deprecated macro that returns the list of available encodings.
+End of list indicated by name == NULL.
+*/
+#define sox_encodings_info (sox_get_encodings_info())
+
+/**
+Client API:
+Fills in an encodinginfo with default values.
+*/
+void
+LSX_API
+sox_init_encodinginfo(
+    LSX_PARAM_OUT sox_encodinginfo_t * e /**< Pointer to uninitialized encoding info structure to be initialized. */
+    );
+
+/**
+Client API:
+Given an encoding (for example, SIGN2) and the encoded bits_per_sample (for
+example, 16), returns the number of useful bits per sample in the decoded data
+(for example, 16), or returns 0 to indicate that the value returned by the
+format handler should be used instead of a pre-determined precision.
+@returns the number of useful bits per sample in the decoded data (for example
+16), or returns 0 to indicate that the value returned by the format handler
+should be used instead of a pre-determined precision.
+*/
+LSX_RETURN_PURE
+unsigned
+LSX_API
+sox_precision(
+    sox_encoding_t encoding,   /**< Encoding for which to lookup precision information. */
+    unsigned bits_per_sample   /**< The number of encoded bits per sample. */
+    );
+
+/**
+Client API:
+Returns the number of items in the metadata block.
+@returns the number of items in the metadata block.
+*/
+size_t
+LSX_API
+sox_num_comments(
+    LSX_PARAM_IN_OPT sox_comments_t comments /**< Metadata block. */
+    );
+
+/**
+Client API:
+Adds an "id=value" item to the metadata block.
+*/
+void
+LSX_API
+sox_append_comment(
+    LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t * comments, /**< Metadata block. */
+    LSX_PARAM_IN_Z char const * item /**< Item to be added in "id=value" format. */
+    );
+
+/**
+Client API:
+Adds a newline-delimited list of "id=value" items to the metadata block.
+*/
+void
+LSX_API
+sox_append_comments(
+    LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t * comments, /**< Metadata block. */
+    LSX_PARAM_IN_Z char const * items /**< Newline-separated list of items to be added, for example "id1=value1\\nid2=value2". */
+    );
+
+/**
+Client API:
+Duplicates the metadata block.
+@returns the copied metadata block.
+*/
+LSX_RETURN_OPT
+sox_comments_t
+LSX_API
+sox_copy_comments(
+    LSX_PARAM_IN_OPT sox_comments_t comments /**< Metadata block to copy. */
+    );
+
+/**
+Client API:
+Frees the metadata block.
+*/
+void
+LSX_API
+sox_delete_comments(
+    LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NULL sox_comments_t * comments /**< Metadata block. */
+    );
+
+/**
+Client API:
+If "id=value" is found, return value, else return null.
+@returns value, or null if value not found.
+*/
+LSX_RETURN_OPT
+char const *
+LSX_API
+sox_find_comment(
+    LSX_PARAM_IN_OPT sox_comments_t comments, /**< Metadata block in which to search. */
+    LSX_PARAM_IN_Z char const * id /**< Id for which to search */
+    );
+
+/**
+Client API:
+Find and load format handler plugins.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_format_init(void);
+
+/**
+Client API:
+Unload format handler plugins.
+*/
+void
+LSX_API
+sox_format_quit(void);
+
+/**
+Client API:
+Initialize effects library.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_init(void);
+
+/**
+Client API:
+Close effects library and unload format handler plugins.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_quit(void);
+
+/**
+Client API:
+Returns the table of format handler names and functions.
+@returns the table of format handler names and functions.
+*/
+LSX_RETURN_ARRAY LSX_RETURN_PURE
+sox_format_tab_t const *
+LSX_API
+sox_get_format_fns(void);
+
+/**
+Client API:
+Deprecated macro that returns the table of format handler names and functions.
+*/
+#define sox_format_fns (sox_get_format_fns())
+
+/**
+Client API:
+Opens a decoding session for a file. Returned handle must be closed with sox_close().
+@returns The handle for the new session, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_read(
+    LSX_PARAM_IN_Z   char               const * path,      /**< Path to file to be opened (required). */
+    LSX_PARAM_IN_OPT sox_signalinfo_t   const * signal,    /**< Information already known about audio stream, or NULL if none. */
+    LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,  /**< Information already known about sample encoding, or NULL if none. */
+    LSX_PARAM_IN_OPT_Z char             const * filetype   /**< Previously-determined file type, or NULL to auto-detect. */
+    );
+
+/**
+Client API:
+Opens a decoding session for a memory buffer. Returned handle must be closed with sox_close().
+@returns The handle for the new session, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_mem_read(
+    LSX_PARAM_IN_BYTECOUNT(buffer_size) void  * buffer,     /**< Pointer to audio data buffer (required). */
+    size_t                                      buffer_size,/**< Number of bytes to read from audio data buffer. */
+    LSX_PARAM_IN_OPT sox_signalinfo_t   const * signal,     /**< Information already known about audio stream, or NULL if none. */
+    LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,   /**< Information already known about sample encoding, or NULL if none. */
+    LSX_PARAM_IN_OPT_Z char             const * filetype    /**< Previously-determined file type, or NULL to auto-detect. */
+    );
+
+/**
+Client API:
+Returns true if the format handler for the specified file type supports the specified encoding.
+@returns true if the format handler for the specified file type supports the specified encoding.
+*/
+sox_bool
+LSX_API
+sox_format_supports_encoding(
+    LSX_PARAM_IN_OPT_Z char               const * path,       /**< Path to file to be examined (required if filetype is NULL). */
+    LSX_PARAM_IN_OPT_Z char               const * filetype,   /**< Previously-determined file type, or NULL to use extension from path. */
+    LSX_PARAM_IN       sox_encodinginfo_t const * encoding    /**< Encoding for which format handler should be queried. */
+    );
+
+/**
+Client API:
+Gets the format handler for a specified file type.
+@returns The found format handler, or null if not found.
+*/
+LSX_RETURN_OPT
+sox_format_handler_t const *
+LSX_API
+sox_write_handler(
+    LSX_PARAM_IN_OPT_Z char               const * path,         /**< Path to file (required if filetype is NULL). */
+    LSX_PARAM_IN_OPT_Z char               const * filetype,     /**< Filetype for which handler is needed, or NULL to use extension from path. */
+    LSX_PARAM_OUT_OPT  char               const * * filetype1   /**< Receives the filetype that was detected. Pass NULL if not needed. */
+    );
+
+/**
+Client API:
+Opens an encoding session for a file. Returned handle must be closed with sox_close().
+@returns The new session handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_write(
+    LSX_PARAM_IN_Z     char               const * path,     /**< Path to file to be written (required). */
+    LSX_PARAM_IN       sox_signalinfo_t   const * signal,   /**< Information about desired audio stream (required). */
+    LSX_PARAM_IN_OPT   sox_encodinginfo_t const * encoding, /**< Information about desired sample encoding, or NULL to use defaults. */
+    LSX_PARAM_IN_OPT_Z char               const * filetype, /**< Previously-determined file type, or NULL to auto-detect. */
+    LSX_PARAM_IN_OPT   sox_oob_t          const * oob,      /**< Out-of-band data to add to file, or NULL if none. */
+    LSX_PARAM_IN_OPT   sox_bool           (LSX_API * overwrite_permitted)(LSX_PARAM_IN_Z char const * filename) /**< Called if file exists to determine whether overwrite is ok. */
+    );
+
+/**
+Client API:
+Opens an encoding session for a memory buffer. Returned handle must be closed with sox_close().
+@returns The new session handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_mem_write(
+    LSX_PARAM_OUT_BYTECAP(buffer_size) void                     * buffer,      /**< Pointer to audio data buffer that receives data (required). */
+    LSX_PARAM_IN                       size_t                     buffer_size, /**< Maximum number of bytes to write to audio data buffer. */
+    LSX_PARAM_IN                       sox_signalinfo_t   const * signal,      /**< Information about desired audio stream (required). */
+    LSX_PARAM_IN_OPT                   sox_encodinginfo_t const * encoding,    /**< Information about desired sample encoding, or NULL to use defaults. */
+    LSX_PARAM_IN_OPT_Z                 char               const * filetype,    /**< Previously-determined file type, or NULL to auto-detect. */
+    LSX_PARAM_IN_OPT                   sox_oob_t          const * oob          /**< Out-of-band data to add to file, or NULL if none. */
+    );
+
+/**
+Client API:
+Opens an encoding session for a memstream buffer. Returned handle must be closed with sox_close().
+@returns The new session handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_memstream_write(
+    LSX_PARAM_OUT      char                     * * buffer_ptr,    /**< Receives pointer to audio data buffer that receives data (required). */
+    LSX_PARAM_OUT      size_t                   * buffer_size_ptr, /**< Receives size of data written to audio data buffer (required). */
+    LSX_PARAM_IN       sox_signalinfo_t   const * signal,          /**< Information about desired audio stream (required). */
+    LSX_PARAM_IN_OPT   sox_encodinginfo_t const * encoding,        /**< Information about desired sample encoding, or NULL to use defaults. */
+    LSX_PARAM_IN_OPT_Z char               const * filetype,        /**< Previously-determined file type, or NULL to auto-detect. */
+    LSX_PARAM_IN_OPT   sox_oob_t          const * oob              /**< Out-of-band data to add to file, or NULL if none. */
+    );
+
+/**
+Client API:
+Reads samples from a decoding session into a sample buffer.
+@returns Number of samples decoded, or 0 for EOF.
+*/
+size_t
+LSX_API
+sox_read(
+    LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+    LSX_PARAM_OUT_CAP_POST_COUNT(len,return) sox_sample_t *buf, /**< Buffer from which to read samples. */
+    size_t len /**< Number of samples available in buf. */
+    );
+
+/**
+Client API:
+Writes samples to an encoding session from a sample buffer.
+@returns Number of samples encoded.
+*/
+size_t
+LSX_API
+sox_write(
+    LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+    LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf, /**< Buffer from which to read samples. */
+    size_t len /**< Number of samples available in buf. */
+    );
+
+/**
+Client API:
+Closes an encoding or decoding session.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_close(
+    LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+    );
+
+/**
+Client API:
+Sets the location at which next samples will be decoded. Returns SOX_SUCCESS if successful.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_seek(
+    LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+    sox_uint64_t offset, /**< Sample offset at which to position reader. */
+    int whence /**< Set to SOX_SEEK_SET. */
+    );
+
+/**
+Client API:
+Finds a format handler by name.
+@returns Format handler data, or null if not found.
+*/
+LSX_RETURN_OPT
+sox_format_handler_t const *
+LSX_API
+sox_find_format(
+    LSX_PARAM_IN_Z char const * name, /**< Name of format handler to find. */
+    sox_bool ignore_devices /**< Set to true to ignore device names. */
+    );
+
+/**
+Client API:
+Returns global parameters for effects
+@returns global parameters for effects.
+*/
+LSX_RETURN_VALID LSX_RETURN_PURE
+sox_effects_globals_t *
+LSX_API
+sox_get_effects_globals(void);
+
+/**
+Client API:
+Deprecated macro that returns global parameters for effects.
+*/
+#define sox_effects_globals (*sox_get_effects_globals())
+
+/**
+Client API:
+Finds the effect handler with the given name.
+@returns Effect pointer, or null if not found.
+*/
+LSX_RETURN_OPT LSX_RETURN_PURE
+sox_effect_handler_t const *
+LSX_API
+sox_find_effect(
+    LSX_PARAM_IN_Z char const * name /**< Name of effect to find. */
+    );
+
+/**
+Client API:
+Creates an effect using the given handler.
+@returns The new effect, or null if not found.
+*/
+LSX_RETURN_OPT
+sox_effect_t *
+LSX_API
+sox_create_effect(
+    LSX_PARAM_IN sox_effect_handler_t const * eh /**< Handler to use for effect. */
+    );
+
+/**
+Client API:
+Applies the command-line options to the effect.
+@returns the number of arguments consumed.
+*/
+int
+LSX_API
+sox_effect_options(
+    LSX_PARAM_IN sox_effect_t *effp, /**< Effect pointer on which to set options. */
+    int argc, /**< Number of arguments in argv. */
+    LSX_PARAM_IN_COUNT(argc) char * const argv[] /**< Array of command-line options. */
+    );
+
+/**
+Client API:
+Returns an array containing the known effect handlers.
+@returns An array containing the known effect handlers.
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+sox_effect_fn_t const *
+LSX_API
+sox_get_effect_fns(void);
+
+/**
+Client API:
+Deprecated macro that returns an array containing the known effect handlers.
+*/
+#define sox_effect_fns (sox_get_effect_fns())
+
+/**
+Client API:
+Initializes an effects chain. Returned handle must be closed with sox_delete_effects_chain().
+@returns Handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_effects_chain_t *
+LSX_API
+sox_create_effects_chain(
+    LSX_PARAM_IN sox_encodinginfo_t const * in_enc, /**< Input encoding. */
+    LSX_PARAM_IN sox_encodinginfo_t const * out_enc /**< Output encoding. */
+    );
+
+/**
+Client API:
+Closes an effects chain.
+*/
+void
+LSX_API
+sox_delete_effects_chain(
+    LSX_PARAM_INOUT sox_effects_chain_t *ecp /**< Effects chain pointer. */
+    );
+
+/**
+Client API:
+Adds an effect to the effects chain, returns SOX_SUCCESS if successful.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_add_effect(
+    LSX_PARAM_INOUT sox_effects_chain_t * chain, /**< Effects chain to which effect should be added . */
+    LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect to be added. */
+    LSX_PARAM_INOUT sox_signalinfo_t * in, /**< Input format. */
+    LSX_PARAM_IN    sox_signalinfo_t const * out /**< Output format. */
+    );
+
+/**
+Client API:
+Runs the effects chain, returns SOX_SUCCESS if successful.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_flow_effects(
+    LSX_PARAM_INOUT  sox_effects_chain_t * chain, /**< Effects chain to run. */
+    LSX_PARAM_IN_OPT sox_flow_effects_callback callback, /**< Callback for monitoring flow progress. */
+    LSX_PARAM_IN_OPT void * client_data /**< Data to pass into callback. */
+    );
+
+/**
+Client API:
+Gets the number of clips that occurred while running an effects chain.
+@returns the number of clips that occurred while running an effects chain.
+*/
+sox_uint64_t
+LSX_API
+sox_effects_clips(
+    LSX_PARAM_IN sox_effects_chain_t * chain /**< Effects chain from which to read clip information. */
+    );
+
+/**
+Client API:
+Shuts down an effect (calls stop on each of its flows).
+@returns the number of clips from all flows.
+*/
+sox_uint64_t
+LSX_API
+sox_stop_effect(
+    LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp /**< Effect to stop. */
+    );
+
+/**
+Client API:
+Adds an already-initialized effect to the end of the chain.
+*/
+void
+LSX_API
+sox_push_effect_last(
+    LSX_PARAM_INOUT sox_effects_chain_t * chain, /**< Effects chain to which effect should be added. */
+    LSX_PARAM_INOUT sox_effect_t * effp /**< Effect to be added. */
+    );
+
+/**
+Client API:
+Removes and returns an effect from the end of the chain.
+@returns the removed effect, or null if no effects.
+*/
+LSX_RETURN_OPT
+sox_effect_t *
+LSX_API
+sox_pop_effect_last(
+    LSX_PARAM_INOUT sox_effects_chain_t *chain /**< Effects chain from which to remove an effect. */
+    );
+
+/**
+Client API:
+Shut down and delete an effect.
+*/
+void
+LSX_API
+sox_delete_effect(
+    LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp /**< Effect to be deleted. */
+    );
+
+/**
+Client API:
+Shut down and delete the last effect in the chain.
+*/
+void
+LSX_API
+sox_delete_effect_last(
+    LSX_PARAM_INOUT sox_effects_chain_t *chain /**< Effects chain from which to remove the last effect. */
+    );
+
+/**
+Client API:
+Shut down and delete all effects in the chain.
+*/
+void
+LSX_API
+sox_delete_effects(
+    LSX_PARAM_INOUT sox_effects_chain_t *chain /**< Effects chain from which to delete effects. */
+    );
+
+/**
+Client API:
+Gets the sample offset of the start of the trim, useful for efficiently
+skipping the part that will be trimmed anyway (get trim start, seek, then
+clear trim start).
+@returns the sample offset of the start of the trim.
+*/
+sox_uint64_t
+LSX_API
+sox_trim_get_start(
+    LSX_PARAM_IN sox_effect_t * effp /**< Trim effect. */
+    );
+
+/**
+Client API:
+Clears the start of the trim to 0.
+*/
+void
+LSX_API
+sox_trim_clear_start(
+    LSX_PARAM_INOUT sox_effect_t * effp /**< Trim effect. */
+    );
+
+/**
+Client API:
+Returns true if the specified file is a known playlist file type.
+@returns true if the specified file is a known playlist file type.
+*/
+sox_bool
+LSX_API
+sox_is_playlist(
+    LSX_PARAM_IN_Z char const * filename /**< Name of file to examine. */
+    );
+
+/**
+Client API:
+Parses the specified playlist file.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_parse_playlist(
+    LSX_PARAM_IN sox_playlist_callback_t callback, /**< Callback to call for each item in the playlist. */
+    void * p, /**< Data to pass to callback. */
+    LSX_PARAM_IN char const * const listname /**< Filename of playlist file. */
+    );
+
+/**
+Client API:
+Converts a SoX error code into an error string.
+@returns error string corresponding to the specified error code,
+or a generic message if the error code is not recognized.
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+char const *
+LSX_API
+sox_strerror(
+    int sox_errno /**< Error code to look up. */
+    );
+
+/**
+Client API:
+Gets the basename of the specified file; for example, the basename of
+"/a/b/c.d" would be "c".
+@returns the number of characters written to base_buffer, excluding the null,
+or 0 on failure.
+*/
+size_t
+LSX_API
+sox_basename(
+    LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len,return) char * base_buffer, /**< Buffer into which basename should be written. */
+    size_t base_buffer_len, /**< Size of base_buffer, in bytes. */
+    LSX_PARAM_IN_Z char const * filename /**< Filename from which to extract basename. */
+    );
+
+/*****************************************************************************
+Internal API:
+WARNING - The items in this section are subject to instability. They only
+exist in the public header because sox (the application) currently uses them.
+These may be changed or removed in future versions of libSoX.
+*****************************************************************************/
+
+/**
+Plugins API:
+Print a fatal error in libSoX.
+*/
+void
+LSX_API
+lsx_fail_impl(
+    LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+    ...)
+    LSX_PRINTF12;
+
+/**
+Plugins API:
+Print a warning in libSoX.
+*/
+void
+LSX_API
+lsx_warn_impl(
+    LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+    ...)
+    LSX_PRINTF12;
+
+/**
+Plugins API:
+Print an informational message in libSoX.
+*/
+void
+LSX_API
+lsx_report_impl(
+    LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+    ...)
+    LSX_PRINTF12;
+
+/**
+Plugins API:
+Print a debug message in libSoX.
+*/
+void
+LSX_API
+lsx_debug_impl(
+    LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+    ...)
+    LSX_PRINTF12;
+
+/**
+Plugins API:
+Report a fatal error in libSoX; printf-style arguments must follow.
+*/
+#define lsx_fail       sox_get_globals()->subsystem=__FILE__,lsx_fail_impl
+
+/**
+Plugins API:
+Report a warning in libSoX; printf-style arguments must follow.
+*/
+#define lsx_warn       sox_get_globals()->subsystem=__FILE__,lsx_warn_impl
+
+/**
+Plugins API:
+Report an informational message in libSoX; printf-style arguments must follow.
+*/
+#define lsx_report     sox_get_globals()->subsystem=__FILE__,lsx_report_impl
+
+/**
+Plugins API:
+Report a debug message in libSoX; printf-style arguments must follow.
+*/
+#define lsx_debug      sox_get_globals()->subsystem=__FILE__,lsx_debug_impl
+
+/**
+Plugins API:
+String name and integer values for enumerated types (type metadata), for use
+with LSX_ENUM_ITEM, lsx_find_enum_text, and lsx_find_enum_value.
+*/
+typedef struct lsx_enum_item {
+    char const *text; /**< String name of enumeration. */
+    unsigned value;   /**< Integer value of enumeration. */
+} lsx_enum_item;
+
+/**
+Plugins API:
+Declares a static instance of an lsx_enum_item structure in format
+{ "item", prefixitem }, for use in declaring lsx_enum_item[] arrays.
+@param prefix The prefix to prepend to the item in the enumeration symbolic name.
+@param item   The user-visible text name of the item (must also be a valid C symbol name).
+*/
+#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
+
+/**
+Plugins API:
+Flags for use with lsx_find_enum_item.
+*/
+enum
+{
+    lsx_find_enum_item_none = 0, /**< Default parameters (case-insensitive). */
+    lsx_find_enum_item_case_sensitive = 1 /**< Enable case-sensitive search. */
+};
+
+/**
+Plugins API:
+Looks up an enumeration by name in an array of lsx_enum_items.
+@returns the corresponding item, or null if not found.
+*/
+LSX_RETURN_OPT LSX_RETURN_PURE
+lsx_enum_item const *
+LSX_API
+lsx_find_enum_text(
+    LSX_PARAM_IN_Z char const * text, /**< Name of enumeration to find. */
+    LSX_PARAM_IN lsx_enum_item const * lsx_enum_items, /**< Array of items to search, with text == NULL for last item. */
+    int flags /**< Search flags: 0 (case-insensitive) or lsx_find_enum_item_case_sensitive (case-sensitive). */
+    );
+
+/**
+Plugins API:
+Looks up an enumeration by value in an array of lsx_enum_items.
+@returns the corresponding item, or null if not found.
+*/
+LSX_RETURN_OPT LSX_RETURN_PURE
+lsx_enum_item const *
+LSX_API
+lsx_find_enum_value(
+    unsigned value, /**< Enumeration value to find. */
+    LSX_PARAM_IN lsx_enum_item const * lsx_enum_items /**< Array of items to search, with text == NULL for last item. */
+    );
+
+/**
+Plugins API:
+Looks up a command-line argument in a set of enumeration names, showing an
+error message if the argument is not found in the set of names.
+@returns The enumeration value corresponding to the matching enumeration, or
+INT_MAX if the argument does not match any enumeration name.
+*/
+LSX_RETURN_PURE
+int
+LSX_API
+lsx_enum_option(
+    int c, /**< Option character to which arg is associated, for example with -a, c would be 'a'. */
+    LSX_PARAM_IN_Z char const * arg, /**< Argument to find in enumeration list. */
+    LSX_PARAM_IN lsx_enum_item const * items /**< Array of items to search, with text == NULL for last item. */
+    );
+
+/**
+Plugins API:
+Determines whether the specified string ends with the specified suffix (case-sensitive).
+@returns true if the specified string ends with the specified suffix.
+*/
+LSX_RETURN_PURE
+sox_bool
+LSX_API
+lsx_strends(
+    LSX_PARAM_IN_Z char const * str, /**< String to search. */
+    LSX_PARAM_IN_Z char const * end  /**< Suffix to search for. */
+    );
+
+/**
+Plugins API:
+Finds the file extension for a filename.
+@returns the file extension, not including the '.', or null if filename does
+not have an extension.
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+char const *
+LSX_API
+lsx_find_file_extension(
+    LSX_PARAM_IN_Z char const * pathname /**< Filename to search for extension. */
+    );
+
+/**
+Plugins API:
+Formats the specified number with up to three significant figures and adds a
+metric suffix in place of the exponent, such as 1.23G.
+@returns A static buffer with the formatted number, valid until the next time
+this function is called (note: not thread safe).
+*/
+LSX_RETURN_VALID_Z
+char const *
+LSX_API
+lsx_sigfigs3(
+    double number /**< Number to be formatted. */
+    );
+
+/**
+Plugins API:
+Formats the specified number as a percentage, showing up to three significant
+figures.
+@returns A static buffer with the formatted number, valid until the next time
+this function is called (note: not thread safe).
+*/
+LSX_RETURN_VALID_Z
+char const *
+LSX_API
+lsx_sigfigs3p(
+    double percentage /**< Number to be formatted. */
+    );
+
+/**
+Plugins API:
+Allocates, deallocates, or resizes; like C's realloc, except that this version
+terminates the running application if unable to allocate the requested memory.
+@returns New buffer, or null if buffer was freed.
+*/
+LSX_RETURN_OPT
+void *
+LSX_API
+lsx_realloc(
+    LSX_PARAM_IN_OPT void *ptr, /**< Pointer to be freed or resized, or null if allocating a new buffer. */
+    size_t newsize /**< New size for buffer, or 0 to free the buffer. */
+    );
+
+/**
+Plugins API:
+Like strcmp, except that the characters are compared without regard to case.
+@returns 0 (s1 == s2), negative (s1 < s2), or positive (s1 > s2).
+*/
+LSX_RETURN_PURE
+int
+LSX_API
+lsx_strcasecmp(
+    LSX_PARAM_IN_Z char const * s1, /**< First string. */
+    LSX_PARAM_IN_Z char const * s2  /**< Second string. */
+    );
+
+
+/**
+Plugins API:
+Like strncmp, except that the characters are compared without regard to case.
+@returns 0 (s1 == s2), negative (s1 < s2), or positive (s1 > s2).
+*/
+LSX_RETURN_PURE
+int
+LSX_API
+lsx_strncasecmp(
+    LSX_PARAM_IN_Z char const * s1, /**< First string. */
+    LSX_PARAM_IN_Z char const * s2, /**< Second string. */
+    size_t n /**< Maximum number of characters to examine. */
+    );
+
+/**
+Plugins API:
+Is option argument unsupported, required, or optional.
+*/
+typedef enum lsx_option_arg_t {
+    lsx_option_arg_none, /**< Option does not have an argument. */
+    lsx_option_arg_required, /**< Option requires an argument. */
+    lsx_option_arg_optional /**< Option can optionally be followed by an argument. */
+} lsx_option_arg_t;
+
+/**
+Plugins API:
+lsx_getopt_init options.
+*/
+typedef enum lsx_getopt_flags_t {
+    lsx_getopt_flag_none = 0,      /**< no flags (no output, not long-only) */
+    lsx_getopt_flag_opterr = 1,    /**< if set, invalid options trigger lsx_warn output */
+    lsx_getopt_flag_longonly = 2   /**< if set, recognize -option as a long option */
+} lsx_getopt_flags_t;
+
+/**
+Plugins API:
+lsx_getopt long option descriptor.
+*/
+typedef struct lsx_option_t {
+    char const *     name;    /**< Name of the long option. */
+    lsx_option_arg_t has_arg; /**< Whether the long option supports an argument and, if so, whether the argument is required or optional. */
+    int *            flag;    /**< Flag to set if argument is present. */
+    int              val;     /**< Value to put in flag if argument is present. */
+} lsx_option_t;
+
+/**
+Plugins API:
+lsx_getopt session information (initialization data and state).
+*/
+typedef struct lsx_getopt_t {
+    int                  argc;     /**< IN    argc:      Number of arguments in argv */
+    char * const *       argv;     /**< IN    argv:      Array of arguments */
+    char const *         shortopts;/**< IN    shortopts: Short option characters */
+    lsx_option_t const * longopts; /**< IN    longopts:  Array of long option descriptors */
+    lsx_getopt_flags_t   flags;    /**< IN    flags:     Flags for longonly and opterr */
+    char const *         curpos;   /**< INOUT curpos:    Maintains state between calls to lsx_getopt */
+    int                  ind;      /**< INOUT optind:    Maintains the index of next element to be processed */
+    int                  opt;      /**< OUT   optopt:    Receives the option character that caused error */
+    char const *         arg;      /**< OUT   optarg:    Receives the value of the option's argument */
+    int                  lngind;   /**< OUT   lngind:    Receives the index of the matched long option or -1 if not a long option */
+} lsx_getopt_t;
+
+/**
+Plugins API:
+Initializes an lsx_getopt_t structure for use with lsx_getopt.
+*/
+void
+LSX_API
+lsx_getopt_init(
+    LSX_PARAM_IN             int argc,                      /**< Number of arguments in argv */
+    LSX_PARAM_IN_COUNT(argc) char * const * argv,           /**< Array of arguments */
+    LSX_PARAM_IN_Z           char const * shortopts,        /**< Short options, for example ":abc:def::ghi" (+/- not supported) */
+    LSX_PARAM_IN_OPT         lsx_option_t const * longopts, /**< Array of long option descriptors */
+    LSX_PARAM_IN             lsx_getopt_flags_t flags,      /**< Flags for longonly and opterr */
+    LSX_PARAM_IN             int first,                     /**< First argv to check (usually 1) */
+    LSX_PARAM_OUT            lsx_getopt_t * state           /**< State object to be initialized */
+    );
+
+/**
+Plugins API:
+Gets the next option. Options are parameters that start with "-" or "--".
+If no more options, returns -1. If unrecognized short option, returns '?'.
+If a recognized short option is missing a required argument,
+return (shortopts[0]==':' ? ':' : '?'). If successfully recognized short
+option, return the recognized character. If successfully recognized long
+option, returns (option.flag ? 0 : option.val).
+Note: lsx_getopt does not permute the non-option arguments.
+@returns option character (short), val or 0 (long), or -1 (no more).
+*/
+int
+LSX_API
+lsx_getopt(
+    LSX_PARAM_INOUT lsx_getopt_t * state /**< The getopt state pointer. */
+    );
+
+/* WARNING END */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* SOX_H */
diff --git a/fdmdv2/tags/0.99-Beta/src/sox_biquad.c b/fdmdv2/tags/0.99-Beta/src/sox_biquad.c
new file mode 100644 (file)
index 0000000..f5a0913
--- /dev/null
@@ -0,0 +1,129 @@
+//==========================================================================
+// Name:            sox_biquad.h
+// Purpose:         Interface into Sox Biquad filters 
+// Created:         Dec 1, 2012
+// Authors:         David Rowe
+// 
+// To test:
+//          $ gcc sox_biquad.c -o sox_biquad -DSOX_BIQUAD_UNITTEST -Wall \
+//            /path/to/sox-14.4.0/src/.libs/libsox.a -lm -lsndfile
+//          $ ./sox_biquad
+//
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "sox.h"
+
+#include "sox_biquad.h"
+
+
+#define N_MAX 1024
+
+int lsx_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf,
+                    sox_sample_t *obuf, size_t *isamp, size_t *osamp);
+
+void sox_biquad_start(void)
+{
+    int r = sox_init();
+    assert(r == SOX_SUCCESS);
+}
+
+void sox_biquad_finish(void)
+{
+    sox_quit();
+}
+
+/*
+  Effect must be implemented by biquads.c in sox, arguments are just
+  like sox command line, for example:
+
+  char *argv[10];
+  argv[0] = "highpass"; argv[1]="1000"; argc=1;
+*/
+
+void *sox_biquad_create(int argc, const char *argv[])
+{
+    int ret;
+    sox_effect_t *e;
+    int (*start)(sox_effect_t *); /* function pointer to effect start func */
+    
+    e = sox_create_effect(sox_find_effect(argv[0])); assert(e != NULL);
+    ret = sox_effect_options(e, argc, (char * const*)&argv[1]);
+    assert(ret == SOX_SUCCESS);
+
+    start = e->handler.start;
+    e->in_signal.rate = 8000;     /* locked at FS=8000 Hz */
+    ret = start(e); assert(ret == SOX_SUCCESS);
+    
+    return (void *)e;
+}
+
+void sox_biquad_destroy(void *sbq) {
+    sox_effect_t *e = (sox_effect_t *)sbq;
+    free(e);
+}
+
+void sox_biquad_filter(void *sbq, short out[], short in[], int n)
+{
+    sox_effect_t *e = (sox_effect_t *)sbq;
+    sox_sample_t ibuf[N_MAX];
+    sox_sample_t obuf[N_MAX];
+    size_t isamp, osamp;
+    unsigned int clips;
+    SOX_SAMPLE_LOCALS; 
+    int i;
+
+    assert(n <= N_MAX);
+
+    clips = 0;
+    for(i=0; i<n; i++)
+        ibuf[i] = SOX_SIGNED_16BIT_TO_SAMPLE(in[i], clips);
+    isamp = osamp = (unsigned int)n;
+    lsx_biquad_flow(e, ibuf, obuf, &isamp, &osamp);
+    for(i=0; i<n; i++)
+        out[i] = SOX_SAMPLE_TO_SIGNED_16BIT(obuf[i], clips); 
+}
+
+
+#ifdef SOX_BIQUAD_UNITTEST
+#define N 20
+int main(void) {
+    void *sbq;
+    char *argv[10];
+    short in[N];
+    short out[N];
+    int   i, argc;;
+
+    for(i=0; i<N; i++)
+        in[i] = 0;
+    in[0] = 8000;
+
+    sox_biquad_start();
+    argv[0] = "highpass"; argv[1]="1000"; argc=1;
+    sbq = sox_biquad_create(argc, argv);
+
+    sox_biquad_filter(sbq, out, in, N);
+    for(i=0; i<N; i++)
+        printf("%d\n", out[i]);
+   
+    sox_biquad_destroy(sbq);
+    sox_biquad_finish();
+
+    return 0;
+}
+#endif
diff --git a/fdmdv2/tags/0.99-Beta/src/sox_biquad.h b/fdmdv2/tags/0.99-Beta/src/sox_biquad.h
new file mode 100644 (file)
index 0000000..f38de64
--- /dev/null
@@ -0,0 +1,40 @@
+//==========================================================================
+// Name:            sox_biquad.h
+// Purpose:         Interface into Sox Biquad filters 
+// Created:         Dec 1, 2012
+// Authors:         David Rowe
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+
+#ifndef __SOX_BIQUAD__
+#define __SOX_BIQUAD__
+
+#ifdef __cplusplus
+extern "C" {
+
+#endif
+
+void sox_biquad_start(void);
+void sox_biquad_finish(void);
+void *sox_biquad_create(int argc, const char *argv[]);
+void sox_biquad_destroy(void *sbq);
+void sox_biquad_filter(void *sbq, short out[], short in[], int n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/fdmdv2/tags/0.99-Beta/src/topFrame.cpp b/fdmdv2/tags/0.99-Beta/src/topFrame.cpp
new file mode 100644 (file)
index 0000000..54ea80a
--- /dev/null
@@ -0,0 +1,551 @@
+//==========================================================================
+// Name:            topFrame.cpp
+//
+// Purpose:         Implements simple wxWidgets application with GUI.
+// Created:         Apr. 9, 2012
+// Authors:         David Rowe, David Witten
+// 
+// License:
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU 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 General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================
+#include "topFrame.h"
+
+extern int g_playFileToMicInEventId;
+extern int g_recFileFromRadioEventId;
+extern int g_playFileFromRadioEventId;
+
+//=========================================================================
+// Code that lays out the main application window
+//=========================================================================
+TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(parent, id, title, pos, size, style)
+{
+    this->SetSizeHints(wxDefaultSize, wxDefaultSize);
+    this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+    this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT));
+    this->SetSizeHints(wxDefaultSize, wxDefaultSize);
+    this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+    this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT));
+    //=====================================================
+    // Menubar Setup
+    m_menubarMain = new wxMenuBar(wxMB_DOCKABLE);
+    file = new wxMenu();
+
+    wxMenuItem* m_menuItemOnTop;
+    m_menuItemOnTop = new wxMenuItem(file, wxID_ANY, wxString(_("On Top")) , _("Always Top Window"), wxITEM_NORMAL);
+    file->Append(m_menuItemOnTop);
+
+    wxMenuItem* m_menuItemExit;
+    m_menuItemExit = new wxMenuItem(file, ID_EXIT, wxString(_("E&xit")) , _("Exit Program"), wxITEM_NORMAL);
+    file->Append(m_menuItemExit);
+
+    m_menubarMain->Append(file, _("&File"));
+
+    tools = new wxMenu();
+    wxMenuItem* m_menuItemAudio;
+    m_menuItemAudio = new wxMenuItem(tools, wxID_ANY, wxString(_("&Audio Config")) , wxEmptyString, wxITEM_NORMAL);
+    tools->Append(m_menuItemAudio);
+
+    wxMenuItem* m_menuItemRigCtrlCfg;
+    m_menuItemRigCtrlCfg = new wxMenuItem(tools, wxID_ANY, wxString(_("&PTT Config")) , wxEmptyString, wxITEM_NORMAL);
+    tools->Append(m_menuItemRigCtrlCfg);
+
+    wxMenuItem* m_menuItemOptions;
+    m_menuItemOptions = new wxMenuItem(tools, wxID_ANY, wxString(_("Options")) , wxEmptyString, wxITEM_NORMAL);
+    tools->Append(m_menuItemOptions);
+
+    wxMenuItem* m_menuItemFilter;
+    m_menuItemFilter = new wxMenuItem(tools, wxID_ANY, wxString(_("&Filter")) , wxEmptyString, wxITEM_NORMAL);
+    tools->Append(m_menuItemFilter);
+
+    wxMenuItem* m_menuItemPlayFileToMicIn;
+    m_menuItemPlayFileToMicIn = new wxMenuItem(tools, wxID_ANY, wxString(_("Start/Stop Play File - Mic In")) , wxEmptyString, wxITEM_NORMAL);
+    g_playFileToMicInEventId = m_menuItemPlayFileToMicIn->GetId();
+    tools->Append(m_menuItemPlayFileToMicIn);
+
+    wxMenuItem* m_menuItemRecFileFromRadio;
+    m_menuItemRecFileFromRadio = new wxMenuItem(tools, wxID_ANY, wxString(_("Start/Stop Record File - From Radio")) , wxEmptyString, wxITEM_NORMAL);
+    g_recFileFromRadioEventId = m_menuItemRecFileFromRadio->GetId();
+    tools->Append(m_menuItemRecFileFromRadio);
+
+    wxMenuItem* m_menuItemPlayFileFromRadio;
+    m_menuItemPlayFileFromRadio = new wxMenuItem(tools, wxID_ANY, wxString(_("Start/Stop Play File - From Radio")) , wxEmptyString, wxITEM_NORMAL);
+    g_playFileFromRadioEventId = m_menuItemPlayFileFromRadio->GetId();
+    tools->Append(m_menuItemPlayFileFromRadio);
+    m_menubarMain->Append(tools, _("&Tools"));
+
+    help = new wxMenu();
+    wxMenuItem* m_menuItemHelpUpdates;
+    m_menuItemHelpUpdates = new wxMenuItem(help, wxID_ANY, wxString(_("Check for Updates")) , wxEmptyString, wxITEM_NORMAL);
+    help->Append(m_menuItemHelpUpdates);
+    m_menuItemHelpUpdates->Enable(false);
+
+    wxMenuItem* m_menuItemAbout;
+    m_menuItemAbout = new wxMenuItem(help, ID_ABOUT, wxString(_("&About")) , _("About this program"), wxITEM_NORMAL);
+    help->Append(m_menuItemAbout);
+
+    m_menubarMain->Append(help, _("&Help"));
+
+    this->SetMenuBar(m_menubarMain);
+
+    wxBoxSizer* bSizer1;
+    bSizer1 = new wxBoxSizer(wxHORIZONTAL);
+
+    //=====================================================
+    // Left side
+    //=====================================================
+    wxBoxSizer* leftSizer;
+    leftSizer = new wxBoxSizer(wxVERTICAL);
+
+    wxStaticBoxSizer* snrSizer;
+    snrSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("SNR")), wxVERTICAL);
+
+    //------------------------------
+    // S/N ratio Guage (vert. bargraph)
+    //------------------------------
+    m_gaugeSNR = new wxGauge(this, wxID_ANY, 25, wxDefaultPosition, wxSize(15,135), wxGA_SMOOTH|wxGA_VERTICAL);
+    m_gaugeSNR->SetToolTip(_("Displays signal to noise ratio in dB."));
+    snrSizer->Add(m_gaugeSNR, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 10);
+
+    //------------------------------
+    // Box for S/N ratio (Numeric)
+    //------------------------------
+    m_textSNR = new wxStaticText(this, wxID_ANY, wxT(" 0.0"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
+    snrSizer->Add(m_textSNR, 0, wxALIGN_CENTER_HORIZONTAL, 1);
+
+    //------------------------------
+    // S/N ratio slow Checkbox
+    //------------------------------
+    m_ckboxSNR = new wxCheckBox(this, wxID_ANY, _("Slow"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    m_ckboxSNR->SetToolTip(_("Smooth but slow SNR estimation"));
+    snrSizer->Add(m_ckboxSNR, 0, wxALIGN_CENTER_HORIZONTAL, 5);
+
+    leftSizer->Add(snrSizer, 2, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 1);
+
+    //------------------------------
+    // Sync  Indicator box
+    //------------------------------
+    wxStaticBoxSizer* sbSizer3_33;
+    sbSizer3_33 = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Sync")), wxVERTICAL);
+
+    m_rbSync = new wxRadioButton( this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+    m_rbSync->SetForegroundColour( wxColour( 255, 0, 0 ) );
+    sbSizer3_33->Add(m_rbSync, 0, wxALIGN_CENTER|wxALL, 1);
+    leftSizer->Add(sbSizer3_33,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    //------------------------------
+    // BER Frames box
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_ber;
+    sbSizer_ber = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Bit Error Rate")), wxVERTICAL);
+
+    m_BtnBerReset = new wxButton(this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, 0);
+    sbSizer_ber->Add(m_BtnBerReset, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+
+    m_textBits = new wxStaticText(this, wxID_ANY, wxT("Bits: 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
+    sbSizer_ber->Add(m_textBits, 0, wxALIGN_LEFT, 1);
+    m_textErrors = new wxStaticText(this, wxID_ANY, wxT("Errs: 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
+    sbSizer_ber->Add(m_textErrors, 0, wxALIGN_LEFT, 1);
+    m_textBER = new wxStaticText(this, wxID_ANY, wxT("BER: 0.0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
+    sbSizer_ber->Add(m_textBER, 0, wxALIGN_LEFT, 1);
+
+    leftSizer->Add(sbSizer_ber,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    //------------------------------
+    // Signal Level(vert. bargraph)
+    //------------------------------
+    wxStaticBoxSizer* levelSizer;
+    levelSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Level")), wxVERTICAL);
+
+    m_textLevel = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(60,-1), wxALIGN_CENTRE);
+    m_textLevel->SetForegroundColour(wxColour(255,0,0));
+    levelSizer->Add(m_textLevel, 0, wxALIGN_LEFT, 1);
+
+    m_gaugeLevel = new wxGauge(this, wxID_ANY, 100, wxDefaultPosition, wxSize(15,135), wxGA_SMOOTH|wxGA_VERTICAL);
+    m_gaugeLevel->SetToolTip(_("Peak of From Radio in Rx, or peak of From Mic in Tx mode.  If Red you should reduce your levels"));
+    levelSizer->Add(m_gaugeLevel, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 10);
+
+    leftSizer->Add(levelSizer, 2, wxALIGN_CENTER|wxALL|wxEXPAND, 1);
+
+    bSizer1->Add(leftSizer, 0, wxALL|wxEXPAND, 5);
+
+    //=====================================================
+    // Center Section
+    //=====================================================
+    wxBoxSizer* centerSizer;
+    centerSizer = new wxBoxSizer(wxVERTICAL);
+    wxBoxSizer* upperSizer;
+    upperSizer = new wxBoxSizer(wxVERTICAL);
+
+    //=====================================================
+    // Tabbed Notebook control containing display graphs
+    //=====================================================
+    //m_auiNbookCtrl = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM|wxAUI_NB_DEFAULT_STYLE);
+    //long style = wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_MIDDLE_CLICK_CLOSE;
+    long nb_style = wxAUI_NB_BOTTOM | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS;
+    m_auiNbookCtrl = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, nb_style);
+    // This line sets the fontsize for the tabs on the notebook control
+    m_auiNbookCtrl->SetFont(wxFont(8, 70, 90, 90, false, wxEmptyString));
+
+    upperSizer->Add(m_auiNbookCtrl, 1, wxALIGN_TOP|wxEXPAND, 1);
+    centerSizer->Add(upperSizer, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALIGN_TOP|wxEXPAND, 0);
+
+    // lower middle used for user ID
+
+    wxBoxSizer* lowerSizer;
+    lowerSizer = new wxBoxSizer(wxHORIZONTAL);
+
+    m_BtnCallSignReset = new wxButton(this, wxID_ANY, _("Clear"), wxDefaultPosition, wxDefaultSize, 0);
+    lowerSizer->Add(m_BtnCallSignReset, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+
+    wxBoxSizer* bSizer15;
+    bSizer15 = new wxBoxSizer(wxVERTICAL);
+    m_txtCtrlCallSign = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+    m_txtCtrlCallSign->SetToolTip(_("Call Sign of transmitting station will appear here"));
+    bSizer15->Add(m_txtCtrlCallSign, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5);
+    lowerSizer->Add(bSizer15, 1, wxEXPAND, 5);
+
+    wxStaticBoxSizer* sbSizer_Checksum = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Checksums")), wxHORIZONTAL);
+
+    wxStaticText *goodLabel = new wxStaticText(this, wxID_ANY, wxT("Good: "), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
+    sbSizer_Checksum->Add(goodLabel, 0, 0, 2);
+    m_txtChecksumGood = new wxStaticText(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxSize(30,-1), wxALIGN_CENTRE);
+    sbSizer_Checksum->Add(m_txtChecksumGood, 0, 0, 2);
+
+    wxStaticText *badLabel = new wxStaticText(this, wxID_ANY, wxT("Bad: "), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
+    sbSizer_Checksum->Add(badLabel, 0, 0, 1);
+    m_txtChecksumBad = new wxStaticText(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxSize(30,-1), wxALIGN_CENTRE);
+    sbSizer_Checksum->Add(m_txtChecksumBad, 0, 0, 1);
+
+    lowerSizer->Add(sbSizer_Checksum, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+
+    //=====================================================
+    // These are the buttons that autosend the userid (?)
+    //=====================================================
+
+    // DR 4 Dec - taken off for screen for Beta release to avoid questions on their use until
+    // we implement this feature
+ #ifdef UNIMPLEMENTED
+    wxBoxSizer* bSizer141;
+    bSizer141 = new wxBoxSizer(wxHORIZONTAL);
+
+    // TxID
+    //---------
+    m_togTxID = new wxToggleButton(this, wxID_ANY, _("TxID"), wxDefaultPosition, wxDefaultSize, 0);
+    m_togTxID->SetToolTip(_("Send Tx ID information"));
+    bSizer141->Add(m_togTxID, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+    // RxID
+    //---------
+    m_togRxID = new wxToggleButton(this, wxID_ANY, _("RxID"), wxDefaultPosition, wxDefaultSize, 0);
+    m_togRxID->SetToolTip(_("Enable reception of ID information"));
+    bSizer141->Add(m_togRxID, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_LEFT|wxALL|wxFIXED_MINSIZE, 5);
+
+    lowerSizer->Add(bSizer141, 0, wxALIGN_RIGHT, 5);
+#endif
+
+    centerSizer->Add(lowerSizer, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 2);
+    bSizer1->Add(centerSizer, 4, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 1);
+
+    //=====================================================
+    // Right side
+    //=====================================================
+    wxBoxSizer* rightSizer;
+    rightSizer = new wxBoxSizer(wxVERTICAL);
+
+    //=====================================================
+    // Squelch Slider Control
+    //=====================================================
+    wxStaticBoxSizer* sbSizer3;
+    sbSizer3 = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Squelch")), wxVERTICAL);
+
+    m_sliderSQ = new wxSlider(this, wxID_ANY, 0, 0, 40, wxDefaultPosition, wxSize(-1,80), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_VERTICAL);
+    m_sliderSQ->SetToolTip(_("Set Squelch level in dB."));
+
+    sbSizer3->Add(m_sliderSQ, 1, wxALIGN_CENTER_HORIZONTAL, 0);
+
+    //------------------------------
+    // Squelch Level static text box
+    //------------------------------
+    m_textSQ = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
+
+    sbSizer3->Add(m_textSQ, 0, wxALIGN_CENTER_HORIZONTAL, 0);
+
+    //------------------------------
+    // Squelch Toggle Checkbox
+    //------------------------------
+    m_ckboxSQ = new wxCheckBox(this, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+
+    sbSizer3->Add(m_ckboxSQ, 0, wxALIGN_CENTER_HORIZONTAL, 0);
+    rightSizer->Add(sbSizer3, 2, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 0);
+
+    //rightSizer->Add(sbSizer3_33,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    /* new --- */
+
+    //------------------------------
+    // Mode box
+    //------------------------------
+    wxStaticBoxSizer* sbSizer_mode;
+    sbSizer_mode = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Mode")), wxVERTICAL);
+
+#ifdef DISABLED_FEATURE
+    m_rb1400old = new wxRadioButton( this, wxID_ANY, wxT("1400 V0.91"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+    sbSizer_mode->Add(m_rb1400old, 0, wxALIGN_LEFT|wxALL, 1);
+    m_rb1400 = new wxRadioButton( this, wxID_ANY, wxT("1400"), wxDefaultPosition, wxDefaultSize, 0);
+    sbSizer_mode->Add(m_rb1400, 0, wxALIGN_LEFT|wxALL, 1);
+#endif
+    m_rb700 = new wxRadioButton( this, wxID_ANY, wxT("700"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+    sbSizer_mode->Add(m_rb700, 0, wxALIGN_LEFT|wxALL, 1);
+    m_rb1600 = new wxRadioButton( this, wxID_ANY, wxT("1600"), wxDefaultPosition, wxDefaultSize, 0);
+    sbSizer_mode->Add(m_rb1600, 0, wxALIGN_LEFT|wxALL, 1);
+    m_rb1600->SetValue(true);
+#ifdef DISABLED_FEATURE
+    m_rb1600Wide = new wxRadioButton( this, wxID_ANY, wxT("1600 Wide"), wxDefaultPosition, wxDefaultSize, 0);
+    sbSizer_mode->Add(m_rb1600Wide, 0, wxALIGN_LEFT|wxALL, 1);
+    m_rb2000 = new wxRadioButton( this, wxID_ANY, wxT("2000"), wxDefaultPosition, wxDefaultSize, 0);
+    sbSizer_mode->Add(m_rb2000, 0, wxALIGN_LEFT|wxALL, 1);
+#endif
+
+    rightSizer->Add(sbSizer_mode,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+    #ifdef MOVED_TO_OPTIONS_DIALOG
+    /* new --- */
+
+    //------------------------------
+    // Test Frames box
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_testFrames;
+    sbSizer_testFrames = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Test Frames")), wxVERTICAL);
+
+    m_ckboxTestFrame = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sbSizer_testFrames->Add(m_ckboxTestFrame, 0, wxALIGN_LEFT, 0);
+
+    rightSizer->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+    #endif
+
+    //=====================================================
+    // Control Toggles box
+    //=====================================================
+    wxStaticBoxSizer* sbSizer5;
+    sbSizer5 = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Control")), wxVERTICAL);
+    wxBoxSizer* bSizer1511;
+    bSizer1511 = new wxBoxSizer(wxVERTICAL);
+
+    //-------------------------------
+    // Stop/Stop signal processing (rx and tx)
+    //-------------------------------
+    m_togBtnOnOff = new wxToggleButton(this, wxID_ANY, _("Start"), wxDefaultPosition, wxDefaultSize, 0);
+    m_togBtnOnOff->SetToolTip(_("Begin/End receiving data."));
+    bSizer1511->Add(m_togBtnOnOff, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    sbSizer5->Add(bSizer1511, 0, wxEXPAND, 1);
+
+#ifdef UNIMPLEMENTED
+    //------------------------------
+    // Toggle Loopback button for RX
+    //------------------------------
+    wxBoxSizer* bSizer15113;
+    bSizer15113 = new wxBoxSizer(wxHORIZONTAL);
+    wxBoxSizer* bSizer15111;
+    bSizer15111 = new wxBoxSizer(wxVERTICAL);
+    wxSize wxSz = wxSize(44, 30);
+    m_togBtnLoopRx = new wxToggleButton(this, wxID_ANY, _("Loop\nRX"), wxDefaultPosition, wxSz, 0);
+    m_togBtnLoopRx->SetFont(wxFont(6, 70, 90, 90, false, wxEmptyString));
+    m_togBtnLoopRx->SetToolTip(_("Loopback Receive audio data."));
+
+    bSizer15111->Add(m_togBtnLoopRx, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
+
+    //sbSizer5->Add(bSizer15111, 0, wxEXPAND, 1);
+    bSizer15113->Add(bSizer15111, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
+
+    //------------------------------
+    // Toggle Loopback button for Tx
+    //------------------------------
+    wxBoxSizer* bSizer15112;
+    bSizer15112 = new wxBoxSizer(wxVERTICAL);
+    m_togBtnLoopTx = new wxToggleButton(this, wxID_ANY, _("Loop\nTX"), wxDefaultPosition, wxSz, 0);
+    m_togBtnLoopTx->SetFont(wxFont(6, 70, 90, 90, false, wxEmptyString));
+    m_togBtnLoopTx->SetToolTip(_("Loopback Transmit audio data."));
+
+    bSizer15112->Add(m_togBtnLoopTx, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
+    bSizer15113->Add(bSizer15112, 0,  wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
+
+    sbSizer5->Add(bSizer15113, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+#endif
+
+    //------------------------------
+    // Split Frequency Mode Toggle
+    //------------------------------
+    wxBoxSizer* bSizer151;
+    bSizer151 = new wxBoxSizer(wxVERTICAL);
+
+    m_togBtnSplit = new wxToggleButton(this, wxID_ANY, _("Split"), wxDefaultPosition, wxDefaultSize, 0);
+    m_togBtnSplit->SetToolTip(_("Toggle split frequency mode."));
+
+    bSizer151->Add(m_togBtnSplit, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    sbSizer5->Add(bSizer151, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 1);
+    wxBoxSizer* bSizer13;
+    bSizer13 = new wxBoxSizer(wxVERTICAL);
+
+    //------------------------------
+    // Analog Passthrough Toggle
+    //------------------------------
+    m_togBtnAnalog = new wxToggleButton(this, wxID_ANY, _("Analog"), wxDefaultPosition, wxDefaultSize, 0);
+    m_togBtnAnalog->SetToolTip(_("Toggle analog/digital operation."));
+    bSizer13->Add(m_togBtnAnalog, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    sbSizer5->Add(bSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+
+    // not implemented on fdmdv2
+#ifdef ALC
+    //------------------------------
+    // Toggle for ALC
+    //------------------------------
+    wxBoxSizer* bSizer14;
+    bSizer14 = new wxBoxSizer(wxVERTICAL);
+    m_togBtnALC = new wxToggleButton(this, wxID_ANY, _("ALC"), wxDefaultPosition, wxDefaultSize, 0);
+    m_togBtnALC->SetToolTip(_("Toggle automatic level control mode."));
+
+    bSizer14->Add(m_togBtnALC, 0, wxALL, 1);
+    sbSizer5->Add(bSizer14, 0, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALL, 1);
+#endif
+
+    //------------------------------
+    // Toggle Transmit/Receive relays
+    //------------------------------
+    wxBoxSizer* bSizer11;
+    bSizer11 = new wxBoxSizer(wxVERTICAL);
+    m_btnTogPTT = new wxToggleButton(this, wxID_ANY, _("PTT"), wxDefaultPosition, wxDefaultSize, 0);
+    m_btnTogPTT->SetToolTip(_("Push to Talk - Switch between Receive and Transmit - you can also use the space bar "));
+    bSizer11->Add(m_btnTogPTT, 1, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    sbSizer5->Add(bSizer11, 2, wxEXPAND, 1);
+    rightSizer->Add(sbSizer5, 2, wxALIGN_CENTER|wxALL|wxEXPAND, 3);
+    bSizer1->Add(rightSizer, 0, wxALL|wxEXPAND, 3);
+    this->SetSizer(bSizer1);
+    this->Layout();
+    m_statusBar1 = this->CreateStatusBar(3, wxST_SIZEGRIP, wxID_ANY);
+
+    //=====================================================
+    // End of layout
+    //=====================================================
+
+    //-------------------
+    // Connect Events
+    //-------------------
+    this->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(TopFrame::topFrame_OnClose));
+    this->Connect(wxEVT_PAINT, wxPaintEventHandler(TopFrame::topFrame_OnPaint));
+    this->Connect(wxEVT_SIZE, wxSizeEventHandler(TopFrame::topFrame_OnSize));
+    this->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::topFrame_OnUpdateUI));
+
+    this->Connect(m_menuItemExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnExit));
+    this->Connect(m_menuItemOnTop->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnTop));
+
+    this->Connect(m_menuItemAudio->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsAudio));
+    this->Connect(m_menuItemAudio->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsAudioUI));
+    this->Connect(m_menuItemFilter->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsFilter));
+    this->Connect(m_menuItemFilter->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsFilterUI));
+    this->Connect(m_menuItemRigCtrlCfg->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsComCfg));
+    this->Connect(m_menuItemRigCtrlCfg->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsComCfgUI));
+    this->Connect(m_menuItemOptions->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsOptions));
+    this->Connect(m_menuItemOptions->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsOptionsUI));
+
+    this->Connect(m_menuItemPlayFileToMicIn->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileToMicIn));
+    this->Connect(m_menuItemRecFileFromRadio->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnRecFileFromRadio));
+    this->Connect(m_menuItemPlayFileFromRadio->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileFromRadio));
+
+    this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpCheckUpdates));
+    this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
+    this->Connect(m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpAbout));
+    //m_togRxID->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnRxID), NULL, this);
+    //m_togTxID->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnTxID), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_TOP, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(TopFrame::OnSliderScrollBottom), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(TopFrame::OnCmdSliderScrollChanged), NULL, this);
+    m_sliderSQ->Connect(wxEVT_SCROLL_TOP, wxScrollEventHandler(TopFrame::OnSliderScrollTop), NULL, this);
+    m_ckboxSQ->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(TopFrame::OnCheckSQClick), NULL, this);
+
+    m_ckboxSNR->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(TopFrame::OnCheckSNRClick), NULL, this);
+
+    m_togBtnOnOff->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnOnOff), NULL, this);
+    m_togBtnSplit->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnSplitClick), NULL, this);
+    m_togBtnAnalog->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnAnalogClick), NULL, this);
+#ifdef ALC
+    m_togBtnALC->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnALCClick), NULL, this);
+#endif
+    m_btnTogPTT->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnPTT), NULL, this);
+
+    m_BtnCallSignReset->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnCallSignReset), NULL, this);
+    m_BtnBerReset->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnBerReset), NULL, this);
+}
+
+TopFrame::~TopFrame()
+{
+    //-------------------
+    // Disconnect Events
+    //-------------------
+    this->Disconnect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(TopFrame::topFrame_OnClose));
+    this->Disconnect(wxEVT_PAINT, wxPaintEventHandler(TopFrame::topFrame_OnPaint));
+    this->Disconnect(wxEVT_SIZE, wxSizeEventHandler(TopFrame::topFrame_OnSize));
+    this->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::topFrame_OnUpdateUI));
+    this->Disconnect(ID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnExit));
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsAudio));
+    this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsAudioUI));
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsFilter));
+    this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsFilterUI));
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsComCfg));
+    this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsComCfgUI));
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsOptions));
+    this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsOptionsUI));
+
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileToMicIn));
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnRecFileFromRadio));
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileFromRadio));
+
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpCheckUpdates));
+    this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
+    this->Disconnect(ID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpAbout));
+    //m_togRxID->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnRxID), NULL, this);
+    //m_togTxID->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnTxID), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_TOP, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(TopFrame::OnCmdSliderScroll), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(TopFrame::OnSliderScrollBottom), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(TopFrame::OnCmdSliderScrollChanged), NULL, this);
+    m_sliderSQ->Disconnect(wxEVT_SCROLL_TOP, wxScrollEventHandler(TopFrame::OnSliderScrollTop), NULL, this);
+    m_ckboxSQ->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(TopFrame::OnCheckSQClick), NULL, this);
+
+    m_togBtnOnOff->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnOnOff), NULL, this);
+    m_togBtnSplit->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnSplitClick), NULL, this);
+    m_togBtnAnalog->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnAnalogClick), NULL, this);
+#ifdef ALC
+    m_togBtnALC->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnALCClick), NULL, this);
+#endif
+    m_btnTogPTT->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnPTT), NULL, this);
+
+}
+
diff --git a/fdmdv2/tags/0.99-Beta/src/topFrame.h b/fdmdv2/tags/0.99-Beta/src/topFrame.h
new file mode 100644 (file)
index 0000000..4341315
--- /dev/null
@@ -0,0 +1,183 @@
+//==========================================================================
+// Name:            topFrame.h
+//
+// Purpose:         Implements simple wxWidgets application with GUI.
+// Created:         Apr. 9, 2012
+// Authors:         David Rowe, David Witten
+//
+// License:
+//
+//  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 __TOPFRAME_H__
+#define __TOPFRAME_H__
+
+#include "version.h"
+#include <wx/artprov.h>
+#include <wx/xrc/xmlres.h>
+#include <wx/intl.h>
+#include <wx/string.h>
+#include <wx/bitmap.h>
+#include <wx/image.h>
+#include <wx/icon.h>
+#include <wx/menu.h>
+#include <wx/gdicmn.h>
+#include <wx/font.h>
+#include <wx/colour.h>
+#include <wx/settings.h>
+#include <wx/gauge.h>
+#include <wx/textctrl.h>
+#include <wx/sizer.h>
+#include <wx/statbox.h>
+#include <wx/aui/auibook.h>
+#include <wx/tglbtn.h>
+#include <wx/slider.h>
+#include <wx/checkbox.h>
+#include <wx/statusbr.h>
+#include <wx/frame.h>
+#include <wx/statbmp.h>
+#include <wx/stattext.h>
+#include <wx/button.h>
+#include <wx/dialog.h>
+#include <wx/radiobut.h>
+#include <wx/combobox.h>
+#include <wx/panel.h>
+#include <wx/listbox.h>
+#include <wx/notebook.h>
+#include <wx/listctrl.h>
+
+
+///////////////////////////////////////////////////////////////////////////
+
+#define ID_OPEN 1000
+#define ID_SAVE 1001
+#define ID_CLOSE 1002
+#define ID_EXIT 1003
+#define ID_COPY 1004
+#define ID_CUT 1005
+#define ID_PASTE 1006
+#define ID_OPTIONS 1007
+#define ID_ABOUT 1008
+
+///////////////////////////////////////////////////////////////////////////////
+/// Class TopFrame
+///////////////////////////////////////////////////////////////////////////////
+class TopFrame : public wxFrame
+{
+    private:
+
+    protected:
+        wxMenuBar* m_menubarMain;
+        wxMenu* file;
+        wxMenu* edit;
+        wxMenu* tools;
+        wxMenu* help;
+        wxGauge* m_gaugeSNR;
+        wxStaticText* m_textSNR;
+        wxCheckBox* m_ckboxSNR;
+        wxGauge* m_gaugeLevel;
+        wxStaticText* m_textLevel;
+
+        wxButton*     m_BtnCallSignReset;
+        wxTextCtrl*   m_txtCtrlCallSign;
+        wxStaticText* m_txtChecksumGood;
+        wxStaticText* m_txtChecksumBad;
+
+        wxSlider* m_sliderSQ;
+        wxCheckBox* m_ckboxSQ;
+        wxStaticText* m_textSQ;
+        wxStatusBar* m_statusBar1;
+
+        wxButton*     m_BtnBerReset;
+        wxStaticText  *m_textBits;
+        wxStaticText  *m_textErrors;
+        wxStaticText  *m_textBER;
+
+        wxRadioButton *m_rbSync;
+        wxRadioButton *m_rb1400old;
+        wxRadioButton *m_rb1400;
+        wxRadioButton *m_rb700;
+        wxRadioButton *m_rb1600;
+        wxRadioButton *m_rb2000;
+        wxRadioButton *m_rb1600Wide;
+
+        // Virtual event handlers, overide them in your derived class
+        virtual void topFrame_OnClose( wxCloseEvent& event ) { event.Skip(); }
+        virtual void topFrame_OnPaint( wxPaintEvent& event ) { event.Skip(); }
+        virtual void topFrame_OnSize( wxSizeEvent& event ) { event.Skip(); }
+        virtual void topFrame_OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
+
+        virtual void OnExit( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTop( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnToolsAudio( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnToolsAudioUI( wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnToolsFilter( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnToolsFilterUI( wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnToolsOptions( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnToolsUDP( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnToolsOptionsUI( wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnToolsComCfg( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnToolsComCfgUI( wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnPlayFileToMicIn( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnRecFileFromRadio( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnPlayFileFromRadio( wxCommandEvent& event ) { event.Skip(); }
+
+        virtual void OnHelpCheckUpdates( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnHelpCheckUpdatesUI( wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnHelpAbout( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnRxID( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnTxID( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnCmdSliderScroll( wxScrollEvent& event ) { event.Skip(); }
+        virtual void OnSliderScrollBottom( wxScrollEvent& event ) { event.Skip(); }
+        virtual void OnCmdSliderScrollChanged( wxScrollEvent& event ) { event.Skip(); }
+        virtual void OnSliderScrollTop( wxScrollEvent& event ) { event.Skip(); }
+        virtual void OnCheckSQClick( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnCheckSNRClick( wxCommandEvent& event ) { event.Skip(); }
+
+        virtual void OnTogBtnLoopRx( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnLoopTx( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnOnOff( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnSplitClick( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnAnalogClick( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnALCClick( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnPTT( wxCommandEvent& event ) { event.Skip(); }
+
+        virtual void OnTogBtnSplitClickUI(wxUpdateUIEvent& event) { event.Skip(); }
+        virtual void OnTogBtnAnalogClickUI(wxUpdateUIEvent& event) { event.Skip(); }
+        virtual void OnTogBtnALCClickUI(wxUpdateUIEvent& event) { event.Skip(); }
+        virtual void OnTogBtnRxIDUI(wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnTxIDUI(wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnPTT_UI(wxUpdateUIEvent& event ) { event.Skip(); }
+        virtual void OnTogBtnOnOffUI(wxUpdateUIEvent& event ) { event.Skip(); }
+
+        virtual void OnCallSignReset( wxCommandEvent& event ) { event.Skip(); }
+        virtual void OnBerReset( wxCommandEvent& event ) { event.Skip(); }
+
+    public:
+        wxToggleButton* m_togRxID;
+        wxToggleButton* m_togTxID;
+        wxToggleButton* m_togBtnOnOff;
+        wxToggleButton* m_togBtnSplit;
+        wxToggleButton* m_togBtnAnalog;
+        wxToggleButton* m_togBtnALC;
+        wxToggleButton* m_btnTogPTT;
+        wxToggleButton* m_togBtnLoopRx;
+        wxToggleButton* m_togBtnLoopTx;
+        wxAuiNotebook* m_auiNbookCtrl;
+
+        TopFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeDV ") + _(FREEDV_VERSION), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(561,300 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
+
+        ~TopFrame();
+};
+
+#endif //__TOPFRAME_H__