# Simple MDegrain Mod v3.1.2d - A Quality Denoising Solution

1. That did the trick, seems my Visual Studio was only up to 2010...

Have you ever tried AviSynth+?
2. Yeah, don't like installing things either. Added a note to documentation.

Haven't tried Avisynth+, I still use some obscure plugins that's why.
3. All of my plugins are obscure, at least to me, ha ha. And I know what you mean about installing things, although it's really nice to have updates know where to go with very little effort.
4. Hi Dogway,

Firstly thank you for creating this script and also keeping maintained.

Quick question.

When encoding with all chroma off would this allow me to set much higher thSAD value and lessen the risk of ghosting?

the script I'm using is

But in some cases where large chunks of noise bloats the encoding (e.g. Lock, Stock And Two Smoking Barrels, Young Frankenstein, Highlander) i have used the following settings to halve the resulting CRF20 bitrate.
I have checked the output of these 3 movies using the above settings both on computer and TV and i can't see any ghosting occurring. i've attached a comparison between the original and re encoded.
5. No, disabling chroma motion vectors only works in very bad sources, like low resolution blocky ones.
This is a fairly good BDR source so it doesn't make any improvements other than speed.

If you like the results use whatever suits you.
6. @Dogway: the last old plugin your script use is RemoveGrainHD for the Quantile function. On Doom9 forum people told me it could be easily removed with some script lines. Is it a good idea? Could it be implemented in the next version? Thanks!
7. It depends. First we would need a median blur with a bigger window that is modern (more than RemoveGrainHD), then make it work with YUY2 sources adding some lines in case that's possible as you were suggested in Doom9.

A modern version would be this tp7's mod of MedianBlur, but as you can read MedianBlur2 performance at MinBlur's r=2 (what SMDegrain uses for HD) is worse than original MedianBlur. Not sure how that compares to Quantile.

Are you having any problem with RemoveGrainHD?
8. Originally Posted by Dogway
Are you having any problem with RemoveGrainHD?
No, I'm a maniac of updating things
9. Hi Dogway, I hope you're well . Having rerereread your SMDegrain .html, I'm again testing some clips with "Chroma=False" in order to (hopefully) gain a bit of speed without a noticeable loss in quality. My basic script for a 1080p live action source is:

Code:
# Set DAR in encoder to xxxx : xxxx. The following line is for automatic signalling
global MeGUI_darx = xxxx
global MeGUI_dary = xxxx
SetMemoryMax(768)
SetMTMode(3,7)
LWLibavVideoSource("SourcePath")
SetMTMode(2)
#deinterlace
#crop
#resize
#denoise
FastLineDarkenMod()
GradFun3()
The results to my eyes look the same (with and without "Chroma=False"), but I remember from your now defunct Doom10 thread a post from someone, I can't remember who, claiming that setting "Chroma=False" had an occasional adverse effect on the creation of the motion vectors. Have you ever experienced this? Thanks!
10. It's a bug in mvtools, but only if you filter chroma with luma vectors, which is not the case since you are using plane=0. I Might release a version 3.1 soon with some minor tweaks, one of them is triggering an error when trying that so nobody does funny stuff.

You mean 200~600 right? I recommend you to output smdegrain in lsb stacked, and use GradFun3 with lsb_in=true, then FastLineDarkenMod()
11. Originally Posted by Dogway
It's a bug in mvtools, but only if you filter chroma with luma vectors, which is not the case since you are using plane=0[Emphasis LouieChuckyMerry]. I Might release a version 3.1 soon with some minor tweaks, one of them is triggering an error when trying that so nobody does funny stuff.
Thanks for the clear answer; now I understand a tiny bit more .

Originally Posted by Dogway
You mean 200~600 right? I recommend you to output smdegrain in lsb stacked, and use GradFun3 with lsb_in=true, then FastLineDarkenMod()
Yes, I meant that my "thSAD" is almost always between 200 and 600. Are you then suggesting:

Code:
# Set DAR in encoder to xxxx : xxxx. The following line is for automatic signalling
global MeGUI_darx = xxxx
global MeGUI_dary = xxxx
SetMemoryMax(768)
SetMTMode(3,7)
LWLibavVideoSource("SourcePath")
SetMTMode(2)
#deinterlace
#crop
#resize
#denoise
FastLineDarkenMod()
Edit: wow, a quick test with the above changes shows a 20% speed increase. Thanks! I need to play with SetMemoryMax and SetMTMode to find the best new numbers (thank Buddha for AVSMeter), as this is an additional recent change to my base script, but a few days testing should do the job. As always, thanks for your kind help, Dogway .
12. hi

