diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 8154fd03b..3129f7d15 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -5775,6 +5775,8 @@ nf: order = 0x4949; cam_mul[0] = get2() / 256.0; if (tag == 0x1018 || tag == 0x20400100) cam_mul[2] = get2() / 256.0; + if (tag == 0x104D) + read_crop.crop_mode = (CropMode)get2(); if (tag == 0x2011 && len == 2) { get2_256: order = 0x4d4d; @@ -7697,7 +7699,6 @@ void CLASS parse_fuji (int offset) } height <<= fuji_layout; width >>= fuji_layout; - read_crop.complete = read_crop_c == 4; // RT } int CLASS parse_jpeg (int offset) @@ -10153,12 +10154,12 @@ canon_a5: width = raw_width = 6016; height = raw_height = 4014; } else if (!strcmp(model, "X-Pro3") || !strcmp(model, "X-T3") || !strcmp(model, "X-T30") || !strcmp(model, "X-T4") || !strcmp(model, "X100V") || !strcmp(model, "X-S10")) { - constexpr std::uint_fast16_t x_width = 6384, x_height = 4182; // RT - is_cropped = read_crop.complete && (x_width - raw_width > is_cropped_margin || x_height - raw_height > is_cropped_margin); // RT - if (!is_cropped) { // RT - width = raw_width = x_width; // RT - height = raw_height = x_height; // RT - } // RT + raw_width = 6384; // RT + raw_height = 4182; // RT + if (!read_crop.crop_mode) { // RT + width = 6384; // RT + height = 4182; // RT + } // RT } else if (!strcmp(model, "DBP for GX680")) { // Special case for #4204 width = raw_width = 5504; height = raw_height = 3856; diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index a963bf2a2..fad979919 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -76,22 +76,20 @@ public: } protected: + enum CropMode : std::uint_fast16_t { // RT + NA = 0, // RT + FullFrameOnGfx = 1, // RT + SportsFinderMode = 2, // RT + ElectronicShutter1_25xCrop = 4 // RT + }; // RT // stores the cropdata read from the file RT struct CropData { // RT std::uint_fast16_t width, // RT height, // RT top_margin, // RT left_margin; // RT - bool complete = false; // RT + CropMode crop_mode = NA; // RT } read_crop; // RT - /* RT - If the difference between the read dimension (width /height) RT - and the constant dimension (eg.: from cameraconstants) RT - is greater than this amount, RT - then the file should be considered raw cropped (for fuji cropped raw) RT - */ // RT - static constexpr std::uint_fast16_t is_cropped_margin = 500; // RT - bool is_cropped = false; // RT int exif_base, ciff_base, ciff_len; rtengine::IMFILE *ifp; FILE *ofp; diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 9567f3fb9..618ab4f38 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -560,8 +560,7 @@ int RawImage::loadRaw(bool loadData, unsigned int imageNum, bool closeFile, Prog raw_crop_cc = true; int lm, tm, w, h; cc->get_rawCrop(raw_width, raw_height, lm, tm, w, h); - is_cropped = read_crop.complete && (raw_width - read_crop.width > is_cropped_margin || raw_height - read_crop.height > is_cropped_margin); // RT - if (is_cropped){ // RT + if (read_crop.crop_mode){ // RT left_margin = read_crop.left_margin; // RT top_margin = read_crop.top_margin; // RT tm = 0; // RT @@ -576,10 +575,10 @@ int RawImage::loadRaw(bool loadData, unsigned int imageNum, bool closeFile, Prog } } - if (!is_cropped) { // RT + if (!read_crop.crop_mode) { // RT left_margin = lm; top_margin = tm; - } // RT + } // RT if (w < 0) { iwidth += w;