Name Date Size #Lines LOC

..--

aom/H25-Apr-2025-7,8412,693

aom_dsp/H25-Apr-2025-117,97292,806

aom_mem/H25-Apr-2025-224155

aom_ports/H25-Apr-2025-2,4161,743

aom_scale/H25-Apr-2025-1,129818

aom_util/H25-Apr-2025-1,038756

apps/H25-Apr-2025-3,8453,257

av1/H25-Apr-2025-344,669273,821

build/H25-Apr-2025-3,8183,281

common/H25-Apr-2025-5,8754,169

config/H25-Apr-2025-33,95024,825

doc/H25-Apr-2025-14,61814,006

examples/H25-Apr-2025-8,7126,253

stats/H25-Apr-2025-504349

test/H25-Apr-2025-78,67864,355

third_party/H25-Apr-2025-126,938100,248

tools/H25-Apr-2025-12,3228,815

.clang-formatH A D25-Apr-2025246 109

.cmake-format.pyH A D25-Apr-20253 KiB10338

.gitattributesH A D25-Apr-2025448 1918

.gitignoreH A D25-Apr-202562 98

.mailmapH A D25-Apr-20255.7 KiB116115

AUTHORSH A D25-Apr-202511.8 KiB325323

Android.bpH A D25-Apr-202531.2 KiB1,076971

Android.bp.inH A D25-Apr-202511.2 KiB392355

CHANGELOGH A D25-Apr-202547.7 KiB1,137992

CMakeLists.txtH A D25-Apr-202542.3 KiB1,060934

LICENSEH A D25-Apr-20251.3 KiB2822

METADATAH A D25-Apr-2025775 3026

NOTICEH A D25-Apr-202513.5 KiB284221

OWNERSH A D25-Apr-2025183 65

PATENTSH A D25-Apr-20255.6 KiB10985

README.androidH A D25-Apr-20251.3 KiB5235

README.mdH A D25-Apr-202524.8 KiB705536

Sample.cfgH A D25-Apr-20252.4 KiB3535

TEST_MAPPINGH A D25-Apr-2025195 1312

aomedia_logo_200.pngHD25-Apr-20256.9 KiB

codereview.settingsH A D25-Apr-2025169 54

docs.cmakeH A D25-Apr-202514.6 KiB346296

generate_config.shH A D25-Apr-20254.3 KiB16484

keywords.doxH A D25-Apr-20252.1 KiB5242

libaom_blocklist.txtH A D25-Apr-20251.4 KiB3130

libs.doxy_templateH A D25-Apr-2025103.1 KiB2,3911,853

mainpage.doxH A D25-Apr-20251.6 KiB6954

update_libaom.shH A D25-Apr-20252.3 KiB9648

usage.doxH A D25-Apr-20255.1 KiB11091

usage_cx.doxH A D25-Apr-2025223 106

usage_dx.doxH A D25-Apr-2025955 2316

README.android

1Name: libaom
2URL: https://aomedia.org
3Version: v3.10.0
4License: BSD
5License File: libaom/LICENSE
6
7Date: Tuesday November 19 2024
8Branch: v3.11.0
9Commit: d6f30ae474dd6c358f26de0a0fc26a0d7340a84c
10
11Cherry-picks:
12None
13
14Description:
15Contains the sources used to compile libaom.
16
17The libaom source is from aomedia.org:
18  https://aomedia.googlesource.com/aom/
19
20Please follow these steps to update libaom source code:
21
221. Update libaom source tree. Look for "Current HEAD: <hash>" output to update
23   README.android. Look for "git log from upstream: <git log>" output to add
24   to the commit message.
25
26   ./update_libaom.sh [branch name]
27
282. Generate updated Android.bp and config files.
29
30   ./generate_config.sh
31
323. Update this file with any Version, Date, Branch, or Commit changes. The
33   version is in the file config/config/aom_version.h
34
354. Commit the changes. The commit message should look like this and is printed
36   by update_libaom.sh:
37   libaom: Pull from upstream
38
39   Current HEAD: <hash>
40
41   git log from upstream:
42   a6b2070 <git commit message 1>
43   08dabbc <git commit message 2>
44   c29fb02 <git commit message 3>
45
46Tools needed to build libaom:
47
48- generate_config.sh
49
50Generate config files that contain the source list for each platform.
51A list of prerequisites is at the top of generate_config.sh.
52

