Code Refactoring: apply unified color format 52/169652/5 accepted/tizen/unified/20180214.144545 submit/tizen/20180212.075159
authorJiyong Min <jiyong.min@samsung.com>
Thu, 8 Feb 2018 06:34:05 +0000 (15:34 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Thu, 8 Feb 2018 07:45:17 +0000 (16:45 +0900)
 - Add 'mmutil_common' library for using all
 - Replace color interface 'mmutil_imgp' to 'mmutil_common' library
 - Unify color formats
 - Remove unused replacement in spec file
 - Remove unused 'format' parameter of internal crop function

Change-Id: I308e484b90b958e870959214215c8f649b68e698

25 files changed:
CMakeLists.txt
bmp/include/mm_util_bmp.h
common/CMakeLists.txt [new file with mode: 0755]
common/include/mm_util_color_image.h [new file with mode: 0755]
common/include/mm_util_common.h [new file with mode: 0755]
common/include/mm_util_private.h
common/include/mm_util_type.h
common/mm_util_color_image.c [new file with mode: 0755]
common/mmutil-common.pc.in [new file with mode: 0755]
imgcv/test/mm_util_imgcv_testsuite.c
imgp/CMakeLists.txt
imgp/include/mm_util_imgp.h
imgp/include/mm_util_imgp_internal.h
imgp/mm_util_imgp.c
imgp/test/mm_util_imgp_testsuite.c
jpeg/CMakeLists.txt
jpeg/include/mm_util_jpeg.h
jpeg/mm_util_jpeg.c
jpeg/test/mm_util_jpeg_testsuite.c
magick/include/mm_util_magick.h
magick/mm_util_magick.c
magick/test/mm_util_magick_testsuite.c
packaging/libmm-utility.spec
png/include/mm_util_png.h
png/mm_util_png.c

index 853406c..53a91a0 100755 (executable)
@@ -16,6 +16,7 @@ INSTALL(
         PATTERN "${INC_DIR}/*.h"
         )
 
+ADD_SUBDIRECTORY(common)
 ADD_SUBDIRECTORY(bmp)
 ADD_SUBDIRECTORY(gif)
 ADD_SUBDIRECTORY(imgcv)
index edd6b92..03f358c 100755 (executable)
@@ -35,13 +35,6 @@ extern "C" {
     This part describes the APIs with repect to multimedia image library.
 */
 
-/**
- * format for bmp
- */
-typedef enum {
-       MM_UTIL_BMP_FMT_RGBA8888,     /**< RGBA8888 format */
-} mm_util_bmp_format;
-
 typedef struct {
        unsigned long width;            /**< width */
        unsigned long height;           /**< height */
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..1baec8e
--- /dev/null
@@ -0,0 +1,72 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "mmutil_common")
+
+PROJECT(${fw_name})
+
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.0.0")
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR
+       include
+       )
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog glib-2.0")
+SET(pc_dependents "dlog capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+
+aux_source_directory(. SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+SET_TARGET_PROPERTIES(${fw_name}
+       PROPERTIES
+       VERSION ${VERSION}
+       SOVERSION ${VERSION_MAJOR}
+       CLEAN_DIRECT_OUTPUT 1
+)
+
+SET(BUILD_CHECK "true")
+IF("${BUILD_CHECK}" STREQUAL "true")
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/mmf
+        FILES_MATCHING
+        PATTERN "*_internal.h" EXCLUDE
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME mmutil-common)
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_FILE_NAME ${PC_NAME}.pc.in)
+
+CONFIGURE_FILE(
+    ${PC_FILE_NAME}
+    ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+#ADD_SUBDIRECTORY(test)
+ENDIF("${BUILD_CHECK}" STREQUAL "true")
diff --git a/common/include/mm_util_color_image.h b/common/include/mm_util_color_image.h
new file mode 100755 (executable)
index 0000000..6849f96
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * libmm-utility
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: YoungHun Kim <yh8004.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __MM_UTIL_COLOR_IMAGE_H__
+#define __MM_UTIL_COLOR_IMAGE_H__
+
+#include "mm_util_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IS_MM_UTIL_COLOR_FORMAT(color) mm_util_is_valid_color_format(color)
+
+gboolean mm_util_is_valid_color_format(mm_util_color_format_e color);
+
+/**
+ *
+ * @remark     Creates the handle of empty color image
+ *
+ * @param      image           [in/out]                The handle of the color image
+ * @return     This function returns created color image handle
+ *             if the result is 0, then handle creation succeed
+ *             else if the result is -1, then handle creation failed
+ */
+int mm_util_create_empty_color_image(mm_util_color_image_h *image);
+
+/**
+ *
+ * @remark     Creates the handle of color image with data
+ *
+ * @param      image           [in/out]                The handle of the color image
+ * @param      width           [in]                    The width of color image
+ * @param      height          [in]                    The height of color image
+ * @param      color           [in]                    The color format of color image
+ * @param      data            [in]                    The data of color image
+ * @param      size            [in]                    The data-size of color image
+ * @return     This function returns created color image handle
+ *             if the result is 0, then handle creation succeed
+ *             else if the result is -1, then handle creation failed
+ */
+int mm_util_create_color_image(mm_util_color_image_h *image, unsigned long width, unsigned long height, mm_util_color_format_e color, void *data, size_t size);
+
+/**
+ *
+ * @remark     Sets the data of color image to handle
+ *
+ * @param      image           [in]                    The handle of the color image
+ * @param      width           [in]                    The width of color image
+ * @param      height          [in]                    The height of color image
+ * @param      color           [in]                    The color format of color image
+ * @param      data            [in]                    The data of color image
+ * @param      size            [in]                    The data-size of color image
+ * @return     This function returns the result of setting the data in handle
+ *             if the result is 0, then setting the data has succeed
+ *             else if the result is -1, then setting the data has failed
+ */
+int mm_util_set_color_image(mm_util_color_image_h image, unsigned long width, unsigned long height, mm_util_color_format_e color, void *data, size_t size);
+
+/**
+ *
+ * @remark     Gets the data of color image from handle
+ *
+ * @param      image           [in]                    The handle of the color image
+ * @param      width           [in/out]                The width of color image
+ * @param      height          [in/out]                The height of color image
+ * @param      color           [in/out]                The color format of color image
+ * @param      data            [in/out]                The data of color image
+ * @param      size            [in/out]                The data-size of color image
+ * @return     This function returns the result of getting the data from handle
+ *             if the result is 0, then getting the data has succeed
+ *             else if the result is -1, then getting the data has failed
+ */
+int mm_util_get_color_image(mm_util_color_image_h image, unsigned long *width, unsigned long *height, mm_util_color_format_e *color, void **data, size_t *size);
+
+/**
+ *
+ * @remark     Destroys the handle of color image
+ *
+ * @param      image           [in]                    The handle of the color image
+ */
+void mm_util_destroy_color_image(mm_util_color_image_h image);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif   /*__MM_UTIL_COLOR_IMAGE_H__*/
diff --git a/common/include/mm_util_common.h b/common/include/mm_util_common.h
new file mode 100755 (executable)
index 0000000..8c004e5
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * libmm-utility
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: YoungHun Kim <yh8004.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __MM_UTIL_COMMON_H__
+#define __MM_UTIL_COMMON_H__
+
+#include "mm_util_color_image.h"
+
+
+#endif   /*__MM_UTIL_COMMON_H__*/
index 2de2601..d6b1de7 100755 (executable)
@@ -38,6 +38,14 @@ extern "C" {
 #define MMUTIL_SAFE_STRCPY(dst, src, n)        g_strlcpy(dst, src, n)
 #define MMUTIL_STRING_VALID(str)       ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
 
+typedef struct {
+       unsigned long width;
+       unsigned long height;
+       mm_util_color_format_e color;
+       void *data;
+       size_t size;
+} color_image_data_s;
+
 #ifdef __cplusplus
 }
 #endif
index 26c6b37..446303f 100755 (executable)
@@ -38,6 +38,42 @@ typedef enum {
        MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT = -5,   /**< Not supported format */
 } mm_util_error_e;
 
+/**
+ * color formats
+ */
+typedef enum {
+       /* YUV planar format */
+       MM_UTIL_COLOR_YUV420,                   /**< YUV420 format - planer YV12*/
+       MM_UTIL_COLOR_YUV422,                   /**< YUV422 format - planer */
+       MM_UTIL_COLOR_I420,                             /**< YUV420 format - planar */
+       MM_UTIL_COLOR_NV12,                             /**< NV12 format - planer */
+
+       /* YUV packed format */
+       MM_UTIL_COLOR_UYVY,                             /**< UYVY format - YUV packed format */
+       MM_UTIL_COLOR_YUYV,                             /**< YUYV format - YUV packed format */
+
+       /* RGB color */
+       MM_UTIL_COLOR_RGB16,            /**< RGB565 pixel format */
+       MM_UTIL_COLOR_RGB24,                    /**< RGB888 pixel format */
+       MM_UTIL_COLOR_ARGB,                             /**< ARGB8888 pixel format */
+
+       MM_UTIL_COLOR_BGRA,                             /**< BGRA8888 pixel format */
+       MM_UTIL_COLOR_RGBA,                             /**< RGBA8888 pixel format */
+       MM_UTIL_COLOR_BGRX,                             /**< BGRX8888 pixel format */
+
+       /* non-standard format */
+       MM_UTIL_COLOR_NV12_TILED,               /**< Customized color format in s5pc110 */
+       MM_UTIL_COLOR_NV16,                             /**< NV16 pixel format */
+       MM_UTIL_COLOR_NV61,                             /**< NV61 pixel format */
+       MM_UTIL_COLOR_NV21,                     /**< NV21 format - planer */
+
+       /* GrayScale */
+       MM_UTIL_COLOR_GRAYSCALE,                /**< Grayscale pixel format */
+       MM_UTIL_COLOR_NUM,                              /**< Number of image formats */
+} mm_util_color_format_e;
+
+typedef void *mm_util_color_image_h;
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/common/mm_util_color_image.c b/common/mm_util_color_image.c
new file mode 100755 (executable)
index 0000000..f350314
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * libmm-utility
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: YoungHun Kim <yh8004.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "mm_util_private.h"
+#include "mm_util_color_image.h"
+
+gboolean mm_util_is_valid_color_format(mm_util_color_format_e color)
+{
+       if ((color < MM_UTIL_COLOR_YUV420) || (color >= MM_UTIL_COLOR_NUM)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+int mm_util_create_empty_color_image(mm_util_color_image_h *image)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *_color_image = NULL;
+
+       mm_util_retvm_if((image == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
+
+       _color_image = (color_image_data_s *)calloc(1, sizeof(color_image_data_s));
+       mm_util_retvm_if((_color_image == NULL), MM_UTIL_ERROR_OUT_OF_MEMORY, "Memory allocation failed");
+
+       *image = (mm_util_color_image_h)_color_image;
+
+       return ret;
+}
+
+int mm_util_create_color_image(mm_util_color_image_h *image, unsigned long width, unsigned long height, mm_util_color_format_e color, void *data, size_t size)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *_color_image = NULL;
+
+       mm_util_retvm_if((image == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
+
+       _color_image = (color_image_data_s *)calloc(1, sizeof(color_image_data_s));
+       mm_util_retvm_if((_color_image == NULL), MM_UTIL_ERROR_OUT_OF_MEMORY, "Memory allocation failed");
+
+       ret = mm_util_set_color_image(_color_image, width, height, color, data, size);
+       if (ret != MM_UTIL_ERROR_NONE) {
+               mm_util_error("mm_util_set_color_image failed(%d)", ret);
+               mm_util_destroy_color_image(_color_image);
+               *image = NULL;
+               return ret;
+       }
+
+       *image = (mm_util_color_image_h)_color_image;
+
+       return ret;
+}
+
+int mm_util_set_color_image(mm_util_color_image_h image, unsigned long width, unsigned long height, mm_util_color_format_e color, void *data, size_t size)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *_color_image = (color_image_data_s *)image;
+
+       mm_util_retvm_if((_color_image == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
+       mm_util_retvm_if((color >= MM_UTIL_COLOR_NUM), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid color");
+       mm_util_retvm_if((data == NULL || size == 0), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid data");
+
+       _color_image->data = calloc(1, size);
+       mm_util_retvm_if((_color_image->data == NULL), MM_UTIL_ERROR_OUT_OF_MEMORY, "Memory allocation failed");
+
+       memcpy(_color_image->data, data, size);
+       _color_image->size = size;
+       _color_image->width = width;
+       _color_image->height = height;
+       _color_image->color = color;
+
+       mm_util_sec_debug("w: %lu, h: %lu, color: %u, size: %zu, data: %p", _color_image->width, _color_image->height,
+               _color_image->color, _color_image->size, _color_image->data);
+
+       return ret;
+}
+
+int mm_util_get_color_image(mm_util_color_image_h image, unsigned long *width, unsigned long *height, mm_util_color_format_e *color, void **data, size_t *size)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *_color_image = (color_image_data_s *)image;
+
+       mm_util_retvm_if((_color_image == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
+
+       if (width != NULL)
+               *width = _color_image->width;
+
+       if (height != NULL)
+               *height = _color_image->height;
+
+       if (color != NULL)
+               *color = _color_image->color;
+
+       if (data != NULL)
+               *data = _color_image->data;
+
+       if (size != NULL)
+               *size = _color_image->size;
+
+       return ret;
+}
+
+
+void mm_util_destroy_color_image(mm_util_color_image_h image)
+{
+       color_image_data_s *_color_image = (color_image_data_s *)image;
+
+       if (_color_image == NULL) {
+               mm_util_error("[ERROR] - image");
+               return;
+       }
+
+       MMUTIL_SAFE_FREE(_color_image->data);
+       MMUTIL_SAFE_FREE(_color_image);
+}
diff --git a/common/mmutil-common.pc.in b/common/mmutil-common.pc.in
new file mode 100755 (executable)
index 0000000..3004389
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/mmf
+
+Name : @PC_NAME@
+Description : Multimedia Framework Utility Library
+Requires : @PC_REQUIRED@
+Version : @VERSION@
+Libs : -L${libdir} @PC_LDFLAGS@
+Cflags : -I${includedir} -DLIBPREFIX=\"${libdir}\"
index d237775..c9298df 100755 (executable)
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
        mm_util_jpeg_yuv_data decoded;
        memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
 
-       ret = mm_util_decode_from_jpeg_file(&decoded, filename, MM_UTIL_JPEG_FMT_RGB888);
+       ret = mm_util_decode_from_jpeg_file(&decoded, filename, MM_UTIL_COLOR_RGB24);
 
        if (!ret) {
                img_buffer = decoded.data;
index d52b101..1742287 100755 (executable)
@@ -39,7 +39,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
 aux_source_directory(. SOURCES)
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} mmutil_common)
 SET_TARGET_PROPERTIES(${fw_name}
        PROPERTIES
        VERSION ${VERSION}
index bea65f6..61ccbbd 100755 (executable)
@@ -31,7 +31,6 @@ extern "C" {
 #include "mm_util_type.h"
 
 typedef void *mm_util_imgp_h;
-typedef void *mm_util_color_image_h;
 
 typedef bool (*mm_util_completed_callback)(mm_util_color_image_h image, int error, void *user_param);
 /**
@@ -43,36 +42,6 @@ typedef bool (*mm_util_completed_callback)(mm_util_color_image_h image, int erro
  */
 
 /**
- * Image formats
- */
-typedef enum {
-       /* YUV planar format */
-       MM_UTIL_IMG_FMT_YUV420 = 0x00,  /**< YUV420 format - planer YV12*/
-       MM_UTIL_IMG_FMT_YUV422,         /**< YUV422 format - planer */
-       MM_UTIL_IMG_FMT_I420,           /**< YUV420 format - planar */
-       MM_UTIL_IMG_FMT_NV12,           /**< NV12 format - planer */
-
-       /* YUV packed format */
-       MM_UTIL_IMG_FMT_UYVY,           /**< UYVY format - YUV packed format */
-       MM_UTIL_IMG_FMT_YUYV,           /**< YUYV format - YUV packed format */
-
-       /* RGB color */
-       MM_UTIL_IMG_FMT_RGB565,         /**< RGB565 pixel format */
-       MM_UTIL_IMG_FMT_RGB888,         /**< RGB888 pixel format */
-       MM_UTIL_IMG_FMT_ARGB8888,       /**< ARGB8888 pixel format */
-
-       MM_UTIL_IMG_FMT_BGRA8888,      /**< BGRA8888 pixel format */
-       MM_UTIL_IMG_FMT_RGBA8888,      /**< RGBA8888 pixel format */
-       MM_UTIL_IMG_FMT_BGRX8888,      /**<BGRX8888 pixel format */
-       /* non-standard format */
-       MM_UTIL_IMG_FMT_NV12_TILED,     /**< Customized color format in s5pc110 */
-       MM_UTIL_IMG_FMT_NV16,     /**<NV16 pixel format */
-       MM_UTIL_IMG_FMT_NV61,     /**<NV61 pixel format */
-       MM_UTIL_IMG_FMT_NUM,            /**< Number of image formats */
-} mm_util_img_format;
-
-
-/**
  * Image rotation types
  */
 typedef enum {
@@ -95,10 +64,10 @@ typedef enum {
  *
  * @return      This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_img_format
+ * @see         mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *size);
+int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, unsigned int *size);
 
 /**
  *
@@ -122,7 +91,7 @@ int mm_util_create(mm_util_imgp_h *imgp_handle);
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_img_format colorspace);
+int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_color_format_e colorspace);
 
 /**
  *
@@ -182,57 +151,6 @@ int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_complete
 
 /**
  *
- * @remark     Creates the handle of color image
- *
- * @param      image           [in/out]                The handle of the color image
- * @return     This function returns created color image handle
- *             if the result is 0, then handle creation succeed
- *             else if the result is -1, then handle creation failed
- */
-int mm_util_create_color_image(mm_util_color_image_h *image);
-
-/**
- *
- * @remark     Sets the data of color image to handle
- *
- * @param      image           [in]                    The handle of the color image
- * @param      width           [in]                    The width of color image
- * @param      height          [in]                    The height of color image
- * @param      format          [in]                    The color format of color image
- * @param      buffer          [in]                    The data of color image
- * @param      buffer_size     [in]                    The data-size of color image
- * @return     This function returns the result of setting the data in handle
- *             if the result is 0, then setting the data has succeed
- *             else if the result is -1, then setting the data has failed
- */
-int mm_util_set_color_image(mm_util_color_image_h image, int width, int height, mm_util_img_format format, void *buffer, size_t buffer_size);
-
-/**
- *
- * @remark     Gets the data of color image from handle
- *
- * @param      image           [in]                    The handle of the color image
- * @param      width           [in/out]                The width of color image
- * @param      height          [in/out]                The height of color image
- * @param      format          [in/out]                The color format of color image
- * @param      buffer          [in/out]                The data of color image
- * @param      buffer_size     [in/out]                The data-size of color image
- * @return     This function returns the result of getting the data from handle
- *             if the result is 0, then getting the data has succeed
- *             else if the result is -1, then getting the data has failed
- */
-int mm_util_get_color_image(mm_util_color_image_h image, int *width, int *height, mm_util_img_format *format, void **buffer, size_t *buffer_size);
-
-/**
- *
- * @remark     Destroys the handle of color image
- *
- * @param      image           [in]                    The handle of the color image
- */
-void mm_util_destroy_color_image(mm_util_color_image_h image);
-
-/**
- *
  * @remark     Image Transform Pipeline
  *
  * @param      imgp_handle             [in]                    image_util_imgp_h
@@ -268,10 +186,10 @@ int mm_util_destroy(mm_util_imgp_h imgp_handle);
  *
  * @return      This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_img_format
+ * @see         mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, mm_util_img_format dst_format);
+int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned char *dst, mm_util_color_format_e dst_format);
 
 /**
  * This function resizes the source image.
@@ -286,10 +204,10 @@ int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width,
  *
  * @return      This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_img_format
+ * @see         mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height);
+int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height);
 
 /**
  * This function rotates the source image.
@@ -305,10 +223,10 @@ int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsig
  *
  * @return      This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_img_format, mm_util_img_rotate_type
+ * @see         mm_util_color_format_e, mm_util_img_rotate_type
  * @since       R1, 1.0
  */
-int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle);
+int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle);
 
 /**
  * This function crop the source image.
@@ -326,10 +244,10 @@ int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsig
  *
  * @return      This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_img_format, mm_util_img_rotate_type
+ * @see         mm_util_color_format_e, mm_util_img_rotate_type
  * @since       R1, 1.0
  */
-int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format,
                        unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_width, unsigned int *crop_dest_height, unsigned char *dst);
 
 #ifdef __cplusplus
index b89cb5e..8b99994 100755 (executable)
  */
 typedef struct _imgp_info_s {
        char *input_format_label;
-       mm_util_img_format src_format;
+       mm_util_color_format_e src_format;
        unsigned int src_width;
        unsigned int src_height;
        char *output_format_label;
-       mm_util_img_format dst_format;
+       mm_util_color_format_e dst_format;
        unsigned int dst_width;
        unsigned int dst_height;
        unsigned int output_stride;
@@ -86,19 +86,11 @@ typedef struct {
 } mm_util_cb_s;
 
 typedef struct {
-       int width;
-       int height;
-       mm_util_img_format format;
-       void *buffer;
-       size_t buffer_size;
-} color_image_data_s;
-
-typedef struct {
        color_image_data_s *src;
        color_image_data_s *dst;
 
        /* for converting colorspace */
-       mm_util_img_format dst_format;
+       mm_util_color_format_e dst_format;
        /* for image crop */
        /* for resize */
        unsigned int start_x;
index a9c267c..ceab8ee 100755 (executable)
@@ -24,6 +24,7 @@
 #include "mm_util_private.h"
 #include "mm_util_imgp.h"
 #include "mm_util_imgp_internal.h"
+#include "mm_util_common.h"
 
 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
@@ -54,26 +55,26 @@ static void __mm_destroy_temp_buffer(unsigned char *buffer[])
                MMUTIL_SAFE_FREE(buffer[i]);
 }
 
-static gboolean __mm_cannot_convert_format(mm_util_img_format src_format, mm_util_img_format dst_format)
+static gboolean __mm_cannot_convert_format(mm_util_color_format_e src_format, mm_util_color_format_e dst_format)
 {
        gboolean _bool = FALSE;
 
        mm_util_debug("src_format: %d, dst_format:%d", src_format, dst_format);
 
-       if ((dst_format == MM_UTIL_IMG_FMT_NV16) || (dst_format == MM_UTIL_IMG_FMT_NV61) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV422) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_BGRX8888) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUV422)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_UYVY)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUYV)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_BGRX8888))) {
+       if ((dst_format == MM_UTIL_COLOR_NV16) || (dst_format == MM_UTIL_COLOR_NV61) ||
+               ((src_format == MM_UTIL_COLOR_YUV422) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_UYVY) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_YUYV) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_RGB16) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_RGB24) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_BGRX) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_YUV422)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_UYVY)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_YUYV)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_ARGB)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_RGBA)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_BGRX))) {
 
                _bool = TRUE;
        }
