tile

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FrameW = 1080
	FrameH = 1080
	Black  = byte(64)
	White  = byte(192)
)

Variables

View Source
var DefaultConfig = Config{Module: 4, RSPercent: 20}

DefaultConfig is the VP8/WebRTC-tuned default: 4×4 modules, 20% RS parity.

Functions

This section is empty.

Types

type Codec

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

Codec encodes/decodes tile frames.

func New

func New(cfg Config) (*Codec, error)

New creates a Codec from config.

func (*Codec) Decode

func (c *Codec) Decode(frame []byte) (*DecodeResult, error)

Decode extracts payload from a 1080×1080 grayscale frame.

func (*Codec) Encode

func (c *Codec) Encode(payload []byte, frameID, totalFrames uint32) ([]byte, error)

Encode packs payload into a 1080×1080 grayscale frame.

func (*Codec) Info

func (c *Codec) Info() string

Info prints codec parameters.

func (*Codec) MaxPayload

func (c *Codec) MaxPayload() int

MaxPayload returns the max user bytes per frame.

type Config

type Config struct {
	// Module is the pixel side of each bit-cell (1..270).
	// 1 = max density (145KB/frame), 4 = VP8-safe default.
	Module int

	// RSPercent is Reed-Solomon parity overhead in percent of data shards (0..200).
	// 0 = no ECC, 20 = 20% parity overhead (recovers up to 10% shard loss), 100 = 2× redundancy.
	RSPercent int
}

Config configures Codec instance.

type DecodeResult

type DecodeResult struct {
	FrameID     uint32
	TotalFrames uint32
	Payload     []byte
}

DecodeResult holds decoded frame data.

Jump to

Keyboard shortcuts

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