Log in

View Full Version : Am I using the right filters when cleaning VHS footage (PAL)


Pages : 1 [2]

Fizick
29th January 2005, 00:57
Socio,
You use DeFreq not proper way.
DeFreq(fx=30,fy=-40) is not good default setting for any (VHS) video, it is only example.
See doc.

gavo
4th May 2005, 05:46
AVISource("H:\capture.avi")
LoadPlugin("C:\warpsharp\warpsharp.dll")
LoadPlugin("C:\warpsharp\LoadPluginEx.dll")
LoadPlugin("C:\warpsharp\dustv5.dll")
LoadPlugin("C:\warpsharp\masktools.dll")
iip( dest_x = xx, dest_y = yy,
\ duststr = 4, dustweight = 1.0,
\ ss1_x = 1.33, ss1_y = 1.66,
\ detailcontr1 = 127, detailcontr2 = 208,
\ contr_radius = 3, PixSharp = 0.3,
\ ss2_x = 2.5, ss2_y = 3.5,
\ Xstren = 208, Xlimit = 255,
\ subpelstren = 0.0, flatweight = 0,
\ antiflicker1 = true, antiflicker2 = true,
\ protect_floor= 0, protect_bias = 12,
\ dering = -100, dering_weight= 1.0,
\ dering_floor = 8, dering_bias = 12,
\ detail_floor = 24,
\ EQ = 2, exborder = false,
\ warp_Y = true, warp_UV = true,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx = 40, cropy = 20
\ )

I still cant seem to get it to work? I got all the dll and everthing

Wilbert
4th May 2005, 09:40
First try this

LoadPlugin("C:\warpsharp\masktools.dll")
LoadPlugin("C:\warpsharp\warpsharp.dll")
LoadPlugin("C:\warpsharp\LoadPluginEx.dll") # only v2.0 plugins after this
LoadPlugin("C:\warpsharp\dustv5.dll")

AVISource("H:\capture.avi") # should be deinterlaced before feeding it to PixieDust
ConvertToYUY2() # if necessary
PixieDust()

gavo
4th May 2005, 22:11
Wilbert I did what u said and I got this
http://www.pix05.com/f/help7455.jpg
As you can see Pixiedust didnt seem to want to turn purple meaning it not working but it not giveing me a error. So I dunno if it working or not I dont notice a different. Help will be apperated.

Wilbert
5th May 2005, 23:08
1) Did you put iipx.avs in your plugin folder?

Next, try this

Import("C:\Program Files\AviSynth 2.5\plugins\IIPX.avs")
LoadPlugin("C:\warpsharp\masktools.dll")
LoadPlugin("C:\warpsharp\warpsharp.dll")
LoadPlugin("C:\warpsharp\LoadPluginEx.dll")
LoadPlugin("C:\warpsharp\dustv5.dll")

AVISource("H:\capture.avi")
iip( duststr = 4, dustweight = 1.0,
\ ss1_x = 1.33, ss1_y = 1.66,
\ detailcontr1 = 127, detailcontr2 = 208,
\ contr_radius = 3, PixSharp = 0.3,
\ ss2_x = 2.5, ss2_y = 3.5,
\ Xstren = 0, Xlimit = 255,
\ subpelstren = 0.0, flatweight = 0,
\ antiflicker1 = true, antiflicker2 = true,
\ protect_floor= 0, protect_bias = 12,
\ dering = -100, dering_weight= 1.0,
\ dering_floor = 8, dering_bias = 12,
\ detail_floor = 24,
\ EQ = 2, exborder = false,
\ warp_Y = true, warp_UV = true,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx = 40, cropy = 20 )


Do yet get any errors?

2) Did you try Cnr2? You might get better results with this.

gavo
7th May 2005, 23:12
Does anyone have the actual IIPX.avs ? I cant seem to find it to import it.

