Skip to content

Commit b93cf43

Browse files
authored
Merge branch 'AOMediaCodec:main' into main
2 parents 39ddacd + 2301f65 commit b93cf43

10 files changed

Lines changed: 349 additions & 125 deletions

File tree

code/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ link_directories (
9696
${CODEC_LIB_DIR}
9797
)
9898

99+
if(MULTICHANNEL_BINAURALIZER OR HOA_BINAURALIZER)
100+
link_directories(
101+
${EXTER_LIB_DIR}/binaural
102+
)
103+
endif()
104+
99105
if(BUILD_SHARED_LIBS)
100106
add_library(${PROJECT_NAME} SHARED ${DIR_DEP_EXTERNAL_WAV} ${DIR_IAMF_COMMON}
101107
${DIR_IAMF_DEC_OPUS} ${DIR_IAMF_DEC_AAC} ${DIR_IAMF_DEC_FLAC} ${DIR_IAMF_DEC_PCM} ${DIR_IAMF_DEC})
@@ -112,6 +118,12 @@ if(BUILD_SHARED_LIBS)
112118
target_link_libraries (${PROJECT_NAME} FLAC)
113119
endif()
114120

121+
if(MULTICHANNEL_BINAURALIZER)
122+
target_link_libraries (${PROJECT_NAME} iamf2bear)
123+
endif()
124+
if(HOA_BINAURALIZER)
125+
target_link_libraries (${PROJECT_NAME} iamf2resonance)
126+
endif()
115127
else()
116128
add_library(${PROJECT_NAME} STATIC ${DIR_DEP_EXTERNAL_WAV} ${DIR_IAMF_COMMON}
117129
${DIR_IAMF_DEC_OPUS} ${DIR_IAMF_DEC_AAC} ${DIR_IAMF_DEC_PCM}

code/dep_codecs/build.sh

Lines changed: 207 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,114 @@
99
# www.aomedia.org/license/patent.
1010
#
1111

12-
OPUS_DIR="$( cd "$(dirname "$0")" ; pwd -P )/opus/opus-1.4"
13-
AAC_DIR="$( cd "$(dirname "$0")" ; pwd -P )/aac/fdk-aac-free-2.0.0"
14-
FLAC_DIR="$( cd "$(dirname "$0")" ; pwd -P )/flac/flac-1.4.2"
15-
CODEC_LIB_DIR="$( cd "$(dirname "$0")" ; pwd -P )/lib"
12+
set -e
13+
14+
run ()
15+
{
16+
if [ "$VERBOSE" = "yes" ] ; then
17+
echo "##### NEW COMMAND"
18+
echo "$@"
19+
$@ 2>&1
20+
else
21+
if [ -n "$TMPLOG" ] ; then
22+
echo "##### NEW COMMAND" >> $TMPLOG
23+
echo "$@" >> $TMPLOG
24+
$@ 2>&1 | tee -a $TMPLOG
25+
else
26+
$@ > /dev/null 2>&1
27+
fi
28+
fi
29+
}
30+
31+
pattern_match ()
32+
{
33+
echo "$2" | grep -q -E -e "$1"
34+
}
35+
36+
# Find if a given shell program is available.
37+
#
38+
# $1: variable name
39+
# $2: program name
40+
#
41+
# Result: set $1 to the full path of the corresponding command
42+
# or to the empty/undefined string if not available
43+
#
44+
find_program ()
45+
{
46+
eval $1=`command -v $2`
47+
}
48+
49+
prepare_download ()
50+
{
51+
find_program CMD_WGET wget
52+
find_program CMD_CURL curl
53+
find_program CMD_SCRP scp
54+
}
55+
56+
# Download a file with either 'curl', 'wget' or 'scp'
57+
#
58+
# $1: source URL (e.g. http://foo.com, ssh://blah, /some/path)
59+
# $2: target file
60+
download_file ()
61+
{
62+
# Is this HTTP, HTTPS or FTP ?
63+
if pattern_match "^(http|https|ftp):.*" "$1"; then
64+
if [ -n "$CMD_WGET" ] ; then
65+
run $CMD_WGET -O $2 $1
66+
elif [ -n "$CMD_CURL" ] ; then
67+
run $CMD_CURL -L -o $2 $1
68+
else
69+
echo "Please install wget or curl on this machine"
70+
exit 1
71+
fi
72+
return
73+
fi
74+
75+
# Is this SSH ?
76+
# Accept both ssh://<path> or <machine>:<path>
77+
#
78+
if pattern_match "^(ssh|[^:]+):.*" "$1"; then
79+
if [ -n "$CMD_SCP" ] ; then
80+
scp_src=`echo $1 | sed -e s%ssh://%%g`
81+
run $CMD_SCP $scp_src $2
82+
else
83+
echo "Please install scp on this machine"
84+
exit 1
85+
fi
86+
return
87+
fi
88+
89+
# Is this a file copy ?
90+
# Accept both file://<path> or /<path>
91+
#
92+
if pattern_match "^(file://|/).*" "$1"; then
93+
cp_src=`echo $1 | sed -e s%^file://%%g`
94+
run cp -f $cp_src $2
95+
return
96+
fi
97+
}
98+
99+
100+
101+
OPUS_DIR="$( cd "$(dirname "$0")" ; pwd -P )/opus"
102+
AAC_DIR="$( cd "$(dirname "$0")" ; pwd -P )/aac"
103+
FLAC_DIR="$( cd "$(dirname "$0")" ; pwd -P )/flac"
104+
CODECS_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
105+
OPUS_TAR="opus-1.4.tar.gz"
106+
AAC_TAR="fdk-aac-free-2.0.0.tar.gz"
107+
FLAC_TAR="flac-1.4.2.tar.xz"
16108

17109
declare -a CONFIG_FLAGS_OPUS
18110
declare -a CONFIG_FLAGS_AAC
19111
declare -a CONFIG_FLAGS_FLAC
20-
CONFIG_FLAGS_AAC="--enable-static --disable-shared"
21-
CONFIG_FLAGS_FLAC="-DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF"
112+
CONFIG_FLAGS_OPUS="-DCMAKE_C_FLAGS="-fPIC""
113+
CONFIG_FLAGS_AAC="--enable-static --disable-shared --with-pic"
114+
CONFIG_FLAGS_FLAC="-DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DCMAKE_C_FLAGS="-fPIC""
115+
116+
OPUS_DOWNLOAD_LINK="https://downloads.xiph.org/releases/opus/opus-1.4.tar.gz"
117+
AAC_DOWNLOAD_LINK="https://people.freedesktop.org/~wtay/fdk-aac-free-2.0.0.tar.gz"
118+
FLAC_DOWNLOAD_LINK="https://downloads.xiph.org/releases/flac/flac-1.4.2.tar.xz"
119+
22120

23121
function show_help()
24122
{
@@ -47,30 +145,30 @@ do
47145
want_help=yes ;;
48146

49147
--x86_64-mingw_toolchain)
50-
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86_64-mingw.cmake -DOPUS_STACK_PROTECTOR=OFF"
51-
CONFIG_FLAGS_AAC="--host=x86_64-w64-mingw32 --enable-static --disable-shared"
52-
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86_64-mingw.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DWITH_STACK_PROTECTOR=OFF"
148+
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86_64-mingw.cmake -DOPUS_STACK_PROTECTOR=OFF -DCMAKE_C_FLAGS="-fPIC""
149+
CONFIG_FLAGS_AAC="--host=x86_64-w64-mingw32 --enable-static --disable-shared --with-pic"
150+
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86_64-mingw.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DWITH_STACK_PROTECTOR=OFF -DCMAKE_C_FLAGS="-fPIC""
53151
shift # past argument with no value
54152
;;
55153

56154
--arm64-linux_toolchain)
57-
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-linux.cmake -DOPUS_STACK_PROTECTOR=OFF"
58-
CONFIG_FLAGS_AAC="--host=aarch64-linux-gnu --enable-static --disable-shared"
59-
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-linux.cmake -DCMAKE_C_FLAGS="-fPIC" -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DWITH_STACK_PROTECTOR=OFF"
155+
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-linux.cmake -DOPUS_STACK_PROTECTOR=OFF -DCMAKE_C_FLAGS="-fPIC""
156+
CONFIG_FLAGS_AAC="--host=aarch64-linux-gnu --enable-static --disable-shared --with-pic"
157+
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-linux.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DWITH_STACK_PROTECTOR=OFF -DCMAKE_C_FLAGS="-fPIC""
60158
shift # past argument with no value
61159
;;
62160

