MfRainbow

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Shared functions/mfRainbow moved to MfRainbow: Remove obsolete shared functions category. See Talk:External filters.)
 
m
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Ok, cause I couldn't find a working 2.5 version of AntiBlink, I decided to make my own ^^'.
+
{{FilterCat4|External_filters|Scripts|Restoration_filters|Rainbow & Dot Crawl Removal}}
 +
{{Filter3
 +
| {{Author/mf}}
 +
| v0.32
 +
| [http://avisynth.nl/images/MfRainbow-v0.32.avsi mfRainbow-v0.32.avsi]
 +
| Rainbow & Dot Crawl Removal
 +
|
 +
|
 +
|}}
  
# mfRainbow by mf
+
== Description ==
# Derainbows according to the same principle as AntiFlicker.
+
Derainbows in areas of high Y, U and V frequencies, which fluctuate heavily.
# Definitely slower, but possibly (untested) higher quality.
+
#
+
# I don't claim copyright but I ask you to treat my script
+
# fairly.
+
#
+
# Happy slow encoding ^^.
+
#
+
+
function mfRainbow(clip input, string "mode", float "clipstren", int "strength", bool "post")
+
{
+
    mode      = Default(mode, "slowest") # processing speed, slow-slower-slowest
+
    strength  = Default(strength, 255)  # processing strength, 0-255
+
    clipstren = Default(clipstren, 5.0)  # value clipping strength, 0.0-10.0
+
    post      = Default(post, true)      # spatial postprocessing on/off
+
+
    inputrgb = input.ConvertToRGB32()
+
+
    edgemask = input.EdgeMask(0, "sobel").Inflate().GreyScale().
+
      \  Levels(0, clipstren, 255, 0, 255).ConvertToRGB32()
+
+
    derainbow = (mode == "slow") ? input.Deen("a3d",4,0,40,50) :
+
      \  (mode == "slower") ? input.Deen("a3d",4,0,20,50).Deen("a3d",4,0,20,50) :
+
      \  (mode == "slowest") ? input.Deen("a3d",4,0,15,50).Deen("a3d",4,0,15,50).
+
      \  Deen("a3d",4,0,15,50).Deen("a3d",4,0,15,50) : Assert(false, "available modes:
+
      \  slow, slower, slowest")
+
+
    maskedrainbow = Mask(derainbow.ConvertToRGB32(), edgemask)
+
    edgerainbow = Layer(inputrgb, maskedrainbow, "add", strength)
+
+
    semifinal = input.MergeChroma(edgerainbow.ConvertToYV12())
+
    blah = semifinal.MSmooth() # cause of a weird argument error
+
    final = semifinal.MergeChroma(blah)
+
+
    return post ? final : semifinal
+
  }
+
  
Parameters:
+
<br>
 +
== Requirements ==
 +
* AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ greater]
 +
* Supported color formats: [[YV12]]
  
type - name - description - range - default
+
=== Required Plugins ===
 +
Latest versions of the following filters are recommended unless stated otherwise.<br>
 +
*[[MaskTools2]]
 +
*[[WarpSharp]]
  
string mode - processing speed (and quality) - slow/slower/slowest - slowest
+
<br>
 +
== [[Script variables|Syntax and Parameters]] ==
 +
:{{Template:FuncDef|mfRainbow (''clip'' input, ''int'' "scd", ''bool'' "interlaced")}}
 +
<br>
 +
::{{Par2|input|clip| }}
 +
:::Input clip.
 +
<br>
 +
::{{Par2|scd|int|10}}
 +
:::Scene change detection for [[Soften|TemporalSoften]]; good values are between 5 and 30.
 +
<br>
 +
::{{Par2|interlaced|bool|false}}
 +
:::False means the input clip is [[FAQ_different_types_content#How_do_I_recognize_progressive.2C_interlaced.2C_telecined.2C_hybrid_and_blended_content.3F|progressive]]; with true it's [[FAQ_different_types_content#How_do_I_recognize_progressive.2C_interlaced.2C_telecined.2C_hybrid_and_blended_content.3F|interlaced]]. Interlaced content is processed by using [[SeparateFields]] in the beginning and [[Weave]] at the end.
 +
:::<span style="color:red">'''Note:'''</span> this parameter was added as an after-thought, it's not technically correct so use with caution and only as a last resort.
  
int strength - processing strength - 0-255 - 255
+
<br>
 +
== Examples ==
 +
mfRainbow with default settings:
 +
[[AviSource]]("Blah.avi")
 +
mfRainbow(scd=10, interlaced=false)
  
float clipstren - value clipping strength - 0.0-10.0 - 5.0
+
<br>
 +
== Changelog ==
 +
Version      Date            Changes<br>
 +
v0.32        2014/02/23      - Changed syntax to use MaskTools2.
 +
                              - Removed leftover parameters from earlier versions; they were disabled anyway.
 +
                              - Add "interlaced" parameter.<br>
 +
[http://web.archive.org/web/20090212071718/http://mf.creations.nl/avs/functions/mfRainbow-v0.31.avs v0.31:]      2004/04/15      - Tweakable scenechange detection for tough sources.<br>
 +
[http://web.archive.org/web/20090212071718/http://mf.creations.nl/avs/functions/mfRainbow-v0.3.avs v0.3:]      2004/03/18      - Temporal fluctuation mask building!<br>
 +
[http://web.archive.org/web/20090212071718/http://mf.creations.nl/avs/functions/mfRainbow-v0.2.avs v.02:]      2003/12/27      - Added U and V mask-building, overhauled Deen settings, changed to YV12.<br>
 +
[http://web.archive.org/web/20090212071718/http://mf.creations.nl/avs/functions/mfRainbow-0.1.avs v0.1:]      2003/05/31      - Initial release
  
bool post - spatial postprocessing - true/false - true
+
<br>
 +
==External Links ==
 +
*[http://forum.doom9.org/showthread.php?p=321319#post321319 Doom9 Forum] - mfRainbow v0.1 discussion.
 +
*[http://forum.doom9.org/showthread.php?t=67578 Doom9 Forum] - mfRainbow v0.2 - v0.31 discussion.
  
"Slow" mode might cause chroma ghosting on edges. Slowest is the safest, but might not be as effective as slow.
+
<br>
 
+
-----------------------------------------------
Explanation of clipstren: this works like value boosts in mfToon, it's the gamma correction of the mask ^^'. Lower values give more variation, but less strength.
+
'''Back to [[External_filters#Rainbow_.26_Dot_Crawl_Removal|External Filters]] &larr;'''
 
+
-----------------------------------------------
You need [[Deen]], [[MaskTools]] and [[MSmooth]].
+
 
+
Like before (and probably ever again), I don't check colorspaces cause I'm too lazy, and my function always outputs YV12. Who needs another colorspace anyway. I'm still kinda sad about the fact that [[Layer]] and [[Mask]] don't work in YUV (cause of the lack of an AYUV colorspace), so alas I have to do 2 colorspace conversions, namely to RGB and back. (Note Wilbert: note that there is a Layer/Mask equivalent working in YUV nowadays, so the script could be adjusted without those colorspace conversions.) The luma luckily doesn't have to be touched (and I do [[MergeChroma]] to ensure that), so that minimizes conversion errors.
+
 
+
Please test if this is any better or worse than existing derainbowers. A discussion can be found [http://forum.doom9.org/showthread.php?s=&postid=321859#post321859 here].
+
 
+
[[Category:Shared functions]]
+

Latest revision as of 00:08, 25 June 2018

Abstract
Author mf
Version v0.32
Download mfRainbow-v0.32.avsi
Category Rainbow & Dot Crawl Removal
License
Discussion

Contents

[edit] Description

Derainbows in areas of high Y, U and V frequencies, which fluctuate heavily.


[edit] Requirements

  • AviSynth 2.5.8 or greater
  • Supported color formats: YV12

[edit] Required Plugins

Latest versions of the following filters are recommended unless stated otherwise.


[edit] Syntax and Parameters

mfRainbow (clip input, int "scd", bool "interlaced")


clip  input =
Input clip.


int  scd = 10
Scene change detection for TemporalSoften; good values are between 5 and 30.


bool  interlaced = false
False means the input clip is progressive; with true it's interlaced. Interlaced content is processed by using SeparateFields in the beginning and Weave at the end.
Note: this parameter was added as an after-thought, it's not technically correct so use with caution and only as a last resort.


[edit] Examples

mfRainbow with default settings:

AviSource("Blah.avi")
mfRainbow(scd=10, interlaced=false)


[edit] Changelog

Version       Date            Changes
v0.32 2014/02/23 - Changed syntax to use MaskTools2. - Removed leftover parameters from earlier versions; they were disabled anyway. - Add "interlaced" parameter.
v0.31: 2004/04/15 - Tweakable scenechange detection for tough sources.
v0.3: 2004/03/18 - Temporal fluctuation mask building!
v.02: 2003/12/27 - Added U and V mask-building, overhauled Deen settings, changed to YV12.
v0.1: 2003/05/31 - Initial release


[edit] External Links



Back to External Filters


Personal tools