SangNom2

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "== SangNom2 == Reimplementation of the old MarcFD's SangNom filter. Output is not completely but mostly identical. <br> === What's different === * It's open source * Correct...")
 
(v0.6.0 update)
 
(27 intermediate revisions by one user not shown)
Line 1: Line 1:
== SangNom2 ==
+
{{FilterCat6|External_filters|Plugins|Plugins_x64|Restoration_filters|Deinterlacers|Deep_color_tools}}
 +
{{Filter3
 +
| {{Author/tp7}}, {{Author/Asd-g}}
 +
| v0.6.0
 +
| [https://github.com/Asd-g/AviSynth-SangNom2/releases SangNom2-0.6.0.7z]
 +
| Deinterlacing
 +
| [http://opensource.org/licenses/MIT MIT] but binaries are [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 +
|6=[http://forum.doom9.org/showthread.php?t=168315 Doom9 Thread]
 +
}}
  
Reimplementation of the old MarcFD's SangNom filter. Output is not completely but mostly identical.
+
== Description ==
 +
SangNom2 is a reimplementation of MarcFD's old [[SangNom]] filter. Originally it's a single field deinterlacer using edge-directed interpolation but nowadays it's mainly used in anti-aliasing scripts. The output is not completely but mostly identical to the original [[SangNom]].
 
<br>
 
<br>
 
+
*'''Note:''' SangNom2 v0.5.0 is a port of the VapourSynth version. See [[SangNom2#Changelog|changelog for details]].
=== What's different ===
+
* It's open source
+
* Correct borders processing
+
* Additinal colorspace support
+
* Multithreading support
+
* Requries SSE2
+
 
+
Singlethreaded performance is mostly identical to the old version despite this plugin using SSE2.
+
 
<br>
 
<br>
 +
== What's Different ==
 +
*It's open source
 +
*Correct borders processing
 +
*Additional colorspace support
 +
*Internal multithreading support (v0.35 only)
 +
*Requires [[SSE2]]
 +
*Single threaded performance is mostly identical to the old version despite this plugin using [[SSE2]].
 +
* High bit-depth support (v0.4.0)
  
 
=== Y8 ===
 
=== Y8 ===
One of the most important differences is Y8 support in AviSynth 2.6. This enables much faster antialiasing (especially when used with [https://github.com/tp7/fturn FTurn] plugin) without any chroma processing.
+
One of the most important differences is [[Y8]] support in AviSynth 2.6. This enables much faster anti-aliasing (especially when used with the [[FTurn]] plugin) without any chroma processing. See [[MAA2]] for example.
 +
<br>
 
<br>
 
<br>
function maa(clip input) {
 
    mask = input.mt_edge("sobel",7,7,5,5).mt_inflate()
 
    aa_clip = input.ConvertToY8().Spline36Resize(width(input)*2,height(input)*2).FTurnLeft() \
 
                  .SangNom2().FTurnRight().SangNom2().Spline36Resize(width(input),height(input))
 
    return mt_merge(input,aa_clip,mask,u=2,v=2)<br>
 
}
 
  
=== Multithreading ===
+
== Requirements ==
This plugin uses min(number of logical processors, 4) threads to do its job. You can control number of threads using the *threads* parameter.  
+
* [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6]
In my tests performance doesn't get any better when using more than 4 threads.
+
* [x64]: [[AviSynth+]]
 +
* Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
 +
**AviSynth+: all [[planar]] Y and YUV formats, 8-16 bit and 32-bit float are supported
 +
<br>
 +
* [[SSE2]] capable CPU
 +
* [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2019 Redistributable Package (x86 / x64)]
 +
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> required for <tt>SangNom2-x86</tt>
 +
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> required for <tt>SangNom2-x64</tt>
 +
<br>
  
Internally it uses a simple thread pool but I do consider switching to avstp if it gets a bit nicer api.<br>
+
== [[Script variables|Syntax and Parameters]] ==
 +
:{{Template:FuncDef|SangNom2 (clip, int "order", int "aa", int "aac", int "threads", bool "dh" , bool "luma", bool "chroma", int "opt")}}
 +
<br>
 +
::{{Par2| |clip| }}
 +
:::Input clip must be [[planar]] Y or YUV, 8-16bit and 32-bit float.
 +
<br>
 +
::{{Par2|order|int|1}}
 +
:::Order of deinterlacing:
  
=== Chroma processing ===
+
::::*0 : Double frame rate, top and bottom fields are kept but [[DoubleWeave]] must be called before SangNom2.
Originally, SangNom always assumes aa=0 for chroma processing. This makes some use cases harder to implement, so additional parameter *aac* was introduced.<br>
+
::::*1 : Single frame rate, keep top field.
It's the same as *aa* but for chroma. Default value is 0 to maintain backward compatibility.<br>
+
::::*2 : Single frame rate, Keep bottom field.
 +
<br>
 +
::{{Par2|aa|int|48}}
 +
:::The strength of luma anti-aliasing, this value is considered in 8 bit clip.
 +
:::Must be between 0 and 128.
 +
<br>
 +
::{{Par2|aac|int|0}}
 +
:::Strength of chroma anti-aliasing. The strength of chroma anti-aliasing, this value is considered in 8 bit clip.
 +
:::Must be between 0 and 128.
 +
:::*The original [[SangNom]] always assumes {{Template:FuncDef|aa}}=0 for chroma processing.  
 +
:::*This makes some use cases harder to implement, so additional parameter {{Template:FuncDef|aac}} was introduced. Default value is 0 to maintain backward compatibility.
 +
<br>
 +
::{{Par2|threads|int| }}
 +
:::It's a dummy parameter for backward compatibility. (v0.4.0 only)
 +
:::v0.35 only:
 +
:::*Control how many threads SangNom2 uses. This plugin uses min(number of logical processors, 4) threads to do its job.
 +
:::*In my tests performance doesn't get any better when using more than 4 threads. Internally it uses a simple thread pool.
 +
<br>
 +
::{{Par2|dh|bool|false}}
 +
:::Doubles the height of the input. Each line of the input is copied to every other line of the output and the missing lines are interpolated.
 +
:::Note: If <code>dh=true</code>, it will force all planes to be processed.
 +
:::Default: false.
 +
<br>
 +
::{{Par2|luma|bool|true}}
 +
::{{Par2|chroma|bool|true}}
 +
:::Planes to process.
 +
:::Default: luma=true; chroma=true.
 +
<br>
 +
::{{Par2|opt|int|-1}}
 +
:::Sets which cpu optimizations to use.
 +
:::*-1 : Auto-detect.
 +
:::*0 : Use C++ code.
 +
:::*1 : Use SSE2 code.
 +
<br>
 +
===SangNom===
 +
Backward compatible SangNom() function.
 +
<br>
 +
<br>
 +
:{{Template:FuncDef|SangNom (clip, int "order", int "aa", int "opt")}}
 +
<br>
 +
::{{Par2| |clip| }}
 +
:::Input clip must be [[planar]] Y or YUV, 8-16bit and 32-bit float.
 +
<br>
 +
::{{Par2|order|int|1}}
 +
:::Order of deinterlacing:
  
=== License ===
+
::::*0 : Single frame rate, Keep bottom field.
This project is licensed under the [http://opensource.org/licenses/MIT MIT license.] Binaries are [http://www.gnu.org/licenses/gpl-2.0.html GPL v2] because if I understand licensing stuff right (please tell me if I don't) they must be.
+
::::*1 : Single frame rate, keep top field. [default]
 +
::::*2 : Double frame rate, top and bottom fields are kept but [[DoubleWeave]] must be called before SangNom.
 +
<br>
 +
::{{Par2|aa|int|48}}
 +
:::The strength of luma anti-aliasing, this value is considered in 8 bit clip.
 +
:::Must be between 0 and 128, default is 48.
 +
<br>
 +
::{{Par2|opt|int|-1}}
 +
:::Sets which cpu optimizations to use.
 +
:::*-1 : Auto-detect.
 +
:::*0 : Use C++ code.
 +
:::*1 : Use SSE2 code.
 +
<br>
 +
 
 +
== Examples ==  
 +
SangNom with default settings:
 +
[[AviSource]]("blah.avi")
 +
SangNom2(order=1, aa=48, aac=0, dh=false, luma=true, chroma=false, opt=-1)
 +
<br>
 +
SangNom with double frame rate output:
 +
[[AviSource]]("blah.avi")
 +
[[DoubleWeave]]()
 +
SangNom2(order=0, aa=48, aac=0, opt=-1)
 +
<br>
 +
== Changelog ==
 +
Version      Date            Changes<br>
 +
v0.6.0      2020/08/27      - Added parameter opt.
 +
                              - Applied the changes from VS SangNom r42.
 +
                              - Separated SSE2 code.<br>
 +
v0.5.0      2020/05/26      - Fixed order=0.
 +
                              - Added backward compatible SangNom function.<br>
 +
v0.4.0      2020/05/23      - Backport VapourSynth port by James1201 and dubhater.
 +
                              - High bit depth support
 +
                              - Add parameters: "dh", "luma", "chroma".
 +
                              - Internal multithreading disabled, "threads" is now just a dummy parameter.
 +
                              - AviSynth+: self-registers as [[MT_MULTI_INSTANCE]].
 +
                              - Added support for AviSynth+ v8 interface.<br>
 +
v0.35        2013/11/26      - x64 build added.
 +
                                Confirmed to be a little slower than x86 on some resolutions with 4 threads and faster in other cases.
 +
                              - Compiled with MSVC++12, requires Microsoft Visual C++ 2012 Redistributable Package <br>
 +
v0.3        2013/07/26      - This plugin now works only with AviSynth 2.6 Alpha4 or later. All previous versions are not supported.
 +
                                Download previous release if you need that.
 +
                              - This version adds aac parameter, which allows to configure chroma aa strength.
 +
                              - It now also works on YV24 correctly, instead of processing only half chroma resolution.<br>
 +
v0.2        2013/07/14      - Second release, containing some significant performance improvements.
 +
                              - This plugin is now threaded with min(number of logical processors, 4) threads used by default.
 +
                                To change number of threads, just use threads parameter.<br>
 +
v0.1        2013/07/13      - First public release.
 +
                                Should be more or less stable but doesn't include many improvements.
 +
<br>
 +
== Archived Downloads ==
 +
{| class="wikitable" border="1"; width="400px"
 +
|-
 +
!!width="100px"| Version
 +
!!width="150px"| Download
 +
!!width="150px"| Source Code
 +
|-
 +
!v0.35
 +
|[http://github.com/tp7/SangNom2/releases/download/0.35/SangNom2-x86.zip SangNom2-x86.zip]
 +
[http://github.com/tp7/SangNom2/releases/download/0.35/SangNom2-x64.zip SangNom2-x64.zip]
 +
|[http://github.com/tp7/SangNom2/archive/0.35.zip 0.35.zip]
 +
|-
 +
!v0.3
 +
|[http://github.com/tp7/SangNom2/releases/download/v0.3/SangNom2.dll SangNom2.dll]
 +
|[http://github.com/tp7/SangNom2/archive/v0.3.zip v0.3.zip]
 +
|-
 +
!v0.2
 +
|[http://github.com/tp7/SangNom2/releases/download/v0.2/SangNom2.dll SangNom2.dll]
 +
|[http://github.com/tp7/SangNom2/archive/v0.2.zip v0.2.zip]
 +
|-
 +
!v0.1
 +
|[http://github.com/tp7/SangNom2/releases/download/v0.1/SangNom2.dll SangNom2.dll]
 +
|[http://github.com/tp7/SangNom2/archive/v0.1.zip v0.1.zip]
 +
|}
 +
<br>
 +
== External Links ==
 +
*[https://github.com/tp7/SangNom2 GitHub] - Source code repository (original).
 +
*[https://github.com/Asd-g/AviSynth-SangNom2 GitHub] - Source code repository (updated).
 +
*[https://github.com/dubhater/vapoursynth-sangnom GitHub] - Source code repository (VapourSynth Port).
 +
<br>
 +
<br>
 +
-----------------------------------------------
 +
'''Back to [[External_filters#Deinterlacing|External Filters]] &larr;'''

Latest revision as of 19:39, 29 August 2020

Abstract
Author tp7, Asd-g
Version v0.6.0
Download SangNom2-0.6.0.7z
Category Deinterlacing
License MIT but binaries are GPLv2
Discussion Doom9 Thread

Contents

[edit] Description

SangNom2 is a reimplementation of MarcFD's old SangNom filter. Originally it's a single field deinterlacer using edge-directed interpolation but nowadays it's mainly used in anti-aliasing scripts. The output is not completely but mostly identical to the original SangNom.


[edit] What's Different

  • It's open source
  • Correct borders processing
  • Additional colorspace support
  • Internal multithreading support (v0.35 only)
  • Requires SSE2
  • Single threaded performance is mostly identical to the old version despite this plugin using SSE2.
  • High bit-depth support (v0.4.0)

[edit] Y8

One of the most important differences is Y8 support in AviSynth 2.6. This enables much faster anti-aliasing (especially when used with the FTurn plugin) without any chroma processing. See MAA2 for example.

[edit] Requirements


*** vcredist_x86.exe required for SangNom2-x86
*** vcredist_x64.exe required for SangNom2-x64


[edit] Syntax and Parameters

SangNom2 (clip, int "order", int "aa", int "aac", int "threads", bool "dh" , bool "luma", bool "chroma", int "opt")


clip   =
Input clip must be planar Y or YUV, 8-16bit and 32-bit float.


int  order = 1
Order of deinterlacing:
  • 0 : Double frame rate, top and bottom fields are kept but DoubleWeave must be called before SangNom2.
  • 1 : Single frame rate, keep top field.
  • 2 : Single frame rate, Keep bottom field.


int  aa = 48
The strength of luma anti-aliasing, this value is considered in 8 bit clip.
Must be between 0 and 128.


int  aac = 0
Strength of chroma anti-aliasing. The strength of chroma anti-aliasing, this value is considered in 8 bit clip.
Must be between 0 and 128.
  • The original SangNom always assumes aa=0 for chroma processing.
  • This makes some use cases harder to implement, so additional parameter aac was introduced. Default value is 0 to maintain backward compatibility.


int  threads =
It's a dummy parameter for backward compatibility. (v0.4.0 only)
v0.35 only:
  • Control how many threads SangNom2 uses. This plugin uses min(number of logical processors, 4) threads to do its job.
  • In my tests performance doesn't get any better when using more than 4 threads. Internally it uses a simple thread pool.


bool  dh = false
Doubles the height of the input. Each line of the input is copied to every other line of the output and the missing lines are interpolated.
Note: If dh=true, it will force all planes to be processed.
Default: false.


bool  luma = true
bool  chroma = true
Planes to process.
Default: luma=true; chroma=true.


int  opt = -1
Sets which cpu optimizations to use.
  • -1 : Auto-detect.
  • 0 : Use C++ code.
  • 1 : Use SSE2 code.


[edit] SangNom

Backward compatible SangNom() function.

SangNom (clip, int "order", int "aa", int "opt")


clip   =
Input clip must be planar Y or YUV, 8-16bit and 32-bit float.


int  order = 1
Order of deinterlacing:
  • 0 : Single frame rate, Keep bottom field.
  • 1 : Single frame rate, keep top field. [default]
  • 2 : Double frame rate, top and bottom fields are kept but DoubleWeave must be called before SangNom.


int  aa = 48
The strength of luma anti-aliasing, this value is considered in 8 bit clip.
Must be between 0 and 128, default is 48.


int  opt = -1
Sets which cpu optimizations to use.
  • -1 : Auto-detect.
  • 0 : Use C++ code.
  • 1 : Use SSE2 code.


[edit] Examples

SangNom with default settings:

AviSource("blah.avi")
SangNom2(order=1, aa=48, aac=0, dh=false, luma=true, chroma=false, opt=-1)


SangNom with double frame rate output:

AviSource("blah.avi")
DoubleWeave()
SangNom2(order=0, aa=48, aac=0, opt=-1)


[edit] Changelog

Version      Date            Changes
v0.6.0 2020/08/27 - Added parameter opt. - Applied the changes from VS SangNom r42. - Separated SSE2 code.
v0.5.0 2020/05/26 - Fixed order=0. - Added backward compatible SangNom function.
v0.4.0 2020/05/23 - Backport VapourSynth port by James1201 and dubhater. - High bit depth support - Add parameters: "dh", "luma", "chroma". - Internal multithreading disabled, "threads" is now just a dummy parameter. - AviSynth+: self-registers as MT_MULTI_INSTANCE. - Added support for AviSynth+ v8 interface.
v0.35 2013/11/26 - x64 build added. Confirmed to be a little slower than x86 on some resolutions with 4 threads and faster in other cases. - Compiled with MSVC++12, requires Microsoft Visual C++ 2012 Redistributable Package
v0.3 2013/07/26 - This plugin now works only with AviSynth 2.6 Alpha4 or later. All previous versions are not supported. Download previous release if you need that. - This version adds aac parameter, which allows to configure chroma aa strength. - It now also works on YV24 correctly, instead of processing only half chroma resolution.
v0.2 2013/07/14 - Second release, containing some significant performance improvements. - This plugin is now threaded with min(number of logical processors, 4) threads used by default. To change number of threads, just use threads parameter.
v0.1 2013/07/13 - First public release. Should be more or less stable but doesn't include many improvements.


[edit] Archived Downloads

Version Download Source Code
v0.35 SangNom2-x86.zip

SangNom2-x64.zip

0.35.zip
v0.3 SangNom2.dll v0.3.zip
v0.2 SangNom2.dll v0.2.zip
v0.1 SangNom2.dll v0.1.zip


[edit] External Links

  • GitHub - Source code repository (original).
  • GitHub - Source code repository (updated).
  • GitHub - Source code repository (VapourSynth Port).




Back to External Filters

Personal tools