[gegl] gegl-cl-color: some coding style and documentation
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-cl-color: some coding style and documentation
- Date: Mon, 20 Aug 2012 17:48:55 +0000 (UTC)
commit 6ba6bb22c2bef864961cafd9d4465d225a565a41
Author: Michael Murà <mure michael gmail com>
Date: Tue Aug 21 01:40:59 2012 +0900
gegl-cl-color: some coding style and documentation
gegl/opencl/gegl-cl-color.c | 86 +++++++++++++++++++++++--------------------
gegl/opencl/gegl-cl-color.h | 23 +++++++++--
gegl/opencl/gegl-cl-types.h | 8 ++--
3 files changed, 68 insertions(+), 49 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-color.c b/gegl/opencl/gegl-cl-color.c
index 801d462..ccd1a46 100644
--- a/gegl/opencl/gegl-cl-color.c
+++ b/gegl/opencl/gegl-cl-color.c
@@ -39,49 +39,49 @@ static const Babl *format[CL_FORMAT_N];
enum
{
-CL_RGBAU8_TO_RGBAF = 0,
-CL_RGBAF_TO_RGBAU8 = 1,
+ CL_RGBAU8_TO_RGBAF = 0,
+ CL_RGBAF_TO_RGBAU8 = 1,
-CL_RGBAF_TO_RAGABAF = 2,
-CL_RAGABAF_TO_RGBAF = 3,
-CL_RGBAU8_TO_RAGABAF = 4,
-CL_RAGABAF_TO_RGBAU8 = 5,
+ CL_RGBAF_TO_RAGABAF = 2,
+ CL_RAGABAF_TO_RGBAF = 3,
+ CL_RGBAU8_TO_RAGABAF = 4,
+ CL_RAGABAF_TO_RGBAU8 = 5,
-CL_RGBAF_TO_RGBA_GAMMA_F = 6,
-CL_RGBA_GAMMA_F_TO_RGBAF = 7,
-CL_RGBAU8_TO_RGBA_GAMMA_F = 8,
-CL_RGBA_GAMMA_F_TO_RGBAU8 = 9,
+ CL_RGBAF_TO_RGBA_GAMMA_F = 6,
+ CL_RGBA_GAMMA_F_TO_RGBAF = 7,
+ CL_RGBAU8_TO_RGBA_GAMMA_F = 8,
+ CL_RGBA_GAMMA_F_T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F_TO_RGB_GAMMA_U8 = 28,
-CL_RGBA_GAMMA_U8_TO_YAF = 29,
-CL_YAF_TO_RGBA_GAMMA_U8 = 30,
-CL_RGB_GAMMA_U8_TO_YAF = 31,
-CL_YAF_TO_RGB_GAMMA_U8 = 32,
+ CL_RGBA_GAMMA_U8_TO_YAF = 29,
+ CL_YAF_TO_RGBA_GAMMA_U8 = 30,
+ CL_RGB_GAMMA_U8_TO_YAF = 31,
+ CL_YAF_TO_RGB_GAMMA_U8 = 32,
};
void
@@ -151,7 +151,8 @@ gegl_cl_color_compile_kernels(void)
static gint
-choose_kernel (const Babl *in_format, const Babl *out_format)
+choose_kernel (const Babl *in_format,
+ const Babl *out_format)
{
gint kernel = -1;
@@ -223,7 +224,8 @@ choose_kernel (const Babl *in_format, const Babl *out_format)
}
gboolean
-gegl_cl_color_babl (const Babl *buffer_format, size_t *bytes)
+gegl_cl_color_babl (const Babl *buffer_format,
+ size_t *bytes)
{
int i;
gboolean supported_format = FALSE;
@@ -261,22 +263,26 @@ gegl_cl_color_babl (const Babl *buffer_format, size_t *bytes)
}
GeglClColorOp
-gegl_cl_color_supported (const Babl *in_format, const Babl *out_format)
+gegl_cl_color_supported (const Babl *in_format,
+ const Babl *out_format)
{
if (in_format == out_format)
return GEGL_CL_COLOR_EQUAL;
if (choose_kernel (in_format, out_format) >= 0)
return GEGL_CL_COLOR_CONVERT;
- else
- return GEGL_CL_COLOR_NOT_SUPPORTED;
+
+ return GEGL_CL_COLOR_NOT_SUPPORTED;
}
#define CL_ERROR {GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(errcode)); return FALSE;}
gboolean
-gegl_cl_color_conv (cl_mem in_tex, cl_mem out_tex, const size_t size,
- const Babl *in_format, const Babl *out_format)
+gegl_cl_color_conv (cl_mem in_tex,
+ cl_mem out_tex,
+ const size_t size,
+ const Babl *in_format,
+ const Babl *out_format)
{
int errcode;
diff --git a/gegl/opencl/gegl-cl-color.h b/gegl/opencl/gegl-cl-color.h
index 992491e..fd0a731 100644
--- a/gegl/opencl/gegl-cl-color.h
+++ b/gegl/opencl/gegl-cl-color.h
@@ -29,13 +29,26 @@ typedef enum
GEGL_CL_COLOR_CONVERT = 2
} GeglClColorOp;
-void gegl_cl_color_compile_kernels(void);
+/** Compile and register OpenCL kernel for color conversion */
+void gegl_cl_color_compile_kernels(void);
-gboolean gegl_cl_color_babl (const Babl *buffer_format, size_t *bytes);
+/** Return TRUE if the Babl format is supported with OpenCL.
+ * If present, returns the byte per pixel in *bytes
+ */
+gboolean gegl_cl_color_babl (const Babl *buffer_format,
+ size_t *bytes);
-GeglClColorOp gegl_cl_color_supported (const Babl *in_format, const Babl *out_format);
+/** Return TRUE if the convertion is OpenCL supported */
+GeglClColorOp gegl_cl_color_supported (const Babl *in_format,
+ const Babl *out_format);
-gboolean gegl_cl_color_conv (cl_mem in_tex, cl_mem aux_tex, const size_t size,
- const Babl *in_format, const Babl *out_format);
+/** Copy and convert size pixels from in_tex to aux_tex.
+ * Return TRUE if succesfull.
+ */
+gboolean gegl_cl_color_conv (cl_mem in_tex,
+ cl_mem aux_tex,
+ const size_t size,
+ const Babl *in_format,
+ const Babl *out_format);
#endif
diff --git a/gegl/opencl/gegl-cl-types.h b/gegl/opencl/gegl-cl-types.h
index cefb40f..7617482 100644
--- a/gegl/opencl/gegl-cl-types.h
+++ b/gegl/opencl/gegl-cl-types.h
@@ -28,10 +28,10 @@
struct _GeglClTexture
{
- cl_mem data;
- cl_image_format format;
- gint width;
- gint height;
+ cl_mem data;
+ cl_image_format format;
+ gint width;
+ gint height;
};
typedef struct _GeglClTexture GeglClTexture;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]