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. |
16th August 2015, 10:30 | #561 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
|
|
10th April 2016, 18:34 | #563 | Link |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
can someone make makstools 2 linked with avstp in order to control the number of threads or even turn multithreaded off
I think this will solve QTGMC slowdown issue and avs mt crashes
__________________
See My Avisynth Stuff |
11th April 2016, 09:26 | #565 | Link | |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
__________________
See My Avisynth Stuff |
|
8th September 2016, 11:39 | #567 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Think I know the answer to this already but,
Is there any way to expand (as in mt_expand()) white on black mask only in 1 direction, ie expand white upwards, or , white downwards ? (well you can hope, can't you ) EDIT: I am aware of the horizontal and vertical only modes, maybe some kind of convolution would work, if so could you please give solutions for all four directions. Results need to be 0,255 only. EDIT: So only originally black pixels should be affected.
__________________
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; 8th September 2016 at 12:36. |
9th September 2016, 20:32 | #568 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
What, nobody, no idea? EDIT: Clues welcome !
__________________
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; 9th September 2016 at 21:25. |
9th September 2016, 23:26 | #569 | Link | ||
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Quote:
How about mt_expand(mode=something) ? Quote:
OK, the custom mode documentation is pretty unclear, but this is what I found through trial and error: Code:
mt_expand(mode=" 1", chroma="-128") ## shift left mt_expand(mode="-1", chroma="-128") ## shift right mt_expand(mode=" 0 1", chroma="-128") ## shift up mt_expand(mode=" 0 -1", chroma="-128") ## shift down mt_expand(mode=" 1 1", chroma="-128") ## shift left+up mt_expand(mode="-1 -1", chroma="-128") ## shift right+down mt_expand(mode=" 0 0 0 1", chroma="-128") ## expand up mt_expand(mode=" 0 0 0 -1", chroma="-128") ## expand down mt_expand(mode=" 0 0 0 0 1", chroma="-128") ## expand left mt_expand(mode=" 0 0 0 0 -1", chroma="-128") ## expand right mt_expand(mode=" 0 0 -1 0 1", chroma="-128") ## expand left+right (same as 'horizontal') mt_expand(mode=" 0 -1 0 1 0", chroma="-128") ## expand up+down (same as 'vertical') mt_expand(mode=" 0 0 0 1 1", chroma="-128") ## expand left+up mt_expand(mode=" 0 0 0 -1 -1", chroma="-128") ## expand right+down Last edited by raffriff42; 10th September 2016 at 20:20. |
||
10th September 2016, 08:16 | #570 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
RaffRiff42, you are my hero
Ta very much
__________________
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 ??? |
10th September 2016, 16:35 | #571 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
There seems to be a MaskTools bug when using Expand Left as posted in RaffRiff42 post, two posts ahead #570.
This line Code:
mt_expand(mode=" 0 0 0 0 1", chroma="-128") ## expand left This script weirdly exhibits the problem Code:
BlankClip(pixel_Type="YV12") Subtitle("Whats the recipe today Jim ...",align=5) mt_expand(mode=" 0 0 0 0 1", chroma="-128") # expand left Greyscale You will sometime get one of the below results, sometimes the other, There is something not quite right somewhere EDIT: XP32. AVS v2.6. Masktools latest on Wiki.
__________________
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; 22nd April 2020 at 21:34. |
10th September 2016, 16:48 | #572 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Here you have (0,0), (0,0), (1,?), with one coordinate incomplete (and the other two being equal). This probably gives rise to undefined behaviour within MaskTools. Try "0 0 1 0", or "-1 0 0 0". |
|
10th September 2016, 16:52 | #573 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thanx big G, that explains it just fine
Was drivin' me nuts because I kept gettin' different results.
__________________
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 ??? |
10th September 2016, 19:33 | #574 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
OK sorry, I had mt_convolution arguments on the brain there.
So mode seems to be a list of (x,y) coordinates, relative to the current pixel (0,0). The coordinate system is as follows (EDIT: updated in light of Gavino's post #582) Code:
Above,left -1,-1 0,-1 1,-1 -1,0 0,0 1,0 -1,1 0,1 1,1 Below,right Each pixel is replaced by its local maximum : the brightest pixel in its "local neighborhood," as defined by the mode argument. For example, mt_expand(mode="0 0 -1 0") defines a local neighborhood of two pixels: the source pixel itself (0,0) and the one to its left (-1,0). In the output, bright areas will appear to "expand" to the right. (end of edit) So my previous post should have been something like: Code:
mt_expand(mode="-1 0", chroma="128") ## shift right mt_expand(mode="-1 0 0 0", chroma="128") ## expand right mt_expand(mode=" 0 1", chroma="128") ## shift up mt_expand(mode=" 0 1 0 0", chroma="128") ## expand up mt_expand(mode=" 0 -1", chroma="128") ## shift down mt_expand(mode=" 0 -1 0 0" , chroma="128") ## expand down mt_expand(mode=" 1 1", chroma="128") ## shift left+up mt_expand(mode=" 1 1 0 0", chroma="128") ## expand left+up mt_expand(mode="-1 -1", chroma="128") ## shift right+down mt_expand(mode="-1 -1 0 0", chroma="128") ## expand right+down mt_expand(mode=" 1 0 0 0 -1 0", chroma="128") ## expand left+right (same as 'horizontal') mt_expand(mode=" 0 1 0 0 0 -1", chroma="128") ## expand up+down (same as 'vertical') Last edited by raffriff42; 14th September 2016 at 01:50. |
10th September 2016, 20:02 | #575 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
You are still my hero Raff, we got it sorted now.
You might want to copy over the fixed list to the original post. EDIT: You seem to have missed out Code:
mt_expand(mode=" 1 0", chroma="-128") ## shift left mt_expand(mode=" 1 0 0 0", chroma="-128") ## expand left
__________________
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; 10th September 2016 at 20:33. |
10th September 2016, 23:46 | #576 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Didn't miss it - omitted it on purpose! My trick seems to have worked!
OK let's have some demo images, and experiment with mt_square, mt_diamond and mt_circle These func's generate strings you can use as mode arguments. So there's no longer any need for... Code:
mt_expand.mt_expand.mt_expand.mt_expand.mt_expand.mt_expand # ...etc Code:
BlankClip(width=260, height=120, pixel_type="YV12", color=$0) Subtitle("M A S K\n- - - -", size=Height/3, align=5, text_color=$ffffff, lsp=0) AddBorders(8, 8, 8, 8, $ffffff) AddBorders(48, 32, 48, 32, $0) return Interleave( \ EvalShow2("""# (input)""") \ , EvalShow2("""mt_expand(mode="0 -1 0 0", chroma="-128") # down""") \ , EvalShow2("""mt_expand(mode="0 0 -1 -1 -2 -2 -3 -3", chroma="-128") # down-right x3""") \ , EvalShow2("""mt_expand(mode=mt_square(radius=4, zero=true), chroma="-128")""") \ , EvalShow2("""mt_expand(mode=mt_diamond(radius=4, zero=true), chroma="-128")""") \ , EvalShow2("""mt_expand(mode=mt_circle(radius=4, zero=true), chroma="-128")""") \ , EvalShow2("""mt_expand(mode=mt_square(radius=16, zero=true), chroma="-128")""") \ , EvalShow2("""mt_expand(mode=mt_diamond(radius=16, zero=true), chroma="-128")""") \ , EvalShow2("""mt_expand(mode=mt_circle(radius=16, zero=true), chroma="-128")""") \ ) ### execute a script snippet and show it on screen function EvalShow2(clip C, string s) { C Eval(s) Subtitle(s, size=12, align=1) return Last } Last edited by raffriff42; 16th March 2017 at 22:56. Reason: (fixed image links) |
11th September 2016, 02:57 | #577 | Link | |
Registered User
Join Date: Mar 2014
Posts: 308
|
Quote:
The mt_expand chain is good because the square and diamond modes are SIMD-optimised, whereas the custom modes aren't. (And obviously using a chain is O(n) whereas specifying all the pixels is O(n^2), so even if SIMD optimisations weren't relevant, you still lose out.) Just for comparison, mt_expand_multi(sw=10,sh=10) runs about 477 times as fast as mt_expand(mode=mt_square(radius=10)) on my old and flaky laptop (815.2 fps versus 1.709 fps). There's also a constant-time algorithm for the specific case of rectangular erosion and dilation, but practically speaking, the O(n) algorithm is fast enough for reasonable radii.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource! Last edited by colours; 11th September 2016 at 03:00. |
|
11th September 2016, 03:12 | #578 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Very sexy
But how would cope with something like, Code:
HALO_L = 3 # Left Halo width in pixels HALO_R = 4 # Right Halo width in pixels HALO_T = 5 # Top Halo height in pixels HALO_B = 6 # Bot Halo height in pixels
__________________
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; 11th September 2016 at 03:14. |
11th September 2016, 05:00 | #579 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
@colours, I spoke before testing it. You are right of course, thank you.
@StainlessS, this seems to be accurate ± one pixel: (EDIT rewritten with mt_expand_multi, part of Dither_tools) Code:
#M=mt_expand(255, 0, #\ mt_rectangle( #\ Round(0.5*(HALO_L+HALO_R)), #\ Round(0.5*(HALO_T+HALO_B))), #\ chroma="copy") ## 32fps M=mt_expand_multi( \ sw=Round(0.5*(HALO_L+HALO_R)), \ sh=Round(0.5*(HALO_T+HALO_B)), \ chroma="copy") ## 220fps M=M.UUOffsetF(HALO_R-HALO_L, HALO_B-HALO_T) ## test - show semitransparent mask return Overlay(M, mode="lighten", opacity=0.75) ## shift a clip up-down and left-right (sub-pixel shift) function UUOffsetF(clip C, float offh, float offv) { return C.BilinearResize(Width, Height, -offh, -offv, Width, Height) } StainlessS, you could hack this for your needs. Note the built-in "free" blurring; you're gonna want that, or something like it. (EDIT use GaussianBlur or something) Last edited by raffriff42; 16th March 2017 at 22:52. Reason: (fixed image links) |
11th September 2016, 05:44 | #580 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Dear me !!!
You seem to have the bull by the horns I cant actually feather until after detection with RT_YInRangeLocate(), so we need full size masks. I'll have another look in the morrow, got to get some sleep before I fall down. EDIT: Rethink, maybe I can. Edit, nah, forget that.
__________________
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; 11th September 2016 at 21:33. |
Thread Tools | Search this Thread |
Display Modes | |
|
|