Performance and byte data

Jan 28, 2015 at 6:27 AM
Does anyone have any profiling data regarding this library compared to say libvorbisfile.dll? If not I will probably test the performance myself and may eventually post the details here.

When I load ogg files in Audacity, Audacity seems to be able to decode a 3 minute song in about 1/2 seconds, decoding the same .ogg song with NVorbs however takes much longer 4/5 seconds+.

Is NVoribs known to be much slower than the reference libvorbisfile implementation? 1.5x slower would be understandable but anything more is pushing it in terms of what I want to accomplish with this library.

Also is it possible to get byte (ushort) PCM data rather than float? Many Audio libraries use raw PCM data and don't support float, meaning I have to convert the array's returned by NVorbis which also adds to decoding time. Is this a ogg vorbis limitation (e.g. decoding returns float values) or does NVorbis just not support returning ushort data directly?

Either way this is still a fantastic pure C# ogg vorbis library and thank all those who were involved in making it.

Xanather.
Coordinator
Jan 28, 2015 at 2:29 PM
Thanks for giving NVorbis a try!

I profiled NVorbis and found all the major performance bottlenecks I know how to address, but that was quite a while back, and I don't have any insight into optimizing the mDCT (which I believe is the majority of the performance bottleneck now). I would be interested to know what someone else can do...

For a mild speed boost, you can disable automatic clipping (see: VorbisReader.ClipSamples). I think I remember it being good for 1-2%.

Vorbis decoding requires float values (or 32-bit fixed point; see Tremor implementation), so the output must be converted to get 16-bit int. libvorbisfile does that for you. NVorbis doesn't (choosing to return the raw output instead).

One detail that may be important: libvorbisfile is a file-based decoder and does all the decoding up front. NVorbis is a stream-based decoder and decodes as requested. That's not significant if you are merely decoding files on local storage, but if you are streaming the data for playback, NVorbis is a clear winner.
Jan 28, 2015 at 3:28 PM
Edited Jan 28, 2015 at 3:30 PM
Thanks for the reply.

I didn't even realize about the stream-based vs file-based decoders. Which is better depends on the type of application being developed, which in my case file-based would be since I am decoding files only once at open and am reusing the PCM data. I also thought Vorbis was float only, glad you have clarified it for me.

Thanks,
Xanather