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: Theory of -Z vs. -X3 (Read 5716 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Theory of -Z vs. -X3

I apologize to Dibrom and everyone for asking about switches which they probably have already explained...but I have been awaiting the FAQ that people speak about and I'm dying for more knowledge... :-)

I like the quality that --dm-preset standard gives in Lame 3.90 alpha 7 August 16th build (in win32lame1.7).

Originally Dibrom recommended -Z for higher quality and then -X3

I have some knowledge of the difference but could use some correcting and enlightenment on what I understand correctly and incorrectly...I truly appreciate any help.

Correct analysis?:
----------------------

(1) adding -Z to --dm-preset standard disables scalefac (and (noiseshaping too?)  It increases the bitrate but gives more quality to files that have many transients.  I don't know if it has any benefits to files without transients...

Unfortunately I forgot what scalefactors were...please help...

(2) adding -X3 to --dm-preset standard alters the noise shaping algorithm, which works WITH scalefac, I believe.  The bitrate goes up considerably but the quality should be better because noise shaping deals with quantization, and the quantization of the music should be more accurate with -X3 than without it.
I think this helps all types of music not just transient-stuff...

(3) adding both -Z and -X3 seems to be self-defeating (Because one works with scalefac the other disables scalefac) am I right?

(4) I usually don't care about bitrate but I noticed that --dm-prest standard -Z (no -X3) gave one of my rock albums an average bitrate of 231 and the same album encoded with -X3 (no Z) gave an average of 259... almost 30 kbps...

I guess I'm trying to see if the 30 kbps is worth it...or if it will only help a very small percentage of files...

I would also like commentary on
which is the best bang for the buck:
(A) --dm-preset standard -Z (no -X3)
(B) --dm-preset standard -X3 (no -Z)

I thank everyone for their help, and btw this board rocks!

Take care,
RD

Theory of -Z vs. -X3

Reply #1
Quote
Originally posted by RD
(1) adding -Z to --dm-preset standard disables scalefac (and (noiseshaping too?)  It increases the bitrate but gives more quality to files that have many transients.  I don't know if it has any benefits to files without transients...

Unfortunately I forgot what scalefactors were...please help...

For the sake of clarity I will refrain from using the -Z switch as since it is a toggle switch now, it is too confusing.

First, nspsytune by default uses noise shaping 2 (aka scalefac_scale).  What this basically does is allow noise levels to come closer to calculated thresholds.

It doesn't really have anything to do with transients themselves, but it seems that in some cases scalefac_scale can cause problems where short blocks are used and on clips where noise levels reach a significant amount above calculated thresholds (such as on problem clips like fatboy and others).

Quote
(2) adding -X3 to --dm-preset standard alters the noise shaping algorithm, which works WITH scalefac, I believe.  The bitrate goes up considerably but the quality should be better because noise shaping deals with quantization, and the quantization of the music should be more accurate with -X3 than without it.
I think this helps all types of music not just transient-stuff...


Not exactly.  scalefac_scale is the noise shaping, the -X modes are the noise measuring.  The reason scalefac_scale doesn't cause problems with -X3 is because -X3 uses a much more strict method of calculating noise than -X1 (the default mode for nspsytune).  Thus the encoder attempts to keep the noise levels lower (because of the more strict measuring of -X3) and resultingly doesn't allow scalefac_scale as much as -X1 would.

Quote
(3) adding both -Z and -X3 seems to be self-defeating (Because one works with scalefac the other disables scalefac) am I right?


Not specifically.  Theoretically turning off noise shaping 2 (scalefac_scale) even with -X3 will keep the noise levels even lower.  The thing is, this is inefficient and unnecessary, this is why I don't recommend doing so.

Quote
(4) I usually don't care about bitrate but I noticed that --dm-prest standard -Z (no -X3) gave one of my rock albums an average bitrate of 231 and the same album encoded with -X3 (no Z) gave an average of 259... almost 30 kbps...


This will vary greatly.  I've seen cases where disabling noise shaping 2 can result in a 50kbps increase.  Overall, using -X3 will give you even higher quality than just disabling noise shaping 2, and will still give you nearly the same quality even with noise shaping 2 enabled.

Quote
I would also like commentary on
which is the best bang for the buck:
(A) --dm-preset standard -Z (no -X3)
(B) --dm-preset standard -X3 (no -Z)


I'd go with standard -X3.  On the other hand, I am not really recommending this because once my new compile comes out this should no longer be an issue anyway.  Things are already working as planned as it is, but I need to work out a few bitrate issues on certain clips still.

Theory of -Z vs. -X3

Reply #2
I've asked earlier if adding --vbr-mtrh to --dm-preset standard -X3 will cause some problems. That is clear now.

I've another question anyway: will I cause any trouble if I add --vbr-mtrh to --dm-preset standard -Z?
If I won't, is using version with X3 worth its slow speed compared to version with -Z and mtrh? Is the quality difference very big?

Theory of -Z vs. -X3

Reply #3
Quote
Originally posted by HomeK
I've asked earlier if adding --vbr-mtrh to --dm-preset standard -X3 will cause some problems. That is clear now.


I'm not sure where you may be drawing your conclusion from, but just to be sure, --vbr-mtrh will not work correctly with -X3.  vbr-mtrh does not rely on the same noise measuring techniques that cbr/abr/vbr-old do.  Robert is adding some new noise measuring modes which use the syntax of the -X switches I think, but they don't do exactly the same thing, and they aren't actually fully implemented yet.  So -X3 will not work as advertised with vbr-mtrh at the moment.

Quote
I've another question anyway: will I cause any trouble if I add --vbr-mtrh to --dm-preset standard -Z? 
If I won't, is using version with X3 worth its slow speed compared to version with -Z and mtrh? Is the quality difference very big?


Yes, for the same reason as shown above.  nspsytune relies on -X1 (maximum noise measuring) which vbr-mtrh does not provide.  You used to be able to enable maximum noise measuring with vbr-mtrh via -q1 and -q0 but I believe this has changed recently.  Even when you could do this via -q1 and -q0 you would get massively increased bitrates over what --dm-preset standard would normally provide.

In conclusion, --dm-preset standard -X3 is the current highest quality setup I know of, yes it may be slow, but it does provide significantly increased quality (and bitrate increases too much sometimes also, which is why I am working on modifications to LAME).  This is basically it.. any other combination of switches I know of is not going to be as optimal as that currently in regards to quality.

Theory of -Z vs. -X3

Reply #4
Whoa, fast answer, thanks  Now I'm of course going to use --dm-preset standard -X3 until you finish your new settings.

I'm afraid my English isn't as good as I'd like it to be. I often seems to me that people understand something little different that I wanted to say  Anyway I wanted to say that now I know that using --vbr-mtrh doesn't make sense with -dm -X3

I'll also have to study all those switches I don't understand :insane:

Theory of -Z vs. -X3

Reply #5
Quote
Originally posted by HomeK
I'm afraid my English isn't as good as I'd like it to be. I often seems to me that people understand something little different that I wanted to say  Anyway I wanted to say that now I know that using --vbr-mtrh doesn't make sense with -dm -X3


Actually your English is fine really  I understood what you said, I just wasn't sure what I may have said to give you that idea (which was correct actually ).. so I thought it'd just clarify to make sure, as the likelyhood of someone else asking about it was fairly high anyway

Edit: Nevermind, I found the thread where I told you about vbr-mtrh.  Forgot about that..

Theory of -Z vs. -X3

Reply #6
Dibrom,

Thanks for the very clear, good, and comprehensive explanation.
Aristotle says you can tell who is truly wise by how well they teach, and you teach well!

I am not a lame developer, but if I were I would give you the "Lame mp3 encoder Quality enhancement of the year award".

Again, I really appreciate your help and quick response.

With kind regards,
RD (Robert)

Theory of -Z vs. -X3

Reply #7
I'm still curious how the bitrates are determined.  WinAmp reports that
My Sharona is at 281 kbps, the highest of
the 150 or so I've encoded since I grasped that " --dm-preset standard -X3"
is very good.  What about that music so exercises the encoder?
  I'm intrigued because I recall reading of hand-wringing because Knack recording studio master tapes have been lost and what is available has been taken from vinyl.

Theory of -Z vs. -X3

Reply #8
Quote
Originally posted by ckjnigel
I'm still curious how the bitrates are determined.  WinAmp reports that 
My Sharona is at 281 kbps, the highest of 
the 150 or so I've encoded since I grasped that " --dm-preset standard -X3"
is very good.  What about that music so exercises the encoder? 
   I'm intrigued because I recall reading of hand-wringing because Knack recording studio master tapes have been lost and what is available has been taken from vinyl.


With -X3, a very noisy source could cause large increases in bitrate.  Since the album you mentioned came from vinyl, it could be possible that this is the cause.  I general though -X3 just attempts to keep noise levels down more than -X0 or -X1, so it is natural to see large increases in bitrate (and again is why I don't actually recommend it for use, though I concede it does offer very high quality).