From 9da2f9fc2ebc9d80fc84b123a67e2af6d42aa82e Mon Sep 17 00:00:00 2001 From: notwa Date: Tue, 26 Feb 2013 10:41:48 +0000 Subject: [PATCH 1/3] --- spddiff.avs | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 spddiff.avs diff --git a/spddiff.avs b/spddiff.avs new file mode 100644 index 0000000..2b8deed --- /dev/null +++ b/spddiff.avs @@ -0,0 +1,85 @@ +function open(string path) +{ return AviSource(path, audio=false) } + +function DiffClip(clip c, int diff) +{ BlankClip(c, diff).Subtitle(String(-diff), align=5, size=c.Height/8) } + +function PadWithDiff(clip c, int len) +{ c.FrameCount < len ? c + DiffClip(c, len - c.FrameCount) : c } + +function MergeHoriz(clip left, clip right) +{ Overlay(AddBorders(left, 0, 0, right.Width, 0), right, left.Width, 0) } + +function MergeVert(clip top, clip bottom) +{ Overlay(AddBorders(top, 0, 0, 0, bottom.Height), bottom, 0, top.Height) } + +function Cmp(clip left, clip right) +{ + frames = max(left.FrameCount, right.FrameCount) + left = PadWithDiff(left, frames) + right = PadWithDiff(right, frames) + return MergeHoriz(left, right) +} + +# http://tasvideos.org/1072S.html +open("snes9x\Movies\old.avi")+\ +open("snes9x\Movies\old_part2.avi")+\ +open("snes9x\Movies\old_part3.avi")+\ +open("snes9x\Movies\old_part4.avi") +Trim(0, 38409) +AddBorders(0,0,16,0) +global old = last + +# http://tasvideos.org/3346S.html +open("snes9x\Movies\new.avi")+\ +open("snes9x\Movies\new_part5.avi")+\ +open("snes9x\Movies\new_part6.avi")+\ +open("snes9x\Movies\new_part7.avi") +Trim(0, 37569) +global new = last + +# compare by slice +function x(int oldStart, int oldEnd, int newStart, int newEnd) +{ Cmp(Trim(old, oldStart, oldEnd), Trim(new, newStart, newEnd)) } + +# compare by split (start is last split) +global prevOldSplit = 0 +global prevNewSplit = 0 +function s(int oldSplit, int newSplit) +{ + ot = prevOldSplit + nt = prevNewSplit + global prevOldSplit = oldSplit + 1 + global prevNewSplit = newSplit + 1 + return x(ot, oldSplit, nt, newSplit) +} + +s(01498,01497)+\ +s(04115,04184)+\ +s(06856,06527)+\ +s(08027,07668)+\ +s(09017,08658)+\ +s(09207,08847)+\ +s(10000,09615)+\ +s(11601,11212)+\ +s(14217,13817)+\ +s(16319,15911)+\ +s(17425,16999)+\ +s(17783,17350)+\ +s(18906,18470)+\ +s(19091,18655)+\ +s(19638,19149)+\ +s(20338,19834)+\ +s(22816,22312)+\ +s(23798,23271)+\ +s(26013,25461)+\ +s(26930,26345)+\ +s(29007,28374)+\ +s(29192,28559)+\ +s(29486,28855)+\ +s(29900,29162)+\ +s(30072,29369)+\ +s(30720,29894)+\ +s(31504,30639)+\ +s(34100,33232)+\ +s(38158,37235)+s(0,0) # end of input, then bowser dead From 0c131cf1ea7d585e655e300b7f258624df5eb93c Mon Sep 17 00:00:00 2001 From: notwa Date: Tue, 26 Feb 2013 11:39:15 +0000 Subject: [PATCH 2/3] --- spddiff.avs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/spddiff.avs b/spddiff.avs index 2b8deed..22955a8 100644 --- a/spddiff.avs +++ b/spddiff.avs @@ -1,17 +1,23 @@ -function open(string path) -{ return AviSource(path, audio=false) } - function DiffClip(clip c, int diff) { BlankClip(c, diff).Subtitle(String(-diff), align=5, size=c.Height/8) } function PadWithDiff(clip c, int len) { c.FrameCount < len ? c + DiffClip(c, len - c.FrameCount) : c } +function DualMonoToStereo(clip left, clip right) +{ MergeChannels(ConvertToMono(left), ConvertToMono(right)) } + function MergeHoriz(clip left, clip right) -{ Overlay(AddBorders(left, 0, 0, right.Width, 0), right, left.Width, 0) } +{ + v = Overlay(AddBorders(left, 0, 0, right.Width, 0), right, left.Width, 0) + return AudioDub(v, DualMonoToStereo(left, right)) +} function MergeVert(clip top, clip bottom) -{ Overlay(AddBorders(top, 0, 0, 0, bottom.Height), bottom, 0, top.Height) } +{ + v = Overlay(AddBorders(top, 0, 0, 0, bottom.Height), bottom, 0, top.Height) + return AudioDub(v, DualMonoToStereo(top, bottom)) +} function Cmp(clip left, clip right) { @@ -22,19 +28,19 @@ function Cmp(clip left, clip right) } # http://tasvideos.org/1072S.html -open("snes9x\Movies\old.avi")+\ -open("snes9x\Movies\old_part2.avi")+\ -open("snes9x\Movies\old_part3.avi")+\ -open("snes9x\Movies\old_part4.avi") +AviSource("snes9x\Movies\old.avi")+\ +AviSource("snes9x\Movies\old_part2.avi")+\ +AviSource("snes9x\Movies\old_part3.avi")+\ +AviSource("snes9x\Movies\old_part4.avi") Trim(0, 38409) AddBorders(0,0,16,0) global old = last # http://tasvideos.org/3346S.html -open("snes9x\Movies\new.avi")+\ -open("snes9x\Movies\new_part5.avi")+\ -open("snes9x\Movies\new_part6.avi")+\ -open("snes9x\Movies\new_part7.avi") +AviSource("snes9x\Movies\new.avi")+\ +AviSource("snes9x\Movies\new_part5.avi")+\ +AviSource("snes9x\Movies\new_part6.avi")+\ +AviSource("snes9x\Movies\new_part7.avi") Trim(0, 37569) global new = last From 03860a8c7fc2f286cbebcea1239465cd5d4bd4b6 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 6 Nov 2016 18:03:20 -0800 Subject: [PATCH 3/3] . --- spddiff.avs | 184 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 132 insertions(+), 52 deletions(-) diff --git a/spddiff.avs b/spddiff.avs index 22955a8..17ba663 100644 --- a/spddiff.avs +++ b/spddiff.avs @@ -1,5 +1,7 @@ +global fontsize = 26 + function DiffClip(clip c, int diff) -{ BlankClip(c, diff).Subtitle(String(-diff), align=5, size=c.Height/8) } +{ BlankClip(c, diff).Subtitle(String(-diff), align=5, size=c.Height / 8) } function PadWithDiff(clip c, int len) { c.FrameCount < len ? c + DiffClip(c, len - c.FrameCount) : c } @@ -7,16 +9,24 @@ function PadWithDiff(clip c, int len) function DualMonoToStereo(clip left, clip right) { MergeChannels(ConvertToMono(left), ConvertToMono(right)) } -function MergeHoriz(clip left, clip right) +function MergeHoriz(clip left, clip right, int audio_index) { v = Overlay(AddBorders(left, 0, 0, right.Width, 0), right, left.Width, 0) - return AudioDub(v, DualMonoToStereo(left, right)) + return audio_index == 0 \ + ? AudioDub(v, DualMonoToStereo(left, right)) \ + : audio_index == 1 ? AudioDub(v, left) \ + : audio_index == 2 ? AudioDub(v, right) \ + : v } -function MergeVert(clip top, clip bottom) +function MergeVert(clip top, clip bottom, int audio_index) { v = Overlay(AddBorders(top, 0, 0, 0, bottom.Height), bottom, 0, top.Height) - return AudioDub(v, DualMonoToStereo(top, bottom)) + return audio_index == 0 \ + ? AudioDub(v, DualMonoToStereo(top, bottom)) \ + : audio_index == 1 ? AudioDub(v, top) \ + : audio_index == 2 ? AudioDub(v, bottom) \ + : v } function Cmp(clip left, clip right) @@ -24,68 +34,138 @@ function Cmp(clip left, clip right) frames = max(left.FrameCount, right.FrameCount) left = PadWithDiff(left, frames) right = PadWithDiff(right, frames) - return MergeHoriz(left, right) + return MergeHoriz(left, right, 0) } -# http://tasvideos.org/1072S.html -AviSource("snes9x\Movies\old.avi")+\ -AviSource("snes9x\Movies\old_part2.avi")+\ -AviSource("snes9x\Movies\old_part3.avi")+\ -AviSource("snes9x\Movies\old_part4.avi") -Trim(0, 38409) -AddBorders(0,0,16,0) +function TextHoriz(clip c, int frames, string left, string right) +{ + size = fontsize + tleft = BlankClip(c, frames, height=size).Subtitle(left, align=2, size=size) + tright = BlankClip(c, frames, height=size).Subtitle(right, align=2, size=size) + MergeHoriz(tleft, tright, -1) + AddBorders(0, 2, 0, 2) +} + +function MakeFrameNumberClip(clip c, int frames) +{ + width = fontsize * 5 / 2 + 1 + halved = (c.Width - width) / 2 + ShowFrameNumber(BlankClip(c, frames, width=width, height=fontsize + 1), size=fontsize) + Crop(0, 5, -0, -0) + AddBorders(halved, 0, halved, 4) + AddBorders(0, 2, 0, 2) +} + +function AdjustClip(clip c, int offset) +{ + # set up your padding and resizing here + PointResize(c, c.Width * 2, c.Height * 2) + AddBorders(64 + offset, 0, 64 - offset, 0) + MergeVert(MakeFrameNumberClip(last.FrameCount), last, 2) + AddBorders(0, 16 - 2, 0, 16) +} + +# http://tasvideos.org/485M.html +global old_name = "phil" +global old_date = "2006-02-25" +global old_frames = 32248 +global old_time = "08:57.47" +global old_comment = "http://tasvideos.org/985S.html" +AviSource("phil5-ddragon-again.avi")+\ +AviSource("phil5-ddragon-again_part2.avi")+\ +AviSource("phil5-ddragon-again_part3.avi") +Trim(0, old_frames + 1636) +#ShowFrameNumber(scroll=true) +AdjustClip(0)#-48) global old = last -# http://tasvideos.org/3346S.html -AviSource("snes9x\Movies\new.avi")+\ -AviSource("snes9x\Movies\new_part5.avi")+\ -AviSource("snes9x\Movies\new_part6.avi")+\ -AviSource("snes9x\Movies\new_part7.avi") -Trim(0, 37569) +# http://tasvideos.org/3211M.html +global new_name = "alyosha" +global new_date = "2016-08-28" +global new_frames = 31869 +global new_time = "08:50.28" +global new_comment = "http://tasvideos.org/5207S.html" +AviSource("alyosha-doubledragon-again.avi")+\ +AviSource("alyosha-doubledragon-again_part2.avi")+\ +AviSource("alyosha-doubledragon-again_part3.avi") +Trim(0, new_frames + 1636) +#ShowFrameNumber(scroll=true) +AdjustClip(0)#48) global new = last # compare by slice -function x(int oldStart, int oldEnd, int newStart, int newEnd) -{ Cmp(Trim(old, oldStart, oldEnd), Trim(new, newStart, newEnd)) } +function x(int oldStart, int oldEnd, int newStart, int newEnd, string title) +{ + left = Trim(old, oldStart, oldEnd) + right = Trim(new, newStart, newEnd) + frames = max(left.FrameCount, right.FrameCount) + fc = MakeFrameNumberClip(left, frames) + TextHoriz(left, frames, old_name + " (" + old_date + ")", new_name + " (" + new_date + ")") + MergeVert(last, TextHoriz(left, frames, String(old_frames) + " frames (" + old_time + ")", string(new_frames) + " frames (" + new_time + ")"), -1) + MergeVert(last, TextHoriz(left, frames, old_comment, new_comment), -1) + MergeVert(last, Cmp(left, right), 2) + MergeVert(last, TextHoriz(left, frames, title, title), 1) + MergeVert(last, TextHoriz(left, frames, "in " + String(left.FrameCount) + " frames", "in " + String(Right.FrameCount) + " frames"), 1) + MergeVert(last, MergeHoriz(fc, fc, -1), 1) +} # compare by split (start is last split) global prevOldSplit = 0 global prevNewSplit = 0 -function s(int oldSplit, int newSplit) +function s(int oldSplit, int newSplit, string title) { ot = prevOldSplit nt = prevNewSplit global prevOldSplit = oldSplit + 1 global prevNewSplit = newSplit + 1 - return x(ot, oldSplit, nt, newSplit) + return x(ot, oldSplit, nt, newSplit, title) } -s(01498,01497)+\ -s(04115,04184)+\ -s(06856,06527)+\ -s(08027,07668)+\ -s(09017,08658)+\ -s(09207,08847)+\ -s(10000,09615)+\ -s(11601,11212)+\ -s(14217,13817)+\ -s(16319,15911)+\ -s(17425,16999)+\ -s(17783,17350)+\ -s(18906,18470)+\ -s(19091,18655)+\ -s(19638,19149)+\ -s(20338,19834)+\ -s(22816,22312)+\ -s(23798,23271)+\ -s(26013,25461)+\ -s(26930,26345)+\ -s(29007,28374)+\ -s(29192,28559)+\ -s(29486,28855)+\ -s(29900,29162)+\ -s(30072,29369)+\ -s(30720,29894)+\ -s(31504,30639)+\ -s(34100,33232)+\ -s(38158,37235)+s(0,0) # end of input, then bowser dead +# TODO: frames gained/lost in corner per file + +s( 1557, 1547, "first screen scroll")+\ +s( 1869, 1862, "first door opening")+\ +s( 2123, 2143, "second screen scroll")+\ +s( 3041, 3067, "third screen scroll")+\ +s( 3973, 4017, "door entered")+\ +s( 4729, 4817, "mission completed")+\ +s( 5943, 6059, "first screen scroll")+\ +s( 6489, 6601, "background visible again")+\ +s( 7118, 7229, "second screen scroll")+\ +s( 7604, 7713, "top of first ladder")+\ +s( 7988, 8094, "top of second ladder")+\ +s( 8316, 8416, "top of third ladder")+\ +s( 8649, 8749, "first door opening")+\ +s( 9291, 9393, "mission completed")+\ +s(10515,10611, "first screen scroll")+\ +s(11695,11747, "second screen scroll")+\ +s(12514,12581, "third screen scroll")+\ +s(13412,13543, "fourth screen scroll")+\ +s(14588,14773, "door entered")+\ +s(15369,15548, "platformer begin")+\ +s(15764,15933, "platformer finished")+\ +s(16087,16256, "first door opening")+\ +s(16941,17111, "door entered")+\ +s(17008,17179, "loaded")+\ +s(17794,17984, "first screen scroll")+\ +s(18793,18983, "black screen")+\ +s(19398,19608, "boss defeated")+\ +s(20776,20994, "mission completed")+\ +s(22572,22804, "first screen scroll")+\ +s(23183,23400, "climbed wall")+\ +s(24076,24398, "black screen")+\ +s(24326,24642, "top of first ladder")+\ +s(24788,25108, "top of second ladder")+\ +s(25606,25917, "top of third ladder")+\ +s(26147,26446, "top of fourth ladder")+\ +s(26283,26642, "black screen")+\ +s(27623,27788, "first screen scroll")+\ +s(27951,28118, "first door opening")+\ +s(28800,28585, "second door opening")+\ +s(29492,29152, "third door opening")+\ +s(29660,29320, "fourth door opening")+\ +s(29944,29545, "fifth door opening")+\ +s(30683,30290, "sixth door opening")+\ +s(old_frames,new_frames, "end of input")+\ +s( 0, 0, "end of game") +AddBorders(0, 16, 0, 16)