Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th October 2020, 14:26   #1  |  Link
agressiv
Registered Loser
 
agressiv's Avatar
 
Join Date: Dec 2004
Posts: 117
Problem with McDegrainSharp()

Hey guys -

I really love the McDegrainSharp() function. However, one out of say, every four encodes hangs right after the last frame and I have to CTRL-C out of the encoder, even if I encode the same clip four times. The encode is otherwise fine - it just won't exit normally.

Source material doesn't matter. Remove that function, and it never hangs.

Running AviSynth+ 3.6.1. Any ideas on how to troubleshoot?
agressiv is offline   Reply With Quote
Old 20th October 2020, 14:38   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
It will likely be version of avisynth or of one of the plugin dll's [ie MvTools], not the McDegrain script itself.

I use that script function all of the time (pretty much every encode), and never suffered similar problems.

Suggest use avs+ 3.6.2 test 2 or 3.6.2 test 3 as posted in Development by Pinterf earlier today. EDIT: https://forum.doom9.org/showthread.p...25#post1926225
[Also make sure you have latest mvtools]. [EDIT: https://github.com/pinterf/mvtools/releases/tag/2.7.43 ]

If still probs, post AvsMeter log, and also script used, and also what encoder is used.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 20th October 2020 at 14:52.
StainlessS is offline   Reply With Quote
Old 20th October 2020, 14:46   #3  |  Link
agressiv
Registered Loser
 
agressiv's Avatar
 
Join Date: Dec 2004
Posts: 117
Got it, thanks - will try new AviSynth. Wondering what your AviSynthMT settings are? That was my only other thought. Ent.dgi is a 90 second Star Trek: Enterprise clip with lots of grain and banding - my go-to for testing.

Code:
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)

SetFilterMTMode("DGSource", 3)
DGSource("D:\Movies\Ent\ent.dgi")

MCDegrainSharp(2)
Prefetch(6)
I have a 6-core box (12 threads) but if I bump prefetch to high, it tends to crash - but it will crash right away.


Tried avs2pipemod64 or avs2yuv64 feeding x264 or x265, so I don't think it's the encoder. Also tried NVencC64 standalone.

MvTools2 is 2.7.43.
agressiv is offline   Reply With Quote
Old 20th October 2020, 15:00   #4  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
First of all, don't use those SetFilterMTMode calls. Any modern filters will already tell Avs+ which one is correct. For the rest, copy-paste the content from here: https://pastebin.com/tmw7J2mj and save as mtmodes.avsi in your Avisynth+ plugins(64) directory.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 20th October 2020, 15:55   #5  |  Link
agressiv
Registered Loser
 
agressiv's Avatar
 
Join Date: Dec 2004
Posts: 117
Attached is the log. I can't get AVSMeter to hang (figured it would, but I've never used the tool before).

Maybe I'll try lowering Prefetch a bit.

Edit: Is http://forum.doom9.org/showthread.ph...45#post1737045 still where the most current avsi is for McDegrain?
Attached Files
File Type: txt ent.txt (174.9 KB, 30 views)

Last edited by agressiv; 20th October 2020 at 15:57.
agressiv is offline   Reply With Quote
Old 21st October 2020, 21:09   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Maybe you would like to try this (McDegrainSharp), just made some mods today, not much tested.

