comparison trau-decode/parse-amr.c @ 82:31a8d34b71ed

trau-parse: AMR 7k95 CRC
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 08 Feb 2025 21:42:53 +0000
parents 9eff2af191d5
children 5e2ecfd45fc3
comparison
equal deleted inserted replaced
81:9eff2af191d5 82:31a8d34b71ed
83 83
84 static void 84 static void
85 decode_mode_5(c_bits, d_bits) 85 decode_mode_5(c_bits, d_bits)
86 ubit_t *c_bits, *d_bits; 86 ubit_t *c_bits, *d_bits;
87 { 87 {
88 ubit_t crc_collect[64];
89 int crc1, crc2, crc3, crc4;
90
91 bcopy(c_bits, crc_collect, 25);
92 bcopy(d_bits + 31, crc_collect + 25, 35);
93 bcopy(d_bits + 83, crc_collect + 60, 2);
94 crc_collect[62] = d_bits[87];
95 crc_collect[63] = d_bits[90];
96 crc1 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 64,
97 d_bits + 92);
98 bcopy(d_bits + 95, crc_collect, 4);
99 bcopy(d_bits + 118, crc_collect + 4, 2);
100 bcopy(d_bits + 122, crc_collect + 6, 4);
101 crc2 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 10,
102 d_bits + 127);
103 bcopy(d_bits + 130, crc_collect, 8);
104 bcopy(d_bits + 155, crc_collect + 8, 2);
105 bcopy(d_bits + 159, crc_collect + 10, 4);
106 crc3 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 14,
107 d_bits + 164);
108 bcopy(d_bits + 167, crc_collect, 4);
109 bcopy(d_bits + 190, crc_collect + 4, 2);
110 bcopy(d_bits + 194, crc_collect + 6, 4);
111 crc4 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 10,
112 d_bits + 199);
113 printf(" CRC %s %s %s %s\n",
114 crc1 ? "bad" : "good", crc2 ? "bad" : "good",
115 crc3 ? "bad" : "good", crc4 ? "bad" : "good");
88 } 116 }
89 117
90 static void 118 static void
91 decode_mode_6(c_bits, d_bits) 119 decode_mode_6(c_bits, d_bits)
92 ubit_t *c_bits, *d_bits; 120 ubit_t *c_bits, *d_bits;