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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th April 2013, 22:28   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra v1.10,Test/Diagnostic clip generator. 18 sept 2018.

Zebra. Promted by this thread:
http://forum.doom9.org/showthread.php?t=167591

Requires VS2008 Runtimes.
Code:
Zebra(clip c, Float "threshold"=0.0,int "matrix"=(c.width>1100 || c.height>600)?3:2,
    \ bool "Row"=true,int "lo"=128,int "hi"=255,int "cmad"=1,int "pix"=48
    \ Float "MinTh"=threshold, Float "MaxTh"=threshold,Float "MnMx_MinTh"=threshold,Float "MnMx_MaxTh"=threshold,Int "FuncMap"=$7F
    \ )

# Avisynth v2.5(x86) / v2.6 x86 and x64 Plugins by StainlessS

Creates a 7 band clip in two modes,
    "Row"=True, creates a set of 7 bands "pix" pixels wide (default 48) per band and same height & colorspace as source clip.
        Each horizontal pixel row in the bands represents the contents of the horizontal rows of the source clip.

    "Row"=False, creates a set of 7 bands "pix" pixels tall (default 48) per band and same width & colorspace as source clip.
        Each vertical pixel column in the bands represents the contents of the vertical columns of the source clip.

The 7 bands it creates are (from left to right if Row==true and top to bottom if Row==false)

0 ) YPlaneMin (0->255)
1 ) YPlaneMax (0->255)
2 ) YPlaneMinMaxDifference (0->255)
3 ) YPlaneMedian (0->255)
4 ) AverageLuma (rounded to nearest int, range 0 -> 255)
5 ) YInRange (population of pixels in range lo to hi, scaled 0->255 and rounded to nearest int [255.0 == 100%])
6 ) YPlaneStdev Luma Standard Deviation.

FuncMap, Default $3F (dec 63), ie 6 bits set. Selects bands
    Bit 0, ($01), YPlaneMin(Threshold=MinTh)
    Bit 1, ($02), YPlaneMax(Threshold=MaxTh)
    Bit 2, ($04), YPlaneMinMaxDifference(MnMx_MinTh, MnMx_MaxTh)    # MinMaxDif band has individually selectable thresholds
    Bit 3, ($08), YPlaneMedian
    Bit 4, ($10), AverageLuma
    Bit 5, ($20), YInRange(lo=Lo,hi=Hi)
    Bit 6, ($40), YPlaneStdev()
           By Default $7F, All bands (dec 127).

"Threshold" is group threshold setting used for bands 0, 1, and 2 as for eg YPlaneMin, 0.0->100.0%, Avoids extreme pixels, ie noise.
"lo" and "hi", set pixel range for YInRange band.
"Matrix",(For RGB -> Luma-Y conversion, not used in YUV modes), Default is 3 if width>1100 or c.height > 600 else 2
    0) = rec601
    1) = rec709
    2) = PC601
    3) = PC709

MinTh      Default threshold, is threshold for YPlaneMin band 0.
MaxTh      Default threshold, is threshold for YPlaneMax band 1.
MnMx_MinTh Default threshold, is minimum threshold for YPlaneMinMaxDifference, band 2. (individual thresholds for both min and max)
MnMx_MaxTh Default threshold, is maximum threshold for YPlaneMinMaxDifference, band 2.

 You might use eg YPlaneMin(MinTh=0.1) to ignore darkest 0.1% of pixels when finding minimum pixel luma.
 YplaneMax(MaxTh=0.2), ignores lightest 0.2% of pixels.
 YplaneMinMaxDifference(MnMx_MinTh=0.3, MnMx_MaxTh=0.4), ignores darkest 0.3%  and lightest0.4% of pixels.
 YPlaneMedian, is essentially YPlaneMin(Threshold=50.0).

"cmad", Centered Moving Averages Diameter, 1->100, default = 1 (OFF). Each row or column of pixels in the bands are averaged with neighbours
   within the "cmad" diameter. A "cmad" of eg 13 would average each row/column with 6 neighbours on either side (plus itself =13).
   Setting "cmad" greater than 1 will produce smoother, bands due to the averaging.

"pix", size of bands in pixels 4->64, default 48 (Mod 4 Only).

############################################

Zebroid(clip c, Float "threshold"=0.0,int "matrix"=(c.width>1100 || c.height>600)?3:2,
    \ int "lo"=128,int "hi"=255,int "cmad"=1,int "func"=4,
    \ Float "MinTh"=threshold, Float "MaxTh"=threshold,Float "MnMx_MinTh"=threshold,Float "MnMx_MaxTh"=threshold,Int "funcMap"=$10,
    \ int "lo2"=lo,int "hi2"=hi,int "cmad2"=cmad,int "func2"=func,
    \ Float "MinTh2"=MinTh, Float "MaxTh2"=MaxTh,Float "MnMx_MinTh2"=MnMx_MinTh,Float "MnMx_MaxTh2"=MnMx_MaxTh,Int "funcMap2"=funcMap
    \ )

v1.10, added args, lo2, hi2, cmad2, func2, MinTh2, MaxTh2, MnMx_MinTh2, MnMx_MaxTh2, funcMap2, which optionally specify alteratives
for equivalent of Zebra(Row=False) (horizontal bars).

NOTE, can specify single Zebroid function using eg Func=4,=AverageLuma band or using FuncMap=$10(AverageLuma again), cannot simultaneously
specify both Func and FuncMap else throws an error. Using FuncMap, can now specify multiple functions, eg $7F will produce a Zebroid
image where each pixel is average(mean) of all bands selected by FuncMap and FuncMap2 args (or Func and Func2).

Threshold, MinTh, MaxTh, MnMx_MinTh, MnMx_MaxTh, matrix, lo, hi, and cmad,
all exactly the same functionality and defaults as in Zebra Filter.
Func argument, default 4 (AverageLuma), is function used in creating the result clip (same size and colorspace as input clip).
Func range 0 -> 5 # EDIT: Func range 0 -> 6
 0 ) YPlanemin(threshold=MinTh)
 1 ) YPlanemax(threshold=MaxTh)
 2 ) YPlaneminmaxDifference(MnMx_MinTh, MnMx_MaxTh) # Indiviually selectable min and max thresholds
 3 ) YPlaneMedian
 4 ) AverageLuma
 5 ) YInRange
 6 ) YPlaneStdev

Each pixel in the output clip is the average (mean) of the two pixels taken from the equivalent of the Zebra columns
(x coord [row=false in Zebra]) and Zebra rows (y coord [row=true in Zebra]) of the chosen Func bands.
'cmad', is processed on both row and column pixels prior to taking the mean and rendering each result pixel.

Returns same audio as input clip.

Zebroid:= A hybrid of Zebra and another equine animal.
############################################

The v2.58 version supports Y8 in avisynth v2.6.
Running version v2.6 on Avisynth v2.58, will not find a plugin named Zebra.
v2.6 dll Requires Avisynth v2.6 Alpha4+ as Alpha3 and below do not support VERSION 6 avisynth.h.

