xiph / opus-tools

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

` opusenc` extremely slow on `master+libopus1.4`. compared to `0.1.6+libopus1.0.2` #85

Closed vadimkantorov closed 10 months ago

vadimkantorov commented 10 months ago

Hi!

We are observing that opusenc opus-tools 0.1.6 (using libopus 1.0.2) takes 3-4x faster than opus-tools master (using libopus 1.4) (on a set of files with the command opusenc --bitrate 32 --quiet).

This older opusenc is taken from CentOS 7 packages. Do you have any hints on where to find the CentOS 7 build script for opus-tools/libopus?

Are there any advices on how to build for maximum perf? Is SSE/AVX/O3 enabled by default?

Here is my build script for the master version:

          wget https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz https://github.com/xiph/opus/releases/download/v1.4/opus-1.4.tar.gz https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz https://github.com/xiph/libopusenc/archive/refs/tags/v0.2.1.tar.gz
          find -name '*.tar.gz' -exec tar -xf {} \;
          # https://github.com/xiph/opus-tools/archive/refs/tags/v0.2.tar.gz
          wget https://github.com/xiph/opus-tools/archive/refs/heads/master.tar.gz
          mkdir opus-tools-0.2 && tar -xf channels-individual.tar.gz -C opus-tools-0.2 --strip-components=1
          export PREFIX="$(pwd)/prefix"
          export PKG_CONFIG_PATH="$(pwd)/prefix/lib/pkgconfig"

          pushd libogg-1.3.5
          # bash ./autogen.sh
          bash ./configure --prefix="$PREFIX" --disable-shared --enable-static
          make -j2 install
          popd
          pushd opus-1.4
          bash ./configure --prefix="$PREFIX" --disable-shared --enable-static --disable-maintainer-mode --disable-doc --disable-extra-programs
          make -j2 install
          popd
          pushd opusfile-0.12
          bash ./configure --prefix="$PREFIX" --disable-shared --enable-static --disable-maintainer-mode --disable-examples --disable-doc --disable-http
          make -j2 install
          popd
          pushd libopusenc-0.2.1
          bash autogen.sh
          bash ./configure --prefix="$PREFIX" --disable-shared --enable-static --disable-maintainer-mode --disable-examples --disable-doc
          make -j2 install
          popd
          pushd opus-tools-0.2
          bash ./autogen.sh
          LIBOPUSENC_LIBS="-L$(pwd)/prefix/lib -lopusenc" LIBOPUSENC_CFLAGS="-I$(pwd)/prefix/include/opus" bash ./configure --prefix="$PREFIX" --with-ogg="$PREFIX" --without-flac --disable-shared --enable-static  --disable-oggtest --disable-cpplibs
          make -j2 install
          popd
vadimkantorov commented 10 months ago

That old "fast" version is from 2012, I wonder how is this possible... btw is the main libopus repo - the better place for this discussion/investigation?

vadimkantorov commented 10 months ago

Closed in favor of:

which also has a repro and measurements