Skip to content

Commit

Permalink
FIX: ISOSPEEDRATINGS is of type SHORT, larger ISO values stored in RE…
Browse files Browse the repository at this point in the history
…COMMENDED_EXPOSURE_INDEX
  • Loading branch information
cytrinox committed May 21, 2021
1 parent 82ee942 commit c32a919
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librawspeed/decoders/Cr3Decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,14 @@ void Cr3Decoder::decodeMetaDataInternal(const CameraMetaData* meta) {
iso = canonBox->CMT2()
->mRootIFD0->getEntryRecursive(ISOSPEEDRATINGS)
->getU32();
if(65535 == iso) {
// ISOSPEEDRATINGS is a SHORT EXIF value. For larger values, we have to look
// at RECOMMENDED_EXPOSURE_INDEX (maybe Canon specific).
if (canonBox->CMT2()->mRootIFD0->hasEntryRecursive(RECOMMENDED_EXPOSURE_INDEX))
iso = canonBox->CMT2()
->mRootIFD0->getEntryRecursive(RECOMMENDED_EXPOSURE_INDEX)
->getU32();
}

// Big raw image is always in track 4
assert(rootBox->moov()->tracks.size() >= 4);
Expand Down
1 change: 1 addition & 0 deletions src/librawspeed/tiff/TiffTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ enum TiffTag {
GPSINFOIFDPOINTER = 0x8825,
ISOSPEEDRATINGS = 0x8827,
OECF = 0x8828,
RECOMMENDED_EXPOSURE_INDEX = 0x8832,
EXIFVERSION = 0x9000,
DATETIMEORIGINAL = 0x9003,
DATETIMEDIGITIZED = 0x9004,
Expand Down

0 comments on commit c32a919

Please sign in to comment.