added initial support for Sigma sd Quattro DNG files

See #3858
This commit is contained in:
Alberto Griggio
2017-05-04 17:25:14 +02:00
parent aff3a03b57
commit b36aa29c36
3 changed files with 23 additions and 6 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}
}
}
}