View Full Version : BM3D (VapourSynth) versus MVTools


DJATOM
4th July 2021, 18:10
CUDA based BM3D (V-BM3D) is fast enough on decent GPU and probably faster than mvtools2 with small temporal radius. You might want to consider using it as faster denoising backend.
Some numbers if you interested:
1080p, radius=3, fast=True - ~21.85 fps
1080p, radius=3, fast=False - ~14.17 fps
1080p, radius=2, fast=True - ~38.93 fps
1080p, radius=2, fast=False - ~19.69 fps
1080p, radius=1, fast=True - ~63.21 fps
1080p, radius=1, fast=False - ~31.49 fps
1080p, radius=0, fast=True - ~159.75 fps (that's a spatial mode)
1080p, radius=0, fast=False - ~79.24 fps (that's also a spatial mode)
"fast" option squeezes more fps with the same quality at expense of flooding PCIe lanes, probably my card can preform better, but due to SSD attached to CPU lanes it works at x8 mode (still enough for me).

ChaosKing
4th July 2021, 19:21
ahh finally some numbers for bm3dcuda. Could you also post some numbers for the bm3dCPU version? I wonder how big the speed gap is.

DJATOM
4th July 2021, 19:41
radius=0 - ~114.46 fps
radius=1 - ~65.87 fps
radius=2 - ~46.11 fps
radius=3 - ~36.03 fps
radius=4 - ~29.26 fps
I'm measuring with 12 cores CPU and overclocked RAM (yet no turbo boost enabled).

ChaosKing
4th July 2021, 20:54
Didn't expect that. It's even faster than your 2070. I guess a ~8 cores cpu could be about the same speed as the 2070 then.

tormento
5th July 2021, 07:16
CUDA based BM3D (V-BM3D) is fast enough on decent GPU and probably faster than mvtools2 with small temporal radius. You might want to consider using it as faster denoising backend.
Thanks for your suggestion, I did not know that BM3D had a CUDA version. Where can I find a Windows build, better with HBD support?

However, there are a few CUDA denoiser around already. What we need is a MVTool on CUDA or OpenCL.

ChaosKing
5th July 2021, 07:48
Thanks for your suggestion, I did not know that BM3D had a CUDA version. Where can I find a Windows build, better with HBD support?

However, there are a few CUDA denoiser around already. What we need is a MVTool on CUDA or OpenCL.

https://github.com/WolframRhodium/VapourSynth-BM3DCUDA

Scroll to version 2.1 for cuda version.

tormento
5th July 2021, 07:50
Scroll to version 2.1 for cuda version.
Thanks but it is for VS not AVS+.

kedautinh12
5th July 2021, 08:34
In the present, BM3D only in VS

WolframRhodium
5th July 2021, 09:22
The numbers from DJATOM looks interesting.

The GPU performance aligns well with the estimation that

fps * (2 * radius + 1) ≈ constant

, since the calculation is dominated by block matching.

The CPU performance is unexpected to me. Maybe the cache plays a nontrivial role.

Anyway, I have no experience in writing an AVS+ plugin. Will take a look if people are interested.

kedautinh12
5th July 2021, 09:31
Yeah, i'm waiting many years for avs+ ver

real.finder
5th July 2021, 10:51
Anyway, I have no experience in writing an AVS+ plugin. Will take a look if people are interested.

you can make the plugin work in both https://github.com/HomeOfAviSynthPlusEvolution/neo_DFTTest (this is backport of vs DFTTest and now it's work on both)

WolframRhodium
5th July 2021, 12:22
you can make the plugin work in both https://github.com/HomeOfAviSynthPlusEvolution/neo_DFTTest (this is backport of vs DFTTest and now it's work on both)

Thanks, I am aware of the DualSynth implementation. I need to read more about the parallelism mechanism of AVS+, thought.

Reel.Deel
8th July 2021, 00:55
Anyway, I have no experience in writing an AVS+ plugin. Will take a look if people are interested.

+1 ... definitely some interest here.

Dogway
8th July 2021, 09:27
Obviously super interested in this. I think it can easily double current scripts speed that make use of mvtools. Probably for implementation reference you can check source of AVS+ 3.7.1 CUDA.

real.finder
22nd July 2021, 05:42
WolframRhodium, any news about avs+ port?

@Moderators, can you move BM3D posts to new thread?

tebasuna51
22nd July 2021, 07:18
@Moderators, can you move BM3D posts to new thread?

Moved. It is ok now?

real.finder
22nd July 2021, 10:45
Moved. It is ok now?

Yes. It's fine. Thanks

WolframRhodium
22nd July 2021, 13:43
I'm sorry about being lazy on avs+ port... Will consider it this weekend.

Dogway
22nd July 2021, 17:14
I think OP was replying to my post:
Currently mvtools is the bottleneck of most scripts, I calculated that for a 2h feature we need a performance of at least 5fps to finish an encode in 10h, good value for an overnight encode. I think this is still a bit far when using refinemotion (a must in my book) -1080p @ 16-bit-.

Thank you WolframRhodium, it would actually be an achievement and a revolution for AVS since mvtools is the major bottleneck in most scripts.

lansing
22nd July 2021, 20:42
I'm confused, so the 3900x is faster than the RTX 2070??

DJATOM
23rd July 2021, 01:21
Usually faster for me for certain job, but if I need to do all at once, gpu offloading helps.

tormento
23rd July 2021, 10:17
Moved. It is ok now?
I think this post is not belong to this thread.

tormento
23rd July 2021, 10:17
Usually faster for me for certain job, but if I need to do all at once, gpu offloading helps.
GPU offloading means more CPU resources to assign to encoder. So it helps a lot.

WolframRhodium
25th July 2021, 10:39
Please check the following test binaries:
nightly releases (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346)

The functions are named "BM3D_CUDA" and "BM3D_VAggregate". They only support planar float inputs (please do the conversion yourself). The usage is the same as the VapourSynth version.

Please feel free to report any issues. I rarely use AVS+ and I may make mistakes everywhere.

DJATOM
25th July 2021, 11:10
Script
DGSource(...)
ConvertBits(bits=32)
BM3D_CUDA(sigma=0.5, radius=2)
BM3D_VAggregate(radius=2)
ConvertBits(bits=16)
Prefetch(12) #more than 12 had worse performance on my machine

Results
radius=0: 165.55 fps
radius=1: 54.57 fps
radius=2: 36.33 fps

kedautinh12
25th July 2021, 12:08
Thanks very much, can you port cpu ver of BM3D???

Dogway
25th July 2021, 18:04
Thanks a lot, runs at 20fps with DJATOM's script on my 1070!

Reel.Deel
25th July 2021, 21:24
Very nice WolframRhodium, thank you very much.

Here are my results with the same script as DJATOM on a GTX 1050 Ti:
[Clip info]
Number of frames: 10001
Length (hh:mm:ss.ms): 00:06:57.125
Frame width: 1920
Frame height: 1080
Framerate: 23.976 (24000/1001)
Colorspace: YUV420P16


[Runtime info]
Frames processed: 10001 (0 - 10000)
FPS (min | max | average): 2.132 | 237298 | 27.10
Process memory usage (max): 3214 MiB
Thread count: 36
CPU usage (average): 54.9%

Time (elapsed): 00:06:09.091

WolframRhodium
26th July 2021, 01:27
Thanks very much, can you port cpu ver of BM3D???

Maybe next week.

tormento
27th July 2021, 16:28
Thanks a lot, runs at 20fps with DJATOM's script on my 1070!
Do you think it worths to be used as prefilter in SMDegrain or it's more than complete in its own? Could it be used instead of MVTools in SMDegrain too?

tormento
27th July 2021, 21:50
Results on 1060 3GB

Number of frames: 2904
Length (hh:mm:ss.ms): 00:02:01.121
Frame width: 1920
Frame height: 800
Framerate: 23.976 (24000/1001)
Colorspace: YUV420P16

Frames processed: 2904 (0 - 2903)
FPS (min | max | average): 2.520 | 153846 | 18.69
Process memory usage (max): 1491 MiB
Thread count: 23
CPU usage (average): 27.2%

GPU usage (average): 63%
VPU usage (average): 8%
GPU memory usage: 991 MiB
GPU Power Consumption (average): 70.1 W

Time (elapsed): 00:02:35.347

Dogway
27th July 2021, 22:25
I didn't give it a deep look but it seemed to me to soften the clip a bit. I would look into vapoursynth superscripts which mix mvtools and BM3D.

Currently I'm on the task of porting Adaptive Sharpen to avisynth (half done) to fully replace Contrasharpen, that's taking me the whole time.

Quadratic
28th July 2021, 03:22
I didn't give it a deep look but it seemed to me to soften the clip a bit. I would look into vapoursynth superscripts which mix mvtools and BM3D.
BM3D can use mvtools as a reference clip which greatly helps when the goal is to reduce grain but not entirely flatten the clip. Generally functions such as SMDegrain are going to be visually more faithful to the original clip, whereas BM3D is unmatched when it comes to complete removal of noise (which makes it an excellent prefilter, among other things).

tormento
28th July 2021, 07:33
BM3D is unmatched when it comes to complete removal of noise (which makes it an excellent prefilter, among other things).
Do you have any suggested values for parameters while using as prefilter?

Quadratic
28th July 2021, 23:34
Do you have any suggested values for parameters while using as prefilter?

Not specific to prefiltering, but watch out for blocking https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/5

WolframRhodium
1st August 2021, 05:14
The CPU (AVX2) version is uploaded.

kedautinh12
1st August 2021, 05:24
Wow, thanks, can you up for AVX same VS and share link download???

WolframRhodium
1st August 2021, 05:43
Wow, thanks, can you up for AVX same VS and share link download???

The link remains the same. AVX2 is required for the cpu version for efficient data movement in register, the same as in VS.

tormento
1st August 2021, 09:33
The CPU (AVX2) version is uploaded.
Does Test2 work for CUDA too or is it AVX2 bonded?

kedautinh12
1st August 2021, 10:34
CUDA for GPU ver, AVX2 for CPU ver

WolframRhodium
1st August 2021, 12:26
Does Test2 work for CUDA too or is it AVX2 bonded?

Both are included and are implemented in different dlls.

real.finder
1st August 2021, 12:36
ColorBars(width=640, height=480, pixel_type="yv12")
LoadPlugin("BM3DCPU_AVS.dll")
ConvertBits(bits=32)
BM3D_cpu(sigma=0.5, radius=2)
BM3D_VAggregate(radius=2)
ConvertBits(8)

22 fps with no mt (no Prefetch) on i7-8700

I have a question about BM3D_VAggregate, it's cpu only? and seems it's Duplicate in both cpu and cuda dlls and that seems not ok

WolframRhodium
1st August 2021, 13:20
ColorBars(width=640, height=480, pixel_type="yv12")
LoadPlugin("BM3DCPU_AVS.dll")
ConvertBits(bits=32)
BM3D_cpu(sigma=0.5, radius=2)
BM3D_VAggregate(radius=2)
ConvertBits(8)

22 fps with no mt (no Prefetch) on i7-8700

I have a question about BM3D_VAggregate, it's cpu only? and seems it's Duplicate in both cpu and cuda dlls and that seems not ok

It's cpu only since its performance is limited by memory bandwidth and has low arithmetic intensity. Test2 moved that function to the cpu dll so there should be no conflict.

tormento
2nd August 2021, 09:25
Both are included and are implemented in different dlls.
Any changelog for test2 on CUDA?

kedautinh12
2nd August 2021, 09:32
Read readme file in file downloaded

WolframRhodium
2nd August 2021, 11:29
Any changelog for test2 on CUDA?

Nothing besides now it depends on the CPU version on VAggregate.

Reel.Deel
3rd August 2021, 00:58
Nothing besides now it depends on the CPU version on VAggregate.

Any possibility of also supporting AVX? I see the VS version supports it, according to the documentation: The cpu version is implemented in AVX/AVX2 intrinsics...

kedautinh12
3rd August 2021, 01:48
Any possibility of also supporting AVX? I see the VS version supports it, according to the documentation: The cpu version is implemented in AVX/AVX2 intrinsics...

But in Requirements, he wrote only AVX2

WolframRhodium
3rd August 2021, 02:08
I mean AVX and AVX2 intrinsics. Sorry for the confusion.

Reel.Deel
3rd August 2021, 02:44
I mean AVX and AVX2 intrinsics. Sorry for the confusion.

Ahh gotcha, I guess that explains this error in AVSMeter:

Exception: 0xC000001D [STATUS_ILLEGAL_INSTRUCTION]
Module: BM3DCPU_AVS.dll
Address: 0x000007FEC45204E6

Figured it was worth asking about AVX since I see just "AVX" in the requirements of the VS version, but in other parts it says AVX/AVX2.... well I guess that leaves me out of it till I build my next PC :D

tormento
5th August 2021, 20:24
I mean AVX and AVX2 intrinsics. Sorry for the confusion.
I am having AVS+ exception error when using test2 on the following script:

SetMemoryMax()
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\Eseguibili\Media\DGDecNV\DGDecodeNV.dll")
DGSource("F:\In\1_33 Grosso guaio a Chinatown\grosso.dgi",ct=132,cb=132,cl=0,cr=0)
ConvertBits(bits=32)
BM3D_cuda(sigma=0.5, radius=2)
BM3D_VAggregate(radius=2)
ConvertBits(16)
Prefetch(6)

I am using a SandyBridge with no AVX2 but it should give no error with the CUDA version. Am I doing something wrong?

Reel.Deel
5th August 2021, 20:39
I am using a SandyBridge with no AVX2 but it should give no error with the CUDA version. Am I doing something wrong?

"BM3D_CUDA" depends on "BM3D_CPU" for temporal denoising. In other words, avx2 capable processor is required.


@WolframRhodium

Since the first test version worked on the gpu only, would it be possible to add a parameter to force gpu processing only? For those that do not have avx2.

tormento
5th August 2021, 20:41
Since the first test version worked on the gpu only, would it be possible to add a parameter to force gpu processing only? For those that do not have avx2.
I think it would be easier to provide 2 versions as every script author should otherwise check if cpu supports avx2 and I don't know if there is such capability in AVS+.

kedautinh12
5th August 2021, 23:41
I am having AVS+ exception error when using test2 on the following script:

SetMemoryMax()
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\Eseguibili\Media\DGDecNV\DGDecodeNV.dll")
DGSource("F:\In\1_33 Grosso guaio a Chinatown\grosso.dgi",ct=132,cb=132,cl=0,cr=0)
ConvertBits(bits=32)
BM3D_cuda(sigma=0.5, radius=2)
BM3D_VAggregate(radius=2)
ConvertBits(16)
Prefetch(6)

I am using a SandyBridge with no AVX2 but it should give no error with the CUDA version. Am I doing something wrong?


Of course BM3D_VAggregate() move to BM3DCPU in test2, try delete BM3D_VAggregate() and check script again

WolframRhodium
6th August 2021, 06:51
Thanks for the report. Please check the latest version (test3). I separate VAggregate from BM3D_CPU.

tormento
6th August 2021, 10:30
Of course BM3D_VAggregate() move to BM3DCPU in test2, try delete BM3D_VAggregate() and check script again
No offense, I know you try to help, but sometimes I feel your posts are just to increase post counting. :p

How can you run BM3D without aggregation? :rolleyes:

tormento
6th August 2021, 10:32
Thanks for the report. Please check the latest version (test3). I separate VAggregate from BM3D_CPU.
Thanks, I will try ASAP and report.

kedautinh12
6th August 2021, 10:53
No offense, I know you try to help, but sometimes I feel your posts are just to increase post counting. :p

How can you run BM3D without aggregation? :rolleyes:

Lol, i know i'm noob. I just try help with my ability :D:D:D

tormento
6th August 2021, 13:34
Thanks for the report. Please check the latest version (test3). I separate VAggregate from BM3D_CPU.
Tested and working. ;)

Now, I have to understand which is better between this and KNLMeansCL...

Reel.Deel
9th August 2021, 08:35
Thanks for the report. Please check the latest version (test3). I separate VAggregate from BM3D_CPU.

Thank for the update. I also confirm that it works :)

