Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/changed/0846-cpp23-read-json-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `core/src/read_json_model`: converted to C++23 (`read_json_model.cpp`, ADR-0846 Wave 8). `goto`-based teardown replaced with a scoped RAII guard; `unique_ptr<char[]>` for collection-name buffer; `std::string` for feature-option key copy; `[[nodiscard]]` on capacity helpers. No behaviour change; public C API and ABI unchanged.
10 changes: 9 additions & 1 deletion core/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ libvmaf/
is `push_c()` at entry → body → `pop()` before the `ferror`
check; dropping the `pop()` leaks a `locale_t` on POSIX and
leaves the calling thread locked to `"C"` on Windows.
- **JSON model loader is now `read_json_model.cpp` (ADR-0846 / Wave 8).**
The active translation unit is [`src/read_json_model.cpp`](src/read_json_model.cpp),
compiled as the isolated `read_json_model_cpp23_lib` static lib
(`cpp_std=c++23`). The original [`src/read_json_model.c`](src/read_json_model.c)
is still on disk but is **not compiled** — the `libvmaf_sources` list replaced
it with a comment. Do not re-add `read_json_model.c` to `libvmaf_sources`;
doing so produces duplicate-symbol link errors for all four `extern "C"` entry
points. The `.c` file will be deleted in a follow-on cleanup PR.
- **JSON model loader has no fixed feature/knot schema ceiling.**
[`src/read_json_model.c`](src/read_json_model.c) grows
[`src/read_json_model.cpp`](src/read_json_model.cpp) grows
`VmafModel.feature` and `score_transform.knots.list` from the JSON
payload. Do not restore the old `MAX_FEATURE_COUNT` / `MAX_KNOT_COUNT`
rejection pattern during an upstream sync; external model JSONs with
Expand Down
19 changes: 18 additions & 1 deletion core/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,21 @@ metadata_handler_cpp20_lib = static_library(
install : false,
)

# ADR-0846: read_json_model.cpp is a C++23 Wave 8 TU. Compiled as an isolated
# static lib so its cpp_std override (c++23) does not propagate to any other TU
# in libvmaf. Mirrors the ADR-0708 pattern for metadata_handler_cpp20_lib.
# The four public entry points retain their original C signatures and are
# declared extern "C" inside the .cpp, so all existing C callers link without
# modification.
read_json_model_cpp23_lib = static_library(
'read_json_model_cpp23',
src_dir + 'read_json_model.cpp',
include_directories : [vmaf_base_include, libvmaf_include],
override_options : ['cpp_std=c++23'],
pic : true,
install : false,
)

libvmaf_sources = [
src_dir + 'libvmaf.c',
src_dir + 'predict.c',
Expand All @@ -1533,7 +1548,7 @@ libvmaf_sources = [
src_dir + 'dict.c',
src_dir + 'opt.c',
src_dir + 'ref.c',
src_dir + 'read_json_model.c',
# read_json_model.cpp is compiled as read_json_model_cpp23_lib (ADR-0846)
src_dir + 'pdjson.c',
src_dir + 'log.c',
src_dir + 'framesync.c',
Expand Down Expand Up @@ -1622,6 +1637,8 @@ libvmaf = library(
libsvm_static_lib.extract_all_objects(recursive: true),
# ADR-0708: C++20 pilot TU compiled as isolated static lib.
metadata_handler_cpp20_lib.extract_all_objects(recursive: true),
# ADR-0846: C++23 Wave 8 TU — read_json_model.cpp.
read_json_model_cpp23_lib.extract_all_objects(recursive: true),
],
version : vmaf_soname_version,
soversion : vmaf_soversion,
Expand Down
Loading
Loading