Repository navigation
Fix QTGMC InputType 2/3 at >8 bits: run havsfunc's MVTools Mask on an 8-bit stand-in (task #89) - #259
Merged
StuartCameronCode merged 1 commit intoNov 24, 2026
Conversation
…y depth (task #89) havsfunc's QTGMC runs mv.Mask(kind=1, ml=ProgSADMask) on InputType 2/3 at Placebo..Medium, and MVTools' Mask refuses every clip above 8 bits, so all those 10/12/16-bit jobs (and every High Precision one) failed. plugin_formats.havsfunc_mask_any_depth rebinds havsfunc's core for the QTGMC call to a proxy whose mv.Mask is mvtools_mask_any_depth: an 8-bit BlankClip stand-in of the clip's size, ml x 2^(bits-8) for kind 1, the mask put on the clip's scale. Exact because kinds 0-4 never read the clip's pixels, and MVTools takes the SAD shift from the clip but the scene-change thresholds from the vectors. The template rebinds _deinterlace_qtgmc in a {{#QTGMC_MASK_ANY_DEPTH}} block only for prog_sad_mask_blocks() jobs; every other script is unchanged. 10-bit vs 8-bit output 0.16 levels (Slow/Medium), 0.07 (Placebo), below the Mask-off control; 8-bit output unchanged. Tests: test_269 (test_263 adjusted), the contracts test's task #89 group, probe calls havsfunc.QTGMC[InputType=2] (HANDLED) and pass.QTGMC[InputType=2] with the table updated, two format-sweep variants, heavy 8-vs-10 parity cases. Also fixes the Input Type description in the Deinterlace panel. Report: docs/reports/task-89-qtgmc-mask-high-bit-depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StuartCameronCode
force-pushed
the
stuart/89-qtgmc-inputtype-2-3-fails-on-every-8-bit
branch
from
November 22, 2026 09:12
4c0b98a to
a6f88ba
Compare
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.
Problem
havsfunc's QTGMC runs
core.mv.Mask(srchClip, bVec1, kind=1, ml=ProgSADMask)whenInputTypeis 2 or 3 andProgSADMask > 0. ProgSADMask is 10 at Placebo, Very Slow, Slower, Slow and Medium. MVTools' Mask refuses any clip above 8 bits ("Mask: input clip must be GRAY8, YUV420P8, …"). So every 10/12/16-bit job with Input Type 2/3 at those presets failed, on every platform. Every High Precision job (QTGMC at 16 bits) with those settings failed too, even from an 8-bit source. The format sweep missed it because InputType isn't one of its axes.Fix (template-side, no deps release)
plugin_formats.mvtools_mask_any_depth: runs Mask on an 8-bit stand-in clip (a BlankClip of the clip's size and subsampling). For kind 1 it scalesmlby 2^(bits−8), then scales the mask back to the clip's depth (x peak * 255 /). This works because:plugin_formats.havsfunc_mask_any_depth(haf, fn): rebinds havsfunc's module-levelcoreto a proxy that replaces onlymv.Mask, for the duration of the QTGMC call. The original is restored in afinally, and patch 7's akarin proxy keeps working.{{#QTGMC_MASK_ANY_DEPTH}}block wraps_deinterlace_qtgmc. It is emitted only whenQTGMCParameters::prog_sad_mask_blocks()is Some, the same condition as test: verify frame counts and geometry against the pipeline, not the model #79's padding. Every other job's script is byte-for-byte unchanged.havsfunc.QTGMC[InputType=2](records the refusal, listed in HANDLED) andpass.QTGMC[InputType=2](the pass as the template runs it). The table only gains those two calls; no existing cell changed.docs/reports/task-89-qtgmc-mask-high-bit-depth), an ENGINEERING_NOTES entry, a reports index row and a CLAUDE.md rule.Results (macOS arm64, deps 1.18.0-rc3)
Tests
test_269(block emitted exactly for Placebo..Medium × InputType 2/3, nowhere else);test_263adjusted.plugin_format_contracts_test: the stand-in mask equals the 8-bit mask at 10 and 16 bits, sample for sample. QTGMC through the helper runs at 10 and 16 bits while the bare call still refuses. The 8-bit output equals the plain call's. havsfunc'scoreis restored, including after an error.integration_qtgmc_parameters_test: checks the wrapper is in the generated script for those jobs and absent for the others.deinterlace_qtgmc_input_type_2(0.68) and_3_high_precision(0.26), against a tolerance of 3.0. Both fail without the fix.cargo testand the Flutter push gate pass. Measured on macOS arm64 only; x86 is covered by this PR's CI (contracts test and the sweep smoke rows).🤖 Generated with Claude Code