4 #include <cuda_runtime.h>
5 #include "../iucutil.h"
12 template <
typename PixelType>
16 static PixelType* alloc(
iu::Size<2> size,
size_t *pitch)
18 if ((size.
width == 0) || (size.
height == 0))
throw IuException(
"width or height is 0", __FILE__, __FUNCTION__, __LINE__);
19 PixelType* buffer = 0;
20 IU_CUDA_SAFE_CALL(cudaMallocPitch((
void **)&buffer, pitch,
25 static void free(PixelType *buffer)
27 IU_CUDA_SAFE_CALL(cudaFree((
void *)buffer));
30 static void copy(
const PixelType *src,
size_t src_pitch, PixelType *dst,
size_t dst_pitch,
iu::Size<2> size)
32 IU_CUDA_SAFE_CALL(cudaMemcpy2D(dst, dst_pitch, src, src_pitch,
34 cudaMemcpyDeviceToDevice));
Definition: image_allocator_gpu.h:13
unsigned int & height
Definition: vector.h:531
Exceptions with additional error information.
Definition: coredefs.h:32
unsigned int & width
Definition: vector.h:529
Template specialization for 2-d unsigned int vectors (size vectors).
Definition: vector.h:525