Skip to content

perf(adm): split adm_p_norm==3.0 fast-path (ADR-0463) - #1678

Merged
lusoris merged 1 commit into
masterfrom
perf/adm-p3-fast-path
Oct 1, 2026
Merged

lusoris merged 1 commit into
masterfrom
perf/adm-p3-fast-path

Conversation

@lusoris

@lusoris lusoris commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Restores the ADM adm_p_norm == 3.0 fast paths (adm_*_s_p3, ADR-0463 / BUG-048 B3) lost to stale merges.

  • Eliminates 14 predictably-taken branches and per-pixel powf calls on the hot path for default VMAF evaluations.
  • Preserves 100% bit-exact scores across all frames at --precision max on both 576p and 1080p checkerboard test pairs.
  • Measured ~1.92x speedup on 1080p checkerboard (234.9 ms -> 122.4 ms/frame, zeus host).

Type

  • perf — performance improvement

Checklist

  • Commits follow Conventional Commits
  • Unit tests pass: python3 scripts/ci/run_meson_test.py -- -C build

Bug-status hygiene

  • docs/state.md updated in this PR with row T-BUG048-PERF-RESTORATIONS-2026-09-26

Netflix golden-data gate

  • I did not modify any assertAlmostEqual(...) score in the Netflix golden Python tests.

Deep-dive deliverables (ADR-0108)

  • Research digest — no digest needed: restoration of ADR-0463 / BUG-048 B3
  • Decision matrix — no alternatives: only-one-way fix (restore lost fast path)
  • AGENTS.md invariant note — no rebase-sensitive invariants
  • Reproducer / smoke-test command — pasted below under Reproducer
  • CHANGELOG fragment — changelog.d/changed/perf-adm-p3-fast-path.md
  • Rebase note — docs/rebase-notes.md

Reproducer

make test-netflix-golden
python3 scripts/ci/run_meson_test.py -- -C build --suite=fast

