图像内存管理函数

用于分配和释放带跨距图像存储的例程。

这些方法为了方便而提供。它们分配的内存可能在每行像素的末尾包含额外的填充字节。虽然填充对于任何 NPP 图像处理原语的正确工作都不是必需的,但与正确填充的图像相比,缺少填充可能会导致严重的性能下降。

这些函数可以在 nppisu 库中找到。仅链接您使用的子库可以显著节省链接时间、应用程序加载时间和使用动态库时的 CUDA 运行时启动时间。

图像内存分配

用于 2D 数据数组的 ImageAllocator 方法。

分配器具有宽度和高度参数,用于指定要分配的图像数据的大小。它们返回指向新创建的内存的指针,并返回连续行之间的字节数。

如果由于缺少可用设备内存或设备内存碎片,内存分配失败,则例程返回 0。

所有分配器都返回具有有利于性能的行步幅的内存。使用这些分配器不是强制性的。NPP 原语可以使用任何有效的 CUDA 设备内存指针,并且对行步幅没有限制。

Npp8u *nppiMalloc_8u_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

8 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp8u *nppiMalloc_8u_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 8 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp8u *nppiMalloc_8u_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 8 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp8u *nppiMalloc_8u_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 8 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16u *nppiMalloc_16u_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

16 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16u *nppiMalloc_16u_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 16 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16u *nppiMalloc_16u_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 16 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16u *nppiMalloc_16u_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 16 位无符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16s *nppiMalloc_16s_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

16 位有符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16s *nppiMalloc_16s_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 16 位有符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16s *nppiMalloc_16s_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 16 位有符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16sc *nppiMalloc_16sc_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

1 通道 16 位有符号复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16sc *nppiMalloc_16sc_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 16 位有符号复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16sc *nppiMalloc_16sc_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 16 位有符号复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp16sc *nppiMalloc_16sc_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 16 位有符号复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32s *nppiMalloc_32s_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

32 位有符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32s *nppiMalloc_32s_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 32 位有符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32s *nppiMalloc_32s_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 32 位有符号图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32sc *nppiMalloc_32sc_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

32 位整数复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32sc *nppiMalloc_32sc_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 32 位整数复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32sc *nppiMalloc_32sc_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 32 位整数复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32sc *nppiMalloc_32sc_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 32 位整数复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32f *nppiMalloc_32f_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

32 位浮点图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32f *nppiMalloc_32f_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 32 位浮点图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32f *nppiMalloc_32f_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 32 位浮点图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32f *nppiMalloc_32f_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 32 位浮点图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32fc *nppiMalloc_32fc_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)

32 位浮点复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32fc *nppiMalloc_32fc_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)

2 通道 32 位浮点复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32fc *nppiMalloc_32fc_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)

3 通道 32 位浮点复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

Npp32fc *nppiMalloc_32fc_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)

4 通道 32 位浮点复数图像内存分配器。

参数
  • nWidthPixels – 图像宽度。

  • nHeightPixels – 图像高度。

  • pStepBytes行步距

返回值

指向新图像数据的指针。

函数

void nppiFree(void *pData)

用于释放任何 2D 分配内存的释放方法。

此方法应用于释放使用任何 nppiMalloc_<modifier> 方法分配的内存。

参数
  • pData – 指向使用 nppiMalloc_<modifier> 分配的内存的指针。