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 12th April 2024, 00:37   #2901  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,616
Quote:
Originally Posted by Dogway View Post
If the blurring was too extreme I would recommend the model HurrDeblur
With what AVS+ plugin?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 12th April 2024, 00:59   #2902  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,409
Quote:
Originally Posted by tormento View Post

Quote:
Originally Posted by Dogway View Post
If the blurring was too extreme I would recommend the model HurrDeblur
With what AVS+ plugin?

There is only 1 plugin that can be used directly in avs+ for HurrDeblur - avs-mlrt

https://github.com/Asd-g/avs-mlrt
poisondeathray is offline   Reply With Quote
Old 12th April 2024, 10:36   #2903  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,616
Quote:
Originally Posted by poisondeathray View Post
There is only 1 plugin that can be used directly in avs+ for HurrDeblur - avs-mlrt


My poor 1660 Super will die on fire.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 16th April 2024, 17:23   #2904  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
I've been using removegrain(mode=5) or vsdegrainmedian(modeY=3) to help with compressability without changing the overall look of the picture too much. What's the best ex_median mode to use as an equivalent?
simple_simon is offline   Reply With Quote
Old 16th April 2024, 20:50   #2905  |  Link
Lucky38
Registered User
 
Join Date: Mar 2024
Posts: 10
hi,

I'm looking option to denoise with smdegrain enitre frame exept area where is the motion. How could i achive that?
Lucky38 is offline   Reply With Quote
Old 16th April 2024, 22:08   #2906  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,616
@Dogway

Is there a way to pass parameters to prefilters but to use it as external prefilter? I am interested mostly in 6,7,8.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 17th April 2024, 12:48   #2907  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,162
Quote:
Originally Posted by Lucky38 View Post
hi,

I'm looking option to denoise with smdegrain enitre frame exept area where is the motion. How could i achive that?
If SMDegrain exports MVs clip (as some named global ?) - you can feed it to MMask() and use output mask with AVS filters like Overlay() or Layer().
If not - you need to calculate MVs again (MSuper+MAnalyse).


After looking into ex_median - it is a great 64 different median (median-like ?) modes ! Now I am in the process of testing some ways of averaging MVs gathered from 'area' searches (with some offset from block's center position in tessellation grid - it sort of very dense overlap with possible steps on 1 sample dx,dy) to make more stable MV for degraded by noise sources. Which of the 64 different median modes can be tested for this process ?

The gathered MVs from AreaMode search can be treated either as 1D array or as 2D array. Currently, the implemented averaging modes process as 1D array and not use possible 2D information gathered (like distance/radius from block's center of the search position). The offset distance from block's center makes positives and negatives:
1. Positives - the more offset distance from block's center - the more new (not tested with original block's position) samples used and gather more new information about motion. It is sort of an increasing block size.
2. Negatives - the more offset distance from block's center - the more image motion may be changed and the offsetted MVs may be really somehow different from the original block's position.

So with 1 and 2 I am still not sure if we can apply some '2D spatial weighting' to the averaging process. Anyway AreaMode gathers lots of new valuable data to process about motion in some close area about block's center (not only MVs but also SAD (or other supported dissimilarity metric)) it is 2D array of 3 values in each (of size 2x2 + center or 3x3 + center minimum with AreaMode 'radius' of 1 sample and many more with > 1). So lots of different new processing modes may be tested to find the best way of refining MVs using new gathered data.

2D view of the question:


For gathered MVs set (2D array of scanned to 1D) of MV(0,0) and some of the MV(dx, dy) members (where dx and dy are +-integer offsets in the units of current search level of MAnalyse: +-1 sample at the full-pel level for example) which of the ex_median() averaging algorithms may be recommended to test to get more stable output MV ?

Each MV() is a structure of 3 members (dx, dy, sad). Where dx and dy are relative motion vector X and Y components). So for analysys of 2 completely equal frames MV(0,0) = MV(dx,dy)= (dx=0,dy=0,sad=0).
But if frames have some noise added: MV(0,0) may be not equal to any of others MV(dx, dy). Also MV(0,0) may have non-zero dx, dy also.

Last edited by DTL; 17th April 2024 at 15:19.
DTL is offline   Reply With Quote
Old 18th April 2024, 08:22   #2908  |  Link
Lucky38
Registered User
 
Join Date: Mar 2024
Posts: 10
Quote:
Originally Posted by DTL View Post
If SMDegrain exports MVs clip (as some named global ?) - you can feed it to MMask() and use output mask with AVS filters like Overlay() or Layer().
If not - you need to calculate MVs again (MSuper+MAnalyse).
@DTL,

Have you got some example how should look like proper call with SMDegrain?

Many Thanks
Lucky38 is offline   Reply With Quote
Old 18th April 2024, 09:13   #2909  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,162
Documentation https://raw.githack.com/Dogway/Avisy...SMDegrain.html
says
Motion Vectors Globals Input/Output: Reuse motion vectors globals for faster processing, or just use SMDegrain() as a shortcut for creating nice quality motion vectors.

Example
Code:
                         SMDegrain(tr=3,thSAD=400,globals=3)    # Outputs vectors

                         Super = MSuper(levels=1)               # Add this line just before if you have some processing between Globals Output and Input.
                         MDegrain3(Super, bVec1, fVec1, bVec2, fVec2, bVec3, fVec3, thSAD=400)
So you can try
Code:
denoised=SMDegrain(tr=3,thSAD=400,globals=3)    # Outputs vectors
mask_clip=MMask(fVec1)
Overlay(last, denoised, mask=mask_clip)
I can not check because SMDegrain too complex for me and I can not gather all required dependencies and install as required. You need to check mask polarity (Use Invert() or arguments replacement in reverse order in Overlay() if result is inverted) and set mask 'sensitivity' to motion adjusting ml param at MMask(). Check mask_clip view to see how it masks motion areas,

Last edited by DTL; 18th April 2024 at 09:19.
DTL is offline   Reply With Quote
Old 18th April 2024, 14:52   #2910  |  Link
Lucky38
Registered User
 
Join Date: Mar 2024
Posts: 10
Quote:
Originally Posted by DTL View Post
Documentation https://raw.githack.com/Dogway/Avisy...SMDegrain.html
says
Motion Vectors Globals Input/Output: Reuse motion vectors globals for faster processing, or just use SMDegrain() as a shortcut for creating nice quality motion vectors.

Example
Code:
                         SMDegrain(tr=3,thSAD=400,globals=3)    # Outputs vectors

                         Super = MSuper(levels=1)               # Add this line just before if you have some processing between Globals Output and Input.
                         MDegrain3(Super, bVec1, fVec1, bVec2, fVec2, bVec3, fVec3, thSAD=400)
So you can try
Code:
denoised=SMDegrain(tr=3,thSAD=400,globals=3)    # Outputs vectors
mask_clip=MMask(fVec1)
Overlay(last, denoised, mask=mask_clip)
I can not check because SMDegrain too complex for me and I can not gather all required dependencies and install as required. You need to check mask polarity (Use Invert() or arguments replacement in reverse order in Overlay() if result is inverted) and set mask 'sensitivity' to motion adjusting ml param at MMask(). Check mask_clip view to see how it masks motion areas,
I need to test this..

Lucky38 is offline   Reply With Quote
Old 20th April 2024, 14:56   #2911  |  Link
Lucky38
Registered User
 
Join Date: Mar 2024
Posts: 10
Quote:
Originally Posted by DTL View Post
Documentation https://raw.githack.com/Dogway/Avisy...SMDegrain.html
says
Motion Vectors Globals Input/Output: Reuse motion vectors globals for faster processing, or just use SMDegrain() as a shortcut for creating nice quality motion vectors.