@@ -120,73 +121,73 @@ static gboolean __mm_gst_can_rotate_format(const char *__format_label)
        return _bool;
 }
 
-static gboolean __mm_select_convert_plugin(mm_util_img_format src_format, mm_util_img_format dst_format)
+static gboolean __mm_select_convert_plugin(mm_util_color_format_e src_format, mm_util_color_format_e dst_format)
 {
        gboolean _bool = FALSE;
 
        mm_util_debug("src_format: %d, dst_format:%d", src_format, dst_format);
 
-       if (((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888))) {
+       if (((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+               ((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+               ((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_RGB24)) ||
+               ((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_ARGB)) ||
+               ((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_BGRA)) ||
+               ((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_RGBA)) ||
+               ((src_format == MM_UTIL_COLOR_YUV420) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_RGB24)) ||
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_ARGB)) ||
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_BGRA)) ||
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_RGBA)) ||
+               ((src_format == MM_UTIL_COLOR_I420) && (dst_format == MM_UTIL_COLOR_NV12_TILED)) ||
+
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_RGB24)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_ARGB)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_BGRA)) ||
+               ((src_format == MM_UTIL_COLOR_NV12) && (dst_format == MM_UTIL_COLOR_RGBA)) ||
+
+               ((src_format == MM_UTIL_COLOR_UYVY) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+               ((src_format == MM_UTIL_COLOR_UYVY) && (dst_format == MM_UTIL_COLOR_RGB24)) ||
+
+               ((src_format == MM_UTIL_COLOR_YUYV) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+               ((src_format == MM_UTIL_COLOR_YUYV) && (dst_format == MM_UTIL_COLOR_RGB24)) ||
+               ((src_format == MM_UTIL_COLOR_YUYV) && (dst_format == MM_UTIL_COLOR_ARGB)) ||
+               ((src_format == MM_UTIL_COLOR_YUYV) && (dst_format == MM_UTIL_COLOR_BGRA)) ||
+               ((src_format == MM_UTIL_COLOR_YUYV) && (dst_format == MM_UTIL_COLOR_RGBA)) ||
+
+               ((src_format == MM_UTIL_COLOR_RGB16) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_RGB16) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_RGB16) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+
+               ((src_format == MM_UTIL_COLOR_RGB24) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_RGB24) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_RGB24) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+
+               ((src_format == MM_UTIL_COLOR_ARGB) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_ARGB) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_ARGB) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+
+               ((src_format == MM_UTIL_COLOR_BGRA) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_BGRA) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_BGRA) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+               ((src_format == MM_UTIL_COLOR_RGBA) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_RGBA) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_RGBA) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+               ((src_format == MM_UTIL_COLOR_RGBA) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_YUV420)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_I420)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_NV12)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_RGB16)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_RGB24)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_ARGB)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_BGRA)) ||
+               ((src_format == MM_UTIL_COLOR_NV12_TILED) && (dst_format == MM_UTIL_COLOR_RGBA))) {
 
                _bool = TRUE;
        }
@@ -194,14 +195,14 @@ static gboolean __mm_select_convert_plugin(mm_util_img_format src_format, mm_uti
        return _bool;
 }
 
-static gboolean __mm_select_resize_plugin(mm_util_img_format _format)
+static gboolean __mm_select_resize_plugin(mm_util_color_format_e _format)
 {
        gboolean _bool = FALSE;
 
        mm_util_debug("_format: %d", _format);
 
-       if ((_format == MM_UTIL_IMG_FMT_UYVY) || (_format == MM_UTIL_IMG_FMT_YUYV) ||
-               (_format == MM_UTIL_IMG_FMT_RGBA8888) || (_format == MM_UTIL_IMG_FMT_BGRX8888))
+       if ((_format == MM_UTIL_COLOR_UYVY) || (_format == MM_UTIL_COLOR_YUYV) ||
+               (_format == MM_UTIL_COLOR_RGBA) || (_format == MM_UTIL_COLOR_BGRX))
                _bool = FALSE;
        else
                _bool = TRUE;
@@ -209,35 +210,35 @@ static gboolean __mm_select_resize_plugin(mm_util_img_format _format)
        return _bool;
 }
 
