AWarpsharp2/aWarp4

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(small documentation update)
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
'''Back to [[aWarpSharp2#Filters|aWarpSharp2]]'''
+
{{FilterCat4|External_filters|Plugin_functions|Adjustment_filters|Sharpeners}}
== Description ==
+
<tt>aWarp4</tt> is designed for an even more custom warp-sharpening than <tt>[[AWarpsharp2/aWarp|aWarp]]</tt> allows. Unlike aWarp, this uses a 4x larger source clip than the edge mask. This is useful for improving the quality of the subpixel interpolation quality in the final step. [[Supersampling]] allows to produce a sharper result with lower {{Template:FuncDef3|depth}}, which equals to less deformations.
A warp-sharpening filter.  
+
== Syntax and Parameters ==
+
:{{Template:FuncDef|aWarp4(edge_mask_clip, int "depth", int "chroma")}}
+
 
<br>
 
<br>
::{{Par|edge_mask_clip| |}}
 
 
<br>
 
<br>
::{{Par|depth|int|3}}
+
== [[Script variables|Syntax and Parameters]] ==
:::Range: -128 to 127<br>
+
:{{Template:FuncDef|aWarp4 (''clip'', ''clip'', ''int'' "depth", ''int'' "chroma")}}
::::Strength of the final warping. Negative values result in warping in opposite direction.
+
 
<br>
 
<br>
::{{Par|chroma|int|1}}
+
::{{Par2| |clip| |}}
:::Processing mode for chroma planes (U and V):
+
:::Input clip; must be exactly 4 times the width and height of the edge mask clip. The 4x upsampled clip should always be top-left aligned, take a look at the examples below.
::::* 0 : fill with zeroes
+
<br>
::::* 1 : don't care, default for aSobel and aBlur
+
::{{Par2| |clip| |}}
::::* 2 : copy
+
:::Edge mask clip; usually the input clip  processed by <tt>[[AWarpsharp2/aSobel|aSobel]]</tt> and followed by <tt>[[AWarpsharp2/aBlur|aBlur]]</tt>.
::::* 3 : process
+
:::If you want more stable results it's a good idea to do anti-aliasing and temporal filtering (if necessary) on the edge mask before passing it to the warping stage.
::::* 4 : guide by luma - default for aWarpSharp, aWarp, and aWarp4 only
+
<br>
::::* 5 : same as 3, but don't process luma
+
::{{Par2|depth|int|3}}
::::* 6 : same as 4, but don't process luma
+
:::Strength of the final warping. Negative values result in warping in opposite direction, i.e. will blur the image instead of sharpening.
 +
:::Range: -128 to 127
 +
:::<span style="color:red">'''Note:'''</span> Chroma channels are internally processed with <code>{{Template:FuncDef|depth}}/2</code>.
 +
<br>
 +
::{{Par2|chroma|int|4}}
 +
:::Processing mode for the chroma channels (U and V):
 +
:::* 0 : fill with 0x80(128), output is grayscale.
 +
:::* 1 : don't care - chroma will be trashed.
 +
:::* 2 : copy chroma channels from the input clip.
 +
:::* 3 : process chroma; create an edge mask from each chroma channel and use those to warp each chroma channel individually.
 +
:::* 4 : process chroma; use the edge mask from the luma to warp the chroma channels.
 +
:::* 5 : same as 3, but don't process luma.
 +
:::* 6 : same as 4, but don't process luma.
 +
:::Luma plane (Y) is always processed, except for mode 5 and 6 which simply copy the luma channel from the input clip.
 +
<br>
 +
== Examples ==
 +
