gpu

package
v0.0.0-...-3c84d77 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorBlack = YUVColor{16, 128, 128}

ColorBlack is BT.709 limited-range black.

View Source
var ErrGPUNotAvailable = errors.New("gpu: not available")

ErrGPUNotAvailable indicates the GPU backend is not available on this system.

View Source
var ErrOptiXNotAvailable = errors.New("gpu: OptiX not available (build without optix tag)")

ErrOptiXNotAvailable indicates OptiX is not available in the current build.

View Source
var ErrTensorRTNotAvailable = errors.New("gpu: TensorRT not available")

ErrTensorRTNotAvailable indicates TensorRT is not available.

Functions

func AllocDeviceBytes

func AllocDeviceBytes(size int) (unsafe.Pointer, error)

AllocDeviceBytes returns ErrGPUNotAvailable on non-GPU builds.

func AllocRGBBuffer

func AllocRGBBuffer(outW, outH int) (unsafe.Pointer, error)

AllocRGBBuffer returns ErrGPUNotAvailable on non-GPU builds.

func BlendFTB

func BlendFTB(ctx *Context, dst, src *GPUFrame, position float64) error

BlendFTB returns ErrGPUNotAvailable on non-GPU builds.

func BlendFTBP210

func BlendFTBP210(ctx *Context, dst, src *GPUFrame, position float64) error

BlendFTBP210 returns ErrGPUNotAvailable on non-GPU builds.

func BlendMix

func BlendMix(ctx *Context, dst, a, b *GPUFrame, position float64) error

BlendMix returns ErrGPUNotAvailable on non-GPU builds.

func BlendMixP210

func BlendMixP210(ctx *Context, dst, a, b *GPUFrame, position float64) error

BlendMixP210 returns ErrGPUNotAvailable on non-GPU builds.

func BlendStinger

func BlendStinger(ctx *Context, dst, base, overlay, alpha *GPUFrame) error

BlendStinger returns ErrGPUNotAvailable on non-GPU builds.

func BlendStingerP210

func BlendStingerP210(ctx *Context, dst, base, overlay, alpha *GPUFrame) error

BlendStingerP210 returns ErrGPUNotAvailable on non-GPU builds.

func BlendWipe

func BlendWipe(ctx *Context, dst, a, b, maskBuf *GPUFrame, position float64, dir WipeDirection, softEdge int) error

BlendWipe returns ErrGPUNotAvailable on non-GPU builds.

func BlendWipeMap

func BlendWipeMap(ctx *Context, dst, srcA, srcB, gradMap *GPUFrame, cfg WipeMapBlendConfig) error

BlendWipeMap returns ErrGPUNotAvailable on non-GPU builds.

func BlendWipeMapP210

func BlendWipeMapP210(ctx *Context, dst, srcA, srcB, gradMap *GPUFrame, cfg WipeMapBlendConfig) error

BlendWipeMapP210 returns ErrGPUNotAvailable on non-GPU builds.

func BlendWipeP210

func BlendWipeP210(ctx *Context, dst, a, b, maskBuf *GPUFrame, position float64, dir WipeDirection, softEdge int) error

BlendWipeP210 returns ErrGPUNotAvailable on non-GPU builds.

func BuildLumaKeyLUT

func BuildLumaKeyLUT(lowClip, highClip, softness float32) [256]byte

BuildLumaKeyLUT creates a 256-byte lookup table for luma keying.

func ChromaKey

func ChromaKey(ctx *Context, frame *GPUFrame, maskBuf *GPUFrame, cfg ChromaKeyConfig) error

ChromaKey returns ErrGPUNotAvailable on non-GPU builds.

func ChromaKeyP210

func ChromaKeyP210(ctx *Context, frame *GPUFrame, maskBuf *GPUFrame, cfg ChromaKeyConfig) error

ChromaKeyP210 returns ErrGPUNotAvailable on non-GPU builds.

func CloseWorkQueue

func CloseWorkQueue(q *GPUWorkQueue)

CloseWorkQueue is a no-op on non-GPU builds.

func ColorGradeLUT3D

func ColorGradeLUT3D(ctx *Context, frame *GPUFrame, lutDevPtr uintptr, lutSize int, intensity float32) error

ColorGradeLUT3D returns ErrGPUNotAvailable on non-GPU builds.

func ColorGradeLUT3DP210

func ColorGradeLUT3DP210(ctx *Context, frame *GPUFrame, lutDevPtr uintptr, lutSize int, intensity float32) error

ColorGradeLUT3DP210 returns ErrGPUNotAvailable on non-GPU builds.

func ConvertNV12ToP210

func ConvertNV12ToP210(ctx *Context, dst, src *GPUFrame) error

ConvertNV12ToP210 returns ErrGPUNotAvailable on non-GPU builds.

func ConvertP210ToP010MSB

func ConvertP210ToP010MSB(ctx *Context, dst, src *GPUFrame) error

ConvertP210ToP010MSB returns ErrGPUNotAvailable on non-GPU builds.

func CopyGPUFrame

func CopyGPUFrame(dst, src *GPUFrame) error

CopyGPUFrame returns nil on non-GPU builds (no frames to copy).

func CopyGPUFrameOn

func CopyGPUFrameOn(dst, src *GPUFrame, q *GPUWorkQueue) error

CopyGPUFrameOn returns ErrGPUNotAvailable on non-GPU builds.

func CopyHostToDevice

func CopyHostToDevice(devPtr, hostPtr unsafe.Pointer, size int) error

CopyHostToDevice returns ErrGPUNotAvailable on non-GPU builds.

func CopyNV12FromDevice

func CopyNV12FromDevice(_ *GPUFrame, _, _ uintptr, _, _, _ int) error

CopyNV12FromDevice is a no-op on non-GPU builds (NVDEC not available).

func CopyP016ToNV12FromDevice

func CopyP016ToNV12FromDevice(_ *GPUFrame, _, _ uintptr, _, _, _ int) error

CopyP016ToNV12FromDevice is a no-op on non-GPU builds (NVDEC not available).

func DSKCompositeFullFrame

func DSKCompositeFullFrame(ctx *Context, frame *GPUFrame, overlay *GPUOverlay, alphaScale float64) error

DSKCompositeFullFrame returns ErrGPUNotAvailable on non-GPU builds.

func DSKCompositeFullFrameOcc

func DSKCompositeFullFrameOcc(ctx *Context, frame *GPUFrame, overlay *GPUOverlay, alphaScale float64, occPtr uintptr, occW, occH int) error

DSKCompositeFullFrameOcc returns ErrGPUNotAvailable on non-GPU builds.

func DSKCompositeFullFrameP210

func DSKCompositeFullFrameP210(ctx *Context, frame *GPUFrame, overlay *GPUOverlay, alphaScale float64) error

DSKCompositeFullFrameP210 returns ErrGPUNotAvailable on non-GPU builds.

func DSKCompositeRect

func DSKCompositeRect(ctx *Context, frame *GPUFrame, overlay *GPUOverlay, rect Rect, alphaScale float64) error

DSKCompositeRect returns ErrGPUNotAvailable on non-GPU builds.

func DSKCompositeRectOcc

func DSKCompositeRectOcc(ctx *Context, frame *GPUFrame, overlay *GPUOverlay, rect Rect, alphaScale float64, occPtr uintptr, occW, occH int) error

DSKCompositeRectOcc returns ErrGPUNotAvailable on non-GPU builds.

func DSKCompositeRectP210

func DSKCompositeRectP210(ctx *Context, frame *GPUFrame, overlay *GPUOverlay, rect Rect, alphaScale float64) error

DSKCompositeRectP210 returns ErrGPUNotAvailable on non-GPU builds.

func DSKOverlayP210

func DSKOverlayP210(ctx *Context, frame *GPUFrame, rgba []byte, width, height, rgbaPitch, alphaScale256 int) error

DSKOverlayP210 returns ErrGPUNotAvailable on non-GPU builds.

func DVE3DComposite

func DVE3DComposite(ctx *Context, dst, src *GPUFrame, t3d *dve.Transform3D,
	invMVP dve.Matrix4x4, srcW, srcH int, slotRect image.Rectangle, alpha256 int) error

DVE3DComposite returns ErrGPUNotAvailable on non-GPU builds.

func DVE3DCompositeP210

func DVE3DCompositeP210(ctx *Context, dst, src *GPUFrame, t3d *dve.Transform3D,
	invMVP dve.Matrix4x4, srcW, srcH int, slotRect image.Rectangle, alpha256 int) error

DVE3DCompositeP210 returns ErrGPUNotAvailable on non-GPU builds.

func DVEComposite

func DVEComposite(ctx *Context, dst, src *GPUFrame, transform dve.Transform,
	invMatrix dve.Matrix3x3, srcW, srcH int, aabb image.Rectangle) error

DVEComposite returns ErrGPUNotAvailable on non-GPU builds.

func DVECompositeP210

func DVECompositeP210(ctx *Context, dst, src *GPUFrame, transform dve.Transform,
	invMatrix dve.Matrix3x3, srcW, srcH int, aabb image.Rectangle) error

DVECompositeP210 returns ErrGPUNotAvailable on non-GPU builds.

func DVEDefocusBlur

func DVEDefocusBlur(ctx *Context, frame *GPUFrame, defocusRadius float64) error

DVEDefocusBlur returns ErrGPUNotAvailable on non-GPU builds.

func Download

func Download(ctx *Context, yuv []byte, frame *GPUFrame, width, height int) error

Download returns ErrGPUNotAvailable on non-GPU builds.

func Download10

func Download10(ctx *Context, frame *GPUFrame, dst []byte, width, height int) error

Download10 returns ErrGPUNotAvailable on non-GPU builds.

