Advertisement
mawen1250

Contra-Sharpen mod 3.0

Sep 3rd, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Avisynth 17.38 KB | None | 0 0
  1. ###### Contra-Sharpen mod 3.0 ###### by mawen1250 ###### 2012.09.03 ######
  2.  
  3. Function CSmod(clip filtered, clip "source", clip "pclip", float "strength", float "divisor", float "index", float "ss_w", float "ss_h",
  4. \ bool "chroma", int "preblur", bool "prec", bool "secure", bool "limit", bool "choversh", bool "Slimit", bool "SlimitY", bool "Tlimit",
  5. \ bool "ssrep", int "preR", int "Smethod", int "Smode", float "Szrp", float "Spwr", float "SdmpLo", float "SdmpHi", int "RGmode", int "RGmodeU",
  6. \ int "Repmode", int "RepmodeU", int "Sovershoot", int "Sundershoot", int "Tovershoot", int "Tundershoot", float "Soft", int "Soothe",
  7. \ string "filter_ss", int "blksize", int "overlap", int "thSAD", int "thSCD1", int "thSCD2", bool "truemotion", bool "MVglobal",
  8. \ int "pel", int "pelsearch", int "search", int "searchparam", int "MVsharp", int "DCT", bool "usepasf", string "kernel", bool "ss_hq",
  9. \ string "ssmethod", int "thr", bool "ssout", bool "ssoutc")
  10. {
  11.  
  12. defsrc   = Defined(source)
  13. defpclp  = Defined(pclip )
  14. defRGm   = Defined(RGmode)
  15. deffss   = Defined(filter_ss)
  16. AA       = deffss ? filter_ss=="AA" : false
  17. sw       = filtered.width()
  18. sh       = filtered.height()
  19. HD       = (sw > 1024 || sh > 576) ? true : false
  20.  
  21. chroma   = Default(chroma,  false  )
  22. ss_w     = Default(ss_w,    1.50   )   #Super sampling multiplier of width.
  23. ss_h     = Default(ss_h,    1.50   )   #Super sampling multiplier of height.
  24. ss_w     = max    (ss_w,    1.00   )
  25. ss_h     = max    (ss_h,    1.00   )
  26. ss_hq    = Default(ss_hq,   ss_w*ss_h>=2.25)   #True using nnedi3_rpow2 in super sampling, false using non-ringing Spline64Resize.
  27. ssout    = Default(ssout,   false  )   #Output in super sampling resolution.
  28. ssoutc   = Default(ssoutc,  true   )   #Whether to output correct chroma when (chroma==false && ss_hq==false && ssout==true).
  29. ssrep    = Default(ssrep,   false  )   #When limiting sharpening to source clip, whether to repair in super sampling resolution.
  30. preblur  = Default(preblur, 1      )   #Pre-filtering, 1 uses Minblur, 2 uses Minblur(Uses SBR by default) mixed with Minblur+FluxSmoothT, 3 uses Minblur(Uses SBR by default)+FluxSmoothT.
  31. prec     = Default(prec,    preblur>=1)   #Whether to use preblur in chroma plane
  32. preR     = Default(preR,    preblur>=2?0:ss_w*ss_h<3?1:2)   #Preblur setting, 1-3 sets radius of MinBlur, 0 uses SBR instead of normal MinBlur.
  33. usepasf  = Default(usepasf, false  )   #Whether to use pre-filtered clip as input(filtered) clip, which will reduce noise/halo/ring from input clip.
  34. limit    = Default(limit,   true   )   #Whether to limit sharpening to source clip, only takes effect when (Defined(source) || Defined(filter_ss) || usepasf) == true.
  35. thr      = Default(thr,     0      )   #When limiting sharpening to source clip, allow sharpening more than the source in [thr].
  36. RGmode   = Default(RGmode,  HD?20:11)
  37. RGmodeU  = Default(RGmodeU, defRGm?RGmode:11)
  38. Repmode  = Default(Repmode, AA?13:1)
  39. RepmodeU = Default(RepmodeU,Repmode)
  40. ssout    = (ss_w > 1.0 || ss_h > 1.0) ? ssout : false
  41. ssrep    = (ss_w > 1.0 || ss_h > 1.0) ? ssrep : false
  42. ssoutc   = (!chroma && ssout) ? ssoutc : false
  43. ssrep    = ssout ? true : ssrep
  44. filter_ss= deffss ? AA ? "SangNom(aa=48).TurnRight().SangNom(aa=48).TurnLeft()" : filter_ss : NOP()  #When defining filter_ss="AA", will automatically use SangNom for anti-aliasing in super sampling clip, and will automatically set Repmode to 13.
  45. limit    = defsrc || deffss || usepasf ? limit : false
  46.  
  47. Smethod  = Default(Smethod, limit?1:3)   #Sharpen Method - 1: 3x3 kernel, 2: Min/Max, 3: Min/Max + 3x3 kernel.
  48. secure   = Default(secure,  true   )   #Mode to avoid banding & oil painting (or face wax) effect of sharpening.(from LSFmod Smode=5)
  49. Smode    = Default(Smode,   3      )   #Sharpen Mode - 1: Linear, 2: Non-linear 1, 3:Non-linear 2(from LSFmod).
  50. divisor  = Default(divisor, 1.5    )
  51. index    = Default(index,   0.8    )
  52. strength = Default(strength,100    )
  53. Szrp     = Default(Szrp,    16     )
  54. Spwr     = Default(Spwr,    4      )
  55. SdmpLo   = Default(SdmpLo,  4      )
  56. SdmpHi   = Default(SdmpHi,  48     )
  57. miSpwr   = 1.0/Spwr
  58.  
  59. Slimit      = Default(Slimit,      !limit      )   #Spatial limit with overshoot and undershoot. Disabled when (limit==true && thr==0).
  60. Sovershoot  = Default(Sovershoot,  Round(strength/100))
  61. Sundershoot = Default(Sundershoot, Sovershoot  )
  62. choversh    = Default(choversh,    true        )   #When (chroma==true && limit==true && thr>=1 && choversh==false), luma will sharpen more than source, chroma will not.
  63. Tlimit      = Default(Tlimit,      false       )   #Use MC Temporal limit at the end of sharpening(only process luma).(from MCTD)
  64. Tovershoot  = Default(Tovershoot,  Round(strength/50 ))
  65. Tundershoot = Default(Tundershoot, Tovershoot  )
  66. SlimitY     = Default(SlimitY,     !Tlimit     )   #It will automatically set Slimit=true, SlimitY=false to use Spatial limit on chroma when Tlimit=true.
  67. Soft        = Default(Soft,        limit?  0:-2)   #Soft the sharpening effect (-1 = old autocalculate, -2 = new autocalculate, 0 = disable, (0, 100] = enable). Disabled when (limit==true && thr==0).(from LSFmod)
  68. Soothe      = Default(Soothe,      limit? -1:24)   #Soothe temporal stabilization, 0-100 sets minimum percent of the original sharpening to keep, -1 disables Soothe. Disabled when (chroma==true && Tlimit=true).
  69.  
  70. blksize     = Default(blksize,     HD ? 16 : 8 )
  71. overlap     = Default(overlap,     HD ? 8  : 4 )
  72. thSAD       = Default(thSAD,       300         )
  73. thSCD1      = Default(thSCD1,      300         )
  74. thSCD2      = Default(thSCD2,      100         )
  75. truemotion  = Default(truemotion,  false       )
  76. MVglobal    = Default(MVglobal,    true        )
  77. pel         = Default(pel,         2           )
  78. pelsearch   = Default(pelsearch,   2           )
  79. search      = Default(search,      2           )
  80. searchparam = Default(searchparam, 2           )
  81. MVsharp     = Default(MVsharp,     2           )
  82. DCT         = Default(DCT,         0           )
  83.  
  84.  
  85. ss_w     = max(ss_w, 1.0)
  86. ss_h     = max(ss_h, 1.0)
  87. wss      = Round(sw*ss_w/8)*8
  88. hss      = Round(sh*ss_h/8)*8
  89. rfactor  = max(Round(sqrt(ss_w*ss_h)/2)*2, 2)
  90. ssmethod = Defined(ssmethod) ? ssmethod
  91. \        : ss_hq ? """nnedi3_rpow2(rfactor=rfactor, qual=2, cshift="Spline64Resize", fwidth=wss, fheight=hss)"""
  92. \                : "CSmod_nrSpline64Resize(wss, hss, chroma=chroma||ssoutc)"
  93. #You can define your own super sampling method with ssmethod.
  94.  
  95. ch21     = chroma ? 2 : 1
  96. ch31     = chroma ? 3 : 1
  97. Slimit   = limit && thr==0 ? false : Slimit
  98. Soft     = limit && thr==0 ? 0
  99. \        : Soft <= -2  ? (1.0+(2.0/(ss_w+ss_h))) * sqrt(strength)
  100. \        : Soft == -1  ? sqrt( (((ss_w+ss_h)/2.0-1.0)*100.0) ) * 10
  101. \        : Soft <= 100 ? Soft : 100
  102. Soothe   = Tlimit ? -1 : Soothe
  103. strength = Smode == 1 ? strength/50.0 : Smode == 2 ? strength/20.0 : strength/100.0
  104.  
  105. preR        = preR <= 0 ? 0 : preR >= 3 ? 3 : preR
  106. Sovershoot  = Sovershoot  < 0 ? 0 : Sovershoot
  107. Sundershoot = Sundershoot < 0 ? 0 : Sundershoot
  108. Tovershoot  = Tovershoot  < 0 ? 0 : Tovershoot
  109. Tundershoot = Tundershoot < 0 ? 0 : Tundershoot
  110.  
  111.  
  112. #super sampling with filtering
  113. source      = defsrc ? source : filtered
  114. filtered_os = filtered
  115. filtered_ss = (ss_w > 1.0 || ss_h > 1.0) ? Eval("filtered."+ssmethod) : filtered
  116. filtered    = (ss_w > 1.0 || ss_h > 1.0) ? filtered_ss : filtered
  117. source_ss   = (ss_w > 1.0 || ss_h > 1.0) ? defsrc ? Eval("source."+ssmethod) : filtered : source
  118. filtered    = (ss_w > 1.0 || ss_h > 1.0) && deffss ? Eval("filtered."+filter_ss) : filtered
  119. filtered_ds = (ss_w > 1.0 || ss_h > 1.0) && deffss ? filtered.CSmod_nrSpline64Resize(sw, sh, chroma=chroma) : filtered_os
  120.  
  121. Assert( (isFrameBased(filtered_os)),                            """CSmod: input clip "filtered" must be Frame Based!""" )
  122. Assert( (isFrameBased(source)),                                   """CSmod: input clip "source" must be Frame Based!""" )
  123. Assert( (source.width() == sw && source.height() == sh), """CSmod: resolution of "filtered" and "source" must match!""" )
  124.  
  125.  
  126. #pre-filtering before sharpening
  127. spatial     = filtered.MinBlur(preR, chroma ? (prec ? 3 : 2) : 1)
  128. temporal    = spatial .FluxsmoothT(7).Repair(spatial, 1, prec ? 1 : -1)
  129. temporal    = chroma&&!prec ? temporal.MergeChroma(filtered) : temporal
  130. mixed       = temporal.merge(spatial,0.251)
  131. pre         = defpclp ? pclip
  132. \                     : preblur==1 ? spatial
  133. \                     : preblur==2 ? mixed
  134. \                     : preblur>=3 ? temporal
  135. \                     : filtered
  136. #You can define your own pre-filter clip with pclip.
  137. pre_ds      = (pre.width() == sw && pre.height() == sh) ? pre : pre.CSmod_nrSpline64Resize(sw, sh, chroma=chroma)
  138. pre         = (ss_w > 1.0 || ss_h > 1.0) ? (pre.width() == wss && pre.height() == hss) ? pre : Eval("pre."+ssmethod) : pre_ds
  139.  
  140. #whether to use pre-filtered clip as main clip
  141. filtered    = usepasf ? pre    : filtered
  142. filtered_ds = usepasf ? pre_ds : filtered_ds
  143.  
  144.  
  145. #unsharp
  146. dark_limit   = pre.mt_inpand(U=ch31, V=ch31)
  147. bright_limit = pre.mt_expand(U=ch31, V=ch31)
  148. minmaxavg    = Smethod == 1 ? NOP() : mt_average(dark_limit, bright_limit, U=ch31, V=ch31)
  149.  
  150. method     = Smethod == 1  ? Defined(kernel) ? Eval("pre.      "+kernel) : pre      .removegrain(RGmode, chroma ? RGmodeU : -1)
  151. \          : Smethod == 2  ?                                               minmaxavg
  152. \          :                 Defined(kernel) ? Eval("minmaxavg."+kernel) : minmaxavg.removegrain(RGmode, chroma ? RGmodeU : -1)
  153.  
  154. method     = secure        ? method.mt_lutxy(pre,"x y < x 1 + x y > x 1 - x ? ?", U=ch31, V=ch31) : method
  155.  
  156.  
  157. #making difference clip of sharpening
  158. sharpdiff  = mt_makediff(pre, method, U=ch31,V=ch31)
  159.  
  160.  
  161. #sharpening diff generate mode
  162. sharpdiff  = Smode == 1 ? sharpdiff.mt_lut("x 128 - "+string(strength)+" * 128 +", U=ch31, V=ch31)
  163. \          : Smode == 2 ? sharpdiff.mt_lut("x 128 == x x 128 - "+String(divisor)+" / Abs "+String(index)+" ^ "+String(strength)+" * x 128 > 1 -1 ? * 128 + ?", U=ch31, V=ch31)
  164. \          : Smode == 3 ? sharpdiff.mt_lut("x 128 == x x 128 - abs "+string(Szrp)+" / "+string(miSpwr)+" ^ "+string(Szrp)+" * "+string(strength)+" * x 128 > 1 -1 ? * x 128 - 2 ^ "+string(Szrp)+" 2 ^ "+string(SdmpLo)+" + * x 128 - 2 ^ "+string(SdmpLo)+" + "+string(Szrp)+" 2 ^ * / * 1 "+string(SdmpHi)+" 0 == 0 "+string(Szrp)+" "+string(SdmpHi)+" / 4 ^ ? + 1 "+string(SdmpHi)+" 0 == 0 x 128 - abs "+string(SdmpHi)+" / 4 ^ ? + / * 128 + ?", U=ch31, V=ch31)
  165. \          : sharpdiff
  166. # x==128 ? x : (abs(x-128)/Szrp)^(miSpwr)*Szrp*strength*(x>128 ? 1 : -1) * ((x-128)^2*(Szrp^2+SdmpLo) / ((x-128)^2+SdmpLo)*Szrp^2) * ((1+ SdmpHi==0 ? 0 : (Szrp/SdmpHi)^4) / (1+ SdmpHi==0 ? 0 : (abs(x-128)/SdmpHi)^4)) + 128
  167.  
  168. #spatial limit
  169. sclp       = Slimit&&(chroma||SlimitY) ? mt_adddiff(filtered, sharpdiff, U=ch31, V=ch31) : NOP()
  170. sclp       = Slimit ? sclp.mt_clamp(bright_limit, dark_limit, Sovershoot, Sundershoot, Y=SlimitY?3:2, U=ch31, V=ch31) : NOP()
  171.  
  172.  
  173. #Soft
  174. sharpdiff  = Slimit&&(chroma||SlimitY) ? mt_makediff(sclp, filtered, U=ch31, V=ch31) : sharpdiff
  175. sharpdiff  = Soft == 0 ? sharpdiff : mt_lutxy(sharpdiff, sharpdiff.removegrain(19, chroma ? 19 : -1), "x 128 - abs y 128 - abs > y "+string(Soft)+" * x "+string(100-Soft)+" * + 100 / x ?", U=ch31, V=ch31)
  176.  
  177.  
  178. #Soothe
  179. sharpdiff2 = (Soothe >= 0 && Soothe <= 100) ? sharpdiff.temporalsoften(1,255,chroma ? 255 : 0,32,2) : NOP()
  180. sharpdiff  = (Soothe >= 0 && Soothe <= 100) ? mt_lutxy(sharpdiff, sharpdiff2, "x 128 - y 128 - * 0 < x 128 - 100 / "+string(Soothe)+" * 128 + x 128 - abs y 128 - abs > x "+string(Soothe)+" * y 100 "+string(Soothe)+" - * + 100 / x ? ?", U=ch31, V=ch31) : sharpdiff
  181.  
  182.  
  183. #the difference achieved by filtering
  184. allD       = limit  ? ssrep && (ss_w > 1.0 || ss_h > 1.0) ? mt_makediff(source_ss, filtered, U=ch31, V=ch31)
  185. \          : mt_makediff(source, filtered_ds, U=ch31, V=ch31) : NOP()
  186.  
  187. #limiting sharpening to source clip
  188. sharpdiff  = !ssrep && (ss_w > 1.0 || ss_h > 1.0) ? sharpdiff.CSmod_nrSpline64Resize(sw, sh, chroma=chroma) : sharpdiff
  189. ssDD       = limit  ? sharpdiff.repair(allD, mode=Repmode, modeU=chroma ? RepmodeU : -1) : sharpdiff
  190. ssDD       = limit && thr >= 1 ? sharpdiff.mt_lutxy(ssDD,"x 128 - abs y 128 - abs " + string(thr) + " + <= x y 128 < y " + string(thr) + " - y " + string(thr) + " + ? ?", U=choversh?ch31:ch21, V=choversh?ch31:ch21) : ssDD
  191. ssDD       = limit && thr == 0 || (limit && !choversh) ? ssDD.mt_lutxy(sharpdiff, "x 128 - abs y 128 - abs < x y ?", Y=(limit && thr >= 1 && !choversh)?2:3, U=ch31, V=ch31) : ssDD
  192. ssDD       = ssrep && (ss_w > 1.0 || ss_h > 1.0) && !ssout ? ssDD.CSmod_nrSpline64Resize(sw, sh, chroma=chroma) : ssDD
  193.  
  194. #add difference clip to clip "filtered" of ss/original resolution
  195. sclp       = ssout ? mt_adddiff(filtered, ssDD, U=ch31, V=ch31) : mt_adddiff(filtered_ds, ssDD, U=ch31, V=ch31)
  196.  
  197.  
  198. #temporal limit
  199. pre_ds = ssout  ? pre       : pre_ds
  200. source = ssout  ? source_ss : source
  201.  
  202. pMVS   = Tlimit ? pre_ds.MSuper(hpad=0, vpad=0, pel=pel, sharp=MVsharp, chroma=false) : NOP()
  203. f1v    = Tlimit ? MAnalyse(pMVS, isb=false, delta=1, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, DCT=DCT, global=MVglobal, chroma=false) : NOP()
  204. b1v    = Tlimit ? MAnalyse(pMVS, isb=true,  delta=1, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, DCT=DCT, global=MVglobal, chroma=false) : NOP()
  205. f1c    = Tlimit ? MCompensate(source, pMVS, f1v, thSAD=thSAD, thSCD1=thSCD1, thSCD2=thSCD2) : NOP()
  206. b1c    = Tlimit ? MCompensate(source, pMVS, b1v, thSAD=thSAD, thSCD1=thSCD1, thSCD2=thSCD2) : NOP()
  207. Tmax   = Tlimit ? source.mt_logic(f1c, "max", U=1, V=1).mt_logic(b1c, "max", U=1, V=1) : NOP()
  208. Tmin   = Tlimit ? source.mt_logic(f1c, "min", U=1, V=1).mt_logic(b1c, "min", U=1, V=1) : NOP()
  209. sclp   = Tlimit ? sclp.mt_clamp(Tmax, Tmin, Tovershoot, Tundershoot, U=2, V=2) : sclp
  210.  
  211.  
  212. end    = chroma ? sclp
  213. \               : ssout ? ssoutc ? sclp.MergeChroma(filtered_ss)
  214. \                                : sclp
  215. \                       : sclp.MergeChroma(filtered_os)
  216.  
  217. return end
  218. }
  219.  
  220.  
  221. Function MinBlur(clip clp, int "r", int "uv"){
  222.  
  223. r     = Default(r,  1)
  224. uv    = Default(uv, 3)
  225.  
  226. uv2   = (uv==2) ? 1  : uv
  227. rg4   = (uv==3) ? 4  : -1
  228. rg11  = (uv==3) ? 11 : -1
  229. rg20  = (uv==3) ? 20 : -1
  230. medf  = (uv==3) ? 1  : -200
  231. uvm2  = (r==2)  ? (uv==3?3:uv==2?0:-1) : nop()
  232. uvm3  = (r==3)  ? (uv==3?3:uv==2?0:-1) : nop()
  233.  
  234. RG11D = (r==0) ? mt_makediff(clp, clp.sbr(uv=uv2), U=uv2, V=uv2)
  235. \     : (r==1) ? mt_makediff(clp, clp.removegrain(11, rg11), U=uv2, V=uv2)
  236. \     : (r==2) ? mt_makediff(clp, clp.removegrain(11, rg11).removegrain(20, rg20), U=uv2, V=uv2)
  237. \     :          mt_makediff(clp, clp.removegrain(11, rg11).removegrain(20, rg20).removegrain(20, rg20), U=uv2, V=uv2)
  238. RG4D  = (r<=1) ? mt_makediff(clp, clp.removegrain(4,  rg4 ), U=uv2, V=uv2)
  239. \     : (r==2) ? mt_makediff(clp, clp.Quantile(radius_y=2, radius_u=uvm2, radius_v=uvm2), U=uv2, V=uv2)
  240. \     :          mt_makediff(clp, clp.Quantile(radius_y=3, radius_u=uvm3, radius_v=uvm3), U=uv2, V=uv2)
  241.  
  242. DD    = mt_lutxy(RG11D, RG4D, "x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?", U=uv2, V=uv2)
  243.  
  244. return clp.mt_makediff(DD, U=uv, V=uv)
  245. }
  246.  
  247.  
  248. Function sbr(clip c, int "uv") {
  249. uv     = Default(uv, 1)
  250. uv2    = (uv==2) ? 1  : uv
  251. rg11   = (uv==3) ? 11 : -1
  252. rg11D  = mt_makediff(c, c.removegrain(11, rg11), U=uv2, V=uv2)
  253. rg11DD = mt_lutxy(rg11D, rg11D.removegrain(11, rg11), "x y - x 128 - * 0 < 128 x y - abs x 128 - abs < x y - 128 + x ? ?", U=uv2, V=uv2)
  254.  
  255. return c.mt_makediff(rg11DD, U=uv, V=uv)
  256. }
  257.  
  258.  
  259. Function CSmod_nrSpline64Resize(clip input, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", bool "chroma", val "nr") {
  260.  
  261.   w             = input.Width
  262.   h             = input.Height
  263.  
  264.   target_width  = Default(target_width,      w)
  265.   target_height = Default(target_height,     h)
  266.   src_left      = Default(src_left,          0)
  267.   src_top       = Default(src_top,           0)
  268.   src_width     = Default(src_width,         w)
  269.   src_height    = Default(src_height,        h)
  270.   chroma        = Default(chroma,         true)
  271.   nr            = Default(nr,             true)
  272.  
  273.   Assert( IsFloat(nr) || IsBool(nr), """CSmod_nrSpline64Resize: "nr" should be either bool or float!""" )
  274.  
  275.   res_mul   = Float( target_width * target_height ) / Float( w * h )
  276.   res_mul   = min( max( res_mul, 1 ), 2.25 )
  277.   nr_weight = IsFloat(nr)       ? nr
  278.   \         : nr /* == True  */ ? Spline( res_mul, 1, 0, 2.25, 1, 3.5, 0, true )
  279.   \         :    /* == False */   0
  280.   nr_weight = min( max( nr_weight, 0 ), 1 )
  281.  
  282.   try {
  283.     inputp = chroma       ? input.IsYV12 ? input
  284.     \                                    : input.ConvertToYV12
  285.     \                     : input.ConvertToY8
  286.   } catch ( error_msg ) {
  287.     inputp = input.IsYV12 ? input
  288.     \                     : input.ConvertToYV12
  289.   }
  290.  
  291.   resize = inputp.Spline64Resize(target_width, target_height, src_left, src_top, src_width, src_height)
  292.   nrres  = inputp.GaussResize(target_width, target_height, src_left, src_top, src_width, src_height, p=100)
  293.   resize = resize.GetCSP == "Y8" ? resize.ConvertToYV12 : resize
  294.   nrres  = nrres .GetCSP == "Y8" ? nrres .ConvertToYV12 : nrres
  295.  
  296.   resize = nr_weight == 0 ? resize
  297.   \      : nr_weight == 1 ? resize.Repair(nrres, 1, chroma ? 1 : -1)
  298.   \      : chroma         ? Merge    (resize, resize.Repair(nrres, 1,  1), nr_weight)
  299.   \                       : MergeLuma(resize, resize.Repair(nrres, 1, -1), nr_weight)
  300.  
  301.   return resize
  302. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement