Remove duplicated code and paramters in image-util and libmm-utility 67/190767/1
authorhj kim <backto.kim@samsung.com>
Fri, 5 Oct 2018 07:32:12 +0000 (16:32 +0900)
committerhj kim <backto.kim@samsung.com>
Fri, 5 Oct 2018 07:32:30 +0000 (16:32 +0900)
Change-Id: I3552bf2a90ec79092010676548782772129caead

imgp/CMakeLists.txt
imgp/include/mm_util_imgp.h
imgp/include/mm_util_imgp_internal.h
imgp/mm_util_imgp.c

index 1742287..05578da 100755 (executable)
@@ -68,4 +68,4 @@ CONFIGURE_FILE(
 )
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
-ADD_SUBDIRECTORY(test)
+#ADD_SUBDIRECTORY(test)
index 8d5ea75..d17d474 100755 (executable)
@@ -28,22 +28,14 @@ extern "C" {
 
 #include <stdbool.h>
 #include <stdlib.h>
+#include <glib.h>
+
 #include "mm_util_type.h"
 
 typedef void *mm_util_imgp_h;
 
 typedef bool (*mm_util_completed_callback)(mm_util_color_image_h image, int error, void *user_param);
-/**
-    @addtogroup UTILITY
-    @{
-
-    @par
-    This part describes the APIs with repect to image converting library.
- */
 
-/**
- * Image rotation types
- */
 typedef enum {
        MM_UTIL_ROTATE_0,               /**< Rotation 0 degree - no effect */
        MM_UTIL_ROTATE_90,              /**< Rotation 90 degree */
@@ -54,202 +46,51 @@ typedef enum {
        MM_UTIL_ROTATE_NUM              /**< Number of rotation types */
 } mm_util_img_rotate_type;
 
-/**
- * This function calculates the size of the image data in bytes.
- *
- * @param      format [in]     image format information
- * @param      width  [in]     pixel size of width
- * @param      height [in]     pixel size of height
- * @param      size   [out]    data size of image in bytes
- *
- * @return      This function returns zero on success, or negative value with error code.
- * @remark
- * @see         mm_util_color_format_e
- * @since       R1, 1.0
- */
-int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, size_t *imgsize);
-
-/**
- *
- * @remark     Transform Handle Creation
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @return     This function returns transform processor result value
- *             if the result is 0, then handle creation succeed
- *             else if the result is -1, then handle creation failed
- */
-int mm_util_create(mm_util_imgp_h *imgp_handle);
-
-/**
- *
- * @remark     Transform Handle Creation
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @param      colorspace      [in]                    colorspace The colorspace of the destination image buffer
-
- * @return     This function returns transform processor result value
- *             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_color_format_e colorspace);
-
-/**
- *
- * @remark     Transform Handle Creation
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @param      width           [in]                    width The width of destination image buffer
- * @param      height          [in]                    height The height of destination image buffer
-
- * @return     This function returns transform processor result value
- *             if the result is 0, then handle creation succeed
- *             else if the result is -1, then handle creation failed
- */
-int mm_util_set_resolution(mm_util_imgp_h imgp_handle, unsigned int width, unsigned int height);
-
-/**
- *
- * @remark     Transform Handle Creation
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @param      rotation                [in]                    dest_rotation The rotation value of destination image buffer
-
- * @return     This function returns transform processor result value
- *             if the result is 0, then handle creation succeed
- *             else if the result is -1, then handle creation failed
- */
-int mm_util_set_rotation(mm_util_imgp_h imgp_handle, mm_util_img_rotate_type rotation);
-
-/**
- *
- * @remark     Transform Handle Creation
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @param      start_x                 [in]                    The start x position of cropped image buffer
- * @param      start_y                 [in]                    The start y position of cropped image buffer
- * @param      end_x                   [in]                    The start x position of cropped image buffer
- * @param      end_y                   [in]                    The start y position of cropped image buffer
-
- * @return     This function returns transform processor result value
- *             if the result is 0, then handle creation succeed
- *             else if the result is -1, then handle creation failed
- */
-int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y);
-
-/**
- *
- * @remark     Transform Handle Creation
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @param      is_completed            [in/out]                Users can obtain the value of the conversion about whether to complete
+typedef struct {
+       void *user_data;
+       mm_util_completed_callback completed_cb;
+} mm_util_cb_s;
+
+typedef struct {
+       mm_image_info_s *src;
+       mm_image_info_s *dst;
+
+       /* for converting colorspace */
+       mm_util_color_format_e dst_format;
+       /* for image crop */
+       /* for resize */
+       unsigned int start_x;
+       unsigned int start_y;
+       unsigned int dst_width;
+       unsigned int dst_height;
+
+       /* for rotation */
+       mm_util_img_rotate_type rotation;
+
+       bool set_convert;
+       bool set_crop;
+       bool set_resize;
+       bool set_rotate;
+
+       /* for multi instance */
+       mm_util_cb_s *_util_cb;
+       bool is_completed;
+       bool is_finish;
+       GThread* thread;
+       GAsyncQueue *queue;
+} mm_util_s;
 
