/* * 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 "rawimagesource.h" #include "curves.h" namespace rtengine { inline void RawImageSource::convert_row_to_YIQ (float* r, float* g, float* b, float* Y, float* I, float* Q, int W) { for (int j=0; jthreshold) oL[j] = cache[(int)y]; else oL[j] = float(903.3 * y / MAXVALD); oa[j] = float(500.0 * ((x>threshold ? cache[(int)x] : 7.787*x/MAXVALD+16.0/116.0) - (y>threshold ? cache[(int)y] : 7.787*y/MAXVALD+16.0/116.0))); ob[j] = float(200.0 * ((y>threshold ? cache[(int)y] : 7.787*y/MAXVALD+16.0/116.0) - (z>threshold ? cache[(int)z] : 7.787*z/MAXVALD+16.0/116.0))); } } inline void RawImageSource::interpolate_row_g (float* agh, float* 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] = r_mul * rawData[i][j]; // blue: cross interpolation float 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] = b_mul*rawData[i][j]; // blue: cross interpolation float 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