<div dir="ltr">Hi,<div>    I want to encode a audio to opus, the audio is 16KHz, 16bits, 1 channel. I use the libopusenc and libopus, and I found the audio will be resampled to 48KHz first, I want to avoid the resample to save MIPS.<br><div>    I found a static_mode_list in libopus/celt/static_modes_fixed.h which only include mode48000_960_120, I generate another mode called mode16000_320_40 by libopus/celt/dump_modes/dump_modes.c, and do some modify in code like follows:</div><div>--- a/celt/celt_encoder.c</div>+++ b/celt/celt_encoder.c<br>@@ -128,9 +128,10 @@ struct OpusCustomEncoder {<br>    /* opus_val16 energyError[],  Size = channels*mode->nbEBands */<br> };<br><br>-__sys__ int celt_encoder_get_size(int channels)<br>+__sys__ int celt_encoder_get_size(opus_int32 Fs, int channels)<br> {<br>-   CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);<br>+   opus_int32 rate = (Fs == 16000) ? Fs : 48000;<br>+   CELTMode *mode = opus_custom_mode_create(rate, rate / 50, NULL);<br>    return opus_custom_encoder_get_size(mode, channels);<br> }<div>    These are only apart of my modify, I also remove the resample in opusenc.c .</div><div>    The output sounds like it works but the amplitude has be changed.Am I do it wrong?</div><div><img src="cid:ii_kismycmj0" alt="image.png" width="562" height="227"><br></div></div><div><br></div><div>Bset Regards.</div></div>