set_gain_adjust patch

This commit is contained in:
Max 2017-10-17 16:58:56 -04:00
parent 15f0acfa17
commit a9522ee636
19 changed files with 39 additions and 22 deletions

View File

@ -47,6 +47,7 @@ namespace gr {
* creating new instances.
*/
static sptr make(int versbose_flag);
virtual void set_gain_adjust(float gain_adjust) {}
};
} // namespace op25_repeater

View File

@ -48,6 +48,7 @@ namespace gr {
* creating new instances.
*/
static sptr make(int versbose_flag, const char * conf_file);
virtual void set_gain_adjust(float gain_adjust) {}
};
} // namespace op25_repeater

View File

@ -47,6 +47,7 @@ namespace gr {
* creating new instances.
*/
static sptr make(bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag);
virtual void set_gain_adjust(float gain_adjust) {}
};
} // namespace op25_repeater

View File

@ -48,6 +48,7 @@ namespace gr {
* creating new instances.
*/
static sptr make(int versbose_flag, const char * conf_file, bool fullrate_mode);
virtual void set_gain_adjust(float gain_adjust) {}
};
} // namespace op25_repeater

View File

@ -549,15 +549,6 @@ ambe_encoder::ambe_encoder(void)
{
mbe_parms enh_mp;
mbe_initMbeParms (&cur_mp, &prev_mp, &enh_mp);
// this is a hack to cut down on overloading
// value is in log2
char *gfp = getenv("GAIN_ADJUST");
if (gfp) {
float gain_adj = 0.0;
sscanf(gfp, "%f", &gain_adj);
if (!std::isnan(gain_adj))
d_gain_adjust = gain_adj;
}
}
void ambe_encoder::set_dstar_mode(void)

View File

@ -28,6 +28,7 @@ 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;}
private:
imbe_vocoder vocoder;
p25p2_vf interleaver;

View File

@ -109,5 +109,10 @@ ambe_encoder_sb_impl::general_work (int noutput_items,
return (nframes);
}
void
ambe_encoder_sb_impl::set_gain_adjust(float gain_adjust) {
d_encoder.set_gain_adjust(gain_adjust);
}
} /* namespace op25_repeater */
} /* namespace gr */

View File

@ -65,6 +65,7 @@ namespace gr {
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void set_gain_adjust(float gain_adjust);
private:
int d_verbose_flag;

View File

@ -169,5 +169,9 @@ dstar_tx_sb_impl::general_work (int noutput_items,
return (nframes * 96);
}
void
dstar_tx_sb_impl::set_gain_adjust(float gain_adjust) {
d_encoder.set_gain_adjust(gain_adjust);
}
} /* namespace op25_repeater */
} /* namespace gr */

View File

@ -53,6 +53,7 @@ namespace gr {
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void set_gain_adjust(float gain_adjust);
private:
int d_verbose_flag;

View File

@ -44,16 +44,6 @@ imbe_vocoder::imbe_vocoder (void) :
decode_init(&my_imbe_param);
encode_init();
// this is a hack to cut down on overloading
// value is in log2
char *gfp = getenv("GAIN_ADJUST_FULLRATE");
if (gfp) {
int gain_adj = 0;
sscanf(gfp, "%d", &gain_adj);
if (gain_adj)
d_gain_adjust = (Word32) gain_adj;
}
if (!already_printed) {
already_printed = 1;
fprintf(stderr,"Project 25 IMBE Encoder/Decoder Fixed-Point implementation\n");

View File

@ -34,6 +34,7 @@ public:
}
// hack to enable ambe encoder read access to speech parameters
const IMBE_PARAM* param(void) {return &my_imbe_param;}
void set_gain_adjust(float gain_adjust) {d_gain_adjust = gain_adjust;}
private:
IMBE_PARAM my_imbe_param;
@ -59,7 +60,7 @@ private:
Word32 dc_rmv_mem;
Cmplx16 fft_buf[FFTLENGTH];
Word16 pe_lpf_mem[PE_LPF_ORD];
Word32 d_gain_adjust;
float d_gain_adjust;
/* member functions */
void idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out);

View File

@ -114,7 +114,7 @@ void imbe_vocoder::sa_encode(IMBE_PARAM *imbe_param)
}
if (d_gain_adjust)
*vec32_ptr = L_sub(*vec32_ptr, d_gain_adjust << 22); // would be nicer to allow fractional increments...
*vec32_ptr = L_sub(*vec32_ptr, (Word32)(d_gain_adjust * float(1<<22)));
vec32_ptr++;
k_acc += k_coef;

View File

@ -343,5 +343,9 @@ void p25p1_voice_encode::init_sock(char* udp_host, int udp_port)
write_sock_addr.sin_port = htons(udp_port);
}
void
p25p1_voice_encode::set_gain_adjust(float gain_adjust) {
vocoder.set_gain_adjust(gain_adjust);
}
} /* namespace op25_repeater */
} /* namespace gr */

View File

@ -45,7 +45,7 @@ namespace gr {
p25p1_voice_encode(bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag, std::deque<uint8_t> &_output_queue);
~p25p1_voice_encode();
void compress_samp(const int16_t * samp, int len);
void set_gain_adjust(float gain_adjust);
private:
static const int RXBUF_MAX = 80;

View File

@ -164,5 +164,10 @@ vocoder_impl::general_work (int noutput_items,
return general_work_decode(noutput_items, ninput_items, input_items, output_items);
}
void
vocoder_impl::set_gain_adjust(float gain_adjust) {
p1voice_encode.set_gain_adjust(gain_adjust);
}
} /* namespace op25_repeater */
} /* namespace gr */

View File

@ -45,6 +45,7 @@ namespace gr {
~vocoder_impl();
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
void set_gain_adjust(float gain_adjust);
int general_work(int noutput_items,
gr_vector_int &ninput_items,

View File

@ -452,5 +452,13 @@ ysf_tx_sb_impl::general_work (int noutput_items,
return (nframes * 480);
}
void
ysf_tx_sb_impl::set_gain_adjust(float gain_adjust) {
if (d_fullrate_mode)
d_fullrate_encoder.set_gain_adjust(gain_adjust);
else
d_halfrate_encoder.set_gain_adjust(gain_adjust);
}
} /* namespace op25_repeater */
} /* namespace gr */

View File

@ -53,6 +53,7 @@ namespace gr {
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void set_gain_adjust(float gain_adjust);
private:
int d_verbose_flag;