python_vali.Surface

class python_vali.Surface

Image stored in vRAM. Consists of 1+ SurfacePlane(s).

__init__(*args, **kwargs)

Methods

Clone(self)

CUDA mem alloc + deep copy.

Make(*args, **kwargs)

Overloaded function.

__init__(*args, **kwargs)

from_cai(dict, format)

DLPack: Make Surface from CAI, don not own memory.

from_dlpack(capsule, format)

DLPack: Make Surface from dlpack, don not own memory.

Attributes

Format

Get pixel format

Height

Height in pixels of plane 0.

HostSize

Amount of memory in bytes which is needed for DtoH memcopy.

IsEmpty

Tell if Surface plane has memory allocated or it's empty inside.

IsOwnMemory

Return True if Surface owns memory, False if it only references actual memory allocation but doesn't own it.

NumPlanes

Number of SurfacePlanes

Pitch

Pitch in bytes of plane 0.

Planes

Get SurfacePlane reference

Width

Width in pixels of plane 0.

Clone(self: python_vali._python_vali.Surface) python_vali._python_vali.Surface

CUDA mem alloc + deep copy. Object returned is manager by Python interpreter.

property Format

Get pixel format

property Height

Height in pixels of plane 0.

property HostSize

Amount of memory in bytes which is needed for DtoH memcopy.

property IsEmpty

Tell if Surface plane has memory allocated or it’s empty inside.

property IsOwnMemory

Return True if Surface owns memory, False if it only references actual memory allocation but doesn’t own it.

static Make(*args, **kwargs)

Overloaded function.

  1. Make(format: python_vali._python_vali.PixelFormat, width: int, height: int, gpu_id: int) -> python_vali._python_vali.Surface

    Constructor method.

    param format:

    target pixel format

    param width:

    width in pixels

    param height:

    height in pixels

    param gpu_id:

    GPU to use

  2. Make(format: python_vali._python_vali.PixelFormat, width: int, height: int, context: int) -> python_vali._python_vali.Surface

    Constructor method.

    param format:

    target pixel format

    param width:

    width in pixels

    param height:

    height in pixels

    param context:

    CUDA contet to use

property NumPlanes

Number of SurfacePlanes

property Pitch

Pitch in bytes of plane 0.

property Planes

Get SurfacePlane reference

Parameters:

plane – SurfacePlane index

property Width

Width in pixels of plane 0.

static from_cai(dict: object, format: python_vali._python_vali.PixelFormat = <PixelFormat.RGB: 2>) python_vali._python_vali.Surface

DLPack: Make Surface from CAI, don not own memory.

Parameters:
  • dict – dictionary which corresponds to CUDA Array Interface specs.

  • fmt – pixel format, by default python_vali.PixelFormat.RGB

Returns:

Surface

Return type:

python_vali.Surface

static from_dlpack(capsule: capsule, format: python_vali._python_vali.PixelFormat = <PixelFormat.RGB: 2>) python_vali._python_vali.Surface

DLPack: Make Surface from dlpack, don not own memory.

Parameters:
  • capsule – capsule object with manager dltensor inside

  • fmt – pixel format, by default python_vali.PixelFormat.RGB

Returns:

Surface

Return type:

python_vali.Surface