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. |
|
|
Thread Tools | Search this Thread | Display Modes |
27th March 2012, 08:24 | #61 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Can you lot please take a peek here and air any views you may have.
http://forum.doom9.org/showthread.ph...21#post1567221
__________________
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 ??? |
27th March 2012, 10:13 | #62 | Link | ||
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Quote:
Quote:
Last edited by manono; 27th March 2012 at 10:31. |
||
27th March 2012, 10:25 | #63 | Link | |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Quote:
As I mentioned, I'm most interested in having a function to interpolate frames well and in the easiest manner possible. And I speak for no one but myself. |
|
27th March 2012, 10:35 | #64 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@Manono
The idea I had was to overcome what I guess is refered to here: Quote:
and the second clip would contain all of the second frames of the repaired pair (both originated from the damaged source clip). Would be a sort of two dimensional array of repaired frames. EDIT: Quote:
Code:
source clip : 1 2 3 4 5 6 repair clip 1 : 1A 2A 3A 4A 5A 6A # where 3A generated from frames 2 and 5 repair clip 2 : 1B 2B 3B 4B 5B 6B # where 3B generated from frames 2 and 5 Code:
would produce: 1 2 3A 3B 5 6 get ClipClop to do the remainder. Same applies to eg 17 frame interpolation. (ClipClop supports up to 255 replacement clips)
__________________
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; 27th March 2012 at 11:46. |
||
27th March 2012, 12:11 | #65 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
However, that only handles the case where all the replacements are pairs. What manono wants (and 2Bdecided also asked for this in post #33) is a single generic function that you just supply with an arbitrary list of bad frames and it does everything for you. This is difficult because you would have to generate a different set of replacement clips for each different-sized 'gap' between good frames, with different motion vectors, etc. |
|
27th March 2012, 12:18 | #66 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Yes am aware of that, 2 - 17 sets of clips would be (I think) be 152 clips, less than 255
supported by ClipClop, there would of course have to be some limit on the number. EDIT: OK, I just looked at post #33 and see what you mean. EDIT: Would clips not used have a prohibitive overhead? EDIT: So would the suggested mod be of use?
__________________
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; 27th March 2012 at 19:14. |
27th March 2012, 19:02 | #67 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
EDIT: Assuming a plug (not taking nor returning a clip) constructor can be called before another
then doing the list of single frame fixes, by 2bdecided etc could be possible if not quite easy, you just need a file fomat converting plugin, provided that the number of frames to be interpolated is supported in the fixing function.
__________________
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; 28th March 2012 at 11:28. |
13th November 2012, 09:35 | #68 | Link |
Warm and fuzzy
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
|
Restore (replace) bad frame(s) with interpolation.
There are two different functions of interpolation. Part 1. . Code:
# # # Ver. 1.4 # 12.11.2012 year # # # File: Interpolate_Bad_Frames.avsi # License GNU # AviSynth 2.5.8 # VirtualDub 1.9.11 # # # Restore bad frames with interpolation # # # Needed plugins and libruaries: # MVTools2 # GScript # # # You could write interpolation functions, see script code, up to 60 frames inc. # # # !!! No any checked in interpolate functions are done (Trim() function, see script code). # # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll") LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GSCRIPT_11\gscript.dll") function Interpolate2(clip clp, int FrameNumber, int FrameInterpolate) { # Constants # Change those constants to tune for the best result of interpolation # # MAnalyse blks = 16 # 8 blksV = blks overlap = 0 overlapV = 0 search = 5 # 2 searchparam = 3 # 3 dct = 5 # 5 # # MSuper # hpad = blks / 2 # 4 # vpad = blksV / 2 hpad = 2 # 4 vpad = 2 pel = 4 # 4 rfilter = 4 # 4 sharp = 2 # 2 # # MFlowInter tCD1 = 300 # 1500 tCD2 = 128 # 130 iml = 70 # 70 # Restore bad frames with interpolation with MFlowInter # Prepare functions # # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \ # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar") # super = MSuper(clp, \ hpad = hpad, \ vpad = vpad, \ pel = pel, \ levels = 0, \ chroma = true, \ sharp = sharp, \ rfilter = rfilter, \ isse = true, \ planar = false) # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \ # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \ # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \ # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \ # int "badrange", bool "isse", int "full", bool "meander", bool "temporal") # backward_vectors = MAnalyse(super, \ blksize = blks, \ blksizeV = blksV, \ levels = 0, \ search = search, \ searchparam = searchparam, \ pelsearch = pel, \ isb = true, \ lambda = 0, \ chroma = true, \ delta = FrameInterpolate + 1, \ truemotion = true, \ lsad = 1200, \ plevel = 0, \ global = true, \ pnew = 50, \ pzero = 50, \ pglobal = 0, \ overlap = overlap, \ overlapV = overlapV, \ dct = dct, \ divide = 0, \ sadx264 = 0, \ badSAD = 10000, \ badrange = 24, \ isse = true, \ meander = true, \ temporal = false, \ trymany = false) # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \ # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \ # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \ # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \ # int "badrange", bool "isse", int "full", bool "meander", bool "temporal") # forward_vectors = MAnalyse(super, \ blksize = blks, \ blksizeV = blksV, \ levels = 0, \ search = search, \ searchparam = searchparam, \ pelsearch = pel, \ isb = false, \ lambda = 0, \ chroma = true, \ delta = FrameInterpolate + 1, \ truemotion = true, \ lsad = 1200, \ plevel = 0, \ global = true, \ pnew = 50, \ pzero = 50, \ pglobal = 0, \ overlap = overlap, \ overlapV = overlapV, \ dct = dct, \ divide = 0, \ sadx264 = 0, \ badSAD = 10000, \ badrange = 24, \ isse = true, \ meander = true, \ temporal = false, \ trymany = false) GScript(""" if (FrameInterpolate == 1) { inter2 = MFlowInter(clp, \ super, \ backward_vectors, \ forward_vectors, \ time = 50, \ mL = iml, \ blend = true, \ thSCD1 = tCD1, \ thSCD2 = tCD2, \ isse = true, \ planar = false) inter = inter2.Trim(FrameNumber, -1) } # End of If-Then else { # Fill an Inter variable with the MFlowInter() clips with different times # Times are calculated in each step # for (i=0, FrameInterpolate-1) { itime = (100.0 / Float(FrameInterpolate + 1)) * Float(i + 1) inter2 = MFlowInter(clp, \ super, \ backward_vectors, \ forward_vectors, \ time = itime, \ mL = iml, \ blend = true, \ thSCD1 = tCD1, \ thSCD2 = tCD2, \ isse = true, \ planar = false) if (i == 0) { inter = inter2.Trim(FrameNumber, -1) } # End of If-Then else { inter = inter ++ inter2.Trim(FrameNumber, -1) } # End of If-Else } # End of For () } # End of If-Else """) # End of GScript () return (inter) } # Example, 10 bad frames to interpolate # function TenFrames(clip clp, int N) { # N is number of the first frame in Source that needs replacing. # Frames N and N + 1 and N + 2 and N + 3 and N + 4 and N + 5 and N + 6 # and N + 7 and N + 8 and N + 9, N + 10 (O) will be replaced. clp.trim(0, N - 1) ++ Interpolate2(clp, N - 1, 10) ++ clp.trim(N + 10, 0) } # Example, 41 bad frames to interpolate # function FourtyOneFrames(clip clp, int N) { # N is number of the first frame in Source that needs replacing. # Frames N and N + 1 and N + 2 and N + 3 and N + 4 and N + 5 and N + 6 # and N + 7 and N + 8 and N + 9 ... N + 41 (O) will be replaced. clp.trim(0, N - 1) ++ Interpolate2(clp, N - 1, 41) ++ clp.trim(N + 41, 0) }
__________________
Warm and fuzzy (white and fluffy) |
13th November 2012, 09:36 | #69 | Link |
Warm and fuzzy
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
|
Restore (replace) bad frame(s) with interpolation.
There are two different functions of interpolation. Part 2 continiue. . Code:
# # Author "manono" # with changes # function RX(clip clp, int N, int X) { # N is number of the 1st frame in Source that needs replacing. # X is total number of frames to replace # e.g. RX(101, 5) would replace 101, 102, 103, 104, 105 , by using 100 and 106 as reference points for mflowfps interpolation # Constants # Change those constants to tune for the best result of interpolation # # MAnalyse blks = 8 # 8 blksV = blks # 8 # overlap = blks / 2 # overlapV = blksV / 2 overlap = 0 overlapV = 0 search = 5 # 2 searchparam = 3 # 2 dct = 5 isse = true # # MSuper # hpad = blks / 2 # 4 # vpad = blksV / 2 hpad = 2 # 4 vpad = 2 # 4 pel = 4 # 4 sharp = 2 rfilter = 4 # # MRecalculate() search2 = search smooth = 1 chroma = true thSAD = 100 # # MFlowFps tCD1 = 300 # 1500 tCD2 = 128 # 130 # Contour artifacts suppression Подавление контурных артефактов # Simple masking Простое маскирование (mask = 0) # Simple masking + Static vectors Простое + Статические вектора (mask = 1) # Simple masking + Vectors of related frames Простое + Вектора смежных кадров (mask = 2) mask = 2 # Artifact suppression level Степень подавления артефактов # Light Легкая (ml = 100) # Medium Средняя (ml = 500) # High Высокая (ml = 2500) # Huge Нереальная (ml = 10000) ml = 10000 # Motion search radius Радиус поиска движения # 1% frame кадра (spar = 1) # 3% frame кадра (spar = 3) # 5% frame кадра (spar = 5) # 10% frame кадра (spar = 10) # 25% frame кадра (spar = 25) # 30% frame кадра (spar = 30) # 50% frame кадра (spar = 50) # 100% frame кадра (spar = 100) spar = 100 # ??? 30% # # Variables dist_h = int((0.01 * spar * Width(clp)) / blks) dist_v = int((0.01 * spar * Height(clp)) / blksV) dist = (dist_h > dist_v) ? dist_h : dist_v dist = (dist > 0) ? dist : 1 start = clp.trim(N - 1, -1) # one good frame before, used for interpolation reference point end = clp.trim(N + X, -1) # one good frame after, used for interpolation reference point start + end AssumeFPS(1.0) # temporarily FPS = 1.0 to use MFlowFps() start_end = last # Restore bad frames with interpolation with MFlowInter # Prepare functions # # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \ # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar") # super = MSuper(start_end, \ hpad = hpad, \ vpad = vpad, \ pel = pel, \ levels = 0, \ chroma = true, \ sharp = sharp, \ rfilter = rfilter, \ isse = isse, \ planar = false) # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \ # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \ # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \ # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \ # int "badrange", bool "isse", int "full", bool "meander", bool "temporal") # backward_vectors = MAnalyse(super, \ blksize = blks, \ blksizeV = blksV, \ levels = 0, \ search = search, \ searchparam = searchparam, \ pelsearch = pel, \ isb = true, \ lambda = 0, \ chroma = true, \ delta = 1, \ truemotion = true, \ lsad = 1200, \ plevel = 0, \ global = true, \ pnew = 50, \ pzero = 50, \ pglobal = 0, \ overlap = overlap, \ overlapV = overlapV, \ dct = dct, \ divide = 0, \ sadx264 = 0, \ badSAD = 10000, \ badrange = 24, \ isse = isse, \ meander = true, \ temporal = false, \ trymany = false) # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \ # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \ # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \ # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \ # int "badrange", bool "isse", int "full", bool "meander", bool "temporal") # forward_vectors = MAnalyse(super, \ blksize = blks, \ blksizeV = blksV, \ levels = 0, \ search = search, \ searchparam = searchparam, \ pelsearch = pel, \ isb = false, \ lambda = 0, \ chroma = true, \ delta = 1, \ truemotion = true, \ lsad = 1200, \ plevel = 0, \ global = true, \ pnew = 50, \ pzero = 50, \ pglobal = 0, \ overlap = overlap, \ overlapV = overlapV, \ dct = dct, \ divide = 0, \ sadx264 = 0, \ badSAD = 10000, \ badrange = 24, \ isse = isse, \ meander = true, \ temporal = false, \ trymany = false) # function MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \ # int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \ # int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \ # int "sadx264", bool "isse") # backward_recalc = MRecalculate(super, \ backward_vectors, \ thSAD = thSAD, \ smooth = smooth, \ blksize = blks, \ blksizev = blksV, \ search = search2, \ searchparam = dist, \ chroma = chroma, \ truemotion = true, \ overlap = overlap, \ overlapv = overlapV, \ dct = dct, \ divide = 0, \ isse = isse) # function MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \ # int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \ # int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \ # int "sadx264", bool "isse") # forward_recalc = MRecalculate(super, \ forward_vectors, \ thSAD = thSAD, \ smooth = smooth, \ blksize = blks, \ blksizev = blksV, \ search = search2, \ searchparam = dist, \ chroma = chroma, \ truemotion = true, \ overlap = overlap, \ overlapv = overlapV, \ dct = dct, \ divide = 0, \ isse = isse) # function MFlowFPS(clip source, clip super, clip mvbw, clip mvfw, int "num", int "den", int "mask", \ # float "ml", bool "blend", int "thSCD1", int "thSCD2", bool "isse", bool "planar") # MFlowFps(start_end, \ super, \ backward_recalc, \ forward_recalc, \ num = X + 1, \ den = 1, \ mask = mask, \ ml = ml, \ blend = false, \ thSCD1 = tCD1, \ thSCD2 = tCD2, \ isse = isse, \ planar = false) AssumeFPS(FrameRate(clp)) # return back to normal source framerate for joining Trim(1, framecount - 1) # trim ends, leaving replacement frames Interpolate = last clp.trim(0, -N) ++ Interpolate ++ clp.trim(N + X + 1, 0) return (last) }
__________________
Warm and fuzzy (white and fluffy) Last edited by Jenyok; 13th November 2012 at 09:44. |
13th November 2012, 22:04 | #70 | Link |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Except I didn't write it, but only use it to replace two or more consecutive bad frames when needed. I don't know who wrote it or I'd happily give credit where credit is due. For single frames needing replacing, I use Gavino's FixBadFrames:
function FixBadFrames(clip c, string frames) { # Replace each frame from a list of 'bad' frames by using MFlowInter to interpolate # between the nearest pair of 'good' frames c sup = MSuper() bv = MAnalyse(sup, isb=true, delta=2) fv = MAnalyse(sup, isb=false, delta=2) candidates = MFlowInter(sup, bv, fv, time=50.0, ml=100).DuplicateFrame(0) ReplaceFramesSimple(candidates, mappings=frames) } #Usage FixBadFrames("34 64 96") I don't know if it's any better than the other one but it's easier to use (less typing). You just have to type in the frame numbers needing replacing. In addition to the usual stuff it also needs stickboy's RemapFrames.dll. |
|
|