GstCUDA - Example 1: cudafilter: Difference between revisions

From RidgeRun Developer Wiki
No edit summary
mNo edit summary
 
(30 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{GstCUDA Page |  
{{GstCUDA/Head|previous=Examples|next=Example - cudafilter: NVMM direct mapping|keywords=GstCUDA Examples,cudafilter,cudafilter example}}
[[GstCUDA - Examples | Examples]]|
[[GstCUDA - Example 2: cudadebayer | Example 2: cudadebayer]]|


This page gives an usage example of the '''''cudafilter''''' element.
This page gives an usage example of the '''''cudafilter''''' element.
Line 7: Line 5:
__TOC__
__TOC__


==Description==
== Introduction ==
'''''Under Construction'''''
GstCUDA offers two basic CUDA algorithm library examples. They are designed for the '''''cudafilter''''' element and works just out of the box, so they are perfect for training and giving the first steps on GstCUDA. The idea is to give detailed examples on how to use the '''''cudafilter''''' element, and also to give some examples of written code of a functional (out of the box) CUDA algorithm library for the '''''cudafilter''''' element. The CUDA algorithm library examples are built automatically, and you can find them under the following paths:
* '''''$GstCUDA_DIR/tests/examples/cudafilter_algorithms/memcpy/memcpy.so'''''
* '''''$GstCUDA_DIR/tests/examples/cudafilter_algorithms/gray-scale-filter/gray-scale-filter.so'''''
* '''''$GstCUDA_DIR/tests/examples/cudafilter_algorithms/median-filter/median-filter.so'''''


The '''''memcpy.so''''' CUDA algorithm library consists of a very basic algorithm that receives a full-color YUV I420 image and generates an exact copy of the incoming image. It is a basic image filter that copies the luminance and chrominance components of the incoming image. The image copy is executed on the GPU, so it is hardware accelerated, that assures optimal performance. This basic algorithm is just for example and demonstration purposes because it shows the capability of GstCUDA to execute an algorithm on the GPU that goes through each pixel in the incoming image and copies it to the output image. This can be a high load task if we consider a 4K@60fps video stream, due to the high data transaction rate, but GstCUDA could handle it with no problem.


==Example pipeline==
The '''''gray-scale-filter.so''''' CUDA algorithm library consists of a very basic algorithm that receives a full-color YUV I420 image and converts it to a gray-scale YUV I420 image. It is a basic image filter that modifies the chrominance components of the image by assigning a fixed value that makes the image look in a gray-scale. All the processing of the image is done in the GPU.
'''''Under Construction'''''


The '''''median-filter.so''''' CUDA algorithm is a basic implementation of a median filter that takes a full-color YUV I420 image and applies a median filter to the image. This allows removing basic salt-and-pepper noise in an image. The filter process is done in the GPU.


==Execution results==
GstCUDA supports two modes of memory handling. NVMM direct mapping mode uses the CUDA mapper and the element receives NVMM memory type buffers as input. Unified memory allocator mode avoids the use of NVMM memory buffers by providing a memory allocator that directly passes the buffer to the GPU. Both modes are supported for Jetpack 3.0, however, NVMM direct mapping mode is not supported for Jetpack 3.1.
'''''Under Construction'''''


Below you will find a set of test pipelines for both modes, with their respective performance stats for each CUDA algorithm library.


==Performance stats==
'''''Note:''''' To get the best performance on the Tegra platform, you must execute the jetson_clocks.sh script. This script tune-up the Tegra to high-performance mode. All the reported performance stats came from tests done after ran the jetson_clocks.sh script.
'''''Under construction'''''
Execute command: ''sudo ~/jetson_clocks.sh''


== Examples Index ==
<html>
  <div class="toc" style="font-size:80%;">
    <ol>
      <li> <a href=https://developer.ridgerun.com/wiki/index.php?title=GstCUDA_-_Example_-_cudafilter:_NVMM_direct_mapping>NVMM direct mapping mode</a></li>
      <li> <a href=https://developer.ridgerun.com/wiki/index.php?title=GstCUDA_-_Example_-_cudafilter:_Unified_memory_allocator>Unified memory allocator mode</a></li>
    </ol>
  </div>
</html>


}}
{{GstCUDA/Foot|previous=Examples|next=Example - cudafilter: NVMM direct mapping|keywords=GstCUDA Examples,cudafilter,cudafilter example}}

Latest revision as of 13:19, 15 September 2020



Previous: Examples Index Next: Example - cudafilter: NVMM direct mapping




This page gives an usage example of the cudafilter element.

Introduction

GstCUDA offers two basic CUDA algorithm library examples. They are designed for the cudafilter element and works just out of the box, so they are perfect for training and giving the first steps on GstCUDA. The idea is to give detailed examples on how to use the cudafilter element, and also to give some examples of written code of a functional (out of the box) CUDA algorithm library for the cudafilter element. The CUDA algorithm library examples are built automatically, and you can find them under the following paths:

  • $GstCUDA_DIR/tests/examples/cudafilter_algorithms/memcpy/memcpy.so
  • $GstCUDA_DIR/tests/examples/cudafilter_algorithms/gray-scale-filter/gray-scale-filter.so
  • $GstCUDA_DIR/tests/examples/cudafilter_algorithms/median-filter/median-filter.so

The memcpy.so CUDA algorithm library consists of a very basic algorithm that receives a full-color YUV I420 image and generates an exact copy of the incoming image. It is a basic image filter that copies the luminance and chrominance components of the incoming image. The image copy is executed on the GPU, so it is hardware accelerated, that assures optimal performance. This basic algorithm is just for example and demonstration purposes because it shows the capability of GstCUDA to execute an algorithm on the GPU that goes through each pixel in the incoming image and copies it to the output image. This can be a high load task if we consider a 4K@60fps video stream, due to the high data transaction rate, but GstCUDA could handle it with no problem.

The gray-scale-filter.so CUDA algorithm library consists of a very basic algorithm that receives a full-color YUV I420 image and converts it to a gray-scale YUV I420 image. It is a basic image filter that modifies the chrominance components of the image by assigning a fixed value that makes the image look in a gray-scale. All the processing of the image is done in the GPU.

The median-filter.so CUDA algorithm is a basic implementation of a median filter that takes a full-color YUV I420 image and applies a median filter to the image. This allows removing basic salt-and-pepper noise in an image. The filter process is done in the GPU.

GstCUDA supports two modes of memory handling. NVMM direct mapping mode uses the CUDA mapper and the element receives NVMM memory type buffers as input. Unified memory allocator mode avoids the use of NVMM memory buffers by providing a memory allocator that directly passes the buffer to the GPU. Both modes are supported for Jetpack 3.0, however, NVMM direct mapping mode is not supported for Jetpack 3.1.

Below you will find a set of test pipelines for both modes, with their respective performance stats for each CUDA algorithm library.

Note: To get the best performance on the Tegra platform, you must execute the jetson_clocks.sh script. This script tune-up the Tegra to high-performance mode. All the reported performance stats came from tests done after ran the jetson_clocks.sh script. Execute command: sudo ~/jetson_clocks.sh

Examples Index


Previous: Examples Index Next: Example - cudafilter: NVMM direct mapping