Recensubs HQ

Inverse Kernel Resize and you, Tutto quello che hai sempre voluto sapere ma non hai mai osato chiedere

« Older   Newer »
  Share  
mirkosp
view post Posted on 19/1/2021, 21:12 by: mirkosp     +1   -1
Avatar

Bimbosp

Group:
Administrator
Posts:
9,780
Reputation:
+929
Location:
Gallarate (VA)

Status:


Colpo di scena abbiamo già una v1.1!

Confrontandomi su Telegram col nostro Snobbino di quartiere, abbiamo convenuto che a conti fatti l'apporto di eedi per certi versi rasenta il placebo (ma bisognerebbe confrontare su più contenuti per verificare per bene).
Il grosso viene fatto comunque dal passaggio alla risoluzione bassa, che però qualcuno potrebbe voler customizzare.

Per non togliere del tutto la possibilità di avere eedi, per chi lo volesse usare comunque, e per aggiungere la possibilità di specificare la res bassa di riferimento, ecco una v1.1:
CODICE
#edmask v1.1 by mirkosp
#yet another detail mask function for high res elements overlayed on upscaled content
#in other words, masking those 1080 things on non-1080 chinese cartoons.
#first we do the usual: a difference and a removegrain for a first false positive cleanup step
#then we use eedi: actual detail is more likely to be close together and connected, not separated
#however, the first step often runs into false negatives and a straight line at 1080 will often have a few missing bits here and there
#by running eedi, we make sure that things that should be together (text lines and so on) actually get connected
#obviously, since our final result is a mask, we can pick speed over quality settings with little repercussions
#next, we try to clean up false negatives: by running a preliminary lut we cut away a few things, and leave at a 50:50 limbo things which might be details or not
#once we've done that, as actual 1080 details are more likely to be things visible at a distance and not a random dot in the middle of the screen, we do a massive downscale
#by doing this with another removegrain, we improve our odds of removing random false positive noise around the screen
#with a final blur before going back to the final res we ensure the mask is soft so the reversed upscale and the normal resize blend together well enough

function edmask (clip c, int width, int height, int "thrmax", int "thrmin", int "cut", int "wlow", bool "eedimode") {
thrmax=default(thrmax,128)
thrmin=default(thrmin,50)
cut=default(cut,40)
wlow=default(wlow,320)
eedimode=default(eedimode,false)
c
edmask=diffmask(last,debicubicy(width,height).bicubicresize(c.width,c.height)).removegrain(11)
qmask=edmask
edmask=overlay(edmask.eedi3(0,alpha=0.8,beta=0.1,gamma=100,u=false,v=false,ucubic=false,cost3=false,vcheck=0,mdis=5,nrad=1),edmask.eedi3(1,alpha=0.8,beta=0.1,gamma=100,u=false,v=false,ucubic=false,cost3=false,vcheck=0,mdis=5,nrad=1)).turnleft()
edmask=overlay(edmask.eedi3(0,alpha=0.8,beta=0.1,gamma=100,u=false,v=false,ucubic=false,cost3=false,vcheck=0,mdis=5,nrad=1),edmask.eedi3(1,alpha=0.8,beta=0.1,gamma=100,u=false,v=false,ucubic=false,cost3=false,vcheck=0,mdis=5,nrad=1)).turnright()
return eedimode ? edmask.mt_lut("x "+string(thrmax)+" > 255 x "+string(thrmin)+" > 128 0 ? ?").bicubicresize(wlow,muldiv(wlow,c.height,c.width)).removegrain(11).mt_lut("x "+string(cut)+" > 255 0 ? ?").blur(1).bicubicresize(width,height) : qmask.mt_lut("x "+string(thrmax)+" > 255 x "+string(thrmin)+" > 128 0 ? ?").bicubicresize(wlow,muldiv(wlow,c.height,c.width)).removegrain(11).mt_lut("x "+string(cut)+" > 255 0 ? ?").blur(1).bicubicresize(width,height)
}


Visto che eedi sembra essere quasi placebo, ho deciso di lasciarlo disattivato di default.
 
Web  Top
28 replies since 3/2/2013, 04:12   5530 views
  Share