IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
LAME lowpass: stereo vs. mono, Lowpass differs with same bitrate per channel
dutch109
post Mar 6 2012, 21:42
Post #1





Group: Members
Posts: 123
Joined: 20-June 06
Member No.: 32044



I am encoding a mono file to mp3 with Lame and a bitrate of 80, and a stereo file with a bitrate of 160.
Since the bitrate per channel is the same in both cases, I'm curious why is the lowpass different?

Here are the command lines I use and the output I get:

CODE
lame --nohist --noreplaygain --preset cbr 80 mono.wav mono.mp3

CODE
LAME 3.98.4 64bits (http://www.mp3dev.org/)
Using polyphase lowpass filter, transition band: 20094 Hz - 20627 Hz
Encoding mono.wav to mono.mp3
Encoding as 44.1 kHz single-ch MPEG-1 Layer III (8.8x)  80 kbps qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  2298/2298  (100%)|    0:00/    0:00|    0:00/    0:00|   88.279x|    0:00
Writing LAME Tag...done


CODE
lame --nohist --noreplaygain --preset cbr 160 stereo.wav stereo.mp3

CODE
LAME 3.98.4 64bits (http://www.mp3dev.org/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding stereo.wav to stereo.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (8.8x) 160 kbps qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  2298/2298  (100%)|    0:01/    0:01|    0:01/    0:01|   35.732x|    0:00
Writing LAME Tag...done


I get the same lowpass difference using different settings (forcing dual mono mode, using cbr without the preset switch, etc.).

Thanks

This post has been edited by dutch109: Mar 6 2012, 21:48


--------------------
Vorbis -q2/5 (Android/PC) & WavPack -hhx6
http://playnoise.com/
Go to the top of the page
+Quote Post
halb27
post Mar 6 2012, 22:06
Post #2





Group: Members
Posts: 2435
Joined: 9-October 05
From: Dormagen, Germany
Member No.: 25015



That's certainly an error. With stereo files such a high lowpass is avoided even with CBR 256, and for stereo files lowpass frequency should be increased rather than decreased compared to the half bitrate mono setting because of the possibilities of joint stereo.


--------------------
lame3100m -V1 --insane-factor 0.75
Go to the top of the page
+Quote Post
dutch109
post Mar 6 2012, 22:31
Post #3





Group: Members
Posts: 123
Joined: 20-June 06
Member No.: 32044



I agree with you, that is why I am posting this here, hoping a lame dev will either enlighten me or confirm this is a bug. smile.gif


--------------------
Vorbis -q2/5 (Android/PC) & WavPack -hhx6
http://playnoise.com/
Go to the top of the page
+Quote Post
halb27
post Mar 6 2012, 22:55
Post #4





Group: Members
Posts: 2435
Joined: 9-October 05
From: Dormagen, Germany
Member No.: 25015



I guess the whole CBR/ABR section of Lame can benefit form tidying it up a bit, and AFAIK robert is planning or already doing it.


--------------------
lame3100m -V1 --insane-factor 0.75
Go to the top of the page
+Quote Post
apodtele
post Mar 8 2012, 15:09
Post #5





Group: Members
Posts: 39
Joined: 16-November 11
Member No.: 95199



QUOTE (dutch109 @ Mar 6 2012, 16:31) *
I agree with you, that is why I am posting this here, hoping a lame dev will either enlighten me or confirm this is a bug. smile.gif


You are using a 2-year old version. Do not expect any feedback from developers who mostly care about 3.99.5 these days. Even though the bug is likely not fixed in the recent version, you need to show some respect to their efforts over past 2 years.
Go to the top of the page
+Quote Post
dutch109
post Mar 8 2012, 21:17
Post #6





Group: Members
Posts: 123
Joined: 20-June 06
Member No.: 32044



QUOTE (apodtele @ Mar 8 2012, 15:09) *
QUOTE (dutch109 @ Mar 6 2012, 16:31) *
I agree with you, that is why I am posting this here, hoping a lame dev will either enlighten me or confirm this is a bug. smile.gif


You are using a 2-year old version. Do not expect any feedback from developers who mostly care about 3.99.5 these days. Even though the bug is likely not fixed in the recent version, you need to show some respect to their efforts over past 2 years.

I'm using the stable version that is in the official packages of my Linux distribution.
I checked here and here before posting this, to see if there was some changes in that area in the late versions.

But you are right, I should have double checked by running the latest version.
I manually compiled one and I get the same exact behaviour.

So I compiled another one with debug symbols, and by debugging the lame executable when encoding a mono file, I found where the bug is located.

The problem is fairly trivial, so I wrote a patch to fix it and sent it to the Lame dev mailing list, where it is currently waiting for review and approval.


--------------------
Vorbis -q2/5 (Android/PC) & WavPack -hhx6
http://playnoise.com/
Go to the top of the page
+Quote Post
apodtele
post Mar 8 2012, 22:37
Post #7





Group: Members
Posts: 39
Joined: 16-November 11
Member No.: 95199



QUOTE (dutch109 @ Mar 8 2012, 15:17) *
But you are right, I should have double checked by running the latest version.
I manually compiled one and I get the same exact behaviour.

So I compiled another one with debug symbols, and by debugging the lame executable when encoding a mono file, I found where the bug is located.

The problem is fairly trivial, so I wrote a patch to fix it and sent it to the Lame dev mailing list, where it is currently waiting for review and approval.


That's proactive! You patch essentially moves multiplification from one place to another and changes the factor from 1.5 to 2.
I'm guessing that a one-liner 1.5 -> 2.0. was not sufficient. Right?
Go to the top of the page
+Quote Post
saratoga
post Mar 8 2012, 22:45
Post #8





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



QUOTE (dutch109 @ Mar 8 2012, 15:17) *
The problem is fairly trivial, so I wrote a patch to fix it and sent it to the Lame dev mailing list, where it is currently waiting for review and approval.


Ha, nice work!

Patch in case anyone is curious:

http://sourceforge.net/mailarchive/forum.p...m_name=lame-dev
Go to the top of the page
+Quote Post
dutch109
post Mar 8 2012, 23:00
Post #9





Group: Members
Posts: 123
Joined: 20-June 06
Member No.: 32044



QUOTE (apodtele @ Mar 8 2012, 22:37) *
You patch essentially moves multiplification from one place to another and changes the factor from 1.5 to 2.

Nope, that is not what it does.

The original code was:
- calculating the optimal lowpass for the bitrate ignoring the number of channel, so for a 80kbps mono track, the lowpass would be 13.5KHz
- multiplying that lowpass by 1.5 if the track is mono, that gave us our incorrect 20KHz lowpass

With my patch, the initial lowpass calculation is done by taking into account the number of channels, so if the track is mono with a bitrate of 80, it chooses the index in the freq_map array as if the track was 160 stereo, in this case it is a 17.5KHz lowpass.
With that change a 80kbps mono encoding has the same lowpass as a 160kbps stereo one.

This post has been edited by dutch109: Mar 8 2012, 23:12


--------------------
Vorbis -q2/5 (Android/PC) & WavPack -hhx6
http://playnoise.com/
Go to the top of the page
+Quote Post
pdq
post Mar 9 2012, 04:32
Post #10





Group: Members
Posts: 3407
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



What lowpass do you get for a 320 kbps mono file?
Go to the top of the page
+Quote Post
dutch109
post Mar 9 2012, 10:32
Post #11





Group: Members
Posts: 123
Joined: 20-June 06
Member No.: 32044



I was expecting that one wink.gif

The default lowpass for a mono track above 160kbps is 20KHz, as expected.
Same for stereo freeformat above 320kbps.

This post has been edited by dutch109: Mar 9 2012, 10:34


--------------------
Vorbis -q2/5 (Android/PC) & WavPack -hhx6
http://playnoise.com/
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: 21st September 2014 - 01:14