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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th August 2017, 11:01   #21  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
also MDeGrain being one of the inter-patch (self-similarity) based approaches, is theoretically equivalent to a sparse coding unit, you can have one or many of those sparse coding layers in your denoising autoencoder and it would reasonably give you results similar to MDeGrain but better
feisty2 is offline   Reply With Quote
Old 16th August 2017, 11:30   #22  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
I've updated the script with a setting for that sharpening amount. This is optioned as 'enh' as it targets detail. A setting of 0 completely disables it. Default setting is 20, which is approximately half of what it was. I realise you can't resurrect lost details, that's not the intention. It's impossible to truly resurrect lost details regardless of how it's done, simply because if it's 'lost' then it's not there to recover. The best you can do is use algorithms to determine what is expected to be there, but that's still not recovering the true detail.

I started looking into other filters because I found KNLMeansCL, as well as other filters, had output that just wasn't as clear as it should be. I then thought of ways to circumvent this, the result being mClean. Another consiration is for it to be pretty fast, suitable for most scenarios, and also keeping things relatively simple. The future intention is to add dehalo, dering, derainbow etc as options, and hopefully deblock as well. Strong enough to be effective but not to reduce wanted detail, whilst still remaining relatively fast.

Last edited by burfadel; 16th August 2017 at 11:45.
burfadel is offline   Reply With Quote
Old 16th August 2017, 11:57   #23  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
quality and performance are on the opposite sides of the tradeoff, you simply can't have them both in general
some denosing filter kills a lot of details along with the noise, some kills less, if you're not happy with what you already got, the healthy choice would be making a new denoising filter that kills less details in the first place, not sharpening what's left of the crap
feisty2 is offline   Reply With Quote
Old 16th August 2017, 12:36   #24  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
That's why the sharpening is only targetting detail, the non-detail is actually being spatially cleaned . Currently it's an 'adaptive' denoiser, but the intention is for it eventually to be an 'adaptive' noiser by default and an cleaner with the options set.

Last edited by burfadel; 16th August 2017 at 13:23.
burfadel is offline   Reply With Quote
Old 16th August 2017, 13:28   #25  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
burfadel, I'm noticing in this version of MClean no longer has this:

Code:
# Masks
LumaMask=mt_binarize(c, threshold=64, upper=true).greyscale().BilinearResize((c.width/16)*2, (c.height/16)*2).BilinearResize(c.width,c.height).mt_binarize(threshold=254)
EdgeMask=mt_edge(c, mode="prewitt",thy1=0,thy2=16).greyscale().mt_binarize(threshold=16, upper=true).BilinearResize((c.width/16)*2, (c.height/16)*2).BilinearResize(c.width,c.height).mt_binarize(threshold=254)
GrainMask=mt_logic(LumaMask,EdgeMask,mode="and")
DegrainMask=GrainMask.mt_invert()
Did you have this as planned?
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 16th August 2017, 14:18   #26  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
It meant the denoising was applied too weak on certain parts of the image.
burfadel is offline   Reply With Quote
Old 16th August 2017, 18:40   #27  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
I like this version

first MClean version / MClean 1.1 / KNLMeans(D=2, A=2, h=1.5, channels="YUV")



I like this one (middle) best, and it is notably better than your first version. Default Enh=20 looks good, eh=40 is too much.

Last edited by MysteryX; 16th August 2017 at 18:46.
MysteryX is offline   Reply With Quote
Old 16th August 2017, 21:05   #28  |  Link
SaurusX
Registered User
 
Join Date: Feb 2017
Posts: 134
Quote:
Originally Posted by MysteryX View Post
I like this version

first MClean version / MClean 1.1 / KNLMeans(D=2, A=2, h=1.5, channels="YUV")



