logo Sign In

Post #499590

Author
RU.08
Parent topic
2006 SE/GOUT hybrid script project - UPDATE: 05-24-11 see 1st & 2nd post...
Link to post in topic
https://originaltrilogy.com/post/id/499590/action/topic#499590
Date created
16-May-2011, 2:39 AM

Okay, here we are (at last). Now, hopefully these screencaps line up correctly to your NTSC frame numbering (I've cliped 12 frames off the start of the video in an attempt to sync it)...

These frame numbers are from VDubMod, the first frame in VDub is 0 (not 1).

Frame 690, first frame of "Star Wars" logo:
http://img820.imageshack.us/img820/9879/690c.jpg

Frame 81507, first frame of Alderaan in the shot where it is destroyed:
http://img535.imageshack.us/img535/4291/81507.jpg

Frame 168773 disolving to credits...
http://img844.imageshack.us/img844/5161/168773.jpg

And finally, I've completed playing with the g-force script, you'll notice that for now subtitles have been completly removed, and the AA is no longer performed (as it can be done in the next stage when combining the gout+se), the reason I removed it for now is because if I resized it to anamorphic after the AA filter now I will be increasing the "uncompressed" file size by like if anyone notices any glaring errors please point it out to me before I spend 48hrs encoding it!

#######################################################################################
#################### GOUT Filter By G-force V.15.00 USE ONLY ON ANH ###################
#################### ______________________________________________ ###################
#################### Modified for PAL by RU.08 ###################
#######################################################################################

# video source
Mpeg2Source("SW_GOUT.d2v") # <-----Set path

# Trim the first 12 frames to match the NTSC frames
# (don't worry it's easy enough to add back 11 frames of black later if needed)
Trim(11,0)

# cut off all black bars (no longer Mod16!)
Crop(0,124,0,-126,align=true)

# I've removed the levels for now, they can be done later.
# Plus there was really no need to do it first in the script.

#black level, gamma, hue
#Levels(10,1.08,255,0,255).Tweak(hue=-3)

# image stabilization and etc...
# de-ring
pm = last
h4 = pm.RemoveGrain(4,-1)
Median1(pm, MT_Convolution(horizontal="1",vertical=" 0 0 0 1 0 .1 -.1" ,chroma="copy first"),h4,Chroma="copy first")
Median1(last,MT_Convolution(horizontal="1",vertical="0 0 0 0 1 0 0 .1 -.1",chroma="copy first"),h4,Chroma="copy first")
Contra(last,pm)

# global stabalization
DeShaker()

# local motion stabilization/degrain stage
source = last
sigma = 5
fft = source.FFT3dFilter(sigma=sigma,sigma2=sigma*.75,sigma3=sigma*.5,sigma4=sigma*.25)
fft.Clense(grey=true)
filt = Contra(last.Repair(fft,2,-1),last).MergeChroma(source)
idx1 = filt.MSuper(pel=2,sharp=1)
bw_vec1 = MAnalyse(idx1,isb=true, delta=1,overlap=4,plevel=0,dct=1)
fw_vec1 = MAnalyse(idx1,isb=false,delta=1,overlap=4,plevel=0,dct=1)
idx2 = source.MSuper(pel=2,sharp=1,levels=1,chroma=false)
pcorr = source.MDegrain1(idx2,bw_vec1,fw_vec1,thSAD=800,thSCD1=150,thSCD2=75,plane=0)
corr1 = Median1(source,pcorr,filt,chroma="copy first")
idx3 = corr1.MSuper(pel=2,sharp=1,levels=1,chroma=false)
corr1.MDegrain1(idx3,bw_vec1,fw_vec1,thSAD=400,thSCD1=150,thSCD2=75,plane=0)
Median1(corr1,last,filt,chroma="copy first")
Contra(last,source)

########## restore stars
prest = last
prest.MT_Binarize(threshold=20,upper=true,chroma="copy first").MT_Expand(chroma="copy first")
MT_Merge(prest,source,last,chroma="copy first")

########## additional "Lucasfilm" and "Along time ago..." stabilization
prest.Trim(0,265)++prest.Trim(266,687).TemporalSoften(3,255,255,25,2)++last.Trim(688,0)

# I've removed the anti-aliasing part for now (and hence resizing), they can be done later.

########## anti-alias
#NNEDI2(dh=true, field=0)
#NNEDI2(dh=false,field=1)

# Resize (to anamorphic PAL).
#Spline16Resize(720,432)

################# End of script, functions follow... ####################

Function Contra(clip denoised, clip orig)
{# re-write of Didée's contra sharpening routine from TemporalDegrain.avs

rg12d = MT_MakeDiff(denoised,denoised.RemoveGrain(12,-1))
rg12d.Repair(MT_MakeDiff(orig,denoised),9,-1).MT_LUTxy(rg12d,"x 128 - abs y 128 - abs < x y ?")

denoised.MT_AddDiff(last,chroma="copy first")

Return(last)
}

Function Median1(clip input_1, clip input_2, clip input_3, string "chroma")
{# median of 3 clips from Helpers.avs by G-force

chroma = Default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"

Interleave(input_1,input_2,input_3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
SelectEvery(3,1)

chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last

Return(last)
}

Function DeShaker(clip orig)
{# Image stabalization stage, rewritten as a function by RU.08
temp = Repair(orig.TemporalSoften(3,255,255,25,2),orig)
source = Interleave(temp,orig)
smotion = DePanEstimate(source,trust=0,dxmax=1,dymax=0)
Return DePan(source,data=smotion,offset=-1,mirror=15).SelectEvery(2,0)
}