Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweep sine get more harmonics when increasing the bitrate #34

Closed
asoulier opened this issue Jul 13, 2023 · 3 comments
Closed

Sweep sine get more harmonics when increasing the bitrate #34

asoulier opened this issue Jul 13, 2023 · 3 comments

Comments

@asoulier
Copy link
Collaborator

asoulier commented Jul 13, 2023

@WenzhengQ has reported:

I disable ltpf unconditionally  in analyse() function of the lc3.c file; output sine signal is normal; 

//    if (nn_flag)
        lc3_ltpf_disable(&side->ltpf);

But I set encode bitrate=500kbps, encode the same full scale sweep sine(20hz-24khz)  and decode the bitstream;  the ouput sine signal has more harmonic at higher sinus frequency; when i set encode bitrate=128kbps, output sine has less harmonic  than bitrate=500kbps;

1.encode the wav
./elc3 -b 500000 -m 10 48khz_16bit_2ch.wav 48khz_16bit_2ch_enc_500kbps.bin
2.decode the bitstream
./dlc3 48khz_16bit_2ch_enc_500kbps.bin 48khz_16bit_2ch_enc_500kbps_dec.wav

Originally posted by @WenzhengQ in #33 (comment)

@asoulier
Copy link
Collaborator Author

Thank for these observations.

Note that the bandwidth is limited to 20 KHz.
I have generated a mono linear sweep 20 Hz to 20 KHz.
And done the encoding/decoding loop :

./bin/elc3 /tmp/sweep.wav -b 64000 | ./bin/dlc3 > /tmp/sweep_64k.wav
./bin/elc3 /tmp/sweep.wav -b 128000 | ./bin/dlc3 > /tmp/sweep_128k.wav
./bin/elc3 /tmp/sweep.wav -b 256000 | ./bin/dlc3 > /tmp/sweep_256k.wav

image

The first track is the linear spectrogram of source sweep, next it's 64k, 128k and 256k ones.

It seems you're completely right. I will look in following days.
Thanks.

@asoulier
Copy link
Collaborator Author

asoulier commented Jul 25, 2023

@WenzhengQ, can you double check with the fix 67f2231.
That looks ok on my side.

For the background: there is 2 quantization steps. The second step, slightly adjust the quantizer (global gain).
This gain should be limited to avoid saturation of the spectral coefficients, fixed to 16 bits by the bitstream.
This was not properly done, on the adjustment step, and select sometimes a quantizer one step too high.
And will occurs more often, when the compression ratio decrease (or bitrate increase).

@WenzhengQ
Copy link

@asoulier
I check with your fixed patch, the issue is fixed;
Thanks for your help.

@asoulier asoulier closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants