isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
gpuFilter.h
1 //
2 // Author: Liang Yu
3 // Copyright 2019
4 //
5 
6 #pragma once
7 
8 #include "forward.h"
9 #include <isce3/core/forward.h>
10 
11 #include <complex>
12 #include <valarray>
13 #include <thrust/complex.h>
14 
15 #include "gpuSignal.h"
16 
17 // Definition of base class
18 template<class T>
20  public:
21  gpuFilter() {};
22  ~gpuFilter();
23 
25  void filter(std::valarray<std::complex<T>> &signal,
26  std::valarray<std::complex<T>> &spectrum);
27 
29  void filter(gpuSignal<T> &signal);
30 
32  void filter(thrust::complex<T> *data);
33 
35  void writeFilter(size_t ncols, size_t nrows);
36 
37  protected:
38 
39  thrust::complex<T> *_d_filter; // device unified memory pointer
40  bool _filter_set = false;
41  gpuSignal<T> _signal;
42 };
43 
44 // Azimuth filter class derived from base class
45 template <class T>
46 class isce3::cuda::signal::gpuAzimuthFilter : public gpuFilter<T> {
47  public:
48  gpuAzimuthFilter();
49  ~gpuAzimuthFilter() {};
50 
52  void initiateAzimuthFilter(std::valarray<std::complex<T>> &signal,
53  std::valarray<std::complex<T>> &spectrum,
54  size_t ncols,
55  size_t nrows);
56 
57  void constructAzimuthCommonbandFilter(const isce3::core::LUT1d<double> & refDoppler,
58  const isce3::core::LUT1d<double> & secDoppler,
59  double bandwidth,
60  double prf,
61  double beta,
62  //std::valarray<std::complex<T>> &signal,
63  size_t ncols,
64  size_t nrows);
65 };
66 
67 // Range filter class derived from base class
68 template <class T>
69 class isce3::cuda::signal::gpuRangeFilter : public gpuFilter<T> {
70  public:
71  gpuRangeFilter();
72  ~gpuRangeFilter();
73 
74  // same name wrappers for filter init and construction functions with HostToDevice cp
76  void initiateRangeFilter(std::valarray<std::complex<T>> &signal,
77  std::valarray<std::complex<T>> &spectrum,
78  size_t ncols,
79  size_t nrows);
80 
82  void constructRangeBandpassFilter(double rangeSamplingFrequency,
83  std::valarray<double> subBandCenterFrequencies,
84  std::valarray<double> subBandBandwidths,
85  std::valarray<std::complex<T>> &signal,
86  std::valarray<std::complex<T>> &spectrum,
87  size_t ncols,
88  size_t nrows,
89  std::string filterType);
90 
91  void constructRangeBandpassFilter(double rangeSamplingFrequency,
92  std::valarray<double> subBandCenterFrequencies,
93  std::valarray<double> subBandBandwidths,
94  size_t ncols,
95  size_t nrows,
96  std::string filterType);
97 
99  void constructRangeBandpassBoxcar(std::valarray<double> subBandCenterFrequencies,
100  std::valarray<double> subBandBandwidths,
101  double dt,
102  int nfft,
103  std::valarray<std::complex<T>> &_filter1D);
104 
105  void constructRangeBandpassCosine(std::valarray<double> subBandCenterFrequencies,
106  std::valarray<double> subBandBandwidths,
107  double dt,
108  std::valarray<double>& frequency,
109  double beta,
110  std::valarray<std::complex<T>>& _filter1D);
111 
112  void filterCommonRangeBand(T *d_refSlc, T *d_secSlc, T *range);
113 
114  size_t rangeFrequencyShiftMaxIdx(thrust::complex<T> *spectrum,
115  int n_rows,
116  int n_cols);
117 
118  void getPeakIndex(T *data, int data_lenth, size_t &peakIndex);
119 
120  private:
121  double _wavelength;
122  double _rangePixelSpacing;
123  double _freqShift;
124  double _rangeBandWidth;
125  double _rangeSamplingFrequency;
126  double _rangeBandwidth;
127  T *_d_spectrumSum;
128  bool _spectrumSum_set = false;
129 };
130 
131 template<class T>
132 __global__ void phaseShift_g(thrust::complex<T> *slc, T *range, double pxlSpace, T conj, double wavelength, T wave_div, int n_elements);
133 
134 template<class T>
135 __global__ void filter_g(thrust::complex<T> *signal, thrust::complex<T> *filter, int n_elements);
136 
137 template<class T>
138 __global__ void sumSpectrum_g(thrust::complex<T> *spectrum, T *spectrum_sum, int n_rows, int n_cols);
Definition: forward.h:10
Definition: forward.h:8
void filter(std::valarray< std::complex< T >> &signal, std::valarray< std::complex< T >> &spectrum)
Filter a signal in frequency domain.
void initiateAzimuthFilter(std::valarray< std::complex< T >> &signal, std::valarray< std::complex< T >> &spectrum, size_t ncols, size_t nrows)
constructs forward abd backward FFT plans for filtering a block of data in azimuth direction...
void initiateRangeFilter(std::valarray< std::complex< T >> &signal, std::valarray< std::complex< T >> &spectrum, size_t ncols, size_t nrows)
constructs forward abd backward FFT plans for filtering a block of data in range direction.
void constructRangeBandpassBoxcar(std::valarray< double > subBandCenterFrequencies, std::valarray< double > subBandBandwidths, double dt, int nfft, std::valarray< std::complex< T >> &_filter1D)
Construct a box car range band-pass filter for multiple bands.
void constructRangeBandpassFilter(double rangeSamplingFrequency, std::valarray< double > subBandCenterFrequencies, std::valarray< double > subBandBandwidths, std::valarray< std::complex< T >> &signal, std::valarray< std::complex< T >> &spectrum, size_t ncols, size_t nrows, std::string filterType)
Construct range band-pass filter.
void writeFilter(size_t ncols, size_t nrows)
carry over from parent class.

Generated for ISCE3.0 by doxygen 1.8.5.