Skip to content

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

Description

@MetaFOE-Team

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:

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

Run it with the attached input:

./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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions