diff --git a/src/pitch.cpp b/src/pitch.cpp index 11a1a14..6f9d646 100755 --- a/src/pitch.cpp +++ b/src/pitch.cpp @@ -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 . + + 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) { @@ -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