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 11th November 2008, 13:56   #1  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
Super Resolution using MVTools

It's possible to use Fizick's MVTools to double video resolution and actually improve detail (i.e. bring out the barely visible). This technique is called "super resolution" and can really work miracles on videos shot with photo cameras and cell phones. Of couse, it can be also used to upscale SD to HD.

Updated on 2009-05-15
Required: MVTools 2.4.2, NNEDI 1.3, MT 0.7 (for mult-core CPU's, if yours is not, remove the SetMTMode lines)

Code:
SetMTMode(5)
AVISource("test.avi")
ConvertToYUY2()
SetMTMode(2)

MDeNoise(100)
MSR()


function MDeNoise(clip s, int th)
{
blkH = 8
blkV = 8
ovl = 2
dct = 0
srch = 4
pel = 2

super = MSuper(s, pel=pel)
vec1 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=true, delta=2)
vec2 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=true, delta=1)
vec3 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=false, delta=1)
vec4 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=false, delta=2)
MDegrain2(s, super, vec1, vec2, vec3, vec4, thSAD=th)
}



function MSR(clip s)
{
blkH = 16
blkV = 16
ovl = 8
srch = 3
dct=0
pel=2

bc = BilinearResize(s, Width(s)*2, Height(s)*2)
super = MSuper(bc, pel=pel)
vec1 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=true, delta=2)
vec2 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=true, delta=1)
vec3 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=false, delta=1)
vec4 = MAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb=false, delta=2)

s = nnedi(s, field=0, dh=true)
s = TurnLeft(s)
s = nnedi(s, field=0, dh=true)
s = TurnRight(s)

s = Sharpen(s, 1)

super = MSuper(s, pel=pel)
c1 = MCompensate(s, super, vec1)
c2 = MCompensate(s, super, vec2)
c3 = MCompensate(s, super, vec3)
c4 = MCompensate(s, super, vec4)

t1 = Overlay(s, c1, opacity=.5)
t2 = Overlay(s, c2, opacity=.5)
t3 = Overlay(s, c3, opacity=.5)
t4 = Overlay(s, c4, opacity=.5)

f1 = Overlay(t1,t2, opacity=.5)
f2 = Overlay(t3,t4, opacity=.5)
Overlay(f1,f2, opacity=.5)
}

Last edited by Efenstor; 15th May 2009 at 14:31.
Efenstor is offline   Reply With Quote
Old 11th November 2008, 14:39   #2  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
You can also try

Code:
vec1 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=-2)
vec2 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=-1)
vec3 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=1)
vec4 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=2)
instead of

Code:
vec1 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb = true, delta=2)
vec2 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb = true, delta=1)
vec3 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb = false, delta=1)
vec4 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, isb = false, delta=2)
I've discovered it by chance. I don't know for what reason but it gives more details! (though a bit more noise too).
Efenstor is offline   Reply With Quote
Old 11th November 2008, 14:51   #3  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
Multithreaded version (the second method, with negative deltas):

Code:
SetMTMode(5)
AVISource("11.avi")
SetMTMode(2)
ConvertToYUY2()

blkH = 16
blkV = 16
ovl = 4
srch = 3
dct=0
pel=2

bc = BilinearResize(Width()*2, Height()*2)
super = MVSuper(bc, pel=pel)
vec1 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=-2)
vec2 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=-1)
vec3 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=1)
vec4 = MVAnalyse(super, blksize=blkH, blksizeV=blkV, overlap=ovl, search=srch, dct=dct, delta=2)

Lanczos4Resize(Width()*2, Height()*2)
Sharpen(1)
super = MVSuper(pel=pel)

c1 = MVCompensate(super, vec1)
c2 = MVCompensate(super, vec2)
c3 = MVCompensate(super, vec3)
c4 = MVCompensate(super, vec4)

t1 = Overlay(c1, opacity=.5)
t2 = Overlay(c2, opacity=.5)
t3 = Overlay(c3, opacity=.5)
t4 = Overlay(c4, opacity=.5)

f1 = Overlay(t1,t2, opacity=.5)
f2 = Overlay(t3,t4, opacity=.5)
Overlay(f1,f2, opacity=.5)
Efenstor is offline   Reply With Quote
Old 11th November 2008, 14:52   #4  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 416
can you put some pictures?
Terka is offline   Reply With Quote
Old 11th November 2008, 15:19   #5  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,739
Sample images:

Downsized from 2160p source:


Downsized to 512x288 and upsized to 1024x576 with MVTools:


Downsized to 512x288 and upsized to 1024x576 with only Spline16:
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 11th November 2008, 17:18   #6  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 3,508
Erm, that's old hats, no? Put short, what's happening is

sharpen().MCDenoise()

Nothing wrong with that, basically. It's just way too simple. The mere spatial step of [upsize().sharpen()] introduces halos and ringing, which won't be cancelled out by the temporal averaging.

You need to figure which parts of the input signal need emphasizing (increase signal amplitude), and which don't need emphasizing, but only final refinement. *That's* the clue.

Hint: one piece of the puzzle is named "median".


Consider:

"Downsized to 512*288, upsized 300%, sharpened, sharpened, resized to 1024*576"



Compare to your examples.
__________________
We´re at the beginning of the end of mankind´s childhood
Didée is offline   Reply With Quote
Old 11th November 2008, 17:59   #7  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
You mean that adjacent frames contain no additional information? Yes the idea is simple but there's more than that you supposed: I take four adjacent frames, motion compensate them, sharpen them and mix them all together with the central one, so that all exaggregated noises disappear and only real details become more visible. Moreover, since I motion compensate an upscaled frame, the edges of objects in the combined frame will be <=4 times more exact to their real-world shape. That's the method of super resolution, I didn't invent one.

I'll post my examples in a while and you'll see it's better. Not too much, but still better than simple sharpen, whichever it is.
Efenstor is offline   Reply With Quote
Old 11th November 2008, 18:11   #8  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
Here they go. I used the "Multithreaded version" posted above. It gives the best quality of all.

Your method:

My method:


Note that the ear shape is much more accurate, more detail around the mouth are visible, you can see faint rims on the windowpane and black dots in the corners of the windowpane are less smeared. This is not achievable using standard methods.

I don't claim it's "hell that good" but it's a real wonder for lo-fi sources, especially those where shapes are slightly distorted from frame to frame due to heavy compression. Try some actual lo-res examples, not downscaled from HD, and you'll see it's better.

Last edited by Efenstor; 11th November 2008 at 18:31.
Efenstor is offline   Reply With Quote
Old 11th November 2008, 18:31   #9  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,180
.... How can you reproduce Didée's results when he never posted the script.


Dude, all its doing is removing noise its not recovering detail lost during interpolation, its recovering detail lost during compression, if its doing anything at all, which is debateable. I'm not saying temporal super resolution doesn't work on some sources, but mvtools isn't designed to do anything but denoise, it by design will not work on high contrast, low SAD areas of a frame (aliased lines fall well within this generalization).
*.mp4 guy is offline   Reply With Quote
Old 11th November 2008, 18:33   #10  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
Okay, then this method sucks and I'll not use it to improve quality of my lo-fi videos. Please suggest better.
Efenstor is offline   Reply With Quote
Old 11th November 2008, 19:03   #11  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,180
I have no idea what your trying to do, or what your videos look like, how am i supposed to suggest something else?

look, what your doing right now is interpolating them to make them bigger, sharpening to make them look less blurry, and denoisng to make them look less crappy, there isn't anything wrong with that. I'm just trying to tell you that mvtools isn't going to help with the interpolation step.

Their are plenty of high quality sharpening and interpolation methods available on the forums. If you don't want to use search to find them, you could post a representative sample from one of the videos you are working with, post what you want to do with it (destination resolution, denoising preferences, etc.) and ask for advice.
*.mp4 guy is offline   Reply With Quote
Old 11th November 2008, 19:21   #12  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
I'm trying to upscale by 2, at least in general and want super resolution in particular. As far as I know there's nothing better than EEDI2 but it looks too blurry to me and eats faint details. I tried Video Enhancer and Topaz Enhance that are both said to use super resolution but they are far worse even than my "method" (especially Topaz Enhance). Will there ever be a hero who'll make a plugin for TRUE video super resolution?
Efenstor is offline   Reply With Quote
Old 11th November 2008, 19:36   #13  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 416
put to google IMARE superresolution
if you want, try matlab application (free for non-commercial)
http://zoi.utia.cas.cz/download
email to sroubekf@utia.cas.cz for download, but dont expect miracles.
Terka is offline   Reply With Quote
Old 11th November 2008, 20:34   #14  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
I'll try and write back the results. Still I don't understand why Fizick won't try to implement real super-resolution using his motion tracking algorithms?
Efenstor is offline   Reply With Quote
Old 11th November 2008, 21:58   #15  |  Link
Nightshiver
Quality Freak
 
