簡介
Opus是一個完全開放的、免費的、多功能的音頻編解碼器。 它在交互式的語音和音樂在互聯(lián)網(wǎng)中的傳輸方面有著無與倫比的優(yōu)勢,但是同樣致力于存儲和流媒體應(yīng)用程序。它是由互聯(lián)網(wǎng)工程任務(wù)組(IETF)制定的標準,標準格式為RFC 6716,由Skype的SILK編解碼器和Xiph.Org的CELT編解碼器合并發(fā)展而來。
編譯和測試方式
1.選擇操作環(huán)境
本文選用華為鯤鵬云服務(wù)ECS KC1實例做測試
2.編譯源代碼
本文以“Opus1.3.1”版本為例,下載源碼,并編譯安裝。
1)下載Opus源代碼。
wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
2)安裝Opus軟件依賴包。
yum install gcc-c++ bzip2 autoconf automake flex texinfo -y
3)升級gcc。
a.查看當前gcc版本,可以看到當前gcc版本為“4.8.5”。
gcc -v
結(jié)果如下:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/4.8.5/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.r
edhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --e
nable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-styl
e=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-initfini-array --disable-libgcj --w
ith-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-aarch64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-
4.8.5-20150702/obj-aarch64-redhat-linux/cloog-install --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
b.下載7.3.0版本的gcc。
wget http://mirrors.concertpass.com/gcc/releases/gcc-7.3.0/gcc-7.3.0.tar.gz
c.解壓和編譯7.3.0版本gcc,過程大概需要1小時~2小時。
tar -xvf gcc-7.3.0.tar.gzcd gcc-7.3.0./contrib/download_prerequisitesmkdir gcc-build-7.3.0 && cd gcc-build-7.3.0../configure --enable-checking=release --enable-languages=c,c++ --disable-multilibmake && make install
d.查看gcc版本。
gcc -v
如果查詢后得到的版本號為舊版本,請退出操作系統(tǒng)后重新登錄并查詢,即可查詢到升級后的gcc版本。
結(jié)果如下:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-unknown-linux-gnu/7.3.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 7.3.0 (GCC)
4)解壓并安裝Opus。
cd /root/tar -xvf /root/opus-1.3.1.tar.gzcd /root/opus-1.3.1./configure && make && make install
3.測試已完成編譯的軟件
由于Opus是一個供應(yīng)用程序調(diào)用的庫,因此編譯生產(chǎn)的也是一個庫,可以通過查看是否有opus.pc產(chǎn)升驗證Opus是否編譯成功。
cat /usr/local/lib/pkgconfig/opus.pc
回顯如下表示opus編譯成功。
# Opus codec reference implementation pkg-config file
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Opus
Description: Opus IETF audio codec (floating-point build)
URL: https://opus-codec.org/
Version: 1.3.1
Requires:
Conflicts:
Libs: -L${libdir} -lopus
Libs.private: -lm
Cflags: -I${includedir}/opus
已知問題匯總
問題描述:
在編譯過程中,提示類型的兼容問題,如下所示:
SUMM = vmlaq_lane_f32(SUMM, YY[0], vget_low_f32(XX[0]), 0);
^
celt/arm/celt_neon_intr.c:139:14: error: incompatible types when initializing type ‘float32x4_t’ using type ‘float32
x2_t’
SUMM = vmlaq_lane_f32(SUMM, YEXT[0], vget_low_f32(XX[0]), 1);
^
celt/arm/celt_neon_intr.c:141:14: error: incompatible types when initializing type ‘float32x4_t’ using type ‘float32
x2_t’
SUMM = vmlaq_lane_f32(SUMM, YEXT[1], vget_high_f32(XX[0]), 0);
^
celt/arm/celt_neon_intr.c:143:14: error: incompatible types when initializing type ‘float32x4_t’ using type ‘float32
x2_t’
SUMM = vmlaq_lane_f32(SUMM, YEXT[2], vget_high_f32(XX[0]), 1);
^
celt/arm/celt_neon_intr.c:145:14: error: incompatible types when initializing type ‘float32x4_t’ using type ‘float32
x2_t’
SUMM = vmlaq_lane_f32(SUMM, YY[1], vget_low_f32(XX[1]), 0);
^
celt/arm/celt_neon_intr.c:147:14: error: incompatible types when initializing type ‘float32x4_t’ using type ‘float32
x2_t’
解決方法:查看當前gcc版本,如果版本為“4.x.x”版本,請升級到“gcc 7.3.0”或者更高版本,升級方法參見上述步驟。