func DownloadMaskU8

func DownloadMaskU8(dst []byte, devPtr unsafe.Pointer, size int) error

DownloadMaskU8 returns ErrGPUNotAvailable on non-GPU builds.

func DownloadP210ToV210

func DownloadP210ToV210(ctx *Context, v210 []byte, src *GPUFrame, width, height int) error

DownloadP210ToV210 returns ErrGPUNotAvailable on non-GPU builds.

func DownloadRGBBuffer

func DownloadRGBBuffer(dst []float32, devPtr unsafe.Pointer, outW, outH int) error

DownloadRGBBuffer returns ErrGPUNotAvailable on non-GPU builds.

func DownloadV210

func DownloadV210(ctx *Context, v210 []byte, src *GPUFrame, width, height int) error

DownloadV210 returns ErrGPUNotAvailable on non-GPU builds.

func DrawBorder

func DrawBorder(ctx *Context, frame *GPUFrame, rect Rect, color YUVColor, thickness int) error

DrawBorder returns ErrGPUNotAvailable on non-GPU builds.

func DrawBorderP210

func DrawBorderP210(ctx *Context, frame *GPUFrame, rect Rect, colorY, colorCb, colorCr uint16, thickness int) error

DrawBorderP210 returns ErrGPUNotAvailable on non-GPU builds.

func FRUCAvailable

func FRUCAvailable() bool

FRUCAvailable returns false on non-GPU builds.

func FillBlack

func FillBlack(ctx *Context, frame *GPUFrame) error

FillBlack returns ErrGPUNotAvailable on non-GPU builds.

func FillBlackP210

func FillBlackP210(ctx *Context, frame *GPUFrame) error

FillBlackP210 returns ErrGPUNotAvailable on non-GPU builds.

func FillColor

func FillColor(ctx *Context, frame *GPUFrame, color YUVColor) error

FillColor returns ErrGPUNotAvailable on non-GPU builds.

func FillColorP210

func FillColorP210(ctx *Context, frame *GPUFrame, y, cb, cr uint16) error

FillColorP210 returns ErrGPUNotAvailable on non-GPU builds.

func FillRect

func FillRect(ctx *Context, frame *GPUFrame, rect Rect, color YUVColor) error

FillRect returns ErrGPUNotAvailable on non-GPU builds.

func FillRectP210

func FillRectP210(ctx *Context, frame *GPUFrame, rect Rect, colorY, colorCb, colorCr uint16) error

FillRectP210 returns ErrGPUNotAvailable on non-GPU builds.

func FreeDeviceBytes

func FreeDeviceBytes(ptr unsafe.Pointer)

FreeDeviceBytes is a no-op on non-GPU builds.

func FreeLUT3D

func FreeLUT3D(devPtr uintptr)

FreeLUT3D is a no-op on non-GPU builds.

func FreeOverlay

func FreeOverlay(overlay *GPUOverlay)

FreeOverlay is a no-op on non-GPU builds.

func FreeRGBBuffer

func FreeRGBBuffer(buf unsafe.Pointer)

FreeRGBBuffer is a no-op on non-GPU builds.

func FuseOcclusion

func FuseOcclusion(ctx *Context, output, depth, samMask uintptr,
	width, height, depthW, depthH int, params OcclusionFuseParams) error

FuseOcclusion returns ErrGPUNotAvailable on non-GPU builds.

func GPUBlendFTBDispatch

func GPUBlendFTBDispatch(ctx *Context, dst, src *GPUFrame, position float64) error

GPUBlendFTBDispatch performs a fade-to-black, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUBlendMixDispatch

func GPUBlendMixDispatch(ctx *Context, dst, a, b *GPUFrame, position float64) error

GPUBlendMixDispatch performs a uniform mix blend, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUBlendStingerDispatch

func GPUBlendStingerDispatch(ctx *Context, dst, base, overlay, alpha *GPUFrame) error

GPUBlendStingerDispatch composites a stinger overlay, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUBlendWipeDispatch

func GPUBlendWipeDispatch(ctx *Context, dst, a, b, maskBuf *GPUFrame, position float64, dir WipeDirection, softEdge int) error

GPUBlendWipeDispatch performs a wipe transition, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUBlendWipeMapDispatch

func GPUBlendWipeMapDispatch(ctx *Context, dst, srcA, srcB, gradMap *GPUFrame, cfg WipeMapBlendConfig) error

GPUBlendWipeMapDispatch performs a gradient-map-driven wipe transition, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUChromaKeyDispatch

func GPUChromaKeyDispatch(ctx *Context, frame, maskBuf *GPUFrame, cfg ChromaKeyConfig) error

GPUChromaKeyDispatch generates an alpha mask, picking the chroma key kernel by frame format. P210 program frames go through the 10-bit kernel; everything else through the legacy NV12 kernel.

func GPUDVE3DCompositeDispatch

func GPUDVE3DCompositeDispatch(ctx *Context, dst, src *GPUFrame, t3d *dve.Transform3D,
	invMVP dve.Matrix4x4, srcW, srcH int, slotRect image.Rectangle, alpha256 int) error

GPUDVE3DCompositeDispatch composites a 3D DVE slot onto the destination frame, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUDVECompositeDispatch

func GPUDVECompositeDispatch(ctx *Context, dst, src *GPUFrame, transform dve.Transform,
	invMatrix dve.Matrix3x3, srcW, srcH int, aabb image.Rectangle) error

GPUDVECompositeDispatch composites a DVE slot onto the destination frame, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUDownloadDispatch

func GPUDownloadDispatch(ctx *Context, frame *GPUFrame, data []byte, width, height int) error

GPUDownloadDispatch downloads a GPU frame to a CPU planar buffer, selecting the correct kernel based on the frame's format.

  • NV12: writes YUV420p, calls Download.
  • P210: writes YUV422P10LE, calls Download10.

func GPUDrawBorderDispatch

func GPUDrawBorderDispatch(ctx *Context, frame *GPUFrame, rect Rect, color YUVColor, thickness int) error

GPUDrawBorderDispatch draws a colored border outside the given rectangle, dispatching to the P210 or NV12 variant based on the frame's format. For P210, the 8-bit YUVColor is promoted to 10-bit (<<2).

func GPUFillBlackDispatch

func GPUFillBlackDispatch(ctx *Context, frame *GPUFrame) error

GPUFillBlackDispatch fills a frame with black, routing to the correct format.

func GPUFillColorDispatch

func GPUFillColorDispatch(ctx *Context, frame *GPUFrame, color YUVColor) error

GPUFillColorDispatch fills a frame with a constant YUV color, routing to the correct format. For P210, promotes 8-bit YUVColor values to 10-bit (<<2).

func GPUFillRectDispatch

func GPUFillRectDispatch(ctx *Context, frame *GPUFrame, rect Rect, color YUVColor) error

GPUFillRectDispatch fills a rectangular region with a constant color, dispatching to the P210 or NV12 variant based on the frame's format. For P210, the 8-bit YUVColor is promoted to 10-bit (<<2).

func GPUGaussianBlurDispatch

func GPUGaussianBlurDispatch(ctx *Context, dst, src *GPUFrame, radius int) error

GPUGaussianBlurDispatch returns ErrGPUNotAvailable on non-GPU builds.

func GPULumaKeyDispatch

func GPULumaKeyDispatch(ctx *Context, frame, maskBuf *GPUFrame, lut [256]byte) error

GPULumaKeyDispatch generates an alpha mask, picking the luma key kernel by frame format.

func GPUPIPCompositeDispatch

func GPUPIPCompositeDispatch(ctx *Context, dst, src *GPUFrame, rect Rect, alpha float64) error

GPUPIPCompositeDispatch composites a source into a destination rectangle, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUPIPCompositeWithCropDispatch

func GPUPIPCompositeWithCropDispatch(ctx *Context, dst, src *GPUFrame, rect Rect, alpha float64,
	cropX, cropY, cropW, cropH int) error

GPUPIPCompositeWithCropDispatch composites a source sub-region into a destination rectangle, dispatching based on the destination frame's format.

func GPUSTMapWarpDispatch

func GPUSTMapWarpDispatch(ctx *Context, dst, src *GPUFrame, stmap *GPUSTMap) error

GPUSTMapWarpDispatch applies an ST map warp, dispatching to the P210 or NV12 variant based on the source frame's format.

func GPUScaleDispatch

func GPUScaleDispatch(ctx *Context, dst, src *GPUFrame) error

GPUScaleDispatch scales a GPU frame using bilinear interpolation, dispatching to the P210 or NV12 variant based on the source frame's format.

func GPUScaleLanczos3Dispatch

func GPUScaleLanczos3Dispatch(ctx *Context, dst, src *GPUFrame) error

GPUScaleLanczos3Dispatch scales a GPU frame using Lanczos-3 interpolation, dispatching to the P210 or NV12 variant based on the destination frame's format.

func GPUUploadDispatch

func GPUUploadDispatch(ctx *Context, frame *GPUFrame, data []byte, width, height int) error

GPUUploadDispatch uploads a CPU planar buffer to a GPU frame, selecting the correct kernel based on the frame's format.

  • NV12: expects YUV420p (w*h*3/2 bytes), calls Upload.
  • P210: expects YUV422P10LE (w*h*4 bytes), calls Upload10.

func GaussianBlur

func GaussianBlur(ctx *Context, dst, src *GPUFrame, radius int) error

GaussianBlur returns ErrGPUNotAvailable on non-GPU builds.

func GaussianBlurP210

func GaussianBlurP210(ctx *Context, dst, src *GPUFrame, radius int) error

GaussianBlurP210 returns ErrGPUNotAvailable on non-GPU builds.

func LumaKey