Code:
/*
  McDegrain(), by Didee.            https://forum.doom9.org/showthread.php?p=1508289#post1508289

  Mods by StainlessS.
  v1.02, 17 Feb 2020. Added Limit, LimitC. BlkSz based on frame size.
  v1.04, 21 Oct 2020, Add args bblur, Pel, Chroma, BlkSz, OLap, Plane, Tm, Glob, ThSAD and ThSAD2.
  v1.05, 01 Nov 2020, If Colorspace 8 bit, force Limit/LimitC args to type Int.

  McDegrain(clip c, int "frames"=2, Float "Limit"=255, Float "LimitC"=Limit,
    \ float "bblur"=0.0,int "Pel"=2,  bool "Chroma"=True,Int "BlkSz",Int "Olap"=BlkSz/2, Int "Plane"=4,
    \ bool "Tm"=True,Bool "glob"=tm, Int "ThSAD"=400,Int "ThSAD2"=ThSAD)

    Frames,   Default 2 (1 or more, was 3 max). Temporal radius of frames processed, default as per MDegrain2.
    Limit,    Default 255 [no limit]. Limits amount of change to pixel luma.
    LimitC,   Default Limit. Limits amount of change to pixel Chroma.
              Default Limit/LimitC is 255 (int), but allows input eg 255.0 (Float)
                Pinterf MvTools v2.7.42 (20200522) changed MDegrainN Limit/LimitC types to Float.
                If Colorspace is 8 bit, then will force any user supplied float value to eg Int(Limit) or Int(LimitC).
                Will still be a problem (throw error in mvtools) if High Bit Depth, Float Limit/LimitC, and pre-Printerf v2.7.42 MvTools.
    bblur,    Default 0.0[OFF], Range 0.0 <= bblur <= 1.58. Blur prefilter for Super clip. Suggest about 0.6
              If bblur < 0.0, then will set bblur based on frame size, (c.width>1920) ? 0.75 : (c.width>1280) ? 0.7 : (c.width>960 ) ? 0.65 : 0.6)
    Pel,      Default 2. 1 may be better and faster for HD content.
    Chroma,   Default true. Set to true, it allows to take chroma into account when doing the motion estimation (false: luma only).
    BlkSz,    Block size used for MAnalyse. 8 <= BlkSz, ideally power of 2, at least multiple of 4.
              Default depends upon source clip width. (c.width>1920) ? 32 : (c.width>1280) ? 24 : (c.width>960 ) ? 16 : 8
    OLap,     Default half BlkSz, Block overlap.
    Plane,    Used by MDegrainN, color planes processed. 0=Luma, 1=Chroma U, 2=Chroma V, 3=Both chromas, 4=All Planes.
    Tm,       (truemotion) Default true. Arg to MAnalyse. Number of users believe false is better especially for larger blocksize and HD.
    Glob,     Global, Default tm. Allow set MAnalyse(global) independently of TrueMotion. Suggest always true.
    ThSAD     Default 400.
              Defines the soft threshold of block sum absolute differences.
              Block with SAD above threshold thSAD have a zero weight for averaging (denoising).
              Block with low SAD has highest weight.
              Rest of weight is taken from pixels of source clip.
              The provided thSAD value is scaled to a 8x8 blocksize.
              Low values can result in staggered denoising, large values can result in ghosting and artifacts.
    ThSAD2    Default ThSAD.
              Parameter is for MDegrainN, defines the SAD soft threshold for the furthest frames.
              The actual SAD threshold for each reference frame is a smooth interpolation between the original thSAD (close to the current frame) and thSAD2.
              Setting thSAD2 lower than thSAD allows large temporal radii and good efficiency for low SAD blocks while reducing the risk of bluring.
*/

