Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th October 2019, 05:13   #1361  |  Link
aymanalz
Registered User
 
Join Date: May 2015
Posts: 68
Quote:
Originally Posted by Cary Knoop View Post
I recommend testing it, there is no one cookie-cutter setting.

For instance, use a combination of stack horizontal and vertical to create a video matrix with various settings, pick the one that is most to your liking.

Or interleave various settings and go through them one by one.

Alternatively, you might want to opt for BM3D for removing grain. It's slow though, until someone ports a GPU version (hint, hint, wink, wink).
Someone has ported BM3D to GPU, but it is in prototype stage as of now. (So says the Vapoursynth wiki.)

I'd prefer to use the GPU for degraining, as my encoding is already very slow. That's why I'm trying KNLmeansCL.

In general, for removing grain, does increasing the temporal parameter (d) help? How high can I increase the h parameter, without starting to lose other details?

Are there any grain removal specific combinations of the settings?

Also, which weighting function should I use?
aymanalz is offline   Reply With Quote
Old 14th October 2019, 18:40   #1362  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by aymanalz View Post
Are there any grain removal specific combinations of the settings?

Also, which weighting function should I use?
Testing is the answer to your questions!

There are no magic settings.
Cary Knoop is offline   Reply With Quote
Old 14th October 2019, 19:33   #1363  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
There's no formal definition of "grain", so we can't be sure what you mean by degraining. For me, grain is a film thing and it doesn't cross frames, so temporal processing is not needed. Tell us more or better still give us a sample.
videoh is offline   Reply With Quote
Old 14th October 2019, 19:40   #1364  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by videoh View Post
For me, grain is a film thing and it doesn't cross frames, so temporal processing is not needed.
How on Earth did you make the conclusion that temporal processing is not needed?

What you say is completely wrong!
Cary Knoop is offline   Reply With Quote
Old 14th October 2019, 20:09   #1365  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Cary is throwing a narc tantrum because someone has a different opinion.
videoh is offline   Reply With Quote
Old 14th October 2019, 20:56   #1366  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,806
Quote:
Originally Posted by videoh View Post
There's no formal definition of "grain", so we can't be sure what you mean by degraining. For me, grain is a film thing and it doesn't cross frames, so temporal processing is not needed. Tell us more or better still give us a sample.
You obviously have never used temporal mdegrain1/2/3 filter If you think that temporal processing is basically useless.
Atak_Snajpera is offline   Reply With Quote
Old 14th October 2019, 21:15   #1367  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
I never said "temporal processing is basically useless", which means you are a scoundrel. DG is still living rent-free in your head. Loving it!

Last edited by videoh; 14th October 2019 at 21:20.
videoh is offline   Reply With Quote
Old 14th October 2019, 21:29   #1368  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,806
Quote:
Originally Posted by videoh View Post
I never said "temporal processing is basically useless", which means you are a scoundrel. DG is still living rent-free in your head. Loving it!
Temporal mdegrain will always give you better quality than knlmeanscl or any other spatial filter. Deal with IT. Spatial denoising like knlmeanscl destroys details like crazy. After all those years You are still such a noob...
Atak_Snajpera is offline   Reply With Quote
Old 15th October 2019, 07:15   #1369  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,752
No religious wars, please. Thank you.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 22nd October 2019, 20:12   #1370  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Question about KNLMeansCL: Would it be beneficial to detect pre-deinterlace noise patterns with this filter or should this filter only be used after proper deinterlacing?
Cary Knoop is offline   Reply With Quote
Old 22nd October 2019, 21:39   #1371  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by Cary Knoop View Post
Question about KNLMeansCL: Would it be beneficial to detect pre-deinterlace noise patterns with this filter or should this filter only be used after proper deinterlacing?
progressive only, otherwise it will mess up the fields

either a) double rate deinterlace; or b) separate grouped even /odd fields and apply to each separately then weave back . For (b) you retain original fields, but you don't get temporal denoising between even/odd fields . I would say (a) is preferred
poisondeathray is offline   Reply With Quote
Old 22nd October 2019, 21:57   #1372  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by poisondeathray View Post
progressive only, otherwise it will mess up the fields

either a) double rate deinterlace; or b) separate grouped even /odd fields and apply to each separately then weave back . For (b) you retain original fields, but you don't get temporal denoising between even/odd fields . I would say (a) is preferred
When I wrote interlaced I actually meant to use option b.

I was thinking about doing a first run using option b and then deinterlace (with frame doubling) and apply a second run.
But the question is if that is worth it?

Last edited by Cary Knoop; 22nd October 2019 at 21:59.
Cary Knoop is offline   Reply With Quote
Old 22nd October 2019, 22:09   #1373  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by Cary Knoop View Post
When I wrote interlaced I actually meant to use option b.

