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: Small question about Joint Stereo (Read 4779 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Small question about Joint Stereo

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

Small question about Joint Stereo

Reply #1
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

Small question about Joint Stereo

Reply #2
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.

Small question about Joint Stereo

Reply #3
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.

Small question about Joint Stereo

Reply #4
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?

Small question about Joint Stereo

Reply #5
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.

Small question about Joint Stereo

Reply #6
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 ?

Small question about Joint Stereo

Reply #7
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.

Small question about Joint Stereo

Reply #8
thanks Ivan
Menno's explanation was just too easy to be the whole truth

 

Small question about Joint Stereo

Reply #9
Yes, thank you for this good explanation