Created
November 5, 2013 17:25
-
-
Save vlofgren/7322741 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double carrier_phase[2]; | |
| double carrier_strength = fourier1p(dbuffer, (float) length * carrier / (float)rate, length, &carrier_phase[0], &carrier_phase[1]); | |
| if(carrier_strength < threshold) continue; | |
| double delta_re = carrier_phase[0] * old_carrier_phase[0] + carrier_phase[1]*old_carrier_phase[1]; | |
| double delta_im = -carrier_phase[1]*old_carrier_phase[0] + carrier_phase[0] * old_carrier_phase[1]; | |
| if(delta_re * delta_re > delta_im * delta_im) { /* Phase difference is a multiple of pi */ | |
| if(delta_re > 0); /* No change */ | |
| else { | |
| bit_data = bit_data * 2; | |
| } | |
| } else { | |
| if(delta_im > 0) { | |
| bit_data = bit_data * 2 + 1; | |
| } else { | |
| if(isprint(bit_data)) printf("%c", bit_data); | |
| else printf("<%.2x>", bit_data); | |
| bit_data = 0; | |
| } | |
| } | |
| old_carrier_phase[0] = carrier_phase[0]; | |
| old_carrier_phase[1] = carrier_phase[1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment