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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th July 2010, 09:52   #41  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Quote:
Originally Posted by Didée View Post
A 4-years-old script, with some minor adjustments of today.
Didée: Is that aimed to interpolation between frames with higher differences? How can I do the opposite ((double)interpolate everything except where the differences are greater)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 13th July 2010, 10:00   #42  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Quote:
Originally Posted by Dogway View Post
Didée: Is that aimed to interpolation between frames with higher differences?
Of course. When 29.97 has been false-decimated to 23.976, you need to insert frames where the frame-difference is the biggest.

Quote:
How can I do the opposite ((double)interpolate everything except where the differences are greater)
Technically, that's easy: just invert the mask. (Precisely: in the "ismax = mt_lutxy(...)" line, replace "x y < 0 255 ?" with "x y < 255 0 ?". That's all, except that the var then should be rather named "isnotmax", but that's cosmetics.)

However, it is totally beyond me what that should be good for ... ?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 13th July 2010 at 10:06.
Didée is offline   Reply With Quote
Old 28th March 2013, 14:24   #43  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
Quote:
Originally Posted by Didée View Post
A 4-years-old script, with some minor adjustments of today.

Code:
# mt_masktools-25.dll
# mvtools2.dll
# tivtc.dll

Source( "VIDEO_that_has_been_decimated_to_FILM" )

o = assumefps(1.0) ox=o.width() oy=o.height()


showdot = true # false #   shows a "dot" in the interpolated frames of the result


super = showdot ? o.subtitle(".").MSuper(pel=2) : o.MSuper(pel=2) 
bvec  = MAnalyse(super, overlap=4, isb = true, search=4, dct=5) 
fvec  = MAnalyse(super, overlap=4, isb = false, search=4, dct=5) 
double = o.MFlowFps(super, bvec, fvec, num=2, den=1, blend=false)


diff2next = mt_makediff(o,o.selectevery(1,1)).mt_lut("x 128 - abs 32 / 1 2.0 / ^ 128 *",U=-128,V=-128)
diff2next = mt_lutf(diff2next,diff2next,yexpr="x",mode="average").pointresize(32,32)
diff2next = interleave(diff2next.selectevery(4,0).tsg(2),diff2next.selectevery(4,1).tsg(2),
 \                     diff2next.selectevery(4,2).tsg(2),diff2next.selectevery(4,3).tsg(2))

max = diff2next.mt_logic(diff2next.selectevery(1,-3),"max")
 \             .mt_logic(diff2next.selectevery(1,-2),"max")
 \             .mt_logic(diff2next.selectevery(1,-1),"max")
 \             .mt_logic(diff2next.selectevery(1, 1),"max")
 \             .mt_logic(diff2next.selectevery(1, 2),"max")
 \             .mt_logic(diff2next.selectevery(1, 3),"max")
ismax = mt_lutxy(diff2next,max,"x y < 0 255 ?",U=-128,V=-128).pointresize(ox,oy)
themask = interleave(o.mt_lut("0"),ismax)
interleave(o,o).mt_merge(double,themask,luma=true,U=3,V=3)

tdecimate(mode=1,cycleR=3,cycle=8)
assumefps(30000,1001)

return( last )

#===========================

function tsg(clip c, int t) { c
t<5?last:last.temporalsoften(1,255,0,255,2).merge(last,0.25)
t<4?last:last.temporalsoften(1,255,0,255,2).merge(last,0.25)
t<3?last:last.temporalsoften(1,255,0,255,2).merge(last,0.25)
t<2?last:last.temporalsoften(1,255,0,255,2).merge(last,0.25)
t<1?last:last.temporalsoften(1,255,0,255,2).merge(last,0.25) }
Worx.
.
.
.
This is a idea of Didee, see script code upper.
.
On this idea of Didee is besed new function
function DoubleFPS(clip clp, int "numerator", int "denominator", int "mode", bool "mopro", int "bias", bool "show")
.
Code:
function DoubleFPS(clip clp, int "numerator", int "denominator", \
                   int "mode", bool "mopro", int "bias", bool "show")
{
  # Defaults
  #
  numerator   = Default(numerator,       2)
  denominator = Default(denominator,     1)
  mode        = Default(mode,            2)
  mopro       = Default(mopro,       false)
  bias        = String(Default(bias,  128))
  showdot     = Default(show,        false)
 

  # Here is code of function...
  #
  v  = addborders(clp, 16, 16, 16, 16)
  o  = v.assumefps(FramerateNumerator(clp))
  ox = v.width()
  oy = v.height()

  S  = (showdot == true) ? v.subtitle(".", x=32, y=24).MSuper(pel=4, hpad=16, vpad=16, rfilter=4) : 
  \                                                  v.MSuper(pel=4, hpad=16, vpad=16, rfilter=4)

  A  = S.MAnalyse(isb=true,  blksize=8, overlap=2, plevel=0, search=5, searchparam=8, badrange=(-24))
  B  = S.MAnalyse(isb=false, blksize=8, overlap=2, plevel=0, search=5, searchparam=8, badrange=(-24))
  
  C  = S.MRecalculate(A, blksize=8, search=5, searchparam=2)
  D  = S.MRecalculate(B, blksize=8, search=5, searchparam=2)
  E  = S.MRecalculate(C, blksize=4, search=5, searchparam=1)
  F  = S.MRecalculate(D, blksize=4, search=5, searchparam=1)

  double = (mode == 1) ? v.MBlockFps(S, E, F,
  \                                  num=FramerateNumerator(v) * numerator,
  \                                  den=FramerateDenominator(v) * denominator,
  \                                  mode=0, blend=false, ThSCD1=220)
  \      : (mode == 2) ?  v.MFlowFps(S, E, F,
  \                                  num=FramerateNumerator(v) * numerator,
  \                                  den=FramerateDenominator(v) * denominator,
  \                                  mask=2, ml=10000, blend=false, ThSCD1=220)
  \      :  NOP()

  diff2next = mt_makediff(o, o.selectevery(1, 1)).mt_lut("x "+bias+" - abs 32 / 1 2.0 / ^ 128 *", U=-128, V=-128)
  diff2next = mt_lutf(diff2next, diff2next, yexpr="x", mode="average").pointresize(32, 32)
  diff2next = interleave(diff2next.selectevery(4, 0).tsg(2), diff2next.selectevery(4, 1).tsg(2),
  \                      diff2next.selectevery(4, 2).tsg(2), diff2next.selectevery(4, 3).tsg(2))

  max = diff2next.mt_logic(diff2next.selectevery(1, -3), "max")
  \              .mt_logic(diff2next.selectevery(1, -2), "max")
  \              .mt_logic(diff2next.selectevery(1, -1), "max")
  \              .mt_logic(diff2next.selectevery(1,  1), "max")
  \              .mt_logic(diff2next.selectevery(1,  2), "max")
  \              .mt_logic(diff2next.selectevery(1,  3), "max")

  ismax   = mt_lutxy(diff2next, max, "x y < 255 0 ?", U=-128, V=-128).pointresize(ox, oy)   # swap 255 0 to interpolate only on big changes.
  themask = interleave(o.mt_lut("0"), ismax)
  interleave(o, o).mt_merge(double, themask, luma=true, U=3, V=3)

  (mopro == true) ? last.crop(16, 16, -16, -16) : double.crop(16, 16, -16, -16)

  return (last)
}
    
function tsg(clip clp, int t)
{ 
  last = clp

  (t < 5) ? last : last.temporalsoften(1, 255, 0, 255, 2).merge(last, 0.25)
  (t < 4) ? last : last.temporalsoften(1, 255, 0, 255, 2).merge(last, 0.25)
  (t < 3) ? last : last.temporalsoften(1, 255, 0, 255, 2).merge(last, 0.25)
  (t < 2) ? last : last.temporalsoften(1, 255, 0, 255, 2).merge(last, 0.25)
  (t < 1) ? last : last.temporalsoften(1, 255, 0, 255, 2).merge(last, 0.25)

  return (last)
}
.
Question to Didee.
.
How to correct this script function to do various frames conversion (not only doubling, multiply by various numerator and denominator) ?
when "mopro = true" .
.
Thanks.
.
__________________
Warm and fuzzy (white and fluffy)

Last edited by Jenyok; 28th March 2013 at 19:38.
Jenyok is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.