IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Dense newbie question about LossyWAV
Wally Walters
post Dec 6 2010, 20:12
Post #1





Group: Members
Posts: 19
Joined: 16-April 07
Member No.: 42587



I read the wiki and several threads here, but I'm still not clear on the following two questions:

1. If LossyWAV is not lossless, what exactly is lost?
2. How does the audio signal produced by LossyWav differ from the original audio signal?

Sorry for my poor English, I'm a product of the U.S. education system.

Thanks!

This post has been edited by Wally Walters: Dec 6 2010, 20:13
Go to the top of the page
+Quote Post
Nick.C
post Dec 6 2010, 20:21
Post #2


lossyWAV Developer


Group: Developer
Posts: 1787
Joined: 11-April 07
From: Wherever here is
Member No.: 42400



Hi there,

1) lossyWAV exploits a feature of FLAC, Wavpack, TAK and some other lossless codecs whereby the signal is encoded more efficiently when one (or more) lower significant bits (LSBs) are *always* zero for a particular block of audio being processed. What lossyWAV does is to add (an acceptable level of) noise to the signal by rounding to a calculated number of LSBs (i.e. bits-to-remove) for the audio block in question (which will be affected dependent on quality setting). This is dynamic and can change from block to block. The added noise caused by rounding off a number of LSBs is pre-calculated and the number of bits-to-remove is determined by an algorithm which includes the use of FFT analyses of at least two lengths (5msec and 20msec by default for 44.1kHz audio).

2) The difference is merely the rounding error for the number of bits removed for each codec-block.

The analysis is channel independent and different numbers of bits-to-remove can be removed from each channel.

[edit] Clarity. [/edit]

This post has been edited by Nick.C: Dec 6 2010, 21:17


--------------------
lossyWAV -q X -a 4 --feedback 4| FLAC -8 ~= 320kbps
Go to the top of the page
+Quote Post
Fandango
post Dec 7 2010, 02:52
Post #3





Group: Members
Posts: 1548
Joined: 13-August 03
Member No.: 8353



It kinda looks like this:


wink.gif
Go to the top of the page
+Quote Post
mjb2006
post Dec 7 2010, 03:20
Post #4





Group: Members
Posts: 760
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



A slightly less technical explanation, possibly inaccurate (someone correct me if it is): All that's being lost are the bits that provide the lowest-amplitude (quietest) variations in the signal. Strategically zeroing those bits makes the quietest sounds (already probably masked by the loud sounds) be totally silent. Having all n LSBs zeroed in every sample in a block (1 block = 4096 samples by default, in FLAC) results in a huge space savings in that block, because of the way FLAC happens to handle that kind of signal. There's no need for the codec to store data for reconstructing 16-bit samples if the lowest n bits are all zero; it can instead just deal with 16-minus-n-bit samples, and then shift them after decoding. (Well, that's in effect; I don't pretend to know what actually goes on in the encoder). n will vary from block to block depending on how much noise/inaccuracy would be introduced by zeroing more bits. The goal is to zero as many as possible while keeping the imprecision below an audible threshold, the standard target being the signal's noise floor. For most music you're not going to be losing any musical signal. I'm curious to know if anyone has actually found any ABX-able examples yet.

This post has been edited by mjb2006: Dec 7 2010, 03:23
Go to the top of the page
+Quote Post
Wally Walters
post Dec 7 2010, 04:17
Post #5





Group: Members
Posts: 19
Joined: 16-April 07
Member No.: 42587



So how different would the reconstructed LossyWAV file look from the original?
Go to the top of the page
+Quote Post
mjb2006
post Dec 7 2010, 05:03
Post #6





Group: Members
Posts: 760
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



QUOTE (Wally Walters @ Dec 6 2010, 20:17) *
So how different would the reconstructed LossyWAV file look from the original?

Do you listen with your eyes? smile.gif 0.5% different, 5% different, 50% different...who cares, as long as the difference isn't audible?
Go to the top of the page
+Quote Post
Wally Walters
post Dec 7 2010, 07:58
Post #7





