I need to stop posting questions that late at night
But I still struggle to get similar looking picture with new ContrastMask And I have some strange artifacts.
new
oldCode:LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\ffms2.dll") FFVideoSource("E:\SAMPLE\video\03.avi") ConvertBits(16) LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\aWarpsharpMT.dll") LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\nnedi3.dll") SeparateFields() MergeChroma(last, Spline36Resize(width/2, height).aWarpSharp2(depth=30).nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=width, fheight=height)) Weave() ColorYUV(gamma_y=-35, cont_y=46, gain_y=-10, off_y=0) #gain_y=-10 Tweak(bright=20, coring=false) #coring=false Tweak(Hue=-16) LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\vsTCanny.dll") LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\masktools2.dll") Import("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\ContrastMask2.avsi") SeparateFields() ContrastMask(enhance=1.8) Weave() Tweak(cont=0.9) LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\fft3dfilter.dll") FFT3DFilter(bt=-1, sharpen=0.3, interlaced=true) ConvertBits(bits=8, dither=1) ConvertToYV12(matrix="rec601", interlaced=true)
[Attachment 82684 - Click to enlarge]
new
[Attachment 82685 - Click to enlarge]
And for some reason - today, banding in the script with old ContrastMask not look that bad So maybe I stick with it...
[Attachment 82686 - Click to enlarge]
old
Code:LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\ffms2.dll") FFVideoSource("E:\SAMPLE\video\03.avi") LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\aWarpsharpMT.dll") LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\nnedi3.dll") SeparateFields() MergeChroma(last, Spline36Resize(width/2, height).aWarpSharp2(depth=30).nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=width, fheight=height)) Weave() ConvertToYV12(matrix="rec601", interlaced=true) LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\variableblur.dll") LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\masktools2.dll") Import("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\ContrastMask.avsi") SeparateFields() even = SelectEven(last).ContrastMask(enhance=3.0) odd = SelectOdd(last).ContrastMask(enhance=3.0) Interleave(even, odd) Weave() ConvertBits(16) ColorYUV(gamma_y=-35, cont_y=46, gain_y=-10, off_y=0) #gain_y=-10 Tweak(bright=3, coring=false) #3 for ContrastMask(enhance=3.0) Tweak(cont=0.9) Tweak(Hue=-16) LoadPlugin("M:\edit\MeGUI-6666.2308_x64\tools\avs\plugins64\fft3dfilter.dll") FFT3DFilter(bt=-1, sharpen=0.3, interlaced=true) ConvertBits(bits=8, dither=1)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 91 to 120 of 142
Thread
-
Last edited by cinephil; 5th Oct 2024 at 09:34.
-
Can't make heads or tail out of your script. (doesn't make any sense to me; too unsorted and unreadable)
Since the new version I posted can't use GaussianBlur from VariableBlur it uses vsTCanny, so there are bound to be differences.
How does it look if you replace:
Code:# Apply Gaussian blur v2 = vsTCanny (v2, sigmaY=gblur)
Code:# Apply Gaussian blur v2 = vsTCanny (v2, sigmaY=gblur,mode=-1)
Code:# Apply Gaussian blur v2 = vsTCanny (v2, sigmaY=gblur, sigmaU=gblur, sigmaV=gblur, mode=-1)
mode=-1 should make it the outputs more similar.
Cu SelurLast edited by Selur; 5th Oct 2024 at 10:53.
users currently on my ignore list: deadrats, Stears555 -
This way it looks much closer to the old ContrastMask.
new+
[Attachment 82689 - Click to enlarge] -
Happy that worked, there might be other parameter to get it even closer to the old version, but I leave that to motivated others.
users currently on my ignore list: deadrats, Stears555 -
If assume that old ContrastMask used all default values for VariableBlur/GaussianBlur,
Code:GaussianBlur (clip, float "varY", float "varC", int "border", bool "integrate", int "Y", int "U", int "V", int "gfunc", int "gfuncc", int "pcr", int "pcrc", int "nthreads")
Code:v2=v2.gaussianblur(50.0,50.0+gblur)
-
v2=v2.gaussianblur(50.0,50.0+gblur)
varY=50
varC=50+gblur
=> vsTCanny should probably use:
Code:v2 = vsTCanny (v2, sigmaY=50, sigmaU=50.0+gblur, mode=-1)
users currently on my ignore list: deadrats, Stears555 -
This giving error:
[Attachment 82707 - Click to enlarge] -
No clue, my guess you would probably have to test a bit to figure out the mapping between GaussianBlur and TCannys GaussianBlur.
users currently on my ignore list: deadrats, Stears555 -
try:
Code:v2 = vsTCanny (v2, sigmaY=5, sigmaU=5+gblur, mode=-1)
users currently on my ignore list: deadrats, Stears555 -
new++
[Attachment 82709 - Click to enlarge]
It's lost even more details in dark areas. I will try later to compare GaussianBlur vs TCannys GaussianBlur on some kind test pattern. Maybe find out something useful. -
Fingers crossed.
I like:
Code:# Apply Gaussian blur v2 = vsTCanny (v2, sigmaY=50+gblur, mode=-1)
Last edited by Selur; 6th Oct 2024 at 14:57.
users currently on my ignore list: deadrats, Stears555 -
Apparently there is something else missing...
I tried this way, but not get close enough to the old one.
Code:v2 = v2.vsTCanny(sigmaY=7.1, sigmaU=7.1+gblur, mode=-1)
Code:sigmaU = sigmaY / horizontal_chroma_subsampling_factor
-
sigmaU = sigmaY / horizontal_chroma_subsampling_factor
For "4:4:4"-content, it's divided by 1.
For "4:2:2"-content, it's divided by 2.
For "4:2:0"-content, it's divided by 2.
For "4:1:1"-content, it's divided by 4.
see: https://en.wikipedia.org/wiki/Chroma_subsampling
Cu Selurusers currently on my ignore list: deadrats, Stears555 -
Seems like chroma treated differently in vsTCanny than in VariableBlur/GaussianBlur. I can't match color test pattern using vsTCanny if chroma parameters involved. Or just didn't find the right ones.
-
Is the original Avisynth version you are using identical to:
Code:function ContrastMask(clip v, float "gblur", float "enhance") { enhance = default (enhance, 10.0) tvcolor = default (tvcolor, true) gblur = default (gblur, 20.0) enhance = (enhance>=0.0 && enhance<=10.0) ? float(enhance*0.1) : 1.0 v2=v.Tweak(sat=0) v2=v2.invert() v2=v2.gaussianblur(50.0,50.0+gblur) photoshop_overlay=mt_lutxy(v,v2,"x 127.5 > y 255 x - 127.5 / * x 255 x - - + y x 127.5 / * ? ") merged=overlay(v,photoshop_overlay,opacity=enhance) return merged }
Is
Code:v2 = vsTCanny(v2, sigmaY=50.0, sigma_vY=50.0 + gblur, sigmaU=0.0, sigma_vU=0.0, sigmaV=0.0, sigma_vV=0.0, mode=-1)
Last edited by Selur; 7th Oct 2024 at 09:21.
users currently on my ignore list: deadrats, Stears555 -
-
About the highlights: a. try lowering enhance a bit or decreasing the 50 in the vsTCanny call
users currently on my ignore list: deadrats, Stears555 -
Well, that affect not only the highlights...
But maybe it's just me being stuck to this old ContrastMask look, and the new one looks better?
old
[Attachment 82730 - Click to enlarge]
new with
Code:# Apply Gaussian blur v2 = vsTCanny(v2, sigmaY=gblur, mode=-1)
[Attachment 82731 - Click to enlarge]
no ContrastMask
[Attachment 82732 - Click to enlarge]
old
Code:SeparateFields() MergeChroma(last, Spline36Resize(width/2, height).aWarpSharp2(depth=30).nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=width, fheight=height)) Weave() ConvertToYV12(matrix="rec601", interlaced=true) SeparateFields() even = SelectEven(last).ContrastMask(enhance=3.0) odd = SelectOdd(last).ContrastMask(enhance=3.0) Interleave(even, odd) Weave() ConvertBits(16) ColorYUV(gamma_y=-35, cont_y=46, gain_y=-10, off_y=0) Tweak(bright=3, coring=false) Tweak(cont=0.9) Tweak(Hue=-16) FFT3DFilter(bt=-1, sharpen=0.3, interlaced=true) ConvertBits(bits=8, dither=1)
Code:ConvertBits(16) SeparateFields() MergeChroma(last, Spline36Resize(width/2, height).aWarpSharp2(depth=30).nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=width, fheight=height)) Weave() SeparateFields() even = SelectEven(last).ContrastMask(enhance=3.0) odd = SelectOdd(last).ContrastMask(enhance=3.0) Interleave(even, odd) Weave() ColorYUV(gamma_y=-35, cont_y=46, gain_y=-10, off_y=0) Tweak(bright=3, coring=false) Tweak(cont=0.9) Tweak(Hue=-16) FFT3DFilter(bt=-1, sharpen=0.3, interlaced=true) ConvertBits(bits=8, dither=1) ConvertToYV12(matrix="rec601", interlaced=true)
Last edited by cinephil; 8th Oct 2024 at 08:34.
-
Also try:
Code:v2 = vsTCanny(v2, sigmaY=50.0, sigma_vY=50.0 + gblur, sigmaU=0.0, sigma_vU=0.0, sigmaV=0.0, sigma_vV=0.0, mode=-1)
users currently on my ignore list: deadrats, Stears555 -
This one rises highlights even more
[Attachment 82734 - Click to enlarge] -
Here's a modified version with another parameter to select the 'tMode':
Code:function ContrastMask(clip v, float "gblur", float "enhance", int "tMode") { enhance = default(enhance, 10.0) gblur = default(gblur, 20.0) enhance = (enhance >= 0.0 && enhance <= 10.0) ? float(enhance * 0.1) : 1.0 tMode = default(tMode, 1) # Get the bit depth and scaling factors bit_depth = v.BitsPerComponent() max_val = pow(2, bit_depth) - 1 half_max_val = max_val / 2.0 # Convert to grayscale and invert v2 = v.Tweak(sat=0) v2 = v2.Invert() # Apply Gaussian blur v2 = (tMode == 1) ? vsTCanny (v2, sigmaY=gblur, mode=-1) : vsTCanny(v2, sigmaY=50.0, sigma_vY=50.0 + gblur, sigmaU=0.0, sigma_vU=0.0, sigmaV=0.0, sigma_vV=0.0, mode=-1) # Construct the expression for mt_lutxy expr = "x {} > y {} x - {} / * x {} x - - + y x {} / * ?".format(half_max_val, max_val, half_max_val, max_val, half_max_val) # Apply the contrast mask effect photoshop_overlay = mt_lutxy(v, v2, expr) # Merge the original and overlay clips merged = Overlay(v, photoshop_overlay, opacity=enhance) return merged }
tMode 2 uses: vsTCanny(v2, sigmaY=50.0, sigma_vY=50.0 + gblur, sigmaU=0.0, sigma_vU=0.0, sigmaV=0.0, sigma_vV=0.0, mode=-1)
Cu Selurusers currently on my ignore list: deadrats, Stears555 -
I guess finally find settings that match highlights level with the old ContrastMask
Code:# Apply Gaussian blur v2 = v2.vsTCanny(sigmaY=7.0, sigmaU=7.0+gblur, mode=-1)
[Attachment 82751 - Click to enlarge]
new*
[Attachment 82752 - Click to enlarge] -
From how I understand the script, sigmaU should not have any effect on the output, since the original script only uses the luma plane.
(an the X + gblur is for the vairance not the U plane)
=> how does:
Code:v2= vsTCanny(v2, sigmaY=7.0, sigma_vY=7.0 + gblur, sigmaU=0.0, sigma_vU=0.0, sigmaV=0.0, sigma_vV=0.0, mode=-1)
Cu SelurLast edited by Selur; 9th Oct 2024 at 12:45.
users currently on my ignore list: deadrats, Stears555 -
Originally Posted by Selur
[Attachment 82753 - Click to enlarge]
Well, varC is for chroma (UV), witch in vsTCanny is sigmaU (=sigmaV by default) - or I not understand it correctly? -
This:
Code:# Convert to grayscale and invert v2 = v.Tweak(sat=0) v2 = v2.Invert()
So unless I'm missing something:
Code:v2 = v2.vsTCanny(sigmaY=7.0, sigmaU=7.0+gblur, mode=-1)
Code:v2 = v2.vsTCanny(sigmaY=7.0, mode=-1)
users currently on my ignore list: deadrats, Stears555 -
I thought that tried this combination
But apparently - not
[Attachment 82754 - Click to enlarge]
The only difference is that with sigmaU involved - there is less parasite red/blue colors on the right black border. -
I don't get how the chroma does change, I must be overlooking something.
Maybe someone else sees what I miss.users currently on my ignore list: deadrats, Stears555 -
Also there is vertical bar around 17 pixel wide on the right border appears with some distortion (in chroma?) using vsTCanny
Maybe it appears after this chroma sharpening in the script
Code:MergeChroma(last, Spline36Resize(width/2, height).aWarpSharp2(depth=30).nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=width, fheight=height))
old
[Attachment 82763 - Click to enlarge]
new
[Attachment 82764 - Click to enlarge] -
Don't really see how ContrastMask could remove or cause this, since http://avisynth.nl/index.php/VsTCanny should not require a special mod.
users currently on my ignore list: deadrats, Stears555 -
Seems like gaussian blur algorithm/kernel realized differently in VariableBlur/GaussianBlur and VsTCanny And this "50.0+gblur" in the old ContrastMask handles this border chroma issues.
Code:v2=v2.gaussianblur(50.0,50.0+gblur)
Last edited by cinephil; 10th Oct 2024 at 09:35.
Similar Threads
-
AVISynth AddBorders chroma issue?
By killerteengohan in forum RestorationReplies: 8Last Post: 6th Apr 2024, 06:25 -
Strategies for movement shift
By Bencuri in forum EditingReplies: 4Last Post: 9th Aug 2023, 11:40 -
Chroma Shift creates artefacts
By phelissimo_ in forum RestorationReplies: 0Last Post: 19th Sep 2021, 07:49 -
How to properly fix this chroma abberation issue?
By elektro in forum Newbie / General discussionsReplies: 4Last Post: 10th Aug 2021, 15:39 -
Shift Filter for VirtualDub?
By anachronon in forum EditingReplies: 2Last Post: 17th Mar 2021, 18:14