Lieber Besucher, herzlich willkommen bei: Amateurfilm-Forum. Falls dies dein erster Besuch auf dieser Seite ist, lies bitte die Hilfe durch. Dort wird dir die Bedienung dieser Seite näher erläutert. Darüber hinaus solltest du dich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutze das Registrierungsformular, um dich zu registrieren oder informiere dich ausführlich über den Registrierungsvorgang. Falls du dich bereits zu einem früheren Zeitpunkt registriert hast, kannst du dich hier anmelden.
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
#Helper functions: #motion compensated framerate converter; yv12 only function mvfps(clip i, float fps, int "blur") { blur=default(blur,1) fwd=mvtools0962_mvanalyse(i,isb=false,lambda=400) bwd=mvtools0962_mvanalyse(i,isb=true, lambda=400) i.mvtools0962_mvconvertfps(bwd,fwd,fps=fps*blur) temporalsoften(round((blur)/3),255,255) selectevery(blur,round(blur/2)) } #revert PAL-DV to YV12 for quality reasons; needs yuy2 input (ie. canopus-dv-decoder) function reYV12(clip i) { yx=i.converttoyv12().greyscale() x=i.separatefields().separatefields().selectevery(4,0,2).weave() ux=x.utoy().converttoyv12() vx=x.vtoy().converttoyv12() ytouv(ux,vx,yx) } function MVbob(clip c,int "blksize", int "pel", int "lambda", int "th", int "ths", int "bobth", bool "predenoise") { #find static parts (experimental) function static_o_matic(clip i, clip j, int thy, int thc) { a=i.converttoyv12().motionmask(thy1=0,thy2=thy,thc1=0,thc2=thc,thSD=255,y=3,u=3,v=3) logic(a,a.trim(1,0),"OR",y=3,u=3,v=3) undot() overlay (i,j, mask=last) } #disable all scene detection of mvcompensate(), because mvbob() is self-correcting due to the corrector() sc=255 # threshold for correcting failed compensated motion th=default(th,8) # threshold for correcting static areas ths=default(ths,3) # deinterlacing threshold for the motion vector analysis do not go much higher than 10 bobth=default(bobth,8) #denoise the video for the bobber (better static areas for noisy video, crappy) predenoise=default(predenoise,false) #defaults for the mocomp blksize=default(blksize,8) scd=(blksize==8)? 300 : round(300/4) pel=default(pel,2) lambda=default(lambda,1000) #determine clip Fieldorder order=(c.getparity==true)? 1:0 yv12 = isyv12(c) # bobx -> kerneldeinterlaced video, used for motion search # mvf -> motion vectors forward # mvb -> motion vectors backward # bobd -> blurred bobx for error checking (correcting false compensated blocks!) # bobdf -> forward compensated bobd # bobdb -> backward compensated bobd # bobdm -> average of bobdb and bobdf # fields-> ELA-deinterlaced fields for motion compensated output and compensation correction # mcf -> forward compensated fields # mcb -> backward compensated fields # cv -> average of mcb and mcf # dpf -> forward compensated fields (global motion) # dpb -> backward compensated fields (global motion) # dp -> average of dpb and dpf # mc -> corrected motion compensated result # create clip for motion analysis and hole-filling bobt=predenoise ? c.temporalsoften(2,5,10) : c bobc=bobt.leakkernelbob(order=order,threshold=bobth,twoway=true,sharp=true) bobc= (order==1) ? bobc.assumetff() : bobc.assumebff() bobx= yv12 ? bobc : bobc.converttoyv12() bobd=bobx.undot().verticalreduceby2() bobd=bobd.lanczos4resize(bobx.width,bobx.height).blur(0,1) # create clip for motion compensation fieldsx = c.tdeint(mode=1,mthreshl=bobth,mthreshc=bobth+2,type=3,Link=0) fields= yv12 ? fieldsx : fieldsx.converttoyv12() # create motion vectors mvf=bobd.mvanalyse(blksize=blksize,pel=pel,isb=false,chroma=true)#,search=3,searchparam=10) mvb=bobd.mvanalyse(blksize=blksize,pel=pel,isb=true, chroma=true)#,search=3,searchparam=10) # create clips for mismatch detection #local motion bobdf=bobd.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc) bobdb=bobd.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc) bobdm=bobdf.mergeluma(bobdb,0.5).mergechroma(bobdb,0.5) #global motion # bobdpf=fields.MVDepan(mvf, zoom=true, rot=true, pixaspect=1.0 ) # bobdpb=fields.MVDepan(mvb, zoom=true, rot=true, pixaspect=1.0 ) # bobdpm=bobdpf.mergeluma(bobdpb,0.5).mergechroma(bobdpb,0.5) # create the motion compensated clip that are passe to the output #local motion mcf=fields.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc).deblock() mcb=fields.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc).deblock() cv=mcf.mergechroma(mcb,0.5).mergeluma(mcb,0.5) #global motion # dpf=fields.MVDepan(vectors=mvf, zoom=false, rot=false, pixaspect=1.0,thscd1=scd,thSCD2=sc,info=false,error=255 ) # dpb=fields.MVDepan(vectors=mvb, zoom=true, rot=true, pixaspect=1.0,thscd1=scd,thSCD2=sc, info=false,error=255 ) # dp=dpf.mergechroma(dpb,0.5).mergeluma(dpb,0.5) # detect mismatches of mvtools and replace them with motion adaptive bobbed areas mc=corrector(bobd,fields, bobdf,bobdb, mcf,mcb, mode=0,th=th) #mc=corrector(bobd,fields, bobdpf,bobdpb,bobdf,bobdb, dpf,dpb,mcf,mcb, mode=0,th=th) # merge corrected output and raw output into one frame horizontally mc=stackhorizontal(mc,cv) # select the correct lines compensated_even=(order==0) ? mc.selecteven().separatefields().selectodd() : mc.selecteven().separatefields().selectodd() compensated_odd =(order==0) ? mc.selectodd() .separatefields().selecteven() : mc.selectodd() .separatefields().selecteven() # ensure correct chroma format compensated_even=yv12 ? compensated_even : compensated_even.converttoyuy2() compensated_odd =yv12 ? compensated_odd : compensated_odd .converttoyuy2() # merge them with the original fields original_even=c.separatefields().selecteven()#.lev(0) original_odd =c.separatefields().selectodd()#.lev(0) even=interleave(stackhorizontal(original_even, original_even), compensated_even).weave() odd =interleave(stackhorizontal(original_odd , original_odd ), compensated_odd ).weave() interleave(even,odd) #separate into corrected and raw video || correct static areas mc_corr=crop(last,0,0,width/2,0) mc_raw =crop(last,width/2,0,0,0) static_o_matic(mc_raw,mc_corr,ths,ths) # some lines for developement, visualisation and comparision.... uncomment if wished... # stackhorizontal(last,fieldsx) #show mvdeinterlaced and t-deinterlaced video side by side for comparsion # interleave(last,fieldsx) #alternate mv- and t-deinterlaced video } loadplugin("C:\Programme\avisynth2\plugins\tdeint.dll") loadplugin("C:\Programme\avisynth2\plugins\leakkerneldeint.dll") loadplugin("C:\Programme\avisynth2\plugins\masktools.dll") loadplugin("C:\Programme\avisynth2\plugins\MVTools0962.dll") loadplugin("C:\Programme\avisynth2\plugins\MVtools0991.dll") LoadPlugin("C:\Programme\avisynth2\plugins\undot.dll") |
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »Gortosch« (25. Oktober 2005, 00:58)
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
SetMemoryMax(384) LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\kerneldeint.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\MaskTools-p4-5.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\FastEDIUpsizer.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\SangNom.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\TDeint.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\warpsharp.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\aWarpSharp.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\AddGrain.dll") LoadPlugin("c:\Programme\AviSynth 2.5\plugins2\DegrainMedian.dll") Import("c:\Programme\AviSynth 2.5\plugins2\LimitedSharpen.avs") Import("c:\Programme\AviSynth 2.5\plugins2\EdgeSmooth.avs") Import("c:\Programme\AviSynth 2.5\plugins2\EdgeSmoothFast.avs") Import("c:\Programme\AviSynth 2.5\plugins2\reinterpolate420.avs") Import("c:\Programme\AviSynth 2.5\plugins2\mvbob.avs") DirectShowSource("C:\DV-Datei.avi") assumeBFF() # Unteres Halbbild zuerst, sonst assumeTFF() reinterpolate420() # Glättet DV Chroma Artefakte mvbob() # Deinterlacing auf 50 fps SelectEven() # entfernt jedes 2 Bild -> 25fps DegrainMedian(interlaced=false, limitY=4,limitUV=15,mode=2) ConvertToYV12(interlaced=false) EdgeSmoothFast(strength=48,hiQ=true, twoway=true) LimitedSharpen(ss_x=2.2, ss_y=2.2, Smode=1, strength=300) ConvertToYUY2(interlaced=false) |
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function EdgeSmoothFast(clip clp, int "strength", bool "hiQ", bool "twoway") { str = default( strength, 48 ) hiQ = default( hiQ, false ) twoway = default( twoway, false ) xpos = hiQ ? 0.5 : 0.0 xmul = hiQ ? 2 : 1 ox = clp.width() oy = clp.height() clp.pointresize(ox*xmul,oy*2) sangnom(order=0,aa=str) twoway ? ( hiQ ? turnleft().sangnom(order=1,aa=str).turnright().bicubicresize(ox,oy, 0.0,0.5, 0.5,0.5,ox*2,oy*2) \ : bicubicresize(ox,oy, 0.0,0.5, 0,0.5,ox,oy*2).turnleft() \ .pointresize(oy,ox*2).sangnom(order=0,aa=str).bicubicresize(oy,ox, 0.0,0.5, 0.5,0.5,oy,ox*2).turnright() \ ) : bicubicresize(ox,oy, 0.0,0.5, 0,0.5,ox*xmul,oy*2) } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »freezer« (25. Oktober 2005, 10:02)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Gortosch« (25. Oktober 2005, 13:31)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »freezer« (25. Oktober 2005, 13:34)
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Gortosch« (25. Oktober 2005, 14:15)
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 |
function reinterpolate420(clip x) { u=x.utoy() v=x.vtoy() u=u.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave() v=v.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave() ytouv(u,v,x) } |
Dieser Beitrag wurde bereits 10 mal editiert, zuletzt von »Gortosch« (25. Oktober 2005, 19:07)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »freezer« (26. Oktober 2005, 00:50)
Zitat
Original von freezer
Zusätzlich hat PicVideo im 4:2:2 die doppelte Chromaauflösung gegenüber DV mit 4:2:0.