Skip to content
Merged
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
60 changes: 0 additions & 60 deletions .config/lint-exceptions.d/clang-tidy-coverage.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,66 +63,6 @@ path = "cmd/vmafx-node/bpf/rclone_bypass.bpf.c"
reason = "eBPF program: includes vmlinux.h, generated from the running kernel's BTF and absent on every runner, so clang-tidy stops at the include; compiled by clang -target bpf through bpf2go."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/STMAD_2011_MatlabCode/ical_stat.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/STMAD_2011_MatlabCode/ical_std.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/convolve.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/corrDn.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/edges-orig.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/edges.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/histo.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/innerProd.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/pointOp.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/range2.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/upConv.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "compat/python-vmaf/matlab/strred/matlabPyrTools/MEX/wrap.c"
reason = "MATLAB MEX source: includes mex.h / matrix.h from the proprietary MATLAB SDK, present on no runner or image, so clang-tidy stops in the preprocessor; meson never builds it (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22 in docs/state.md)."
expires = 2027-03-31

[[exception]]
path = "core/src/feature/metal/float_adm.metal"
reason = "Metal Shading Language kernel. clang-tidy reads the languages the clang front end accepts; clang has no Metal language mode (`clang -x metal` answers \"language not recognized\" on clang 23.1.1, and the -x language list in https://clang.llvm.org/docs/ClangCommandLineReference.html names none; clang-tidy, https://clang.llvm.org/extra/clang-tidy/, runs on that front end). The kernels are compiled by Apple's `metal` compiler (-std=metal3.1) in the macOS Metal build leg and their arithmetic headers are held against the CPU by the device-free host-replay tests. Revisit when upstream clang gains a Metal mode."
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ jobs:
# exist on disk before clang-tidy parses the translation units.
meson compile -C build
python3 scripts/ci/write-compile-commands.py --build-dir build
python3 scripts/ci/gen-mex-compile-commands.py build
- name: Run clang-tidy on changed files
if: steps.cpp-changes.outputs.any == 'true'
# Hardening per Semgrep `yaml.github-actions.security.run-shell-injection`
Expand Down Expand Up @@ -317,18 +318,12 @@ jobs:
# replay. `(^|/)testdata/` is already the tree-wide fixture
# exclusion in `.pre-commit-config.yaml`; this is the same rule
# applied to the changed-files tidy lane.
# - compat/python-vmaf/matlab/ — upstream Netflix training-harness
# MATLAB MEX sources. They include `mex.h` / `matrix.h` from the
# proprietary MATLAB SDK, which does not exist on the runner, so
# every one of them dies in the preprocessor
# (`'mex.h' file not found`) and the diagnostics that follow are
# artefacts of reading a `.c` file as C++ after the include
# failed, not findings about the code. Same posture as the
# CUDA/SYCL/HIP/eBPF families above, and the same exclusion these
# files already carry in every hygiene hook in
# `.pre-commit-config.yaml` (see the `check-copyright` entry).
# The whole-tree ratchet does not measure them either — they have
# no entry in `build/compile_commands.json`.
# - compat/python-vmaf/matlab/ is NOT excluded: the MEX sources include the
# MATLAB SDK's `mex.h` / `matrix.h`, which no runner has, so the step
# `Generate compile_commands.json` appends entries that point at the
# self-authored stubs in `scripts/ci/lint-stubs/matlab/`
# (`scripts/ci/gen-mex-compile-commands.py`, the `cpu` lane does the
# same; T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22).
#
# One filter shared by every trigger path below, so adding a family
# is a single edit.
Expand Down Expand Up @@ -359,8 +354,7 @@ jobs:
-e '^core/src/compat/win32/' \
-e '^core/tools/test/test_vmaf_windows_utf8_argv\.cpp$' \
-e '^cmd/vmafx-node/bpf/' \
-e '^\.config/hiss/testdata/' \
-e '^compat/python-vmaf/matlab/' |
-e '^\.config/hiss/testdata/' |
python3 scripts/ci/pelorus_mirror.py filter
}
if [ "$GH_EVENT_NAME" = "pull_request" ]; then
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@
(the scaffold-audit P1 record) where they cited ADR-0613, the vmaf-tune dynamic optimizer.


- ADR-0643, ADR-0665, ADR-0666 and ADR-0673 lose the unfilled allocator template block that preceded their real text (their first heading read `<fill in title>`); a status update records it. Four ADR numbers that other ADRs cite and that had no file (ADR-0228, 0636, 0867, 0979) get a short record each, written from the commits and ADRs that name them.


- 34 ADR status headers read in the one form the drift gate parses (`- **Status**: Accepted`): 12 bullet variants and 22 table or heading headers (no value changed; empty `Supersedes` rows dropped). ADR-0003 and ADR-0019 link their successor ADR-1277. ADR-1129, ADR-1225 and ADR-0954 gain a dated status update: the pins they quote have moved (`build-config.env` is the authority) and the HIP dispatch strategy file was removed by #2030. `docs/state.md` cites ADR-0639 (scaffold-audit P1) where it said ADR-0613.