func LumaKey(ctx *Context, frame *GPUFrame, maskBuf *GPUFrame, lut [256]byte) error

LumaKey returns ErrGPUNotAvailable on non-GPU builds.

func LumaKeyP210

func LumaKeyP210(ctx *Context, frame *GPUFrame, maskBuf *GPUFrame, lut [256]byte) error

LumaKeyP210 returns ErrGPUNotAvailable on non-GPU builds.

func MaskEMA

func MaskEMA(output, prev, curr unsafe.Pointer, alpha float32, size int, stream uintptr) error

MaskEMA returns ErrGPUNotAvailable on non-GPU builds.

func MaskErode3x3

func MaskErode3x3(dst, src unsafe.Pointer, width, height int, stream uintptr) error

MaskErode3x3 returns ErrGPUNotAvailable on non-GPU builds.

func MaskFloatToU8Upscale

func MaskFloatToU8Upscale(dstPtr unsafe.Pointer, dstW, dstH int, srcPtr unsafe.Pointer, srcW, srcH int, stream uintptr) error

MaskFloatToU8Upscale returns ErrGPUNotAvailable on non-GPU builds.

func MemoryStatsExtended

func MemoryStatsExtended(ctx *Context) map[string]any

MemoryStatsExtended returns unavailable status on non-GPU builds.

func NV12ToV210

func NV12ToV210(ctx *Context, v210DevPtr uintptr, v210Stride int, src *GPUFrame, width, height int) error

NV12ToV210 returns ErrGPUNotAvailable on non-GPU builds.

func PIPComposite

func PIPComposite(ctx *Context, dst, src *GPUFrame, rect Rect, alpha float64) error

PIPComposite returns ErrGPUNotAvailable on non-GPU builds.

func PIPCompositeP210

func PIPCompositeP210(ctx *Context, dst, src *GPUFrame, rect Rect, alpha float64) error

PIPCompositeP210 returns ErrGPUNotAvailable on non-GPU builds.

func PIPCompositeP210WithCrop

func PIPCompositeP210WithCrop(ctx *Context, dst, src *GPUFrame, rect Rect, alpha float64,
	cropX, cropY, cropW, cropH int) error

PIPCompositeP210WithCrop returns ErrGPUNotAvailable on non-GPU builds.

func PIPCompositeWithCrop

func PIPCompositeWithCrop(ctx *Context, dst, src *GPUFrame, rect Rect, alpha float64,
	cropX, cropY, cropW, cropH int) error

PIPCompositeWithCrop returns ErrGPUNotAvailable on non-GPU builds.

func PreprocessNV12ToRGB

func PreprocessNV12ToRGB(ctx *Context, rgbOut unsafe.Pointer, src *GPUFrame, outW, outH int) error

PreprocessNV12ToRGB returns ErrGPUNotAvailable on non-GPU builds.

func PreprocessNV12ToRGBNHWC

func PreprocessNV12ToRGBNHWC(ctx *Context, rgbOut unsafe.Pointer, src *GPUFrame, outW, outH int) error

PreprocessNV12ToRGBNHWC returns ErrGPUNotAvailable on non-GPU builds.

func ProbeGPUFrame

func ProbeGPUFrame(ctx *Context, frame *GPUFrame, dst []byte) error

ProbeGPUFrame is a no-op on non-GPU builds.

func STMapWarp

func STMapWarp(ctx *Context, dst, src *GPUFrame, stmap *GPUSTMap) error

STMapWarp returns ErrGPUNotAvailable on non-GPU builds.

func STMapWarpGlobalMem

func STMapWarpGlobalMem(ctx *Context, dst, src *GPUFrame, stmap *GPUSTMap) error

STMapWarpGlobalMem returns ErrGPUNotAvailable on non-GPU builds.

func STMapWarpP210

func STMapWarpP210(ctx *Context, dst, src *GPUFrame, stmapS, stmapT []float32, width, height int) error

STMapWarpP210 returns ErrGPUNotAvailable on non-GPU builds.

func STMapWarpP210Map

func STMapWarpP210Map(ctx *Context, dst, src *GPUFrame, stmap *GPUSTMap) error

STMapWarpP210Map returns ErrGPUNotAvailable on non-GPU builds.

func Scale

func Scale(ctx *Context, dst, src *GPUFrame, quality ScaleQuality) error

Scale returns ErrGPUNotAvailable on non-GPU builds.

func ScaleBilinear

func ScaleBilinear(ctx *Context, dst, src *GPUFrame) error

ScaleBilinear returns ErrGPUNotAvailable on non-GPU builds.

func ScaleBilinearOn

func ScaleBilinearOn(ctx *Context, dst, src *GPUFrame, q *GPUWorkQueue) error

ScaleBilinearOn returns ErrGPUNotAvailable on non-GPU builds.

func ScaleBilinearP210

func ScaleBilinearP210(ctx *Context, dst, src *GPUFrame) error

ScaleBilinearP210 returns ErrGPUNotAvailable on non-GPU builds.

func ScaleLanczos3

func ScaleLanczos3(ctx *Context, dst, src *GPUFrame) error

ScaleLanczos3 returns ErrGPUNotAvailable on non-GPU builds.

func ScaleLanczos3P210

func ScaleLanczos3P210(ctx *Context, dst, src *GPUFrame) error

ScaleLanczos3P210 returns ErrGPUNotAvailable on non-GPU builds.

func ScaleNV12ToP210

func ScaleNV12ToP210(ctx *Context, dst, src *GPUFrame) error

ScaleNV12ToP210 returns ErrGPUNotAvailable on non-GPU builds.

func ScaleP210ToNV12On

func ScaleP210ToNV12On(ctx *Context, dst, src *GPUFrame, q *GPUWorkQueue) error

ScaleP210ToNV12On returns ErrGPUNotAvailable on non-GPU builds.

func SharpenLuma

func SharpenLuma(ctx *Context, frame *GPUFrame, amount float32) error

SharpenLuma returns ErrGPUNotAvailable on non-GPU builds.

func SyncDefaultStream

func SyncDefaultStream() error

SyncDefaultStream returns ErrGPUNotAvailable on non-GPU builds.

func SyncWorkQueue

func SyncWorkQueue(q *GPUWorkQueue) error

SyncWorkQueue is a no-op on non-GPU builds.

func TRTDTypeSize

func TRTDTypeSize(dtype int) int

TRTDTypeSize returns 0 on non-TensorRT builds.

func TensorBufferSize

func TensorBufferSize(info TensorInfo) int

TensorBufferSize returns 0 on non-TensorRT builds.

func Upload

func Upload(ctx *Context, frame *GPUFrame, yuv []byte, width, height int) error

Upload returns ErrGPUNotAvailable on non-GPU builds.

func Upload10

func Upload10(ctx *Context, frame *GPUFrame, yuv422p10 []byte, width, height int) error

Upload10 returns ErrGPUNotAvailable on non-GPU builds.

func UploadBytes

func UploadBytes(devPtr unsafe.Pointer, data []byte) error

UploadBytes returns ErrGPUNotAvailable on non-GPU builds.

func UploadLUT3D

func UploadLUT3D(data []float32) (uintptr, error)

UploadLUT3D returns ErrGPUNotAvailable on non-GPU builds.

func UploadV210

func UploadV210(ctx *Context, dst *GPUFrame, v210 []byte, width, height int) error

UploadV210 returns ErrGPUNotAvailable on non-GPU builds.

func UploadV210ToP210

func UploadV210ToP210(ctx *Context, dst *GPUFrame, v210 []byte, width, height int) error

UploadV210ToP210 returns ErrGPUNotAvailable on non-GPU builds.

func UploadYUV420PToP210

func UploadYUV420PToP210(ctx *Context, frame *GPUFrame, yuv []byte, width, height int) error

UploadYUV420PToP210 returns ErrGPUNotAvailable on non-GPU builds.

func V210LineStride

func V210LineStride(width int) int

V210LineStride returns the byte stride for one line of V210 data.

func V210ToNV12

func V210ToNV12(ctx *Context, dst *GPUFrame, v210DevPtr uintptr, v210Stride, width, height int) error

V210ToNV12 returns ErrGPUNotAvailable on non-GPU builds.

Types

type AISegmentConfig

type AISegmentConfig struct {
	Background  string  // "transparent"|"blur:N"|"color:RRGGBB"
	Sensitivity float32 // 0.0-1.0 (maps to segmentation threshold)
	EdgeSmooth  float32 // 0.0-1.0 (maps to EMA temporal smoothing alpha)
}

AISegmentConfig holds the background replacement configuration for a source.

type BorderSnapshot

type BorderSnapshot struct {
	ColorY, ColorCb, ColorCr uint8
	Thickness                int
}

BorderSnapshot holds border configuration for a layout slot.

type CUDATexture

type CUDATexture struct{}

CUDATexture is a stub for non-OptiX builds.

func CreateCUDATexture

func CreateCUDATexture(rgba []byte, width, height int) (*CUDATexture, error)

CreateCUDATexture returns ErrOptiXNotAvailable on non-OptiX builds.

func (*CUDATexture) Close

func (t *CUDATexture) Close()

Close is a no-op on non-OptiX builds.

func (*CUDATexture) Handle

func (t *CUDATexture) Handle() uint64

Handle returns 0 on non-OptiX builds.

type ChromaKeyConfig

type ChromaKeyConfig struct {
	KeyCb, KeyCr   uint8
	Similarity     float32
	Smoothness     float32
	SpillSuppress  float32
	SpillReplaceCb uint8
	SpillReplaceCr uint8
}

ChromaKeyConfig holds chroma key parameters.

type ColorGradeState