Function McDegrain(clip c, int "frames",
    \ Float "Limit",Float "LimitC",
    \ float "bblur", int "Pel",bool "Chroma", Int "BlkSz",Int "OLap",Int "Plane",bool "Tm",Bool "glob", Int "ThSAD",Int "ThSAD2") {
    Function __McDegrain_bpc(clip c) {try {bpc=c.BitsPerComponent} catch(mes) {bpc=8} return bpc}
    myName = "McDegrain: "
    frames = Default(frames, 2)
    Limit  = Default(Limit,255)
    LimitC = Default(LimitC,Limit) # Default Limit/LimitC is 255 (int)
             Limit =(c.__McDegrain_bpc==8)?Limit.Int :Limit    # Force Limit/LimitC to type int if Colorspace is 8 bit
             LimitC=(c.__McDegrain_bpc==8)?LimitC.Int:LimitC
    bblur  = Default(bblur,0.0)    # Denoising for Super Clip.
    bblur  = (bblur>=0.0) ? bblur : (c.width>1920) ? 0.75 : (c.width>1280) ? 0.7 : (c.width>960 ) ? 0.65 : 0.6
    pel    = Default(pel,2)
    chroma = Default(chroma,true)  # Use chroma in MAnalyse for vectors
    BlkSz  = Default(BlkSz,(c.width>1920) ? 32 : (c.width>1280) ? 24 : (c.width>960 ) ? 16 : 8)
    OLap   = Default(OLap,BlkSz/2)
    Plane  = Default(Plane,4)
    tm     = Default(tm,true)       # TrueMotion
    Glob   = Default(glob,Tm)       # Default Tm, Allow set MAnalyse(global) independently of TrueMotion.
    ThSAD  = Default(ThSAD,400)
    ThSAD2 = Default(ThSAD2,ThSAD)
    Assert(0.0 <= bblur <= 1.58, myName + "0.0 <= bblur <= 1.58")
    Assert(pel==1 || pel==2 || pel==4, myName + "pel==1 || pel==2 || pel==4")
    Assert(0 <= Plane <= 4, myName + "0 <= Plane <= 4")
    super      = (bblur==0.0  ? c : c.blur(bblur)).MSuper(pel=pel, sharp=1)
    super_rend = (bblur==0.0) ? super : c.MSuper(pel=pel, sharp=1,Levels=1) # Only 1 Level required for rendering Super (not MAnalyse-ing)
    MultiVec = super.MAnalyse(multi=true,delta=frames,blksize=BlkSz,overlap=OLap,chroma=Chroma,truemotion=Tm,global=Glob)
    (frames<=0)
        \ ? c
        \ : c.MDegrainN(super_rend, MultiVec, Frames, thSAD=ThSAD, plane=Plane, Limit=Limit, LimitC=LimitC, thsad2=ThSAD2)
    return Last
}

/*
  McDegrainSharp(), by StainlessS.
  Original post:-                                   https://forum.doom9.org/showthread.php?p=1508635#post1508635
  Earlier mods:-                                    https://forum.doom9.org/showthread.php?p=1737045#post1737045
  Based on MCDegrain By Didee,                      https://forum.doom9.org/showthread.php?p=1508289#post1508289
  Also based on DiDee observations in this thread:  http://forum.doom9.org/showthread.php?t=161580
    "Denoise with MDegrainX, do slight sharpening where motionmatch is good, do slight blurring where motionmatch is bad"
    In areas where MAnalyse cannot find good matches, the blur() will be dominant.
    In areas where good matches are found, the sharpen()'ed pixels will overweight the blur()'ed pixels
    when the pixel averaging is performed.

  McDegrainSharp(clip c, int "frames"=2, float "bblur", float "csharp"=0.6, bool "bsrch"=True, bool "Precise"=False, Float "Limit"=255, Float "LimitC"=Limit,
    \ int "Pel"=2,  bool "Chroma"=True,Int "BlkSz",Int "Olap"=BlkSz/2, Int "Plane"=4,bool "Tm"=True,Bool "glob"=tm, Int "ThSAD"=400,Int "ThSAD2"=ThSAD)

  v1.02, 17 Feb 2020. Default bblur mod for HD. BlkSz (blocksize) mod for HD. Added Limit, LimitC. 17 Feb 2020.
  v1.04, 21 Oct 2020. Add args Pel, Chroma, BlkSz, OLap, Plane, Tm, Glob, ThSAD and ThSAD2.
  v1.05, 01 Nov 2020, If Colorspace 8 bit, force Limit/LimitC args to type Int.

    Frames,   Default 2 (1 or more, was 3 max). Temporal radius of frames processed, default as per MDegrain2.
    bblur,    Blur arg used for both MSuper pre-filter clip (bsrch==true) and blurring used where motion match is bad.
              Range 0.0 <= bblur <= 1.58.
              Default depends upon source clip width. (c.width>1920) ? 0.75 : (c.width>1280) ? 0.7 : (c.width>960 ) ? 0.65 : 0.6)
    csharp,   Default 0.6, (0.0 <= csharp <= 1.0) Sharpening used where motion match is good.
    bsrch,    Default True. If true, then prefilter clip is blurred source clip, c.blur(bblur).
    Precise,  Default false. If true, then uses MRecalculate to refine vectors.
    Limit,    Default 255 [no limit]. Limits amount of change to pixel luma.
    LimitC,   Default Limit. Limits amount of change to pixel Chroma.
              Default Limit/LimitC is 255 (int), but allows input eg 255.0 (Float)
                Pinterf MvTools v2.7.42 (20200522) changed MDegrainN Limit/LimitC types to Float.
                If Colorspace is 8 bit, then will force any user supplied float value to eg Int(Limit) or Int(LimitC).
                Will still be a problem (throw error in mvtools) if High Bit Depth, Float Limit/LimitC, and pre-Printerf v2.7.42 MvTools.
    Pel,      Default 2. 1 may be better and faster for HD content.
    Chroma,   Default true. Set to true, it allows to take chroma into account when doing the motion estimation (false: luma only).
    BlkSz,    Block size used for MAnalyse. 8 <= BlkSz, ideally power of 2, at least multiple of 4.
              Default depends upon source clip width. (c.width>1920) ? 32 : (c.width>1280) ? 24 : (c.width>960 ) ? 16 : 8
    OLap,     Default half BlkSz, Block overlap.
    Plane,    Used by MDegrainN, color planes processed. 0=Luma, 1=Chroma U, 2=Chroma V, 3=Both chromas, 4=All Planes.
    Tm,       (truemotion) Default true. Arg to MAnalyse. Number of users believe false is better especially for larger blocksize and HD.
    Glob,     Global, Default tm. Allow set MAnalyse(global) independently of TrueMotion. Suggest always true.
    ThSAD     Default 400.
              Defines the soft threshold of block sum absolute differences.
              Block with SAD above threshold thSAD have a zero weight for averaging (denoising).
              Block with low SAD has highest weight.
              Rest of weight is taken from pixels of source clip.
              The provided thSAD value is scaled to a 8x8 blocksize.
              Low values can result in staggered denoising, large values can result in ghosting and artifacts.
    ThSAD2    Default ThSAD.
              Parameter is for MDegrainN, defines the SAD soft threshold for the furthest frames.
              The actual SAD threshold for each reference frame is a smooth interpolation between the original thSAD (close to the current frame) and thSAD2.
              Setting thSAD2 lower than thSAD allows large temporal radii and good efficiency for low SAD blocks while reducing the risk of bluring.

*/