I was thinking about doing a first run using option b and then deinterlace (with frame doubling) and apply a second run.
But the question is if that is worth it?
You can try it; but I don't think it's worth it in general (for other denoisers as well, not just KNLMeansCL) . When you process even/odd separately , you can introduce a type of flicker because you don't even out the pattern between even/odd

If there was some type of defect limited to , say the even fields, then you might do that as to not contaminate the other odd fields with temporal processing (denoising or double rate deinterlacing with temporal smoothing like QTGMC). Or if one group had more noise (e.g. maybe chroma noise) than the other , you might preprocess them separately with different strengths and filters applied to even vs. odd
poisondeathray is offline   Reply With Quote
Old 26th October 2019, 12:47   #1374  |  Link
aymanalz
Registered User
 
Join Date: May 2015
Posts: 68
KNLmeansCL seems to have no effect on the output file when the weighing function chosen is anything other than Welsch. Has anybody else experienced this? During the encode, the GPU runs at high power, but the output file remains un-denoised, if I select any other weighing function.

I mentioned this to @selur, as I thought it's a bug in his program "Hybrid", and he was able to confirm the bug - but he stated that the bug is in KNLmeansCL.

Last edited by aymanalz; 26th October 2019 at 17:08.
aymanalz is offline   Reply With Quote
Old 26th October 2019, 13:21   #1375  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Hybrid properly uses:
Code:
clip = core.knlm.KNLMeansCL(clip=clip)
clip = core.knlm.KNLMeansCL(clip=clip, wmode=1)
clip = core.knlm.KNLMeansCL(clip=clip, wmode=2)
clip = core.knlm.KNLMeansCL(clip=clip, wmode=3)
no error occurs, but interleaving the filtered and unprocessed frames does not show a differenc if wmode != 0.
(Hybrid uses KNLMeansCL 1.1.1)

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 26th October 2019, 16:36   #1376  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by aymanalz View Post
KNLmeansCL seems to have no effect on the output file when the weighing function chosen is anything other than Welsch. Has anybody else experienced this?
I have no problem with for instance Modified Bisquare on Vapoursynth.
Cary Knoop is offline   Reply With Quote
Old 26th October 2019, 17:11   #1377  |  Link
aymanalz
Registered User
 
Join Date: May 2015
Posts: 68
Quote:
Originally Posted by Cary Knoop View Post
I have no problem with for instance Modified Bisquare on Vapoursynth.
What program do you use? Hybrid or Staxrip or...

Additionally, and I'm not sure if this is important, but what are you encoding from and to? x264/x265/something else?

Last edited by aymanalz; 26th October 2019 at 17:16.
aymanalz is offline   Reply With Quote
Old 26th October 2019, 18:30   #1378  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by aymanalz View Post
What program do you use? Hybrid or Staxrip or...

Additionally, and I'm not sure if this is important, but what are you encoding from and to? x264/x265/something else?
Just straight Vapoursynth piped to FFmpeg.

No, the codec is not relevant. When I do a diff using Vapoursynth Editor, I can see a clear difference.
Cary Knoop is offline   Reply With Quote
Old 27th October 2019, 06:14   #1379  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
You are right there are differences using:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2k.dll")
# Loading source using FFMS2K
clip = core.ffms2.Source(source="F:/TESTCL~1/files/test.avi",cachefile="E:/Temp/avi_078c37f69bb356e7b5fa040c71584c40_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
original = clip
# denoising using KNLMeansCL
clip = core.knlm.KNLMeansCL(clip=clip, wmode=2)
# adjusting for FilterView
if original.format.id != clip.format.id:
 if (original.format.color_family == vs.RGB and clip.format.color_family != vs.RGB):
   original = core.resize.Bicubic(original, format=clip.format.id, matrix_s="470bg", range_s="limited")
 elif (original.format.color_family == clip.format.color_family):
   original = core.resize.Bicubic(original, format=clip.format.id, range_s="limited")
 else:
   original = core.resize.Bicubic(original, format=clip.format.id, matrix_in_s="470bg", range_s="limited")
diff = core.std.MakeDiff(clip, original)
# Output
diff.set_output()
I can see differences even when not using wmode=9, but they are way less then when using wmode=0.
Instead of
Code:
diff = core.std.MakeDiff(clip, original)
# Output
diff.set_output()
Hybrid uses something like:
Code:
original = core.text.Text(original,"Original")
clip = core.text.Text(clip,"Filtered")
interleaved = core.std.Interleave([original, clip])
# Output
interleaved.set_output()
-> Looks to me like neither a bug in Hybrid or the filter, but simply that with wmode=2 those subtle differences are really hard to spot when looking at the frames itself.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 27th October 2019, 07:00   #1380  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Out of curiosity why all the testing of the color format? KNLMeans does not convert the format. Also for YUV by default color is not processed.
Cary Knoop is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:27.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.