Image 2D (nvmimg_2d)

The NvMedia Image 2D sample application nvmimg_2d demonstrates how to use the NvMedia Image 2D API to execute a single NvMedia2DCompose test case defined in .cfg format for NvMediaImage conversion.

The application requires you to provide command line input as well as a group of settings as defined in the configuration file.

Usage

The command syntax is:

$ nvmimg_2d <config filename>

Configuration File Structure

The configuration file structure consists of parameters, assigned values, and comments. Parameter values are assigned with a line such as Parameter = Value in the configuration file. Lines starting with # are comments.

The sample application contains example configuration files (.cfg).

Surface Data File Format

The input and output files (configured with SrcLayerXInputFile and DstOutputFile configuration parameters) contain the surface pixel data as binary dump. The exact layout of the data is determined by the file I/O mode and the surface format set with the configuration parameters.

Configuration Parameters

The following table describes the configuration parameters.

The X in parameters starting with SrcLayerX is an integer in range 1-16.

The Y in parameters containing the string PlaneY is an integer in range 1-3.

Parameter Description Type Range
FileIOMode

Defines how the surface data in input and output files are interpreted.

Valid values:
    • NvSci
    • LineByLine

With NvSci, NvSciBufObjGetPixels() and NvSciBufObjPutPixels() functions are used. This means that for all YUV surface formats, including planar, semiplanar and interleaved, the surface data file format has planar layout with the planes in Y, U, V order.

With LineByLine, a simple copy of the surface data occurs line-by-line, discarding any padding.

Optional. If not set, defaults to NvSci.

STRING See description
SrcLayerXInputFile File where the surface data for the source layer is read. Mandatory if the layer is used. STRING Max 256 char
SrcLayerXLayout

Memory layout to use for the source surface.

Valid values:

  • BlockLinear
  • PitchLinear

Mandatory if the layer is used.

STRING See description
SrcLayerXScanType

Scan type to use for the source surface.

Valid values:

  • Progressive
  • Interlace

Mandatory if the layer is used.

STRING See description
SrcLayerXPlaneYColorFormat

Color format to use for the source surface plane.

Valid values:

  • U8V8
  • U8_V8
  • V8U8
  • V8_U8
  • U10V10
  • V10U10
  • U12V12
  • V12U12
  • U16V16
  • V16U16
  • Y8
  • Y10
  • Y12
  • Y16
  • U8
  • V8
  • U10
  • V10
  • U12
  • V12
  • U16
  • V16
  • A8Y8U8V8
  • Y8U8Y8V8
  • Y8V8Y8U8
  • U8Y8V8Y8
  • V8Y8U8Y8
  • A16Y16U16V16
  • A8
  • B8G8R8A8
  • A8R8G8B8
  • A8B8G8R8
  • A2R10G10B10
  • A16B16G16R16

Mandatory if the plane is used.

STRING See description
SrcLayerXPlaneYColorStandard

Color standard to use for the source surface plane.

Valid values:

  • SRGB
  • REC601_SR
  • REC601_ER
  • REC709_SR
  • REC709_ER
  • REC2020_RGB
  • REC2020_SR
  • REC2020_ER
  • YcCbcCrc_SR
  • YcCbcCrc_ER
  • SENSOR_RGBA
  • REQ2020PQ_ER

Optional. If set for one plane, set the value for all planes of the surface.

STRING See description
SrcLayerXPlaneYWidth Width of the source surface plane. Mandatory if the plane is used. UINT

16 - 16384

16 - 8192 if color format with 16-bit components is used.

SrcLayerXPlaneYHeight Height of the source surface plane. Mandatory if the plane is used. UINT

16 - 16384

16 - 8192 if color format with 16-bit components is used.

SrcLayerXSrcRectLeft The source layer’s source rectangle left coordinate. Optional. If set, all layer’s source rectangle coordinates must be set. UINT 0 – source surface width
SrcLayerXSrcRectTop The source layer’s source rectangle top coordinate. Optional. If set, all layer’s source rectangle coordinates must be set. UINT 0 – source surface height
SrcLayerXSrcRectRight The source layer’s source rectangle right coordinate. Optional. If set, all layer’s source rectangle coordinates must be set. UINT 0 – source surface width
SrcLayerXSrcRectBottom The source layer’s source rectangle bottom coordinate. Optional. If set, all layer’s source rectangle coordinates must be set. UINT 0 – source surface height
SrcLayerXDstRectLeft The source layer’s destination rectangle left coordinate. Optional. If set, all layer’s destination rectangle coordinates must be set. UINT 0 – destination surface width
SrcLayerXDstRectTop The source layer’s destination rectangle top coordinate. Optional. If set, all layer’s destination rectangle coordinates must be set. UINT 0 – destination surface height
SrcLayerXDstRectRight The source layer’s destination rectangle right coordinate. Optional. If set, all layer’s destination rectangle coordinates must be set. UINT 0 – destination surface width
SrcLayerXDstRectBottom The source layer’s destination rectangle bottom coordinate. Optional. If set, all layer’s destination rectangle coordinates must be set. UINT 0 – destination surface height
SrcLayerXTransform

Transformation to apply for the source layer.

Valid values:

  • None
  • Rotate90
  • Rotate180
  • Rotate270
  • FlipHorizontal
  • InvTranspose
  • FlipVertical
  • Transpose

Optional

STRING See description
SrcLayerXFiltering

Filtering to apply for the source layer.

Valid values:

  • Off
  • Low
  • Medium
  • High

Optional

STRING See description
SrcLayerXBlending

Blending to apply for the source layer.

Valid values:

  • Disabled
  • ConstantAlpha
  • StraightAlpha
  • PremultipliedAlpha

Optional

STRING See description
SrcLayerXBlendingConstantAlpha Constant alpha factor to use in blending. Mandatory if blending is configured for the layer. FLOAT 0.0 – 1.0
DstOutputFile File where the destination surface data is written to. Mandatory. STRING Max 256 char
DstLayout Memory layout to use for the destination surface. See SrcLayerXLayout for valid values. Mandatory. STRING See description
DstScanType Scan type to use for the destination surface. See SrcLayerXScanType for valid values. Mandatory. STRING See description
DstPlaneYColorFormat Color format to use for the destination surface plane. See SrcLayerXPlaneYColorFormat for valid values. Mandatory if the plane is used. STRING See description
DstPlaneYColorStandard Color standard to use for the destination surface plane. See SrcLayerXPlaneYColorStandard for valid values. Optional. If set for one plane,the value must be set for all planes of the surface. STRING See description
DstPlaneYWidth Width of the destination surface plane. Mandatory if the plane is used. UINT

16 - 16384

16 - 8192 if color format with 16-bit components is used.

DstPlaneYHeight Height of the destination surface plane. Mandatory if the plane is used. UINT

16 - 16384

16 - 8192 if color format with 16-bit components is used.