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 1st January 2019, 18:58   #161  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Quote:
Originally Posted by zorr View Post
When doing denoising you need to make a clip with added noise, then remove the noise and finally compare the denoised clip with the original. See here for an example. I have thought about other ways to do it but this is currently the most reliable way.
I see, that makes more sense although it kind of becomes a synthetic test since normally we don't have a ground truth to compare to. I'll be doing grain modeling with GrainFactory instead since it resembles more film grain.

I thought on using the dynamic mode because if I only use iterations I felt it was being stucked into some ranges.
Leaving it at low iterations and 5 run cycles it would get out of said ranges but now it would totally ignore past cycle logs which is undesired. I will try to do some other tests with low cycles and high iterations.
Dogway is offline   Reply With Quote
Old 1st January 2019, 21:24   #162  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Following your indications and still get the least-change variables.

Best result:
Code:
smdegrain(tr=1,thSAD=100,contrasharp=0,prefilter=0,blksize=32,overlap=12,divide=0)
Not sure if I'm doing something wrong. If you need my scripts please tell me and I upload them.
Dogway is offline   Reply With Quote
Old 1st January 2019, 22:41   #163  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by Dogway View Post
Not sure if I'm doing something wrong. If you need my scripts please tell me and I upload them.
Yes that's a good idea. I will take a look.

[EDIT] I have a suspicion of what the problem is. If your video is very grainy then the degraining process cannot remove a lot of noise in order to look like the original. This add noise -> remove noise -> compare only works well when the original video doesn't have much (or any) noise. You could try finding a part of the video where there is very little noise or perhaps even use a completely different video (with very little noise but similar content and movement) as the source in the optimization.

Last edited by zorr; 1st January 2019 at 22:52.
zorr is offline   Reply With Quote
Old 1st January 2019, 22:55   #164  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Here's the link with the 3 clips. A slightly modified version of smdegrain to test contrasharp and divide. Prefilter has a few dependencies so you might want to comment it.

Last edited by Dogway; 4th January 2019 at 00:32. Reason: Removed link
Dogway is offline   Reply With Quote
Old 1st January 2019, 23:56   #165  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by Dogway View Post
Here's the link with the 3 clips.
Thanks. I don't know why but my 7zip says it doesn't support the compression method. I downloaded the latest version but apparently it needs a reboot in order to install and I'm in the middle of optimization process so I don't want to do it now. Can you provide the files in another zip format?
zorr is offline   Reply With Quote
Old 2nd January 2019, 03:01   #166  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Zorr, My version 7zip from April 2018 opens Dogway zip no problem, yours must be reasonably old version.

Latest update 2 days ago, 2018 Dec 30:- https://www.7-zip.org/download.html

No reboot required here (x64 version).
I think about 12 -> 18 months ago, some fancy new algo was added to 7zip.

For 7zip using zip archive, should perhaps set to Normal compression,
and whatever you wish for 7z archives.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd January 2019 at 03:25.
StainlessS is offline   Reply With Quote
Old 2nd January 2019, 22:29   #167  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by Dogway View Post
Here's the link with the 3 clips. A slightly modified version of smdegrain to test contrasharp and divide.
Is your modified version uploaded somewhere? Looks like the latest released SMDegrain version (v3.1.2.100s) doesn't have the divide argument. And it would be a good idea to use the exact same function anyway so we can compare results.

The source video doesn't have any grain so it should work well...

I'm going to have to delay the testing a bit because I also need to update MVTools2 and the optimization task I'm running uses an older version. I don't want to do anything radical while it's running... should be done tomorrow.
zorr is offline   Reply With Quote
Old 2nd January 2019, 22:43   #168  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by ChaosKing View Post
I would be nice if we would have also halo and "other crap" simulators to easily test (optimize) other kinds of filters.
The halo removal is something I have thought about. Using a synthetic test is probably not useful there because the effect is unique in every video so it needs customized parameters.

The way I would do it: take a single frame (or even a small part of the frame) where the halo effect is clearly visible and use Photoshop or whatever to remove it manually (using the clone stamp tool for example). Then use a halo removal filter in AviSynth and optimize its parameters so that it replicates the result. The same parameters should then work well for the whole video.
zorr is offline   Reply With Quote
Old 2nd January 2019, 22:44   #169  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Here it is, in the rush I forgot to include it. This is not a release or anything, I modified it a bit to test divide and integer type data for contrasharpening (the generic "val" data type wasn't suited for the variable). I skipped prefilter=3 because I can't make dfttest work on my end. The denoised version was denoised with: smdegrain(tr=3,thSAD=250,contrasharp=40,prefilter=2,blksize=16,overlap=8,divide=0,refinemotion=true,lsb=true). Which is (maybe?) a good starting point for grainy 1080p, in lack of better denoisers for avs+ like BM3D.

Whenever you have time is ok, I use the mvtools2 from pinterf github.

Last edited by Dogway; 2nd January 2019 at 22:46.
Dogway is offline   Reply With Quote
Old 2nd January 2019, 23:04   #170  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by Dogway View Post
I see, that makes more sense although it kind of becomes a synthetic test since normally we don't have a ground truth to compare to.
I agree that it's a synthetic test. But there's something you can do to improve SMDegrain that doesn't rely on such a synthetic test. Since SMDegrain relies on MVTools you can optimize its arguments using motion compensation (MAnalyze + MCompensate). If the motion compensation is high quality then SMDegrain should benefit from that also.

