yuyv

package
v0.0.0-...-d4073d0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package yuyv provides support for the YUYV format.

Index

Constants

View Source
const FourCC = 'Y' | 'U'<<8 | 'Y'<<16 | 'V'<<24

FourCC of the YUYV format.

Variables

This section is empty.

Functions

func ToGray

func ToGray(dst *image.Gray, r image.Rectangle, src *Image, p image.Point)

ToGray aligns r.Min in dst with p in src, and draws the part of src visible through r over src.

It's several times faster than the image/draw package.

func ToRGBA

func ToRGBA(dst *image.RGBA, r image.Rectangle, src *Image, p image.Point)

ToRGBA aligns r.Min in dst with p in src, and draws the part of src visible through r over src.

It's several times faster than the image/draw package.

func ToYCbCr

func ToYCbCr(dst *image.YCbCr, r image.Rectangle, src *Image, p image.Point)

ToYCbCr aligns r.Min in dst with p in src, and draws the part of src visible through r over src.

Panics if the subsample ratio of dst is not 4:4:4.

Types

type Image

type Image struct {
	// Pix holds the pixel data. Every four bytes corresponds to a pair of
	// horizontally adjacent pixels. The two pixels have separate luma values
	// and shared chroma. The sample order is Y0, Cb, Y1, Cr.
	Pix []uint8

	// Stride is the distance in bytes between vertically adjacent pixels.
	// Line y starts at index (y-Rect.Min.Y)*Stride.
	Stride int

	// Rect is the bounds of the image.
	Rect image.Rectangle
}

An Image is an in-memory YUYV image. It implements the image.Image interface.

func New

func New(rect image.Rectangle) *Image

New returns a new YUYV image with the given bounds.

func (*Image) At

func (img *Image) At(x, y int) color.Color

At returns the color of the pixel at (x, y).

func (*Image) Bounds

func (img *Image) Bounds() image.Rectangle

Bounds returns the bounds of the image.

func (*Image) CbOffset

func (img *Image) CbOffset(x, y int) int

CbOffset returns the index at which the Cb component of the pixel at (x, y) is located in Pix.

func (*Image) ColorModel

func (img *Image) ColorModel() color.Model

ColorModel returns color.YCbCrModel.

func (*Image) CrOffset

func (img *Image) CrOffset(x, y int) int

CrOffset returns the index at which the Cr component of the pixel at (x, y) is located in Pix.

func (*Image) Opaque

func (img *Image) Opaque() bool

Opaque returns true.

func (*Image) PixPairOffset

func (img *Image) PixPairOffset(x, y int) int

PixPairOffset returns the index of the first element in Pix that corresponds to the pixel pair to which (x, y) belongs.

func (*Image) SubImage

func (img *Image) SubImage(rect image.Rectangle) image.Image

SubImage returns an image representing the portion of img visible through rect. The returned value shares pixels with the original image.

func (*Image) YCbCrAt

func (img *Image) YCbCrAt(x, y int) color.YCbCr

YCbCrAt returns the color of the pixel at (x, y).

func (*Image) YOffset

func (img *Image) YOffset(x, y int) int

YOffset returns the index at which the Y component of the pixel at (x, y) is located in Pix.

Jump to

Keyboard shortcuts

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