Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubt on the symbol decoding function #174

Open
Algafix opened this issue Apr 8, 2023 · 0 comments
Open

Doubt on the symbol decoding function #174

Algafix opened this issue Apr 8, 2023 · 0 comments

Comments

@Algafix
Copy link

Algafix commented Apr 8, 2023

Hello!

I have a question about the following code snipped in the symbol decoding function.

dump1090/dump1090.c

Lines 1430 to 1448 in de61bd5

low = m[j+i+MODES_PREAMBLE_US*2];
high = m[j+i+MODES_PREAMBLE_US*2+1];
delta = low-high;
if (delta < 0) delta = -delta;
if (i > 0 && delta < 256) {
bits[i/2] = bits[i/2-1];
} else if (low == high) {
/* Checking if two adiacent samples have the same magnitude
* is an effective way to detect if it's just random noise
* that was detected as a valid preamble. */
bits[i/2] = 2; /* error */
if (i < MODES_SHORT_MSG_BITS*2) errors++;
} else if (low > high) {
bits[i/2] = 1;
} else {
/* (low < high) for exclusion */
bits[i/2] = 0;
}

Is this first condition attempting to solve the same problem as the "outOfPhase" correction? Making it easier to detect sequences of bits with the same value.

If that is the case, then I think the error count is not working as intended, because a delta of 0 falls inside the first condition. Hence, it will only count errors on the first bit, before i>0. I'm not sure if this implication is taken into account in the rest of the code, it seems to me that it is expecting values greater than 1 in the error count.

Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant