Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
cmfile_yuvblock.cpp
1
2
/**************************************************************************
3
* cmfile_yuvblock.cpp - FVFF Colormap File YUV Block
4
*
5
* Created: Mon Mar 31 18:10:01 2008
6
* Copyright 2005-2008 Tim Niemueller [www.niemueller.de]
7
*
8
***************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <fvutils/colormap/cmfile_yuvblock.h>
25
#include <fvutils/colormap/cmfile.h>
26
#include <fvutils/colormap/yuvcm.h>
27
28
#include <core/exceptions/software.h>
29
#include <cstring>
30
31
namespace
firevision {
32
#if 0
/* just to make Emacs auto-indent happy */
33
}
34
#endif
35
36
/** @class ColormapFileYuvBlock <fvutils/colormap/cmfile_yuvblock.h>
37
* YUV block for colormap file.
38
* @author Tim Niemueller
39
*/
40
41
/** Constructor.
42
* @param cm YUV colormap that this block shall represent.
43
* @param level Y level
44
*/
45
ColormapFileYuvBlock::ColormapFileYuvBlock(
YuvColormap
*cm,
unsigned
int
level)
46
:
ColormapFileBlock
(CMFILE_TYPE_YUV, cm->plane_size(), sizeof(
cmfile_yuvblock_header_t
))
47
{
48
if
( level > cm->
depth
() ) {
49
throw
fawkes::OutOfBoundsException
(
"YuvColormap level is out of bounds"
, level, 0, cm->
depth
());
50
}
51
52
__cm = cm;
53
__level = level;
54
55
__header = (
cmfile_yuvblock_header_t
*)
_spec_header
;
56
__header->
range_from
= level * cm->
deepness
() / cm->
depth
();
57
__header->
range_to
= ((level + 1) * cm->
deepness
() / cm->
depth
()) - 1;
58
59
memcpy(
_data
, __cm->
get_buffer
() + level * cm->
plane_size
(),
_data_size
);
60
}
61
62
63
/** Copy Constructor.
64
* It is assumed that the block actually is a rectification LUT info block. Check that
65
* before calling this method.
66
* @param block block to copy
67
*/
68
ColormapFileYuvBlock::ColormapFileYuvBlock
(
FireVisionDataFileBlock
*block)
69
:
ColormapFileBlock
(block)
70
{
71
__header = (
cmfile_yuvblock_header_t
*)
_spec_header
;
72
}
73
74
75
/** Range from value.
76
* @return range from value
77
*/
78
unsigned
int
79
ColormapFileYuvBlock::range_from
()
const
80
{
81
return
__header->
range_from
;
82
}
83
84
85
/** Range to value.
86
* @return range to value
87
*/
88
unsigned
int
89
ColormapFileYuvBlock::range_to
()
const
90
{
91
return
__header->
range_to
;
92
}
93
94
}
// end namespace firevision
src
libs
fvutils
colormap
cmfile_yuvblock.cpp
Generated by
1.8.1.1