Cppcheck: Fixed almost all performance hints
This commit is contained in:
parent
3552fd4161
commit
3bef6cb8de
@ -1025,7 +1025,7 @@ void ColorTemp::cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, dou
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorTemp::temp2mulxyz (double tem, double gree, std::string method , double &Xxyz, double &Zxyz)
|
void ColorTemp::temp2mulxyz (double tem, double gree, const std::string &method, double &Xxyz, double &Zxyz)
|
||||||
{
|
{
|
||||||
double xD, yD, x_D, y_D, interm;
|
double xD, yD, x_D, y_D, interm;
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mul2temp (const double rmul, const double gmul, const double bmul, const double equal, double& temp, double& green) const;
|
void mul2temp (const double rmul, const double gmul, const double bmul, const double equal, double& temp, double& green) const;
|
||||||
static void temp2mulxyz (double tem, double gree, std::string method, double &Xxyz, double &Zxyz);
|
static void temp2mulxyz (double tem, double gree, const std::string &method, double &Xxyz, double &Zxyz);
|
||||||
|
|
||||||
static void cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, double &CAM02BB01, double &CAM02BB02, double &CAM02BB10, double &CAM02BB11, double &CAM02BB12, double &CAM02BB20, double &CAM02BB21, double &CAM02BB22, double adap );
|
static void cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, double &CAM02BB01, double &CAM02BB02, double &CAM02BB10, double &CAM02BB11, double &CAM02BB12, double &CAM02BB20, double &CAM02BB21, double &CAM02BB22, double adap );
|
||||||
//static void CAT02 (Imagefloat* baseImg, const ProcParams* params);
|
//static void CAT02 (Imagefloat* baseImg, const ProcParams* params);
|
||||||
|
@ -1,150 +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 "rtengine.h"
|
|
||||||
#include <iostream>
|
|
||||||
//#include <giomm.h>
|
|
||||||
#include <helpers.h>
|
|
||||||
|
|
||||||
class PListener : public rtengine::ProgressListener
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
void setProgressStr (Glib::ustring str)
|
|
||||||
{
|
|
||||||
std::cout << str << std::endl;
|
|
||||||
}
|
|
||||||
void setProgress (double p)
|
|
||||||
{
|
|
||||||
std::cout << p << std::endl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class MyPrevImgListener : public rtengine::PreviewImageListener
|
|
||||||
{
|
|
||||||
|
|
||||||
IImage8* i;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// this method is called when the staged image processor creates a new image to store the resulting preview image (this does not happen too often)
|
|
||||||
// usually you just have to store it
|
|
||||||
void setImage (IImage8* img, double scale, procparams::CropParams cp)
|
|
||||||
{
|
|
||||||
i = img;
|
|
||||||
}
|
|
||||||
// if the staged image processor wants to delete the image that stores the preview image, it calls this method. You have to destroy the image.
|
|
||||||
void delImage (IImage8* img)
|
|
||||||
{
|
|
||||||
if (img) {
|
|
||||||
// make sure we dont use this image in an other thread
|
|
||||||
IImage8* temp = i;
|
|
||||||
i->getMutex().lock ();
|
|
||||||
i = NULL;
|
|
||||||
temp->getMutex().unlock ();
|
|
||||||
// free it
|
|
||||||
img->free ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if the preview image changes, this method is called
|
|
||||||
void imageReady (procparams::CropParams cp)
|
|
||||||
{
|
|
||||||
// initiate a redraw in the background and return as fast as possible
|
|
||||||
}
|
|
||||||
// a possible redraw function:
|
|
||||||
//void redraw () {
|
|
||||||
// if (i) {
|
|
||||||
// i->lock ();
|
|
||||||
// int w = i->getWidth ();
|
|
||||||
// int h = i->getHeigt ();
|
|
||||||
// const char* data = i->getData ();
|
|
||||||
// ... draw it ...
|
|
||||||
// i->unlock ();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (argc < 4) {
|
|
||||||
std::cout << "Usage: rtcmd <infile> <paramfile> <outfile>" << std::endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Glib::thread_init ();
|
|
||||||
|
|
||||||
// create and fill settings
|
|
||||||
rtengine::Settings* s = rtengine::Settings::create ();
|
|
||||||
s->demosaicMethod = "hphd";
|
|
||||||
s->colorCorrectionSteps = 2;
|
|
||||||
s->iccDirectory = "";
|
|
||||||
s->colorimetricIntent = 1;
|
|
||||||
s->monitorProfile = "";
|
|
||||||
// init rtengine
|
|
||||||
rtengine::init (s);
|
|
||||||
// the settings can be modified later through the "s" pointer without calling any api function
|
|
||||||
|
|
||||||
// Create a listener object. Any class is appropriate that inherits from rtengine::ProgressListener
|
|
||||||
PListener pl;
|
|
||||||
|
|
||||||
// Load the image given in the first command line parameter
|
|
||||||
rtengine::InitialImage* ii;
|
|
||||||
int errorCode;
|
|
||||||
ii = rtengine::InitialImage::load (argv[1], true, errorCode, &pl);
|
|
||||||
|
|
||||||
if (!ii) {
|
|
||||||
ii = rtengine::InitialImage::load (argv[1], false, errorCode, &pl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ii) {
|
|
||||||
std::cout << "Input file not supported." << std::endl;
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Second scenario. Create a stagedimageprocessor with a preview scale of 1:5 and change few things */
|
|
||||||
MyPrevImgListener myPrevImgListener;
|
|
||||||
|
|
||||||
StagedImageProcessor* ipc = StagedImageProcessor::create (ii);
|
|
||||||
ipc->setProgressListener (&pl);
|
|
||||||
ipc->setPreviewImageListener (&myPrevImgListener);
|
|
||||||
ipc->setPreviewScale (5); // preview scale = 1:5
|
|
||||||
// you can add a histogram listener, too, that is notified when the histogram changes
|
|
||||||
// ipc->setHistogramListener (...);
|
|
||||||
// you can add autoexplistener that is notified about the exposure settings when the auto exp algorithm finishes
|
|
||||||
// ipc->setAutoExpListener (curve);
|
|
||||||
// you can add sizelistener if you want to be notified when the size of the final image changes (due to rotation/resize/etc)
|
|
||||||
// ipc->setSizeListener (crop);
|
|
||||||
|
|
||||||
// if you want to change the settings you have to ask for the procparams structure of the staged image processor
|
|
||||||
// you have to tell it what has changed. At the first time tell it EvPhotoLoaded so a full processing will be performed
|
|
||||||
rtengine::procparams::ProcParams* params = ipc->beginUpdateParams ();
|
|
||||||
// change this and that...
|
|
||||||
params->toneCurve.brightness = 1.0;
|
|
||||||
// you can load it, too, from a file: params->load (argv[2]);
|
|
||||||
// finally you have to call this non-blocking method, and the image processing starts in the background. When finished, the preview image listener will be notified
|
|
||||||
ipc->endUpdateParams (rtengine::EvPhotoLoaded);
|
|
||||||
// you can go on with changing of the settings, following the gui actions
|
|
||||||
// now we know that only the brightness has changed compared to the previous settings, to only a part of the processing has to be repeated
|
|
||||||
params = ipc->beginUpdateParams ();
|
|
||||||
params->toneCurve.brightness = 1.2;
|
|
||||||
ipc->endUpdateParams (rtengine::EvBrightness);
|
|
||||||
|
|
||||||
// ... and so on. If you dont need it any more, you can destroy it (make sure that no processing is happening when you destroy it!)
|
|
||||||
StagedImageProcessor::destroy (ipc);
|
|
||||||
}
|
|
||||||
|
|
@ -250,8 +250,8 @@ static void _convolveImageVert(
|
|||||||
|
|
||||||
static void _convolveSeparate(
|
static void _convolveSeparate(
|
||||||
_KLT_FloatImage imgin,
|
_KLT_FloatImage imgin,
|
||||||
ConvolutionKernel horiz_kernel,
|
const ConvolutionKernel &horiz_kernel,
|
||||||
ConvolutionKernel vert_kernel,
|
const ConvolutionKernel &vert_kernel,
|
||||||
_KLT_FloatImage imgout)
|
_KLT_FloatImage imgout)
|
||||||
{
|
{
|
||||||
/* Create temporary image */
|
/* Create temporary image */
|
||||||
|
@ -4395,7 +4395,7 @@ void RawImageSource::HLRecovery_CIELab (float* rin, float* gin, float* bin, floa
|
|||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void RawImageSource::hlRecovery (std::string method, float* red, float* green, float* blue, int width, float* hlmax )
|
void RawImageSource::hlRecovery (const std::string &method, float* red, float* green, float* blue, int width, float* hlmax )
|
||||||
{
|
{
|
||||||
|
|
||||||
if (method == "Luminance") {
|
if (method == "Luminance") {
|
||||||
|
@ -97,7 +97,7 @@ protected:
|
|||||||
void hphd_horizontal (float** hpmap, int row_from, int row_to);
|
void hphd_horizontal (float** hpmap, int row_from, int row_to);
|
||||||
void hphd_green (float** hpmap);
|
void hphd_green (float** hpmap);
|
||||||
void processFalseColorCorrectionThread (Imagefloat* im, array2D<float> &rbconv_Y, array2D<float> &rbconv_I, array2D<float> &rbconv_Q, array2D<float> &rbout_I, array2D<float> &rbout_Q, const int row_from, const int row_to);
|
void processFalseColorCorrectionThread (Imagefloat* im, array2D<float> &rbconv_Y, array2D<float> &rbconv_I, array2D<float> &rbconv_Q, array2D<float> &rbout_I, array2D<float> &rbout_Q, const int row_from, const int row_to);
|
||||||
void hlRecovery (std::string method, float* red, float* green, float* blue, int width, float* hlmax);
|
void hlRecovery (const std::string &method, float* red, float* green, float* blue, int width, float* hlmax);
|
||||||
void transformRect (PreviewProps pp, int tran, int &sx1, int &sy1, int &width, int &height, int &fw);
|
void transformRect (PreviewProps pp, int tran, int &sx1, int &sy1, int &width, int &height, int &fw);
|
||||||
void transformPosition (int x, int y, int tran, int& tx, int& ty);
|
void transformPosition (int x, int y, int tran, int& tx, int& ty);
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ public:
|
|||||||
|
|
||||||
void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb);
|
void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb);
|
||||||
static bool findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in);
|
static bool findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in);
|
||||||
static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], std::string camName)
|
static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], const std::string &camName)
|
||||||
{
|
{
|
||||||
colorSpaceConversion_ (im, cmp, wb, pre_mul, embedded, camprofile, cam, camName);
|
colorSpaceConversion_ (im, cmp, wb, pre_mul, embedded, camprofile, cam, camName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user