Merge pull request #3147 from Beep6581/xtrans_fix

Recalculate XTrans matrix after cropping by camconst settings, fixes …
This commit is contained in:
Ingo Weyrich
2016-02-12 19:57:14 +01:00
3 changed files with 32 additions and 10 deletions

View File

@@ -927,6 +927,13 @@ Quality X: unknown, ie we knowing to little about the camera properties to know
"ranges": { "white": 4040 }
},
{ // Quality B
"make_model": "FUJIFILM X-PRO2",
"dcraw_matrix": [ 11434,-4948,-1210,-3746,12042,1903,-666,1479,5235 ], // DNG_v9.4 D65
"raw_crop": [ 0, 0, 6032, 4032 ], // full raw 6160,4032, Usable 6032,4032 - experimental crop
"ranges": { "white": 16100 }
},
{ // Quality B, Matrix from Adobe's dcp D65 instead of the internal in Leica's DNG
"make_model": [ "LEICA SL (Typ 601)", "LEICA Q (Typ 116)" ],
"dcraw_matrix": [ 10068,-4043,-1068,-5319,14268,1044,-765,1701,6522 ], // DCP D65

View File

@@ -397,6 +397,19 @@ void identify();
void apply_profile (const char *input, const char *output);
void jpeg_thumb() {} // not needed
bool dcraw_coeff_overrides(const char make[], const char model[], int iso_speed, short trans[12], int *black_level, int *white_level);
void shiftXtransMatrix( const int offsy, const int offsx) {
char xtransTemp[6][6];
for(int row = 0;row < 6; row++) {
for(int col = 0;col < 6; col++) {
xtransTemp[row][col] = xtrans[(row+offsy)%6][(col+offsx)%6];
}
}
for(int row = 0;row < 6; row++) {
for(int col = 0;col < 6; col++) {
xtrans[row][col] = xtransTemp[row][col];
}
}
}
};

View File

@@ -495,11 +495,13 @@ int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistene
if (cc && cc->has_rawCrop()) {
int lm, tm, w, h;
cc->get_rawCrop(lm, tm, w, h);
if(((int)top_margin - tm) & 1) { // we have an odd border difference
filters = (filters << 4) | (filters >> 28); // left rotate filters by 4 bits
if(isXtrans()) {
shiftXtransMatrix(6 - ((top_margin - tm)%6), 6 - ((left_margin - lm)%6));
} else {
if(((int)top_margin - tm) & 1) { // we have an odd border difference
filters = (filters << 4) | (filters >> 28); // left rotate filters by 4 bits
}
}
left_margin = lm;
top_margin = tm;