Browse Source

performance improvements

dev
Clemens Richter 9 years ago
parent
commit
5d0ba663d0
  1. 60
      lib/rds_decoder_redsea_impl.cc
  2. 2
      python/tmc_classes.py
  3. 6
      python/tmc_parser.py

60
lib/rds_decoder_redsea_impl.cc

@ -293,33 +293,36 @@ int rds_decoder_redsea_impl::work (int noutput_items,
checkword=reg & 0x3ff;//checkword part of received block (lower 10 bits)
/* manage special case of C or C' offset word */
if (block_number==2) {
if (variant==0){//A
offset_char = 'C';
block_received_crc=checkword^offset_word[2];
}
else{//B
offset_char = 'c';
block_received_crc=checkword^offset_word[4];
//dout<<"B"<<std::endl;
}
if (block_received_crc==block_calculated_crc) {
good_block=true;
}else{
//try correcting:
uint32_t corrected_block= correctBurstErrors(reg,offset_char);
if(corrected_block != reg){
if (variant == 2 ) dout << "error: 3rd block received before 2nd"<<std::endl;
else{
if (variant==0){//A
offset_char = 'C';
block_received_crc=checkword^offset_word[2];
}
else{//B
offset_char = 'c';
block_received_crc=checkword^offset_word[4];
//dout<<"B"<<std::endl;
}
if (block_received_crc==block_calculated_crc) {
good_block=true;
block_was_corrected=true;
group_corrected_blocks_counter++;
//wrong_blocks_counter++;
dataword=(corrected_block>>10) & 0xffff;
checkword=corrected_block & 0x3ff;
//dout << "corrected error"<<std::endl;
}else {
wrong_blocks_counter++;
good_block=false;
}else{
//try correcting:
uint32_t corrected_block= correctBurstErrors(reg,offset_char);
if(corrected_block != reg){
good_block=true;
block_was_corrected=true;
group_corrected_blocks_counter++;
//wrong_blocks_counter++;
dataword=(corrected_block>>10) & 0xffff;
checkword=corrected_block & 0x3ff;
//dout << "corrected error"<<std::endl;
}else {
wrong_blocks_counter++;
good_block=false;
}
}
}
@ -327,8 +330,6 @@ int rds_decoder_redsea_impl::work (int noutput_items,
else {
block_received_crc=checkword^offset_word[block_number];
if (block_received_crc==block_calculated_crc) {//valid block
if (block_number==0)
last_pi=dataword;
good_block=true;
offset_char=expected_offset_char[block_number]; //expected_offset_char[]={'A','B','?','D'};
/*if (block_number==0) offset_char = 'A';
@ -380,10 +381,12 @@ int rds_decoder_redsea_impl::work (int noutput_items,
}
/* done checking CRC */
if (block_number==0 && good_block) {
last_pi=dataword;
group_assembly_started=true;
//group_corrected_blocks_counter=block_was_corrected;
group_corrected_blocks_counter=0;
group_good_blocks_counter=1;
variant=2;
}
if (block_number==1 && good_block) {//2nd block - > read group type variant
variant=(dataword>>11)& 0x1;
@ -406,6 +409,7 @@ int rds_decoder_redsea_impl::work (int noutput_items,
group_good_blocks_counter++;
}
if (group_good_blocks_counter==5) decode_group(group);
//if (group_good_blocks_counter==5 and group_corrected_blocks_counter>0) decode_group(group);//test corrected blocks
}
block_bit_counter=0;
block_number=(block_number+1) % 4;

2
python/tmc_classes.py

@ -428,7 +428,7 @@ class tmc_location:
print("lcn is segment %i"%lcn)
elif self.lcl_obj.roads.has_key(lcn) and self.tableobj.debug:
print("lcn is road %i"%lcn)
else:
elif self.tableobj.debug:
print("lcn not found %i"%lcn)
elif self.tableobj.log or self.tableobj.debug:

6
python/tmc_parser.py

@ -100,7 +100,7 @@ class tmc_parser(gr.sync_block):
print("closing tmc display")
def save_data(self):
print_dbg('saving data..', end="")
self.dataLock.acquire(1)
#self.dataLock.acquire(1) #disabled 2017-06-06 for performance
if self.writeDB:
self.dbLock.acquire(1)
self.db.commit()
@ -108,7 +108,7 @@ class tmc_parser(gr.sync_block):
f=open(self.workdir+'google_maps_markers.js', 'w')
markerstring=self.tmc_messages.getMarkerString()
self.dataLock.release(1)
#self.dataLock.release(1)
markerstring+='\n console.log("loaded "+markers.length+" markers")'
markerstring+='\n document.getElementById("errorid").innerHTML = "loaded "+markers.length+" markers";'
f.write(markerstring)
@ -287,7 +287,7 @@ class tmc_parser(gr.sync_block):
pass
return return_string
def print_dbg(message,end="\n"):
dbg=True
dbg=False
if dbg:
print(message,end=end)
class tmc_parser_Widget(QtGui.QWidget):

Loading…
Cancel
Save