Example
Code:
                         SMDegrain(tr=3,thSAD=400,globals=3)    # Outputs vectors

                         Super = MSuper(levels=1)               # Add this line just before if you have some processing between Globals Output and Input.
                         MDegrain3(Super, bVec1, fVec1, bVec2, fVec2, bVec3, fVec3, thSAD=400)
So you can try
Code:
denoised=SMDegrain(tr=3,thSAD=400,globals=3)    # Outputs vectors
mask_clip=MMask(fVec1)
Overlay(last, denoised, mask=mask_clip)
I can not check because SMDegrain too complex for me and I can not gather all required dependencies and install as required. You need to check mask polarity (Use Invert() or arguments replacement in reverse order in Overlay() if result is inverted) and set mask 'sensitivity' to motion adjusting ml param at MMask(). Check mask_clip view to see how it masks motion areas,
Ihave tried this

SMDegrain(tr=3,thSAD=400,globals=3) # Outputs vectors
mask_clip=MMask(fVec1)
denoised = SMDegrain(last ,tr=4, thSAD=480, thSCD2=100, prefilter=-1)
Overlay(last, denoised, mask=mask_clip)

but this is not work to my eyes. keep more grain on flat area than default SMDegrain call:
SMDegrain(tr=4, thSAD=480, thSCD2=100, prefilter=-1)
Lucky38 is offline   Reply With Quote
Old 20th April 2024, 15:45   #2912  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,162
To debug the script you may start from checking the mask first - add

return mask_clip

(to the end of script or after mask_clip generation)

And look how it good or not tracks the static and motion areas. Depending on lots of settings (like MVs length and pel and many more) you may need to adjust mask with ml-param of MMask and/or with later any levels adjustment filters (Levels, ColorYUV, Tweak or other) to prepare best mask matching your source motion type and preference. And only next step is apply mask to Overlay() to get best result.

May be better to stack mask and real image in some way to see both mask and real frame at the same time like

return StackVertical(last, mask_clip)

But it may need more conversions to make colour formats equal of mask_clip and 'last' clip so Stack* can combine it in the single frame.

Overlay documentation: clip mask = (full opacity)
Optional transparency mask. Must be the same size as overlay. Where mask is darker, overlay will be more transparent. Must be 0-255 range (in general: 0 - 2^N-1 range for N bits format).

overlay clip is second param of Overlay() so where mask is black (no motion) it will output 'last' (denoised) clip.

MMask kind=0 (default) - Motion
Creates motion mask from the motion vectors length. It builds a better mask than MotionMask function of MaskTools plugin because motion vectors are a lot more reliable than the algorithm of MotionMask. Mask value 0 means no motion at all (the length of the motion vector is null). The longer vector length, the larger mask value (saturated to 255), the scale is defined by ml.

ml float default = 100. So if your motion is at low speed you may try to set higher ml param like

mask_clip=MMask(fVec1, ml=500)

Check if white levels at mask_clip is high enough at the moving areas/objects. Better about 100% white. If because of noise false MVs the MMask starts to output too high 'black level' at the static areas with big ml-value - you can add 'contrast' to mask_clip for better separation of slow motion or noised MVs from moving with Tweak(cont > 1.0) or may be Levels (params to increase conrast).

Last edited by DTL; 20th April 2024 at 16:01.
DTL is offline   Reply With Quote
Old 25th April 2024, 20:21   #2913  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
@Dogway

I noticed in the deep_resize script notes that it says linear sspace is best for downscaling. Do I need to convert to linear first or is this all that's needed:

Code:
convertbits(16) #(or 32?)
propSet("_FieldBased",0).deep_resize(1728,720,grain=0,qual=2,sspace="linear")
convertbits(8,dither=1)
simple_simon is offline   Reply With Quote
Old 25th April 2024, 21:01   #2914  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
Yes, that's fine. You can omit grain and qual args in this case. I think 16bit is enough but check your downscaling kernel! By default it might be DPDIR or SSIM2, in such cases linear is not necessary
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 25th April 2024, 22:27   #2915  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
Quote:
Originally Posted by Dogway View Post
Yes, that's fine. You can omit grain and qual args in this case. I think 16bit is enough but check your downscaling kernel! By default it might be DPDIR or SSIM2, in such cases linear is not necessary
Looks like all three scalers are using "Didee" by default. I think SSIM2 used to be the default for most small downscaling. Would one of the 2 you mentioned be better?

Also, it probably got lost in the mix but did you happen to see my question here about Gradfun3plus?
https://forum.doom9.org/showpost.php...postcount=2852

Last edited by simple_simon; 25th April 2024 at 22:29.
simple_simon is offline   Reply With Quote
Old 25th April 2024, 22:56   #2916  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
The kernel adapts to the downscaling ratio. In case of Didee the linear space might help , but it also depends on content due to risks on ringing. On live content it can be useful, on clean digital animations sources it might not.

As for adding grain option to Gradfun3plus let me check. I thought it was an option? (Writing from mobile)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 28th April 2024, 06:13   #2917  |  Link
FTLOY
Friend of a friend..
 
FTLOY's Avatar
 
Join Date: Feb 2023
Posts: 290
Why would this script max out my 32Gb of RAM ?? (which sometimes crashes the PC)

Code:
SetCacheMode()
SetMemoryMax(16384)
LoadPlugin("%AVISYNTHPLUGINS%\masktools\masktools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\mvtools\mvtools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\RgTools\RgTools.dll")
LoadPlugin("%AVISYNTHPLUGINS%\PD_TOOLS\DGHDRtoSDR\DGHDRtoSDR.dll")
LoadPlugin("%AVISYNTHPLUGINS%\PD_TOOLS\MedianBlur2\MedianBlur2.dll")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\EXTOOLS\ExTools.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\GRADE-PACK\Grade Pack.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\LSF-PLUS\LSFplus.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\RESIZERS-PACK\Resizers Pack.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\SHARPENERS-PACK\Sharpeners Pack.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\SMDEGRAIN\SMDegrain.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\TRANSFORM-PACK\Transforms Pack.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\TRANSFORM-PACK\Transforms Pack-Models.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\TRANSFORM-PACK\Transforms Pack-Transfers.avs")
Import("%AVISYNTHPLUGINS%\PD_TOOLS\Zs_RF_Shared\Zs_RF_Shared.avs")
video=ConvertBits(video,16)
pre=DGHDRtoSDR(video,mode="pq",white=2000,gamma=1/2.4,tm=1.0).ex_Median(mode="IQMST",thres=255)
video=STTWM(video,sw=50,tw=50,aw=100,sthres=5,tthres=5)
video=SMDegrain(video,tr=2,thSAD=200,thSADC=100,UHDHalf=false,limit=255,contrasharp=true,prefilter=pre,str=5.0,refinemotion=true)
FTLOY is offline   Reply With Quote
Old 28th April 2024, 08:24   #2918  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,162
If RAM usage grows constantly at processing - it may mean memory leak exist in some plugin. Try to isolate it by making script shorter and if found memory leak - report to developers.
DTL is offline   Reply With Quote
Old 28th April 2024, 09:36   #2919  |  Link
FTLOY
Friend of a friend..
 
FTLOY's Avatar
 
Join Date: Feb 2023
Posts: 290
Quote:
Originally Posted by DTL View Post
If RAM usage grows constantly at processing - it may mean memory leak exist in some plugin. Try to isolate it by making script shorter and if found memory leak - report to developers.
Hi DTL,

Now that you've suggested this, the ONLY plugin that is different to the majority of my scripts, is DGHDRtoSDR.

It actually doesn't "grow", it's pretty much immediately

I've only just started to use this one, and I have been having some very unusual problems.


Last edited by FTLOY; 29th April 2024 at 01:55.
FTLOY is offline   Reply With Quote
Old 29th April 2024, 07:46   #2920  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
Also try to use UHDHalf=true, mvtools2 might not handle 16-bit UHD resolution nicely.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Reply

Tags
avisynth, dogway, filters, hbd, packs

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.