ssS
see Mediafire And/Or SendSpace below in my sig
v2.58, v2.60 x86 and x64 dll's + source + full VS2008 project files.
__________________
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; 19th September 2018 at 09:08. Reason: test, diagnostic
StainlessS is offline   Reply With Quote
Old 12th April 2013, 23:10   #2  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,057
I had a few minutes to play with this. The YInRange column definitely provides a little more control over the mask creation. Thanks!
johnmeyer is offline   Reply With Quote
Old 12th April 2013, 23:23   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Any suggestions for further band modes ? (EDIT, that can be calculated from a pixel count array)
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 13th April 2013, 00:27   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,057
Quote:
Originally Posted by StainlessS View Post
Any suggestions for further band modes ? (EDIT, that can be calculated from a pixel count array)
I cannot say for sure whether this would be useful for my current project, but a "centered moving average" of rows might be a good way to smooth the mask.

General idea:

R = Moving average range

row(n)_average =
[row(n-R/2) + row(n-R/2 +1) + ... row(n) + ... row(n+R/2-1) + row(n+R/2)] / R

So, the general idea is to collect the min/max/median row values as you already have, but then replace one or more of these with the the calculated value for the current row, averaged with 1,2,3, ... of both the previous and following rows.

Centered moving averages work really well, but are a pain because you really want to stick with only odd numbers for R, and of course the values for the beginning and end rows cannot have a full range of averages, so you have to write extra code to deal with the end points (first row has no average; second row is averaged with the adjacent rows; and so on until you reach the R/2th row -- same for the last row).

I'm not sure this is going to make a difference for my current project, but you asked ...

Actually, as I think about it, this actually would help remove the need for all the blur functions, and even better, might tend to "feather" the edge of the mask.
johnmeyer is offline   Reply With Quote
Old 13th April 2013, 01:11   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
OK, I'll have a go at this, I'll do a prototype in script and post for your approval before coding it in C++.
The script version will probably be quite slow.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 13th April 2013, 01:13   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,057
Thanks!
johnmeyer is offline   Reply With Quote
Old 13th April 2013, 17:59   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
How does this grab ya.

Code:
Avisource("D:\avs\1955 Football 02.avi").Trim(0,-10)
ConvertToYV24()

Function CenteredMovingAve(clip c,int r) {
    Assert(r>0,"MovingAve: r cannot be zero")
    c   c2=0    killaudio()
    WW=width HH=height Frames=FrameCount
    GScript("""
        Even = !RT_BitTST(r,0)
        if(Even) {r=r-1}                                        # Make ALWAYS odd
        r=r/2                                                   # make radius
        for(n=0,Frames-1) {
            ras=0
            For(y=0,hh-1) {
                ave=0.0 div=0.0
                if(Even && y-(r+1) >= 0) {                    # do even
                    a = RT_YPlaneMax(n=n,y=y-(r+1),h=1) 
                    ave = ave + 0.5 * a 
                    div = div + 0.5 
                }
                For(off= -r, r) {
                    row=y+off
                    if(row>=0 && row<HH) {
                        a = RT_YPlaneMax(n=n,y=row,h=1) 
                        ave = ave + a
                        div=div+1.0
                    }   
                }
                if(Even && y+(r+1) < HH) {                    # do even
                    a = RT_YPlaneMax(n=n,y=y+(r+1),h=1) 
                    ave = ave + 0.5 * a 
                    div = div + 0.5
                }
                ave=ave / div
                color=Int(ave+0.5)
                scanline=c.BlankClip(Color_YUV=$8080+$10000*color,width=48,height=1,length=1)
                ras=(IsClip(ras)) ? ras++scanline : scanline
            }
            ras=ras.WeaveRows(HH)
            c2=(IsClip(c2)) ? c2++ras : ras
            RT_Debug(String(n)+"] of ",string(Frames))
        }
    """)
    return c2
}

ORG=Last
S=RT_Timer()
DIAG=CenteredMovingAve(ORG,24)
E=RT_Timer()
StackHorizontal(ORG,DIAG)
ConvertToRGB32()
RT_Debug("Time=",String(E-S))
Return Last
Its real slow, ~ 22 secs per frame with r==24, 1.8 secs @ r==1,7 secs @ r=7.

I've attempted to implement EVEN R.

EDIT:
Quote:
first row has no average
have not implemented like that, but could easily.

OOps, fixed (r/2+1) should be (r/2)

OOPS, Take 3. Hope I got it right this time.

Take 4, minor mod
__________________
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; 14th April 2013 at 18:22.
StainlessS is offline   Reply With Quote
Old 13th April 2013, 19:35   #8  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,057
I'm in my garage with my front load washer in pieces. Have laptop on to follow nice instructional video of how to remove bearings. Will not be able to test your code until late today or tomorrow. Once again, thank you very, very much.
johnmeyer is offline   Reply With Quote
Old 14th April 2013, 01:24   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra 1.03beta:
LINK REMOVED:

Code:
Zebra(clip c, Float "threshold"=0.0,int "matrix"=2,bool "Row"=true,int "lo"=128,int "hi"=255,int "cmad"=1,int "pix"=48)
# Avisynth v2.5/v2.6 Plugins by StainlessS

Creates a 6 bar clip in two modes,
    "Row"=True, creates a set of 6 bars "pix" pixels wide (default 48) per bar and same height & colorspace as source clip.
        Each horizontal pixel row in the bars represents the contents of the horizontal rows of the source clip.

    "Row"=False, creates a set of 6 bars "pix" pixels tall (default 48) per bar and same width & colorspace as source clip.
        Each vertical pixel column in the bars represents the contents of the vertical columns of the source clip.

The 6 bands it creates are (from left to right if Row==true and top to bottom if Row==false)

1 ) YPlanemin (0->255)
2 ) YPlanemax (0->255)
3 ) YPlaneminmaxDifference (0->255)
4 ) YPlaneMedian (0->255)
5 ) AverageLuma (rounded to nearest int, range 0 -> 255)
6 ) YInRange (population of pixels in range lo to hi, scaled 0->255 and rounded to nearest int)


"Threshold" used for bands 1, 2, and 3 as for eg YPlaneMin, 0.0->100.0%, Avoids extreme pixels, ie noise.
 You might use eg YPlaneMin(Threshold=0.2) to ignore darkest 0.2% of pixels when finding minimum pixel luma.
 YplaneMax(Threshold=0.2), ignores lightest 0.2% of pixels.
 YplaneMinMaxDifference(Threshold=0.2), ignores darkest and lightest 0.2% of pixels.
 YPlaneMedian, is essentially YPlaneMin(Threshold=50.0).

"Matrix",(For RGB -> Luma-Y conversion, not used in YUV modes)

0) = rec601
1) = rec709
2) = PC601
3) = PC709

"lo" and "hi", set pixel range for YInRange band.

"cmad", Centered Moving Averages Diameter, 1->100, default = 1 (OFF). Each row or column of pixels in the bands are averaged with neighbours
 within the "cmad" diameter. A "cmad" of eg 13 would average each row/column with 6 neighbours on either side (plus itself =13).
 Setting "cmad" greater than 1 will produce smoother, bands due to the averaging.

"pix", size of bands in pixels 4->64, default 48 (Mod 4 Only).


