Table of Contents

Class Vp8FramePlan

Namespace
Egami.Formats.Webp
Assembly
Egami.dll

How Encode(YuvRaster<byte>, Vp8FramePlan) codes one frame: its type, quality and references.

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

Examples

// 4:2:0 pictures of one size, here decoded from a clip; Egami.Video writes WebM and IVF and plans the frames for you.
using Vp8StreamEncoder encoder = new(pictures[0].Width, pictures[0].Height);
for (int i = 0; i < pictures.Count; i++)
{
    Vp8FramePlan plan = new()
    {
        KeyFrame = i % 30 == 0,     // a key frame a second at 30 frames a second
        RefreshGolden = i % 10 == 0, // and a golden frame to fall back on every tenth
        Quality = 70,
    };
    Vp8EncodedFrame frame = encoder.Encode(pictures[i], plan);
    packets.Add(frame.Data.ToArray()); // a WebM block or an IVF frame; frame.LumaPsnr says how close it came
}

Properties

AlternateSignBias

Gets whether the alternate frame's vectors point the other way, as for a hidden alternate frame in the future.

public bool AlternateSignBias { get; init; }

Property Value

bool

CopyToAlternate

Gets what an inter frame that does not refresh the alternate frame copies into it first: nothing, the last frame or the golden frame, as they were before this frame (the golden copy, if any, comes after).

public Vp8ReferenceCopy CopyToAlternate { get; init; }

Property Value

Vp8ReferenceCopy

CopyToGolden

Gets what an inter frame that does not refresh the golden frame copies into it first: nothing, the last frame or the alternate frame, as they were before this frame.

public Vp8ReferenceCopy CopyToGolden { get; init; }

Property Value

Vp8ReferenceCopy

Default

Gets the plan of an inter frame against all references that refreshes the last frame, at the default quality and effort.

public static Vp8FramePlan Default { get; }

Property Value

Vp8FramePlan

Effort

Gets how hard the encoder works, 0 (fastest) to 10 (smallest frames): how far and how finely it searches for motion, whether it tries split vectors and every intra mode, and whether it tries loop filter levels. Defaults to 4.

public int Effort { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 0 to 10.

FilterLevel

Gets the loop filter level, 0 (off) to 63; null (the default) for the encoder to choose it.

public int? FilterLevel { get; init; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

The value is outside 0 to 63.

GoldenSignBias

Gets whether the golden frame's vectors point the other way, as for a golden frame in the future.

public bool GoldenSignBias { get; init; }

Property Value

bool

KeyFrame

Gets whether the frame is a key frame, which decodes on its own and refreshes every reference.

public bool KeyFrame { get; init; }

Property Value

bool

Partitions

Gets the number of token partitions, 1, 2, 4 or 8: one is smallest, more let decoders work in parallel. Defaults to 1.

public int Partitions { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is not 1, 2, 4 or 8.

Quality

Gets the quality, 0 (smallest) to 100 (best), on the scale of lossy WebP's quality. Defaults to 75. Ignored when Quantizer is set.

public int Quality { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 0 to 100.

Quantizer

Gets VP8's quantizer index, 0 (finest) to 127, which rate control sets to replace Quality; null (the default) to use the quality. A key frame with a quantizer has one quantizer for the whole frame instead of four segments.

public int? Quantizer { get; init; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

The value is outside 0 to 127.

References

Gets which references an inter frame may predict from. Defaults to all; with none, every macroblock is intra.

public Vp8References References { get; init; }

Property Value

Vp8References

RefreshAlternate

Gets whether an inter frame becomes the alternate frame.

public bool RefreshAlternate { get; init; }

Property Value

bool

RefreshEntropy

Gets whether the frame's probability updates carry over to the frames after it. Defaults to true; false makes the stream error resilient, as real-time streams want: a lost frame then does not spoil the probabilities of the next.

public bool RefreshEntropy { get; init; }

Property Value

bool

RefreshGolden

Gets whether an inter frame becomes the golden frame.

public bool RefreshGolden { get; init; }

Property Value

bool

RefreshLast

Gets whether an inter frame becomes the last frame. Defaults to true.

public bool RefreshLast { get; init; }

Property Value

bool

Show

Gets whether the frame is shown. A hidden frame, typically an alternate reference, only updates the references. Defaults to true.

public bool Show { get; init; }

Property Value

bool