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. |
14th November 2017, 17:14 | #3741 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Quote:
Other speed tests are welcome, that's why there are optXXX parameters. Code:
results in fps avx2: set it only in Expr through optAvx2 parameter bits i5 sse2 32/64 bit i5Avx2 32/64 bit 8 17.00 19.30 24.63 28.98 16 15.69 17.59 20.38 23.26 32 12.70 13.59 16.03 17.14 Code:
lsmashvideosource("13HoursCUT.mp4", format="YUV444P8") Spline64Resize(486,240) #resize, result is a multistacked image src=last # expr c8 = CalcTest(src,8, False) c16 = CalcTest(src,16, False) c32 = CalcTest(src,32, False) # lutxy c8e = CalcTest(src,8, True) c16e = CalcTest(src,16, True) c32e = CalcTest(src,32, True) res8=Diff(c8,src) res16=Diff(c16,src) res32=Diff(c32,src) res8e=Diff(c8e,src) res16e=Diff(c16e,src) res32e=Diff(c32e,src) col1=StackVertical(c8,c16.convertbits(8),c32.convertbits(8)) col2=StackVertical(res8, res16, res32) col3=StackVertical(c8e,c16e.convertbits(8),c32e.convertbits(8)) col4=StackVertical(res8e, res16e, res32e) StackHorizontal(col1, col2, col3, col4) #used only c8, c16 or c32 output for speed test from the clips above. # change parameters. e.g. optSSE2=true, optSingleMode=false, optAvx2=false c8 Function Diff(clip src1, clip src2) { return Subtract(src1.ConvertBits(8),src2.ConvertBits(8)).Levels(120, 1, 255-120, 0, 255, coring=false) } Function CalcTest(clip src, int bits, bool lut) { src convertbits(bits) tmp=last method=Blur(1) szrp=16 spwr=4 str=100/100.0 sdmplo=4 sdmphi=48 expr_pow = "x y == x x x y - abs "+string(Szrp) +" scaleb / 1 "+string(Spwr)+" / ^ "+string(Szrp) +" scaleb * "+string(str)+" * x y - 2 ^ x y - 2 ^ " \+string(SdmpLo)+" scaleb scaleb + / * x y - x y - abs / * 1 "+string(SdmpHi)+" scaleb 0 == 0 x y - abs "+string(SdmpHi)+" scaleb / 4 ^ ? + / + ?" ret=lut ? mt_lutxy(tmp,method, yexpr=expr_pow, U=1,V=1 ) : Expr(tmp,method,expr_pow,"","", optSSE2=true, optSingleMode=false, optAvx2=false) return ret } Last edited by pinterf; 14th November 2017 at 17:20. Reason: test env clarification |
|
15th November 2017, 10:25 | #3745 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Yes, normalized but I took the terminology from here:
http://avisynth.nl/index.php/MaskTools2/mt_lutspa |
15th November 2017, 12:29 | #3746 | Link |
Registered User
Join Date: Apr 2015
Posts: 84
|
I change mt_lutxy to Expr then limit function no work any more.
Code:
Function kf_limit_dif8_expr(clip filtered, clip original, bool "smooth", float "thr", float "elast", float "darkthr", int "Y", int "U", int "V") { sCSP = filtered.kf_GetCSP() IsY8 = sCSP == "Y8" smooth = Default(smooth, True ) thr = Default(thr, 1.0 ) elast = Default(elast, smooth ? 3.0 : 255./thr) darkthr = Default(darkthr,thr ) Y = Default(Y, 3 ) U = Default(U, 3 ) V = Default(V, 3 ) Y = min(Y, 4) U = min(U, 4) V = min(V, 4) thr = max(min( thr, 255.0), 0.0) darkthr = max(min(darkthr, 255.0), 0.0) elast = max(elast, 1.0) mode = thr == 0 && darkthr == 0 ? 4 : thr == 255 && darkthr == 255 ? 2 : 3 smooth = elast==1 ? False : smooth diffstr = " x y - " elaststr = " "+string(elast)+" " thrstr = diffstr+" 0 > "+string(darkthr)+" scalef "+string(thr)+" scalef ? " alphastr = elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstr+" * / ? " betastr = thrstr+elaststr+" * " sexpr = smooth ? alphastr+diffstr+" * "+betastr+diffstr+" abs - * y + " \ : thrstr+diffstr+diffstr+" abs / * y + " expr = diffstr+" abs "+thrstr+" <= x "+diffstr+" abs "+betastr+" >= y "+sexpr+" ? ? " thrstrc = " "+string(thr)+" scalef " alphastrc= elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstrc+" * / ? " betastrc = thrstrc+elaststr+" * " sexprc = smooth ? alphastrc+diffstr+" * "+betastrc+diffstr+" abs - * y + " \ : thrstrc+diffstr+diffstr+" abs / * y + " exprc = diffstr+" abs "+thrstrc+" <= x "+diffstr+" abs "+betastrc+" >= y "+sexprc+" ? ? " # diff = filtered - original # alpha = 1 / (thr * (elast - 1)) # beta = elast * thr # When smooth=True : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + alpha * diff * (beta - abs(diff)) # When smooth=False : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + thr * (diff / abs(diff)) expry = (Y == 3) ? expr : "" expru = (U == 3) ? exprc : "" exprv = (V == 3) ? exprc : "" return (mode == 4) ? original \ : (mode == 2) ? filtered \ : IsY8 ? Expr(filtered, original, expry, optSSE2=true, optSingleMode=false, optAvx2=true) \ : Expr(filtered, original, expry, expru, exprv, optSSE2=true, optSingleMode=false, optAvx2=true) } Code:
Function kf_limit_dif8_mt(clip filtered, clip original, bool "smooth", float "thr", float "elast", float "darkthr", int "Y", int "U", int "V") { smooth = Default(smooth, True ) thr = Default(thr, 1.0 ) elast = Default(elast, smooth ? 3.0 : 255./thr) darkthr = Default(darkthr,thr ) Y = Default(Y, 3 ) U = Default(U, 3 ) V = Default(V, 3 ) Y = min(Y, 4) U = min(U, 4) V = min(V, 4) thr = max(min( thr, 255.0), 0.0) darkthr = max(min(darkthr, 255.0), 0.0) elast = max(elast, 1.0) mode = thr == 0 && darkthr == 0 ? 4 : thr == 255 && darkthr == 255 ? 2 : 3 smooth = elast==1 ? False : smooth diffstr = " x y - " elaststr = " "+string(elast)+" " thrstr = diffstr+" 0 > "+string(darkthr)+" scalef "+string(thr)+" scalef ? " alphastr = elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstr+" * / ? " betastr = thrstr+elaststr+" * " sexpr = smooth ? alphastr+diffstr+" * "+betastr+diffstr+" abs - * y + " \ : thrstr+diffstr+diffstr+" abs / * y + " expr = diffstr+" abs "+thrstr+" <= x "+diffstr+" abs "+betastr+" >= y "+sexpr+" ? ? " thrstrc = " "+string(thr)+" scalef " alphastrc= elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstrc+" * / ? " betastrc = thrstrc+elaststr+" * " sexprc = smooth ? alphastrc+diffstr+" * "+betastrc+diffstr+" abs - * y + " \ : thrstrc+diffstr+diffstr+" abs / * y + " exprc = diffstr+" abs "+thrstrc+" <= x "+diffstr+" abs "+betastrc+" >= y "+sexprc+" ? ? " # diff = filtered - original # alpha = 1 / (thr * (elast - 1)) # beta = elast * thr # When smooth=True : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + alpha * diff * (beta - abs(diff)) # When smooth=False : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + thr * (diff / abs(diff)) return mode == 4 ? original \ : mode == 2 ? filtered \ : mt_lutxy(filtered, original, yExpr=expr, uExpr=exprc, vExpr=exprc, Y=Y, U=U, V=V) } Last edited by edcrfv94; 15th November 2017 at 12:58. |
15th November 2017, 13:05 | #3748 | Link | |
Registered User
Join Date: Apr 2015
Posts: 84
|
Quote:
Code:
SetMemoryMax(3000) #colorbars(width=1920, height=1080, pixel_type="yv12").killaudio().assumefps(25, 1) ImageSource("1.png", end=0).Dither_convert_rgb_to_yuv(lsb=true,output="YV12").DitherPost(mode=6) ConvertToY8() trim(0, 5000) #Limiter() #InvertNeg() #VToY() src = last.ConvertBits(bits=16) sharp = src.Sharpen(1.0).Sharpen(1.0) kf_limit_dif8_mt_test(sharp, src, thr=1, elast=42, y=3, u=1, v=1) #kf_limit_dif8_expr_test(sharp, src, thr=1, elast=42, y=3, u=1, v=1) ConvertToStacked().DitherPost(mode=6, ampo=1) Function kf_limit_dif8_expr_test(clip filtered, clip original, bool "smooth", float "thr", float "elast", float "darkthr", int "Y", int "U", int "V") { sCSP = filtered.kf_GetCSP() IsY8 = sCSP == "Y8" smooth = Default(smooth, True ) thr = Default(thr, 1.0 ) elast = Default(elast, smooth ? 3.0 : 255./thr) darkthr = Default(darkthr,thr ) Y = Default(Y, 3 ) U = Default(U, 3 ) V = Default(V, 3 ) Y = min(Y, 4) U = min(U, 4) V = min(V, 4) thr = max(min( thr, 255.0), 0.0) darkthr = max(min(darkthr, 255.0), 0.0) elast = max(elast, 1.0) mode = thr == 0 && darkthr == 0 ? 4 : thr == 255 && darkthr == 255 ? 2 : 3 smooth = elast==1 ? False : smooth diffstr = " x y - " elaststr = " "+string(elast)+" " thrstr = diffstr+" 0 > "+string(darkthr)+" scalef "+string(thr)+" scalef ? " alphastr = elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstr+" * / ? " betastr = thrstr+elaststr+" * " sexpr = smooth ? alphastr+diffstr+" * "+betastr+diffstr+" abs - * y + " \ : thrstr+diffstr+diffstr+" abs / * y + " expr = diffstr+" abs "+thrstr+" <= x "+diffstr+" abs "+betastr+" >= y "+sexpr+" ? ? " thrstrc = " "+string(thr)+" scalef " alphastrc= elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstrc+" * / ? " betastrc = thrstrc+elaststr+" * " sexprc = smooth ? alphastrc+diffstr+" * "+betastrc+diffstr+" abs - * y + " \ : thrstrc+diffstr+diffstr+" abs / * y + " exprc = diffstr+" abs "+thrstrc+" <= x "+diffstr+" abs "+betastrc+" >= y "+sexprc+" ? ? " # diff = filtered - original # alpha = 1 / (thr * (elast - 1)) # beta = elast * thr # When smooth=True : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + alpha * diff * (beta - abs(diff)) # When smooth=False : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + thr * (diff / abs(diff)) expry = (Y == 3) ? expr : "" expru = (U == 3) ? exprc : "" exprv = (V == 3) ? exprc : "" return (mode == 4) ? original \ : (mode == 2) ? filtered \ : IsY8 ? Expr(filtered, original, expry, optSSE2=true, optSingleMode=false, optAvx2=true) \ : Expr(filtered, original, expry, expru, exprv, optSSE2=true, optSingleMode=false, optAvx2=true) } Function kf_limit_dif8_mt_test(clip filtered, clip original, bool "smooth", float "thr", float "elast", float "darkthr", int "Y", int "U", int "V") { smooth = Default(smooth, True ) thr = Default(thr, 1.0 ) elast = Default(elast, smooth ? 3.0 : 255./thr) darkthr = Default(darkthr,thr ) Y = Default(Y, 3 ) U = Default(U, 3 ) V = Default(V, 3 ) Y = min(Y, 4) U = min(U, 4) V = min(V, 4) thr = max(min( thr, 255.0), 0.0) darkthr = max(min(darkthr, 255.0), 0.0) elast = max(elast, 1.0) mode = thr == 0 && darkthr == 0 ? 4 : thr == 255 && darkthr == 255 ? 2 : 3 smooth = elast==1 ? False : smooth diffstr = " x y - " elaststr = " "+string(elast)+" " thrstr = diffstr+" 0 > "+string(darkthr)+" scalef "+string(thr)+" scalef ? " alphastr = elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstr+" * / ? " betastr = thrstr+elaststr+" * " sexpr = smooth ? alphastr+diffstr+" * "+betastr+diffstr+" abs - * y + " \ : thrstr+diffstr+diffstr+" abs / * y + " expr = diffstr+" abs "+thrstr+" <= x "+diffstr+" abs "+betastr+" >= y "+sexpr+" ? ? " thrstrc = " "+string(thr)+" scalef " alphastrc= elaststr+" 1 <= 0 1 "+elaststr+" 1 - "+thrstrc+" * / ? " betastrc = thrstrc+elaststr+" * " sexprc = smooth ? alphastrc+diffstr+" * "+betastrc+diffstr+" abs - * y + " \ : thrstrc+diffstr+diffstr+" abs / * y + " exprc = diffstr+" abs "+thrstrc+" <= x "+diffstr+" abs "+betastrc+" >= y "+sexprc+" ? ? " # diff = filtered - original # alpha = 1 / (thr * (elast - 1)) # beta = elast * thr # When smooth=True : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + alpha * diff * (beta - abs(diff)) # When smooth=False : # output = diff <= thr ? filtered : \ # diff >= beta ? original : \ # original + thr * (diff / abs(diff)) return mode == 4 ? original \ : mode == 2 ? filtered \ : mt_lutxy(filtered, original, yExpr=expr, uExpr=exprc, vExpr=exprc, Y=Y, U=U, V=V) } Function kf_GetCSP(clip c) { try { csp = c.kf_GetCSP_avsPlus() } catch (error_msg) { csp = c.kf_GetCSP_avs() } return csp } Function kf_GetCSP_avs(clip c) { return c.IsPlanar ? c.IsYV12 ? "YV12" : \ c.IsYV16 ? "YV16" : \ c.IsYV24 ? "YV24" : c.kf_GetCSP_Y8_YV411() : \ c.IsYUY2 ? "YUY2" : \ c.IsRGB32 ? "RGB32" : \ c.IsRGB24 ? "RGB24" : "Unknown" Function kf_GetCSP_Y8_YV411(clip c) { try { c.UtoY csp = "YV411" } catch (error_msg) { csp = "Y8" } return csp } } Function kf_GetCSP_avsPlus(clip c) { return c.Is420 ? "YV12" : \ c.IsY ? "Y8" : \ c.Is422 ? "YV16" : \ c.Is444 ? "YV24" : \ c.IsYUVA ? "YUVA" : \ c.IsYV411 ? "YV411" : \ c.IsYUY2 ? "YUY2" : \ c.IsRGB32 ? "RGB32" : \ c.IsRGB24 ? "RGB24" : \ c.IsPackedRGB ? "RGB32/RGB24" : \ c.IsPlanarRGB ? "RGB48" : \ c.IsPlanarRGBA ? "RGB64" : "Unknown" } Last edited by edcrfv94; 15th November 2017 at 13:09. |
|
15th November 2017, 17:32 | #3750 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
New build with a hotfix
Download Avisynth+ r2544 Code:
20171115 r2544 - Expr: fix "scalef" for 10-16 bits - Expr optimization: eliminate ^1 +0 -0 *1 /1 |
15th November 2017, 23:43 | #3751 | Link |
Registered User
Join Date: Mar 2009
Posts: 3,650
|
Gave the sizetmod a try but have it crash every time. Tried a simple script through ffdshow raw.
SetFilterMTMode("DEFAULT_MT_MODE", 2) ffdshow_source() aWarp4(Spline36Resize(width*4, height*4, 0.375, 0.375), aSobel.aBlur(), depth=2) Prefetch(4) MadVR ends up crashing, no issues with the normal build. |
16th November 2017, 09:24 | #3752 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Quote:
For me they (x64 plugins with CPP 2.5 interface) are crashing with the sizetmod build. No wonder, 2.5 is the "baked" code interface. I don't like them. For example supporting 2.5 prevented me last year to introduce the array type. Now this. They badly need at least a recompile for 2.6. |
|
16th November 2017, 12:08 | #3753 | Link |
Acid fr0g
Join Date: May 2002
Location: Italy
Posts: 2,578
|
Experimental x64 crashing here.
PHP Code:
__________________
@turment on Telegram Last edited by tormento; 16th November 2017 at 12:14. |
16th November 2017, 12:32 | #3755 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Quote:
For example LSmashSource (CPP v2.5 as Avsmeter64 reports) is crashing for me. ffms2 is OK. |
|
16th November 2017, 12:54 | #3756 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Quote:
I don't know about the source filter, I have replaced it with ffms2. The script still crashed with lsb=true. Unfortunately dither.dll is a 2.5 style plugin. With lsb=false the script is working properly with the given parameters. Edit: rebuilt dither.dll, replaced the 2.5-style avisynth.h with the 2.6-style avs+ header (not even the size_t mod version) and no more crash with lsb=true. Last edited by pinterf; 16th November 2017 at 13:11. |
|
16th November 2017, 17:01 | #3759 | Link | |
Acid fr0g
Join Date: May 2002
Location: Italy
Posts: 2,578
|
Quote:
Code:
[CPP 2.5 / 64 Bit Plugins] D:\Programmi\Media\AviSynth+\plugins64\Dither-1.27.2.dll D:\Programmi\Media\AviSynth+\plugins64\f3kdb-2.020140721-SAPikachu.dll
__________________
@turment on Telegram |
|
17th November 2017, 11:17 | #3760 | Link |
Registered User
Join Date: Oct 2011
Posts: 275
|
Not sure if my used plugins are all up to date and /or if some others could be replaced by something else tho but things like LSmashSource, Avsinpaint, MP_Pipeline are essential for me and i don't think there is any alternative to those :/ Last edited by Yanak; 22nd January 2018 at 23:43. |
Thread Tools | Search this Thread |
Display Modes | |
|
|