@lusoris
lusoris force-pushed the perf/adm-p3-fast-path branch from c3abb7d to 6f4cd1b Compare October 1, 2026 10:54
@lusoris
lusoris merged commit 57da15e into master Oct 1, 2026
64 of 68 checks passed
@lusoris
lusoris deleted the perf/adm-p3-fast-path branch October 1, 2026 10:54
@github-actions github-actions Bot added the type:perf Performance improvement label Oct 1, 2026
lusoris added a commit that referenced this pull request Oct 6, 2026
…ion_target, conversion in read_pictures (#1671-#1675, #1677, #1678)

Netflix/vmaf PRs merged on 2026-10-05: ed61076b2 (per-input colorimetry
flags), 1ddf81607 (conversion_target in the model file), a6c0ba6d5
(convert pictures to the model's target in vmaf_read_pictures), 130569c45
(Windows build of its test), efe90c8b8 (Python pass-through), 5c3f4fb90
(approximate gamma in the zimg graph), 4f3f71b68 (CAMBI 144p encode
minimum).

Adapted, not verbatim (ADR-2093, ADR-1822): VmafPicture keeps its layout,
so the source colour of each input is declared on the context with the
new vmaf_set_input_colorimetry() instead of VmafPicture::color; the
policy functions take it as an argument and the glue upstream keeps in
libvmaf.c is core/src/conversion_context.c. The conversion runs on the
host before any device upload; a device picture and the SYCL zero-copy
entry point are refused with -ENOTSUP when a model declares a target. A
failed conversion releases the pictures (ADR-1431). The CAMBI minimum is
applied to the CUDA, HIP, SYCL and Metal option tables as well. Upstream's
missing-colour message named flags that do not exist; it names the real
ones.

Fixtures: the two 576x324 HDR dock clips of Netflix/vmaf_resource are in
scripts/test/fetch-test-yuvs.sh with md5 sums.

Measured on ryzen-4090-arc (gcc, zimg 3.0.6): test_model,
test_conversion_policy, test_read_pictures_convert, test_cli_parse,
test_colorspace and the new CAMBI minimum contract pass; disabling the
conversion makes test_read_pictures_convert fail; the Netflix golden
tests (CPU, isolated gcc build) 280 passed, 3 skipped; clang-tidy cpu lane
0 findings on the 13 touched translation units.

(cherry picked from commits ed61076b2, 1ddf81607, a6c0ba6d5, 130569c45,
efe90c8b8, 5c3f4fb90, 4f3f71b68)

Co-authored-by: Christos Bampis <christosb@netflix.com>
Co-authored-by: Pavan Madhusudanarao <pmadhusudanarao@netflix.com>
lusoris added a commit that referenced this pull request Oct 6, 2026
…ion_target, conversion in read_pictures (#1671-#1675, #1677, #1678) (#2300)

* port(upstream): HDR-VMAF groundwork: input colorimetry, model conversion_target, conversion in read_pictures (#1671-#1675, #1677, #1678)

Netflix/vmaf PRs merged on 2026-10-05: ed61076b2 (per-input colorimetry
flags), 1ddf81607 (conversion_target in the model file), a6c0ba6d5
(convert pictures to the model's target in vmaf_read_pictures), 130569c45
(Windows build of its test), efe90c8b8 (Python pass-through), 5c3f4fb90
(approximate gamma in the zimg graph), 4f3f71b68 (CAMBI 144p encode
minimum).

Adapted, not verbatim (ADR-2093, ADR-1822): VmafPicture keeps its layout,
so the source colour of each input is declared on the context with the
new vmaf_set_input_colorimetry() instead of VmafPicture::color; the
policy functions take it as an argument and the glue upstream keeps in
libvmaf.c is core/src/conversion_context.c. The conversion runs on the
host before any device upload; a device picture and the SYCL zero-copy
entry point are refused with -ENOTSUP when a model declares a target. A
failed conversion releases the pictures (ADR-1431). The CAMBI minimum is
applied to the CUDA, HIP, SYCL and Metal option tables as well. Upstream's
missing-colour message named flags that do not exist; it names the real
ones.

Fixtures: the two 576x324 HDR dock clips of Netflix/vmaf_resource are in
scripts/test/fetch-test-yuvs.sh with md5 sums.

Measured on ryzen-4090-arc (gcc, zimg 3.0.6): test_model,
test_conversion_policy, test_read_pictures_convert, test_cli_parse,
test_colorspace and the new CAMBI minimum contract pass; disabling the
conversion makes test_read_pictures_convert fail; the Netflix golden
tests (CPU, isolated gcc build) 280 passed, 3 skipped; clang-tidy cpu lane
0 findings on the 13 touched translation units.

(cherry picked from commits ed61076b2, 1ddf81607, a6c0ba6d5, 130569c45,
efe90c8b8, 5c3f4fb90, 4f3f71b68)

Co-authored-by: Christos Bampis <christosb@netflix.com>
Co-authored-by: Pavan Madhusudanarao <pmadhusudanarao@netflix.com>
lusoris added a commit that referenced this pull request Oct 6, 2026
…es in the libvmaf filters (#2304)

* port(upstream): HDR-VMAF groundwork: input colorimetry, model conversion_target, conversion in read_pictures (#1671-#1675, #1677, #1678)

Netflix/vmaf PRs merged on 2026-10-05: ed61076b2 (per-input colorimetry
flags), 1ddf81607 (conversion_target in the model file), a6c0ba6d5
(convert pictures to the model's target in vmaf_read_pictures), 130569c45
(Windows build of its test), efe90c8b8 (Python pass-through), 5c3f4fb90
(approximate gamma in the zimg graph), 4f3f71b68 (CAMBI 144p encode
minimum).

Adapted, not verbatim (ADR-2093, ADR-1822): VmafPicture keeps its layout,
so the source colour of each input is declared on the context with the
new vmaf_set_input_colorimetry() instead of VmafPicture::color; the
policy functions take it as an argument and the glue upstream keeps in
libvmaf.c is core/src/conversion_context.c. The conversion runs on the
host before any device upload; a device picture and the SYCL zero-copy
entry point are refused with -ENOTSUP when a model declares a target. A
failed conversion releases the pictures (ADR-1431). The CAMBI minimum is
applied to the CUDA, HIP, SYCL and Metal option tables as well. Upstream's
missing-colour message named flags that do not exist; it names the real
ones.

Fixtures: the two 576x324 HDR dock clips of Netflix/vmaf_resource are in
scripts/test/fetch-test-yuvs.sh with md5 sums.

Measured on ryzen-4090-arc (gcc, zimg 3.0.6): test_model,
test_conversion_policy, test_read_pictures_convert, test_cli_parse,
test_colorspace and the new CAMBI minimum contract pass; disabling the
conversion makes test_read_pictures_convert fail; the Netflix golden
tests (CPU, isolated gcc build) 280 passed, 3 skipped; clang-tidy cpu lane
0 findings on the 13 touched translation units.

(cherry picked from commits ed61076b2, 1ddf81607, a6c0ba6d5, 130569c45,
efe90c8b8, 5c3f4fb90, 4f3f71b68)

Co-authored-by: Christos Bampis <christosb@netflix.com>
Co-authored-by: Pavan Madhusudanarao <pmadhusudanarao@netflix.com>

* feat(ffmpeg): declare the input colorimetry from the AVFrame properties in the libvmaf filters

Patch 0022 of the FFmpeg series (ADR-2093): on the first frame pair the libvmaf filter and the software path of libvmaf_sycl map the AVFrame range, primaries, transfer and matrix of each input and call vmaf_set_input_colorimetry(), so a model with a conversion_target converts HDR input. An input with an attribute libvmaf does not name stays unspecified, so SDR and untagged input score as before. Refreshed and checked against FFmpeg n9.0.2. Measured with an FFmpeg n9.0.2 build carrying patches 0001 to 0022: check-libvmaf-input-colorimetry.sh 8 of 8; test_ffmpeg_libvmaf_input_colorimetry_contract passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:perf Performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant