MCTemporalDenoise

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Required Filters)
m (Required Filters)
 
Line 25: Line 25:
 
* [[MaskTools2]]
 
* [[MaskTools2]]
 
* [[LSFmod]]
 
* [[LSFmod]]
* [[FFT3Dfilter]] or [[FFT3DGPU]]
+
* [[FFT3DFilter]] or [[FFT3DGPU]]
 
* [[TTempSmooth]]
 
* [[TTempSmooth]]
 
*<strike>RemoveGrain and Repair - part of the [[RemoveGrain v1.0b]] package.</strike>
 
*<strike>RemoveGrain and Repair - part of the [[RemoveGrain v1.0b]] package.</strike>

Latest revision as of 00:10, 6 April 2020

Abstract
Author LaTo
Version v1.4.20 - Update 2010/07/02
Download MCTemporalDenoise
Category Spatio-Temporal Denoisers
Requirements YV12
License
Discussion Doom9 Thread


Contents

[edit] Abstract

A motion compensated noise removal script with an accompanying post-processing component.
This script is a motion compensated temporal denoiser, which utilizes both pixel and motion masks to obtain the highest quality output. It also includes a variety of post-processing filters, everything from sharpening to anti-aliasing to halo removal. Plus much more!


[edit] Description

Some of this information may be outdated and/or incomplete, check the Doom9 Thread for up-to-date version !!!


[edit] Required Filters

Latest versions of the following filters are recommended unless stated otherwise.
Note: You do not necessarily need all of these filters for this script to function. There are special modes that enable the use of specific filters at specific times, but these are only used when necessary. Just to be safe, make sure you have all of the filters listed below in you "Plugins" folder.



[edit] Syntax and Parameters

MCTemporalDenoise( clip i, int "radius", int "sigma", bool "twopass", bool "useTTmpSm", int "limit", int "limit2", bool "fixFFT3D", bool "chroma", bool "GPU", bool "MT", int "idx", bool "interlaced", int "sharp", bool "adapt", int "strength", int "SHmode", int "SHmethod", int "Slimit", int "Sovershoot", bool "Tlimit", int "Tovershoot", bool "protect", int "cutoff", int "threshold", int "maxdiff", bool "AA", bool "useEEDI2", float "reduc", int "maxd", int "AAthr", int "method", bool "deblock", bool "useQED", int "quant1", int "quant2", bool "edgeclean", int "ECrad", int "ECthr", string "ECmode", bool "stabilize", int "maxr", int "TTstr", bool "flat", float "GFthr", int "AGstr", int "bias", int "bwbh", int "owoh", int "blksize", int "overlap", bool "truemotion", bool "safe", bool "MVglobal", int "bt", int "ncpu", int "precision", int "mode", int "thSAD", int "thSAD2", int "thSCD1", int "thSCD2", int "pel", int "pelsearch", int "search", int "searchparam", int "MVsharp", int "DCT", clip "p", string "settings", bool "show", int "screenW", int "screenH" )



DENOISE


radius int = based on mode
Temporal radius [1...6]

sigma int = based on mode
FFT3D sigma [0=no pre-filtering,1...]

twopass bool = based on mode
Do the denoising job in 2 stages (stronger but very slow)

useTTmpSm bool = based on mode
Use MVDegrain (faster) or MVCompensate TTempsmooth (stronger)

limit int = based on mode
Limit the effect of the first denoising [-1=auto,0=off,1...255]

limit2 int = based on mode
Limit the effect of the second denoising (if twopass=true) [-1=auto,0=off,1...255]

fixFFT3D bool = based on mode
Prevent posterize/banding issue when limit=-1 (due to high sigma used in FFT3D)

chroma bool = based on mode
Process or not the chroma plane

GPU bool = true
Use FFT3Dfilter or FFT3Dgpu (WARNING: May cause "rare" crash with some graphic card!)

MT bool = false
Use MVTools(official) or MVToolsMULTI (WARNING: Faster but - unstable, use with caution!)

idx int = 40
MVTools initial idx

interlaced bool = false
Input video interlaced or not



SHARP


sharp int = based on mode
Enable Post-Sharpening [0=off, 1=contra-sharpening, 2= Spatial-Sharpening + Motion-compensated temporal limiting]

adapt bool = true
Adaptative sharpening --> sharp only static & detailed areas, prevents grain sharpening & save much bitrate (+-10/15%)

