Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 13 additions & 12 deletions vodesfunc/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this actually be default lol
I know all the benchmarks used this but is it worth putting more resources into nlm in the context of a real script

@TheFeelTrain TheFeelTrain Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jetpack has nl_means default to num_streams=2 with it. https://github.com/Jaded-Encoding-Thaumaturgy/vs-jetpack/blob/5fdcfcf1533ab1094c95af802eb95b8d6017a180/vsdenoise/nlm.py#L108

A lot of other filters also default to 2. Bilateral is even 4 and it seems to be fine in a full script. I've been running it with 2 since the nlm-hip commit. If you want could also make it kwargs instead and default to 1.

num_streams=kwargs.pop("num_streams", 1)

Although I didn't originally because that is going to conflict with bm3d in vszip cl/cu, lol.
Best might be a num_streams=[2,2] type argument when that happens I suppose.

Also sidenote is there any reason why nlmeans is cuda[0] and bm3d is cuda[1] while everything else is the opposite?

)

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 :)
Expand Down