dstar alt interleave
This commit is contained in:
parent
9f6c73e280
commit
9858e0cecc
|
@ -545,6 +545,7 @@ static void encode_49bit(uint8_t outp[49], const int b[9]) {
|
|||
ambe_encoder::ambe_encoder(void)
|
||||
: d_49bit_mode(false),
|
||||
d_dstar_mode(false),
|
||||
d_alt_dstar_interleave(false),
|
||||
d_gain_adjust(0)
|
||||
{
|
||||
mbe_parms enh_mp;
|
||||
|
@ -579,7 +580,7 @@ void ambe_encoder::encode(int16_t samples[], uint8_t codeword[])
|
|||
encode_ambe(vocoder.param(), b, &cur_mp, &prev_mp, d_dstar_mode, d_gain_adjust);
|
||||
|
||||
if (d_dstar_mode) {
|
||||
interleaver.encode_dstar(codeword, b);
|
||||
interleaver.encode_dstar(codeword, b, d_alt_dstar_interleave);
|
||||
} else if (d_49bit_mode) {
|
||||
encode_49bit(codeword, b);
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,8 @@ public:
|
|||
ambe_encoder(void);
|
||||
void set_49bit_mode(void);
|
||||
void set_dstar_mode(void);
|
||||
void set_gain_adjust(float gain_adjust) {d_gain_adjust = gain_adjust;}
|
||||
void set_gain_adjust(const float gain_adjust) {d_gain_adjust = gain_adjust;}
|
||||
void set_alt_dstar_interleave(const bool v) { d_alt_dstar_interleave = v; }
|
||||
private:
|
||||
imbe_vocoder vocoder;
|
||||
p25p2_vf interleaver;
|
||||
|
@ -37,6 +38,7 @@ private:
|
|||
bool d_49bit_mode;
|
||||
bool d_dstar_mode;
|
||||
float d_gain_adjust;
|
||||
bool d_alt_dstar_interleave;
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_AMBE_ENCODER_H */
|
||||
|
|
|
@ -817,9 +817,11 @@ static const int m_list[] = {0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 17, 18, 19, 20, 2
|
|||
|
||||
static const int d_list[] = {7, 1, 11, 21, 31, 25, 35, 45, 55, 49, 59, 69, 6, 0, 10, 20, 30, 24, 34, 44, 54, 48, 58, 68, 5, 15, 9, 19, 29, 39, 33, 43, 53, 63, 57, 67, 4, 14, 8, 18, 28, 38, 32, 42, 52, 62, 56, 66, 3, 13, 23, 17, 27, 37, 47, 41, 51, 61, 71, 65, 2, 12, 22, 16, 26, 36, 46, 40, 50, 60, 70, 64};
|
||||
|
||||
static const int alt_d_list[] = {0, 12, 24, 36, 48, 60, 1, 13, 25, 37, 49, 61, 2, 14, 26, 38, 50, 62, 3, 15, 27, 39, 51, 63, 4, 16, 28, 40, 52, 64, 5, 17, 29, 41, 53, 65, 6, 18, 30, 42, 54, 66, 7, 19, 31, 43, 55, 67, 8, 20, 32, 44, 56, 68, 9, 21, 33, 45, 57, 69, 10, 22, 34, 46, 58, 70, 11, 23, 35, 47, 59, 71};
|
||||
|
||||
static const int b_lengths[] = {7,4,6,9,7,4,4,4,3};
|
||||
|
||||
void p25p2_vf::encode_dstar(uint8_t result[72], const int b[9]) {
|
||||
void p25p2_vf::encode_dstar(uint8_t result[72], const int b[9], bool alt_dstar_interleave) {
|
||||
uint8_t pbuf[48];
|
||||
uint8_t tbuf[48];
|
||||
|
||||
|
@ -842,14 +844,20 @@ void p25p2_vf::encode_dstar(uint8_t result[72], const int b[9]) {
|
|||
store_reg(c1, pre_buf+24, 24);
|
||||
memcpy(pre_buf+48, pbuf+24, 24);
|
||||
for (int i=0; i < 72; i++)
|
||||
if (alt_dstar_interleave)
|
||||
result[i] = pre_buf[alt_d_list[i]];
|
||||
else
|
||||
result[d_list[i]] = pre_buf[i];
|
||||
}
|
||||
|
||||
void p25p2_vf::decode_dstar(const uint8_t codeword[72], int b[9]) {
|
||||
void p25p2_vf::decode_dstar(const uint8_t codeword[72], int b[9], bool alt_dstar_interleave) {
|
||||
uint8_t pre_buf[72];
|
||||
uint8_t post_buf[48];
|
||||
uint8_t tbuf[48];
|
||||
for (int i=0; i < 72; i++)
|
||||
if (alt_dstar_interleave)
|
||||
pre_buf[alt_d_list[i]] = codeword[i];
|
||||
else
|
||||
pre_buf[i] = codeword[d_list[i]];
|
||||
|
||||
uint32_t c0 = load_reg(pre_buf, 24);
|
||||
|
|
|
@ -26,8 +26,8 @@ class p25p2_vf {
|
|||
public:
|
||||
void process_vcw(const uint8_t vf[], int* b);
|
||||
void encode_vcw(uint8_t vf[], const int* b);
|
||||
void encode_dstar(uint8_t result[72], const int b[9]);
|
||||
void decode_dstar(const uint8_t codeword[72], int b[9]);
|
||||
void encode_dstar(uint8_t result[72], const int b[9], bool alt_dstar_interleave);
|
||||
void decode_dstar(const uint8_t codeword[72], int b[9], bool alt_dstar_interleave);
|
||||
private:
|
||||
void extract_vcw(const uint8_t _vf[], int& _c0, int& _c1, int& _c2, int& _c3);
|
||||
void interleave_vcw(uint8_t _vf[], int _c0, int _c1, int _c2, int _c3);
|
||||
|
|
Loading…
Reference in New Issue