type ColorGradeState interface {
	HasGradingEnabled() bool
	GradingLUTData() []float32 // 33^3 * 3 float32s (pre-parsed)
	GradingLUTSize() int       // cube dimension (e.g., 33)
	GradingLUTGen() uint64     // generation counter for cache invalidation
	GradingIntensity() float32 // 0.0-1.0
}

ColorGradeState provides color grading state to the GPU color grade node. Implemented by an adapter wrapping the colorGradeController.

type CompositorState

type CompositorState interface {
	HasActiveLayers() bool
	SnapshotVisibleLayers() []VisibleLayerSnapshot
}

CompositorState provides graphics compositor state to the GPU DSK node. Implemented by an adapter wrapping graphics.Compositor.

type Context

type Context struct{}

Context is a stub for non-GPU builds.

func NewContext

func NewContext() (*Context, error)

NewContext returns ErrGPUNotAvailable on non-GPU builds.

func (*Context) Backend

func (c *Context) Backend() string

Backend returns "" on non-GPU builds.

func (*Context) CUDAContext

func (c *Context) CUDAContext() unsafe.Pointer

CUDAContext returns nil on non-GPU builds.

func (*Context) Close

func (c *Context) Close() error

Close is a no-op on non-GPU builds.

func (*Context) DeviceName

func (c *Context) DeviceName() string

DeviceName returns "" on non-GPU builds.

func (*Context) DeviceProperties

func (c *Context) DeviceProperties() DeviceProperties

DeviceProperties returns a zero-value DeviceProperties.

func (*Context) EncStream

func (c *Context) EncStream() uintptr

EncStream returns 0 (nil stream).

func (*Context) MemoryStats

func (c *Context) MemoryStats() MemoryStats

MemoryStats returns zero stats on non-GPU builds.

func (*Context) Pool

func (c *Context) Pool() *FramePool

Pool returns nil on non-GPU builds.

func (*Context) SetPool

func (c *Context) SetPool(pool *FramePool)

SetPool is a no-op on non-GPU builds.

func (*Context) Stream

func (c *Context) Stream() uintptr

Stream returns 0 (nil stream).

func (*Context) Sync

func (c *Context) Sync() error

Sync is a no-op on non-GPU builds.

type DeviceProperties

type DeviceProperties struct {
	Name                string
	ComputeCapability   [2]int
	TotalMemory         int64
	MultiprocessorCount int
	MaxThreadsPerBlock  int
}

DeviceProperties holds GPU device information.

type EnabledKeySnapshot

type EnabledKeySnapshot struct {
	SourceKey      string
	Type           string // "chroma" or "luma"
	KeyCb, KeyCr   uint8
	Similarity     float32
	Smoothness     float32
	SpillSuppress  float32
	SpillReplaceCb uint8
	SpillReplaceCr uint8
	LowClip        float32
	HighClip       float32
	Softness       float32
	FillYUV        []byte // YUV420p fill frame (deep copy)
	FillW, FillH   int
}

EnabledKeySnapshot is a deep-copied snapshot of one enabled key's state.

type FRUC

type FRUC struct{}

FRUC is a stub for non-GPU builds.

func NewFRUC

func NewFRUC(ctx *Context, width, height int) (*FRUC, error)

NewFRUC returns ErrGPUNotAvailable on non-GPU builds.

func (*FRUC) Close

func (f *FRUC) Close()

Close is a no-op on non-GPU builds.

func (*FRUC) ComputeFlow

func (f *FRUC) ComputeFlow(prev, curr *GPUFrame) bool

ComputeFlow returns false on non-GPU builds.

func (*FRUC) HasNVOFA

func (f *FRUC) HasNVOFA() bool

HasNVOFA returns false on non-GPU builds.

func (*FRUC) Interpolate

func (f *FRUC) Interpolate(prev, curr, output *GPUFrame, alpha float64) error

Interpolate returns ErrGPUNotAvailable on non-GPU builds.

func (*FRUC) MotionBlur

func (f *FRUC) MotionBlur(prev, curr, output *GPUFrame, alpha, shutterAngle float64) error

MotionBlur returns ErrGPUNotAvailable on non-GPU builds.

type FramePool

type FramePool struct{}

FramePool is a stub for non-GPU builds.

func NewFramePool

func NewFramePool(ctx *Context, width, height, initialSize int) (*FramePool, error)

NewFramePool returns ErrGPUNotAvailable on non-GPU builds.

func NewP210FramePool

func NewP210FramePool(ctx *Context, width, height, initialSize int) (*FramePool, error)

NewP210FramePool returns ErrGPUNotAvailable on non-GPU builds.

func (*FramePool) Acquire

func (p *FramePool) Acquire() (*GPUFrame, error)

Acquire returns ErrGPUNotAvailable on non-GPU builds.

func (*FramePool) AllDevPtrs

func (p *FramePool) AllDevPtrs() []uintptr

AllDevPtrs returns nil on non-GPU builds.

func (*FramePool) AllFrames

func (p *FramePool) AllFrames() []*GPUFrame

AllFrames returns nil on non-GPU builds.

func (*FramePool) Close

func (p *FramePool) Close()

Close is a no-op on non-GPU builds.

func (*FramePool) Format

func (p *FramePool) Format() GPUFrameFormat

NewGPUFrameFromDevPtr creates a GPUFrame wrapping an external device pointer. On non-GPU builds this returns a frame with the given dimensions but no usable device pointer. Format returns the pixel format of frames in this pool.

func (*FramePool) Pitch

func (p *FramePool) Pitch() int

Pitch returns 0 on non-GPU builds.

func (*FramePool) Stats

func (p *FramePool) Stats() (hits, misses uint64)

Stats returns zero stats on non-GPU builds.

type GPUAnimatedSTMap

type GPUAnimatedSTMap struct{ Width, Height, FPS int }

GPUAnimatedSTMap is a stub for non-GPU builds.

func NewGPUAnimatedSTMap

func NewGPUAnimatedSTMap(ctx *Context, sMaps, tMaps [][]float32, width, height, fps int) (*GPUAnimatedSTMap, error)

NewGPUAnimatedSTMap returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUAnimatedSTMap) CurrentFrame

func (a *GPUAnimatedSTMap) CurrentFrame() *GPUSTMap

CurrentFrame returns nil on non-GPU builds.

func (*GPUAnimatedSTMap) FrameCount

func (a *GPUAnimatedSTMap) FrameCount() int

FrameCount returns 0 on non-GPU builds.

func (*GPUAnimatedSTMap) Free

func (a *GPUAnimatedSTMap) Free()

Free is a no-op on non-GPU builds.

type GPUDecoder

type GPUDecoder struct{}

GPUDecoder is a stub for non-GPU builds.

func NewGPUDecoder

func NewGPUDecoder(ctx *Context, threadCount int) (*GPUDecoder, error)

NewGPUDecoder returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUDecoder) Close

func (d *GPUDecoder) Close()

Close is a no-op on non-GPU builds.

func (*GPUDecoder) Decode

func (d *GPUDecoder) Decode(data []byte) ([]byte, int, int, error)

Decode returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUDecoder) Flush

func (d *GPUDecoder) Flush()

Flush is a no-op on non-GPU builds.

type GPUEncoder

type GPUEncoder struct{}

GPUEncoder is a stub for non-GPU builds.

func NewGPUEncoder

func NewGPUEncoder(ctx *Context, width, height, fpsNum, fpsDen, bitrate int) (*GPUEncoder, error)

NewGPUEncoder returns ErrGPUNotAvailable on non-GPU builds.

func NewGPUEncoderForCodec

func NewGPUEncoderForCodec(ctx *Context, width, height, fpsNum, fpsDen, bitrate int,
	pipelineCodec switcher.PipelineCodec, colorFormat switcher.PipelineColorFormat) (*GPUEncoder, error)

NewGPUEncoderForCodec returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUEncoder) Close

func (e *GPUEncoder) Close()

Close is a no-op on non-GPU builds.

func (*GPUEncoder) EncodeCPU

func (e *GPUEncoder) EncodeCPU(yuv []byte, pts int64, forceIDR bool) ([]byte, bool, error)

EncodeCPU returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUEncoder) EncodeGPU

func (e *GPUEncoder) EncodeGPU(frame *GPUFrame, forceIDR bool) ([]byte, bool, error)

EncodeGPU returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUEncoder) EncodeGPUOn

func (e *GPUEncoder) EncodeGPUOn(frame *GPUFrame, forceIDR bool, q *GPUWorkQueue) ([]byte, bool, error)

EncodeGPUOn returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUEncoder) IsHEVC

func (e *GPUEncoder) IsHEVC() bool

IsHEVC returns false on non-GPU builds.

func (*GPUEncoder) IsHWFrames

func (e *GPUEncoder) IsHWFrames() bool

IsHWFrames returns false on non-GPU builds.

func (*GPUEncoder) IsNativeVT

func (e *GPUEncoder) IsNativeVT() bool

IsNativeVT returns false on non-GPU builds.

type GPUFrame

type GPUFrame struct {
	Width  int
	Height int
	Pitch  int
	PTS    int64
	Format GPUFrameFormat
}

GPUFrame is a stub for non-GPU builds.

func NewGPUFrameFromDevPtr

func NewGPUFrameFromDevPtr(_ uintptr, width, height, pitch int, pts int64, format GPUFrameFormat) *GPUFrame

func (*GPUFrame) FrameSize

func (f *GPUFrame) FrameSize() int

FrameSize returns the total byte size of the frame based on its format.

func (*GPUFrame) NV12Size

func (f *GPUFrame) NV12Size() int

NV12Size returns the total byte size assuming NV12 layout. Deprecated: Use FrameSize() which is format-aware.

func (*GPUFrame) Ref

