color

package
v0.0.0-...-2eec009 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRI_SRGB   int32 = 1
	PRI_CUSTOM int32 = 2
	PRI_BT2100 int32 = 9
	PRI_P3     int32 = 11

	WP_D50    int32 = -1
	WP_D65    int32 = 1
	WP_CUSTOM int32 = 2
	WP_E      int32 = 10
	WP_DCI    int32 = 11

	CE_RGB     int32 = 0
	CE_GRAY    int32 = 1
	CE_XYB     int32 = 2
	CE_UNKNOWN int32 = 3

	RI_PERCEPTUAL int32 = 0
	RI_RELATIVE   int32 = 1
	RI_SATURATION int32 = 2
	RI_ABSOLUTE   int32 = 3

	TF_BT709   int32 = 1 + (1 << 24)
	TF_UNKNOWN int32 = 2 + (1 << 24)
	TF_LINEAR  int32 = 8 + (1 << 24)
	TF_SRGB    int32 = 13 + (1 << 24)
	TF_PQ      int32 = 16 + (1 << 24)
	TF_DCI     int32 = 17 + (1 << 24)
	TF_HLG     int32 = 18 + (1 << 24)
)

Variables

View Source
var (
	CM_PRI_SRGB   = GetPrimaries(PRI_SRGB)
	CM_PRI_BT2100 = GetPrimaries(PRI_BT2100)
	CM_PRI_P3     = GetPrimaries(PRI_P3)

	CM_WP_D65 = GetWhitePoint(WP_D65)
	CM_WP_D50 = GetWhitePoint(WP_D50)

	BRADFORD = [][]float32{
		{0.8951, 0.2664, -0.1614},
		{-0.7502, 1.7135, 0.0367},
		{0.0389, -0.0685, 1.0296},
	}

	BRADFORD_INVERSE = util.InvertMatrix3x3(BRADFORD)
)
View Source
var (
	DEFAULT_MATRIX = [][]float32{
		{11.031566901960783, -9.866943921568629, -0.16462299647058826},
		{-3.254147380392157, 4.418770392156863, -0.16462299647058826},
		{-3.6588512862745097, 2.7129230470588235, 1.9459282392156863}}
	DEFAULT_OPSIN_BIAS              = []float32{-0.0037930732552754493, -0.0037930732552754493, -0.0037930732552754493}
	DEFAULT_QUANT_BIAS              = []float32{1.0 - 0.05465007330715401, 1.0 - 0.07005449891748593, 1.0 - 0.049935103337343655}
	DEFAULT_QBIAS_NUMERATOR float32 = 0.145
)

Functions

func AdaptWhitePoint

func AdaptWhitePoint(targetWP *CIEXY, currentWP *CIEXY) ([][]float32, error)

func GetConversionMatrix

func GetConversionMatrix(targetPrim CIEPrimaries, targetWP CIEXY, currentPrim CIEPrimaries, currentWP CIEXY) ([][]float32, error)

func GetXYZ

func GetXYZ(xy CIEXY) ([]float32, error)

func ValidateColorEncoding

func ValidateColorEncoding(colorEncoding int32) bool

func ValidatePrimaries

func ValidatePrimaries(primaries int32) bool

func ValidateRenderingIntent

func ValidateRenderingIntent(renderingIntent int32) bool

func ValidateTransfer

func ValidateTransfer(transfer int32) bool

func ValidateWhitePoint

func ValidateWhitePoint(whitePoint int32) bool

Types

type BT709TransferFunction

type BT709TransferFunction struct {
}

func (BT709TransferFunction) FromLinear

func (tf BT709TransferFunction) FromLinear(input float64) float64

func (BT709TransferFunction) ToLinear

func (tf BT709TransferFunction) ToLinear(input float64) float64

type CIEPrimaries

type CIEPrimaries struct {
	Red   *CIEXY
	Green *CIEXY
	Blue  *CIEXY
}

func GetPrimaries

func GetPrimaries(primaries int32) *CIEPrimaries

func NewCIEPrimaries

func NewCIEPrimaries(red *CIEXY, green *CIEXY, blue *CIEXY) *CIEPrimaries

func (*CIEPrimaries) Matches

func (cp *CIEPrimaries) Matches(b *CIEPrimaries) bool

