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. |
27th April 2019, 21:48 | #4661 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
I can't do anything more. I think is better a new thread by pinterf.
__________________
BeHappy, AviSynth audio transcoder. |
|
28th April 2019, 06:57 | #4664 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Use it when you don't want to bother with the different bit-depths within your Expr script. Depending on your choice, the Expr expression will always see your input clip to be 8 (or other bit depth, fine tuned with the i8, i10, etc Expr keywords)
The parameter helps converting old 8-bit-only Expr (or mt_lutxxx family) expression strings to a generic good-for-all-bit-depth string. Since there is an automatic input conversion phase (e.g. pixel values of a 10 bit input clip will be divided by 4.0 to have them in the 8 bit range), then a back-conversion phase (result will be multiplied by 4.0 before converting the intermediate pixel result back to 10 bit integer). Using this method Expr itself is a little bit slower, but the conversion takes place only when the input bit-depth is different from the bit-depth used in Expr. |
28th April 2019, 07:08 | #4665 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Regarding the new thread, yeah, I'll start it, promise, unfortunately my draftsman is on holiday , I wanted to write a proper intro w/o mis-spelling.
Anyway it's time for a new release but I found way too many other tasks and coding adventures for myself, so it's just a question of weeks. |
28th April 2019, 19:06 | #4666 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
Thanks pinterf, I think I got it.
Float style code only works with 32bit float videos, but integer style code works with everything, unless you have uknown bitdepth variables (float, integers, clips) in which case you can use the scale_inputs setting to bring them to a common denominator (8-bit). This is my Expr version of mt_merge(), if you pinpoint something odd or not optimized please correct me. (not working with 32bit float) Code:
function expr_merge ( clip a, clip b, clip msk, bool "luma", string "scale_inputs") { luma = Default(luma, true) scale_inputs = Default(scale_inputs, "all") luma ? Eval(""" msk w = Width() h = Height() Y = ConvertToY8() U = Y.BicubicResize(W/2,H/2,-.5,.25, src_left=0.25 - (0.25/w)) V = U msk=CombinePlanes(Y, U, V, planes = "YUV", sample_clip=msk)""") : nop() code="x z range_max - abs * y z * + range_size / " expr(a,b,msk,code,code,code, scale_inputs=scale_inputs) } Last edited by Dogway; 28th April 2019 at 19:12. |
28th April 2019, 19:58 | #4667 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
1.) You can omit abs by exchanging range_max and z in your script
Code:
(x * (range_max - z) + y * z) / range_max But in actual integer pixel-type implementations like in mt_merge or Avisynth Overlay there are simplifications: Code:
(x * range_max - x * z + y * z) / range_max --> x + (y - x) * z / range_max -- end of popular science -- ) 2.) You can write code, code, code as code: when an expression is not given for a plane plane, it will be copied from the previous one. |
28th April 2019, 20:28 | #4668 | Link | |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,795
|
Quote:
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth VapourSynth Portable FATPACK || VapourSynth Database |
|
29th April 2019, 11:45 | #4669 | Link | |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
and there are already MasknotCL, MaskCL and my https://pastebin.com/aLP9Mb3z and all these in avs26 nowadays is useless since the bug fixed, unless you use avs 2.5
__________________
See My Avisynth Stuff |
|
29th April 2019, 15:41 | #4670 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
The goal was that if someone wanted to keep a 32f bit process chain they could saving on quantization processing time and error accumulation (bitdepth down conversion) on the usual heavy filtering done in the scripts, but without removing the support for integer type bitdepths. Float precision is also benefitial for less degradation in dark images or parts of them.
I understand this is currently not possible due to the right-shift mechanism (discrepancies in masks), unless we get an official expr_merge with said optimizations. For now I will apply your suggestions (a ternary op in masks) until we get an internal function. I haven't cared for cosmetics yet. Edit: @real.finder, because I asked a few days ago about an internal equivalent of mt_merge and nobody replied, so assumed there were none (long time out of touch) . Your script does the job perfectly although with a dependency. I will spend my time on my other tools. Edit2: After testing smaskmerge() also didn't work for 32bit so I adapted mine and now is bitdepth agnostic. Last edited by Dogway; 30th April 2019 at 15:26. |
30th April 2019, 20:20 | #4671 | Link | |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
and and the formula seems work fine even in float, what you mean by "didn't work for 32bit"?
__________________
See My Avisynth Stuff Last edited by real.finder; 30th April 2019 at 20:24. |
|
1st May 2019, 17:11 | #4672 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
Test with this, as pinterf explained a hack is needed when mask is range_max in float precision. I also had to remove the try catch for cl_exprxyz() in smaskmerge.avsi since it was triggering an error in the script.
16-bit integer__________32-bit float Code:
blankclip(length=48,width=720,height=480, color=$00000,pixel_type="YV12") expr("sx frameno + 32 % 16 < range_half range_max ?","sx frameno 2 / + 16 % 8 < range_half sx 15 / - range_half ?","sx frameno 2 / + 16 % 8 < range_half sx 8 / - range_half ?") ConvertBits(32) # 32bit float vs 8-16bit integer video=last video2=video.trim(20,0) x1=string(20) x2=string(600) y1=string(50) y2=string(340) msk=expr("sx "+x1+" >= sx "+x2+" <= & sy "+y1+" >= sy "+y2+" <= & & range_max range_min ?", "range_half", "range_half").trim(0,-1).FreezeFrame(0, FrameCount(last)-1, 0) ########################## smaskmerge(video, video2, msk,3,3,3, luma=true) ConvertBits(8) # Debug Chroma planes # ExtractU() Last edited by Dogway; 1st May 2019 at 17:14. |
1st May 2019, 17:40 | #4673 | Link |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
so the problem only in chroma? I think this because the zero-chroma-center transition, don't know how chroma mask in float should be, let see what pinterf said and how it work in mt_edge and mt_merge
__________________
See My Avisynth Stuff |
2nd May 2019, 08:05 | #4674 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Without reverse engineering the Expr itself, yep, float chroma goes -from 0.5 to 0.5, sometimes it can be tricky to apply on it a universal Expr. Perhaps with "range_size"? Anyway, masks are just weights going from 0 to 1.0.
|
2nd May 2019, 10:11 | #4675 | Link | |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
maybe temporary shifting to 0-1.0 for float chroma if there are only universal (luma) Expr available? or with some parameter to set that same for masktools lut things
__________________
See My Avisynth Stuff Last edited by real.finder; 3rd July 2019 at 09:30. |
|
9th May 2019, 01:58 | #4676 | Link |
Registered User
Join Date: Feb 2014
Posts: 356
|
Script Translation From SEt's AviSynth MT To pinterf's AviSynt+
Hello, and thanks in advance for any help. About five years ago, kind, patient people here and elsewhere helped me develop a quite nice basic template for shriveling and improving my Blu-rays with 10-bit x264 using MeGUI with SEt's MT AviSynth. I'm still using MeGUI, but I've recently upgraded to pinterf's AviSynth+ and am wanting to verify that I've translated my template correctly.
The original SEt AviSynth MT template is: Code:
SetMemoryMax(XXXX) SetMTMode(X,X) SOURCE INFORMATION HERE SetMTMode(X) SMDegrain(TR=X,ThSAD=XXX,RefineMotion=True,Plane=0,Chroma=False,LSB=True,LSB_Out=True) F=DitherPost(Mode=-1) S=F.FastLineDarkenMod("Settings Depend On Source") D=MT_MakeDiff(S,F).Dither_Convert_8_To_16() Dither_Add16(Last,D,Dif=True,U=2,V=2) GradFun3("Settings Depend On Source",LSB_In=True,LSB=True) ### Preview Source OR Send 16-bit Output To x264 10-bit ### # DitherPost() Dither_Out() Code:
--demuxer raw --input-depth 16 --sar 1:1 Code:
SOURCE INFORMATION HERE SetFilterMTMode("Default_MT_Mode",2) SMDegrain(TR=X,ThSAD=XXX,RefineMotion=True,Plane=0,Chroma=False,LSB=True,LSB_Out=True) F=DitherPost(Mode=-1) S=F.FastLineDarkenMod("Settings Depend On Source") D=MT_MakeDiff(S,F).Dither_Convert_8_To_16() Dither_Add16(Last,D,Dif=True,U=2,V=2) GradFun3("Settings Depend On Source",LSB_In=True,LSB=True) ConvertFromStacked ConvertBits(10,Dither=0) Prefetch(X) Anyway, I just want to make sure that all is well before I attack further encoding. I'm using the newest .dll's-.avsi's I could find: pinterf's dual signature MaskTools2.2.18.dll, pinterf's MVTools2.7.41.dll, Dither1.27.2.avsi, SMDegrain3.1.2.93s.avsi. And some questions: 0) Is the new AviSynth+ template truly processing in 16-bits from the beginning to the output? 1) Is the "ConvertBits(10,Dither=0")" call necessary given that I'm sending 16-bit to 10-bit x264; ie, would removing this cause a lack of proper dithering? 2) Is the: Code:
F=DitherPost(Mode=-1) S=F.FastLineDarkenMod("Settings Depend On Source") D=MT_MakeDiff(S,F).Dither_Convert_8_To_16() Dither_Add16(Last,D,Dif=True,U=2,V=2) 3) What have I missed? Thanks again for any help; I really appreciate it . |
16th May 2019, 13:24 | #4677 | Link |
Registered User
Join Date: Feb 2014
Posts: 356
|
As I was checking some test clips, I noticed that very rarely there's an error message from, I think, AviSynth+ superimposed across the top, center of single frames:
Code:
Script error: Invalid arguments to function 'IsCombedTIVTC' ([ScriptClip], line 1) EDIT: Turns out that adding "PreFetch(X)" to the end of a script for encoding interlaced video improves speed but causes errors. Sorry for the bother; a more detailed explanation is in the MeGUI: General Questions and Troubleshooting Thread. Last edited by LouieChuckyMerry; 16th May 2019 at 23:54. Reason: Coffee; Solution |
16th May 2019, 13:57 | #4678 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
ConvertBits(10,Dither=0)
This outputs 10 bit, you can certainly serve 16 bit to x265, I don't know which way is better.
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
16th May 2019, 14:54 | #4679 | Link | |
Registered User
Join Date: Feb 2014
Posts: 356
|
Quote:
Code:
ConvertFromStacked.ConvertBits(10,Dither=0) Code:
ConvertFromStacked |
|
16th May 2019, 18:32 | #4680 | Link |
Registered User
Join Date: Jan 2010
Posts: 709
|
If wasn't fixed, x265's --dither doesn't work other than for 8bit output, without --dither it'll do a truncate.
for x264 it should work well as it apply a sierra dithering iirc
__________________
powered by Google Translator |
|
|