func (f *GPUFrame) Ref()

Ref is a no-op on non-GPU builds.

func (*GPUFrame) Release

func (f *GPUFrame) Release()

Release is a no-op on non-GPU builds.

func (*GPUFrame) UVPlaneHeight

func (f *GPUFrame) UVPlaneHeight() int

UVPlaneHeight returns the height of the UV/chroma plane.

func (*GPUFrame) UVPlaneOffset

func (f *GPUFrame) UVPlaneOffset() int

UVPlaneOffset returns the byte offset of the UV plane.

func (*GPUFrame) YPlaneOffset

func (f *GPUFrame) YPlaneOffset() int

YPlaneOffset returns the byte offset of the Y plane (always 0).

type GPUFrameFormat

type GPUFrameFormat int

GPUFrameFormat identifies the pixel format of a GPUFrame.

const (
	// GPUFormatNV12 is 8-bit 4:2:0 semi-planar (Y uint8 + UV uint8 interleaved).
	// Y plane: pitch * height bytes. UV plane: pitch * height/2 bytes.
	// Total: pitch * height * 3/2.
	GPUFormatNV12 GPUFrameFormat = iota

	// GPUFormatP210 is 10-bit 4:2:2 semi-planar (Y uint16 + UV uint16 interleaved).
	// Y plane: pitch * height bytes (pitch = width*2 rounded to alignment).
	// UV plane: pitch * height bytes (full height for 4:2:2).
	// Total: pitch * height * 2.
	GPUFormatP210
)

func (GPUFrameFormat) String

func (f GPUFrameFormat) String() string

String returns a human-readable name for the format.

type GPUOverlay

type GPUOverlay struct {
	Width, Height int
}

GPUOverlay is a stub for non-GPU builds.

func UploadOverlay

func UploadOverlay(ctx *Context, rgba []byte, width, height int) (*GPUOverlay, error)

UploadOverlay returns ErrGPUNotAvailable on non-GPU builds.

type GPUPipeline

type GPUPipeline struct{}

GPUPipeline is a stub for non-GPU builds.

func NewGPUPipeline

func NewGPUPipeline(ctx *Context, pool *FramePool) *GPUPipeline

NewGPUPipeline returns a stub on non-GPU builds.

func (*GPUPipeline) Build

func (p *GPUPipeline) Build(width, height, pitch int, nodes []GPUPipelineNode) error

Build returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUPipeline) BypassState

func (p *GPUPipeline) BypassState() map[string]bool

BypassState returns empty state on non-GPU builds.

func (*GPUPipeline) Close

func (p *GPUPipeline) Close() error

Close is a no-op on non-GPU builds.

func (*GPUPipeline) Pool

func (p *GPUPipeline) Pool() *FramePool

Pool returns nil on non-GPU builds.

func (*GPUPipeline) Run

func (p *GPUPipeline) Run(frame *GPUFrame) error

Run returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUPipeline) RunWithUpload

func (p *GPUPipeline) RunWithUpload(yuv []byte, width, height int, pts int64) (*GPUFrame, error)

RunWithUpload returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUPipeline) SetBypass

func (p *GPUPipeline) SetBypass(nodeName string, bypass bool) error

SetBypass returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUPipeline) SetThumbnailStore

func (p *GPUPipeline) SetThumbnailStore(store ThumbnailStore)

SetThumbnailStore is a no-op on non-GPU builds.

func (*GPUPipeline) Snapshot

func (p *GPUPipeline) Snapshot() map[string]any

Snapshot returns empty stats on non-GPU builds.

func (*GPUPipeline) Wait

func (p *GPUPipeline) Wait()

Wait is a no-op on non-GPU builds.

type GPUPipelineNode

type GPUPipelineNode interface {
	Name() string
	Configure(width, height, pitch int) error
	Active() bool
	ProcessGPU(frame *GPUFrame) error
	Err() error
	Latency() time.Duration
	Close() error
}

GPUPipelineNode is the interface for GPU pipeline processing nodes.

func NewGPUAISegmentNode

func NewGPUAISegmentNode(ctx *Context, pool *FramePool, state SegmentationState) GPUPipelineNode

NewGPUAISegmentNode returns nil on non-TensorRT builds. The pipeline filters nil nodes, so this is safely excluded from the chain.

func NewGPUColorGradeNode

func NewGPUColorGradeNode(ctx *Context, state ColorGradeState) GPUPipelineNode

NewGPUColorGradeNode returns nil on non-GPU builds.

func NewGPUCompositorNode

func NewGPUCompositorNode(ctx *Context, compositor CompositorState) GPUPipelineNode

NewGPUCompositorNode returns nil on non-GPU builds.

func NewGPUEncodeNode

func NewGPUEncodeNode(ctx *Context, encoder *GPUEncoder, forceIDR *atomic.Bool, onEncoded func([]byte, bool, int64)) GPUPipelineNode

NewGPUEncodeNode returns nil on non-GPU builds.

func NewGPUKeyNode

func NewGPUKeyNode(ctx *Context, pool *FramePool, bridge KeyBridge) GPUPipelineNode

NewGPUKeyNode returns nil on non-GPU builds.

func NewGPULayoutNode

func NewGPULayoutNode(ctx *Context, pool *FramePool, layout LayoutState) GPUPipelineNode

NewGPULayoutNode returns nil on non-GPU builds. The stub constructors are compiled but never called at runtime because initGPU returns nil, so wireGPUPipeline (which creates nodes) is skipped.

func NewGPUNeuralKeyNode

func NewGPUNeuralKeyNode(ctx *Context, pool *FramePool, state NeuralKeyState, enginePath string) GPUPipelineNode

NewGPUNeuralKeyNode returns nil on non-TensorRT builds. The pipeline filters nil nodes, so this is safely excluded from the chain.

func NewGPUPassthroughNode

func NewGPUPassthroughNode(name string, active bool) GPUPipelineNode

NewGPUPassthroughNode returns nil on non-GPU builds.

func NewGPUPreviewEncodeNode

func NewGPUPreviewEncodeNode(ctx *Context, previewW, previewH, bitrate, fpsNum, fpsDen int,
	onEncoded func(data []byte, isIDR bool, pts int64)) GPUPipelineNode

NewGPUPreviewEncodeNode returns nil on non-GPU builds.

func NewGPURawSinkNode

func NewGPURawSinkNode(ctx *Context, sink *atomic.Pointer[RawSinkFunc]) GPUPipelineNode

NewGPURawSinkNode returns nil on non-GPU builds.

func NewGPUSTMapNode

func NewGPUSTMapNode(ctx *Context, pool *FramePool, registry STMapState) GPUPipelineNode

NewGPUSTMapNode returns nil on non-GPU builds. The stub constructors are compiled but never called at runtime because initGPU returns nil, so wireGPUPipeline (which creates nodes) is skipped.

func NewGPUSharpnessNode

func NewGPUSharpnessNode(ctx *Context, state SharpnessState) GPUPipelineNode

NewGPUSharpnessNode returns nil on non-GPU builds.

type GPUSTMap

type GPUSTMap struct{ Width, Height int }

GPUSTMap is a stub for non-GPU builds.

func UploadSTMap

func UploadSTMap(ctx *Context, s, t []float32, width, height int) (*GPUSTMap, error)

UploadSTMap returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUSTMap) Free

func (m *GPUSTMap) Free()

Free is a no-op on non-GPU builds.

type GPUSourceManager

type GPUSourceManager struct{}

GPUSourceManager is a stub for non-GPU builds.

func NewGPUSourceManager

func NewGPUSourceManager(ctx *Context, pool *FramePool, stmaps SourceSTMapProvider) *GPUSourceManager

NewGPUSourceManager returns nil on non-GPU builds.

func (*GPUSourceManager) AcquireNV12Tmp

func (m *GPUSourceManager) AcquireNV12Tmp(sourceKey string, w, h int) (*GPUFrame, error)

AcquireNV12Tmp returns an error on non-GPU builds.

func (*GPUSourceManager) AliasSource

func (m *GPUSourceManager) AliasSource(dstKey, srcKey string) bool

AliasSource is a no-op on non-GPU builds.

func (*GPUSourceManager) Close

func (m *GPUSourceManager) Close()

Close is a no-op on non-GPU builds.

func (*GPUSourceManager) CurrentFrame

func (m *GPUSourceManager) CurrentFrame(sourceKey string) *GPUFrame

CurrentFrame returns nil on non-GPU builds.

func (*GPUSourceManager) GetFrame

func (m *GPUSourceManager) GetFrame(sourceKey string) *GPUFrame

GetFrame returns nil on non-GPU builds.

func (*GPUSourceManager) IngestGPUFrame

func (m *GPUSourceManager) IngestGPUFrame(sourceKey string, frame *GPUFrame, pts int64)

IngestGPUFrame is a no-op on non-GPU builds.

func (*GPUSourceManager) IngestYUV

func (m *GPUSourceManager) IngestYUV(sourceKey string, yuv []byte, w, h int, pts int64)

IngestYUV is a no-op on non-GPU builds.

func (*GPUSourceManager) Pool

func (m *GPUSourceManager) Pool() *FramePool

Pool returns nil on non-GPU builds.

func (*GPUSourceManager) ReadCachedFrame

func (m *GPUSourceManager) ReadCachedFrame(sourceKey string) (yuv []byte, w, h int, pts int64)

ReadCachedFrame returns nil on non-GPU builds.

func (*GPUSourceManager) RegisterSource

func (m *GPUSourceManager) RegisterSource(sourceKey string, w, h int, preview *PreviewConfig)

RegisterSource is a no-op on non-GPU builds.

func (*GPUSourceManager) RemoveSource

