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 Display Modes
Old 10th February 2008, 23:24   #1  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
The DCT Block vs. Grain Anime paradox

...or whatever...

I have done a lot of searching; I have an anime dvd source that is grainy, but when the grain is cleaned up, DCT blocks appear (shaky blocks is dark areas, right?).

The only solution seems to be adding dither... which seems to make it pointless to even degrain the anime to begin with!

But most anime doesn't look good grainy--it can distort lines, or plain just look bad.

Is grain/dither really the only solution to getting rid of DCT blocks? It seems that its a lose/lose situation -- either have your anime look like it is covered in sand or have dark areas full of dancing blocks.
mahsah is offline   Reply With Quote
Old 11th February 2008, 00:10   #2  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Location: Claremont, CA
Posts: 6,911
Tried dfttest?
Dark Shikari is offline   Reply With Quote
Old 11th February 2008, 01:02   #3  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
I have not, what settings would you recommend for anime?
mahsah is offline   Reply With Quote
Old 11th February 2008, 01:08   #4  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Location: Claremont, CA
Posts: 6,911
Quote:
Originally Posted by mahsah View Post
I have not, what settings would you recommend for anime?
Try dfttest(sigma=1) and raise/lower sigma from there.

Its like fft3dfilter, but better.
Dark Shikari is offline   Reply With Quote
Old 11th February 2008, 01:23   #5  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
dfttest isn't really helping... it just seems to replace the dancing blocks with pulsating blobs, like most other denoisers.
mahsah is offline   Reply With Quote
Old 11th February 2008, 01:25   #6  |  Link
Zanejin
Registered User
 
Zanejin's Avatar
 
Join Date: Jan 2007
Posts: 24
You could try a motion-compensated dfttest. This is what I'm testing for a similarly grainy and blocky source:

Code:
source=last
# Motion-compensation code based on one of Dark Shikari's posts.
backward_vectors = source.MVAnalyse(isb = true, truemotion=false, delta = 1, idx = 1,overlap=4)
forward_vectors = source.MVAnalyse(isb = false, truemotion=false, delta = 1, idx = 1,overlap=4)
forward_compensation = source.MVCompensate(forward_vectors, idx=1)
backward_compensation = source.MVCompensate(backward_vectors, idx=1)
interleave(forward_compensation, source, backward_compensation)
dfttest(sigma = 0.5)
dull=last
sharp = dull.LimitedSharpenFaster(smode=4, strength = 20, undershoot = 80, ss_x = 1.0, ss_y = 1.0)
Soothe(sharp, dull)
selectevery(3,1)
gradfun2db(1.3)

Last edited by Zanejin; 11th February 2008 at 01:28. Reason: Properly credited Dark Shikari for motion-compensation code.
Zanejin is offline   Reply With Quote
Old 11th February 2008, 01:31   #7  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
That helps a little bit, but I still get blocks that tend to flicker every second or so. Its really strange.

EDIT: I tried the motion compensated fft3dgpu script that you linked to, and it seems to work much better then dfttest. Except for the banding, but gradfun2db can help that.

Also is it better to include the sharpening in the motion compensated section of the script? What about line darkening?

Last edited by mahsah; 11th February 2008 at 01:48.
mahsah is offline   Reply With Quote
Old 11th February 2008, 03:14   #8  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,306
Line darkening can be run after the motion compensation, as it shouldn't gain any difference in the quality of darkened lines if motion was factored in. Edges are edges, whether they are moving or not.

Edit: Also, why is dfftest better than fft3dfilter/gpu?

Last edited by Adub; 11th February 2008 at 03:19.
Adub is offline   Reply With Quote
Old 11th February 2008, 03:20   #9  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 499
Quote:
Originally Posted by Dark Shikari View Post
Try dfttest(sigma=1) and raise/lower sigma from there.

Its like fft3dfilter, but better.
sigma=1 is way to high. Would destroy WAY too many details. As long as the source is at least semi-clean, anything under sigma=0.5 should be fine (even that is high). Once you go higher, you loose too many details.

It's a trade off, but I'd take the little noise over lost details any day of the week.

Quote:
Also is it better to include the sharpening in the motion compensated section of the script? What about line darkening?
I believe both of those are spatio and not temporal so it wouldn't matter if it was in or not. Only thing it would effect would be speed since it's processing twice as many frames (more then twice I think).

Everything is a trade off. You can have the grain, you can have the blocks, or you can have a little of both. I'd try and keep as many details as possible though no matter which way you go.
TheRyuu is offline   Reply With Quote
Old 11th February 2008, 10:19   #10  |  Link
check
phjbdpcrjlj2sb3h
 
check's Avatar
 
Join Date: Sep 2005
Location: Western Australia
Posts: 1,693
OP, can you post a sample?