Function McDegrainSharp(clip c, int "frames", float "bblur", float "csharp", bool "bsrch",bool "Precise",Float "Limit",Float "LimitC",
    \ int "Pel",bool "Chroma", Int "BlkSz",Int "OLap",Int "Plane",bool "Tm",Bool "glob", Int "ThSAD",Int "ThSAD2") {
    Function __McDegrainSharp_bpc(clip c) {try {bpc=c.BitsPerComponent} catch(mes) {bpc=8} return bpc}
    myName = "McDegrainSharp: "
    frames = Default(frames, 2)
    bblur  = Default(bblur, (c.width>1920) ? 0.75 : (c.width>1280) ? 0.7 : (c.width>960 ) ? 0.65 : 0.6)
    csharp = Default(csharp, 0.6)
    bsrch  = Default(bsrch, true)
    Precise= Default(Precise,False)  # Use MRecalculate
    Limit  = Default(Limit,255)      # Max allowed Y change, Arg to MDegrainN. Default Limit/LimitC is 255 (int)
    LimitC = Default(LimitC,Limit)   # Max allowed U,V change
             Limit =(c.__McDegrainSharp_bpc==8)?Limit.Int :Limit    # Force Limit/LimitC to type int if Colorspace is 8 bit
             LimitC=(c.__McDegrainSharp_bpc==8)?LimitC.Int:LimitC
    pel    = Default(pel,2)
    chroma = Default(chroma,true)    # Use chroma in MAnalyse for vectors
    BlkSz  = Default(BlkSz,(c.width>1920) ? 32 : (c.width>1280) ? 24 : (c.width>960 ) ? 16 : 8)
    OLap   = Default(OLap,BlkSz/2)
    Plane  = Default(Plane,4)
    tm     = Default(tm,true)        # TrueMotion
    Glob   = Default(glob,Tm)        # Default Tm, Allow set MAnalyse(global) independently of TrueMotion.
    ThSAD  = Default(ThSAD,400)
    ThSAD2 = Default(ThSAD2,ThSAD)
    Assert(0.0 <= bblur <= 1.58, myName + "0.0 <= bblur <= 1.58")
    Assert(0.0 <= csharp <= 1.0, myName + "0.0 <= csharp <= 1.0")
    Assert(pel==1 || pel==2 || pel==4, myName + "pel==1 || pel==2 || pel==4")
    Assert(0 <= Plane <= 4, myName + "0 <= Plane <= 4")
    c2          = c.blur(bblur)
    super       = bsrch ? c2.MSuper(pel=pel, sharp=1) : c.MSuper(pel=pel, sharp=1)
    super_rend  = c.sharpen(csharp).MSuper(pel=pel, sharp=1,levels=1)   # Only 1 Level required for sharpened Super (not MAnalyse-ing)
    MultiVec    = super.MAnalyse(multi=true,delta=frames,blksize=BlkSz,overlap=OLap,chroma=Chroma,truemotion=Tm,global=Glob)
    # If Precise, then recalculate on Prefiltered (blurred) Super (NOT the sharpened render super)
    MultiVec = (Precise)
        \ ? super.MRecalculate(MultiVec,blksize=BlkSz/2,overlap=OLap/2,thSAD=100,chroma=chroma,truemotion=tm,global=Glob, tr=frames)
        \ : MultiVec
    (frames<=0)
        \ ? c
        \ : c2.MDegrainN(super_rend, MultiVec, Frames, thSAD=ThSAD, plane=Plane, Limit=Limit, LimitC=LimitC, thsad2=ThSAD2)
    return Last
}
UPDATED

