| 173 | } |
| 174 | |
| 175 | void 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 | |
| 213 | void OrfDecoder::decodeMetaDataInternal(const CameraMetaData* meta) { |
| 214 | int iso = 0; |
nothing calls this directly
no test coverage detected