hbVPRemap

typedef struct hbVPRemapParam {
  uint64_t mapPhyAddr;
  void *mapVirAddr;
  int32_t srcWidth;
  int32_t srcHeight;
  int32_t mapWidth;
  int32_t mapHeight;
  int8_t interpoType;
  int8_t borderType;
  uint8_t padValue;
  uint8_t dataType;
} hbVPRemapParam;

The visual operator hbVPRemap needs to prepare hbVPRemapParam to get hbVPMapWrap for executing the remap task before doing the creation of the task.

Note
  • The underlying gdc only supports bilinear interpolation, and does not need to configure borderType padValue parameter;

  • Since the implementation principle of gdc is different from that of dsp, the accuracy of the image output by gdc and dsp from the same map will be different;

  • GDC has the following requirements for map:

    • Map coordinates must be positive numbers;
    • Try to keep the sampling points in the same row with a smooth transition. If the transition between two points changes sharply, the accuracy of the spline will not be enough to handle it;
    • Four sampling points cannot form a triangle;
    • If the sampling accuracy is insufficient, it may cause aliasing, distortion, etc. In this case, it is recommended to use subpixel coordinates.
  • GDC supports 10-bit and 12-bit image processing. Note that 10-bit and 12-bit are only the pixel widths of the Y channel; the UV channel remains 8 bits. Furthermore, 10-bit and 12-bit Y data must be stored as 16 bits with the MSB being the most significant bit, meaning one pixel occupies two bytes. :::

  • Member

    Member NameDescription
    mapPhyAddrPhysical address of map data, data type double.
    mapVirAddrThe map data virtual address.
    srcWidthInput width.
    srcHeightInput height.
    mapWidthmap width (i.e., target width).
    mapHeightmap height (i.e., target height).
    interpoTypeInterpolation type in Remap, supports NEAREST and LINEAR types in hbVPInterpolationType.
    borderTypeReserved parameter.
    padValueReserved parameter.
    dataTypeData types in map that supports the type HB_VP_IMAGE_TYPE_F64C2 in hbVPImageType.

::: info Note

Note that the data layout in map (i.e. the memory data under the physical address of phyAddr) is x_0, y_0, x_1, y_1, ..., and the memory length should be 2 * mapWidth * mapHeight * sizeof(dataType), please refer to the sample for detailed usage.

  1. When the task is deployed on a GDC, srcWidth and mapWidth are in the range [96, 3840], and srcHeight and mapHeight are in the range [96, 2160] and satisfy: mapWidth <= srcWidth, mapHeight <= srcHeight. Since GDC has data alignment restrictions, mapWidth needs to be 16 aligned, which means that when srcWidth does not meet 16 alignment, the mapWidth will be less than srcWidth. The stride of the input and output is aligned to 16 in the width direction. When processing 8-bit images, the input and output stride range is [96, 3840]. When processing 10-bit and 12-bit images, the input and output stride range is [192, 7680]. When allocating memory, please use the height and stride size as the criteria.
  2. When the task is deployed on a DSP, srcWidth and dstWidth range [32, 4096] and srcHeight and dstHeight range [16, 2160].
typedef void *hbVPMapWrap_t;

hbVPRemap the operator's argument description handle, which contains the description information necessary to run on different Backend, can be reused.

int32_t hbVPCreateMapWrap(hbVPMapWrap_t *mapWrap, hbVPRemapParam const *param, uint64_t backend);

Creates the mapWrap parameter of the Remap.

  • Parameter
    • [out] mapWrap Created parameter that are used in the interface, the parameter must point to nullptr.
    • [in] param The remap parameter, which is used to create a uniform mapWrap parameter.
    • [in] backend Select the backend hardware, different hardware backend need to prepare different hardware resources for the map.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
Note
  1. hbVPCreateMapWrap is used to create map resources for remap. Since different backends require different hardware resources to be prepared, it is necessary to specify the backend here to determine which resource the map applies to.
  2. Interface support hardware resources for GDC, DSP. When specifying DSP deployment resources, backend needs to be set according to the hardware configuration of the development board. For example, on a single-core DSP development board, backend can be: HB_UCP_DSP_CORE_ANY, HB_UCP_DSP_CORE_0.
  3. Supports specifying both dsp and gdc backends at the same time, creating two hardware map resources respectively, such as: backend=HB_UCP_GDC_CORE_0|HB_UCP_DSP_CORE_ANY (specifies the hardware resources to create two kinds of backends, GDC and DSP, and the parameter needs to satisfy the constraints on the sizes of GDC and DSP at the same time, HB_UCP_CORE_ANY cannot be ORed with other backends).
int32_t hbVPReleaseMapWrap(hbVPMapWrap_t mapWrap);

Release the mapWrap parameter of the Remap.

  • Parameter
    • [in] mapWrap The mapWrap parameter to be released.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
int32_t hbVPRemap(hbUCPTaskHandle_t *taskHandle,
                  hbVPImage *dstImg,
                  hbVPImage const *srcImg,
                  hbVPMapWrap_t mapWrap);

The API for calling the Remap.

  • Parameter
    • [out] taskHandle Task handles are responsible for the interaction of the operator with the UCP architecture.
    • [out] dstImg The output picture, type and format are the same as the input picture, the size is the same as the map.
    • [in] srcImg Input picture, type support U8C1, format dsp hardware support Y and nv12, gdc support nv12, nv12_y10c8_msb and nv12_y12c8_msb. When using gdc to process 10-bit or 12-bit images, you need to set the image format to HB_VP_IMAGE_FORMAT_NV12_Y10C8_MSB or HB_VP_IMAGE_FORMAT_NV12_Y12C8_MSB and the type to HB_VP_IMAGE_TYPE_U16C1 for processing.
    • [in] mapWrap Point to the map parameter.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.