with SMDegrain(show=true,interlaced=true)

I get
13. Thanks for the report, I already fixed it for v3.1d. I guess I forgot to test interlaced sources at the time.
14. Post Deleted.
15. In the process trying to figure out the Dither-10 bit x264 thing I bumped into this and noticed that SMDegrainMod is still linked to the now defunct Doom10 thread. I don't know if you care, but I thought I'd point it out in case you do .

Edit: next time I'll check the links, sorry to bother you, and I wish there was a "Delete" option...
16. v.3.0d

Smdegrain(Prefilter=2,Show=true)

is there something i typed wrong way in smdegrain?

17. PHP Code:
 #SetMTMode(5) SetMemoryMax(2048) LoadPlugin("D:\eseguibili\media\[url=https://www.videohelp.com/software/DGAVCDec]DGDecNV[/url]\[url=https://www.videohelp.com/software/DGMPGDec]DGDecodeNV[/url].dll") DGSource("E:\in\1_48 Indovina chi viene a cena\indovina.dgi") CompTest(1) ChangeFPS(last,last,true) #SetMTMode(2) SMDegrain (tr=6,PreFilter=4,thSAD=600,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6) #SMDegrain (tr=6,PreFilter=2,thSAD=600,contrasharp=false,refinemotion=true,lsb_out=true,plane=4,chroma=true,Globals=2) #SMDegrain (tr=6,            thSAD=600,contrasharp=false,refinemotion=true,lsb_in =true,plane=4,chroma=true,Globals=1,mode=6) #Distributor()  
Any idea?
18. Worked for me. Did you update to latest Dither 1.27?
Due to the error message it could be one of the KNLMeans dependencies, do you have Visual C++ 2013 Redistributable (x86)? Otherwise try to update CL drivers (nvidia or Intel HD drivers).
19. Originally Posted by Dogway
Worked for me. Did you update to latest Dither 1.27?
Due to the error message it could be one of the KNLMeans dependencies, do you have Visual C++ 2013 Redistributable (x86)? Otherwise try to update CL drivers (nvidia or Intel HD drivers).
20. A question, do you have a discreet GPU (Nvidia, AMD)?
I have my iGPU disabled on BIOS, so this could be a matter of defaulting to IntelCL instead of your other GPU (although it should work either way).
21. Originally Posted by Dogway
A question, do you have a discreet GPU (Nvidia, AMD)?
I have my iGPU disabled on BIOS, so this could be a matter of defaulting to IntelCL instead of your other GPU (although it should work either way).
Discreet Nvidia as main GPU. Intel one enabled in bios as I do tests with Intel video decoders.

Want to use Nvidia as it is faster.
22. yeah, probably that's the reason, KNLMeans (for some reason) may want to default to Intel, while your main system's GPU is the Nvidia. I will try to reproduce this and change according.
23. Originally Posted by Dogway
yeah, probably that's the reason, KNLMeans (for some reason) may want to default to Intel, while your main system's GPU is the Nvidia. I will try to reproduce this and change according.
Ok, keep on scripting

KNL is really a nice prefilter, even if I upped strenght to 7.5 as from official thread.

Got really nicer results than with prefilter=2.
24. Looks like the default "auto" for KNLMeans is a bit dumb and won't prefer a discrete card over an internal. It uses the system's default OpenCL order which more often than not is the iGPU. I will add device_type="GPU", although this will trigger an error for those guys using only iGPU, so you will need yes or yes a dedicated video card (not willing to pass through another setting). I will change back to "auto" when the developer refines this aspect.

As for the error, I tested this morning with both GPU's enabled and also only iGPU and both worked without issues, so there must be something going on your side (lack of updated iGPU drivers?).
25. Sorry for my last comment , show=true issue is permanent eradicated in new version now working perfect in v.3.1.1d.
Thank you very much for this heavy filter
26. Thanks for the update, Dogway, and Happy Saturday! In case there are actually others as slow as I am (doubtful), v3.1.1d requires upgrading to the newest Dither.dll, otherwise you'll receive the error message "Ditherpost does not have a named argument 'slice'".
27. Yes I think it's noted on documentation. If I'm not wrong from v1.27 onwards.
28. I'm sure you're right. I've been using v1.25.1, didn't know there was an update until I updated SMDegrain. Someday...
29. with
Code:
prefandmf = dfttest()
SMDegrain(prefilter=prefandmf)
I get
30. Works here. What source are you using? YUY2, interlaced, HD? Avisynth version?
edit: Ok, it's fixed now.

Statistics