L4T Multimedia API Reference

27.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nvee_vid_scal_col_fmt_conv.md
Go to the documentation of this file.
1 Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
2 
3 @page nvvid_scal_col_group Video Scaling and Color Format Conversion Sample
4 @{
5 
6  - [Overview](#overview)
7  - [Key Structure and Classes](#key)
8 
9 - - - - - - - - - - - - - - -
10 <a name="overview">
11 ## Overview ##
12 
13 The video scaling and color format conversion sample demonstrates how to use the
14 libv4l2 video conversion component for image color formatting and buffer layout
15 conversion.
16 
17 This sample does not require a camera.
18 
19 ![ ](nvee_video_converter.jpg)
20 
21 #### Prerequisites ####
22 Before running the sample, you must have the following:
23 
24 * README that provides details on the environment requirements to build and run the sample
25 
26 #### Additional Details
27 
28 This sample can be used to convert color format from YV12 to RGB or NV12 to YV12
29 etc. NVIDIA<sup>&reg;</sup> Tegra<sup>&reg;</sup> provides pitch linear and
30 block linear memory format support on input and output. Input and output memory
31 formats do not need to match.
32 
33  ret = ctx->conv->setOutputPlaneFormat(format.fmt.pix_mp.pixelformat,
34  format.fmt.pix_mp.width,
35  format.fmt.pix_mp.height,
36  NvVideoConverter::LAYOUT_BLOCK);
37 
38 This call is to set up libv4l2 output plane, i.e., receiving input YUV data for
39 decoder, as a block linear memory format. This is the format that complies with
40 Tegra hardware.
41 
42  ret = ctx->conv->setCapturePlaneFormat(format.fmt.pix_mp.pixelformat,
43  format.fmt.pix_mp.width,
44  format.fmt.pix_mp.height,
45  NvVideoConverter::LAYOUT_PITCH);
46 
47 This call sets up libv4l2 capture plane to be pitch linear format. This is the
48 format that is common to software implementation.
49 
50 
51 - - - - - - - - - - - - - - -
52 <a name="key">
53 ## Key Structure and Classes ##
54 
55 `v412_videoconvert_test.h` exposes the `context_t` global structure to
56 manage all the resources in the application. The key fields in that
57 structure are:
58 - [NvVideoConverter](classNvVideoConverter.html) *conv. Performs video format conversion.
59 - `std::queue < \c %NvBuffer * > *conv_output_plane_buf_queue`.
60  Holds an output plane queue for the second video converter.
61 
62 ### %NvVideoDecoder ###
63 
64 The [NvVideoDecoder](classNvVideoDecoder.html) class creates a new V4L2 Video Decoder.
65 The following table describes the key %NvVideoDecoder members that this sample uses.
66 
67 |Method|Description|
68 |---------------------|---|
69 |[setCapturePlaneFormat](classNvVideoDecoder.html#abc20773d70cfafed881238dfda6046ce)|Sets the format on the decoder capture plane.|
70 |[setOutputPlaneFormat](classNvVideoDecoder.html#a7cacbe8afce830495c25514cbd7c8efe) |Sets the format on the decoder output plane.|
71 
72 
73 ### %NvVideoConverter ###
74 
75 The [NvVideoConverter](classNvVideoConverter.html) class packages all video converting related elements and functions.
76 It performs color space conversion, scaling and
77 conversion between hardware buffer memory and software buffer memory.
78 The following table describes the key %NvVideoConverter members that this sample uses.
79 
80 |Member|Description|
81 |-------------|---|
82 |[output_plane](classNvV4l2Element.html#aaba251827cef1b23e7c42f776e95fee5) |Holds the output plane.|
83 |[capture_plane](classNvV4l2Element.html#a91806d7ed13b4b2c48758e8a02f46c6d)|Holds the capture plane.|
84 |[waitForIdle](classNvVideoConverter.html#a2f5d1a234427862adf9cae7323b5e24c) |Waits until all the buffers queued on the output plane are converted and dequeued from the capture plane. This is a blocking method.|
85 |[setCapturePlaneFormat](classNvVideoConverter.html#ad91e70f0e8b5f5a8b4deefa5a26ffe85)|Sets the format on the converter capture plane.|
86 |[setOutputPlaneFormat](classNvVideoConverter.html#a38b53f4d1e2c357360893756f417faf6) |Sets the format on the converter output plane.|
87 
88 
89 ### %NvV4l2ElementPlane ###
90 
91 [NvV4l2ElementPlane](group__ee__nvv4lelementplane__group.html) creates an [NVv4l2Element](classNvV4l2Element.html) plane.
92 The following table describes the key %NvV4l2ElementPlane members used in this sample.
93 
94 |Member |Description|
95 |-------------------|---|
96 |[setupPlane](classNvV4l2ElementPlane.html#a89959f455e5222f686187cc826b1b345) |Sets up the plane of V4l2 element.|
97 |[deinitPlane](classNvV4l2ElementPlane.html#af89cfe87d8f818beb0478bcf5b72574c) |Destroys the plane of V4l2 element.|
98 |[setStreamStatus](classNvV4l2ElementPlane.html#a03164dde4d7ab41f3e92b41e13059316) |Starts/Stops the stream.|
99 |[setDQThreadCallback](classNvV4l2ElementPlane.html#a37f213325e0e4857180f5b2319317d6a)|Sets the callback function of the `dqueue` buffer thread.|
100 |[startDQThread](classNvV4l2ElementPlane.html#a31f77f5e5ed1f320caa44a868a7cbedd) |Starts the thread of the `dqueue` buffer.|
101 |[stopDQThread](classNvV4l2ElementPlane.html#aa798d14493de321fa90aeab6d944ca87) |Stops the thread of the `dqueue` buffer.|
102 |[qBuffer](classNvV4l2ElementPlane.html#af4d52964fcfd37082f47682e457f5e95) |Queues a V4l2 buffer from the plane.|
103 |[dqBuffer](classNvV4l2ElementPlane.html#a8dfcbc666ee6f36a02abfb1170ae05cd) |Dequeues a V4l2 buffer from the plane.|
104 |[getNumBuffers](classNvV4l2ElementPlane.html#ac5cd394a7e0a4afd69395759aeac8787) |Gets the number of the V4l2 buffer.|
105 |getNumQueuedBuffers |Gets the number of the V4l2 buffer in the queue.|
106 |[getNthBuffer](classNvV4l2ElementPlane.html#a868d438908f3d267dd4af1033133892f) |Gets the \c %NvBuffer queue object at index N.|
107 
Defines a helper class for V4L2 Video Decoder.
Defines a helper class for operations performed on a V4L2 Element plane.
Class representing a buffer.
Definition: NvBuffer.h:85
Defines a helper class for V4L2 Video Converter.