Some Coverity fixes (#3558)
This commit is contained in:
parent
051670160b
commit
9e5ce9a99b
@ -6,7 +6,7 @@
|
||||
#endif
|
||||
#include "sleef.c"
|
||||
#include "opthelper.h"
|
||||
|
||||
#include <iostream>
|
||||
#define pow_F(a,b) (xexpf(b*xlogf(a)))
|
||||
|
||||
#define DIAGONALS 5
|
||||
@ -883,7 +883,7 @@ float *EdgePreservingDecomposition::CreateIteratedBlur(float *Source, float Scal
|
||||
return Blur;
|
||||
}
|
||||
|
||||
SSEFUNCTION float *EdgePreservingDecomposition::CompressDynamicRange(float *Source, float Scale, float EdgeStopping, float CompressionExponent, float DetailBoost, int Iterates, int Reweightings, float *Compressed)
|
||||
SSEFUNCTION void EdgePreservingDecomposition::CompressDynamicRange(float *Source, float Scale, float EdgeStopping, float CompressionExponent, float DetailBoost, int Iterates, int Reweightings)
|
||||
{
|
||||
if(w < 300 && h < 300) { // set number of Reweightings to zero for small images (thumbnails). We could try to find a better solution here.
|
||||
Reweightings = 0;
|
||||
@ -926,12 +926,7 @@ SSEFUNCTION float *EdgePreservingDecomposition::CompressDynamicRange(float *Sour
|
||||
//Blur. Also setup memory for Compressed (we can just use u since each element of u is used in one calculation).
|
||||
float *u = CreateIteratedBlur(Source, Scale, EdgeStopping, Iterates, Reweightings);
|
||||
|
||||
if(Compressed == nullptr) {
|
||||
Compressed = u;
|
||||
}
|
||||
|
||||
//Apply compression, detail boost, unlogging. Compression is done on the logged data and detail boost on unlogged.
|
||||
// float temp = CompressionExponent - 1.0f;
|
||||
float temp;
|
||||
|
||||
if(DetailBoost > 0.f) {
|
||||
@ -958,8 +953,7 @@ SSEFUNCTION float *EdgePreservingDecomposition::CompressDynamicRange(float *Sour
|
||||
cev = xexpf(LVFU(Source[i]) + LVFU(u[i]) * (tempv)) - epsv;
|
||||
uev = xexpf(LVFU(u[i])) - epsv;
|
||||
sourcev = xexpf(LVFU(Source[i])) - epsv;
|
||||
_mm_storeu_ps( &Source[i], sourcev);
|
||||
_mm_storeu_ps( &Compressed[i], cev + DetailBoostv * (sourcev - uev) );
|
||||
_mm_storeu_ps( &Source[i], cev + DetailBoostv * (sourcev - uev) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -967,7 +961,7 @@ SSEFUNCTION float *EdgePreservingDecomposition::CompressDynamicRange(float *Sour
|
||||
float ce = xexpf(Source[i] + u[i] * (temp)) - eps;
|
||||
float ue = xexpf(u[i]) - eps;
|
||||
Source[i] = xexpf(Source[i]) - eps;
|
||||
Compressed[i] = ce + DetailBoost * (Source[i] - ue);
|
||||
Source[i] = ce + DetailBoost * (Source[i] - ue);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -979,16 +973,11 @@ SSEFUNCTION float *EdgePreservingDecomposition::CompressDynamicRange(float *Sour
|
||||
float ce = xexpf(Source[i] + u[i] * (temp)) - eps;
|
||||
float ue = xexpf(u[i]) - eps;
|
||||
Source[i] = xexpf(Source[i]) - eps;
|
||||
Compressed[i] = ce + DetailBoost * (Source[i] - ue);
|
||||
Source[i] = ce + DetailBoost * (Source[i] - ue);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if(Compressed != u) {
|
||||
delete[] u;
|
||||
}
|
||||
|
||||
return Compressed;
|
||||
|
||||
delete[] u;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public:
|
||||
the more compression is applied, with Compression = 1 giving no effect and above 1 the opposite effect. You can totally
|
||||
use Compression = 1 and play with DetailBoost for some really sweet unsharp masking. If working on luma/grey, consider giving it a logarithm.
|
||||
In place calculation to save memory (Source == Compressed) is totally ok. Reweightings > 0 invokes CreateIteratedBlur instead of CreateBlur. */
|
||||
float *CompressDynamicRange(float *Source, float Scale = 1.0f, float EdgeStopping = 1.4f, float CompressionExponent = 0.8f, float DetailBoost = 0.1f, int Iterates = 20, int Reweightings = 0, float *Compressed = nullptr);
|
||||
void CompressDynamicRange(float *Source, float Scale = 1.0f, float EdgeStopping = 1.4f, float CompressionExponent = 0.8f, float DetailBoost = 0.1f, int Iterates = 20, int Reweightings = 0);
|
||||
|
||||
private:
|
||||
MultiDiagonalSymmetricMatrix *A; //The equations are simple enough to not mandate a matrix class, but fast solution NEEDS a complicated preconditioner.
|
||||
|
@ -317,6 +317,7 @@ CameraConst::parseEntry(void *cJSON_, const char *make_model)
|
||||
return cc;
|
||||
|
||||
parse_error:
|
||||
delete cc;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -6438,7 +6438,7 @@ void ImProcFunctions::EPDToneMapCIE (CieImage *ncie, float a_w, float c_, float
|
||||
|
||||
//Jacques Desmis : always Iterates=5 for compatibility images between preview and output
|
||||
|
||||
epd.CompressDynamicRange (Qpr, (float)sca / skip, (float)edgest, Compression, DetailBoost, Iterates, rew, Qpr);
|
||||
epd.CompressDynamicRange (Qpr, (float)sca / skip, (float)edgest, Compression, DetailBoost, Iterates, rew);
|
||||
|
||||
//Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping.
|
||||
float s = (1.0f + 38.7889f) * powf (Compression, 1.5856f) / (1.0f + 38.7889f * powf (Compression, 1.5856f));
|
||||
@ -6585,7 +6585,7 @@ void ImProcFunctions::EPDToneMap (LabImage *lab, unsigned int Iterates, int skip
|
||||
fwrite(L, N, sizeof(float), f);
|
||||
fclose(f);*/
|
||||
|
||||
epd.CompressDynamicRange (L, sca / float (skip), edgest, Compression, DetailBoost, Iterates, rew, L);
|
||||
epd.CompressDynamicRange (L, sca / float (skip), edgest, Compression, DetailBoost, Iterates, rew);
|
||||
|
||||
//Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping.
|
||||
float s = (1.0f + 38.7889f) * powf (Compression, 1.5856f) / (1.0f + 38.7889f * powf (Compression, 1.5856f));
|
||||
|
@ -1654,7 +1654,7 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat
|
||||
}
|
||||
|
||||
|
||||
epd2.CompressDynamicRange(WavCoeffs_L0, (float)sca / skip, edgest, Compression, DetailBoost, Iterates, rew, WavCoeffs_L0);
|
||||
epd2.CompressDynamicRange(WavCoeffs_L0, (float)sca / skip, edgest, Compression, DetailBoost, Iterates, rew);
|
||||
|
||||
//Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping.
|
||||
#ifdef _RT_NESTED_OPENMP
|
||||
|
@ -8502,6 +8502,12 @@ PartialProfile::PartialProfile(const ProcParams* pp, const ParamsEdited* pe)
|
||||
}
|
||||
}
|
||||
|
||||
PartialProfile::~PartialProfile()
|
||||
{
|
||||
delete pparams;
|
||||
delete pedited;
|
||||
}
|
||||
|
||||
int PartialProfile::load (const Glib::ustring &fName)
|
||||
{
|
||||
if (!pparams) {
|
||||
|
@ -1435,6 +1435,7 @@ public:
|
||||
PartialProfile (bool createInstance = false, bool paramsEditedValue = false);
|
||||
PartialProfile (ProcParams* pp, ParamsEdited* pe = nullptr, bool fullCopy = false);
|
||||
PartialProfile (const ProcParams* pp, const ParamsEdited* pe = nullptr);
|
||||
~PartialProfile ();
|
||||
void deleteInstance ();
|
||||
void clearGeneral ();
|
||||
int load (const Glib::ustring &fName);
|
||||
|
@ -451,7 +451,7 @@ public:
|
||||
};
|
||||
|
||||
EditorPanel::EditorPanel (FilePanel* filePanel)
|
||||
: catalogPane(nullptr), realized(false), iHistoryShow(nullptr), iHistoryHide(nullptr), iTopPanel_1_Show(nullptr), iTopPanel_1_Hide(nullptr), iRightPanel_1_Show(nullptr), iRightPanel_1_Hide(nullptr), iBeforeLockON(nullptr), iBeforeLockOFF(nullptr), beforePreviewHandler(nullptr), beforeIarea(nullptr), beforeBox(nullptr), afterBox(nullptr), afterHeaderBox(nullptr), parent(nullptr), openThm(nullptr), ipc(nullptr), beforeIpc(nullptr), isProcessing(false)
|
||||
: catalogPane(nullptr), realized(false), tbBeforeLock(nullptr), iHistoryShow(nullptr), iHistoryHide(nullptr), iTopPanel_1_Show(nullptr), iTopPanel_1_Hide(nullptr), iRightPanel_1_Show(nullptr), iRightPanel_1_Hide(nullptr), iBeforeLockON(nullptr), iBeforeLockOFF(nullptr), previewHandler(nullptr), beforePreviewHandler(nullptr), beforeIarea(nullptr), beforeBox(nullptr), afterBox(nullptr), beforeLabel(nullptr), afterLabel(nullptr), beforeHeaderBox(nullptr), afterHeaderBox(nullptr), parent(nullptr), openThm(nullptr), isrc(nullptr), ipc(nullptr), beforeIpc(nullptr), err(0), isProcessing(false)
|
||||
{
|
||||
|
||||
epih = new EditorPanelIdleHelper;
|
||||
@ -1689,6 +1689,8 @@ bool EditorPanel::idle_saveImage (ProgressConnector<rtengine::IImage16*> *pc, Gl
|
||||
else if (sf.format == "jpg")
|
||||
ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsJPEG), fname, sf.jpegQuality, sf.jpegSubSamp),
|
||||
sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf));
|
||||
else
|
||||
delete ld;
|
||||
} else {
|
||||
Glib::ustring msg_ = Glib::ustring ("<b>") + fname + ": Error during image processing\n</b>";
|
||||
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||
|
@ -168,6 +168,11 @@ PreviewLoader::PreviewLoader():
|
||||
{
|
||||
}
|
||||
|
||||
PreviewLoader::~PreviewLoader()
|
||||
{
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
PreviewLoader* PreviewLoader::getInstance()
|
||||
{
|
||||
static PreviewLoader instance_;
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
private:
|
||||
|
||||
PreviewLoader();
|
||||
~PreviewLoader();
|
||||
|
||||
class Impl;
|
||||
Impl* impl_;
|
||||
|
@ -184,6 +184,11 @@ ThumbImageUpdater::ThumbImageUpdater():
|
||||
{
|
||||
}
|
||||
|
||||
ThumbImageUpdater::~ThumbImageUpdater()
|
||||
{
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
void
|
||||
ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upgrade, ThumbImageUpdateListener* l)
|
||||
{
|
||||
|
@ -93,6 +93,7 @@ public:
|
||||
private:
|
||||
|
||||
ThumbImageUpdater();
|
||||
~ThumbImageUpdater();
|
||||
|
||||
class Impl;
|
||||
Impl* impl_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user