1 Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 @page nvvid_scal_col_group Video Scaling and Color Format Conversion Sample
6 - [Overview](#overview)
7 - [Key Structure and Classes](#key)
9 - - - - - - - - - - - - - - -
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
17 This sample does not require a camera.
19 
21 #### Prerequisites ####
22 Before running the sample, you must have the following:
24 * README that provides details on the environment requirements to build and run the sample
26 #### Additional Details
28 This sample can be used to convert color format from YV12 to RGB or NV12 to YV12
29 etc. NVIDIA<sup>®</sup> Tegra<sup>®</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.
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);
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
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);
47 This call sets up libv4l2 capture plane to be pitch linear format. This is the
48 format that is common to software implementation.
51 - - - - - - - - - - - - - - -
53 ## Key Structure and Classes ##
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
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.
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.
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.|
73 ### %NvVideoConverter ###
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.
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.|
89 ### %NvV4l2ElementPlane ###
91 [
NvV4l2ElementPlane](group__ee__nvv4lelementplane__group.html) creates an [NVv4l2Element](classNvV4l2Element.html) plane.
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.|
Defines a helper class for V4L2 Video Decoder.
Defines a helper class for operations performed on a V4L2 Element plane.
Class representing a buffer.
Defines a helper class for V4L2 Video Converter.