Note, Frames now can be more than 3.

If it seems OK, then I'll probalby mod Didee's McDegrain() similarly. EDIT: DONE.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 23rd April 2022 at 11:11.
StainlessS is offline   Reply With Quote
Old 21st October 2020, 21:56   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
If it seems OK, then I'll probalby mod Didee's McDegrain() similarly.
Done.
Above post mod.

EDIT: Changed McDegrain slightly, added bblur < 0.0 auto set bblur based on frame size.

EDIT: Boulder makes a good point
and all file based sourcefilters should be MT_SERIALIZED(3) by default [no need to set individually].
(from Boulder link)
Code:
# Source plugins
SetFilterMTMode("DGSourceIM",          MT_SERIALIZED)     #DGDecIM        beta 50   2015/10/10
SetFilterMTMode("DGSource",            MT_SERIALIZED)     #DGDecNV           2046    2014/01/01 - GPU decoding
SetFilterMTMode("DSS2",                MT_SERIALIZED)     #DSS2          2.0.0.13   2014/11/10
SetFilterMTMode("FFAudioSource",       MT_SERIALIZED)     #FFMS2            V2.22   2015/10/12
SetFilterMTMode("FFImageSource",       MT_SERIALIZED)     #FFMS2            V2.22   2015/10/12
SetFilterMTMode("FFFFmpegSource2",     MT_SERIALIZED)     #FFMS2            V2.22   2015/10/12
SetFilterMTMode("FFMS2",               MT_SERIALIZED)     #FFMS2            V2.22   2015/10/12
SetFilterMTMode("FFVideoSource",       MT_SERIALIZED)     #FFMS2            V2.22   2015/10/12
SetFilterMTMode("FRIMSource",          MT_SERIALIZED)     #FRIMSource       V1.26   2016/01/16
SetFilterMTMode("JpegSource",          MT_SERIALIZED)     #JpegSource       --->    2014/04/19
SetFilterMTMode("LSMASHAudioSource",   MT_SERIALIZED)     #LSMASHSource     r877    2016/03/09
SetFilterMTMode("LSMASHVideoSource",   MT_SERIALIZED)     #LSMASHSource     r877    2016/03/09
SetFilterMTMode("LWLibavAudioSource",  MT_SERIALIZED)     #LSMASHSource     r877    2016/03/09
SetFilterMTMode("LWLibavVideoSource",  MT_SERIALIZED)     #LSMASHSource     r877    2016/03/09
#SetFilterMTMode("RawSource",          MT_SERIALIZED)     #RawSource26      20160528    2016/05/28 # this line is not needed after 20160528
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 21st October 2020 at 23:19.
StainlessS is offline   Reply With Quote
Old 22nd October 2020, 13:11   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Added in blue for McDegrain post #6
Code:
super_rend = (bblur==0.0) ? super : c.MSuper(pel=pel, sharp=1,Levels=1) # Only 1 Level required for rendering Super (not MAnalyse-ing)
Slightly faster when prefiltering super (bblur>0.0)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 22nd October 2020 at 14:00.
StainlessS is offline   Reply With Quote
Old 1st November 2020, 17:02   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #6 update [ McDegrain() and McDegrainSharp() ]

