Nnedi3ocl/nnedi3x rpow2

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (category)
m (remove category 'Script_functions')
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Plugin_Filters]]
+
{{FilterCat|External_filters|Adjustment_filters|Resizers}}
[[Category:Resizers]]
+
'''Back to [[nnedi3ocl]] ←'''
'''Back to [[nnedi3ocl#Filters|nnedi3ocl]] ←'''
+
 
--------------------------------------------------
 
--------------------------------------------------
<br>
 
 
<br>
 
<br>
 
== Description ==
 
== Description ==
:nnedi3x_rpow2 is for enlarging images by the power of 2.
+
nnedi3x_rpow2 is a script function for advanced scaling with chroma and center correction. It supports all [[planar]] formats and YUY2 and RGB24 as well. nnedi3x_rpow2 also doesn't complain if you feed it with now removed parameters of original [[Nnedi3/nnedi3_rpow2|nnedi3_rpow2]].  
 +
<br>
 
<br>
 
<br>
 
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
 
:{{Template:FuncDef|nnedi3x_rpow2 (''clip'' a, ''int'' rfactor, ''int'' "nsize", ''int'' "nns", ''int'' "qual", ''int'' "etype", ''int'' "pscrn", ''string'' "cshift", ''int'' "fwidth", ''int'' "fheight", "ep0", "ep1",  ''int'' "threads", ''int'' "opt", ''int'' "fapprox", ''bool'' "Y", ''bool'' "U", ''bool'' "V")}}
 
:{{Template:FuncDef|nnedi3x_rpow2 (''clip'' a, ''int'' rfactor, ''int'' "nsize", ''int'' "nns", ''int'' "qual", ''int'' "etype", ''int'' "pscrn", ''string'' "cshift", ''int'' "fwidth", ''int'' "fheight", "ep0", "ep1",  ''int'' "threads", ''int'' "opt", ''int'' "fapprox", ''bool'' "Y", ''bool'' "U", ''bool'' "V")}}
Line 27: Line 25:
 
<br>
 
<br>
 
::{{Par2|nns|int|3}}
 
::{{Par2|nns|int|3}}
:::Sets the number of neurons in the predictor neural network. Possible settings are
+
:::Sets the number of neurons in the predictor neural network. Possible settings are 0, 1, 2, 3, and 4. 0 is fastest. 4 is slowest, but should give the best quality.  
:::0, 1, 2, 3, and 4. 0 is fastest. 4 is slowest, but should give the best quality. This
+
:::This is a quality vs speed option; however, differences are usually small. The difference in speed will become larger as '{{Template:FuncDef|qual}}' is increased.
:::is a quality vs speed option; however, differences are usually small. The difference
+
:::in speed will become larger as '{{Template:FuncDef|qual}}' is increased.
+
  
 
::::*0 - 16
 
::::*0 - 16
Line 39: Line 35:
 
<br>
 
<br>
 
::{{Par2|qual|int|1}}
 
::{{Par2|qual|int|1}}
:::Controls the number of different neural network predictions that are blended together
+
:::Controls the number of different neural network predictions that are blended together to compute the final output value.  
:::to compute the final output value. Each neural network was trained on a different set
+
:::Each neural network was trained on a different set of training data. Blending the results of these different networks improves generalization to unseen data.
:::of training data. Blending the results of these different networks improves generalization
+
:::Possible values are 1 or 2. Essentially this is a quality vs speed option. Larger values will result in more processing time, but should give better results.  
:::to unseen data. Possible values are 1 or 2. Essentially this is a quality vs speed
+
:::However, the difference is usually pretty small. I would recommend using {{Template:FuncDef|qual}}>1 for things like single image enlargement.
:::option. Larger values will result in more processing time, but should give better results.
+
:::However, the difference is usually pretty small. I would recommend using {{Template:FuncDef|qual}}>1 for
+
:::things like single image enlargement.
+
 
<br>
 
<br>
 
::{{Par2|etype|int|0}}
 
::{{Par2|etype|int|0}}
Line 57: Line 50:
 
<br>
 
<br>
 
::{{Par2|cshift|string|""}}
 
::{{Par2|cshift|string|""}}
:::Sets the resizer used for correcting the image center shift that nnedi3_rpow2 introduces.  
+
:::Sets the resizer used for correcting the image center shift that nnedi3x_rpow2 introduces. This can be any of Avisynth's [[Resize|internal resizers]], such as "[[Spline36Resize]]", "[[LanczosResize]]", etc...  
:::This can be any of Avisynth's [[Resize|internal resizers]], such as "spline36resize",
+
:::If not specified the shift is not corrected. The correction is accomplished by using the subpixel cropping capability of Avisynth's internal resizers.
:::"lanczosresize", etc... If not specified the shift is not corrected. The correction
+
:::is accomplished by using the subpixel cropping capability of Avisynth's internal resizers.
+
 
