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. |
18th April 2020, 13:32 | #5501 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Suggest 16KB RAM pack upgrade and lump of Bluetack to prevent RAM pack wobble.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
24th April 2020, 19:32 | #5502 | Link |
Registered User
Join Date: Jan 2019
Location: Antarctica
Posts: 74
|
Hi, I don't know if this is an AviSynth question or a HEVC one. I wanted to ask is it possible to do a script with both chroma shift and chroma upscale (the tattler I think that's what it does) in 4:2:0 encoding in HEVC similarly with a script below?
This is the script I'm currently using: Code:
dither_convert_8_to_16() # filter(s) s16 = last DitherPost() # 8 bit filter(s) dither_convert_8_to_16() s16.Dither_limit_dif16 (last,) ly = GradFun3mod(resizer="DebilinearM", lsb_in=true, lsb=true) lc = nnedi3_resize16(1280*2, 720*2,lsb_in=true,lsb=true,kernel_d="Spline36",kernel_u="Spline36",src_top=0.0,src_left=0.50,nlsb=false) lu = lc.UtoY() lv = lc.VtoY() YtoUV(lu,lv,ly) Dither_out() Code:
Y = ConvertToY8().dither_resize16(1280,720,kernel="Spline36")src top and left U = UToY8().dither_resize16(1280,720,kernel="blackmanminlobe",src_top=0.0,src_left=0.25) V = VToY8().dither_resize16(1280,720,kernel="blackmanminlobe",src_top=0.0,src_left=0.25) YToUV(U, V, Y) I get no issues in H264 4:2:0. No issues with HEVC 4:4:4 of course. Just in case it's asked I am using the correct script in HEVC: --input-depth 16 --profile main10 --input-csp i420 and using AviSynth+ ver 3.5.0. I am also using possibly an out of date avs4x26x if that helps. |
24th April 2020, 21:06 | #5503 | Link | |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
also this https://forum.doom9.org/showthread.p...65#post1906465
__________________
See My Avisynth Stuff |
|
24th April 2020, 22:09 | #5504 | Link |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
I find something when I try adding HBD for Ylevels by Didée
Code:
function Ylevels(clip clp, \ float "input_low", float "gamma", float "input_high", \ float "output_low", float "output_high", bool "show_function") { sisavs26 = !(VersionNumber() < 2.60) input_low = Default(input_low, 0) gamma = Default(gamma, 1.0) input_high = Default(input_high, 255) output_low = Default(output_low, 0) output_high = Default(output_high, 255) show_function = Default(show_function, false) wicked = sisavs26 ? "x " +string(input_low)+ " scalef - " +string(input_high)+ " scalef " +string(input_low)+ " scalef - / 1 " +string(gamma)+ \ " / ^ " +string(output_high)+ " scalef " +string(output_low)+ " scalef - * " +string(output_low)+ " scalef +" \ : "x " +string(input_low)+ " - " +string(input_high)+ " " +string(input_low)+ " - / 1 " +string(gamma)+ \ " / ^ " +string(output_high)+ " " +string(output_low)+ " - * " +string(output_low)+ " +" return( show_function ? clp.subtitle(wicked) : sisavs26 ? clp.mt_lut(Yexpr = wicked, use_expr=2, U=2,V=2) : clp.mt_lut(Yexpr = wicked, U=2,V=2) ) } it's ok in 16bit and in float it's ok as I don't set gamma to 1.2 convertbits(32) Ylevels(40, 1.2, 255, 0, 255, false) Limiter(0,1,-0.5,0.5) convertbits(8) also tried with scale_input="float" but still give white artifacts in dark parts of frame, both with use_expr=2 or without even if I scale expr with x 255 * and 255 / in the end of expr still same, is there are certain limits if the input is float clip or it's bug?
__________________
See My Avisynth Stuff Last edited by real.finder; 24th April 2020 at 22:13. |
25th April 2020, 08:44 | #5506 | Link | ||
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
Quote:
__________________
See My Avisynth Stuff |
||
25th April 2020, 11:37 | #5507 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Does mt_Infix() no longer work ? [Win7].
Code:
Colorbars(Pixel_type="YV12").ConvertToYV24.ConvertBits(32) YLevels() convertToRGB32 # Inside YLevels RT_DebugF("Wicked = '%s'",wicked) infix = Mt_Infix(wicked) RT_DebugF("Infix = '%s'",Infix) Code:
00000315 0.14433271 [4556] RT_DebugF: Wicked = 'x 0 scalef - 255 scalef 0 scalef - / 1 1.000000 / ^ 255 scalef 0 scalef - * 0 scalef +' 00000316 0.14450951 [4556] RT_DebugF: Infix = '(0+)' EDIT: this works so its not totally broken [error in wicked RPN ? (I dont understand that new scalef stuff) ] Code:
Colorbars RPN="x y - abs" IFX=mt_infix(RPN) RT_DebugF("RPN = '%s'\nIFX = '%s'",RPN,IFX) Subtitle("RPN = '"+RPN+"'\n"+"IFX = '"+IFX+"'",lsp=0,font="Courier New") __END__ 00000962 0.17500676 [3320] RT_DebugF: RPN = 'x y - abs' 00000963 0.17506003 [3320] RT_DebugF: IFX = 'abs((x-y))'
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 25th April 2020 at 12:25. |
25th April 2020, 12:31 | #5508 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,309
|
1.) We are at 2.2.21 masktools.
2.) I dont remember is scalef is handled in infix. 3.) Probably power 1 is optimized to do nothing. But 1.00001 should give quite similar result. Does it work? Cannot check, I'm not near my PC |
25th April 2020, 12:47 | #5509 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
1) Yeh, its in my Inbox
2.) Seems not in 2.2.18 This looks right after doing scalef thing manually [only for defaults] Code:
Colorbars RPN="x 0.0 - 1.0 0.0 - / 1 1.0 / ^ 1.0 0.0 - * 0.0 +" IFX=mt_infix(RPN) RT_DebugF("RPN = '%s'\nIFX = '%s'",RPN,IFX) Subtitle("RPN = '"+RPN+"'\n"+"IFX = '"+IFX+"'",lsp=0,font="Courier New") __END__ 00006458 0.14370735 [3704] RT_DebugF: RPN = 'x 0.0 - 1.0 0.0 - / 1 1.0 / ^ 1.0 0.0 - * 0.0 +' 00006459 0.14376387 [3704] RT_DebugF: IFX = '(((((x-0.0)/(1.0-0.0))^(1/1.0))*(1.0-0.0))+0.0)' #output = ( (input - input_low) / (input_high - input_low) )^(1 / gamma) * (output_high - output_low) + output_low
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
25th April 2020, 13:23 | #5511 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Seems ok (InFix scalef thing in 2.2.21, not optimized) SCRIPT DELETED: See post #5519.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th April 2020 at 12:46. |
|
25th April 2020, 13:48 | #5513 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
EDIT: Oops did not see P Post.
SCRIPT DELETED: See post #5519. [EDIT: Not because of above P post, P was answering RF]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th April 2020 at 12:47. |
25th April 2020, 16:37 | #5515 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
SCRIPT DELETED: See post #5519.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th April 2020 at 12:47. |
25th April 2020, 17:11 | #5516 | Link |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
the question is why there are no problem when 8-16 bits?
__________________
See My Avisynth Stuff |
25th April 2020, 18:47 | #5519 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
As in below Pinterf next post.
Quote:
Code:
\ + "0 max 1 min " [* P = min(max(P , 0.0), 1.0) *] Code:
Function Ylevels(clip clp, \ float "input_low", float "gamma", float "input_high", \ float "output_low", float "output_high", bool "show_function") { input_low = Default(input_low, 0) gamma = Default(gamma, 1.0) input_high = Default(input_high, 255) output_low = Default(output_low, 0) output_high = Default(output_high, 255) show_function = Default(show_function, false) # invGam = 1.0 / min(max(0.1,Gamma),10.0) # Sane range, avoid div by zero divisor = (input_high==input_low) ? 1 : input_high-input_low # Avoid divide by zero try { bpc = clp.BitsPerComponent } catch(msg) { bpc=8 } # Use scalef only if bpc > 8 (ie Avs+) # wicked = (bpc>8) [* Use scalef only if > 8 bit ie Avs+ *] \ ? "x " +string(input_low)+" scalef - "+string(divisor)+" scalef / " [* P = (input - input_low) / divisor *] \ + "0 max 1 min " [* P = min(max(P , 0.0), 1.0) *] \ + string(invGam) + " ^ " [* P = pow(P, 1.0/Gamma) *] \ + string(output_high)+" scalef " +string(output_low)+" scalef - * "+string(output_low)+" scalef +" [* P = P * (output_high - output_low) + output_low *] \ : "x " +string(input_low)+" - "+string(divisor)+" / " \ + "0 max 1 min " \ + string(invGam) + " ^ " \ + string(output_high)+" " +string(output_low)+" - * "+string(output_low)+" +" # UnComment next line to explicitly round & clamp to output range, although Masktools will do this anyway. 32 bit Float NOT rounded. Here as documentation. # wicked = wicked + ((bpc==32) ? " 0 max 255 scalef min" : (bpc>8) ? " round 0 max 255 scalef min" : " round 0 max 255 min") [* P = min(max(int(P+0.5) , 0.0), 255.0) *] return( show_function ? clp.subtitle(wicked) : (bpc>8) ? clp.mt_lut(Yexpr = wicked, use_expr=2, U=2,V=2) : clp.mt_lut(Yexpr = wicked, U=2,V=2) ) } Quote:
Here specifying both input and output coords outside of colorspace range, Code:
Ylevels(0-32, 1.0, 255+32, 0-32, 255+32, false) Also, you should not artifically limit input or output args to the YLevels function. [EDIT: Original v2.58 (and Beta 2.60) avs Levels used PixelClip on RGB ouput, this was an (in some caes failed) attempt to clamp output RGB and was a bug, a simple Min,Max clamp fixed it. ] Client for similar to above image. Code:
SHOW=False Avisource("D:\Parade.avi") #Colorbars(width=1920,height=1080,pixel_type="YV12") #convertbits(16) convertbits(32) Ylevels(-32, 1.0, 255+32, 0-32, 255+32, SHOW) convertbits(8) Code:
gamma = min(max(gamma,0.1f),10.0f); // ssS: Added sane range limiting (& avoid div by zero on gamma) gamma = 1/gamma; int divisor = (in_max == in_min) ? 1 : (in_max - in_min); // avoid zero divide if (vi.IsYUV()) { for (int i=0; i<256; ++i) { float p; if (coring) p = ((i-16)*(255.0f/219.0f) - in_min) / divisor; else p = float(i - in_min) / divisor; // range 0.0 -> 1.0 of input range p = pow(min(max(p, 0.0f), 1.0f), gamma); // gamma p = p * (out_max - out_min) + out_min; // output range with out_min offset int pp; if (coring) pp = int(p*(219.0f/255.0f)+16.5f); else pp = int(p+0.5f); // round to nearest luma level map[i] = min(max(pp, (coring) ? 16 : 0), (coring) ? 235 : 255); int q = ((i-128) * (out_max-out_min) + (divisor>>1)) / divisor + 128; mapchroma[i] = min(max(q, (coring) ? 16 : 0), (coring) ? 240 : 255); } } else if (vi.IsRGB()) { for (int i=0; i<256; ++i) { float p = float(i - in_min) / divisor; p = pow(min(max(p, 0.0f), 1.0f), gamma); p = p * (out_max - out_min) + out_min; int z=int(p+0.5f); map[i] = (z < 0) ? 0 : (z>255) ? 255 : z; // # EDIT: Was originally bugged PixelClip clamping } }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th April 2020 at 13:41. |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|