vpx

package module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: BSD-3-Clause Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

vpx

VP8 and VP9 decoders in pure Go, no cgo. Packages vp8 and vp9 decode packets to planar YUV (VP9 profiles 0 and 1; profiles 2 and 3 return vpx.ErrVP9NotImplemented). The shared vpx package holds Image and the error sentinels.

d, err := vp9.New(vp9.Options{MaxWidth: 4096, MaxHeight: 2304, Threads: 4, RowMT: true})
// ...
if err := d.DecodeWithPTS(packet, pts); err == nil {
	if img, ok := d.NextFrame(); ok { /* img is valid until the next decode */ }
}

Status: v0.1.0 (M0)

This release is a port of the decoder subset of govpx v0.5.3 (BSD-3-Clause), extracted by tools/portgovpx (a per-declaration closure of the decoder, written in Go with a test), so that every later change is made here and measured against libvpx. The design is in docs/design/vpx-decoder.md.

At M0 the decoded picture is vpx.Image, a view of the decoder's buffers; the design's Picture type replaces it later. The package has no extra behaviour over govpx v0.5.3: the same 376 libvpx test vectors decode to the same md5 of every picture, with 0 and with 4 threads.

Changes from govpx v0.5.3 (each is also noted in the file): internal/vpx/buffers/aligned.go rounds up to a power of two with math/bits, because govpx's v >> 32 does not compile for 32-bit targets.

Since v0.3.0 the amd64 hot loops come from go-videodsp/kernels (AVX2, chosen at run time by cpu.HasAVX2, the previous code as the fallback): the VP9 loop filters and 8-tap convolutions, and since v0.5.0 the VP8 loop filters and six-tap/bilinear predictors. On a Ryzen 9 7950X, one core, crowd_run 1080p, VP8 decodes in 3437 µs per frame against 4942 for v0.4.0 (1.44x); the table is in docs/perf/speed-log.md.

Tests

  • LIBVPX_VECTORS_DIR=DIR go test ./... decodes libvpx's 376 decoder vectors and compares every picture's md5 with libvpx's. go run ./tools/vpxfetch --manifests testdata/libvpx --dir DIR (a module of its own, in tools/) downloads them. Without the variable the vector tests are skipped and say so.
  • Fuzz targets with committed corpora: FuzzReadBool (the boolean decoder against RFC 6386, far past the end of the data), FuzzVP8Decode and FuzzVP9Decode (any two packets; the size cap bounds allocation).
  • The ported tree (internal/) is not held to the 100 % coverage gate of the sibling repositories: it is measured by the vectors. Hand-written code is.

Licences

BSD-3-Clause, see LICENSE. Derived files cite their govpx path (third_party/govpx/), and where govpx cites a libvpx source file, that file's licence and patent grant are in third_party/libvpx/. The AV1-derived SIMD kernels carry goav1's licence in third_party/goav1/ and the AOM patent grant is PATENTS.

Documentation

Overview

Package vpx holds the types shared by the VP8 and VP9 decoders of this module: the decoded image and the error sentinels. The decoders are in packages vp8 and vp9.

At M0 the decoded picture is Image, a view of the decoder's frame buffer, valid until the next decode call. The design's Picture type replaces it in a later milestone.

Index

Constants

View Source
const (
	Subsampling420 = codecapi.Subsampling420
	Subsampling422 = codecapi.Subsampling422
	Subsampling440 = codecapi.Subsampling440
	Subsampling444 = codecapi.Subsampling444
)

The chroma layouts the decoders produce.

Variables

View Source
var (
	ErrInvalidData       = vpxerrors.ErrInvalidData
	ErrInvalidVP9Data    = vpxerrors.ErrInvalidVP9Data
	ErrNeedKeyFrame      = vpxerrors.ErrNeedKeyFrame
	ErrFrameRejected     = vpxerrors.ErrFrameRejected
	ErrInvalidConfig     = vpxerrors.ErrInvalidConfig
	ErrClosed            = vpxerrors.ErrClosed
	ErrVP9NotImplemented = vpxerrors.ErrVP9NotImplemented
)

The error sentinels. Wrap-aware: test with errors.Is.

Functions

This section is empty.

Types

type ChromaSubsampling

type ChromaSubsampling = codecapi.ChromaSubsampling

ChromaSubsampling names the chroma layout of an Image.

type Image

type Image = codecapi.Image

Image is a decoded frame. Its planes alias the decoder's buffers.

Directories

Path Synopsis
internal
pixel
Independent scalar pixel kernels, also used for CPUs without AVX2.
Independent scalar pixel kernels, also used for CPUs without AVX2.
vp8/codec
Shared codec API aliases for libvpx v1.16.0 VP8 codec implementation.
Shared codec API aliases for libvpx v1.16.0 VP8 codec implementation.
vp8/decoder
VP8 edge order follows libvpx v1.16.0 vp8/common/loopfilter.c.
VP8 edge order follows libvpx v1.16.0 vp8/common/loopfilter.c.
vp8/dsp
Code generated by go test -tags govpx_generate -run TestGenerateIntraSIMD; DO NOT EDIT.
Code generated by go test -tags govpx_generate -run TestGenerateIntraSIMD; DO NOT EDIT.
vp8/rtp
Package rtp implements VP8 RTP payload descriptors and frame fragment assembly.
Package rtp implements VP8 RTP payload descriptors and frame fragment assembly.
vp9/rtp
Package rtp implements VP9 RTP payload descriptors and frame fragment assembly.
Package rtp implements VP9 RTP payload descriptors and frame fragment assembly.
vpx/errors
Package errors holds shared sentinel errors for internal VPx packages.
Package errors holds shared sentinel errors for internal VPx packages.
vpx/rtp
Package rtp holds shared mechanical helpers for RTP payload assembly.
Package rtp holds shared mechanical helpers for RTP payload assembly.
Package vp8 is a VP8 decoder.
Package vp8 is a VP8 decoder.
Package vp9 is a VP9 decoder (profiles 0 and 1).
Package vp9 is a VP9 decoder (profiles 0 and 1).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址