blob: 1938375e5cf1be97779499835f9f5bc024cf6e98 [file] [log] [blame] [view]
Tom Finegan9e57db22017-06-07 07:22:37 -07001# AV1 Codec Library
2
Tom Fineganbca03fc2017-12-08 07:47:06 -08003## Contents
41. [Building the lib and applications](#building-the-library-and-applications)
5 - [Prerequisites](#prerequisites)
Tom Finegan9007d342017-12-14 07:47:13 -08006 - [Get the code](#get-the-code)
Tom Fineganbca03fc2017-12-08 07:47:06 -08007 - [Basics](#basic-build)
8 - [Configuration options](#configuration-options)
9 - [Dylib builds](#dylib-builds)
10 - [Debugging](#debugging)
11 - [Cross compiling](#cross-compiling)
12 - [Sanitizer support](#sanitizers)
13 - [MSVC builds](#microsoft-visual-studio-builds)
14 - [Xcode builds](#xcode-builds)
15 - [Emscripten builds](#emscripten-builds)
Tom Fineganaa71f072018-01-31 06:54:01 -080016 - [Extra Build Flags](#extra-build-flags)
Tom Fineganbca03fc2017-12-08 07:47:06 -0800172. [Testing the library](#testing-the-av1-codec)
18 - [Basics](#testing-basics)
19 - [Unit tests](#1_unit-tests)
20 - [Example tests](#2_example-tests)
Tom Finegan9007d342017-12-14 07:47:13 -080021 - [Encoder tests](#3_encoder-tests)
Tom Fineganbca03fc2017-12-08 07:47:06 -080022 - [IDE hosted tests](#ide-hosted-tests)
23 - [Downloading test data](#downloading-the-test-data)
Tom Finegan9007d342017-12-14 07:47:13 -080024 - [Additional test data](#additional-test-data)
Tom Fineganbca03fc2017-12-08 07:47:06 -080025 - [Sharded testing](#sharded-testing)
26 - [Running tests directly](#1_running-test_libaom-directly)
27 - [Running tests via CMake](#2_running-the-tests-via-the-cmake-build)
283. [Coding style](#coding-style)
Tom Finegan9007d342017-12-14 07:47:13 -0800294. [Submitting patches](#submitting-patches)
30 - [Login cookie](#login-cookie)
31 - [Contributor agreement](#contributor-agreement)
32 - [Testing your code](#testing-your-code)
33 - [Commit message hook](#commit-message-hook)
34 - [Upload your change](#upload-your-change)
35 - [Incorporating Reviewer Comments](#incorporating-reviewer-comments)
36 - [Submitting your change](#submitting-your-change)
37 - [Viewing change status](#viewing-the-status-of-uploaded-changes)
385. [Support](#support)
396. [Bug reports](#bug-reports)
Tom Fineganbca03fc2017-12-08 07:47:06 -080040
Tom Finegan9e57db22017-06-07 07:22:37 -070041## Building the library and applications
42
43### Prerequisites
44
45 1. [CMake](https://cmake.org) version 3.5 or higher.
46 2. [Git](https://git-scm.com/).
47 3. [Perl](https://www.perl.org/).
48 4. For x86 targets, [yasm](http://yasm.tortall.net/), which is preferred, or a
49 recent version of [nasm](http://www.nasm.us/).
50 5. Building the documentation requires [doxygen](http://doxygen.org).
Tom Fineganff766cd2017-06-20 14:18:03 -070051 6. Building the unit tests requires [Python](https://www.python.org/).
Tom Finegan84d35992017-07-07 10:38:01 -070052 7. Emscripten builds require the portable
53 [EMSDK](https://kripken.github.io/emscripten-site/index.html).
Tom Finegan9e57db22017-06-07 07:22:37 -070054
Tom Finegan9007d342017-12-14 07:47:13 -080055### Get the code
56
57The AV1 library source code is stored in the Alliance for Open Media Git
58repository:
59
60~~~
61 $ git clone https://aomedia.googlesource.com/aom
62 # By default, the above command stores the source in the aom directory:
63 $ cd aom
64~~~
65
Tom Finegan9e57db22017-06-07 07:22:37 -070066### Basic build
67
68CMake replaces the configure step typical of many projects. Running CMake will
69produce configuration and build files for the currently selected CMake
70generator. For most systems the default generator is Unix Makefiles. The basic
71form of a makefile build is the following:
72
Tom Finegan9007d342017-12-14 07:47:13 -080073~~~
Tom Finegan9e57db22017-06-07 07:22:37 -070074 $ cmake path/to/aom
75 $ make
Tom Finegan9007d342017-12-14 07:47:13 -080076~~~
Tom Finegan9e57db22017-06-07 07:22:37 -070077
78The above will generate a makefile build that produces the AV1 library and
79applications for the current host system after the make step completes
80successfully. The compiler chosen varies by host platform, but a general rule
81applies: On systems where cc and c++ are present in $PATH at the time CMake is
82run the generated build will use cc and c++ by default.
83
84### Configuration options
85
86The AV1 codec library has a great many configuration options. These come in two
87varieties:
88
89 1. Build system configuration options. These have the form `ENABLE_FEATURE`.
90 2. AV1 codec configuration options. These have the form `CONFIG_FEATURE`.
91
92Both types of options are set at the time CMake is run. The following example
Sebastien Alaiwan7c524d42018-01-02 10:10:55 +010093enables ccache and disables the AV1 encoder:
Tom Finegan9e57db22017-06-07 07:22:37 -070094
Tom Finegan007b2ee2017-07-11 14:47:06 -070095~~~
Sebastien Alaiwan7c524d42018-01-02 10:10:55 +010096 $ cmake path/to/aom -DENABLE_CCACHE=1 -DCONFIG_AV1_ENCODER=0
Tom Finegan9e57db22017-06-07 07:22:37 -070097 $ make
Tom Finegan007b2ee2017-07-11 14:47:06 -070098~~~
Tom Finegan9e57db22017-06-07 07:22:37 -070099
100The available configuration options are too numerous to list here. Build system
101configuration options can be found at the top of the CMakeLists.txt file found
102in the root of the AV1 repository, and AV1 codec configuration options can
103currently be found in the file `build/cmake/aom_config_defaults.cmake`.
104
Tom Finegan84f2d792017-06-15 23:06:44 -0700105### Dylib builds
106
107A dylib (shared object) build of the AV1 codec library can be enabled via the
Tom Finegan007b2ee2017-07-11 14:47:06 -0700108CMake built in variable `BUILD_SHARED_LIBS`:
Tom Finegan84f2d792017-06-15 23:06:44 -0700109
Tom Finegan007b2ee2017-07-11 14:47:06 -0700110~~~
111 $ cmake path/to/aom -DBUILD_SHARED_LIBS=1
Tom Finegan84f2d792017-06-15 23:06:44 -0700112 $ make
Tom Finegan007b2ee2017-07-11 14:47:06 -0700113~~~
Tom Finegan84f2d792017-06-15 23:06:44 -0700114
115This is currently only supported on non-Windows targets.
116
Tom Fineganfe809bd2017-09-27 11:54:24 -0700117### Debugging
118
119Depending on the generator used there are multiple ways of going about
120debugging AV1 components. For single configuration generators like the Unix
121Makefiles generator, setting `CMAKE_BUILD_TYPE` to Debug is sufficient:
122
123~~~
124 $ cmake path/to/aom -DCMAKE_BUILD_TYPE=Debug
125~~~
126
127For Xcode, mainly because configuration controls for Xcode builds are buried two
Tom Finegand77323d2017-09-29 09:41:43 -0700128configuration windows deep and must be set for each subproject within the Xcode
129IDE individually, `CMAKE_CONFIGURATION_TYPES` should be set to Debug:
Tom Fineganfe809bd2017-09-27 11:54:24 -0700130
131~~~
132 $ cmake path/to/aom -G Xcode -DCMAKE_CONFIGURATION_TYPES=Debug
133~~~
134
135For Visual Studio the in-IDE configuration controls should be used. Simply set
136the IDE project configuration to Debug to allow for stepping through the code.
137
138In addition to the above it can sometimes be useful to debug only C and C++
Tom Finegand77323d2017-09-29 09:41:43 -0700139code. To disable all assembly code and intrinsics set `AOM_TARGET_CPU` to
Tom Fineganfe809bd2017-09-27 11:54:24 -0700140generic at generation time:
141
142~~~
143 $ cmake path/to/aom -DAOM_TARGET_CPU=generic
144~~~
145
Tom Finegan9e57db22017-06-07 07:22:37 -0700146### Cross compiling
147
148For the purposes of building the AV1 codec and applications and relative to the
149scope of this guide, all builds for architectures differing from the native host
150architecture will be considered cross compiles. The AV1 CMake build handles
151cross compiling via the use of toolchain files included in the AV1 repository.
152The toolchain files available at the time of this writing are:
153
154 - arm64-ios.cmake
155 - arm64-linux-gcc.cmake
156 - armv7-ios.cmake
157 - armv7-linux-gcc.cmake
158 - armv7s-ios.cmake
159 - mips32-linux-gcc.cmake
160 - mips64-linux-gcc.cmake
161 - x86-ios-simulator.cmake
162 - x86-linux.cmake
163 - x86-macos.cmake
Tom Finegand77323d2017-09-29 09:41:43 -0700164 - x86-mingw-gcc.cmake
Tom Finegan9e57db22017-06-07 07:22:37 -0700165 - x86\_64-ios-simulator.cmake
Tom Finegand77323d2017-09-29 09:41:43 -0700166 - x86\_64-mingw-gcc.cmake
Tom Finegan9e57db22017-06-07 07:22:37 -0700167
168The following example demonstrates use of the x86-macos.cmake toolchain file on
169a x86\_64 MacOS host:
170
Tom Finegan007b2ee2017-07-11 14:47:06 -0700171~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700172 $ cmake path/to/aom \
173 -DCMAKE_TOOLCHAIN_FILE=path/to/aom/build/cmake/toolchains/x86-macos.cmake
174 $ make
Tom Finegan007b2ee2017-07-11 14:47:06 -0700175~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700176
177To build for an unlisted target creation of a new toolchain file is the best
178solution. The existing toolchain files can be used a starting point for a new
179toolchain file since each one exposes the basic requirements for toolchain files
180as used in the AV1 codec build.
181
182As a temporary work around an unoptimized AV1 configuration that builds only C
183and C++ sources can be produced using the following commands:
184
Tom Finegan007b2ee2017-07-11 14:47:06 -0700185~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700186 $ cmake path/to/aom -DAOM_TARGET_CPU=generic
187 $ make
Tom Finegan007b2ee2017-07-11 14:47:06 -0700188~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700189
190In addition to the above it's important to note that the toolchain files
191suffixed with gcc behave differently than the others. These toolchain files
192attempt to obey the $CROSS environment variable.
193
Tom Finegan8a30baf2017-09-13 11:35:34 -0700194### Sanitizers
195
196Sanitizer integration is built-in to the CMake build system. To enable a
197sanitizer, add `-DSANITIZE=<type>` to the CMake command line. For example, to
198enable address sanitizer:
199
200~~~
201 $ cmake path/to/aom -DSANITIZE=address
202 $ make
203~~~
204
205Sanitizers available vary by platform, target, and compiler. Consult your
206compiler documentation to determine which, if any, are available.
207
Tom Finegan9e57db22017-06-07 07:22:37 -0700208### Microsoft Visual Studio builds
209
210Building the AV1 codec library in Microsoft Visual Studio is supported. The
211following example demonstrates generating projects and a solution for the
212Microsoft IDE:
213
Tom Finegan007b2ee2017-07-11 14:47:06 -0700214~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700215 # This does not require a bash shell; command.exe is fine.
216 $ cmake path/to/aom -G "Visual Studio 15 2017"
Tom Finegan007b2ee2017-07-11 14:47:06 -0700217~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700218
219### Xcode builds
220
221Building the AV1 codec library in Xcode is supported. The following example
222demonstrates generating an Xcode project:
223
Tom Finegan007b2ee2017-07-11 14:47:06 -0700224~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700225 $ cmake path/to/aom -G Xcode
Tom Finegan007b2ee2017-07-11 14:47:06 -0700226~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700227
Tom Finegan84d35992017-07-07 10:38:01 -0700228### Emscripten builds
229
230Building the AV1 codec library with Emscripten is supported. Typically this is
231used to hook into the AOMAnalyzer GUI application. These instructions focus on
232using the inspector with AOMAnalyzer, but all tools can be built with
233Emscripten.
234
235It is assumed here that you have already downloaded and installed the EMSDK,
236installed and activated at least one toolchain, and setup your environment
237appropriately using the emsdk\_env script.
238
2391. Download [AOMAnalyzer](https://people.xiph.org/~mbebenita/analyzer/).
240
2412. Configure the build:
242
243~~~
244 $ cmake path/to/aom \
245 -DENABLE_CCACHE=1 \
246 -DAOM_TARGET_CPU=generic \
247 -DENABLE_DOCS=0 \
248 -DCONFIG_ACCOUNTING=1 \
249 -DCONFIG_INSPECTION=1 \
250 -DCONFIG_MULTITHREAD=0 \
251 -DCONFIG_RUNTIME_CPU_DETECT=0 \
252 -DCONFIG_UNIT_TESTS=0 \
253 -DCONFIG_WEBM_IO=0 \
254 -DCMAKE_TOOLCHAIN_FILE=path/to/emsdk-portable/.../Emscripten.cmake
255~~~
256
2573. Build it: run make if that's your generator of choice:
258
259~~~
260 $ make inspect
261~~~
262
2634. Run the analyzer:
264
265~~~
266 # inspect.js is in the examples sub directory of the directory in which you
267 # executed cmake.
268 $ path/to/AOMAnalyzer path/to/examples/inspect.js path/to/av1/input/file
269~~~
270
Tom Fineganaa71f072018-01-31 06:54:01 -0800271### Extra build flags
272
273Three variables allow for passing of additional flags to the build system.
274
275- AOM\_EXTRA\_C\_FLAGS
276- AOM\_EXTRA\_CXX\_FLAGS
277- AOM\_EXTRA\_EXE\_LINKER\_FLAGS
278
279The build system attempts to ensure the flags passed through the above variables
280are passed to tools last in order to allow for override of default behavior.
281These flags can be used, for example, to enable asserts in a release build:
282
283~~~
284 $ cmake path/to/aom \
285 -DCMAKE_BUILD_TYPE=Release \
286 -DAOM_EXTRA_C_FLAGS=-UNDEBUG \
287 -DAOM_EXTRA_CXX_FLAGS=-UNDEBUG
288~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700289
290## Testing the AV1 codec
291
292### Testing basics
293
Tom Finegan9007d342017-12-14 07:47:13 -0800294There are several methods of testing the AV1 codec. All of these methods require
295the presence of the AV1 source code and a working build of the AV1 library and
296applications.
Tom Finegan9e57db22017-06-07 07:22:37 -0700297
Tom Finegan007b2ee2017-07-11 14:47:06 -0700298#### 1. Unit tests:
Tom Finegan9e57db22017-06-07 07:22:37 -0700299
300The unit tests can be run at build time:
301
Tom Finegan007b2ee2017-07-11 14:47:06 -0700302~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700303 # Before running the make command the LIBAOM_TEST_DATA_PATH environment
304 # variable should be set to avoid downloading the test files to the
305 # cmake build configuration directory.
306 $ cmake path/to/aom
307 # Note: The AV1 CMake build creates many test targets. Running make
308 # with multiple jobs will speed up the test run significantly.
309 $ make runtests
Tom Finegan007b2ee2017-07-11 14:47:06 -0700310~~~
311
312#### 2. Example tests:
Tom Finegan9e57db22017-06-07 07:22:37 -0700313
314The example tests require a bash shell and can be run in the following manner:
315
Tom Finegan007b2ee2017-07-11 14:47:06 -0700316~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700317 # See the note above about LIBAOM_TEST_DATA_PATH above.
318 $ cmake path/to/aom
319 $ make
320 # It's best to build the testdata target using many make jobs.
321 # Running it like this will verify and download (if necessary)
322 # one at a time, which takes a while.
323 $ make testdata
324 $ path/to/aom/test/examples.sh --bin-path examples
Tom Finegan007b2ee2017-07-11 14:47:06 -0700325~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700326
Tom Finegan9007d342017-12-14 07:47:13 -0800327#### 3. Encoder tests:
328
329When making a change to the encoder run encoder tests to confirm that your
330change has a positive or negligible impact on encode quality. When running these
331tests the build configuration should be changed to enable internal encoder
332statistics:
333
334~~~
335 $ cmake path/to/aom -DCONFIG_INTERNAL_STATS=1
336 $ make
337~~~
338
339The repository contains scripts intended to make running these tests as simple
340as possible. The following example demonstrates creating a set of baseline clips
341for comparison to results produced after making your change to libaom:
342
343~~~
344 # This will encode all Y4M files in the current directory using the
345 # settings specified to create the encoder baseline statistical data:
346 $ cd path/to/test/inputs
347 # This command line assumes that run_encodes.sh, its helper script
348 # best_encode.sh, and the aomenc you intend to test are all within a
349 # directory in your PATH.
350 $ run_encodes.sh 200 500 50 baseline
351~~~
352
353After making your change and creating the baseline clips, you'll need to run
354encodes that include your change(s) to confirm that things are working as
355intended:
356
357~~~
358 # This will encode all Y4M files in the current directory using the
359 # settings specified to create the statistical data for your change:
360 $ cd path/to/test/inputs
361 # This command line assumes that run_encodes.sh, its helper script
362 # best_encode.sh, and the aomenc you intend to test are all within a
363 # directory in your PATH.
364 $ run_encodes.sh 200 500 50 mytweak
365~~~
366
367After creating both data sets you can use `test/visual_metrics.py` to generate a
368report that can be viewed in a web browser:
369
370~~~
371 $ visual_metrics.py metrics_template.html "*stt" baseline mytweak \
372 > mytweak.html
373~~~
374
375You can view the report by opening mytweak.html in a web browser.
376
377
Tom Finegan9e57db22017-06-07 07:22:37 -0700378### IDE hosted tests
379
380By default the generated projects files created by CMake will not include the
381runtests and testdata rules when generating for IDEs like Microsoft Visual
382Studio and Xcode. This is done to avoid intolerably long build cycles in the
383IDEs-- IDE behavior is to build all targets when selecting the build project
384options in MSVS and Xcode. To enable the test rules in IDEs the
385`ENABLE_IDE_TEST_HOSTING` variable must be enabled at CMake generation time:
386
Tom Finegan007b2ee2017-07-11 14:47:06 -0700387~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700388 # This example uses Xcode. To get a list of the generators
389 # available, run cmake with the -G argument missing its
390 # value.
391 $ cmake path/to/aom -DENABLE_IDE_TEST_HOSTING=1 -G Xcode
Tom Finegan007b2ee2017-07-11 14:47:06 -0700392~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700393
394### Downloading the test data
395
396The fastest and easiest way to obtain the test data is to use CMake to generate
397a build using the Unix Makefiles generator, and then to build only the testdata
398rule:
399
Tom Finegan007b2ee2017-07-11 14:47:06 -0700400~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700401 $ cmake path/to/aom -G "Unix Makefiles"
402 # 28 is used because there are 28 test files as of this writing.
403 $ make -j28 testdata
Tom Finegan007b2ee2017-07-11 14:47:06 -0700404~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700405
406The above make command will only download and verify the test data.
407
Tom Finegan9007d342017-12-14 07:47:13 -0800408### Additional test data
409
410The test data mentioned above is strictly intended for unit testing.
411
412Additional input data for testing the encoder can be obtained from:
413https://media.xiph.org/video/derf/
414
Tom Finegan007b2ee2017-07-11 14:47:06 -0700415### Sharded testing
416
417The AV1 codec library unit tests are built upon gtest which supports sharding of
418test jobs. Sharded test runs can be achieved in a couple of ways.
419
420#### 1. Running test\_libaom directly:
421
422~~~
James Zern47cd7be2018-03-16 18:12:10 -0700423 # Set the environment variable GTEST_TOTAL_SHARDS to control the number of
424 # shards.
425 $ export GTEST_TOTAL_SHARDS=10
Tom Finegan007b2ee2017-07-11 14:47:06 -0700426 # (GTEST shard indexing is 0 based).
James Zern515c8692017-08-30 16:32:28 -0700427 $ seq 0 $(( $GTEST_TOTAL_SHARDS - 1 )) \
428 | xargs -n 1 -P 0 -I{} env GTEST_SHARD_INDEX={} ./test_libaom
Tom Finegan007b2ee2017-07-11 14:47:06 -0700429~~~
430
431To create a test shard for each CPU core available on the current system set
432`GTEST_TOTAL_SHARDS` to the number of CPU cores on your system minus one.
433
434#### 2. Running the tests via the CMake build:
435
436~~~
437 # For IDE based builds, ENABLE_IDE_TEST_HOSTING must be enabled. See
438 # the IDE hosted tests section above for more information. If the IDE
439 # supports building targets concurrently tests will be sharded by default.
440
441 # For make and ninja builds the -j parameter controls the number of shards
442 # at test run time. This example will run the tests using 10 shards via
443 # make.
444 $ make -j10 runtests
445~~~
446
447The maximum number of test targets that can run concurrently is determined by
448the number of CPUs on the system where the build is configured as detected by
449CMake. A system with 24 cores can run 24 test shards using a value of 24 with
450the `-j` parameter. When CMake is unable to detect the number of cores 10 shards
451is the default maximum value.
Tom Finegan9e57db22017-06-07 07:22:37 -0700452
453## Coding style
454
Tom Finegan9007d342017-12-14 07:47:13 -0800455We are using the Google C Coding Style defined by the
456[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
457
Tom Finegan9e57db22017-06-07 07:22:37 -0700458The coding style used by this project is enforced with clang-format using the
Tom Finegan9007d342017-12-14 07:47:13 -0800459configuration contained in the
460[.clang-format](https://chromium.googlesource.com/webm/aom/+/master/.clang-format)
461file in the root of the repository.
462
463You can download clang-format using your system's package manager, or directly
464from [llvm.org](http://llvm.org/releases/download.html). You can also view the
465[documentation](https://clang.llvm.org/docs/ClangFormat.html) on llvm.org.
466Output from clang-format varies by clang-format version, for best results your
467version should match the one used on Jenkins. You can find the clang-format
468version by reading the comment in the `.clang-format` file linked above.
Tom Finegan9e57db22017-06-07 07:22:37 -0700469
470Before pushing changes for review you can format your code with:
471
Tom Finegan007b2ee2017-07-11 14:47:06 -0700472~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700473 # Apply clang-format to modified .c, .h and .cc files
474 $ clang-format -i --style=file \
475 $(git diff --name-only --diff-filter=ACMR '*.[hc]' '*.cc')
Tom Finegan007b2ee2017-07-11 14:47:06 -0700476~~~
Tom Finegan9e57db22017-06-07 07:22:37 -0700477
478Check the .clang-format file for the version used to generate it if there is any
479difference between your local formatting and the review system.
480
Tom Finegan9007d342017-12-14 07:47:13 -0800481Some Git installations have clang-format integration. Here are some examples:
482
483~~~
484 # Apply clang-format to all staged changes:
485 $ git clang-format
486
487 # Clang format all staged and unstaged changes:
488 $ git clang-format -f
489
490 # Clang format all staged and unstaged changes interactively:
491 $ git clang-format -f -p
492~~~
493
494## Submitting patches
495
496We manage the submission of patches using the
497[Gerrit](https://www.gerritcodereview.com/) code review tool. This tool
498implements a workflow on top of the Git version control system to ensure that
499all changes get peer reviewed and tested prior to their distribution.
500
501### Login cookie
502
503Browse to [AOMedia Git index](https://aomedia.googlesource.com/) and login with
504your account (Gmail credentials, for example). Next, follow the
505`Generate Password` Password link at the top of the page. You’ll be given
506instructions for creating a cookie to use with our Git repos.
507
508### Contributor agreement
509
510You will be required to execute a
511[contributor agreement](http://aomedia.org/license) to ensure that the AOMedia
512Project has the right to distribute your changes.
513
514### Testing your code
515
516The testing basics are covered in the [testing section](#testing-the-av1-codec)
517above.
518
519In addition to the local tests, many more (e.g. asan, tsan, valgrind) will run
520through Jenkins instances upon upload to gerrit.
521
522### Commit message hook
523
524Gerrit requires that each submission include a unique Change-Id. You can assign
525one manually using git commit --amend, but it’s easier to automate it with the
526commit-msg hook provided by Gerrit.
527
528Copy commit-msg to the `.git/hooks` directory of your local repo. Here's an
529example:
530
531~~~
532 $ curl -Lo aom/.git/hooks/commit-msg https://chromium-review.googlesource.com/tools/hooks/commit-msg
533
534 # Next, ensure that the downloaded commit-msg script is executable:
535 $ chmod u+x aom/.git/hooks/commit-msg
536~~~
537
538See the Gerrit
539[documentation](https://gerrit-review.googlesource.com/Documentation/user-changeid.html)
540for more information.
541
542### Upload your change
543
544The command line to upload your patch looks like this:
545
546~~~
547 $ git push https://aomedia-review.googlesource.com/aom HEAD:refs/for/master
548~~~
549
550### Incorporating reviewer comments
551
552If you previously uploaded a change to Gerrit and the Approver has asked for
553changes, follow these steps:
554
5551. Edit the files to make the changes the reviewer has requested.
5562. Recommit your edits using the --amend flag, for example:
557
558~~~
559 $ git commit -a --amend
560~~~
561
5623. Use the same git push command as above to upload to Gerrit again for another
563 review cycle.
564
565In general, you should not rebase your changes when doing updates in response to
566review. Doing so can make it harder to follow the evolution of your change in
567the diff view.
568
569### Submitting your change
570
571Once your change has been Approved and Verified, you can “submit” it through the
572Gerrit UI. This will usually automatically rebase your change onto the branch
573specified.
574
575Sometimes this can’t be done automatically. If you run into this problem, you
576must rebase your changes manually:
577
578~~~
579 $ git fetch
580 $ git rebase origin/branchname
581~~~
582
583If there are any conflicts, resolve them as you normally would with Git. When
584you’re done, reupload your change.
585
586### Viewing the status of uploaded changes
587
588To check the status of a change that you uploaded, open
589[Gerrit](https://aomedia-review.googlesource.com/), sign in, and click My >
590Changes.
Tom Finegan9e57db22017-06-07 07:22:37 -0700591
592## Support
593
594This library is an open source project supported by its community. Please
595please email aomediacodec@jointdevelopment.kavi.com for help.
596
597## Bug reports
598
599Bug reports can be filed in the Alliance for Open Media
600[issue tracker](https://bugs.chromium.org/p/aomedia/issues/list).