/** * Copyright 1993-2015 NVIDIA Corporation. All rights reserved. * * Please refer to the NVIDIA end user license agreement (EULA) associated * with this source code for terms and conditions that govern your use of * this software. Any use, reproduction, disclosure, or distribution of * this software and related documentation outside the terms of the EULA * is strictly prohibited. * */ #ifndef NV_UTIL_NPP_IMAGES_NPP_H #define NV_UTIL_NPP_IMAGES_NPP_H #include "Exceptions.h" #include "ImagePacked.h" #include "ImageAllocatorsNPP.h" #include namespace npp { // forward declaration template class ImageCPU; template class ImageNPP: public npp::ImagePacked > { public: ImageNPP() { ; } ImageNPP(unsigned int nWidth, unsigned int nHeight, bool bTight = false): ImagePacked >(nWidth, nHeight, bTight) { ; } ImageNPP(const npp::Image::Size &rSize): ImagePacked >(rSize) { ; } ImageNPP(const ImageNPP &rImage): Image(rImage) { ; } template explicit ImageNPP(const ImageCPU &rImage, bool bTight = false): ImagePacked >(rImage.width(), rImage.height(), bTight) { npp::ImageAllocator::HostToDeviceCopy2D(ImagePacked >::data(), ImagePacked >::pitch(), rImage.data(), rImage.pitch(), ImagePacked >::width(), ImagePacked >::height()); } virtual ~ImageNPP() { ; } ImageNPP & operator= (const ImageNPP &rImage) { ImagePacked >::operator= (rImage); return *this; } void copyTo(D *pData, unsigned int nPitch) const { NPP_ASSERT((ImagePacked >::width() * sizeof(npp::Pixel) <= nPitch)); npp::ImageAllocator::DeviceToHostCopy2D(pData, nPitch, ImagePacked >::data(), ImagePacked >::pitch(), ImagePacked >::width(), ImagePacked >::height()); } void copyFrom(D *pData, unsigned int nPitch) { NPP_ASSERT((ImagePacked >::width() * sizeof(npp::Pixel) <= nPitch)); npp::ImageAllocator::HostToDeviceCopy2D(ImagePacked >::data(), ImagePacked >::pitch(), pData, nPitch, ImagePacked >::width(), ImagePacked >::height()); } }; typedef ImageNPP ImageNPP_8u_C1; typedef ImageNPP ImageNPP_8u_C2; typedef ImageNPP ImageNPP_8u_C3; typedef ImageNPP ImageNPP_8u_C4; typedef ImageNPP ImageNPP_16u_C1; typedef ImageNPP ImageNPP_16u_C2; typedef ImageNPP ImageNPP_16u_C3; typedef ImageNPP ImageNPP_16u_C4; typedef ImageNPP ImageNPP_16s_C1; typedef ImageNPP ImageNPP_16s_C3; typedef ImageNPP ImageNPP_16s_C4; typedef ImageNPP ImageNPP_32s_C1; typedef ImageNPP ImageNPP_32s_C3; typedef ImageNPP ImageNPP_32s_C4; typedef ImageNPP ImageNPP_32f_C1; typedef ImageNPP ImageNPP_32f_C2; typedef ImageNPP ImageNPP_32f_C3; typedef ImageNPP ImageNPP_32f_C4; typedef ImageNPP ImageNPP_64f_C1; typedef ImageNPP ImageNPP_64f_C2; typedef ImageNPP ImageNPP_64f_C3; typedef ImageNPP ImageNPP_64f_C4; } // npp namespace #endif // NV_UTIL_NPP_IMAGES_NPP_H