26 #include <boost/static_assert.hpp>
28 #include <libopenraw/consts.h>
30 #include "mosaicinfo.hpp"
43 static const uint8_t BLUE = OR_PATTERN_COLOUR_BLUE;
45 static const uint8_t RGGB_PATTERN[] = { RED, GREEN, GREEN, BLUE };
46 static const uint8_t GBRG_PATTERN[] = { GREEN, BLUE, RED, GREEN };
47 static const uint8_t BGGR_PATTERN[] = { BLUE, GREEN, GREEN, RED };
48 static const uint8_t GRBG_PATTERN[] = { GREEN, RED, BLUE, GREEN };
60 case OR_CFA_PATTERN_RGGB:
63 case OR_CFA_PATTERN_GBRG:
66 case OR_CFA_PATTERN_BGGR:
69 case OR_CFA_PATTERN_GRBG:
86 static std::array<MosaicInfo*, _OR_CFA_PATTERN_INVALID> s_patterns
87 = { { NULL, NULL, NULL, NULL, NULL, NULL } };
89 BOOST_STATIC_ASSERT(_OR_CFA_PATTERN_INVALID == 6);
92 (pattern >= _OR_CFA_PATTERN_INVALID)) {
99 s_patterns[pattern] = pat;
112 : x(0), y(0), n_colours(0)
121 const uint8_t* pattern;
124 MosaicInfo::MosaicInfo()
130 uint16_t width, uint16_t height)
137 MosaicInfo::~MosaicInfo()
146 if(x != 2 || y != 2) {
169 if(count !=
d->x *
d->y) {
174 d->pattern = pattern;
191 d->pattern_type = pattern;
201 return d->pattern_type;
The MosaicInfo type for 2x2 bayer mosaic patterns.
Cfa2x2RgbPattern(::or_cfa_pattern pattern)
Constructor for a specific 2x2 pattern.
Info on the mosaic for the Colour Filter Array.
void setSize(uint16_t x, uint16_t y)
Set the pattern size.
void setPatternType(::or_cfa_pattern pattern)
Set the pattern type.
::or_cfa_pattern patternType() const
void getSize(uint16_t &x, uint16_t &y) const
Get the pattern size.
void setPatternPattern(const uint8_t *pattern, uint16_t count)
Set the pattern pattern.
static const MosaicInfo * twoByTwoPattern(::or_cfa_pattern)
Factory to return a singleton instance of the right pattern.
const uint8_t * patternPattern(uint16_t &count) const
Return the pattern's pattern.
bool is2by2Rgb() const
Return if the pattern is 2x2 RGB.
or_cfa_pattern
CFA pattern types.
@ OR_CFA_PATTERN_NON_RGB22
@ OR_PATTERN_COLOUR_GREEN
Global namespace for libopenraw.