bs1770demo can produce NaN as loudness result
The bs1770demo python wrapper function relies on the "Obtained level" and "Scaling factor" output by the bs1770demo binary: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-processing-scripts/-/blob/main/ivas_processing_scripts/audiotools/wrappers/bs1770.py#L136-138
For certain files, this value can be reported as nan, an example is attached (found by @treffehn while working on background noise mixing):
❯ bs1770demo -nchan 2 tmp_loudness.pcm /dev/null
Input file:       tmp_loudness.pcm
Output file:      /dev/null
nchan:            2
Input level:      nan
Target level:     -26.000000
Obtained level:   nan
Scaling factor:   nan
--> Done processing 170667 samplesWe need to decide what to do in such a scenario; I see the following options:
- Patch bs1770demo to fix this (not sure how easy this is)
- Use the RMS value computed in python
- Use the RMS value reported from bs1770demo (I think there was a patch in the works?)