###### ## ## Composite v0.2 by mf ## ## Creates dotcrawl and rainbows. With configurable strength. ## ## function GCTM(clip input) { str = "x 128 - abs 2.004 *" input.yv12lut( str, str, str, U=3, V=3 ) } function Composite(clip input, int "strength") { strength = Default(strength, 230) BlankClip(pixel_type="yv12", length=input.framecount, width=Ceil(input.width/4), \ height=Ceil(input.height/4)) black = last black.Invert() white = last Interleave(black, white) AssumeFieldBased().Weave() TurnLeft() Interleave(last, last.Invert()) AssumeFieldBased().Weave() TurnRight() PointResize(last.width*2, last.height*2) Interleave(last, last.Invert()) Crop(0, 0, input.width, input.height) DotCrawl = last input.EdgeMask(3, 255, 255, 255, "sobel", Y=3, V=1, U=1).Levels(0, 2, 45, 0, 255) \ .Inflate().Inflate().Inflate().Inflate().Levels(0, 1, 100, 0, 255).Blur(1) \ .Inflate().Inflate().Blur(1).Blur(1).Blur(1).Blur(1).Greyscale() input Subtract(last, last.Blur(1, 0)) GCTM().Greyscale() Levels(0, 2, 45, 0, 255).Blur(1, 0).Blur(1, 0) Levels(0, 1, 100, 0, 255).Blur(1, 0).Blur(1, 0) Levels(0, 1, 100, 0, 255).Blur(1, 0).Blur(1, 0) ColorYUV(levels="TV->PC") ymask = last input.UToY().LanczosResize(last.width, last.height) unorm = last input.UToY().LanczosResize(last.width, last.height) vnorm = last BlankClip(unorm, color=$808080) grey = last YV12Subtract(grey, unorm.Invert(), tol=0).Levels(0, 1.5, 128, 0, 255) ulight = last YV12Subtract(grey, vnorm.Invert(), tol=0).Levels(0, 1.5, 128, 0, 255) vlight = last #Overlay(ulight, vlight, mode="lighten") YV12Layer(ulight, vlight, "mul", 128) Levels(0, 1, 255, 0, strength).ColorYUV(levels="TV->PC") satmask = last MaskedMerge(input, dotcrawl, ymask) edgedots = last MaskedMerge(input, edgedots, satmask) dotcrawled = last input Interleave(BlankClip(input, width=Int(Float(input.width/12)/4.0)*4, height=Int(Float(input.height/24)/4.0)*4, length=input.framecount*2, color=$FF0000, pixel_type="YUY2"), BlankClip(input, width=Int(Float(input.width/12)/4.0)*4, height=Int(Float(input.height/24)/4.0)*4, length=input.framecount*2, color=$00FF00, pixel_type="YUY2")) one = last Interleave(BlankClip(input, width=Int(Float(input.width/12)/4.0)*4, height=Int(Float(input.height/24)/4.0)*4, length=input.framecount*2, color=$0000FF, pixel_type="YUY2"), BlankClip(input, width=Int(Float(input.width/12)/4.0)*4, height=Int(Float(input.height/24)/4.0)*4, length=input.framecount*2, color=$00FF00, pixel_type="YUY2")) two = last Interleave(BlankClip(input, width=Int(Float(input.width/12)/4.0)*4, height=Int(Float(input.height/24)/4.0)*4, length=input.framecount*2, color=$00FF00, pixel_type="YUY2"), BlankClip(input, width=Int(Float(input.width/12)/4.0)*4, height=Int(Float(input.height/24)/4.0)*4, length=input.framecount*2, color=$0000FF, pixel_type="YUY2")) three = last Interleave(Interleave(one, two, three).Weave(frames=3).SelectEven(), Interleave(two, three, one).Weave(frames=3).SelectEven()) BilinearResize(input.width, input.height) gradient = last u = Overlay(input.SeparateFields().Invert().Greyscale().LanczosResize(width/2, height/4), gradient.ConvertToYV12().UToY().SeparateFields(), mode="exclusion") v = Overlay(input.SeparateFields().Invert().Greyscale().LanczosResize(width/2, height/4), gradient.ConvertToYV12().VToY().SeparateFields(), mode="exclusion") YToUV(u, v, input.SeparateFields()) AssumeFieldBased().Weave() rainbows = last Subtract(input, input.YV12Convolution("1 1 1 1 1", "0 0 1 0 0")) GCTM().Greyscale() Levels(0, 1.5, 80, 0, 255) Blur(1, 0) ColorYUV(levels="TV->PC") mask = last Overlay(input, rainbows, mask=mask) rainbowed = last MergeLuma(dotcrawled) }