MCPcopy Create free account
hub / github.com/darktable-org/rawspeed / parseCFA

Method parseCFA

src/librawspeed/decoders/OrfDecoder.cpp:175–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void OrfDecoder::parseCFA() {
176 if (!mRootIFD->hasEntryRecursive(EXIFCFAPATTERN))
177 ThrowRDE("No EXIFCFAPATTERN entry found!");
178
179 TiffEntry* CFA = mRootIFD->getEntryRecursive(EXIFCFAPATTERN);
180 if (CFA->type != TiffDataType::TIFF_UNDEFINED || CFA->count != 8) {
181 ThrowRDE("Bad EXIFCFAPATTERN entry (type %u, count %u).", CFA->type,
182 CFA->count);
183 }
184
185 iPoint2D cfaSize(CFA->getU16(0), CFA->getU16(1));
186 if (cfaSize != iPoint2D{2, 2})
187 ThrowRDE("Bad CFA size: (%i, %i)", cfaSize.x, cfaSize.y);
188
189 mRaw->cfa.setSize(cfaSize);
190
191 auto int2enum = [](uint8_t i) -> CFAColor {
192 switch (i) {
193 case 0:
194 return CFA_RED;
195 case 1:
196 return CFA_GREEN;
197 case 2:
198 return CFA_BLUE;
199 default:
200 ThrowRDE("Unexpected CFA color: %u", i);
201 }
202 };
203
204 for (int y = 0; y < cfaSize.y; y++) {
205 for (int x = 0; x < cfaSize.x; x++) {
206 uint8_t c1 = CFA->getByte(4 + x + y * cfaSize.x);
207 CFAColor c2 = int2enum(c1);
208 mRaw->cfa.setColorAt(iPoint2D(x, y), c2);
209 }
210 }
211}
212
213void OrfDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
214 int iso = 0;

Callers

nothing calls this directly

Calls 7

setColorAtMethod · 0.80
iPoint2DClass · 0.70
hasEntryRecursiveMethod · 0.45
getEntryRecursiveMethod · 0.45
getU16Method · 0.45
setSizeMethod · 0.45
getByteMethod · 0.45

Tested by

no test coverage detected