L4T Multimedia API Reference

32.3.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multimedia_api/ll_samples/docs/l4t_mm_transform_unit_sample.md
Go to the documentation of this file.
1 Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
2 
3 @page l4t_mm_transform_unit_sample_group transform_unit_sample
4 @{
5 
6  - [Overview](#overview)
7  - [Building and Running](#build_and_run)
8  - [Flow](#flow)
9  - [Key Structure and Classes](#key)
10 
11 
12 - - - - - - - - - - - - - - -
13 <a name="overview">
14 ## Overview ##
15 
16 The NVIDIA buffering utility, [nvbuf_utils](nvbuf__utils_8h_source.html)
17 provide a wrapper to simplify the use case of applications/plugins for
18 buffering and rransform, composite or blending.
19 
20 The transform unit sample demonstrates the use of nvbuf_utils for conversion from
21 one pixel-format to another.
22 Supported pixel formats, filters, composites and other properties are
23 described in the [nvbuf_utils](nvbuf__utils_8h_source.html).
24 
25 Supported pixel formats are:
26 * NV12
27 * NV21
28 * NV12_709
29 * ARGB32
30 * XRGB32
31 * YUV420
32 * YVU420
33 * YUV420_709
34 
35 <a name="build_and_run">
36 - - - - - - - - - - - - - - -
37 ## Building and Running ##
38 
39 ### Prerequisites
40 * You have followed steps 1-3 in @ref mmapi_build.
41 * If you are building from your host Linux PC (x86), you have followed
42  step 4 in @ref mmapi_build.
43 
44 ### To build
45 * Enter:
46 
47  $ cd $HOME/multimedia_api/samples/unittest_samples/transform_unit_sample
48  $ make
49 
50 ### To run
51 * Enter:
52 
53  $ ./transform_sample <in-file> <in-pix-fmt> <in-width> <in-height> <out-file> <out-pixfmt>
54 
55 ### To view supported options
56 Enter:
57 
58  $ ./transform_sample --help
59 
60 ### Example
61 
62  $ ./transform_sample ../../data/Video/sample_outdoor_car_1080p_10fps.yuv
63  yuv420 1920 1080 sample_outdoor_car_1080p_10fps_nv12.yuv nv12
64 
65 
66 <a name="flow">
67 - - - - - - - - - - - - - - -
68 ## Flow
69 The following steps show the flow through this sample.
70 
71 -# Create input and output DMA mapped hardware buffers.
72 -# Define the transformation parameters.
73 -# Call the @b NvBufferTransform which transforms the input DMA buffer
74  to the output DMA buffer, both exported as fd.
75 -# The application writes the transformed buffer into a file.
76 
77 
78 <a name="key">
79 - - - - - - - - - - - - - - -
80 ## Key Structure and Classes ##
81 
82 The sample uses the [nvbuf_utils](nvbuf__utils_8h_source.html) functions:
83 
84 | Element | Description |
85 | ---------------- | ----------- |
86 | [NvBufferMemMap](group__ee__nvbuffering__group.html#gab6760a1b12067b32a80e7aa9e2a98d2b) | Gets mem mapped virtual Address of the plane. |
87 | [NvBufferMemUnMap](group__ee__nvbuffering__group.html#ga5fd173847091ba84802f8f7e00ffda52) | Unmaps mapped virtual Address of the plane. |
88 | [NvBufferGetParams](group__ee__nvbuffering__group.html#gabd39426181a52065586917dfd470fa5a) | Gets the buffer parameters. |
89 | [NvBufferCreateEx](group__ee__nvbuffering__group.html#ga5d21823c3ab5f07f55ccea64deb01e96") | Allocates a hardware buffer. |
90 | [NvBufferMemSyncForCpu](group__ee__nvbuffering__group.html#ga8c26b181329a181b41498b06a4f66602) | Syncs hw memory cache for the CPU. |
91 | [NvBufferMemSyncForDevice](group__ee__nvbuffering__group.html#ga4a52fd88a031be9cca774b2c6ff98e4e) | Syncs hw memory cache for the device. |
92 | [NvBufferTransform](group__ee__nvbuffering__group.html#ga6f79642157d9930b43bd6a775a92dca9) | Transforms one DMA buffer to another DMA buffer. |
93 | [NvBufferDestroy](group__ee__nvbuffering__group.html#gab03cbe902e747420f02bb5b509b05968) | Destroys hw buffer. |
94 
95 @}
int NvBufferMemUnMap(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Unmaps the mapped virtual address of the plane.
int NvBufferMemMap(int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr)
Gets the memory-mapped virtual address of the plane.
int NvBufferTransform(int src_dmabuf_fd, int dst_dmabuf_fd, NvBufferTransformParams *transform_params)
Transforms one DMA buffer to another DMA buffer.
int NvBufferGetParams(int dmabuf_fd, NvBufferParams *params)
Gets buffer parameters.
int NvBufferCreateEx(int *dmabuf_fd, NvBufferCreateParams *input_params)
Allocates a hardware buffer.