BlToPl#

Functions#

NVCVStatus pvaBlToPlCreate(NVCVOperatorHandle *handle, const NVCVImageRequirements *imageRequirements)

Constructs an operator instance for converting an image from Block Linear (BL) layout to Pitch Linear (PL) layout.

NVCVStatus pvaBlToPlSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVImageHandle in, NVCVImageHandle out)

Executes the BL to PL operation on NV12 images.

Functions#

NVCVStatus pvaBlToPlCreate(
NVCVOperatorHandle *handle,
const NVCVImageRequirements *imageRequirements,
)#

Constructs an operator instance for converting an image from Block Linear (BL) layout to Pitch Linear (PL) layout.

This operator is specifically designed to work with images in the NV12 format only.

PL (Pitch Linear) is the layout of most ordinary images, where elements are arranged row by row and elements within the same row are consecutive in memory. BL (Block Linear) block linear is a proprietary layout. Compared to PL layout, on a 32 bytes x 2 rows granularity (referred to as 32x2), BL layout means the elements are permuted as follows:

  • Bytes within the 32x2 are permuted.

  • Different 32x2 blocks within the image are also permuted.

NV12 is a YUV semi-planar format that has two planes: one for the Y plane and the other for the interleaved UV plane. The UV plane is subsampled, with its image width and height being half of that of the Y plane’s. For both PL and BL, the layout refers to a per-plane basis; there is no permutation of blocks across planes.

Input: Data Layout: [BL]

Image Format: NVCV_IMAGE_FORMAT_NV12 or NVCV_IMAGE_FORMAT_NV12_ER Note that NVCV APIs do not support NVCV_IMAGE_FORMAT_NV12_BL or NVCV_IMAGE_FORMAT_NV12_ER_BL, otherwise they will be more accurate.

Output: Data Layout: [PL]

Image Format: NVCV_IMAGE_FORMAT_NV12 or NVCV_IMAGE_FORMAT_NV12_ER

Input/Output Dependency:

Property

Input == Output

Data Layout

No

Image Format

Yes

Parameters:
  • handle[out] Where the operator instance handle will be written to.

    • Must not be NULL.

  • imageRequirements[in] Pointer to the NVCVImageRequirements structure which contains image width, height, data type information, and output image’s line pitch.

    • Note that the line pitch for BL layout is implicitly determined by the image width, so cannot be explicitly specified.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Possible cases include: 1) The handle or imageRequirements are either NULL or point to an invalid address. 2) The NV12 format itself is incorrect, e.g., having an odd number of rows or columns. 3) The image size is smaller than the minimum required size of 32x4. 4) Incorrect tile size for the given image size, as the tile size is currently hardcoded.

  • NVCV_ERROR_OUT_OF_MEMORY – Not enough memory to create the operator.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus pvaBlToPlSubmit(
NVCVOperatorHandle handle,
cupvaStream_t stream,
NVCVImageHandle in,
NVCVImageHandle out,
)#

Executes the BL to PL operation on NV12 images.

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid CUPVA stream.

  • in[in] Input image handle, points to the image with BL layout.

  • out[out] Output image handle, points to the image with PL layout.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Possible cases include: 1) The handle, stream, input, or output is either NULL or points to an invalid address. 2) The input or output image does not meet the requirements used to create the operator handle. 3) The metadata of the input does not correspond to the correct NV12 format (e.g., number of planes not equal to 2).

  • NVCV_ERROR_INTERNAL – Internal error in the operator; invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.