block_utils.h
Go to the documentation of this file.
1 #ifndef __block_utils__
2 #define __block_utils__
3 
4 // STL
5 #include <vector>
6 
7 typedef void (*extract_pixel_data_fnct_t)(const std::vector<unsigned char*>&,
8  unsigned int,
9  unsigned char*);
10 
12 
13 template<class T> void extract_pixel_data(const std::vector<unsigned char*>& blocks,
14  unsigned int offset,
15  unsigned char* data)
16 {
17  const std::size_t nblocks = blocks.size();
18 
19  for(std::size_t i = 0; i != nblocks; ++i)
20  {
21  memcpy(data, blocks[i] + offset, sizeof(T));
22 
23  data += sizeof(T);
24  }
25 }
26 
27 #endif // __block_utils__
28 
void(* extract_pixel_data_fnct_t)(const std::vector< unsigned char * > &, unsigned int, unsigned char *)
Definition: block_utils.h:7
void set_extract_pixel_data_strategy(extract_pixel_data_fnct_t *f, int data_type)
Definition: block_utils.cpp:13
void extract_pixel_data(const std::vector< unsigned char * > &blocks, unsigned int offset, unsigned char *data)
Definition: block_utils.h:13