summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTércio Martins2020-06-23 02:06:00 -0300
committerTércio Martins2020-06-23 02:06:00 -0300
commite2beb7f7aad7c108063ce1f5151d2ba01e3c897d (patch)
tree9d74ba78a7c592f1ee260c9fd3b4b69323027046
parent4ed73cbaeb1b87771d419b208d4270967325913c (diff)
downloadaur-e2beb7f7aad7c108063ce1f5151d2ba01e3c897d.tar.gz
Fix a bug in the DenoiseSharpen plugin - https://github.com/NatronGitHub/Natron/issues/300
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD13
-rw-r--r--openfx-misc-2.3.15-DenoiseSharpen.patch131
3 files changed, 144 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 96557c52f117..0d84d95e0f9a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = openfx-misc
pkgdesc = Miscellaneous OpenFX plugins
pkgver = 2.3.15
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/NatronGitHub/openfx-misc
arch = i686
arch = pentium4
@@ -11,7 +11,9 @@ pkgbase = openfx-misc
depends = libgl
optdepends = natron-plugins-git: More presets for the Shadertoy plugin
source = openfx-misc-Natron-2.3.15.tar.xz::https://github.com/NatronGitHub/openfx-misc/releases/download/Natron-2.3.15/openfx-misc-Natron-2.3.15.tar.xz
+ source = openfx-misc-2.3.15-DenoiseSharpen.patch
sha512sums = 614b12da180ceb4df2ea3a309b434d52eaa4ea6d2bf79ababb00b4b53c637b21c5b96f88ea7e74a2f05a0ef6df4ec1d32484f2c83ee390a193638379c5b868bf
+ sha512sums = e95ee15c7a7215b99d2ab57b8a2b04ff1f504df6993f195a142b4623287ab999c00a9cc767718eb64a072ac4bef16eef1b4646884e9321d3ae652669e9a823cc
pkgname = openfx-misc
diff --git a/PKGBUILD b/PKGBUILD
index 0b97c47853de..9d0b3e34ad6b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@
pkgname=openfx-misc
pkgver=2.3.15
_pkgname="${pkgname}-Natron-${pkgver}"
-pkgrel=1
+pkgrel=2
arch=('i686' 'pentium4' 'x86_64')
pkgdesc="Miscellaneous OpenFX plugins"
url="https://github.com/NatronGitHub/openfx-misc"
@@ -13,8 +13,15 @@ license=('GPL')
depends=('libgl')
makedepends=('openmp')
optdepends=('natron-plugins-git: More presets for the Shadertoy plugin')
-source=("${_pkgname}.tar.xz::${url}/releases/download/Natron-${pkgver}/${_pkgname}.tar.xz")
-sha512sums=('614b12da180ceb4df2ea3a309b434d52eaa4ea6d2bf79ababb00b4b53c637b21c5b96f88ea7e74a2f05a0ef6df4ec1d32484f2c83ee390a193638379c5b868bf')
+source=("${_pkgname}.tar.xz::${url}/releases/download/Natron-${pkgver}/${_pkgname}.tar.xz"
+ "openfx-misc-2.3.15-DenoiseSharpen.patch")
+sha512sums=('614b12da180ceb4df2ea3a309b434d52eaa4ea6d2bf79ababb00b4b53c637b21c5b96f88ea7e74a2f05a0ef6df4ec1d32484f2c83ee390a193638379c5b868bf'
+ 'e95ee15c7a7215b99d2ab57b8a2b04ff1f504df6993f195a142b4623287ab999c00a9cc767718eb64a072ac4bef16eef1b4646884e9321d3ae652669e9a823cc')
+
+prepare() {
+ cd "${srcdir}/${_pkgname}"
+ patch --forward --strip=1 --input="${srcdir}/openfx-misc-2.3.15-DenoiseSharpen.patch"
+}
build() {
cd "${srcdir}/${_pkgname}"
diff --git a/openfx-misc-2.3.15-DenoiseSharpen.patch b/openfx-misc-2.3.15-DenoiseSharpen.patch
new file mode 100644
index 000000000000..ce44f5bedd2e
--- /dev/null
+++ b/openfx-misc-2.3.15-DenoiseSharpen.patch
@@ -0,0 +1,131 @@
+Description: This patch fixes a bug in the DenoiseSharpen plugin that causes Natron to crash under certain conditions.
+
+<https://github.com/NatronGitHub/Natron/issues/300>
+<https://github.com/NatronGitHub/openfx-misc/commit/42fbb836da1e6573d601dc0685309e880cc594c7>
+
+diff --unified --recursive --text openfx-misc-Natron-2.3.15-orig/DenoiseSharpen/DenoiseSharpen.cpp openfx-misc-Natron-2.3.15-new/DenoiseSharpen/DenoiseSharpen.cpp
+--- openfx-misc-Natron-2.3.15-orig/DenoiseSharpen/DenoiseSharpen.cpp 2020-06-07 17:29:17.000000000 -0300
++++ openfx-misc-Natron-2.3.15-new/DenoiseSharpen/DenoiseSharpen.cpp 2020-06-23 01:29:23.146640797 -0300
+@@ -417,9 +417,18 @@
+
+ #if defined(_OPENMP)
+ #define abort_test() if ( !omp_get_thread_num() && abort() ) { throwSuiteStatusException(kOfxStatFailed); }
+-#define abort_test_loop() if ( abort() ) { if ( !omp_get_thread_num() ) {throwSuiteStatusException(kOfxStatFailed);} \
+- else { continue;} \
+-}
++// OpenMP 2.5 specs (https://www.openmp.org/wp-content/uploads/spec25.pdf):
++// "The for-loop must be a structured block, and in addition, its execution
++// must not be terminated by a break statement."
++// So we must use continue instead of break.
++// Besides, it seems like even throwing an exception from the master thread is risky,
++// so let's wait till the loop is finished.
++// Version that throws an exception from the master thread:
++// #define abort_test_loop() if ( abort() ) { if ( !omp_get_thread_num() ) {throwSuiteStatusException(kOfxStatFailed);} \
++// else { continue;} \
++// }
++// Version that never throws an exception inside a loop:
++#define abort_test_loop() if ( abort() ) { continue;}
+ #else
+ #define abort_test() if ( abort() ) { throwSuiteStatusException(kOfxStatFailed); }
+ #define abort_test_loop() abort_test()
+@@ -2028,6 +2037,7 @@
+ fimg_sat[i] = prevsq;
+ }
+ }
++ abort_test();
+ // IntegralCols
+ # ifdef _OPENMP
+ # pragma omp parallel for
+@@ -2041,6 +2051,7 @@
+ fimg_sat[i] = prev;
+ }
+ }
++ abort_test();
+ // ApplyThresholdAdaptive
+ # ifdef _OPENMP
+ # pragma omp parallel for
+@@ -2088,9 +2099,9 @@
+ #endif // ifdef kUseMultithread
+ }
+ hpass = lpass;
++ abort_test();
+ } // for(lev)
+
+- abort_test();
+ // add the last smoothed image to the image
+ #ifdef kUseMultithread
+ {
+@@ -2139,8 +2150,8 @@
+ #pragma omp parallel for
+ #endif
+ for (unsigned int row = 0; row < iheight; ++row) {
+- float* temp = new float[iwidth];
+ abort_test_loop();
++ float* temp = new float[iwidth];
+ hat_transform (temp, fimg[hpass] + row * iwidth, 1, iwidth, b3, 1 << lev);
+ for (unsigned int col = 0; col < iwidth; ++col) {
+ unsigned int i = row * iwidth + col;
+@@ -2159,8 +2170,8 @@
+ #pragma omp parallel for
+ #endif
+ for (unsigned int col = 0; col < iwidth; ++col) {
+- float* temp = new float[iheight];
+ abort_test_loop();
++ float* temp = new float[iheight];
+ hat_transform (temp, fimg[lpass] + col, iwidth, iheight, b3, 1 << lev);
+ for (unsigned int row = 0; row < iheight; ++row) {
+ unsigned int i = row * iwidth + col;
+@@ -2559,6 +2570,8 @@
+ }
+ }
+
++ abort_test();
++
+ // denoise
+
+ if ( (nComponents != 1) && (p.process[0] || p.process[1] || p.process[2]) ) {
+@@ -2567,8 +2580,8 @@
+ if (!( (p.colorModel == eColorModelRGB) || (p.colorModel == eColorModelLinearRGB) ) || p.process[c]) {
+ assert(fimgcolor[c]);
+ float* fimg[4] = { fimgcolor[c], fimgtmp[0], fimgtmp[1], (p.adaptiveRadius > 0) ? fimgtmp[2] : NULL};
+- abort_test();
+ wavelet_denoise(fimg, iwidth, iheight, p.b3, p.noiseLevel[c], p.adaptiveRadius, p.denoise_amount[c], p.sharpen_amount[c], p.sharpen_radius, p.startLevel, (float)c / nComponents, 1.f / nComponents);
++ abort_test();
+ }
+ }
+ }
+@@ -2576,8 +2589,8 @@
+ assert(fimgalpha);
+ // process alpha
+ float* fimg[4] = { fimgalpha, fimgtmp[0], fimgtmp[1], (p.adaptiveRadius > 0) ? fimgtmp[2] : NULL };
+- abort_test();
+ wavelet_denoise(fimg, iwidth, iheight, p.b3, p.noiseLevel[3], p.adaptiveRadius, p.denoise_amount[3], p.sharpen_amount[3], p.sharpen_radius, p.startLevel, (float)(nComponents - 1) / nComponents, 1.f / nComponents);
++ abort_test();
+ }
+
+ // store back into the result
+@@ -3172,6 +3185,8 @@
+ }
+ }
+
++ abort_test();
++
+ // set noise levels
+
+ if (nComponents != 1) {
+@@ -3181,6 +3196,7 @@
+ float* fimg[4] = { fimgcolor[c], fimgtmp[0], fimgtmp[1], fimgtmp[2] };
+ double sigma_n[4];
+ sigma_mad(fimg, bimgmask, iwidth, iheight, b3, sigma_n, (float)c / nComponents, 1.f / nComponents);
++ abort_test();
+ for (unsigned f = 0; f < 4; ++f) {
+ _noiseLevel[c][f]->setValue(sigma_n[f]);
+ }
+@@ -3192,6 +3208,7 @@
+ float* fimg[4] = { fimgalpha, fimgtmp[0], fimgtmp[1], fimgtmp[2] };
+ double sigma_n[4];
+ sigma_mad(fimg, bimgmask, iwidth, iheight, b3, sigma_n, (float)(nComponents - 1) / nComponents, 1.f / nComponents);
++ abort_test();
+ for (unsigned f = 0; f < 4; ++f) {
+ _noiseLevel[3][f]->setValue(sigma_n[f]);
+ }