Quote:
sigma=1 is way to high. Would destroy WAY too many details. As long as the source is at least semi-clean, anything under sigma=0.5 should be fine (even that is high). Once you go higher, you loose too many details.
It's a trade off, but I'd take the little noise over lost details any day of the week.
Are you talking about sigma=1 being too high for live action, or for anime?
Also, seeing as the suggestion was to go up or down as needed, it shouldn't matter too much
check is offline   Reply With Quote
Old 11th February 2008, 11:34   #11  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 3,517
In respect to:

Quote:
Originally Posted by Zanejin View Post
You could try a motion-compensated dfttest. This is what I'm testing for a similarly grainy and blocky source:

Code:
source=last
# Motion-compensation code based on one of Dark Shikari's posts.
backward_vectors = source.MVAnalyse(isb = true, truemotion=false, delta = 1, idx = 1,overlap=4)
forward_vectors = source.MVAnalyse(isb = false, truemotion=false, delta = 1, idx = 1,overlap=4)
forward_compensation = source.MVCompensate(forward_vectors, idx=1)
backward_compensation = source.MVCompensate(backward_vectors, idx=1)
interleave(forward_compensation, source, backward_compensation)
dfttest(sigma = 0.5)
dull=last
sharp = dull.LimitedSharpenFaster(smode=4, strength = 20, undershoot = 80, ss_x = 1.0, ss_y = 1.0)
Soothe(sharp, dull)
selectevery(3,1)
gradfun2db(1.3)
and

Quote:
Originally Posted by mahsah View Post
EDIT: I tried the motion compensated fft3dgpu script that you linked to, and it seems to work much better then dfttest.

Note that with default settings, dfttest works purely spatial (tbsize=1), so it won't benefit at all from the compensation.
You should instead use dfttest(sigma=[something], tbsize=3) in that script, to actually make use of the motion compensation.


Quote:
Originally Posted by mahsah
Also is it better to include the sharpening in the motion compensated section of the script?
The sharpening is not affected by motion compensation, but the soothing of the sharpening effect is. Thus there's indeed a point to put the sharpen+soothe combo in the motion compensated section.


Also, dfttest is a bit odd in how it manages some things. It seems that every pixel gets filtered several times, as a consequence of the spatial window overlapping. With the default of sbsize=12/sosize=9, every pixel gets filtered 4 times. That's why the denoising strength of dfttest appears to be much stronger than what one would expect from the specified sigma.

Compare the results of these two lines:

> dfttest(sigma=3, sbsize=12, sosize=9) # default
versus
> dfttest(sigma=3, sbsize=12, sosize=3) # less overlapping


both use the same sigma, so one would expect a similar denoising strength. However, the 1st one does waaaaay more strong denoising than the 2nd one.
I'd call this counter-intuitive.
__________________
We´re at the beginning of the end of mankind´s childhood

Last edited by Didée; 11th February 2008 at 13:14.
Didée is offline   Reply With Quote
Old 11th February 2008, 21:26   #12  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
Huh, something strange. Using that script that Zanejin posted (with tbsize=3 and sigma=.5), motion became very "jolty", almost like frames were being outright dropped.

I got better results by dropping dfttest into the example script provided with mvtools:
Code:
source=last
backward_vectors = source.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 1)
# we use explicit idx for more fast processing
forward_vectors = source.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 1)
forward_compensation = source.MVFlow(forward_vectors, idx=1, thSCD1=500) # or use MVCompensate
backward_compensation = source.MVFlow(backward_vectors, idx=1, thSCD1=500) # or use MVCompensate
# create interleaved 3 frames sequences
interleave(forward_compensation, source, backward_compensation)

dfttest(sigma=.5,tbsize=3) # place your preferred temporal (spatial-temporal) denoiser here

selectevery(3,1) # return filtered central (not-compensated) frames only
This does a very good job of temporally stabalizing the clip as well as smoothing noise. While the "blobs" are still there, they are much less noticeable, only moving about every second or so.

EDIT: Also is Limitedsharpenfaster really good for anime? I have found it always introduces some form of haloing. Is seesaw any good for anime?

Last edited by mahsah; 11th February 2008 at 21:28.
mahsah is offline   Reply With Quote
Old 11th February 2008, 22:25   #13  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,306
VMtoon is usually the way to go with Anime. LSF does have a tendency to produce halo's unless using lower settings (obviously).

Give VMtoon at try and see what you think.
Adub is offline   Reply With Quote
Old 12th February 2008, 00:16   #14  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
Yeah, but VMtoon is very slow (isn't it's sharpening just a supersampled xsharpen?)

I usually use fastlinedarkenmod...
mahsah is offline   Reply With Quote
Old 12th February 2008, 01:50   #15  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,306
huh, looks like you are right. I will have to try fastlinedarkenmod. I think I had a bad experience with it in the past, so that's why I wasn't using it.

