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 2nd January 2005, 00:44   #1  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
SSXSharpen in realtime....

Well, its not really SSXSharpen...

But this combo looks imo 90% the same!

Code:
# The plugins

aSharp(0.4,0,0).aWarpsharp(3,1,bm=3,cm=0,thresh=0.99)
Source:


SSXSharpen:


The combo:



Thanks n' Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 02:56.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 00:51   #2  |  Link
ObiKenobi
Guest
 
Posts: n/a
Very nice indeed. At the same time, it looks like in some areas that the combo gives even more detail enhancement then SSXSharpen.
  Reply With Quote
Old 2nd January 2005, 01:04   #3  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
If you dont like this effect, just lower the tresh of aSharp!

Btw, if you "hack" this combo into LimitedSharpen...

Code:

# LimitedSharpen
#
# A multi-purpose sharpener by Didée, hacked by Akirasuto n' Soulhunter... ^^
#

function LimitedSharpen2( clip clp,
 \                       float "ss_x",   float "ss_y",
 \                       int   "dest_x", int   "dest_y",
 \                       int   "Smode" , int   "strength", int  "radius",
 \                       int   "Lmode",  bool  "wide",     int  "overshoot",
 \                       bool  "soft",   int   "edgemode", bool "special",
 \                       int   "exborder" )
{
ox = clp.width
oy = clp.height
ss_x =     default( ss_x, 1.5 )
ss_y =     default( ss_y, 1.5 )
dest_x =   default( dest_x, ox )
dest_y =   default( dest_y, oy )
Smode =    default( Smode, 4 )
strength = Smode==1
 \       ? default( strength, 160 )
 \       : default( strength, 100 )
strength = Smode==2&&strength>100 ? 100 : strength
radius =   default( radius, 2 )
Lmode =    default( Lmode, 1 )
wide =     default( wide, false )
overshoot= default( overshoot, 1)
overshoot= overshoot<0 ? 0 : overshoot
soft =     default( soft, false )
edgemode = default( edgemode, 0 )
special =  default( special, false )
exborder = default( exborder, 0)
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4

clp.isYV12() ? clp : clp.converttoyv12()

ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last

edge = logic( tmp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=2)
 \           ,tmp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=2)
 \           ,"max").levels(0,0.86,128,0,255,false)

bright_limit = (soft == true) ? tmp.blur(1.0) : tmp
dark_limit   = bright_limit.inpand()
bright_limit = bright_limit.expand()
dark_limit   = (wide==false) ? dark_limit   : dark_limit  .inflate.deflate.inpand()
bright_limit = (wide==false) ? bright_limit : bright_limit.deflate.inflate.expand()
minmaxavg    = special==false
 \           ? yv12lutxy(bright_limit,dark_limit,yexpr="x y + 2 /")
\            : maskedmerge(dark_limit,bright_limit,tmp,Y=3,U=-128,V=-128)

Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
 \             : Smode==2 ? sharpen(float(strength)/100.0)
 \             : Smode==3 ? yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
 \             : asharp(2,0,0).awarpsharp(3,1,bm=3,cm=0,thresh=0.99)

OS = string(overshoot)
Lmode == 1 ? yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x "+OS+" + ?")
 \         : yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
Lmode == 1 ? yv12lutxy( dark_limit,   last,      yexpr="y x "+OS+" - > y x "+OS+" - ?")
 \         : yv12lutxy( dark_limit,   last,      yexpr="y x "+OS+" - > y x x y - "+OS+" - 1 2 / ^ - "+OS+" - ?")

edgemode==0 ? NOP
 \          : edgemode==1
 \            ? MaskedMerge(tmp,last,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
 \            : MaskedMerge(last,tmp,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)

     (ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last

ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
 \.blur(1.3).inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp=clp.lanczosresize(dest_x,dest_y)

clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
 \                           : maskedmerge(tmp,last,ex,Y=3,U=1,V=1) )
 \           : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
 \                           : tmp.mergeluma( maskedmerge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
 \                                           .converttoyuy2()) )
 
return last
}
#
It produces something like this...




Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 03:15.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 01:06   #4  |  Link
ObiKenobi
Guest
 
Posts: n/a
Even better looking. I will definitely be doing some testing with that.
  Reply With Quote
Old 2nd January 2005, 01:36   #5  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
hmm, vdub doesnt even load when i use this hack.
Dreassica is offline   Reply With Quote
Old 2nd January 2005, 02:04   #6  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by Dreassica