Group: Members
Posts: 19
Joined: 16-April 07
Member No.: 42587



Just curious how close the reconstructed signal is to the original.
Go to the top of the page
+Quote Post
Nick.C
post Dec 7 2010, 08:41
Post #8


lossyWAV Developer


Group: Developer
Posts: 1787
Joined: 11-April 07
From: Wherever here is
Member No.: 42400



Try processing a file and use the --correction parameter. This will produce two files - the processed audio and a correction file that can be reintegated with the processed audio to recreate the original. Have a look at the correction file to get a feel for the difference between the original and the processed audio.


--------------------
lossyWAV -q X -a 4 --feedback 4| FLAC -8 ~= 320kbps
Go to the top of the page
+Quote Post
Rotareneg
post Dec 7 2010, 08:45
Post #9





Group: Members
Posts: 194
Joined: 18-March 05
From: Non-Euclidean
Member No.: 20701



There isn't a "reconstructed signal," the result of LossyWAV processing is uncompressed audio, just like the input.

LossyWAV adds white noise to the audio, the amount of noise depending on how much the program calculates it can add without being audible (the threshold being adjustable via the quality setting.)
Go to the top of the page
+Quote Post
Wally Walters
post Dec 7 2010, 19:25
Post #10





Group: Members
Posts: 19
Joined: 16-April 07
Member No.: 42587



Toldja I was dense. But I think I understand better now. Thanks everybody!
Go to the top of the page
+Quote Post
[JAZ]
post Dec 7 2010, 19:48
Post #11





Group: Members
Posts: 1764
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



Let's see if this explanation is easier to understand:

The output of lossywav is the same signal as input, plus some dynamically added noise. As if lossywav controlled a volume knob which inputs noise, and decided to add more or less noise depending on the analisys it does (the analisys is done each 512 samples, which is around 10 milliseconds).

I recommend you to encode something at the minimum quality settings of losssywav ( -q 0 , or even -q -2 (minus 2)), and listen to the original and the output. In some cases it is possible that you won't hear the difference even in this extreme setting. You will simply hear more background noise.


The technical details are that it isn't really adding (white) noise, but reducing the bit width precision of the signal and doing noise shaping to reduce the effects of quantization distortion. The reason it does it this way, like Nick mentioned, is to exploit the features of some lossless codecs that can encode this type of signals with a lower bitrate.


QUOTE (mjb2006 @ Dec 7 2010, 03:20) *
A slightly less technical explanation, possibly inaccurate (someone correct me if it is)


Well.. yes.. it's innacurate. It can lead to think that it removes sounds depending on its amplitude.
Also, 1 FLAC block is 4096 at -8, but lossywav uses smaller blocks. That's why increasing from flac -5 to flac -8 doesn't help much with lossywav signals.
Go to the top of the page
+Quote Post
bandpass
post Aug 8 2011, 10:14
Post #12





Group: Members
Posts: 326
Joined: 3-August 08
From: UK
Member No.: 56644



Seems a bit odd to name an algorithm after a container format—using such logic, µ-law might also be called lossyWAV. 'Block Precision Formatting' or somesuch might be a better name.
Go to the top of the page
+Quote Post
Nick.C
post Aug 8 2011, 17:30
Post #13


lossyWAV Developer


Group: Developer
Posts: 1787
Joined: 11-April 07
From: Wherever here is
Member No.: 42400



In retrospect, it may have been better to use a name such as lossyPCM. However as lossyWAV was first released a little over three years ago it's a bit too late to change the name....


--------------------
lossyWAV -q X -a 4 --feedback 4| FLAC -8 ~= 320kbps
Go to the top of the page
+Quote Post
lvqcl
post Aug 8 2011, 17:39
Post #14





Group: Developer
Posts: 3338
Joined: 2-December 07
Member No.: 49183



After all, it's *.lossy.wav wink.gif
Go to the top of the page
+Quote Post
chrizoo
post Sep 13 2011, 08:00
Post #15





Group: Members
Posts: 345
Joined: 25-March 08
Member No.: 52274



