Graceful recovery from EPD tone mapping cholesky segfault. Issue 1112, comment 169, committed on behalf of ralf.anderson
This commit is contained in:
parent
ea598952fa
commit
2dc1f0f9ca
@ -1,6 +1,5 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "rt_math.h"
|
#include "rt_math.h"
|
||||||
|
|
||||||
#include "EdgePreservingDecomposition.h"
|
#include "EdgePreservingDecomposition.h"
|
||||||
|
|
||||||
/* Solves A x = b by the conjugate gradient method, where instead of feeding it the matrix A you feed it a function which
|
/* Solves A x = b by the conjugate gradient method, where instead of feeding it the matrix A you feed it a function which
|
||||||
@ -407,7 +406,12 @@ float *EdgePreservingDecomposition::CreateBlur(float *Source, float Scale, float
|
|||||||
if(UseBlurForEdgeStop) delete[] a;
|
if(UseBlurForEdgeStop) delete[] a;
|
||||||
|
|
||||||
//Solve & return.
|
//Solve & return.
|
||||||
A->CreateIncompleteCholeskyFactorization(1); //Fill-in of 1 seems to work really good. More doesn't really help and less hurts (slightly).
|
bool success=A->CreateIncompleteCholeskyFactorization(1); //Fill-in of 1 seems to work really good. More doesn't really help and less hurts (slightly).
|
||||||
|
if(!success) {
|
||||||
|
fprintf(stderr,"Error: Tonemapping has failed.\n");
|
||||||
|
memset(Blur, 0, sizeof(float)*n); // On failure, set the blur to zero. This is subsequently exponentiated in CompressDynamicRange.
|
||||||
|
return Blur;
|
||||||
|
}
|
||||||
if(!UseBlurForEdgeStop) memcpy(Blur, Source, n*sizeof(float));
|
if(!UseBlurForEdgeStop) memcpy(Blur, Source, n*sizeof(float));
|
||||||
SparseConjugateGradient(A->PassThroughVectorProduct, Source, n, false, Blur, 0.0f, (void *)A, Iterates, A->PassThroughCholeskyBackSolve);
|
SparseConjugateGradient(A->PassThroughVectorProduct, Source, n, false, Blur, 0.0f, (void *)A, Iterates, A->PassThroughCholeskyBackSolve);
|
||||||
A->KillIncompleteCholeskyFactorization();
|
A->KillIncompleteCholeskyFactorization();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user