As to sharpening, it's all a matter of preference/source. If LSF works, then great! You may also want to try awarpsharp, Seesaw(although its rarely used for anime), xsharpen, and whatever else you have up your sleeve.
Adub is offline   Reply With Quote
Old 12th February 2008, 02:11   #16  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 499
Quote:
Originally Posted by Merlin7777 View Post
huh, looks like you are right. I will have to try fastlinedarkenmod. I think I had a bad experience with it in the past, so that's why I wasn't using it.

As to sharpening, it's all a matter of preference/source. If LSF works, then great! You may also want to try awarpsharp, Seesaw(although its rarely used for anime), xsharpen, and whatever else you have up your sleeve.
LSF with smode=3 generally works better for anime from what I've found.

warpsharpening is a matter of preference (some people like it, others don't).

As for a line darkener. try using vmtoon(sharpen=false,thinning=0,strength=35) or there abouts. Use LSF instead as the sharpener (call it after, or before, try it out both ways). I've found vmtoon to have higher quality over fastlinedarkenmod and the likes (Fastlinedarkenmod caused jaggies for me and I just liked the overall look of vmtoon better (WITH SHARPEN=FALSE). It may be a little slower, but the quality is probably worth it.
TheRyuu is offline   Reply With Quote
Old 12th February 2008, 02:23   #17  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
What is the difference between the different smodes anyways?

Also jaggies from fastlinedarken mod arn't a big deal, as I am calling aaf() (TWICE, my source is really jaggy) at the end of my script.

Also has anyone tried mvdegrain3 with anime? I noticed the new version of mvtools has it, but I'm not sure how to best use it.
mahsah is offline   Reply With Quote
Old 12th February 2008, 02:58   #18  |  Link
Zanejin
Registered User
 
Zanejin's Avatar
 
Join Date: Jan 2007
Posts: 24
Quote:
Originally Posted by Didée
Note that with default settings, dfttest works purely spatial (tbsize=1), so it won't benefit at all from the compensation.
You should instead use dfttest(sigma=[something], tbsize=3) in that script, to actually make use of the motion compensation.
Hm, I didn't realize that. Thanks for the note!

Quote:
Originally Posted by mahsah
What is the difference between the different smodes anyways?
This is well-documented here. I prefer smode = 4 for usual anime-filtering (note: "Each mode has progressively less haloing in its sharpening.").

Quote:
Originally Posted by mahsah
Also jaggies from fastlinedarken mod arn't a big deal, as I am calling aaf() (TWICE, my source is really jaggy) at the end of my script.
To anti-alias (remove jaggies), you can also try TIsophote. It's faster than AAF and may or may not produce satisfactory results.

You may actually be able to accomplish sharpening, line-darkening, and anti-aliasing all with LimitedSharpenFaster. You can use a high undershoot value (above 80, perhaps) to darken lines and super-sampling (controlled by ss_x and ss_y) to anti-alias.

Quote:
Originally Posted by mahsah
Also has anyone tried mvdegrain3 with anime? I noticed the new version of mvtools has it, but I'm not sure how to best use it.
MVDegrain3 will just stabilize and remove grain to a greater degree and with greater accuracy than MVDegrain2 at a cost to speed. It's basically the standard MVDegrain algorithm using a radius of 3 frames. The very basic usage would be:

Code:
source = last
backward_vector_1	= source.MVAnalyse(isb = true, delta = 1, idx = 1)
forward_vector_1	= source.MVAnalyse(isb = false, delta = 1, idx = 1)
backward_vector_2	= source.MVAnalyse(isb = true, delta = 2, idx = 1)
forward_vector_2	= source.MVAnalyse(isb = false, delta = 2, idx = 1)
backward_vector_3	= source.MVAnalyse(isb = true, delta = 3, idx = 1)
forward_vector_3	= source.MVAnalyse(isb = false, delta = 3, idx = 1)
source.MVDegrain3(backward_vector_1, forward_vector_1, backward_vector_2, forward_vector_2, backward_vector_3, backward_vector_3, idx = 1)
You may be interested in experimenting with the pel and blksize parameters for MVAnalyse.

Last edited by Zanejin; 12th February 2008 at 03:36. Reason: Changed "overlap" in last sentence to "blksize".
Zanejin is offline   Reply With Quote
Old 12th February 2008, 21:55   #19  |  Link
mahsah
Registered User
 
Join Date: Jun 2006
Posts: 270
Thanks!

But I think I'm gonna stay with my current script, as supersampling or tisophote isn't enough to get rid of the aliasing in my source, as undershoot isn't really enough darkening for my taste.

I ended up with
fastlinedarkenmod(thinning=0, strength=35)
and
limitedsharpenfaster(smode=3, strength=50)
mahsah is offline   Reply With Quote
Reply

Thread Tools
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:33.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.