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. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#61 | Link |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
extract avsi files inside functions.7z and put them in your avisynth autoload folder
and run the script below Code:
LWLibAVVideoSource("clip") convert8to16 (tv_range=true) EDIResize16(output="rgb48y",edimode="eedi3+nnedi3_repaired",noring=true,curve="linear") #Dither_y_gamma_to_linear (tv_range_in=False, tv_range_out=False, curve="709",sigmoid=false) #Dither_y_linear_to_gamma (tv_range_in=False, tv_range_out=False, curve="srgb",sigmoid=false) YTo420_16() soft=last softo=soft LWLibAVVideoSource("clip") convert8to16 (tv_range=true) converttoy8 ().tv2pc16 () #Dither_y_gamma_to_linear (tv_range_in=False, tv_range_out=False, curve="709",sigmoid=false) #Dither_y_linear_to_gamma (tv_range_in=False, tv_range_out=False, curve="srgb",sigmoid=false) YTo420_16() search=last searcho=search soft converttoy8 () LimitClip16(str=1.0, curve="srgb", tv_range=false) LimitClip16(str=1.0, curve="srgb", tv_range=false) YTo420_16() limit=last soft converttoy8 () a=last LimitClip16(str=1.0, curve="srgb", tv_range=false) LimitClip16(str=1.0, curve="srgb", tv_range=false) LimitClip16(str=1.0, curve="srgb", tv_range=false) dither_sub16 (last,a,dif=true,y=3,u=3,v=3) YTo420_16() dif=last soft converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superclip=last superclipo=superclip search converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() supersearch=last supersearcho=supersearch limit converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last soft=soft.selectevery (3,0) dif=dif.selectevery (3,0) limit=limit.selectevery (3,0) pre=search superclip=superclip.selectevery (3,0) superdif=superdif.selectevery (3,0) superlimit=superlimit.selectevery (3,0) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) r=last soft=soft.selectevery (3,1) dif=dif.selectevery (3,1) limit=limit.selectevery (3,1) pre=search superclip=superclip.selectevery (3,1) superdif=superdif.selectevery (3,1) superlimit=superlimit.selectevery (3,1) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) g=last soft=soft.selectevery (3,2) dif=dif.selectevery (3,2) limit=limit.selectevery (3,2) pre=search superclip=superclip.selectevery (3,2) superdif=superdif.selectevery (3,2) superlimit=superlimit.selectevery (3,2) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) b=last soft=interleave (r,g,b) search converttoy8 () LimitClip16(str=1.0, curve="srgb", tv_range=false) LimitClip16(str=1.0, curve="srgb", tv_range=false) YTo420_16() limit=last search converttoy8 () a=last LimitClip16(str=1.0, curve="srgb", tv_range=false) LimitClip16(str=1.0, curve="srgb", tv_range=false) LimitClip16(str=1.0, curve="srgb", tv_range=false) dither_sub16 (last,a,dif=true,y=3,u=3,v=3) YTo420_16() dif=last limit converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last search=search.DeconvLimit16(pre=search, dif=dif, limit=limit, superclip=supersearch, superpre=supersearch, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) soft ShrinkSharp16(original=softo, str=1.0, tv_range=False) ShrinkSharp16(original=softo, str=1.0, tv_range=False) limit=last soft a=last ShrinkSharp16(original=softo, str=1.0, tv_range=False) ShrinkSharp16(original=softo, str=1.0, tv_range=False) ShrinkSharp16(original=softo, str=1.0, tv_range=False) dither_sub16 (last,a,dif=true,y=3,u=3,v=3) dif=last soft converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superclip=last search converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() supersearch=last limit converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last soft=soft.selectevery (3,0) dif=dif.selectevery (3,0) limit=limit.selectevery (3,0) pre=search superclip=superclip.selectevery (3,0) superdif=superdif.selectevery (3,0) superlimit=superlimit.selectevery (3,0) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) r=last soft=soft.selectevery (3,1) dif=dif.selectevery (3,1) limit=limit.selectevery (3,1) pre=search superclip=superclip.selectevery (3,1) superdif=superdif.selectevery (3,1) superlimit=superlimit.selectevery (3,1) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) g=last soft=soft.selectevery (3,2) dif=dif.selectevery (3,2) limit=limit.selectevery (3,2) pre=search superclip=superclip.selectevery (3,2) superdif=superdif.selectevery (3,2) superlimit=superlimit.selectevery (3,2) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) b=last limit=interleave (r,g,b) search ShrinkSharp16(original=searcho, str=1.0, tv_range=False) ShrinkSharp16(original=searcho, str=1.0, tv_range=False) limit=last search a=last ShrinkSharp16(original=searcho, str=1.0, tv_range=False) ShrinkSharp16(original=searcho, str=1.0, tv_range=False) ShrinkSharp16(original=searcho, str=1.0, tv_range=False) dither_sub16 (last,a,dif=true,y=3,u=3,v=3) dif=last limit converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last limit_s=search.DeconvLimit16(pre=search, dif=dif, limit=limit, superclip=supersearch, superpre=supersearch, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) softo Deconv16 (dif=true, tv_range=false) dif=last limit converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last soft=softo.selectevery (3,0) dif=dif.selectevery (3,0) limit=limit.selectevery (3,0) pre=searcho superclip=superclipo.selectevery (3,0) superdif=superdif.selectevery (3,0) superlimit=superlimito.selectevery (3,0) superpre=supersearcho soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) r=last soft=softo.selectevery (3,1) dif=dif.selectevery (3,1) limit=limit.selectevery (3,1) pre=searcho superclip=superclipo.selectevery (3,1) superdif=superdif.selectevery (3,1) superlimit=superlimito.selectevery (3,1) superpre=supersearcho soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) g=last soft=softo.selectevery (3,2) dif=dif.selectevery (3,2) limit=limit.selectevery (3,2) pre=searcho superclip=superclipo.selectevery (3,2) superdif=superdif.selectevery (3,2) superlimit=superlimito.selectevery (3,2) superpre=supersearcho soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) b=last soft=interleave (r,g,b) searcho Deconv16 (dif=true, tv_range=false) dif=last limit_s converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last search=searcho.DeconvLimit16(pre=searcho, dif=dif, limit=limit_s, superclip=supersearcho, superpre=supersearcho, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) soft ShrinkSharp16(original=softo, str=1.0, tv_range=False) ShrinkSharp16(original=softo, str=1.0, tv_range=False) limit=last soft a=last ShrinkSharp16(original=softo, str=1.0, tv_range=False) ShrinkSharp16(original=softo, str=1.0, tv_range=False) ShrinkSharp16(original=softo, str=1.0, tv_range=False) dither_sub16 (last,a,dif=true,y=3,u=3,v=3) dif=last soft converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superclip=last search converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() supersearch=last limit converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superlimit=last dif converttoy8 () GenSuperclip16(pel=4, tv_range=false, curve="srgb") YTo420_16() superdif=last soft=soft.selectevery (3,0) dif=dif.selectevery (3,0) limit=limit.selectevery (3,0) pre=search superclip=superclip.selectevery (3,0) superdif=superdif.selectevery (3,0) superlimit=superlimit.selectevery (3,0) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) r=last soft=soft.selectevery (3,1) dif=dif.selectevery (3,1) limit=limit.selectevery (3,1) pre=search superclip=superclip.selectevery (3,1) superdif=superdif.selectevery (3,1) superlimit=superlimit.selectevery (3,1) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) g=last soft=soft.selectevery (3,2) dif=dif.selectevery (3,2) limit=limit.selectevery (3,2) pre=search superclip=superclip.selectevery (3,2) superdif=superdif.selectevery (3,2) superlimit=superlimit.selectevery (3,2) superpre=supersearch soft.DeconvLimit16(pre=pre, dif=dif, limit=limit, superclip=superclip, superpre=superpre, superdif=superdif, superlimit=superlimit, dct=1, str=1.00, tv_range=false) b=last interleave (r,g,b) |
![]() |
![]() |
![]() |
#62 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
Summary of fine sharpening package for HD Material.
Thanks very much to feisty2 for his extensive help! Step 1: Sharpen The following simple but highly effective unsharp mask will emphasize only fine detail contrast for Full HD material and will add no edge halos if parameter w is set to low values. feisty2 suggested another very interesting approach with the dither-tool, but after extensive testing I came back to my first approach: It creates a tiny bit less halos / mid contrast, it is faster, it is simpler because it does not need dither. Code runs very fast. With multitasking put ahead you might process more than 35 fps (full HD) on a quadcore: Code:
# Step 0: Multitasking options (Avisynth 2.6) SetMemoryMax(1024) SetMTMode(2,8) # Try SetMTMode(3,8) if you run into troubles # Step 1: Sharpen AviSource("blabla.avi") convertToYV12 # YV12 is needed by binomial blur s=100 # strength of sharpen. If steps 2 and 3 are applied: try 80-100 (donīt go beyond). Step 1 only: try 40 to 70 w=4 # width of sharpen. If steps 2 and 3 are applied: try 3-5. Step 1 only: try 1-2. Larger w = larger halos i=last.binomialBlur(varY=0.5, varC=0, Y=3, U=2, V=2,useMMX=true) j=subtract(i,last).levels(0+s,1,255-s,0,255) w=w*(128/s) k=j.levels(127-w,1,128+w,127-w,128+w) subtract(last,k) One optional single line helps to effectively remove remaining edge halos e.g. from preprocessing. Thanks Didier for this brilliant filter (that you should not forget to download from the avisynth pages). Setting supersampling (Parameter ss) to 1.5 rather than 1.0 will slow down processing-speed to 40% but helps a little with anti-aliasing (reduce stairs on linear structures). Code:
DeHalo_alpha(highsens=100,ss=1.0) # highsens adjusted to address larger halos and to nicely fit into the package This step slows down processing heavily (to some 4 fps) but helps a lot. Emphasizing fine detail might lead to fine grain flickering. Mdegrain averages out ("calms") fine grain using adjacent frames. There is no relevant drop of sharpness with that step. As additional gift Mdegrain also calms fine sensor chroma noise to make it considerably less obtrusive. Mdegrain also brings back a natural look to diffuse structures like clouds which could have been overstructured here and there by the sharpening process. Highly recommended! Code:
super = MSuper(pel=2, sharp=1) bv2 = MAnalyse(super, isb = true, delta = 2, overlap=4) bv1 = MAnalyse(super, isb = true, delta = 1, overlap=4) fv1 = MAnalyse(super, isb = false, delta = 1, overlap=4) fv2 = MAnalyse(super, isb = false, delta = 2, overlap=4) MDegrain2(super,bv1,fv1,bv2,fv2,thSAD=400) Have fun with this package and thanks to all thread partcipants who had helped me so generously. Last edited by Hotte; 18th November 2014 at 22:50. |
![]() |
![]() |
![]() |
#63 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
Just to add one thing:
You can boooost detail sharpness by chaining more unsharp masks with lower sharpness settings together. Performance effects are almost irrelevant. Itīs so fast. s=100 w=4 like in Step 1 above gives me a well visible moderate detail sharpness amplification (in connection with dehalo_alpha and MDegrain2). If I go beyond 100 (up to the limit of 127) I am getting small whitish spots ("snow") instead of more sharpness if I zoom in to see what happens. Results will be a lot better and even sharper if I chain unsharp masks together. But be careful to choose low sharpness and width settings otherwise you either get something to shave your beard or the chain collapses to strange results. I found that going lower than s=30 or higher than s=70 will not behave like expected if masks are being chained together. Outside these boundaries the behaviour is not linear anymore. So you need to experiment with the parameters s and w to squeeze out the very best sharpness for your individual full-hd footage. Exchanging Step 1 with the following lines gives me really excellent and well balanced detail sharpness, no halos, very few artefacts and calm grain (if MDregrain2 or 3 applied): Code:
s=30 w=1 i=last.binomialBlur(varY=0.5, varC=0, Y=3, U=2, V=2, useMMX=true) j=subtract(i,last).levels(0+s,1,255-s,0,255) w=w*(128/s) k=j.levels(127-w,1,128+w,127-w,128+w) subtract(last,k) s=30 w=1 i=last.binomialBlur(varY=0.5, varC=0, Y=3, U=2, V=2, useMMX=true) j=subtract(i,last).levels(0+s,1,255-s,0,255) w=w*(128/s) k=j.levels(127-w,1,128+w,127-w,128+w) subtract(last,k) See the detail views taken out of a 1920x1080 clip in the attachments. s=100 w=4 (Step 1), 2 times s=30 w=1 (chained), Edius NLE internal sharpener set to 28 and original compared. Last edited by Hotte; 22nd November 2014 at 10:32. |
![]() |
![]() |
![]() |
#64 | Link | |
Registered User
Join Date: Nov 2006
Posts: 90
|
http://avisynth.nl/index.php/Levels
Quote:
Last edited by SSH4; 22nd November 2014 at 11:39. |
|
![]() |
![]() |
![]() |
#65 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
I did not experience any relevant color shift with my clips.
Concerning performance Step 1 is very, very fast. 90% of processing time goes into (optional) MDegrain. Iīd be happy if you find things to improve, however I am not experienced enough to translate the code above into Masktools, Tweak or ColorYUV. It would be great if you could help out with a code example - Thanks! |
![]() |
![]() |
![]() |
#66 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
feisty2, should you listen:
could you tell me, if there is a parameter in "Function SharpLimit16 ()" to adjust the width (radius if you want) of sharpness, rather than the strength (represented by the str-parameter). Thanks |
![]() |
![]() |
![]() |
#67 | Link |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 739
|
I do not want to interrupt your conversation with feisty2, but I find it very interesting what you're doing and want to contribute something.
If you want to use a script that allows you to clean the image while sharpness I leave him this: You could modify including DeHalo. You can adjust the brightness and contrast try this: YLevels (download masktools2 version) SmoothAdjust Fusion Last edited by GMJCZP; 27th November 2014 at 00:38. |
![]() |
![]() |
![]() |
#69 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
GMJCZP, thanks for your feedback. Especially YLevels looks interesting as a replacement for levels. Could improve high sharpening levels - maybe. Also Iīll have a look what Didierīs script is good for.
I will give it a try at the next opportunity. Hopefully YLevels behaves like levels, otherwise it will be getting difficult since I only have a basic understanding what the code does - but not in deep. The other commands I honestly do not know where they could add something to the issue. I do not really adjust contrast nor brightness. It's just an unsharp mask. feisty2 - got the idea now. Well it actually does sharpen - and not too bad, really! Even though it was not meant for that - funny. I am still really fascinated what these few codelines do to my videos. Looking at MDegrain alone: The results come next to a miracle. Last edited by Hotte; 28th November 2014 at 00:06. |
![]() |
![]() |
![]() |
#70 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
GMJCZP, I tried ylevels: I replaced the two levels-statements with ylevels leaving all the parameters as they were.
Sharpen works with ylevels, but differences are big: With ylevels sharpening affects more mid-detail rather than fine-detail and creates much stronger halos with my full-HD footage. On the chroma side there was no visible improvement. I donīt know what it is in this old code of Step 1 but with no other solution I tried before have I seen this special micro-contrast enhancement affecting only fine structures and giving a perception I would describe as 'discreet bottom-up' sharpness - for anyone who likes it - of course. More comments and suggestions are welcome any time. Last edited by Hotte; 28th November 2014 at 00:08. |
![]() |
![]() |
![]() |
#71 | Link | |
Registered User
Join Date: Nov 2006
Posts: 90
|
Quote:
Limit amount of overshoot and undershoot from Sharp filter. Code:
src=last overshoot=4 undershoot=16 blr=0.5 i=src.binomialBlur(varY=blr, varC=0, Y=3, U=2, V=2, useMMX=true) a=mt_makediff(i,src,u=2,v=2,chroma="128") #equal your substract() x=mt_makediff(src,a, y=3, U=3, V=3) #equal your second substract() that create Sharp mt_clamp(x,src,src,overshoot,undershoot) #this line limit amount of previous step no more than +4 and not less than -16 from original pixel value |
|
![]() |
![]() |
![]() |
#72 | Link | |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 739
|
Quote:
|
|
![]() |
![]() |
![]() |
#73 | Link |
Registered User
Join Date: Oct 2014
Posts: 209
|
GMJCZP, I tried all the ylevel-functions now. Sorry to tell that all show similar characteristics concerning unsharp mask. They will all show much more halos and more mid-detail rather than fine detail enhancement, so stay behind in terms of fine-sharpening. But anyway thanks for your feedback.
|
![]() |
![]() |
![]() |
Tags |
detail, fine, full-hd, sharpen, unsharp mask |
Thread Tools | Search this Thread |
Display Modes | |
|
|