libvibe++ : a generic C++ library for the ViBe algorithm
CopyPixel.h
Go to the documentation of this file.
1 /* Copyright - Benjamin Laugraud <blaugraud@ulg.ac.be> - 2016
2  * Copyright - Marc Van Droogenbroeck <m.vandroogenbroeck@ulg.ac.be> - 2016
3  *
4  * ViBe is covered by a patent (see http://www.telecom.ulg.ac.be/research/vibe).
5  *
6  * Permission to use ViBe without payment of fee is granted for nonprofit
7  * educational and research purposes only.
8  *
9  * This work may not be copied or reproduced in whole or in part for any
10  * purpose.
11  *
12  * Copying, reproduction, or republishing for any purpose shall require a
13  * license. Please contact the authors in such cases. All the code is provided
14  * without any guarantee.
15  */
16 
17 /**
18  @file CopyPixel.h
19  @brief
20 
21  @author Benjamin Laungraud and Marc Van Droogenbroeck
22 
23  @date June 2016
24 */
25 
26 #ifndef _LIB_VIBE_XX_METAPROGRAMS_COPY_PIXEL_H_
27 #define _LIB_VIBE_XX_METAPROGRAMS_COPY_PIXEL_H_
28 
29 #include "../system/inline.h"
30 #include "../system/types.h"
31 
32 namespace ViBe {
33  namespace internals {
34  /* ====================================================================== *
35  * CopyPixel<Channels> *
36  * ====================================================================== */
37 
38  template <int32_t Channels, typename Encoding = uint8_t>
39  struct CopyPixel {
40  STRONG_INLINE static void copy(
41  Encoding* destination,
42  const Encoding* source
43  ) {
44  *destination = *source;
45  CopyPixel<Channels - 1, Encoding>::copy(destination + 1, source + 1);
46  }
47  };
48 
49  /* ====================================================================== *
50  * CopyPixel<1> *
51  * ====================================================================== */
52 
53  template <typename Encoding>
54  struct CopyPixel<1, Encoding> {
55  STRONG_INLINE static void copy(
56  Encoding* destination,
57  const Encoding* source
58  ) {
59  *destination = *source;
60  }
61  };
62  } /* _NS_internals_ */
63 } /* _NS_ViBe_ */
64 
65 #endif /* _LIB_VIBE_XX_METAPROGRAMS_COPY_PIXEL_H_ */

License/Copyright

This code is copyrighted by the University of Liège, Belgium. 
It is only shared for research purposes. Please do not distribute it. 
B. Laugraud and M. Van Droogenbroeck, May 2016.