图像内存管理函数
用于分配和释放带间距的图像存储空间的例程。
这些方法是为了方便而提供的。它们分配的内存可能在每行像素末尾包含额外的填充字节。虽然对于任何NPP图像处理原语来说,填充并非正确运行的必要条件,但与正确填充的图像相比,缺少填充可能会导致严重的性能下降。
这些函数可以在nppisu库中找到。仅链接您使用的子库在使用动态库时能显著节省链接时间、应用程序加载时间以及CUDA运行时启动时间。
图像内存分配
用于二维数据数组的ImageAllocator方法。
分配器具有宽度和高度参数,用于指定要分配的图像数据大小。它们返回指向新创建内存的指针,并返回连续行之间的字节数。
If the memory allocation failed due to lack of free device memory or device memory fragmentation the routine returns 0.
所有分配器返回的内存行步长都有利于性能提升。使用这些分配器并非强制要求。NPP原语可以接受任何有效的CUDA设备内存指针,且对行步长没有任何限制。
-
Npp8u *nppiMalloc_8u_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
8位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp8u *nppiMalloc_8u_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道8位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp8u *nppiMalloc_8u_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
3通道8位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp8u *nppiMalloc_8u_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道8位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16u *nppiMalloc_16u_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
16位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16u *nppiMalloc_16u_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道16位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16u *nppiMalloc_16u_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
3通道16位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16u *nppiMalloc_16u_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道16位无符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16s *nppiMalloc_16s_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
16位有符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16s *nppiMalloc_16s_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道16位有符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16s *nppiMalloc_16s_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道16位有符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16sc *nppiMalloc_16sc_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
1通道16位有符号复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16sc *nppiMalloc_16sc_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道16位有符号复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16sc *nppiMalloc_16sc_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
3通道16位有符号复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp16sc *nppiMalloc_16sc_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道16位有符号复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32s *nppiMalloc_32s_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
32位有符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32s *nppiMalloc_32s_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
3通道32位有符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32s *nppiMalloc_32s_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道32位有符号图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32sc *nppiMalloc_32sc_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
32位整数复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32sc *nppiMalloc_32sc_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道32位整数复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32sc *nppiMalloc_32sc_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
3通道32位整数复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32sc *nppiMalloc_32sc_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道32位整数复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32f *nppiMalloc_32f_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
32位浮点图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32f *nppiMalloc_32f_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道32位浮点图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32f *nppiMalloc_32f_C3(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
3通道32位浮点图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32f *nppiMalloc_32f_C4(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
4通道32位浮点图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32fc *nppiMalloc_32fc_C1(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
32位浮点复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
-
Npp32fc *nppiMalloc_32fc_C2(int nWidthPixels, int nHeightPixels, int *pStepBytes)
-
2通道32位浮点复数图像内存分配器。
- Parameters
-
nWidthPixels – 图像宽度。
nHeightPixels – 图像高度。
pStepBytes – 行步长。
- Returns
-
指向新图像数据的指针。
函数
-
void nppiFree(void *pData)
-
释放任何二维分配内存的方法。
此方法应用于释放通过任何nppiMalloc_
方法分配的内存。 - Parameters
-
pData – 指向使用nppiMalloc_
分配的内存的指针。