Expand Down Expand Up @@ -940,6 +943,13 @@ make `core/AGENTS.md` a generated index over `AGENTS.d/` topic pages ([ADR-1454]
sweep).


- **The CUDA MS-SSIM twin no longer copies frames through the host.**
`float_ms_ssim_cuda` converted every plane of every frame on the host
(a device-to-host copy, a wait, `picture_copy()` and an upload); the
conversion now runs on the device with the same arithmetic, so its scores
are unchanged and the frame stays on the GPU.


- **The parity gate covers `speed_chroma` on CUDA, at `5e-6`.**
`speed_chroma_cuda` reproduces the CPU extractor's arithmetic and rounds
`log2` correctly; the CPU extractor calls the C library's `log2f`, and
Expand Down Expand Up @@ -2826,6 +2836,13 @@ make `core/AGENTS.md` a generated index over `AGENTS.d/` topic pages ([ADR-1454]
scoped write under a clang-tidy other than the baseline's stops with exit 5.


- The `cpu` clang-tidy lane and the changed-files job measure the ten MATLAB MEX
sources of `compat/python-vmaf/matlab/` against self-authored stub `mex.h` and
`matrix.h` (`scripts/ci/lint-stubs/matlab/`); their lint exceptions are removed.
The first measurement fixed the mechanical findings and a defect in `ical_std.c`
(`mxDestroyArray()` was called on a matrix's data pointer).


- **The Metal host code is clean under clang-tidy.** The macOS `metal` lane measures 0 findings on its 27 translation units (it started at 1640 once `write-compile-commands.py` stopped dropping the `.mm` files). `core/src/metal/objc_handle.h` now holds the one `uintptr_t` slot to Metal object bridge and `vmaf_metal_library_load()` the one metallib loader, replacing 17 copies; file-scope helpers sit in anonymous namespaces; no score, public API or FFmpeg patch changes. See [tidy lanes](docs/development/tidy-lanes.md).


Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,11 @@ TIDY_RATCHET_EXTRA_arm64 := --extra-arg=--target=$(AARCH64_TARGET) \
# translation units out of compile_commands.json: write-compile-commands.py
# exports only the native c/cpp_COMPILER rules, so without this second pass the
# cuda and hip lanes measure the host files only and the sycl lane measures zero
# SYCL feature TUs, recording an empty backend in its baseline.
TIDY_RATCHET_COMPDB_cpu :=
# SYCL feature TUs, recording an empty backend in its baseline. The `cpu` lane adds
# the MATLAB MEX sources, which meson never builds and which need the stub headers
# of scripts/ci/lint-stubs/matlab/ (T-TIDY-MATLAB-MEX-UNMEASURED-2026-09-22).
TIDY_RATCHET_COMPDB_cpu := $(PYTHON_INTERPRETER) scripts/ci/gen-mex-compile-commands.py \
"$(TIDY_RATCHET_BUILD_DIR)"
TIDY_RATCHET_COMPDB_clang :=
TIDY_RATCHET_COMPDB_cuda := $(PYTHON_INTERPRETER) scripts/ci/gen-gpu-compile-commands.py \
"$(TIDY_RATCHET_BUILD_DIR)"
Expand Down
1 change: 1 addition & 0 deletions changelog.d/changed/adr-audit-backfill-2026-10-06.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- ADR-0643, ADR-0665, ADR-0666 and ADR-0673 lose the unfilled allocator template block that preceded their real text (their first heading read `<fill in title>`); a status update records it. Four ADR numbers that other ADRs cite and that had no file (ADR-0228, 0636, 0867, 0979) get a short record each, written from the commits and ADRs that name them.
5 changes: 5 additions & 0 deletions changelog.d/changed/cuda-ms-ssim-device-level0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- **The CUDA MS-SSIM twin no longer copies frames through the host.**
`float_ms_ssim_cuda` converted every plane of every frame on the host
(a device-to-host copy, a wait, `picture_copy()` and an upload); the
conversion now runs on the device with the same arithmetic, so its scores
are unchanged and the frame stays on the GPU.
5 changes: 5 additions & 0 deletions changelog.d/changed/tidy-matlab-mex-lane.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- The `cpu` clang-tidy lane and the changed-files job measure the ten MATLAB MEX
sources of `compat/python-vmaf/matlab/` against self-authored stub `mex.h` and
`matrix.h` (`scripts/ci/lint-stubs/matlab/`); their lint exceptions are removed.
The first measurement fixed the mechanical findings and a defect in `ical_std.c`
(`mxDestroyArray()` was called on a matrix's data pointer).
34 changes: 24 additions & 10 deletions compat/python-vmaf/matlab/STMAD_2011_MatlabCode/ical_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
static double block_mean(const double *xVal, int colLen, int i, int j)
{
double mean = 0;
int iB, jB;
int iB;
int jB;

for (iB = i; iB < i + 16; iB++) {
for (jB = j; jB < j + 16; jB++) {
Expand All @@ -26,8 +27,14 @@ static void block_moments(const double *xVal, int colLen, int i, int j, double *
double *outSkw, double *outKrt)
{
double mean = block_mean(xVal, colLen, i, j);
double stdev, skw, krt, stmp, tmp, tmp1;
int iB, jB;
double stdev;
double skw;
double krt;
double stmp;
double tmp;
double tmp1;
int iB;
int jB;

stdev = 0;
skw = 0;
Expand Down Expand Up @@ -61,7 +68,7 @@ static void block_moments(const double *xVal, int colLen, int i, int j, double *
*outKrt = krt;
}

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
void mexFunction(int /* nlhs */, mxArray *plhs[], int /* nrhs */, const mxArray *prhs[])
{
/* We have input of one double type matrix*/
/* this function calculates the local mean, std, skewness, and kurtosis*/
Expand All @@ -71,10 +78,19 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])

/*Declarations*/
mxArray *xData;
double *xVal, *outStd, *outSkw, *outKrt;
double stdev, skw, krt;
int i, j, iB, jB;
int rowLen, colLen;
double *xVal;
double *outStd;
double *outSkw;
double *outKrt;
double stdev;
double skw;
double krt;
int i;
int j;
int iB;
int jB;
int rowLen;
int colLen;

/*Copy input pointer x*/
xData = prhs[0];
Expand Down Expand Up @@ -111,6 +127,4 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
}
}

return;
}
48 changes: 33 additions & 15 deletions compat/python-vmaf/matlab/STMAD_2011_MatlabCode/ical_std.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
static void block_mean_and_std(const double *xVal, const double *yVal, double *outStd,
double *outMean, int rowLen, int colLen)
{
double mean, mean2, stdev, tmp1;
int i, j, iB, jB;
double mean;
double mean2;
double stdev;
double tmp1;
int i;
int j;
int iB;
int jB;

/*Copy matrix while multiplying each point by 2*/
for (i = 0; i < rowLen - 15; i += 4) {
Expand Down Expand Up @@ -54,8 +60,13 @@ static void block_mean_and_std(const double *xVal, const double *yVal, double *o
static void block_modified_std(const double *yVal, double *outStdMod, double *TMP, int rowLen,
int colLen)
{
double mean, stdev, tmp1;
int i, j, iB, jB;
double mean;
double stdev;
double tmp1;
int i;
int j;
int iB;
int jB;

for (i = 0; i < rowLen - 15; i += 4) {
for (j = 0; j < colLen - 15; j += 4) {
Expand Down Expand Up @@ -94,7 +105,10 @@ static void block_modified_std(const double *yVal, double *outStdMod, double *TM
static void block_min_filter(double *outStdMod, const double *TMP, int rowLen, int colLen)
{
double mean;
int i, j, iB, jB;
int i;
int j;
int iB;
int jB;

for (i = 0; i < rowLen - 15; i += 4) {
for (j = 0; j < colLen - 15; j += 4) {
Expand All @@ -115,7 +129,7 @@ static void block_min_filter(double *outStdMod, const double *TMP, int rowLen, i
}
}

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
void mexFunction(int /* nlhs */, mxArray *plhs[], int /* nrhs */, const mxArray *prhs[])
{
/* We have input of one double type matrix*/
/* this function calculates the local mean, std, skewness, and kurtosis*/
Expand All @@ -124,19 +138,24 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
/*---Inside mexFunction---*/

/*Declarations*/
mxArray *xData, *yData;
double *xVal, *yVal, *outStd, *outStdMod, *outMean;
mxArray *xData;
mxArray *yData;
double *xVal;
double *yVal;
double *outStd;
double *outStdMod;
double *outMean;
mxArray *tmp_array;
double *TMP;
int rowLen, colLen;
int rowLen;
int colLen;

/*Copy input pointer x*/
xData = prhs[0];
yData = prhs[1];

/*Get matrix x*/
xVal = mxGetPr(xData);
rowLen = mxGetN(xData);
colLen = mxGetM(xData);

/*Get matrix y*/
yVal = mxGetPr(yData);
Expand All @@ -156,7 +175,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
plhs[2] = mxCreateDoubleMatrix(colLen, rowLen, mxREAL); /*mxReal is our data-type*/
outMean = mxGetPr(plhs[2]);

TMP = mxGetPr(mxCreateDoubleMatrix(colLen, rowLen, mxREAL));
tmp_array = mxCreateDoubleMatrix(colLen, rowLen, mxREAL);
TMP = mxGetPr(tmp_array);

block_mean_and_std(xVal, yVal, outStd, outMean, rowLen, colLen);

Expand All @@ -167,7 +187,5 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])

block_min_filter(outStdMod, TMP, rowLen, colLen);

mxDestroyArray(TMP);

return;
mxDestroyArray(tmp_array);
}
Loading
Loading