<br>
 
<br>
 
::{{Par2|fwidth|int| }}
 
::{{Par2|fwidth|int| }}
 
::{{Par2|fheight|int| }}
 
::{{Par2|fheight|int| }}
:::If correcting the image center shift by using the '{{Template:FuncDef|cshift}}' parameter, {{Template:FuncDef|fwidth}}/{{Template:FuncDef|fheight}}
+
:::If correcting the image center shift by using the '{{Template:FuncDef|cshift}}' parameter, {{Template:FuncDef|fwidth}}/{{Template:FuncDef|fheight}} allow you to set a new output resolution.  
:::allow you to set a new output resolution. First, the image is enlarged by '{{Template:FuncDef|rfactor}}'
+
:::First, the image is enlarged by '{{Template:FuncDef|rfactor}}' using nnedi3. Once that is completed the image center shift is corrected, and the image is resampled to {{Template:FuncDef|fwidth}} x {{Template:FuncDef|fheight}} resolution.  
:::using [[nnedi3ocl]]. Once that is completed the image center shift is corrected, and the
+
:::The shifting and resampling happen in one call using the internal Avisynth resizer you specify via the '{{Template:FuncDef|cshift}}' string. If {{Template:FuncDef|fwidth}}/{{Template:FuncDef|fheight}} are not specified, then they are set equal to {{Template:FuncDef|rfactor}}*width and {{Template:FuncDef|rfactor}}*height respectively (in other words they do nothing).
:::image is resampled to {{Template:FuncDef|fwidth}} x {{Template:FuncDef|fheight}} resolution. The shifting and resampling
+
:::happen in one call using the internal Avisynth resizer you specify via the '{{Template:FuncDef|cshift}}'
+
:::string. If {{Template:FuncDef|fwidth}}/{{Template:FuncDef|fheight}} are not specified, then they are set equal to {{Template:FuncDef|rfactor}}*width
+
:::and {{Template:FuncDef|rfactor}}*height respectively (in other words they do nothing).
+
 
<br>
 
<br>
 
::{{Par2|ep0| | }}
 
::{{Par2|ep0| | }}
 
::{{Par2|ep1| | }}
 
::{{Par2|ep1| | }}
:::Some Avisynth resizers take optional arguments, such as 'taps' for lanczosresize or
+
:::Some Avisynth resizers take optional arguments, such as 'taps' for [[LanczosResize]] or 'p' for [[GaussResize]]. ep0/ep1 allow you to pass values for these optional arguments when using the 'cshift' parameter.
:::'p' for gaussresize. ep0/ep1 allow you to pass values for these optional arguments
+
:::If the resizer only takes one optional argument then ep0 is used. If the argument that the resizer takes is not a float value, then ep0 gets rounded to an integer.  
:::when using the 'cshift' parameter. If the resizer only takes one optional argument
+
:::If the resizer takes two optional arguments, then ep0 corresponds to the first one, and ep1 corresponds to the second. The only resizer that takes more than one optional argument is [[BicubicResize]](), which takes 'b' and 'c'. So ep0 = b, and ep1 = c.
:::then ep0 is used. If the argument that the resizer takes is not a float value,
+
:::If ep0/ep1 are not set then the default value for the optional argument(s) of the resizer is used.
:::then ep0 gets rounded to an integer. If the resizer takes two optional arguments,
+
:::then ep0 corresponds to the first one, and ep1 corresponds to the second. The only
+
:::resizer that takes more than one optional argument is bicubicresize(), which takes
+
:::'b' and 'c'. So ep0 = b, and ep1 = c. If ep0/ep1 are not set then the default value
+
:::for the optional argument(s) of the resizer is used.
+
 
<br>
 
<br>
 
::{{Par2|threads|int| }}
 
::{{Par2|threads|int| }}
:::This option is not implemented and is silently ignored.
 
<br>
 
 
::{{Par2|opt|int| }}
 
::{{Par2|opt|int| }}
:::This option is not implemented and is silently ignored.
 
<br>
 
 
::{{Par2|fapprox|int| }}
 
::{{Par2|fapprox|int| }}
:::This option is not implemented and is silently ignored.
+
:::These parameters are not implemented and are silently ignored.
 
<br>
 
<br>
 
::{{Par2|Y|bool|true}}
 
::{{Par2|Y|bool|true}}
 
::{{Par2|U|bool|true}}
 
::{{Par2|U|bool|true}}
 
::{{Par2|V|bool|true}}
 
::{{Par2|V|bool|true}}
:::These control whether or not the specified plane is processed. Set to true to
+
:::These control whether or not the specified plane is processed. Set to true to process or false to ignore.  
:::process or false to ignore. Ignored planes are not copied, zero'd, or even
+
:::Ignored planes are not copied, zero'd, or even considered. So what the ignored planes happen to contain on output is unpredictable.
:::considered. So what the ignored planes happen to contain on output is unpredictable.
+
 
