# AOM AV1 mode-control encoder

This source package contains a modified AOM AV1 encoder with runtime control
over individual coding tools. It is intended for generating focused AV1
bitstreams for decoder and hardware bring-up tests.

The added `aomenc` option is:

```text
--tools-cfg=FILE.csv
```

The CSV file can enable or disable individual:

- block partition types;
- intra prediction modes;
- inter reference frames and prediction modes;
- compound prediction types;
- transform sizes and transform types.

Loop filtering, CDEF, loop restoration, palette, CfL, angle delta, OBMC and
other high-level features are controlled with the normal `aomenc` flags. The
included Python wrapper exposes both groups through one INI file.

## Contents

- `_ref_av1_aom/` — modified AOM source tree;
- `enc_av1/` — Python wrapper, web UI and B0-B5 example presets;
- `build_encoder.sh` — reproducible encoder-only build helper.

Generated build directories and binaries are deliberately excluded. The ZIP
has been verified by extracting it into an empty directory and compiling
`aomenc` from scratch.

## Requirements

- Linux or macOS;
- C and C++ compiler (GCC or Clang);
- CMake 3.16 or newer;
- GNU Make or Ninja;
- Python 3.8 or newer for the INI wrapper;
- FFmpeg only when using the wrapper's crop support.

## Build

From the extracted package directory:

```bash
./build_encoder.sh
```

The resulting executable is:

```text
_ref_av1_aom/build_enc/aomenc
```

An alternative build directory can be passed as the first argument. Parallel
job count can be set with `BUILD_JOBS`:

```bash
BUILD_JOBS=8 ./build_encoder.sh /tmp/aom-mode-control-build
```

## Use the INI wrapper

```bash
cd enc_av1

# Generate an editable configuration containing every supported tool.
./encode.py --init my_modes.ini

# Set the wanted tools to true and the other tools in the same category to
# false, then encode raw YUV420 input.
./encode.py -i input.yuv -o output.ivf -cfg my_modes.ini
```

Ready-made progressive presets are included:

- `B0_infrastructure.ini` — DC + DCT baseline, no filters;
- `B1_intra.ini` — basic intra modes and transforms;
- `B2_intra_features.ini` — angle delta, CfL, palette and filter intra;
- `B3_inter.ini` — inter prediction and compound modes;
- `B4_deblocking.ini` — deblocking enabled;
- `B5_full.ini` — full tool set including CDEF and loop restoration.

Run `./encode.py --help` for wrapper options. The source dimensions must be
specified in the INI file or with `-W` and `-H`.

## Use `aomenc` directly

A tools configuration is a CSV file with `category,name,enabled` rows:

```csv
partition,PARTITION_NONE,1
partition,PARTITION_SPLIT,0
intra,DC_PRED,1
intra,V_PRED,0
inter_mode,NEWMV,1
compound_type,COMPOUND_AVERAGE,1
tx_size,TX_16X16,1
transform,DCT_DCT,1
transform,ADST_DCT,0
```

Entries omitted from a CSV remain enabled, so list and disable the other modes
when a category must be restricted to one concrete choice. The wrapper always
writes a complete CSV automatically.

Example direct command:

```bash
_ref_av1_aom/build_enc/aomenc \
  --tools-cfg=my_tools.csv \
  -w 256 -h 256 --fps=30/1 --limit=1 \
  --passes=1 --end-usage=q --cq-level=30 \
  -o output.ivf input.yuv
```

Tool control constrains the encoder's mode search. A selected mode can only be
used where it is valid in the AV1 syntax and coding context.

## Source information

- Upstream project: Alliance for Open Media `libaom`;
- base working-tree commit: `2318aa16a78502cf930fe2b06072a74bc14893f3`;
- package date: 2026-07-21;
- platform-independent source package; no prebuilt executable is included.

The upstream AOM license and patent notices are included in
`_ref_av1_aom/LICENSE` and `_ref_av1_aom/PATENTS`.
