hydra3333
27th January 2010, 04:30
I'm not sure how to use LimitedSharpenFaster with interlaced BFF material ...
The script below is what I have far ... should LimitedSharpenFaster be on the whole unseparated clip like it is now, or should it be done separately on each field (I guess within the function) ? The result is fed into HCenc. Also, comment on whether this is the right way to go about using AGC with interlaced material would be appreciated.
AviSource("canon-mv920-file.avi", audio=false)
AssumeFPS(25)
AssumeBFF()
MDegrain1i2(doAGC=TRUE).LimitedSharpenFaster(smode=4,strength=100)
AssumeBFF()
function AGCiEmbedded(clip srcclp) {
inpclp = srcclp
#inpclp=inpclp.HDRAGC(coef_gain=1.0, coef_sat=1.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.1, coef_sat=1.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.2, coef_sat=1.0, corrector=0.8, reducer=2.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.2, min_gain=0.1, max_gain=1.0, coef_sat=1.0, corrector=0.8, reducer=2.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.2, min_gain=0.1, max_gain=1.0, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=0.5) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
inpclp=inpclp.HDRAGC(coef_gain=0.1, min_gain=0.1, max_gain=0.5, coef_sat=0.75, corrector=0.8, reducer=2.0, black_clip=1.0)
#inpclp=inpclp.HDRAGC(coef_gain=0.1, min_gain=0.1, max_gain=0.5, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=1.0)
#inpclp=inpclp.HDRAGC(coef_gain=0.1, min_gain=0.2, max_gain=1.0, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=1.0)
return inpclp
}
function AGCiEmbedded_EvenOdd(clip srcclp) {
# Assume SEPARATEFIELDS HAS ALREADY BEEN DONE BEFORE THE CALL TO THIS FUNCTION
e=srcclp.SelectEven().AGCiEmbedded()
o=srcclp.SelectOdd().AGCiEmbedded()
return Interleave(e,o)
}
function MDegrain1i2(clip srcclp, int "blksize", int "overlap", int "dct", bool "doAGC") {
doAGC=default(doAGC,TRUE)
# AssumexFF() must have been done prior to calling this function or funny things happen
blksize=default(blksize,8) # # 4, 8 or 16 ( default is 8 ). Larger blocks are less sensitive to noise, are faster, but also less accurate.
overlap=default(overlap,4) # overlap value (0 to 4 for blksize=8) Must be even and less than block size
dct=default(dct,0) # use dct=1 for clip with light flicker
fields=srcclp.SeparateFields() # separate by fields
super = fields.MSuper(pel=2, chroma=true, sharp=2) # half-pixel accuracy of the motion estimation
backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct, chroma=true)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct, chroma=true)
fields=fields.MDegrain1(super, backward_vec2,forward_vec2,thSAD=400,plane=4)
doAGC ? fields.AGCiEmbedded_EvenOdd() : fields
Weave()
}
Converttoyv12(interlaced=true)
SetPlanarLegacyAlignment(True)
I'm guessing that if LSF needs to be applied separately to fields, the right way would be to change the function header to
function MDegrain1i2(clip srcclp, int "blksize", int "overlap", int "dct", bool "doAGC", bool "doLSF") {
doAGC=default(doAGC,TRUE)
doLSF=default(doLSF,TRUE)
and add another line after the "doAGC ?" line like
doLSF ? fields.LSF_EvenOdd(smode=4,strength=100) : fields
and add another function
function LSF_EvenOdd(clip srcclp) {
# Assume SEPARATEFIELDS HAS ALREADY BEEN DONE BEFORE THE CALL TO THIS FUNCTION
e=srcclp.SelectEven().LimitedSharpenFaster(smode=4,strength=100)
o=srcclp.SelectOdd().LimitedSharpenFaster(smode=4,strength=100)
return Interleave(e,o)
}
The script below is what I have far ... should LimitedSharpenFaster be on the whole unseparated clip like it is now, or should it be done separately on each field (I guess within the function) ? The result is fed into HCenc. Also, comment on whether this is the right way to go about using AGC with interlaced material would be appreciated.
AviSource("canon-mv920-file.avi", audio=false)
AssumeFPS(25)
AssumeBFF()
MDegrain1i2(doAGC=TRUE).LimitedSharpenFaster(smode=4,strength=100)
AssumeBFF()
function AGCiEmbedded(clip srcclp) {
inpclp = srcclp
#inpclp=inpclp.HDRAGC(coef_gain=1.0, coef_sat=1.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.1, coef_sat=1.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.2, coef_sat=1.0, corrector=0.8, reducer=2.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.2, min_gain=0.1, max_gain=1.0, coef_sat=1.0, corrector=0.8, reducer=2.0) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
#inpclp=inpclp.HDRAGC(coef_gain=0.2, min_gain=0.1, max_gain=1.0, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=0.5) # default. +coef_gain=brighter decrease to limit. +coef_sat=more saturation
inpclp=inpclp.HDRAGC(coef_gain=0.1, min_gain=0.1, max_gain=0.5, coef_sat=0.75, corrector=0.8, reducer=2.0, black_clip=1.0)
#inpclp=inpclp.HDRAGC(coef_gain=0.1, min_gain=0.1, max_gain=0.5, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=1.0)
#inpclp=inpclp.HDRAGC(coef_gain=0.1, min_gain=0.2, max_gain=1.0, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=1.0)
return inpclp
}
function AGCiEmbedded_EvenOdd(clip srcclp) {
# Assume SEPARATEFIELDS HAS ALREADY BEEN DONE BEFORE THE CALL TO THIS FUNCTION
e=srcclp.SelectEven().AGCiEmbedded()
o=srcclp.SelectOdd().AGCiEmbedded()
return Interleave(e,o)
}
function MDegrain1i2(clip srcclp, int "blksize", int "overlap", int "dct", bool "doAGC") {
doAGC=default(doAGC,TRUE)
# AssumexFF() must have been done prior to calling this function or funny things happen
blksize=default(blksize,8) # # 4, 8 or 16 ( default is 8 ). Larger blocks are less sensitive to noise, are faster, but also less accurate.
overlap=default(overlap,4) # overlap value (0 to 4 for blksize=8) Must be even and less than block size
dct=default(dct,0) # use dct=1 for clip with light flicker
fields=srcclp.SeparateFields() # separate by fields
super = fields.MSuper(pel=2, chroma=true, sharp=2) # half-pixel accuracy of the motion estimation
backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct, chroma=true)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct, chroma=true)
fields=fields.MDegrain1(super, backward_vec2,forward_vec2,thSAD=400,plane=4)
doAGC ? fields.AGCiEmbedded_EvenOdd() : fields
Weave()
}
Converttoyv12(interlaced=true)
SetPlanarLegacyAlignment(True)
I'm guessing that if LSF needs to be applied separately to fields, the right way would be to change the function header to
function MDegrain1i2(clip srcclp, int "blksize", int "overlap", int "dct", bool "doAGC", bool "doLSF") {
doAGC=default(doAGC,TRUE)
doLSF=default(doLSF,TRUE)
and add another line after the "doAGC ?" line like
doLSF ? fields.LSF_EvenOdd(smode=4,strength=100) : fields
and add another function
function LSF_EvenOdd(clip srcclp) {
# Assume SEPARATEFIELDS HAS ALREADY BEEN DONE BEFORE THE CALL TO THIS FUNCTION
e=srcclp.SelectEven().LimitedSharpenFaster(smode=4,strength=100)
o=srcclp.SelectOdd().LimitedSharpenFaster(smode=4,strength=100)
return Interleave(e,o)
}