Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/librawspeed/decoders/ArwDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ void ArwDecoder::DecodeLJpeg(const TiffIFD* raw) {
uint32_t width = raw->getEntry(TiffTag::IMAGEWIDTH)->getU32();
uint32_t height = raw->getEntry(TiffTag::IMAGELENGTH)->getU32();
uint32_t bitPerPixel = raw->getEntry(TiffTag::BITSPERSAMPLE)->getU32();
uint32_t photometric =
raw->getEntry(TiffTag::PHOTOMETRICINTERPRETATION)->getU32();

if (photometric != 32803)
ThrowRDE("Unsupported photometric interpretation: %u", photometric);

switch (bitPerPixel) {
case 8:
Expand Down Expand Up @@ -352,9 +357,7 @@ void ArwDecoder::DecodeLJpeg(const TiffIFD* raw) {

PostProcessLJpeg();

const TiffEntry* size_entry = raw->hasEntry(TiffTag::SONYRAWIMAGESIZE)
? raw->getEntry(TiffTag::SONYRAWIMAGESIZE)
: raw->getEntry(TiffTag::DEFAULTCROPSIZE);
const TiffEntry* size_entry = raw->getEntry(TiffTag::SONYRAWIMAGESIZE);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so no fallback is necessary, we're always sure to have this EXIF marker available?

Copy link
Copy Markdown
Collaborator Author

@kmilos kmilos Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're always sure to have this EXIF marker available?

Seems to be the case so far, as mentioned.

In the worst case, I'd rather return the uncropped image w/ black borders than the DNG crop, I feel it's more consistent with the stated behaviour:

RawSpeed does NOT…

crop the image to the same sizes as manufactures, but supplies biggest possible images.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, getEntry() throws if you query for an entry that will not be found.

iRectangle2D crop(0, 0, size_entry->getU32(0), size_entry->getU32(1));
mRaw->subFrame(crop);
}
Expand Down