From 8cb45c0abefa4c2ce577c797edb2a174a50885b7 Mon Sep 17 00:00:00 2001 From: Hombre Date: Sun, 26 Dec 2010 02:13:27 +0100 Subject: [PATCH] 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 --- rtengine/procparams.cc | 2 +- rtengine/procparams.h | 2 +- rtengine/rawimagesource.cc | 110 ------------------------------------- rtengine/rawimagesource.h | 4 +- rtgui/utils.cc | 39 ------------- rtgui/utils.h | 27 --------- 6 files changed, 3 insertions(+), 181 deletions(-) delete mode 100644 rtgui/utils.cc delete mode 100644 rtgui/utils.h diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 6770e5d3f..a4e9aa16e 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -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 () { diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 8a3164260..16d137fe0 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -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]; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 8e735296e..c54691dd1 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -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; iisetProgressStr ("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 (tidsetProgress (1.0); - free (image); -} - /* Adaptive Homogeneity-Directed interpolation is based on the work of Keigo Hirakawa, Thomas Parks, and Paul Lee. diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 9335a119c..d1d640d0b 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -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); diff --git a/rtgui/utils.cc b/rtgui/utils.cc deleted file mode 100644 index cad454981..000000000 --- a/rtgui/utils.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 . - */ -#include -#include - -void removeIfThere (Gtk::Container* cont, Gtk::Widget* w) { - - Glib::ListHandle list = cont->get_children (); - Glib::ListHandle::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); -} diff --git a/rtgui/utils.h b/rtgui/utils.h deleted file mode 100644 index 682cdd03f..000000000 --- a/rtgui/utils.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 __UTILS_ -#define __UTILS_ - -#include - -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