Files
OpenBTS-UMTS/TransceiverUHD/Resampler.h
Tom Tsou 00e302f32a TransceiverUHD: Add transceiver support for UHD devices
Supported devices includes USRP N200/N210/USRP2, B200/B210, X300/X310.
Other Ettus devices are not supported due to bandwidth limitations.
There is no direct embedded device support at this time.

The UHD transceiver device operating rate is fixed at 6.25 Msps, which
interfaces with the UMTS chip rate of 3.84 Mcps through a combined
polyphase resampling and RRC pulse-shaping filterbank. The effective
oversampling factor is approximate 1.63 samples per symbol.

Tested against Agilent 89600 VSA for appropriate EVM and ACP values.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-04 13:14:32 +01:00

66 lines
1.9 KiB
C++

#ifndef _RESAMPLER_H_
#define _RESAMPLER_H_
class Resampler {
public:
/* Constructor for rational sample rate conversion
* @param p numerator of resampling ratio
* @param q denominator of resampling ratio
* @param filt_len length of each polyphase subfilter
*/
Resampler(size_t p, size_t q, size_t filt_len = 16);
~Resampler();
/* Initilize resampler filterbank.
* @param bw bandwidth factor on filter generation (pre-window)
* @return false on error, zero otherwise
*
* Automatic setting is to compute the filter to prevent aliasing with
* a Blackman-Harris window. Adjustment is made through a bandwith
* factor to shift the cutoff and/or the constituent filter lengths.
* Calculation of specific rolloff factors or 3-dB cutoff points is
* left as an excersize for the reader.
*/
bool init(int type = FILTER_TYPE_SINC, float bw = 1.0f);
/* Rotate "commutator" and drive samples through filterbank
* @param in continuous buffer of input complex float values
* @param in_len input buffer length
* @param out continuous buffer of output complex float values
* @param out_len output buffer length
* @return number of samples outputted, negative on error
*
* Input and output vector lengths must of be equal multiples of the
* rational conversion rate denominator and numerator respectively.
*/
int rotate(float *in, size_t in_len, float *out, size_t out_len);
/* Get filter length
* @return number of taps in each filter partition
*/
size_t len();
enum {
FILTER_TYPE_SINC,
FILTER_TYPE_RRC,
};
private:
size_t p;
size_t q;
size_t filt_len;
size_t path_len;
size_t *in_index;
size_t *out_path;
float **partitions;
float *history;
bool initFilters(int type, float bw);
void releaseFilters();
bool computePaths(int len);
bool checkLen(size_t in_len, size_t out_len);
};
#endif /* _RESAMPLER_H_ */