- * @return     This function returns transform processor result value
- *             if the result is 0, then handle creation succeed
- *             else if the result is -1, then handle creation failed
- */
-int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_completed);
-
-/**
- *
- * @remark     Image Transform Pipeline
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @param      completed_callback                                      [in]                    Completed_callback
- * @param      user_param                                              [in]                    User parameter which is received from user when callback function was set
-
- * @return     This function returns transform processor result value
- *             if the result is 0, then you can use output_Filename pointer(char** value)
- *             else if the result is -1, then do not execute when the colopsapce converter is not supported
- */
+int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, size_t *imgsize);
+//int mm_util_create(mm_util_imgp_h *imgp_handle);
+//int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_color_format_e colorspace);
+//int mm_util_set_resolution(mm_util_imgp_h imgp_handle, unsigned int width, unsigned int height);
+//int mm_util_set_rotation(mm_util_imgp_h imgp_handle, mm_util_img_rotate_type rotation);
+//int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y);
 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);
-
-/**
- *
- * @remark     Transform Handle Destory
- *
- * @param      imgp_handle             [in]                    image_util_imgp_h
- * @return     This function returns transform processor result value
- *             if the result is 0, then handle destory succeed
- *             else if the result is -1, then handle destory failed
- */
-int mm_util_destroy(mm_util_imgp_h imgp_handle);
-
-/**
- * This function convert the pixel format from source format to destination format.
- *
- * @param      src         [in]        pointer of source image data
- * @param      src_width   [in]        pixel size of source image width
- * @param      src_height  [in]        pixel size of source image height
- * @param      src_format  [in]        pixel format of source image
- * @param      dst         [in/out]    pointer of destination image data
- * @param      dst_format  [in]        pixel format of destination image
- *
- * @return      This function returns zero on success, or negative value with error code.
- * @remark
- * @see         mm_util_color_format_e
- * @since       R1, 1.0
- */
+//int mm_util_destroy(mm_util_imgp_h imgp_handle);
 int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, mm_util_color_format_e dst_format, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-
