Struct SwsAlgorithm
Represents a scaling algorithm for use with FFmpeg's libswscale, encapsulating the algorithm flags and optional scaling parameters. These parameters can tune the behavior of the scaling algorithm for finer control over image scaling quality.
Implements
Inherited Members
Namespace: FFmpeg.Images
Assembly: FFmpeg.dll
Syntax
public readonly struct SwsAlgorithm : IEquatable<SwsAlgorithm>
Constructors
View SourceSwsAlgorithm(SwsFlags, double, double)
Initializes a new instance of the SwsAlgorithm struct with the specified scaling algorithm flags and optional parameters.
Declaration
public SwsAlgorithm(SwsFlags algorithmFlags, double param1 = 123456, double param2 = 123456)
Parameters
| Type | Name | Description |
|---|---|---|
| SwsFlags | algorithmFlags | The scaling algorithm flags used to determine the interpolation or filtering method. |
| double | param1 | An optional parameter to tune the behavior of the algorithm (default: DEFAULT_PARAM). |
| double | param2 | An optional second parameter for additional tuning of the algorithm (default: DEFAULT_PARAM). |
Fields
View SourceDEFAULT_PARAM
The default value for algorithm parameters when none are specified.
Declaration
public const int DEFAULT_PARAM = 123456
Field Value
| Type | Description |
|---|---|
| int |
Properties
View SourceAlgorithmFlags
Gets the scaling algorithm flags that specify the type of interpolation or filtering used.
Declaration
public SwsFlags AlgorithmFlags { get; }
Property Value
| Type | Description |
|---|---|
| SwsFlags |
Param1
Gets the first parameter used for fine-tuning the scaling algorithm, specific to the algorithm.
Declaration
public double Param1 { get; }
Property Value
| Type | Description |
|---|---|
| double |
Param2
Gets the second parameter used for additional fine-tuning of the scaling algorithm, specific to the algorithm.
Declaration
public double Param2 { get; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
View SourceArea()
Creates an area-based scaling algorithm with no additional tuning.
Declaration
public static SwsAlgorithm Area()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Bicubic()
Creates a bicubic scaling algorithm with default parameters.
Declaration
public static SwsAlgorithm Bicubic()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Bicubic(double, double)
Creates a bicubic scaling algorithm with adjustable parameters.
For Bicubic, param1 tunes the value of f(1), and param2 tunes f'(1), which influence the shape of the basis function.
Declaration
public static SwsAlgorithm Bicubic(double param1 = 0, double param2 = 0.6)
Parameters
| Type | Name | Description |
|---|---|---|
| double | param1 | Tuning parameter for f(1) (default: 0). |
| double | param2 | Tuning parameter for f'(1) (default: 0.6). |
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Bicublin()
Creates a bicublin scaling algorithm with default parameters.
Declaration
public static SwsAlgorithm Bicublin()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Bicublin(double, double)
Creates a bicublin scaling algorithm with adjustable parameters.
For Bicublin, param1 tunes f(1) and param2 tunes f'(1), similar to the bicubic filter.
Declaration
public static SwsAlgorithm Bicublin(double param1 = 0, double param2 = 0.6)
Parameters
| Type | Name | Description |
|---|---|---|
| double | param1 | Tuning parameter for f(1) (default: 0). |
| double | param2 | Tuning parameter for f'(1) (default: 0.6). |
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Bilinear()
Creates a bilinear scaling algorithm with no additional tuning.
Declaration
public static SwsAlgorithm Bilinear()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Equals(SwsAlgorithm)
Declaration
public bool Equals(SwsAlgorithm other)
Parameters
| Type | Name | Description |
|---|---|---|
| SwsAlgorithm | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
View SourceExperimental()
Creates an experimental scaling algorithm with a default parameter.
Declaration
public static SwsAlgorithm Experimental()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Experimental(double)
Creates an experimental scaling algorithm with adjustable parameters.
Specific to the experimental algorithm, param1 is used for custom tuning.
Declaration
public static SwsAlgorithm Experimental(double param1 = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| double | param1 | Custom tuning parameter (default: 1.0). |
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
FastBilinear()
Creates a fast bilinear scaling algorithm with no additional tuning.
Declaration
public static SwsAlgorithm FastBilinear()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Gauss()
Creates a Gaussian scaling algorithm with default parameters.
Declaration
public static SwsAlgorithm Gauss()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Gauss(double)
Creates a Gaussian scaling algorithm with an adjustable parameter.
For Gauss, param1 tunes the exponent of the Gaussian function, affecting the cutoff frequency of the filter.
Declaration
public static SwsAlgorithm Gauss(double param1 = 3)
Parameters
| Type | Name | Description |
|---|---|---|
| double | param1 | Tuning parameter for the Gaussian exponent (default: 3.0). |
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
View SourceLanczos()
Creates a Lanczos scaling algorithm with default parameters.
Declaration
public static SwsAlgorithm Lanczos()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Lanczos(double)
Creates a Lanczos scaling algorithm with an adjustable parameter.
For Lanczos, param1 tunes the width of the window function used by the Lanczos filter.
Declaration
public static SwsAlgorithm Lanczos(double param1 = 3)
Parameters
| Type | Name | Description |
|---|---|---|
| double | param1 | Tuning parameter for the width of the Lanczos window function (default: 3). |
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
NearestNeighbor()
Creates a nearest neighbor scaling algorithm (point sampling).
Declaration
public static SwsAlgorithm NearestNeighbor()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Sinc()
Creates a Sinc scaling algorithm with no additional tuning.
Declaration
public static SwsAlgorithm Sinc()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Spline()
Creates a Spline scaling algorithm with no additional tuning.
Declaration
public static SwsAlgorithm Spline()
Returns
| Type | Description |
|---|---|
| SwsAlgorithm |
Operators
View Sourceoperator ==(SwsAlgorithm, SwsAlgorithm)
Declaration
public static bool operator ==(SwsAlgorithm left, SwsAlgorithm right)
Parameters
| Type | Name | Description |
|---|---|---|
| SwsAlgorithm | left | |
| SwsAlgorithm | right |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(SwsAlgorithm, SwsAlgorithm)
Declaration
public static bool operator !=(SwsAlgorithm left, SwsAlgorithm right)
Parameters
| Type | Name | Description |
|---|---|---|
| SwsAlgorithm | left | |
| SwsAlgorithm | right |
Returns
| Type | Description |
|---|---|
| bool |