24 #include <fvutils/colormap/cmfile.h>
26 #include <fvutils/colormap/colormap.h>
27 #include <fvutils/colormap/cmfile_yuvblock.h>
29 #include <fvutils/colormap/yuvcm.h>
30 #include <core/exception.h>
32 #include <sys/utsname.h>
36 namespace firevision {
49 ColormapFile::ColormapBlockVector::~ColormapBlockVector()
51 for (iterator i = begin(); i != end(); ++i) {
69 ColormapFile::ColormapFile(uint16_t depth, uint16_t width, uint16_t height)
75 __header->
depth = depth;
76 __header->
width = width;
113 if ( (colormap->
depth() != __header->
depth) ||
116 throw fawkes::Exception(
"Colormap dimensions %dx%dx%d do not match expected dimensions %dx%dx%d",
121 printf(
"Adding colormap with dimensions %dx%dx%d\n", colormap->
width(), colormap->
height(), colormap->
depth());
124 for (std::list<ColormapFileBlock *>::iterator i = blocks.begin(); i != blocks.end(); ++i) {
138 for (std::list<FireVisionDataFileBlock *>::iterator i = b.begin(); i != b.end(); ++i) {
139 if ((*i)->type() == CMFILE_TYPE_YUV ) {
150 ColormapFile::assert_header()
154 throw fawkes::Exception(
"Cannot get header information, invalid ctor used or file not read?");
175 for (BlockList::iterator b = bl.begin(); b != bl.end(); ++b) {
176 if ( (*b)->type() != CMFILE_TYPE_YUV ) {
188 unsigned int level = 0;
189 for (BlockList::iterator b = bl.begin(); b != bl.end(); ++b) {
190 if ( (*b)->data_size() != cm->
plane_size() ) {
196 cm->
copy_uvplane((
unsigned char *)(*b)->data_ptr(), level++);
222 std::string rv = format;
224 struct utsname uname_info;
225 uname( &uname_info );
227 size_t loc = rv.find(
"%h" );
228 while (loc != std::string::npos) {
229 rv.replace( loc, 2, uname_info.nodename );
230 loc = rv.find(
"%h" );
252 return __header->
depth;
262 return __header->
width;