Changed in BLUE (Only shown for McDegrainSharp).

Docs
Code:
  McDegrainSharp(clip c, int "frames"=2, float "bblur", float "csharp"=0.6, bool "bsrch"=True, bool "Precise"=False, Float "Limit"=255, Float "LimitC"=Limit,
    \ int "Pel"=2,  bool "Chroma"=True,Int "BlkSz",Int "Olap"=BlkSz/2, Int "Plane"=4,bool "Tm"=True,Bool "glob"=tm, Int "ThSAD"=400,Int "ThSAD2"=ThSAD)

  v1.02, 17 Feb 2020. Default bblur mod for HD. BlkSz (blocksize) mod for HD. Added Limit, LimitC. 17 Feb 2020.
  v1.04, 21 Oct 2020. Add args Pel, Chroma, BlkSz, OLap, Plane, Tm, Glob, ThSAD and ThSAD2.
  v1.05, 01 Nov 2020, If Colorspace 8 bit, force Limit/LimitC args to type Int.

    Frames,   Default 2 (1 or more, was 3 max). Temporal radius of frames processed, default as per MDegrain2.
    bblur,    Blur arg used for both MSuper pre-filter clip (bsrch==true) and blurring used where motion match is bad.
              Range 0.0 <= bblur <= 1.58.
              Default depends upon source clip width. (c.width>1920) ? 0.75 : (c.width>1280) ? 0.7 : (c.width>960 ) ? 0.65 : 0.6)
    csharp,   Default 0.6, (0.0 <= csharp <= 1.0) Sharpening used where motion match is good.
    bsrch,    Default True. If true, then prefilter clip is blurred source clip, c.blur(bblur).
    Precise,  Default false. If true, then uses MRecalculate to refine vectors.
    Limit,    Default 255 [no limit]. Limits amount of change to pixel luma.
    LimitC,   Default Limit. Limits amount of change to pixel Chroma.
              Default Limit/LimitC is 255 (int), but allows input 255.0 (Float)
                Pinterf MvTools v2.7.42 (20200522) changed MDegrainN Limit/LimitC types to Float.
                If Colorspace is 8 bit, then will force any user supplied float value to eg Int(Limit) or Int(LimitC).
                Will still be a problem (throw error in mvtools) if High Bit Depth, Float Limit/LimitC, and pre-Printerf v2.7.42 MvTools.

 ...
And for code
Code:
    Limit  = Default(Limit,255)      # Max allowed Y change, Arg to MDegrainN. Default Limit/LimitC is 255 (int)
    LimitC = Default(LimitC,Limit)   # Max allowed U,V change
             Limit =(c.McDegrainSharp_bpc==8)?Limit.Int :Limit    # Force Limit/LimitC to type int if Colorspace is 8 bit
             LimitC=(c.McDegrainSharp_bpc==8)?LimitC.Int:LimitC
EDIT: Oops, and added this as local function
Code:
Function McDegrainSharp_bpc(clip c) {
    try {bpc=c.BitsPerComponent()} 
    catch(mes) {bpc=8} 
    return bpc
}
EDIT:
Quote:
Originally Posted by agressiv View Post
Edit: Is http://forum.doom9.org/showthread.ph...45#post1737045 still where the most current avsi is for McDegrain?
Nope, now its in this thread, but I'll probably post in its own thread at some point.

EDIT:
Clarification:
Code:
    Limit,    Default 255 [no limit]. Limits amount of change to pixel luma.
    LimitC,   Default Limit. Limits amount of change to pixel Chroma.
              Default Limit/LimitC is 255 (int), but allows input 255.0 (Float)
                Pinterf MvTools v2.7.42 (20200522) changed MDegrainN Limit/LimitC types to Float.
                If Colorspace is 8 bit, then will force any user supplied float value to eg Int(Limit) or Int(LimitC).
                Will still be a problem (throw error in mvtools) if High Bit Depth, Float Limit/LimitC, and pre-Printerf v2.7.42 MvTools.