README.md

1README.md                {#LREADME}
2=========
3# AV1 Codec Library
4
5## Contents
61. [Building the lib and applications](#building-the-library-and-applications)
7    - [Prerequisites](#prerequisites)
8    - [Get the code](#get-the-code)
9    - [Basics](#basic-build)
10    - [Configuration options](#configuration-options)
11    - [Dylib builds](#dylib-builds)
12    - [Debugging](#debugging)
13    - [Cross compiling](#cross-compiling)
14    - [Sanitizer support](#sanitizers)
15    - [MSVC builds](#microsoft-visual-studio-builds)
16    - [Xcode builds](#xcode-builds)
17    - [Emscripten builds](#emscripten-builds)
18    - [Extra Build Flags](#extra-build-flags)
19    - [Build with VMAF support](#build-with-vmaf)
202. [Testing the library](#testing-the-av1-codec)
21    - [Basics](#testing-basics)
22        - [Unit tests](#unit-tests)
23        - [Example tests](#example-tests)
24        - [Encoder tests](#encoder-tests)
25    - [IDE hosted tests](#ide-hosted-tests)
26    - [Downloading test data](#downloading-the-test-data)
27    - [Adding a new test data file](#adding-a-new-test-data-file)
28    - [Additional test data](#additional-test-data)
29    - [Sharded testing](#sharded-testing)
30        - [Running tests directly](#running-test_libaom-directly)
31        - [Running tests via CMake](#running-the-tests-via-the-cmake-build)
323. [Coding style](#coding-style)
334. [License header](#license-header)
345. [Submitting patches](#submitting-patches)
35    - [Login cookie](#login-cookie)
36    - [Contributor agreement](#contributor-agreement)
37    - [Testing your code](#testing-your-code)
38    - [Commit message hook](#commit-message-hook)
39    - [Upload your change](#upload-your-change)
40    - [Incorporating Reviewer Comments](#incorporating-reviewer-comments)
41    - [Submitting your change](#submitting-your-change)
42    - [Viewing change status](#viewing-the-status-of-uploaded-changes)
436. [Support](#support)
447. [Bug reports](#bug-reports)
45
46## Building the library and applications {#building-the-library-and-applications}
47
48### Prerequisites {#prerequisites}
49
501. [CMake](https://cmake.org). See CMakeLists.txt for the minimum version
51   required.
522. [Git](https://git-scm.com/).
533. A modern C compiler. gcc 6+, clang 7+, Microsoft Visual Studio 2019+ or
54   the latest version of MinGW-w64 (clang64 or ucrt toolchains) are
55   recommended. A C++ compiler is necessary to build the unit tests and some
56   features contained in the examples.
574. [Perl](https://www.perl.org/).
585. For x86 targets, [yasm](http://yasm.tortall.net/) or a recent version (2.14
59   or later) of [nasm](http://www.nasm.us/). (If both yasm and nasm are
60   present, yasm will be used by default. Pass -DENABLE_NASM=ON to cmake to
61   select nasm.) If you download yasm with the intention to work with Visual
62   Studio, please download win32.exe or win64.exe and rename it into yasm.exe.
63   DO NOT download or use vsyasm.exe.
646. Building the documentation requires
65   [doxygen version 1.8.10 or newer](http://doxygen.org).
667. Emscripten builds require the portable
67   [EMSDK](https://kripken.github.io/emscripten-site/index.html).
68
69### Get the code {#get-the-code}
70
71The AV1 library source code is stored in the Alliance for Open Media Git
72repository:
73
74~~~
75    $ git clone https://aomedia.googlesource.com/aom
76    # By default, the above command stores the source in the aom directory:
77    $ cd aom
78~~~
79
80### Basic build {#basic-build}
81
82CMake replaces the configure step typical of many projects. Running CMake will
83produce configuration and build files for the currently selected CMake
84generator. For most systems the default generator is Unix Makefiles. The basic
85form of a makefile build is the following:
86
87~~~
88    $ cmake path/to/aom
89    $ make
90~~~
91
92The above will generate a makefile build that produces the AV1 library and
93applications for the current host system after the make step completes
94successfully. The compiler chosen varies by host platform, but a general rule
95applies: On systems where cc and c++ are present in $PATH at the time CMake is
96run the generated build will use cc and c++ by default.
97
98### Configuration options {#configuration-options}
99
100The AV1 codec library has a great many configuration options. These come in two
101varieties:
102
103 1. Build system configuration options. These have the form `ENABLE_FEATURE`.
104 2. AV1 codec configuration options. These have the form `CONFIG_FEATURE`.
105
106Both types of options are set at the time CMake is run. The following example
107enables ccache and disables the AV1 encoder:
108
109~~~
110    $ cmake path/to/aom -DENABLE_CCACHE=1 -DCONFIG_AV1_ENCODER=0
111    $ make
112~~~
113
114The available configuration options are too numerous to list here. Build system
115configuration options can be found at the top of the CMakeLists.txt file found
116in the root of the AV1 repository, and AV1 codec configuration options can
117currently be found in the file `build/cmake/aom_config_defaults.cmake`.
118
119### Dylib builds {#dylib-builds}
120
121A dylib (shared object) build of the AV1 codec library can be enabled via the
122CMake built in variable `BUILD_SHARED_LIBS`:
123
124~~~
125    $ cmake path/to/aom -DBUILD_SHARED_LIBS=1
126    $ make
127~~~
128
129This is currently only supported on non-Windows targets.
130
131### Debugging {#debugging}
132
133Depending on the generator used there are multiple ways of going about
134debugging AV1 components. For single configuration generators like the Unix
135Makefiles generator, setting `CMAKE_BUILD_TYPE` to Debug is sufficient:
136
137~~~
138    $ cmake path/to/aom -DCMAKE_BUILD_TYPE=Debug
139~~~
140
141For Xcode, mainly because configuration controls for Xcode builds are buried two
142configuration windows deep and must be set for each subproject within the Xcode
143IDE individually, `CMAKE_CONFIGURATION_TYPES` should be set to Debug:
144
145~~~
146    $ cmake path/to/aom -G Xcode -DCMAKE_CONFIGURATION_TYPES=Debug
147~~~
148
149For Visual Studio the in-IDE configuration controls should be used. Simply set
150the IDE project configuration to Debug to allow for stepping through the code.
151
152In addition to the above it can sometimes be useful to debug only C and C++
153code. To disable all assembly code and intrinsics set `AOM_TARGET_CPU` to
154generic at generation time:
155
156~~~
157    $ cmake path/to/aom -DAOM_TARGET_CPU=generic
158~~~
159
160### Cross compiling {#cross-compiling}
161
162For the purposes of building the AV1 codec and applications and relative to the
163scope of this guide, all builds for architectures differing from the native host
164architecture will be considered cross compiles. The AV1 CMake build handles
165cross compiling via the use of toolchain files included in the AV1 repository.
166The toolchain files available at the time of this writing are:
167
168 - arm64-ios.cmake
169 - arm64-linux-clang.cmake
170 - arm64-linux-gcc.cmake
171 - arm64-mingw-gcc.cmake
172 - armv7-ios.cmake
173 - armv7-linux-gcc.cmake
174 - armv7-mingw-gcc.cmake
175 - armv7s-ios.cmake
176 - ppc-linux-gcc.cmake
177 - riscv-linux-gcc.cmake
178 - x86-ios-simulator.cmake
179 - x86-linux.cmake
180 - x86-macos.cmake
181 - x86-mingw-gcc.cmake
182 - x86\_64-ios-simulator.cmake
183 - x86\_64-mingw-gcc.cmake
184
185The following example demonstrates use of the x86-macos.cmake toolchain file on
186a x86\_64 MacOS host:
187
188~~~
189    $ cmake path/to/aom \
190      -DCMAKE_TOOLCHAIN_FILE=path/to/aom/build/cmake/toolchains/x86-macos.cmake
191    $ make
192~~~
193
194To build for an unlisted target creation of a new toolchain file is the best
195solution. The existing toolchain files can be used a starting point for a new
196toolchain file since each one exposes the basic requirements for toolchain files
197as used in the AV1 codec build.
198
199As a temporary work around an unoptimized AV1 configuration that builds only C
200and C++ sources can be produced using the following commands:
201
202~~~
203    $ cmake path/to/aom -DAOM_TARGET_CPU=generic
204    $ make
205~~~
206
207In addition to the above it's important to note that the toolchain files
208suffixed with gcc behave differently than the others. These toolchain files
209attempt to obey the $CROSS environment variable.
210
211### Sanitizers {#sanitizers}
212
213Sanitizer integration is built-in to the CMake build system. To enable a
214sanitizer, add `-DSANITIZE=<type>` to the CMake command line. For example, to
215enable address sanitizer:
216
217~~~
218    $ cmake path/to/aom -DSANITIZE=address
219    $ make
220~~~
221
222Sanitizers available vary by platform, target, and compiler. Consult your
223compiler documentation to determine which, if any, are available.
224
225### Microsoft Visual Studio builds {#microsoft-visual-studio-builds}
226
227Building the AV1 codec library in Microsoft Visual Studio is supported. Visual
228Studio 2019 (16.0) or later is required. The following example demonstrates
229generating projects and a solution for the Microsoft IDE:
230
231~~~
232    # This does not require a bash shell; Command Prompt (cmd.exe) is fine.
233    # This assumes the build host is a Windows x64 computer.
234
235    # To create a Visual Studio 2022 solution for the x64 target:
236    $ cmake path/to/aom -G "Visual Studio 17 2022"
237
238    # To create a Visual Studio 2022 solution for the 32-bit x86 target:
239    $ cmake path/to/aom -G "Visual Studio 17 2022" -A Win32
240
241    # To create a Visual Studio 2019 solution for the x64 target:
242    $ cmake path/to/aom -G "Visual Studio 16 2019"
243
244    # To create a Visual Studio 2019 solution for the 32-bit x86 target:
245    $ cmake path/to/aom -G "Visual Studio 16 2019" -A Win32
246
247    # To build the solution:
248    $ cmake --build .
249~~~
250
251NOTE: The build system targets Windows 7 or later by compiling files with
252`-D_WIN32_WINNT=0x0601`.
253
254### Xcode builds {#xcode-builds}
255
256Building the AV1 codec library in Xcode is supported. The following example
257demonstrates generating an Xcode project:
258
259~~~
260    $ cmake path/to/aom -G Xcode
261~~~
262
263### Emscripten builds {#emscripten-builds}
264
265Building the AV1 codec library with Emscripten is supported. Typically this is
266used to hook into the AOMAnalyzer GUI application. These instructions focus on
267using the inspector with AOMAnalyzer, but all tools can be built with
268Emscripten.
269
270It is assumed here that you have already downloaded and installed the EMSDK,
271installed and activated at least one toolchain, and setup your environment
272appropriately using the emsdk\_env script.
273
2741. Build [AOM Analyzer](https://github.com/xiph/aomanalyzer).
275
2762. Configure the build:
277
278~~~
279    $ cmake path/to/aom \
280        -DENABLE_CCACHE=1 \
281        -DAOM_TARGET_CPU=generic \
282        -DENABLE_DOCS=0 \
283        -DENABLE_TESTS=0 \
284        -DCONFIG_ACCOUNTING=1 \
285        -DCONFIG_INSPECTION=1 \
286        -DCONFIG_MULTITHREAD=0 \
287        -DCONFIG_RUNTIME_CPU_DETECT=0 \
288        -DCONFIG_WEBM_IO=0 \
289        -DCMAKE_TOOLCHAIN_FILE=path/to/emsdk-portable/.../Emscripten.cmake
290~~~
291
2923. Build it: run make if that's your generator of choice:
293
294~~~
295    $ make inspect
296~~~
297
2984. Run the analyzer:
299
300~~~
301    # inspect.js is in the examples sub directory of the directory in which you
302    # executed cmake.
303    $ path/to/AOMAnalyzer path/to/examples/inspect.js path/to/av1/input/file
304~~~
305
306### Extra build flags {#extra-build-flags}
307
308Three variables allow for passing of additional flags to the build system.
309
310- AOM\_EXTRA\_C\_FLAGS
311- AOM\_EXTRA\_CXX\_FLAGS
312- AOM\_EXTRA\_EXE\_LINKER\_FLAGS
313
314The build system attempts to ensure the flags passed through the above variables
315are passed to tools last in order to allow for override of default behavior.
316These flags can be used, for example, to enable asserts in a release build:
317
318~~~
319    $ cmake path/to/aom \
320        -DCMAKE_BUILD_TYPE=Release \
321        -DAOM_EXTRA_C_FLAGS=-UNDEBUG \
322        -DAOM_EXTRA_CXX_FLAGS=-UNDEBUG
323~~~
324
325### Build with VMAF support {#build-with-vmaf}
326
327After installing
328[libvmaf.a](https://github.com/Netflix/vmaf/tree/master/libvmaf),
329you can use it with the encoder:
330
331~~~
332    $ cmake path/to/aom -DCONFIG_TUNE_VMAF=1
333~~~
334
335Please note that the default VMAF model
336("/usr/local/share/model/vmaf_v0.6.1.json")
337will be used unless you set the following flag when running the encoder:
338
339~~~
340    # --vmaf-model-path=path/to/model
341~~~
342
343## Testing the AV1 codec {#testing-the-av1-codec}
344
345### Testing basics {#testing-basics}
346
347There are several methods of testing the AV1 codec. All of these methods require
348the presence of the AV1 source code and a working build of the AV1 library and
349applications.
350
351#### 1. Unit tests: {#unit-tests}
352
353The unit tests can be run at build time:
354
355~~~
356    # Before running the make command the LIBAOM_TEST_DATA_PATH environment
357    # variable should be set to avoid downloading the test files to the
358    # cmake build configuration directory.
359    $ cmake path/to/aom
360    # Note: The AV1 CMake build creates many test targets. Running make
361    # with multiple jobs will speed up the test run significantly.
362    $ make runtests
363~~~
364
365#### 2. Example tests: {#example-tests}
366
367The example tests require a bash shell and can be run in the following manner:
368
369~~~
370    # See the note above about LIBAOM_TEST_DATA_PATH above.
371    $ cmake path/to/aom
372    $ make
373    # It's best to build the testdata target using many make jobs.
374    # Running it like this will verify and download (if necessary)
375    # one at a time, which takes a while.
376    $ make testdata
377    $ path/to/aom/test/examples.sh --bin-path examples
378~~~
379
380#### 3. Encoder tests: {#encoder-tests}
381
382When making a change to the encoder run encoder tests to confirm that your
383change has a positive or negligible impact on encode quality. When running these
384tests the build configuration should be changed to enable internal encoder
385statistics:
386
387~~~
388    $ cmake path/to/aom -DCONFIG_INTERNAL_STATS=1
389    $ make
390~~~
391
392The repository contains scripts intended to make running these tests as simple
393as possible. The following example demonstrates creating a set of baseline clips
394for comparison to results produced after making your change to libaom:
395
396~~~
397    # This will encode all Y4M files in the current directory using the
398    # settings specified to create the encoder baseline statistical data:
399    $ cd path/to/test/inputs
400    # This command line assumes that run_encodes.sh, its helper script
401    # best_encode.sh, and the aomenc you intend to test are all within a
402    # directory in your PATH.
403    $ run_encodes.sh 200 500 50 baseline
404~~~
405
406After making your change and creating the baseline clips, you'll need to run
407encodes that include your change(s) to confirm that things are working as
408intended:
409
410~~~
411    # This will encode all Y4M files in the current directory using the
412    # settings specified to create the statistical data for your change:
413    $ cd path/to/test/inputs
414    # This command line assumes that run_encodes.sh, its helper script
415    # best_encode.sh, and the aomenc you intend to test are all within a
416    # directory in your PATH.
417    $ run_encodes.sh 200 500 50 mytweak
418~~~
419
420After creating both data sets you can use `test/visual_metrics.py` to generate a
421report that can be viewed in a web browser:
422
423~~~
424    $ visual_metrics.py metrics_template.html "*stt" baseline mytweak \
425      > mytweak.html
426~~~
427
428You can view the report by opening mytweak.html in a web browser.
429
430
431### IDE hosted tests {#ide-hosted-tests}
432
433By default the generated projects files created by CMake will not include the
434runtests and testdata rules when generating for IDEs like Microsoft Visual
435Studio and Xcode. This is done to avoid intolerably long build cycles in the
436IDEs-- IDE behavior is to build all targets when selecting the build project
437options in MSVS and Xcode. To enable the test rules in IDEs the
438`ENABLE_IDE_TEST_HOSTING` variable must be enabled at CMake generation time:
439
440~~~
441    # This example uses Xcode. To get a list of the generators
442    # available, run cmake with the -G argument missing its
443    # value.
444    $ cmake path/to/aom -DENABLE_IDE_TEST_HOSTING=1 -G Xcode
445~~~
446
447### Downloading the test data {#downloading-the-test-data}
448
449The fastest and easiest way to obtain the test data is to use CMake to generate
450a build using the Unix Makefiles generator, and then to build only the testdata
451rule. By default the test files will be downloaded to the current directory. The
452`LIBAOM_TEST_DATA_PATH` environment variable can be used to set a
453custom one.
454
455~~~
456    $ cmake path/to/aom -G "Unix Makefiles"
457    # 28 is used because there are 28 test files as of this writing.
458    $ make -j28 testdata
459~~~
460
461The above make command will only download and verify the test data.
462
463### Adding a new test data file {#adding-a-new-test-data-file}
464
465First, add the new test data file to the `aom-test-data` bucket of the
466`aomedia-testing` project on Google Cloud Platform. You may need to ask someone
467with the necessary access permissions to do this for you.
468
469NOTE: When a new test data file is added to the `aom-test-data` bucket, its
470"Public access" is initially "Not public". We need to change its
471"Public access" to "Public" by using the following
472[`gsutil`](https://cloud.google.com/storage/docs/gsutil_install) command:
473~~~
474    $ gsutil acl ch -g all:R gs://aom-test-data/test-data-file-name
475~~~
476This command grants the `AllUsers` group READ access to the file named
477"test-data-file-name" in the `aom-test-data` bucket.
478
479Once the new test data file has been added to `aom-test-data`, create a CL to
480add the name of the new test data file to `test/test_data_util.cmake` and add
481the SHA1 checksum of the new test data file to `test/test-data.sha1`. (The SHA1
482checksum of a file can be calculated by running the `sha1sum` command on the
483file.)
484
485### Additional test data {#additional-test-data}
486
487The test data mentioned above is strictly intended for unit testing.
488
489Additional input data for testing the encoder can be obtained from:
490https://media.xiph.org/video/derf/
491
492### Sharded testing {#sharded-testing}
493
494The AV1 codec library unit tests are built upon gtest which supports sharding of
495test jobs. Sharded test runs can be achieved in a couple of ways.
496
497#### 1. Running test\_libaom directly: {#running-test_libaom-directly}
498
499~~~
500   # Set the environment variable GTEST_TOTAL_SHARDS to control the number of
501   # shards.
502   $ export GTEST_TOTAL_SHARDS=10
503   # (GTEST shard indexing is 0 based).
504   $ seq 0 $(( $GTEST_TOTAL_SHARDS - 1 )) \
505       | xargs -n 1 -P 0 -I{} env GTEST_SHARD_INDEX={} ./test_libaom
506~~~
507
508To create a test shard for each CPU core available on the current system set
509`GTEST_TOTAL_SHARDS` to the number of CPU cores on your system minus one.
510
511#### 2. Running the tests via the CMake build: {#running-the-tests-via-the-cmake-build}
512
513~~~
514    # For IDE based builds, ENABLE_IDE_TEST_HOSTING must be enabled. See
515    # the IDE hosted tests section above for more information. If the IDE
516    # supports building targets concurrently tests will be sharded by default.
517
518    # For make and ninja builds the -j parameter controls the number of shards
519    # at test run time. This example will run the tests using 10 shards via
520    # make.
521    $ make -j10 runtests
522~~~
523
524The maximum number of test targets that can run concurrently is determined by
525the number of CPUs on the system where the build is configured as detected by
526CMake. A system with 24 cores can run 24 test shards using a value of 24 with
527the `-j` parameter. When CMake is unable to detect the number of cores 10 shards
528is the default maximum value.
529
530## Coding style {#coding-style}
531
532We are using the Google C Coding Style defined by the
533[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
534
535The coding style used by this project is enforced with clang-format using the
536configuration contained in the
537[.clang-format](https://chromium.googlesource.com/webm/aom/+/main/.clang-format)
538file in the root of the repository.
539
540You can download clang-format using your system's package manager, or directly
541from [llvm.org](http://llvm.org/releases/download.html). You can also view the
542[documentation](https://clang.llvm.org/docs/ClangFormat.html) on llvm.org.
543Output from clang-format varies by clang-format version, for best results your
544version should match the one used on Jenkins. You can find the clang-format
545version by reading the comment in the `.clang-format` file linked above.
546
547Before pushing changes for review you can format your code with:
548
549~~~
550    # Apply clang-format to modified .c, .h and .cc files
551    $ clang-format -i --style=file \
552      $(git diff --name-only --diff-filter=ACMR '*.[hc]' '*.cc')
553~~~
554
555Check the .clang-format file for the version used to generate it if there is any
556difference between your local formatting and the review system.
557
558Some Git installations have clang-format integration. Here are some examples:
559
560~~~
561    # Apply clang-format to all staged changes:
562    $ git clang-format
563
564    # Clang format all staged and unstaged changes:
565    $ git clang-format -f
566
567    # Clang format all staged and unstaged changes interactively:
568    $ git clang-format -f -p
569~~~
570
571## License header {#license-header}
572
573Use the following comment block in new C/C++ source files, replacing "${year}"
574with the current year. The same comment should be added to other file types,
575adjusting the comment syntax as necessary.
576
577```
578/*
579 * Copyright (c) ${year}, Alliance for Open Media. All rights reserved.
580 *
581 * This source code is subject to the terms of the BSD 2 Clause License and
582 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
583 * was not distributed with this source code in the LICENSE file, you can
584 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
585 * Media Patent License 1.0 was not distributed with this source code in the
586 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
587 */
588```
589
590## Submitting patches {#submitting-patches}
591
592We manage the submission of patches using the
593[Gerrit](https://www.gerritcodereview.com/) code review tool. This tool
594implements a workflow on top of the Git version control system to ensure that
595all changes get peer reviewed and tested prior to their distribution.
596
597### Login cookie {#login-cookie}
598
599Browse to [AOMedia Git index](https://aomedia.googlesource.com/) and login with
600your account (Gmail credentials, for example). Next, follow the
601`Generate Password` Password link at the top of the page. You’ll be given
602instructions for creating a cookie to use with our Git repos.
603
604You must also have a Gerrit account associated with your Google account. To do
605this visit the [Gerrit review server](https://aomedia-review.googlesource.com)
606and click "Sign in" (top right).
607
608### Contributor agreement {#contributor-agreement}
609
610You will be required to execute a
611[contributor agreement](http://aomedia.org/license) to ensure that the AOMedia
612Project has the right to distribute your changes.
613
614Note: If you are pushing changes on behalf of an Alliance for Open Media member
615organization this step is not necessary.
616
617### Testing your code {#testing-your-code}
618
619The testing basics are covered in the [testing section](#testing-the-av1-codec)
620above.
621
622In addition to the local tests, many more (e.g. asan, tsan, valgrind) will run
623through Jenkins instances upon upload to gerrit.
624
625### Commit message hook {#commit-message-hook}
626
627Gerrit requires that each submission include a unique Change-Id. You can assign
628one manually using git commit --amend, but it’s easier to automate it with the
629commit-msg hook provided by Gerrit.
630
631Copy commit-msg to the `.git/hooks` directory of your local repo. Here's an
632example:
633
634~~~
635    $ curl -Lo aom/.git/hooks/commit-msg https://chromium-review.googlesource.com/tools/hooks/commit-msg
636
637    # Next, ensure that the downloaded commit-msg script is executable:
638    $ chmod u+x aom/.git/hooks/commit-msg
639~~~
640
641See the Gerrit
642[documentation](https://gerrit-review.googlesource.com/Documentation/user-changeid.html)
643for more information.
644
645### Upload your change {#upload-your-change}
646
647The command line to upload your patch looks like this:
648
649~~~
650    $ git push https://aomedia-review.googlesource.com/aom HEAD:refs/for/main
651~~~
652
653### Incorporating reviewer comments {#incorporating-reviewer-comments}
654
655If you previously uploaded a change to Gerrit and the Approver has asked for
656changes, follow these steps:
657
6581. Edit the files to make the changes the reviewer has requested.
6592. Recommit your edits using the --amend flag, for example:
660
661~~~
662   $ git commit -a --amend
663~~~
664
6653. Use the same git push command as above to upload to Gerrit again for another
666   review cycle.
667
668In general, you should not rebase your changes when doing updates in response to
669review. Doing so can make it harder to follow the evolution of your change in
670the diff view.
671
672### Submitting your change {#submitting-your-change}
673
674Once your change has been Approved and Verified, you can “submit” it through the
675Gerrit UI. This will usually automatically rebase your change onto the branch
676specified.
677
678Sometimes this can’t be done automatically. If you run into this problem, you
679must rebase your changes manually:
680
681~~~
682    $ git fetch
683    $ git rebase origin/branchname
684~~~
685
686If there are any conflicts, resolve them as you normally would with Git. When
687you’re done, reupload your change.
688
689### Viewing the status of uploaded changes {#viewing-the-status-of-uploaded-changes}
690
691To check the status of a change that you uploaded, open
692[Gerrit](https://aomedia-review.googlesource.com/), sign in, and click My >
693Changes.
694
695## Support {#support}
696
697This library is an open source project supported by its community. Please
698please email [email protected] for help.
699
700## Bug reports {#bug-reports}
701
702Bug reports can be filed in the Alliance for Open Media
703[issue tracker](https://aomedia.issues.chromium.org/). For security reports,
704select 'Security report' from the Template dropdown.
705