View Single Post
Old 25th December 2004, 22:21   #1  |  Link
cwolf
Registered User
 
Join Date: Oct 2003
Location: Porto Alegre, Brazil
Posts: 13
Applyrange calling function with global

My intention is to get rid of flashes in a show ("David Gilmour in concert"). After some experiments that didn't satisfy me, I'm trying Depan to fix the affected fields before deinterlacing with Alignfields. This show has a lot of flashes that I noted down, and will be fixed by calling a function. Usually 3 fields are affected.
Code:
function flash (clip f, int "first", int "qty") {
global first = first     # first affected field of the range
global qty   = qty       # number of affected fields to fix
# It copies the last and next good fields to the previous and
# current ones so that Depan can do its job.
scriptclip(f,""" x= freezeframe(current_frame -1,current_frame -1,first -1)
                 y= x.freezeframe(current_frame,current_frame,first + qty)
                 d= y.DePanEstimate(improve=true,zoommax=1.4)
                 offs= 1. / ( qty + 1.) * (current_frame - first + 1.)
                 DePan(x, data=d, offset=offs,info=true)
                 subtitle (" current_frame="+string(current_frame)+
  \                        " first="+string(first)+
  \                        " offset="+string(offs),
  \                        " qty="+string(qty),y=200)
              """)
}
avisource("f:\david gilmour\show.avi",audio=false)
assumetff()
###alignfields(fps2=true,mode=0)
ibob()
showframenumber(scroll=true)
applyrange (157177,157179,"flash",157177,3)
applyrange (37115,37117,"flash",37115,3)
applyrange (6713,6715,"flash",6713,4)
Now the goddamn problem :
the variables first and qty keep the value from the last "applyrange" of the script! For instance, in the sequence above the value for "first" will be 6713 for all instances of applyrange. The only way I know for passing the parameters to the scriptclip is this one. I appreciate if someone could think of a workaround. There are about 100 flashes to clean.
PS: I suggest comment Depan in order to run this script, because the value for "offset" will be absurd (30093 for the range 157177).
__________________
Athlon XP2400;a7v333;768mb PC2100;Seagate 80Gb;AIW8500;DVD
musica do mundo - my favourite radio program, check it!
cwolf is offline   Reply With Quote