Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 1 | Welcome to the WebM VP8/VP9 Codec SDK! |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 2 | |
| 3 | COMPILING THE APPLICATIONS/LIBRARIES: |
| 4 | The build system used is similar to autotools. Building generally consists of |
| 5 | "configuring" with your desired build options, then using GNU make to build |
| 6 | the application. |
| 7 | |
| 8 | 1. Prerequisites |
John Koleszar | 94c52e4 | 2010-06-18 16:39:21 | [diff] [blame] | 9 | |
James Zern | d699ef4 | 2025-01-13 21:15:04 | [diff] [blame] | 10 | * All x86 targets require the NASM[0] or Yasm[1] assembler be installed[2]. |
Jerome Jiang | 24b43c4 | 2021-03-09 00:07:02 | [diff] [blame] | 11 | * All Windows builds require that Cygwin[3] or MSYS2[4] be installed. |
| 12 | * Building the documentation requires Doxygen[5]. If you do not |
James Zern | f8630c7 | 2014-05-10 18:15:11 | [diff] [blame] | 13 | have this package, the install-docs option will be disabled. |
Jerome Jiang | 24b43c4 | 2021-03-09 00:07:02 | [diff] [blame] | 14 | * Downloading the data for the unit tests requires curl[6] and sha1sum. |
John Koleszar | 0074863 | 2012-06-20 21:45:22 | [diff] [blame] | 15 | sha1sum is provided via the GNU coreutils, installed by default on |
| 16 | many *nix platforms, as well as MinGW and Cygwin. If coreutils is not |
| 17 | available, a compatible version of sha1sum can be built from |
Jerome Jiang | 24b43c4 | 2021-03-09 00:07:02 | [diff] [blame] | 18 | source[7]. These requirements are optional if not running the unit |
John Koleszar | 0074863 | 2012-06-20 21:45:22 | [diff] [blame] | 19 | tests. |
John Koleszar | 94c52e4 | 2010-06-18 16:39:21 | [diff] [blame] | 20 | |
James Zern | d699ef4 | 2025-01-13 21:15:04 | [diff] [blame] | 21 | [0]: https://www.nasm.us/ |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 22 | [1]: http://www.tortall.net/projects/yasm |
Johann | 7a9a46f | 2018-03-19 23:46:06 | [diff] [blame] | 23 | [2]: For Visual Studio the base yasm binary (not vsyasm) should be in the |
| 24 | PATH for Visual Studio. For VS2017 it is sufficient to rename |
| 25 | yasm-<version>-<arch>.exe to yasm.exe and place it in: |
| 26 | Program Files (x86)/Microsoft Visual Studio/2017/<level>/Common7/Tools/ |
James Zern | c358ac4 | 2025-01-14 21:06:28 | [diff] [blame] | 27 | The MSYS2 version of the yasm binary can also be used and avoids an |
| 28 | issue caused by a missing Visual C++ Redistributable install (Visual |
| 29 | Studio 2010, MSVCR100.dll). |
Johann | 7a9a46f | 2018-03-19 23:46:06 | [diff] [blame] | 30 | [3]: http://www.cygwin.com |
Jerome Jiang | 24b43c4 | 2021-03-09 00:07:02 | [diff] [blame] | 31 | [4]: http://www.msys2.org/ |
| 32 | [5]: http://www.doxygen.org |
| 33 | [6]: http://curl.haxx.se |
| 34 | [7]: http://www.microbrew.org/tools/md5sha1sum/ |
John Koleszar | 94c52e4 | 2010-06-18 16:39:21 | [diff] [blame] | 35 | |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 36 | 2. Out-of-tree builds |
| 37 | Out of tree builds are a supported method of building the application. For |
| 38 | an out of tree build, the source tree is kept separate from the object |
| 39 | files produced during compilation. For instance: |
| 40 | |
| 41 | $ mkdir build |
| 42 | $ cd build |
| 43 | $ ../libvpx/configure <options> |
| 44 | $ make |
| 45 | |
| 46 | 3. Configuration options |
| 47 | The 'configure' script supports a number of options. The --help option can be |
| 48 | used to get a list of supported options: |
| 49 | $ ../libvpx/configure --help |
| 50 | |
Johann | 20521c3 | 2018-03-27 19:59:15 | [diff] [blame] | 51 | 4. Compiler analyzers |
| 52 | Compilers have added sanitizers which instrument binaries with information |
| 53 | about address calculation, memory usage, threading, undefined behavior, and |
| 54 | other common errors. To simplify building libvpx with some of these features |
| 55 | use tools/set_analyzer_env.sh before running configure. It will set the |
| 56 | compiler and necessary flags for building as well as environment variables |
| 57 | read by the analyzer when testing the binaries. |
| 58 | $ source ../libvpx/tools/set_analyzer_env.sh address |
| 59 | |
| 60 | 5. Cross development |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 61 | For cross development, the most notable option is the --target option. The |
| 62 | most up-to-date list of supported targets can be found at the bottom of the |
| 63 | --help output of the configure script. As of this writing, the list of |
| 64 | available targets is: |
| 65 | |
Johann | 0c0a050 | 2016-12-30 00:31:22 | [diff] [blame] | 66 | arm64-android-gcc |
James Zern | 77f5c3d | 2016-07-28 05:10:09 | [diff] [blame] | 67 | arm64-darwin-gcc |
James Zern | 979e27c | 2020-09-25 20:21:11 | [diff] [blame] | 68 | arm64-darwin20-gcc |
James Zern | 3d57fb6 | 2023-05-06 01:56:59 | [diff] [blame] | 69 | arm64-darwin21-gcc |
| 70 | arm64-darwin22-gcc |
James Zern | f9b7c85 | 2023-12-04 21:25:01 | [diff] [blame] | 71 | arm64-darwin23-gcc |
James Zern | 6e23d97 | 2024-11-19 20:29:59 | [diff] [blame] | 72 | arm64-darwin24-gcc |
James Zern | 77f5c3d | 2016-07-28 05:10:09 | [diff] [blame] | 73 | arm64-linux-gcc |
Johann | b85ac11 | 2019-02-01 21:49:00 | [diff] [blame] | 74 | arm64-win64-gcc |
Jon Kunkee | e6f889c | 2018-11-12 21:40:56 | [diff] [blame] | 75 | arm64-win64-vs15 |
James Zern | 3fe1365 | 2023-05-05 23:56:51 | [diff] [blame] | 76 | arm64-win64-vs16 |
| 77 | arm64-win64-vs16-clangcl |
| 78 | arm64-win64-vs17 |
| 79 | arm64-win64-vs17-clangcl |
Fritz Koenig | d830573 | 2012-01-06 19:50:05 | [diff] [blame] | 80 | armv7-android-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 81 | armv7-darwin-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 82 | armv7-linux-rvct |
| 83 | armv7-linux-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 84 | armv7-none-rvct |
Johann | b85ac11 | 2019-02-01 21:49:00 | [diff] [blame] | 85 | armv7-win32-gcc |
Ghislain MARY | 3067c34 | 2015-07-28 14:37:09 | [diff] [blame] | 86 | armv7-win32-vs14 |
Gregor Jasny | bcfd9c9 | 2017-05-23 07:30:44 | [diff] [blame] | 87 | armv7-win32-vs15 |
James Zern | f9b7c85 | 2023-12-04 21:25:01 | [diff] [blame] | 88 | armv7-win32-vs16 |
| 89 | armv7-win32-vs17 |
Tom Finegan | cd2088b | 2014-06-11 01:52:58 | [diff] [blame] | 90 | armv7s-darwin-gcc |
James Zern | 77f5c3d | 2016-07-28 05:10:09 | [diff] [blame] | 91 | armv8-linux-gcc |
James Zern | 3d57fb6 | 2023-05-06 01:56:59 | [diff] [blame] | 92 | loongarch32-linux-gcc |
| 93 | loongarch64-linux-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 94 | mips32-linux-gcc |
Gordana Cmiljanovic | 1c31e3e | 2014-08-07 17:09:47 | [diff] [blame] | 95 | mips64-linux-gcc |
Johann | f80be22 | 2018-01-04 18:54:28 | [diff] [blame] | 96 | ppc64le-linux-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 97 | sparc-solaris-gcc |
| 98 | x86-android-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 99 | x86-darwin8-gcc |
| 100 | x86-darwin8-icc |
| 101 | x86-darwin9-gcc |
| 102 | x86-darwin9-icc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 103 | x86-darwin10-gcc |
| 104 | x86-darwin11-gcc |
| 105 | x86-darwin12-gcc |
| 106 | x86-darwin13-gcc |
Johann | bb5a39c | 2015-03-23 22:33:17 | [diff] [blame] | 107 | x86-darwin14-gcc |
James Zern | 77f5c3d | 2016-07-28 05:10:09 | [diff] [blame] | 108 | x86-darwin15-gcc |
Jerome Jiang | 6d38ad4 | 2017-01-27 01:53:00 | [diff] [blame] | 109 | x86-darwin16-gcc |
Johann | b85ac11 | 2019-02-01 21:49:00 | [diff] [blame] | 110 | x86-darwin17-gcc |
Tom Finegan | cd2088b | 2014-06-11 01:52:58 | [diff] [blame] | 111 | x86-iphonesimulator-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 112 | x86-linux-gcc |
| 113 | x86-linux-icc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 114 | x86-os2-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 115 | x86-solaris-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 116 | x86-win32-gcc |
Ghislain MARY | 3067c34 | 2015-07-28 14:37:09 | [diff] [blame] | 117 | x86-win32-vs14 |
Gregor Jasny | bcfd9c9 | 2017-05-23 07:30:44 | [diff] [blame] | 118 | x86-win32-vs15 |
Johann | daefbf2 | 2019-10-29 17:19:43 | [diff] [blame] | 119 | x86-win32-vs16 |
Gregor Jasny | cafe7cc | 2022-02-10 08:01:49 | [diff] [blame] | 120 | x86-win32-vs17 |
James Zern | 5da87e8 | 2015-07-24 21:24:20 | [diff] [blame] | 121 | x86_64-android-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 122 | x86_64-darwin9-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 123 | x86_64-darwin10-gcc |
| 124 | x86_64-darwin11-gcc |
| 125 | x86_64-darwin12-gcc |
| 126 | x86_64-darwin13-gcc |
Johann | bb5a39c | 2015-03-23 22:33:17 | [diff] [blame] | 127 | x86_64-darwin14-gcc |
James Zern | 77f5c3d | 2016-07-28 05:10:09 | [diff] [blame] | 128 | x86_64-darwin15-gcc |
Jerome Jiang | 6d38ad4 | 2017-01-27 01:53:00 | [diff] [blame] | 129 | x86_64-darwin16-gcc |
Johann | b85ac11 | 2019-02-01 21:49:00 | [diff] [blame] | 130 | x86_64-darwin17-gcc |
Johann | 5ed1801 | 2019-10-23 17:50:31 | [diff] [blame] | 131 | x86_64-darwin18-gcc |
Johann | 3ef630a | 2020-03-31 06:52:30 | [diff] [blame] | 132 | x86_64-darwin19-gcc |
James Zern | 979e27c | 2020-09-25 20:21:11 | [diff] [blame] | 133 | x86_64-darwin20-gcc |
James Zern | 3d57fb6 | 2023-05-06 01:56:59 | [diff] [blame] | 134 | x86_64-darwin21-gcc |
| 135 | x86_64-darwin22-gcc |
James Zern | f9b7c85 | 2023-12-04 21:25:01 | [diff] [blame] | 136 | x86_64-darwin23-gcc |
James Zern | 6e23d97 | 2024-11-19 20:29:59 | [diff] [blame] | 137 | x86_64-darwin24-gcc |
Tom Finegan | cd2088b | 2014-06-11 01:52:58 | [diff] [blame] | 138 | x86_64-iphonesimulator-gcc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 139 | x86_64-linux-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 140 | x86_64-linux-icc |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 141 | x86_64-solaris-gcc |
Paweł Hajdan | 9ab4777 | 2013-08-02 03:08:42 | [diff] [blame] | 142 | x86_64-win64-gcc |
Ghislain MARY | 3067c34 | 2015-07-28 14:37:09 | [diff] [blame] | 143 | x86_64-win64-vs14 |
Gregor Jasny | bcfd9c9 | 2017-05-23 07:30:44 | [diff] [blame] | 144 | x86_64-win64-vs15 |
Johann | daefbf2 | 2019-10-29 17:19:43 | [diff] [blame] | 145 | x86_64-win64-vs16 |
Gregor Jasny | cafe7cc | 2022-02-10 08:01:49 | [diff] [blame] | 146 | x86_64-win64-vs17 |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 147 | generic-gnu |
| 148 | |
| 149 | The generic-gnu target, in conjunction with the CROSS environment variable, |
| 150 | can be used to cross compile architectures that aren't explicitly listed, if |
| 151 | the toolchain is a cross GNU (gcc/binutils) toolchain. Other POSIX toolchains |
| 152 | will likely work as well. For instance, to build using the mipsel-linux-uclibc |
| 153 | toolchain, the following command could be used (note, POSIX SH syntax, adapt |
| 154 | to your shell as necessary): |
| 155 | |
Johann | a31a58d | 2010-10-07 18:13:36 | [diff] [blame] | 156 | $ CROSS=mipsel-linux-uclibc- ../libvpx/configure |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 157 | |
| 158 | In addition, the executables to be invoked can be overridden by specifying the |
James Zern | b0c9d0c | 2024-06-11 20:46:00 | [diff] [blame] | 159 | environment variables: AR, AS, CC, CXX, LD, STRIP. Additional flags can be |
| 160 | passed to these executables with ASFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS. |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 161 | |
Johann | 20521c3 | 2018-03-27 19:59:15 | [diff] [blame] | 162 | 6. Configuration errors |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 163 | If the configuration step fails, the first step is to look in the error log. |
James Zern | e636af1 | 2013-07-18 21:17:00 | [diff] [blame] | 164 | This defaults to config.log. This should give a good indication of what went |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 165 | wrong. If not, contact us for support. |
| 166 | |
James Zern | 4bbca2e | 2014-05-30 23:37:39 | [diff] [blame] | 167 | VP8/VP9 TEST VECTORS: |
| 168 | The test vectors can be downloaded and verified using the build system after |
| 169 | running configure. To specify an alternate directory the |
| 170 | LIBVPX_TEST_DATA_PATH environment variable can be used. |
| 171 | |
| 172 | $ ./configure --enable-unit-tests |
| 173 | $ LIBVPX_TEST_DATA_PATH=../libvpx-test-data make testdata |
| 174 | |
James Zern | 15f29ef | 2016-07-28 05:16:51 | [diff] [blame] | 175 | CODE STYLE: |
| 176 | The coding style used by this project is enforced with clang-format using the |
| 177 | configuration contained in the .clang-format file in the root of the |
| 178 | repository. |
| 179 | |
| 180 | Before pushing changes for review you can format your code with: |
| 181 | # Apply clang-format to modified .c, .h and .cc files |
| 182 | $ clang-format -i --style=file \ |
| 183 | $(git diff --name-only --diff-filter=ACMR '*.[hc]' '*.cc') |
| 184 | |
| 185 | Check the .clang-format file for the version used to generate it if there is |
| 186 | any difference between your local formatting and the review system. |
| 187 | |
| 188 | See also: http://clang.llvm.org/docs/ClangFormat.html |
| 189 | |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 190 | PROFILE GUIDED OPTIMIZATION (PGO) |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 191 | Profile Guided Optimization can be enabled for Clang builds using the |
| 192 | commands: |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 193 | |
| 194 | $ export CC=clang |
| 195 | $ export CXX=clang++ |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 196 | $ ../libvpx/configure --enable-profile |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 197 | $ make |
| 198 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 199 | Generate one or multiple PGO profile files by running vpxdec or vpxenc. For |
| 200 | example: |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 201 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 202 | $ ./vpxdec ../vpx/out_ful/vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm \ |
| 203 | -o - > /dev/null |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 204 | |
| 205 | To convert and merge the raw profile files, use the llvm-profdata tool: |
| 206 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 207 | $ llvm-profdata merge -o perf.profdata default_8382761441159425451_0.profraw |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 208 | |
| 209 | Then, rebuild the project with the new profile file: |
| 210 | |
| 211 | $ make clean |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 212 | $ ../libvpx/configure --use-profile=perf.profdata |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 213 | $ make |
| 214 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 215 | Note: Always use the llvm-profdata from the toolchain that is used for |
| 216 | compiling the PGO-enabled binary. |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 217 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 218 | To observe the improvements from a PGO-enabled build, enable and compare the |
| 219 | list of failed optimizations by using the -Rpass-missed compiler flag. For |
| 220 | example, to list the failed loop vectorizations: |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 221 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 222 | $ ../libvpx/configure --use-profile=perf.profdata \ |
| 223 | --extra-cflags=-Rpass-missed=loop-vectorize |
Zoltan Kuscsik | 7eec109 | 2023-12-13 15:13:00 | [diff] [blame] | 224 | |
James Zern | 8408251 | 2024-02-05 21:19:30 | [diff] [blame] | 225 | For guidance on utilizing PGO files to identify potential optimization |
| 226 | opportunities, see: tools/README.pgo.md |
Zoltan Kuscsik | c6a8fa2 | 2024-02-01 08:18:04 | [diff] [blame] | 227 | |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 228 | SUPPORT |
| 229 | This library is an open source project supported by its community. Please |
James Zern | 5ea8712 | 2016-07-28 05:10:02 | [diff] [blame] | 230 | email [email protected] for help. |
John Koleszar | 0ea50ce | 2010-05-18 15:58:33 | [diff] [blame] | 231 | |
James Zern | 9a1e8ae | 2024-07-18 22:24:12 | [diff] [blame] | 232 | BUG REPORTS |
| 233 | Bug reports can be filed in the libvpx issue tracker: |
| 234 | https://issues.webmproject.org/. |
James Zern | 50aa6cc | 2024-08-26 22:30:01 | [diff] [blame] | 235 | For security reports, select 'Security report' from the Template dropdown. |