-
-/**
- * This function resizes the source image.
- *
- * @param      src         [in]        pointer of source image data
- * @param      src_width   [in]        pixel size of source image width
- * @param      src_height  [in]        pixel size of source image height
- * @param      src_format  [in]        pixel format of source image
- * @param      dst         [in/out]    pointer of destination image data
- * @param      dst_width   [in/out]    pixel size of destination image width
- * @param      dst_height  [in/out]    pixel size of destination image height
- *
- * @return      This function returns zero on success, or negative value with error code.
- * @remark
- * @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_color_format_e src_format, unsigned int dst_width, unsigned int dst_height, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-
-
-/**
- * This function rotates the source image.
- *
- * @param      src         [in]        pointer of source image data
- * @param      src_width   [in]        pixel size of source image width
- * @param      src_height  [in]        pixel size of source image height
- * @param      src_format  [in]        pixel format of source image
- * @param      dst         [in/out]    pointer of destination image data
- * @param      dst_width   [in/out]    pixel size of destination image width
- * @param      dst_height  [in/out]    pixel size of destination image height
- * @param      angle       [in]        rotation enum value
- *
- * @return      This function returns zero on success, or negative value with error code.
- * @remark
- * @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_color_format_e src_format, mm_util_img_rotate_type angle, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-
-
-/**
- * This function crop the source image.
- *
- * @param      src         [in]                pointer of source image data
- * @param      src_width   [in]             pixel size of source image width
- * @param      src_height  [in]             pixel size of source image height
- * @param      src_format  [in]            pixel format of source image
- * @param      crop_start_x   [in]         pixel point of cropped image
- * @param      crop_start_y  [in]          pixel point of cropped image
- * @param      crop_dest_width   [in/out]   cropped image width (value is changed when yuv image width is odd)
- * @param      crop_dest_height  [in/out]   cropped image height
-
- * @param      dst         [in/out]    pointer of destination image data
- *
- * @return      This function returns zero on success, or negative value with error code.
- * @remark
- * @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_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, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
index 80687b4..a167f6e 100755 (executable)
@@ -69,49 +69,6 @@ typedef enum {
        IMGP_GSTCS,
 } imgp_plugin_type_e;
 
-typedef enum {
-       MM_UTIL_ROTATION_NONE = 0,  /**< None */
-       MM_UTIL_ROTATION_90 = 1,    /**< Rotation 90 degree */
-       MM_UTIL_ROTATION_180,       /**< Rotation 180 degree */
-       MM_UTIL_ROTATION_270,       /**< Rotation 270 degree */
-       MM_UTIL_ROTATION_FLIP_HORZ, /**< Flip horizontal */
-       MM_UTIL_ROTATION_FLIP_VERT, /**< Flip vertical */
-} mm_util_rotation_e;
-
-typedef struct {
-       void *user_data;
-       mm_util_completed_callback completed_cb;
-} mm_util_cb_s;
-
-typedef struct {
-       mm_image_info_s *src;
-       mm_image_info_s *dst;
-
-       /* for converting colorspace */
-       mm_util_color_format_e dst_format;
-       /* for image crop */
-       /* for resize */
-       unsigned int start_x;
-       unsigned int start_y;
-       unsigned int dst_width;
-       unsigned int dst_height;
-
-       /* for rotation */
-       mm_util_rotation_e rotation;
-
-       bool set_convert;
-       bool set_crop;
-       bool set_resize;
-       bool set_rotate;
-
-       /* for multi instance */
-       mm_util_cb_s *_util_cb;
-       bool is_completed;
-       bool is_finish;
-       GThread* thread;
-       GAsyncQueue *queue;
-} mm_util_s;
-
 #ifdef __cplusplus
 }
 #endif
index 524567b..aff5403 100755 (executable)
@@ -426,6 +426,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
+#if 0
 static int __mm_util_handle_init(mm_util_s *handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -435,7 +436,7 @@ static int __mm_util_handle_init(mm_util_s *handle)
        /* private values init */
        handle->dst = NULL;
        handle->dst_format = MM_UTIL_COLOR_NUM;
-       handle->rotation = MM_UTIL_ROTATION_NONE;
+       handle->rotation = MM_UTIL_ROTATE_0;
 
        handle->start_x = -1;
        handle->start_y = -1;
@@ -460,6 +461,7 @@ static int __mm_util_handle_init(mm_util_s *handle)
 
        return ret;
 }
+#endif
 
 gpointer _mm_util_thread_repeate(gpointer data)
 {
@@ -644,6 +646,7 @@ static int __mm_util_transform_exec(mm_util_s *handle, mm_image_info_s *source_i
        return ret;
 }
 
+#if 0
 static int
 _mm_util_handle_finalize(mm_util_s *handle)
 {
@@ -750,6 +753,7 @@ int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsi
 
        return ret;
 }
+#endif
 
 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)
 {
@@ -790,21 +794,7 @@ int mm_util_transform(mm_util_imgp_h imgp_handle, mm_util_color_image_h image, m
        return ret;
 }
 
-int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_completed)
-{
-       int ret = MM_UTIL_ERROR_NONE;
-
-       mm_util_s *handle = (mm_util_s *) imgp_handle;
-
-       mm_util_retvm_if(handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
-       mm_util_retvm_if(!is_completed, MM_UTIL_ERROR_INVALID_PARAMETER, "[ERROR] - is_completed");
-
-       *is_completed = handle->is_completed;
-       mm_util_debug("[Transform....] %d", *is_completed);
-
-       return ret;
-}
-
+#if 0
 int mm_util_destroy(mm_util_imgp_h imgp_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -822,7 +812,7 @@ int mm_util_destroy(mm_util_imgp_h imgp_handle)
 
        return ret;
 }
-
+#endif
 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;