xiph / opus-tools

A set of tools to encode, inspect, and decode audio in the Opus format.
https://opus-codec.org/
Other
212 stars 78 forks source link

Resampler in opus-tools vs speex #60

Closed AachoLoya closed 3 years ago

AachoLoya commented 3 years ago

Confused about the Resampler written in src/resample.c vs the one in libspeex. What's the main difference between the two?

mark4o commented 3 years ago

The resampler in opus-tools is the same as the one in libspeexdsp. It was originally part of libspeex, before libspeex was split into libspeex and libspeexdsp; libspeex now contains the Speex codec, and libspeexdsp contains the codec-independent parts that can be used with any codec.

AachoLoya commented 3 years ago

But I couldn't find speex_resampler.c or any resampler named file in libspeex repo. Are APIs identical between the two? Whats the significance of OUTSIDE_SPEEX directive, if its defined its seems to use internal definitions of functions etc, otherwise its seems to resort to libspeex, no?

Btw, this repo is missing "resample_neon.h", where can I get that?

mark4o commented 3 years ago

The resampler is not codec-specific so it is in libspeexdsp. The header file is https://gitlab.xiph.org/xiph/speexdsp/-/blob/master/include/speex/speex_resampler.h and the implementation is in https://gitlab.xiph.org/xiph/speexdsp/-/blob/master/libspeexdsp/resample.c. The code and API is the same in the opus-tools copy. OUTSIDE_SPEEX is defined in opus-tools since it uses its own copy and does not want to depend on other parts of libspeexdsp (or libspeex).

resample_neon.h is at: https://gitlab.xiph.org/xiph/speexdsp/-/blob/master/libspeexdsp/resample_neon.h

AachoLoya commented 3 years ago

Got it. Thanks!