Functions
VXLIB_scaleImageBilinear_i8u_o8u

Functions

VXLIB_STATUS VXLIB_scaleImageBilinear_i8u_o8u (const uint8_t src[restrict], const VXLIB_bufParams2D_t *src_addr, uint8_t dst[restrict], const VXLIB_bufParams2D_t *dst_addr, VXLIB_F32 xScale, VXLIB_F32 yScale, int16_t srcOffsetX, int16_t srcOffsetY, int16_t dstOffsetX, int16_t dstOffsetY)
 
VXLIB_STATUS VXLIB_scaleImageBilinear_i8u_o8u_checkParams (const uint8_t src[restrict], const VXLIB_bufParams2D_t *src_addr, uint8_t dst[restrict], const VXLIB_bufParams2D_t *dst_addr, VXLIB_F32 xScale, VXLIB_F32 yScale, int16_t srcOffsetX, int16_t srcOffsetY, int16_t dstOffsetX, int16_t dstOffsetY)
 

Detailed Description

Function Documentation

◆ VXLIB_scaleImageBilinear_i8u_o8u()

VXLIB_STATUS VXLIB_scaleImageBilinear_i8u_o8u ( const uint8_t  src[restrict],
const VXLIB_bufParams2D_t *  src_addr,
uint8_t  dst[restrict],
const VXLIB_bufParams2D_t *  dst_addr,
VXLIB_F32  xScale,
VXLIB_F32  yScale,
int16_t  srcOffsetX,
int16_t  srcOffsetY,
int16_t  dstOffsetX,
int16_t  dstOffsetY 
)

Performs image rescale from input image (8-bit) to output image (8-bit) using bilinear interpolation. No border handling in done in this function, so it is expected that appropriate padding is done to the input buffer.

Method:
Parameters
[in]src[]Pointer to array containing first input image (UQ8.0)
[in]src_addr[]Pointer to structure containing dimensional information of src
[out]dst[]Pointer to array containing output image (UQ8.0)
[in]dst_addr[]Pointer to structure containing dimensional information of dst
[in]xScaleParameter indicating x scale factor from output to input (F32)
[in]yScaleParameter indicating y scale factor from output to input (F32)
[in]srcOffsetXParameter indicating x offset of src pointer relative to start of valid data in broader image (SQ15.0)
[in]srcOffsetYParameter indicating y offset of src pointer relative to start of valid data in broader image (SQ15.0)
[in]dstOffsetXParameter indicating x offset of dst pointer relative to start of output valid data in broader image (SQ15.0)
[in]dstOffsetYParameter indicating y offset of dst pointer relative to start of output valid data in broader image (SQ15.0)
Assumptions:
  • I/O buffer pointers are assumed to be not aliased.
  • If a user wants to divide processing of the image into smaller blocks, then it can use the dstOffsetX and dstOffsetY to indicate the starting coordinate of the output block relative to the start of the full output image, and srcOffsetX and srcOffsetY to indicate the starting coordinate of the input block relative to the start of the full input image.
  • xScale and yScale are available on the API instead of computing them internally using the buffer sizes in order to support block-based processing. The expected values are: xScale = (input image width) / (output image width) yScale = (input image height) / (output image height)
  • Be sure to allocate padding around the border (or fetch enough pad pixels from the input for interior edges when breaking into blocks), for the rescale, or else the function may fetch from an out-of-bounds memory location. For each dimension, the required fetch amount should be:

    • input block width to fetch = ((output block width + 2) * xScale) + 2
    • input block height to fetch = ((output block height + 2) * yScale) + 2

    And the amount of left/top overlap to refetch should be:

    • left edge overlap = ((input block width to fetch) - (input block width)) / 2
    • top edge overlap = ((input block height to fetch) - (input block height)) / 2
  • If padding has been applied to the start of the input image, then the src pointer should point to the start of the image including the padding, and the srcOffsetX and srcOffsetY will be negative numbers (e.g. If 2 rows and 2 columns of padding have been added, then srcOffsetX and srcOffsetY will both be -2).

◆ VXLIB_scaleImageBilinear_i8u_o8u_checkParams()

VXLIB_STATUS VXLIB_scaleImageBilinear_i8u_o8u_checkParams ( const uint8_t  src[restrict],
const VXLIB_bufParams2D_t *  src_addr,
uint8_t  dst[restrict],
const VXLIB_bufParams2D_t *  dst_addr,
VXLIB_F32  xScale,
VXLIB_F32  yScale,
int16_t  srcOffsetX,
int16_t  srcOffsetY,
int16_t  dstOffsetX,
int16_t  dstOffsetY 
)
Description:
Checks the parameters for programming errors for the VXLIB_scaleImageBilinear_i8u_o8u function.
Method:
The following checks are made:
  • There shall be no NULL pointers
  • The strides of each image shall be equal to or greater than the x dimension
Parameters
[in]src[]Pointer to array containing first input image (UQ8.0)
[in]src_addr[]Pointer to structure containing dimensional information of src
[out]dst[]Pointer to array containing output image (UQ8.0)
[in]dst_addr[]Pointer to structure containing dimensional information of dst
[in]xScaleParameter indicating x scale factor from output to input (F32)
[in]yScaleParameter indicating y scale factor from output to input (F32)
[in]srcOffsetXParameter indicating x offset of src pointer relative to start of valid data in broader image (SQ15.0)
[in]srcOffsetYParameter indicating y offset of src pointer relative to start of valid data in broader image (SQ15.0)
[in]dstOffsetXParameter indicating x offset of dst pointer relative to start of output valid data in broader image (SQ15.0)
[in]dstOffsetYParameter indicating y offset of dst pointer relative to start of output valid data in broader image (SQ15.0)

Copyright 2022, Texas Instruments Incorporated