/* * This file is part of RawTherapee. * * Copyright (c) 2004-2010 Gabor Horvath * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * RawTherapee is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ #ifndef RAWIMAGESOURCE_I_H_INCLUDED #define RAWIMAGESOURCE_I_H_INCLUDED #include #include #undef MAXVAL #undef CLIP #define MAXVAL 0xffff #define CLIP(a) ((a)>0?((a)threshold) oL[j] = 300.0*cache[(int)y]; else oL[j] = 300.0 * 903.3 * y / MAXVAL; oa[j] = 32.0 * 500.0 * ((x>threshold ? cache[(int)x] : 7.787*x/MAXVAL+16.0/116.0) - (y>threshold ? cache[(int)y] : 7.787*y/MAXVAL+16.0/116.0)); ob[j] = 32.0 * 200.0 * ((y>threshold ? cache[(int)y] : 7.787*y/MAXVAL+16.0/116.0) - (z>threshold ? cache[(int)z] : 7.787*z/MAXVAL+16.0/116.0)); } } inline void RawImageSource::interpolate_row_g (unsigned short* agh, unsigned short* agv, int i) { for (int j=0; jISGREEN(i,j)) { agh[j] = rawData[i][j]; agv[j] = rawData[i][j]; } else { int gh=0; int gv=0; if (j>1 && jmaxgh) gh = maxgh; else if (gh1 && imaxgv) gv = maxgv; else if (gvISRED(i,0) || ri->ISRED(i,1)) { // RGRGR or GRGRGR line for (int j=0; jISRED(i,j)) { // red is simple ar[j] = rawData[i][j]; // blue: cross interpolation int b = 0; int n = 0; if (i>0 && j>0) { b += rawData[i-1][j-1] - pg[j-1]; n++; } if (i>0 && j0) { b += rawData[i+1][j-1] - ng[j-1]; n++; } if (iISBLUE(i,j)) { // red is simple ab[j] = rawData[i][j]; // blue: cross interpolation int r = 0; int n = 0; if (i>0 && j>0) { r += rawData[i-1][j-1] - pg[j-1]; n++; } if (i>0 && j0) { r += rawData[i+1][j-1] - ng[j-1]; n++; } if (iISRED(i,0) || ri->ISRED(i,1)) { // RGRGR or GRGRGR line for (int j=x1, jx=0; jxISRED(i,j)) { // red is simple ar[jx] = CLIP(r_mul * rawData[i][j]); // blue: cross interpolation int b = 0; int n = 0; if (i>0 && j>0) { b += b_mul*rawData[i-1][j-1] - g_mul*pg[j-1]; n++; } if (i>0 && j0) { b += b_mul*rawData[i+1][j-1] - g_mul*ng[j-1]; n++; } if (iISBLUE(i,j)) { // red is simple ab[jx] = CLIP(b_mul*rawData[i][j]); // blue: cross interpolation int r = 0; int n = 0; if (i>0 && j>0) { r += r_mul*rawData[i-1][j-1] - g_mul*pg[j-1]; n++; } if (i>0 && j0) { r += r_mul*rawData[i+1][j-1] - g_mul*ng[j-1]; n++; } if (i