libvmaf: add median and percentile C API pooling - #1589
Open
lusoris wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The C pooling API cannot currently select the median or lower percentiles requested in #818. This adapts VMAFx #1340 to current upstream C11: append
MEDIAN,PERC5,PERC10, andPERC20, gather the scores selected by the inclusive interval andn_subsample, then sort and linearly interpolate atpercentile * (n - 1) / 100. Existing pooling values, accumulation order, and allocation behavior remain unchanged. The README and public header document the semantics and memory cost.The implementation explicitly rejects non-finite samples because current upstream permits importing them (unlike the fork's collector). It propagates missing-score errors, rejects an empty selected interval, checks allocation size, and uses 64-bit interval arithmetic to avoid wrapping at
UINT_MAX. The feature-pooling output is unchanged on failure.This adds the C API functionality. FFmpeg's filter option mapping needs a separate FFmpeg-side change, so this does not claim that its
pooloption immediately accepts the new values. No CLI option, model, bootstrap-confidence-interval formula, or golden assertion changes.Validation on upstream
f85a853692a8c730d0270cd733c8bb30b5b93b7c, x86-64 Linux, GCC 15.2 / C11, Meson 1.10.1:Cases cover interpolation on unsorted scores without mutating their stored order, singleton/tied/negative values, subsampling and partial intervals, missing/non-finite scores, invalid arguments,
UINT_MAXendpoints, and delegation from cached model scores. The new interpolation test fails when onlylibvmaf.cis replaced by the original upstream file. Sanitizer coverage claimed here is the targeted test; the full upstream baseline has unrelated LeakSanitizer failures intest_predictandtest_pic_preallocation, recorded while validating #1588.