View Full Version : 1px Horizontal line removal (at varying vertical locations)
thecoreyburton
26th December 2017, 11:07
I'm currently working on an encode of a tool-assisted speedrun and I've come to noticed a horizontal line in certain situations in-game. It's likely an emulation bug, but due to the fickle nature of syncing input playback, options that could potentially fix it cannot be changed. This is also the reason behind the excessive (and stretched) resolution, which is easy enough to fix once the line is removed.
Throughout the game, the output goes to and from 4:3 to letterboxed widescreen. It cycles to this letterbox resolution by having black bars fall down from the top and raise up from the bottom over a series of frames (the exact amount varies with the emulator). The line itself only appears when these black bars do, 24 pixels above the top of the gameplay window. This means as the black bars fall in, the line falls in, too. Furthermore, UI elements are drawn on top of the line. If the game is displaying in 4:3, the line is not present at all.
Here is a short clip (http://www.mediafire.com/file/9xk854f2341n62t/zelda_test.avi) with several frames exhibiting the problem in it's various states (selected at random).
Because I need the footage to maintain as much accuracy as possible (despite it's alarming inaccuracy), I decided the best course of action regarding the line's removal would be to first detect if the line was present, and if so, replace the entire line with an average of the lines directly above and below it. This would ensure that the UI elements weren't distorted (and if they were, it would be nearly impossible to tell). I initially was unaware of the fact the line fell in with the black bars and thought it stayed permanently at y=385 and so I used the following script to detect and remove the line:
# Load the source
AVISource("zelda_test.avi")
# Create the reference clip for the check
# Horizontal values set to avoid UI elements, vertical values set based on the line's location with a 2-pixel buffer
LineReferenceTop = Last.Crop(900,2,-2500,-2498)
LineReferenceBottom = Last.Crop(900,387,-2500,-2474)
LineReference = StackVertical(LineReferenceTop, LineReferenceBottom)
# Create the output clip for when a line is detected
# OutputLine averages the pixel above and below the line in order to keep UI elements intact
OutputTop = last.crop(0,0,0,-2496)
OutputLine = Average(last.crop(0,383,0,-2496), 0.5, last.crop(0,385,0,-2494), 0.5)
OutputBottom = last.crop(0,385,0,0)
LineFixed = StackVertical(OutputTop, OutputLine, OutputBottom)
# Perform a check comparing the test clip to a completely black clip
# If the result is 0, test area is black and line should be replaced
ConditionalFilter(LineReference, last, LineFixed, "RGBDifference(LineReference.BlankClip())", ">", "0", false)
There are a number of problems with this method, though - namely that it's a bit of dumb code (it doesn't check for the line itself, but rather the black surrounding it); and that it doesn't account for the fact the line is non-static and can be at varying heights. Unfortunately, this isn't something I've encountered before and so I don't know the best way to tackle either of the problems. Any help or insight on this would be greatly appreciated.
Shirtfull
26th December 2017, 11:49
B#####, I didn't get an 8K monitor for Xmas
thecoreyburton
27th December 2017, 12:44
B#####, I didn't get an 8K monitor for XmasIf it makes you feel better, neither did I.
I'm thinking that if perhaps the clip has padding added to the top, a detection could be performed looking for n black pixels, followed by a row of non black pixels, followed by n black pixels. If the detection is true, then whatever y value the line was detected at could have the fix applied. Unfortunately, I'm not sure how to go about this in terms of AVISynth script though.
thecoreyburton
30th December 2017, 14:03
I did a lot of experimentation and spoke to a few people and came up with the following script:
AVISource("zelda_test.avi")
global v1 = false
global v2 = false
global v3 = false
LineIndex = DetectLine(32, 96, 960, 2240, 4860, 480, 20)
(LineIndex == 0) ? Last : Last.FixLine(LineIndex)
function FixLine(clip c, int i)
{
# Function by TheCoreyBurton
c_top = c.crop(0,0,0,-(c.height-i+1))
c_bottom = c.crop(0,i,0,0)
c_top_blend = c.crop(0,i-2,0,-(c.height-i+1))
c_bottom_blend = c.crop(0,i,0,1)
c_line = Average(c_top_blend, 0.5, c_bottom_blend, 0.5)
output = StackVertical(c_top, c_line, c_bottom)
return output
}
function DetectLine(clip c, int block_width, int x1, int x2, int x3, int x4, int ymax, int buffer)
{
# Function by TheCoreyBurton (props to feos, Warepire and creaothcean)
return_index = 0
c1 = c.crop(x1,0,block_width,0)
c2 = c.crop(x2,0,block_width,0)
c3 = c.crop(x3,0,block_width,0)
c4 = c.crop(x4,0,block_width,0)
c_stack = StackHorizontal(c1, c2, c3, c4).AddBorders(0,buffer,0,0)
GScript("""
for (index = buffer+1, ymax+buffer+1, 1)
{
global p1 = c_stack.crop(0,index-1-buffer,0,buffer)
global p2 = c_stack.crop(0,index-1,0,1)
global p3 = c_stack.crop(0,index,0,buffer)
global d1 = 0
global d2 = 0
global d3 = 0
#FrameEvaluate(p1, "global d1 = RGBDifference(p1, p1.blankclip)")
#FrameEvaluate(p2, "global d2 = RGBDifference(p2, p2.blankclip)")
#FrameEvaluate(p3, "global d3 = RGBDifference(p3, p3.blankclip)")
#v1 = (d1 == 0) ? true : false
#v2 = (d2 == 0) ? false : true
#v3 = (d3 == 0) ? true : false
return_index = v1 ? v2 ? v3 ? index-buffer-1 : return_index : return_index : return_index
}
""")
return return_index
}
Last
The FixLine function works as expected if you give it a pre-determined integer. The DetectLine function is currently broken. Usage is quite simple - it samples four custom portions of the original video, splits them into three parts (above, below, and the line itself) and sequentially checks each section against a black version of itself for each index until it reaches the ymax.
The first problem I'm having is that I need to somehow store the results of RGBDifference from each detection into values (and I have no idea how to do that). I've commented out the six lines that didn't work as intended and I only really need a true/false response to make it work, but my current lines of code were not functioning correctly. The script should return "0" if no line was found, or if a line was found it should return the index so the FixLine function can be carried out.
The second problem that may arise (depending on how the first is dealt with) is that this needs to be evaluated on a per-frame basis, as the line's position is dynamic and changes regularly.
I also attempted an alternate solution to the problem (a "cheat"). I decided to use a variation of the original ConditionalFilter line I wrote in conjunction with global variables in the following manner:
AVISource("zelda_test.avi")
global v1 = false
global v2 = false
global v3 = false
LineIndex = DetectLine(32, 96, 960, 2240, 4860, 480, 20)
(LineIndex == 0) ? Last : Last.FixLine(LineIndex)
function FixLine(clip c, int i)
{
# Function by TheCoreyBurton
c_top = c.crop(0,0,0,-(c.height-i+1))
c_bottom = c.crop(0,i,0,0)
c_top_blend = c.crop(0,i-2,0,-(c.height-i+1))
c_bottom_blend = c.crop(0,i,0,1)
c_line = Average(c_top_blend, 0.5, c_bottom_blend, 0.5)
output = StackVertical(c_top, c_line, c_bottom)
return output
}
function DetectLine(clip c, int block_width, int x1, int x2, int x3, int x4, int ymax, int buffer)
{
# Function by TheCoreyBurton (props to feos, Warepire and creaothcean)
return_index = 0
c1 = c.crop(x1,0,block_width,0)
c2 = c.crop(x2,0,block_width,0)
c3 = c.crop(x3,0,block_width,0)
c4 = c.crop(x4,0,block_width,0)
c_stack = StackHorizontal(c1, c2, c3, c4).AddBorders(0,buffer,0,0)
GScript("""
for (index = buffer+1, ymax+buffer+1, 1)
{
global p1 = c_stack.crop(0,index-1-buffer,0,buffer)
global p2 = c_stack.crop(0,index-1,0,1)
global p3 = c_stack.crop(0,index,0,buffer)
ConditionalFilter(p1, p1.v1black, p1.v1else, "RGBDifference(p1, p1.BlankClip())", ">", "0", false)
ConditionalFilter(p2, p2.v2black, p2.v2else, "RGBDifference(p2, p2.BlankClip())", ">", "0", false)
ConditionalFilter(p3, p3.v3black, p3.v3else, "RGBDifference(p3, p3.BlankClip())", ">", "0", false)
return_index = v1 ? v2 ? v3 ? index-buffer-1 : return_index : return_index : return_index
}
""")
return return_index
}
function v1black(clip c)
{
global v1 = true
return c
}
function v1else(clip c)
{
global v1 = false
return c
}
function v2black(clip c)
{
global v2 = false
return c
}
function v2else(clip c)
{
global v2 = true
return c
}
function v3black(clip c)
{
global v3 = true
return c
}
function v3else(clip c)
{
global v3 = false
return c
}
Last
It's worth noting that this code did actually change the value of v1, but only once. I'm not sure if the value was accurate or not (thanks to the loop), but it wasn't the default. If the DetectLine function could be modified to run per frame then this might be a potential solution, too. Otherwise, I'm out of ideas for now.
It's also worth noting that due to the nature of the project, the code in DetectLine for selecting the index may be incorrect. I've been able to give it user-defined numbers so far, but I won't be able to see if it stops at the correct point in the loop until the loop itself is working. Any testing should probably be done with this in mind.
StainlessS
30th December 2017, 17:05
On sample frame 2, there are hearts and some ball type things intruding into the black border, can the left and or right edges of the borders be guaranteed
free of such hearts and baubles ?
EDIT: For detection of border present.
StainlessS
30th December 2017, 18:02
How does this look to you ? (simple preliminary test)
ORG=AVISource("D:\zelda_test.avi")
ORG
TEST_LEFT_W=320 TEST_RIGHT_W=320 TEST_H=420
LFT=Crop(0,0,TEST_LEFT_W,TEST_H)
RGT=Crop(Width-TEST_RIGHT_W,0,0,TEST_H)
StackHorizontal(LFT,RGT)
Function TestIt(clip c) {
c
Bingo = RT_RgbInRangeLocate(RLo=0,GLo=0,Blo=0,RHi=0,GHi=0,BHi=0,Baffle_W=Width,Baffle_H=2)
Bingo ? RT_Subtitle("%d %d %d %d",RGBIRL_X,RGBIRL_Y,RGBIRL_W,RGBIRL_H) : NOP
Bingo ? Overlay(Last,Last.BlankClip(Width=Width/2,Height=1,Color=$FF0000),x=Width/4,y=RGBIRL_H-24) : NOP
Return Last
}
Return ScriptClip("Return Testit")
EDITED
EDIT: Frame 0 (Top LHS and top RHS corners only, stacked horizontal)
https://s20.postimg.org/s8knuoofx/zelda_test--simple-avisource.jpg (https://postimages.org/)
Red marks the spot. Numbers are the top border coords when located, red mark relative bottom of border (-24).
Correctly ID's line on each of the sample frames suffering from the artifact.
EDIT: Frame 8
https://s10.postimg.cc/d769ik6pl/zelda_test2--simple-avisource.jpg (https://postimages.cc/)
StainlessS
31st December 2017, 02:49
This any good ?
GSCript("""
Function FixLine(clip c, int i, Bool Fix, Bool Show) {
c
if(i>=0) {
if(FIX) {
if(i==0) {
StackVertical(crop(0,1,0,1),crop(0,1,0,0))
} else {
m=StackVertical(crop(0,i-1,0,1),crop(0,i+1,0,1)).BilinearResize(Width,3).crop(0,1,0,1)
StackVertical(crop(0,0,0,i),m,crop(0,i+1,0,0))
}
}
Show ? Overlay(Last.BlankClip(Width=Width*7/8,Height=3,Color=$FFFF00),x=Width/16,y=i-1) : NOP
Show ? Subtitle(String(current_frame,"%.0f") + String(i,"] Line @ Y=%.0f"),Size=Height/32.0) : NOP
} Else { Show ? Subtitle(String(current_frame,"%.0f] Border NOT FOUND"),Size=Height/32.0) : NOP }
return Last
}
""")
AVISource("D:\zelda_test.avi")
#AVISource("D:\zelda_test2.avi")
TEST_LEFT_W=320 TEST_RIGHT_W=320 TEST_H=408
FIX =true # Fix Artifact if True
SHOW=true # Mark line with height of 3 (make more visible) in Yellow.
DC=StackHorizontal(Crop(0,0,TEST_LEFT_W,TEST_H),Crop(Width-TEST_RIGHT_W,0,0,TEST_H))
SSS="""
i = DC.RT_RgbInRangeLocate(RLo=0,GLo=0,Blo=0,RHi=0,GHi=0,BHi=0,Baffle_W=DC.Width,Baffle_H=23) ? RGBIRL_H-24 : -1
FixLine(Last,i,FIX||!SHOW,SHOW)
return Last
"""
Return ScriptClip(SSS) #.BicubicResize(854,480)
Frame 0, Detected line shown in yellow with an original line height of 3 to make more visible (show=true), downscaled to 854x480 for forum.
https://s20.postimg.cc/4ud525alp/zelda_test3.jpg (https://postimages.cc/)
EDIT: Changed Baffle_H from 2 to 23.
EDIT: Added FIX.
EDIT: Mod TEST_H=408
thecoreyburton
31st December 2017, 03:14
On sample frame 2, there are hearts and some ball type things intruding into the black border, can the left and or right edges of the borders be guaranteed
free of such hearts and baubles ?
EDIT: For detection of border present.
For the most part, I'd say so (excluding the first pixel and last pixel). The UI elements move vertically at some points but I don't think they ever move horizontally. Even so, it would be easy enough to change the detection area.
Thanks for all the replies, StainlessS. That last script is fantastic. I tried it on a few sections of the full 400,000 frame source and only came across one situation where it didn't function as intended. Here's a new sample (http://www.mediafire.com/file/nsgj9vf2p9x4rru/zelda_test2.avi), have a look at frames 3 and 4. It's not failing to detect the line, but it rather looks like it's detecting inconsistencies below the line.
StainlessS
31st December 2017, 03:21
Can you retry with current script (I changed Baffle_H to 23 while you were replying).
EDIT:
For the most part, I'd say so (excluding the first pixel and last pixel).
Can you spell out exactly what that means please.
thecoreyburton
31st December 2017, 03:30
No worries, I really appreciate the help!
That fixed the issue on frame 4 of the new sample (Where the line was detected significantly lower than it's actual coordinate), but not frame 3 of the new sample (where the line is detected only a single pixel lower).
StainlessS
31st December 2017, 03:32
OK, thanks. I'll down the current sample.
StainlessS
31st December 2017, 03:54
Change to TEST_H=408 and retest please.
EDIT: Can you answer this too.
For the most part, I'd say so (excluding the first pixel and last pixel).
Can you spell out exactly what that means please.
EDIT: Erroneous detection due to top line of that frame 3 being totally black, ie looks like border.
TEST_H=408, is presumably maximum height of top border.
thecoreyburton
31st December 2017, 04:13
Change to TEST_H=408 and retest please.
That seems to have fixed the problem. In a few days I'll be able to apply this to the entire clip and see the results, but I'm optimistic. Thank you.
Can you spell out exactly what that means please.
Regarding the way the video was acquired, the graphics plugin is notorious for sometimes adding garbage data to the border of the output. I've only ever seen this amount to a single pixel in width or height (depending on which border it's adding to) and would usually deal with it by using Crop(1,1,-1,-1).
StainlessS
31st December 2017, 04:16
Thank you, good luck and let us know how it goes.
EDIT: May fail if top border less than max 408, and some of top lines of non border is near black (right across the width).
EDIT: I'm trying to improve border detection where top line of non border is near black. (Probably require RT_Stats v2.0 beta)
thecoreyburton
1st January 2018, 03:31
To be safe, I've added RT_Stats v2.0 beta to my plugin folder and I'll keep watching this thread for any other changes.
StainlessS
1st January 2018, 11:27
OK, wanna give this a whirl, it dont need RT_ v2.0
GSCript("""
# Allocate Format strings Globally only once, not for each frame.
Global G_String_0 = "%s"
Global G_String_1 = "%d] Border NOT FOUND"
Global G_String_2 = "%d] Line=%d Border Detect FAIL : Border NOT Full scan Width (X=%d:W=%d, should be 1:%d)"
Global G_String_3 = "%d] Line=%d Border Detect FAIL : Border NOT Start @ top of frame : (Top=%d, should be 1)"
Global G_String_4 = "%d] Line=%d Bad Detect (pop=%.2f%%) : Check frame"
Global G_String_5 = " Re-Detected OK @ Line=%d (pop=%.2f%%)"
Global G_String_6 = " Upward scan did not find artifact : LineBest=%d popBest=%.2f%% "
Global G_String_7 = "%d] Line = %d (pop=%.2f%%)"
Function FixLine(clip c,clip DC, Int BordHi,Float BordPerc, Int MarkLo,Float MarkPerc,Int Matrix,
\ Bool Fix,Bool Fix_ReDetect,Bool Subs, Bool Mark,String LogFile,Bool VerbLog) {
c frm=current_frame
locWid = DC.Width - 2 # Exclude left and right edges (crud on sample frame 8, LHS)
Line=DC.RT_YInRangeLocate(x=1,y=1,w=locWid,Baffle_W=(locWid+1)/2,Baffle_H=23,Lo=0,Hi=BordHi,Matrix=Matrix,
\ Thresh=BordPerc) ? YIRL_Y+YIRL_H-24 : -1
if(Line<0) {
S=RT_String(G_String_1,frm)
VerbLog ? RT_WriteFile(LogFile,G_String_0,s,Append=True) : NOP
Subs ? Subtitle(S,Size=Height/32.0) : NOP
} else if(YIRL_W!=locWid){
S=RT_String(G_String_2,frm,Line,YIRL_X,YIRL_W,locWid)
RT_WriteFile(LogFile,G_String_0,s,Append=True)
Subs ? Subtitle(S,Size=Height/32.0) : NOP
} else if(YIRL_Y!=1 && Line!=0){ # We also excluded top scanline in border detect (crud)
S=RT_String(G_String_3,frm,Line,YIRL_Y)
RT_WriteFile(LogFile,G_String_0,s,Append=True)
Subs ? Subtitle(S,Size=Height/32.0) : NOP
} else {
vi = DC.RT_YInRange(x=1,y=Line,w=locWid,h=1,Lo=MarkLo,Hi=255) * 100.0 # retest, test for lighter line
if(vi <= MarkPerc) { # Percent of light pixels too low, scan upwards, try re-detect
RT_WriteFile(LogFile,G_String_4,frm,Line,vi,Append=True)
Linechk = -1 vbest=vi jbest=Line
for(j=Line-1, 0, -1) { # Line, Fixed in BLUE
v = DC.RT_YInRange(x=1,y=j,w=locWid,h=1,Lo=MarkLo,Hi=255) * 100.0
if(v>vbest) { jbest=j vbest=v }
if(v > MarkPerc) {
Linechk = j
RT_WriteFile(LogFile,G_String_5,Linechk,v,Append=True)
Fix = Fix && Fix_ReDetect
vi = v
j = -1 # Break with j = -2
}
}
if(Linechk<0) {
RT_WriteFile(LogFile,G_String_6,jbest,vbest,Append=True)
Fix=False
}
Line=Linechk
}
if(Line>=0) {
if(Fix) {
if(Line==0) {
StackVertical(crop(0,1,0,1),crop(0,1,0,0))
} else {
m=StackVertical(crop(0,Line-1,0,1),crop(0,Line+1,0,1)).BilinearResize(Width,3).crop(0,1,0,1)
StackVertical(crop(0,0,0,Line),m,crop(0,Line+1,0,0))
}
}
Mark?Layer(Last.BlankClip(Width=Width*7/8,Height=3,Color=$FFFF00).ResetMask,"add",257,Width/16,Line-1):NOP
S=RT_String(G_String_7,frm, Line, vi)
VerbLog ? RT_WriteFile(LogFile,G_String_0,s,Append=True) : NOP
Subs ? Subtitle(S,Size=Height/32.0) : NOP
}
}
return Last
}
""")
AVISource("D:\zelda_test.avi" , "D:\zelda_test2.avi")
TEST_LEFT_W=320 TEST_RIGHT_W=320 TEST_H=408
DC=StackHorizontal(Crop(0,0,TEST_LEFT_W,TEST_H),Crop(Width-TEST_RIGHT_W,0,0,TEST_H))
###################
BORDHI = 3 # Is possible border scanline if pixel population 0 -> BORDHI is Greater than BORDPERC.
BORDPERC = 5.0 # (BORDPERC may work as low as 0.0, Dont go too high, max maybe 10.0 [Baffle is main detector])
###
MARKLO = 4 # Is artifact line if pixel population MARKLO -> 255 is Greater than MARKPERC.
MARKPERC = 5.0 #
###
Matrix = 3 # 2 = PC.601 : 3 = PC.709 (RGB -> Luma Conversion for detection)
FIX = false # Fix Artifact if True
FIX_REDETECT = false # Fix Bad detections that were re-detected OK.
SUBS = True # Subtitles in Yellow (may OMEM if not SMALL=True).
MARK = True # Mark line with height of 3 (make more visible) in Yellow.
SMALL = True # MARK/FIX/SUBS detect clip only (fails on big clip for Subtitle, Out Of Memory)
LogFile = "MyLog.Log" # Log filename
VERBLOG = true # More Verbose Logging
###################
RT_FileDelete(LogFile)
VC = SMALL ? DC : Last
Return VC.ScriptClip("Return FixLine(Last,DC,BORDHI,BORDPERC,MARKLO,MARKPERC,Matrix,
\ FIX,FIX_REDETECT,SUBS,MARK,LogFile,VERBLOG)") #.BicubicResize(854,480)
Due to crud in one frame (Frame 8 when both samples joined together, at left side of border),
have excluded left, right and top single pixels from detection area, should still work as before, no need to crop crud.
If problems, I may have to use RT_ v2.0 as it has separate threshold for border detection, for h and v.
EDIT: If you need post further samples, then only post DC clip, a helluva lot smaller (and minus audio).
creaothceann
1st January 2018, 23:42
Crop(1, 1, -1, -1)
It might result in faster processing if you just put black lines there:
# Crop(1, 1, -1, -1).AddBorders(1, 1, 1, 1)
RemoveGarbage
function RemoveGarbage(clip c) {
c
h = BlankClip(c, 1, Width, 1, color=$FF000000)
v = BlankClip(c, 1, 1, Height, color=$FF000000)
c .\
Layer(h, x= 0, y= 0).\
Layer(h, x= 0, y=Height-1).\
Layer(v, x= 0, y= 0).\
Layer(v, x=Width-1, y= 0)
}
EDIT: Alternatively, the garbage might disappear if you disable anti-aliasing in your GPU's driver settings?
wonkey_monkey
2nd January 2018, 00:41
Have you checked speed on that? I can't imagine crop/addborders being slower than four calls to layer.
creaothceann
2nd January 2018, 02:16
No, just assumed that cropping and adding borders involves copying lots of memory around.
EDIT: in a quick test with this code and VirtualDub's "preview output from start" function, using the function resulted in a very slight speedup (35 vs. 38 seconds).
a = Version.ConvertToRGB32.Trim(0, -1)
b = BlankClip(a, 400000)
Layer(b, a)
# Crop(1, 1, -1, -1).AddBorders(1, 1, 1, 1)
RemoveGarbage
(only 440x80 pixels)
StainlessS
2nd January 2018, 02:34
Perhaps letterbox a better option to blacken borders:- http://avisynth.nl/index.php/Letterbox
Docs (EDIT: Its one of those built-in filters that is very easy to forget about)
Letterbox
Fills the top and bottom rows of each frame, and optionally the left and right columns, with black or color. This has several common uses:
Black out video noise from the existing black bands in an image that's already letterboxed
Black out the video noise at the bottom of the frame in VHS tape sources.
Black out overscan areas in VCD or SVCD sources.
Create a quick rectangular mask for other filters – a so-called "garbage matte"
See also: AddBorders, which increases frame size. Letterbox does not change frame size.
The functionality of Letterbox can be duplicated with a combination of Crop and AddBorders, but Letterbox is faster and easier.
Generally, it's better to Crop video noise off than to black it out; many older lossy compression algorithms don't deal well with solid-color borders, unless the border happens to fall on a macroblock boundary (16 pixels for MPEG). However, in some cases, particularly for certain hardware players, it's better to use Letterbox because it lets you keep a standard frame size.
EDIT: Anyway, dont need crop prior detect, have left that option for thecoreyburton.
EDIT: The detector should still be able to detect and correct bad scanline @ line 0, even though the border detect starts @ scanline 1.
The bad scanline is bottom of border - 24 pixels [EDIT: total border height, incl top scanline, - 24 pixels, ie upwards].
thecoreyburton
4th January 2018, 11:07
Thanks for all your help, and apologies for the slow response (I was testing the script out on the full source)! That last script is much more successful than the first. At a glance, I almost didn't notice anything wrong. I did manage to find a case (14.5kb) (http://www.mediafire.com/file/ucdadafzboub323/zelda_test3.avi) where the screen is dark and the line is not detected, but other than outliers such as this it seems good (and in theory, the contrast of the detection clip could be boosted to perhaps overcome this). I really appreciate all the effort.
the garbage might disappear if you disable anti-aliasing in your GPU's driver settings?
No luck, unfortunately. It might be a case of requiring profile inspector and antialiasing compatibility, but the viewport is already wildly inaccurate and I don't think a single pixel off each side isn't going to matter much. I can play with the plugin's settings via registry, but at this point I've had to resync the entire clip multiple times and don't really want to volunteer for anther nightmare haha.
StainlessS
4th January 2018, 20:20
where the screen is dark and the line is not detected,
Is detected for me with the default args as given.
EDIT: Frame 16 (last frame 16 of frames 0->16)
When adding last sample frame to previous given 16 frames (was slightly different Framerate).
From DebugView if giving Debug=True to RT_YInRangeLocate (I added to the script)
RT_YInRangeLocate: 16] Top 1 : x1=1 y1=1 x2=638 y2=407 638x407 (outer edge passing Th : 100.000% 638.0 pixels)
RT_YInRangeLocate: 16] Bot 407 : x1=1 y1=1 x2=638 y2=407 638x407 (outer edge passing Th : 100.000% 638.0 pixels)
RT_YInRangeLocate: 16] Lft 1 : x1=1 y1=1 x2=638 y2=407 638x407 (outer edge passing Th : 100.000% 407.0 pixels)
RT_YInRangeLocate: 16] Rgt 638 : x1=1 y1=1 x2=638 y2=407 638x407 (outer edge passing Th : 99.754% 406.0 pixels)
RT_YInRangeLocate: 16] Perimeter no recan detect @ x1=1 y1=1 x2=638 y2=407 (638x407)
RT_YInRangeLocate: 16] Successful Detection @ x1=1 y1=1 x2=638 y2=407 (638x407) # Height 407 (excluding scanline 0, so total 408 lines)
RT_YInRangeLocate: 16] Returned Locals YIRL_X=1 YIRL_Y=1 YIRL_W=638 YIRL_H=407
From MyLog.log
0] Line = 384 (pop=100.00%)
1] Line = 384 (pop=100.00%)
2] Line = 324 (pop=100.00%)
3] Line = 384 (pop=100.00%)
4] Line = 324 (pop=100.00%)
5] Border NOT FOUND
6] Line = 384 (pop=100.00%)
7] Line = 204 (pop=100.00%)
8] Line = 84 (pop=100.00%)
9] Border NOT FOUND
10] Line = 384 (pop=100.00%)
11] Line = 384 (pop=100.00%)
12] Line = 384 (pop=100.00%)
13] Line = 384 (pop=96.55%)
14] Line = 384 (pop=90.44%)
15] Line = 384 (pop=90.60%)
16] Line = 384 (pop=76.02%)
Did you change args at all, and to what ?
EDIT: Debugview logging was from RT_Stats v2.0 beta.
EDIT: Maybe RT_Stats v2.0 was the difference, can you try with that one (I know you said you had put it in plugins).
thecoreyburton
5th January 2018, 02:44
It was a codec / pixel format problem on my end, sorry. The dump itself uses FFV1 and AVISource was incorrectly guessing that this clip was YV12. If I specify the correct pixel format, the detection works just fine (I compared it to a short Lagarith dump of the source itself using subtract to locate any differences). I didn't consider this until you mentioned it detecting okay for you because we'd been using Lagarith for the tests.
StainlessS
5th January 2018, 02:53
Nice, job done I hope.
Have a great year, have a better than great life.
thecoreyburton
5th January 2018, 03:07
Thank you! You too, StainlessS.
thecoreyburton
16th January 2018, 13:34
Unfortunately, it looks like I've ran into another (and hopefully, final) problem. When selecting random test frames, everything works as expected but when starting the full source from the beginning I get the following on-screen prompt:
I don't know what "i" means
([GScript], line 47)
([GScript], line 54)
([GScript], line 68)
([ScriptClip], line 2)
Here's the newest test clip (http://www.mediafire.com/file/v38rv6g0lo3v9y7/new_test_fullframe.avi) (provided in full frame as the size was small enough).
for(j=i-1, 0, -1) {
The above (line 37) seems to be where the problem is occurring. It looks like i is undeclared when referencing the new test frames, but it's fine when using the old test frames. I suspect it's something to do with the background being entirely black and am currently trying to work this out myself (I'll edit this post if I have any luck). Sorry to bother you again.
StainlessS
16th January 2018, 17:17
Oops, sorry. Think I changed something and condition to reveal the mistake never occurred and so did not notice the error.
Should I think be
for(j=Line-1, 0, -1) {
Untested, and about to leave the house, hope it works ok.
thecoreyburton
17th January 2018, 01:48
That's alright! Line removal still works the same and the error message no longer pops up. Looks like it worked. Thank you once again.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.