Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Wavpack lossy mode noise shaping problem (Read 11377 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Wavpack lossy mode noise shaping problem

Hello David,

I've noticed some problems with several samples in the lossy mode involving auto-noise shaping.

It seems that noise shaping causes a big increase in perceived noise on *some* samples - others show improvement and others remain the same. The regressed cases are really obvious and you can hear the difference when turning noise shaping off without abx. The problem seems to have started in version 4.0 beta 3 and persists in the current version.

Some examples by sample:

http://ff123.net/samples/41_30sec.flac


A cymbal solo - good sample for hybrids. (listen to tack-tack around 4 second mark)

Without noise shaping:

-hb256s0 - noisy, dusty cymbals  abx 8/8
-hb320s0 - slight noise, near-transparent    abx 8/8
-hb384s0 - transparent

With normal noise shaping everything becomes much worse and I can abx 384k which is similar to 320k without noise shaping !. At 448k it is quite hard even with the damage, but I managed to abx it sometimes. Interesting that optimfrog DS is also suffering on this sample with --ans enabled - quality 0 --ans sound bad compared to without, quality 3 is abxed 13/16 but seems transparent without.

Another similar case:

http://ff123.net/samples/florida_seq.flac  (listen to the pffftt)

Your 'furious' sample is also affected in a similar fashion.

WV 4.0 b2 and previous versions handled all these better and it would be nice if this can be rectified for the next release.

Also, what do think about making 's0' the default again like in optimfrog ds ?
The real advantage of noise shaping seems to be for low-mid bitrates. At 320k its already hard to hear any differences and I use high bitrate around 450k. Either way I don't mind adding 's0' to the commandline.. I decided that I don't need noise shaping  for high bitrate since transparency is already reached and I am only adding more measured noise.. Anyway its just a thought and I welcome your comments.

Wavpack lossy mode noise shaping problem

Reply #1
Hi shadowking,

Haha, well it was actually 4.0 beta 3 where the noise shaping was "fixed"! 

The noise shaping value is actually a floating point value from -1.0 to +1.0. The default value for 44 kHz sampling is -0.5 which provides some rolloff of the noise at higher frequencies at the cost of slightly more noise at low frequencies. One of the reasons that this was choosen was that a certain WavPack user (remember den?) was complaining about the very high-frequency noise that he heard in many samples at 320 kbps. I was surprised at this (and have never really heard it) but I could see that at very high frequencies there was sometimes little sound in the recording to mask the added quantization noise.

There was another advantage of this negative noise shaping. By reducing the noise added at higher frequencies, it also tended to make the predictor work better which meant that hybrid lossless would get better compression and in some samples (that had little high frequencies) it could actually improve the total noise figure.

As you said, some samples improve with the noise shaping and some get worse. When I did extensive testing with EAQUAL I found that the -0.5 number gave about the best average perceptible noise numbers and it seemed to match what den considered about the best.

The downside, of course, is that on samples with a lot of high frequencies and large gaps in the midrange, the noise essentially gets shifted the wrong way (and the other advantage of helping the predictor doesn't work) and so a lot more noise appears at low frequencies. This is an artifact I can actually hear and, in fact, noticed the "furious" sample myself. If I listened at high volume in headphones (and could still hear to 20 kHz!) I might be bothered by the other problem too...

BTW, the change from beta 2 to beta 3 was that I figured out that I needed to change the way I did negative shaping (FIR to IIR) to really have the curve I wanted, and this allowed me to bump up the shaping value from -0.3 to -0.5.

So, the first thing I would be curious about is whether using a positive value (like +0.5 or even +1.0) would actually improve those samples for you over no shaping. I did a quick test here (I am not set up right now to do accurate listening tests because I still haven't found my headphone amp after moving) and this made a big improvement. Obviously this is not a real solution because it hurts on most samples, but it would be interesting to me.

At some point I would like to try again to reintroduce psychoacoustic analysis to have a real "quality" mode. In the nearer term I might play around with a simpler scheme to automatically adjust the noise shaping like Dualstream does (the current meaning of "auto" shaping in WavPack is only that the fixed value is choosen based on sample rate). I realize you say that Dualstream fails this sample too, but maybe that's a deficiency of Dualstream's method.

My hesitation in changing the value now would be that it would hurt the hybrid lossless compression ratio and I may suddenly have people complaining about the high-frequency noise (unless that was something that den could hear much more easily than most people). Having the noise shaping reduce at higher bitrates does make some sense and I'll look into that.

Thanks for taking the time to post your thoughts on this (and for using WavPack!) and please let me know if you do any more tests or think I'm all wet on this... 

David

Wavpack lossy mode noise shaping problem

Reply #2
Thanks for your helpful explanation.

I think that -0.5 will help people that are doing 200-250k encodes for future portable use etc. Using s0 makes a HF hiss a bit more obvious at these bitrate, s0.5 & s1 make it very obvious on some samples. Its possible that some people might complain if they were using lower bitrates. I tried s1 a while back and the furious like samples and it does help a lot - but regresses others. I did a short test on a sample today that gets worse with positive noise shaping values. I encoded one file using -hb200, one -hb200s0.5 and one -hb320s0.5. at 200k +0.5 had a much louder hiss and abxing the two was easy. I thought the 320k would also suffer so I tried to abx it against a reference lossless file. It was much tougher than I thought, at first I thought I heard a slight difference , got to 4/4, got confused, went to grab a drink and finaly gave up at 4/7. Abxing 200k was very easy.

So using +0.5 might give the best of both for higher bitrates, but I have to test more. I've got the feeling that hissing in the 'gaps' would simply dissolve at 350k+ and aggressive hf samples like furious would benefit greatly at the same time. Meanwhile s0 is good across all samples I've tested and seems quite stable.

I also remember a few posts that Den claimed to abx wavpack 3.x 320k all the time and 350k only sometimes. He did mention using very high volume to unmask the hiss that he learned at lower bitrates. I honestly never thought of this technique until he brought it up. I recently tried the same with wavpack 4. I 'learned ' problems at 200k at then raised the bitrate. at normal volumes even 256k sounds good on a lot of stuff, but raising the volume in the problem areas help you hear the hiss better. At 320k s0 it was a real close to call even with the volume raised - I did abx 2 or so samples this way - little differences. I wonder he was inducing an extreme listening situation or that wavpack 4 320k is more like wavpack 3.x 360k ??

Anyway, I'd love to test alpha builds with quality modes or anything that you come up with. Keep up the great work.

Wavpack lossy mode noise shaping problem

Reply #3
Quote
BTW, the change from beta 2 to beta 3 was that I figured out that I needed to change the way I did negative shaping (FIR to IIR) to really have the curve I wanted, and this allowed me to bump up the shaping value from -0.3 to -0.5.
[{POST_SNAPBACK}][/a]


Hi David !

You probably like to know how I did the noise sahping in my audio steganography tests. ([a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=36291]see this thread[/url])

I did an LPC analysis and used the LPC synthesis filter (all-pole minimum phase IIR) in combination with a static FIR noise shaper (all-zero minimum phase FIR). The LPC synthesis filter alone gets you a more or less equal signal to noise ratio over all frequencies. I combined this synthesis filter with a FIR noise shaper to increase the SNR for lower frequencies / decrease the SNR for higher frequencies. I actually designed this according to what the current Vorbis encoder does to white noise. So, on white noise this combinted noise shaper will give you the same noise power distribution like the Vorbis encoder's.

What puzzles me a bit though is: How are you combining prediction, quantization and noise shaping so the quantization errors can be removed with the correction file ?

Sebi

Wavpack lossy mode noise shaping problem

Reply #4
Hi Sebi,

Thanks for the information! When I read that original thread I was wondering exactly what you were doing because in a way your project is very much the same as mine: how to hide as much noise as possible in music and not hear it. I have thought about trying to implement some more complex noise shaping to reduce the audibility of the noise in WavPack and it would certainly be interesting to know how much improvement could be achieved.

This was briefly discussed some time ago in these threads:

http://www.hydrogenaudio.org/forums/index....showtopic=11623
http://www.hydrogenaudio.org/forums/index....showtopic=15855

To answer your question, first keep in mind that the correction file information is handled at the entropy encoder stage, so the signal that goes into the correction file is always white noise. The advantage of this is that even heavy noise shaping will not cause the lossy+correction size to go up (in fact it goes down if less high frequency noise makes the signal more predictable).

The disadvantage of this is that if the decoder wants to do lossless restoration then it must implement the same shaping on the white "correction" noise to calculate the actual noise added (and thereby the original audio). So, if the shaping used coefficients that were calculated with analysis of the original signal, then that must be repeated during decoding also (unless the required coefficients were updated infrequently enough that they could be quantized and sent in the correction file).

Of course, with lossy decoding, the noise shaping is completely transparent and needn't be considered at all.

(I just noticed that you reworded your question while I was composing this; let me know if it's still not clear...)

David

Wavpack lossy mode noise shaping problem

Reply #5
Quote
I also remember a few posts that Den claimed to abx wavpack 3.x 320k all the time and 350k only sometimes. He did mention using very high volume to unmask the hiss that he learned at lower bitrates. I honestly never thought of this technique until he brought it up. I recently tried the same with wavpack 4. I 'learned ' problems at 200k at then raised the bitrate. at normal volumes even 256k sounds good on a lot of stuff, but raising the volume in the problem areas help you hear the hiss better. At 320k s0 it was a real close to call even with the volume raised - I did abx 2 or so samples this way - little differences. I wonder he was inducing an extreme listening situation or that wavpack 4 320k is more like wavpack 3.x 360k ??

Anyway, I'd love to test alpha builds with quality modes or anything that you come up with. Keep up the great work.
[{POST_SNAPBACK}][/a]

First of all, there was a significant (about 2 dB) improvement in 4.0 with respect to noise in the hybrid mode. There's also a little bitrate bloat with 4.0 that didn't happen with previous versions (so 320 kbps with 3.97 really was 320 and not 330). The net result is that setting 320 now is very much like setting about 355 with 3.97 (and I do think den played stuff pretty loud).

I thought a little bit about this problem and figured out an easy way to implement the noise shaping so that I could keep the basic negative shaping most of the time but transition to positive shaping when appropriate. It seems to work pretty well on the samples I tried it on, and because it uses information already being generated by the decorrelator it doesn't slow anything down (unlike the hack I put into version 3.98b). I have posted the experimental version here:

[a href="http://www.wavpack.com/wavpack4x.zip]http://www.wavpack.com/wavpack4x.zip[/url]

The correction file breaks the decoder so I've taken out the -c option for now, and the -s option is gone so that there's no confusion (the new mode is always used in lossy mode). The resulting lossy files are perfectly legitimate for all decoders (they even play on RockBox). The -x option seems to work, but it may do weird things in some cases. Use at your own risk! 

If this ends up making a distinct improvement to the quality at lower bitrates, I'll consider putting it in. I hate breaking decoders unless there's a real good reason, but since this is only for the hybrid lossless mode and it's so simple I think it might be worth it.

As always, any feedback is appreciated!! 

Wavpack lossy mode noise shaping problem

Reply #6
Thanks!

I am planning on testing 10-15 samples - known critical and some less and will post results soon.

Wavpack lossy mode noise shaping problem

Reply #7
Quote
I am planning on testing 10-15 samples - known critical and some less and will post results soon.
[a href="index.php?act=findpost&pid=326764"][{POST_SNAPBACK}][/a]

That would be great, thanks! 

Wavpack lossy mode noise shaping problem

Reply #8
I did a relaxed test using 3 encodes at 200k :

Wavpack 4.22 -hb200
Wavpack 4.22 -hb200s0
Wavpack 4 EX -hb200

Quality at this bitrate isn't great, hiss is more distinct, wrapping itself around instruments and vocals in where there are gaps in music, but its easy to test and will reveal a lot. 256k is nearly 4db better and I really think that many samples will be near transparent, especially if the noise shaping works good.


wavpack noiseshaping test results

Overall differences between 4.22 and 422s0 aren't distinct when comparing many samples - obviously HF rich samples degrade 4.22, however more normal 'broadband' samples are better. Wavpack 4 EXP handled all HF samples very well, while retaining overall quality for the others. At times i felt that 4.22 was better, but abxing between them was quite difficult - so my take: The is no noticeable regression and there is a noticeable improvement on all HF material. This new noiseshaping is smarter.

I am planning a separate abx test as well for some of this samples at higher bitrate. Also I have to test -x modes as it gives me flac like decodes and high quality. New releases can safely have this auto-shaping - it will not harm quality and it will help alot at 200-260k and also on some critical samples at higher bitrate. All the -S options inc S0 must still be optional though.

David , so far this looks promising and I really appreciate this. What do you think ?

Wavpack lossy mode noise shaping problem

Reply #9
Code: [Select]
FRIEDMAN version 1.24 (Jan 17, 2002) http://ff123.net/
Tukey HSD analysis

Number of listeners: 13
Critical significance:  0.05
Tukey's HSD:   0.642

Means:

4exp     4.22s0   4.22    
 3.05     2.38     2.35  

-------------------------- Difference Matrix --------------------------

        4.22s0   4.22    
4exp       0.662*   0.700*
4.22s0              0.038  
-----------------------------------------------------------------------

4exp is better than 4.22s0, 4.22

Hope I am using the tool correctly.
edit: Forgot to mention that this is for shadowking's results.

Wavpack lossy mode noise shaping problem

Reply #10
These are very encouraging results! I will be interested to hear how 256 kbps fares. While there are still samples that are so highly tonal that they will always do poorly at 256 kbps (Guruboolez has given me several), it would be great to have a higher percentage of samples sound okay at that bitrate (without tweaking).

And yes, my plan (assuming no bad discoveries) would be that this would only alter the default behavior. Using the -S switch would produce the same results as before, and -S-0.5 would give the old default behavior. This could also be used in situations where someone needed compatibility with old decoders. 

Wavpack lossy mode noise shaping problem

Reply #11
I am going to test 256k between 4.22s-0.5 and 4.22exp in the next few days.

Wavpack lossy mode noise shaping problem

Reply #12
Hi David, I've uploaded results for 256k here:

http://users.tpg.com.au/adslt0rr/wavpack/w...oiseshaping.htm

Commandline for both encoders is -hb256

Problems remain for stock 4.22 with the HF samples and some might persist at higher bitrates, 4 exp is much improved but still abxable on extreme hf stuff. More 'normal' samples are reaching near transparency on both.. Some problems remain at this bitrate with tonal samples like naked voices, instruments etc, not artifacts but a background hiss change. On less tonal samples this perception is difficult to abx (elusive).

Overall 4 exp at 256k is good, similar to TC codecs at 160k with differences less annoying.

Wavpack lossy mode noise shaping problem

Reply #13
Hi shadowking 

Thanks for all your testing, I really appreciate it.

In the meantime, I have also done some testing and trying different things and think I've made some further improvements. When I have something close to a final version I'll post here again and if you'd be willing to give it a "sanity check" listen that would be great.