Beispiel #1
0
        public OutbandPowerSpectrumSignal(int nsize)
        {
            this.block_size = nsize;

            this.window      = new float[nsize];
            this.ps_results  = new float[nsize * 2];
            this.ps_average  = new float[nsize * 2];
            this.filt_design = new FilterDesigner();

            filt_design.makewindow(WindowType_e.BLACKMANHARRIS_WINDOW,
                                   nsize,
                                   ref window);

            this.ps_cpx  = new CPX[nsize * 2];
            this.tmp_cpx = new CPX[nsize * 2];

            h_ps   = GCHandle.Alloc(ps_cpx, GCHandleType.Pinned);
            h_temp = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx_1 out: ps_cpx
            plan_fwd_ps = FFTW.dft_1d(nsize * 2,
                                      h_temp.AddrOfPinnedObject(),
                                      h_ps.AddrOfPinnedObject(),
                                      FFTW.fftw_direction.Forward,
                                      FFTW.fftw_flags.Measure);
        }
        public PowerSpectrumSignal(ref DSPBuffer dsp_buffer_obj)
        {
            this.d = dsp_buffer_obj;
            this.s = d.State;

            this.sample_rate  = s.DSPSampleRate;
            this.block_size   = s.DSPBlockSize;
            this.strobe_count = (int)this.sample_rate / (this.block_size * this.rate);

            this.window      = new float[s.DSPBlockSize];
            this.ps_results  = new float[s.DSPBlockSize * 2];
            this.ps_average  = new float[s.DSPBlockSize * 2];
            this.filt_design = new FilterDesigner();

            filt_design.makewindow(WindowType_e.BLACKMANHARRIS_WINDOW,
                                   s.DSPBlockSize,
                                   ref window);

            this.ps_cpx  = new CPX[s.DSPBlockSize * 2];
            this.tmp_cpx = new CPX[s.DSPBlockSize * 2];

            h_ps   = GCHandle.Alloc(ps_cpx, GCHandleType.Pinned);
            h_temp = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx_1 out: ps_cpx
            plan_fwd_ps = FFTW.dft_1d(s.DSPBlockSize * 2,
                                      h_temp.AddrOfPinnedObject(),
                                      h_ps.AddrOfPinnedObject(),
                                      FFTW.fftw_direction.Forward,
                                      FFTW.fftw_flags.Measure);
        }
Beispiel #3
0
        public OutbandPowerSpectrumSignal(ref DSPBuffer dsp_buffer_obj, WindowType_e filterType)
        {
            this.d = dsp_buffer_obj;
            this.s = d.State;

            this.block_size = s.DSPBlockSize;

            this.window      = new float[s.DSPBlockSize];
            this.ps_results  = new float[s.DSPBlockSize * 2];
            this.ps_average  = new float[s.DSPBlockSize * 2];
            this.filt_design = new FilterDesigner();

            filt_design.makewindow(filterType,
                                   s.DSPBlockSize,
                                   ref window);

            this.ps_cpx  = new CPX[s.DSPBlockSize * 2];
            this.tmp_cpx = new CPX[s.DSPBlockSize * 2];

            h_ps   = GCHandle.Alloc(ps_cpx, GCHandleType.Pinned);
            h_temp = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx_1 out: ps_cpx
            plan_fwd_ps = FFTW.dft_1d(s.DSPBlockSize * 2,
                                      h_temp.AddrOfPinnedObject(),
                                      h_ps.AddrOfPinnedObject(),
                                      FFTW.fftw_direction.Forward,
                                      FFTW.fftw_flags.Measure);
        }
Beispiel #4
0
        public Resampler(int filtersz, int interpfactor, int decifactor)
        {
            this.interpolation_factor = interpfactor;
            this.decimation_factor    = decifactor;
            this.filter_coeff         = new CPX[this.interpolation_factor * 31];
            this.filter_size          = filtersz;
            this.mask            = this.filter_size - 1;
            this.filter_coeff_sz = 31 * this.interpolation_factor;
            this.filter_memory   = new CPX[this.filter_size];
            FilterDesigner fdes = new FilterDesigner();

            fdes.MakeFirLowpass(0.45f / (float)this.decimation_factor,
                                this.interpolation_factor,
                                WindowType_e.BLACKMANHARRIS_WINDOW,
                                ref this.filter_coeff,
                                31 * this.interpolation_factor);
            //fdes.MakeFirBandpass(0.0001f, 0.45f / (float)this.decimation_factor,
            //                    this.interpolation_factor, WindowType_e.BLACKMANHARRIS_WINDOW,
            //                    ref this.filter_coeff, 33 * this.interpolation_factor);
        }
Beispiel #5
0
        public Filter(ref DSPBuffer dsp_buffer_obj)
        {
            this.d = dsp_buffer_obj;
            this.s = d.State;

            this.ovlp_cpx        = new CPX[s.DSPBlockSize];
            this.filter_cpx      = new CPX[s.DSPBlockSize * 2];
            this.tmp_cpx         = new CPX[s.DSPBlockSize * 2];
            this.filter_designer = new FilterDesigner();

            h_filter = GCHandle.Alloc(filter_cpx, GCHandleType.Pinned);
            h_temp   = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx out: filter_cpx
            plan_fwd_filter = FFTW.dft_1d(s.DSPBlockSize * 2,
                                          h_temp.AddrOfPinnedObject(),
                                          h_filter.AddrOfPinnedObject(),
                                          FFTW.fftw_direction.Forward,
                                          FFTW.fftw_flags.Measure);
        }