Log in

View Full Version : BM3D (VapourSynth) versus MVTools


Pages : [1] 2 3 4 5

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