DataHoarder
6ea3e971bb
All checks were successful
continuous-integration/drone/push Build is passing
64 lines
1.5 KiB
Go
64 lines
1.5 KiB
Go
package frame
|
|
|
|
import (
|
|
"git.gammaspectra.live/S.O.N.G/Ignite/color"
|
|
"git.gammaspectra.live/S.O.N.G/Ignite/utilities"
|
|
)
|
|
|
|
type AllowedFrameTypes interface {
|
|
uint8 | uint16
|
|
}
|
|
|
|
type Frame interface {
|
|
Properties() Properties
|
|
// PTS usually frame number, but can differ on VFR
|
|
PTS() int64
|
|
// NextPTS Next PTS
|
|
NextPTS() int64
|
|
|
|
// Get16 get a pixel sample in 16-bit depth
|
|
Get16(x, y int) (Y uint16, Cb uint16, Cr uint16)
|
|
|
|
// Get8 get a pixel sample in 8-bit depth
|
|
Get8(x, y int) (Y uint8, Cb uint8, Cr uint8)
|
|
|
|
GetLuma() []byte
|
|
GetCb() []byte
|
|
GetCr() []byte
|
|
// GetJoint Gets Luma+Cb+Cr slice. Do not keep references to this slice, copy instead.
|
|
// This is unsafe
|
|
GetJoint() []byte
|
|
|
|
// Return Finishes using this frame and marks it for reuse
|
|
Return()
|
|
}
|
|
|
|
type TypedFrame[T AllowedFrameTypes] interface {
|
|
Frame
|
|
|
|
// GetNative get a pixel sample in native bit depth
|
|
GetNative(x, y int) (Y T, Cb T, Cr T)
|
|
|
|
// GetNativeLuma also known as Y. Do not keep references to this slice, copy instead.
|
|
GetNativeLuma() []T
|
|
// GetNativeCb also known as U. Do not keep references to this slice, copy instead.
|
|
GetNativeCb() []T
|
|
// GetNativeCr also known as V. Do not keep references to this slice, copy instead.
|
|
GetNativeCr() []T
|
|
// GetNativeJoint Gets Luma+Cb+Cr slice. Do not keep references to this slice, copy instead.
|
|
GetNativeJoint() []T
|
|
|
|
FillNativeLuma([]T)
|
|
FillNativeCb([]T)
|
|
FillNativeCr([]T)
|
|
}
|
|
|
|
type Properties struct {
|
|
//TODO: HDR
|
|
Width int
|
|
Height int
|
|
PixelAspectRatio utilities.Ratio
|
|
ColorSpace color.Space
|
|
FullColorRange bool
|
|
}
|