#1485·brotli

quality=11 output is larger than quality=1 output for the same input

Author: MetaFOE-TeamCreated May 22, 2026Updated May 23, 2026

Summary

With a specific input, one-shot Brotli compression with BrotliEncoderCompress() produces a larger output at quality=11 than at quality=1 when the same mode and window settings are used.

The attached reproducer reads the input once, compresses it with quality=1, compresses the same bytes with quality=11, and prints the compressed sizes. In the observed result, the quality=1 output is 164 bytes and the quality=11 output is 165 bytes.

If higher quality is expected to optimize compression density monotonically for the same input and encoder settings, the quality=11 output is expected to be smaller than or equal to the quality=1 output. If size monotonicity across quality levels is not guaranteed, this behavior may need clarification in the encoder documentation.

Environment

The observation below was collected on:

OS: Ubuntu 20.04.6 LTS (Focal Fossa), x86_64
Compiler for the standalone reproducer: gcc 9.4.0
Brotli source version: 1.2.0
Git commit: ab685df8343d8046226ece980408e958c10f9085

Observation

Running on Brotli encoder version 0x01000007

Running the attached reproducer and input produces:

Brotli encoder version: 0x01000007
input size: 161
quality 1 compressed size: 164
quality 11 compressed size: 165
quality 11 output is larger than quality 1 output

The reproducer therefore observes a one-byte size increase when moving from quality=1 to quality=11 for the same input.

Reproduce steps

The attachments are:

brotli_quality_size_repro.c
brotli_quality_test_input.bin

Compile the reproducer against the Brotli encoder library:

bash
cc -O0 -g brotli_quality_size_repro.c -lbrotlienc -o repro

Run it with the attached input:

bash
./repro brotli_quality_test_input.bin

The reproducer prints the Brotli encoder version and the two compressed sizes. It returns a non-zero exit status when the quality=11 output is larger than the quality=1 output.

reproduce.zip