Jenyok Member 390/596 ответов 19 лет на iXBT, с ноября 2005 Чаще пишет РІ "Видеозахват" (63%) Россия, Russia, Moscow
|
Интерполяция кадров. . 001 | # function InterpolateFrames(clip clp, int FrameNumber, int FrameCount) using MFlowInter(), GScript |
002 | # function InterpolateFrames2(clip clp, int FrameNumber, int FrameCount) using MFlowInter(), MRecalculate(), GScript |
004 | LoadPlugin( "C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll" ) |
005 | LoadPlugin( "C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GSCRIPT_11\gscript.dll" ) |
008 | # InterpolateFrames() function ... |
010 | # FrameNumber is number of the 1-st frame in Source that needs replacing. |
011 | # FrameCount is total number of frames to replace. |
012 | # InterpolateFrames(101, 5) would replace 101, 102, 103, 104, 105, |
013 | # by using MFlowInter() interpolation. |
015 | function InterpolateFrames(clip clp, int FrameNumber, int FrameCount) |
020 | hpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
021 | vpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
023 | sharp = 2 # default =2 !!! |
024 | rfilter = 4 # default =2 |
025 | chroma = true # default =true |
026 | isse = true # default =true |
027 | planar = false # default =false |
028 | levels = 0 # default =0 |
033 | blkh = 32 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
034 | blkv = 32 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
035 | overlap = 4 # Maybe 2, 4, 8, 16, !!! maybe blkh/2 or litle !!! Change this constant for best tuning !!! |
036 | overlapV = 4 # Maybe 2, 4, 8, 16, !!! maybe blkv/2 or litle !!! Change this constant for best tuning !!! |
037 | search = 3 # default =4 !!! DO NOT CHANGE =3 |
038 | searchparam = 16 # default =2 !!! DO NOT CHANGE =16 |
040 | plevel = 2 # default =0 |
041 | badrange = (-24) # default =24 |
042 | badsad = 10000 # default =10000 |
043 | divide = 0 # default =0 |
044 | sadx264 = 0 # default =0 |
045 | truemotion = true # default =true |
047 | lambda = (truemotion == false) ? 0 : (1000 * blkh * blkv / 64) # default =0 truemotion=false, default =1000*blksize*blksizeV/64 truemotion=true |
048 | lsad = (truemotion == false) ? 400 : 1200 # default =400 truemotion=false, default =1200 truemotion=true |
049 | pnew = (truemotion == false) ? 0 : 50 # default =0 truemotion=false, default =50 truemotion=true |
050 | pzero = pnew # default pzero=pnew |
055 | thSCD1 = 800 # default =400 !!! DO NOT CHANGE =800 |
056 | thSCD2 = 130 # default =130 |
057 | iml = 70 # default =100 |
058 | blend = true # default =true |
061 | # Here is code of function ... |
063 | # Restore bad frames with interpolation with MFlowInter |
066 | # function MSuper(clip, int "hpad" , int "vpad" , int "pel" , int "levels" , bool "chroma" , \ |
067 | # int "sharp" , int "rfilter" , clip "pelclip" , bool "isse" , bool "planar" ) |
069 | super = MSuper(clp, \ |
080 | # function MAnalyse(clip super, int "blksize" , int "blksizeV" , int "level" , int "search" , int "searchparam" , \ |
081 | # int "pelsearch" , bool "isb" , int "lambda" , bool "chroma" , int "delta" , bool "truemotion" , \ |
082 | # int "lsad" , int "plevel" , bool "global" , int "pnew" , int "pzero" , int "pglobal" , int "overlap" , \ |
083 | # int "overlapV" , string "outfile" , int "dct" , int "divide" , int "sadx264" , int "badSAD" , \ |
084 | # int "badrange" , bool "isse" , int "full" , bool "meander" , bool "temporal" ) |
086 | backward1 = MAnalyse(super, \ |
087 | delta = (FrameCount + 1), \ |
092 | overlapV = overlapV, \ |
094 | searchparam = searchparam, \ |
098 | truemotion = truemotion, \ |
107 | badrange = badrange, \ |
116 | # function MAnalyse(clip super, int "blksize" , int "blksizeV" , int "level" , int "search" , int "searchparam" , \ |
117 | # int "pelsearch" , bool "isb" , int "lambda" , bool "chroma" , int "delta" , bool "truemotion" , \ |
118 | # int "lsad" , int "plevel" , bool "global" , int "pnew" , int "pzero" , int "pglobal" , int "overlap" , \ |
119 | # int "overlapV" , string "outfile" , int "dct" , int "divide" , int "sadx264" , int "badSAD" , \ |
120 | # int "badrange" , bool "isse" , int "full" , bool "meander" , bool "temporal" ) |
122 | forward1 = MAnalyse(super, \ |
123 | delta = (FrameCount + 1), \ |
128 | overlapV = overlapV, \ |
130 | searchparam = searchparam, \ |
134 | truemotion = truemotion, \ |
143 | badrange = badrange, \ |
153 | if (FrameCount == 1) { |
155 | # MFlowInter(clip source, clip super, clip mvbw, clip mvfw, float "time" , float "mL" , \ |
156 | # bool "blend" , int "thSCD1" , int "thSCD2" , bool "isse" , bool "planar" ) |
158 | inter2 = MFlowInter(clp, \ |
170 | inter = inter2.Trim(FrameNumber, -1) |
173 | # Fill an Inter variable with the MFlowInter() clips with different times |
174 | # Times are calculated in each step |
176 | for (i=0, FrameCount-1) { |
177 | itime = (100.0 / Float(FrameCount + 1)) * Float(i + 1) |
179 | # MFlowInter(clip source, clip super, clip mvbw, clip mvfw, float "time" , float "mL" , \ |
180 | # bool "blend" , int "thSCD1" , int "thSCD2" , bool "isse" , bool "planar" ) |
182 | inter2 = MFlowInter(clp, \ |
195 | inter = inter2.Trim(FrameNumber, -1) |
198 | inter = inter ++ inter2.Trim(FrameNumber, -1) |
202 | "" ") # End of GScript () |
204 | return (clp.trim(0, FrameNumber - 1) ++ inter ++ clp.trim(FrameNumber + FrameCount, 0)) |
210 | # InterpolateFrames2() function ... |
212 | # FrameNumber is number of the 1-st frame in Source that needs replacing. |
213 | # FrameCount is total number of frames to replace. |
214 | # InterpolateFrames2(101, 5) would replace 101, 102, 103, 104, 105, |
215 | # by using MRecalculate() and MFlowInter() interpolation. |
217 | function InterpolateFrames2(clip clp, int FrameNumber, int FrameCount) |
222 | hpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
223 | vpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
225 | sharp = 2 # default =2 !!! |
226 | rfilter = 4 # default =2 |
227 | chroma = true # default =true |
228 | isse = true # default =true |
229 | planar = false # default =false |
230 | levels = 0 # default =0 |
235 | blkh = 32 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
236 | blkv = 32 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
237 | overlap = 4 # Maybe 2, 4, 8, 16, !!! maybe blkh/2 or litle !!! Change this constant for best tuning !!! |
238 | overlapV = 4 # Maybe 2, 4, 8, 16, !!! maybe blkv/2 or litle !!! Change this constant for best tuning !!! |
239 | search = 3 # default =4 !!! DO NOT CHANGE =3 |
240 | searchparam = 16 # default =2 !!! DO NOT CHANGE =16 |
242 | plevel = 2 # default =0 |
243 | badrange = (-24) # default =24 |
244 | badsad = 10000 # default =10000 |
245 | divide = 0 # default =0 |
246 | sadx264 = 0 # default =0 |
247 | truemotion = true # default =true |
249 | lambda = (truemotion == false) ? 0 : (1000 * blkh * blkv / 64) # default =0 truemotion=false, default =1000*blksize*blksizeV/64 truemotion=true |
250 | lsad = (truemotion == false) ? 400 : 1200 # default =400 truemotion=false, default =1200 truemotion=true |
251 | pnew = (truemotion == false) ? 0 : 50 # default =0 truemotion=false, default =50 truemotion=true |
252 | pzero = pnew # default pzero=pnew |
257 | blkhR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
258 | blkvR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!! |
259 | overlapR = 4 # Maybe 2, 4, 8, 16, !!! maybe blkhR/2 or litle !!! Change this constant for best tuning !!! |
260 | overlapVR = 4 # Maybe 2, 4, 8, 16, !!! maybe blkvR/2 or litle !!! Change this constant for best tuning !!! |
261 | searchR = 3 # default =4 |
262 | searchparamR = 1 # default =2 |
263 | thSAD = 400 # default =200 !!! DO NOT CHANGE =400 |
265 | lambdaR = (truemotion == false) ? 0 : (1000 * blkhR * blkvR / 64) # default =0 truemotion=false, default =1000*blksize*blksizeV/64 truemotion=true |
270 | thSCD1 = 800 # default =400 !!! DO NOT CHANGE =800 |
271 | thSCD2 = 130 # default =130 |
272 | iml = 70 # default =100 |
273 | blend = true # default =true |
276 | # Here is code of function ... |
278 | # Restore bad frames with interpolation with MFlowInter |
281 | # function MSuper(clip, int "hpad" , int "vpad" , int "pel" , int "levels" , bool "chroma" , \ |
282 | # int "sharp" , int "rfilter" , clip "pelclip" , bool "isse" , bool "planar" ) |
284 | super = MSuper(clp, \ |
295 | # function MAnalyse(clip super, int "blksize" , int "blksizeV" , int "level" , int "search" , int "searchparam" , \ |
296 | # int "pelsearch" , bool "isb" , int "lambda" , bool "chroma" , int "delta" , bool "truemotion" , \ |
297 | # int "lsad" , int "plevel" , bool "global" , int "pnew" , int "pzero" , int "pglobal" , int "overlap" , \ |
298 | # int "overlapV" , string "outfile" , int "dct" , int "divide" , int "sadx264" , int "badSAD" , \ |
299 | # int "badrange" , bool "isse" , int "full" , bool "meander" , bool "temporal" ) |
301 | backward1 = MAnalyse(super, \ |
302 | delta = (FrameCount + 1), \ |
307 | overlapV = overlapV, \ |
309 | searchparam = searchparam, \ |
313 | truemotion = truemotion, \ |
322 | badrange = badrange, \ |
331 | # function MAnalyse(clip super, int "blksize" , int "blksizeV" , int "level" , int "search" , int "searchparam" , \ |
332 | # int "pelsearch" , bool "isb" , int "lambda" , bool "chroma" , int "delta" , bool "truemotion" , \ |
333 | # int "lsad" , int "plevel" , bool "global" , int "pnew" , int "pzero" , int "pglobal" , int "overlap" , \ |
334 | # int "overlapV" , string "outfile" , int "dct" , int "divide" , int "sadx264" , int "badSAD" , \ |
335 | # int "badrange" , bool "isse" , int "full" , bool "meander" , bool "temporal" ) |
337 | forward1 = MAnalyse(super, \ |
338 | delta = (FrameCount + 1), \ |
343 | overlapV = overlapV, \ |
345 | searchparam = searchparam, \ |
349 | truemotion = truemotion, \ |
358 | badrange = badrange, \ |
367 | # MRecalculate(clip super, clip vectors, int "thSAD" , int "smooth" , int "blksize" , int "blksizeV" , \ |
368 | # int "search" , int "searchparam" , int "lambda" , bool "chroma" , bool "truemotion" , \ |
369 | # int "pnew" , int "overlap" , int "overlapV" , string "outfile" , int "dct" , int "divide" , \ |
370 | # int "sadx264" , bool "isse" ) |
372 | backward2 = MRecalculate(super, \ |
376 | overlap = overlapR, \ |
377 | overlapV = overlapVR, \ |
379 | searchparam = searchparamR, \ |
382 | truemotion = truemotion, \ |
391 | # MRecalculate(clip super, clip vectors, int "thSAD" , int "smooth" , int "blksize" , int "blksizeV" , \ |
392 | # int "search" , int "searchparam" , int "lambda" , bool "chroma" , bool "truemotion" , \ |
393 | # int "pnew" , int "overlap" , int "overlapV" , string "outfile" , int "dct" , int "divide" , \ |
394 | # int "sadx264" , bool "isse" ) |
396 | forward2 = MRecalculate(super, \ |
400 | overlap = overlapR, \ |
401 | overlapV = overlapVR, \ |
403 | searchparam = searchparamR, \ |
406 | truemotion = truemotion, \ |
416 | if (FrameCount == 1) { |
418 | # MFlowInter(clip source, clip super, clip mvbw, clip mvfw, float "time" , float "mL" , \ |
419 | # bool "blend" , int "thSCD1" , int "thSCD2" , bool "isse" , bool "planar" ) |
421 | inter2 = MFlowInter(clp, \ |
433 | inter = inter2.Trim(FrameNumber, -1) |
436 | # Fill an Inter variable with the MFlowInter() clips with different times |
437 | # Times are calculated in each step |
439 | for (i=0, FrameCount-1) { |
440 | itime = (100.0 / Float(FrameCount + 1)) * Float(i + 1) |
442 | # MFlowInter(clip source, clip super, clip mvbw, clip mvfw, float "time" , float "mL" , \ |
443 | # bool "blend" , int "thSCD1" , int "thSCD2" , bool "isse" , bool "planar" ) |
445 | inter2 = MFlowInter(clp, \ |
458 | inter = inter2.Trim(FrameNumber, -1) |
461 | inter = inter ++ inter2.Trim(FrameNumber, -1) |
465 | "" ") # End of GScript () |
467 | return (clp.trim(0, FrameNumber - 1) ++ inter ++ clp.trim(FrameNumber + FrameCount, 0)) |
|