Browse Source

added clockslip correction (untested)

dev
Clemens Richter 9 years ago
parent
commit
c31ca6f60e
  1. 19
      lib/rds_decoder_redsea_impl.cc

19
lib/rds_decoder_redsea_impl.cc

@ -306,23 +306,14 @@ int rds_decoder_redsea_impl::work (int noutput_items,
if (num_diff_bits<2){ if (num_diff_bits<2){
dout << "clockslip detection (forward,skipped one):"<<std::endl; dout << "clockslip detection (forward,skipped one):"<<std::endl;
dout << "dataword:"<<std::bitset<16>(dataword)<<"\tlast_pi:"<<std::bitset<16>(last_pi)<<std::endl; dout << "dataword:"<<std::bitset<16>(dataword)<<"\tlast_pi:"<<std::bitset<16>(last_pi)<<std::endl;
i--;
} }
if (num_diff_bits2<2){ if (num_diff_bits2<2){
dout << "clockslip detection (backward,repeated one):"<<std::endl; dout << "clockslip detection (backward,repeated one):"<<std::endl;
dout << "dataword:"<<std::bitset<16>(dataword)<<"\tlast_pi:"<<std::bitset<16>(last_pi)<<std::endl; dout << "dataword:"<<std::bitset<16>(dataword)<<"\tlast_pi:"<<std::bitset<16>(last_pi)<<std::endl;
i++;
} }
diff=dataword^(last_pi>>2);
diff2=(dataword>>2)^(last_pi);
num_diff_bits = std::bitset<16>(diff).count();
num_diff_bits2 = std::bitset<16>(diff2).count();
if (num_diff_bits<2){
dout << "clockslip detection (forward,skipped two):"<<std::endl;
dout << "dataword:"<<std::bitset<16>(dataword)<<"\tlast_pi:"<<std::bitset<16>(last_pi)<<std::endl;
}
if (num_diff_bits2<2){
dout << "clockslip detection (backward,repeated two):"<<std::endl;
dout << "dataword:"<<std::bitset<16>(dataword)<<"\tlast_pi:"<<std::bitset<16>(last_pi)<<std::endl;
}
} }
//try correcting: //try correcting:
uint32_t corrected_block= correctBurstErrors(reg,expected_offset_char[block_number]); uint32_t corrected_block= correctBurstErrors(reg,expected_offset_char[block_number]);
@ -382,9 +373,9 @@ int rds_decoder_redsea_impl::work (int noutput_items,
block_number=(block_number+1) % 4; block_number=(block_number+1) % 4;
blocks_counter++; blocks_counter++;
/* 1187.5 bps / 104 bits = 11.4 groups/sec, or 45.7 blocks/sec */ /* 1187.5 bps / 104 bits = 11.4 groups/sec, or 45.7 blocks/sec */
if (blocks_counter==40) {//reduced from 50 if (blocks_counter==50) {//reduced from 50
last_wrong_blocks_counter=wrong_blocks_counter; last_wrong_blocks_counter=wrong_blocks_counter;
if (wrong_blocks_counter>28) {//reduced from 35 if (wrong_blocks_counter>35) {//reduced from 35
lout << "@@@@@ Lost Sync (Got " << wrong_blocks_counter lout << "@@@@@ Lost Sync (Got " << wrong_blocks_counter
<< " bad blocks on " << blocks_counter << " bad blocks on " << blocks_counter
<< " total)" << std::endl; << " total)" << std::endl;

Loading…
Cancel
Save