2 * Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
4 * Please refer to the NVIDIA end user license agreement (EULA) associated
5 * with this source code for terms and conditions that govern your use of
6 * this software. Any use, reproduction, disclosure, or distribution of
7 * this software and related documentation outside the terms of the EULA
8 * is strictly prohibited.
12 #ifndef NV_UTIL_NPP_SIGNAL_H
13 #define NV_UTIL_NPP_SIGNAL_H
26 Signal(size_t nSize) : nSize_(nSize)
29 Signal(const Signal &rSignal) : nSize_(rSignal.nSize_)
37 operator= (const Signal &rSignal)
39 nSize_ = rSignal.nSize_;
53 size_t nTemp = nSize_;
54 nSize_ = rSignal.nSize_;
55 rSignal.nSize_ = nTemp;
63 template<typename D, class A>
64 class SignalTemplate: public Signal
69 SignalTemplate(): aValues_(0)
74 SignalTemplate(size_t nSize): Signal(nSize)
77 aValues_ = A::Malloc1D(size());
80 SignalTemplate(const SignalTemplate<D, A> &rSignal): Signal(rSignal)
83 aValues_ = A::Malloc1D(size());
84 A::Copy1D(aValues_, rSignal.values(), size());
94 operator= (const SignalTemplate<D, A> &rSignal)
96 // in case of self-assignment
105 // assign parent class's data fields (width, height)
106 Signal::operator =(rSignal);
108 aValues_ = A::Malloc1D(size());
109 A::Copy1D(aValues_, rSignal.value(), size());
114 /// Get a pointer to the pixel array.
115 /// The result pointer can be offset to pixel at position (x, y) and
116 /// even negative offsets are allowed.
117 /// \param nX Horizontal pointer/array offset.
118 /// \param nY Vertical pointer/array offset.
119 /// \return Pointer to the pixel array (or first pixel in array with coordinates (nX, nY).
135 swap(SignalTemplate<D, A> &rSignal)
137 Signal::swap(rSignal);
139 tData *aTemp = this->aValues_;
140 this->aValues_ = rSignal.aValues_;
141 rSignal.aValues_ = aTemp;
151 #endif // NV_UTIL_NPP_SIGNAL_H