Zebra.dll is for Avisynth v2.58 and Zebra26.dll is for Avisynth v2.6.
The v2.58 version supports Y8 in avisynth v2.6.
Running version v2.6 on Avisynth v2.58, will not find a plugin named Zebra.
__________________
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; 15th August 2018 at 15:12.
StainlessS is offline   Reply With Quote
Old 17th April 2013, 14:57   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
v1.03beta updated to v1.3. See 1st post.

arg "pix" min changed from 1 to 4.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 22nd April 2013, 16:19   #11  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,057
Finally getting back to this project. I tried your CenteredMovingAve function but I kept getting an error that there is no function called "WeaveRows." I queried my version of AVISynth and I am running 2.60, August 28, 201, Ben Rudiak-Gould. I think this version should include this extension, but perhaps this build did not.

Don't spend any time trying to help me with this minor issue because this is not a big deal: while it would be interesting to have the averaging provided by this function, the script is too slow to be practical, and I think I can proceed with either the modified Zebra function or the RT_YInRangeLocate function.

I'll post again, including some results, when I have worked my way through how to best use this function.
johnmeyer is offline   Reply With Quote
Old 22nd April 2013, 17:18   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Quote:
2.60, August 28, 201
That version is nearly 2000 years old, update to Alpha 4 of Jan 2013 (WeaveRows new to that ver$).

The script function was only a prototype, to see if I got the logic correct, it seems AOK.

EDIT: I'll add a filter function to Zebra to apply CMAD to a clip.
__________________
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 2013 at 17:27.
StainlessS is offline   Reply With Quote
Old 22nd April 2013, 17:44   #13  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,057
Quote:
I'll add a filter function to Zebra to apply CMAD to a clip.
Don't spend too much time on this. I'm trying various things and I think I can get what I need by doing motion compensation on the previous frame; then subtract that frame from the current frame; and then use RT_YInRangeLocate to generate a clip that I can feed into my mask generator.

My biggest hurdle will be perfecting that mask. I do lots of things with AVISynth, but have never had any success creating my own masks, although I've used some code created by Didee that involved masks, and it worked spectacularly well. I'll probably stick with what I did on my first attempt at this last week, and do the masking inside my editing program, Sony Vegas.
johnmeyer is offline   Reply With Quote
Old 23rd April 2013, 10:28   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
John, changed my mind about doing an additional CMAD func in zebra, would be just as good
to just crop out the required Zebra band and resize to full frame, results should be just the same,
even pointresize should make no difference.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 17th January 2015, 07:41   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra v1.04, new version, see 1st post.

Code:
Zebroid(clip c, Float "threshold"=0.0,int "matrix"=2,int "lo"=128,int "hi"=255,int "cmad"=1,int "func"=4)

Threshold, matrix, lo, hi, and cmad, all exactly the same functionality and defaults as in Zebra Filter.
New argument, Func, default 4 (AverageLuma), is function used in creating the result clip (same size and colorspace as input clip).
Func range 0 -> 5
 0 ) YPlanemin
 1 ) YPlanemax
 2 ) YPlaneminmaxDifference
 3 ) YPlaneMedian
 4 ) AverageLuma
 5 ) YInRange

Each pixel in the output clip is the average (mean) of the two pixels taken from the equivalent of the Zebra columns
(x coord [row=false in Zebra]) and Zebra rows (y coord [row=true in Zebra]) of the chosen Func bars.
'cmad', is processed on both row and column pixels prior to taking the mean and rendering each result pixel.

Returns same audio as input clip.

Zebroid:= A hybrid of Zebra and another equine animal.
Was looking though a PDF on scene change detection earlier today (well, yesterday, got to get to bed one day), and saw that somebody
had suggested a sort of equivalent resized and merged to full frame version of the Zebra row/column bars, for use in Scene Change Detection.
For use in SCD, they used frame split into 9 parts (3x3) and did detection on re-assembled clip after processing. Could not resist having a go,
and result is the Zebroid filter added here to Zebra Plugin.

Full image, CMAD=1 (off) [func=4 AverageLuma]


Full image, CMAD=11 [func=4 AverageLuma]


3x3 Images CMAD=1 [func=4 AverageLuma]


3x3 Images CMAD=11 [func=4 AverageLuma]


Script supplied in zip
Code:
#avisource("TEST.avi").trim(10000,0)
#ImageSource("dq-tools.jpg",end=0)
Colorbars.killaudio

#convertToYv12
#convertToYUY2
#ConvertToRGB32
#ConvertToRGB24

############## CONFIG ##########
CMAD=1
LO=64
HI=191
FUNC=4    # 0 -> 5
################################

return StackVertical(zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC))

WW = Round(Width  / 12.0) * 4
HH = Round(Height / 12.0) * 4

TL=Crop(0,0,WW,HH).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)
TM=Crop(WW,0,Width-WW*2,HH).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)
TR=Crop(Width-WW,0,WW,HH).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)

ML=Crop(0,HH,WW,Height-HH*2).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)
MM=Crop(WW,HH,Width-WW*2,Height-HH*2).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)
MR=Crop(Width-WW,HH,WW,Height-HH*2).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)

BL=Crop(0, Height-HH,WW,HH).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)
BM=Crop(WW,Height-HH,Width-WW*2,HH).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)
BR=Crop(Width-WW,Height-HH,WW,HH).zebroid(lo=LO,hi=HI,cmad=CMAD,func=FUNC)

T=StackHorizontal(TL,TM,TR)
M=StackHorizontal(ML,MM,MR)
B=StackHorizontal(BL,BM,BR)

Z=StackVertical(T,M,B)

StackVertical(Z)                  # or maybe with CMAD=1: return Z.Blur(1.58).Blur(1.58).ConvertToRGB32

return ConvertToRGB32
EDIT: Oops, copied same link twice for last two images, fixed.

EDIT: Or this is probably better for SCD with CMAD=1 (Off) and Blur(1.58).Blur(1.58),
no hard edges between 3x3 clips.


EDIT: The Pdf mentioned: http://arhcmus.googlecode.com/svn/tr...pi-Anttila.pdf

EDIT: The Zebroid output (according to the pdf) would need some kind of additional 'line analysis', but I think it might actually
work (to some degree) on its own. I'll have to go back and read the rest of the pdf, I stopped immediately that I read about it
and dashed off to do the Zebroid thing.
__________________
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; 15th August 2018 at 15:14.
StainlessS is offline   Reply With Quote
Old 30th March 2015, 19:36   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra v1.05, see 1st post.

Changed Matrix arg default (to include width>1100), Recompile v2.6 dll with Avisynth Version 6 Header.
Code:
Zebra(clip c, Float "threshold"=0.0,int "matrix"=(c.width>1100 || c.height>600)?3:2,
    \ bool "Row"=true,int "lo"=128,int "hi"=255,int "cmad"=1,int "pix"=48)
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 20th March 2018, 04:01   #17  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
EQuid, ZebraTest() mod.

