BlindDeHalo3

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m
(update link)
 
(14 intermediate revisions by one user not shown)
Line 1: Line 1:
{{FilterCat|External_filters|Restoration_filters|Dehalo}}
+
{{FilterCat4|External_filters|Scripts|Restoration_filters|Dehalo}}
{{Filter
+
{{Filter3
|{{Author/Didée}}
+
|1={{Author/Didée}}
|3_MT2
+
|2=3_MT2
|[http://home.arcor.de/dhanselmann/_stuff/BlindDeHalo3_MT2.zip BlindDeHalo3_MT2]
+
|3=[https://forum.doom9.org/attachment.php?attachmentid=5599&d=1143030001 BlindDeHalo3_MT2.zip]
|Dehalo
+
|4=Dehalo
|[[YV12]]
+
|5=
|
+
|6=[http://forum.doom9.org/showthread.php?t=74003 Doom9 Thread]}}
|}}
+
<br>
+
 
== Description ==
 
== Description ==
:This script removes the light & dark halos from too strong "Edge Enhancement".
+
This script removes the light & dark halos from too strong "Edge Enhancement".<br>
 
<br>
 
<br>
==== Requirements: ====
+
== Requirements ==
:- AviSynth 2.5.8 or later
+
* AviSynth 2.5.8 or later
:- Supported color formats: [[YV12]]
+
* Supported color formats: [[YV12]]
  
===== Required Filters: =====
+
=== Required Plugins ===
:*[[MaskTools2]] 2.0a48+
+
Latest versions of the following filters are recommended unless stated otherwise.<br>
:*[[RemoveGrain]]
+
*[[MaskTools2]]
 +
*<strike>RemoveGrain - part of the [[RemoveGrain v1.0b]] package.</strike>
 +
*[[RgTools]] - recommended drop-in replacement for RemoveGrain!
 
<br>
 
<br>
  
== Syntax and Parameters ==
+
== [[Script variables|Syntax and Parameters]] ==
:{{Template:FuncDef|BlindDeHalo3(clip clp, float "rx", float "ry", int "strength", float "lodamp", float "hidamp", float "sharpness", float "tweaker", int "PPmode", int "PPlimit", bool "interlaced")}}
+
:{|
 +
|-
 +
| {{Template:FuncDef|BlindDeHalo3}}
 +
|
 +
|{{Template:FuncDef|(''clip'' clp, ''float'' "rx", ''float'' "ry", ''int'' "strength", ''float'' "lodamp", ''float'' "hidamp", ''float'' "sharpness", ''float'' "tweaker", ''int'' "PPmode", ''int'' "PPlimit", ''bool'' "interlaced")}}
 +
|}
 
<br>
 
<br>
::{{Par|rx, ry|float|3.0}}
+
::{{Par2|clp|clip| }}
:::The radii to use for the [quasi-] gaussian blur, on which the halo removal is based.<br>
+
::::Input clip.
 
<br>
 
<br>
::{{Par|strength|int|125}}
+
::{{Par2|rx|float|3.0}}
:::The overall strength of the halo removal effect.<br>
+
::{{Par2|ry|float|3.0}}
 +
::::The radii to use for the [quasi-] Gaussian blur, on which the halo removal is based.<br>
 
<br>
 
<br>
::{{Par|lodamp, hidamp|float|0.0}}
+
::{{Par2|strength|int|125}}
:::Range: 0.0 - ??? (try 4.0 as a start)
+
::::The overall strength of the halo removal effect.<br>
::::With these two values, one can reduce the basic effect on areas that would change only little anyway (lodamp),
+
::::and/or on areas that would change very much (hidamp).
+
::::Lodamp does a reasonable job in keeping more detail in affected areas.
+
::::Hidamp is intended to keep rather small areas that are very bright or very dark from getting processed too strong.
+
::::Works OK on sources that contain only weak haloing - for sources ::with strong oversharpening, it should not be used, mostly.
+
::::(Usage has zero impact on speed.)
+
 
<br>
 
<br>
::{{Par|sharpness|float|0.0}}
+
::{{Par2|lodamp|float|0.0}}
:::Range: 0.0 - 1.58
+
::{{Par2|hidamp|float|0.0}}
::::By setting this bigger than 0.0, the affected areas will come out with better sharpness.  
+
:::With these two values, one can reduce the basic effect on areas that would change only little anyway ({{Template:FuncDef|lodamp}}), and/or on areas that would change very much ({{Template:FuncDef|hidamp}}).
::::However, strength must be chosen somewhat bigger as well, then, to get the same effect than without.
+
:::{{Template:FuncDef|lodamp}} does a reasonable job in keeping more detail in affected areas. {{Template:FuncDef|hidamp}} is intended to keep rather small areas that are very bright or very dark from getting processed too strong.
::::(This is the same as initial version's "maskblur" option.)
+
:::Works OK on sources that contain only weak haloing - for sources with strong over sharpening, it should not be used, mostly. (Usage has zero impact on speed.)
 +
 
 +
:::*Range: 0.0 to ??? (try 4.0 as a start)
 
<br>
 
<br>
::{{Par|tweaker|float|0.0}}
+
::{{Par2|sharpness|float|0.0}}
:::Range: 0.0 - 1.00
+
:::By setting this bigger than 0.0, the affected areas will come out with better sharpness. However, strength must be chosen somewhat bigger as well, then, to get the same effect than without.
::::May be used to get a stronger effect, seperately from altering "strenght".
+
:::(This is the same as initial version's "maskblur" option.)
::::(Also in accordance to initial version's working methodology. I had no better idea for naming this parameter.)
+
 
 +
:::*Range: 0.0 to 1.58
 +
<br>
 +
::{{Par2|tweaker|float|0.0}}
 +
:::May be used to get a stronger effect, separately from altering "strength". (Also in accordance to initial version's working methodology. I had no better idea for naming this parameter.)
 +
 
 +
:::*Range: 0.0 - 1.00
 
<br>
 
<br>
::{{Par|interlaced|bool|false}}
+
::{{Par2|interlaced|bool|false}}
:::As formerly, this is intended for sources that were originally interlaced, but then made progressive by deinterlacing.
+
:::As formerly, this is intended for sources that were originally interlaced, but then made progressive by deinterlacing. It aims in particular at clips that made their way through [[Restore24]].
:::It aims in particular at clips that made their way through Restore24.
+
 
<br>
 
<br>
::{{Par|PPmode|int|0}}
+
::{{Par2|PPmode|int|0}}
 
:::When set to "1" or "2", a second cleaning operation after the basic halo removal is done. This deals with:
 
:::When set to "1" or "2", a second cleaning operation after the basic halo removal is done. This deals with:
 
::::a) Removing/reducing those corona lines that sometimes are left over by BlindDeHalo
 
::::a) Removing/reducing those corona lines that sometimes are left over by BlindDeHalo
 
::::b) Improving on mosquito noise, if some is present.
 
::::b) Improving on mosquito noise, if some is present.
 
+
:::{{Template:FuncDef|PPmode}}=1 uses a simple Gaussian blur for post-cleaning. {{Template:FuncDef|PPmode}}=2 uses a 3*3 average, with zero weighting of the center pixel.
:::PPmode=1 uses a simple gaussian blur for post-cleaning.  
+
:::Also, {{Template:FuncDef|PPmode}} can be "-1" or "-2". In this case, the main dehaloing step is completely discarded, and *only* the PP cleaning is done.  
:::PPmode=2 uses a 3*3 average, with zero weigthing of the center pixel.
+
 
+
:::Also, PPmode can be "-1" or "-2". In this case, the main dehaloing step is completely discarded, and *only* the PP cleaning is done.  
+
 
:::This has less effect on halos, but can deal for sources containing more mosquito noise than halos.  
 
:::This has less effect on halos, but can deal for sources containing more mosquito noise than halos.  
 
<br>
 
<br>
::{{Par|PPlimit|int|0}}
+
::{{Par2|PPlimit|int|0}}
:::Can be used to make the PP routine change no pixel by more than [PPlimit].
+
:::Can be used to make the PP routine change no pixel by more than [{{Template:FuncDef|PPlimit}}].
 
:::I'm not sure if this makes much sense in this context. However the option is there - you never know what it might be good for.
 
:::I'm not sure if this makes much sense in this context. However the option is there - you never know what it might be good for.
 
<br>
 
<br>
 +
 
== Comments & Tips ==
 
== Comments & Tips ==
:Additional information for optimal usage. Written by Didée in this [http://forum.doom9.org/showpost.php?p=622289&postcount=70 thread.]
+
Additional information for optimal usage. Written by [http://forum.doom9.org/showpost.php?p=622289&postcount=70 Didée]
<br>
+
:*'''Regarding "strength" & "sharpness" & "tweaker"'''
+
::These three behave somewhat similar, but not the same.
+
::A bigger value for "sharpness" is similar to reducing "strength".
+
::A bigger value for "tweaker" is similar to increasing "strength" value -- and vice versa for both.
+
::Also the other way round: when increasing "sharpness", you probably have to increase "strength" a little as well, to get the same removal effect.
+
::Usage of "sharpness" works in particular good when bigger radii (say, >2.5) are used for dehaloing.
+
::Usage of "tweaker" is more useful when working with sources containing thin, weak halos.
+
::In the end, it comes down again to trial & error.
+
 
<br>
 
<br>
:*'''Lodamp and Hidamp'''
+
*'''Regarding "strength" & "sharpness" & "tweaker"'''
::Technically, these two are the "n" constants in two scaling factors of the form "x/(x+n)",  
+
:These three behave somewhat similar, but not the same.
::which are used when creating a LUT from the difference between input clip and its gaussian blurred version.
+
:A bigger value for "sharpness" is similar to reducing "strength". A bigger value for "tweaker" is similar to increasing "strength" value -- and vice versa for both.
 +
:Also the other way round: when increasing "sharpness", you probably have to increase "strength" a little as well, to get the same removal effect.
 +
:Usage of "sharpness" works in particular good when bigger radii (say, >2.5) are used for dehaloing. Usage of "tweaker" is more useful when working with sources containing thin, weak halos.
 +
:In the end, it comes down again to trial & error.
  
::As described above, "lodamp" deals for better protection of areas where this difference is alredy small.
+
*'''Lodamp and Hidamp'''
::Effectively, it preserves some more of weak detail in areas of high contrast.
+
:Technically, these two are the "n" constants in two scaling factors of the form "x/(x+n)", which are used when creating a LUT from the difference between input clip and its Gaussian blurred version.  
::A value of 4.0 seems a good starting point.
+
::One can also try to use bigger values like 16.0 or so, along with a bigger "strength" value.
+
::By this, one can somewhat change the characteristics of "what-is-processed-how-strongly".
+
  
::"hidamp" tries to do the opposite: protect small detail that is very bright or very dark from being toned down too much.  
+
:As described above, "lodamp" deals for better protection of areas where this difference is already small. Effectively, it preserves some more of weak detail in areas of high contrast. A value of 4.0 seems a good starting point. One can also try to use bigger values like 16.0 or so, along with a bigger "strength" value. By this, one can somewhat change the characteristics of "what-is-processed-how-strongly".
::But its usability is much more restricted: it seems to work OK when the actual halos of the source are rather weak,  
+
 
::and/or when not too small radii are used - in this case, the protection of very prominent detail works out, mostly.
+
:"hidamp" tries to do the opposite: protect small detail that is very bright or very dark from being toned down too much. But its usability is much more restricted: it seems to work OK when the actual halos of the source are rather weak, and/or when not too small radii are used - in this case, the protection of very prominent detail works out, mostly. In case the source contains strong haloing, it's better to not use "hidamp" at all: in this case, the halos itself would be considered to be "prominent detail" and be protected ... no go.
::In case the source contains strong haloing, is's better to not use "hidamp" at all:
+
::in this case, the halos itself would be considerd to be "prominent detail" and be protected ... no go.
+
 
<br>
 
<br>
 +
 
== Examples ==
 
== Examples ==
 
Full function call with default values:
 
Full function call with default values:
Line 106: Line 101:
  
 
== Changelog ==
 
== Changelog ==
  Changes [http://forum.doom9.org/showpost.php?p=803275&postcount=82 2006-03-22]
+
Version      Date            Changes<br>
     - BlindDeHalo3_MT2
+
[http://forum.doom9.org/showpost.php?p=803275&postcount=82 3MT2]        2006/03/22    - BlindDeHalo3_MT2
      - Changed syntax to use [[MaskTools2]]
+
                              - Changed syntax to use MaskTools2
      - Replaced some things with RemoveGrain-modes ([[RemoveGrain]].dll newer than v0.9 required)
+
                              - Replaced some things with RemoveGrain-modes (RemoveGrain.dll newer than v0.9 required)
      - Fixed some oddities
+
                              - Fixed some oddities
      - New PPmode (3 and -3): shouldn't blur, but still remove mosquitos and leftover halo borders<br>
+
                              - New PPmode (3 and -3): shouldn't blur, but still remove mosquitos and leftover halo borders<br>
  Changes [http://forum.doom9.org/showpost.php?p=622289&postcount=70 2005-03-09]
+
[http://forum.doom9.org/showpost.php?p=622289&postcount=70 3]          2005/03/09    - BlindDeHalo3
     - BlindDeHalo3
+
                              - [http://forum.doom9.org/showpost.php?p=737387&postcount=32 Added parameters]
      - [http://forum.doom9.org/showpost.php?p=737387&postcount=32 Added parameters]
+
                                - "sharpness" parameter (and "tweak" counterpart)
          - "sharpness" parameter (and "tweak" counterpart)
+
                                - "lodamp" (and "hidamp" (!) ) parameter
          - "lodamp" (and "hidamp" (!) ) parameter
+
                                - The "PP" modes, which act somewhat similar to [[HQDering]] ...
          - The "PP" modes, which act somewhat similar to HQdering ...
+
                                  ... where "PP" < 0 runs *only* these routines, without the main dehaloing one<br>
          - ... where "PP" < 0 runs *only* these routines, without the main dehaloing one<br>
+
[http://forum.doom9.org/showpost.php?p=579853&postcount=16 2]          2004/12/10    - BlindDeHalo2
  Changes [http://forum.doom9.org/showpost.php?p=579853&postcount=16 2004-12-10:]
+
                              - Added interlaced parameter
     - BlindDeHalo2
+
                              - Changed rx, ry, and strength default
      - Added interlaced parameter
+
                              - Removed parameters<br>
      - Changed rx, ry, and strength default
+
[http://forum.doom9.org/showpost.php?p=471158&postcount=1 v0.1]        2004/04/07    - BlindDeHalo
      - Removed parameters<br>
+
                              - Initial release
  Changes [http://forum.doom9.org/showpost.php?p=471158&postcount=1 2004-04-07:]
+
     - BlindDeHalo1
+
      - Initial release
+
 
<br>
 
<br>
  
 
== External Links ==
 
== External Links ==
: - [http://forum.doom9.org/showthread.php?t=74003 Doom9 Forum] - BlindDeHalo Discussion.
+
*[http://forum.doom9.org/showthread.php?t=74003 Doom9 Forum] - BlindDeHalo Discussion.
<br>
+
 
<br>
 
<br>
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
 
'''Back to [[External_filters#Dehaloing|External Filters]] &larr;'''
 
'''Back to [[External_filters#Dehaloing|External Filters]] &larr;'''

Latest revision as of 22:53, 26 December 2022

Abstract
Author Didée
Version 3_MT2
Download BlindDeHalo3_MT2.zip
Category Dehalo
License
Discussion Doom9 Thread

Contents

[edit] Description

This script removes the light & dark halos from too strong "Edge Enhancement".

[edit] Requirements

  • AviSynth 2.5.8 or later
  • Supported color formats: YV12

[edit] Required Plugins

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


[edit] Syntax and Parameters

BlindDeHalo3 (clip clp, float "rx", float "ry", int "strength", float "lodamp", float "hidamp", float "sharpness", float "tweaker", int "PPmode", int "PPlimit", bool "interlaced")


clip  clp =
Input clip.


float  rx = 3.0
float  ry = 3.0
The radii to use for the [quasi-] Gaussian blur, on which the halo removal is based.


int  strength = 125
The overall strength of the halo removal effect.


float  lodamp = 0.0
float  hidamp = 0.0
With these two values, one can reduce the basic effect on areas that would change only little anyway (lodamp), and/or on areas that would change very much (hidamp).
lodamp does a reasonable job in keeping more detail in affected areas. hidamp is intended to keep rather small areas that are very bright or very dark from getting processed too strong.
Works OK on sources that contain only weak haloing - for sources with strong over sharpening, it should not be used, mostly. (Usage has zero impact on speed.)
  • Range: 0.0 to ??? (try 4.0 as a start)


float  sharpness = 0.0
By setting this bigger than 0.0, the affected areas will come out with better sharpness. However, strength must be chosen somewhat bigger as well, then, to get the same effect than without.
(This is the same as initial version's "maskblur" option.)
  • Range: 0.0 to 1.58


float  tweaker = 0.0
May be used to get a stronger effect, separately from altering "strength". (Also in accordance to initial version's working methodology. I had no better idea for naming this parameter.)
  • Range: 0.0 - 1.00


bool  interlaced = false
As formerly, this is intended for sources that were originally interlaced, but then made progressive by deinterlacing. It aims in particular at clips that made their way through Restore24.


int  PPmode = 0
When set to "1" or "2", a second cleaning operation after the basic halo removal is done. This deals with:
a) Removing/reducing those corona lines that sometimes are left over by BlindDeHalo
b) Improving on mosquito noise, if some is present.
PPmode=1 uses a simple Gaussian blur for post-cleaning. PPmode=2 uses a 3*3 average, with zero weighting of the center pixel.
Also, PPmode can be "-1" or "-2". In this case, the main dehaloing step is completely discarded, and *only* the PP cleaning is done.
This has less effect on halos, but can deal for sources containing more mosquito noise than halos.


int  PPlimit = 0
Can be used to make the PP routine change no pixel by more than [PPlimit].
I'm not sure if this makes much sense in this context. However the option is there - you never know what it might be good for.


[edit] Comments & Tips

Additional information for optimal usage. Written by Didée

  • Regarding "strength" & "sharpness" & "tweaker"
These three behave somewhat similar, but not the same.
A bigger value for "sharpness" is similar to reducing "strength". A bigger value for "tweaker" is similar to increasing "strength" value -- and vice versa for both.
Also the other way round: when increasing "sharpness", you probably have to increase "strength" a little as well, to get the same removal effect.
Usage of "sharpness" works in particular good when bigger radii (say, >2.5) are used for dehaloing. Usage of "tweaker" is more useful when working with sources containing thin, weak halos.
In the end, it comes down again to trial & error.
  • Lodamp and Hidamp
Technically, these two are the "n" constants in two scaling factors of the form "x/(x+n)", which are used when creating a LUT from the difference between input clip and its Gaussian blurred version.
As described above, "lodamp" deals for better protection of areas where this difference is already small. Effectively, it preserves some more of weak detail in areas of high contrast. A value of 4.0 seems a good starting point. One can also try to use bigger values like 16.0 or so, along with a bigger "strength" value. By this, one can somewhat change the characteristics of "what-is-processed-how-strongly".
"hidamp" tries to do the opposite: protect small detail that is very bright or very dark from being toned down too much. But its usability is much more restricted: it seems to work OK when the actual halos of the source are rather weak, and/or when not too small radii are used - in this case, the protection of very prominent detail works out, mostly. In case the source contains strong haloing, it's better to not use "hidamp" at all: in this case, the halos itself would be considered to be "prominent detail" and be protected ... no go.


[edit] Examples

Full function call with default values:

AviSource("Blah.avi")
BlindDeHalo3( rx=3.0, ry=3.0, strength=125, 
\            lodamp=0.0, hidamp=0.0, sharpness=0.0, tweaker=0.0,
\            PPmode=0, PPlimit=0, interlaced=false)


[edit] Changelog

Version      Date            Changes
3MT2 2006/03/22 - BlindDeHalo3_MT2 - Changed syntax to use MaskTools2 - Replaced some things with RemoveGrain-modes (RemoveGrain.dll newer than v0.9 required) - Fixed some oddities - New PPmode (3 and -3): shouldn't blur, but still remove mosquitos and leftover halo borders
3 2005/03/09 - BlindDeHalo3 - Added parameters - "sharpness" parameter (and "tweak" counterpart) - "lodamp" (and "hidamp" (!) ) parameter - The "PP" modes, which act somewhat similar to HQDering ... ... where "PP" < 0 runs *only* these routines, without the main dehaloing one
2 2004/12/10 - BlindDeHalo2 - Added interlaced parameter - Changed rx, ry, and strength default - Removed parameters
v0.1 2004/04/07 - BlindDeHalo - Initial release


[edit] External Links




Back to External Filters

Personal tools