Question, are arrays allowed? I took a peek at the source code (line 429 (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/8339115ff736005b9c9f8e60e4ac8718e3a508bc/source/source_avs.cpp#L429)) and it made me think that arrays are allowed just like the VS version.
When I set sigma to [0.5, 0.0, 0.5] it sets the U plane to 255, if I use [0.5, 0.0, 0.0] it sets both U/V to 255. If I use [0.0,0.5,0.5] it sets the Y plane to 255. So I guess that using an array does work, I just don't know if setting sigma to 0 should behave that way.

WolframRhodium
9th August 2021, 11:56
Question, are arrays allowed? I took a peek at the source code (line 429 (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/8339115ff736005b9c9f8e60e4ac8718e3a508bc/source/source_avs.cpp#L429)) and it made me think that arrays are allowed just like the VS version.
When I set sigma to [0.5, 0.0, 0.5] it sets the U plane to 255, if I use [0.5, 0.0, 0.0] it sets both U/V to 255. If I use [0.0,0.5,0.5] it sets the Y plane to 255. So I guess that using an array does work, I just don't know if setting sigma to 0 should behave that way.

Yes, arrays are allowed, and the behavior is the same as the VS version. Setting gamma for a specific plane to 0 skips denoising of that plane, which gives a performance boost.

Reel.Deel
10th August 2021, 01:21
Yes, arrays are allowed, and the behavior is the same as the VS version. Setting gamma for a specific plane to 0 skips denoising of that plane, which gives a performance boost.

Thank you for the confirmation. I created a wiki page for BM3DCUDA (http://avisynth.nl/index.php/BM3DCUDA). I still need add that arrays are accepted. But if there's anything you you would like changed or added just let me know.

WolframRhodium
10th August 2021, 04:39
Thanks, nothing needs to be added.

real.finder
13th August 2021, 02:51
Yes, arrays are allowed, and the behavior is the same as the VS version. Setting gamma for a specific plane to 0 skips denoising of that plane, which gives a performance boost.

but from what I see https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/8339115ff736005b9c9f8e60e4ac8718e3a508bc/cpu_source/source_avs.cpp#L461

arrays parameters don't have "+" like this https://github.com/Asd-g/AviSynthPlus-vsLGhost/blob/05d22f007ab77fe5d2634510c29d70700694d7ac/src/vsLGhost.cpp#L245

edit: seems it work with arrays as it now but it's break my avsi wrapper that like this https://github.com/realfinder/UniversalPluginsFolders/blob/master/plugins64%2B/36x/vsLGhost.avsi

WolframRhodium
13th August 2021, 03:28
but from what I see https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/8339115ff736005b9c9f8e60e4ac8718e3a508bc/cpu_source/source_avs.cpp#L461

arrays parameters don't have "+" like this https://github.com/Asd-g/AviSynthPlus-vsLGhost/blob/05d22f007ab77fe5d2634510c29d70700694d7ac/src/vsLGhost.cpp#L245

edit: seems it work with arrays as it now but it's break my avsi wrapper that like this https://github.com/realfinder/UniversalPluginsFolders/blob/master/plugins64%2B/36x/vsLGhost.avsi

Does the avsi wrapper work with a "*" postfix (which indicates "zero or more" arguments of the same type)?

real.finder
13th August 2021, 09:44
Does the avsi wrapper work with a "*" postfix (which indicates "zero or more" arguments of the same type)?

it didn't https://forum.doom9.org/showpost.php?p=1914628&postcount=434 but with avs+ 3.6 I think it can with unnamed arrays, didn't test though (edit: see here https://github.com/AviSynth/AviSynthPlus/issues/226)

real.finder
15th August 2021, 19:27
after read this https://github.com/AviSynth/AviSynthPlus/issues/203 I did some workaround for BM3D case

Function BM3D_CPU(clip clip, clip "ref", float_array "sigma", int_array "block_step", int_array "bm_range", int "radius", int_array "ps_num", int_array "ps_range", bool "chroma")
{
LoadPlugin(AviSynthPlugins64PDir + "36x/BM3DCPU.dll")
BM3D_CPU(clip, ref=ref, sigma=IsArray(sigma) ? ArraySize(sigma) == 0 ? undefined : sigma : sigma, block_step=IsArray(block_step) ? ArraySize(block_step) == 0 ? undefined : block_step : block_step, bm_range=IsArray(bm_range) ? ArraySize(bm_range) == 0 ? undefined : bm_range : bm_range, radius=radius, ps_num=IsArray(ps_num) ? ArraySize(ps_num) == 0 ? undefined : ps_num : ps_num, ps_range=IsArray(ps_range) ? ArraySize(ps_range) == 0 ? undefined : ps_range : ps_range, chroma=chroma)
}


Function BM3D_CUDA(clip clip, clip "ref", float_array "sigma", int_array "block_step", int_array "bm_range", int "radius", int_array "ps_num", int_array "ps_range", bool "chroma", int "device_id", bool "fast", int "extractor_exp")
{
LoadPlugin(AviSynthPlugins64PDir + "36x/BM3DCUDA.dll")
BM3D_CUDA(clip, ref=ref, sigma=IsArray(sigma) ? ArraySize(sigma) == 0 ? undefined : sigma : sigma, block_step=IsArray(block_step) ? ArraySize(block_step) == 0 ? undefined : block_step : block_step, bm_range=IsArray(bm_range) ? ArraySize(bm_range) == 0 ? undefined : bm_range : bm_range, radius=radius, ps_num=IsArray(ps_num) ? ArraySize(ps_num) == 0 ? undefined : ps_num : ps_num, ps_range=IsArray(ps_range) ? ArraySize(ps_range) == 0 ? undefined : ps_range : ps_range, chroma=chroma, device_id, fast=fast, extractor_exp=extractor_exp)
}

anyway, arrays in avs+ still vague, I think we need pinterf explain it more, Especial why script (avsi) cases different than plugins one in case of plugins accept array even if the argument/parameter is not array type while script (avsi) is not

WolframRhodium
16th August 2021, 12:42
after read this https://github.com/AviSynth/AviSynthPlus/issues/203 I did some workaround for BM3D case
Thanks.

anyway, arrays in avs+ still vague, I think we need pinterf explain it more, Especial why script (avsi) cases different than plugins one in case of plugins accept array even if the argument/parameter is not array type while script (avsi) is not

Agree.

guest
24th August 2021, 03:22
I'm embarrassed to ask this, as I am just finding BM3D, and would like help with a basic AVS script...

kedautinh12
24th August 2021, 03:28
Read examples in here
http://avisynth.nl/index.php/BM3DCUDA
Edit: GPU ver need AVX in CPU cause BM3D_VAggregate. CPU ver need AVX2. They need strong GPU or CPU to work for speed fps

guest
24th August 2021, 03:44
Read examples in here
http://avisynth.nl/index.php/BM3DCUDA
Edit: GPU ver need AVX in CPU cause BM3D_VAggregate. CPU ver need AVX2. They need strong GPU or CPU to work for speed fps

Thanks again, I have looked there several times, but as I'm not too good at compiling scripts, unless I have a good example of one, to start with.

I need something like this :-

#Custom
LoadPlugin("%AVISYNTHPLUGINS%\mvtools\mvtools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\masktools\masktools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\RgTools\RgTools.dll")
LoadPlugin("%AVISYNTHPLUGINS%\MedianBlur2\x64\MedianBlur2.dll")
Import("%AVISYNTHPLUGINS%\scripts\extras\SMDegrain.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Zs_RF_Shared.avs")
video=SMDegrain(video,tr=4,thSAD=400,contrasharp=true,refinemotion=true)

I have a 5950X, and a 1080 GPU....

kedautinh12
24th August 2021, 03:57
Scripts in example is very basic. If you want use BM3D in SMDegrain maybe use this script

LoadPlugin("%AVISYNTHPLUGINS%\mvtools\mvtools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\BM3DCUDA_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\BM3D_VAggregate_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\masktools\masktools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\RgTools\RgTools.dll")
LoadPlugin("%AVISYNTHPLUGINS%\MedianBlur2\x64\MedianBlur2.dll")
Import("%AVISYNTHPLUGINS%\scripts\extras\SMDegrain.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Zs_RF_Shared.avs")
ffms2("...") #or any Video Sources
SMDegrain(tr=4,thSAD=400,contrasharp=true,refinemotion=true,prefilter=5)

guest
24th August 2021, 04:53
Scripts in example is very basic. If you want use in SMDegrain maybe use this script

LoadPlugin("%AVISYNTHPLUGINS%\mvtools\mvtools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\BM3DCUDA_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\BM3D_VAggregate_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\masktools\masktools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\RgTools\RgTools.dll")
LoadPlugin("%AVISYNTHPLUGINS%\MedianBlur2\x64\MedianBlur2.dll")
Import("%AVISYNTHPLUGINS%\scripts\extras\SMDegrain.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Zs_RF_Shared.avs")
ffms2("...") #or any Video Sources
SMDegrain(tr=4,thSAD=400,contrasharp=true,refinemotion=true,prefilter=5)


Awesome, thankyou...

Can you clarify the:- ffms2("...") #or any Video Sources line ??

I'm trying to adapt this to RipBot264, and it uses Lsmash as the default decoder.

I'm guessing that the ("....") is the location & name of the the file to be encoded....could be left out ??

#VideoSource
LoadPlugin("D:\RipBot264v1.26.1\Tools\AviSynth plugins\ffms\2017\x64\ffms2.dll")
video=FFVideoSource("D:\Bering.Sea.Gold.mkv",cachefile="C:\Temp\RipBot264temp\job5\Bering.Sea.Gold.mkv.ffindex")

OR

#VideoSource
LoadPlugin("D:\RipBot264v1.26.1\Tools\AviSynth plugins\lsmash\LSMASHSource.dll")
video=LWLibavVideoSource("D:\Bering.Sea.Gold.mkv",cachefile="C:\Temp\RipBot264temp\job4\Bering.Sea.Gold.mkv.lwi")


Remember I'm a real noobie at this stuff, so ANY help is invaluable.

kedautinh12
24th August 2021, 05:12
Awesome, thankyou...

Can you clarify the:- ffms2("...") #or any Video Sources line ??

I'm trying to adapt this to RipBot264, and it uses Lsmash as the default decoder.

I'm guessing that the ("....") is the location & name of the the file to be encoded....could be left out ??

#VideoSource
LoadPlugin("D:\RipBot264v1.26.1\Tools\AviSynth plugins\ffms\2017\x64\ffms2.dll")
video=FFVideoSource("D:\Bering.Sea.Gold.mkv",cachefile="C:\Temp\RipBot264temp\job5\Bering.Sea.Gold.mkv.ffindex")

OR

#VideoSource
LoadPlugin("D:\RipBot264v1.26.1\Tools\AviSynth plugins\lsmash\LSMASHSource.dll")
video=LWLibavVideoSource("D:\Bering.Sea.Gold.mkv",cachefile="C:\Temp\RipBot264temp\job4\Bering.Sea.Gold.mkv.lwi")


Remember I'm a real noobie at this stuff, so ANY help is invaluable.

Yes, the ("....") is the location & name of the the file to be encoded. Use any video sources you like. If one video source have problem try change another video sources

kedautinh12
24th August 2021, 05:23
New ver ffms2
https://forum.doom9.org/showthread.php?p=1950254#post1950254
New ver L-SMASH Works
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases

guest
24th August 2021, 05:23
Yes, the ("....") is the location & name of the the file to be encoded. Use any video sources you like. If one video source have problem try change another video sources

Would it be possible to incorporate DGDecNV into this script ??

loadplugin("d:\don\Programming\C++\dgdecnv\DGDecodeNV\x64\Release\dgdecodenv.dll")
dgsource("Alba.dgi")

kedautinh12
24th August 2021, 05:26
Would it be possible to incorporate DGDecNV into this script ??

loadplugin("d:\don\Programming\C++\dgdecnv\DGDecodeNV\x64\Release\dgdecodenv.dll")
dgsource("Alba.dgi")

Yes, it's can

New ver DGDecNV
http://rationalqm.us/dgdecnv/binaries/

guest
24th August 2021, 05:32
Yes, it's can

New ver DGDecNV
http://rationalqm.us/dgdecnv/binaries/

Sounds interesting....

How would that affect the RipBot264 generated command

#VideoSource
LoadPlugin("D:\RipBot264v1.26.1\Tools\AviSynth plugins\lsmash\LSMASHSource.dll")
video=LWLibavVideoSource("D:\Bering.Sea.Gold.mkv",cachefile="C:\Temp\RipBot264temp\job4\Bering.Sea.Gold.mkv.lwi")

It would be great to get RipBot to use DGDecNV, instead of L Smash.

It might require DGSource to do some pre lim's.

STJAM
5th September 2021, 14:12
I am probably going to regret this inquiry but could someone post an example script for the Vapoursynth CUDA version. I have been using BM3D-r8 for quite some time and can create a working script without even the help of mvsfunc but can not seem to get this version to work. I have followed the examples on https://github.com/WolframRhodium/VapourSynth-BM3DCUDA but am still at a loss.

kedautinh12
5th September 2021, 15:07
New ver BM3D avs+
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/1200055357

WolframRhodium
5th September 2021, 17:09
I am probably going to regret this inquiry but could someone post an example script for the Vapoursynth CUDA version. I have been using BM3D-r8 for quite some time and can create a working script without even the help of mvsfunc but can not seem to get this version to work. I have followed the examples on https://github.com/WolframRhodium/VapourSynth-BM3DCUDA but am still at a loss.

Sorry for the inconvenience. Could you please describe what problem occurs?

Here is a basic snippet.

yuv420ps = core.fmtc.bitdepth(yuv420p8, bits=8)

# spatial denoising
denoised_ps = core.bm3dcuda.BM3D(yuv420ps, sigma=[5, 3, 3], radius=0)

# or, temporal denoising
denoised_ps = core.bm3dcuda.BM3D(yuv420ps, sigma=[5, 3, 3], radius=1).bm3d.VAggregate(radius=1)

denoised_p8 = core.fmtc.bitdepth(denoised_ps, bits=8)

ChaosKing
5th September 2021, 17:38
Is this blockiness normal? (look at the sky)


clip = core.fmtc.bitdepth(clip, bits=32)
r=2
clip = core.bm3dcuda_rtc.BM3D(clip, sigma=[18, 16, 16], radius=r).bm3d.VAggregate(radius=r)
https://i.imgur.com/XsObV4E.png

Win10 x64, VapourSynth R55, RTX 3070TI.

STJAM
5th September 2021, 18:29
import vapoursynth as vs
import sys
core = vs.core
core.std.LoadPlugin(path=r'C:\ \VapourSynth-BM3DCUDA-r2.4\BM3DCUDA.dll')
core.std.LoadPlugin(path=r'C:\ \fmtconv-r22\win64\fmtconv.dll')
core.std.LoadPlugin(path=r'C:\ \L-SMASH-Works_20200207\plugins64\LSMASHSource.dll')
clip = core.lsmas.LWLibavSource(r'C:\Video.mkv')
clip = core.fmtc.bitdepth(clip, bits=32)
r=2
clip = core.bm3dcuda.BM3D(clip, sigma=[3, 2, 2], radius=r).bm3d.VAggregate(radius=r)

AttributeError: There is no attribute or namespace named bm3d

WolframRhodium
5th September 2021, 23:56
Is this blockiness normal? (look at the sky)


clip = core.fmtc.bitdepth(clip, bits=32)
r=2
clip = core.bm3dcuda_rtc.BM3D(clip, sigma=[18, 16, 16], radius=r).bm3d.VAggregate(radius=r)
https://i.imgur.com/XsObV4E.png

Win10 x64, VapourSynth R55, RTX 3070TI.

Blockness will be reduced with a low value of "block_step".

AttributeError: There is no attribute or namespace named bm3d

VapourSynth-BM3D also has to be loaded.

guest
6th September 2021, 04:36
New ver BM3D avs+
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/1200055357

Where ???

kedautinh12
6th September 2021, 04:51
Where ???
You need github account for download that

guest
6th September 2021, 04:58
You need github account for download that

Have you got one ??

I haven't needed one yet !!!

But that page looks different to others....

kedautinh12
6th September 2021, 05:43
Here:
https://drive.google.com/file/d/1sYVmozUVrSAdd0S01AphMIa6yH8CexUW/view?usp=sharing

guest
6th September 2021, 06:54
Here:
https://drive.google.com/file/d/1sYVmozUVrSAdd0S01AphMIa6yH8CexUW/view?usp=sharing

:thanks:

tormento
6th September 2021, 12:01
Is this blockiness normal? (look at the sky)
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/5

Wilbert
7th September 2021, 20:46
@kedautinh12,

I removed 85 useless 'thank you' posts of you. I ask you this only once, please stop posting useless off topic (like 'thank you' posts) stuff. Also take your time to read the forum rules, especially number 11:

11) Don't post just to increase your number of posts. If you have nothing to say on a certain matter then don't post. The number of posts on this board has no direct relation to the experience of a member.

kedautinh12
8th September 2021, 00:07
Ok, thanks. Need "thanks" button

guest
20th September 2021, 07:42
Hi WolframRhodium,

Since I started using this filter, I have been using my Ryzen 3950X & 5950X, and has worked without issue :)

However, only today, when using it on non AVX2 CPU machines, I have been getting an error that stops any encoding :(

Is there any chance that you could modify the AVS compatible builds to work with AVX CPU's ??

I'm sure I wouldn't be the only one who would appreciate it.

(unless there's some "trick" to the existing builds)

Regards

Reel.Deel
20th September 2021, 08:02
Hi WolframRhodium,

Since I started using this filter, I have been using my Ryzen 3950X & 5950X, and has worked without issue :)

However, only today, when using it on non AVX2 CPU machines, I have been getting an error that stops any encoding :(

Is there any chance that you could modify the AVS compatible builds to work with AVX CPU's ??

I'm sure I wouldn't be the only one who would appreciate it.

(unless there's some "trick" to the existing builds)

Regards

If you have a compatible GPU then you can to use BM3D_CUDA(). BM3D_CPU() at the moment is AVX2 only.

guest
20th September 2021, 09:41
If you have a compatible GPU then you can to use BM3D_CUDA(). BM3D_CPU() at the moment is AVX2 only.

I only have 2 AVX2 systems, one has an nVidia GPU, the other has an AMD :(

Hopefully "Wolf" can work his magic, as there's a LOT of AVX cpu's out there...

I know I saw that there was an AVX build, but that might have been for Vapoursynth.

What would be the next best filter ??

Reel.Deel
20th September 2021, 09:53
I know I saw that there was an AVX build, but that might have been for Vapoursynth.

Only the BM3D VAggregate function is AVX. This at least makes it usable for those that have a compatible GPU but do not have AVX2.

ChaosKing
20th September 2021, 10:03
Why not use this version then? https://github.com/HomeOfVapourSynthEvolution/VapourSynth-BM3D
Use the mvsfunc wrapper for easy usage.

guest
20th September 2021, 11:06
Only the BM3D VAggregate function is AVX. This at least makes it usable for those that have a compatible GPU but do not have AVX2.

Well, that's a shame, I only just started using BM3D, and now I can only use it on a couple of my PC's.

guest
20th September 2021, 11:07
Why not use this version then? https://github.com/HomeOfVapourSynthEvolution/VapourSynth-BM3D
Use the mvsfunc wrapper for easy usage.

I'm not able to use Vapoursynth with RipBot :(

WolframRhodium
20th September 2021, 14:55
I recommend to use VS-BM3D or to buy a GTX 750. It is hard to relax that requirement and I am busy these days.

guest
21st September 2021, 01:39
I recommend to use VS-BM3D or to buy a GTX 750. It is hard to relax that requirement and I am busy these days.

Like I said in the previous post, I cannot use Vapoursynth, and why should I waste my hard earned cash on a GPU, all because you're too busy.

You started the project, you should finish it (or get someone else too)....there would have to be more ppl out there with AVX or lower spec CPU's that would like to use this filter, but can't.

For example, someone has an Intel CPU, but only AVX, and an AMD GPU, they're screwed :(, with both Avisynth & Vapoursynth.

kedautinh12
21st September 2021, 01:59
I think with BM3D only support 32bit and with no Nvidia GPU. Chip don't support AVX is old and work with very slow fps. They just replace another fast denoiser

StainlessS
21st September 2021, 02:08
why should I waste my hard earned cash on a GPU, all because you're too busy
Why dont you waste, I mean spend your time learning to code and do it yourself.
You dont have to waste your hard earned on anything, and neither does WolframRhodium have to waste any of his time on you [or me].

https://forum.doom9.org/showthread.php?t=52597

EDIT: https://en.wiktionary.org/wiki/don%27t_shit_where_you_eat

guest
21st September 2021, 02:31
Why dont you waste, I mean spend your time learning to code and do it yourself.
You dont have to waste your hard earned on anything, and neither does WolframRhodium have to waste any of his time on you [or me].

https://forum.doom9.org/showthread.php?t=52597

EDIT: https://en.wiktionary.org/wiki/don%27t_shit_where_you_eat

Thanks StainlessS, point taken....

It's just frustrating, I have a LOT of SSE4.2 & AVX (only) dual cpu servers, that I use for Distributed Encoding with RipBot264, and someone comes along with a nice new filter, and I can't use them.

And RipBot doesn't use Vapoursynth, but that's a whole other source of frustration :(

WolframRhodium
21st September 2021, 03:32
Why dont you waste, I mean spend your time learning to code and do it yourself.
You dont have to waste your hard earned on anything, and neither does WolframRhodium have to waste any of his time on you [or me].

https://forum.doom9.org/showthread.php?t=52597

EDIT: https://en.wiktionary.org/wiki/don%27t_shit_where_you_eat

Thanks.

kedautinh12
17th October 2021, 18:17
Last ver
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346

takla
24th October 2021, 11:01
Last ver with BM3DCUDA_rtc for avs+ x64
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/1367074149

If you don't mind, could you say "latest version" instead of "last version"? Everytime I read "last" it makes it sound like there won't be any more updates.

kedautinh12
24th October 2021, 11:42
If you don't mind, could you say "latest version" instead of "last version"? Everytime I read "last" it makes it sound like there won't be any more updates.

Ok, sr my bad English :D

guest
26th October 2021, 01:46
Ok, sr my bad English :D

Hi ked,

So how do you keep track of all these updates ??

And which one should I be using ??

This:- https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346

or

https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/1367074149

kedautinh12
26th October 2021, 01:54
Keep track here:
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions

Remember download in post with word note like "build (windows)" and tag avs+ or you will get Vapoursynth ver :D

kedautinh12
28th November 2021, 06:20
Latest ver
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/1506053740

tormento
28th November 2021, 10:50
Latest ver
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/1506053740
Can't find the changelog between versions and aggregate dll is missing too.

takla
28th November 2021, 12:14
@tormento
Changelog is here: https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/commits/main

kedautinh12
28th November 2021, 13:06
@tormento
Changelog is here: https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/commits/main

This for Vapoursynth and here for avs+
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/commits/avs%2B

WolframRhodium
29th November 2021, 08:45
Can't find the changelog between versions and aggregate dll is missing too.

Thanks, the problem is fixed.

There is no change log since these changes are not mean to be releases (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346) and haven't been tested.

tormento
29th November 2021, 09:24
haven't been tested.
Thanks. Same package?

I have tested since your release, with older aggregate, and they work fine.

WolframRhodium
29th November 2021, 11:40
Same package?

Yes.

I have tested since your release, with older aggregate, and they work fine.

Thanks.

Dogway
2nd February 2022, 19:55
I found some issues. The plugin is broken when used with DGSource() with cropping as it only denoises vertically.
DGSource("D:\Clip.dgi",cl=0,ct=40,cr=0,cb=40)
ConverttoYUV444()
ConvertBits(bits=32)
BM3D_CUDA(sigma=2, radius=2)
BM3D_VAggregate(radius=2)

With ffms2 it shows macroblocks with radius starting from 3 (and sigma 2), but very noticeable with radius=4. Actually a combination of sigma and radius so sigma=>5 and radius=1 also shows the blocks, not sure if this is by design.

videoh
2nd February 2022, 20:08
You sound confused.

StainlessS
2nd February 2022, 21:20
Yeah, me too.
Just come in from pub, NO BEER, well lager and that kind of ilk, but I ask you, who would not be confused after that !
(Chill doggy doo, dont let it get to you :) )

ChaosKing
2nd February 2022, 22:25
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA
Note2: Lowering the value of "blocking_step" will be useful in reducing blocking artifacts at the cost of slower processing.

Dogway
2nd February 2022, 22:54
Thanks good call. Hope the arg gets included.

@StainlessS: I just ignore him, he gives away himself lol

joearmstrong
13th February 2022, 21:47
I just tested BM3DCUDA in spatial mode. I'm very impressed about the performance and the results. Maybe I switch from Neo VagueDenoiser to BM3DCUDA as my preferred spatial denoiser.
My settings:
ConvertBits(32)
BM3D_CUDA(sigma=2.5, radius=0)
ConvertBits(8, dither=0)

joearmstrong
14th February 2022, 15:27
Is there a reason why chroma is disabled by default?

kedautinh12
14th February 2022, 15:34
Is there a reason why chroma is disabled by default?

Cause chroma only support yuv444

kedautinh12
14th February 2022, 16:59
thanks for your last update test 6 support more old GPU & CPU but now BM3DCUDA very slow in TemporalDegrain2, half speed than test 5. I checked and seen you remove AVX support. Can you add support again AVX, AVX2 support and auto-detect highest Instruction Set Extensions. Thanks

guest
15th February 2022, 00:57
thanks for your last update test 6 support more old GPU & CPU but now BM3DCUDA very slow in TemporalDegrain2, half speed than test 5. I checked and seen you remove AVX support. Can you add support again AVX, AVX2 support and auto-detect highest Instruction Set Extensions. Thanks

Hi ked,

I also noticed that he's "remove avx requirement", now as BM3D for Avisynth didn't support AVX before, how can it be removed, UNLESS he mean he's added AVX support.

And what's the difference between this small "test6", and the #35 & #36 on his Git page ??

What's "ninja" ?

WolframRhodium
15th February 2022, 03:22
thanks for your last update test 6 support more old GPU & CPU but now BM3DCUDA very slow in TemporalDegrain2, half speed than test 5. I checked and seen you remove AVX support. Can you add support again AVX, AVX2 support and auto-detect highest Instruction Set Extensions. Thanks

Thanks for the feedback. These are restored in test7 (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/files/8065185/BM3DCUDA_AVS-test7.zip). test6 is accidentally build with compiler optimization disabled so it should not be used. Auto isa detection may be supported in the future (I need more time for experiment).

guest
15th February 2022, 04:12
thanks for your last update test 6 support more old GPU & CPU but now BM3DCUDA very slow in TemporalDegrain2, half speed than test 5. I checked and seen you remove AVX support. Can you add support again AVX, AVX2 support and auto-detect highest Instruction Set Extensions. Thanks

Hi ked,

Check out my discussion here (and the posts below)

https://forum.doom9.org/showthread.php?p=1963933#post1963933

kedautinh12
15th February 2022, 06:31
I will try test 7 later

guest
15th February 2022, 06:47
I will try test 7 later

OK, pls let me know, as test#6 & #7, and build #38 & #42 didn't.

In fact 38 & 42 were a total failure, for me, it would do ANYTHING.

So has "Wolf" done anything about AVX support for older CPU's ??

The title sort of suggests it, but as they didn't work for me, I don't know.

Cheers

kedautinh12
15th February 2022, 07:14
OK, pls let me know, as test#6 & #7, and build #38 & #42 didn't.

In fact 38 & 42 were a total failure, for me, it would do ANYTHING.

So has "Wolf" done anything about AVX support for older CPU's ??

The title sort of suggests it, but as they didn't work for me, I don't know.

Cheers

AVX don't support very older cpu. It's base your cpu support AVX or not

guest
15th February 2022, 08:24
AVX don't support very older cpu. It's base your cpu support AVX or not

I've had a bit of a brain fade..

Some of my servers are old Xeon X-series and they are only SSE4.2 as I found out.

But I do have several E5 series Xeons that are AVX and I forgot to check them, so I need to do that !!

guest
15th February 2022, 13:05
I will try test 7 later

Hi ked,

"Wolfie" has been busy....he's dropped another build...#43.

I might try it, but if it's like #36 & #42, it won't work for me :(

https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/workflows/windows.yml

WolframRhodium
15th February 2022, 13:07
Hi ked,

"Wolfie" has been busy....he's dropped another build...#43.

I might try it, but if it's like #36 & #42, it won't work for me :(

https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/workflows/windows.yml

Hopes test8 (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/files/8068864/BM3DCUDA_AVS-test8.zip) could work on your pc.

kedautinh12
15th February 2022, 13:27
I wonder why BM3DCUDA_AVS.dll x86 large than x64 ver??

WolframRhodium
15th February 2022, 13:46
I wonder why BM3DCUDA_AVS.dll x86 large than x64 ver??

The visual studio generator in cmake incorrectly includes additional gpu assembly programs. The ninja generator does not have this problem, but it only works for x64.

kedautinh12
15th February 2022, 13:59
I tried test 8 and speed very well. Thanks

guest
15th February 2022, 14:29
The visual studio generator in cmake incorrectly includes additional gpu assembly programs. The ninja generator does not have this problem, but it only works for x64.

Is there any difference between the VS & Ninja builds ??

Is anything else required to run the Ninja builds ??

I will test "test #8" & build #43 in about 11 hours from now.

Good night.

WolframRhodium
15th February 2022, 18:38
I tried test 8 and speed very well. Thanks

Thanks for your testing.

Is there any difference between the VS & Ninja builds ??

Is anything else required to run the Ninja builds ??

I will test "test #8" & build #43 in about 11 hours from now.

Good night.

VS & Ninja are just different tools that automates compilation so there should not be much difference. Test #8 should work on machine that can run test #6.

guest
16th February 2022, 05:24
Thanks for your testing.



VS & Ninja are just different tools that automates compilation so there should not be much difference. Test #8 should work on machine that can run test #6.

OK, so I've just tested "test#8" on the server that has dual Xeon E5-2697v2's (AVX), and a sad little GTX 760.

It worked on CUDA, but as expected, not on CPU, unfortunately...maybe one day.

I tried "Test#7", and was the same as #8.

I also tried build #43....did not even start AVSMeter, but build's #35 & #36 are good to go (for me), but #38 was no good.

Cheers

kedautinh12
16th February 2022, 06:15
OK, so I've just tested "test#8" on the server that has dual Xeon E5-2697v2's (AVX), and a sad little GTX 760.

It worked on CUDA, but as expected, not on CPU, unfortunately...maybe one day.

I tried "Test#7", and was the same as #8.

I also tried build #43....did not even start AVSMeter, but build's #35 & #36 are good to go (for me), but #38 was no good.

Cheers

BM3DCPU required AVX2 to work and i think don't need delete AVX2 in CPU ver cause CPU ver will very slow in old cpu. Just use BM3DCUDA

guest
16th February 2022, 07:49
BM3DCPU required AVX2 to work and i think don't need delete AVX2 in CPU ver cause CPU ver will very slow in old cpu. Just use BM3DCUDA

Yes I know this, it's just a shame, because the Vapoursynth version does support AVX...

And yes, I am happy that the CUDA function is now working (again), and on older nVidia GPU's that "Wolfie" thought wouldn't be supported, are "helping".

I lashed out and bought an RTX 3050 OC yesterday, 2560 Cuda Cores, should be a nice addition to the Ryzen 5950X, and the process.

Be nice if I could get VS to work for me with RipBot...oh well, wishful thinking.

Cheers

kedautinh12
16th February 2022, 08:34
I think can add sse2, sse4.2 and keep AVX2 in BM3DCPU if WolframRhodium support auto-detect highest Instruction Set Extensions :D

joearmstrong
20th February 2022, 10:42
I found some issues. The plugin is broken when used with DGSource() with cropping as it only denoises vertically.
DGSource("D:\Clip.dgi",cl=0,ct=40,cr=0,cb=40)
ConverttoYUV444()
ConvertBits(bits=32)
BM3D_CUDA(sigma=2, radius=2)
BM3D_VAggregate(radius=2)

I made a few encodes with DGSource and cropping, but
I used the cropping function from AviSynth - I couldn't find any problems.
DGSource("D:\Clip.dgi")
ConvertBits(32)
crop(0, 24, 0, 24)
BM3D_CUDA(sigma=2.2, block_step=2, radius=0)
ConvertBits(8, dither=0)

kedautinh12
20th February 2022, 11:27
I made a few encodes with DGSource and cropping, but
I used the cropping function from AviSynth - I couldn't find any problems.
DGSource("D:\Clip.dgi")
ConvertBits(32)
crop(0, 24, 0, 24)
BM3D_CUDA(sigma=2.2, block_step=2, radius=0)
ConvertBits(8, dither=0)

Cause you edited value of block_step

joearmstrong
20th February 2022, 11:40
Cause you edited value of block_step

Yes, these were my last settings. But before, I used the default block_step setting which was also working fine. Maybe it's depending on the source video (quality/resolution) and the amount of sigma. At least I can testify that it's not broken.

tormento
18th June 2022, 13:18
I would like to try and see if AVS+ is slower than VS on BM3D CUDA with this script:

SetMemoryMax()
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\Eseguibili\Media\DGDecNV\DGDecodeNV.dll")
DGSource("F:\In\1_30 Trigun - Badlands rumble\rumble.dgi")
ConvertBits(32)
BM3D_CUDA(sigma=3, radius=2)
BM3D_VAggregate(radius=2)
fmtc_bitdepth (bits=10,dmode=8)
neo_f3kdb(range=15, Y=65, Cb=40, Cr=40, grainY=0, grainC=0, sample_mode=2, blur_first=true, dynamic_grain=false, mt=false, keep_tv_range=true)
Prefetch(8)

How would it translate in VS? I have problems understanding the way VS deals with bitdepths.

Yomiko
20th June 2022, 07:33
How do you justify whether pcie becomes the bottleneck?

ChaosKing
20th June 2022, 14:35
I would like to try and see if AVS+ is slower than VS on BM3D CUDA with this script:

SetMemoryMax()
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\Eseguibili\Media\DGDecNV\DGDecodeNV.dll")
DGSource("F:\In\1_30 Trigun - Badlands rumble\rumble.dgi")
ConvertBits(32)
BM3D_CUDA(sigma=3, radius=2)
BM3D_VAggregate(radius=2)
fmtc_bitdepth (bits=10,dmode=8)
neo_f3kdb(range=15, Y=65, Cb=40, Cr=40, grainY=0, grainC=0, sample_mode=2, blur_first=true, dynamic_grain=false, mt=false, keep_tv_range=true)
Prefetch(8)

How would it translate in VS? I have problems understanding the way VS deals with bitdepths.

Like this

import vapoursynth as vs
core = vs.core
#core.max_cache_size = 4000 # Not really needed: Set the upper framebuffer cache size after which memory is aggressively freed. The value is in megabytes.

clip = core.dgdecodenv.DGSource(r'F:\In\1_30 Trigun - Badlands rumble\rumble.dgi')

clip = core.fmtc.bitdepth(clip, bits=32)
clip = clip.bm3dcuda.BM3D(sigma=3, radius=2).bm3d.VAggregate(radius=2)
clip = clip.fmtc.bitdepth(bits=10,dmode=8)
clip = clip.neo_f3kdb.Deband(range=15, y=65, cb=40, cr=40, grainy=0, grainc=0, sample_mode=2, blur_first=True, dynamic_grain=False, mt=False, keep_tv_range=True)

clip.set_output()

clip = core.fmtc.bitdepth(clip, bits=32) is the same as clip = clip.fmtc.bitdepth(bits=32)
Python is case sensitive true is not True

guest
27th June 2022, 02:46
I just wanted to show what problems I get, when using BM3D CUDA....(Avisynth)

BM3D CPU is good :)

https://www.mediafire.com/file/ai7y4ild8fe6opn/bm3d_cuda_test.mkv/file

kedautinh12
17th July 2022, 13:28
Latest ver
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346

tormento
19th July 2022, 10:13
I read that since test8 AVX support has been removed.

Does it mean that now it requires AVX2? That would be so bad for my i7-2600k...

kedautinh12
19th July 2022, 10:40
I read that since test8 AVX support has been removed.

Does it mean that now it requires AVX2? That would be so bad for my i7-2600k...

No it's required below AVX can use this plugin

DTL
19th July 2022, 11:30
I read that since test8 AVX support has been removed.

Does it mean that now it requires AVX2? That would be so bad for my i7-2600k...

May you finally can move to about 10-years old AVX2 capable chip. The era of AVX2 still going widely. The AVX was very short transition from SSE2 to AVX2.

AVX is float only 256bit that is still slowly in compare with 16 and may be 32 bit integer AVX2 for 8 and 16bit AVS formats.

It is too slow to process of 8bit samples as 32bit floats in AVX - it makes processing samples half of possible per op. Also the available to store in register file chunk of data is half sized. Also conversions from-to float and 8/16bit unsigned int are slow (and require special limiting-saturation as separate ops that is built-in into bit-truncation packing ops of integers).

There is even an auto-saturated integer addition for 16bit arguments exist already in AVX2. It is only about 1/3 slower at some chips families in compare with standard addition. Looks saturated addition can be dispatched on 2 ports and standard addition on up to 3 ports at once so super-scalarity is only a bit limited for saturated addition.

tormento
19th July 2022, 16:19
May you finally can move to about 10-years old AVX2 capable chip.
Whenever I will get the money to do it.

Can I send you my bank account number? :p

Funny enough, now that I am saving to buy a new Intel, they disabled AVX512 and AMD enabled them.

It's a strange world.

DTL
19th July 2022, 17:35
" AMD enabled them."

AMD with AVX512 (F + BMI at least) and large cache and large core number should be a winner. Now it is unbalanced world - intel have AVX512 2048 bytes register file + nice instructions set but low core number and low cache size.

AMD have large core number and large cache but only AVX2 old 512 bytes sized register file and a decade+ old instructions set only. No nice data shift in variable byte granularity and inbetween 'registers' with single instruction to support typical moving pictures data processing operations like scaling/shifting/searching. Old hack with using palignr instruction for shift-rotate with variable bytes granularity is only work for 128bit lanes and require pairing/cascading with permutes/blends to support 256bit or data shift inbetween 256bit data chunks. It is not as nice as newer AVX512 byte moving instructions.

The era of 10+ years old AVX2 is ending and it is again new waiting time who make new winner CPU chip of both 2048bytes register file + many cores + large cache + nice new instructions for multimedia.

kedautinh12
19th July 2022, 17:54
" AMD enabled them."

AMD with AVX512 (F + BMI at least) and large cache and large core number should be a winner. Now it is unbalanced world - intel have AVX512 2048 bytes register file + nice instructions set but low core number and low cache size.

AMD have large core number and large cache but only AVX2 old 512 bytes sized register file and a decade+ old instructions set only. No nice data shift in variable byte granularity and inbetween 'registers' with single instruction to support typical moving pictures data processing operations like scaling/shifting/searching. Old hack with using palignr instruction for shift-rotate with variable bytes granularity is only work for 128bit lanes and require pairing/cascading with permutes/blends to support 256bit or data shift inbetween 256bit data chunks. It is not as nice as newer AVX512 byte moving instructions.

The era of 10+ years old AVX2 is ending and it is again new waiting time who make new winner CPU chip of both 2048bytes register file + many cores + large cache + nice new instructions for multimedia.

Intel 12th had more core

DTL
19th July 2022, 19:28
Intel 12 is strange hybrid to be partially good at new and at old applications so have only part of cores with AVX512 SIMD coprocessor and part of cores with AVX2 only. So its nightmare for threads planner - it MUST put AVX512 applications only at P-cores with AVX512 co-SIMD and never put to E-cores (or got invalid instruction crash when attempt to execute AVX512 instruction). Its magic require Win11 threads scheduler and may be special build of application. The only sad workaround for old windows is to disable degraded E-cores at all in BIOS.

Last full AVX2/AVX512 compatible desktop intel is 11.

Intel 12 may be either specially designed low-cost chip with partial AVX512 co-SIMD support on a part of cores or may be sorted out Xeon chips with defected and disabled at factory AVX512 coprocessors at one or more cores. Because full cores of AVX512 require too much transistor and power budget for general purpose desktop CPU. Xeons typically $$$$ to $$$$$ priced with all cores AVX512 support.

So intel 12 still some transient from AVX2 era to AVX512 in some possible future of desktop CPUs. AVX512 is still low supported by desktop apps and intel need to show good benchmarks at the old more or less multithreaded desktop applications with no any use of SIMD at all. Current intel production simply can not sell for $$$ the massive multicores CPUs with all cores AVX512 for a small number of AVS+ plugins and some cryptomining. The residual desktop market of CPUs require hard balance between cores number and cores complexity and cache size. AVX512 is very expensive part of core and too few used by desktop software. May be x264/265 will be redesigned to use it too someday. Typical advanced workstation for movie pictures data processing is Xeon-based.

tormento
20th July 2022, 08:28
Intel 12th had more core
Intel is laser cutting all new desktop processors not to have AVX512.

To have them back, you need to jump to Xeon and its HPC derivatives.

guest
20th July 2022, 12:42
Latest ver
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346

I wonder what the difference is between "test#9", and this :-

https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/2675015268

kedautinh12
20th July 2022, 15:59
I wonder what the difference is between "test#9", and this :-

https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/actions/runs/2675015268

Same cause it's from aabebd9 commit

DTL
20th July 2022, 16:59
About 1 year after 4th July 2021, 18:10 thread starting:

It looks new tests for season of mid-2022 ready - https://forum.doom9.org/showthread.php?p=1972003#post1972003

BM3D (CUDA ?) vs mvtools2 (DX12-ME accelerated MAnalyse + interpolated overlap MDegrainN +MVLPF +motion-adaptive thSAD) - speed/quality.

kedautinh12
26th January 2023, 13:05
New ver:
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346

SaurusX
9th March 2023, 18:17
Any idea what may be causing this error?
http://i.ibb.co/0JP3Hwy/AVS-error.jpg

I'm using MeGUI x64 build 2913.

poisondeathray
9th March 2023, 18:57
Any idea what may be causing this error?
http://i.ibb.co/0JP3Hwy/AVS-error.jpg

I'm using MeGUI x64 build 2913.


You probably need a newer version of avs+ ; bm3d requires features like arrays which are not supported in older avs+ versions

Megui 2913 was released (January 19, 2020) , the bundled avs+ version is probably too old

kedautinh12
9th March 2023, 23:52
You need update avs+ manually and use with MeGUI AvisynthWrapper from Pinterf:
https://forum.doom9.org/showthread.php?p=1913117#post1913117

Avs+ latest ver:
https://gitlab.com/uvz/AviSynthPlus-Builds

Stereodude
7th March 2025, 18:08
Sorry if this is a stupid question, but I just discovered BM3D and some of the parameters aren't so clear to me (like are there downsides other than memory / CPU usage).

Are these reasonable parameters for standard def 480p content (MPEG-2 DVD source 24p live action / not animation)?

Adjusting things by eye I have:
BM3D_CPU(sigma=5.0, block_step=3, radius=4)
BM3D_VAggregate(radius=4)

Stereodude
11th March 2025, 04:11
I'm running the last test release and it's a slideshow if chroma=true using CUDA. Chroma=true is like 1/10th the speed of Chroma = false. I get a few frames at time (seems to correlate to my prefetch setting) and long pauses in between. My GPU (3070 Ti) doesn't show that it's loaded heavily or out of memory. Has anyone seen something like this? Running on the CPU is very close in speed of chroma = true or false.

Stereodude
12th March 2025, 17:03
I'm running the last test release and it's a slideshow if chroma=true using CUDA. Chroma=true is like 1/10th the speed of Chroma = false. I get a few frames at time (seems to correlate to my prefetch setting) and long pauses in between. My GPU (3070 Ti) doesn't show that it's loaded heavily or out of memory. Has anyone seen something like this? Running on the CPU is very close in speed of chroma = true or false.
FWIW, I was trying to use this on 1080p content with a radius of 4 with chroma = true when it performed so slowly. It seems that with chroma = true the radius has a much larger effect on the speed when compared to chroma = false. A radius of 1 or 2 with chroma = true behaved much better.

Emulgator
12th March 2025, 20:59
I can confirm that if I stack algos that internally rely on BM3D (just 1 feisty2 algo which is full of BM3D anyway),
plus maybe SMDegrain(prefilter=8 (BM3D)), and sometimes a third instance of BM3D may join the party hidden somewhere),
I get a huge penalty depending on prefetch depth.
The individual depths of individual calls to BM3D overlaid by prefetch needs to shovel/calculate huge data pages back and forth, thus becoming a gridlock.
Trying to split some load into BM3D_CPU and BM3D_CUDA may help here, I tried that and it helped.
ANd if not: In harder cases I just have to split the load, tolerate an intermediate generation and run 2 passes.

Stereodude
18th March 2025, 03:42
BM3D feels like a cheat code for encoding. 1080p Blu-ray and 2160p HDR Blu-ray content that is already quite clean looking with very little to no visible apparent noise to remove will encode to about half the bitrate with the same exact same x265 settings after BM3D NR (vs. no BM3D NR). In some cases I can't even see a visible difference in terms of noise even while pixel peeping from running it through BM3D, but the resulting bitrate of the x265 encode is substantially lower. I've got CRF 18 1080p x265 encodes where the resulting video looks great to me with nothing objectionable in the encode that I can notice and the HEVC video track is smaller in size than the lossless audio for the movie. :eek:

DTL
18th March 2025, 06:53
We expect same methods to be implemented in the MPEG encoder engine so the pre-processing with 'external denoising' can be skipped. Some motion to this way may be in the AV1 coder.

tormento
18th March 2025, 09:12
We expect same methods to be implemented in the MPEG encoder engine so the pre-processing with 'external denoising' can be skipped. Some motion to this way may be in the AV1 coder.


When? :)

BTW BM3D is my favorite denoiser by far.

I hope it won’t become an abandonware as it has still some great potential such as running the temporal part in the GPU routine or having the capability to run multiple pass with lower settings, such as SMSegrain does, without leaving GPU memory space. I tried to ask Asd~G to maintain it but he is not interested. Perhaps Pinterf could maintain it as it does with KNLMeansCL.

cubicibo
18th March 2025, 10:39
What's a "MPEG encoder engine"? VTM? Unusable.

Z2697
18th March 2025, 17:01
Personally speaking, if a encoder has a denoising feature, I definitely don't want to use it (on anything I actually care about).

It means you have the denoising based on a process that's highly dependent on the encoding process, and there's virtually no way to verify / evaluate the effect without doing the encoding, and the added encoding distortion.
The result will vary based on the encoding settings, including quality / bitrate! (there's a bunch of settings that can cause the ME result to change, other than the ME settins)
Even the denoising itself will probably change the ME result.
The granularity of the ME also cannot be changed (otherwise where's the difference than denoise separately?), you only have the PU level MVs, or even worse, look-ahead rough search.
The goal of ME also not quite the same. Denoising VS Encoding, obviously. I know there must be a lot of overlap between these two, but still not the same.

It also means you equivalently have the denoising as the absolute final step of your pre-processing. (if you are planning to do denoising only, then great, it might actually not that big of a problem, but still, consider the previouslyt described problems)
Which may... just maybe fine sometimes, but not ideal.

If you just want a encoder feature that "beat 'em up and save bits", then that's probably it, but other than that, I'd say I'm very doubtful.
A good encoder should be good at one thing, and one thing only, that's encoding.

DTL
18th March 2025, 17:34
Typically most of MPEG encoders already working as denoising engines but with very poor quality. Because they can not fit all possible input noise-data into typically required output bitrate. Making input less noisy mean encoder can make better image without wasting bits to encode noise.

"Even the denoising itself will probably change the ME result."

Yes - you can see it in multi-generation method for mvtools. It also takes lots of computing resources because instead of single pass ME+block_averaging we need to make many sequential ME+block_averaging with lower settings in attempt to have less details missed.

The ME engine of BM3D may be also adapded to this method - only required to add the second input-clip to ME engine. Typically ME engine of denoisers (and MPEG encoders) work with single input clip and search ME of current frame vs other frame of the same input clip.

For multi-generation denoise the ME engine search current frame vs frame from different input clip.

1st generation denoise - ME engine work with single imput clip. Searches of current frame vs other frame on the input clip (max noised).
Nth generation denoise - ME engine work with N-1 generation denoised clip and original noisy input clip. This allows to search vs non-distorted input and miss less details.

"The goal of ME also not quite the same. Denoising VS Encoding,"

Denoising ME must be more perfect - error in ME for denoising cause details loss/degradation. Error in ME for MPEG encoding only cause bitrate increasing because of less motion-compensated data found. It also mean hardware ME engines that we have in GPUs are from MPEG encoders and not designed to be very great quality.

The ME engine for denoiser may be several orders of 10-magnitude more complex (in computing complexity) in comparison with 'already very slow' MPEG encoder ME. Because we have lots of methods to make MVs better by statistical analysis. But it require lots of ME engines running in parallel and also in many generations of MVs refining.

Z2697
18th March 2025, 18:01
Block matching is not motion estimation, I think.

DTL
18th March 2025, 18:07
BM marked as 3D works in both same frame (2D) and +1D temporal. It can run on single frame only in 2D mode (?). It come from static image denoise when single frame denoise also required. Same as KNLmeans method.

Z2697
18th March 2025, 19:44
BM3D is pure spatial denoiser. The third dimension is the "matched blocks", IIRC.
A "temporal" version is called V-BM3D. But I think it still isn't doing motion estimation.
The "temporal effectiveness" of V-BM3D is very limited, because there's no motion compensation, and the "temporal matching" part works differently than NLMeans.

DTL
19th March 2025, 01:55
BM3D is spatio-temporal with 'very big' possible temporal 'radius' up to 16 - http://avisynth.nl/index.php/BM3DCUDA

int radius = 0
The temporal radius for denoising, valid range [1, 16].
For each processed frame, (radius * 2 + 1) frames will be requested, and the filtering result will be returned to these frames by BM3D_VAggregate.
Increasing radius only increases tiny computational cost in block-matching and aggregation, and will not affect collaborative filtering, but the memory consumption can grow quadratically.
Thus, feel free to use large radius as long as your RAM is large enough :D

"because there's no motion compensation,"

I think block-matching directly mean finding and averaging only 'matching' blocks - it mean both search and 'compensation' in the same frame and in the several frames.

Z2697
19th March 2025, 03:06
BM3D is spatio-temporal with 'very big' possible temporal 'radius' up to 16 - http://avisynth.nl/index.php/BM3DCUDA

int radius = 0
The temporal radius for denoising, valid range [1, 16].
For each processed frame, (radius * 2 + 1) frames will be requested, and the filtering result will be returned to these frames by BM3D_VAggregate.
Increasing radius only increases tiny computational cost in block-matching and aggregation, and will not affect collaborative filtering, but the memory consumption can grow quadratically.
Thus, feel free to use large radius as long as your RAM is large enough :D

"because there's no motion compensation,"

I think block-matching directly mean finding and averaging only 'matching' blocks - it mean both search and 'compensation' in the same frame and in the several frames.

I know.
It's called VBM3D.
Not "3D meaning temporal".

Stereodude
20th March 2025, 13:40
BM3D is pure spatial denoiser. The third dimension is the "matched blocks", IIRC.
A "temporal" version is called V-BM3D. But I think it still isn't doing motion estimation.
The "temporal effectiveness" of V-BM3D is very limited, because there's no motion compensation, and the "temporal matching" part works differently than NLMeans.
What is the radius parameter doing in BM3D? The documentation says it looks across multiple frames of video (as long as the radius isn't set to 0).

I didn't test this aspect too much, I mostly picked radius settings that fit in the memory of my GPU and didn't slow encoding too much, but in my brief tests I didn't see much difference in the radius setting, though I have to be honest, I don't know what I should have looked for or in what sort of content it would make a difference.

tormento
20th March 2025, 14:48
What is the radius parameter doing in BM3D? The documentation says it looks across multiple frames of video (as long as the radius isn't set to 0).

I didn't test this aspect too much, I mostly picked radius settings that fit in the memory of my GPU and didn't slow encoding too much, but in my brief tests I didn't see much difference in the radius setting, though I have to be honest, I don't know what I should have looked for or in what sort of content it would make a difference.


The larger radius you give, the more precise the denoising is, mostly for high denoise values. There is a precise formula to calculate memory consumption on the GitHub repo.

Stereodude
20th March 2025, 16:20
The larger radius you give, the more precise the denoising is, mostly for high denoise values. There is a precise formula to calculate memory consumption on the GitHub repo.
What is considered a high denoise (sigma?) value?

Z2697
20th March 2025, 16:45
What is the radius parameter doing in BM3D? The documentation says it looks across multiple frames of video (as long as the radius isn't set to 0).

I didn't test this aspect too much, I mostly picked radius settings that fit in the memory of my GPU and didn't slow encoding too much, but in my brief tests I didn't see much difference in the radius setting, though I have to be honest, I don't know what I should have looked for or in what sort of content it would make a difference.

BM3D, for each "block to be denoised", finds similar block (matching) and group them like a "pillar" which is where the third dimension comes from, and then do the rest steps.
V-BM3D, as I understand it, extends the matching range to adjacent +- "radius" frames, the rest is pretty much the same.

tormento
20th March 2025, 18:25
What is considered a high denoise (sigma?) value?
I usually set sigma=4 for clean source up to 10-12 for bad ones but, in that case, more processing is often needed. I read that BM3D gives the best with sigma > 8 but I find it pleasant even with 4 for recent BDs.

For some strange reason, even values of sigma give better results than odd ones.

Stereodude
20th March 2025, 19:59
I usually set sigma=4 for clean source up to 10-12 for bad ones but, in that case, more processing is often needed. I read that BM3D gives the best with sigma > 8 but I find it pleasant even with 4 for recent BDs.

For some strange reason, even values of sigma give better results than odd ones.
Interesting... I've found that a sigma of 2.0 is plenty for 1080p BD sources that have no to very little frame to frame "grain"/noise on top of the image. For really clean BDs there are no readily apparent differences in the post processed output image, but after BM3D it compresses considerably better.

2.5 or 3.0 clean up light grain/noise nicely. By the time the grain/noise gets really heavy I've found large sigma values negatively affect sharpness and detail making the image look unnatural/overly processed. I prefer to use a sigma of like 5 to knock down the finer parts of the grain/noise which helps compressability significantly, but leaves visible coarseness which presumably the director wanted. Obviously the compressed HEVC video track has higher bitrates than a clean source would, but they're still smaller than the source and look more pleasing to my eyes than going crazy with the sigma.

I hadn't noticed anything about whole numbers or even numbers vs odd or fractional settings.

Z2697
20th March 2025, 23:44
I usually use 1 or even less sigma LOL
And because BM3D and even VBM3D is not great at temporal noise I use it together with MDegrain, or even as it's reference, or limit (like this (https://github.com/Mr-Z-2697/z-vsPyScripts/blob/b427bf5ffc54bb4abfaf72b373b8d39fe332e2a5/zvs.py#L242-L247), as I stole the idea from MCTD)
BTW the sigma of BM3D (mawen1250) and BM3DCUDA/CPU (WolframRhodium) does not have exact same effect, somehow. The latter is roughly 5/3 times "stronger" in my opinion. It's BM3DCUDA I was talking about in first line.

Stereodude
21st March 2025, 00:09
I usually use 1 or even less sigma LOL
And because BM3D and even VBM3D is not great at temporal noise I use it together with MDegrain.
BTW the sigma of BM3D (mawen1250) and BM3DCUDA/CPU (WolframRhodium) does not have exact same effect, somehow. The latter is roughly 5/3 times "stronger" in my opinion. It's BM3DCUDA I was talking about in first line.
I also gave BM3DCUDA/CPU numbers. I found very little downside to using a really higher sigma value like 8 on the first few discs I tried it on where 2.5 or 3 would have done the trick. On clean sources in static shots a high sigma doesn't really seem to negatively affect the image from what I could see. I subtracted the after BM3DCUDA image from the source to see what it was removing / changing. When content is really noisy was where I started re-evaluating the idea of using a higher than necessary sigma. Things that are moving quickly or camera movement were blurred inconsistently or perhaps erroneously with high sigma values (like 10+). I was stepping through it frame by frame, not watching it in motion, so maybe in motion it wouldn't have been noticeable, but it didn't sit well with me.

Z2697
21st March 2025, 05:42
The "visibility" of the effect, by the same sigma, whether it's downside or not, will vary depending on the noise strength. For most contents I normally filter, sigma=3 already looks bad.

tormento
22nd March 2025, 10:05
The only negative side of BM3D is that, with high sigma values, it can expose the underlying blockiness of high crf values, previously hidden by grain/noise. Unfortunately, when that happens, there is very little you can do. Once the compression went too high, you have to deal with that blocks in some way. One good example is Evangelion BDs, where they applied too much AVC compression over an unprocessed very bad master. You have to choose between bad noise or blockiness. Any hint is welcome.

Z2697
22nd March 2025, 11:41
High sigma blockiness comes from the block_step (being > 1).
Which I think, is always there, just lower sigma makes less significant.
Lower block_step makes it less significant as well, and like what mawen1250 does in his wrapper, having the 2 steps use different block_step also helps.

DTL
22nd March 2025, 16:19
You have to choose between bad noise or blockiness. Any hint is welcome.

There are very many methods possible. First you can try to use (many ?) 'deblock' plugins before denoise.

Next is to make processing of several copies of the clip with somehow shifted block-tesselation grid and calculate average of the result. Same as overlapped processing in mvtools. The external plugin exist for overlapped averaging - BlockOverlap.

Z2697
23rd March 2025, 00:00
No you shouldn't. The block is created by BM3D, you should tweak the settings instead of degrading it further.

tormento
23rd March 2025, 11:15
Next is to make processing of several copies of the clip with somehow shifted block-tesselation grid and calculate average of the result. Same as overlapped processing in mvtools. The external plugin exist for overlapped averaging - BlockOverlap.
That goes beyond my average AVS script writing. :p

Will try VsDeblockPP7.

DTL
23rd March 2025, 15:39
The block is created by BM3D,

If BM3D create blockiness - it is also possible to decrease it using 2 processing pipelines of original and shifted clips and aggregate at the output with BlockOverlap plugin. If the block-tesselation grid of the BM3D is rectangular and stable it may work good enough.

Script is simple to test:

orig=last
shifted=Crop+AddBorders to shift in H and V directions to 1/2 of block size

orig_fitered=BM3D(orig)
shifted_filtered=BM3D(shifted)

BlockOverlap(orig_filtered, shifted_filtered) (apply crop-shift back if required by BlockOverlap - not remember it right)

If cropping is not nice and edges quality must be highest - the orig and shifted clips may be created with AddBorders only with a bit bigger frame size and Crop added sides after BlockOverlap.

BM3D may be very old and abandoned so developers do not add internal overlapped processing to decrease output block artifacts like was added in mvtools.

tormento
23rd March 2025, 17:35
BM3D may be very old and abandoned so developers do not add internal overlapped processing to decrease output block artifacts like was added in mvtools.
BM3D isn't old, it's just been "abandoned" as it happens whenever it's one person only to create builds. IMHO it's one of the best denoisers so far.

DTL
23rd March 2025, 20:14
If developer still active and the filter create block artifacts - you can try to ask about implementing block overlapping to decrease it. It may be somehow better in performance in comparison with scripted form. Also BlockOverlap support only 2x-diagonal offset mode and with other software methods you can use 4x overlap like default in mvtools with overlap=blocksize/2. It makes better quality but takes 4x more blocks to process.

tormento
23rd March 2025, 20:19
If developer still active and the filter create block artifacts - you can try to ask about implementing block overlapping to decrease it. It may be somehow better in performance in comparison with scripted form. Also BlockOverlap support only 2x-diagonal offset mode and with other software methods you can use 4x overlap like default in mvtools with overlap=blocksize/2. It makes better quality but takes 4x more blocks to process.


Good idea. I opened an issue and I hope he will read it.

Z2697
23rd March 2025, 21:10
block_step

Did you saw that

Of course, this is not the same as block overlapping, and block overlapping can well be applied separately

tormento
25th September 2025, 11:21
@pinterf or anyone else with good will and golden heart :)

Would someone please port the last version of VapourSynth-BM3DCUDA (https://github.com/WolframRhodium/VapourSynth-BM3DCUDA) to AVS+?

That's a great denoiser filter with both temporal and spatial capabilities, not relying on motion vectors but on block matching.

The last versions add support to 50xx nVidia cards plus other benefits.

Thank you. ;)