HydrogenAudio

Lossy Audio Compression => Opus => Topic started by: lithopsian on 2014-03-14 15:07:02

Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: lithopsian on 2014-03-14 15:07:02
I noticed that my CPU usage goes through the roof (ie. maxes out, around 10x what a 7 channel track takes) when decoding 8 channel Opus tracks, but only when it is outputting samples as floats.  The integer call runs at expected levels.  It appears to be due to the library itself rather than something dumb in my own code.  I can't really tell if it happens in libopusfile or libopus.
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: lvqcl on 2014-03-14 15:33:30
Sounds like a problem with denormals.
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: jmvalin on 2014-03-15 03:14:06
Sounds like a problem with denormals.


Denormals would not only cause problems with the float output because it's the same codepath until the very end. It would have to be problems in the application code, not in libopus.
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: lithopsian on 2014-03-17 22:17:09
Sounds like a problem with denormals.


Denormals would not only cause problems with the float output because it's the same codepath until the very end. It would have to be problems in the application code, not in libopus.

Seems unlikely to be in the application code.  Just slapping this in an infinite loop causes the issue:
Code: [Select]
ret=opus_read_float(info->opus_file, values, values_to_read, &cur_link);


Obviously there is also a read callback but that is simply an fread call that knows nothing about whether the decoder will be dealing with floats or how many channels there might be.

I'd like to try with more files, but 7.1 Opus files are pretty thin on the ground.
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: saratoga on 2014-03-18 00:58:32
Profile it?
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: lvqcl on 2014-03-18 03:18:01
What is opus_read_float? I cannot find this function anywhere.
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: lithopsian on 2014-03-18 13:58:28
Sorry, its op_read_float.  op_read (returns int) doesn't have the same issues.
http://www.opus-codec.org/docs/opusfile_api-0.5.pdf (http://www.opus-codec.org/docs/opusfile_api-0.5.pdf)
Title: Has anyone tried the Opus decoder library with floats and 8 channels?
Post by: lithopsian on 2014-03-18 14:29:59
I had some time to dig into this today.  jmvalin is right, it is an application issue and not a library issue.  The loop timer collapses to zero when the total bitrate goes past 32 * 8 (* 48000).  On a longer track I think it would settle down once the internal buffer was full, but on short test tracks it just thrashes the decoder as hard as it can go.