comparison FChTransformF0gram.cpp @ 12:fc8f351d2cd6 perf

Remove further unused
author Chris Cannam
date Tue, 02 Oct 2018 13:49:23 +0100
parents af59167b3d35
children 44b86c346a5a
comparison
equal deleted inserted replaced
11:36c99e4c7e94 12:fc8f351d2cd6
31 31
32 m_fs = inputSampleRate; 32 m_fs = inputSampleRate;
33 // max frequency of interest (Hz) 33 // max frequency of interest (Hz)
34 m_fmax = 10000.f; 34 m_fmax = 10000.f;
35 // warping parameters 35 // warping parameters
36 m_warp_params.nsamps_twarp = 2048; 36 m_warp_params.nsamps_twarp = 2048;
37 //m_warp_params.nsamps_twarp = 8; 37 //m_warp_params.nsamps_twarp = 8;
38 m_warp_params.alpha_max = 4; 38 m_warp_params.alpha_max = 4;
39 m_warp_params.num_warps = 21; 39 m_warp_params.num_warps = 21;
40 //m_warp_params.num_warps = 11; 40 //m_warp_params.num_warps = 11;
41 m_warp_params.fact_over_samp = 2; 41 m_warp_params.fact_over_samp = 2;
529 529
530 /* initialise m_glogs_params */ 530 /* initialise m_glogs_params */
531 design_GLogS(); 531 design_GLogS();
532 532
533 /* design of FChT */ 533 /* design of FChT */
534 // design_fcht(m_warps, m_accums, m_f0s)
535 design_FChT(); 534 design_FChT();
536
537 design_FFT();
538 535
539 design_LPF(); 536 design_LPF();
540 537
541 design_time_window(); 538 design_time_window();
542 539
637 } 634 }
638 } 635 }
639 } 636 }
640 637
641 void 638 void
642 FChTransformF0gram::design_FFT() {
643 in = (fftw_complex*) fftw_malloc(sizeof (fftw_complex) * m_nfft);
644 out = (fftw_complex*) fftw_malloc(sizeof (fftw_complex) * m_nfft);
645 //TODO verificar que el tipo de datos de in_window es del tipo double, era float.
646 in_window = (double*) fftw_malloc(sizeof (double) * m_nfft);
647 planFFT = fftw_plan_dft_1d(m_nfft, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
648
649 //TODO hacer diseño del FFT para el filtrado pasabajos.
650
651 }
652
653 void
654 FChTransformF0gram::design_FChT() { 639 FChTransformF0gram::design_FChT() {
655 640
656 /* 641 /*
657 * FILES FOR DEBUGGING 642 * FILES FOR DEBUGGING
658 */ 643 */
938 923
939 // Clear buffers, reset stored values, etc 924 // Clear buffers, reset stored values, etc
940 925
941 delete [] m_warpings.pos_int; 926 delete [] m_warpings.pos_int;
942 delete [] m_warpings.pos_frac; 927 delete [] m_warpings.pos_frac;
943
944 fftw_destroy_plan(planFFT);
945 fftw_free(in);
946 fftw_free(out);
947 928
948 clean_LPF(); 929 clean_LPF();
949 930
950 delete [] m_timeWindow; 931 delete [] m_timeWindow;
951 932
1026 apply_LPF(); 1007 apply_LPF();
1027 // Señal filtrada queda en LPF_time 1008 // Señal filtrada queda en LPF_time
1028 1009
1029 Feature feature; 1010 Feature feature;
1030 feature.hasTimestamp = false; 1011 feature.hasTimestamp = false;
1031
1032
1033 /* Solo a modo de prueba, voy a poner la salida del filtrado en «in» y
1034 voy a mostrar la FFT de eso, para ver el efecto del filtrado. */
1035 // for (int i = 0; i < m_nfft; i++) {
1036 // in[i][0] = tbuf[i];
1037 // in[i][1] = 0;
1038 // }
1039 // fftw_execute(planFFT);
1040 // double real, imag;
1041 // for (int i=0; i<n; ++i) { // preincremento?? ver version de nacho
1042 // real = out[i][0];
1043 // imag = out[i][1];
1044 // feature.values.push_back(real*real + imag*imag);
1045 // }
1046 // fs[0].push_back(feature);
1047
1048 // float real;
1049 // float imag;
1050 // for (int i=0; i<m_blockSize/2+1; i++) {
1051 // real = (float)(LPF_frequency[i][0]);
1052 // imag = (float)(LPF_frequency[i][1]);
1053 // feature.values.push_back(real*real+imag*imag);
1054 // //feature.values.push_back((float)(mp_LPFWindow[i]));
1055 // }
1056 1012
1057 // ---------------------------------------------------------------------------------------------- 1013 // ----------------------------------------------------------------------------------------------
1058 // Hanning window & FFT for all warp directions 1014 // Hanning window & FFT for all warp directions
1059 1015
1060 double max_glogs = -DBL_MAX; 1016 double max_glogs = -DBL_MAX;