|
|
|
@ -179,15 +179,15 @@ static const char * const offset_name[]={"A","B","C","D","c"};*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint32_t rds_decoder_redsea_impl::correctBurstErrors(uint32_t block, char offset) { |
|
|
|
uint32_t rds_decoder_redsea_impl::correctBurstErrors(uint32_t block, char offset) { |
|
|
|
uint32_t syndrome = calc_syndrome(block,26); |
|
|
|
//uint32_t syndrome = calc_syndrome(block,26);
|
|
|
|
//uint32_t syndrome = calcSyndrome_vec(block);
|
|
|
|
uint32_t syndrome = calc_syndrome(block ^ offset_char_to_word(offset),26); |
|
|
|
uint32_t corrected_block = block; |
|
|
|
uint32_t corrected_block = block; |
|
|
|
//dout << "trying to correct sy:"<<syndrome<<"\t\toffset:"<<offset;//<<std::endl;
|
|
|
|
//dout << "trying to correct sy:"<<syndrome<<"\t\toffset:"<<offset;//<<std::endl;
|
|
|
|
//dout << "\tcount:"<<kErrorLookup.count({(uint16_t)syndrome, (char)offset})<<std::endl;
|
|
|
|
//dout << "\tcount:"<<kErrorLookup.count({(uint16_t)syndrome, (char)offset})<<std::endl;
|
|
|
|
if (kErrorLookup.count({syndrome, offset}) > 0) { |
|
|
|
if (kErrorLookup.count({syndrome, offset}) > 0) { |
|
|
|
uint32_t err = kErrorLookup.at({syndrome, offset}); |
|
|
|
uint32_t err = kErrorLookup.at({syndrome, offset}); |
|
|
|
//dout << "correcting"<<std::endl;
|
|
|
|
//dout << "correcting"<<std::endl;
|
|
|
|
err=0;//correction disabled
|
|
|
|
//err=0;//disables error correction
|
|
|
|
corrected_block ^= err; |
|
|
|
corrected_block ^= err; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
@ -221,6 +221,19 @@ void rds_decoder_redsea_impl::decode_group(uint16_t *group) { |
|
|
|
pmt::pmt_t pdu(pmt::cons(meta, data)); // make PDU: (metadata, data) pair
|
|
|
|
pmt::pmt_t pdu(pmt::cons(meta, data)); // make PDU: (metadata, data) pair
|
|
|
|
message_port_pub(pmt::mp("out"), pdu); |
|
|
|
message_port_pub(pmt::mp("out"), pdu); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
unsigned int rds_decoder_redsea_impl::offset_char_to_word(char offset_char){ |
|
|
|
|
|
|
|
// {'A','B','C','D','c'};
|
|
|
|
|
|
|
|
// {252,408,360,436,848};
|
|
|
|
|
|
|
|
switch(offset_char){ |
|
|
|
|
|
|
|
case 'A':return offset_word[0]; |
|
|
|
|
|
|
|
case 'B':return offset_word[1]; |
|
|
|
|
|
|
|
case 'C':return offset_word[2]; |
|
|
|
|
|
|
|
case 'D':return offset_word[3]; |
|
|
|
|
|
|
|
case 'c':return offset_word[4]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::cout << "error converting offset char to word"<<std::endl; |
|
|
|
|
|
|
|
return 0;//
|
|
|
|
|
|
|
|
} |
|
|
|
//work function
|
|
|
|
//work function
|
|
|
|
int rds_decoder_redsea_impl::work (int noutput_items, |
|
|
|
int rds_decoder_redsea_impl::work (int noutput_items, |
|
|
|
gr_vector_const_void_star &input_items, |
|
|
|
gr_vector_const_void_star &input_items, |
|
|
|
@ -350,11 +363,11 @@ int rds_decoder_redsea_impl::work (int noutput_items, |
|
|
|
dataword=(corrected_block>>10) & 0xffff; |
|
|
|
dataword=(corrected_block>>10) & 0xffff; |
|
|
|
checkword=corrected_block & 0x3ff; |
|
|
|
checkword=corrected_block & 0x3ff; |
|
|
|
|
|
|
|
|
|
|
|
//dout << "corrected error"<<std::endl;
|
|
|
|
dout << "corrected error:"<<std::endl; |
|
|
|
// dout << "old: rx:"<<block_received_crc<<"\tcalc:"<<block_calculated_crc<<std::endl;
|
|
|
|
dout << "old: rx:"<<block_received_crc<<"\tcalc:"<<block_calculated_crc<<std::endl; |
|
|
|
// block_received_crc=checkword^offset_word[block_number];
|
|
|
|
block_received_crc=checkword^offset_word[block_number]; |
|
|
|
// block_calculated_crc=calc_syndrome(dataword,16);
|
|
|
|
block_calculated_crc=calc_syndrome(dataword,16); |
|
|
|
// dout << "new: rx:"<<block_received_crc<<"\tcalc:"<<block_calculated_crc<<std::endl;
|
|
|
|
dout << "new: rx:"<<block_received_crc<<"\tcalc:"<<block_calculated_crc<<std::endl; |
|
|
|
|
|
|
|
|
|
|
|
offset_char=expected_offset_char[block_number]; |
|
|
|
offset_char=expected_offset_char[block_number]; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -374,7 +387,7 @@ int rds_decoder_redsea_impl::work (int noutput_items, |
|
|
|
} |
|
|
|
} |
|
|
|
if (block_number==1 && good_block) {//2nd block - > read group type variant
|
|
|
|
if (block_number==1 && good_block) {//2nd block - > read group type variant
|
|
|
|
variant=(dataword>>11)& 0x1; |
|
|
|
variant=(dataword>>11)& 0x1; |
|
|
|
uint8_t group=(dataword>>12)& 0xf; |
|
|
|
// uint8_t group=(dataword>>12)& 0xf;
|
|
|
|
// dout << "group:"<<std::setw(2)<< unsigned(group);
|
|
|
|
// dout << "group:"<<std::setw(2)<< unsigned(group);
|
|
|
|
// //dout << "\tvariant:" << unsigned(variant);
|
|
|
|
// //dout << "\tvariant:" << unsigned(variant);
|
|
|
|
// if (variant==0)
|
|
|
|
// if (variant==0)
|
|
|
|
|