# V4L2 Video Converter

NVIDIA Tegra V4L2 Video Converter Description and Extensions. More...

## Defines

#define | V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+520)
| Control ID to set converter output plane buffer layout.
#define | V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+521)
| Control ID to set converter capture plane buffer layout.
#define | V4L2_CID_VIDEO_CONVERT_FLIP_METHOD (V4L2_CID_MPEG_BASE+522)
| Control ID to set the converter flip/rotation method.
#define | V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD (V4L2_CID_MPEG_BASE+523)
| Control ID to set the converter interpolation method.
#define | V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM (V4L2_CID_MPEG_BASE+524)
| Control ID to set the converter Temporal Noise Reduction (TNR) Algorithm.

## Enumerations

enum | v4l2_nv_buffer_layout { V4L2_NV_BUFFER_LAYOUT_PITCH = 0, V4L2_NV_BUFFER_LAYOUT_BLOCKLINEAR = 1 }
| Enum specifying types of buffer layouts. More...
enum | v4l2_flip_method { V4L2_FLIP_METHOD_IDENTITY = 0, V4L2_FLIP_METHOD_90L = 1, V4L2_FLIP_METHOD_180 = 2, V4L2_FLIP_METHOD_90R = 3, V4L2_FLIP_METHOD_HORIZ = 4, V4L2_FLIP_METHOD_INVTRANS = 5, V4L2_FLIP_METHOD_VERT = 6, V4L2_FLIP_METHOD_TRANS = 7 }
| Enum specifying types of rotation/flip algorithms. More...
enum | v4l2_interpolation_method { V4L2_INTERPOLATION_NEAREST = 1, V4L2_INTERPOLATION_LINEAR = 2, V4L2_INTERPOLATION_SMART = 3, V4L2_INTERPOLATION_BILINEAR = 4 }
| Enum specifying types of interpolation methods. More...
enum | v4l2_tnr_algorithm { V4L2_TNR_ALGO_ORIGINAL = 0, V4L2_TNR_ALGO_OUTDOOR_LOW_LIGHT = 1, V4L2_TNR_ALGO_OUTDOOR_MEDIUM_LIGHT = 2, V4L2_TNR_ALGO_OUTDOOR_HIGH_LIGHT = 3, V4L2_TNR_ALGO_INDOOR_LOW_LIGHT = 4, V4L2_TNR_ALGO_INDOOR_MEDIUM_LIGHT = 5, V4L2_TNR_ALGO_INDOOR_HIGH_LIGHT = 6 }
| Enum specifying types of TNR algorithms. More...

## Detailed Description

NVIDIA Tegra V4L2 Video Converter Description and Extensions.

Video converter can be used for color space conversion, scaling and conversion between hardware buffer memory (V4L2_MEMORY_MMAP/ V4L2_MEMORY_DMABUF) and software buffer memory (V4L2_MEMORY_USERPTR) and other operations such as cropping, flipping/rotating and temporal noise reduction (TNR). The video converter device node is "/dev/nvhost-vic".

### Supported pixelformats: PIXEL FORMAT | PIXEL FORMAT :---------------------: | :--------------: V4L2_PIX_FMT_YUV444M | V4L2_PIX_FMT_YVU422M V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_YVU420M V4L2_PIX_FMT_NV12M | V4L2_PIX_FMT_GREY V4L2_PIX_FMT_YUYV | V4L2_PIX_FMT_YVYU V4L2_PIX_FMT_UYVY | V4L2_PIX_FMT_VYUY V4L2_PIX_FMT_ABGR32 | V4L2_PIX_FMT_XBGR32

### Supported pixelformats for TNR: PIXEL FORMAT | PIXEL FORMAT :---------------------: | :--------------: V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_NV12M V4L2_PIX_FMT_UYVY | V4L2_PIX_FMT_YUYV

### Supported memory types: MEMORY | OUTPUT PLANE | CAPTURE PLANE :------------------: | :----------: | :-----------: V4L2_MEMORY_MMAP | Y | Y V4L2_MEMORY_DMABUF | Y | Y V4L2_MEMORY_USERPTR | Y | Y

### Supported controls:

- V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT
- V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT
- V4L2_CID_VIDEO_CONVERT_FLIP_METHOD
- V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD
- V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM

### Cropping: Video converter supports cropping using VIDIOC_S_SELECTION ioctl with type V4L2_BUF_TYPE_VIDEO_CAPTURE and target V4L2_SEL_TGT_CROP. This should be set before requesting buffers on either plane.

### EOS Handling: Following sequence should be followed for sending EOS and recieving EOS from the converter.