63161
--x86-macos_toolchain)
64-
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86-macos.cmake"
65-
CONFIG_FLAGS_AAC="--host=x86_64-apple-darwin20.4 --enable-static --disable-shared"
66-
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86-macos.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF"
162+
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86-macos.cmake -DCMAKE_C_FLAGS="-fPIC""
163+
CONFIG_FLAGS_AAC="--host=x86_64-apple-darwin20.4 --enable-static --disable-shared --with-pic"
164+
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/x86-macos.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DCMAKE_C_FLAGS="-fPIC""
67165
shift # past argument with no value
68166
;;
69167

70168
--arm64-ios_toolchain)
71169
CONFIG_FLAGS_OPUS="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-ios.cmake"
72-
CONFIG_FLAGS_AAC="--host=aarch64-apple-darwin20.4 --enable-static --disable-shared"
73-
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-ios.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF"
170+
CONFIG_FLAGS_AAC="--host=aarch64-apple-darwin20.4 --enable-static --disable-shared --with-pic"
171+
CONFIG_FLAGS_FLAC="-DCMAKE_TOOLCHAIN_FILE=../../../build/cmake/toolchains/arm64-ios.cmake -DWITH_OGG=OFF -DBUILD_CXXLIBS=OFF -DCMAKE_C_FLAGS="-fPIC""
74172
shift # past argument with no value
75173
;;
76174