Join Date: Jun 2007
Location: Area 52
Posts: 388
Because imo, super-resolution is pointless.
Nightshiver is offline   Reply With Quote
Old 11th November 2008, 22:06   #16  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Location: Claremont, CA
Posts: 6,861
Quote:
Originally Posted by Efenstor View Post
I'm trying to upscale by 2, at least in general and want super resolution in particular. As far as I know there's nothing better than EEDI2 but it looks too blurry to me and eats faint details. I tried Video Enhancer and Topaz Enhance that are both said to use super resolution but they are far worse even than my "method" (especially Topaz Enhance). Will there ever be a hero who'll make a plugin for TRUE video super resolution?
Try NNEDI + LimitedSharpenFaster.
Dark Shikari is online now   Reply With Quote
Old 11th November 2008, 23:56   #17  |  Link
g-force
Registered User
 
Join Date: Feb 2008
Posts: 121
Efenstor,

I think you are only going to find a lot of cynicism about "super-resolution", which is a misnomer at best, pie-in-the-sky at worst. The reason really lies in the question "what is super-resolution?" The answer is: "good upsizing with detail bolstering of moving detail from previous and subsequent frames". We already have both of those in the form of NNEDI, and MVTools, and when you put them together, nothing magical happens. It's just good upsizing practices. Nothing more. Definitely nothing to warrant the term "super-resolution".
Now these supposed "super-resolution" packages are just snake-oil. Show the potential customer some still frame, show them what it looks like when it is upsized poorly (point-resize), show them what it looks like upsized correctly, and voila, "super-resolution!"

-G

Last edited by g-force; 12th November 2008 at 00:10.
g-force is offline   Reply With Quote
Old 12th November 2008, 08:12   #18  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 612
Here's a good start
http://hdl.handle.net/2014/39112 (http://trs-new.jpl.nasa.gov/dspace/handle/2014/39112)
http://en.wikipedia.org/wiki/Richard..._deconvolution
http://en.wikipedia.org/wiki/Spitzer_Space_Telescope
__________________
Computer: E6850, 4GB, 3x500GB, Nvid 8400 GS, 22" LCD & 19" CRT, XP SP3
DV: Panasonic PV-DV910
HDV: Canon HV20

AVS News

AVS Script Editor[AvsP]
Capture HDV[HDVSplit], DV[WinDV]
mikeytown2 is offline   Reply With Quote
Old 12th November 2008, 12:50   #19  |  Link
Efenstor
Registered User
 
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 43
I don't think super resolution is really pointless, I'm using a program called Photo Acute Studio and it really improves resolution. In theory, suppose we have a single point visible in two adjacent frames: in the first frame it's between the pixels and thus it's smeared 50/50 between them, but in the second frame it falls approximately to the pixel center and so it's much sharper. Go further: in the first frame points surrounding that point are sharp but in the second are smeared. Why can we use sharp information from both frames? There are other, more AI-like approaches such as analyzing which pixel of the two smeared closer represents the original point brightness/color or equalizing both smeared pixels depending on their subpixel position so that we can approximately reveal the two original non-interpolated values. We can just think of pixel grid as of another kind of noise, basically it is noise when we look not at single frame but at several where the grid constantly moves over the identical picture details. It's not pointless, but rather interesting I think. And very complex to implement.

Last edited by Efenstor; 12th November 2008 at 12:55.
Efenstor is offline   Reply With Quote
Old 12th November 2008, 19:15   #20  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,126
Quote:
Originally Posted by Efenstor View Post
Still I don't understand why Fizick won't try to implement real super-resolution using his motion tracking algorithms?
me tried

i even created supplement plugin to fill holes, and have some script, but i did not release it, and its development is paused.
__________________
My Avisynth plugins are now at http://avisynth.org.ru
I usually do not provide a technical support in private messages.
Fizick 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 13:01.


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