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. |
|
|
#502 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Dont know what to make of your graphs. Seems to be sharing AVS work between several cores.
Am curious as to whether you get same via VDub2.
__________________
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 ??? |
|
|
|
|
|
#504 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Maybe not a good idea to be running other apps when you wanna measure CPU usage of a single app.
(is some kind of server computer ?)
__________________
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 ??? |
|
|
|
|
|
#507 | Link |
|
Registered User
Join Date: Jun 2022
Posts: 295
|
Technical question about RT_FrameMovement
How does it measure the difference between two frames? Assuming for simplicity that we have a 2x2 block (and only luma), then the measured total difference for the block: 1 -1 -1 1 (this is the difference between luma in both frames) will be 4 (sum of absolute differences)? And for the block: 0 0 0 4 also 4? |
|
|
|
|
|
#508 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Code:
RT_FrameMovement(clip c,clip c2,int "n"=current_frame,int "n2"=current_frame,Float "ChromaWeight"=1.0/3.0,
int "x"=0,int "y"=0,int "w"=0,int "h"=0,int "x2"=x,int "y2"=y,
bool "AltScan"=false,Bool "ChromaI"=False,int "Matrix"=(c.Width>1100||c.Height>600||c2.Width>1100||c2.Height>600?3:2),
int "BlkW"=64,int "BlkH"=BlkW, Int "OLapX"=BlkW/2, Int "OLapY"=BlkH/2,Float "BlkTh"=1.0,String "Prefix"="")
Returns FLOAT value (0.0 -> 255.0) movement detection between clip c frame n area x,y,w,h, and clip c2 frame n2 area x2,y2,w,h.
The frames are sectioned into blocks of BlkW x BlkH with block overlaps of OLapX and OLapY, and all blocks are differenced, the result
is the greatest difference for any one block comparison.
Is more sensitive to localized movement. Best control of localized movement sensitivity is by changing blk size, lower is more sensitive.
If Altscan is true, then only every other horizontal scanline in BLKH will be scanned.
Args:-
c, c2, comparison clips, usually the same clip.
n, default current_frame, frame from clip c.
n2, default current_frame, frame from clip c2.
ChromaWeight, default 1.0/3.0. Range 0.0 -> 1.0.
Difference method control when comparing blocks.
Y8, returns same as RT_LumaDifference. ChromaWeight ignored.
YUV,
Weighting applied YUV chroma:- (1.0 - ChromaWeight) * Lumadif + ChromaWeight * ((Udif + Vdif)/2.0).
RGB,
If ChromaWeight > 0.0, then returns same as RT_RGBDifference() [average RGB pixel channel difference].
If ChromaWeight == 0.0, then returns same as RT_LumaDifference() using Matrix arg to convert RGB to YUV-Y Luma.
x,y,w,h, all default 0 (full frame c).
x2,y2. x2 defaults x, y2 defaults y, for clip c2.
Altscan, default false. If true then scan only every other scanline starting at clip c y coord, and clip c2 y2 coord.
ChromaI, default false. If YV12 and ChromaI, then do YV12 interlaced chroma scanning.
Ignored if not YV12. Both YV12 clips must be same, cannot difference one that is progressive and one that has interlaced chroma.
Matrix, default (c.Width>1100||c.Height>600||c2.Width>1100||c2.Height>600)?3:2
Conversion matrix for conversion of RGB to YUV-Y Luma. 0=REC601 : 1=REC709 : 2 = PC601 : 3 = PC709.
Default = (c.Width > 1100 OR c.Height>600 OR c2.Width > 1100 OR c2.Height>600) then 3(PC709) else 2(PC601). YUV not used
Matrix only Used if RGB and ChromaWeight == 0.0, where returns same as RT_LumaDifference().
BlkW, default 64, Block size. Minimum 8 (silently limited to frame dimensions), Must be EVEN.
BlkH, default BlkW, Block size. Minimum 8 (silently limited to frame dimensions), Must be EVEN.
OlapX, default BlkW/2, Horizontal block overlap. 0 -> BlkW/2
OlapY, default BlkH/2, Vertical block overlap. 0 -> BlkH/2
BlkTh, default 1.0. Governs extra information returned when Prefix != "", as local variables.
Prefix, default "" is do not set additional local variables.
If set eg "FM_", then sets local variables as below.
"FM_Xoff" = X Coord of block in Clip c that was greatest.
"FM_Yoff" = Y Coord of block in Clip c that was greatest.
"FM_PercAboveTh" = Percentage of Blocks that were above BlkTh.
"FM_BlkAveDf" = Average Block difference.
"FM_nAboveTh" = Number of Blocks that were above BlkTh.
"FM_TotalBlks" = Total Number of Blocks.
NOTE, 'x2' and 'y2' default to 'x' and 'y' respectively.
c and c2 need not be same dimensions but BEWARE, x2 and y2 default to x and y also w and h default to 0
which is converted to c.width-x and c.height-y, may be best to provide x2, y2, w and h where c2 not same dimensions as c.
As for both your examples except divided by the number of pixels in block, so in both your instances result is 1.0. Sum Of Absolute Difference / nPixels, ie SAD / (w * h). [EDIT: SAD / (Blkw * Blkh), or if AltScan=true ie skip every other scanline then SAD / (Blkw * (Blkh/2))] I've used RT_FrameMovement in script functions, CensorSwap :- https://forum.doom9.org/showthread.p...58#post1935658 SecurityCamExtractMotion.AVS :- From RT_Stats AVS directory Duplicity2 :- https://forum.doom9.org/showthread.p...ght=duplicity2 Where in eg Duplcity2(), we use 3 simutaneous detectors, RT_FrameDifference: Frame Global differencing. [whole frame] # below, more local differencing RT_FrameMovement: Block differencing (block of greatest difference in entire frame). RT_LumaPixelsDifferent: Big single pixel difference. EDIT: NOTE, RT_Stats is still 8 bit only. [EDIT: However, note!, you dont need eg 10 bit to detect dupes, 8 is quite sufficient but may make script a bit more complicookered ]
__________________
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; 1st June 2025 at 16:40. |
|
|
|
|
|
#509 | Link |
|
Registered User
Join Date: Jun 2022
Posts: 295
|
Yes, I read the manual, I was looking for information about the calculation method.
I'm currently experiencing the disadvantages of this method. For example: - 256px differing by 1 each = RT_FrameMov will return 1, - 254 identical pixels, and two differing by 128 will also return 1. The first example is typical for compressed videos and is imperceptible on the screen, while the second one rather shows movement in a block and is easy to see on the screen. Of course, these are just quick extreme examples, but I see a problem here. I think that the bigger the difference, the bigger the "point penalty" can be applied, i.e. difference 1 is 1 point, difference 2 is 4 points, difference 3 is 9 points, etc. (Edit: using dfttest on the source clip reduces the problem, but slows down the whole operation a lot) |
|
|
|
|
|
#510 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
That is the very reason that I use 3 detectors in Duplicity2.
Sounds like you wanna experiment with both of these, Code:
# below, more local differencing RT_FrameMovement: Block differencing (block of greatest difference in entire frame). RT_LumaPixelsDifferent: Big single pixel difference. Code:
RT_LumaPixelsDifferent(clip c,clip c2,int "n"=current_frame,int "delta"=0,int "x"=0,int "y"=0,int "w"=0,int "h"=0, \
int "n2"=current_frame,int "delta2"=0,int "x2"=x,int"y2"=y,bool "interlaced"=false, \
int "matrix"=(Width>1100||Height>600?3:2),int "Thresh"=0)
Compares clip c frame (n+delta) at x,y,w,h, and clip c2 frame (n2+delta2) at x2,y2,w,h, and returns amount of pixels
whose pixel luma difference is greater than Thresh (RGB converted to Luma-Y using Matrix).
Matrix 0=Rec601, 1=Rec709, 2=PC601, 3=PC709.
If Interlaced=True, then skips every other raster line, eg process only y, y+2, y+4 etc.
Thresh Default 0, returns number of pixels that are not exactly the same.
Return value is in range 0.0 (meaning none) to 255.0 meaning 100% of pixels.
v2.0, c and c2 need not be same dimensions but BEWARE, x2 and y2 default to x and y also w and h default to 0
which is converted to c.width-x and c.height-y, may be best to provide x2, y2, w and h where c2 not same dimensions as c.
Code:
/*
Duplicity2(), v2.13, by StainlessS @ Doom9:- https://forum.doom9.org/showthread.php?t=175357
A two faced scheming and double dealing [on your behalf] dupe tool.
Three modes of operation,
0) Write duplicate Frames file only (as single frames or ranges).
1) Replace duplicates with exact duplicates. (Can also write Frames file).
2) Replace duplicates with Interpolated or Blended frames (control via MaxDuplen and MaxInterp). (Can also write Frames file).
Req:-
RT_Stats v2.00_Beta_11 + CallCmd (c) StainlessS,
GSCript, Grunt, (c) Gavino,
MaskTools2, MvTools2, (c) Manoa/Fizick/Pinterf & Others (Pinterf Versions).
RemoveGrain, (c) Kassandro.
GScript not needed if Avs+ [(c) Ultim, Pinterf and others.].
If CallCmd available then will AutoDelete DBase on clip closure, otherwise requires manual deletion.
ColorSpace:- All v2.6 standard PLANAR colorspaces except YV411, no support for YUY2, RGB24 or RGB32.
Function Duplicity2(clip c,"Mode"=0,Float "ThG"=1.0,Float "ThB"=ThG*2.0, Int "ThP"=64,Float "IgP"=0.0,Int "ThK"=7,
\ Int "MaxDupLen"=9,Int "LagMax"=MaxDupLen,Int "MaxInterp"=Min(9,MaxDupLen),
\ int "BlkW"=64,int "BlkH"=BlkW,int "OLapX"=BlkW/2,Int "OLapY=BlkH/2",
\ Int "X"=0,Int "Y"=0,Int"W"=0,Int "H"=0,Float "CW"=0.0,Bool "ChromaI"=False,Bool "AltScan"=False,
\ Int "SPad"=16, Int "SSharp"=1, Int "SRFilter"=4, [* MSuper *]
\ Int "ABlkSize"=16, Int "AOverlap"=4, Int "ASearch"=3,Int "ADct"=0, [* MAnalyse *]
\ Int "RBlkSize"=8, Int "ROverlap"=2, Int "RthSAD"=100, [* MRecalculate *]
\ Float "Iml"=200.0, Bool "IBlend"=True, Int "IthSCD1"=400, Int "IthSCD2"=130, [* MFlowInter *]
\ Int "OthSCD1"=400,Int "OthSCD2"=130, [* Dupe Detect Override @ Scene Change *]
\ String "OverRide"="",String "Frames"="Frames.txt",Bool "Ranges"=True,Bool "FrameAsRange"=False,
\ Bool "Show"=True,Bool "Verb"=True,Bool "ShowBlk"=True,Bool "Dim"=True,Bool "ShowDot"=False,
\ Bool "InterpFast"=True,String "DBase"=""
\ )
Duplicity2() uses 3 RT_Stats measurement functions, RT_FrameDifference(), RT_FrameMovement(), and RT_LumaPixelsDifferent().
the first two may difference using either luma only, or with a combined weighted chroma difference. Also see CW,
and ChromaI args. RT_LumaPixelsDifferent() differences luma only.
DeDuppers use some method to determine if a frame is a duplicate of its predecessor, a typical measuring method might be
RT_FrameDifference (average absolute difference per pixel), unfortunately the result of such measure may be due to a small
frame global change (lots and lots of pixels change by a small amount), or a smaller number of pixels change by a
larger amount, both these cases could produce the exact same result. Another case may be that of a very small number of
pixels change by a very large amount (eg a person blinks an eye with remainder of frame static) and such measure might seem
to be a duplicate as it could produce much smaller numbers than a frame global change of a small amount.
Duplicity2() uses a triple measurement system (maybe it should be called Triplicity), Primary measurement (RT_FrameDifference)
to detect frames 'Unique' to their immediate predecessor (large or 'frame Global' changes), and second and third methods to
determine if 'Non-Unique' frames are either 'Low Motion' or 'Duplicate' frames. The second method is a block differencing
method (RT_FrameMovement) where it splits the frame up into BlkW by BlkH blocks and finds the maximum average pixel difference
of any one block. The third measurement method is RT_LumaPixelsDifferent (result 0.0->255.0 where 255.0 is equivalent to 100.0%,
user args for this method actually require Duplicity2 arg 'IgP' in range 0.0->100.0%, and also show results in range 0->100.0%).
RT_LumaPixelsDifferent, compares frames and shows percent of pixels whose corresponding absolute luma pixel difference is
greater than Int arg 'ThP', if this percent difference is greater than 'IgP', then it is deemed to be a 'Low motion' frame and if
less or equal to 'IgP' then is a duplicate ('IgP' can be 0.0, meaning any pixels at all with difference greater than 'ThP' is a
'Low Motion' Frame). Where both 'ThP' and 'IgP' are 0 and 0.0 respectively, will show percentage of pixels that are not Exactly the same.
'IgP' could be set to 0.0 (Default) in which case the function is governed solely by any pixel differences exceeding 'ThP', or can set
'IgP'= eg 0.001% meaning the it will disregard as noise 1 pixel difference exceeding 'ThP' in every 100,000 pixels
[eg 1 pixel in every 316x316 region]. It is probably easiest to always use IgP of 0.0 and only adjust ThP.
The function examines the DBase to determine if status for current frame is already known, if not already known then,
the function determines if the current frame is a 'Unique' frame or not (via 'ThG' RT_FrameDifference to predecessor), if Unique,
then the job is done and is considered a Non-Duplicate, these Unique frames are marked in a DBase as Unique. If a frame is
'Non-Unique', then the function scans both backwards and forwards looking for 'Unique Start' and 'Unique End' frames (and if
necessary, marking them in DBase). This Backwards/Forwards scanning permits jumping around in the clip for perusal and getting
exact same results as if travelling forwards only (even backwards traversal only, should work just fine). When the
'Unique Start' and 'Unique End' frames are established, we then know the extent of the unknown (unvisited) frames, and can scan
and measure those with the second and third measurement methods (RT_FrameMovement and RT_LumaPixelsDifferent) to determine
Low Motion/Dupe status. When determining Low Motion/Dupe status, we compare with an 'Anchor Frame', which at the beginning of a
'Non-Unique' sequence is the 'Unique Start' frame. When scanning a non-unique sequence the 'Anchor Frame' is the predecessor frame
to the very first frame in the current sub sequence of the 'Non-Unique' sequence, so potential duplicates are not necessarily
compared with their immediate predecessor. When a frame is determined to be 'Low Motion' (not a dupe), any detected duplicates are
written to the DBase and also to the output Frames file, and it switches to detecting sequences of 'Low Motion' frames within the
'Non-Unique' sequence. On each detected 'Low Motion' frame, the Anchor frame for the next frame (whether it be another
'Low Motion' frame or a new 'Dupe' frame) will be switched to that newly detected 'Low Motion' frame. With this method,
all frames BETWEEN (but excluding) the 'Unique Start' and 'Unique End' in the 'Non-Unique' sequence are detected as perhaps
multiple 'Low Motion' and 'Duplicate' sub sequences.
Setting LagMax arg to some low number (min 1), will limit distance of the Anchor frame prior to the current frame, eg setting
LagMax=1, would always do LoMo/Dupe compare with the current frame and its predecessor. A LagMax greater than 1 allows better detection
of Low-Motion frames where there is only very slow creeping movement in the sequence.
The above method allows for reasonably fast processing, where a 'unique' frame is encountered [where it is clearly different from
its predecessor] but where not so clear, will examine the LoMo/dupe suspect frames more closely. ThG sets the boundary between
'Unique' frames and non unique, and so has some effect on speed, setting too high for your source will slow processing speed as many
non dupes will be examined more closely, and setting ThG too low for your source, may increase speed but may miss duplicates in noisy
sources (probably better to set too high than too low).
Although you might be able to scan backwards and get same detections, results are written to the Frames file in visited sequence and
you should NOT jump about whilst writing the final frames file. Also, this is a Multi-Instance script, can use multiple instances
at the same time (view side by side metrics) but you should really choose a unique 'Frames' filename for each instance.
Args:-
Mode, Default 0, (Range 0->2)
0) Write Frames file only (where Frames file="" then not written so only Show=true does anything).
1) Make duplicate sequences Exact Dupes.
2) Interpolate/Blend Duplicates (depends upon MaxDupLen and MaxInterp).
ThG, Default 1.0 (0.0 < ThG <= 255.0) Suggest 1.0, never below 0.5.
Primary Global Unique detect threshold. [current_frame-1 <-> current_frame].
If using 255.0 will likely scan all of the way to both Start and End frames, and then
detect LoMo/Dupe frames of entire clip using the 2nd & 3rd detection methods, will seem to pause for a long time,
dont do it (no error if using daft numbers).
ThB, Default Float ThG * 2.0, (Range ThG <= ThB < 255.0, Suggested about 1.5->3.5).
Secondary Local LoMo/Dupe Block detect threshold, [Anchor<->current_frame]
Tune for source and Block Size. (For smaller block size, just by random chance there may be several noisy pixels
in duplicate frame block, that produce considerably higher metric than most other blocks).
ThP, Default Int 64. (Advised Range ThB < ThP <= 64, or 255=OFF)
Ternary Local [single pixel] LoMo/Dupe detect threshold, [Anchor<->current_frame].
On a test with 256 artificial generated 640x480 identical frames of random coloured pixels, encoded at
MeGUI AVC CRF 23.0(default), RT_LumaPixelsDifferent(Thresh=1) found no frames where any single pixel was
different by more than 1 luma level when compared with the first encoded frame from that sequence. Mpeg2
and flv might not fare as well. This test was on a totally clean artificial source without artefacts
and such, you will likely need considerably higher values of ThP than 1.
I have seen multiple clips exhibiting some kind of minute (perhaps sub pixel) frame shift (both horizontal and
vertical) where frame should have been an exact duplicate, no idea to the cause.
This setting is an additional knob to twiddle, and you could turn it off and rely on ThG and ThB
completely [ThP=255, turns off]. The default of 64 and the below setting IgP=0.0, will consider any single pixel
with a luma difference of 64 or more, to be a non dupe, unfortunately any clip having above mentioned sub pixel
shifting at dupe frames, may need a high setting to not trigger a lomo detection, I have not I think
seen so far any clip that needed ThP more than about 48. 64 might seem ridiculously high but if frames are shifted,
then a little preposterous-ness is likely necessary, in a true non-dupe, there will most usually be at least
one pixel that differs in luma by more than 64.
We have thusly decided to make the default an emergency fallback detect value of 64, the user may decide to lower
this value or indeed turn it off completely[ThP=255].
IgP, Default 0.0, (Range 0.0 <= IgP < 100.0). Percent noise threshold for Ternary Local [pixel] LoMo/Dupe Detect,
Note, default 0.0% means that any frame with any single pixel with abs luma difference greater than ThP will
be detected as LoMotion.
ThK, Default = 7, (0 <= ThK <= 255). 0 = K Overrides off.
If RT_YPlaneMinMaxDifference(Threshold=0.2) of current_frame is less ThK then will Override any detection,
ie black (or narrow luma range) frames are ignored as not duplicates.
[Threshold=0.2 ignores as noise, 1 in 500 extreme pixels when establishing loose minimum and loose maximum & luma range].
__________________
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; 1st June 2025 at 17:25. |
|
|
|
|
|
#511 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Suggest RT_LumaPixelsDifferent(Thresh=64) # Detect big single pixel difference.
Would return 0.0 -> 255.0, where 255.0 = 100%, of pixels with absolute difference greater than Thresh. Also note, Code:
RT_LumaPixelsDifferentCount(clip c,clip c2,int "n"=current_frame,int "delta"=0,int "x"=0,int "y"=0,int "w"=0,int "h"=0, \
int "n2"=current_frame,int "delta2"=0,int "x2"=x,int"y2"=y,bool "interlaced"=false, \
int "matrix"=(Width>1100||Height>600?3:2),int "Thresh"=0)
Compares clip c frame (n+delta) at x,y,w,h, and clip c2 frame (n2+delta2) at x2,y2,w,h, and returns number of pixels
whose pixel luma difference is greater than Thresh (RGB converted to Luma-Y using Matrix).
Matrix 0=Rec601, 1=Rec709, 2=PC601, 3=PC709.
If Interlaced=True, then skips every other raster line, eg process only y, y+2, y+4 etc.
Thresh Default 0, returns number of pixels that are not exactly the same.
Note, returns the number of pixels whose difference is greater than Thresh, so ranges 0 -> (Width*Height).
v2.0, c and c2 need not be same dimensions but BEWARE, x2 and y2 default to x and y also w and h default to 0
which is converted to c.width-x and c.height-y, may be best to provide x2, y2, w and h where c2 not same dimensions as c.
EDIT: Sorry for confusing things (I was confused ) But Duplicity2 arg ThP, is used for RT_LumaPixelsDifferent(Thresh=ThP). EDIT: Maybe something like [the differencing calls require additional args] Code:
ThG = 1.0 # (0.0 < ThG <= 255.0)
ThB = 2.0 * ThG # (Range ThG < ThB < 255.0, Suggested about 1.5->3.5)
ThP = 64 # (Advised Range ThB < ThP <= 64)
IsDIf = (RT_FrameDifference() > ThG || RT_FrameMovement(BlkTh=ThB) > ThB || RT_LumaPixelsDifferent(Thresh=ThP) > 0.0)
If(isDif) {
# ...
} else {
# ...
}
__________________
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; 1st June 2025 at 18:28. |
|
|
|
|
|
#513 | Link | |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Sorry, I told you a load of BullSquirt, RT_FrameMovement(BlkTh=ThB) was rubbish/unnecessary.
Code:
RT_FrameMovement(clip c,clip c2,int "n"=current_frame,int "n2"=current_frame,Float "ChromaWeight"=1.0/3.0,
int "x"=0,int "y"=0,int "w"=0,int "h"=0,int "x2"=x,int "y2"=y,
bool "AltScan"=false,Bool "ChromaI"=False,int "Matrix"=(c.Width>1100||c.Height>600||c2.Width>1100||c2.Height>600?3:2),
int "BlkW"=64,int "BlkH"=BlkW, Int "OLapX"=BlkW/2, Int "OLapY"=BlkH/2,Float "BlkTh"=1.0,String "Prefix"="")
Returns FLOAT value (0.0 -> 255.0) movement detection between clip c frame n area x,y,w,h, and clip c2 frame n2 area x2,y2,w,h.
The frames are sectioned into blocks of BlkW x BlkH with block overlaps of OLapX and OLapY, and all blocks are differenced, the result
is the greatest difference for any one block comparison.
Is more sensitive to localized movement. Best control of localized movement sensitivity is by changing blk size, lower is more sensitive.
If Altscan is true, then only every other horizontal scanline in BLKH will be scanned.
Args:-
c, c2, comparison clips, usually the same clip.
n, default current_frame, frame from clip c.
n2, default current_frame, frame from clip c2.
ChromaWeight, default 1.0/3.0. Range 0.0 -> 1.0.
Difference method control when comparing blocks.
Y8, returns same as RT_LumaDifference. ChromaWeight ignored.
YUV,
Weighting applied YUV chroma:- (1.0 - ChromaWeight) * Lumadif + ChromaWeight * ((Udif + Vdif)/2.0).
RGB,
If ChromaWeight > 0.0, then returns same as RT_RGBDifference() [average RGB pixel channel difference].
If ChromaWeight == 0.0, then returns same as RT_LumaDifference() using Matrix arg to convert RGB to YUV-Y Luma.
x,y,w,h, all default 0 (full frame c).
x2,y2. x2 defaults x, y2 defaults y, for clip c2.
Altscan, default false. If true then scan only every other scanline starting at clip c y coord, and clip c2 y2 coord.
ChromaI, default false. If YV12 and ChromaI, then do YV12 interlaced chroma scanning.
Ignored if not YV12. Both YV12 clips must be same, cannot difference one that is progressive and one that has interlaced chroma.
Matrix, default (c.Width>1100||c.Height>600||c2.Width>1100||c2.Height>600)?3:2
Conversion matrix for conversion of RGB to YUV-Y Luma. 0=REC601 : 1=REC709 : 2 = PC601 : 3 = PC709.
Default = (c.Width > 1100 OR c.Height>600 OR c2.Width > 1100 OR c2.Height>600) then 3(PC709) else 2(PC601). YUV not used
Matrix only Used if RGB and ChromaWeight == 0.0, where returns same as RT_LumaDifference().
BlkW, default 64, Block size. Minimum 8 (silently limited to frame dimensions), Must be EVEN.
BlkH, default BlkW, Block size. Minimum 8 (silently limited to frame dimensions), Must be EVEN.
OlapX, default BlkW/2, Horizontal block overlap. 0 -> BlkW/2
OlapY, default BlkH/2, Vertical block overlap. 0 -> BlkH/2
BlkTh, default 1.0. Governs extra information returned when Prefix != "", as local variables.
Prefix, default "" is do not set additional local variables.
If set eg "FM_", then sets local variables as below.
"FM_Xoff" = X Coord of block in Clip c that was greatest.
"FM_Yoff" = Y Coord of block in Clip c that was greatest.
"FM_PercAboveTh" = Percentage of Blocks that were above BlkTh.
"FM_BlkAveDf" = Average Block difference.
"FM_nAboveTh" = Number of Blocks that were above BlkTh.
"FM_TotalBlks" = Total Number of Blocks.
NOTE, 'x2' and 'y2' default to 'x' and 'y' respectively.
c and c2 need not be same dimensions but BEWARE, x2 and y2 default to x and y also w and h default to 0
which is converted to c.width-x and c.height-y, may be best to provide x2, y2, w and h where c2 not same dimensions as c.
It is the greatest difference for any one block comparison. BlkTh, default 1.0. Governs only extra information returned when Prefix != "", as Global variables. So for BlkTh to have any function, Need to set eg Prefix="FM_" (where will set extra Global variables, where var name starts with Prefix, in example case "FM_"). Changes these "FM_" Global variiables. "FM_PercAboveTh" = Percentage of Blocks that were above BlkTh. "FM_nAboveTh" = Number of Blocks that were above BlkTh. So modified script with no BlkTh set for RT_FrameMovement() # Previous script with RT_FrameMovement(BlkTh=ThB) did not really do anything different. Code:
ThG = 1.0
ThB = ThG * 2.0 # (0.0 < ThG <= 255.0)
ThP = 64 # (Advised Range ThB < ThP <= 64) # EDIT: Could try 48, this is really an emergency detect for massive single pixel difference where RT_FrameDifference and RT_FrameMovement both fail detect.
IsDIf = (RT_FrameDifference() > ThG || RT_FrameMovement() > ThB || RT_LumaPixelsDifferent(Thresh=ThP) > 0.0)
If(isDif) {
# ...
} else {
# ...
}
Quote:
We really wanna detect any single block being greater than ThB. [and for RT_LumaPixelsDifferent(Thresh=ThP) any single pixel greater than ThP, return value is pseudo percent 0.0->255.0 of pixels] Below are available if setting Prefix="FM_" and BlkTh "FM_PercAboveTh" = Percentage of Blocks that were above BlkTh. [EDIT: I think this is Pseudo Percent, range 0.0 -> 255.0, use FM_PercAboveTh*100.0/255.0 for actual %] "FM_nAboveTh" = Number of Blocks that were above BlkTh. and others not dependant upon BlkTh "FM_BlkAveDf" = Average Block difference. "FM_TotalBlks" = Total Number of Blocks. [always same, depends upon BlkW, BlkH, OLapX, OLapY] "FM_Xoff" = X Coord of block in Clip c that was greatest. "FM_Yoff" = Y Coord of block in Clip c that was greatest.
__________________
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; 2nd June 2025 at 05:22. |
|
|
|
|
|
|
#514 | Link |
|
Registered User
Join Date: Jun 2022
Posts: 295
|
(about RT_FrameMovement)
Threshold to ignore small pixel difference. For example: ThP (default 0) = ignore pixel difference smaller than ThP. So with ThP=2 block with luma difference: 1 -1 -1 1 RT_FrameMov. will return 0. And with block: 0 0 0 4 will return 4 (converted to average value, i.e. 1). |
|
|
|
|
|
#515 | Link | |||
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Quote:
RT_LumaPixelsDifferentCount(Thresh=ThP) returns COUNT of single pixels with pixel diff GREATER than ThP. So with default ThP=0.0, returns number of pixels that are not EXACTLY the same. RT_LumaPixelsDifferent(Thresh) and RT_LumaPixelsDifferentCount(Thresh) allow for ThP=0 to compare for exactly same, and ThP=255 = switch OFF detection, dont do anything ie return 0 without scan. Quote:
additional vars based on some block thresh can be gotten from eg FM_PercAboveTh and FM_nAboveTh as previously described. (envisaged as being only of use in metrics). EDIT: So maybe something like this where showing/not showing metrics. [NOT TESTED in any way] Code:
ThG = 1.0
ThB = ThG * 2.0 # (0.0 < ThG <= 255.0)
ThP = 64 # (Advised Range ThB < ThP <= 64) # EDIT: Could try 48, this is really an emergency detect for massive single pixel difference where RT_FrameDifference and RT_FrameMovement both fail detect.
Prefix="FM_"
Metrics=TRUE
If (METRICS) { # Short-circuit logic not possible, need all for metrics.
dfG = RT_FrameDifference()
dfB = RT_FrameMovement(Prefix="FM_",BlkTh=ThB)
dfP = RT_LumaPixelsDifferent(Thresh=ThP)
IsDIf = (dfG > ThG || dfB > ThB || dfP > 0.0)
RT_Subtitle("%d] %s\ndfG=%f\ndfB=%f : BlkAveDf=%f : nAboveTh=%f\ndfP=%f\n",n,IsDif,dfG,dfB,FM_BlkAveDf,FM_nAboveTh,dfP)
} Else { # Below short-circuit LOGIC, stops at first test that passes as TRUE
IsDIf = (RT_FrameDifference() > ThG || RT_FrameMovement() > ThB || RT_LumaPixelsDifferent(Thresh=ThP) > 0.0)
}
If(isDif) {
# ...
} else {
# ...
}
Quote:
YPlaneMin(clip [, float threshold = 0, int offset = 0]) # http://avisynth.nl/index.php/Interna...ons#Difference where YPlaneMin(threshold) can ignore a few extreme pixels to get "loose minimum", I dont think that functionality is really of use here, we are trying our best to not ignore anything, and to detect where different, might be suitable (and can do it with) RT_LumaPixelsDifferent(Thresh=ThP) or RT_LumaPixelsDifferentCount(Thresh=ThP), but not good idea on block based measurements where we are only interested in the single block with greatest average difference. EDIT: This from Duplicity2 docs, Code:
ThP, Default Int 64. (Advised Range ThB < ThP <= 64, or 255=OFF)
Ternary Local [single pixel] LoMo/Dupe detect threshold, [Anchor<->current_frame].
On a test with 256 artificial generated 640x480 identical frames of random coloured pixels, encoded at
MeGUI AVC CRF 23.0(default), RT_LumaPixelsDifferent(Thresh=1) found no frames where any single pixel was
different by more than 1 luma level when compared with the first encoded frame from that sequence. Mpeg2
and flv might not fare as well. This test was on a totally clean artificial source without artefacts
and such, you will likely need considerably higher values of ThP than 1.
I have seen multiple clips exhibiting some kind of minute (perhaps sub pixel) frame shift (both horizontal and
vertical) where frame should have been an exact duplicate, no idea to the cause.
This setting is an additional knob to twiddle, and you could turn it off and rely on ThG and ThB
completely [ThP=255, turns off]. The default of 64 and the below setting IgP=0.0, will consider any single pixel
with a luma difference of 64 or more, to be a non dupe, unfortunately any clip having above mentioned sub pixel
shifting at dupe frames, may need a high setting to not trigger a lomo detection, I have not I think
seen so far any clip that needed ThP more than about 48. 64 might seem ridiculously high but if frames are shifted,
then a little preposterous-ness is likely necessary, in a true non-dupe, there will most usually be at least
one pixel that differs in luma by more than 64.
We have thusly decided to make the default an emergency fallback detect value of 64, the user may decide to lower
this value or indeed turn it off completely[ThP=255].
__________________
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; 2nd June 2025 at 16:50. |
|||
|
|
|
|
|
#516 | Link | ||
|
Registered User
Join Date: Jun 2022
Posts: 295
|
Quote:
Quote:
For one set of frames it might give: 50.00 5.00 1.00 50.00 -- where 5.00 and 1.00 are dups and for another it might give: 2.00 0.50 0.50 2.00 -- where 0.50 are dups (Same problem with RT_LumaPixelsDifferent) Return variables won't help here. Generally lacks threshold option for better motion detection with RT_FrameMov. Or block definition with RT_LumaPixelsDifferent. One of the two would improve motion detection. |
||
|
|
|
|
|
#517 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
I doubt it, but I hear you.
__________________
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 ??? |
|
|
|
|
|
#518 | Link |
|
Registered User
Join Date: Jun 2022
Posts: 295
|
I'm testing my clip (48k frames, about 30k duplicates) so I see problems
![]() RT_Frame Mov. captures "noise", small pixel changes in area, but it's not clear whether it's a lot of invisible changes or one big one. RT_LumaPixelsDifferent (with threshold) captures a specific number of changes, but since it's in the whole image, it's not clear whether it's a lot of small changes (but exceeding the threshold) captured throughout the image (i.e. rather noise) or a large change in one area (movement). Last edited by rgr; 2nd June 2025 at 19:58. |
|
|
|
|
|
#519 | Link | ||||
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Quote:
The provided default thresholds for RT_FrameDifference(), RT_FrameMovement(), and RT_LumaPixelsDifferent/Count do work very well, suggest that you do try the provided defaults, but you can lower the ThP pixel thresh (so long as you dont have wierd sub pixel 'shaking video'), but suggest no less than 16, defo no less than 7. EDIT: Quote:
EDIT: I think I did have an arg something like IgP (pixel ignore threshold) in Duplicity2(), it proved less than useless and I dont ever use it, I always compare RT_LumaPixelsDifferent(ThP) > 0. [IgP probably be removed] EDIT: The result of RT_LumaPixelsDifferent(ThP) or RT_LumaPixelsDifferentCount(ThP) could be shown in metrics and help to select good ThP, but the actual detect should only be if > 0. Same with the RT_FrameMovement(Prefix="FM_") style extra global vars, can show in metrics where can asisist in choosing good thresholds for a particular source. (see metrics in following post image, eg nAboveTh). EDIT: Quote:
It works very well, and even can lock on to 'fluctuating movement'. Quote:
__________________
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; 3rd June 2025 at 01:48. |
||||
|
|
|
|
|
#520 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,385
|
Find SecurityCamExtractMotion.AVS v2.02 :- https://www.mediafire.com/file/c6kqo...otion.AVS/file
Looks like this ![]() Or, SecurityCamExtractMotion.AVS [Part 1 of 2] Code:
AVISource("DayCAP2.avi")
Trim(550,31142)
crop(460,200,0,0) # Chop off waving bushes
############################################
# SecurityCamExtractMotion.AVS, v2.02, By StainlessS.
#
# Requires RT_Stats v2.0, FrameSel v1.03, GScript, Grunt, mt_tools_2. [GScript not needed if Avs+]
#
# Clip, Planar, YUY2 or RGB clip, YV411 not supported due to non support in Overlay.
# (RGB, will likely require different thresholds)
#
# MUST SCAN STRAIGHT THROUGH, NO JUMPING ABOUT IN MotDetect.
#
# MotDetect() creates four .txt command files for KEEP frames (movement), DROP frames (not movement), DUPE frames and HOLD frames.
# HOLD frames are combination of all KEEP frames and, DROP frames where block with greatest difference is in close proximity to previous
# KEEP frame block with greatest difference (ie there seems to be possible movement very near previously identified movement).
# Using SelectFrames() you can select frames types of each of the 4 command files, or using the Reject mode of FrameSel, you can
# instead return the frames NOT in the command file, so using the 4 created command files, you can extract 8 variations of frame types
# after a single detection scan.
#
############################################
Th = 6.0 # Greater or equal KEEP (movement), below is DROP(or DUPE, or possibly HOLD).
# Need check against source, block size and almost all other settings.
#
dTH = 4.0 # Below or equal is DUPE, 0.0 <= dTh < Th (above dTh and below Th is DROP [or possibly HOLD]).
#
BLKW = 64 # Suggest about 16 -> 64 (even only, mod 4 else probably slower). Metrics will change with block size.
BLKH = BLKW # Localized movement, adjust for smallest size of moving objects to detect, makes only little difference to speed,
# bigger, may be a bit faster.
# For human target, suggest box encompassing head + shoulders of most distant human.
# RT_FrameMovement returns greatest average pixel difference for any one of the blocks.
# Block searches may be overlapped by up to half a block both horizontally and vertically and so total x,y,w,h area
# of each pair of frames is compared up to about 4 times due to the half block overlaps.
#
X = 16 # Area Of Interest, avoid eg passing traffic or timecode (or could use eg Overlay to blot out stuff for dclip).
Y = 16 # Suggest cut out eg sky unless looking for flying saucers (less to search, faster).
W = -16 # As for Crop. Best MOD 4 only
H = -16
#
CW = 0.0 # ChromaWeight, 0.0->1.0. 0.0 = Luma ONLY, about 0.1 suggested for color (luma ONLY faster for YUV).
# For RGB, Matrix used where CW==0.0 to convert to Luma-Y. If CW != 0.0, then returns average pixel differences,
# (apdR+apdG+apdB)/3.0.
# Perhaps always CW=0.0 [luma only] for YUV night captures.
# Can convert RGB to YUV for Luma-Y detect and SelectFrames() using original RGB, if required.
#
AltScan=false # If True, Scan only every other raster line starting from Y (maybe faster, especially YUV Luma scan only).
#
ChromaI=False # If True, YV12 chroma is interlaced (ignored if not YV12 or if Luma ONLY scan [CW==0.0]).
#
Matrix=(Width>1100||Height>600)?3:2 # Matrix used for RGB conversion to Luma-Y.
# Default, If (Width>1100 || Height>600) then 3(PC.709), else 2(PC.601). (0=Rec.601, 1=Rec.709)
# NOTE, default PClevels conversions will likely require different thresholds to YUV because of the
# greater differences in Y (after RGB-Luma-Y conversion), probably about (255.0/219.0) times greater.
#
OLapX= BlkW/2 # X Block Overlap. 0->BLKW/2 (bigger more accurate, slower)
OLapY= BlkH/2 # Y Block Overlap. 0->BLKH/2
# Where YUV, CW==0.0 and AltScan==True, might try eg OLapY=(BlkH/2)-1, where would be faster due to AltScan and,
# also in overlapped 'Y_Block' scan will then scan alternate scanlines that were not scanned in previous non overlapped
# scan (if that makes any sense, ie even scanlines sampled in first block, odd lines sampled in overlapped block scan).
LAG = 1 # Lag (default 1, ie no lag. 1 or more). Compares current frame n with frame n-Lag. Detection is always
# initially compared(n,n-1), if neither DUPE nor KEEP detected and Lag>1, then will redetect using comparison(n,n-Lag)
# where n-lag frame is limited to no earlier than the most recent KEEP frame.
# A moderate Lag (up to about 50 or so), may be more sensitive to very small amount of movement,
# it introduces a time delay between compared frames. There is no upper limit to Lag arg.
# NOTE, Lag > 1 will likely produce more KEEP and HOLD frames (ie identify more movement), and also a bit slower
# due to 2nd detection scan where initial scan identified DROP frame (ie DROP may be converted to KEEP or HOLD).
# Lag will not make any huge difference to results, small amount of movement at beginning of sequence of movements may be
# detected, use lag > 1 only where every possible movement frame is required.
SHOWDCLIP=false # If True, then shows DClip in MotDetect rather than source clip (Only useful if dclip pre-processed in some fashion)
#
dclip=Last # Detection clip.
# Or some kind of denoise or whatever, used for detection (visible in ShowMetrics if SHOWDCLIp==True).
# Use SPATIAL denoise ONLY.
#dclip=dclip.MaxContrast(Samples=64,Gamma=1.0).VagueDenoiser(threshold=0.8,method=1,nsteps=6,chromaT=0,interlaced=false) # SLOWISH
#dclip=dclip.MaxContrast(Samples=64,Gamma=1.0).hqdn3d(2.0, 0.0,0.0,0.0,0) # A bit FASTER
###
### Show Metrics ONLY
DIM=False # Dim/darken area outside of the x,y,w,h search area. A little faster with Dim==False when showing metrics only.
SHOWMISS =true # Show block 'Marker' for greatest moving DROP block (miss), (markers never shown for dupes).
MISSCOLOR =$AAFF00 # Color, block 'Marker' for greatest DROP block (when SHOWMISS==True).
HITCOLOR =$FFFF44 # Color, block 'Marker' for greatest KEEP block (hit).
HOLDCOLOR =$FF8800 # Color, block 'Marker' for HOLD block (Miss converted to HIT due to Miss proximity to previous Hit).
VERBOSE=True # Show additional metrics, Th, dTh, BLK Args
###
### Frame Extraction ONLY
SHOW =True # Show FrameSel() Info on frame when extracting frames (ie shows '66] Using 12345').
SHOWTIME=True # Show original clip Time on Frame.
#
# # Name of command frames file returned By AutoGetFrames and SelectFrames. (Keep.Txt, Drop.txt, Dupe.txt, Hold.txt)
#ReturnFN="Keep.Txt"
ReturnFN="Hold.Txt"
#ReturnFN="Drop.Txt"
#ReturnFN="Dupe.Txt"
#
REJECT = False # If True, then return frames NOT in RetunFN rather than frames in ReturnFN.
###
##########################################
# Choose 1 of below options:- (uncomment)
##########################################
# Show metrics (Multi-Instance capable) to get best Threshold 'th' (will create valid frames files if playing straight through).
MotDetect(Last,Th,dTH,BLKW,BLKH,X,Y,W,H,CW,AltScan,ChromaI,Matrix,OLapX,OLapY,LAG,dclip,Dim,SHOWMISS,MISSCOLOR,HITCOLOR,HOLDCOLOR,SHOWDCLIP,VERBOSE)
# Make Frames Cmd files for SelectFrames(), Must Play all way through (no metrics shown ie faster).
#MotDetect(Last,Th,dTH,BLKW,BLKH,X,Y,W,H,CW,AltScan,ChromaI,Matrix,OLapX,OLapY,LAG,dclip,Hide=True)
# Make Frames command files and then extract ReturnFN frames (Keep.txt default) automatically in 1 pass (Auto scans entire file before display).
# Fastest possible scanning, faster than eg VDub video analysis pass as no video shown at all during scan, Speed FPS result shown via DebugView.
#AutoGetFrames(Last,Th,dTh,BlkW,BLKH,X,Y,W,H,CW,AltScan,ChromaI,Matrix,OlapX,OlapY,Lag,dclip,show=SHOW,showTime=SHOWTIME,ReturnFN=ReturnFN,Reject=REJECT)
# Return Frames using EXISTING ReturnFN frames Command file (after making ReturnFN using one of above options)
#SelectFrames(Last,ReturnFN,show=SHOW,showTime=SHOWTIME,reject=REJECT)
#AssumeFPS(250.0)
return Last
##########################################
##########################################
##########################################
Function MotDetect(clip c,float th,Float "dth", int "BlkW",int "BlkH",int "X",int "Y",int "W",int "H",
\ Float "CW",Bool "AltScan",Bool "ChromaI",int "Matrix",int "OLapX",int "OLapY",Int "Lag",
\ clip "dclip",bool "dim",Bool "ShowMiss",int "MissColor",int "HitColor",int "HoldCOLOR",bool "ShowDClip",bool "Verbose",
\ String "KeepFN",String "DropFN",String "DupeFN",String "HoldFN",
\ bool "Hide") {
myName="MotDetect: "
IsAvsPlus=(FindStr(UCase(versionString),"AVISYNTH+")!=0) HasGScript=RT_FunctionExist("GScript")
Assert(RT_FunctionExist("GScriptClip"),myName+"Essential GRunT installed, http://forum.doom9.org/showthread.php?t=139337")
Assert(IsAvsPlus||HasGScript,myName+"Essential GScript installed, http://forum.doom9.org/showthread.php?t=147846")
Assert(RT_FunctionExist("RT_FrameMovement"),myName+"Essential RT_Stats v2.0 installed, http://forum.doom9.org/showthread.php?t=165479")
dth=Float(Default(dth,0.001))
BlkW=Default(BlkW,64) BlkH=Default(BlkH,BlkW)
X=default(X,0) Y=default(Y,0) W=default(W,0) H=default(H,0)
CW=Default(CW,1.0/3.0) AltScan=Default(AltScan,false) CI=Default(ChromaI,false)
Lag=Default(Lag,1)
dclip=Default(dclip,c)
ShowMiss=Default(ShowMiss,true) MissColor=Default(MissColor,$AAFF00)
HitColor=Default(HitColor,$FFFF44) HoldColor=Default(HoldColor,$FF8800)
ShowDClip=Default(ShowDClip,false)
Verbose=Default(Verbose,true)
c=(ShowDClip)?dclip:c
Hide=Default(Hide,false)
Dim=(!Hide)?Default(dim,true):False
KeepFN=Default(KeepFN,"Keep.Txt") DropFN=Default(DropFN,"Drop.Txt")
DupeFN=Default(DupeFN,"Dupe.Txt") HoldFN=Default(HoldFN,"Hold.Txt")
c
Matrix=Default(Matrix,Width>1100||Height>600?3:2) OLapX=Default(OLapX,BlkW/2) OLapY=Default(OLapY,BlkH/2)
Assert(CW>=0 && CW<=1.0,RT_String("%s0.0 <= CW <= 1.0",myName))
Assert(Width==dclip.Width&&Height==dclip.Height&&FrameCount==dclip.FrameCount, RT_String("%sDissimilar detection clip",myName))
Assert(dTh>=0.0 && dTh<Th && Th<=255.0,RT_String("%s0.0 <= dTh < Th <= 255.0",myName))
Assert(Lag>=1, RT_String("%sLag Must be 1 or more",myName))
W = (W > 0) ? (W + X) - Width : W H = (H > 0) ? (H + Y) - Height : H # Make -ve relative width,height
X = (X+3) / 4 * 4 Y = (Y+3) / 4 * 4 # Round UP (inwards) Mod 4
W = (W-3) / 4 * 4 H = (H-3) / 4 * 4 # Round DOWN(inwards) Mod 4
W = Width - X + W H = Height - Y + H # +ve width,height
Cropped=Crop(X,Y,W,H) BlkW=Min(Cropped.Width,BlkW) BlkH=Min(Cropped.Height,BlkH)
(Dim && (W!=Width || H!=Height)) ? levels(0,1.0,255,0,128).Overlay(Cropped,x=X,y=Y,opacity=1.0) : Last
(Exist(KeepFN)) ? RT_FileDelete(KeepFN) : NOP
(Exist(DropFN)) ? RT_FileDelete(DropFN) : NOP
(Exist(DupeFN)) ? RT_FileDelete(DupeFN) : NOP
(Exist(HoldFN)) ? RT_FileDelete(HoldFN) : NOP
MissMsk = Hit_Marker(BlkW,BlkH,false)
HitMsk = Hit_Marker(BlkW,BlkH,true)
HoldMsk = Hit_Marker(BlkW,BlkH,true)
MissMrk = MissMsk.BlankClip(Color=MissColor,pixel_type="YV12")
HitMrk = HitMsk.BlankClip(Color=HitColor,pixel_type="YV12")
HoldMrk = HoldMsk.BlankClip(Color=HoldColor,pixel_type="YV12")
OutCS=IsRGB24?"RGB24":IsRGB32?"RGB32":IsYUY2?"YUY2":IsYV12?"YV12":VersionNumber<2.6?"UNK"
\ :IsY8?"Y8":IsYV16?"YV16":IsYV24?"YV24":IsYV411?"YV411":"UNK" # YV411 not actually supported by Overlay output.
Fmt=
\ "%d ] %s{%c} BlkMaxDif=%7.3f\n" +
\ "LAG=%-13d : CompFrm=%d\n" +
\ "KEEP=%-6d %5.2f%% : MinKeep=%.3f\n" +
\ "DROP=%-6d %5.2f%% : MaxDrop=%.3f\n" +
\ "DUPE=%-6d %5.2f%% : MaxDupe=%.3f\n" +
\ "HOLD=%-6d %5.2f%% : LastKFrm=%d"
vFmt="nBlks=%d : BlkAveDif=%.3f\n" +
\ "nAboveTh=%2d (%.2f%%)\n" +
\ "Th=%.2f DTh=%.3f : CW=%.3f\nAlt=%c : Blk=%dx%d : OLap=%dx%d"
__________________
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; 3rd June 2025 at 01:33. |
|
|
|
![]() |
| Tags |
| averageluma, correlation, lumadifference, runtime |
| Thread Tools | |
| Display Modes | |
|
|