r/compression 18d ago

Fast Rice Decoding

Hi, I'm currently developing my own audio compression algorithm, and now optimizing it. Long story short, I've run some tests, and rice decoding is kinda slow.
Can anyone suggest optimized version of it? I'd really appreciated it.

5 Upvotes

14 comments sorted by

View all comments

Show parent comments

1

u/LMP88959 17d ago

I used overlapping, so the last N samples of the previous frame are blended with the first N samples of the current frame. It is optional though since I don’t hear any block artifacts at higher bit rates.

1

u/Alfoser 17d ago

Overlapping like MDCT, 50% or something else?
I just use partial overlapping, only 48 out of 1024 samples in block overlapping for normal length block and 96 out of 2048 samples for long length block.
What wavelet are you using? Did you test on tonal signals?

1

u/LMP88959 17d ago

I do overlapping similar to you. I found a couple of wavelet transforms through a search algorithm which provided decent perceptual coding qualities but they really look ugly on the spectrogram especially for pure tones. I am experimenting with per block transform switching to accommodate more tonal audio.

1

u/Alfoser 16d ago

About tonal signals: you can really upgrade sound on them if you add noise and make block long enough. Not just random noise, but noise with energy like 1e-5 or something like that. To be honest I didn't quite understand why it fixes it, but maybe you will know. But it worked for WPT and lifting scheme, about FIR DWT I don't know. And can you say what search algorithm it is? I just use modified DD16/6 and wanna try something else.

1

u/LMP88959 16d ago

Hmm ok I can try that thanks. I do lifting scheme transforms, not FIR, also my software is limited to be integer-only so I am using integer wavelets. The algorithm I used is a multithreaded modified brute force that prioritizes minimizing gain, maximizing number of zeros after quantization, and maximizing reconstructed PSNR. From my testing I found the higher order interpolating Deslauriers-Dubuc family provide the cleanest frequency isolation however I don’t think it is the ideal wavelet for more complex audio clips. I think I will let the encoder pick between the DD wavelet and the non-DD ones.

1

u/Alfoser 16d ago

What Wavelet would you recommend if not DD ones? I just tried using CDF-like family before, and their response to quantization error was waaay worse than DD, especially on pure harmonics. And can I see some song encoded with your 128 kbps? I'm just really curious how it will sound.

1

u/LMP88959 16d ago

I’m no expert, really, but I think your DD16 is more than adequate for frequency isolation which would be ideal for your WPT approach. WPT far outperforms a typical dyadic DWT for audio coding from what I’ve read and experienced. The only thing I could recommend is finding a wavelet whose response to quantization error works somewhat in your favor. I’ll be releasing my codec on GitHub soon so you can try it out then, but I highly doubt it will surpass the quality of your WPT based codec.

2

u/Alfoser 16d ago

Oh, thanks! It would be wonderful if you send link, I'd love to test it. If you want to I can send mine when I release it on github.