PDA

View Full Version : selectevery question


rkalwaitis
23rd October 2009, 13:13
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
# Use some denoiser (blur) or deflicker for prefiltering
prefiltered = blur(1.0)
super = MSuper(levels=1) # one level is enough for MCompensate
superfilt = MSuper(prefiltered) # all levels for MAnalyse
backward_vectors = MAnalyse(superfilt, isb = true)
How do they determine what to select? At the bottom they selected 3,1.

what if it were there were three forward compensations and three backward compensations and three of each for manalyse? They what do you select then?

forward_vectors = MAnalyse(superfilt, isb = false)
# use not-prefiltered (super) clip for motion compensation
forward_compensation = MCompensate(super, forward_vectors)
backward_compensation = MCompensate(super, backward_vectors)
# create interleaved 3 frames sequences
interleave(forward_compensation, last, backward_compensation)

DeGrainMedian() # place your preferred temporal (spatial-temporal) denoiser here

selectevery(3,1) # return filtered central (not-compensated) frames only

Terka
23rd October 2009, 13:20
then you need a denoiser which uses all of them and selectevery(7,3) (in case the original is in the middle)
why dont you use mdegrain3?
the selectevery means: from 3 select the nr.1 (they are 0,1,2)
the 3forward/backward selectevery means: from 7 select the nr.3 (they are 0,1,2,3,4,5,6,7)

rkalwaitis
23rd October 2009, 13:32
I wanted to use mdgrain with mcompensate 3 forwards and 3 backs for each but I did not understand the selectevery idea. Im still not so sure I do. where do they get the numbers from?

so from my example above from the mvtools documentation, what is 3 and what is 1?

so the three are in the interleaved line the three is the total of items interleaved and the 1 is the "last" in the case above.

so the selectevery (7,3) would only be used for mdgrain by itself not taking into consideration the mcompensation part?

rkalwaitis
23rd October 2009, 14:06
did I select the right ones?

source = last
preNR=source.degrainmedian(limitY=2,limitUV=3,mode =1).fft3dfilter(wintype=1,bt=3,bw=32,bh=32,ow=16,oh=16,degrid=1,sigma=6.0,plane=0)
preNR_super = preNR.MSuper(pel=2, sharp=1, rfilter=4)
source_super = source.MSuper(pel=2, sharp=1, levels=1)
vb2 = MAnalyse(preNR_super,isb=true,truemotion=true,delta=2,blksize=16,overlap=4,pelsearch=2,search=2,searchparam=2,DCT=0,chroma=false)
vb1 = MAnalyse(preNR_super,isb=true,truemotion=true,delta=1,blksize=16,overlap=4,pelsearch=2,search=2,searchparam=2,DCT=0,chroma=false)
vf1 = MAnalyse(preNR_super,isb=false,truemotion=true,delta=1,blksize=16,overlap=4,pelsearch=2,search=2,searchparam=2,DCT=0,chroma=false)
vf2 = MAnalyse(preNR_super,isb=false,truemotion=true,delta=2,blksize=16,overlap=4,pelsearch=2,search=2,searchparam=2,DCT=0,chroma=false)

fc1 = MCompensate(preNR_super, vf1)
bc1 = MCompensate(preNR_super, vb1)
fc2 = MCompensate(preNR_super, vf2)
bc2 = MCompensate(preNR_super, vb2)
# create interleaved 3 frames sequences
interleave(fc1, fc2,last,bc1,bc2)

degrainmedian()

selectevery(5,2) # return filtered central (not-compensated) frames only

Terka
23rd October 2009, 15:27
imho forget the interleave-degrainmedian-selectevery thing
use mdegrain1, 2 or 3 (you dont need to use MCompensate and mdegrain is probable better than degrainmedian)

on mvtools2 page is something like this:
super = MSuper()
bv1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
fv1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
bv2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
fv2 = MAnalyse(super, isb = false, delta = 2, overlap=4)
bv3 = MAnalyse(super, isb = true, delta = 3, overlap=4)
fv3 = MAnalyse(super, isb = false, delta = 3, overlap=4)
MDegrain3(super,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=400)
MDegrain3 is NOT followed by selectevery
or if you want something 'more simple' there exist some version the "Multi" MVTools modification by Josey Wells.
the usage is see an example below. (you just enter the refframes nr.)


calm = calmI(bob)
denoised = mo_denoiseAB (calm,bob)
denoised
#######################################################################


###################################################
function mo_denoiseAB (clip calm,clip denoise , int "blksize", int "overlap", int "blksize", int "sharp", int "thSAD", int "refframes")
{
clp=denoise
idx = 20
blksize = default(blksize,4) # blksize value (4, 8 or 16)
overlap = default(overlap,blksize/2) # overlap value (0 to half blksize)
sharp = default(sharp,1) # 0=bilinear softest, 1=bicubic, 2=Wiener sharpest
thSAD = default(thSAD,400) # 640didee,200 orig. higher risks motion ghosting and swimming, lower risks blotchy denoising
refframes = default(refframes,8) # temporal radius for MVTools using the "Multi" modification by Josey Wells


vectors = calm.MVAnalyseMulti(refframes = refframes, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx)

clp.MVDegrainMulti(vectors, refframes = refframes, thSAD = thSAD, idx = idx + 1)
return(last)
}

function calmI (clip)
{
t1 = clip.temporalsoften(1,255,255,28,2)
t2 = clip.temporalsoften(2,255,255,28,2)
t1.merge(t2,0.357).merge(clip,0.125)
return(last)
}

Terka
23rd October 2009, 15:35
the mdegrain is better because for deinoising it uses information about how sucessfull was the motion compensation. but 3rd party filters has only the mo-compensated frames, with errors and they dont know that there are errors and where are they.
another possibility is to use special functions eg. from Didee or LaTo, etc. Search for
Temporal Degrain
MCTemporalDenoise
MC_Spuds.

rkalwaitis
23rd October 2009, 16:54
Okay I get it now, thanks for your help. You rock!

Terka
23rd October 2009, 20:08
im beginner, much more info you will get on proper posts.
use search. the mdegrain2 or 3 are good enough. no more refframes are needed.