butteraugli_go

package module
v0.0.0-...-5522cb5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is a wrapper struct for interacting with the butteraugli api.

func ApiCreate

func ApiCreate() API

ApiCreate creates a new API structure that is used to interact with the butteraugli api.

func (*API) Compute

func (a *API) Compute(t ComputeTask) (Result, error)

Compute takes a ComputeTask as a input and returns a Result struct and error If there is a error the user can safely assume that the Result does not need to be destroyed.

func (*API) Destroy

func (a *API) Destroy()

Destroy destroys the underlying butteraugli api and frees memory. This is implicitly called when the Result is garbage collected. However when the Result is garbage collected is undeterminable.

func (*API) SetHFAsymmetry

func (a *API) SetHFAsymmetry(asymmetry float32)

SetHFAsymmetry controls bias for penalizing high frequency artifacts over blurring. 1.0 = neutral / default

func (*API) SetIntensityTarget

func (a *API) SetIntensityTarget(intensity float32)

SetIntensityTarget sets the butteraugli Intensity Target. This should be set to the target contents or display max brightness.

type ComputeTask

type ComputeTask struct {
	// Must be the same for both frames
	Width, Height uint32

	// the raw image must first be converted into a linear format before being
	// passed. If this is not done then the results can vary from slightly to
	// significantly inaccurate.
	RefBytes, DisBytes []byte

	// If the pixel format is incorrect Compute will return a error.
	RefPixFmt, DisPixFmt PixelFormat
}

ComputeTask represents all the inputs used for the Compute function. Width and Height represent the width and height of the source and distored frame. RefBytes and DisBytes represents the raw bytes of both frames going from the top left of the frame to the bottom right. RefPixFmt and DisPixFmt represent the pixel properties of both frames.

type DATATYPE

type DATATYPE int

DATATYPE represets the type for every pixel/sub pixel of a raw frame.

const (
	TYPE_FLOAT   DATATYPE = C.JXL_TYPE_FLOAT
	TYPE_UINT8   DATATYPE = C.JXL_TYPE_UINT8
	TYPE_UINT16  DATATYPE = C.JXL_TYPE_UINT16
	TYPE_FLOAT16 DATATYPE = C.JXL_TYPE_FLOAT16
)

type ENDIANNESS

type ENDIANNESS int

ENDIANNESS represets the byte level ordering of the raw frame.

const (
	NATIVE_ENDIAN ENDIANNESS = C.JXL_NATIVE_ENDIAN
	LITTLE_ENDIAN ENDIANNESS = C.JXL_LITTLE_ENDIAN
	BIG_ENDIAN    ENDIANNESS = C.JXL_BIG_ENDIAN
)

type NUM_CHANNELS

type NUM_CHANNELS int

NUM_CHANNELS represents the number of channels/subpixels per pixel.

const (
	GRAYSCALE  NUM_CHANNELS = 1
	GRAY_ALPHA NUM_CHANNELS = 2
	RGB        NUM_CHANNELS = 3
	RGBA       NUM_CHANNELS = 4
)

type PixelFormat

type PixelFormat struct {
	NumChannels NUM_CHANNELS
	DataType    DATATYPE
	Endianness  ENDIANNESS
	Align       uint32
}

PixelFormat represents the pixel format properties of a frame.

type Result

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

Result is a wrapper struct for interacting with butteraugli results.

func (*Result) Destroy

func (r *Result) Destroy()

Destroy destroys the underlying butteraugli result and frees memory. This is implicitly called when the Result is garbage collected. However when the Result is garbage collected is undeterminable.

func (*Result) GetDistance

func (r *Result) GetDistance(pnorm float32) float32

GetDistance returns the average butteraugli distance of each pixel averaged by the given pnorm. More information about pnorm can be seen here. https://en.wikipedia.org/wiki/Norm_(mathematics)#p-norm

func (*Result) GetMaxDistance

func (r *Result) GetMaxDistance() float32

GetMaxDistance returns the highest distance of the result.

Jump to

Keyboard shortcuts

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