GstCUDA - libGstCUDA API: Difference between revisions

From RidgeRun Developer Wiki
No edit summary
No edit summary
Line 63: Line 63:


====gst_cuda_mapper_new====
====gst_cuda_mapper_new====
Code
<syntaxhighlight lang='C'>
GstCudaMapper *gst_cuda_mapper_new (void);
GstCudaMapper *gst_cuda_mapper_new (void);
</syntaxhighlight>


Create a newly allocated GstCudaMapper. Free with gst_cuda_mapper_free after usage.
Create a newly allocated GstCudaMapper. Free with gst_cuda_mapper_free after usage.
Line 78: Line 79:


====gst_cuda_mapper_free====
====gst_cuda_mapper_free====
Code
<syntaxhighlight lang='C'>
void gst_cuda_mapper_free (GstCudaMapper * mapper);
void gst_cuda_mapper_free (GstCudaMapper * mapper);
</syntaxhighlight>


Free a previously allocated gst_cuda_mapper_free.
Free a previously allocated gst_cuda_mapper_free.
Line 91: Line 93:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------  
------------------------------------------------------------------------------------------------------------------------------------------------------------------------  


====gst_cuda_mapper_map====
<syntaxhighlight lang='C'>
gboolean gst_cuda_mapper_map (GstCudaMapper * mapper, GstBuffer * buf,
    GstCudaBuffer ** cuda_buf);
</syntaxhighlight>
Map a GstBuffer into a GstCudaBuffer to be consumed by the GPU. Unmap with gst_cuda_mapper_unmap after usage.
<b><i>Parameters</i></b>
:: '''''mapper:''''' (in) (transfer none): A GstCudaMapper object.
:: '''''buf:''''' (in) (transfer none): The GstBuffer to take the data from.
:: '''''cuda_buf:''''' (out) (transfer full): The resulting GstCudaBuffer to be used on the GPU.
<b><i>Returns</i></b>
:: '''''gboolean:''''' true if the mapping was successful, false otherwise.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
====gst_cuda_mapper_unmap====
<syntaxhighlight lang='C'>
gboolean gst_cuda_mapper_unmap (GstCudaMapper * mapper,
    GstCudaBuffer * cuda_buf);
</syntaxhighlight>
Unmap a previously mapped GstCudaBuffer.
<b><i>Parameters</i></b>
:: '''''mapper:''''' (in) (transfer none): A GstCudaMapper object.
:: '''''cuda_buf:''''' (in) (transfer full): The GstCudaBuffer to unmap. 
<b><i>Returns</i></b>
:: '''''gboolean:''''' true if the unmap was successful, false otherwise.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
====gst_cuda_buffer_data====
<syntaxhighlight lang='C'>
void gst_cuda_buffer_data (GstCudaBuffer * buffer, GstCudaData * data);
</syntaxhighlight>
Query the pointer and data size information from a GstCudaBuffer.
<b><i>Parameters</i></b>
:: '''''buffer:''''' (in) (transfer none): The GstCudaBuffer to query the data from.
:: '''''data:''''' (out) (transfer none): The resulting associated to buffer. 
<b><i>Returns</i></b>
:: '''''void:''''' No return function.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
====gst_cuda_init====
<syntaxhighlight lang='C'>
gboolean gst_cuda_init (void);
</syntaxhighlight>
Initialize the GstCuda subsystem. This should be invoked before any other API call.
<b><i>Parameters</i></b>
:: '''''void:''''' Do not has parameters. 
<b><i>Returns</i></b>
:: '''''gboolean:''''' true if initialization was successful, false otherwise.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
}}
}}

Revision as of 01:05, 5 October 2017


GstCUDA Framework


Home

GstCUDABaseFilter



This page shows the libGstCUDA API documentation provided in the GstCUDA framework.

Description

LibGstCUDA API consists in a library that expose special structures and functions that abstracts the complexity of: handle NVMM memory type buffers, extracts the data buffer to be processed and pass it to the GPU, and recover back the processed data from the GPU to the GStreamer element. The methods implemented in the libGstCUDA API ensures an optimal performance, due to direct handling of NVMM memory type buffers and zero memory copy interface between GStreamer and CUDA.

API Documentation

Structures

GstCudaBuffer

typedef struct _GstCudaBuffer GstCudaBuffer

An opaque structure representing a data buffer.



GstCudaMapper

typedef struct _GstCudaMapper GstCudaMapper

An opaque structure representing a mapper to convert GstBuffer to GstCudaBuffer.



GstCudaChannel

typedef struct _GstCudaChannel GstCudaChannel

The image size and data information for a single image plane. I.e.; for I420 a plane could be either Y, U or V.

Members

data: A pointer to the plane data. This data can be directly consumed by CUDA.
pitch: The width of the plane plus some HW dependent extra padding.
width: The width of the plane.
height: The height of the plane.


GstCudaData

typedef struct _GstCudaData GstCudaData

Data information as an array of channels. The meaning of each channel depends on the application's color space, i.e.: for I420 they will represent Y, U and V, respectively.

Members

channels: An array of planes specified as GstCudaChannel.


Functions

gst_cuda_mapper_new

GstCudaMapper *gst_cuda_mapper_new (void);

Create a newly allocated GstCudaMapper. Free with gst_cuda_mapper_free after usage.

Parameters

void: Do not has parameters.

Returns

GstCudaMapper: (transfer full): A newly allocated GstCudaMapper


gst_cuda_mapper_free

void gst_cuda_mapper_free (GstCudaMapper * mapper);

Free a previously allocated gst_cuda_mapper_free.

Parameters

mapper: (in) (transfer none): A GstCudaMapper object.

Returns

void: No return function.


gst_cuda_mapper_map

gboolean gst_cuda_mapper_map (GstCudaMapper * mapper, GstBuffer * buf,
    GstCudaBuffer ** cuda_buf);

Map a GstBuffer into a GstCudaBuffer to be consumed by the GPU. Unmap with gst_cuda_mapper_unmap after usage.

Parameters

mapper: (in) (transfer none): A GstCudaMapper object.
buf: (in) (transfer none): The GstBuffer to take the data from.
cuda_buf: (out) (transfer full): The resulting GstCudaBuffer to be used on the GPU.

Returns

gboolean: true if the mapping was successful, false otherwise.


gst_cuda_mapper_unmap

gboolean gst_cuda_mapper_unmap (GstCudaMapper * mapper,
    GstCudaBuffer * cuda_buf);

Unmap a previously mapped GstCudaBuffer.

Parameters

mapper: (in) (transfer none): A GstCudaMapper object.
cuda_buf: (in) (transfer full): The GstCudaBuffer to unmap.

Returns

gboolean: true if the unmap was successful, false otherwise.


gst_cuda_buffer_data

void gst_cuda_buffer_data (GstCudaBuffer * buffer, GstCudaData * data);

Query the pointer and data size information from a GstCudaBuffer.

Parameters

buffer: (in) (transfer none): The GstCudaBuffer to query the data from.
data: (out) (transfer none): The resulting associated to buffer.

Returns

void: No return function.

gst_cuda_init

gboolean gst_cuda_init (void);

Initialize the GstCuda subsystem. This should be invoked before any other API call.

Parameters

void: Do not has parameters.

Returns

gboolean: true if initialization was successful, false otherwise.



GstCUDA Framework


Home

GstCUDABaseFilter