Didée
8th May 2005, 02:25
Really not? (http://forum.doom9.org/showthread.php?s=&postid=517100#post517100) ;)

gavo
8th May 2005, 05:57
I'm still geting a error when I try the load command in avisynth check out the script. I copy, pasted this and made it into a .avs I then put it in a import command and it didnt seem to wanta load.

The script to load everthing
code:--------------------------------------------------------------------------------# iip : Integrated Image Processor, v.0.5a
#
#
# ---------------
# | It is slow. |
# ---------------
#
# New in v.0.5 :
#
# EQ [int] : Edge quality. 0=deaktivated (don't do that!!!), 1=standard (as formerly), 2=better'n'slower, 3=evenbetter'n'evenslower
# Note: when using EQ = 2|3, then it's a good idea to *DEACTIVATE* deringing in iiP (don't hit the dog twice).
#
# warp_Y, warp_UV [bool] additional Luma & Chroma Warping.
#
# Luma warping should make the picture more 'gracile' when upsizing to bigger resolution, e.g. DVD -> HDTV.
# For same resolution or downsizing, it may (?) help for sources with distorted detail. Or it may not - YMMV.
#
# Chroma warping helps on sources with bleeding colors (e.g. Enterprise: on the uniforms, the red stripes are bleeding into
# the blue cloth, which looks *very* ugly [like an aquarell that's gotten wet]. It looks much better with chroma warping.)
# On clean sources, chroma warping is a waste of CPU cycles.
#
# exborder [bool] : exclude outmost 8-pixel-border from sharpening (gradient masked)
#
# dering: old method: called with positive values for "dering"
# new method: called with negative values for "dering" (better, but slower)
#
# detail_floor [int] : was formerly hardcoded, now user-definable. default 20.
#

function Ylevels(clip clp, int a, float gamma, int b, int c, int d)
{ wicked="x "+string(a)+" - "+string(b)+" "+string(a)+" - / 1 "+string(gamma)+" / ^ "+string(d)+" "+string(c)+" - * "+string(c)+" +"
# Reminder: Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +"
# return( clp.subtitle(wicked) )
return( clp.YV12LUT(Yexpr = wicked) )
}

function FineEdge( clip clp, int "div" )
{
logic( clp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", setdivisor=true, divisor=div)
\ ,clp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", setdivisor=true, divisor=div), "max", Y=3,U=1,V=1 )
}

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16

# Now I have the other idea - but it's too slow, yet
clp = antiflicker1 == true ? clp.temporalsoften(2,2,3,23,2) : clp

#---------------------------------------------------------------------------------------------------------------------
# Base denoising by PixieDust
#
dusted = clp.addborders(0,0,xcorr,ycorr).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-ycorr)
dusted = (dustweight==0.0) ? clp
\ : ( dustweight<1.00 ? Overlay(clp, dusted, opacity=dustweight)
\ : dusted )

soft=dusted.bicubicresize(xx_small,yy_small,.2,.4).bicubicresize(xx_ss1,yy_ss1,1.0,.0)

#---------------------------------------------------------------------------------------------------------------------
# Build EdgeMask to protect already sharp detail from oversharpening
#
YV12subtract( dusted.sharpen(0.6).sharpen(0.6), dusted.blur(1.0).blur(1.0) )

edge00 = bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
edge0=edge00
\ .YV12LUT(Yexpr="x 128 - abs "+string(protect_floor)+" - "+string(protect_bias)+" *")
\ .deflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1).blur(1.58)
edge00 = edge00.yv12lut(yexpr="x 128 - 2 *").expand(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask: +++ OLD ROUTINE +++
#
dering > 0 ? expand(Y=3,U=1,V=1) : NOP
edge1b = dering > 0
\ ? yv12subtract( expand(Y=3,U=1,V=1).blur(1.58),
\ inpand(Y=3,U=1,V=1),tol=1,wideRange=true )
\ .bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .yv12LUT(Yexpr="x 128 - abs "+string(dering_floor)+" - "+string(dering_bias)+" *")
\ .deflate(Y=3,U=1,V=1).blur(1.58)
\ : last
# .Ylevels(0,3.0,255,0,255)
#---------------------------------------------------------------------------------------------------------------------
# 1st supersampling stage to perform sharpening at
#

(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask & perform dering'ing: +++ NEW ROUTINE (Pre-processor) +++
#
tmpp = string(dering_floor)
edge1b = dering < 0
\ ? yv12subtract( last, last.xsharpen(255,255),tol=1,wideRange=true )
\ .yv12lut(yexpr="x 128 - abs "+tmpp+" *")
\ .expand().inflate().expand().inflate().FineEdge(dering_bias).blur(1.58)
\ .greyscale.Ylevels(19,1.6,208,0,255)
\ : edge1b
dering < 0 ? maskedmerge( last, soft, edge1b, Y=3,U=1,V=1, useMMX=true ) : NOP

#-------- iterative sharpening, currently only 3-fold: its slow enough ... --------

temp = last
shrpcnt = 0
mskcnt = 0
shrpcnt = (PixSharp != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr2 != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr1 != 0) ? shrpcnt + 1 : shrpcnt
mskcnt = (EQ>shrpcnt) ? shrpcnt : EQ

# Stage 1 : UnsharpMasking, wide radius -----------------------
detailcontr1 != 0
\ ? unsharpmask(detailcontr1,contr_radius,0)
\ : NOP
detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.expand.inflate.inflate, Y=3,U=1,V=1,useMMX=true)
\ : NOP
mskcnt = (detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr1 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 2 : UnsharpMasking, small radius ----------------------
detailcontr2 != 0
\ ? unsharpmask(detailcontr2, 1,0)
\ : NOP
detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.inflate.inflate,Y=3,U=1,V=1,useMMX=true)
\ : NOP
mskcnt = (detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr2 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 3 : per-pixel sharpening ------------------------------
PixSharp != 0.0
\ ? sharpen( PixSharp )
\ : NOP
PixSharp != 0.0 && shrpcnt > 0 && EQ>0
\ ? MaskedMerge(last,temp,edge0, Y=3,U=1,V=1,useMMX=true)
\ : NOP
undot()

#---------------------------------------------------------------------------------------------------------------------
# DeRing'ing of sharpen'ed clip: +++ OLD ROUTINE (Post-processor) +++
#
dering > 0 ? MaskedMerge(last,last.unfilter(-dering,-dering),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1,useMMX=true)
\ : NOP

# Now I have the other idea - but it's too slow, yet
antiflicker2 == true ? temporalsoften(1,2,3,23,2) : NOP

#---------------------------------------------------------------------------------------------------------------------
# 2nd supersampling stage to perform SubPel operation & XSharpening at
#
# Notes: Luma Warping - may help for sources that are hard to get a "clean" picure from.
# - Should help making the picture a little more "gracile" when doing DVD -> HDTV upsizing

xx_ss2 != ox || yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

warp_Y ? awarpsharp(depth=(ss2_x+ss2_y)/2*3,thresh=0.5,blurlevel=2,cm=0) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

#---------------------------------------------------------------------------------------------------------------------
# Build new EdgeMask of the enhanced clip
#
edge2 = bicubicresize(int(dest_x/1.75/16+.5)*16,int(dest_y/1.75/16+.5)*16,1.0,.0)
\ .DEdgeMask(0,255,0,255,"-5 -7 -5 -7 48 -7 -5 -7 -5",Y=3,U=1,V=1,useMMX=true,setdivisor=true,divisor=1)
bordermask = blankclip(edge2,width=dest_x-16,height=dest_y-16,color=$FFFFFF)
\ .addborders(2,2,2,2,color=$8F8F8F).addborders(2,2,2,2,color=$6F6F6F)
\ .addborders(2,2,2,2,color=$202020).addborders(2,2,2,2,color=$000000)
edge2 = edge2
\ .levels( (detail_floor+int(detailcontr1/15+detailcontr2/30+PixSharp*15)), 4.0,128,flatweight,255,false)
\ .bicubicResize(dest_x,dest_y,1.0,0)
edge2 = exborder ? edge2.logic(bordermask,"min") : edge2
edge2 = edge2
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .blur(1.58).greyscale()
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .temporalsoften(1,63,63,255,2)

#---------------------------------------------------------------------------------------------------------------------
# Put original de-noised & not-sharpened clip into areas still appearing flat, after all that sharpening
#
MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1,useMMX=true)

#---------------------------------------------------------------------------------------------------------------------
# Chroma Warping - often useful for sources where colors are "bleeding". Superfluid for clean sources.
#
warp_UV ? MergeChroma( aWarpSharp(depth = 8.5 * (dest_x/ox + dest_y/oy), thresh=0.5, cm=1, blurlevel=2) ) : NOP

#---------------------------------------------------------------------------------------------------------------------
# Visualizations
#
debug == "dering" ? overlay(last,blankclip(last,color=$00A000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP
debug == "protect" ? overlay(last,blankclip(last,color=$00A000),mask=edge0.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "detail" ? overlay(last,blankclip(last,color=$00A000),mask=edge2.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "compareH" ? stackhorizontal(clp.lanczosresize(dest_x,dest_y).crop(cropx,0,-cropx,-0).addborders(0,0,4,0,color=$800000).subtitle("Original"),
\ last.crop(cropx,0,-cropx,-0).subtitle("iiP") )
\ : NOP
debug == "compareV" ? stackvertical(clp.lanczosresize(dest_x,dest_y).crop(0,cropy,-0,-cropy).addborders(0,0,0,4,color=$800000).subtitle("Original"),
\ last .crop(0,cropy,-0,-cropy).subtitle("iiP") )
\ : NOP
debug == "showall" ? stackvertical( stackhorizontal( edge0 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,4,color=$800000).subtitle("Protection of sharp edges"),
\ edge1b.greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,0,4,color=$800000).subtitle("DeRing'ing") ),
\ stackhorizontal( edge2 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,0,color=$800000).subtitle("Detail areas"),
\ last .crop(cropx,cropy,-cropx,-cropy).subtitle("iiP") ) )
\ : NOP

return(last)
}

#
I then tryed to load it with this
Import("C:\Program Files\AviSynth 2.5\plugins\IIPX.avs")
LoadPlugin("C:\warpsharp\masktools.dll")
LoadPlugin("C:\warpsharp\warpsharp.dll")
LoadPlugin("C:\warpsharp\LoadPluginEx.dll")
LoadPlugin("C:\warpsharp\dustv5.dll")

AVISource("H:\capture.avi")
iip( duststr = 4, dustweight = 1.0,
\ ss1_x = 1.33, ss1_y = 1.66,
\ detailcontr1 = 127, detailcontr2 = 208,
\ contr_radius = 3, PixSharp = 0.3,
\ ss2_x = 2.5, ss2_y = 3.5,
\ Xstren = 0, Xlimit = 255,
\ subpelstren = 0.0, flatweight = 0,
\ antiflicker1 = true, antiflicker2 = true,
\ protect_floor= 0, protect_bias = 12,
\ dering = -100, dering_weight= 1.0,
\ dering_floor = 8, dering_bias = 12,
\ detail_floor = 24,
\ EQ = 2, exborder = false,
\ warp_Y = true, warp_UV = true,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx = 40, cropy = 20 )

It gave me this error http://img108.echo.cx/img108/2442/clipboard013ls.jpg (http://www.imageshack.us)

Didée
8th May 2005, 06:39
1) Do *not* put the iiP script into AviSynth/Plugins. Put it into another folder. (basically it should not matter 'cause of ".avs" instead of ".avsi" ... but still.)

2) Make sure your text editor is not using unicode - that's known to cause non-working scripts.

