PyNvCodec.Surface

class PyNvCodec.Surface
__init__(*args, **kwargs)

Methods

Clone(*args, **kwargs)

Overloaded function.

CopyFrom(*args, **kwargs)

Overloaded function.

Crop(*args, **kwargs)

Overloaded function.

Empty(self)

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

Format(self)

Get pixel format

Height(self[, plane])

Height in pixels.

HostSize(self)

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

Make(*args, **kwargs)

Overloaded function.

NumPlanes(self)

Number of SurfacePlanes

OwnMemory(self)

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

Pitch(self[, plane])

Pitch in bytes.

PlanePtr(self[, plane])

Get SurfacePlane reference

Width(self[, plane])

Width in pixels.

__init__(*args, **kwargs)

Clone(*args, **kwargs)

Overloaded function.

  1. Clone(self: PyNvCodec._PyNvCodec.Surface) -> PyNvCodec._PyNvCodec.Surface

    Deep copy = CUDA mem alloc + CUDA mem copy. Will use CUDA context associated with CUDA memory object and default CUDA stream.

  2. Clone(self: PyNvCodec._PyNvCodec.Surface, gpu_id: int) -> PyNvCodec._PyNvCodec.Surface

    Deep copy = CUDA mem alloc + CUDA mem copy

    param gpu_id:

    GPU to use

  3. Clone(self: PyNvCodec._PyNvCodec.Surface, context: int, stream: int) -> PyNvCodec._PyNvCodec.Surface

    Deep copy = CUDA mem alloc + CUDA mem copy

    param context:

    CUDA contet to use

    param stream:

    CUDA stream to use

CopyFrom(*args, **kwargs)

Overloaded function.

  1. CopyFrom(self: PyNvCodec._PyNvCodec.Surface, other: PyNvCodec._PyNvCodec.Surface, gpu_id: int) -> None

    Perform DtoD memcopy

    param other:

    other Surface

    param gpu_id:

    GPU to use

  2. CopyFrom(self: PyNvCodec._PyNvCodec.Surface, other: PyNvCodec._PyNvCodec.Surface, context: int, stream: int) -> None

    Perform DtoD memcopy

    param other:

    other Surface

    param context:

    CUDA contet to use

    param stream:

    desc

Crop(*args, **kwargs)

Overloaded function.

  1. Crop(self: PyNvCodec._PyNvCodec.Surface, x: int, y: int, w: int, h: int, gpu_id: int) -> PyNvCodec._PyNvCodec.Surface

    Crop = select ROI + CUDA mem alloc + CUDA mem copy

    param x:

    ROI top left X coordinate

    param y:

    ROI top left Y coordinate

    param w:

    ROI width in pixels

    param h:

    ROI height in pixels

    param gpu_id:

    GPU to use

  2. Crop(self: PyNvCodec._PyNvCodec.Surface, x: int, y: int, w: int, h: int, context: int, stream: int) -> PyNvCodec._PyNvCodec.Surface

    Crop = select ROI + CUDA mem alloc + CUDA mem copy

    param x:

    ROI top left X coordinate

    param y:

    ROI top left Y coordinate

    param w:

    ROI width in pixels

    param h:

    ROI height in pixels

    param context:

    CUDA contet to use

    param stream:

    CUDA stream to use

Empty(self: PyNvCodec._PyNvCodec.Surface) bool

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

Format(self: PyNvCodec._PyNvCodec.Surface) PyNvCodec._PyNvCodec.PixelFormat

Get pixel format

Height(self: PyNvCodec._PyNvCodec.Surface, plane: int = 0) int

Height in pixels. Please note that different SurfacePlane may have different dimensions depending on pixel format.

Parameters:

plane – SurfacePlane index

HostSize(self: PyNvCodec._PyNvCodec.Surface) int

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

static Make(*args, **kwargs)

Overloaded function.

  1. Make(format: PyNvCodec._PyNvCodec.PixelFormat, width: int, height: int, gpu_id: int) -> PyNvCodec._PyNvCodec.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: PyNvCodec._PyNvCodec.PixelFormat, width: int, height: int, context: int) -> PyNvCodec._PyNvCodec.Surface

    Constructor method.

    param format:

    target pixel format

    param width:

    width in pixels

    param height:

    height in pixels

    param context:

    CUDA contet to use

NumPlanes(self: PyNvCodec._PyNvCodec.Surface) int

Number of SurfacePlanes

OwnMemory(self: PyNvCodec._PyNvCodec.Surface) bool

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

Pitch(self: PyNvCodec._PyNvCodec.Surface, plane: int = 0) int

Pitch in bytes. Please note that different SurfacePlane may have different dimensions depending on pixel format.

Parameters:

plane – SurfacePlane index

PlanePtr(self: PyNvCodec._PyNvCodec.Surface, plane: int = 0) PyNvCodec._PyNvCodec.SurfacePlane

Get SurfacePlane reference

Parameters:

plane – SurfacePlane index

Width(self: PyNvCodec._PyNvCodec.Surface, plane: int = 0) int

Width in pixels. Please note that different SurfacePlane may have different dimensions depending on pixel format.

Parameters:

plane – SurfacePlane index