debug: dump raw IMBE frame data
This commit is contained in:
parent
111b311d88
commit
538ae6015b
|
@ -10,6 +10,7 @@
|
|||
#include <vector>
|
||||
|
||||
typedef std::vector<bool> voice_codeword;
|
||||
typedef std::vector<uint8_t> packed_codeword;
|
||||
typedef const std::vector<bool> const_bit_vector;
|
||||
typedef std::vector<bool> bit_vector;
|
||||
|
||||
|
@ -344,6 +345,26 @@ imbe_header_decode(const voice_codeword& cw, uint32_t& u0, uint32_t& u1, uint32_
|
|||
return errs;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pack 88 bit IMBE parameters into uint8_t vector
|
||||
*/
|
||||
static inline void
|
||||
imbe_pack(packed_codeword& cw, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7)
|
||||
{
|
||||
cw.empty();
|
||||
cw.push_back(u0 >> 4);
|
||||
cw.push_back(((u0 & 0xf) << 4) + (u1 >> 8));
|
||||
cw.push_back(u1 & 0xff);
|
||||
cw.push_back(u2 >> 4);
|
||||
cw.push_back(((u2 & 0xf) << 4) + (u3 >> 8));
|
||||
cw.push_back(u3 & 0xff);
|
||||
cw.push_back(u4 >> 3);
|
||||
cw.push_back(((u4 & 0x7) << 5) + (u5 >> 6));
|
||||
cw.push_back(((u5 & 0x3f) << 2) + (u6 >> 9));
|
||||
cw.push_back(u6 >> 1);
|
||||
cw.push_back(((u6 & 0x1) << 7) + (u7 >> 1));
|
||||
}
|
||||
|
||||
/* APCO IMBE header encoder.
|
||||
*
|
||||
* given 88 bits of IMBE parameters, construct output 144-bit IMBE codeword
|
||||
|
|
|
@ -625,6 +625,15 @@ p25p1_fdma::process_voice(const bit_vector& A)
|
|||
imbe_deinterleave(A, cw, i);
|
||||
// recover 88-bit IMBE voice code word
|
||||
imbe_header_decode(cw, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], E0, ET);
|
||||
|
||||
if (d_debug >= 10) {
|
||||
packed_codeword p_cw;
|
||||
imbe_pack(p_cw, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7]);
|
||||
sprintf(s,"%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
|
||||
p_cw[0], p_cw[1], p_cw[2], p_cw[3], p_cw[4], p_cw[5],
|
||||
p_cw[6], p_cw[7], p_cw[8], p_cw[9], p_cw[10]);
|
||||
fprintf(stderr, "%s IMBE %s\n", logts.get(), s); // print to log in one operation
|
||||
}
|
||||
// output one 32-byte msg per 0.020 sec.
|
||||
// also, 32*9 = 288 byte pkts (for use via UDP)
|
||||
sprintf(s, "%03x %03x %03x %03x %03x %03x %03x %03x\n", u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7]);
|
||||
|
|
Loading…
Reference in New Issue