QUOTE (mjb2006 @ Dec 7 2010, 03:20) *
A slightly less technical explanation [...] Strategically zeroing those bits makes the quietest sounds (already probably masked by the loud sounds) be totally silent.

I'm really no expert, but I don't think this is correct. It has nothing to do with silent sounds or loud sounds. Your explanation suggests, that a file which is loud from beginning to end without any silent parts, would not benefit from lossyWAV which AFAIK is not the case. Rather than affecting the amplitude or "quiet sounds" I *think* what happens is that with lossyWAV you lose a little bit of precision (LSBs) which results in an (allegedly) tiny amount of added noise. During this process it might happen that "almost silence" is changed to "absolute silence", but if that is the case I think this is only a side benefit and not the core idea of lossyWAV. Corrections welcome.

QUOTE (bandpass @ Aug 8 2011, 10:14) *
Seems a bit odd to name an algorithm after a container format—using such logic, µ-law might also be called lossyWAV.

+1

This post has been edited by chrizoo: Sep 13 2011, 08:02
Go to the top of the page
+Quote Post
Northpack
post Sep 13 2011, 09:26
Post #16





Group: Members
Posts: 455
Joined: 16-December 01
Member No.: 664



QUOTE (chrizoo @ Sep 13 2011, 08:00) *
QUOTE (mjb2006 @ Dec 7 2010, 03:20) *
A slightly less technical explanation [...] Strategically zeroing those bits makes the quietest sounds (already probably masked by the loud sounds) be totally silent.

I'm really no expert, but I don't think this is correct. It has nothing to do with silent sounds or loud sounds. Your explanation suggests, that a file which is loud from beginning to end without any silent parts, would not benefit from lossyWAV which AFAIK is not the case. Rather than affecting the amplitude or "quiet sounds" I *think* what happens is that with lossyWAV you lose a little bit of precision (LSBs) which results in an (allegedly) tiny amount of added noise.

That's absolutely correct.
QUOTE
During this process it might happen that "almost silence" is changed to "absolute silence", but if that is the case I think this is only a side benefit and not the core idea of lossyWAV. Corrections welcome.

That won't happen, removing bits will always add noise, as you've said above. However, lossyWAV will treat "almost silence" very carefully and probably keep most of the bits, because when there is no louder signal to mask the added noise, it's more likely that you will notice it.

This post has been edited by Northpack: Sep 13 2011, 09:27
Go to the top of the page
+Quote Post
mjb2006
post Sep 13 2011, 10:10
Post #17





Group: Members
Posts: 760
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



By quietest sounds, I didn't mean quiet passages in the music, but rather just the tiny variations in amplitude provided by the LSBs. But you're right, it's not the best analogy.
Go to the top of the page
+Quote Post
Northpack
post Sep 13 2011, 10:30
Post #18





Group: Members
Posts: 455
Joined: 16-December 01
Member No.: 664



QUOTE (mjb2006 @ Sep 13 2011, 10:10) *
By quietest sounds, I didn't mean quiet passages in the music, but rather just the tiny variations in amplitude provided by the LSBs.

That still holds a misconception: by removing the "tiny variations" within the LSBs, you'll always add noise. Bear in mind that a given frequency component consists of hundreds or thousands of samples, so you can't draw any conclusion by looking at a single sample.
Go to the top of the page
+Quote Post
saratoga
post Sep 13 2011, 18:53
Post #19





Group: Members
Posts: 4866
Joined: 2-September 02
Member No.: 3264



QUOTE (mjb2006 @ Sep 13 2011, 05:10) *
By quietest sounds, I didn't mean quiet passages in the music, but rather just the tiny variations in amplitude provided by the LSBs. But you're right, it's not the best analogy.


Yeah but it can't make them silent, it'll just make them noisier.
Go to the top of the page
+Quote Post
mjb2006
post Sep 13 2011, 21:23
Post #20





Group: Members
Posts: 760
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



Thanks for correcting my mistaken simplifications, guys. I am not too proud to admit I was wrong. I was wrong.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 30th July 2014 - 06:59