I like this one (middle) best, and it is notably better than your first version. Default Enh=20 looks good, eh=40 is too much.
The middle picture has more blocking, though less ringing around the letters compared the KNLMeansCL. The hand in the air for the woman on the right is better defined in the KNLMeansCL picture.
SaurusX is offline   Reply With Quote
Old 16th August 2017, 21:37   #29  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
This doesn't solve blocking at all. I'll need to run a separate filter for that. You're right, hand in the air on the right is better defined for KNLMeans. The biggest difference, however, is in the curtains and roof, where KNLMeans discards the subtle details as noise giving a slight plastic or washed out effect.

Note than in my sample, I'm applying upscaling and interpolation after denoising which amplifies the denoising difference. Small variations can however cause large variations in interpolation, explaining why one hand would be clearer while other objects have less details. Sometimes it simply changes the motion estimation so that the hand appears clearer one frame earlier or later. So we really have to look at the whole picture.

Last edited by MysteryX; 16th August 2017 at 22:09.
MysteryX is offline   Reply With Quote
Old 17th August 2017, 05:29   #30  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
It's hard to compare spatial images when any filter has a temporal component. The temporal stability of motion and detail is something you can't judge in images but can have a huge impact on video quality. I've got another idea that I'll put in this week, many will say it's pointless but it's really simple and some may find it useful.
burfadel is offline   Reply With Quote
Old 17th August 2017, 05:50   #31  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
It always goes like this. First people say it's impossible. Then you achieve it anyway. Then some use it.

So don't worry what people say Just implement your ideas.
MysteryX is offline   Reply With Quote
Old 19th August 2017, 16:33   #32  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
Updated the script in the first post with a new feature, ReNoise. It's range is from 0 (default, disabled), to 20. This feature allows you to add back some of the luma noise that was removed, which may sound counterintuitive. However, the noise has been temporally cleaned and also spatially modified, so it's not the same as when removed and should have better compressibility. An advantage of doing the modifications to the noise is that it changes only the noise, not also the underlying picture which would be the case if it were applied to the whole picture. There is an option from 0 (disabled), 1 to 10, which adds back 10-100 percent of the modified noise, and 11-20 adds an additional 10 to 100 percent. The modified noise is much weaker, so I thought it would be good to give the option to apply it more strongly . A setting of 5 is probably a good starting point if you wish to use it.

Last edited by burfadel; 19th August 2017 at 16:46.
burfadel is offline   Reply With Quote
Old 20th August 2017, 01:14   #33  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Interesting. As a denoiser before upscaling, renoising is useless.

As a prefilter on HD content... I've encoded with x264 to see the difference in encoding and taken screenshots afterwards. FrameRateConverter is with preset=Normal... preset=Slower just wasn't working with this at all performance-wise.

- RemoveGrain(21) [1.43MB)
- MClean() [1.46MB]
- MClean(rn=5) [1.46MB]
- MClean(rn=10) [1.46MB]
- MClean(rn=10), 16-bit processing [1.57MB]



MClean gives a plastic effect as a prefilter, or perhaps it could work with lower settings, but with rn=10 it looks better than RemoveGrain. Note that there are considerable rounding errors in 8-bit. If I do the whole processing in 16-bit, quality is much better. I think MClean should internally work in 16-bit if the source is 8-bit, otherwise there are rounding differences on subtle details applied several times in a row.

For some reason, I'm unable to convert to 16-bit and back to 8-bit for the prefilter.
Code:
Pref=last.ConvertBits(16).MClean(rn=10).ConvertBits(8, dither=1)
FrameRateConverter(NewNum=60, NewDen=1, Prefilter=Pref)
MRecalculate: wrong pixel type in FrameRateConverter line 145

In terms of performance, this is using MvTools2 which has MT performance issues. With FRC Preset=Normal which uses DCT=0, the encoding won't start at all, it jams, even though MT normally works with DCT=0. With FRC Preset=Slower (non-MT), it drags extremely slowly.
MysteryX is offline   Reply With Quote
Old 20th August 2017, 03:35   #34  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
As for running MClean separately instead of as a prefilter, it considerably decrades the quality.

