VMAF on the Intel GPU with the kk-vmafx base image, checked against the CPU #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/gpu-vmaf"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Requested by Kees
What
RX_BASE_IMAGEbuild arg (default debian:trixie-slim, unchanged). Withkk-vmafx:localthe image is Ubuntu 26.04 + Intel GPU runtime + VMAFx ffmpeg (/opt/vmafx/bin/ffmpeg); everything except VMAF keeps the BtbN ffmpeg.libvmaf_syclon the A580, every frame. First GPU score per start is compared with the CPU scoring every frame on the same pair; only a match within 0.01 switches to the GPU. Mismatch or GPU error: CPU.RX_VMAF_GPU=offdisables it.Tests
🤖 Generated with Claude Code
Title
VMAF on the Intel GPU with the kk-vmafx base image, checked against the CPU
PR Type
Enhancement
Description
Adds Intel GPU VMAF scoring for 720p+ videos
Switches to GPU only after matching CPU score
Includes unit tests and UI status updates
Diagram Walkthrough
File Walkthrough
3 files
Add vmaf_on status indicator to app stateSupport GPU VMAF command with libvmaf_syclImplement GPU VMAF logic with CPU validation3 files
Parse RX_VMAF_GPU environment variableSupport custom base image for GPU runtimePass RX_BASE_IMAGE and RX_VMAF_GPU args1 files
Add unit tests for GPU VMAF functionality4 files
Display VMAF scoring location in UIDocument new RX_VMAF_GPU settingDocument Intel GPU VMAF feature releaseUpdate env vars documentation for GPU3 finding(s) as line comments; the review comment lists all of them.
@ -209,0 +224,4 @@threads, height = cfg["vmaf_threads"], info.get("height")if (cfg.get("vmaf_gpu", "auto") != "off" and _gpu_vmaf["ok"] is not False and (height or 0) >= GPU_MIN_HEIGHTand os.path.exists(rx_media.VMAF_GPU_FFMPEG)):rc, _, err = run(rx_media.vmaf_cmd(enc, ref, threads, log, height, gpu=True))Unbounded Recursion Risk ·
KK-f1a1d61e69· lowThe _vmaf_score function calls itself recursively via the run() callable when executing GPU VMAF checks (line 227) and CPU fallbacks (line 241). If the run() callable is misconfigured to invoke _vmaf_score instead of an external process, this creates infinite recursion leading to a stack overflow. While unlikely in normal operation, the lack of explicit process separation in the code structure makes this a latent risk.
Reply
not an issue,false positiveorwon't fixto dismiss it; it is then not reported again.@ -209,0 +236,4 @@+ ("" if rc == 0 else f" ({describe_rc(rc)}: {useful_tail(err, 200)})"), file=sys.stderr, flush=True)if score is not None and _gpu_vmaf["ok"]:return scoreif rc != 0 and not first: # a later GPU failure: this score comes from the CPU, the next one tries the GPU againMissing Error Handling for parse_vmaf ·
KK-636033240b· mediumIn _vmaf_score, if the GPU command fails (rc != 0), the code proceeds to call rx_media.parse_vmaf on the error output (line 241) without first checking if a valid score was obtained from the failed attempt. This could result in parsing garbage data or raising unexpected exceptions if parse_vmaf does not handle non-score output gracefully.
Reply
not an issue,false positiveorwon't fixto dismiss it; it is then not reported again.@ -0,0 +21,4 @@def __call__(self, cmd, timeout=None, on_line=None):self.cmds.append(cmd)score = self.gpu if "libvmaf_sycl" in cmd[cmd.index("-lavfi") + 1] else self.cpuTest Mock Inconsistency ·
KK-cf487d87c7· lowThe FakeRun mock in test_gpu_vmaf.py returns a score based on whether "libvmaf_sycl" is in the command string (line 24), but it does not simulate the actual behavior of the real ffmpeg binary which might fail with specific exit codes or produce different error messages. This could lead to false positives in tests where the mock succeeds but the real implementation would fail under similar conditions.
Reply
not an issue,false positiveorwon't fixto dismiss it; it is then not reported again.PR Reviewer Guide 🔍
📋 Focus areas: 🔴 3 open · ✅ 0 handled. Every push re-checks them; a handled area moves to Resolved findings at the bottom.
Unbounded Recursion Risk
The _vmaf_score function calls itself recursively via the run() callable when executing GPU VMAF checks (line 227) and CPU fallbacks (line 241). If the run() callable is misconfigured to invoke _vmaf_score instead of an external process, this creates infinite recursion leading to a stack overflow. While unlikely in normal operation, the lack of explicit process separation in the code structure makes this a latent risk.
Missing Error Handling for parse_vmaf
In _vmaf_score, if the GPU command fails (rc != 0), the code proceeds to call rx_media.parse_vmaf on the error output (line 241) without first checking if a valid score was obtained from the failed attempt. This could result in parsing garbage data or raising unexpected exceptions if parse_vmaf does not handle non-score output gracefully.
Test Mock Inconsistency
The FakeRun mock in test_gpu_vmaf.py returns a score based on whether "libvmaf_sycl" is in the command string (line 24), but it does not simulate the actual behavior of the real ffmpeg binary which might fail with specific exit codes or produce different error messages. This could lead to false positives in tests where the mock succeeds but the real implementation would fail under similar conditions.
🗂️ Finding ids (reply with the id and
not an issue,false positiveorwon't fixto dismiss one; it is then not reported again):KK-f1a1d61e69app/rx_search.py:227KK-636033240bapp/rx_search.py:239KK-cf487d87c7tests/test_gpu_vmaf.py:24