@@ -86,29 +184,114 @@ if test "x$want_help" = xyes; then
86184
show_help
87185
fi
88186

187+
#Delete old libraries
188+
rm -rf $CODECS_DIR/lib
189+
190+
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>Codec Download<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
191+
192+
CLEAN=yes
193+
DOWNLOAD=yes
194+
195+
if [ $CLEAN = yes ] ; then
196+
echo "Cleaning: $OPUS_DIR"
197+
rm -f -r $OPUS_DIR
198+
199+
echo "Cleaning: $AAC_DIR"
200+
rm -f -r $AAC_DIR
201+
202+
echo "Cleaning: $FLAC_DIR"
203+
rm -f -r $FLAC_DIR
204+
205+
mkdir $OPUS_DIR
206+
mkdir $AAC_DIR
207+
mkdir $FLAC_DIR
208+
[ "$DOWNLOAD" = "yes" ] || exit 0
209+
fi
210+
211+
#Download OPUS
212+
if [ ! -f $OPUS_DIR/$OPUS_TAR ]
213+
then
214+
echo "Downloading opus please wait..."
215+
prepare_download
216+
download_file $OPUS_DOWNLOAD_LINK $OPUS_DIR/$OPUS_TAR
217+
fi
218+
219+
if [ ! -f $OPUS_DIR/$OPUS_TAR ]
220+
then
221+
echo "Failed to download opus! Please download manually\nand save it in this directory as $OPUS_TAR"
222+
exit 1
223+
fi
224+
225+
if [ -f $OPUS_DIR/$OPUS_TAR ]
226+
then
227+
echo "Unpacking opus"
228+
tar -zxf $OPUS_DIR/$OPUS_TAR -C $OPUS_DIR
229+
fi
230+
231+
#Download AAC
232+
if [ ! -f $AAC_DIR/$AAC_TAR ]
233+
then
234+
echo "Downloading aac please wait..."
235+
prepare_download
236+
download_file $AAC_DOWNLOAD_LINK $AAC_DIR/$AAC_TAR
237+
fi
238+
239+
if [ ! -f $AAC_DIR/$AAC_TAR ]
240+
then
241+
echo "Failed to download aac! Please download manually\nand save it in this directory as $AAC_TAR"
242+
exit 1
243+
fi
244+
245+
if [ -f $AAC_DIR/$AAC_TAR ]
246+
then
247+
echo "Unpacking aac"
248+
tar -zxf $AAC_DIR/$AAC_TAR -C $AAC_DIR
249+
fi
250+
251+
#Download FLAC
252+
if [ ! -f $FLAC_DIR/$FLAC_TAR ]
253+
then
254+
echo "Downloading flac please wait..."
255+
prepare_download
256+
download_file $FLAC_DOWNLOAD_LINK $FLAC_DIR/$FLAC_TAR
257+
fi
258+
259+
if [ ! -f $FLAC_DIR/$FLAC_TAR ]
260+
then
261+
echo "Failed to download flac! Please download manually\nand save it in this directory as $FLAC_TAR"
262+
exit 1
263+
fi
264+
265+
if [ -f $FLAC_DIR/$FLAC_TAR ]
266+
then
267+
echo "Unpacking flac"
268+
tar -xf $FLAC_DIR/$FLAC_TAR -C $FLAC_DIR
269+
fi
270+
271+
89272

