Skip to content

refactor(core): cpp23 Wave 3 part B — psnr_tools, luminance_tools, mkdirp (ADR-0731) - #51

Merged
lusoris merged 1 commit into
masterfrom
feat/cpp23-wave3-part-b-20260528
May 28, 2026
Merged

lusoris merged 1 commit into
masterfrom
feat/cpp23-wave3-part-b-20260528

Conversation

@lusoris

@lusoris lusoris commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert psnr_tools.c, luminance_tools.c, and mkdirp.c to C++23 following the ADR-0708 isolated-static-library playbook
  • Each TU compiled as its own static_library with override_options=['cpp_std=c++23']; objects extracted into libvmaf and all tests via feature_cpp23_objects helper
  • Fixes orphaned test_ansnr_simd entries in core/test/meson.build left over from the ansnr drop (commit 70ed8b3)

C++23 idioms applied

File Idioms
psnr_tools.cpp constexpr std::array lookup table, std::string_view dispatch, std::optional return
luminance_tools.cpp std::max/std::clamp replacing MAX(), constexpr constants, std::string_view EOTF dispatch, [[nodiscard]]
mkdirp.cpp std::string RAII replacing goto fail + dual free(), constexpr path separator

Six deep-dive deliverables (ADR-0108)

  • Research digest: no digest needed: bulk Wave 3 part B continues ADR-0708 playbook
  • Decision matrix: in ADR-0731 ## Alternatives considered
  • core/AGENTS.md invariant: feature_cpp23_objects wiring rule added
  • Reproducer: meson setup core/build-wave3b core -Denable_cuda=false -Denable_sycl=false -Denable_vulkan=disabled && ninja -C core/build-wave3b && meson test -C core/build-wave3b --suite=fast — 50/50 pass
  • changelog.d/changed/cpp23-wave3-part-b.md
  • docs/rebase-notes.md entry

Per-surface docs

no user-discoverable surface change: internal refactor — .c → .cpp, no API delta, no new CLI flags or public headers

docs/state.md

no state.md update needed: no bugs opened, closed, or ruled not-affecting

ffmpeg-patches

no ffmpeg-patches update needed: no public C-API or public header changes

ADR

ADR-0731

Test outcome

Ok: 50  Fail: 0

@lusoris
lusoris marked this pull request as ready for review May 28, 2026 16:26
@lusoris
lusoris enabled auto-merge (squash) May 28, 2026 16:26
Comment thread core/src/feature/mkdirp.cpp Fixed
…dirp (ADR-0731)

Convert three small feature utility TUs from C to C++23 following the ADR-0708
isolated-static-library playbook:

- psnr_tools.cpp: constexpr lookup table replaces strcmp chain; std::string_view
  dispatch eliminates repeated strlen traversals.
- luminance_tools.cpp: std::max/std::clamp replace MAX() macro; BT.1886/PQ
  constants become constexpr; EOTF dispatch uses std::string_view; [[nodiscard]]
  on internal helpers; extern "C" guards added to luminance_tools.h and log.h.
- mkdirp.cpp: std::string RAII replaces goto-fail cleanup; strdup+free pairs
  eliminated; MIT-licensed original logic preserved.

Each TU is compiled as an isolated static_library (psnr_tools_cpp23_lib,
luminance_tools_cpp23_lib, mkdirp_cpp23_lib) with override_options=['cpp_std=c++23']
and extracted into libvmaf and all test binaries that directly link
libvmaf_feature_static_lib (via new feature_cpp23_objects helper list).

Also removes stale test_ansnr_simd entries from core/test/meson.build left over
from the ansnr drop (commit 70ed8b3).

Six deliverables: no digest needed (bulk Wave 3 part B continues ADR-0708 playbook);
ADR-0731 alternatives matrix; core/AGENTS.md invariant note; reproducer: meson test
--suite=fast (50/50); changelog.d/changed/cpp23-wave3-part-b.md; rebase-notes.md entry.
No user-discoverable surface change (internal refactor).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lusoris
lusoris force-pushed the feat/cpp23-wave3-part-b-20260528 branch from 4e55c59 to 60be4ad Compare May 28, 2026 21:57
@lusoris
lusoris merged commit fabe48a into master May 28, 2026
46 of 63 checks passed
@lusoris
lusoris deleted the feat/cpp23-wave3-part-b-20260528 branch May 28, 2026 22:35
@lusoris lusoris added this to the 1.0.0 — First release milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants