| 81 | } |
| 82 | |
| 83 | RawImage KdcDecoder::decodeRawInternal() { |
| 84 | if (!mRootIFD->hasEntryRecursive(COMPRESSION)) |
| 85 | ThrowRDE("Couldn't find compression setting"); |
| 86 | |
| 87 | auto compression = mRootIFD->getEntryRecursive(COMPRESSION)->getU32(); |
| 88 | if (7 != compression) |
| 89 | ThrowRDE("Unsupported compression %d", compression); |
| 90 | |
| 91 | TiffEntry* ifdoffset = mRootIFD->getEntryRecursive(KODAK_IFD2); |
| 92 | if (!ifdoffset) |
| 93 | ThrowRDE("Couldn't find the Kodak IFD offset"); |
| 94 | |
| 95 | NORangesSet<Buffer> ifds; |
| 96 | |
| 97 | assert(ifdoffset != nullptr); |
| 98 | TiffRootIFD kodakifd(nullptr, &ifds, ifdoffset->getRootIfdData(), |
| 99 | ifdoffset->getU32()); |
| 100 | |
| 101 | uint32_t width = 0; |
| 102 | uint32_t height = 0; |
| 103 | TiffEntry* ew = kodakifd.getEntryRecursive(KODAK_KDC_SENSOR_WIDTH); |
| 104 | TiffEntry* eh = kodakifd.getEntryRecursive(KODAK_KDC_SENSOR_HEIGHT); |
| 105 | if (ew && eh) { |
| 106 | width = ew->getU32(); |
| 107 | height = eh->getU32(); |
| 108 | } else |
| 109 | ThrowRDE("Unable to retrieve image size"); |
| 110 | |
| 111 | mRaw->dim = iPoint2D(width, height); |
| 112 | |
| 113 | const Buffer inputBuffer = KdcDecoder::getInputBuffer(); |
| 114 | |
| 115 | mRaw->createData(); |
| 116 | |
| 117 | UncompressedDecompressor u( |
| 118 | ByteStream(DataBuffer(inputBuffer, Endianness::little)), mRaw); |
| 119 | |
| 120 | u.decode12BitRaw<Endianness::big>(width, height); |
| 121 | |
| 122 | return mRaw; |
| 123 | } |
| 124 | |
| 125 | void KdcDecoder::decodeMetaDataInternal(const CameraMetaData* meta) { |
| 126 | setMetaData(meta, "", 0); |
nothing calls this directly
no test coverage detected