Prefilter / Denoise (both in 16-bit)


I'm getting best results with MClean(rn=10) in 16-bit, but am unable to use it as a prefilter in 16-bit and can't figure out why. Additionally, I'm unable to get a decent encoding done with FRC Preset=slower combined with MClean. But ultimately, that would give the best.
MysteryX is offline   Reply With Quote
Old 20th August 2017, 10:55   #35  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
I've updated the script again, just note that rn strength may need to be adjusted . You would think that it would work okay as a prefilter, but I suspect using a tempoeral filter for temporal analysis may be the issue? For the down dither, I'm using dither=0 as it would be better for compressibility and for running before framerateconverter.
burfadel is offline   Reply With Quote
Old 20th August 2017, 16:35   #36  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
This would cause frame requests to come in a weird order, and MT is known to have a limitation requiring frame to be requested in the right order.

With ST, however, it shouldn't be an issue.
MysteryX is offline   Reply With Quote
Old 20th August 2017, 16:48   #37  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
The whole script doesn't seem to run as a prefilter though, as the script instructs it to convert back to 8 bits. It's as if the MAnalyse of FrameRateConverter is pulling the MSuper/MAnalyse data directly from mClean, hence mixing 16 bit with 8 bit and the error.
burfadel is offline   Reply With Quote
Old 20th August 2017, 16:52   #38  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
What's concerning is that it looks like a bug in the core. Perhaps try AVS 2.6?

Duh, there's no ConvertBits in 2.6, never mind!

Last edited by MysteryX; 20th August 2017 at 18:34.
MysteryX is offline   Reply With Quote
Old 21st August 2017, 22:05   #39  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Interesting bug.

This freezes when opening in VirtualDub. Later on I ran this through the encoder and it went just fine...
Code:
file="Video.mp4"
LWLibavVideoSource(file, cache=False)
ConvertBits(16).MClean(rn=10).ConvertBits(8, dither=0)
Prefetch(8)
This works.
Code:
ColorBarsHD()
ConvertBits(16).MClean(rn=10).ConvertBits(8, dither=0)
Prefetch(8)
This also works.
Code:
file="Video.mp4"
LWLibavVideoSource(file, cache=False)
MClean(rn=10)
Prefetch(8)
Importing in this way still gives "wrong pixel type"
Code:
Pref=AviSource("PreviewPref.avs")
FrameRateConverter(NewNum=60, NewDen=1, Prefilter=Pref)
You're however able to run the prefilter as a first pass as an AVI file and then use that as a source for the 2nd pass. Not ideal but at least we can try and compare quality. Then you're also able to use Preset="slower".

Last edited by MysteryX; 21st August 2017 at 22:33.
MysteryX is offline   Reply With Quote
Old 21st August 2017, 22:43   #40  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
OK I've done some comparison tests as a prefilter, running MClean in 16-bit and FRC in 8-bit. These tests take longer because I need to encode the prefilter output as an AVI file and then use that interim file. It gives the quality comparison though.

What did you change in this version? Renoise seems softer. Any settings you recommend for better results as a prefilter?

Here I didn't test H264 encoding which may show additional benefits.

RemoveGrain(21) / previous MClean(rn=10) / new MClean(rn=10) / new MClean(rn=12)



The prefilter AVI interm file is 392MB for previous MClean and 400MB for this version, which indicates there are more details.

Performance-wise, MClean in 16-bit encodes into AVI at 6fps on 1080p content. It's a bit slow for a prefilter unless it gives very clear benefits.

Burdafel, you don't want to convert back to 8-bit at the end if the source isn't 8-bit.

Last edited by MysteryX; 21st August 2017 at 22:57.
MysteryX is offline   Reply With Quote
Reply

Tags
cleaning, denoise, denoiser, mclean

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 23:53.


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