hmm, vdub doesnt even load when i use this hack.
Does the "non hacked" version of LimitedSharpen work for you?


Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 02:58.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 02:12   #7  |  Link
Socio
Registered User
 
Join Date: May 2004
Posts: 288
Going to test this LimitedSharpen hack my self the pic looks pretty damn nice.

BTW Soulhunter what does the call script for the hacked LimitedSharpen look like?



Last edited by Socio; 2nd January 2005 at 02:15.
Socio is offline   Reply With Quote
Old 2nd January 2005, 02:12   #8  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
Looks like textpad (which i used to edit this into) i steh culprit, with its whining about unicode/ansi crap. resaved it properly and now it does load. Let the mfps rendering begin ;0
Dreassica is offline   Reply With Quote
Old 2nd January 2005, 02:17   #9  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by Dreassica

Let the mfps rendering begin ;0
Nah, not at all...

The combo itself should run @ "above realtime" speed!


Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 03:16.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 02:26   #10  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
Not in the script I'll be using this in :P
Dreassica is offline   Reply With Quote
Old 2nd January 2005, 02:32   #11  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by Socio

BTW Soulhunter what does the call script for the hacked LimitedSharpen look like?
The default is...

LimitedSharpen2(Smode=4)


But you can disable super-sampling...

LimitedSharpen2(ss_x=1,ss_y=1,Smode=4)


Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 03:01.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 02:39   #12  |  Link
Socio
Registered User
 
Join Date: May 2004
Posts: 288
Thanks!

Looks like the only real change is Smode to 4 so one could still use the full LimitedSharpen call like the following correct?

LimitedSharpen2( ss_x=1.0, ss_y=1.0,
\ Smode=4, strength=40, radius=2,
\ Lmode=1, wide=false, overshoot=1,
\ soft=false, edgemode=0, special=false,
\ exborder=0 )
Socio is offline   Reply With Quote
Old 2nd January 2005, 02:47   #13  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Yeah, you should be able to use it with all the other stuff!


Update:
Code:

# aSaWLimitedSharpen
#
# A multi-purpose sharpener by Didée, midified by Akirasuto n' Soulhunter
#

function aSaWLimitedSharpen( clip clp,
 \                       float "ss_x",   float "ss_y",
 \                       int   "dest_x", int   "dest_y",
 \                       int   "Smode" , int   "strength", int  "radius",
 \                       int   "Lmode",  bool  "wide",     int  "overshoot",
 \                       bool  "soft",   int   "edgemode", bool "special",
 \                       float "aSharpS", float "aWThresh", int   "exborder" )
{
ox = clp.width
oy = clp.height
ss_x =     default( ss_x, 1 )
ss_y =     default( ss_y, 1 )
dest_x =   default( dest_x, ox )
dest_y =   default( dest_y, oy )
Smode =    default( Smode, 4 )
strength = Smode==1
 \       ? default( strength, 160 )
 \       : default( strength, 100 )
strength = Smode==2&&strength>100 ? 100 : strength
radius =   default( radius, 2 )
Lmode =    default( Lmode, 1 )
aSharpS = default(aSharpS, 0.5)
aWThresh = default(aWThresh,0.75)
wide =     default( wide, false )
overshoot= default( overshoot, 1)
overshoot= overshoot<0 ? 0 : overshoot
soft =     default( soft, false )
edgemode = default( edgemode, 0 )
special =  default( special, false )
exborder = default( exborder, 0)
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4

clp.isYV12() ? clp : clp.converttoyv12()

ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last

edge = logic( tmp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=2)
 \           ,tmp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=2)
 \           ,"max").levels(0,0.86,128,0,255,false)

bright_limit = (soft == true) ? tmp.blur(1.0) : tmp
dark_limit   = bright_limit.inpand()
bright_limit = bright_limit.expand()
dark_limit   = (wide==false) ? dark_limit   : dark_limit  .inflate.deflate.inpand()
bright_limit = (wide==false) ? bright_limit : bright_limit.deflate.inflate.expand()
minmaxavg    = special==false
 \           ? yv12lutxy(bright_limit,dark_limit,yexpr="x y + 2 /")
