[arrayfire] 189/284: Freeimage only requires the flags for 24 / 32 bit images
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit 17b2600f9ba4e0d5b258213655c65053201c5ad7
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Sun Jan 10 13:11:21 2016 -0500
Freeimage only requires the flags for 24 / 32 bit images
---
src/api/c/imageio.cpp | 15 ++++++++-------
src/api/c/imageio2.cpp | 18 ++++++++++--------
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/api/c/imageio.cpp b/src/api/c/imageio.cpp
index c6a20a8..e372cd7 100644
--- a/src/api/c/imageio.cpp
+++ b/src/api/c/imageio.cpp
@@ -60,14 +60,15 @@ static af_err readImage(af_array *rImage, const uchar* pSrcLine, const int nSrcP
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));
} else {
// Non 8-bit types do not use ordering
// See Pixel Access Functions Chapter in FreeImage Doc
- 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));
+ pDst0[indx] = (float) *(src + (x * step + 0));
+ pDst1[indx] = (float) *(src + (x * step + 1));
+ pDst2[indx] = (float) *(src + (x * step + 2));
+ if (fo_color == 4) pDst3[indx] = (float) *(src + (x * step + 3));
}
- if (fo_color == 4) pDst3[indx] = (float) *(src + (x * step + FI_RGBA_ALPHA));
}
indx++;
}
@@ -104,9 +105,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 + FI_RGBA_RED));
- g = (T) *(src + (x * step + FI_RGBA_GREEN));
- b = (T) *(src + (x * step + FI_RGBA_BLUE));
+ r = (T) *(src + (x * step + 0));
+ g = (T) *(src + (x * step + 1));
+ b = (T) *(src + (x * step + 2));
}
pDst[indx] = r * 0.2989f + g * 0.5870f + b * 0.1140f;
}
diff --git a/src/api/c/imageio2.cpp b/src/api/c/imageio2.cpp
index aed793e..a1374a2 100644
--- a/src/api/c/imageio2.cpp
+++ b/src/api/c/imageio2.cpp
@@ -58,14 +58,15 @@ static af_err readImage_t(af_array *rImage, const uchar* pSrcLine, const int nSr
pDst0[indx] = (T) *(src + (x * step + FI_RGBA_RED));
pDst1[indx] = (T) *(src + (x * step + FI_RGBA_GREEN));
pDst2[indx] = (T) *(src + (x * step + FI_RGBA_BLUE));
+ if (fi_color == 4) pDst3[indx] = (T) *(src + (x * step + FI_RGBA_ALPHA));
} else {
// Non 8-bit types do not use ordering
// See Pixel Access Functions Chapter in FreeImage Doc
- pDst0[indx] = (T) *(src + (x * step + FI_RGBA_RED));
- pDst1[indx] = (T) *(src + (x * step + FI_RGBA_GREEN));
- pDst2[indx] = (T) *(src + (x * step + FI_RGBA_BLUE));
+ pDst0[indx] = (T) *(src + (x * step + 0));
+ pDst1[indx] = (T) *(src + (x * step + 1));
+ pDst2[indx] = (T) *(src + (x * step + 2));
+ if (fi_color == 4) pDst3[indx] = (T) *(src + (x * step + 3));
}
- if (fi_color == 4) pDst3[indx] = (T) *(src + (x * step + FI_RGBA_ALPHA));
}
indx++;
}
@@ -242,15 +243,16 @@ static void save_t(T* pDstLine, const af_array in, const dim4 dims, uint nDstPit
*(pDstLine + x * step + FI_RGBA_RED ) = (T) pSrc0[indx]; // r -> 0
*(pDstLine + x * step + FI_RGBA_GREEN) = (T) pSrc1[indx]; // g -> 1
*(pDstLine + x * step + FI_RGBA_BLUE ) = (T) pSrc2[indx]; // b -> 2
+ if(channels >= 4) *(pDstLine + x * step + FI_RGBA_ALPHA) = (T) pSrc3[indx]; // a
} else {
// Non 8-bit types do not use ordering
// See Pixel Access Functions Chapter in FreeImage Doc
- *(pDstLine + x * step + FI_RGBA_RED ) = (T) pSrc0[indx]; // r -> 0
- *(pDstLine + x * step + FI_RGBA_GREEN) = (T) pSrc1[indx]; // g -> 1
- *(pDstLine + x * step + FI_RGBA_BLUE ) = (T) pSrc2[indx]; // b -> 2
+ *(pDstLine + x * step + 0) = (T) pSrc0[indx]; // r -> 0
+ *(pDstLine + x * step + 1) = (T) pSrc1[indx]; // g -> 1
+ *(pDstLine + x * step + 2) = (T) pSrc2[indx]; // b -> 2
+ if(channels >= 4) *(pDstLine + x * step + 3) = (T) pSrc3[indx]; // a
}
}
- if(channels >= 4) *(pDstLine + x * step + FI_RGBA_ALPHA) = (T) pSrc3[indx]; // a
++indx;
}
pDstLine = (T*)(((uchar*)pDstLine) - nDstPitch);
--
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