Working 128-bit decoding

pull/1/head
Mark Jessop 2020-06-27 23:38:36 +09:30
rodzic a97f62da15
commit 48dbff4ed3
2 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -474,7 +474,7 @@ int extract_horus_binary_v1(struct horus *hstates, char hex_out[], int uw_loc) {
hstates->crc_ok = (crc_tx == crc_rx);
if ( hstates->crc_ok) {
hstates->total_payload_bits += HORUS_BINARY_V1_NUM_UNCODED_PAYLOAD_BYTES;
hstates->total_payload_bits = HORUS_BINARY_V1_NUM_UNCODED_PAYLOAD_BYTES;
}
return hstates->crc_ok;
}
@ -517,7 +517,7 @@ int extract_horus_binary_v2_128(struct horus *hstates, char hex_out[], int uw_lo
}
fprintf(stderr, "\n");
}
uint8_t payload_bytes[HORUS_BINARY_V2_128BIT_NUM_UNCODED_PAYLOAD_BYTES];
float *softbits = hstates->soft_bits + uw_loc + sizeof(uw_horus_binary_v2);
horus_ldpc_decode( payload_bytes, softbits , HORUS_MODE_BINARY_V2_128BIT);
@ -549,7 +549,7 @@ int extract_horus_binary_v2_128(struct horus *hstates, char hex_out[], int uw_lo
hstates->crc_ok = (crc_tx == crc_rx);
if ( hstates->crc_ok) {
hstates->total_payload_bits += HORUS_BINARY_V2_128BIT_NUM_UNCODED_PAYLOAD_BYTES;
hstates->total_payload_bits = HORUS_BINARY_V2_128BIT_NUM_UNCODED_PAYLOAD_BYTES;
}
return hstates->crc_ok;
@ -628,7 +628,6 @@ int horus_rx(struct horus *hstates, char ascii_out[], short demod_in[], int quad
packet_detected = extract_horus_binary_v2_128(hstates, ascii_out, uw_loc);
}
}
return packet_detected;
}

Wyświetl plik

@ -1083,9 +1083,9 @@ int ldpc_encode_packet(unsigned char *out_data, unsigned char *in_data, int mode
for(j = 0; j < max_row_weight; j++) {
// This is a bit silly, move this out of this loop.
if (mode == 1){
uint8_t tmp = H_256_768_22_H_rows[i + number_parity_bits * j];
tmp = H_256_768_22_H_rows[i + number_parity_bits * j];
} else if (mode == 2) {
uint8_t tmp = H_128_384_23_H_rows[i + number_parity_bits * j];
tmp = H_128_384_23_H_rows[i + number_parity_bits * j];
}
if (!tmp)
continue;
@ -1206,12 +1206,14 @@ void soft_deinterleave(float *in, float* out, int mode) {
/* LDPC decode */
void horus_ldpc_decode(uint8_t *payload, float *sd, int mode) {
float sum, mean, sumsq, estEsN0, x;
int bits_per_packet;
int bits_per_packet, payload_bytes;
if(mode == 1){
bits_per_packet = H_256_768_22_BITS_PER_PACKET;
payload_bytes = H_256_768_22_DATA_BYTES;
} else {
bits_per_packet = H_128_384_23_BITS_PER_PACKET;
payload_bytes = H_128_384_23_DATA_BYTES;
}
float llr[bits_per_packet];
@ -1272,7 +1274,7 @@ void horus_ldpc_decode(uint8_t *payload, float *sd, int mode) {
i = run_ldpc_decoder(&ldpc, outbits, llr, &parityCC);
/* convert MSB bits to a packet of bytes */
for (b = 0; b < (bits_per_packet/8); b++) {
for (b = 0; b < payload_bytes; b++) {
uint8_t rxbyte = 0;
for(i=0; i<8; i++)
rxbyte |= outbits[b*8+i] << (7 - i);