Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/pitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ void pitch_search(const opus_val16 *x_lp, opus_val16 *y,
#endif
);

/*
A modified pitch correlation inspired by section 3.1 Features and Quantization: Pitch
in the paper <A Real-Time Wideband Neural Vocoder at 1.6 kb/s Using LPCNet>.

Link: https://jmvalin.ca/papers/lpcnet_codec.pdf
*/
*pitch_corr = 2*xcorr[best_pitch[0]] / (
1+celt_inner_prod(x_lp, x_lp, len>>1)+
celt_inner_prod(&y[best_pitch[0]], &y[best_pitch[0]], len>>1)
);

/* Refine by pseudo-interpolation */
if (best_pitch[0]>0 && best_pitch[0]<(max_pitch>>1)-1)
{
Expand All @@ -382,7 +393,7 @@ void pitch_search(const opus_val16 *x_lp, opus_val16 *y,
offset = 0;
}
*pitch = 2*best_pitch[0]-offset;
*pitch_corr = xcorr[best_pitch[0]];
/* *pitch_corr = xcorr[best_pitch[0]]; */
}

#ifdef FIXED_POINT
Expand Down