diff --git a/pyproject.toml b/pyproject.toml index be27abb..c5e3fc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,8 +47,9 @@ dev = [ "vapoursynth-manipmv>=1.3.0", "vapoursynth-mvtools>=26", "vapoursynth-bm3dcuda>=2.16", - "vapoursynth-knlmeanscl>=1.2", "vapoursynth-vszip>=14.0.0", + "vapoursynth-vszipcl>=1.2.0", + "vapoursynth-vszipcu>=1.2.0", "vs-placebo>=2.0.2", "vsview>=0.5.0", "vspreview>=0.20.0" diff --git a/vodesfunc/denoise.py b/vodesfunc/denoise.py index 71f0918..6032930 100644 --- a/vodesfunc/denoise.py +++ b/vodesfunc/denoise.py @@ -172,23 +172,24 @@ def schizo_denoise( clip = depth(src, 16) if get_depth(src) < 16 else src - has_nlm_cuda = hasattr(core, "nlm_cuda") - has_nlm_hip = hasattr(core, "nlm_hip") - - if cuda[0] and (has_nlm_cuda or has_nlm_hip): - if has_nlm_cuda: - nlmfunc = core.nlm_cuda.NLMeans - else: - nlmfunc = core.nlm_hip.NLMeans + if cuda[0] and hasattr(core, "vszipcu"): + nlmfunc = core.vszipcu.NLMeans else: - nlmfunc = core.knlm.KNLMeansCL + nlmfunc = core.vszipcl.NLMeans + + nlmargs = dict( + a=nlm_a, + d=radius[1], + channels="UV", + num_streams=2 + ) if len(sigma) == 3: - clip_u = nlmfunc(clip, a=nlm_a, d=radius[1], h=sigma[1], channels="UV") - clip_v = nlmfunc(clip, a=nlm_a, d=radius[1], h=sigma[2], channels="UV") + clip_u = nlmfunc(clip, h=sigma[1], **nlmargs) # type: ignore + clip_v = nlmfunc(clip, h=sigma[2], **nlmargs) # type: ignore nlm = join(get_y(clip), get_u(clip_u), get_v(clip_v)) # type: ignore else: - clip_uv = nlmfunc(clip, a=nlm_a, d=radius[1], h=sigma[1], channels="UV") + clip_uv = nlmfunc(clip, h=sigma[1], **nlmargs) # type: ignore nlm = join(clip, clip_uv) # type: ignore # 'Extract' possible bm3d args before passing kwargs to mvtools :)