ffv1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: ISC Imports: 6 Imported by: 0

Documentation

Overview

Package ffv1 implements an FFV1 Version 3 decoder based off of draft-ietf-cellar-ffv1.

Index

Constants

View Source
const (
	YCbCr = 0
	RGB   = 1
)

Colorspaces. From 4.1.5. colorspace_type

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder is a FFV1 decoder instance.

func NewDecoder

func NewDecoder(record []byte, width uint32, height uint32) (*Decoder, error)

NewDecoder creates a new FFV1 decoder instance.

'record' is the codec private data provided by the container. For Matroska, this is what is in CodecPrivate (adjusted for e.g. VFW data that may be before it). For ISOBMFF, this is the 'glbl' box.

'width' and 'height' are the frame width and height provided by the container.

func (*Decoder) DecodeFrame

func (d *Decoder) DecodeFrame(frame []byte) (*Frame, error)

DecodeFrame takes a packet and decodes it to a ffv1.Frame.

Slice threading is used by default, with one goroutine per slice.

type Frame

type Frame struct {
	// Image data. Valid only when BitDepth is 8.
	Buf [][]byte
	// Image data. Valid only when BitDepth is greater than 8.
	Buf16 [][]uint16
	// Width of the frame, in pixels.
	Width uint32
	// Height of the frame, in pixels.
	Height uint32
	// BitDepth of the frame (8-16).
	BitDepth uint8
	// ColorSpace of the frame. See the ColorSpace constants.
	ColorSpace int
	// Whether or not chroma planes are present.
	HasChroma bool
	// Whether or not an alpha plane is present.
	HasAlpha bool
	// The log2 vertical chroma subampling value.
	ChromaSubsampleV uint8
	// The log2 horizontal chroma subsampling value.
	ChromaSubsampleH uint8
}

Frame contains a decoded FFV1 frame and relevant data about the frame.

If BitDepth is 8, image data is in Buf. If it is anything else, image data is in Buf16.

Image data consists of up to four contiguous planes, as follows:

  • If ColorSpace is YCbCr:
  • Plane 0 is Luma (always present)
  • If HasChroma is true, the next two planes are Cr and Cr, subsampled by ChromaSubsampleV and ChromaSubsampleH.
  • If HasAlpha is true, the next plane is alpha.
  • If ColorSpace is RGB:
  • Plane 0 is Red
  • Plane 1 is Green
  • Plane 2 is Blue
  • If HasAlpha is true, plane 4 is alpha.

Directories

Path Synopsis
Package golomb implements a Golomb-Rice coder as per Section 3.8.2.
Package golomb implements a Golomb-Rice coder as per Section 3.8.2.
Package rangecoer implements a range coder as per 3.8.1.
Package rangecoer implements a range coder as per 3.8.1.

Jump to

Keyboard shortcuts

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