[arrayfire] 01/03: Refresh patch queue: - Delete Fixing-select-and-replace-tests.patch, already dropped. - Refresh Use-system-gtest.patch and Use-system-mathjax.patch. - Add cherry-picked upstream fix for ArrayFire image i/o on selected architectures. File: Always-use-freeimage-flags-instead-of-hardcoded-offsets.patch
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Jan 10 23:22:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.
commit a84107e525493bfc553240760f61834268548021
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date: Fri Jan 8 19:20:15 2016 +0000
Refresh patch queue:
- Delete Fixing-select-and-replace-tests.patch, already dropped.
- Refresh Use-system-gtest.patch and Use-system-mathjax.patch.
- Add cherry-picked upstream fix for ArrayFire image i/o on selected
architectures.
File: Always-use-freeimage-flags-instead-of-hardcoded-offsets.patch
---
...eimage-flags-instead-of-hardcoded-offsets.patch | 94 ++++++++++++++++
.../patches/Fixing-select-and-replace-tests.patch | 125 ---------------------
debian/patches/Use-system-gtest.patch | 8 +-
debian/patches/Use-system-mathjax.patch | 2 +-
debian/patches/series | 1 +
5 files changed, 101 insertions(+), 129 deletions(-)
diff --git a/debian/patches/Always-use-freeimage-flags-instead-of-hardcoded-offsets.patch b/debian/patches/Always-use-freeimage-flags-instead-of-hardcoded-offsets.patch
new file mode 100644
index 0000000..42857f3
--- /dev/null
+++ b/debian/patches/Always-use-freeimage-flags-instead-of-hardcoded-offsets.patch
@@ -0,0 +1,94 @@
+From: Pavan Yalamanchili <pavan at arrayfire.com>
+Date: Fri, 8 Jan 2016 08:43:51 -0500
+Subject: Always use freeimage flags instead of hardcoded offsets
+
+---
+ src/api/c/imageio.cpp | 40 ++++++++++++++++++++--------------------
+ 1 file changed, 20 insertions(+), 20 deletions(-)
+
+diff --git a/src/api/c/imageio.cpp b/src/api/c/imageio.cpp
+index 746ee69..c6a20a8 100644
+--- a/src/api/c/imageio.cpp
++++ b/src/api/c/imageio.cpp
+@@ -63,9 +63,9 @@ static af_err readImage(af_array *rImage, const uchar* pSrcLine, const int nSrcP
+ } else {
+ // Non 8-bit types do not use ordering
+ // See Pixel Access Functions Chapter in FreeImage Doc
+- pDst0[indx] = (float) *(src + (x * step + 0));
+- pDst1[indx] = (float) *(src + (x * step + 1));
+- pDst2[indx] = (float) *(src + (x * step + 2));
++ pDst0[indx] = (float) *(src + (x * step + FI_RGBA_RED));
++ pDst1[indx] = (float) *(src + (x * step + FI_RGBA_GREEN));
++ pDst2[indx] = (float) *(src + (x * step + FI_RGBA_BLUE));
+ }
+ if (fo_color == 4) pDst3[indx] = (float) *(src + (x * step + FI_RGBA_ALPHA));
+ }
+@@ -104,9 +104,9 @@ static af_err readImage(af_array *rImage, const uchar* pSrcLine, const int nSrcP
+ } else {
+ // Non 8-bit types do not use ordering
+ // See Pixel Access Functions Chapter in FreeImage Doc
+- r = (T) *(src + (x * step + 0));
+- g = (T) *(src + (x * step + 1));
+- b = (T) *(src + (x * step + 2));
++ r = (T) *(src + (x * step + FI_RGBA_RED));
++ g = (T) *(src + (x * step + FI_RGBA_GREEN));
++ b = (T) *(src + (x * step + FI_RGBA_BLUE));
+ }
+ pDst[indx] = r * 0.2989f + g * 0.5870f + b * 0.1140f;
+ }
+@@ -333,10 +333,10 @@ af_err af_save_image(const char* filename, const af_array in_)
+ // Copy the array into FreeImage buffer
+ for (uint y = 0; y < fi_h; ++y) {
+ for (uint x = 0; x < fi_w; ++x) {
+- *(pDstLine + x * step + 0) = (uchar) pSrc2[indx]; // r
+- *(pDstLine + x * step + 1) = (uchar) pSrc1[indx]; // g
+- *(pDstLine + x * step + 2) = (uchar) pSrc0[indx]; // b
+- *(pDstLine + x * step + 3) = (uchar) pSrc3[indx]; // a
++ *(pDstLine + x * step + FI_RGBA_RED ) = (uchar) pSrc0[indx]; // r
++ *(pDstLine + x * step + FI_RGBA_GREEN) = (uchar) pSrc1[indx]; // g
++ *(pDstLine + x * step + FI_RGBA_BLUE ) = (uchar) pSrc2[indx]; // b
++ *(pDstLine + x * step + FI_RGBA_ALPHA) = (uchar) pSrc3[indx]; // a
+ ++indx;
+ }
+ pDstLine -= nDstPitch;
+@@ -362,9 +362,9 @@ af_err af_save_image(const char* filename, const af_array in_)
+ // Copy the array into FreeImage buffer
+ for (uint y = 0; y < fi_h; ++y) {
+ for (uint x = 0; x < fi_w; ++x) {
+- *(pDstLine + x * step + 0) = (uchar) pSrc2[indx]; // r
+- *(pDstLine + x * step + 1) = (uchar) pSrc1[indx]; // g
+- *(pDstLine + x * step + 2) = (uchar) pSrc0[indx]; // b
++ *(pDstLine + x * step + FI_RGBA_RED ) = (uchar) pSrc0[indx]; // r
++ *(pDstLine + x * step + FI_RGBA_GREEN) = (uchar) pSrc1[indx]; // g
++ *(pDstLine + x * step + FI_RGBA_BLUE ) = (uchar) pSrc2[indx]; // b
+ ++indx;
+ }
+ pDstLine -= nDstPitch;
+@@ -602,10 +602,10 @@ af_err af_save_image_memory(void **ptr, const af_array in_, const af_image_forma
+ // Copy the array into FreeImage buffer
+ for (uint y = 0; y < fi_h; ++y) {
+ for (uint x = 0; x < fi_w; ++x) {
+- *(pDstLine + x * step + 2) = (uchar) pSrc0[indx]; // b
+- *(pDstLine + x * step + 1) = (uchar) pSrc1[indx]; // g
+- *(pDstLine + x * step + 0) = (uchar) pSrc2[indx]; // r
+- *(pDstLine + x * step + 3) = (uchar) pSrc3[indx]; // a
++ *(pDstLine + x * step + FI_RGBA_RED ) = (uchar) pSrc0[indx]; // r
++ *(pDstLine + x * step + FI_RGBA_GREEN) = (uchar) pSrc1[indx]; // g
++ *(pDstLine + x * step + FI_RGBA_BLUE ) = (uchar) pSrc2[indx]; // b
++ *(pDstLine + x * step + FI_RGBA_ALPHA) = (uchar) pSrc3[indx]; // a
+ ++indx;
+ }
+ pDstLine -= nDstPitch;
+@@ -631,9 +631,9 @@ af_err af_save_image_memory(void **ptr, const af_array in_, const af_image_forma
+ // Copy the array into FreeImage buffer
+ for (uint y = 0; y < fi_h; ++y) {
+ for (uint x = 0; x < fi_w; ++x) {
+- *(pDstLine + x * step + 2) = (uchar) pSrc0[indx]; // b
+- *(pDstLine + x * step + 1) = (uchar) pSrc1[indx]; // g
+- *(pDstLine + x * step + 0) = (uchar) pSrc2[indx]; // r
++ *(pDstLine + x * step + FI_RGBA_RED ) = (uchar) pSrc0[indx]; // r
++ *(pDstLine + x * step + FI_RGBA_GREEN) = (uchar) pSrc1[indx]; // g
++ *(pDstLine + x * step + FI_RGBA_BLUE ) = (uchar) pSrc2[indx]; // b
+ ++indx;
+ }
+ pDstLine -= nDstPitch;
diff --git a/debian/patches/Fixing-select-and-replace-tests.patch b/debian/patches/Fixing-select-and-replace-tests.patch
deleted file mode 100644
index a138bc0..0000000
--- a/debian/patches/Fixing-select-and-replace-tests.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From: Pavan Yalamanchili <pavan at arrayfire.com>
-Date: Mon, 14 Dec 2015 11:18:17 -0500
-Subject: Fixing select and replace tests
-
----
- test/replace.cpp | 22 +++++++++++++++++-----
- test/select.cpp | 20 +++++++++++++++-----
- 2 files changed, 32 insertions(+), 10 deletions(-)
-
-diff --git a/test/replace.cpp b/test/replace.cpp
-index c6d3b5d..9e99eae 100644
---- a/test/replace.cpp
-+++ b/test/replace.cpp
-@@ -35,10 +35,17 @@ void replaceTest(const dim4 &dims)
- af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
-
- array a = randu(dims, ty);
-- array c = a.copy();
-- array cond = randu(dims, ty) > constant(0.3, dims, ty);
- array b = randu(dims, ty);
-
-+ if (a.isinteger()) {
-+ a = (a % (1 << 30)).as(ty);
-+ b = (b % (1 << 30)).as(ty);
-+ }
-+
-+ array c = a.copy();
-+
-+ array cond = randu(dims, ty) > a;
-+
- replace(c, cond, b);
-
- int num = (int)a.elements();
-@@ -65,8 +72,13 @@ void replaceScalarTest(const dim4 &dims)
- af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
-
- array a = randu(dims, ty);
-+
-+ if (a.isinteger()) {
-+ a = (a % (1 << 30)).as(ty);
-+ }
-+
- array c = a.copy();
-- array cond = randu(dims, ty) > constant(0.3, dims, ty);
-+ array cond = randu(dims, ty) > a;
- double b = 3;
-
- replace(c, cond, b);
-@@ -81,7 +93,7 @@ void replaceScalarTest(const dim4 &dims)
- cond.host(&hcond[0]);
-
- for (int i = 0; i < num; i++) {
-- ASSERT_EQ(hc[i], hcond[i] ? b : ha[i]);
-+ ASSERT_EQ(hc[i], hcond[i] ? T(b) : ha[i]);
- }
- }
-
-@@ -103,7 +115,7 @@ TEST(Replace, NaN)
- array a = randu(dims, ty);
- a(seq(a.dims(0) / 2), span, span, span) = af::NaN;
- array c = a.copy();
-- double b = 0;
-+ float b = 0;
- replace(c, isNaN(c), b);
-
- int num = (int)a.elements();
-diff --git a/test/select.cpp b/test/select.cpp
-index 91c8110..1c39282 100644
---- a/test/select.cpp
-+++ b/test/select.cpp
-@@ -34,9 +34,15 @@ void selectTest(const dim4 &dims)
- af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
-
- array a = randu(dims, ty);
-- array cond = randu(dims, ty) > constant(0.3, dims, ty);
- array b = randu(dims, ty);
-
-+ if (a.isinteger()) {
-+ a = (a % (1 << 30)).as(ty);
-+ b = (b % (1 << 30)).as(ty);
-+ }
-+
-+ array cond = randu(dims, ty) > a;
-+
- array c = select(cond, a, b);
-
- int num = (int)a.elements();
-@@ -63,9 +69,13 @@ void selectScalarTest(const dim4 &dims)
- af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
-
- array a = randu(dims, ty);
-- array cond = randu(dims, ty) > constant(0.3, dims, ty);
-+ array cond = randu(dims, ty) > a;
- double b = 3;
-
-+ if (a.isinteger()) {
-+ a = (a % (1 << 30)).as(ty);
-+ }
-+
- array c = is_right ? select(cond, a, b) : select(cond, b, a);
-
- int num = (int)a.elements();
-@@ -80,11 +90,11 @@ void selectScalarTest(const dim4 &dims)
-
- if (is_right) {
- for (int i = 0; i < num; i++) {
-- ASSERT_EQ(hc[i], hcond[i] ? ha[i] : b);
-+ ASSERT_EQ(hc[i], hcond[i] ? ha[i] : T(b));
- }
- } else {
- for (int i = 0; i < num; i++) {
-- ASSERT_EQ(hc[i], hcond[i] ? b : ha[i]);
-+ ASSERT_EQ(hc[i], hcond[i] ? T(b) : ha[i]);
- }
- }
- }
-@@ -111,7 +121,7 @@ TEST(Select, NaN)
-
- array a = randu(dims, ty);
- a(seq(a.dims(0) / 2), span, span, span) = af::NaN;
-- double b = 0;
-+ float b = 0;
- array c = select(isNaN(a), b, a);
-
- int num = (int)a.elements();
diff --git a/debian/patches/Use-system-gtest.patch b/debian/patches/Use-system-gtest.patch
index 98198a7..4ca7dd7 100644
--- a/debian/patches/Use-system-gtest.patch
+++ b/debian/patches/Use-system-gtest.patch
@@ -3,12 +3,14 @@ Date: Tue, 17 Nov 2015 12:04:49 +0000
Subject: Use system gtest.
---
- CMakeModules/build_gtest.cmake | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
+ test/CMakeModules/build_gtest.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+diff --git a/test/CMakeModules/build_gtest.cmake b/test/CMakeModules/build_gtest.cmake
+index eb4a0ad..d0b4001 100644
--- a/test/CMakeModules/build_gtest.cmake
+++ b/test/CMakeModules/build_gtest.cmake
-@@ -51,7 +51,7 @@
+@@ -51,7 +51,7 @@ ExternalProject_Add(
${BUILD_NAME}
# URL http://googletest.googlecode.com/files/gtest-1.7.0.zip
# URL_MD5 2d6ec8ccdf5c46b05ba54a9fd1d130d7
diff --git a/debian/patches/Use-system-mathjax.patch b/debian/patches/Use-system-mathjax.patch
index be4a20c..83301a7 100644
--- a/debian/patches/Use-system-mathjax.patch
+++ b/debian/patches/Use-system-mathjax.patch
@@ -7,7 +7,7 @@ Subject: Use system mathjax.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/doxygen.mk b/docs/doxygen.mk
-index defb7fe..1a1a266 100644
+index 46a1dc0..2c64c41 100644
--- a/docs/doxygen.mk
+++ b/docs/doxygen.mk
@@ -1464,7 +1464,7 @@ MATHJAX_FORMAT = HTML-CSS
diff --git a/debian/patches/series b/debian/patches/series
index f64c3c8..671fbcb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ Use-system-mathjax.patch
Disable-privacy-breaching-settings.patch
Use-system-gtest.patch
Disable-git-usage-in-Doxygen-settings.patch
+Always-use-freeimage-flags-instead-of-hardcoded-offsets.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list