nvutil

package
v0.0.0-...-98db5b7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: CC-BY-4.0 Imports: 11 Imported by: 1

Documentation

Overview

Package nvutil are functions that use the other nvidia packages and allows them to be used with each other

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchTileSet

func BatchTileSet(hlprs []*TileHelper, imgs []*jpeg.Image, tilesize npp.Size) (err error)

BatchTileSet sets a batch of helpers with a batch of imgs

func BatchTileTotalElements

func BatchTileTotalElements(helpers []*TileHelper) int32

BatchTileTotalElements returns the number of elements that make up the tiled images

func BatchTiles

func BatchTiles(h *Handle, hlprs []*TileHelper, dest *npp.Uint8, s gocu.Streamer) error

func Convert

func Convert(src, dest tensor.Volume, copier MemCopier, streamctx *npp.StreamContext) error

Convert will convert the data of A to the datatype of B and put it into B. A datatype == B datatype memory will be copied from A to B

func FindDims

func FindDims(helpers []*TileHelper) []int32

FindDims will find dims for a tensor. Will return nil if it can't be made. IE the dims of each helper isn't the same

func ImageToNppi

func ImageToNppi(img *jpeg.Image) (planar []*npp.Uint8, size npp.Size)

ImageToNppi Converts an jpeg.Image to a npp.type with its npp.Size

Types

type BatchBuffer

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

func CreateBatchBuffer

func CreateBatchBuffer(dims []int32, averagepixel float32) *BatchBuffer

CreateBatchBuffer is NCHW. And works for stand alone images

func (*BatchBuffer) FillTensor

func (b *BatchBuffer) FillTensor(h *Handle, t *tensor.Volume) error

func (*BatchBuffer) GetProperties

func (b *BatchBuffer) GetProperties() (dims []int32, nchw bool)

func (*BatchBuffer) LoadImages

func (b *BatchBuffer) LoadImages(h *Handle, imgs []*jpeg.Image, srcROIs, destROIs []npp.Rect) (err error)

LoadImages will take the images and resize them considering the srcROIs,and destROIs to the buffer.

if srcROIS and/or destROIs are nil, then it will make the ROIs that are null the size of the src and dest space.

if src or dest is not nil. Then the length needs to be the same as imgs.

func (*BatchBuffer) Mirror

func (b *BatchBuffer) Mirror(h *Handle, batches []int32, onaxis []npp.Axis) (err error)

Mirror will mirror the batches indicated in batches. len(onaxis)==len(batches) else it will cause an error

type Handle

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

func CreateHandle

func CreateHandle(ctx *npp.StreamContext, polation npp.InterpolationMode) *Handle

type MemCopier

type MemCopier interface {
	MemCopy(src, dst cutil.Mem, sib uint) error
}

type TileHelper

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

TileHelper will help tile an image

func CreateTileHelpers

func CreateTileHelpers(num int) []*TileHelper

CreateTileHelpers creates some tilehelpers

func (*TileHelper) GetDestNumOfElements

func (t *TileHelper) GetDestNumOfElements() (n int32)

GetDestNumOfElements returns the number of elements the dest location will need

func (*TileHelper) Set

func (t *TileHelper) Set(img *jpeg.Image, tilesize npp.Size) (err error)

Set sets the tilehelper

func (*TileHelper) TiledCTHW

func (t *TileHelper) TiledCTHW(h *Handle, dest *npp.Uint8, s gocu.Streamer) error

TiledCTHW converts an image to an CTHW and places it into dest

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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