Skip to content

Commit

Permalink
Fix: carrier pattern wraps around even with no more input data
Browse files Browse the repository at this point in the history
Process carrier symbols before each input data symbol.
Append any trailing carrier symbol until the pattern wraps around.
  • Loading branch information
delta512 committed Aug 9, 2022
1 parent 8fbab14 commit 523a1d9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/urh/signalprocessing/Encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,20 @@ def code_carrier(self, decoding, inpt):
# Add carrier if encoding
if len(self.carrier) > 0:
x = 0
while self.carrier[x % len(self.carrier)] in ("0", "1", "*"):
output.append(False if self.carrier[x % len(self.carrier)] in (
"0", "*") else True) # Add 0 when there is a wildcard (*) in carrier description
x += 1
for i in inpt:
tmp = self.carrier[x % len(self.carrier)]
if not tmp in ("0", "1", "*"):
output.append(i)
x += 1
while self.carrier[x % len(self.carrier)] in ("0", "1", "*"):
output.append(False if self.carrier[x % len(self.carrier)] in (
"0", "*") else True) # Add 0 when there is a wildcard (*) in carrier description
x += 1
tmp = self.carrier[x % len(self.carrier)]
if not tmp in ("0", "1", "*"):
output.append(i)
x += 1
# Consume the trailing carrier pattern avoiding any wrap around
while x % len(self.carrier) > 0 and self.carrier[x % len(self.carrier)] in ("0", "1", "*"):
output.append(False if self.carrier[x % len(self.carrier)] in (
"0", "*") else True) # Add 0 when there is a wildcard (*) in carrier description
x += 1
return output, errors, self.ErrorState.SUCCESS

def code_data_whitening(self, decoding, inpt):
Expand Down

0 comments on commit 523a1d9

Please sign in to comment.