jpeg

package
v0.0.0-...-49a09c6 Latest Latest
Warning

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

Go to latest
Published: May 20, 2014 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package jpeg provides a low level decoder framework supporting the entire ITU-T T.81 JPEG specification.

The JPEG specification can be found at http://www.w3.org/Graphics/JPEG/itu-t81.pdf.

Index

Constants

View Source
const (
	SOF0  = 0xc0 // Baseline DCT
	SOF1  = 0xc1 // Extended sequential DCT
	SOF2  = 0xc2 // Progressive DCT
	SOF3  = 0xc3 // Lossless (sequential)
	SOF5  = 0xc5 // Differential sequential DCT
	SOF6  = 0xc6 // Differential progressive DCT
	SOF7  = 0xc7 // Differential lossless (sequential)
	JPG   = 0xc8 // Reserved for JPEG extensions
	SOF9  = 0xc9 // Extended sequential DCT
	SOF10 = 0xca // Progressive DCT
	SOF11 = 0xcb // Lossless (sequential)
	SOF13 = 0xcd // Differential sequential DCT
	SOF14 = 0xce // Differential progressive DCT
	SOF15 = 0xcf // Differential lossless (sequential)
	DHT   = 0xc4 // Define Huffman table(s)
	DAC   = 0xcc // Define arithmetic codes conditioning(s)
	RST0  = 0xd0 // Restart interval 'm' modulo 8 *
	RST1  = 0xd1
	RST2  = 0xd2
	RST3  = 0xd3
	RST4  = 0xd4
	RST5  = 0xd5
	RST6  = 0xd6
	RST7  = 0xd7
	SOI   = 0xd8 // Start of image *
	EOI   = 0xd9 // End of image *
	SOS   = 0xda // Start of scan
	DQT   = 0xdb // Define quantization table(s)
	DNL   = 0xdc // Define number of lines
	DRI   = 0xdd // Define restart interval
	DHP   = 0xde // Define hierarchical progression
	EXP   = 0xdf // Expand reference component(s)
	APP0  = 0xe0 // Application segments
	APP1  = 0xe1
	APP2  = 0xe2
	APP3  = 0xe3
	APP4  = 0xe4
	APP5  = 0xe5
	APP6  = 0xe6
	APP7  = 0xe7
	APP8  = 0xe8
	APP9  = 0xe9
	APP10 = 0xea
	APP11 = 0xeb
	APP12 = 0xec
	APP13 = 0xed
	APP14 = 0xee
	APP15 = 0xef
	JPG0  = 0xf0 // Reserved for JPEG extensions
	JPG1  = 0xf1
	JPG2  = 0xf2
	JPG3  = 0xf3
	JPG4  = 0xf4
	JPG5  = 0xf5
	JPG6  = 0xf6
	JPG7  = 0xf7
	JPG8  = 0xf8
	JPG9  = 0xf9
	JPG10 = 0xfa
	JPG11 = 0xfb
	JPG12 = 0xfc
	JPG13 = 0xfd
	COM   = 0xfe // Comment
	TEM   = 0x01 // For temporary private use in arithmetic coding *
)

Markers with * have no associated segment.

View Source
const (
	MaxTables = 4
)

Variables

This section is empty.

Functions

func Decode

func Decode(rr Reader, d Decoder)

Types

type ATable

type ATable struct {
	Tb int // Table class: 0 = DC table or lossless table, 1 = AC table.
	Tc int // Table destination identifier
	Cs int // Conditioning table value
}

Arithmetic conditioning table

type AppData

type AppData struct {
	N  int    // Kind
	Ap []byte // Application data bytes
}

Application data segment

type Comment

type Comment []byte

Comment segment

type Decoder

type Decoder interface {
	Error(error)
	Marker(m Marker, a ...interface{})
	Byte(b byte)
}

type Exp

type Exp struct {
	Eh int // Expand horizontally
	Ev int // Expand vertically
}

Expand

type Frame

type Frame struct {
	Type  Marker
	P     int         // sample precision
	Y     int         // number of lines
	X     int         // number of samples per line
	Comps []FrameComp // image components in frame
}

A Frame specifies the metadata associated with the SOF? markers

type FrameComp

type FrameComp struct {
	C  int // component identifier
	H  int // horizontal sampling factor
	V  int // vertical sampling factor
	Tq int // quantization table destination selector
}

A FrameComp

type HTable

type HTable struct {
	Tc   int    // Table class: 0 = DC table or lossless table, 1 = AC table
	Th   int    // Destination identifier
	Bits []byte // Number of Huffman codes of length i
	Vals []byte // Value associated with each Huffman code
}

Huffman table

type Marker

type Marker byte

A Marker represents the 0xPQ part of a two-byte JPEG marker 0xFFPQ.

func (Marker) HasSegment

func (m Marker) HasSegment() bool

HasSegment returns false if the Marker is not followed by a fixed length marker segment.

func (Marker) Match

func (m Marker) Match(buf []byte) bool

func (Marker) String

func (m Marker) String() string

type Nl

type Nl int

Number of lines

type QTable

type QTable struct {
	Pq int     // Element precision
	Tq int     // Destination identifier
	Q  [64]int // Elements
}

Quantization table

type Reader

type Reader interface {
	io.Reader
	io.ByteReader
}

type RstInt

type RstInt int

Restart interval

type Scan

type Scan struct {
	Comps []ScanComp // scan component-specification parameters
	Ss    int        // Start of spectral or predictor selector
	Se    int        // End of spectral selection
	Ah    int        // Successive approximation bit position high
	Al    int        // Successive approximation bit position low or point transform
}

A Scan specifies the metadata associated with the SOS marker

type ScanComp

type ScanComp struct {
	Cs int // Scan component selector
	Td int // DC entropy coding table destination selector
	Ta int // AC entropy coding table destination selector
}

A ScanComp describes the component associated with a given sample

Jump to

Keyboard shortcuts

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