kdf

package module
v0.0.0-...-3a05198 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 4 Imported by: 0

README

go-kdf

Go Documentation

A Go library for the Khronos Data Format.

License

MIT

Documentation

Overview

Package kdf implements the Khronos Data Format.

The specification is available at: https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, blocks []Descriptor) error

Types

type BasicDescriptor

type BasicDescriptor struct {
	ColorModel       ColorModel
	ColorPrimaries   ColorPrimaries
	TransferFunction TransferFunction
	Flags            Flags

	TexelBlockDimension [4]int
	BytesPlane          []uint8 // max 8
	SampleInfo          []SampleInfo
}

type Channel

type Channel uint8
const (
	// RGBSDA
	ChannelRGBSDA_R Channel = 0  // Red
	ChannelRGBSDA_G Channel = 1  // Green
	ChannelRGBSDA_B Channel = 2  // Blue
	ChannelRGBSDA_S Channel = 13 // Stencil
	ChannelRGBSDA_D Channel = 14 // Depth
	ChannelRGBSDA_A Channel = 15 // Alpha (opacity)

	// YUVSDA
	ChannelYUVSDA_Y Channel = 0  // Y/Y' (luma/luminance)
	ChannelYUVSDA_U Channel = 1  // U (aka. CB)
	ChannelYUVSDA_V Channel = 2  // V (aka. CR)
	ChannelYUVSDA_S Channel = 13 // Stencil
	ChannelYUVSDA_D Channel = 14 // Depth
	ChannelYUVSDA_A Channel = 15 // Alpha (opacity)
)

func (Channel) Name

func (ch Channel) Name(cm ColorModel) string

type ColorModel

type ColorModel uint8
const (
	ColorModelUnspecified ColorModel = 0
	ColorModelRGBSDA      ColorModel = 1
	ColorModelYUVSDA      ColorModel = 2
	ColorModelYIQSDA      ColorModel = 3
	ColorModelLABSDA      ColorModel = 4
	ColorModelCMYKA       ColorModel = 5
	ColorModelXYZW        ColorModel = 6
	ColorModelHSVAAng     ColorModel = 7
	ColorModelHSLAAng     ColorModel = 8
	ColorModelHSVAHex     ColorModel = 9
	ColorModelHSLAHex     ColorModel = 10
	ColorModelYCGCOA      ColorModel = 11
	ColorModelYCCBCCRC    ColorModel = 12
	ColorModelICTCP       ColorModel = 13
	ColorModelCIEXYZ      ColorModel = 14
	ColorModelCIEXYY      ColorModel = 15

	// Compressed formats
	ColorModelDXT1AOrBC1A     ColorModel = 128
	ColorModelDXT2OrDXT3OrBC2 ColorModel = 129
	ColorModelDXT4OrDXT5OrBC3 ColorModel = 130
	ColorModelBC4             ColorModel = 131
	ColorModelBC5             ColorModel = 132
	ColorModelBC6H            ColorModel = 133
	ColorModelBC7             ColorModel = 134
	ColorModelETC1            ColorModel = 160
	ColorModelETC2            ColorModel = 161
	ColorModelASTC            ColorModel = 162
	ColorModelETC1S           ColorModel = 163
	ColorModelPVRTC           ColorModel = 164
	ColorModelPVRTC2          ColorModel = 165
)

func (ColorModel) String

func (cm ColorModel) String() string

type ColorPrimaries

type ColorPrimaries uint8
const (
	ColorPrimariesUnspecified ColorPrimaries = 0
	ColorPrimariesBT709OrSRGB ColorPrimaries = 1
	ColorPrimariesBT601_EBU   ColorPrimaries = 2
	ColorPrimariesBT601_SMPTE ColorPrimaries = 3
	ColorPrimariesBT2020      ColorPrimaries = 4
	ColorPrimariesCIEXYZ      ColorPrimaries = 5
	ColorPrimariesACES        ColorPrimaries = 6
	ColorPrimariesACESCC      ColorPrimaries = 7
	ColorPrimariesNTSC1953    ColorPrimaries = 8
	ColorPrimariesPAL525      ColorPrimaries = 9
	ColorPrimariesDisplayP3   ColorPrimaries = 10
	ColorPrimariesAdobeRGB    ColorPrimaries = 11
)

func (ColorPrimaries) String

func (cp ColorPrimaries) String() string

type Descriptor

type Descriptor struct {
	Type          DescriptorType
	VendorID      Vendor
	VersionNumber DescriptorVersion

	Basic *BasicDescriptor
}

func NewBasicDescriptor

func NewBasicDescriptor(basic *BasicDescriptor) *Descriptor

func Read

func Read(r io.Reader) ([]Descriptor, error)

func (*Descriptor) Copy

func (desc *Descriptor) Copy() *Descriptor

type DescriptorType

type DescriptorType uint16
const (
	DescriptorTypeKhronosBasic                DescriptorType = 0
	DescriptorTypeKhronosAdditionalPlanes     DescriptorType = 0x6001
	DescriptorTypeKhronosAdditionalDimensions DescriptorType = 0x6002
)

Khronos descriptor block types.

func (DescriptorType) Name

func (t DescriptorType) Name(v Vendor) string

type DescriptorVersion

type DescriptorVersion uint16
const (
	DescriptorVersion1_1 DescriptorVersion = 0
	DescriptorVersion1_2 DescriptorVersion = 1
	DescriptorVersion1_3 DescriptorVersion = 2
)

func (DescriptorVersion) String

func (v DescriptorVersion) String() string

type Endianness

type Endianness int

Endianness represents a byte order.

const (
	LittleEndian Endianness = iota
	BigEndian
)

type Flags

type Flags uint8
const (
	FlagAlphaPremultiplied Flags = 1
)

func (Flags) String

func (f Flags) String() string

type SampleInfo

type SampleInfo struct {
	Float, Signed, Exponent, Linear bool
	Channel                         Channel
	BitLength                       int
	BitOffset                       uint16
	SamplePosition                  [4]uint8
	SampleLower, SampleUpper        uint32
}

type TransferFunction

type TransferFunction uint8
const (
	TransferFunctionUnspecified TransferFunction = 0
	TransferFunctionLinear      TransferFunction = 1
	TransferFunctionSRGB        TransferFunction = 2
	TransferFunctionITU         TransferFunction = 3
	TransferFunctionNTSC        TransferFunction = 4
	TransferFunctionSLOG        TransferFunction = 5
	TransferFunctionSLOG2       TransferFunction = 6
	TransferFunctionBT1886      TransferFunction = 7
	TransferFunctionHLG_OETF    TransferFunction = 8
	TransferFunctionHLG_EOTF    TransferFunction = 9
	TransferFunctionPQ_EOTF     TransferFunction = 10
	TransferFunctionPQ_OETF     TransferFunction = 11
	TransferFunctionDCIP3       TransferFunction = 12
	TransferFunctionPAL_OETF    TransferFunction = 13
	TransferFunctionPAL625_EOTF TransferFunction = 14
	TransferFunctionST240       TransferFunction = 15
	TransferFunctionACESCC      TransferFunction = 16
	TransferFunctionACESCCT     TransferFunction = 17
	TransferFunctionAdobeRGB    TransferFunction = 18
)

func (TransferFunction) String

func (tf TransferFunction) String() string

type Vendor

type Vendor uint16
const (
	VendorKhronos Vendor = 0
)

func (Vendor) String

func (v Vendor) String() string

Directories

Path Synopsis
cmd
Package webgpu exposes WebGPU pixel formats.
Package webgpu exposes WebGPU pixel formats.

Jump to

Keyboard shortcuts

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