func (m *GPUSourceManager) RemoveSource(sourceKey string)

RemoveSource is a no-op on non-GPU builds.

func (*GPUSourceManager) SetSegmenter

func (m *GPUSourceManager) SetSegmenter(seg Segmenter)

SetSegmenter is a no-op on non-GPU builds.

func (*GPUSourceManager) SetSourceColorGrade

func (m *GPUSourceManager) SetSourceColorGrade(provider SourceColorGradeProvider)

SetSourceColorGrade is a no-op on non-GPU builds.

func (*GPUSourceManager) Snapshot

func (m *GPUSourceManager) Snapshot() map[string]any

Snapshot returns empty stats on non-GPU builds.

type GPUWorkQueue

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

GPUWorkQueue represents an isolated GPU execution context. On Metal: wraps an MTLCommandQueue (serial command buffer submission). On CUDA: wraps a cudaStream_t (serial kernel/memcpy execution). On stub: nil handle (no GPU operations).

func NewWorkQueue

func NewWorkQueue(ctx *Context) (*GPUWorkQueue, error)

NewWorkQueue returns ErrGPUNotAvailable on non-GPU builds.

func (*GPUWorkQueue) IsValid

func (q *GPUWorkQueue) IsValid() bool

IsValid returns true if the work queue holds a non-nil GPU handle.

type KeyBridge

type KeyBridge interface {
	HasEnabledKeysWithFills() bool
	HasEnabledKeys() bool // checks if any keys are configured+enabled, regardless of CPU fills
	SnapshotEnabledKeys() []EnabledKeySnapshot
	GPUFill(sourceKey string) *GPUFrame // returns ref'd frame from GPU cache, or nil
}

KeyBridge provides key processor state to the GPU key node. Implemented by an adapter wrapping graphics.KeyProcessorBridge.

type LayoutState

type LayoutState interface {
	Active() bool
	SnapshotSlots() []SlotSnapshot
	GPUFill(sourceKey string) *GPUFrame // returns ref'd frame from GPU cache, or nil
}

LayoutState provides layout compositor state to the GPU layout node. Implemented by an adapter wrapping dve.Compositor.

type MemoryStats

type MemoryStats struct {
	TotalMB int
	FreeMB  int
	UsedMB  int
}

MemoryStats holds GPU memory usage information.

type NeuralKeyEngine

type NeuralKeyEngine struct{}

NeuralKeyEngine is a stub for non-TensorRT builds.

func NewNeuralKeyEngine

func NewNeuralKeyEngine(ctx *Context, modelPath string, progW, progH int) (*NeuralKeyEngine, error)

NewNeuralKeyEngine returns ErrTensorRTNotAvailable on non-TensorRT builds.

func (*NeuralKeyEngine) Close

func (nke *NeuralKeyEngine) Close()

Close is a no-op on non-TensorRT builds.

func (*NeuralKeyEngine) Infer

func (nke *NeuralKeyEngine) Infer(frame *GPUFrame, keyCb, keyCr uint8, similarity, smoothness float32) error

Infer is a no-op on non-TensorRT builds.

func (*NeuralKeyEngine) InferAndComposite

func (nke *NeuralKeyEngine) InferAndComposite(programFrame, fillFrame *GPUFrame, keyCb, keyCr uint8, similarity, smoothness float32) error

InferAndComposite is a no-op on non-TensorRT builds.

func (*NeuralKeyEngine) WarmupDone

func (nke *NeuralKeyEngine) WarmupDone() bool

WarmupDone returns false on non-TensorRT builds.

type NeuralKeySnapshot

type NeuralKeySnapshot struct {
	SourceKey  string
	KeyColorY  uint8
	KeyColorCb uint8
	KeyColorCr uint8
	Similarity float32
	Smoothness float32

	// FillFrame is the source's GPU-cached NV12 frame (from GPU source manager).
	// The neural key node runs inference on this frame and composites the result
	// onto the program frame. Nil if the source has no cached frame yet.
	FillFrame *GPUFrame
}

NeuralKeySnapshot holds a deep copy of neural key parameters for one source.

type NeuralKeyState

type NeuralKeyState interface {
	// HasNeuralKeys returns true when any source has type:"neural" key enabled.
	HasNeuralKeys() bool
	// SnapshotNeuralKeys returns a deep copy of all neural key configs,
	// each with a reference to the source's GPU cached fill frame.
	SnapshotNeuralKeys() []NeuralKeySnapshot
}

NeuralKeyState provides neural key configuration to the GPU pipeline node. Unlike the original design which only checked the program source, this interface returns ALL sources with neural keys enabled — matching the upstream key pattern where keyed sources are composited onto program.

Implementations must be safe for concurrent reads from the pipeline goroutine.

type OcclusionFuseParams

type OcclusionFuseParams struct {
	DepthNear float32 // depth threshold for foreground (default 0.3)
	Softness  float32 // transition softness (default 0.1, range 0.01-0.5)
}

OcclusionFuseParams controls the depth-to-occlusion mapping.

func DefaultOcclusionFuseParams

func DefaultOcclusionFuseParams() OcclusionFuseParams

DefaultOcclusionFuseParams returns sensible defaults for occlusion fusion.

type OptixContext

type OptixContext struct{}

OptixContext is a stub for non-OptiX builds.

func NewOptixContext

func NewOptixContext(cudaCtx unsafe.Pointer) (*OptixContext, error)

NewOptixContext returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixContext) BuildIAS

func (c *OptixContext) BuildIAS(instances []OptixInstance, stream unsafe.Pointer) (*OptixIAS, error)

BuildIAS returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixContext) BuildTriangleGAS

func (c *OptixContext) BuildTriangleGAS(vertices []float32, indices []uint32, stream unsafe.Pointer) (*OptixGAS, error)

BuildTriangleGAS returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixContext) Close

func (c *OptixContext) Close()

Close is a no-op on non-OptiX builds.

func (*OptixContext) CreateModule

func (c *OptixContext) CreateModule(ptxSource []byte) (*OptixModule, error)

CreateModule returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixContext) CreatePipeline

func (c *OptixContext) CreatePipeline(config OptixPipelineConfig) (*OptixPipeline, error)

CreatePipeline returns ErrOptiXNotAvailable on non-OptiX builds.

type OptixDenoiser

type OptixDenoiser struct{}

OptixDenoiser is a stub for non-OptiX builds.

func NewOptixDenoiser

func NewOptixDenoiser(ctx *OptixContext, width, height int, temporal bool) (*OptixDenoiser, error)

NewOptixDenoiser returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixDenoiser) Close

func (d *OptixDenoiser) Close()

Close is a no-op on non-OptiX builds.

func (*OptixDenoiser) Denoise

func (d *OptixDenoiser) Denoise(noisyInput, cleanOutput, flowBuffer unsafe.Pointer,
	width, height int, stream unsafe.Pointer) error

Denoise returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixDenoiser) Height

func (d *OptixDenoiser) Height() int

Height returns 0 on non-OptiX builds.

func (*OptixDenoiser) Temporal

func (d *OptixDenoiser) Temporal() bool

Temporal returns false on non-OptiX builds.

func (*OptixDenoiser) Width

func (d *OptixDenoiser) Width() int

Width returns 0 on non-OptiX builds.

type OptixGAS

type OptixGAS struct{}

OptixGAS is a stub for non-OptiX builds.

func (*OptixGAS) Close

func (g *OptixGAS) Close()

Close is a no-op on non-OptiX builds.

func (*OptixGAS) DeviceIndices

func (g *OptixGAS) DeviceIndices() (uintptr, int)

DeviceIndices returns (0, 0) on non-OptiX builds.

func (*OptixGAS) DeviceVertices

func (g *OptixGAS) DeviceVertices() (uintptr, int)

DeviceVertices returns (0, 0) on non-OptiX builds.

type OptixIAS

type OptixIAS struct{}

OptixIAS is a stub for non-OptiX builds.

func (*OptixIAS) Close

func (ias *OptixIAS) Close()

Close is a no-op on non-OptiX builds.

func (*OptixIAS) TraversableHandle

func (ias *OptixIAS) TraversableHandle() uintptr

TraversableHandle returns 0 on non-OptiX builds.

func (*OptixIAS) Update

func (ias *OptixIAS) Update(instances []OptixInstance, stream unsafe.Pointer) error

Update returns ErrOptiXNotAvailable on non-OptiX builds.

type OptixInstance

type OptixInstance struct {
	GAS            *OptixGAS
	Transform      [12]float32
	SBTOffset      uint32
	VisibilityMask uint32
}

OptixInstance describes a GAS instance in the scene with its transform.

type OptixLaunchParams

type OptixLaunchParams struct {
	OutputBuffer    unsafe.Pointer
	Width           int
	Height          int
	IASHandle       unsafe.Pointer
	CameraPos       [3]float32
	CameraU         [3]float32
	CameraV         [3]float32
	CameraW         [3]float32
	SamplesPerPixel int
	FrameNumber     int
	Lights          unsafe.Pointer
	NumLights       int
}

OptixLaunchParams specifies parameters for a ray tracing launch.

type OptixModule

type OptixModule struct{}

OptixModule is a stub for non-OptiX builds.

func (*OptixModule) Close

func (m *OptixModule) Close()

Close is a no-op on non-OptiX builds.

type OptixPipeline

type OptixPipeline struct{}

OptixPipeline is a stub for non-OptiX builds.

func (*OptixPipeline) Close

func (p *OptixPipeline) Close()

Close is a no-op on non-OptiX builds.

func (*OptixPipeline) Launch

func (p *OptixPipeline) Launch(params OptixLaunchParams, stream unsafe.Pointer) error