type CIEXY

type CIEXY struct {
	X float32
	Y float32
}

func GetWhitePoint

func GetWhitePoint(whitePoint int32) *CIEXY

func NewCIEXY

func NewCIEXY(x float32, y float32) *CIEXY

func (*CIEXY) Matches

func (cxy *CIEXY) Matches(b *CIEXY) bool

type ColorEncodingBundle

type ColorEncodingBundle struct {
	UseIccProfile   bool
	ColorEncoding   int32
	WhitePoint      int32
	White           *CIEXY
	Primaries       int32
	Prim            *CIEPrimaries
	Tf              int32
	RenderingIntent int32
}

func NewColorEncodingBundle

func NewColorEncodingBundle() (*ColorEncodingBundle, error)

func NewColorEncodingBundleWithReader

func NewColorEncodingBundleWithReader(reader *jxlio.Bitreader) (*ColorEncodingBundle, error)

type CustomXY

type CustomXY struct {
	CIEXY
}

func NewCustomXY

func NewCustomXY(reader *jxlio.Bitreader) (*CustomXY, error)

type GammaTransferFunction

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

func NewGammaTransferFunction

func NewGammaTransferFunction(transfer int32) GammaTransferFunction

func (GammaTransferFunction) FromLinear

func (tf GammaTransferFunction) FromLinear(input float64) float64

func (GammaTransferFunction) ToLinear

func (tf GammaTransferFunction) ToLinear(input float64) float64

type LinearTransferFunction

type LinearTransferFunction struct {
}

func (LinearTransferFunction) FromLinear

func (tf LinearTransferFunction) FromLinear(input float64) float64

func (LinearTransferFunction) ToLinear

func (tf LinearTransferFunction) ToLinear(input float64) float64

type OpsinInverseMatrix

type OpsinInverseMatrix struct {
	QuantBias          []float32
	QuantBiasNumerator float32
	// contains filtered or unexported fields
}

func NewOpsinInverseMatrix

func NewOpsinInverseMatrix() *OpsinInverseMatrix

func NewOpsinInverseMatrixAllParams

func NewOpsinInverseMatrixAllParams(
	primaries CIEPrimaries,
	whitePoint CIEXY,
	matrix [][]float32,
	opsinBias []float32,
	quantBias []float32,
	quantBiasNumerator float32) *OpsinInverseMatrix

func NewOpsinInverseMatrixWithReader

func NewOpsinInverseMatrixWithReader(reader *jxlio.Bitreader) (*OpsinInverseMatrix, error)

func (*OpsinInverseMatrix) GetMatrix

func (oim *OpsinInverseMatrix) GetMatrix(prim *CIEPrimaries, white *CIEXY) (*OpsinInverseMatrix, error)

func (*OpsinInverseMatrix) InvertXYB

func (oim *OpsinInverseMatrix) InvertXYB(buffer [][][]float32, intensityTarget float32) error

type PQTransferFunction

type PQTransferFunction struct {
}

func (PQTransferFunction) FromLinear

func (tf PQTransferFunction) FromLinear(input float64) float64

func (PQTransferFunction) ToLinear

func (tf PQTransferFunction) ToLinear(input float64) float64

type SRGBTransferFunction

type SRGBTransferFunction struct {
}

func (SRGBTransferFunction) FromLinear

func (tf SRGBTransferFunction) FromLinear(input float64) float64

func (SRGBTransferFunction) ToLinear

func (tf SRGBTransferFunction) ToLinear(input float64) float64

type ToneMapping

type ToneMapping struct {
	IntensityTarget      float32
	MinNits              float32
	RelativeToMaxDisplay bool
	LinearBelow          float32
}

func NewToneMapping

func NewToneMapping() *ToneMapping

func NewToneMappingWithReader

func NewToneMappingWithReader(reader *jxlio.Bitreader) (*ToneMapping, error)

func (*ToneMapping) GetIntensityTarget

func (tm *ToneMapping) GetIntensityTarget() float32

type TransferFunction

type TransferFunction interface {
	ToLinear(input float64) float64
	FromLinear(input float64) float64
}

func GetTransferFunction

func GetTransferFunction(transfer int32) (TransferFunction, error)

Jump to

Keyboard shortcuts

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