3) Also get "unfilter.dll" from tbarry. It is used from iiP.

4) If you use a recent version of maskTools, you'll get more errors until you've deleted all instances of ",useMMX=true" from the script. (Will work OK with MaskTools v1.4.6, though.)


BTW, how do you come to the "X" in "iiPX.avs" ... ?


- edit -

Oh, and your import command " Import("C:\Program Files\AviSynth 2.5\plugins\IIPX.avs") " does not correspond with the error you're getting: "couldn't import C:\IIPX.avs".

Can you open more simple scripts sucessfully, or is iiP your 1st try on AviSynth?

gavo
8th May 2005, 07:04
http://img114.echo.cx/img114/8788/z0jn.jpg (http://www.imageshack.us)

http://img107.echo.cx/img107/3565/clipboard025jj.jpg (http://www.imageshack.us)

Works fine with normal script but didnt like the ipp.

gavo
12th May 2005, 10:01
Hey I have small 5 mb clip of what exactly is going wrong for me. Please take (http://s42.yousendit.com/d.aspx?id=2ED18550Y1EKH0WBKGHJ7CWK4R) a look.

dragonfly
14th May 2005, 14:48
I watched the movie, but I couldn't find anything wrong yet.
Don't have the time right now, but I'll have a look at it later.
Could you please open the script in media player classis and post what kind of error you get?

Gannjunior
26th May 2005, 13:40
I'm going to encode an old tv series (The Flash) i kept in VHS 15 years ago. My tv signal weren't good and so here you are a screenshot of raw digitalization:

http://img93.echo.cx/img93/1613/flash5kf.png

Any suggestion of filters avisynth's combo to manage this?
I tried dust, but it's not enough...

TIA

ciao!