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, 20:57 by: mirkosp     +1   -1
Avatar

Bimbosp

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

Status:


Necropost di più di 6 anni, oh yeah baby!

Vi sono mancato? Ovviamente no, ma fa niente.

Ad ogni modo, maskdetail continuava a starmi stretto, nel senso che le maschere che tirava fuori non mi convincevano mai pienamente ed ero certo che ci fosse qualcosa nel procedimento stesso da dover rivedere.
Principalmente, l'approccio a colpi di expand e inflate per cercare di costruire la maschera porta a un risultato molto artificiale e "quadrettoso" che poco combacia con l'area che realmente si voleva mascherare idealmente.
Quel che ne è risultato dopo una sessione di brainstorming e testing di non so quantificare quanto tempo è quel che segue:

CODICE
#edmask v1.0 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") {
thrmax=default(thrmax,128)
thrmin=default(thrmin,50)
cut=default(cut,40)
c
edmask=diffmask(last,debicubicy(width,height).bicubicresize(c.width,c.height)).removegrain(11)
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()
edmask.mt_lut("x "+string(thrmax)+" > 255 x "+string(thrmin)+" > 128 0 ? ?").bicubicresize(320,muldiv(320,c.height,c.width)).removegrain(11).mt_lut("x "+string(cut)+" > 255 0 ? ?").blur(1).bicubicresize(width,height)
}


Ovviamente, in mia piena tradizione, non è esattamente la cosa più veloce e "stabile" (a livello di cpu) che ci sia, ma rispetto a roba che ho tirato fuori in passato ho fatto dei passi da gigante!
Il risultato comunque, per quanto possa probabilmente avere ulteriori migliore, mi convince e soddisfa a sufficienza.
Sotto spoiler un'immagine di riferimento e il confronto tra maskdetail con settaggi di default ed edmask con settaggi di default:


Sicuramente potrete lamentarvi che usare maskdetail con settaggi default sia una mezza bastardata, per cui vi lascio di seguito un altro riferimento di alcuni settaggi a cui ero arrivato con scarsa soddisfazione tentando di farci qualcosa (forse a causa di incompetenza mia nell'adoperare maskdetail, anche, eh, non lo escluderei):
CODICE
maskdetail(1440,810,cutoff=40,gain=2.5,expandN=3)


Come vedete, siamo a livelli simili, ma leggermente inferiori, di affidabilità della maschera in quanto a dettagli rintracciati, ma con nettamente più falsi positivi e un look inevitabilmente "quadrettoso", come lo chiamavo più sopra.
L'unico contraltare di edmask è che, quando i falsi positivi riescono a sopravvivere a tutti i passaggi, si potrebbero portare appresso un'area potenzialmente più grossa nella maschera finale rispetto a maskdetail, ma soppesando pro e contro mi accontento così.

Spero che vi torni utile, ma siamo nel 2021 e il fansub è morto l'encoding nel fansub ha lasciato spazio al remux, quindi vabbè.
 
Web  Top
28 replies since 3/2/2013, 04:12   5530 views
  Share