Does anyone know whether MDeGrain uses pixel-based motion compensation (like MFlowInter) or the block based (like MCompensate)? I think it's the latter but I'm not sure.

Another open question: if you find good parameters for MCompensate (or MFlowInter) do they work equally well with MDeGrain? Even if they're not similar there's the MAnalyze (and MRecalculate) part which should work in identical way for all use cases.
zorr is offline   Reply With Quote
Old 2nd January 2019, 23:21   #171  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by zorr View Post
The way I would do it: take a single frame (or even a small part of the frame) where the halo effect is clearly visible and use Photoshop or whatever to remove it manually (using the clone stamp tool for example). Then use a halo removal filter in AviSynth and optimize its parameters so that it replicates the result. The same parameters should then work well for the whole video.
Ahhh why didn't I think of what! And testing one-two frame(s) should be enough
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 2nd January 2019, 23:49   #172  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Yes I dabbled with MCompensate back then, we used it for all kinds of filtering I guess I wanted to keep things simple and fast at that time but I had some beta version with it included. I want to run some tests with avsoptimizer and see where it takes me.
I think it uses MCompensate internally, you can see the vectors with MMask. In my opinion MFlowInter artifacts are less forgivable but I have been long out of the loop so things might have changed.
Dogway is offline   Reply With Quote
Old 3rd January 2019, 10:03   #173  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
Regarding denoising, do you have any plans for the Vapoursynth support that was briefly discussed when the optimization method was published?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 4th January 2019, 00:18   #174  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by Dogway View Post
This is not a release or anything, I modified it a bit to test divide and integer type data for contrasharpening (the generic "val" data type wasn't suited for the variable).
...
Whenever you have time is ok, I use the mvtools2 from pinterf github.
All right, figured out the problem. In the script you're comparing the denoised clip to the noisy clip when you should compare it to the original (without added noise). It was trying hard to come up with parameters that don't remove any noise.

So just add a line to load the original clip:
orig=ffvideosource("source.avi")

and then calculate SSIM between the original and denoised. Remove
global ssim = SSIM_FRAME(source, denoised)
and replace with
global ssim = SSIM_FRAME(orig, denoised)

I'm running a small test with such modifications and seems like it prefers tr=4 (as it should).
zorr is offline   Reply With Quote
Old 4th January 2019, 00:20   #175  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by StainlessS View Post
Zorr, My version 7zip from April 2018 opens Dogway zip no problem, yours must be reasonably old version.
Still couldn't open the 7zip after the update. Perhaps the package was corrupted during download. The .zip opened without problems.
zorr is offline   Reply With Quote
Old 4th January 2019, 00:25   #176  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by Boulder View Post
Regarding denoising, do you have any plans for the Vapoursynth support that was briefly discussed when the optimization method was published?
I haven't looked at Vapoursynth yet. I know almost nothing about it so it's hard to say how much effort it would take. Can you recommend a tutorial / site to get one started with VapourSynth?
zorr is offline   Reply With Quote
Old 4th January 2019, 00:29   #177  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
The official site and for a quickstart my portable pack https://forum.doom9.org/showthread.php?t=175529 <- there are some bat ecnode and VS editor examples
It's very similar to avisynth.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 4th January 2019, 00:30   #178  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
yes, that makes more sense. I guess I got confused since adding synthetic grain seems counterintuitive... off to some tests.
Dogway is offline   Reply With Quote
Old 4th January 2019, 00:31   #179  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
EDIT:
Quote:
Can you recommend a tutorial / site
Perhaps a succinct Python3 intro would be easiest way into VS,
here "Learn X in Y Minutes" for Python3:- https://learnxinyminutes.com/docs/python3/
[already linked on Vapoursynth home site]

EDIT: Python 2 is somewhat different to Python 3, so give tutorials on that a wide berth.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th January 2019 at 00:44.
StainlessS is offline   Reply With Quote
Old 4th January 2019, 01:19   #180  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Here are some basics:
Code:
from vapoursynth import core
import somescript as xy


clip = core.d2v.Source(r'E:\test.d2v') # r means raw string, so u can copy paste a windows path. Alternatively use (without r) 'E:\\test.d2v'
video = clip

# call a function from our imported script
clip = xy.Filter(clip)
clip = somescript.Filter(clip) #alternative

# call a plugin function. All plugins have a namespace.
clip = core.dfttest.DFTTest(clip, sigma=5)
clip = clip.dfttest.DFTTest(sigma=5) #alternative

#compare
clip = core.std.StackHorizontal([video.text.Text("original"), clip])		
clip.set_output()
EDIT
Oh and it would be also very easy to run Avisynth plugins/scripts within VS

Code:
clip = core.d2v.Source(r'E:\test.d2v') 
clip_distorted = core.avsw.Eval('FineDehalo(darkstr =0)', clips=[clip], clip_names=["last"], slave_log=r"D:\debug.txt",  avisynth =r"D:\AVSPLUS_x86\Avisynth.dll")

vmaf.VMAF(clip_reference, clip_distorted) # https://github.com/HomeOfVapourSynthEvolution/VapourSynth-VMAF
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 4th January 2019 at 10:20.
ChaosKing 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 00:40.


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