Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pr/521' into develop
Browse files Browse the repository at this point in the history
Pentax K-3 Mark III Monochrome DNG bug.

* upstream/pr/521:
  Relax DNG black level parsing
  • Loading branch information
LebedevRI committed Sep 21, 2023
2 parents 2f1e314 + 1be0462 commit a7ea097
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/librawspeed/decoders/DngDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,16 @@ bool DngDecoder::decodeBlackLevels(const TiffIFD* raw) const {
iPoint2D blackdim(1, 1);
if (raw->hasEntry(TiffTag::BLACKLEVELREPEATDIM)) {
const TiffEntry* bleveldim = raw->getEntry(TiffTag::BLACKLEVELREPEATDIM);
if (bleveldim->count != 2)
if (bleveldim->count == 2)
blackdim = iPoint2D(bleveldim->getU32(0), bleveldim->getU32(1));
else if (bleveldim->count == 1) {
// Non-spec-compliant quirk. Assuming NxN repeat dimensions.
blackdim = iPoint2D(bleveldim->getU32(0), bleveldim->getU32(0));
// Let's only allow somewhat unambiguous case of 1x1 repeat dimensions.
if (blackdim != iPoint2D(1, 1))
return false;
} else
return false;
blackdim = iPoint2D(bleveldim->getU32(0), bleveldim->getU32(1));
}

if (!blackdim.hasPositiveArea())
Expand Down

0 comments on commit a7ea097

Please sign in to comment.