Log in

View Full Version : TRMC Auxclip / prefilter error


anton_foy
9th April 2022, 14:12
Hey, I modified TSMC to TRMC based off of a Didée idea but when I try to use auxclip to prefilter I get this error message:
MCompensate : wrong source or super frame size
It refers to line 197: mocomp = Mcompensate(input,super,vmulti2,thsad=mthresh,tr=tradius,center=true,mt=true)
Any ideas?

TRMC:
# TRMC
function TRMC(clip input, int "tradius", int "mthresh", int "lumathresh", int "LR", int "CR",
\ int "blocksize",clip "auxclip", bool "pref", int "Y", int "UV")
{

pref = Default(pref, true)
Y = Default(Y, 3)
UV = Default(UV, 2)

t=Defined(tradius)
tradius=t ? tradius : 6
# temporal radius-number of frames analyzed before/after current frame.

LR = Default( LR, 12)
CR = Default( CR, 30)

m=Defined(mthresh)
mthresh=m ? mthresh : 180
# motion threshold-higher numbers denoise areas with higher motion.
#Anything above this number does not get denoised.

l=Defined(lumathresh)
lumathresh=l ? lumathresh : 255
# luma threshold- Denoise pixels that match in surrounding frames.
#255 is the maximum and default. 0-255 are valid numbers.
#Also adjusts chroma threshold.

b=Defined(blocksize)
blocksize=b ? blocksize : 16
#larger numbers = faster processing times

chroma = UV == 3
aux=Defined(auxclip)

w = width(input)
h = height(input)
isUHD = (w > 2599 || h > 1499)
nw = round(w/2.0)
nh = round(h/2.0)
inputA = input
inputA = aux ? auxclip : isUHD ? inputA.ConvertBits(8,dither=-1).BilinearResize(nw+nw%2, nh+nh%2) : inputA

super = MSuper(input, pel=1, hpad = 0, vpad = 0, chroma=true, mt=true, levels=1)
superfilt = MSuper(inputA,pel=1, hpad = 0, vpad = 0, chroma=true, mt=true)

vmulti = Manalyse(superfilt,multi=true,delta=tradius,temporal=true,truemotion=true,blksize=blocksize,overlap=blocksize/2, mt=true, chroma=true)
vmulti2 = Mrecalculate(superfilt,vmulti,thsad=mthresh,truemotion=true,tr=tradius,blksize=blocksize/2,overlap=blocksize/4, mt=true, chroma=true)
vmulti2 = isUHD ? vmulti2.MScaleVect() : vmulti2
mocomp = Mcompensate(input,super,vmulti2,thsad=mthresh,tr=tradius,center=true,mt=true)
dnmc = mocomp.T_REP(T=Tradius,LR=LR,CR=CR)
dec = selectevery(dnmc,tradius * 2 + 1,tradius)
Y != 3 ? input.mergechroma(dec) : dec }

function T_rep(clip c, int "t", int "lr", int "cr"){
T = Default( T, 6)
LR = Default( LR, 12)
CR = Default( CR, 30)
c.temporalsoften(t,lr,cr,28,2)
last.clense().repair(last,1)
}

Avs script line:
p = coloryuv(autogain=true).fft3dfilter(sigma=0.7,sigma2=1,sigma3=1.7,sigma4=1.7,plane=0,bt=1,ncpu=4)
Trmc(auxclip=p)

Ceppo
9th April 2022, 16:56
I did I quick read, try:

super = MSuper(inputA,pel=1, hpad = 0, vpad = 0, chroma=true, mt=true)

vmulti = Manalyse(super,multi=true,delta=tradius,temporal=true,truemotion=true,blksize=blocksize,overlap=blocksize/2, mt=true, chroma=true)
vmulti2 = Mrecalculate(super,vmulti,thsad=mthresh,truemotion=true,tr=tradius,blksize=blocksize/2,overlap=blocksize/4, mt=true, chroma=true)
vmulti2 = isUHD ? vmulti2.MScaleVect() : vmulti2
super = aux || isUHD ? MSuper(input, pel=1, hpad = 0, vpad = 0, chroma=true, mt=true, levels=1) : super

mocomp = Mcompensate(input,super,vmulti2,thsad=mthresh,tr=tradius,center=true,mt=true)
dnmc = mocomp.T_REP(T=Tradius,LR=LR,CR=CR)

It probabily won't work, but the idea is that one.

anton_foy
9th April 2022, 17:25
I did I quick read, try:

super = MSuper(inputA,pel=1, hpad = 0, vpad = 0, chroma=true, mt=true)

vmulti = Manalyse(super,multi=true,delta=tradius,temporal=true,truemotion=true,blksize=blocksize,overlap=blocksize/2, mt=true, chroma=true)
vmulti2 = Mrecalculate(super,vmulti,thsad=mthresh,truemotion=true,tr=tradius,blksize=blocksize/2,overlap=blocksize/4, mt=true, chroma=true)
vmulti2 = isUHD ? vmulti2.MScaleVect() : vmulti2
super = aux || isUHD ? MSuper(input, pel=1, hpad = 0, vpad = 0, chroma=true, mt=true, levels=1) : super

mocomp = Mcompensate(input,super,vmulti2,thsad=mthresh,tr=tradius,center=true,mt=true)
dnmc = mocomp.T_REP(T=Tradius,LR=LR,CR=CR)

It probabily won't work, but the idea is that one.

Thanks but same error unfortunately.

Dogway
9th April 2022, 17:28
To answer your PM since I don't have more space, it looks a bit to TemporalSoften mode in SMDegrain.
SMDegrain(6, 180, mode="TemporalSoften", prefilter=5, ContraSharp=false, RefineMotion=true, LFR=0, DCTFlicker=true)

I will have a look at the auxclip issue.

EDIT: It happens with UHD sources because you are not downscaling 'auxclip' as you do with 'inputA'

Try this:
inputA = aux ? auxclip : input
inputA = isUHD ? inputA.ConvertBits(8,dither=-1).BilinearResize(nw+nw%2, nh+nh%2) : inputA

anton_foy
9th April 2022, 17:37
To answer your PM since I don't have more space, it looks a bit to TemporalSoften mode in SMDegrain.
SMDegrain(6, 180, mode="TemporalSoften", prefilter=5, ContraSharp=false, RefineMotion=true, LFR=0, DCTFlicker=true)

I will have a look at the auxclip issue.

EDIT: It happens with UHD sources because you are not downscaling 'auxclip' as you do with 'inputA'

Thanks you yes they are very similar and very close in speed too but I noticed TRMC retains more detail and if truemotion=false it is even better than if =true.

EDIT: It works thank you! :)