├── .github └── workflows │ └── build.yml ├── .gitignore ├── Images └── terminals.png ├── LICENSE ├── README.md ├── build.sh ├── setup.sh ├── test-materials ├── BattleThemeA.mp3 ├── BattleThemeA_p23_44_128.aac ├── BattleThemeA_p29_44_128.aac ├── BattleThemeA_p2_44_128.aac ├── BattleThemeA_p2_44_256.aac ├── BattleThemeA_p2_44_m1.aac ├── BattleThemeA_p2_44_m5.aac ├── BattleThemeA_p39_44_128.aac ├── BattleThemeA_p5_44_128.aac ├── README.md └── ffmpeg.exe └── test.sh /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | runs-on: windows-latest 13 | defaults: 14 | run: 15 | shell: msys2 {0} 16 | steps: 17 | - uses: msys2/setup-msys2@v2 18 | with: 19 | msystem: MINGW64 20 | update: true 21 | install: >- 22 | mingw-w64-x86_64-gcc 23 | autoconf 24 | automake-wrapper 25 | make 26 | libtool 27 | - uses: actions/checkout@v2 28 | - run: ./setup.sh 29 | - run: ./build.sh 30 | - run: ./test.sh 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | artifacts/ 2 | stage/ 3 | references/ 4 | -------------------------------------------------------------------------------- /Images/terminals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/Images/terminals.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Kouji Matsui 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libfdk-aac for Windows binary builder 2 | 3 | libfdk-aac (0.1.6 and 2.0.2) and fdkaac tool (1.0.3) for Windows auto binary builder scripts. 4 | 5 | [![CI build (master)](https://github.com/kekyo/fdk-aac-win32-builder/workflows/Build/badge.svg?branch=master)](https://github.com/kekyo/fdk-aac-win32-builder/actions?query=branch%3Amaster) 6 | 7 | [fdk-aac](https://github.com/mstorsjo/fdk-aac) is "A standalone library of the Fraunhofer FDK AAC code from Android." A mirror of released source code, see [official opencore-amr project](https://sourceforge.net/projects/opencore-amr/). 8 | 9 | [fdkaac](https://github.com/nu774/fdkaac) is "command line encoder frontend for libfdk-aac". 10 | 11 | It'll build both: 12 | 13 | * `libfdk-aac-1.dll` 14 | * `libfdk-acc-2.dll` 15 | * `fdkaac.exe` (**Linked libfdk-aac-2.dll**) 16 | 17 | # How to use 18 | 19 | 1. Install [MSYS2](http://www.msys2.org/) 20 | 2. Open MSYS2 shell terminal. 21 | * Choose `MSYS2 MinGW-32bit` terminal if you wanna 32bit (i686) binary. 22 | * Choose `MSYS2 MinGW-64bit` terminal if you wanna 64bit (x86_64) binary. 23 | * DON'T USE `MSYS2` (unannoteted) terminal. 24 | 25 | ![Terminals](Images/terminals.png) 26 | 27 | 3. Update components by pacman. (See MSYS2 top page.) 28 | 4. Install development tools. 29 | * Execute `pacman -S mingw-w64-i686-gcc autoconf automake-wrapper make libtool` if you wanna 32bit binary. 30 | * Execute `pacman -S mingw-w64-x86_64-gcc autoconf automake-wrapper make libtool` if you wanna 64bit binary. 31 | 5. Execute `./setup.sh`, it'll download source code archive and extract reference files for testing purpose. 32 | 6. You can choose GCC's optimization option by editing `build.sh`. See `CFLAGS` symbols in the head of this file. 33 | 7. Execute `./build.sh`. 34 | 35 | Finally, stored binaries into artifacts directory. 36 | * `artifacts/i686-w64-mingw32/` (32bit) 37 | * `artifacts/x86_64-w64-mingw32/` (64bit) 38 | 39 | If you have to get results for PCM bits equality, you can execute `./test.sh` after building was successful. The test materials are generated by a specific version of the encoder, so they can only be used for verifying specific version of fdk-aac, (see [here](./test-materials/README.md) for detailed information). It'll use `cmp` command, so will show nothing output if these PCM files are verified. For example: 40 | 41 | ```sh 42 | $ ./test.sh 43 | Step 1. Generating reference PCM files 44 | Step 2. Generating test AAC files using fdkaac.exe with libfdk-aac-2.dll 45 | Step 3. Generating test PCM files 46 | Step 4. Comparing PCM files 47 | ====Test finished==== 48 | 49 | $ 50 | ``` 51 | 52 | # License 53 | 54 | MIT, inside all contents except built binaries. See description for fdk-aac. 55 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | #Print commands and their arguments as they are executed. 3 | set -x 4 | 5 | ################################### 6 | # Compiler optimization flags: 7 | 8 | # Platform native (not include AVX-512, it's standard options) 9 | # Remove "-flto" to avoid Wstringop-overflow warning for fdkaac 10 | CFLAGS="-O3 -march=native" 11 | 12 | # AVX-512 13 | #CFLAGS="-O3 -march=native -mavx512f -mavx512dq -mavx512er -mavx512cd -mavx512bw -mavx512pf -mavx512vl -mavx512ifma -mavx512vbmi" 14 | 15 | # For debugging/reference usage 16 | #CFLAGS="-O0" 17 | 18 | ################################### 19 | 20 | NPB=`cat /proc/cpuinfo |grep "processor"|wc -l` 21 | 22 | if [ -z "$MINGW_CHOST" ]; then 23 | echo "Building failed, because maybe you did not use MinGW terminal instead MSYS terminal." 24 | echo "See README.md how to use instructions." 25 | exit 26 | fi 27 | 28 | cd stage 29 | 30 | rm -rf $MINGW_CHOST 31 | mkdir $MINGW_CHOST 32 | cd $MINGW_CHOST 33 | 34 | tar -zxf ../../artifacts/fdk-aac-0.1.6.tar.gz 35 | tar -zxf ../../artifacts/fdk-aac-2.0.2.tar.gz 36 | tar -zxf ../../artifacts/fdkaac-1.0.3.tar.gz 37 | 38 | cd fdk-aac-0.1.6 39 | #Temporary add "-flto" option here, should be replaced by interactive compile switches in the future 40 | CC="gcc -pipe -static-libgcc -flto" CXX="g++ -pipe -static-libgcc -flto" ./configure --prefix=$MINGW_PREFIX/$MINGW_CHOST/ CFLAGS="${CFLAGS}" 41 | make -j$NPB 42 | make install 43 | cd .. 44 | 45 | cd fdk-aac-2.0.2 46 | autoreconf -i 47 | #Temporary add "-flto" option here, should be replaced by interactive compile switches in the future 48 | CC="gcc -pipe -static-libgcc -flto" CXX="g++ -pipe -static-libgcc -flto" ./configure --prefix=$MINGW_PREFIX/$MINGW_CHOST/ CFLAGS="${CFLAGS}" 49 | make -j$NPB 50 | make install 51 | cd .. 52 | 53 | cd fdkaac-1.0.3 54 | autoreconf -i 55 | CC="gcc -pipe -static-libgcc" CXX="g++ -pipe -static-libgcc" ./configure --prefix=$MINGW_PREFIX/$MINGW_CHOST/ CFLAGS="${CFLAGS}" 56 | make -j$NPB 57 | make install 58 | cd .. 59 | 60 | cd ../.. 61 | 62 | rm -rf artifacts/$MINGW_CHOST 63 | mkdir artifacts/$MINGW_CHOST 64 | cd artifacts/$MINGW_CHOST 65 | 66 | cp ../../stage/$MINGW_CHOST/fdk-aac-0.1.6/.libs/libfdk-aac.a libfdk-aac-1.a 67 | cp ../../stage/$MINGW_CHOST/fdk-aac-0.1.6/.libs/libfdk-aac.dll.a libfdk-aac-1.dll.a 68 | cp ../../stage/$MINGW_CHOST/fdk-aac-0.1.6/.libs/libfdk-aac-1.dll . 69 | 70 | cp ../../stage/$MINGW_CHOST/fdk-aac-2.0.2/.libs/libfdk-aac.a libfdk-aac-2.a 71 | cp ../../stage/$MINGW_CHOST/fdk-aac-2.0.2/.libs/libfdk-aac.dll.a libfdk-aac-2.dll.a 72 | cp ../../stage/$MINGW_CHOST/fdk-aac-2.0.2/.libs/libfdk-aac-2.dll . 73 | 74 | cp ../../stage/$MINGW_CHOST/fdkaac-1.0.3/fdkaac.exe . 75 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ -z "$MINGW_CHOST" ]; then 4 | echo "Setup failed because maybe you did not use MinGW terminal instead MSYS terminal." 5 | echo "See README.md how to use instructions." 6 | exit 7 | fi 8 | 9 | rm -rf artifacts 10 | rm -rf stage 11 | 12 | mkdir artifacts 13 | mkdir stage 14 | 15 | cd artifacts 16 | 17 | wget https://github.com/kekyo/fdk-aac-win32-builder/releases/download/distributes/fdk-aac-0.1.6.tar.gz 18 | wget https://github.com/kekyo/fdk-aac-win32-builder/releases/download/distributes/fdk-aac-2.0.2.tar.gz 19 | #wget https://github.com/kekyo/fdk-aac-win32-builder/releases/download/distributes/fdkaac-1.0.2.tar.gz 20 | wget https://github.com/kekyo/fdk-aac-win32-builder/releases/download/distributes/fdkaac-1.0.3.tar.gz 21 | 22 | cd .. 23 | -------------------------------------------------------------------------------- /test-materials/BattleThemeA.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA.mp3 -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p23_44_128.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p23_44_128.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p29_44_128.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p29_44_128.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p2_44_128.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p2_44_128.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p2_44_256.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p2_44_256.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p2_44_m1.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p2_44_m1.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p2_44_m5.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p2_44_m5.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p39_44_128.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p39_44_128.aac -------------------------------------------------------------------------------- /test-materials/BattleThemeA_p5_44_128.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/BattleThemeA_p5_44_128.aac -------------------------------------------------------------------------------- /test-materials/README.md: -------------------------------------------------------------------------------- 1 | BattleThemeA.wav imported from: 2 | 3 | * [opengameart.org](https://opengameart.org/content/battle-theme-a) 4 | * License: CC0 5 | 6 | The wav file was converted from mp3 format from the link above, and aac files are generated by **fdkaac 1.0.2 and fdk-aac 2.0.2** (with both 64bit, -O0). 7 | 8 | Although the signature at the end of AAC file generated by different binaries (with different compiler optimization options and different binary platforms) is slightly different, the audio data encoded by the same version of the encoder should be the same. Therefore, this test will compare audio coding data in pulse code modulation (PCM file) instead of directly comparing AAC files. 9 | 10 | It should be noted that the above test materials are generated by a specific version of the encoder, so they can only be used for comparison with the corresponding version of the encoder; Otherwise, the comparison may produce inconsistent test results due to the change of encoder algorithm (see [here](https://github.com/kekyo/fdk-aac-win32-builder/pull/5) for detailed discussion). 11 | 12 | -------------------------------------------------------------------------------- /test-materials/ffmpeg.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/fdk-aac-win32-builder/4864e2d6efdda79a6d328a269ee5d1a03e36afd7/test-materials/ffmpeg.exe -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | DEST=artifacts/$MINGW_CHOST"_test" 4 | 5 | rm -rf references 6 | mkdir references 7 | 8 | test-materials/ffmpeg.exe -i test-materials/battleThemeA.mp3 references/BattleThemeA.wav > /dev/null 2>&1 9 | 10 | echo "Step 1. Generating reference PCM files" 11 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p2_44_128.aac -f s16le references/battleThemeA_p2_44_128.pcm > /dev/null 2>&1 12 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p5_44_128.aac -f s16le references/battleThemeA_p5_44_128.pcm > /dev/null 2>&1 13 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p23_44_128.aac -f s16le references/battleThemeA_p23_44_128.pcm > /dev/null 2>&1 14 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p29_44_128.aac -f s16le references/battleThemeA_p29_44_128.pcm > /dev/null 2>&1 15 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p39_44_128.aac -f s16le references/battleThemeA_p39_44_128.pcm > /dev/null 2>&1 16 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p2_44_256.aac -f s16le references/battleThemeA_p2_44_256.pcm > /dev/null 2>&1 17 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p2_44_m1.aac -f s16le references/battleThemeA_p2_44_m1.pcm > /dev/null 2>&1 18 | test-materials/ffmpeg.exe -i test-materials/BattleThemeA_p2_44_m5.aac -f s16le references/battleThemeA_p2_44_m5.pcm > /dev/null 2>&1 19 | 20 | 21 | rm -rf $DEST 22 | mkdir $DEST 23 | 24 | # Execute using built binary. 25 | echo "Step 2. Generating test AAC files using fdkaac.exe with libfdk-aac-2.dll" 26 | 27 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 2 -b 128 -o $DEST/BattleThemeA_p2_44_128.aac references/BattleThemeA.wav 28 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 5 -b 128 -o $DEST/BattleThemeA_p5_44_128.aac references/BattleThemeA.wav 29 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 23 -b 128 -o $DEST/BattleThemeA_p23_44_128.aac references/BattleThemeA.wav 30 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 29 -b 128 -o $DEST/BattleThemeA_p29_44_128.aac references/BattleThemeA.wav 31 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 39 -b 128 -o $DEST/BattleThemeA_p39_44_128.aac references/BattleThemeA.wav 32 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 2 -b 256 -o $DEST/BattleThemeA_p2_44_256.aac references/BattleThemeA.wav 33 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 2 -m 1 -o $DEST/BattleThemeA_p2_44_m1.aac references/BattleThemeA.wav 34 | artifacts/$MINGW_CHOST/fdkaac.exe -S -p 2 -m 5 -o $DEST/BattleThemeA_p2_44_m5.aac references/BattleThemeA.wav 35 | 36 | 37 | # Make raw pcm from encoded files. 38 | echo "Step 3. Generating test PCM files" 39 | 40 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p2_44_128.aac -f s16le $DEST/battleThemeA_p2_44_128.pcm > /dev/null 2>&1 41 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p5_44_128.aac -f s16le $DEST/BattleThemeA_p5_44_128.pcm > /dev/null 2>&1 42 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p23_44_128.aac -f s16le $DEST/BattleThemeA_p23_44_128.pcm > /dev/null 2>&1 43 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p29_44_128.aac -f s16le $DEST/BattleThemeA_p29_44_128.pcm > /dev/null 2>&1 44 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p39_44_128.aac -f s16le $DEST/BattleThemeA_p39_44_128.pcm > /dev/null 2>&1 45 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p2_44_256.aac -f s16le $DEST/BattleThemeA_p2_44_256.pcm > /dev/null 2>&1 46 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p2_44_m1.aac -f s16le $DEST/BattleThemeA_p2_44_m1.pcm > /dev/null 2>&1 47 | test-materials/ffmpeg.exe -i $DEST/BattleThemeA_p2_44_m5.aac -f s16le $DEST/BattleThemeA_p2_44_m5.pcm > /dev/null 2>&1 48 | 49 | 50 | # Compare raw pcm files. 51 | echo "Step 4. Comparing PCM files" 52 | 53 | cmp references/battleThemeA_p2_44_128.pcm $DEST/battleThemeA_p2_44_128.pcm 54 | cmp references/BattleThemeA_p5_44_128.pcm $DEST/BattleThemeA_p5_44_128.pcm 55 | cmp references/BattleThemeA_p23_44_128.pcm $DEST/BattleThemeA_p23_44_128.pcm 56 | cmp references/BattleThemeA_p29_44_128.pcm $DEST/BattleThemeA_p29_44_128.pcm 57 | cmp references/BattleThemeA_p39_44_128.pcm $DEST/BattleThemeA_p39_44_128.pcm 58 | cmp references/BattleThemeA_p2_44_256.pcm $DEST/BattleThemeA_p2_44_256.pcm 59 | cmp references/BattleThemeA_p2_44_m1.pcm $DEST/BattleThemeA_p2_44_m1.pcm 60 | cmp references/BattleThemeA_p2_44_m5.pcm $DEST/BattleThemeA_p2_44_m5.pcm 61 | 62 | echo "====Test finished====" 63 | --------------------------------------------------------------------------------