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 hbVPWarpParam to get hbVPMapWrap for executing the remap task before doing the creation of the task.

Note
  • The underlying gdc uses bilinear interpolation by default, and does not need to configure the interpoType, borderType, and 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.
  • 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.
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 [100, 3840], and srcHeight and mapHeight are in the range [100, 2160] and satisfy: mapWidth <= srcWidth, mapHeight <= srcHeight. Due to the GDC's alignment constraints, the input stride must be aligned to 16 pixels in the width direction. Thus, the input and output stride are in the range [112,3840]. 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. Due to the multi-core nature of the DSP, when specifying DSP deployment resources, the backend can be set to HB_UCP_DSP_CORE_ANY, HB_UCP_DSP_CORE_0 and HB_UCP_DSP_CORE_1 without distinguishing the core ID. The specific backend will be selected based on the development environment.
  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.
    • [in] mapWrap Point to the map parameter.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.