diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 679c7a134..7330ff27c 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1933,6 +1933,11 @@ Camera constants: "raw_crop": [ 12, 0, -110, -62 ] // for small size all numbers/2 }, + { // Quality C, only raw crop for now - see #3858 + "make_model": "Sigma sd Quattro", + "raw_crop": [ 200, 74, 5632, 3698 ] + }, + { // Quality A, correction for color matrix from Colin Walker's d50 to dng d65 "make_model": "Sony NEX-C3", //"dcraw_matrix": [ 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 ], // Colin walker's d50 kept for possible consistency issues diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index c0fd1f576..d8dc7eb1d 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -547,8 +547,8 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro crop_masked_pixels(); free (raw_image); raw_image = nullptr; - } else { - if (is_foveon && cc && cc->has_rawCrop()) { // foveon images + } else { + if (get_maker() == "Sigma" && cc && cc->has_rawCrop()) { // foveon images int lm, tm, w, h; cc->get_rawCrop(lm, tm, w, h); left_margin = lm; diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 798964275..2854df91a 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -544,20 +544,32 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati int left_margin = ri->get_leftmargin(); firstgreen += left_margin; int top_margin = ri->get_topmargin(); + int wmax = tmpw; + int hmax = tmph; if(ri->get_maker() == "Sigma" && ri->DNGVERSION()) { // Hack to prevent sigma dng files from crashing - tmpw = (width - 2 - left_margin) / hskip; - tmph = (height - 2 - top_margin) / vskip; + wmax = (width - 2 - left_margin) / hskip; + hmax = (height - 2 - top_margin) / vskip; } - for (int row = 1 + top_margin, y = 0; row < iheight + top_margin - 1 && y < tmph; row += vskip, y++) { + int y = 0; + for (int row = 1 + top_margin; row < iheight + top_margin - 1 && y < hmax; row += vskip, y++) { rofs = row * iwidth; - for (int col = firstgreen, x = 0; col < iwidth + left_margin - 1 && x < tmpw; col += hskip, x++) { + int x = 0; + for (int col = firstgreen; col < iwidth + left_margin - 1 && x < wmax; col += hskip, x++) { int ofs = rofs + col; tmpImg->r(y, x) = image[ofs][0]; tmpImg->g(y, x) = image[ofs][1]; tmpImg->b(y, x) = image[ofs][2]; } + for (; x < tmpw; ++x) { + tmpImg->r(y, x) = tmpImg->g(y, x) = tmpImg->b(y, x) = 0; + } + } + for (; y < tmph; ++y) { + for (int x = 0; x < tmpw; ++x) { + tmpImg->r(y, x) = tmpImg->g(y, x) = tmpImg->b(y, x) = 0; + } } } }