Launch returns ErrOptiXNotAvailable on non-OptiX builds.

func (*OptixPipeline) SetHitGroupData

func (p *OptixPipeline) SetHitGroupData(index int, vertices, normals, texcoords, indices unsafe.Pointer,
	mat [3]float32, metallic, roughness float32, emission [3]float32,
	baseColorTex uint64, stream unsafe.Pointer) error

SetHitGroupData returns ErrOptiXNotAvailable on non-OptiX builds.

type OptixPipelineConfig

type OptixPipelineConfig struct {
	Module          *OptixModule
	RaygenEntry     string
	MissEntry       string
	ShadowMissEntry string
	ClosestHitEntry string
	AnyHitEntry     string
	MaxTraceDepth   int
}

OptixPipelineConfig specifies shader entry points for pipeline creation.

type PipelineMetrics

type PipelineMetrics struct{}

PipelineMetrics tracks GPU pipeline performance counters.

func (*PipelineMetrics) Snapshot

func (m *PipelineMetrics) Snapshot() map[string]any

Snapshot returns empty stats on non-GPU builds.

type PreviewConfig

type PreviewConfig struct {
	Width, Height  int
	Bitrate        int
	FPSNum, FPSDen int
	OnPreview      func(data []byte, isIDR bool, pts int64)
}

PreviewConfig configures per-source GPU preview encoding.

type PreviewEncodeForceIDR

type PreviewEncodeForceIDR interface {
	ForceIDR()
}

PreviewEncodeForceIDR is the subset of gpuPreviewEncodeNode needed by the app layer to force IDR keyframes on program source cuts.

type PreviewEncoder

type PreviewEncoder struct{}

PreviewEncoder is a stub for non-GPU builds.

func NewPreviewEncoder

func NewPreviewEncoder(ctx *Context, srcW, srcH, dstW, dstH, bitrate, fpsNum, fpsDen int) (*PreviewEncoder, error)

NewPreviewEncoder returns ErrGPUNotAvailable on non-GPU builds.

func (*PreviewEncoder) Close

func (p *PreviewEncoder) Close()

Close is a no-op on non-GPU builds.

func (*PreviewEncoder) Encode

func (p *PreviewEncoder) Encode(src *GPUFrame, forceIDR bool) ([]byte, bool, error)

Encode returns ErrGPUNotAvailable on non-GPU builds.

type RawSinkFunc

type RawSinkFunc func(yuv []byte, width, height int)

RawSinkFunc is a callback for raw YUV420p frames.

type Rect

type Rect struct{ X, Y, W, H int }

Rect defines a rectangle for compositing.

type STMapState

type STMapState interface {
	HasProgramMap() bool
	ProgramMapName() string
	ProgramSTArrays() (s, t []float32)
	IsAnimated() bool
	AdvanceAnimatedIndex() int
	AnimatedSTArraysAt(idx int) (s, t []float32)

	// ProgramGPUSnapshot returns an atomic snapshot of the program map state.
	// All returned values are consistent (read under a single lock hold).
	// The caller MUST call release() when done reading the S/T slices —
	// Delete() is blocked from munmapping backing memory until release().
	ProgramGPUSnapshot() (mapName string, animated bool, animIdx int, s, t []float32, release func())
}

STMapState provides ST map state to the GPU stmap node. Implemented by stmap.Registry directly (no circular dependency).

type ScaleQuality

type ScaleQuality int

ScaleQuality selects the scaling algorithm.

const (
	ScaleQualityBilinear ScaleQuality = iota
	ScaleQualityLanczos
)

type SegmentationEngine

type SegmentationEngine struct{}

SegmentationEngine is a stub for non-TensorRT builds.

func NewSegmentationEngine

func NewSegmentationEngine(ctx *Context, modelPath string) (*SegmentationEngine, error)

NewSegmentationEngine returns nil and ErrTensorRTNotAvailable on non-TensorRT builds.

func (*SegmentationEngine) ClearPendingConfig

func (se *SegmentationEngine) ClearPendingConfig(key string)

ClearPendingConfig is a no-op on non-TensorRT builds.

func (*SegmentationEngine) Close

func (se *SegmentationEngine) Close()

Close is a no-op on non-TensorRT builds.

func (*SegmentationEngine) DisableSource

func (se *SegmentationEngine) DisableSource(key string)

DisableSource is a no-op on non-TensorRT builds.

func (*SegmentationEngine) EnableSource

func (se *SegmentationEngine) EnableSource(key string, w, h int, smoothing float32) error

EnableSource returns ErrTensorRTNotAvailable on non-TensorRT builds.

func (*SegmentationEngine) HasPendingConfig

func (se *SegmentationEngine) HasPendingConfig(key string) bool

HasPendingConfig returns false on non-TensorRT builds.

func (*SegmentationEngine) IsEnabled

func (se *SegmentationEngine) IsEnabled(key string) bool

IsEnabled returns false on non-TensorRT builds.

func (*SegmentationEngine) MaskDevPtrForSource

func (se *SegmentationEngine) MaskDevPtrForSource(key string) uintptr

MaskDevPtrForSource returns 0 on non-TensorRT builds.

func (*SegmentationEngine) MaskForSource

func (se *SegmentationEngine) MaskForSource(key string) *GPUFrame

MaskForSource returns nil on non-TensorRT builds.

func (*SegmentationEngine) PendingSmoothing

func (se *SegmentationEngine) PendingSmoothing(key string) float32

PendingSmoothing returns 0 on non-TensorRT builds.

func (*SegmentationEngine) Segment

func (se *SegmentationEngine) Segment(key string, frame *GPUFrame)

Segment is a no-op on non-TensorRT builds.

func (*SegmentationEngine) SetPendingConfig

func (se *SegmentationEngine) SetPendingConfig(key string, smoothing float32)

SetPendingConfig is a no-op on non-TensorRT builds.

type SegmentationProxy

type SegmentationProxy struct{}

SegmentationProxy is a stub for non-CUDA builds.

func NewSegmentationProxy

func NewSegmentationProxy(host *sidecar.Host, pool *sidecar.CUDAGPUPool) *SegmentationProxy

NewSegmentationProxy returns nil on non-CUDA builds.

func (*SegmentationProxy) ClearPendingConfig

func (p *SegmentationProxy) ClearPendingConfig(key string)

ClearPendingConfig is a no-op on non-CUDA builds.

func (*SegmentationProxy) Close

func (p *SegmentationProxy) Close()

Close is a no-op on non-CUDA builds.

func (*SegmentationProxy) DisableSource

func (p *SegmentationProxy) DisableSource(key string)

DisableSource is a no-op on non-CUDA builds.

func (*SegmentationProxy) EnableSource

func (p *SegmentationProxy) EnableSource(key string, w, h int, smoothing float32) error

EnableSource returns an error on non-CUDA builds.

func (*SegmentationProxy) HandleMessage

func (p *SegmentationProxy) HandleMessage(msg *sidecar.Message)

HandleMessage is a no-op on non-CUDA builds.

func (*SegmentationProxy) HasPendingConfig

func (p *SegmentationProxy) HasPendingConfig(key string) bool

HasPendingConfig returns false on non-CUDA builds.

func (*SegmentationProxy) IsEnabled

func (p *SegmentationProxy) IsEnabled(key string) bool

IsEnabled returns false on non-CUDA builds.

func (*SegmentationProxy) MaskDevPtrForSource

func (p *SegmentationProxy) MaskDevPtrForSource(key string) uintptr

MaskDevPtrForSource returns 0 on non-CUDA builds.

func (*SegmentationProxy) MaskForSource

func (p *SegmentationProxy) MaskForSource(key string) *GPUFrame

MaskForSource returns nil on non-CUDA builds.

func (*SegmentationProxy) PendingSmoothing

func (p *SegmentationProxy) PendingSmoothing(key string) float32

PendingSmoothing returns 0 on non-CUDA builds.

func (*SegmentationProxy) RecoverStaleSlots

func (p *SegmentationProxy) RecoverStaleSlots()

RecoverStaleSlots is a no-op on non-CUDA builds.

func (*SegmentationProxy) ReenableSources

func (p *SegmentationProxy) ReenableSources()

ReenableSources is a no-op on non-CUDA builds.

func (*SegmentationProxy) Segment

func (p *SegmentationProxy) Segment(key string, frame *GPUFrame)

Segment is a no-op on non-CUDA builds.

func (*SegmentationProxy) SetPendingConfig

func (p *SegmentationProxy) SetPendingConfig(key string, smoothing float32)

SetPendingConfig is a no-op on non-CUDA builds.

type SegmentationState

type SegmentationState interface {
	// HasEnabledSources returns true if any source has AI segmentation active.
	HasEnabledSources() bool
	// ProgramSourceKey returns the current program source key.
	ProgramSourceKey() string
	// MaskForSource returns the latest GPU-resident segmentation mask for
	// the source, with a reference taken; callers MUST Release() it when
	// done. Returns nil if no mask is available. The returned GPUFrame is
	// a uint8 single-plane mask (255 = foreground, 0 = background).
	MaskForSource(key string) *GPUFrame
	// ConfigForSource returns the AI segmentation config for a source.
	// Returns nil if the source has no AI segmentation config.
	ConfigForSource(key string) *AISegmentConfig
}

SegmentationState provides AI segmentation state for the GPU pipeline node. Implemented by an adapter bridging SegmentationEngine + Switcher.

type Segmenter

