Log in

View Full Version : An attempt at cleaning anime


Dali Lama
21st May 2003, 03:42
Hi,

With some free time on my hands, I decided to try to improve my anime encoding. Knowing all too well that a clean source leads to clean output, I decided to re-evaluate some spatial and temporal cleaning techniques.

***************************************************************
Note: The following information has been gained by experimentation and reading posts from users like you! I hope we will continue to share our knowledge and improve our encoding and filtering techniques.
***************************************************************
__________________________________________________________________
After reading posts by MasterYoshidino concerning the use of spatial following temporal filters, I began to experiment...

My previous belief was that using temporal filtering would remove as much noise as possible. Then a spatial filter could smooth the remaining noise away. And it does work well, I'm sure as you all know. However, I tried to use spatial first and then temporal afterwards. To my surprise the noise removal was considerably better. Thinking about it and looking at what the spatial filter did, I realized that using a spatial filter first actually helps to smooth out mosquito noise into flat beveled blocks, enabling the temporal smoother to work better.

(good work MasterYoshidino!, maybe others have a different opinion?)
_________________________________________________________________

Then I began to experiment with the order of the filters. There are basically two ways. Apply both filters after resize or before. Now, logic would entail that applying the filters before resizing would give the filter more data (higher resolution) and noise to work with, which is good. In addition, resizing afterwards allows any noise that has not been removed to be somewhat disgused by the resizer.

However, I found the opposite to be true in my trials. I have a few reasons for this. One, the common resizing algorithms (bicubic, bilinear, lanczos) all use anti-alisizing/spatial filtering on resize (please correct me if I am wrong). Therefore, it goes back to the first discussion on applying spatial before temporal. So, I think if you believe that spatial should be applied before temporal filters, then maybe you should also try filtering after resize?

Secondly, I have read before on the forums that applying filters after resize results in more heavy filtering. This may also play a role in my subjective observations. However, I am usually not impressed by over filtering and the strengths/thresholds used for my tests were low. This should also be a consideration.
_______________________________________________________________
The last issue I'd like to bring for (at least for this initial post) is the number of sequential spatial filtering. I was thinking that if spatial filters blend pixels that are adjecent to each other, then using more than one instance of the filter sequentially should not lead to rapid image degredation, if the thresholds are LOW. Instead it could enhance filtering and preserve sharpness/detail of the edges especially.

Very quickly, I realized that for the use of sequential spatial filtering to be useful there would have to be increasingly wide/large filter radii. This is needed, because once one spatial filter is used and averages some pixels at for example 1x1 radius, then a larger radius should be used the second time to average slightly more pixels.

So basically, the spatial filtering can look something like this:

Name of Spatial Cleaner, threshold, x radius, y radius
2DCleaner 1,1,1
2DCleaner 2,2,2
2DCleaner 3,3,3
2DCleaner 4,4,4
2DCleaner 5,5,5

So the thresholds and radii increase after each incidence of the spatial filter. The thresholds can stay low (5 and under is ver low for 2D cleaner) the radii go very high (5x5 = 11x11 in 2DCleaner), which makes the speed very slow, but the noise reduction is substaintial and detail level high, IMO.
_________________________________________________________________
A few questions:

1. Do others get nice results using this technique?
2. Can this work on non-anime or film type sources? (I better check)
3. Is the speed loss due to the multiple sequential instances of the spatial filtering? IMO, probably not. You could just use two instances or just one. However, one may have to use higher thresholds to acheive the same noise reduction at the sacrifice of detail.
___________________________________________________________________

Next time, I will report back on the use of various types of spatial and temporal cleaners. Sh0dan just unveiled MipSmooth! I will have to try it out. But you can probably guess which spatial "cleaner" I like from my example ;)
___________________________________________________________________
Here are some example snapshots using this filtering technique:

Source: Rurouni Kenshin TV (of course! ;))
[list=1]
Saito's Face Original (http://avisynth.scripterz.org/SaitoFaceOrig.PNG)
Saito's Face Filtered (http://avisynth.scripterz.org/SaitoFace.PNG)
Kenshin Trees Original (http://avisynth.scripterz.org/KenshinTreesOrig.PNG)
Kenshin Trees Filtered (http://avisynth.scripterz.org/KenshinTrees.PNG)
Kenshin's Face Original (http://avisynth.scripterz.org/KenshinFaceOrig.PNG)
Kenshin's Face Filtered (http://avisynth.scripterz.org/KenshinFace.PNG)
Kaoru Trees Original (http://avisynth.scripterz.org/KaoruTreesOrig.PNG)
Kaoru Trees Filtered (http://avisynth.scripterz.org/KaoruTrees.PNG)
[/list=1]
Note: You have to highlight the url and hit 'enter' for image to load. :confused:

Update: I just discovered...if you look at the two pictures right after each other, the filtered image seems to be stretched. This is a side effect of a light (threshold=15) warpsharp that I used. I did another sample with no filtering but warpsharp and it exhibited the same thing! nueron2 mentioned a while ago that warpsharp was not recommended!?! I guess I should have believed him (not that I think its useless, really, but its not practical for keeping the original lines of the anime).

Have a great summer!

Dali

mf
21st May 2003, 16:31
I can't load the images at all. First I get "this document has moved", and then I get a 404 error page.

Guest
21st May 2003, 18:47
Originally posted by Dali Lama
neuron2 mentioned a while ago that warpsharp was not recommended!?! Not quite accurate. It was a specific usage scenario that was being discussed. I wouldn't make such a general judgement; tools need to be used in their domain of applicability. In any case, I was proven wrong by counter example even in the domain discussed. Bottom line: Warpsharp is a useful tool in some applications.

Dali Lama
21st May 2003, 19:18
Originally posted by mf
I can't load the images at all. First I get "this document has moved", and then I get a 404 error page.

:confused:

You're right. I think its some types of cheesy free web space. I can't even log into my account?? If anyone would be so kind to let me upload those pics to their site very temporarily, that would be nice.

If not, I will try to find some free space.

Bye,

Dali

Edit: Oh and you're right neuron2. There is a place for everything.

mf
21st May 2003, 19:34
Email or dcc them to me. I'm online on freenode and IRCnet.

AS
21st May 2003, 20:20
I've been using sequential spatial filtering for some time, I normally prefer using

2DCleaner 5,0,5
2DCleaner 0,5,5

than 2DCleaner 5,5,5.

However, you may say there is uneven smoothing. Then I follow up with 2DCleaner 1,1,10 (with radius 1,1, most of the details remaining are retained)

So I end up with

2DCleaner 5,0,5
2DCleaner 0,5,5
2DCleaner 1,1,10


I also tend to put the spatial before temporal filter.

Also, if you put filters before resizing, you get something like what I would call a 'multiplier' effect.

MasterYoshidino
22nd May 2003, 06:56
that is an effect of spatial filtering not cleaning well enough and temporal noise remains. when resizing, it is harder to filter with spatial filters as they are now smaller and harder to detect (i think, at least with the smart smoothers 2dclean and smartsmooth) without washing out details.

I have tried cleaning the temporal noise on the dark scenes of Escaflowne the Movie but what results is the wood floors become washed out, in order to wash out temporal since the blocks are detected as detail by all temporal filters out there. C3D blurs it, Dust does not touch it, TemporalSmoother causes ghosting, Grape can not clean it well either.
Closest I got was using AviSynth 2.5 to make a temp Huffy file using MPEG2DEC3 with deblockers and an msharpen, then use avisynth 2.0's dust to clean it as much as I could w/o destroying images.
Strangely enough, sharpening in YV12 looks better than sharpening in YUY2 ...

A big plus is no matter how rainbowed the source it is, I could get rid of it with a preprocessed huffy and do a double temporal smoother (TemporalSmoother then a FaeryDust) after a SShiQ, but some anime can not take this filtering well. MSharpen looks softer after this, and looks like it was actualy like that on the DVD :) (did this on some of the hentai DVD's I have, and all rainbow edges go away, especially on credits)

Anyone that has encoded the US version will notice the bad quality as about 2GB is dedicated to audio tracks :mad: ,especially this scene.
http://masteryoshidino.adultbouncer.com/images/escaflowne_bar_scene.png
(about 1hr into the movie)

the only way to get rid of heavy blocking is to try to spatially filter them to the point that a temporal filter detects them as impurities and not detail
the amout of filtering we are suggesting here is not meant for all anime, some can take very little before looking blurred, even with msharpen, while some low motion anime (Aoshi, Chobits, etc.) are not affected as much (depends on detail level of drawings)
this is NOT useful for normal movies (real life actors, not drawings)

btw you may want to email me if you need some images hosted, AB does not care about hotlinked images
http://masteryoshidino.adultbouncer.com/contact.htm

edit: hah I typo bad :D

Xndo
4th June 2003, 05:57
so what your saying is. In some cases filtering before resizeing is better than filtering after resizeing?


Useing this

2DCleaner 1,1,1
2DCleaner 2,2,2
2DCleaner 3,3,3
2DCleaner 4,4,4
2DCleaner 5,5,5

My question is this, lets take DBZ US Dubbed version from Funiamtion. The older dvd's that pioneer put out crash avs every time with access violations. Now if i used one of thier newer lets say anything released from last year untill now, I have no trouble at all.

I have seen alot of noise that follows in these DVD's and have found its hard to filter them out. Everytime it errors out on me I keep getting pissed and don't come back to it for a few days. If I wasn't adding a logo to it, I think i can get pretty good quality but when i have to reencode it usering logo i loose soo much quality its not funny.


I've ran across a script called "mfToon-v0.32.avs" though I haven't used it yet, I was wondering if anyone has an could give me some info about it.


here is a list of filters I've used before maybe its just my placement of them.

TemporalSoften2.dll
SmoothHiQ.dll
MipSmooth.dll ( I've tried it once and never really learned how to use it)
warpsharp.vdf ( haveing found a good enough setting for this one )

I've seen alot of .ogm files that look just great. but getting the same effect into a avi useing divx 5.x i haven't had much luck with it.

Maybe someone can beat it into my brain that what I'm doing is jacked up