1. Send EOS to converter by queueing on the output plane a buffer with bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`).
2. Dequeue buffers on the capture plane, till it gets a buffer with bytesused = 0 for the 0th plane.

## Define Documentation

#define V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+521)

Control ID to set converter capture plane buffer layout.

A value of type v4l2_nv_buffer_layout should be supplied with this control.

Attention:
  This control should be set before requesting buffers on the capture plane.

Definition at line 552 of file v4l2_nv_extensions.h.

#define V4L2_CID_VIDEO_CONVERT_FLIP_METHOD (V4L2_CID_MPEG_BASE+522)

Control ID to set the converter flip/rotation method.

A value of type v4l2_flip_method should be supplied with this control.

Attention:
  This control should be set before requesting buffers on either plane.

Definition at line 561 of file v4l2_nv_extensions.h.

#define V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD (V4L2_CID_MPEG_BASE+523)

Control ID to set the converter interpolation method.

A value of type v4l2_interpolation_method should be supplied with this control.

Attention:
  This control should be set before requesting buffers on either plane.

Definition at line 570 of file v4l2_nv_extensions.h.

#define V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+520)

Control ID to set converter output plane buffer layout.

A value of type v4l2_nv_buffer_layout should be supplied with this control.

Attention:
  This control should be set before requesting buffers on the output plane.

Definition at line 543 of file v4l2_nv_extensions.h.

#define V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM (V4L2_CID_MPEG_BASE+524)

Control ID to set the converter Temporal Noise Reduction (TNR) Algorithm.

A value of type v4l2_tnr_algorithm should be supplied with this control.

Attention:
  This control should be set before requesting buffers on either plane.

  TNR algorithms are not supported with YUV422 and YUV444 capture plane formats.

Definition at line 581 of file v4l2_nv_extensions.h.

## Enumeration Type Documentation

enum v4l2_flip_method

Enum specifying types of rotation/flip algorithms.

Enumerator:

  V4L2_FLIP_METHOD_IDENTITY | Identity (no rotation).
  V4L2_FLIP_METHOD_90L | Rotate counter-clockwise 90 degrees.
  V4L2_FLIP_METHOD_180 | Rotate 180 degrees.
  V4L2_FLIP_METHOD_90R | Rotate clockwise 90 degrees.
  V4L2_FLIP_METHOD_HORIZ | Flip horizontally.
  V4L2_FLIP_METHOD_INVTRANS | Flip across upper right/lower left diagonal.
  V4L2_FLIP_METHOD_VERT | Flip vertically.
  V4L2_FLIP_METHOD_TRANS | Flip across upper left/lower right diagonal.

Definition at line 1176 of file v4l2_nv_extensions.h.

enum v4l2_interpolation_method

Enum specifying types of interpolation methods.

Enumerator:

  V4L2_INTERPOLATION_NEAREST | Nearest interpolation method.
  V4L2_INTERPOLATION_LINEAR | Linear interpolation method.
  V4L2_INTERPOLATION_SMART | Smart interpolation method.
  V4L2_INTERPOLATION_BILINEAR | Bi-Linear interpolation method.

Definition at line 1190 of file v4l2_nv_extensions.h.

enum v4l2_nv_buffer_layout

Enum specifying types of buffer layouts.

Enumerator:

  V4L2_NV_BUFFER_LAYOUT_PITCH | Pitch Linear Layout.
  V4L2_NV_BUFFER_LAYOUT_BLOCKLINEAR | Block Linear Layout.

Definition at line 1168 of file v4l2_nv_extensions.h.

enum v4l2_tnr_algorithm

Enum specifying types of TNR algorithms.

Enumerator:

  V4L2_TNR_ALGO_ORIGINAL | Default TNR Algorithm.
  V4L2_TNR_ALGO_OUTDOOR_LOW_LIGHT | Outdoor Low Light TNR Algorithm.
  V4L2_TNR_ALGO_OUTDOOR_MEDIUM_LIGHT | Outdoor Medium Light TNR Algorithm.
  V4L2_TNR_ALGO_OUTDOOR_HIGH_LIGHT | Outdoor High Light TNR Algorithm.
  V4L2_TNR_ALGO_INDOOR_LOW_LIGHT | Indoor Low Light TNR Algorithm.
  V4L2_TNR_ALGO_INDOOR_MEDIUM_LIGHT | Indoor Medium Light TNR Algorithm.
  V4L2_TNR_ALGO_INDOOR_HIGH_LIGHT | Indoor High Light TNR Algorithm.

Definition at line 1200 of file v4l2_nv_extensions.h.