90273
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>OPUS Compile<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
91-
cd $OPUS_DIR
274+
cd $OPUS_DIR/opus-1.4
92275
rm -rf build
93276
cmake -B build ./ $CONFIG_FLAGS_OPUS
94277
cmake --build build --clean-first
95-
cp -f build/libopus.a $CODEC_LIB_DIR
278+
cmake --install build --prefix $CODECS_DIR
96279

97280
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>AAC Compile<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
98-
cd $AAC_DIR
281+
cd $AAC_DIR/fdk-aac-free-2.0.0
99282
rm -rf build
100283
mkdir build
101284
cd build
102-
../configure $CONFIG_FLAGS_AAC
285+
../configure $CONFIG_FLAGS_AAC --prefix=$CODECS_DIR
103286
make
104-
cp -f .libs/libfdk-aac.a $CODEC_LIB_DIR
287+
make install
105288

106289
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>FLAC Compile<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
107-
cd $FLAC_DIR
290+
cd $FLAC_DIR/flac-1.4.2
108291
rm -rf build
109292
cmake -B build ./ $CONFIG_FLAGS_FLAC
110293
cmake --build build --clean-first
111-
cp -f build/src/libFLAC/libFLAC.a $CODEC_LIB_DIR
294+
cmake --install build --prefix $CODECS_DIR
112295

113296

114297

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
README.md
22
=========
3-
# Dependent Codec Libraries
3+
# Dependent Externals Libraries
44

55
## Contents
66
1. [Downloading the opensource](#Downloading-the-opensource)
@@ -10,21 +10,20 @@ README.md
1010

1111

1212
## Downloading the opensource
13-
1. [visr](https://github.com/ebu/bear/releases/download/v0.0.1-pre/visr-0.13.0-pre-5e13f020.zip)
14-
2. [boost](https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip)
15-
16-
Please download the opensource and unzip to directory separately as following:
17-
~~~
18-
rd-audio-visr-public-master
19-
boost_1_82_0
20-
~~~
13+
1. [bear](https://github.com/ebu/bear)
14+
2. [resonance-audio](https://github.com/resonance-audio/resonance-audio)
15+
2116

2217
## Building the libraries
2318

2419
### Prerequisites
2520
1. [CMake](https://cmake.org) version 3.6 or higher.
26-
2. Tool chains if need cross compiling.
27-
21+
2. [boost](https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip), version 1.82
22+
~~~
23+
$ ./bootstrap.sh --with-toolset=gcc
24+
$ ./b2 toolset=gcc
25+
$ ./b2 install
26+
~~~
2827

2928
### Basic build
3029
"build.sh" is an example to build, you can run it directly at your side.

0 commit comments

Comments
 (0)