| 100 | } |
| 101 | |
| 102 | RawImage OrfDecoder::decodeRawInternal() { |
| 103 | const auto* raw = mRootIFD->getIFDWithTag(STRIPOFFSETS); |
| 104 | |
| 105 | int compression = raw->getEntry(COMPRESSION)->getU32(); |
| 106 | if (1 != compression) |
| 107 | ThrowRDE("Unsupported compression"); |
| 108 | |
| 109 | uint32_t width = raw->getEntry(IMAGEWIDTH)->getU32(); |
| 110 | uint32_t height = raw->getEntry(IMAGELENGTH)->getU32(); |
| 111 | |
| 112 | if (!width || !height || width % 2 != 0 || width > 10400 || height > 7796) |
| 113 | ThrowRDE("Unexpected image dimensions found: (%u; %u)", width, height); |
| 114 | |
| 115 | mRaw->dim = iPoint2D(width, height); |
| 116 | |
| 117 | ByteStream input(handleSlices()); |
| 118 | |
| 119 | if (decodeUncompressed(input, width, height, input.getSize())) |
| 120 | return mRaw; |
| 121 | |
| 122 | if (raw->getEntry(STRIPOFFSETS)->count != 1) |
| 123 | ThrowRDE("%u stripes, and not uncompressed. Unsupported.", |
| 124 | raw->getEntry(STRIPOFFSETS)->count); |
| 125 | |
| 126 | OlympusDecompressor o(mRaw); |
| 127 | mRaw->createData(); |
| 128 | o.decompress(std::move(input)); |
| 129 | |
| 130 | return mRaw; |
| 131 | } |
| 132 | |
| 133 | bool OrfDecoder::decodeUncompressed(const ByteStream& s, uint32_t w, uint32_t h, |
| 134 | uint32_t size) { |
nothing calls this directly
no test coverage detected