<br>
 
<br>
  

Latest revision as of 06:54, 8 November 2015

Back to nnedi3ocl



[edit] Description

nnedi3x_rpow2 is a script function for advanced scaling with chroma and center correction. It supports all planar formats and YUY2 and RGB24 as well. nnedi3x_rpow2 also doesn't complain if you feed it with now removed parameters of original nnedi3_rpow2.

[edit] Syntax and Parameters

nnedi3x_rpow2 (clip a, int rfactor, int "nsize", int "nns", int "qual", int "etype", int "pscrn", string "cshift", int "fwidth", int "fheight", "ep0", "ep1", int "threads", int "opt", int "fapprox", bool "Y", bool "U", bool "V")


clip  a =
Input clip.


int  rfactor =
Image enlargement factor. Must be a power of 2 in the range [2,1024].


int  nsize = 0
Sets the size of the local neighborhood around each pixel that is used by the predictor neural network.
  • 0 - 8x6
Only nsize 0 is implemented, other values are simply ignored.


int  nns = 3
Sets the number of neurons in the predictor neural network. Possible settings are 0, 1, 2, 3, and 4. 0 is fastest. 4 is slowest, but should give the best quality.
This is a quality vs speed option; however, differences are usually small. The difference in speed will become larger as 'qual' is increased.
  • 0 - 16
  • 1 - 32
  • 2 - 64
  • 3 - 128
  • 4 - 256


int  qual = 1
Controls the number of different neural network predictions that are blended together to compute the final output value.
Each neural network was trained on a different set of training data. Blending the results of these different networks improves generalization to unseen data.
Possible values are 1 or 2. Essentially this is a quality vs speed option. Larger values will result in more processing time, but should give better results.
However, the difference is usually pretty small. I would recommend using qual>1 for things like single image enlargement.


int  etype = 0
Controls which set of weights to use in the predictor nn. Possible settings:
  • 0 - weights trained to minimize absolute error
  • 1 - weights trained to minimize squared error


int  pscrn =
This option is not implemented and is silently ignored.


string  cshift = ""
Sets the resizer used for correcting the image center shift that nnedi3x_rpow2 introduces. This can be any of Avisynth's internal resizers, such as "Spline36Resize", "LanczosResize", etc...
If not specified the shift is not corrected. The correction is accomplished by using the subpixel cropping capability of Avisynth's internal resizers.


int  fwidth =
int  fheight =
If correcting the image center shift by using the 'cshift' parameter, fwidth/fheight allow you to set a new output resolution.
First, the image is enlarged by 'rfactor' using nnedi3. Once that is completed the image center shift is corrected, and the image is resampled to fwidth x fheight resolution.
The shifting and resampling happen in one call using the internal Avisynth resizer you specify via the 'cshift' string. If fwidth/fheight are not specified, then they are set equal to rfactor*width and rfactor*height respectively (in other words they do nothing).


  ep0 =
  ep1 =
Some Avisynth resizers take optional arguments, such as 'taps' for LanczosResize or 'p' for GaussResize. ep0/ep1 allow you to pass values for these optional arguments when using the 'cshift' parameter.
If the resizer only takes one optional argument then ep0 is used. If the argument that the resizer takes is not a float value, then ep0 gets rounded to an integer.
If the resizer takes two optional arguments, then ep0 corresponds to the first one, and ep1 corresponds to the second. The only resizer that takes more than one optional argument is BicubicResize(), which takes 'b' and 'c'. So ep0 = b, and ep1 = c.
If ep0/ep1 are not set then the default value for the optional argument(s) of the resizer is used.


int  threads =
int  opt =
int  fapprox =
These parameters are not implemented and are silently ignored.


bool  Y = true
bool  U = true
bool  V = true
These control whether or not the specified plane is processed. Set to true to process or false to ignore.
Ignored planes are not copied, zero'd, or even considered. So what the ignored planes happen to contain on output is unpredictable.


[edit] Examples

  • nnedi3x_rpow2 with default settings. This example enlarges the image by 2x but does not correct for center shift.
AviSource("Blah.avi")
nnedi3x_rpow2(rfactor=2, nsize=0, nns=3, qual=1, etype=0, cshift="", Y=true, U=true, V=true)


  • Enlarge image by 2x and correct for center shift using Spline36Resize.
AviSource("Blah.avi")
nnedi3x_rpow2(rfactor=2, cshift="Spline36Resize")


  • Enlarge image by 8x, correct for center shift and downsample from 8x to 7x using LanczosResize with 5 taps.
AviSource("Blah.avi")
nnedi3x_rpow2(rfactor=8, cshift="LanczosResize", fwidth=width*7, fheight=height*7, ep0=5)




Back to nnedi3ocl

Personal tools