mirror of
https://github.com/xiph/opus.git
synced 2025-05-17 00:48:29 +00:00
Properly delaying the pitch gain
This commit is contained in:
parent
6367aa8a78
commit
470a0a7e3e
1 changed files with 4 additions and 2 deletions
|
@ -50,6 +50,7 @@ struct LPCNetState {
|
||||||
float last_sig[LPC_ORDER];
|
float last_sig[LPC_ORDER];
|
||||||
float old_input[FEATURES_DELAY][FEATURE_CONV2_OUT_SIZE];
|
float old_input[FEATURES_DELAY][FEATURE_CONV2_OUT_SIZE];
|
||||||
float old_lpc[FEATURES_DELAY][LPC_ORDER];
|
float old_lpc[FEATURES_DELAY][LPC_ORDER];
|
||||||
|
float old_gain[FEATURES_DELAY];
|
||||||
int frame_count;
|
int frame_count;
|
||||||
float deemph_mem;
|
float deemph_mem;
|
||||||
};
|
};
|
||||||
|
@ -153,8 +154,9 @@ void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const float *features
|
||||||
static int start = LPC_ORDER+1;
|
static int start = LPC_ORDER+1;
|
||||||
/* FIXME: Do proper rounding once the Python code rounds properly. */
|
/* FIXME: Do proper rounding once the Python code rounds properly. */
|
||||||
pitch = (int)floor(.1 + 50*features[36]+100);
|
pitch = (int)floor(.1 + 50*features[36]+100);
|
||||||
/* FIXME: get the pitch gain from 2 frames in the past. */
|
pitch_gain = lpcnet->old_gain[FEATURES_DELAY-1];
|
||||||
pitch_gain = features[PITCH_GAIN_FEATURE];
|
memmove(&lpcnet->old_gain[1], &lpcnet->old_gain[0], (FEATURES_DELAY-1)*sizeof(lpcnet->old_gain[0]));
|
||||||
|
lpcnet->old_gain[0] = features[PITCH_GAIN_FEATURE];
|
||||||
run_frame_network(lpcnet, condition, gru_a_condition, features, pitch);
|
run_frame_network(lpcnet, condition, gru_a_condition, features, pitch);
|
||||||
memcpy(lpc, lpcnet->old_lpc[FEATURES_DELAY-1], LPC_ORDER*sizeof(lpc[0]));
|
memcpy(lpc, lpcnet->old_lpc[FEATURES_DELAY-1], LPC_ORDER*sizeof(lpc[0]));
|
||||||
memmove(lpcnet->old_lpc[1], lpcnet->old_lpc[0], (FEATURES_DELAY-1)*LPC_ORDER*sizeof(lpc[0]));
|
memmove(lpcnet->old_lpc[1], lpcnet->old_lpc[0], (FEATURES_DELAY-1)*LPC_ORDER*sizeof(lpc[0]));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue