[arrayfire] 225/408: Modified colorspace function to handle new colorspace - YCbCr

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:03 UTC 2015


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 587aa2d9ce75b6181c9fbe4fd51a40098461e5e4
Author: pradeep <pradeep at arrayfire.com>
Date:   Mon Aug 10 19:41:13 2015 -0400

    Modified colorspace function to handle new colorspace - YCbCr
---
 include/af/defines.h     |  3 ++-
 src/api/c/colorspace.cpp | 22 +++++++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/include/af/defines.h b/include/af/defines.h
index b85e456..28f7c96 100644
--- a/include/af/defines.h
+++ b/include/af/defines.h
@@ -243,7 +243,8 @@ typedef enum {
 typedef enum {
     AF_GRAY = 0, ///< Grayscale
     AF_RGB,      ///< 3-channel RGB
-    AF_HSV       ///< 3-channel HSV
+    AF_HSV,      ///< 3-channel HSV
+    AF_YCbCr     ///< 3-channel YCbCr
 } af_cspace_t;
 
 typedef enum {
diff --git a/src/api/c/colorspace.cpp b/src/api/c/colorspace.cpp
index e86b262..5933033 100644
--- a/src/api/c/colorspace.cpp
+++ b/src/api/c/colorspace.cpp
@@ -13,19 +13,23 @@
 
 af_err af_color_space(af_array *out, const af_array image, const af_cspace_t to, const af_cspace_t from)
 {
-    bool hsv2rgb  = (from==AF_HSV  && to==AF_RGB );
-    bool rgb2hsv  = (from==AF_RGB  && to==AF_HSV );
-    bool gray2rgb = (from==AF_GRAY && to==AF_RGB );
-    bool rgb2gray = (from==AF_RGB  && to==AF_GRAY);
+    bool hsv2rgb  = (from==AF_HSV   && to==AF_RGB  );
+    bool rgb2hsv  = (from==AF_RGB   && to==AF_HSV  );
+    bool gray2rgb = (from==AF_GRAY  && to==AF_RGB  );
+    bool rgb2gray = (from==AF_RGB   && to==AF_GRAY );
+    bool ycbcr2rgb= (from==AF_YCbCr && to==AF_RGB  );
+    bool rgb2ycbcr= (from==AF_RGB   && to==AF_YCbCr);
 
-    ARG_ASSERT(2, (hsv2rgb || rgb2hsv || gray2rgb || rgb2gray));
+    ARG_ASSERT(2, (hsv2rgb || rgb2hsv || gray2rgb || rgb2gray || ycbcr2rgb || rgb2ycbcr));
 
     af_err result = AF_SUCCESS;
 
-    if (hsv2rgb)  result = af_hsv2rgb(out, image);
-    if (rgb2hsv)  result = af_rgb2hsv(out, image);
-    if (gray2rgb) result = af_gray2rgb(out, image, 1.0f, 1.0f, 1.0f);
-    if (rgb2gray) result = af_rgb2gray(out, image, 0.2126f, 0.7152f, 0.0722f);
+    if (hsv2rgb)   result = af_hsv2rgb(out, image);
+    if (rgb2hsv)   result = af_rgb2hsv(out, image);
+    if (gray2rgb)  result = af_gray2rgb(out, image, 1.0f, 1.0f, 1.0f);
+    if (rgb2gray)  result = af_rgb2gray(out, image, 0.2126f, 0.7152f, 0.0722f);
+    if (ycbcr2rgb) result = af_ycbcr2rgb(out, image, AF_YCC_601);
+    if (rgb2ycbcr) result = af_rgb2ycbcr(out, image, AF_YCC_601);
 
     return result;
 }

-- 
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