Skip to content

Commit b3debdc

Browse files
Fix EEDI3CL fallback patch indentation breaking havsfunc import
The 8-space search pattern substring-matched inside the 12-space santiag_stronger block, producing an IndentationError at line 141. Now patches both locations separately (deeper indent first) in both macOS and Windows download scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 864b548 commit b3debdc

4 files changed

Lines changed: 62 additions & 20 deletions

File tree

Scripts/download-deps-macos.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,17 +717,37 @@ if 'vs.YCOCG' in content:
717717
# Patch 4: EEDI3CL fallback — modern eedi3m plugin removed EEDI3CL (OpenCL).
718718
# When opencl=True, havsfunc tries core.eedi3m.EEDI3CL which doesn't exist.
719719
# Fall back to CPU EEDI3 so opencl mode works (NNEDI3CL still uses GPU).
720-
old_eedi3cl = " myEEDI3 = core.eedi3m.EEDI3CL\n"
721-
if old_eedi3cl in content:
720+
# Two locations: santiag_stronger (12-space indent) and QTGMC_Interpolate (8-space indent).
721+
# Must patch deeper indent first to avoid substring matches with .replace().
722+
patched_eedi3cl = False
723+
724+
# 4a: santiag_stronger (12-space indent, uses mdis=mdis)
725+
old_santiag = " myEEDI3 = core.eedi3m.EEDI3CL\n"
726+
if old_santiag in content:
727+
content = content.replace(
728+
old_santiag,
729+
" has_eedi3cl = hasattr(core, 'eedi3m') and hasattr(core.eedi3m, 'EEDI3CL')\n"
730+
" myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)\n"
731+
)
732+
old_santiag_args = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck, device=device)\n"
733+
new_santiag_args = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck)\n"
734+
content = content.replace(old_santiag_args, new_santiag_args)
735+
patched_eedi3cl = True
736+
737+
# 4b: QTGMC_Interpolate (8-space indent, uses mdis=EdiMaxD)
738+
old_qtgmc = " myEEDI3 = core.eedi3m.EEDI3CL\n"
739+
if old_qtgmc in content:
722740
content = content.replace(
723-
old_eedi3cl,
741+
old_qtgmc,
724742
" has_eedi3cl = hasattr(core, 'eedi3m') and hasattr(core.eedi3m, 'EEDI3CL')\n"
725743
" myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)\n"
726744
)
727-
# Fix eedi3_args to not pass device= when falling back to CPU EEDI3
728-
old_eedi3_args = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device)\n"
729-
new_eedi3_args = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck)\n"
730-
content = content.replace(old_eedi3_args, new_eedi3_args)
745+
old_qtgmc_args = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device)\n"
746+
new_qtgmc_args = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck)\n"
747+
content = content.replace(old_qtgmc_args, new_qtgmc_args)
748+
patched_eedi3cl = True
749+
750+
if patched_eedi3cl:
731751
patches.append('EEDI3CL fallback')
732752
733753
if patches:

Scripts/download-deps-windows.ps1

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,15 +540,37 @@ def _fix_mv_args(args):
540540
# Patch 4: EEDI3CL fallback — modern eedi3m plugin removed EEDI3CL (OpenCL).
541541
# When opencl=True, havsfunc tries core.eedi3m.EEDI3CL which doesn't exist.
542542
# Fall back to CPU EEDI3 so opencl mode works (NNEDI3CL still uses GPU).
543-
$OldEedi3cl = " myEEDI3 = core.eedi3m.EEDI3CL`n"
544-
if ($Content.Contains($OldEedi3cl)) {
545-
Write-Host " Applying EEDI3CL fallback patch..." -ForegroundColor Gray
546-
$NewEedi3cl = " has_eedi3cl = hasattr(core, 'eedi3m') and hasattr(core.eedi3m, 'EEDI3CL')`n myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)`n"
547-
$Content = $Content.Replace($OldEedi3cl, $NewEedi3cl)
548-
549-
$OldArgs = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device)`n"
550-
$NewArgs = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck)`n"
551-
$Content = $Content.Replace($OldArgs, $NewArgs)
543+
# Two locations: santiag_stronger (12-space indent) and QTGMC_Interpolate (8-space indent).
544+
# Must patch deeper indent first to avoid substring matches with .Replace().
545+
$PatchedEedi3cl = $false
546+
547+
# 4a: santiag_stronger (12-space indent, uses mdis=mdis)
548+
$OldSantiag = " myEEDI3 = core.eedi3m.EEDI3CL`n"
549+
if ($Content.Contains($OldSantiag)) {
550+
Write-Host " Applying EEDI3CL fallback patch (santiag_stronger)..." -ForegroundColor Gray
551+
$NewSantiag = " has_eedi3cl = hasattr(core, 'eedi3m') and hasattr(core.eedi3m, 'EEDI3CL')`n myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)`n"
552+
$Content = $Content.Replace($OldSantiag, $NewSantiag)
553+
554+
$OldSantiagArgs = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck, device=device)`n"
555+
$NewSantiagArgs = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck)`n"
556+
$Content = $Content.Replace($OldSantiagArgs, $NewSantiagArgs)
557+
$PatchedEedi3cl = $true
558+
}
559+
560+
# 4b: QTGMC_Interpolate (8-space indent, uses mdis=EdiMaxD)
561+
$OldQtgmc = " myEEDI3 = core.eedi3m.EEDI3CL`n"
562+
if ($Content.Contains($OldQtgmc)) {
563+
Write-Host " Applying EEDI3CL fallback patch (QTGMC_Interpolate)..." -ForegroundColor Gray
564+
$NewQtgmc = " has_eedi3cl = hasattr(core, 'eedi3m') and hasattr(core.eedi3m, 'EEDI3CL')`n myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)`n"
565+
$Content = $Content.Replace($OldQtgmc, $NewQtgmc)
566+
567+
$OldQtgmcArgs = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device)`n"
568+
$NewQtgmcArgs = " eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=EdiMaxD, vcheck=vcheck)`n"
569+
$Content = $Content.Replace($OldQtgmcArgs, $NewQtgmcArgs)
570+
$PatchedEedi3cl = $true
571+
}
572+
573+
if ($PatchedEedi3cl) {
552574
$PatchesApplied += "EEDI3CL fallback"
553575
}
554576

app/assets/deps-version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"platforms": {
66
"windows-x64": {
77
"filename": "VapourBox-deps-1.2.0-windows-x64.zip",
8-
"sha256": "92fa7946b423c077ecae0066b74c5a61ee45ac2406caea84c576dc2d10b63cbd",
9-
"size": 172690070
8+
"sha256": "44a1b3d3ad4a36a0e78985d01abfc47706ddc4fd5b1a0d7cd2da2245eeb1356e",
9+
"size": 172690077
1010
},
1111
"macos-arm64": {
1212
"filename": "VapourBox-deps-1.2.0-macos-arm64.zip",

deps/windows-x64/vapoursynth/Lib/site-packages/havsfunc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def santiag_stronger(c, strength, type):
137137
if opencl:
138138
myNNEDI3 = core.nnedi3cl.NNEDI3CL
139139
has_eedi3cl = hasattr(core, 'eedi3m') and hasattr(core.eedi3m, 'EEDI3CL')
140-
myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)
140+
myEEDI3 = core.eedi3m.EEDI3CL if has_eedi3cl else (core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3)
141141
nnedi3_args = dict(nsize=nsize, nns=nns, qual=qual, pscrn=pscrn, device=device)
142-
eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck, device=device)
142+
eedi3_args = dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck, device=device) if has_eedi3cl else dict(alpha=alpha, beta=beta, gamma=gamma, nrad=nrad, mdis=mdis, vcheck=vcheck)
143143
else:
144144
myNNEDI3 = core.znedi3.nnedi3 if hasattr(core, 'znedi3') else core.nnedi3.nnedi3
145145
myEEDI3 = core.eedi3m.EEDI3 if hasattr(core, 'eedi3m') else core.eedi3.eedi3

0 commit comments

Comments
 (0)