Bilinear demozaicing method suppressed (it were containing a huge memory leak and gave worse result than "Fast", while being really marginally faster), and 2 unused files removed
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
namespace rtengine {
|
||||
namespace procparams {
|
||||
|
||||
const char *RAWParams::methodstring[RAWParams::numMethods]={"eahd", "hphd", "vng4", "dcb", "amaze", "ahd", "fast", "bilinear" };
|
||||
const char *RAWParams::methodstring[RAWParams::numMethods]={"eahd", "hphd", "vng4", "dcb", "amaze", "ahd", "fast" };
|
||||
|
||||
ProcParams::ProcParams () {
|
||||
|
||||
|
@@ -384,7 +384,7 @@ class HSVEqualizerParams {
|
||||
class RAWParams {
|
||||
|
||||
public:
|
||||
enum eMethod{eahd,hphd,vng4,dcb,amaze,ahd,fast,bilinear,
|
||||
enum eMethod{eahd,hphd,vng4,dcb,amaze,ahd,fast,
|
||||
numMethods }; // This MUST be the last enum
|
||||
static const char *methodstring[numMethods];
|
||||
|
||||
|
@@ -977,8 +977,6 @@ void RawImageSource::demosaic(const RAWParams &raw)
|
||||
eahd_demosaic ();
|
||||
else if (raw.dmethod == RAWParams::methodstring[RAWParams::fast] )
|
||||
fast_demo (0,0,W,H);
|
||||
else if (raw.dmethod == RAWParams::methodstring[RAWParams::bilinear] )
|
||||
bilinear_demosaic();
|
||||
else
|
||||
nodemosaic();
|
||||
t2.set();
|
||||
@@ -2455,114 +2453,6 @@ void RawImageSource::border_interpolate(int border, ushort (*image)[4], int star
|
||||
}
|
||||
}
|
||||
|
||||
void RawImageSource::bilinear_interpolate_block(ushort (*image)[4], int start, int end)
|
||||
{
|
||||
ushort (*pix);
|
||||
int i, *ip, sum[4];
|
||||
int width=W;
|
||||
int colors = 3;
|
||||
|
||||
for (int row = start; row < end; row++)
|
||||
for (int col=1; col < width-1; col++) {
|
||||
pix = image[row*width+col];
|
||||
ip = blcode[row & 15][col & 15];
|
||||
memset (sum, 0, sizeof sum);
|
||||
for (i=8; i--; ip+=3)
|
||||
sum[ip[2]] += pix[ip[0]] << ip[1];
|
||||
for (i=colors; --i; ip+=2)
|
||||
pix[ip[0]] = sum[ip[0]] * ip[1] >> 8;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void RawImageSource::bilinear_demosaic()
|
||||
{
|
||||
int width=W, height=H;
|
||||
int *ip, sum[4];
|
||||
int c, x, y, row, col, shift, color;
|
||||
int colors = 3;
|
||||
|
||||
ushort (*image)[4], *pix;
|
||||
image = (ushort (*)[4]) calloc (H*W, sizeof *image);
|
||||
|
||||
for (int ii=0; ii<H; ii++)
|
||||
for (int jj=0; jj<W; jj++)
|
||||
image[ii*W+jj][fc(ii,jj)] = rawData[ii][jj];
|
||||
|
||||
//if (verbose) fprintf (stderr,_("Bilinear interpolation...\n"));
|
||||
if (plistener) {
|
||||
plistener->setProgressStr ("Demosaicing...");
|
||||
plistener->setProgress (0.0);
|
||||
}
|
||||
|
||||
memset(blcode,0,16*16*32);
|
||||
for (row=0; row < 16; row++)
|
||||
for (col=0; col < 16; col++) {
|
||||
ip = blcode[row][col];
|
||||
memset (sum, 0, sizeof sum);
|
||||
for (y=-1; y <= 1; y++)
|
||||
for (x=-1; x <= 1; x++) {
|
||||
shift = (y==0) + (x==0);
|
||||
if (shift == 2) continue;
|
||||
color = fc(row+y,col+x);
|
||||
*ip++ = (width*y + x)*4 + color;
|
||||
*ip++ = shift;
|
||||
*ip++ = color;
|
||||
sum[color] += 1 << shift;
|
||||
}
|
||||
FORCC
|
||||
if (c != fc(row,col)) {
|
||||
*ip++ = c;
|
||||
*ip++ = 256 / sum[c];
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
int nthreads = omp_get_num_threads();
|
||||
int blk = H/nthreads;
|
||||
|
||||
int start = 0;
|
||||
if (tid == 0) start = 1;
|
||||
if (tid<nthreads-1)
|
||||
{
|
||||
border_interpolate(1, image, tid*blk, (tid+1)*blk);
|
||||
bilinear_interpolate_block(image, start+tid*blk, (tid+1)*blk);
|
||||
}
|
||||
else
|
||||
{
|
||||
border_interpolate(1, image, tid*blk, height);
|
||||
bilinear_interpolate_block(image, tid*blk, height-1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
border_interpolate(1, image);
|
||||
bilinear_interpolate_block(image, 1, height-1);
|
||||
#endif
|
||||
|
||||
red = new unsigned short*[H];
|
||||
green = new unsigned short*[H];
|
||||
blue = new unsigned short*[H];
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<H; i++) {
|
||||
red[i] = new unsigned short[W];
|
||||
green[i] = new unsigned short[W];
|
||||
blue[i] = new unsigned short[W];
|
||||
for (int j=0; j<W; j++){
|
||||
red[i][j] = image[i*W+j][0];
|
||||
green[i][j] = image[i*W+j][1];
|
||||
blue[i][j] = image[i*W+j][2];
|
||||
}
|
||||
}
|
||||
|
||||
if(plistener) plistener->setProgress (1.0);
|
||||
free (image);
|
||||
}
|
||||
|
||||
/*
|
||||
Adaptive Homogeneity-Directed interpolation is based on
|
||||
the work of Keigo Hirakawa, Thomas Parks, and Paul Lee.
|
||||
|
@@ -166,9 +166,7 @@ class RawImageSource : public ImageSource {
|
||||
void fast_demo(int winx, int winy, int winw, int winh);//Emil's code for fast demosaicing
|
||||
void dcb_demosaic(int iterations, int dcb_enhance);
|
||||
void ahd_demosaic(int winx, int winy, int winw, int winh);
|
||||
void bilinear_demosaic();
|
||||
void bilinear_interpolate_block(ushort (*image)[4], int start, int end);
|
||||
void border_interpolate(int border, ushort (*image)[4], int start = 0, int end = 0);
|
||||
void border_interpolate(int border, ushort (*image)[4], int start = 0, int end = 0);
|
||||
void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border);
|
||||
void fill_raw( ushort (*cache )[4], int x0, int y0, ushort** rawData);
|
||||
void fill_border( ushort (*cache )[4], int border, int x0, int y0);
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <guiutils.h>
|
||||
#include <options.h>
|
||||
|
||||
void removeIfThere (Gtk::Container* cont, Gtk::Widget* w) {
|
||||
|
||||
Glib::ListHandle<Gtk::Widget*> list = cont->get_children ();
|
||||
Glib::ListHandle<Gtk::Widget*>::iterator i = list.begin ();
|
||||
for (; i!=list.end() && *i!=w; i++);
|
||||
if (i!=list.end()) {
|
||||
w->reference ();
|
||||
cont->remove (*w);
|
||||
}
|
||||
}
|
||||
|
||||
void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh) {
|
||||
|
||||
if (options.thumbInterp==0)
|
||||
rtengine::nearestInterp (src, sw, sh, dst, dw, dh);
|
||||
else if (options.thumbInterp==1)
|
||||
rtengine::bilinearInterp (src, sw, sh, dst, dw, dh);
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __UTILS_
|
||||
#define __UTILS_
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
void removeIfThere (Gtk::Container* cont, Gtk::Widget* w);
|
||||
void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user