type Segmenter interface {
	// EnableSource creates a segmentation session for a source with the
	// given frame dimensions. The smoothing parameter is accepted for API
	// compatibility (RVM uses recurrent states instead of explicit smoothing).
	EnableSource(key string, w, h int, smoothing float32) error

	// DisableSource destroys the segmentation session for a source.
	DisableSource(key string)

	// SetPendingConfig stores a deferred segmentation config for a source.
	// Called by the REST API when the source resolution is not yet known.
	SetPendingConfig(key string, smoothing float32)

	// HasPendingConfig returns true if a deferred config exists for the
	// source but no active session has been created yet.
	HasPendingConfig(key string) bool

	// PendingSmoothing returns the smoothing value for a pending config.
	PendingSmoothing(key string) float32

	// ClearPendingConfig removes the deferred config for a source.
	ClearPendingConfig(key string)

	// IsEnabled returns true if segmentation is active for the source.
	IsEnabled(key string) bool

	// Segment submits a frame for segmentation processing. The frame must
	// be GPU-resident (DevPtr in shared VRAM). Implementations may process
	// synchronously (SegmentationEngine) or asynchronously (SegmentationProxy).
	Segment(key string, frame *GPUFrame)

	// MaskForSource returns the latest GPU-resident segmentation mask with
	// a reference taken; callers MUST Release() the returned frame when
	// done so DisableSource cannot free the mask's device memory while a
	// pipeline kernel is still reading it. Returns nil if no mask is
	// available. The returned GPUFrame is a uint8 single-plane mask
	// (255 = foreground, 0 = background).
	MaskForSource(key string) *GPUFrame

	// MaskDevPtrForSource returns the raw device pointer of the mask buffer
	// for a source. Returns 0 if no active session exists. Used by the sidecar
	// to export the mask buffer as a CUDA IPC handle for zero-copy sharing.
	MaskDevPtrForSource(key string) uintptr

	// Close releases all resources.
	Close()
}

Segmenter is the interface for AI person segmentation engines. Implemented by SegmentationEngine (in-process TensorRT) and SegmentationProxy (sidecar delegation via CUDA IPC).

The source manager calls Segment() on every ingested frame for enabled sources. The pipeline node reads masks via MaskForSource(), which returns the latest GPU-resident segmentation mask with a reference taken.

type SharpnessState

type SharpnessState interface {
	SharpnessAmount() float32
}

SharpnessState provides sharpness amount to the GPU sharpness node.

type SlotSnapshot

type SlotSnapshot struct {
	Index        int
	Enabled      bool
	SourceKey    string
	Rect         Rect
	FillYUV      []byte // YUV420p source frame (deep copy, nil if no signal)
	FillW, FillH int
	FillPTS      int64
	Border       BorderSnapshot
	Alpha        float32
	ScaleMode    string     // "stretch" (default) or "fill"
	CropAnchor   [2]float64 // [x,y] 0.0-1.0, anchor point for crop (0.5,0.5 = center)

	// DVE transform fields (populated when DVE layout is active).
	DVETransform  *dve.Transform // full DVE transform (nil if simple PIP)
	DVEInvMatrix  dve.Matrix3x3  // pre-computed inverse transform matrix
	DVEIsIdentity bool           // true if no DVE effects needed (fast path)
}

SlotSnapshot is a deep-copied snapshot of one layout slot's state.

type SourceColorGradeProvider

type SourceColorGradeProvider interface {
	// SourceLUTData returns the LUT float32 data for a source, or nil if no correction.
	SourceLUTData(sourceKey string) []float32
	// SourceLUTSize returns the cube dimension (e.g., 33).
	SourceLUTSize(sourceKey string) int
	// SourceLUTGen returns a generation counter for cache invalidation.
	SourceLUTGen(sourceKey string) uint64
}

SourceColorGradeProvider supplies per-source 3D LUT data for color correction. Implemented by the corrector state manager (or any adapter that maps source keys to LUT data). The source manager checks each frame and uploads/caches the LUT on GPU memory, using the generation counter to avoid redundant uploads.

type SourceSTMapProvider

type SourceSTMapProvider interface {
	// SourceMapName returns the map name assigned to a source, or "" if none.
	SourceMapName(sourceKey string) string
	// SourceSTArrays returns the S and T float32 arrays for the source's
	// assigned map, or (nil, nil) if no map is assigned.
	SourceSTArrays(sourceKey string) (s, t []float32)
}

SourceSTMapProvider provides per-source ST map state to the GPU source manager. Implemented by stmap.Registry via SourceMapName and SourceSTArrays methods.

type TRTBinding

type TRTBinding struct {
	Name   string
	DevPtr unsafe.Pointer
	Dims   []int
}

TRTBinding describes a single named tensor binding for multi-input inference.

type TRTContext

type TRTContext struct{}

TRTContext is a stub for non-TensorRT builds.

func (*TRTContext) Close

func (c *TRTContext) Close()

Close is a no-op on non-TensorRT builds.

func (*TRTContext) Infer

func (c *TRTContext) Infer(input, output unsafe.Pointer, batchSize int, stream unsafe.Pointer) error

Infer returns ErrTensorRTNotAvailable on non-TensorRT builds.

func (*TRTContext) InferMulti

func (c *TRTContext) InferMulti(bindings []TRTBinding, stream unsafe.Pointer) error

InferMulti returns ErrTensorRTNotAvailable on non-TensorRT builds.

type TRTEngine

type TRTEngine struct{}

TRTEngine is a stub for non-TensorRT builds.

func LoadTRTPlan

func LoadTRTPlan(planPath string) (*TRTEngine, error)

LoadTRTPlan returns ErrTensorRTNotAvailable on non-TensorRT builds.

func LoadTRTPlanFromMemory

func LoadTRTPlanFromMemory(data []byte) (*TRTEngine, error)

LoadTRTPlanFromMemory returns ErrTensorRTNotAvailable on non-TensorRT builds.

func NewTRTEngine

func NewTRTEngine(onnxPath string, opts TRTEngineOpts) (*TRTEngine, error)

NewTRTEngine returns ErrTensorRTNotAvailable on non-TensorRT builds.

func NewTRTEngineV2

func NewTRTEngineV2(onnxPath string, opts TRTEngineOptsV2) (*TRTEngine, error)

NewTRTEngineV2 returns ErrTensorRTNotAvailable on non-TensorRT builds.

func (*TRTEngine) Close

func (e *TRTEngine) Close()

Close is a no-op on non-TensorRT builds.

func (*TRTEngine) Handle

func (e *TRTEngine) Handle() unsafe.Pointer

Handle returns nil on non-TensorRT builds.

func (*TRTEngine) InputSize

func (e *TRTEngine) InputSize() int

InputSize returns 0 on non-TensorRT builds.

func (*TRTEngine) NewContext

func (e *TRTEngine) NewContext() (*TRTContext, error)

NewContext returns ErrTensorRTNotAvailable on non-TensorRT builds.

func (*TRTEngine) NumIOTensors

func (e *TRTEngine) NumIOTensors() int

NumIOTensors returns 0 on non-TensorRT builds.

func (*TRTEngine) OutputSize

func (e *TRTEngine) OutputSize() int

OutputSize returns 0 on non-TensorRT builds.

func (*TRTEngine) TensorInfoAt

func (e *TRTEngine) TensorInfoAt(index int) (TensorInfo, error)

TensorInfoAt returns ErrTensorRTNotAvailable on non-TensorRT builds.

type TRTEngineOpts

type TRTEngineOpts struct {
	MaxBatchSize  int
	UseFP16       bool
	UseINT8       bool
	PlanCachePath string
}

TRTEngineOpts configures engine building.

type TRTEngineOptsV2

type TRTEngineOptsV2 struct {
	MaxBatchSize  int
	MaxSeqLen     int
	MaxEncSeqLen  int
	UseFP16       bool
	UseINT8       bool
	PlanCachePath string
}

TRTEngineOptsV2 extends TRTEngineOpts with sequence length for decoder models.

type TensorInfo

type TensorInfo struct {
	Name    string
	IsInput bool
	DType   int
	Dims    []int
}

TensorInfo describes an I/O tensor in a TensorRT engine.

type ThumbnailStore

type ThumbnailStore interface {
	ShouldCapture() bool
	Store(nodeID string, jpeg []byte, width, height int)
}

ThumbnailStore is the callback interface for storing per-node JPEG thumbnails. Stub definition for non-GPU builds.

type Timer

type Timer struct{}

Timer is a stub for non-GPU builds.

func NewTimer

func NewTimer() (*Timer, error)

NewTimer returns ErrGPUNotAvailable on non-GPU builds.

func (*Timer) Close

func (t *Timer) Close()

Close is a no-op on non-GPU builds.

func (*Timer) Start

func (t *Timer) Start(stream uintptr)

Start is a no-op on non-GPU builds.

func (*Timer) Stop

func (t *Timer) Stop(stream uintptr) float32

Stop returns 0 on non-GPU builds.

type VisibleLayerSnapshot

type VisibleLayerSnapshot struct {
	ID                 int
	Rect               Rect
	Alpha              float32 // 0.0-1.0 (fade position)
	Overlay            []byte  // RGBA pixel data (deep copy)
	OverlayW, OverlayH int
	Gen                uint64 // generation counter for cache invalidation
}

VisibleLayerSnapshot is a deep-copied snapshot of one visible layer's state.

type WipeDirection

type WipeDirection int

WipeDirection matches transition.WipeDirection values.

type WipeMapBlendConfig

type WipeMapBlendConfig struct {
	Position      float64
	SoftEdge      float64
	BorderWidth   float64
	BorderColorY  byte
	BorderColorCb byte
	BorderColorCr byte
	Reverse       bool
	Multiply      int
}

WipeMapBlendConfig holds parameters for a gradient-map-driven wipe blend.

type YUVColor

type YUVColor struct{ Y, Cb, Cr uint8 }

YUVColor defines a color in YCbCr space.

Jump to

Keyboard shortcuts

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