-static gboolean __mm_select_rotate_plugin(mm_util_img_format _format)
+static gboolean __mm_select_rotate_plugin(mm_util_color_format_e _format)
 {
        mm_util_debug("_format: %d", _format);
 
-       if ((_format == MM_UTIL_IMG_FMT_YUV420) || (_format == MM_UTIL_IMG_FMT_I420) || (_format == MM_UTIL_IMG_FMT_NV12)
-               || (_format == MM_UTIL_IMG_FMT_RGB888  || _format == MM_UTIL_IMG_FMT_RGB565)) {
+       if ((_format == MM_UTIL_COLOR_YUV420) || (_format == MM_UTIL_COLOR_I420) || (_format == MM_UTIL_COLOR_NV12)
+               || (_format == MM_UTIL_COLOR_RGB24  || _format == MM_UTIL_COLOR_RGB16)) {
                return TRUE;
        }
 
        return FALSE;
 }
 
-static gboolean __mm_is_rgb_format(mm_util_img_format format)
+static gboolean __mm_is_rgb_format(mm_util_color_format_e format)
 {
        mm_util_debug("format: %d", format);
 
-       if ((format == MM_UTIL_IMG_FMT_RGB565) ||
-               (format == MM_UTIL_IMG_FMT_RGB888) ||
-               (format == MM_UTIL_IMG_FMT_ARGB8888) ||
-               (format == MM_UTIL_IMG_FMT_BGRA8888) ||
-               (format == MM_UTIL_IMG_FMT_RGBA8888) ||
-               (format == MM_UTIL_IMG_FMT_BGRX8888)) {
+       if ((format == MM_UTIL_COLOR_RGB16) ||
+               (format == MM_UTIL_COLOR_RGB24) ||
+               (format == MM_UTIL_COLOR_ARGB) ||
+               (format == MM_UTIL_COLOR_BGRA) ||
+               (format == MM_UTIL_COLOR_RGBA) ||
+               (format == MM_UTIL_COLOR_BGRX)) {
                return TRUE;
        }
 
        return FALSE;
 }
 
-static int __mm_util_get_crop_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize)
+static int __mm_util_get_crop_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, unsigned int *imgsize)
 {
        int ret = MM_UTIL_ERROR_NONE;
        unsigned char x_chroma_shift = 0;
@@ -260,8 +261,8 @@ static int __mm_util_get_crop_image_size(mm_util_img_format format, unsigned int
        }
 
        switch (format) {
-       case MM_UTIL_IMG_FMT_I420:
-       case MM_UTIL_IMG_FMT_YUV420:
+       case MM_UTIL_COLOR_I420:
+       case MM_UTIL_COLOR_YUV420:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
@@ -273,40 +274,40 @@ static int __mm_util_get_crop_image_size(mm_util_img_format format, unsigned int
                size2 = stride2 * h2;
                *imgsize = size + 2 * size2;
                break;
-       case MM_UTIL_IMG_FMT_YUV422:
-       case MM_UTIL_IMG_FMT_YUYV:
-       case MM_UTIL_IMG_FMT_UYVY:
-       case MM_UTIL_IMG_FMT_NV16:
-       case MM_UTIL_IMG_FMT_NV61:
+       case MM_UTIL_COLOR_YUV422:
+       case MM_UTIL_COLOR_YUYV:
+       case MM_UTIL_COLOR_UYVY:
+       case MM_UTIL_COLOR_NV16:
+       case MM_UTIL_COLOR_NV61:
                stride = MM_UTIL_ROUND_UP_4(width) * 2;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_RGB565:
+       case MM_UTIL_COLOR_RGB16:
                stride = width * 2;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_RGB888:
+       case MM_UTIL_COLOR_RGB24:
                stride = width * 3;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_ARGB8888:
-       case MM_UTIL_IMG_FMT_BGRA8888:
-       case MM_UTIL_IMG_FMT_RGBA8888:
-       case MM_UTIL_IMG_FMT_BGRX8888:
+       case MM_UTIL_COLOR_ARGB:
+       case MM_UTIL_COLOR_BGRA:
+       case MM_UTIL_COLOR_RGBA:
+       case MM_UTIL_COLOR_BGRX:
                stride = width * 4;
                size = stride * height;
                *imgsize = size;
                break;
 
 
-       case MM_UTIL_IMG_FMT_NV12:
-       case MM_UTIL_IMG_FMT_NV12_TILED:
+       case MM_UTIL_COLOR_NV12:
+       case MM_UTIL_COLOR_NV12_TILED:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
@@ -329,7 +330,7 @@ static int __mm_util_get_crop_image_size(mm_util_img_format format, unsigned int
        return ret;
 }
 
-int __mm_util_get_buffer_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize)
+int __mm_util_get_buffer_size(mm_util_color_format_e format, unsigned int width, unsigned int height, unsigned int *imgsize)
 {
        int ret = MM_UTIL_ERROR_NONE;
        unsigned char x_chroma_shift = 0;
@@ -352,8 +353,8 @@ int __mm_util_get_buffer_size(mm_util_img_format format, unsigned int width, uns
        }
 
        switch (format) {
-       case MM_UTIL_IMG_FMT_I420:
-       case MM_UTIL_IMG_FMT_YUV420:
+       case MM_UTIL_COLOR_I420:
+       case MM_UTIL_COLOR_YUV420:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
@@ -365,40 +366,40 @@ int __mm_util_get_buffer_size(mm_util_img_format format, unsigned int width, uns
                size2 = stride2 * h2;
                *imgsize = size + 2 * size2;
                break;
-       case MM_UTIL_IMG_FMT_YUV422:
-       case MM_UTIL_IMG_FMT_YUYV:
-       case MM_UTIL_IMG_FMT_UYVY:
-       case MM_UTIL_IMG_FMT_NV16:
-       case MM_UTIL_IMG_FMT_NV61:
+       case MM_UTIL_COLOR_YUV422:
+       case MM_UTIL_COLOR_YUYV:
+       case MM_UTIL_COLOR_UYVY:
+       case MM_UTIL_COLOR_NV16:
+       case MM_UTIL_COLOR_NV61:
                stride = MM_UTIL_ROUND_UP_4(width) * 2;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_RGB565:
+       case MM_UTIL_COLOR_RGB16:
                stride = MM_UTIL_ROUND_UP_4(width) * 2;
                size = stride * MM_UTIL_ROUND_UP_2(height);
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_RGB888:
+       case MM_UTIL_COLOR_RGB24:
                stride = MM_UTIL_ROUND_UP_4(width) * 3;
                size = stride * MM_UTIL_ROUND_UP_2(height);
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_ARGB8888:
-       case MM_UTIL_IMG_FMT_BGRA8888:
-       case MM_UTIL_IMG_FMT_RGBA8888:
-       case MM_UTIL_IMG_FMT_BGRX8888:
+       case MM_UTIL_COLOR_ARGB:
+       case MM_UTIL_COLOR_BGRA:
+       case MM_UTIL_COLOR_RGBA:
+       case MM_UTIL_COLOR_BGRX:
                stride = width * 4;
                size = stride * MM_UTIL_ROUND_UP_2(height);
                *imgsize = size;
                break;
 
 
-       case MM_UTIL_IMG_FMT_NV12:
-       case MM_UTIL_IMG_FMT_NV12_TILED:
+       case MM_UTIL_COLOR_NV12:
+       case MM_UTIL_COLOR_NV12_TILED:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
@@ -468,7 +469,7 @@ static int __mm_confirm_dst_width_height(unsigned int src_width, unsigned int sr
        return ret;
 }
 
-static int __mm_set_format_label(imgp_info_s *_imgp_info_s, mm_util_img_format src_format, mm_util_img_format dst_format)
+static int __mm_set_format_label(imgp_info_s *_imgp_info_s, mm_util_color_format_e src_format, mm_util_color_format_e dst_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        char *src_fmt_lable = NULL;
@@ -480,40 +481,40 @@ static int __mm_set_format_label(imgp_info_s *_imgp_info_s, mm_util_img_format s
        }
 
        switch (src_format) {
-       case MM_UTIL_IMG_FMT_YUV420:
+       case MM_UTIL_COLOR_YUV420:
                src_fmt_lable = (char *)"YV12";
                break;
-       case MM_UTIL_IMG_FMT_YUV422:
+       case MM_UTIL_COLOR_YUV422:
                src_fmt_lable = (char *)"Y42B";
                break;
-       case MM_UTIL_IMG_FMT_I420:
+       case MM_UTIL_COLOR_I420:
                src_fmt_lable = (char *)"I420";
                break;
-       case MM_UTIL_IMG_FMT_NV12:
+       case MM_UTIL_COLOR_NV12:
                src_fmt_lable = (char *)"NV12";
                break;
-       case MM_UTIL_IMG_FMT_UYVY:
+       case MM_UTIL_COLOR_UYVY:
                src_fmt_lable = (char *)"UYVY";
                break;
-       case MM_UTIL_IMG_FMT_YUYV:
+       case MM_UTIL_COLOR_YUYV:
                src_fmt_lable = (char *)"YUYV";
                break;
-       case MM_UTIL_IMG_FMT_RGB565:
+       case MM_UTIL_COLOR_RGB16:
                src_fmt_lable = (char *)"RGB565";
                break;
-       case MM_UTIL_IMG_FMT_RGB888:
+       case MM_UTIL_COLOR_RGB24:
                src_fmt_lable = (char *)"RGB888";
                break;
-       case MM_UTIL_IMG_FMT_ARGB8888:
+       case MM_UTIL_COLOR_ARGB:
                src_fmt_lable = (char *)"ARGB8888";
                break;
-       case MM_UTIL_IMG_FMT_BGRA8888:
+       case MM_UTIL_COLOR_BGRA:
                src_fmt_lable = (char *)"BGRA8888";
                break;
-       case MM_UTIL_IMG_FMT_RGBA8888:
+       case MM_UTIL_COLOR_RGBA:
                src_fmt_lable = (char *)"RGBA8888";
                break;
-       case MM_UTIL_IMG_FMT_BGRX8888:
+       case MM_UTIL_COLOR_BGRX:
                src_fmt_lable = (char *)"BGRX";
                break;
        default:
@@ -522,40 +523,40 @@ static int __mm_set_format_label(imgp_info_s *_imgp_info_s, mm_util_img_format s
        }
 
        switch (dst_format) {
-       case MM_UTIL_IMG_FMT_YUV420:
+       case MM_UTIL_COLOR_YUV420:
                dst_fmt_lable = (char *)"YV12";
                break;
-       case MM_UTIL_IMG_FMT_YUV422:
+       case MM_UTIL_COLOR_YUV422:
                dst_fmt_lable = (char *)"Y42B";
                break;
-       case MM_UTIL_IMG_FMT_I420:
+       case MM_UTIL_COLOR_I420:
                dst_fmt_lable = (char *)"I420";
                break;
-       case MM_UTIL_IMG_FMT_NV12:
+       case MM_UTIL_COLOR_NV12:
                dst_fmt_lable = (char *)"NV12";
                break;
-       case MM_UTIL_IMG_FMT_UYVY:
+       case MM_UTIL_COLOR_UYVY:
                dst_fmt_lable = (char *)"UYVY";
                break;
-       case MM_UTIL_IMG_FMT_YUYV:
+       case MM_UTIL_COLOR_YUYV:
                dst_fmt_lable = (char *)"YUYV";
                break;
-       case MM_UTIL_IMG_FMT_RGB565:
+       case MM_UTIL_COLOR_RGB16:
                dst_fmt_lable = (char *)"RGB565";
                break;
-       case MM_UTIL_IMG_FMT_RGB888:
+       case MM_UTIL_COLOR_RGB24:
                dst_fmt_lable = (char *)"RGB888";
                break;
-       case MM_UTIL_IMG_FMT_ARGB8888:
+       case MM_UTIL_COLOR_ARGB:
                dst_fmt_lable = (char *)"ARGB8888";
                break;
-       case MM_UTIL_IMG_FMT_BGRA8888:
+       case MM_UTIL_COLOR_BGRA:
                dst_fmt_lable = (char *)"BGRA8888";
                break;
-       case MM_UTIL_IMG_FMT_RGBA8888:
+       case MM_UTIL_COLOR_RGBA:
                dst_fmt_lable = (char *)"RGBA8888";
                break;
-       case MM_UTIL_IMG_FMT_BGRX8888:
+       case MM_UTIL_COLOR_BGRX:
                dst_fmt_lable = (char *)"BGRX";
                break;
        default:
@@ -593,7 +594,7 @@ static int __mm_set_format_label(imgp_info_s *_imgp_info_s, mm_util_img_format s
        return ret;
 }
 
-static int __mm_set_imgp_info_s(imgp_info_s *_imgp_info_s, mm_util_img_format src_format, unsigned int src_width, unsigned int src_height, mm_util_img_format dst_format, unsigned int dst_width, unsigned int dst_height, mm_util_img_rotate_type angle)
+static int __mm_set_imgp_info_s(imgp_info_s *_imgp_info_s, mm_util_color_format_e src_format, unsigned int src_width, unsigned int src_height, mm_util_color_format_e dst_format, unsigned int dst_width, unsigned int dst_height, mm_util_img_rotate_type angle)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -656,7 +657,7 @@ static void __mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s)
        return;
 }
 
-static int __mm_util_crop_rgba32(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_rgba32(const unsigned char *src, unsigned int src_width, unsigned int src_height,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -675,7 +676,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static int __mm_util_crop_rgb888(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_rgb888(const unsigned char *src, unsigned int src_width, unsigned int src_height,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -694,7 +695,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static int __mm_util_crop_rgb565(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_rgb565(const unsigned char *src, unsigned int src_width, unsigned int src_height,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -713,7 +714,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static int __mm_util_crop_yuv420(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_yuv420(const unsigned char *src, unsigned int src_width, unsigned int src_height,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -760,7 +761,7 @@ static int __mm_util_handle_init(mm_util_s *handle)
 
        /* private values init */
        handle->dst = NULL;
-       handle->dst_format = MM_UTIL_IMG_FMT_NUM;
+       handle->dst_format = MM_UTIL_COLOR_NUM;
        handle->rotation = MM_UTIL_ROTATION_NONE;
 
        handle->start_x = -1;
@@ -861,7 +862,7 @@ static int __mm_util_processing(mm_util_s *handle)
        unsigned char *dst_buf[4] = {NULL,};
        unsigned int dst_buf_size = 0;
        unsigned int src_width = 0, src_height = 0;
-       mm_util_img_format src_format = -1;
+       mm_util_color_format_e src_format = -1;
        unsigned int src_index = 0, dst_index = 0;
 
        if (handle == NULL) {
@@ -871,15 +872,15 @@ static int __mm_util_processing(mm_util_s *handle)
 
        mm_util_debug("src: %p, dst: %p", handle->src, handle->dst);
 
-       dst_buf[src_index] = calloc(1, handle->src->buffer_size);
+       dst_buf[src_index] = calloc(1, handle->src->size);
        src_width = handle->src->width;
        src_height = handle->src->height;
-       src_format = handle->src->format;
+       src_format = handle->src->color;
        if (dst_buf[src_index] == NULL) {
                mm_util_error("[multi func] memory allocation error");
                return MM_UTIL_ERROR_INVALID_OPERATION;
        }
-       memcpy(dst_buf[src_index], handle->src->buffer, handle->src->buffer_size);
+       memcpy(dst_buf[src_index], handle->src->data, handle->src->size);
        if (handle->set_crop) {
                dst_index++;
                __mm_util_get_crop_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
@@ -967,7 +968,7 @@ static int __mm_util_processing(mm_util_s *handle)
        }
 
        if (dst_buf[dst_index] != NULL && dst_buf_size != 0) {
-               ret = mm_util_set_color_image((mm_util_color_image_h)handle->dst, (int)src_width, (int)src_height, src_format, (void *)dst_buf[dst_index], (size_t)dst_buf_size);
+               ret = mm_util_create_color_image((mm_util_color_image_h *)&(handle->dst), (unsigned long)src_width, (unsigned long)src_height, src_format, (void *)dst_buf[dst_index], (size_t)dst_buf_size);
                if (ret != MM_UTIL_ERROR_NONE)
                        mm_util_error("mm_util_set_color_image failed");
        }
@@ -987,15 +988,11 @@ static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *sourc
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       mm_util_debug("orig_image: %p [%zu] %d X %d (%d)", source_image->buffer, source_image->buffer_size,
-               source_image->width, source_image->height, source_image->format);
+       mm_util_debug("orig_image: %p [%zu] %lu X %lu (%u)", source_image->data, source_image->size,
+               source_image->width, source_image->height, source_image->color);
 
        handle->src = source_image;
-       ret = mm_util_create_color_image((mm_util_color_image_h *)&handle->dst);
-       if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("mm_util_create_color_image failed");
-               return ret;
-       }
+       handle->dst = NULL;
 
        ret = __mm_util_processing(handle);
        if (ret != MM_UTIL_ERROR_NONE) {
@@ -1003,8 +1000,8 @@ static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *sourc
                return ret;
        }
 
-       mm_util_debug("result_image: %p [%zu] %d X %d (%u)", handle->dst->buffer, handle->dst->buffer_size,
-               handle->dst->width, handle->dst->height, handle->dst->format);
+       mm_util_debug("result_image: %p [%zu] %lu X %lu (%u)", handle->dst->data, handle->dst->size,
+               handle->dst->width, handle->dst->height, handle->dst->color);
 
        return ret;
 }
@@ -1062,7 +1059,7 @@ int mm_util_create(mm_util_imgp_h *imgp_handle)
        return ret;
 }
 
-int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_img_format colorspace)
+int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_color_format_e colorspace)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) imgp_handle;
@@ -1135,102 +1132,6 @@ int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsi
        return ret;
 }
 
-int mm_util_create_color_image(mm_util_color_image_h *image)
-{
-       int ret = MM_UTIL_ERROR_NONE;
-       color_image_data_s *color_image = NULL;
-
-       if (image == NULL) {
-               mm_util_error("[ERROR] - image");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       mm_util_error("Memory allocation s");
-
-       color_image = (color_image_data_s *)calloc(1, sizeof(color_image_data_s));
-       if (color_image == NULL) {
-               mm_util_error("Memory allocation failed");
-               return MM_UTIL_ERROR_OUT_OF_MEMORY;
-       }
-
-       mm_util_error("Memory allocation e");
-
-       *image = (mm_util_color_image_h)color_image;
-
-       return ret;
-}
-
-int mm_util_set_color_image(mm_util_color_image_h image, int width, int height, mm_util_img_format format, void *buffer, size_t buffer_size)
-{
-       int ret = MM_UTIL_ERROR_NONE;
-       color_image_data_s *color_image = (color_image_data_s *)image;
-
-       if (color_image == NULL) {
-               mm_util_error("[ERROR] - raw_image");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       if (buffer == NULL || buffer_size == 0) {
-               mm_util_error("[ERROR] - Invalid parameters");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       color_image->buffer = calloc(1, buffer_size);
-       if (color_image->buffer == NULL) {
-               mm_util_error("Memory allocation failed");
-               return MM_UTIL_ERROR_OUT_OF_MEMORY;
-       }
-       memcpy(color_image->buffer, buffer, buffer_size);
-       color_image->buffer_size = buffer_size;
-       color_image->width = width;
-       color_image->height = height;
-       color_image->format = format;
-
-       return ret;
-}
-
-int mm_util_get_color_image(mm_util_color_image_h image, int *width, int *height, mm_util_img_format *format, void **buffer, size_t *buffer_size)
-{
-       int ret = MM_UTIL_ERROR_NONE;
-       color_image_data_s *color_image = (color_image_data_s *)image;
-
-       if (color_image == NULL) {
-               mm_util_error("[ERROR] - raw_image");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       if (width != NULL)
-               *width = color_image->width;
-
-       if (height != NULL)
-               *height = color_image->height;
-
-       if (format != NULL)
-               *format = color_image->format;
-
-       if (buffer != NULL)
-               *buffer = color_image->buffer;
-
-       if (buffer_size != NULL)
-               *buffer_size = color_image->buffer_size;
-
-       return ret;
-}
-
-
-void mm_util_destroy_color_image(mm_util_color_image_h image)
-{
-       color_image_data_s *color_image = (color_image_data_s *)image;
-
-       if (color_image == NULL) {
-               mm_util_error("[ERROR] - image");
-               return;
-       }
-
-       MMUTIL_SAFE_FREE(color_image->buffer);
-       MMUTIL_SAFE_FREE(color_image);
-}
-
 int mm_util_transform(mm_util_imgp_h imgp_handle, mm_util_color_image_h image, mm_util_completed_callback completed_callback, void *user_data)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -1329,7 +1230,7 @@ int mm_util_destroy(mm_util_imgp_h imgp_handle)
        return ret;
 }
 
-static IMGPInfoFunc __mm_util_initialize(imgp_type_e function, mm_util_img_format src_format, mm_util_img_format dst_format, GModule **module)
+static IMGPInfoFunc __mm_util_initialize(imgp_type_e function, mm_util_color_format_e src_format, mm_util_color_format_e dst_format, GModule **module)
 {
        imgp_plugin_type_e _imgp_plugin_type_e = IMGP_GSTCS;
        GModule *_module = NULL;
@@ -1381,7 +1282,7 @@ static IMGPInfoFunc __mm_util_initialize(imgp_type_e function, mm_util_img_forma
        return _func;
 }
 
-int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, mm_util_img_format dst_format)
+int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned char *dst, mm_util_color_format_e dst_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        IMGPInfoFunc _mm_util_imgp_func = NULL;
@@ -1391,8 +1292,8 @@ int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width,
 
        mm_util_retvm_if(src == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
        mm_util_retvm_if(dst == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst");
-       mm_util_retvm_if((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format >= MM_UTIL_IMG_FMT_NUM), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
-       mm_util_retvm_if((dst_format < MM_UTIL_IMG_FMT_YUV420) || (dst_format >= MM_UTIL_IMG_FMT_NUM), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_format [%d]", dst_format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(src_format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(dst_format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_format [%d]", dst_format);
 
        if (__mm_cannot_convert_format(src_format, dst_format)) {
                mm_util_error("#ERROR# Cannot Support Image Format Convert");
@@ -1461,7 +1362,7 @@ ERROR:
        return ret;
 }
 
-int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height)
+int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height)
 {
        int ret = MM_UTIL_ERROR_NONE;
        IMGPInfoFunc _mm_util_imgp_func = NULL;
@@ -1472,7 +1373,7 @@ int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsig
        mm_util_retvm_if(src == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
        mm_util_retvm_if(src_width == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_width");
        mm_util_retvm_if(src_height == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_height");
-       mm_util_retvm_if((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format >= MM_UTIL_IMG_FMT_NUM), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(src_format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
        mm_util_retvm_if(dst == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst");
        mm_util_retvm_if(dst_width == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_width");
        mm_util_retvm_if(dst_height == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_height");
@@ -1548,7 +1449,7 @@ ERROR:
        return ret;
 }
 
-int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
+int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
 {
        int ret = MM_UTIL_ERROR_NONE;
        IMGPInfoFunc _mm_util_imgp_func = NULL;
@@ -1559,7 +1460,7 @@ int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsig
        mm_util_retvm_if(src == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
        mm_util_retvm_if(src_width == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_width");
        mm_util_retvm_if(src_height == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_height");
-       mm_util_retvm_if((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format >= MM_UTIL_IMG_FMT_NUM), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(src_format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
        mm_util_retvm_if(dst == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst");
        mm_util_retvm_if(dst_width == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_width");
        mm_util_retvm_if(dst_height == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_height");
@@ -1654,7 +1555,7 @@ ERROR:
        return ret;
 }
 
-int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_width, unsigned int *crop_dest_height, unsigned char *dst)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -1662,7 +1563,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_wi
        mm_util_retvm_if(src == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
        mm_util_retvm_if(src_width == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_width");
        mm_util_retvm_if(src_height == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_height");
-       mm_util_retvm_if((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format >= MM_UTIL_IMG_FMT_NUM), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(src_format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_format [%d]", src_format);
        mm_util_retvm_if(dst == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst");
        mm_util_retvm_if((crop_start_x + *crop_dest_width > src_width), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid position [%d]]", crop_start_x);
        mm_util_retvm_if((crop_start_y + *crop_dest_height > src_height), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid position [%d]", crop_start_y);
@@ -1671,23 +1572,23 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_wi
                                                src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height);
 
        switch (src_format) {
-       case MM_UTIL_IMG_FMT_RGB888: {
-               ret = __mm_util_crop_rgb888(src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
+       case MM_UTIL_COLOR_RGB24: {
+               ret = __mm_util_crop_rgb888(src, src_width, src_height, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
                break;
                }
-       case MM_UTIL_IMG_FMT_RGB565: {
-               ret = __mm_util_crop_rgb565(src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
+       case MM_UTIL_COLOR_RGB16: {
+               ret = __mm_util_crop_rgb565(src, src_width, src_height, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
                break;
                }
-       case MM_UTIL_IMG_FMT_ARGB8888:
-       case MM_UTIL_IMG_FMT_BGRA8888:
-       case MM_UTIL_IMG_FMT_RGBA8888:
-       case MM_UTIL_IMG_FMT_BGRX8888: {
-               ret = __mm_util_crop_rgba32(src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
+       case MM_UTIL_COLOR_ARGB:
+       case MM_UTIL_COLOR_BGRA:
+       case MM_UTIL_COLOR_RGBA:
+       case MM_UTIL_COLOR_BGRX: {
+               ret = __mm_util_crop_rgba32(src, src_width, src_height, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
                break;
                }
-       case MM_UTIL_IMG_FMT_I420:
-       case MM_UTIL_IMG_FMT_YUV420: {
+       case MM_UTIL_COLOR_I420:
+       case MM_UTIL_COLOR_YUV420: {
                if ((*crop_dest_width % 2) != 0) {
                        mm_util_warn("#YUV Width value(%d) must be even at least# ", *crop_dest_width);
                        *crop_dest_width = ((*crop_dest_width+1)>>1)<<1;
@@ -1700,7 +1601,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_wi
                        mm_util_debug("Image isplay is suceeded when YUV crop height value %d", *crop_dest_height);
                }
 
-               ret = __mm_util_crop_yuv420(src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
+               ret = __mm_util_crop_yuv420(src, src_width, src_height, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
                break;
                }
        default:
@@ -1713,7 +1614,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_wi
        return ret;
 }
 
-int mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize)
+int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, unsigned int *imgsize)
 {
        int ret = MM_UTIL_ERROR_NONE;
        unsigned char x_chroma_shift = 0;
@@ -1736,8 +1637,8 @@ int mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsign
        }
 
        switch (format) {
-       case MM_UTIL_IMG_FMT_I420:
-       case MM_UTIL_IMG_FMT_YUV420:
+       case MM_UTIL_COLOR_I420:
+       case MM_UTIL_COLOR_YUV420:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
@@ -1749,40 +1650,40 @@ int mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsign
                size2 = stride2 * h2;
                *imgsize = size + 2 * size2;
                break;
-       case MM_UTIL_IMG_FMT_YUV422:
-       case MM_UTIL_IMG_FMT_YUYV:
-       case MM_UTIL_IMG_FMT_UYVY:
-       case MM_UTIL_IMG_FMT_NV16:
-       case MM_UTIL_IMG_FMT_NV61:
+       case MM_UTIL_COLOR_YUV422:
+       case MM_UTIL_COLOR_YUYV:
+       case MM_UTIL_COLOR_UYVY:
+       case MM_UTIL_COLOR_NV16:
+       case MM_UTIL_COLOR_NV61:
                stride = MM_UTIL_ROUND_UP_4(width) * 2;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_RGB565:
+       case MM_UTIL_COLOR_RGB16:
                stride = MM_UTIL_ROUND_UP_4(width) * 2;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_RGB888:
+       case MM_UTIL_COLOR_RGB24:
                stride = MM_UTIL_ROUND_UP_4(width) * 3;
                size = stride * height;
                *imgsize = size;
                break;
 
-       case MM_UTIL_IMG_FMT_ARGB8888:
-       case MM_UTIL_IMG_FMT_BGRA8888:
-       case MM_UTIL_IMG_FMT_RGBA8888:
-       case MM_UTIL_IMG_FMT_BGRX8888:
+       case MM_UTIL_COLOR_ARGB:
+       case MM_UTIL_COLOR_BGRA:
+       case MM_UTIL_COLOR_RGBA:
+       case MM_UTIL_COLOR_BGRX:
                stride = width * 4;
                size = stride * height;
                *imgsize = size;
                break;
 
 
-       case MM_UTIL_IMG_FMT_NV12:
-       case MM_UTIL_IMG_FMT_NV12_TILED:
+       case MM_UTIL_COLOR_NV12:
+       case MM_UTIL_COLOR_NV12_TILED:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
index 041fc35..04d2698 100755 (executable)
@@ -26,6 +26,7 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <mm_util_imgp.h>
+#include <mm_util_common.h>
 
 #define MAX_STRING_LEN 128
 #define IMAGE_FORMAT_LABEL_BUFFER_SIZE 4
@@ -102,8 +103,8 @@ int main(int argc, char *argv[])
        unsigned char *dst = NULL;
 
        if (argc < 12) {
-               fprintf(stderr, "Usage: %s sync {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format rotation crop_start_x crop_start_y \n", argv[0]);
-               fprintf(stderr, "Usage: %s async {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format rotation crop_start_x crop_start_y \n", argv[0]);
+               fprintf(stderr, "Usage: %s sync {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n", argv[0]);
+               fprintf(stderr, "Usage: %s async {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n", argv[0]);
                fprintf(stderr, "ex: %s sync test.rgb resize 1920 1080 7 1280 720 7 0 0 0 \n", argv[0]);
                return ret;
        }
@@ -115,10 +116,10 @@ int main(int argc, char *argv[])
        char *command = strdup(argv[3]);
        unsigned int src_width = (unsigned int)atoi(argv[4]);
        unsigned int src_height = (unsigned int)atoi(argv[5]);
-       mm_util_img_format src_format = atoi(argv[6]);
+       mm_util_color_format_e src_format = atoi(argv[6]);
        unsigned int dst_width = (unsigned int)atoi(argv[7]);
        unsigned int dst_height = (unsigned int)atoi(argv[8]);
-       mm_util_img_format dst_format = atoi(argv[9]);
+       mm_util_color_format_e dst_format = atoi(argv[9]);
        mm_util_img_rotate_type rotation = atoi(argv[10]);
        unsigned int start_x = (unsigned int)atoi(argv[11]);
        unsigned int start_y = (unsigned int)atoi(argv[12]);
@@ -166,9 +167,9 @@ int main(int argc, char *argv[])
        {  /* ready output file */
                char *output_fmt = (char *) calloc(1, sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
                memset(output_fmt, 0, IMAGE_FORMAT_LABEL_BUFFER_SIZE);
-               if (dst_format == MM_UTIL_IMG_FMT_YUV420 ||
-                       dst_format == MM_UTIL_IMG_FMT_YUV422 ||
-                       dst_format == MM_UTIL_IMG_FMT_I420) {
+               if (dst_format == MM_UTIL_COLOR_YUV420 ||
+                       dst_format == MM_UTIL_COLOR_YUV422 ||
+                       dst_format == MM_UTIL_COLOR_I420) {
                        strncpy(output_fmt, "yuv", strlen("yuv"));
                } else {
                        //strncpy(output_fmt, "rgb", strlen("rgb"));
@@ -216,15 +217,7 @@ int main(int argc, char *argv[])
                        goto TEST_FAIL;
                }
 
-               ret = mm_util_create_color_image(&orig_image);
-               if (ret == MM_UTIL_ERROR_NONE) {
-                       fprintf(stderr, "Success - mm_util_create_color_image\n");
-               } else {
-                       fprintf(stderr, "ERROR - mm_util_create_color_image\n");
-                       goto TEST_FAIL;
-               }
-
-               ret = mm_util_set_color_image(orig_image, src_width, src_height, src_format, src, src_size);
+               ret = mm_util_create_color_image(&orig_image, src_width, src_height, src_format, src, src_size);
                if (ret == MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "Success - mm_util_create_color_image\n");
                } else {
index 2a77cc2..d81a2f8 100755 (executable)
@@ -40,7 +40,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
 aux_source_directory(. SOURCES)
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} mmutil_imgp jpeg turbojpeg)
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} mmutil_common mmutil_imgp jpeg turbojpeg)
 SET_TARGET_PROPERTIES(${fw_name}
        PROPERTIES
        VERSION ${VERSION}
index b90b81a..51af0a9 100755 (executable)
@@ -37,31 +37,6 @@ extern "C" {
 */
 
 /**
- * YUV format for jpeg
- */
-typedef enum {
-       /* YUV planar format */
-       MM_UTIL_JPEG_FMT_YUV420 = 0x00,  /**< YUV420 format - planer I420 */
-       MM_UTIL_JPEG_FMT_YUV422,         /**< YUV422 format - planer */
-       /* YUV packed format */
-       MM_UTIL_JPEG_FMT_UYVY,            /**< UYVY format - YUV packed format */
-       /* RGB888 format */
-       MM_UTIL_JPEG_FMT_RGB888,             /**< RGB888 format */
-       /* GrayScale format */
-       MM_UTIL_JPEG_FMT_GraySacle,    /**< GrayScale format */
-       /* YUV packed format */
-       MM_UTIL_JPEG_FMT_YUYV,            /**< YUYV format - YUV packed format */
-       /*Following formats are only for qualcomm hardware codecs.*/
-       MM_UTIL_JPEG_FMT_NV12,             /**< YUV format - YUV420 semi-planar (NV12) */
-       MM_UTIL_JPEG_FMT_NV21,             /**< YUV format - YUV420 semi-planar (NV21) */
-       MM_UTIL_JPEG_FMT_NV16,             /**< YUV format - YUV422 semi-planar (NV16) */
-       MM_UTIL_JPEG_FMT_NV61,             /**< YUV format - YUV422 semi-planar (NV61) */
-       MM_UTIL_JPEG_FMT_RGBA8888,     /**< RGBA8888 format */
-       MM_UTIL_JPEG_FMT_BGRA8888,     /**< BGRA8888 format */
-       MM_UTIL_JPEG_FMT_ARGB8888,     /**< ARGB8888 format */
-} mm_util_jpeg_yuv_format;
-
-/**
  * downscale decoding for jpeg
  */
 typedef enum {
@@ -75,7 +50,7 @@ typedef enum {
  * YUV data
  */
 typedef struct {
-       mm_util_jpeg_yuv_format format;     /**< pixel format*/
+       mm_util_color_format_e format;     /**< pixel format*/
        int width;                          /**< width */
        int height;                         /**< heigt */
        unsigned int size;                           /**< size */
@@ -94,10 +69,10 @@ typedef struct {
  * @param quality [in]      encoding quality, from 1 to 100
  * @return This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_jpeg_yuv_format
+ * @see         mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_jpeg_encode_to_file(const char *filename, void *src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality);
+int mm_util_jpeg_encode_to_file(const char *filename, void *src, int width, int height, mm_util_color_format_e fmt, int quality);
 
 
 /**
@@ -112,10 +87,10 @@ int mm_util_jpeg_encode_to_file(const char *filename, void *src, int width, int
  * @param quality [in]      encoding quality, from 1 to 100
  * @return This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_jpeg_yuv_format
+ * @see         mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void *src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality);
+int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void *src, int width, int height, mm_util_color_format_e fmt, int quality);
 
 
 /**
@@ -126,10 +101,10 @@ int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void *src, int
  * @param fmt [in]          color format
  * @return This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @see         mm_util_jpeg_yuv_data, mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt);
+int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_color_format_e fmt);
 
 
 /**
@@ -141,10 +116,10 @@ int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *fi
  * @param fmt [in]          color format
  * @return This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @see         mm_util_jpeg_yuv_data, mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_jpeg_yuv_format fmt);
+int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_color_format_e fmt);
 
 /**
  * This function extracts yuv data from jpeg file with downscale decode option
@@ -155,10 +130,10 @@ int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, u
  * @param downscale [in]       downscale value
  * @return This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @see         mm_util_jpeg_yuv_data, mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale);
+int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale);
 
 /**
  * This function extracts yuv data from jpeg buffer with downscale decode option
@@ -170,10 +145,10 @@ int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded,
  * @param downscale [in]       downscale value
  * @return This function returns zero on success, or negative value with error code.
  * @remark
- * @see         mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @see         mm_util_jpeg_yuv_data, mm_util_color_format_e
  * @since       R1, 1.0
  */
-int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale);
+int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale);
 
 
 #ifdef __cplusplus
index 213c5b9..6e75076 100755 (executable)
@@ -33,6 +33,7 @@
 #include <glib.h>
 #include "mm_util_jpeg.h"
 #include "mm_util_imgp.h"
+#include "mm_util_common.h"
 #include "mm_util_private.h"
 
 #ifndef YUV420_SIZE
@@ -109,7 +110,7 @@ static void mm_image_codec_writeJPEG(unsigned char *jpegBuf, unsigned long jpegS
 }
 #endif
 
-static void __mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int TD_BU, mm_util_jpeg_yuv_data* decoded_data, mm_util_jpeg_yuv_format input_fmt)
+static void __mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int TD_BU, mm_util_jpeg_yuv_data* decoded_data, mm_util_color_format_e input_fmt)
 {
        int _hdrw = 0, _hdrh = 0, _hdrsubsamp = -1;
        int scaledWidth = 0;
@@ -133,7 +134,7 @@ static void __mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char
                return;
        }
 
-       if ((_hdrsubsamp == TJSAMP_444 || _hdrsubsamp == TJSAMP_GRAY) || input_fmt == MM_UTIL_JPEG_FMT_RGB888)
+       if ((_hdrsubsamp == TJSAMP_444 || _hdrsubsamp == TJSAMP_GRAY) || input_fmt == MM_UTIL_COLOR_RGB24)
                _sf = sf[i];
        else
                _sf = sf1;
@@ -142,18 +143,18 @@ static void __mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char
        scaledHeight = TJSCALED(_hdrh, _sf);
        mm_util_debug("_hdrw:%d _hdrh:%d, _hdrsubsamp:%d, scaledWidth:%d, scaledHeight:%d", _hdrw, _hdrh, _hdrsubsamp, scaledWidth, scaledHeight);
 
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422)
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422)
                mm_util_debug("JPEG -> YUV %s ... ", subName[_hdrsubsamp]);
-       else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888)
+       else if (input_fmt == MM_UTIL_COLOR_RGB24)
                mm_util_debug("JPEG -> RGB %d/%d ... ", _sf.num, _sf.denom);
 
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422) {
                dstSize = TJBUFSIZEYUV(_hdrw, _hdrh, _hdrsubsamp);
-               mm_util_debug("MM_UTIL_JPEG_FMT_YUV420 dstSize: %d _hdrsubsamp:%d TJBUFSIZEYUV(w, h, _hdrsubsamp): %d",
+               mm_util_debug("MM_UTIL_COLOR_YUV420 dstSize: %d _hdrsubsamp:%d TJBUFSIZEYUV(w, h, _hdrsubsamp): %d",
                        dstSize, _hdrsubsamp, TJBUFSIZEYUV(_hdrw, _hdrh, _hdrsubsamp));
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       } else if (input_fmt == MM_UTIL_COLOR_RGB24) {
                dstSize = scaledWidth*scaledHeight*tjPixelSize[TJPF_RGB];
-               mm_util_debug("MM_UTIL_JPEG_FMT_RGB888 dstSize: %d _hdrsubsamp:%d", dstSize, _hdrsubsamp);
+               mm_util_debug("MM_UTIL_COLOR_RGB24 dstSize: %d _hdrsubsamp:%d", dstSize, _hdrsubsamp);
        }
 
        if ((decoded_data->data = (void *)calloc(1, dstSize)) == NULL) {
@@ -163,25 +164,25 @@ static void __mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char
 
        mm_util_debug("dstBuf:%p", decoded_data->data);
 
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422) {
                _tj(tjDecompressToYUV(handle, jpegBuf, jpegSize, decoded_data->data, TD_BU));
-               mm_util_debug("MM_UTIL_JPEG_FMT_YUV420, dstBuf: %d", decoded_data->data);
+               mm_util_debug("MM_UTIL_COLOR_YUV420, dstBuf: %d", decoded_data->data);
                decoded_data->format = input_fmt;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       } else if (input_fmt == MM_UTIL_COLOR_RGB24) {
                _tj(tjDecompress2(handle, jpegBuf, jpegSize, decoded_data->data, scaledWidth, 0, scaledHeight, TJPF_RGB, TD_BU));
-               mm_util_debug("MM_UTIL_JPEG_FMT_RGB888, dstBuf: %p", decoded_data->data);
-               decoded_data->format = MM_UTIL_JPEG_FMT_RGB888;
+               mm_util_debug("MM_UTIL_COLOR_RGB24, dstBuf: %p", decoded_data->data);
+               decoded_data->format = MM_UTIL_COLOR_RGB24;
        } else {
                mm_util_error("[%s][%05d] We can't support the IMAGE format");
                return;
        }
 
        decoded_data->size = dstSize;
-       if (input_fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       if (input_fmt == MM_UTIL_COLOR_RGB24) {
                decoded_data->width = scaledWidth;
                decoded_data->height = scaledHeight;
                decoded_data->size = dstSize;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422) {
                if (_hdrsubsamp == TJSAMP_422) {
                        mm_util_debug("_hdrsubsamp == TJSAMP_422", decoded_data->width, _hdrw);
                        decoded_data->width = MM_JPEG_ROUND_UP_2(_hdrw);
@@ -205,7 +206,7 @@ static void __mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char
        }
 }
 
-static int __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_data *decoded_data, const char *pFileName, mm_util_jpeg_yuv_format input_fmt)
+static int __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_data *decoded_data, const char *pFileName, mm_util_color_format_e input_fmt)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        tjhandle dhandle = NULL;
@@ -259,7 +260,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_
        return iErrorCode;
 }
 
-static int __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_data *decoded_data, void *src, unsigned int size, mm_util_jpeg_yuv_format input_fmt)
+static int __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_data *decoded_data, void *src, unsigned int size, mm_util_color_format_e input_fmt)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        tjhandle dhandle = NULL;
@@ -289,7 +290,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yu
        return iErrorCode;
 }
 
-static void _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsigned char **dstBuf, unsigned long *dstSize, int w, int h, int jpegQual, int flags, mm_util_jpeg_yuv_format fmt)
+static void _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsigned char **dstBuf, unsigned long *dstSize, int w, int h, int jpegQual, int flags, mm_util_color_format_e fmt)
 {
        unsigned char *srcBuf = NULL;
        unsigned long jpegSize = 0;
@@ -302,9 +303,9 @@ static void _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsign
                return;
        } else {
                mm_util_debug("srcBuf: 0x%2x", srcBuf);
-               if (fmt == MM_UTIL_JPEG_FMT_RGB888) {
+               if (fmt == MM_UTIL_COLOR_RGB24) {
                        __initBuf(srcBuf, w, h, TJPF_RGB, flags);
-               } else if (fmt == MM_UTIL_JPEG_FMT_YUV420 || fmt == MM_UTIL_JPEG_FMT_YUV422) {
+               } else if (fmt == MM_UTIL_COLOR_YUV420 || fmt == MM_UTIL_COLOR_YUV422) {
                        __initBuf(srcBuf, w, h, TJPF_GRAY, flags);
                } else {
                        MMUTIL_SAFE_FREE(srcBuf);
@@ -317,14 +318,14 @@ static void _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsign
        if (*dstBuf && *dstSize > 0) memset(*dstBuf, 0, *dstSize);
        mm_util_debug("Done.");
        *dstSize = TJBUFSIZE(w, h);
-       if (fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       if (fmt == MM_UTIL_COLOR_RGB24) {
                _tj(tjCompress2(handle, srcBuf, w, 0, h, TJPF_RGB, dstBuf, dstSize, TJPF_RGB, jpegQual, flags));
                mm_util_debug("*dstSize: %d", *dstSize);
-       } else if (fmt == MM_UTIL_JPEG_FMT_YUV420) {
+       } else if (fmt == MM_UTIL_COLOR_YUV420) {
                *dstSize = TJBUFSIZEYUV(w, h, TJSAMP_420);
                _tj(tjEncodeYUV2(handle, srcBuf, w, 0, h, TJPF_RGB, *dstBuf, TJSAMP_420, flags));
                mm_util_debug("*dstSize: %d \t decode_yuv_subsample: %d TJBUFSIZE(w, h):%d", *dstSize, TJSAMP_420, TJBUFSIZE(w, h));
-       } else if (fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       } else if (fmt == MM_UTIL_COLOR_YUV422) {
                *dstSize = TJBUFSIZEYUV(w, h, TJSAMP_422);
                _tj(tjEncodeYUV2(handle, srcBuf, w, 0, h, TJPF_RGB, *dstBuf, TJSAMP_422, flags));
                mm_util_debug("*dstSize: %d \t decode_yuv_subsample: %d TJBUFSIZE(w, h):%d", *dstSize, TJSAMP_422, TJBUFSIZE(w, h));
@@ -335,7 +336,7 @@ static void _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsign
        MMUTIL_SAFE_FREE(srcBuf);
 }
 
-static int __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(const char *filename, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+static int __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(const char *filename, void* src, int width, int height, mm_util_color_format_e fmt, int quality)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        tjhandle chandle = NULL;
@@ -375,16 +376,16 @@ static int __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(const char *filenam
        return iErrorCode;
 }
 
-static int __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(void **mem, unsigned int *csize, void *rawdata, int w, int h, mm_util_jpeg_yuv_format fmt, int quality)
+static int __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(void **mem, unsigned int *csize, void *rawdata, int w, int h, mm_util_color_format_e fmt, int quality)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        tjhandle chandle = NULL;
        int TD_BU = 0;
 
        *csize = TJBUFSIZE(w, h);
-       if (fmt == MM_UTIL_JPEG_FMT_RGB888) {
-               mm_util_debug("MM_UTIL_JPEG_FMT_RGB888 size: %u", *csize);
-       } else if (fmt == MM_UTIL_JPEG_FMT_YUV420 || fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       if (fmt == MM_UTIL_COLOR_RGB24) {
+               mm_util_debug("MM_UTIL_COLOR_RGB24 size: %u", *csize);
+       } else if (fmt == MM_UTIL_COLOR_YUV420 || fmt == MM_UTIL_COLOR_YUV422) {
                mm_util_debug("TJSAMP_420 ||TJSAMP_422 size: %u", *csize);
        } else {
                        mm_util_error("We can't support the IMAGE format");
@@ -451,7 +452,7 @@ static void __my_error_exit(j_common_ptr cinfo)
        longjmp(myerr->setjmp_buffer, 1); /* Return control to the setjmp point */
 }
 
-static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, void *rawdata, int width, int height, mm_util_color_format_e fmt, int quality)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        char *realPATH = NULL;
@@ -510,7 +511,7 @@ static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, vo
        jpeg_stdio_dest(&cinfo, fpWriter);
        cinfo.image_width = width;
        cinfo.image_height = height;
-       if (fmt == MM_UTIL_JPEG_FMT_YUV420 || fmt == MM_UTIL_JPEG_FMT_YUV422 || fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       if (fmt == MM_UTIL_COLOR_YUV420 || fmt == MM_UTIL_COLOR_YUV422 || fmt == MM_UTIL_COLOR_UYVY) {
                mm_util_debug("[__mm_image_encode_to_jpeg_file_with_libjpeg] jpeg_stdio_dest for YUV");
                mm_util_debug("[Height] %d", height);
                _height = MM_JPEG_ROUND_DOWN_16(height);
@@ -527,9 +528,9 @@ static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, vo
                cinfo.do_fancy_downsampling = FALSE;
 
                cinfo.comp_info[0].h_samp_factor = 2;
-               if (fmt == MM_UTIL_JPEG_FMT_YUV420)
+               if (fmt == MM_UTIL_COLOR_YUV420)
                        cinfo.comp_info[0].v_samp_factor = 2;
-               else if (fmt == MM_UTIL_JPEG_FMT_YUV422 || fmt == MM_UTIL_JPEG_FMT_UYVY)
+               else if (fmt == MM_UTIL_COLOR_YUV422 || fmt == MM_UTIL_COLOR_UYVY)
                        cinfo.comp_info[0].v_samp_factor = 1;
                cinfo.comp_info[1].h_samp_factor = 1;
                cinfo.comp_info[1].v_samp_factor = 1;
@@ -611,27 +612,27 @@ static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, vo
                mm_util_debug("jpeg_destroy_compress");
        }
 
-       else if (fmt == MM_UTIL_JPEG_FMT_RGB888 || fmt == MM_UTIL_JPEG_FMT_GraySacle || fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       else if (fmt == MM_UTIL_COLOR_RGB24 || fmt == MM_UTIL_COLOR_GRAYSCALE || fmt == MM_UTIL_COLOR_RGBA || fmt == MM_UTIL_COLOR_BGRA || fmt == MM_UTIL_COLOR_ARGB) {
                JSAMPROW row_pointer[1];
                int iRowStride = 0;
 
-               if (fmt == MM_UTIL_JPEG_FMT_RGB888) {
+               if (fmt == MM_UTIL_COLOR_RGB24) {
                        cinfo.input_components = 3;
                        cinfo.in_color_space = JCS_RGB;
                        mm_util_debug("JCS_RGB");
-               } else if (fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+               } else if (fmt == MM_UTIL_COLOR_GRAYSCALE) {
                        cinfo.input_components = 1; /* one colour component */
                        cinfo.in_color_space = JCS_GRAYSCALE;
                        mm_util_debug("JCS_GRAYSCALE");
-               } else if (fmt == MM_UTIL_JPEG_FMT_RGBA8888) {
+               } else if (fmt == MM_UTIL_COLOR_RGBA) {
                        cinfo.input_components = 4; /* one colour component */
                        cinfo.in_color_space = JCS_EXT_RGBA;
                        mm_util_debug("JCS_EXT_RGBA");
-               } else if (fmt == MM_UTIL_JPEG_FMT_BGRA8888) {
+               } else if (fmt == MM_UTIL_COLOR_BGRA) {
                        cinfo.input_components = 4;
                        cinfo.in_color_space = JCS_EXT_BGRA;
                        mm_util_debug("JCS_EXT_BGRA");
-               } else if (fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+               } else if (fmt == MM_UTIL_COLOR_ARGB) {
                        cinfo.input_components = 4;
                        cinfo.in_color_space = JCS_EXT_ARGB;
                        mm_util_debug("JCS_EXT_ARGB");
@@ -643,11 +644,11 @@ static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, vo
                mm_util_debug("jpeg_set_quality");
                jpeg_start_compress(&cinfo, TRUE);
                mm_util_debug("jpeg_start_compress");
-               if (fmt == MM_UTIL_JPEG_FMT_RGB888)
+               if (fmt == MM_UTIL_COLOR_RGB24)
                        iRowStride = width * 3;
-               else if (fmt == MM_UTIL_JPEG_FMT_GraySacle)
+               else if (fmt == MM_UTIL_COLOR_GRAYSCALE)
                        iRowStride = width;
-               else if (fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888)
+               else if (fmt == MM_UTIL_COLOR_RGBA || fmt == MM_UTIL_COLOR_BGRA || fmt == MM_UTIL_COLOR_ARGB)
                        iRowStride = width * 4;
 
                JSAMPLE *image_buffer = (JSAMPLE *)rawdata;
@@ -672,7 +673,7 @@ static int __mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, vo
        return iErrorCode;
 }
 
-static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned int *csize, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned int *csize, void *rawdata, int width, int height, mm_util_color_format_e fmt, int quality)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
 
@@ -710,7 +711,7 @@ static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned in
        jpeg_mem_dest(&cinfo, (unsigned char **)mem, &size);
        cinfo.image_width = width;
        cinfo.image_height = height;
-       if (fmt == MM_UTIL_JPEG_FMT_YUV420 || fmt == MM_UTIL_JPEG_FMT_YUV422 || fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       if (fmt == MM_UTIL_COLOR_YUV420 || fmt == MM_UTIL_COLOR_YUV422 || fmt == MM_UTIL_COLOR_UYVY) {
                mm_util_debug("[__mm_image_encode_to_jpeg_file_with_libjpeg] jpeg_stdio_dest for YUV");
                _height = MM_JPEG_ROUND_DOWN_16(height);
                flag = height - _height;
@@ -724,9 +725,9 @@ static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned in
                cinfo.do_fancy_downsampling = FALSE;
 
                cinfo.comp_info[0].h_samp_factor = 2;
-               if (fmt == MM_UTIL_JPEG_FMT_YUV420)
+               if (fmt == MM_UTIL_COLOR_YUV420)
                        cinfo.comp_info[0].v_samp_factor = 2;
-               else if (fmt == MM_UTIL_JPEG_FMT_YUV422 || fmt == MM_UTIL_JPEG_FMT_UYVY)
+               else if (fmt == MM_UTIL_COLOR_YUV422 || fmt == MM_UTIL_COLOR_UYVY)
                        cinfo.comp_info[0].v_samp_factor = 1;
                cinfo.comp_info[1].h_samp_factor = 1;
                cinfo.comp_info[1].v_samp_factor = 1;
@@ -805,28 +806,28 @@ static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned in
                mm_util_debug("Exit jpeg_destroy_compress, mem: %p\t size:%u", *mem, *csize);
        }
 
-       else if (fmt == MM_UTIL_JPEG_FMT_RGB888 || fmt == MM_UTIL_JPEG_FMT_GraySacle || fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       else if (fmt == MM_UTIL_COLOR_RGB24 || fmt == MM_UTIL_COLOR_GRAYSCALE || fmt == MM_UTIL_COLOR_RGBA || fmt == MM_UTIL_COLOR_BGRA || fmt == MM_UTIL_COLOR_ARGB) {
                JSAMPROW row_pointer[1];
                int iRowStride = 0;
 
-               mm_util_debug("MM_UTIL_JPEG_FMT_RGB888");
-               if (fmt == MM_UTIL_JPEG_FMT_RGB888) {
+               mm_util_debug("MM_UTIL_COLOR_RGB24");
+               if (fmt == MM_UTIL_COLOR_RGB24) {
                        cinfo.input_components = 3;
                        cinfo.in_color_space = JCS_RGB;
                        mm_util_debug("JCS_RGB");
-               } else if (fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+               } else if (fmt == MM_UTIL_COLOR_GRAYSCALE) {
                        cinfo.input_components = 1; /* one colour component */
                        cinfo.in_color_space = JCS_GRAYSCALE;
                        mm_util_debug("JCS_GRAYSCALE");
-               } else if (fmt == MM_UTIL_JPEG_FMT_RGBA8888) {
+               } else if (fmt == MM_UTIL_COLOR_RGBA) {
                        cinfo.input_components = 4;
                        cinfo.in_color_space = JCS_EXT_RGBA;
                        mm_util_debug("JCS_EXT_RGBA");
-               } else if (fmt == MM_UTIL_JPEG_FMT_BGRA8888) {
+               } else if (fmt == MM_UTIL_COLOR_BGRA) {
                        cinfo.input_components = 4;
                        cinfo.in_color_space = JCS_EXT_BGRA;
                        mm_util_debug("JCS_EXT_BGRA");
-               } else if (fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+               } else if (fmt == MM_UTIL_COLOR_ARGB) {
                        cinfo.input_components = 4;
                        cinfo.in_color_space = JCS_EXT_ARGB;
                        mm_util_debug("JCS_EXT_ARGB");
@@ -838,11 +839,11 @@ static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned in
                mm_util_debug("jpeg_set_quality");
                jpeg_start_compress(&cinfo, TRUE);
                mm_util_debug("jpeg_start_compress");
-               if (fmt == MM_UTIL_JPEG_FMT_RGB888)
+               if (fmt == MM_UTIL_COLOR_RGB24)
                        iRowStride = width * 3;
-               else if (fmt == MM_UTIL_JPEG_FMT_GraySacle)
+               else if (fmt == MM_UTIL_COLOR_GRAYSCALE)
                        iRowStride = width;
-               else if (fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888)
+               else if (fmt == MM_UTIL_COLOR_RGBA || fmt == MM_UTIL_COLOR_BGRA || fmt == MM_UTIL_COLOR_ARGB)
                        iRowStride = width * 4;
 
                JSAMPLE *image_buffer = (JSAMPLE *)rawdata;
@@ -865,7 +866,7 @@ static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned in
        return iErrorCode;
 }
 
-static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *decoded_data, const char *pFileName, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
+static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *decoded_data, const char *pFileName, mm_util_color_format_e input_fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        FILE *infile = NULL;
@@ -943,22 +944,22 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *
        dinfo.dct_method = JDCT_FASTEST;
 
        /* set parameters for decompression */
-       if (input_fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       if (input_fmt == MM_UTIL_COLOR_RGB24) {
                dinfo.out_color_space = JCS_RGB;
                mm_util_debug("cinfo.out_color_space = JCS_RGB");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422 || input_fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422 || input_fmt == MM_UTIL_COLOR_UYVY) {
                dinfo.out_color_space = JCS_YCbCr;
                mm_util_debug("cinfo.out_color_space = JCS_YCbCr");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+       } else if (input_fmt == MM_UTIL_COLOR_GRAYSCALE) {
                dinfo.out_color_space = JCS_GRAYSCALE;
                mm_util_debug("cinfo.out_color_space = JCS_GRAYSCALE");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGBA8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_RGBA) {
                dinfo.out_color_space = JCS_EXT_RGBA;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_RGBA");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_BGRA8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_BGRA) {
                dinfo.out_color_space = JCS_EXT_BGRA;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_BGRA");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_ARGB) {
                dinfo.out_color_space = JCS_EXT_ARGB;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_ARGB");
        }
@@ -968,7 +969,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *
        jpeg_start_decompress(&dinfo);
 
        /* byte-align for YUV format */
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422) {
                if (dinfo.output_width % 2 != 0)
                        dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
                if (dinfo.output_height % 2 != 0)
@@ -980,16 +981,16 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *
 
        /* Make a one-row-high sample array that will go away when done with image */
        buffer = (*dinfo.mem->alloc_sarray) ((j_common_ptr) &dinfo, JPOOL_IMAGE, row_stride, 1);
-       mm_util_debug("JPOOL_IMAGE BUFFER");
+       mm_util_debug("JPOOL_IMAGE BUFFER (input_fmt: %d)", input_fmt);
        decoded_data->width = dinfo.output_width;
        decoded_data->height = dinfo.output_height;
-       if (input_fmt == MM_UTIL_JPEG_FMT_RGB888 || input_fmt == MM_UTIL_JPEG_FMT_RGBA8888 || input_fmt == MM_UTIL_JPEG_FMT_BGRA8888 || input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       if (input_fmt == MM_UTIL_COLOR_RGB24 || input_fmt == MM_UTIL_COLOR_RGBA || input_fmt == MM_UTIL_COLOR_BGRA || input_fmt == MM_UTIL_COLOR_ARGB) {
                decoded_data->size = dinfo.output_height * row_stride;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV420) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV420) {
                decoded_data->size = dinfo.output_height * row_stride / 2;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV422 || input_fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV422 || input_fmt == MM_UTIL_COLOR_UYVY) {
                decoded_data->size = dinfo.output_height * dinfo.output_width * 2;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+       } else if (input_fmt == MM_UTIL_COLOR_GRAYSCALE) {
                decoded_data->size = dinfo.output_height * dinfo.output_width;
        } else{
                jpeg_finish_decompress(&dinfo);
@@ -1011,7 +1012,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *
        }
        mm_util_debug("decoded_data->data");
 
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422 || input_fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422 || input_fmt == MM_UTIL_COLOR_UYVY) {
                image = decoded_data->data;
                u_image = image + (dinfo.output_width * dinfo.output_height);
                v_image = u_image + (dinfo.output_width*dinfo.output_height) / 4;
@@ -1033,7 +1034,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *
                                v_image += dinfo.output_width / 2;
                        }
                }
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888 || input_fmt == MM_UTIL_JPEG_FMT_GraySacle || input_fmt == MM_UTIL_JPEG_FMT_RGBA8888 || input_fmt == MM_UTIL_JPEG_FMT_BGRA8888 || input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_RGB24 || input_fmt == MM_UTIL_COLOR_GRAYSCALE || input_fmt == MM_UTIL_COLOR_RGBA || input_fmt == MM_UTIL_COLOR_BGRA || input_fmt == MM_UTIL_COLOR_ARGB) {
                int state = 0;
                /* while (scan lines remain to be read) jpeg_read_scanlines(...); */
                while (dinfo.output_scanline < dinfo.output_height) {
@@ -1058,7 +1059,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data *
        return iErrorCode;
 }
 
-static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *decoded_data, void *src, unsigned int size, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
+static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *decoded_data, void *src, unsigned int size, mm_util_color_format_e input_fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        struct jpeg_decompress_struct dinfo;
@@ -1128,22 +1129,22 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data
        dinfo.dct_method = JDCT_FASTEST;
 
        /* set parameters for decompression */
-       if (input_fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       if (input_fmt == MM_UTIL_COLOR_RGB24) {
                dinfo.out_color_space = JCS_RGB;
                mm_util_debug("cinfo.out_color_space = JCS_RGB");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422 || input_fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422 || input_fmt == MM_UTIL_COLOR_UYVY) {
                dinfo.out_color_space = JCS_YCbCr;
                mm_util_debug("cinfo.out_color_space = JCS_YCbCr");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+       } else if (input_fmt == MM_UTIL_COLOR_GRAYSCALE) {
                dinfo.out_color_space = JCS_GRAYSCALE;
                mm_util_debug("cinfo.out_color_space = JCS_GRAYSCALE");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGBA8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_RGBA) {
                dinfo.out_color_space = JCS_EXT_RGBA;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_RGBA");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_BGRA8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_BGRA) {
                dinfo.out_color_space = JCS_EXT_BGRA;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_BGRA");
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_ARGB) {
                dinfo.out_color_space = JCS_EXT_ARGB;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_ARGB");
        }
@@ -1154,7 +1155,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data
        mm_util_debug("jpeg_start_decompress");
 
        /* byte-align for YUV format */
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422) {
                if (dinfo.output_width % 2 != 0)
                        dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
                if (dinfo.output_height % 2 != 0)
@@ -1166,16 +1167,16 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data
 
        /* Make a one-row-high sample array that will go away when done with image */
        buffer = (*dinfo.mem->alloc_sarray) ((j_common_ptr) &dinfo, JPOOL_IMAGE, row_stride, 1);
-       mm_util_debug("JPOOL_IMAGE BUFFER");
+       mm_util_debug("JPOOL_IMAGE BUFFER (input_fmt: %d)", input_fmt);
        decoded_data->width = dinfo.output_width;
        decoded_data->height = dinfo.output_height;
-       if (input_fmt == MM_UTIL_JPEG_FMT_RGB888 || input_fmt == MM_UTIL_JPEG_FMT_RGBA8888 || input_fmt == MM_UTIL_JPEG_FMT_BGRA8888 || input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       if (input_fmt == MM_UTIL_COLOR_RGB24 || input_fmt == MM_UTIL_COLOR_RGBA || input_fmt == MM_UTIL_COLOR_BGRA || input_fmt == MM_UTIL_COLOR_ARGB) {
                decoded_data->size = dinfo.output_height * row_stride;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV420) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV420) {
                decoded_data->size = dinfo.output_height * row_stride / 2;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_YUV422 || input_fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       } else if (input_fmt == MM_UTIL_COLOR_YUV422 || input_fmt == MM_UTIL_COLOR_UYVY) {
                decoded_data->size = dinfo.output_height * dinfo.output_width * 2;
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+       } else if (input_fmt == MM_UTIL_COLOR_GRAYSCALE) {
                decoded_data->size = dinfo.output_height * dinfo.output_width;
        } else{
                jpeg_finish_decompress(&dinfo);
@@ -1196,7 +1197,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data
        mm_util_debug("decoded_data->data");
 
        /* while (scan lines remain to be read) jpeg_read_scanlines(...); */
-       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422 || input_fmt == MM_UTIL_JPEG_FMT_UYVY) {
+       if (input_fmt == MM_UTIL_COLOR_YUV420 || input_fmt == MM_UTIL_COLOR_YUV422 || input_fmt == MM_UTIL_COLOR_UYVY) {
                image = decoded_data->data;
                u_image = image + (dinfo.output_width * dinfo.output_height);
                v_image = u_image + (dinfo.output_width*dinfo.output_height)/4;
@@ -1218,7 +1219,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data
                                v_image += dinfo.output_width / 2;
                        }
                }
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888 || input_fmt == MM_UTIL_JPEG_FMT_GraySacle || input_fmt == MM_UTIL_JPEG_FMT_RGBA8888 || input_fmt == MM_UTIL_JPEG_FMT_BGRA8888 || input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+       } else if (input_fmt == MM_UTIL_COLOR_RGB24 || input_fmt == MM_UTIL_COLOR_GRAYSCALE || input_fmt == MM_UTIL_COLOR_RGBA || input_fmt == MM_UTIL_COLOR_BGRA || input_fmt == MM_UTIL_COLOR_ARGB) {
                int state = 0;
                while (dinfo.output_scanline < dinfo.output_height) {
                        /* jpeg_read_scanlines expects an array of pointers to scanlines. Here the array is only one element long, but you could ask formore than one scanline at a time if that's more convenient. */
@@ -1243,7 +1244,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data
        return iErrorCode;
 }
 #endif
-int mm_util_jpeg_encode_to_file(const char *filename, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+int mm_util_jpeg_encode_to_file(const char *filename, void* src, int width, int height, mm_util_color_format_e fmt, int quality)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1259,7 +1260,7 @@ int mm_util_jpeg_encode_to_file(const char *filename, void* src, int width, int
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
+       if (IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE) {
                mm_util_error("#ERROR# fmt value [%d]", fmt);
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -1274,19 +1275,19 @@ int mm_util_jpeg_encode_to_file(const char *filename, void* src, int width, int
        ret = __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(filename, src, width, height, fmt, quality);
 #else
        mm_util_debug("#START# LIBJPEG");
-       if (fmt == MM_UTIL_JPEG_FMT_NV12) {
+       if (fmt == MM_UTIL_COLOR_NV12) {
                unsigned int dst_size = 0;
-               ret = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, (unsigned int)width, (unsigned int)height, &dst_size);
+               ret = mm_util_get_image_size(MM_UTIL_COLOR_NV12, (unsigned int)width, (unsigned int)height, &dst_size);
                unsigned char *dst = NULL;
                dst = calloc(1, dst_size);
                if (dst) {
-                       ret = mm_util_convert_colorspace(src, width, height, MM_UTIL_IMG_FMT_NV12, dst, MM_UTIL_IMG_FMT_YUV420);
-                       ret = __mm_image_encode_to_jpeg_file_with_libjpeg(filename, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
+                       ret = mm_util_convert_colorspace(src, width, height, MM_UTIL_COLOR_NV12, dst, MM_UTIL_COLOR_YUV420);
+                       ret = __mm_image_encode_to_jpeg_file_with_libjpeg(filename, dst, width, height, MM_UTIL_COLOR_YUV420, quality);
                        MMUTIL_SAFE_FREE(dst);
                } else {
                        return MM_UTIL_ERROR_OUT_OF_MEMORY;
                }
-       } else if (fmt == MM_UTIL_JPEG_FMT_NV21) {
+       } else if (fmt == MM_UTIL_COLOR_NV21) {
                return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        } else {
                ret = __mm_image_encode_to_jpeg_file_with_libjpeg(filename, src, width, height, fmt, quality);
@@ -1298,7 +1299,7 @@ int mm_util_jpeg_encode_to_file(const char *filename, void* src, int width, int
        return ret;
 }
 
-int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int width, int height, mm_util_color_format_e fmt, int quality)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1314,7 +1315,7 @@ int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
+       if (IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE) {
                mm_util_error("#ERROR# fmt value [%d]", fmt);
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -1329,19 +1330,19 @@ int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int
        ret = __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(mem, size, src, width, height, fmt, quality);
 #else /* LIBJPEG_TURBO */
        mm_util_debug("#START# libjpeg");
-       if (fmt == MM_UTIL_JPEG_FMT_NV12) {
+       if (fmt == MM_UTIL_COLOR_NV12) {
                unsigned int dst_size = 0;
-               ret = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, (unsigned int)width, (unsigned int)height, &dst_size);
+               ret = mm_util_get_image_size(MM_UTIL_COLOR_NV12, (unsigned int)width, (unsigned int)height, &dst_size);
                unsigned char *dst = NULL;
                dst = calloc(1, dst_size);
                if (dst) {
-                       ret = mm_util_convert_colorspace(src, width, height, MM_UTIL_IMG_FMT_NV12, dst, MM_UTIL_IMG_FMT_YUV420);
-                       ret = __mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
+                       ret = mm_util_convert_colorspace(src, width, height, MM_UTIL_COLOR_NV12, dst, MM_UTIL_COLOR_YUV420);
+                       ret = __mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, dst, width, height, MM_UTIL_COLOR_YUV420, quality);
                        MMUTIL_SAFE_FREE(dst);
                } else {
                        return MM_UTIL_ERROR_OUT_OF_MEMORY;
                }
-       } else if (fmt == MM_UTIL_JPEG_FMT_NV21) {
+       } else if (fmt == MM_UTIL_COLOR_NV21) {
                return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        } else {
                ret = __mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, src, width, height, fmt, quality);
@@ -1352,7 +1353,7 @@ int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int
        return ret;
 }
 
-int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt)
+int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_color_format_e fmt)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1363,7 +1364,7 @@ int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *fi
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
+       if (IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE) {
                mm_util_error("#ERROR# fmt value [%d]", fmt);
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -1389,20 +1390,20 @@ int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *fi
                mm_util_debug("#START# LIBJPEG_TURBO");
                ret = __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
 #else
-               mm_util_debug("#START# libjpeg");
-               if (fmt == MM_UTIL_JPEG_FMT_NV12) {
+               mm_util_debug("#START# libjpeg(fmt:%d)", fmt);
+               if (fmt == MM_UTIL_COLOR_NV12) {
                        unsigned int dst_size = 0;
-                       ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, MM_UTIL_IMG_FMT_YUV420, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
+                       ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, MM_UTIL_COLOR_YUV420, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
                        if (ret == MM_UTIL_ERROR_NONE) {
                                int err = MM_UTIL_ERROR_NONE;
-                               err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                               err = mm_util_get_image_size(MM_UTIL_COLOR_NV12, decoded->width, decoded->height, &dst_size);
                                if (err != MM_UTIL_ERROR_NONE)
                                        mm_util_error("fail mm_util_get_image_size");
 
                                unsigned char *dst = NULL;
                                dst = calloc(1, dst_size);
                                if (dst) {
-                                       ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                                       ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, dst, MM_UTIL_COLOR_NV12);
                                        MMUTIL_SAFE_FREE(decoded->data);
                                        decoded->data = calloc(1, dst_size);
                                        if (decoded->data == NULL) {
@@ -1443,7 +1444,7 @@ int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *fi
        return ret;
 }
 
-int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_jpeg_yuv_format fmt)
+int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_color_format_e fmt)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1454,7 +1455,7 @@ int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, u
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
+       if (IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE) {
                mm_util_error("#ERROR# fmt value [%d]", fmt);
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -1464,20 +1465,20 @@ int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, u
        ret = __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
 #else
        mm_util_debug("#START# libjpeg");
-       if (fmt == MM_UTIL_JPEG_FMT_NV12) {
+       if (fmt == MM_UTIL_COLOR_NV12) {
                unsigned int dst_size = 0;
                unsigned char *dst = NULL;
 
-               ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, MM_UTIL_IMG_FMT_YUV420, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
+               ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, MM_UTIL_COLOR_YUV420, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
                if (ret == MM_UTIL_ERROR_NONE) {
                        int err = MM_UTIL_ERROR_NONE;
-                       err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                       err = mm_util_get_image_size(MM_UTIL_COLOR_NV12, decoded->width, decoded->height, &dst_size);
                        if (err != MM_UTIL_ERROR_NONE)
                                        mm_util_error("fail mm_util_get_image_size");
 
                        dst = calloc(1, dst_size);
                        if (dst) {
-                               ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                               ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, dst, MM_UTIL_COLOR_NV12);
                                MMUTIL_SAFE_FREE(decoded->data);
                                decoded->data = calloc(1, dst_size);
                                if (decoded->data == NULL) {
@@ -1503,7 +1504,7 @@ int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, u
        return ret;
 }
 
-int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1514,7 +1515,7 @@ int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded,
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
+       if (IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE) {
                mm_util_error("#ERROR# fmt value [%d]", fmt);
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -1546,19 +1547,19 @@ int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded,
                ret = __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
 #else
                mm_util_debug("#START# libjpeg");
-               if (fmt == MM_UTIL_JPEG_FMT_NV12) {
+               if (fmt == MM_UTIL_COLOR_NV12) {
                        unsigned int dst_size = 0;
-                       ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, MM_UTIL_IMG_FMT_YUV420, downscale);
+                       ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, MM_UTIL_COLOR_YUV420, downscale);
                        if (ret == MM_UTIL_ERROR_NONE) {
                                int err = MM_UTIL_ERROR_NONE;
-                               err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                               err = mm_util_get_image_size(MM_UTIL_COLOR_NV12, decoded->width, decoded->height, &dst_size);
                                if (err != MM_UTIL_ERROR_NONE)
                                        mm_util_error("fail mm_util_get_image_size");
 
                                unsigned char *dst = NULL;
                                dst = calloc(1, dst_size);
                                if (dst) {
-                                       ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                                       ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, dst, MM_UTIL_COLOR_NV12);
                                        MMUTIL_SAFE_FREE(decoded->data);
                                        decoded->data = calloc(1, dst_size);
                                        if (decoded->data == NULL) {
@@ -1599,7 +1600,7 @@ int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded,
        return ret;
 }
 
-int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1610,7 +1611,7 @@ int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decode
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
+       if (IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE) {
                mm_util_error("#ERROR# fmt value [%d]", fmt);
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -1626,20 +1627,20 @@ int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decode
        ret = __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
 #else
        mm_util_debug("#START# libjpeg");
-       if (fmt == MM_UTIL_JPEG_FMT_NV12) {
+       if (fmt == MM_UTIL_COLOR_NV12) {
                unsigned int dst_size = 0;
                unsigned char *dst = NULL;
 
-               ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, MM_UTIL_IMG_FMT_YUV420, downscale);
+               ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, MM_UTIL_COLOR_YUV420, downscale);
                if (ret == MM_UTIL_ERROR_NONE) {
                        int err = MM_UTIL_ERROR_NONE;
-                       err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                       err = mm_util_get_image_size(MM_UTIL_COLOR_NV12, decoded->width, decoded->height, &dst_size);
                        if (err != MM_UTIL_ERROR_NONE)
                                        mm_util_error("fail mm_util_get_image_size");
 
                        dst = calloc(1, dst_size);
                        if (dst) {
-                               ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                               ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, dst, MM_UTIL_COLOR_NV12);
                                MMUTIL_SAFE_FREE(decoded->data);
                                decoded->data = calloc(1, dst_size);
                                if (decoded->data == NULL) {
index 1504314..7a39197 100755 (executable)
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
        void *dst = NULL;
 
        mm_util_jpeg_yuv_data decoded_data = {0,};
-       mm_util_jpeg_yuv_format fmt; /* = MM_UTIL_JPEG_FMT_RGB888; */
+       mm_util_color_format_e fmt; /* = MM_UTIL_COLOR_RGB24; */
        mm_util_jpeg_decode_downscale downscale;
 
        if (argc < 2) {
@@ -217,14 +217,14 @@ int main(int argc, char *argv[])
                                fprintf(stderr, "\t##Decoded data##: %p\t width: %d\t height:%d\t size: %d\n", decoded_data.data, decoded_data.width, decoded_data.height, decoded_data.size);
                                char filename[BUFFER_SIZE] = {0, };
                                memset(filename, 0, BUFFER_SIZE);
-                               if (fmt == MM_UTIL_JPEG_FMT_RGB888 || fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+                               if (fmt == MM_UTIL_COLOR_RGB24 || fmt == MM_UTIL_COLOR_RGBA || fmt == MM_UTIL_COLOR_BGRA || fmt == MM_UTIL_COLOR_ARGB) {
                                        snprintf(filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "rgb");
-                               } else if ((fmt == MM_UTIL_JPEG_FMT_YUV420) ||
-                                       (fmt == MM_UTIL_JPEG_FMT_YUV422) ||
-                                       (fmt == MM_UTIL_JPEG_FMT_NV12) ||
-                                       (fmt == MM_UTIL_JPEG_FMT_NV21) ||
-                                       (fmt == MM_UTIL_JPEG_FMT_NV16) ||
-                                       (fmt == MM_UTIL_JPEG_FMT_NV61)) {
+                               } else if ((fmt == MM_UTIL_COLOR_YUV420) ||
+                                       (fmt == MM_UTIL_COLOR_YUV422) ||
+                                       (fmt == MM_UTIL_COLOR_NV12) ||
+                                       (fmt == MM_UTIL_COLOR_NV21) ||
+                                       (fmt == MM_UTIL_COLOR_NV16) ||
+                                       (fmt == MM_UTIL_COLOR_NV61)) {
                                        snprintf(filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "yuv");
                                }
                                _write_file(filename, decoded_data.data, decoded_data.size);
index 6e47c0b..8bb7ef0 100755 (executable)
@@ -31,17 +31,6 @@ extern "C" {
 typedef void *mm_util_image_h;
 
 /**
- * Image formats
- */
-typedef enum {
-       MM_UTIL_IMG_FMT_RGB888,         /**< RGB888 pixel format */
-       MM_UTIL_IMG_FMT_ARGB8888,      /**< ARGB8888 pixel format */
-       MM_UTIL_IMG_FMT_BGRA8888,      /**< BGRA8888 pixel format */
-       MM_UTIL_IMG_FMT_RGBA8888,      /**< RGBA8888 pixel format */
-       MM_UTIL_IMG_FMT_NUM,             /**< Number of image formats */
-} mm_util_magick_format;
-
-/**
  * Image rotation types
  */
 typedef enum {
@@ -69,23 +58,23 @@ typedef enum {
        IMG_CODEC_DRM                                   = (1 << 8),
 } mm_util_img_codec_type;
 
-int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer, unsigned int width, unsigned int height, size_t size, mm_util_magick_format format);
+int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer, unsigned int width, unsigned int height, size_t size, mm_util_color_format_e format);
 
 /*You must release buffer using free().*/
-int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned int *width, unsigned int *height, size_t *size, mm_util_magick_format *format);
+int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned int *width, unsigned int *height, size_t *size, mm_util_color_format_e *format);
 int mm_util_destroy_handle(mm_util_image_h handle);
 
 int mm_util_rotate_B_B(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, mm_util_image_h *dst_handle);
 int mm_util_rotate_B_P(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, const char *dst_path);
-int mm_util_rotate_P_B(const char *src_path, mm_util_magick_rotate_type angle, mm_util_magick_format req_format, mm_util_image_h *dst_handle);
+int mm_util_rotate_P_B(const char *src_path, mm_util_magick_rotate_type angle, mm_util_color_format_e req_format, mm_util_image_h *dst_handle);
 int mm_util_rotate_P_P(const char *src_path, mm_util_magick_rotate_type angle, const char *dst_path);
 
 int mm_util_resize_B_B(mm_util_image_h src_handle, unsigned int req_width, unsigned int req_height, mm_util_image_h *dst_handle);
 int mm_util_resize_B_P(mm_util_image_h src_handle, unsigned int req_width, unsigned int req_height, const char *dst_path);
-int mm_util_resize_P_B(const char *src_path, unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format, mm_util_image_h *dst_handle);
+int mm_util_resize_P_B(const char *src_path, unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format, mm_util_image_h *dst_handle);
 int mm_util_resize_P_P(const char *src_path, unsigned int req_width, unsigned int req_height, const char *dst_path);
 
-int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_magick_format req_format, mm_util_image_h *dst_handle);
+int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_color_format_e req_format, mm_util_image_h *dst_handle);
 
 int mm_util_extract_image_info(const char *path, mm_util_img_codec_type *type, unsigned int *width, unsigned int *height);
 
index 96d2ea9..3009c0e 100755 (executable)
@@ -29,7 +29,7 @@ typedef struct _util_image_s {
        unsigned int width;
        unsigned int height;
        size_t size;
-       mm_util_magick_format format;
+       mm_util_color_format_e format;
 } util_image_s;
 
 static bool __mm_util_check_angle(mm_util_magick_rotate_type angle);
@@ -104,21 +104,21 @@ static void __mm_util_finalize(Image *image_1, Image *image_2, ImageInfo *imageI
        return;
 }
 
-static int __mm_util_get_map(mm_util_magick_format format, char **map)
+static int __mm_util_get_map(mm_util_color_format_e format, char **map)
 {
        mm_util_retvm_if(map == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid map");
 
        switch (format) {
-       case MM_UTIL_IMG_FMT_RGB888:
+       case MM_UTIL_COLOR_RGB24:
                *map = g_strdup("RGB");
                break;
-       case MM_UTIL_IMG_FMT_ARGB8888:
+       case MM_UTIL_COLOR_ARGB:
                *map = g_strdup("ARGB");
                break;
-       case MM_UTIL_IMG_FMT_BGRA8888:
+       case MM_UTIL_COLOR_BGRA:
                *map = g_strdup("BGRA");
                break;
-       case MM_UTIL_IMG_FMT_RGBA8888:
+       case MM_UTIL_COLOR_RGBA:
                *map = g_strdup("RGBA");
                break;
        default:
@@ -359,7 +359,7 @@ static bool __mm_util_check_angle(mm_util_magick_rotate_type angle)
                return FALSE;
 }
 
-int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer, unsigned int width, unsigned int height, size_t size, mm_util_magick_format format)
+int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer, unsigned int width, unsigned int height, size_t size, mm_util_color_format_e format)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -379,7 +379,7 @@ int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer,
        return ret;
 }
 
-int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned int *width, unsigned int *height, size_t *size, mm_util_magick_format *format)
+int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned int *width, unsigned int *height, size_t *size, mm_util_color_format_e *format)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -521,7 +521,7 @@ ERROR:
        return ret;
 }
 
-int mm_util_rotate_P_B(const char *src_path, mm_util_magick_rotate_type angle, mm_util_magick_format req_format, mm_util_image_h *dst_handle)
+int mm_util_rotate_P_B(const char *src_path, mm_util_magick_rotate_type angle, mm_util_color_format_e req_format, mm_util_image_h *dst_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
        char *map = NULL;
@@ -744,7 +744,7 @@ ERROR:
        return ret;
 }
 
-int mm_util_resize_P_B(const char *src_path, unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format, mm_util_image_h *dst_handle)
+int mm_util_resize_P_B(const char *src_path, unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format, mm_util_image_h *dst_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
        char *map = NULL;
@@ -857,7 +857,7 @@ ERROR:
        return ret;
 }
 
-int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_magick_format req_format, mm_util_image_h *dst_handle)
+int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_color_format_e req_format, mm_util_image_h *dst_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
        util_image_s *_src_handle = (util_image_s*)src_handle;
index 0171f08..21c7145 100755 (executable)
@@ -32,14 +32,14 @@ typedef enum {
 #define MM_UTIL_SAFE_FREE(src) { if (src) { free(src); src = NULL; } }
 
 static int _magick_rotate_P_P_test(mm_util_magick_rotate_type angle);
-static int _magick_rotate_P_B_test(mm_util_magick_rotate_type angle, mm_util_magick_format req_format);
-static int _magick_rotate_B_P_test(mm_util_magick_rotate_type angle, mm_util_magick_format req_format);
-static int _magick_rotate_B_B_test(mm_util_magick_rotate_type angle, mm_util_magick_format req_format);
+static int _magick_rotate_P_B_test(mm_util_magick_rotate_type angle, mm_util_color_format_e req_format);
+static int _magick_rotate_B_P_test(mm_util_magick_rotate_type angle, mm_util_color_format_e req_format);
+static int _magick_rotate_B_B_test(mm_util_magick_rotate_type angle, mm_util_color_format_e req_format);
 static int _magick_resize_P_P_test(unsigned int req_width, unsigned int req_height);
-static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format);
-static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format);
-static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format);
-static int _magick_convert_B_B_test(mm_util_magick_format in_format, mm_util_magick_format out_format);
+static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
+static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
+static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
+static int _magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_color_format_e out_format);
 
 static char *__get_dst_path(mm_util_magick_rotate_type angle)
 {
@@ -107,7 +107,7 @@ static void __save_to_file(mm_util_image_h handle, const char *out_path)
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
-       mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+       mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
 
        ret = mm_util_get_image(handle, &buffer, &width, &height, &size, &format);
        if (ret != MM_UTIL_ERROR_NONE) {
@@ -124,7 +124,7 @@ static void __save_to_file(mm_util_image_h handle, const char *out_path)
        return;
 }
 
-static int __get_buffer_for_test(mm_util_magick_format req_format, unsigned char **buffer,  unsigned int *width, unsigned int *height, size_t *size, mm_util_magick_format *format)
+static int __get_buffer_for_test(mm_util_color_format_e req_format, unsigned char **buffer,  unsigned int *width, unsigned int *height, size_t *size, mm_util_color_format_e *format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h dst_handle = NULL;
@@ -187,7 +187,7 @@ static int _magick_resize_P_P_test(unsigned int req_width, unsigned int req_heig
        return ret;
 }
 
-static int _magick_rotate_P_B_test(mm_util_magick_rotate_type angle, mm_util_magick_format req_format)
+static int _magick_rotate_P_B_test(mm_util_magick_rotate_type angle, mm_util_color_format_e req_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h dst_handle = NULL;
@@ -212,7 +212,7 @@ static int _magick_rotate_P_B_test(mm_util_magick_rotate_type angle, mm_util_mag
        return ret;
 }
 
-static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format)
+static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h dst_handle = NULL;
@@ -240,7 +240,7 @@ static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_heig
        return ret;
 }
 
-static int _magick_rotate_B_P_test(mm_util_magick_rotate_type angle, mm_util_magick_format req_format)
+static int _magick_rotate_B_P_test(mm_util_magick_rotate_type angle, mm_util_color_format_e req_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h src_handle = NULL;
@@ -248,7 +248,7 @@ static int _magick_rotate_B_P_test(mm_util_magick_rotate_type angle, mm_util_mag
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
-       mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+       mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
 
        printf("* Rotate B P Test * angle = [%d] \n", angle);
 
@@ -278,7 +278,7 @@ static int _magick_rotate_B_P_test(mm_util_magick_rotate_type angle, mm_util_mag
        return ret;
 }
 
-static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format)
+static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h src_handle = NULL;
@@ -286,7 +286,7 @@ static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_heig
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
-       mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+       mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
        char dst_path[1024] = {0, };
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_bp_%d_%d.jpg", req_width, req_height);
@@ -319,7 +319,7 @@ static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_heig
        return ret;
 }
 
-static int _magick_rotate_B_B_test(mm_util_magick_rotate_type angle, mm_util_magick_format req_format)
+static int _magick_rotate_B_B_test(mm_util_magick_rotate_type angle, mm_util_color_format_e req_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h src_handle = NULL;
@@ -328,7 +328,7 @@ static int _magick_rotate_B_B_test(mm_util_magick_rotate_type angle, mm_util_mag
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
-       mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+       mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
 
        printf("* Rotate B B Test * angle = [%d] \n", angle);
 
@@ -364,7 +364,7 @@ static int _magick_rotate_B_B_test(mm_util_magick_rotate_type angle, mm_util_mag
        return ret;
 }
 
-static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format)
+static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h src_handle = NULL;
@@ -373,7 +373,7 @@ static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_heig
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
-       mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+       mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
        char dst_path[1024] = {0, };
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_bb_%d_%d.raw", req_width, req_height);
@@ -412,7 +412,7 @@ static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_heig
        return ret;
 }
 
-static int _magick_convert_B_B_test(mm_util_magick_format in_format, mm_util_magick_format out_format)
+static int _magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_color_format_e out_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_image_h src_handle = NULL;
@@ -421,7 +421,7 @@ static int _magick_convert_B_B_test(mm_util_magick_format in_format, mm_util_mag
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
-       mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+       mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
        char dst_path[1024] = {0, };
        memset(dst_path, 0x00, sizeof(dst_path));
 
@@ -477,29 +477,29 @@ int main(int argc, char *argv[])
                ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_FLIP_VERT);
 
        } else if (strcmp(argv[1], "2") == 0) {
-               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_0, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_90, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_180, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_270, MM_UTIL_IMG_FMT_BGRA8888);
-               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_IMG_FMT_RGBA8888);
+               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
+               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
+               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
+               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
+               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
+               ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
 
        } else if (strcmp(argv[1], "3") == 0) {
-               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_0, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_90, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_180, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_270, MM_UTIL_IMG_FMT_BGRA8888);
-               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_IMG_FMT_RGBA8888);
+               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
+               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
+               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
+               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
+               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
+               ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
 
        } else if (strcmp(argv[1], "4") == 0) {
-               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_0, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_90, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_180, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_270, MM_UTIL_IMG_FMT_BGRA8888);
-               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_rotate_B_B_test(100, MM_UTIL_IMG_FMT_RGBA8888);   //invalid parameter
+               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
+               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
+               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
+               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
+               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
+               ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
+               ret = _magick_rotate_B_B_test(100, MM_UTIL_COLOR_RGBA); //invalid parameter
 
        } else if (strcmp(argv[1], "5") == 0) {
                ret = _magick_resize_P_P_test(3000, 2000);
@@ -509,32 +509,32 @@ int main(int argc, char *argv[])
                ret = _magick_resize_P_P_test(0, 2000); //invalid parameter
 
        } else if (strcmp(argv[1], "6") == 0) {
-               ret = _magick_resize_P_B_test(3000, 2000, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_resize_P_B_test(199, 299, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_resize_P_B_test(3, 2, MM_UTIL_IMG_FMT_BGRA8888);
-               ret = _magick_resize_P_B_test(1000, 999, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_resize_P_B_test(10000, 999, MM_UTIL_IMG_FMT_RGBA8888);
+               ret = _magick_resize_P_B_test(3000, 2000, MM_UTIL_COLOR_RGB24);
+               ret = _magick_resize_P_B_test(199, 299, MM_UTIL_COLOR_ARGB);
+               ret = _magick_resize_P_B_test(3, 2, MM_UTIL_COLOR_BGRA);
+               ret = _magick_resize_P_B_test(1000, 999, MM_UTIL_COLOR_RGBA);
+               ret = _magick_resize_P_B_test(10000, 999, MM_UTIL_COLOR_RGBA);
 
        } else if (strcmp(argv[1], "7") == 0) {
-               ret = _magick_resize_B_P_test(3000, 2000, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_resize_B_P_test(199, 299, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_resize_B_P_test(3, 2, MM_UTIL_IMG_FMT_BGRA8888);
-               ret = _magick_resize_B_P_test(1000, 999, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_resize_B_P_test(10000, 999, MM_UTIL_IMG_FMT_RGBA8888);
+               ret = _magick_resize_B_P_test(3000, 2000, MM_UTIL_COLOR_RGB24);
+               ret = _magick_resize_B_P_test(199, 299, MM_UTIL_COLOR_ARGB);
+               ret = _magick_resize_B_P_test(3, 2, MM_UTIL_COLOR_BGRA);
+               ret = _magick_resize_B_P_test(1000, 999, MM_UTIL_COLOR_RGBA);
+               ret = _magick_resize_B_P_test(10000, 999, MM_UTIL_COLOR_RGBA);
 
        } else if (strcmp(argv[1], "8") == 0) {
-               ret = _magick_resize_B_B_test(3000, 2000, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_resize_B_B_test(199, 299, MM_UTIL_IMG_FMT_ARGB8888);
-               ret = _magick_resize_B_B_test(3, 2, MM_UTIL_IMG_FMT_BGRA8888);
-               ret = _magick_resize_B_B_test(1000, 999, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_resize_B_B_test(10000, 999, MM_UTIL_IMG_FMT_RGBA8888);
+               ret = _magick_resize_B_B_test(3000, 2000, MM_UTIL_COLOR_RGB24);
+               ret = _magick_resize_B_B_test(199, 299, MM_UTIL_COLOR_ARGB);
+               ret = _magick_resize_B_B_test(3, 2, MM_UTIL_COLOR_BGRA);
+               ret = _magick_resize_B_B_test(1000, 999, MM_UTIL_COLOR_RGBA);
+               ret = _magick_resize_B_B_test(10000, 999, MM_UTIL_COLOR_RGBA);
 
        } else if (strcmp(argv[1], "9") == 0) {
-               ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_RGB888, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_ARGB8888, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_BGRA8888, MM_UTIL_IMG_FMT_RGBA8888);
-               ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_RGBA8888, MM_UTIL_IMG_FMT_RGB888);
-               ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_BGRA8888, MM_UTIL_IMG_FMT_RGB888);
+               ret = _magick_convert_B_B_test(MM_UTIL_COLOR_RGB24, MM_UTIL_COLOR_RGBA);
+               ret = _magick_convert_B_B_test(MM_UTIL_COLOR_ARGB, MM_UTIL_COLOR_RGBA);
+               ret = _magick_convert_B_B_test(MM_UTIL_COLOR_BGRA, MM_UTIL_COLOR_RGBA);
+               ret = _magick_convert_B_B_test(MM_UTIL_COLOR_RGBA, MM_UTIL_COLOR_RGB24);
+               ret = _magick_convert_B_B_test(MM_UTIL_COLOR_BGRA, MM_UTIL_COLOR_RGB24);
 
        } else {
                printf("Invalid parameter\n");
index 7d647d1..3878f0d 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.1.10
+Version:    0.1.11
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
@@ -45,13 +45,6 @@ export CFLAGS="$CFLAGS -DGMAGICK_DEBUG=0"
 %cmake .
 make %{?jobs:-j%jobs}
 
-sed -i -e "s#@IMGP_REQPKG@#$IMGP_REQPKG#g" imgp/mmutil-imgp.pc
-sed -i -e "s#@JPEG_REQPKG@#$JPEG_REQPKG#g" jpeg/mmutil-jpeg.pc
-sed -i -e "s#@IMGCV_REQPKG@#$IMGCV_REQPKG#g" imgcv/mmutil-imgcv.pc
-sed -i -e "s#@PNG_REQPKG@#$PNG_REQPKG#g" png/mmutil-png.pc
-sed -i -e "s#@GIF_REQPKG@#$GIF_REQPKG#g" gif/mmutil-gif.pc
-sed -i -e "s#@BMP_REQPKG@#$BMP_REQPKG#g" bmp/mmutil-bmp.pc
-
 %install
 rm -rf %{buildroot}
 %make_install
index ea6ade2..e00e0bf 100755 (executable)
@@ -37,12 +37,6 @@ extern "C" {
     This part describes the APIs with repect to multimedia image library.
 */
 
-/* These describe the color_type field in png_info. */
-/* color types.  Note that not all combinations are legal */
-typedef enum {
-       MM_UTIL_PNG_COLOR_TYPE_RGB_ALPHA,
-} mm_util_png_color_type;
-
 typedef enum {
        MM_UTIL_COMPRESSION_0 = 0,      /* No compression */
        MM_UTIL_COMPRESSION_1 = 1,      /* Best speed */
index e6bc7e5..3a0b57a 100755 (executable)
@@ -396,7 +396,7 @@ int write_png(void **data, mm_util_png_data *encoded, FILE *fp)
        png_set_compression_level(png_ptr, encoded->png.compression_level);
 
        /* convert color type */
-       if (encoded->png.color_type == MM_UTIL_PNG_COLOR_TYPE_RGB_ALPHA)
+       if (encoded->png.color_type == MM_UTIL_COLOR_RGBA)
                encoded->png.color_type = PNG_COLOR_TYPE_RGB_ALPHA;
 
        png_set_IHDR(png_ptr, info_ptr, encoded->width, encoded->height, encoded->png.bit_depth, encoded->png.color_type, encoded->png.interlace_type, PNG_COMPRESSION_TYPE_BASE, encoded->png.filter_type);