Sebastian Mares
Sep 30 2003, 20:17
Hello!
I know that Joint Stereo (actually Mid/Side Stereo encoding) will produce one mid. channel containing the main data and a side channel containing the difference between the L and R channels. (I hope I described it OK). Also, as far as I know, Mid/Side Stereo will reproduce the full stereo effect (unlike Intensity Stereo) - so it is basicly lossless.
Now here comes my problem: there was a site once (http://harmsy.freeuk.com/mostync/) which contained a very big article about Joint Stereo. At the beginning of the article, the author wrote that Mid/Side Stereo is lossless and demonstrated it using the Mid/Side Stereo encoding/decoding formulas. Later, he showed another example (by showing how 6 samples of stereo music would look like, then the same samples as Mid/Side Stereo and then the decoded samples again) where NOT the same values came out. He also said that the loss is very small, though.
Is the loss caused by Mid/Side Stereo, or by the quantization/psychoacoustics? Basicly, is Mid/Side Stereo really lossless?
Thanks,
Sebastian Mares
M = (L + R)/2
S = (L - R)/2
L = M + S
R = M - S
(Matrix notation would be easier)
Ok, filling the L and R in the M and S formulas will give M = M and S = S

But as you see there is a scaling of /2, if (L + R) or (L - R) is odd, then you will get some loss.
Noticeable error in audio coding definately comes from psychoacoustics and quantisation.
Menno
Sebastian Mares
Sep 30 2003, 20:51
OK, let us assume:
L = 23
R = 15
Then:
Encoding:
M = (23 + 15) / 2 = 19
S = (23 - 15) / 2 = 4
Decoding:
L = 19 + 4 = 23
R = 19 - 4 = 15
That means that it is lossless... Now, can L or R actually be 23,5 or 15,7, or do they have to be integers?
Edit: If they can be floating point values, then some rounding errors may occur.
R+L and R-L are even in your example, they must be uneven for the loss to happen.
In general, the 'loss' in joint stereo is simple rounding issues, which are far below the audible level.
sony666
Sep 30 2003, 23:37
how exactly can you save bits when you store M/S instead of L/R..
I assume S is very small and therefore a smaller integer type, right?
Ivan Dimkovic
Oct 1 2003, 00:04
QUOTE
how exactly can you save bits when you store M/S instead of L/R..
I assume S is very small and therefore a smaller integer type, right
MP3, AAC and some other codecs use so-called 'power law' quantizer - i.e. stronger signal needs more bits to be coded (with huffman codebooks).
If the L and R channel are very similar, the S channel will contain almost no energy, and it would require very low number of bits.
But the main purpose of joint stereo is not to save bits, but to account for some stereo unmasking problems that could arise.
NumLOCK
Oct 1 2003, 00:25
Here's a new (I think) question:
When encoding, say, a sound with lame --aps, some frames will be encoded in L/R (not M/S) stereo. Are the unmasking effects still taken into account for those frames ?
Ivan Dimkovic
Oct 1 2003, 00:34
Yes, they are - unmasking effects appear when the sounds in some frequency areas of L and R channel have very similar masking threshold level (in dB)
L/R coding mode is used exactly when the oposite condition is met - when left and right channel differ too much - so, no unmasking problems in that case.
So, consider something like this to be a reasonable psychoacoustic thinking:
- Do L and R channels differ less than some threshold (say, 2 dB) ?
- If YES, then employ M/S coding for that band, and also employ "masking level depression" (MLD), by correcting of the thresholds
- If NO, then employ L/R coding for that band
The problem with MP3 is, that it do not allow switching per frequency band, only per frame - so you need to come out with some kind of averaging mechanism.
sony666
Oct 1 2003, 02:11
thanks Ivan

Menno's explanation was just too easy to be the whole truth
NumLOCK
Oct 1 2003, 10:39
Yes, thank you for this good explanation
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.