strength int = radius*100
Sharpening strength ( see LSFmod: strength )

SHmode int = based on mode
Sharpening mode ( see LSFmod: Smode )

SHmethod int = based on mode
Sharpening method ( see LSFmod: Smethod )

Slimit int = 0
Spatial limiting ( see LSFmod: Lmode )

Sovershoot int = 0
Spatial overshoot ( see LSFmod: overshoot )

Tlimit bool = true
Temporal limiting (Motion compensated, clamp output to Tovershoot)

Tovershoot int = 0
Temporal overshoot +-= Maximum sharpening excess allowed (If overrange=0, don't sharpen more than the original clip.)

/!\ If you set Tovershoot>0, be sure that Slimit!=0 (to not over-enhance edges... Slimit=2 is a good compromise)          



STAR & BRIGHT POINTS PROTECTION


protect bool = false
Enable star & bright points protection

cutoff int = 64
Luma cutoff (process only brighter areas than this value) [0=all,1...255]

threshold int = 16
Luma threshold (minimal change needed to be filtered, the higher = the lesser areas are filtered) [0...127]

maxdiff int = 4
Maximum change allowed between source and result (the lesser, the brighter) [0=source,1...255]



ANTIALIASING


AA bool = false
Enable antialiasing (only on edges)

useEEDI2 bool = based on mode
If true use EEDI2 filtering, else use SANGNOM filtering

reduc float = 0.5
MC-soothe reduc parameter, reduc==-1 turn off MC-antialiasing [-1=off,0.0...1.0]

maxd int = useEEDI2?24:48
If EEDI2 is used it's his maxd setting, if SANGNOM is used it's his AA setting (see docs of these filters)

AAthr int = based on mode
Threshold for mask (the higher, the less "small edges" are process) [0...255]

method int = based on mode
Sharpness for downsize [0=bilinear,1=spline36,2=lanczos4]



DEBLOCK


deblock bool = false
Enable deblocking before the denoising

useQED bool = based on mode
If true, use Deblock_QED, else use Deblock (faster & stronger)

quant1 int = based on mode
Deblock_QED "quant1" parameter (Deblock "quant" parameter is "(quant1 quant2)/2")

quant2 int = based on mode
Deblock_QED "quant2" parameter (Deblock "quant" parameter is "(quant1 quant2)/2")



EDGECLEAN: DERING, DEHALO...


edgeclean bool = false
Enable safe edgeclean process after the denoising (only on edges which are in non-detailed areas, so "no" quality loss)

ECrad int = based on mode
Radius for mask (the higher, the greater distance from the edge is filtered)

ECthr int = based on mode
Threshold for mask (the higher, the less "small edges" are process) [0...255]

ECmode string = based on mode
Script/Filter used for cleaning edges (ex: "dfttest().dehalo_alpha()", don't forget quotes "". Dfttest is good for dering)



STABILIZE


stabilize bool = based on mode
Enable ttempsmooth post processing to stabilize only flat areas (background will be less "nervous")

maxr int = based on mode
Temporal radius (the higher, the more stable image)

TTstr int = based on mode
Strength (see TTempSmooth docs)



FLAT


enhance bool = false
Enable gradfun2db & addgrain only in flat & static areas (to avoid banding & blocking when encoding)

GFthr float = based on mode
Gradfun2db threshold [1.0=off,...]

AGstr int = 0
AddGrain strength [0=off,...]

bias int = 64
Brightness bias for adaptative grain mask (the higher, the less grain in dark areas & the more grain in bright areas) [-1=off,0=input,1...254,255=invert]



BLOCKSIZE / OVERLAP


bwbh int = based on mode
FFT3D blocksize

owoh int = bwbh/2
FFT3D overlap (speed: bwbh/3, quality: bwbh/2)

blksize int = based on mode
MVTools blocksize

overlap int = blksize/2
MVTools overlap (speed: blksize/3, quality: blksize/2)



METHOD


truemotion bool = based on mode
MVTools truemotion

safe bool = truemotion?false:true
Repair compensated frames (work only with UseTTmpSm=true)

MVglobal bool = true
MVTools global



FFT3D


bt int = based on mode
FFT3D block temporal size

ncpu int = 1
FFT3Dfilter ncpu

precision int = 2
FFT3Dgpu precision

mode int = 1
FFT3Dgpu mode



MVTOOLS


thSAD int = based on mode
MVTools thSAD for the first pass

thSAD2 int = thSAD
MVTools thSAD for the second pass (if twopass=true)

thSCD1 int = based on mode
MVTools thSCD1

thSCD2 int = based on mode
MVTools thSCD2

pel int = based on mode
MVTools pel

pelsearch int = pel
MVTools pelsearch

search int = 2
MVTools search

searchparam int = 2
MVTools searchparam

MVsharp int = based on mode
MVTools sharp

DCT int = 0
MVTools DCT



GLOBAL


p string = empty
Set an external prefilter clip

settings string = low
Global MCTemporalDenoise settings

         - "very low"                                      
         - "low" [Default]                                          
         - "medium"                                        
         - "high"                                          
         - "very high"                                     



DEBUG


show bool = false
Show debug clip & informations

screenW int = 1280
Screen horizontal resolution (for show clip)

screenH int = 1024
Screen vertical resolution (for show clip)

[edit] Defaults

   +-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
   | SETTINGS    |      VERY LOW               |      LOW                    |      MEDIUM                 |      HIGH                   |      VERY HIGH              |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | radius      |      1                      |      2                      |      3                      |      3                      |      6                      |
   | sigma       |      radius                 |      radius*2               |      radius*3               |      radius*4               |      radius*5               |
   | twopass     |      false                  |      false                  |      false                  |      true                   |      true                   |
   | useTTmpSm   |      false                  |      false                  |      false                  |      false                  |      true                   |
   | limit       |      -1                     |      -1                     |      -1                     |      -1                     |      0                      |
   | limit2      |      -1                     |      -1                     |      -1                     |      0                      |      0                      |
   | fixFFT3D    |      true                   |      true                   |      true                   |      false                  |      false                  |
   | chroma      |      false                  |      false                  |      false                  |      true                   |      true                   |
   | GPU         |      true                   |      true                   |      true                   |      true                   |      true                   |
   | MT          |      false                  |      false                  |      false                  |      false                  |      false                  |
   | idx         |      40                     |      40                     |      40                     |      40                     |      40                     |
   | interlaced  |      false                  |      false                  |      false                  |      false                  |      false                  |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | sharp       |      2                      |      2                      |      2                      |      1                      |      1                      |
   | adapt       |      sharp==2?true:false    |      sharp==2?true:false    |      sharp==2?true:false    |      sharp==2?true:false    |      sharp==2?true:false    |
   | strength    |      100                    |      100                    |      100                    |      200                    |      200                    |
   | SHmode      |      5                      |      5                      |      3                      |      3                      |      3                      |
   | SHmethod    |      3                      |      3                      |      3                      |      3                      |      3                      |
   | Slimit      |      0                      |      0                      |      0                      |      0                      |      0                      |
   | Sovershoot  |      0                      |      0                      |      0                      |      0                      |      0                      |
   | Tlimit      |      true                   |      true                   |      true                   |      0                      |      0                      |
   | Tovershoot  |      0                      |      0                      |      0                      |      true                   |      true                   |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | protect     |      false                  |      false                  |      false                  |      false                  |      false                  |
   | cutoff      |      64                     |      64                     |      64                     |      64                     |      64                     |
   | threshold   |      16                     |      16                     |      16                     |      16                     |      16                     |
   | maxdiff     |      4                      |      4                      |      4                      |      4                      |      4                      |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | AA          |      false                  |      false                  |      false                  |      false                  |      false                  |
   | useEEDI2    |      true                   |      true                   |      false                  |      false                  |      false                  |
   | reduc       |      0.5                    |      0.5                    |      0.5                    |      0.5                    |      0.5                    |
   | maxd        |      useEEDI2?24:48         |      useEEDI2?24:48         |      useEEDI2?24:48         |      useEEDI2?24:48         |      useEEDI2?24:48         |
   | AAthr       |      64                     |      32                     |      32                     |      16                     |      16                     |
   | method      |      2                      |      1                      |      1                      |      0                      |      0                      |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | deblock     |      false                  |      false                  |      false                  |      false                  |      false                  |
   | useQED      |      true                   |      true                   |      true                   |      true                   |      false                  |
   | quant1      |      10                     |      20                     |      30                     |      40                     |      40                     |
   | quant2      |      20                     |      40                     |      60                     |      80                     |      80                     |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | edgeclean   |      false                  |      false                  |      false                  |      false                  |      false                  |
   | ECrad       |      2                      |      3                      |      4                      |      5                      |      6                      |
   | ECthr       |      32                     |      32                     |      32                     |      16                     |      16                     |
   | ECmode      |      "Removegrain(2,-1)"    |      "Removegrain(2,-1)"    |      "Removegrain(3,-1)"    |      "Removegrain(4,4)"     |      "Removegrain(4,4)"     |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | stabilize   |      false                  |      false                  |      false                  |      true                   |      true                   |
   | maxr        |      1                      |      1                      |      3                      |      3                      |      7                      |
   | TTstr       |      1                      |      1                      |      2                      |      4                      |      8                      |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | enhance     |      false                  |      false                  |      false                  |      false                  |      false                  |
   | GFthr       |      1.1                    |      1.2                    |      1.6                    |      1.8                    |      2.0                    |
   | AGstr       |      0                      |      0                      |      0                      |      0                      |      0                      |
   | bias        |      64                     |      64                     |      64                     |      64                     |      64                     |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | bwbh        |      32                     |      16                     |      16                     |      16                     |      8                      |
   | owoh        |      bwbh/2                 |      bwbh/2                 |      bwbh/2                 |      bwbh/2                 |      bwbh/2                 |
   | blksize     |      HD?16:8                |      HD?16:8                |      HD?16:8                |      HD?16:8                |      HD?16:8                |
   | overlap     |      blksize/2              |      blksize/2              |      blksize/2              |      blksize/2              |      blksize/2              |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | truemotion  |      false                  |      false                  |      false                  |      true                   |      true                   |
   | safe        |      truemotion?false:true  |      truemotion?false:true  |      truemotion?false:true  |      truemotion?false:true  |      truemotion?false:true  |
   | MVglobal    |      true                   |      true                   |      true                   |      true                   |      true                   |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | bt          |      1                      |      MT&&GPU?1:3            |      MT&&GPU?1:3            |      MT&&GPU?1:3            |      MT&&GPU?1:4            |
   | ncpu        |      1                      |      1                      |      1                      |      1                      |      1                      |
   | precision   |      2                      |      2                      |      2                      |      2                      |      2                      |
   | mode        |      1                      |      1                      |      1                      |      1                      |      1                      |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | thSAD       |      200                    |      300                    |      400                    |      500                    |      600                    |
   | thSAD2      |      thSAD                  |      thSAD                  |      thSAD                  |      thSAD                  |      thSAD                  |
   | thSCD1      |      200                    |      300                    |      400                    |      500                    |      600                    |
   | thSCD2      |      90                     |      100                    |      100                    |      130                    |      130                    |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | pel         |      1                      |      2                      |      2                      |      2                      |      2                      |
   | pelsearch   |      pel                    |      pel                    |      pel                    |      pel                    |      pel                    |
   | search      |      2                      |      2                      |      2                      |      2                      |      2                      |
   | searchparam |      2                      |      2                      |      2                      |      2                      |      2                      |
   | MVsharp     |      2                      |      2                      |      2                      |      1                      |      0                      |
   | DCT         |      0                      |      0                      |      0                      |      0                      |      0                      |
   |-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------|
   | show        |      false                  |      false                  |      false                  |      false                  |      false                  |
   | screenW     |      1280                   |      1280                   |      1280                   |      1280                   |      1280                   |
   | screenH     |      1024                   |      1024                   |      1024                   |      1024                   |      1024                   |
   +-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+

[edit] MCTemporalDenoisePP

This is the post processing portion of MCTemporalDenoise, and it has the wonderful ability to be called externally. It differs from MCTemporalDenoise in the fact that it doesn't denoise, and that all settings default to off. Meaning, you do nothing without turning on a feature.

Parameters are the same as MCTemporalDenoise.

"Sharp" & "Protect" options need 2 inputs/ Example:

source=last
denoised=source.FFT3Dfilter()
MCTemporalDenoisePP(denoised,source,...)

The others only need "denoised".

By default, all filters are off!

[edit] Examples

MCTemporalDenoise(settings="low", edgeclean=true, ecrad=3, stabilize=true, maxr=2)

or

MCTemporalDenoise(settings="medium")

etc...


[edit] External Links

Personal tools