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

8bit quantization #8

Open
CornN64 opened this issue Jul 1, 2021 · 0 comments
Open

8bit quantization #8

CornN64 opened this issue Jul 1, 2021 · 0 comments

Comments

@CornN64
Copy link

CornN64 commented Jul 1, 2021

To improve the 8bit quantization in the RTL mode with ½ LSB and round it to the nearest LSB I would suggest to replace the lines

*(data++) = (unsigned char)(((*xi << sample_shift) >> 8) + 128);
*(data++) = (unsigned char)(((*xq << sample_shift) >> 8) + 128);

with

*(data++) = (unsigned char)((((*xi << sample_shift) + 0x80) >> 8) + 128);
*(data++) = (unsigned char)((((*xq << sample_shift) + 0x80) >> 8) + 128);

or even more optimized

*(data++) = (unsigned char)(((*xi << sample_shift) + 0x8080) >> 8);
*(data++) = (unsigned char)(((*xq << sample_shift) + 0x8080) >> 8);

Cheers

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

1 participant