klangfreund / LUFSMeter

An implementation of the loudness measurement algorithm ITU-R BS.1770
208 stars 30 forks source link

How to distinguish between ITU.R BS.1770 (-1, -2, -3, -4) and EBU R128 #2

Closed christianscheuer closed 5 years ago

christianscheuer commented 5 years ago

This code is great - very clean and well documented. Good reading.

However I'm not entirely sure which of those ever so slightly different algorithms this code is actually running. It mentions both BS.1770 and EBU in the code.

Would it be possible to swap between the different algorithms mentioned in the title?

klangfreund commented 5 years ago

Thank you for your kind words!

The integrated loudness is defined in ITU-R BS.1770. The momentary loudness and the short-term loudness are defined in EBU TECH 3341 (which refers to ITU-R BS.1770). The loudness range is defined in EBU TECH 3342 (which refers to ITU-R BS.1770). EBU R 128 refers to all of them.

Therefore it is not possible to have EBU 128 without ITU-R BS.1770.

On the other hand, if you only provide the integrated loudness to the user, it's probably legit to call it an "ITU-R BS.1770 only" loudness meter.

This implementation is compliant with ITU.R BS.1770-2, ITU.R BS.1770-3 and ITU.R BS.1770-4. All at the same time.

christianscheuer commented 5 years ago

Ah, very interesting. Thank you for those details. Please bear with me, I'll try to explain why I still think the distinction matters for measurements.

In the film sound community it seems to be the case that these versions of the standards do yield different measurements, and that it can make a film fail QC for example, if the measurement at mix time was done with a different version of the standard than when being evaluated. One of the parameters that I've read about is whether or not the noise gate is applied in the measurement of integrated/program loudness. Since the gate essentially means everything below the relative threshold will not be counted in the integrated loudness, it can mean a big difference for shows with a large loudness range.

From what I can read here.. https://toneprints.com/media/1017421/lundt013011.pdf ..it appears that 1770 and 1770-1 uses ungated measurement, whereas EBU R128/Tech 3341 uses a -8 LU relative gate (G8) (see page 3 for a table that shows the differences in integrated loudness whether or not the gate is applied).

Reading here https://service.tcgroup.tc/loudness-standards.asp and here https://tech.ebu.ch/news/itu-publishes-new-itu-r-bs1770-2-with-eb-15apr11 it seems that 1770-2 implemented the noise gate from EBU R128, although with a -10 LU relative gate. It appears from reading this that EBU R128 may have been updated to meet the -10 LU from 1770-2. It appears from reading here that the 1770-3 and 1770-4 changed filtering and input channel consumption, respectively.

Thomas Lund's table on page 3 here illustrates it pretty well I think, that the gate settings (and other details) can have a big impact on the integrated loudness readout. "The Matrix" has a difference of 4 LU between measuring the integrated loudness with or without the G8 gate.

So - with all this being said, I'm hoping still to learn a little more of which combinations of these standards that you implemented in the code. Hope this makes sense, and thank you again for taking the time to answer and help me understand.

klangfreund commented 5 years ago

I'm aware that ITU-R BS.1770-1 doesn't use gating and that it yields to quite different results. I have created an implementation for it to be used in my commercial products, but I didn't found time to add it to this repository yet.

I've painstakingly marked all differences between the ITU-R BS.1770 revisions (It's a pity that the changes are not mentioned explicitly by the ITU), but according to my observations there are no changes in any filtering from revision 2 to revision 3 in Annex 1 which describes the actual loudness measurement algorithm. There are some additional filter descriptions for the true-peak calculation in revision 3, Annex 2, but they don't affect the loudness measurement at all. I might be wrong, though. If you can tell me exactly where this "changed filtering" is supposed to be in ITU-R BS.1770-3, I'm happy to take a look at it. Attached is revision 3, where I have marked the differences between revision 2 and revision 3.

Between ITU-R BS.1770-3 and ITU-R BS.1770-4, there are also no differences in Annex 1.

R-REC-BS.1770-3-201208_differences_to_rev2_marked_by_Samuel.pdf

christianscheuer commented 5 years ago

Thank you again for helping me understand. Your code is definitely very well documented as to all of the various revisions of the standards it derives its code from, but it's still a little over my head to understand exactly how the math/formulas translate to the code, that's why I was asking :) But your guidance here and the documents in hand will for sure help me understand even more now.

I have created an implementation for it to be used in my commercial products, but I didn't found time to add it to this repository yet. Cool!

Thank you so much for explaining the changes and how they shouldn't relate to the loudness measurement. Your initial statement here:

This implementation is compliant with ITU.R BS.1770-2, ITU.R BS.1770-3 and ITU.R BS.1770-4. All at the same time.

makes a lot more sense to me now.

I got further clarification of that by reading that the EBU Tech 3341 specifies the relative gate at -10 LU, and specifically mentions that it corresponds to the 1770-4 definition.

Thanks to your details and the text you had highlighted between the revisions, I was able to also understand from reading the code that you're using the rev3+ channel weighting set forth on page 7.

Once again thank you for making this tool available. Lots to learn from reading your code, and now I feel more confident knowing how it maps to the standards.

klangfreund commented 5 years ago

I'm glad I could help.

It's great that you take a closer look at the code at hand! Don't hesitate to ask if you can't figure out what a certain section of the code does.

A new commercial product release will keep me busy for the next few weeks. But if I find some time in between, I'll add the ITU-R BS.1770-1 loudness measurement capability to this repository.