//////////////////////////////////////////////////////////////// // // //exposure correction before interpolation // // code dated: December 27, 2010 // // Expo_before.cc 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. // // This program 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 this program. If not, see . // //////////////////////////////////////////////////////////////// // Jacques Desmis // use fast-demo(provisional) from Emil Martinec // inspired from work Guillermo Luijk and Manuel LLorens(Perfectraw) // // This function uses parameters: // exposure (linear): 2^(-8..0..8): currently 0.5 +3 // preserve (log) : 0..8 : currently 0.1 1 void RawImageSource::processRawWhitepoint(float expos, float preser) { int width=W, height=H; // exposure correction inspired from G.Luijk if (preser==0.0) { // No highlight protection - simple mutiplication #pragma omp parallel for shared(expos) for (int row=0;row(W,H); // with memcpy it's faster than for (...) for (int i=0; i(imgd, H); // Find maximum to adjust LUTs. New float engines clips only at the very end int maxVal=65535; for(int row=0;rowmaxVal) maxVal = rawData[row][col]; // Exposure correction with highlight preservation LUTf lut(maxVal+1); if(expos>1){ float K = maxVal / expos*exp(-preser*log(2.0)); for (int j=0;j<=maxVal;j++) lut[(int)j]=((maxVal-K*expos)/(maxVal-K)*(j-maxVal)+maxVal) / j; #pragma omp parallel for shared(expos) for(int row=0;row