Correct usage examples[http://forum.doom9.org/showpost.php?p=1567371&postcount=67]:<br>
 +
<br>
 +
*Using [[Resize|Spline36Resize]] to upscale:
 +
input    = [[AviSource]]("Blah.avi")
 +
input4x  = input.Spline36Resize(width*4, height*4, src_left=0.375, src_top=0.375)
 +
edge_mask = input.aSobel(thresh=128, chroma=1).aBlur(blur=3, type=1, chroma=1)<br>
 +
aWarp4(input4x, edge_mask, depth=3, chroma=4)
 +
 
 +
<br>
 +
The following example is written differently but is identical to the one above.
 +
[[AviSource]]("Blah.avi")
 +
aWarp4(Spline36Resize(width*4, height*4, 0.375, 0.375), aSobel().aBlur())
 +
<br>
 +
*Using [[nnedi3/nnedi3_rpow2|nnedi3_rpow2]] and [[Resize|Spline36Resize]] to upscale:
 +
input    = [[AviSource]]("Blah.avi")
 +
input4x  = input.nnedi3_rpow2(rfactor=2).Spline36Resize(width*4, height*4, 0.25, 0.25)
 +
edge_mask = input.aSobel().aBlur()<br>
 +
aWarp4(input4x, edge_mask)
 +
<br>
 +
*Using [[nnedi3/nnedi3_rpow2|nnedi3_rpow2]] to upscale:
 +
input    = [[AviSource]]("Blah.avi")
 +
input4x  = input.nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2)
 +
edge_mask = input.aSobel().aBlur()<br>
 +
aWarp4(input4x, edge_mask, depth=2)
 +
<br>
 +
*The 4x upsampled clip should always be top-left aligned, so <code>Spline36Resize(width*4, height*4)</code> or <code>nnedi3_rpow2(rfactor=4)</code> '''will not''' produce correct results.
 +
<br>
 +
--------------------------------------------------------
 +
'''Back to [[aWarpSharp2#Filters|aWarpSharp2]] &larr;'''

Latest revision as of 00:55, 10 November 2015

aWarp4 is designed for an even more custom warp-sharpening than aWarp allows. Unlike aWarp, this uses a 4x larger source clip than the edge mask. This is useful for improving the quality of the subpixel interpolation quality in the final step. Supersampling allows to produce a sharper result with lower depth, which equals to less deformations.

[edit] Syntax and Parameters

aWarp4 (clip, clip, int "depth", int "chroma")


clip   =
Input clip; must be exactly 4 times the width and height of the edge mask clip. The 4x upsampled clip should always be top-left aligned, take a look at the examples below.


clip   =
Edge mask clip; usually the input clip processed by aSobel and followed by aBlur.
If you want more stable results it's a good idea to do anti-aliasing and temporal filtering (if necessary) on the edge mask before passing it to the warping stage.


int  depth = 3
Strength of the final warping. Negative values result in warping in opposite direction, i.e. will blur the image instead of sharpening.
Range: -128 to 127
Note: Chroma channels are internally processed with depth/2.


int  chroma = 4
Processing mode for the chroma channels (U and V):
  • 0 : fill with 0x80(128), output is grayscale.
  • 1 : don't care - chroma will be trashed.
  • 2 : copy chroma channels from the input clip.
  • 3 : process chroma; create an edge mask from each chroma channel and use those to warp each chroma channel individually.
  • 4 : process chroma; use the edge mask from the luma to warp the chroma channels.
  • 5 : same as 3, but don't process luma.
  • 6 : same as 4, but don't process luma.
Luma plane (Y) is always processed, except for mode 5 and 6 which simply copy the luma channel from the input clip.


[edit] Examples

Correct usage examples[1]:

input     = AviSource("Blah.avi")
input4x   = input.Spline36Resize(width*4, height*4, src_left=0.375, src_top=0.375)
edge_mask = input.aSobel(thresh=128, chroma=1).aBlur(blur=3, type=1, chroma=1)
aWarp4(input4x, edge_mask, depth=3, chroma=4)


The following example is written differently but is identical to the one above.

AviSource("Blah.avi")
aWarp4(Spline36Resize(width*4, height*4, 0.375, 0.375), aSobel().aBlur())


input     = AviSource("Blah.avi")
input4x   = input.nnedi3_rpow2(rfactor=2).Spline36Resize(width*4, height*4, 0.25, 0.25)
edge_mask = input.aSobel().aBlur()
aWarp4(input4x, edge_mask)


input     = AviSource("Blah.avi")
input4x   = input.nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2)
edge_mask = input.aSobel().aBlur()
aWarp4(input4x, edge_mask, depth=2)


  • The 4x upsampled clip should always be top-left aligned, so Spline36Resize(width*4, height*4) or nnedi3_rpow2(rfactor=4) will not produce correct results.



Back to aWarpSharp2

Personal tools