Code:
Function Equid(clip c,Float "Thresh",Float "Lo",Float "Hi",Int "CMad",Int "Bands",
        \ Bool "Zebroid",Float "zThresh",Float "zLo",Float "zhi",Int "zCMad",Int "zFunc",
        \ Bool "Subs") {
    /*
        Equid, Hoofed mammal with Mane (or an on-line 1.00 coin).
            Equid, a ZebraTest() script mod, revamped as a script function.
        Main advantage is the number of bars are selectable (from highest downwards), eg Bands=1 selects bar 5, ie YInRange bar.
        The least useful [ie YPlaneMin(func band=0) and YPlaneMax(func band=1)] are included only if selecting Bands=6 and 5
        respectively.
          In addition to the normal Zebra() functionality provided in ZebraTest script, this effort allows selection of
        Zebroid functionality (when Zebroid bool = true, where the 'z...' args become relevant).
        If Zebroid is applied to the incoming clip, then the Zebra bands are created using the Zebroid result as source.
        See ZebraTest() script for further usage. https://forum.doom9.org/showthread.php?t=167663
    */
    c  PIX=48
    Thresh=Default(Thresh,0.0)       Lo=Round(Default(Lo,128))   Hi=Round(Default(Hi,255.0))  CMad=Default(CMad,1)  Bands=Default(Bands,4)
    Zebroid=Default(Zebroid,false)   zThresh=Default(zThresh,0.0)
    zLo=Round(Default(zLo,128))      zHi=Round(Default(zHi,255)) zCMad=Default(zCMad,1)  zFunc=Default(zFunc,4) Subs=Default(Subs,True)

    Assert(1 <= Bands <= 6,String(Bands,"ZebBoard: 1 <= Bands <= 6(%.0f)"))
    Zebroid?Assert(0 <= zFunc <= 5,String(Bands,"ZebBoard: 0 <= zFunc <= 5(%.0f)")):NOP
    zFnName=Select(zFunc,"Min","Max","Mx-Mn","Med","Ave","Yir")
    (Zebroid) ? Zebroid(Threshold=zThresh,lo=Round(zLo),hi=Round(zHi),cmad=zCMad,func=zFunc) : NOP
    Z1=Zebra(row=true,threshold=Thresh,lo=Round(LO),hi=Round(HI),pix=PIX,cmad=CMAD).Crop((6-Bands)*Pix,0,Pix*Bands,0)
    Z2=Zebra(row=false,threshold=Thresh,lo=Round(LO),hi=Round(HI),pix=PIX,cmad=CMAD).Crop(0,(6-Bands)*Pix,0,Pix*Bands)
    Z1=Z1.SUBTITLE("Row\nTrue", x=(Bands)*PIX/2-15,y=Z1.Height/2-10,Text_Color=$FFFFFF,lsp=0)
    Z2=Z2.SUBTITLE("Row False",x=Z2.Width/2-37,y=(Bands)*PIX/2-10,Text_Color=$FFFFFF)
    (Subs)?SubTitle("PIX="+String(PIX),y=height/2-50,Text_Color=$FFFFFF,Align=5):NOP
    (Subs)?SubTitle("Thresh="+String(Thresh),y=height/2-30,Text_Color=$FFFFFF,Align=5):NOP
    (Subs)?SubTitle("LO="+String(LO)+" HI="+String(hi),y=height/2-10,Text_Color=$FFFFFF,Align=5):NOP
    (Subs)?SubTitle("CMAD="+String(CMAD),y=height/2+10,Text_Color=$FFFFFF,Align=5):NOP
    (Subs&&Zebroid)?Subtitle(String(zThresh,"zThresh=%f\n")+String(zLo,"zLo=%.0f ")+String(zHi,"zHi=%.0f\n")+
        \ String(zCMad,"zCMad=%.0f\n")+String(zFunc,"zFunc=%.0f [")+zFnName+"]",y=height/2+40,Text_Color=$FFFFFF,Align=5,lsp=0) : NOP
    BLANK=Z2.BlankClip(width=Bands*PIX,color=$808080)
    BLANK=(Bands>=6)?BLANK.SUBTITLE("MIN",x=(Bands-6)  *PIX+PIX/2-15,y=(Bands-6)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
    BLANK=(Bands>=5)?BLANK.SUBTITLE("MAX",x=(Bands-5)  *PIX+PIX/2-15,y=(Bands-5)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
    BLANK=(Bands>=4)?BLANK.SUBTITLE("MX-MN",x=(Bands-4)*PIX+PIX/2-24,y=(Bands-4)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
    BLANK=(Bands>=3)?BLANK.SUBTITLE("MED",x=(Bands-3)  *PIX+PIX/2-15,y=(Bands-3)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
    BLANK=(Bands>=2)?BLANK.SUBTITLE("AVE",x=(Bands-2)  *PIX+PIX/2-15,y=(Bands-2)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
    BLANK           =BLANK.SUBTITLE("YIR",x=(Bands-1)  *PIX+PIX/2-15,y=(Bands-1)*PIX+PIX/2-10,Text_Color=$FFFFFF)
    Return StackVertical(StackHorizontal(Z1),StackHorizontal(Z2,BLANK))
}
EDIT: Added Round() on internal Lo/Hi zLo/ZHi args.

Code:
Imagesource("DQ-Tools.jpg",end=0)
Return Equid(CMad=3,Bands=3)
#Return Equid(CMad=10,Bands=3,Zebroid=True,zFunc=5)






EDIT:
q] What use is it ?
a] No idea, but I'm experimenting with it in Spatial Alignment of clips [EQuid, as a viewer for perusal].
__________________
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; 15th August 2018 at 15:14.
StainlessS is offline   Reply With Quote
Old 15th August 2018, 15:08   #18  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra v1.06, new version see 1st post.
Code:
/* 
	v1.04, 15 Jan 2015. Added Zebroid.
	v1.05, 30 Mar 2015. changed RGB Matrix default, (c.width>1100 || c.height>600)?3[PC709]:2[REC601]
	       Recompile v2.6 dll with Avisynth Version 6 Header.
	v1.06, 15 Aug 2018. Added Version Resource. Recompile VS2008 Avs v2.58, AVs+ v2.60 x86 & x64.

*/
Zip about 112KB incl source + full VS2008 Project Files. (requires recent avs+ headers).
Headers (and ones in avs directory):- https://github.com/pinterf/AviSynthP...s_core/include

EDIT: Some broken image links in previous posts fixed.
__________________
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; 15th August 2018 at 15:15.
StainlessS is offline   Reply With Quote
Old 11th September 2018, 05:04   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra v1.07, new version see 1st post.

Code:
/* 
	v1.04, 15 Jan 2015. Added Zebroid.
	v1.05, 30 Mar 2015. changed RGB Matrix default, (c.width>1100 || c.height>600)?3[PC709]:2[REC601]
	       Recompile v2.6 dll with Avisynth Version 6 Header.
	v1.06, 15 Aug 2018. Added Version Resource. Recompile VS2008 Avs v2.58, AVs+ v2.60 x86 & x64.
	v1.07, 11 Sept 2018. Added MinTh, MaxTh, MnMx_MinTh, MnMx_MaxTh, FuncMap args.

*/
Mod of EQuid() Script, as supplied in Zip

Code:
Function Equid(clip c,Float "Thresh",Int "Lo",Int "Hi",Int "CMad",Int "Bands",
        \ Float "MinTh", Float "MaxTh",Float "MnMx_MinTh",Float "MnMx_MaxTh",Int "FuncMap",
        \ Bool "Zebroid",Float "zThresh",Int "zLo",Int "zhi",Int "zCMad",Int "zFunc",
        \ Float "zMinTh", Float "zMaxTh",Float "zMnMx_MinTh",Float "zMnMx_MaxTh",
        \ Bool "SubsI",Bool "SubsO"
        \ ) {
/*
        Equid, Hoofed mammal with Mane (or an on-line 1.00 coin).
            Equid, a ZebraTest() script mod, revamped as a script function.

        Shows Zebra Bands for clip c.
            Zebra bands selectable via Bands(default 6, ie all, from highest band downwards, so Bands=2 selects YInRange & AverageLuma)
                    or via a FuncMap bit map(default $3F ie all), where each set bit selects a Zebra band
                       (Where the min/max/minmaxdif default to Thresh).
                Bit 0, ($01), YPlaneMin(Threshold=MinTh)
                Bit 1, ($02), YPlaneMax(Threshold=MaxTh)
                Bit 2, ($04), YPlaneMinMaxDifference(MnMx_MinTh, MnMx_MaxTh)    # MinMaxDif band has individually selectable thresholds
                Bit 3, ($08), YPlaneMedian
                Bit 4, ($10), AverageLuma
                Bit 5, ($20), YInRange(lo=Lo,hi=Hi)
            By Default All Bands are $3F, dec 63.

        Thresh,     Default 0.0, is group default setting for the minimum and maximum thresholds.
        lo,hi,      Defaults Lo=128, hi=255 YInRange(Lo,hi) band. YInRange shows population between lo and high (where white=100%).
        Bands,      Default 6, as described above. (selects from highest band [YInRange] downwards). (0=none selected).
        MinTh,      Default Thresh. Threshold for YPlaneMin band.
        MaxTh,      Default Thresh. Threshold for YPlaneMax band.
        MnMx_MinTh, Default Thresh. Threshold for YPlaneMinMaxDifference(Minimum threshold), individually selectable threshold.
        MnMx_MaxTh, Default Thresh. Threshold for YPlaneMinMaxDifference(Maximum threshold), individually selectable threshold.
        FuncMap,    Default $3F, dec 63m, ie all bands selected. (0=none selected).

        Zebroid,    Default False.
                      In addition to the normal Zebra() functionality provided in ZebraTest script, this effort allows selection of
                    Zebroid functionality (when Zebroid bool = true, where the 'z...' args become relevant).
                    If Zebroid is applied to the incoming clip, then the Zebra bands are created using the Zebroid result as source.
                    q) Whats its purpose ?, a) Dont know, just experiment.
        zXXX args,  As For above args but only if Zebroid=True, and applied to incoming Zebroid'ed clip before Zebra bands created.

        SubsI,      Default True, If True, show subtitles on inner  clip (source of Zebroid).
        SubsO,      Default SubI, If True, show subtitles on outter clips, Zebra bands if selected.

        NOTE, Can only supply EITHER Bands OR FuncMap, not both, and if suppled as 0, and Zebroid=False, then function returns src clip.
*/
    myName="EQuid: "
    c  PIX=48
    Assert(!(Bands.Defined && FuncMap.Defined),RT_String("%sCannot specify both Bands and FuncMap",myName))
    FuncMap  = !FuncMap.Defined ? RT_BitXor($3F,RT_BitLSR($3F,Default(Bands,6))) : FuncMap
    Thresh     =Default(Thresh,0.0)           Lo=Default(Lo,128)   Hi=Default(Hi,255)  CMad=Default(CMad,1)  Bands=Default(Bands,4)
    MinTh      =Default(MinTh,Thresh)         MaxTh=Default(MaxTh,Thresh)
    MnMx_MinTh =Default(MnMx_MinTh,Thresh)    MnMx_MaxTh=Default(MnMx_MaxTh,Thresh)
    Zebroid    =Default(Zebroid,false)        zThresh=Default(zThresh,0.0)
    zLo        =Default(zLo,128)              zHi=Default(zHi,255)
    zCMad      =Default(zCMad,1)              zFunc=Default(zFunc,4)
    zMinTh     =Default(zMinTh,zThresh)       zMaxTh=Default(zMaxTh,zThresh)
    zMnMx_MinTh=Default(zMnMx_MinTh,zThresh)  zMnMx_MaxTh=Default(zMnMx_MaxTh,zThresh)
    SubsI=Default(SubsI,True)                 SubsO=Default(SubsO,SubsI)
    Zebroid?Assert(0 <= zFunc <= 5,RT_String("%s0 <= zFunc <= 5(%.0f)",myName,zFunc)):NOP
    zFnName=Select(zFunc,"Min","Max","Mx-Mn","Med","Ave","Yir")
    (Zebroid) ? Zebroid(Threshold=zThresh,lo=Round(zLo),hi=Round(zHi),cmad=zCMad,func=zFunc,
            \       MinTh=zMinTh,Maxth=zMaxTh,MnMx_MinTh=zMnMx_MinTh,MnMx_MaxTh=zMnMx_MaxTh)
            \ : NOP
    Bands=RT_BitSetCount(FuncMap)
    Z1=(Bands==0)?0:Last.Zebra(row=true,threshold=Thresh,lo=Round(LO),hi=Round(HI),pix=PIX,cmad=CMAD,
            \ MinTh=MinTh,Maxth=MaxTh,MnMx_MinTh=MnMx_MinTh,MnMx_MaxTh=MnMx_MaxTh,FuncMap=FuncMap)
    Z2=(Bands==0)?0:Zebra(row=false,threshold=Thresh,lo=Round(LO),hi=Round(HI),pix=PIX,cmad=CMAD,
            \ MinTh=MinTh,Maxth=MaxTh,MnMx_MinTh=MnMx_MinTh,MnMx_MaxTh=MnMx_MaxTh,FuncMap=FuncMap)
    S1=(!SubsI) ? "" : RT_String("\nMinTh=%.2f MaxTh=%.2f\nMnMx_MinTh=%.2f  MnMx_MaxTh=%.2f\nLo=%d Hi=%d\nCMad=%d",
                 \ Minth,MaxTh,MnMx_MinTh,MnMx_MaxTh,Lo,Hi,CMad)
    S2=(!(SubsI&&Zebroid)) ? "" : RT_String("\n\nzMinTh=%.2f zMaxTh=%.2f\nzMnMx_MinTh=%.2f  zMnMx_MaxTh=%.2f\nzLo=%d zHi=%d\nzCMad=%d",
                 \ zMinth,zMaxTh,zMnMx_MinTh,zMnMx_MaxTh,zLo,zHi,zCMad)
    S=S1+S2      Lines=RT_TxtQueryLines(S)    Y=(Height-Lines*18) / 2   S=S.RT_StrReplace(Chr(10),"\n")
    Z1=(Bands!=0&&SubsO)?Z1.SUBTITLE("Row\nTrue",Align=5,lsp=0):Z1
    Z2=(Bands!=0&&SubsO)?Z2.SUBTITLE("Row False",y=(Z2.Height+12)/2.0,Align=5):Z2
    (SubsI) ? SubTitle(S,Align=5,Y=Y,lsp=0) : NOP
    Function BandSub(clip c,int FuncMap,Int Bands) {
        c  myName="EQuid::BandSub: "
        IsAvsPlus=(FindStr(UCase(versionString),"AVISYNTH+")!=0) HasGScript=RT_FunctionExist("GScript")
        Assert(IsAvsPlus || HasGScript,RT_String("%sNeed Avs+ or GScript",myName))
        GS="""
            off=0 PixX=Width.Float/Bands PixY=Height.Float/Bands
            for(i=0,5) {
                if(RT_BitTst(FuncMap,i)) {
                    Fnam=Select(i,"Min","Max","Mx-Mn","Med","Ave","Yir")
                    len=StrLen(Fnam)    x=(Off+0.5)*PixX-(4.5*Len) y=(Off+0.5)*PixY-11
                    SUBTITLE(fnam,x=x,y=y)
                    off = off + 1
                }
            }
        """
        HasGScript?GScript(GS) : Eval(GS)
        Return Last
    }
    BLANK=(Z2.IsClip)?Z2.BlankClip(width=Z1.Width,color=$808080):0
    Blank=(Blank.IsClip&&SubsO)?Blank.BandSub(FuncMap,Bands):Blank
    Return (Blank.IsClip)?StackVertical(StackHorizontal(Z1),StackHorizontal(Z2,BLANK)):Last
}

/*
    #Client_script
    AVISource("D:\G.avi")
    #Colorbars.KillAudio
    Crop(0,0,Width/4*4,Height/4*4)
    ConvertToYV12
    FUNCMAP = $3f  # 0 -> $3F
    return Equid(FuncMap=FUNCMAP)
*/
EDIT:
Code:
AVISource("D:\Greymouse.avi")
Crop(12,12,-12,-12)
Crop(0,0,Width/4*4,Height/4*4)
ConvertToYV12
FUNCMAP = $2C   # bits 2, 3, and 5, YPlaneMinMaxdif, YPlaneMedian, YInRange
return Equid(MnMx_MinTh=5,MnMx_MaxTh=10,Lo=140,hi=255,FuncMap=FUNCMAP)
__________________
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 2018 at 05:30.
StainlessS is offline   Reply With Quote
Old 18th September 2018, 12:32   #20  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,982
Zebra v1.10, new version see first post.

Code:
/* 
	v1.04, 15 Jan 2015. Added Zebroid.
	v1.05, 30 Mar 2015. changed RGB Matrix default, (c.width>1100 || c.height>600)?3[PC709]:2[REC601]
	       Recompile v2.6 dll with Avisynth Version 6 Header.
	v1.06, 15 Aug 2018. Added Version Resource. Recompile VS2008 Avs v2.58, AVs+ v2.60 x86 & x64.
	v1.07, 11 Sept 2018. Added MinTh, MaxTh, MnMx_MinTh, MnMx_MaxTh, FuncMap args.
	v1.10, 18 Sept 2018. Bugfix v1.07 RGB24 Zebroid hang (infinite loop).
			Added, lo2, hi2, cmad2, func2, minTh2, maxTh2, mnmx_minTh2, mnmx_maxTh2, funcmap2 args.
			Added, YPlaneStdev function to both Zebra and Zebroid.

*/
Added new band, YPlaneStdev.

Update to Equid script, (args have changed due to expansion, now uses FuncMap rather than Func arg).
EQuid.avs (Included in zip)
Code:
Function Equid(clip c,Float "Thresh",Int "FuncMap",Int "Matrix",
        \
        \ Float "MinTh" , Float "MaxTh" ,Float "MnMx_MinTh" ,Float "MnMx_MaxTh" ,Int "Lo" ,Int "Hi" , Int "CMad" ,
        \ Float "MinTh2", Float "MaxTh2",Float "MnMx_MinTh2",Float "MnMx_MaxTh2",Int "Lo2",Int "Hi2", Int "CMad2",
        \
        \ Bool "Zebroid",Float "zThresh",
        \ int "zFuncmap",  Float "zMinTh" , Float "zMaxTh" ,Float "zMnMx_MinTh" ,Float "zMnMx_MaxTh" ,Int "zLo" ,Int "zhi" ,Int "zCMad",
        \ int "zFuncmap2", Float "zMinTh2", Float "zMaxTh2",Float "zMnMx_MinTh2",Float "zMnMx_MaxTh2",Int "zLo2",Int "zhi2",Int "zCMad2",
        \
        \ Bool "SubsI",Bool "SubsO"
        \ ) {
/*
        Equid v1.0.
        Equid, Hoofed mammal with Mane (or an on-line 1.00 coin).
            Equid, a ZebraTest() script mod, revamped as a script function.

        Equid(clip c,Float "Thresh"=0.0,Int "FuncMap"=$7F,Int "Matrix"=c.Width>=1100||c.Height>=600?3:2,
            \
            \ Float "MinTh"=Thresh, Float "MaxTh"=Thresh,Float "MnMx_MinTh"=Thresh,Float "MnMx_MaxTh"=Thresh,
            \ Int "Lo"=128,Int "Hi"=255,Int "CMad"=1,
            \
            \ Float "MinTh2"=Thresh,Float "MaxTh2"=Thresh,Float "MnMx_MinTh2"=Thresh,Float "MnMx_MaxTh2"=Thresh,
            \ Int "Lo2"=lo,Int "Hi2"=hi, Int "CMad2"=CMad,
            \
            \ Bool "Zebroid"=False,Float "zThresh"=Thresh),
            \
            \ int "zFuncmap"=$10(AverageLuma,  Float "zMinTh" , Float "zMaxTh" ,Float "zMnMx_MinTh" ,Float "zMnMx_MaxTh" ,
            \ Int "zLo"=128 ,Int "zhi"=255 ,Int "zCMad"=1,
            \
            \ int "zFuncmap2"=zFuncMap, Float "zMinTh2"=zThresh, Float "zMaxTh2"=zThresh,Float "zMnMx_MinTh2"=zThresh,Float "zMnMx_MaxTh2"=zThresh,
            \ Int "zLo2"=zlo,Int "zhi2"=zhi,Int "zCMad2"=zCMad,
            \
            \ Bool "SubsI"=True,Bool "SubsO"=SubsI

        Shows Zebra Bands for clip c.
            Zebra bands selectable via FuncMap bit map(default $7F ie all), where each set bit selects a Zebra band
                       (Where the min/max thresholds default to Thresh).
                Bit 0, ($01), YPlaneMin(Threshold=MinTh)
                Bit 1, ($02), YPlaneMax(Threshold=MaxTh)
                Bit 2, ($04), YPlaneMinMaxDifference(MnMx_MinTh, MnMx_MaxTh)    # MinMaxDif band has individually selectable thresholds
                Bit 3, ($08), YPlaneMedian
                Bit 4, ($10), AverageLuma
                Bit 5, ($20), YInRange(lo=Lo,hi=Hi)
                Bit 6, ($40), YPlaneStdev
            All Bands are $7F, dec 127.

        Thresh,      Default 0.0, is group default setting for the minimum and maximum thresholds.
        FuncMap,     Default $7F, dec 127, ie all bands selected. (0=none selected).
        Matrix,      Default (Width>=1100||Height>=600?3:2                   # 3=PC.709, 2=PC.601 (0=rec.601, 1=rec.709)
                     Matrix for RGB->Luma Y conversion.

                     Row=True, Args:
        MinTh,       Default Thresh. Threshold for YPlaneMin band.
        MaxTh,       Default Thresh. Threshold for YPlaneMax band.
        MnMx_MinTh,  Default Thresh. Threshold for YPlaneMinMaxDifference(Minimum threshold), individually selectable threshold.
        MnMx_MaxTh,  Default Thresh. Threshold for YPlaneMinMaxDifference(Maximum threshold), individually selectable threshold.
        lo,hi,       Defaults Lo=128, hi=255. YInRange(lo=lo,hi=hi) band. YInRange shows population between lo and hi (where white=100%).
        CMad,        Default 1, Off. Centered Moving Average Diameter. (1->100). Vertical smoothing of bands when Row=True.

                     Row=False, Args (default to same as Row=True args):
        MinTh2,      Default MinTh. Threshold for YPlaneMin band.
        MaxTh2,      Default MaxTh. Threshold for YPlaneMax band.
        MnMx_MinTh2, Default MnMx_MinTh. Threshold for YPlaneMinMaxDifference(Minimum threshold), individually selectable threshold.
        MnMx_MaxTh2, Default MnMx_MaxTh. Threshold for YPlaneMinMaxDifference(Maximum threshold), individually selectable threshold.
        lo2,hi2,     Defaults Lo2=lo, hi2=hi. YInRange(Lo2,hi2) band. YInRange shows population between lo2 and hi2 (where white=100%).
        CMad2,       Default CMad. Centered Moving Average Diameter. (1->100). Horizontal smoothing of bands when Row=false.


        Zebroid,    Default False, OFF.
        zXXX args,  As For above args but only if Zebroid=True, and applied to incoming Zebroid'ed clip before Zebra bands created.
                      In addition to the normal Zebra() functionality provided in ZebraTest script, this effort allows selection of
                    Zebroid functionality (when Zebroid bool = true, where the 'z...' args become relevant).
                    If True, Zebroid is applied to the incoming clip, then the Zebra bands are created using the Zebroid result as source.
                    q) Whats its purpose ?, a) Dont know, just experiment.

                    zThresh,      Default 0.0, is group default setting for the minimum and maximum threshold for zxxx args.

                    Zebroid Row Args, As for Zebra Row=True.
                    zFuncMap,     Default $10(AverageLuma)

                    zMinTh,       Default zThresh. Threshold as for Row=true, zFunc = 0(YPlaneMin).
                    zMaxTh,       Default zThresh. Threshold as for Row=true, zFunc = 1(YPlaneMax).
                    zMnMx_MinTh,  Default zThresh. Threshold as for Row=true, zFunc = 2(YPlaneMinMaxDifference(Minimum threshold).
                    zMnMx_MaxTh,  Default zThresh. Threshold as for Row=true, zFunc = 2(YPlaneMinMaxDifference(Maximum threshold).
                    zlo,zhi,      Defaults zLo=128, zhi=255. As for zFunc=5, YInRange(zLo,zhi).
                    zCMad,        Default 1, Off. Centered Moving Average Diameter. (1->100). Vertical smoothing.

                    Zebroid Column Args, As for Zebroid Row=True.
                    zFuncMap2,    Default zFuncMap.
                    zMinTh2,      Default zMinTh. Threshold as for Row=true, zFunc2 = 0(YPlaneMin).
                    zMaxTh2,      Default zMaxTh. Threshold as for Row=true, zFunc2 = 1(YPlaneMax).
                    zMnMx_MinTh2, Default zMnMx_MinTh. Threshold as for Row=true, zFunc2 = 2(YPlaneMinMaxDifference(Minimum threshold).
                    zMnMx_MaxTh2, Default zMnMx_MaxTh. Threshold as for Row=true, zFunc2 = 2(YPlaneMinMaxDifference(Maximum threshold).
                    zlo2,zhi2,    Defaults zLo2=zlo, zhi2=zhi. As for zFunc2, YInRange(zLo2,zhi2).
                    zCMad2,       Default zCMad. Centered Moving Average Diameter. (1->100). Horizontal smoothing.

        SubsI,      Default True, If True, show subtitles on inner  clip (source or Zebroid).    # EDIT: Was (source of Zebroid)
        SubsO,      Default SubI, If True, show subtitles on outter clips, Zebra bands if selected.
*/
    myName="EQuid: "    c    PIX=48
    ######
    # Zebra Args (defaults for both ROW and COLUMN)
    FuncMap      = Default(FuncMap,$7F)              Thresh      = Default(Thresh,0.0)
    Matrix=Default(Matrix,Width>=1100||Height>=600?3:2)          # Default PC Levels 3=PC.709, 2=Rec.601
    MinTh        = Default(MinTh,Thresh)             MaxTh       = Default(MaxTh,Thresh)
    MnMx_MinTh   = Default(MnMx_MinTh,Thresh)        MnMx_MaxTh  = Default(MnMx_MaxTh,Thresh)
    Lo           = Default(Lo,128)                   Hi          = Default(Hi,255)
    CMad         = Default(CMad,1)
    # Zebra Args COLUMN (default as for ROW)
    MinTh2       = Default(MinTh2,MinTh)             MaxTh2      = Default(MaxTh2,MaxTh)
    MnMx_MinTh2  = Default(MnMx_MinTh2,MnMx_MinTh)   MnMx_MaxTh2 = Default(MnMx_MaxTh2,MnMx_MaxTh)
    Lo2          = Default(Lo2,lo)                   Hi2         = Default(Hi2,Hi)
    CMad2        = Default(CMad2,CMad)
    ### Zebroid Args (defaults for both ROW and COLUMN)
    Zebroid      = Default(Zebroid,false)            zThresh     = Default(zThresh,Thresh)
    #
    zFuncMap     = Default(zFuncMap,$10)                          # AverageLuma
    zMinTh       = Default(zMinTh,zThresh)           zMaxTh      = Default(zMaxTh,zThresh)
    zMnMx_MinTh  = Default(zMnMx_MinTh,zThresh)      zMnMx_MaxTh = Default(zMnMx_MaxTh,zThresh)
    zLo          = Default(zLo,128)                  zHi         = Default(zHi,255)
    zCMad        = Default(zCMad,1)
    # Zebroid Args COLUMN (default as for Zebroid ROW)
    zFuncMap2    = Default(zFuncMap2,zFuncMap)
    zMinTh2      = Default(zMinTh2,zMinTh)           zMaxTh2     = Default(zMaxTh2,zMaxTh)
    zMnMx_MinTh2 = Default(zMnMx_MinTh2,zMnMx_MinTh) zMnMx_MaxTh2= Default(zMnMx_MaxTh2,zMnMx_MaxTh)
    zLo2         = Default(zLo2,zLo)                 zHi2        = Default(zHi2,zHi)
    zCMad2       = Default(zCMad2,zCMad)
    ### Common args
    SubsI        = Default(SubsI,True)               SubsO       = Default(SubsO,SubsI)
    Zebroid?Assert(1 <= zFuncMap  <= $7F,RT_String("%s1 <= zFuncMap  <= $7F(%d)",myName,zFuncMap))  : NOP
    Zebroid?Assert(1 <= zFuncMAp2 <= $7F,RT_String("%s1 <= zFuncMap2 <= $7F(%d)",myName,zFuncMap2)) : NOP
    ###### If Zebroid, then Proc Zebroid on incomimng clip.
    (Zebroid) ? Zebroid(Threshold=zThresh,matrix=Matrix,
            \ lo =zLo ,hi=zHi  ,cmad=zCMad  ,MinTh=zMinTh  ,Maxth=zMaxTh  ,MnMx_MinTh=zMnMx_MinTh  ,MnMx_MaxTh=zMnMx_MaxTh,FuncMap=zFuncMap,
            \ lo2=zLo2,hi2=zHi2,cmad2=zCMad2,MinTh2=zMinTh2,Maxth2=zMaxTh2,MnMx_MinTh2=zMnMx_MinTh2,MnMx_MaxTh2=zMnMx_MaxTh2,FuncMap2=zFuncMap2)
            \ : NOP
    S2=(SubsI&&Zebroid) ? RT_String("\nzMinTh=%.2f zMaxTh=%.2f\nzMnMx_MinTh=%.2f zMnMx_MaxTh=%.2f\nzLo=%d zHi=%d zCMad=%d zFuncMap=$%X\n",
                             \ zMinth,zMaxTh,zMnMx_MinTh,zMnMx_MaxTh,zLo,zHi,zCMad,zFuncMap)  : ""
    S2=S2+ ((SubsI&&Zebroid&&(zMinTh!=zMinth2||zMaxTh!=zMaxTh2||zMnMx_MinTh!=zMnMx_MinTh2||zMnMx_MaxTh!=zMnMx_MaxTh2))
           \ ? RT_String("zMinTh2=%.2f zMaxTh2=%.2f\nzMnMx_MinTh2=%.2f zMnMx_MaxTh2=%.2f\n",zMinth2,zMaxTh2,zMnMx_MinTh2,zMnMx_MaxTh2) : "")
    S2=S2+ ((SubsI&&Zebroid&&(zlo!=zLo2||zhi!=zhi2||zCMad!=zCMad2||zFuncMap!=zFuncMap2))
           \ ? RT_String("zLo2=%d zHi2=%d zCMad2=%d zFuncMap2=$%2X",zLo2,zHi2,zCMad2,zFuncMap2) : "")
    ###### If (BandCnt>0) then Proc Zebra
    BandCnt = RT_BitSetCount(FuncMap)
    RowC=(BandCnt==0)?0:Last.Zebra(threshold=Thresh,matrix=Matrix,row=TRUE,
            \ lo=Lo, hi=Hi, cmad=CMad, pix=PIX,minTh=MinTh, maxth=MaxTh, MnMx_MinTh=MnMx_MinTh, MnMx_MaxTh=MnMx_MaxTh, funcMap=FuncMap)
    ColC=(BandCnt==0)?0:Last.Zebra(threshold=Thresh,matrix=Matrix,row=FALSE,
            \ lo=Lo2,hi=Hi2,cmad=CMad2,pix=PIX,minTh=MinTh2,maxth=MaxTh2,MnMx_MinTh=MnMx_MinTh2,MnMx_MaxTh=MnMx_MaxTh2,funcMap=FuncMap)
    RowC=(BandCnt!=0&&SubsO)?RowC.SUBTITLE("Row\nTrue",Align=5,lsp=0):RowC
    ColC=(BandCnt!=0&&SubsO)?ColC.SUBTITLE("Row False",y=(ColC.Height+12)/2.0,Align=5):ColC
    S1=(SubsI&&BandCnt>0) ? RT_String("FuncMap=$%2X\nMinTh=%.2f MaxTh=%.2f\nMnMx_MinTh=%.2f MnMx_MaxTh=%.2f\nLo=%d Hi=%d CMad=%d\n",
           \    FuncMap,Minth,MaxTh,MnMx_MinTh,MnMx_MaxTh,Lo,Hi,CMad) : ""
    S1=S1+ ((SubsI&&BandCnt>0&&(MinTh!=Minth2||MaxTh!=MaxTh2||MnMx_MinTh!=MnMx_MinTh2||MnMx_MaxTh!=MnMx_MaxTh2))
           \  ? RT_String("MinTh2=%.2f MaxTh2=%.2f\nMnMx_MinTh2=%.2f MnMx_MaxTh2=%.2f\n",Minth2,MaxTh2,MnMx_MinTh2,MnMx_MaxTh2) : "")
    S1=S1+ ( (SubsI&&BandCnt>0&&(lo!=Lo2||hi!=hi2||CMad!=CMad2))? RT_String("Lo2=%d Hi2=%d CMad2=%d\n",Lo2,Hi2,CMad2): "")
    S=S1+S2   Lines=RT_TxtQueryLines(S)       Y=(Height-Lines*18) / 2   S=S.RT_StrReplace(Chr(10),"\n")
    (SubsI) ? SubTitle(S,Align=5,Y=Y,lsp=0) : NOP           # Subtitle center Src or Zebroid'ed clip.
    Function BandSub(clip c,int FuncMap,Int BandCnt) {
        c  myName="EQuid::BandSub: "
        IsAvsPlus=(FindStr(UCase(versionString),"AVISYNTH+")!=0) HasGScript=RT_FunctionExist("GScript")
        Assert(IsAvsPlus || HasGScript,RT_String("%sNeed Avs+ or GScript",myName))
        GS="""
            off=0 PixX=Width.Float/BandCnt PixY=Height.Float/BandCnt
            for(i=0,6) {
                if(RT_BitTst(FuncMap,i)) {
                    Fnam=Select(i,"Min","Max","Mx-Mn","Med","Ave","Yir","Std")
                    len=StrLen(Fnam)    x=(Off+0.5)*PixX-(4.5*Len) y=(Off+0.5)*PixY-11
                    SUBTITLE(fnam,x=x,y=y)
                    off = off + 1
                }
            }
        """
        HasGScript?GScript(GS) : Eval(GS)
        Return Last
    }
    BLANK=(ColC.IsClip)?ColC.BlankClip(width=RowC.Width,color=$808080):0
    Blank=(Blank.IsClip&&SubsO)?Blank.BandSub(FuncMap,BandCnt):Blank
    Return (Blank.IsClip)?StackVertical(StackHorizontal(RowC),StackHorizontal(ColC,BLANK)):Last
}

/* Client Script
AVISource("D:\Greymouse.avi")
Crop(12,12,-12,-12)
Crop(0,0,Width/4*4,Height/4*4)
#ConvertToYV12
#ConvertToYUY2
#ConvertToRGB24
#ConvertToRGB32
#ConvertToY8
#ConvertToYV16
#ConvertToYV24
#ConvertToYV411
ORG=Last

FuncMap=$7F
CMad=1
Cmad2=Cmad
Thresh=1.0
Lo=128
Hi=255
Zebroid=True
ZFuncMap=$10
zLo=128
zHi=255

return Equid(funcmap=Funcmap,thresh=Thresh,lo=lo,hi=hi,CMad=CMad,CMad2=CMad2,Zebroid=Zebroid,zFuncMap=ZFuncMap, zlo=Lo,zhi=Hi)
*/
__________________
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; 19th September 2018 at 09:14.
StainlessS is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.