Skip to content

Commit 448c35e

Browse files
committed
RafDecoder: extract applyCorrections() out of decodeMetaDataInternal()
1 parent e0c7697 commit 448c35e

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

src/librawspeed/decoders/RafDecoder.cpp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,7 @@ void RafDecoder::checkSupportInternal(const CameraMetaData* meta) {
189189
}
190190
}
191191

192-
void RafDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
193-
int iso = 0;
194-
if (mRootIFD->hasEntryRecursive(TiffTag::ISOSPEEDRATINGS))
195-
iso = mRootIFD->getEntryRecursive(TiffTag::ISOSPEEDRATINGS)->getU32();
196-
mRaw->metadata.isoSpeed = iso;
197-
198-
// This is where we'd normally call setMetaData but since we may still need
199-
// to rotate the image for SuperCCD cameras we do everything ourselves
200-
auto id = mRootIFD->getID();
201-
const Camera* cam = meta->getCamera(id.make, id.model, mRaw->metadata.mode);
202-
if (!cam)
203-
ThrowRDE("Couldn't find camera");
204-
205-
assert(cam != nullptr);
206-
192+
void RafDecoder::applyCorrections(const Camera* cam) {
207193
iPoint2D new_size(mRaw->dim);
208194
iPoint2D crop_offset(0, 0);
209195

@@ -267,6 +253,24 @@ void RafDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
267253
} else if (applyCrop) {
268254
mRaw->subFrame(iRectangle2D(crop_offset, new_size));
269255
}
256+
}
257+
258+
void RafDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
259+
int iso = 0;
260+
if (mRootIFD->hasEntryRecursive(TiffTag::ISOSPEEDRATINGS))
261+
iso = mRootIFD->getEntryRecursive(TiffTag::ISOSPEEDRATINGS)->getU32();
262+
mRaw->metadata.isoSpeed = iso;
263+
264+
// This is where we'd normally call setMetaData but since we may still need
265+
// to rotate the image for SuperCCD cameras we do everything ourselves
266+
auto id = mRootIFD->getID();
267+
const Camera* cam = meta->getCamera(id.make, id.model, mRaw->metadata.mode);
268+
if (!cam)
269+
ThrowRDE("Couldn't find camera");
270+
271+
assert(cam != nullptr);
272+
273+
applyCorrections(cam);
270274

271275
const CameraSensorInfo *sensor = cam->getSensorInfo(iso);
272276
mRaw->blackLevel = sensor->mBlackLevel;

src/librawspeed/decoders/RafDecoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class RafDecoder final : public AbstractTiffDecoder
4242
: AbstractTiffDecoder(move(root), file) {}
4343

4444
RawImage decodeRawInternal() override;
45+
void applyCorrections(const Camera* cam);
4546
void decodeMetaDataInternal(const CameraMetaData* meta) override;
4647
void checkSupportInternal(const CameraMetaData* meta) override;
4748
static bool isRAF(const Buffer& input);

0 commit comments

Comments
 (0)