New Pinterf MvTools Limit/LimitC types of float will accept int as valid args, however older mvTools type Int arg Limit/LimitC will
throw error if user provided with type float args.
Function arg type specified as Float, really means type Numeric [float or int], whereas func arg type int is strictly type int.
Also, at some point in development of v2.60, a script function arg specified as type float but supplied by user as type int, is forcibly
coerced/converted to type float inside the function [this was supposed to make things easier, but actually made them more awkward].

EDIT:
Changed local function names to eg "__McDegrainSharp_bpc()", prepended "__", no version number update.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 26th January 2022 at 17:18.
StainlessS is offline   Reply With Quote
Old 1st November 2020, 19:26   #10  |  Link
agressiv
Registered Loser
 
agressiv's Avatar
 
Join Date: Dec 2004
Posts: 117
FYI since:
  • Adding mtmodes.avsi code snippet
  • Upgrading to AviSynth 3.6.2 test 3
  • using the new McDegrainSharp code in this thread
I haven't been able to get it to hang!

Thanks everyone -
agressiv is offline   Reply With Quote
Old 26th January 2022, 11:37   #11  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
StainlessS,
I was looking at the changes to your MCDegrainSharp function, and I'm not sure I understand the need to force the Limit argument to integer for 8 bit.
The way I understand it Limit specifies the maximum change allowed for a pixel rather than a maximum value as such, but I assume MVTools2 must round the final value to an integer for any bitdepth (except float).

I changed the Limit argument to float in my copy of FastDegrain, and float values for limit don't producing an error for 8 bit video. ie
FastDegrain(Limit=133.74)

By the way, I like the idea of this function as it's simpler than than extracting build numbers from version strings when you only need to know if Avisynth supports HBD (although I'd just add it to a script as a variable rather than depend on a separate function), but where does the BPC() function come from? Is that another function returning BitsPerComponent()?

Function McDegrainSharp_bpc(clip c) {
try {bpc=c.bpc}
catch(mes) {bpc=8}
return bpc
}
hello_hello is offline   Reply With Quote
Old 26th January 2022, 17:17   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Oops, I found that error, thought I had not posted it.
Code:
Function __McDegrainSharp_bpc(clip c) {
try {bpc=c.BitsPerComponent()}
catch(mes) {bpc=8}
return bpc
}
or just inline it. [I have a function called X_bpc(), probably got confused with that]

(Without looking at it,) float limit would fail if used with older mvtools (where it expects type int only).

Quote:
New Pinterf MvTools Limit/LimitC types of float will accept int as valid args, however older mvTools type Int arg Limit/LimitC will
throw error if user provided with type float args.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 26th January 2022 at 17:25.
StainlessS is offline   Reply With Quote
Old 27th January 2022, 08:36   #13  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Your BPC function idea might look good at the end of the script in that case. Just a thought....

Code:
(frames<=0)
    \ ? c
    \ : try{c2.MDegrainN(super_rend, MultiVec, Frames, thSAD=ThSAD, plane=Plane, Limit=Limit, LimitC=LimitC, thsad2=ThSAD2)}catch(err){
            c2.MDegrainN(super_rend, MultiVec, Frames, thSAD=ThSAD, plane=Plane, Limit=int(Limit), LimitC=int(LimitC), thsad2=ThSAD2)}
return Last
hello_hello is offline   Reply With Quote
Old 28th January 2022, 19:01   #14  |  Link
gispos
Registered User
 
Join Date: Oct 2018
Location: Germany
Posts: 996
Nice, I like using it too. When MCTemporalDenoise fails.
Thank's StainlessS
__________________
Live and let live
gispos is offline   Reply With Quote
Old 28th January 2022, 19:29   #15  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Post deleted (I thought I'd come up with a clever try/catch idea, but on closer inspection is wasn't working).

Last edited by hello_hello; 28th January 2022 at 19:59.
hello_hello is offline   Reply With Quote
Reply

Tags
hangs, mcdegrain, mcdegrainsharp

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 15:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.