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. |
4th June 2016, 22:09 | #141 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
PadFFT v0.02, because of AddBorders() stuff in EDIT above:- http://www.mediafire.com/download/2b...2_20160604.zip
PadFFT cpp Code:
#include <windows.h> #include "avisynth.h" class PadFFT : public GenericVideoFilter { const int pad; const int padval; public: PadFFT(PClip _child,int _pad,int _padval, IScriptEnvironment* env); ~PadFFT(){}; PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env); }; PadFFT::PadFFT(PClip _child, int _pad, int _padval, IScriptEnvironment* env) : GenericVideoFilter(_child), pad(_pad), padval(_padval) { if (!vi.IsPlanar()) env->ThrowError("PadFFT: Requires Planar"); if((vi.pixel_type!=0xA0000008 && vi.pixel_type!=0xE0000000)) // not YV12 or Y8 env->ThrowError("PadFFT: ColorSpace unsupported in PadFFT, YV12 and Y8 Only\n"); if(pad < 0 || pad > 64 || (pad&0x01)) env->ThrowError("PadFFT: Pad 2 -> 64, even ONLY"); if(padval < 0 || padval > 255) env->ThrowError("PadFFT: PadVal 0 -> 255 ONLY"); vi.width = vi.width + 2*pad; vi.height = vi.height + 2*pad; } PVideoFrame __stdcall PadFFT::GetFrame(int n, IScriptEnvironment* env) { n = (n<0) ? 0 : (n>= vi.num_frames) ? vi.num_frames-1 : n; PVideoFrame src = child->GetFrame(n, env); const BYTE *srcp = src->GetReadPtr(PLANAR_Y); const int spitch = src->GetPitch(PLANAR_Y); PVideoFrame dst = env->NewVideoFrame(vi); BYTE *dstp = dst->GetWritePtr(PLANAR_Y); const int dpitch = dst->GetPitch(PLANAR_Y); const int dwid = vi.width; const int dhit = vi.height; const VideoInfo& ivi= child->GetVideoInfo(); const int swid = ivi.width; const int shit = ivi.height; const int val = padval; int x,y; for(y=pad ; --y>=0 ; ) { for(x=dwid ; --x>=0 ; ) dstp[x] = val; dstp += dpitch; } for(y=shit ; --y>=0 ; ) { BYTE *drp = dstp + pad + swid; for(x=pad ; --x>=0 ; ) drp[x] = val; drp -= swid; for(x=swid ; --x>=0 ; ) drp[x] = srcp[x]; for(x=pad ; --x>=0 ; ) dstp[x] = val; dstp += dpitch; srcp += spitch; } for(y=pad ; --y>=0 ; ) { for(x=dwid ; --x>=0 ; ) dstp[x] = val; dstp += dpitch; } const int RowSize = dst->GetRowSize(PLANAR_U); if(RowSize > 0) { // NOT Y8 : Chroma GreyScale const int upitch = dst->GetPitch(PLANAR_U); const int uhit = dst->GetHeight(PLANAR_U); BYTE *urp = dst->GetWritePtr(PLANAR_U); BYTE *vrp = dst->GetWritePtr(PLANAR_V); for(y=uhit ; --y>=0 ; ) { for(x=RowSize ; --x>=0 ; ) { urp[x] = 128; vrp[x] = 128; } urp += upitch; vrp += upitch; } } return dst; } AVSValue __cdecl Create_PadFFT(AVSValue args, void* user_data, IScriptEnvironment* env) { PClip child = args[0].AsClip(); int pad = args[1].AsInt(8); int padval = args[2].AsInt(0); return (pad != 0) ? new PadFFT(child,pad,padval,env) : child; // pad == 0, return original clip. } extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) { env->AddFunction("PadFFT","c[Pad]i[PadVal]i", Create_PadFFT, 0); return "`PadFFT' PadFFT plugin"; // A freeform name of the plugin. } Script to demo (not as any yet posted) Code:
Function cm(clip c, float "Weight", int "CBlur",Bool "TS", int "TR", int "TT", Bool "UpSz", Bool "ALevel", \ Int "p3R",Int "p3G",Int "p3B",Int "Pad") {# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 ###Source Must Be Progressive UpSz= Default (UpSz,False) ALevel=Default (ALevel,False) CBlur=Default (CBlur,18) Weight=Default (Weight,0.75) TS=Default (TS,True) TT=Default (TT,30) TR=Default (TR,10) p3R=Default(p3R,96) p3G=Default(p3G,76) p3B=Default(p3B,110) Pad = Default(Pad,0) c=c.converttoyv12().greyscale() c2=(ALevel==True) ? c.autolevels(12) : c c3=(UpSz==True) ? c2.sincresize(c2.Width*2,c2.Height*2) : c2 cpad=c3.PadFFT(PAD) r=cpad.F2Quiver(1,3,p3R,127,0,frad=16) g=cpad.F2Quiver(1,3,p3G,127,0,frad=16) b=cpad.F2Quiver(1,3,p3B,127,0,frad=16) mergergb(r,g,b) autolevels(12,autogamma=true) converttoyv12() coloryuv(autowhite=true) tweak(sat=10,interp=32) tweak(sat=10,interp=32) converttorgb() invert("R") #mergergb(showgreen,showred,showblue) # ??? is this intended (swap red and green) ??? converttoyv12() tweak(hue=90) medianblur(0,CBlur,CBlur) Crop(PAD,PAD,-PAD,-PAD) bilinearresize(width(c),height(c)) coloryuv(autowhite=true) (TS==True) ? temporalsoften(last,TR,0,TT) : last mergechroma(c,last,Weight) } Avisource("IceColdInAlex_VCD.avi").convertToYV12.Trim(176155,176155) Crop(0,0,Width/4*4,Height/4*4).convertToYV12 A=CM(Pad=0).RT_Subtitle("frad=16:Pad=0",align=5) B=CM(pad=8).RT_Subtitle("frad=16:Pad=8",align=5) C=CM(pad=16).RT_Subtitle("frad=16:Pad=16",align=5) D=CM(pad=32).RT_Subtitle("frad=16:Pad=32",align=5) StackVertical(StackHorizontal(A,B),StackHorizontal(C,D)) Return Last Looks to me like best padding is Frad / 2, so that total wrap around padding = Frad. With Pad=frad*2, we get lots of blue (well people been complaining bout lack of blue, now we got some ). EDIT: I think I'll mod to PadFFT(Int "Pad"=8,Int "PadVal"=0), where PadVal added so can set whatever value you like, might be useful for other things where AddBorders is un-obliging. EDIT: Change zip link above to v0.02, the PadVal arg added..
__________________
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; 18th September 2018 at 21:26. |
5th June 2016, 12:54 | #142 | Link |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
In addition to the requirement of padding by 2 * frad, it is to be ensured that the resulting frame width and heights are multiples of 2, 3 , 5, 7, 9, 11 for FFTW3.dll speed considerations. All this work is done internally by F2Quiver. Only thing the user is to ensure is frame width and heights are even numbers.( YUY or YV standards also requires this criterion to be met.)
|
5th June 2016, 13:57 | #143 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thanks VC.
Presumably, 3,5,7,9,11, are something to do with harmonics. Are there any caveats regarding PC/TV levels, (does F2Quiver differentiate). I tried setting PadVal=16 (and 64, 128 255 etc), and it does make some difference (even though it would seem that frequencies in the padded regions should be 0, ie no differences [except for initial transition at edge->pad]). EDIT: Where Pad=Frad*2 and PadVal=255, the blue edge turns a greenish. Where PadVal=128, even more greenish. Even though padding should logically be frad*2, (wraparound frad*4), for this peculiar application seems frame/2 is better choice, although that may perhaps result in grayscale edges (have not as yet played with other clips/images).
__________________
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; 6th June 2016 at 18:52. |
5th June 2016, 14:47 | #144 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Having relocated the removal of padding to just after F2Quiver (and MergeRGB), the amount of padding makes pretty much no visible difference.
It would seem that autolevels and autowhite were responsible for the differences, including the weird blue border (Doh). Code:
Function cm(clip c, float "Weight", int "CBlur",Bool "TS", int "TR", int "TT", Bool "UpSz", Bool "ALevel", \ Int "p3R",Int "p3G",Int "p3B",Int "Pad",Int "PadVal") {# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 UpSz= Default (UpSz,False) ALevel=Default (ALevel,False) CBlur=Default (CBlur,18) Weight=Default (Weight,0.75) TS=Default (TS,True) TT=Default (TT,30) TR=Default (TR,10) p3R=Default(p3R,96) p3G=Default(p3G,76) p3B=Default(p3B,110) Pad = Default(Pad,0) PadVal = Default(PadVal,0) c=c.converttoyv12().greyscale() c2=(ALevel==True) ? c.autolevels(12) : c c3=(UpSz==True) ? c2.sincresize(c2.Width*2,c2.Height*2) : c2 cpad=c3.PadFFT(PAD,PadVal) FRAD = 16 r=cpad.F2Quiver(1,3,p3R,127,0,frad=FRAD) g=cpad.F2Quiver(1,3,p3G,127,0,frad=FRAD) b=cpad.F2Quiver(1,3,p3B,127,0,frad=FRAD) mergergb(r,g,b) Crop(PAD,PAD,-PAD,-PAD) autolevels(12,autogamma=true) converttoyv12() coloryuv(autowhite=true) tweak(sat=10,interp=32) tweak(sat=10,interp=32) converttorgb() invert("R") converttoyv12() tweak(hue=90) medianblur(0,CBlur,CBlur) bilinearresize(width(c),height(c)) coloryuv(autowhite=true) (TS==True) ? temporalsoften(last,TR,0,TT) : last mergechroma(c,last,Weight) } #Imagesource("ShirleyEaton.jpg",end=0) crop(0,0,Width/2*2,Height/2*2).convertToYV12.BilinearResize(400,272) #Imagesource("DQ-Tools_Color.BMP",end=0).convertToYV12 #Imagesource("JP_Test_Color.BMP",end=0).convertToYV12 #Imagesource("harold-lloyd.jpg",end=0) crop(0,0,Width/2*2,Height/2*2).convertToYV12 #Imagesource("Original Football.jpg",end=0).convertToYV12 #Avisource("Doctor.avi").convertToYV12 #Avisource("Test1.avi").convertToYV12 Avisource("IceColdInAlex_VCD.avi").convertToYV12.Trim(176155,176155) #AviSource("BabelColour.avi") #AviSource("JurassicPark.avi").RoboCrop(Wmod=4,HMod=4,Laced=False).Trim(19109,22086).Trim(600,0) Crop(0,0,Width/4*4,Height/4*4).convertToYV12 PadVal=0 A=CM(Pad=0, PadVal=PadVal).RT_Subtitle("frad=16:Pad=0:PadVal=%d",PadVal,align=5) B=CM(pad=8, PadVal=PadVal).RT_Subtitle("frad=16:Pad=8;PadVal=%d",PadVal,align=5) C=CM(pad=16,PadVal=PadVal).RT_Subtitle("frad=16:Pad=16:PadVal=%d",PadVal,align=5) D=CM(pad=32,PadVal=PadVal).RT_Subtitle("frad=16:Pad=32:PadVal=%d",PadVal,align=5) StackVertical(StackHorizontal(A,B),StackHorizontal(C,D)) return Last
__________________
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 ??? |
9th June 2016, 13:18 | #145 | Link | ||
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
Quote:
Quote:
|
||
9th June 2016, 15:33 | #146 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thanks VC,
Quote:
Anyways, just been playing with the defreq version of Cmx7Mod (which some may prefer resultant colors), and for some reason suspected that Measure arg (unused in any version so far) might affect the crashing. So, after mod and 3 or 4 dozen attempts to crash script, was un-successful, so we seem to have found a fix for the crashing. @ Steve Zodiac, can you try with supplied below (or mod to your favorite version [just add the MEASURE=False, and ',measure=MEASURE' text to Defreq calls]) Do tell if it fixes the probs that you were having. Code:
Function Cmx7Mod(clip c, Float "Sat",Bool "DownSz",Int "Pad") { # (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 # Progressive Only : MUST be MOD 2 Width and Height, Otherwise will crop Mod 2 Sat = Default(Sat,0.33) # Default 0.33, 0.0 -> 1.0 DownSz = Default(DownSz,True) # Default true, True=Qwiker, False Precise Pad = (Default(Pad,2)+1)/2*2 # Round up next multiple of 2, Avoid green border. c = c.Crop(0,0,c.Width/2*2,c.Height/2*2).ConvertToYV12.GrayScale # Mod 2 smallc = (DownSz) ? c.sincresize((c.Width+3)/4*2,(c.Height+3)/4*2) : c # At least half size, Mod 2 Padc = (Pad>0) ? smallc.pointresize(smallc.Width+Pad*2,smallc.Height+Pad*2,-Pad,-Pad,smallc.Width+Pad*2,smallc.Height+Pad*2) : smallc MEASURE=False # Fix crashes r = Padc.defreq(fy=0,fx=39,sharp=100,dx=50,dy=50,cutx=0,cuty=0,Measure=MEASURE).Crop(Pad,Pad,-Pad,-Pad) r1 = Padc.defreq(fy=0,fx=47,sharp=100,dx=50,dy=50,cutx=0,cuty=0,Measure=MEASURE).Crop(Pad,Pad,-Pad,-Pad) g = Padc.defreq(fy=0,fx=37,sharp=100,dx=50,dy=50,cutx=0,cuty=0,Measure=MEASURE).Crop(Pad,Pad,-Pad,-Pad) g1 = Padc.defreq(fy=0,fx=85,sharp=100,dx=50,dy=50,cutx=0,cuty=0,Measure=MEASURE).Crop(Pad,Pad,-Pad,-Pad) b = Padc.defreq(fy=0,fx=65,sharp=100,dx=50,dy=50,cutx=0,cuty=0,Measure=MEASURE).Crop(Pad,Pad,-Pad,-Pad) b1 = Padc.defreq(fy=0,fx=59,sharp=100,dx=50,dy=50,cutx=0,cuty=0,fx2=100,fy2=0,Measure=MEASURE).Crop(Pad,Pad,-Pad,-Pad) x1 = merge(r,r1) y1 = merge(smallc.invert(),merge(g,g1)) z1 = merge(smallc.invert(),merge(b,b1)) y2 = overlay(smallc,y1,mode="multiply") z2 = overlay(smallc,z1,mode="multiply") x=mt_makediff(smallc,x1,Chroma="-128").converttorgb() # Full range RGB y=mt_makediff(smallc,y2,Chroma="-128").converttorgb() z=mt_makediff(smallc,z2,Chroma="-128").converttorgb() mergergb(x,y,z).ConvertToYV12 # RGB to YV12 TV Levels lanczos4resize(c.Width,c.Height) mergechroma(c,ColorYUV(autowhite=true)) return (Sat>0.0) ? mergechroma(c,tweak(sat=7.5,interp=32),Sat) : Last } Code:
measure - select fastest FFT method by speed measure (longer init stage) instead of simple estimation (default=true)
__________________
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; 9th June 2016 at 17:15. |
|
10th June 2016, 12:39 | #147 | Link |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
from the write up Defreq is equivalent to F2Quiver with point symmetry option and large degree (24). The difference still would be defreq selects the point coordinates as the maximum in window, while F2Quiver does not. One more point, if the search window encompasses either x = 0 or y = 0, then the point to be filtered will always be on the axis. The axial values are larger as they represent the DC value.
|
10th June 2016, 13:36 | #148 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
So would below be about same ?
Code:
MEASURE=false # Fix crashes p3R=39 # r=defreq(fy=0,fx=p3R,sharp=100,dx=50,dy=50,cutx=0,cuty=0,Measure=MEASURE) Code:
p3R=39 # EDIT: p3R=Int(39*127/100.0+0.5) MORPH = False # Default False(as yet untried) RESCALE= False # Default False FRAD = 16 # Default 32, Min Frame x:y dimension=16*8=128(incl padding) # Symetry=5(Point) : Type=5(Not Used) : xFreq=p3x(arg) : yFreq=0 : DegreeOfSharpness=24 : FRad=FRAD r=F2Quiver(5,5,p3R,0,24, morph=MORPH,rescale=RESCALE,frad=FRAD)
__________________
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; 10th June 2016 at 13:47. |
11th June 2016, 12:43 | #149 | Link | |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
Quote:
|
|
17th July 2016, 17:14 | #150 | Link |
Registered User
Join Date: Mar 2016
Location: Arkansas
Posts: 95
|
I found something from a while back. It doesn't internally greyscale and I'm using cmb(0,1,0,false) before.
Code:
function colorbyfreqx (clip c, float weight) { c=c.converttoyv12() v=c.gaussresize(256,256).levels(0,1.150,255,0,255).tweak(bright=0) v g=v.defreq(fy=0,fx=84,sharp=100,dx=50,dy=50,cutx=0,cuty=0,info=false) b=v.defreq(fy=0,fx=99,sharp=100,dx=50,dy=50,cutx=0,cuty=0,fx2=100,fy2=0) r=v.defreq(fy=0,fx=39,sharp=100,dx=50,dy=50,cutx=0,cuty=0) g1=v.defreq(fy=0,fx=49,sharp=100,dx=50,dy=50,cutx=0,cuty=0) b1=v.defreq(fy=0,fx=76,sharp=100,dx=50,dy=50,cutx=0,cuty=0,fx2=100,fy2=0) r1=v.defreq(fy=0,fx=47,sharp=100,dx=50,dy=50,cutx=0,cuty=0) x1=merge(r1,r) y1=merge(g,g1) z1=merge(b1,b) x=mt_makediff(v,x1,y=3).levels(0,0.3,255,0,255).converttorgb() y=mt_adddiff(v,y1,y=3).levels(0,1.5,226,0,255).converttorgb() z=mt_adddiff(v,z1,y=3).levels(0,.4,226,0,235).converttorgb() mergergb(x,y,z) converttoyv12() gaussresize(width(c),height(c)) ColorYUV(autogain=true,autowhite=true,showyuv=false) tweak(sat=2) mergechroma(c,last,weight) return last } Code:
Function CmBmod(clip v, Int "Speed", float "Weight", float "Merge" , int "CBlur", Bool "ALevel") { # (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 ###Source Must Be Progressive Speed= Default (Speed,1) # 0 = fast, 1 normal, 2 slow. Assert(Speed>=0 && Speed <=2, "Speed, 1 <= Speed <= 2") Weight=Float(Default (Weight,1)) Merge=Float(Default (Merge,.25)) CBlur = Default (CBlur,20) ### Very dependent on source ALevel= Default (ALevel,False) LRad = Speed < 2 ? 4 : 12 # v = v.Crop(0,0,v.Width/2*2,v.Height/2*2).ConvertToYV12.GreyScale.colorbyfreqx(1) # Mod 2, must be same as cmx7mod returns c=(ALevel==True) ? v.autolevels(12) : v cpad = Speed < 2 ? c.bilinearresize(400,400) : c g=cpad.F2Quiver(1,3,96, 127,0,frad=24) b=cpad.F2Quiver(1,3,110,127,0,frad=24) r=cpad.F2Quiver(1,3,76, 127,0,frad=24) mergergb(r,g,b) autolevels(LRad,autogamma=true) converttoyv12() coloryuv(autowhite=true) tweak(sat=10,interp=32).tweak(sat=10,interp=32) converttorgb() invert("G") mergergb(showgreen,showred,showblue) converttoyv12() tweak(hue=90) converttoyv12() medianblur(0,CBlur,CBlur) bilinearresize(width(c),height(c)) coloryuv(autowhite=true) # cc=Speed > 0 ? c.cmx7mod() : c # mergechroma(cc,Last,Weight) Speed > 0 ? Last.Merge(c.colorbyfreqx(1).gblur(2),Merge) : Last mergechroma(c.greyscale(),Last,Weight) } Edit: Examples, at default with the above script. Edit: Newly updated CMB. Last edited by MWilson; 22nd July 2016 at 00:28. Reason: Update - Added Merge :) |
21st July 2016, 03:43 | #152 | Link |
Registered User
Join Date: Mar 2016
Location: Arkansas
Posts: 95
|
Edit: Above script at post 151 is much better.
Full rewrite. ChromaJig v1 (or is it a million? ) Requirements: defreq Masktools MedianBlur GamMac Optional: F2Quiver Code:
function cm1 (clip c, float weight) { c=c.converttoyv12() v=c.gaussresize(256,256)##.unfilter(0,100).unfilter(100,100) v g=v.defreq(fy=-100,fx=100,sharp=0,dx=50,dy=50,cutx=0,cuty=0,info=false) b=v.defreq(fy=-100,fx=0,sharp=0,dx=50,dy=50,cutx=0,cuty=0,fx2=0,fy2=0) r=v.defreq(fy=0,fx=36,sharp=0,dx=50,dy=50,cutx=0,cuty=0) g1=v.defreq(fy=-50,fx=49,sharp=0,dx=50,dy=50,cutx=0,cuty=0) b1=v.defreq(fy=0,fx=49,sharp=0,dx=50,dy=50,cutx=0,cuty=0,fx2=0,fy2=0) r1=v.defreq(fy=-50,fx=34,sharp=0,dx=50.0,dy=50.0,cutx=0,cuty=0) x1=merge(r1,r) y1=merge(g,g1) z1=merge(b,b1) x=mt_makediff(v,x1,y=3).converttorgb() y=mt_makediff(v,y1,y=3).converttorgb() z=mt_makediff(v,z1,y=3).converttorgb() mergergb(x,y,z) converttoyv12() coloryuv(autowhite=true) gaussresize(width(c),height(c)) ColorYUV(autogain=true,autowhite=false) tweak(sat=3.5,interp=32) invert("UV") swapuv() medianblur(0,5,5) mergechroma(c,last,weight) return last } Code:
function chromajig(clip g, float weight) { g=g.greyscale().converttoyv12() converttorgb(g) rgbadjust(g=0) invert() cm1(1) invert("Y") converttorgb() rgbadjust(r=0,b=0) merge(g.cm1(1),last.converttoyv12()) converttorgb() gammac(-3) converttoyv12() coloryuv(cont_u=220,cont_v=220) mergechroma(g,last,weight) return last } Edit: Removed last line. - Added CMJ. Edit: CMJ Removed. Last edited by MWilson; 5th August 2016 at 11:30. Reason: cork_OS |
24th July 2016, 09:29 | #153 | Link |
Registered User
Join Date: Mar 2016
Location: Arkansas
Posts: 95
|
I'm finding some uses of cmfullshift out in the wild.
Large portions of Metropolis. https://www.youtube.com/watch?v=AbH1cQUnh7U The transformation scene. https://www.youtube.com/watch?v=E99Gb7N2oIk Deadly Earnest. https://www.youtube.com/watch?v=6XxooEg9qxo Because I modified the first post, omitting the script, here it is warts and all. Code:
function cmfull(clip v2) { v2=v2.greyscale() width=v2.width/2 height=v2.height/2 v=v2.sincresize(256,256).greyscale().addborders(width,height,width,height) g=v.defreq(fy=0,fx=59,sharp=100,dx=50,dy=50,cutx=0,cuty=0,info=false) b=v.defreq(fy=0,fx=65,sharp=100,dx=50,dy=50,cutx=0,cuty=0,info=false) r=v.defreq(fy=0,fx=39,sharp=100,dx=50,dy=50,cutx=0,cuty=0) g1=v.defreq(fy=0,fx=51,sharp=100,dx=50,dy=50,cutx=0,cuty=0) b1=v.defreq(fy=0,fx=59,sharp=100,dx=50,dy=50,cutx=0,cuty=0,fx2=100,fy2=0) r1=v.defreq(fy=0,fx=47,sharp=100,dx=50,dy=50,cutx=0,cuty=0) x1=merge(r1,r) y1=merge(g,g1) z1=merge(b1,b1) z2=overlay(v,z1,0,0,mode="multiply") y2=overlay(v,y1,mode="multiply") x2=overlay(v,x1,mode="multiply") x=mt_makediff(v,x1).converttorgb().crop(width,height,-width,-height) y=mt_makediff(v,y2).converttorgb().crop(width,height,-width,-height) z=mt_makediff(v,z2).converttorgb().crop(width,height,-width,-height) mergergb(x,y,z) lanczos4resize(width(v2),height(v2)) converttoyv12() ColorYUV(autogain=false,autowhite=true) tweak(sat=1) ax=last.sincresize(width(v2),height(v2)) bx=mergechroma(v2.greyscale(),ax,1) coloryuv(bx,autowhite=true) mergechroma(merge(last,last.invert("Y").invert("UV")),last,1) mergechroma(v2.greyscale(),last,1) return last } Code:
function cmfullshift (clip v) { v=v.converttoyv12().greyscale()##only addition cmfull(v) u=last.utoy() v2=last.vtoy() stackhorizontal(u,v2) ytouv(u,v2,v) tweak(sat=3.5,interp=32) coloryuv(autowhite=true) u3=repair(v.lanczosresize(width(v)/2,height(v)/2),u) v3=repair(v.lanczosresize(width(v)/2,height(v)/2),v2) ytouv(u3,v3,v) tweak(sat=7.5,interp=32) mergechroma(v,last,.33) coloryuv(autowhite=true) return last } Last edited by MWilson; 24th July 2016 at 09:51. Reason: Added Greyscale Call |
24th July 2016, 16:48 | #157 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
Interesting VideoHelp thread: Coloring Grey-Scale Image: Another triumph of deep learning AI
|
24th July 2016, 17:31 | #158 | Link |
Registered User
Join Date: Mar 2016
Location: Arkansas
Posts: 95
|
Thanks for the link Reel.Deel
Code:
function cmfullshift2 (clip v) { v=v.converttoyv12() cmfull(v) u=last.utoy() v2=last.vtoy() ##stackhorizontal(u,v2) ytouv(u,v2,v) tweak(sat=3.5,interp=32) coloryuv(autowhite=true) ##u3=repair(v.lanczosresize(width(v)/2,height(v)/2),u) ##v3=repair(v.lanczosresize(width(v)/2,height(v)/2),v2) ytouv(u,v2,v) tweak(sat=7.5,interp=32) mergechroma(v,last,.33) coloryuv(autowhite=true) ##vtoy() u4=mt_merge(u.spline36resize(width(v),height(v)),u.invert().spline36resize(width(v),height(v)),v).lanczosresize(width(v)/2,height(v)/2) v4=mt_merge(v2.spline36resize(width(v),height(v)),v2.invert().spline36resize(width(v),height(v)),v).lanczosresize(width(v)/2,height(v)/2) ytouv(u4,v4,v) tweak(sat=7.5) mergechroma(v,last,.75) return last } Code:
function cmshifter (clip y, float weight) { y=y.converttoyv12().greyscale() gaussresize(y,192,108) cmfullshift2() coloryuv(cont_u=-96,cont_v=-96) hqdn3d(8,16,0,4.5) tweak(sat=7.5,interp=32) gaussresize(width(y),height(y)) mergechroma(y.chromajig(1),last,.33) mergechroma(y,last,weight) return last } Hope you guys like it! Edit: Comparison Pic - cmfullshift (left) / cmshifter (right) ] Last edited by MWilson; 24th July 2016 at 17:53. Reason: Added Pic |
29th July 2016, 05:37 | #159 | Link |
Registered User
Join Date: Mar 2016
Location: Arkansas
Posts: 95
|
ChromaJig v1.6a - 8/15/2016
Requirements: Defreq Masktools2 HQDN3d Code:
function fc1(clip v,float weight) {# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 v=v.greyscale().converttoyv12() af=v.defreq(fy=-.29,fx=.29,sharp=0,dx=.50,dy=.50,fy2=-.88,fx2=.88,dx2=.50,dy2=.50) av=v.defreq(fy=-29,fx=29,sharp=0,dx=50,dy=50,fy2=-88,fx2=88,dx2=50,dy2=50) ax=v.defreq(fy2=-88,fx2=88,sharp=0,dx2=50,dy2=50,fy=-58,fx=58,dx=0,dy=50) a=mt_makediff(merge(af,av),v).converttorgb().converttoyv12() m1=ytouv(av,a).converttoyv12().sincresize(width(v),height(v)) y2=ytouv(m1.invert(),av).converttoyv12().sincresize(width(v),height(v)) merge(m1,y2,.35) converttoyv12(last) coloryuv(autowhite=true) tweak(sat=5,maxsat=59.5,interp=20) merge(v.invert().converttoyv12(),last.converttoyv12()) converttorgb() sb=showblue(last).invert() sr=showred(last).invert() sg=showgreen(last).invert() mergergb(sb,sr,sg) ConvertToYV12() sx=last.converttorgb().invert("G").converttoyv12() sy=last.converttoyv12() mergechroma(sy,sx,.50).converttoyv12() merge(last,v.invert().converttoyv12()).invert("UV").swapuv() tweak(sat=7.5,maxsat=59.5,interp=20) mergechroma(v.converttoyv12(),last,weight) coloryuv(autowhite=true) converttorgb24() return last } function fc2(clip v) {# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 v=v.converttoyv12() merge(v.invert().fc1(1).converttoyv12().coloryuv(cont_u=-128,cont_v=-128),v.fc1(1).converttoyv12()) converttoyv12() tweak(sat=5,interp=32) mergechroma(v,last.awarpsharp2(depth=48,chroma=4),.333) return last } function chromajig(clip y) {# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364 y=y.greyscale().converttoyv12() y1=y.gaussresize(72,48) y1 fc2() hqdn3d(0,28,0,4.5) gaussresize(width(y),height(y)) subtract(y.fc2(),last) mergeluma(y) return last } Edit: Minor Changes Edit: New - Version 1.5b - Removed Link to video Edit: New - Version 1.5a - Removed Extra Calls - Output is the same Edit: Remove Old Pics Edit: Link to script and all requirements :ChromaJig Last edited by MWilson; 15th August 2016 at 21:45. Reason: Update |
15th August 2016, 21:35 | #160 | Link |
Registered User
Join Date: Mar 2016
Location: Arkansas
Posts: 95
|
I apologize for the last script. It wasn't even working for me
I've posted a new version (3 scripts in 1), but I'm having trouble getting much further than this. Any ideas would be appreciated. I hope this can be helpful. I'm taking a break
__________________
ChromaJig |
Tags |
automated, color, colorization |
Thread Tools | Search this Thread |
Display Modes | |
|
|