Navigation Menu

Skip to content

Commit

Permalink
added initial support for Sigma sd Quattro DNG files
Browse files Browse the repository at this point in the history
See #3858
  • Loading branch information
agriggio committed May 4, 2017
1 parent aff3a03 commit b36aa29
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions rtengine/camconst.json
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rtengine/rawimage.cc
Expand Up @@ -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;
Expand Down
20 changes: 16 additions & 4 deletions rtengine/rtthumbnail.cc
Expand Up @@ -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;
}
}
}
}
Expand Down

0 comments on commit b36aa29

Please sign in to comment.