TComb

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m
(reformat)
Line 1: Line 1:
{{FilterCat|External_filters|Restoration_filters|Rainbow & Dot Crawl Removal}}
+
{{FilterCat4|External_filters|Plugins|Restoration_filters|Rainbow & Dot Crawl Removal}}
{{Filter
+
{{Filter3
 
| {{Author/tritical}}
 
| {{Author/tritical}}
 
| v2.0 Beta 2
 
| v2.0 Beta 2
 
| [http://web.missouri.edu/~kes25c/TCombv2B2.zip TCombv2B2.zip]
 
| [http://web.missouri.edu/~kes25c/TCombv2B2.zip TCombv2B2.zip]
 
| Rainbow & Dot Crawl Removal
 
| Rainbow & Dot Crawl Removal
|
 
* YUY2
 
* YV12
 
 
| [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
| [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
|}}
 
|}}
 
<br>
 
<br>
 
== Description ==
 
== Description ==
:TComb is a temporal comb filter (it reduces cross-luminance (rainbows) and cross-chrominance (dot crawl) artifacts in static areas of the picture).  
+
TComb is a temporal comb filter (it reduces cross-luminance (dot crawl) and cross-chrominance (rainbows) artifacts in static areas of the picture). It will ONLY work with NTSC material, and WILL NOT work with telecined material where the rainbowing/dotcrawl was introduced prior to the telecine process! It must be used before IVTC or deinterlace in order to work.  In terms of what it does it is similar to GuavaComb/[[DeDot#How_it_works:|DeDot]].
:It will ONLY work with NTSC material, and WILL NOT work with telecined material where the rainbowing/dotcrawl was introduced prior to the telecine process!  
+
:It must be used before IVTC or deinterlace in order to work.  In terms of what it does it is similar to GuavaComb/[[DeDot#How_it_works:|DeDot]].
+
  
 
+
TComb does support seeking... that is, jumping to a random frame will produce the same result as if you had linearly run up to that frame. For dot crawl removal TComb requires at least 3 static fields of the same parity and for rainbow removal TComb requires at least 5 static fields of the same parity.
:TComb does support seeking... that is, jumping to a random frame will produce the same result as if you had linearly run up to that frame.
+
:For dot crawl removal tcomb requires at least 3 static fields of the same parity and for rainbow removal tcomb requires at least 5 static fields of the same parity.
+
 
<br>
 
<br>
== Requirements: ==
 
:- AviSynth 2.5.8 or later
 
:- Supported color formats: [[YUY2]], [[YV12]]
 
 
<br>
 
<br>
== Syntax and Parameters ==
+
== Requirements ==
 +
* AviSynth 2.5.8 or later
 +
* Supported color formats: [[YUY2]], [[YV12]]
 +
<br>
 +
== [[Script variables|Syntax and Parameters]] ==
 
:{{Template:FuncDef|TComb (''clip'', ''int'' "mode", ''int'' "fthreshL", ''int'' "fthreshC", ''int'' "othreshL", ''int'' "othreshC", ''bool'' "map", ''float'' "scthresh", ''bool'' "debug", ''int'' "opt")}}
 
:{{Template:FuncDef|TComb (''clip'', ''int'' "mode", ''int'' "fthreshL", ''int'' "fthreshC", ''int'' "othreshL", ''int'' "othreshC", ''bool'' "map", ''float'' "scthresh", ''bool'' "debug", ''int'' "opt")}}
 +
<br>
 +
::{{Par2| |clip| }}
 +
:::Input clip.
 
<br>
 
<br>
 
::{{Par2|mode|int|2}}
 
::{{Par2|mode|int|2}}
Line 34: Line 31:
 
::::*1 - process chroma only  (rainbow removal)
 
::::*1 - process chroma only  (rainbow removal)
 
::::*2 - process both
 
::::*2 - process both
 
:::Default:  2
 
 
<br>
 
<br>
 
::{{Par2|fthreshL|int|4}}
 
::{{Par2|fthreshL|int|4}}
Line 41: Line 36:
 
:::Filtered pixel correlation thresholds.
 
:::Filtered pixel correlation thresholds.
  
::::One of the things TComb checks for is correlation between filtered values over the length of the filtering window.
+
:::One of the things TComb checks for is correlation between filtered values over the length of the filtering window. If all values differ by less than fthreshL (for luma) or fthreshC (for chroma) then the filtered values are considered to be correlated.
::::If all values differ by less than fthreshL (for luma) or fthreshC (for chroma) then the filtered values are considered to be correlated.
+
:::Larger values will allow more filtering (will be more effective at removing rainbowing/dot crawl), but will also create more artifacts.
::::Larger values will allow more filtering (will be more effective at removing rainbowing/dot crawl), but will also create more artifacts.
+
:::Smaller values will produce less artifacts, but will be less effective in removing rainbowing/dot crawl. A good range of values is between 4 and 7.
::::Smaller values will produce less artifacts, but will be less effective in removing rainbowing/dot crawl. A good range of values is between 4 and 7.
+
 
+
:::Default: fthreshL -> 4
+
:::::fthreshC -> 5
+
 
<br>
 
<br>
 
::{{Par2|othreshL|int|5}}
 
::{{Par2|othreshL|int|5}}
Line 53: Line 44:
 
:::Original pixel correlation thresholds.
 
:::Original pixel correlation thresholds.
  
::::One of the things TComb checks for is correlation between original pixel values from every other field of the same parity.
+
:::One of the things TComb checks for is correlation between original pixel values from every other field of the same parity. Due to the oscillation period, these values should be equal or very similar in static areas containing dot crawl or rainbowing. If the pixel values differ by less than othreshL (for luma) or othreshC (for chroma) then the pixels are considered to be correlated.  
::::Due to the oscillation period, these values should be equal or very similar in static areas containing dot crawl or rainbowing.
+
:::Larger values will allow more filtering (will be more effective at removing rainbowing/dotcrawl), but will also create more artifacts.  
::::If the pixel values differ by less than othreshL (for luma) or othreshC (for chroma) then the pixels are considered to be correlated.
+
:::Smaller values will produce less artifacts, but will be less effective in removing rainbowing/dotcrawl. A good range of values is between 4 and 8.
::::Larger values will allow more filtering (will be more effective at removing rainbowing/dotcrawl), but will also create more artifacts.
+
::::Smaller values will produce less artifacts, but will be less effective in removing rainbowing/dotcrawl.  
+
::::A good range of values is between 4 and 8.
+
 
+
:::Default: othreshL -> 5
+
:::::othreshC -> 6
+
 
<br>
 
<br>
 
::{{Par2|map|bool|false}}
 
::{{Par2|map|bool|false}}
Line 73: Line 58:
  
 
:::: ** n = current frame
 
:::: ** n = current frame
 
:::Default: false
 
 
<br>
 
<br>
 
::{{Par2|scthresh|float|12.0}}
 
::{{Par2|scthresh|float|12.0}}
:::Scenechange threshold.
+
:::Scenechange threshold; sets the scenechange detection threshold as a percentage of maximum change on the luma plane.
::::Sets the scenechange detection threshold as a percentage of maximum change on the luma plane.
+
:::Use the debug output to see which frames are detected as scenechanges and the scenechange statistics.
::::Use the debug output to see which frames are detected as scenechanges and the scenechange statistics.
+
 
+
:::Default:  12.0
+
 
<br>
 
<br>
 
::{{Par2|debug|bool|false}}
 
::{{Par2|debug|bool|false}}
::::Will enable debug output.  The only thing it shows are the scenechange stats.  The info is output via OutputDebugString().
+
:::Will enable debug output.  The only thing it shows are the scenechange stats.   
::::You can use the utility "DebugView" from sysinternals to view the output.
+
:::The info is output via OutputDebugString(). You can use the utility "DebugView" from sysinternals to view the output. The frame numbers in the debug output correspond to the input clip after a [[SeparateFields]]() call. TComb internally invokes SeparateFields() before itself and [[weave]]() after itself.
::::The frame numbers in the debug output correspond to the input clip after a separatefields() call.
+
::::TComb internally invokes separatefields() before itself and weave() after itself.
+
 
+
:::Default:  false
+
 
<br>
 
<br>
 
::{{Par2|opt|int|4}}
 
::{{Par2|opt|int|4}}
Line 100: Line 76:
 
::::*3 - use [[SSE2]] routines
 
::::*3 - use [[SSE2]] routines
 
::::*4 - auto detect
 
::::*4 - auto detect
 
:::Default:  4
 
 
<br>
 
<br>
  
 
== Basic Setup/Usage: ==
 
== Basic Setup/Usage: ==
:Setting up TComb is pretty simple.  The only values that would ever really need adjusting are fthreshL/fthreshC, othreshL/othreshC, and mode.
+
Setting up TComb is pretty simple.  The only values that would ever really need adjusting are fthreshL/fthreshC, othreshL/othreshC, and mode.
  
:Set mode to 0 if you want to do dot crawl removal only, set it to 1 if you want to do rainbow removal only, or set it to 2 to do both.
+
Set mode to 0 if you want to do dot crawl removal only, set it to 1 if you want to do rainbow removal only, or set it to 2 to do both.
 +
<br>
 
<br>
 
<br>
::'''Dot Crawl Removal Tweaking (fthreshL/othreshL):'''
+
'''Dot Crawl Removal Tweaking (fthreshL/othreshL):'''<br>
:::To find good values for fthreshL/othreshL, start with the following line:
+
To find good values for fthreshL/othreshL, start with the following line:
  
::::<pre>TComb(mode=0, fthreshL=255, othreshL=255)</pre>
+
:<pre>TComb(mode=0, fthreshL=255, othreshL=255)</pre>
  
:::Now, keep othreshL at 255 but set fthreshL down to 1.  Keep increasing fthreshL in steps of 1 to 2 until you find the point at which all dot crawl is removed.
+
Now, keep othreshL at 255 but set fthreshL down to 1.  Keep increasing fthreshL in steps of 1 to 2 until you find the point at which all dot crawl is removed. Remember that value.<br>
:::Remember that value. Next, set fthreshL back to 255, and set othreshL to 1.
+
Next, set fthreshL back to 255, and set othreshL to 1. Now, increase othreshL in steps of 1 or 2 until you find the point at which all dot crawl is removed.  You've now got values for fthreshL/othreshL.
:::Now, increase othreshL in steps of 1 or 2 until you find the point at which all dot crawl is removed.  You've now got values for fthreshL/othreshL.
+
 
<br>
 
<br>
::'''Rainbowing Removal Tweaking (fthreshC/othreshC):'''
+
<br>
:::To find good values for fthreshC/othreshC, start with the following line:
+
'''Rainbowing Removal Tweaking (fthreshC/othreshC):'''<br>
 +
To find good values for fthreshC/othreshC, start with the following line:
  
::::<pre>TComb(mode=1, fthreshC=255, othreshC=255)</pre>
+
:<pre>TComb(mode=1, fthreshC=255, othreshC=255)</pre>
  
:::Now, keep othreshC at 255 but set fthreshC down to 1.  Keep increasing fthreshC in steps of 1 to 2 until you find the point at which all (or most) rainbowing is removed.
+
Now, keep othreshC at 255 but set fthreshC down to 1.  Keep increasing fthreshC in steps of 1 to 2 until you find the point at which all (or most) rainbowing is removed. Remember that value.<br>
:::Remember that value. Next, set fthreshC back to 255, and set othreshC to 1.  
+
Next, set fthreshC back to 255, and set othreshC to 1. Now, increase othreshC in steps of 1 or 2 until you find the point at which all (or most) rainbowing is removed.  You've now got values for fthreshC/othreshC.
:::Now, increase othreshC in steps of 1 or 2 until you find the point at which all (or most) rainbowing is removed.  You've now got values for fthreshC/othreshC.
+
<br>
 +
<br>
 +
Once you've got values for mode, fthreshL/fthreshC, and othreshL/othreshC, add the necessary TComb() line into your script and run through part of it. If you see any artifacts try lowering your fthresh/othresh values.
 
<br>
 
<br>
:Once you've got values for mode, fthreshL/fthreshC, and othreshL/othreshC, add the necessary tcomb() line into your script and run through part of it.
 
:If you see any artifacts try lowering your fthresh/othresh values.
 
 
<br>
 
<br>
 
== Changelog ==
 
== Changelog ==
Line 140: Line 115:
 
       - Initial Release
 
       - Initial Release
 
<br>
 
<br>
== To Do List: ==
+
== To Do List ==
 
       - remove buffering of frames/info that aren't actually used (was there for development/testing purposes).
 
       - remove buffering of frames/info that aren't actually used (was there for development/testing purposes).
 
         Should save a lot of RAM usage.<br>
 
         Should save a lot of RAM usage.<br>
Line 147: Line 122:
 
== External Links ==
 
== External Links ==
 
*[http://www.aquilinestudios.org/avsfilters/dotcrawl.html#tcomb Scintilla's Guide] - Additional usage information mainly for dot crawl.
 
*[http://www.aquilinestudios.org/avsfilters/dotcrawl.html#tcomb Scintilla's Guide] - Additional usage information mainly for dot crawl.
 +
<br>
 +
<br>
 +
-----------------------------------------------
 +
'''Back to [[External_filters#Rainbow_.26_Dot_Crawl_Removal|External Filters]] &larr;'''
 +
-----------------------------------------------

Revision as of 16:11, 24 December 2014

Abstract
Author tritical
Version v2.0 Beta 2
Download TCombv2B2.zip
Category Rainbow & Dot Crawl Removal
License GPLv2
Discussion


Contents

Description

TComb is a temporal comb filter (it reduces cross-luminance (dot crawl) and cross-chrominance (rainbows) artifacts in static areas of the picture). It will ONLY work with NTSC material, and WILL NOT work with telecined material where the rainbowing/dotcrawl was introduced prior to the telecine process! It must be used before IVTC or deinterlace in order to work. In terms of what it does it is similar to GuavaComb/DeDot.

TComb does support seeking... that is, jumping to a random frame will produce the same result as if you had linearly run up to that frame. For dot crawl removal TComb requires at least 3 static fields of the same parity and for rainbow removal TComb requires at least 5 static fields of the same parity.

Requirements

  • AviSynth 2.5.8 or later
  • Supported color formats: YUY2, YV12


Syntax and Parameters

TComb (clip, int "mode", int "fthreshL", int "fthreshC", int "othreshL", int "othreshC", bool "map", float "scthresh", bool "debug", int "opt")


clip   =
Input clip.


int  mode = 2
Controls whether both luma/chroma are processed or only one or the other.
Possible settings:
  • 0 - process luma only (dot crawl removal)
  • 1 - process chroma only (rainbow removal)
  • 2 - process both


int  fthreshL = 4
int  fthreshC = 5
Filtered pixel correlation thresholds.
One of the things TComb checks for is correlation between filtered values over the length of the filtering window. If all values differ by less than fthreshL (for luma) or fthreshC (for chroma) then the filtered values are considered to be correlated.
Larger values will allow more filtering (will be more effective at removing rainbowing/dot crawl), but will also create more artifacts.
Smaller values will produce less artifacts, but will be less effective in removing rainbowing/dot crawl. A good range of values is between 4 and 7.


int  othreshL = 5
int  othreshC = 6
Original pixel correlation thresholds.
One of the things TComb checks for is correlation between original pixel values from every other field of the same parity. Due to the oscillation period, these values should be equal or very similar in static areas containing dot crawl or rainbowing. If the pixel values differ by less than othreshL (for luma) or othreshC (for chroma) then the pixels are considered to be correlated.
Larger values will allow more filtering (will be more effective at removing rainbowing/dotcrawl), but will also create more artifacts.
Smaller values will produce less artifacts, but will be less effective in removing rainbowing/dotcrawl. A good range of values is between 4 and 8.


bool  map = false
Identifies pixels that are being replaced with filtered values.
Each pixel in the output frame will have one of the following values indicating how it is being filtered:
0 - not being filtered
85 - [1 2 1] average of (n,n+1,n+2)
170 - [1 2 1] average of (n-2,n-1,n)
255 - [1 2 1] average of (n-1,n,n+1)
** n = current frame


float  scthresh = 12.0
Scenechange threshold; sets the scenechange detection threshold as a percentage of maximum change on the luma plane.
Use the debug output to see which frames are detected as scenechanges and the scenechange statistics.


bool  debug = false
Will enable debug output. The only thing it shows are the scenechange stats.
The info is output via OutputDebugString(). You can use the utility "DebugView" from sysinternals to view the output. The frame numbers in the debug output correspond to the input clip after a SeparateFields() call. TComb internally invokes SeparateFields() before itself and weave() after itself.


int  opt = 4
Controls which cpu optimizations are used.
Possible settings:
  • 0 - use C routines
  • 1 - use MMX routines
  • 2 - use ISSE routines
  • 3 - use SSE2 routines
  • 4 - auto detect


Basic Setup/Usage:

Setting up TComb is pretty simple. The only values that would ever really need adjusting are fthreshL/fthreshC, othreshL/othreshC, and mode.

Set mode to 0 if you want to do dot crawl removal only, set it to 1 if you want to do rainbow removal only, or set it to 2 to do both.

Dot Crawl Removal Tweaking (fthreshL/othreshL):
To find good values for fthreshL/othreshL, start with the following line:

TComb(mode=0, fthreshL=255, othreshL=255)

Now, keep othreshL at 255 but set fthreshL down to 1. Keep increasing fthreshL in steps of 1 to 2 until you find the point at which all dot crawl is removed. Remember that value.
Next, set fthreshL back to 255, and set othreshL to 1. Now, increase othreshL in steps of 1 or 2 until you find the point at which all dot crawl is removed. You've now got values for fthreshL/othreshL.

Rainbowing Removal Tweaking (fthreshC/othreshC):
To find good values for fthreshC/othreshC, start with the following line:

TComb(mode=1, fthreshC=255, othreshC=255)

Now, keep othreshC at 255 but set fthreshC down to 1. Keep increasing fthreshC in steps of 1 to 2 until you find the point at which all (or most) rainbowing is removed. Remember that value.
Next, set fthreshC back to 255, and set othreshC to 1. Now, increase othreshC in steps of 1 or 2 until you find the point at which all (or most) rainbowing is removed. You've now got values for fthreshC/othreshC.

Once you've got values for mode, fthreshL/fthreshC, and othreshL/othreshC, add the necessary TComb() line into your script and run through part of it. If you see any artifacts try lowering your fthresh/othresh values.

Changelog

  05/16/2006  v2.0 Beta 2
      + Stricter checking of othreshL/othreshC when looking for oscillation
      + For dot crawl detection require at least one vertical neighbor (y-1/y+1, x-1/x/x+1)
      - fixed possible crash with yuy2 input (sse2 planar<->packed conversions)
03/31/2006 v2.0 Beta 1 - complete rewrite
06/24/2005 v0.9.0 - Initial Release


To Do List

     - remove buffering of frames/info that aren't actually used (was there for development/testing purposes).
       Should save a lot of RAM usage.
- release v2.0 final


External Links




Back to External Filters


Personal tools