\            : maskedmerge(dark_limit,bright_limit,tmp,Y=3,U=-128,V=-128)

Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
 \             : Smode==2 ? sharpen(float(strength)/100.0)
 \             : Smode==3 ? yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
 \             : asharp(aSharpS,0,0).awarpsharp(3,1,bm=3,cm=0,aWThresh)

OS = string(overshoot)
Lmode == 1 ? yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x "+OS+" + ?")
 \         : yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
Lmode == 1 ? yv12lutxy( dark_limit,   last,      yexpr="y x "+OS+" - > y x "+OS+" - ?")
 \         : yv12lutxy( dark_limit,   last,      yexpr="y x "+OS+" - > y x x y - "+OS+" - 1 2 / ^ - "+OS+" - ?")

edgemode==0 ? NOP
 \          : edgemode==1
 \            ? MaskedMerge(tmp,last,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
 \            : MaskedMerge(last,tmp,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)

     (ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last

ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
 \.blur(1.3).inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp=clp.lanczosresize(dest_x,dest_y)

clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
 \                           : maskedmerge(tmp,last,ex,Y=3,U=1,V=1) )
 \           : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
 \                           : tmp.mergeluma( maskedmerge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
 \                                           .converttoyuy2()) )
 
return last
}
#
Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 03:17.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 03:13   #14  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,393
Under investigation. Looks promising, but I have some doubts about speed advantage in LS (the currently used sharpeners by themselves aren't slow, as well ... it's the complete bunch of operations together that suck the CPU time).

And let me ask here, too: in *what* way have the used DLLs of aSharp and aWarpSharp been modified? To know what's actually going on would help on further improvement ... after all, LimitedSharpenEX gets closer to completion - but perhaps a few days more would be beneficial
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 2nd January 2005, 03:16   #15  |  Link
ObiKenobi
Guest
 
Posts: n/a
Quote:
Originally posted by Didée
And let me ask here, too: in *what* way have the used DLLs of aSharp and aWarpSharp been modified?
Changed from what? They haven't been changed for quite some time since MarcFD stopped coding.
  Reply With Quote
Old 2nd January 2005, 03:29   #16  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,393
I heard a rumour those DLLs were "slightly modified". But looking at the file dates, and remembering that MarcFD wasn't the busyiest with releasing sources ...

Soulhunter?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 2nd January 2005, 03:37   #17  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by Didée

Under investigation. Looks promising, but I have some doubts about speed advantage in LS (the currently used sharpeners by themselves aren't slow, as well ... it's the complete bunch of operations together that suck the CPU time).
Well, at least you dont need super-sampling anymore...

And getting SSXS a'like results in realtime is enough for me!


Quote:
Originally posted by Didée

And let me ask here, too: in *what* way have the used DLLs of aSharp and aWarpSharp been modified? To know what's actually going on would help on further improvement ... after all, LimitedSharpenEX gets closer to completion - but perhaps a few days more would be beneficial
Have to ask pruned for the exact changes...

IIRC it was about "finer precision" or something like this!?


Bye
__________________

Visit my IRC channel

Last edited by Soulhunter; 4th May 2006 at 03:02.
Soulhunter is offline   Reply With Quote
Old 2nd January 2005, 12:33   #18  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
Originally posted by Soulhunter
Have to ask pruned for the exact changes...

IIRC it was about "finer precision" or something like this !?!
Well, since it looks like he reverse engineered it (adding an extra tweak parameter (what's it do? ) and more chroma modes doesn't really work with mere patching) - could you ask him if he'd release the source? The aWarpSharp used in ffdshow never really worked right for me, and this would be a great opportunity to get it working...

One can dream, right?

np: Autechre - Lowride (Incunabula)
Leak is offline   Reply With Quote
Old 2nd January 2005, 14:54   #19  |  Link
AS
Registered User
 
Join Date: Jan 2002
Posts: 76
He didn't reversed engineered awarpsharp since he made awarpsharp to begin with ^_~

The modified awarpsharp does a shock filtering and the asharp to do real sharpening, iirc. I could be wrong, though ^^;

Edit: Oops, I was corrected... wrong person.

Last edited by AS; 2nd January 2005 at 16:42.
AS is offline   Reply With Quote
Old 2nd January 2005, 15:09   #20  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,356
I thought aWarpSharp was made by marcFD?

btw, the source of asharp should be available (at least I have the "old" source) since it's GPL.
Wilbert is offline   Reply With Quote
Reply

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 19:31.


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