Table of Contents

Class AvifFilmGrain

Namespace
Egami.Formats.Avif
Assembly
Egami.dll

An AV1 frame's film grain parameters (AV1 specification 5.9.30 and 6.8.20): what the decoder's grain synthesis adds to the output, kept so an image loaded without its grain can have it added again or described.

public sealed record AvifFilmGrain : IEquatable<AvifFilmGrain>
Inheritance
AvifFilmGrain
Implements
Inherited Members

Examples

// Load decodes the AV1 image, converts it to RGB the way libavif does, and crops the clean aperture.
using Raster image = Raster.Load("duck.avif");

// The image as coded, without the film grain its AV1 stream asks the decoder to add.
using Raster clean = Raster.Load("duck.avif", options: new AvifReaderOptions { FilmGrain = false });
AvifFilmGrain? grain = ((AvifDetails)clean.Metadata.FormatDetails!).FilmGrain;   // null when there is none

Properties

ArCoeffLag

Gets the autoregressive filter's lag, 0 to 3.

public int ArCoeffLag { get; init; }

Property Value

int

ArCoeffShift

Gets the autoregressive coefficients' shift, 6 to 9.

public int ArCoeffShift { get; init; }

Property Value

int

ArCoeffsCb

Gets the Cb autoregressive coefficients, the last weighting luma when there is luma grain.

public IReadOnlyList<int> ArCoeffsCb { get; init; }

Property Value

IReadOnlyList<int>

ArCoeffsCr

Gets the Cr autoregressive coefficients.

public IReadOnlyList<int> ArCoeffsCr { get; init; }

Property Value

IReadOnlyList<int>

ArCoeffsY

Gets the luma autoregressive coefficients, from -128 to 127.

public IReadOnlyList<int> ArCoeffsY { get; init; }

Property Value

IReadOnlyList<int>

Cb

Gets the Cb multipliers and offset as coded: cb_mult, cb_luma_mult and cb_offset.

public (int Mult, int LumaMult, int Offset) Cb { get; init; }

Property Value

(int Mult, int LumaMult, int Offset)

ChromaScalingFromLuma

Gets whether chroma grain is scaled by the luma scaling function.

public bool ChromaScalingFromLuma { get; init; }

Property Value

bool

ClipToRestrictedRange

Gets whether the output is clipped to the video range.

public bool ClipToRestrictedRange { get; init; }

Property Value

bool

Cr

Gets the Cr multipliers and offset as coded: cr_mult, cr_luma_mult and cr_offset.

public (int Mult, int LumaMult, int Offset) Cr { get; init; }

Property Value

(int Mult, int LumaMult, int Offset)

GrainScaleShift

Gets the shift that scales the Gaussian samples down, 0 to 3.

public int GrainScaleShift { get; init; }

Property Value

int

Overlap

Gets whether grain blocks are blended where they overlap.

public bool Overlap { get; init; }

Property Value

bool

RandomSeed

Gets the random seed.

public int RandomSeed { get; init; }

Property Value

int

ScalingPointsCb

Gets the scaling function for Cb.

public IReadOnlyList<(int Value, int Scaling)> ScalingPointsCb { get; init; }

Property Value

IReadOnlyList<(int Value, int Scaling)>

ScalingPointsCr

Gets the scaling function for Cr.

public IReadOnlyList<(int Value, int Scaling)> ScalingPointsCr { get; init; }

Property Value

IReadOnlyList<(int Value, int Scaling)>

ScalingPointsY

Gets the piecewise-linear scaling function for luma: (value, scaling) points with increasing values.

public IReadOnlyList<(int Value, int Scaling)> ScalingPointsY { get; init; }

Property Value

IReadOnlyList<(int Value, int Scaling)>

ScalingShift

Gets the scaling shift, 8 to 11.

public int ScalingShift { get; init; }

Property Value

int