W A R N I N G !


W A R N I N G !

This page is full of non-facts and bullsh!t, (just like the internet and especially forums and other blogs), please do not believe entirely without exercising your intellect. Any resemblance to real things in reality is purely coincidental. You are free to interpret/misinterpret the content however you like, most likely for entertainment, but in no case is the text written on this blog the absolute truth. The blog owner and Blogger are not responsible for any misunderstanding of ASCII characters as facts. *cough* As I was saying, you are free to interpret however you like. *cough*

Saturday, March 8, 2008

Restoring The Quality Of Cartoon/Anime Videos/Pictures With MSU Cartoon Restore Filter

I was making some PSP "Logitech" Playgear skins when I noticed that one of my pictures has too much noise. To be precise, JPEG compression artifects. I remember seeing a guide on how to take a bad quality, low res. picture found on the net and restore it to a decent quality good enough to be used as DVD cover. It involved VirtualDub and some kind of Power Rangers, but I couldn't find it anymore when I needed it, so if you know where this is, drop me a message. I'd be grateful.

But as I was looking for it, I came across another solution that works. No not those kind of bogus $20-100 software that either does nothing or has too much undesirable effects, and are basically some inferior common programming repackaged and sold for daylight robbery prices. It's by MSU. MSU stands for Moscow State University, their Graphics & Media Lab (Video Group) to be exact. They are a bunch of geniuses that study digital video compression and such, create filters (lots of it), and even have their own lossless codec. Their filters are usually very good, and they even improved on x264, their improved version available for download on their homepage at http://www.compression.ru/index_en.htm.

Today I'll be talking about the MSU Cartoon Restore filter, which I used to restore the quality of my bad JPEG picture. It works, with a great degree of success, unlike other solutions out there as I've mentioned above.

The page is here.

The reason it works is because it only works on cartoons/Anime. Basically high contrast and sharp edges. Understanding how cartoon/Anime works, all the code needs to do that's different from the normal one, is to detect huge similar patches of colors and the thick black lines, and be more merciless at destroying the minute data that we call "noise". It would've sounded easy to the pros out there and should've been created long ago, why is it that only MSU created the actual product that's going to be so useful to Otakus?

Ok, enough with the talking, "a little less conversation a little more action please".

This is the pic I wanted to restore:



This is after restoration:


After resizing for printing, a close up reveals the differences:


That is pretty good. I used the Fuzzy Adaptive Filter because 1) The Insane Artifect Reduction has better results than Multipass Bilateral Filter at the preset settings, and 2) Attempts to use insane custom settings with the Multipass Bilateral Filter makes my com feel so slow as if it crashed. (The Fuzzy Adaptive Filter is slow already - brings my encoding rate to less than half of real-time with HuffYUV. Otherwise, for that kind of source, it'd be at least a 100fps and ~150 on average. A 320x240 source btw, god knows what happens with full SD or even HD resolution)

But it (the speed impact) just shows how complicated this filter is, and how it's going to be good. :D

On their website, Multipass Bilateral Filter is the best, but they are the pros that know how to tweak the settings, while I'm just a small kid with a slow com. I take what I can get.

I also tried my own Insane Artifect Reduction settings, which is 1.5x higher in everything compared to the original Insane Artifect Reduction. But it softened the picture too much while reducing only a bit more artifecting, so it definitely is not at optimal. The makers probably knew that, hence their Insane Artifect Reduction is not too insane.

Ok, it's so good, why not I use it to try to restore the quality of a YouTube video I have on hand?

So I launched VirtualDub again, Fuzzy Adaptive Filter - Insane Artifect Reduction. Results are pleasing. Definitely more watchable. A bit of blocking is also removed. But the larger macroblocks are left untouched.

So I decided to bring in MSU Smart Deblocking filter. It's THE deblocking filter for noobs. I know that their standard deblocker filter as well as that of ffdshow have more settings to tweak, but just with the simplest settings MSU Smart Deblocking yields the best results. And since MSU is saying that the "smart" version is better in their own comparison on the "smart"'s page, lets believe the pros.

After two filters and a massive speed slowdown, the result is... impressive. Now instead of a YouTube video, it looks more like a poorly ripped and encoded sub of a show in the 1990s. Not the best, but definitely more pleasing.

(Pictures in this order from left to right - original, w/MSU Cartoon Restore ilter, w/MSU Cartoon Restore and MSU Smart Deblocking filters)

BTW - if you know what this video is, well good, welcome to the same world as me. :D If not, it's better if you don't know what it is.

P.S. I like the song, one of my fav at all times. And if you have the video or better quality version of the full-length song please contact me. Also, if you want the "not the best but still decent" quality of the full-length song can contact me too. :)

Update: Ok I already got the song in FLAC and the original MPEG movie which is 7mbps. Anyone wants can contact me. :D

This is one of the best scenes in the source already, and the filters manage to make it look even better.

Now lets look at the worse scenes.

Deblocking starts to become important







I didn't know it is possible to get so much data out of this frame by deblocking

Ey wait, wasn't I supposed to be looking at the MSU Cartoon Restore filter and not the Smart Deblocking filter? Oops.

There are a lot more pictures I want to show you, but that would take too much of my time and make this post too long. Anyway the conclusion is obvious. The MSU Cartoon Restore filter works like a charm. The Smart Deblocking filter works too. And together, they can change poor YouTube quality videos into something more watchable.










Ok... the sharper eyes have noticed that this guide is about "Restoring The Quality Of Cartoon/Anime Videos/Pictures With MSU Cartoon Restore Filter". Now, I definitely talked about restoring the quality of pictures (and have done so above), and MSU Cartoon Restore filter is a video filter for use in AVISynth and VirtualDub. How did I use a video filter on a picture?

This post is another double-guide (as in like the multi-guide of some of my previous posts, meaning more than one guide in a post, literally). The other important part required to make the above work, is knowing how to open pictures in VirtualDub.

It's not hard actually. Just make sure your picture is in a common picture format, make one copy of it and place it in the same directory, rename them such that they end with "1" (or 2 and 3 and 4... for more pictures in the image sequence). Open the first one in VirtualDub, and the rest of the images in the sequence will be opened as though they were together in a video file. This trick may occasionally become useful in video editing.

After opening the picture in VirtualDub, you can now use the many filters that are available for VirtualDub to do interesting and useful things.

That's the end of this guide. Hope it will be useful to you, someday. :D

1 comment:

Jhkh said...

Today we would use waifu2x :P