summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2013-07-16 21:31:29 (UTC)
committer Dimitri Stolnikov <horiz0n@gmx.net>2013-07-16 21:31:29 (UTC)
commit0edfcfcba0ddf0fd5002dab70331d75a376bcf3f (patch)
tree4512d5485e8a425d59a41054187a190e947f109f
parent3ce7c3398102e49f5fe7411a8e0fb5700236a3c7 (diff)
rtl: remove residue DC component introduced by RTL chip
received from Juha Vierinen: A student here noticed that there is dc bias even with the rafael tuner. We looked into this issue and found that using 127.4f instead of 127.5f removes this bias. I assume this is associated with a bug in the digital downconversion of the RTL chip. This change fixes the problem.
-rw-r--r--lib/rtl/rtl_source_c.cc8
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_f.cc2
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc
index 15bde78..6479b28 100644
--- a/lib/rtl/rtl_source_c.cc
+++ b/lib/rtl/rtl_source_c.cc
@@ -170,11 +170,11 @@ rtl_source_c::rtl_source_c (const std::string &args)
// create a lookup table for gr_complex values
for (unsigned int i = 0; i <= 0xffff; i++) {
#ifdef BOOST_LITTLE_ENDIAN
- _lut.push_back( gr_complex( (float(i & 0xff) - 127.5f) * (1.0f/128.0f),
- (float(i >> 8) - 127.5f) * (1.0f/128.0f) ) );
+ _lut.push_back( gr_complex( (float(i & 0xff) - 127.4f) * (1.0f/128.0f),
+ (float(i >> 8) - 127.4f) * (1.0f/128.0f) ) );
#else // BOOST_BIG_ENDIAN
- _lut.push_back( gr_complex( (float(i >> 8) - 127.5f) * (1.0f/128.0f),
- (float(i & 0xff) - 127.5f) * (1.0f/128.0f) ) );
+ _lut.push_back( gr_complex( (float(i >> 8) - 127.4f) * (1.0f/128.0f),
+ (float(i & 0xff) - 127.4f) * (1.0f/128.0f) ) );
#endif
}
diff --git a/lib/rtl_tcp/rtl_tcp_source_f.cc b/lib/rtl_tcp/rtl_tcp_source_f.cc
index 4d38ddb..211cc95 100644
--- a/lib/rtl_tcp/rtl_tcp_source_f.cc
+++ b/lib/rtl_tcp/rtl_tcp_source_f.cc
@@ -130,7 +130,7 @@ rtl_tcp_source_f::rtl_tcp_source_f(size_t itemsize,
d_temp_buff = new unsigned char[d_payload_size]; // allow it to hold up to payload_size bytes
d_LUT= new float[0xff+1];
for(int i=0; i <=(0xff);++i){
- d_LUT[i] = (((float)(i&0xff))-127.5f)*(1.0f/128.0f);
+ d_LUT[i] = (((float)(i&0xff))-127.4f)*(1.0f/128.0f);
}
// create socket
d_socket = socket(ip_src->ai_family, ip_src->ai_socktype,