Jetson Linux Multimedia API Reference

32.4.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
transform_unit_sample

Overview

The NVIDIA buffering utility, nvbuf_utils provide a wrapper to simplify the use case of applications/plugins for buffering and rransform, composite or blending.

The transform unit sample demonstrates the use of nvbuf_utils for conversion from one pixel-format to another. Supported pixel formats, filters, composites and other properties are described in the nvbuf_utils.

Supported pixel formats are:

  • NV12
  • NV21
  • NV12_709
  • ARGB32
  • XRGB32
  • YUV420
  • YVU420
  • YUV420_709


Building and Running

Prerequisites

To build

  • Enter:
     $ cd $HOME/multimedia_api/samples/unittest_samples/transform_unit_sample
     $ make
    

To run

  • Enter:
     $ ./transform_sample <in-file> <in-pix-fmt> <in-width> <in-height> <out-file> <out-pixfmt>
    

To view supported options

Enter:

   $ ./transform_sample --help

Example

  $ ./transform_sample ../../data/Video/sample_outdoor_car_1080p_10fps.yuv
  yuv420 1920 1080 sample_outdoor_car_1080p_10fps_nv12.yuv nv12


Flow

The following steps show the flow through this sample.

  1. Create input and output DMA mapped hardware buffers.
  2. Define the transformation parameters.
  3. Call the NvBufferTransform which transforms the input DMA buffer to the output DMA buffer, both exported as fd.
  4. The application writes the transformed buffer into a file.


Key Structure and Classes

The sample uses the nvbuf_utils functions:

Element Description
NvBufferMemMap Gets mem mapped virtual Address of the plane.
NvBufferMemUnMap Unmaps mapped virtual Address of the plane.
NvBufferGetParams Gets the buffer parameters.
NvBufferCreateEx Allocates a hardware buffer.
NvBufferMemSyncForCpu Syncs hw memory cache for the CPU.
NvBufferMemSyncForDevice Syncs hw memory cache for the device.
NvBufferTransform Transforms one DMA buffer to another DMA buffer.
NvBufferDestroy Destroys hw buffer.