Unify image info structures because All of them have same format 10/190610/1
authorhj kim <backto.kim@samsung.com>
Thu, 4 Oct 2018 06:18:29 +0000 (15:18 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 4 Oct 2018 06:18:56 +0000 (15:18 +0900)
Change-Id: I6b9bcbd3dd054f49783d8b242a399965fe3ede65

16 files changed:
bmp/include/mm_util_bmp.h
bmp/mm_util_bmp.c
bmp/test/mm_util_bmp_testsuite.c
common/include/mm_util_private.h
common/include/mm_util_type.h
common/mm_util_color_image.c
imgcv/test/mm_util_imgcv_testsuite.c
imgp/include/mm_util_imgp_internal.h
imgp/mm_util_imgp.c
jpeg/include/mm_util_jpeg.h
jpeg/mm_util_jpeg.c
jpeg/test/mm_util_jpeg_testsuite.c
magick/mm_util_magick.c
png/include/mm_util_png.h
png/mm_util_png.c
png/test/mm_util_png_testsuite.c

index 506a8d5..398a462 100755 (executable)
@@ -27,74 +27,10 @@ extern "C" {
 #endif
 #include "mm_util_type.h"
 
-/**
-    @addtogroup UTILITY
-    @{
-
-    @par
-    This part describes the APIs with repect to multimedia image library.
-*/
-
-typedef struct {
-       unsigned long width;            /**< width */
-       unsigned long height;           /**< height */
-       size_t size;    /**< size */
-       void *data;                     /**< data */
-} mm_util_bmp_data;
-
-/**
- * This function decodes bmp image(file) to color image(raw data)
- *
- * @param filename [in]     the input file, encoded bmp image
- * @param decoded  [out]    the pointer of mm_util_bmp_data.
- *                          After using it, please free the allocated memory.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_bmp_data
- * @since                   R1, 1.0
- */
-int mm_util_decode_from_bmp_file(const char *filename, mm_util_bmp_data * decoded);
-
-/**
- * This function decodes bmp image(memory) to color image(raw data)
- *
- * @param memory   [in]     the input memory, encoded bmp image
- * @param src_size [in]     the size of input memory
- * @param decoded  [out]    the pointer of mm_util_bmp_data.
- *                          After using it, please free the allocated memory.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_bmp_data
- * @since                   R1, 1.0
- */
-int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_bmp_data * decoded);
-
-/**
- * This function encodes color image(raw data) to bmp file
- *
- * @param decoded  [in]     the pointer of mm_util_bmp_data.
- *                          After using it, please free the allocated memory.
- * @param filename [out]    the output file name on to which the encoded bmp stream will be written.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_bmp_data
- * @since                   R1, 1.0
- */
-int mm_util_encode_bmp_to_file(mm_util_bmp_data * decoded, const char *filename);
-
-/**
- * This function encodes color image(raw data) to buffer
- *
- * @param decoded [in]     the pointer of mm_util_bmp_data.
- *                         After using it, please free the allocated memory.
- * @param buffer  [out]    the output memory on to which the encoded bmp stream will be written.
- * @param size    [out]    The size of output buffer on to which the encoded stream will be written.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_bmp_data
- * @since                   R1, 1.0
- */
-int mm_util_encode_bmp_to_memory(mm_util_bmp_data *decoded, void **buffer, size_t *size);
+int mm_util_decode_from_bmp_file(const char *filename, mm_image_info_s * decoded);
+int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_image_info_s * decoded);
+int mm_util_encode_bmp_to_file(mm_image_info_s * decoded, const char *filename);
+int mm_util_encode_bmp_to_memory(mm_image_info_s *decoded, void **buffer, size_t *size);
 
 #ifdef __cplusplus
 }
index 28a8ba7..a6b84a3 100755 (executable)
@@ -116,7 +116,7 @@ static void __print_error(const char *context, bmp_result code)
 }
 
 /* decodes bmp image to color image */
-static int _read_bmp(const char *filename, void *memory, size_t src_size, mm_util_bmp_data *decoded)
+static int _read_bmp(const char *filename, void *memory, size_t src_size, mm_image_info_s *decoded)
 {
        bmp_bitmap_callback_vt bitmap_callbacks = {
                __bitmap_create,
@@ -184,7 +184,7 @@ static int _read_bmp(const char *filename, void *memory, size_t src_size, mm_uti
 }
 
 /* encodes color image to bmp image */
-static int _write_bmp(mm_util_bmp_data *decoded, const char *filename, void **memory, size_t *src_size)
+static int _write_bmp(mm_image_info_s *decoded, const char *filename, void **memory, size_t *src_size)
 {
        bmpfile_t *bmp;
        rgb_pixel_t pixel = { 0, 0, 0, 0 };
@@ -233,7 +233,7 @@ static int _write_bmp(mm_util_bmp_data *decoded, const char *filename, void **me
        return MM_UTIL_ERROR_NONE;
 }
 
-int mm_util_decode_from_bmp_file(const char *filename, mm_util_bmp_data *decoded)
+int mm_util_decode_from_bmp_file(const char *filename, mm_image_info_s *decoded)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -251,7 +251,7 @@ int mm_util_decode_from_bmp_file(const char *filename, mm_util_bmp_data *decoded
        return ret;
 }
 
-int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_bmp_data *decoded)
+int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_image_info_s *decoded)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -269,7 +269,7 @@ int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_
        return ret;
 }
 
-int mm_util_encode_bmp_to_file(mm_util_bmp_data *decoded, const char *filename)
+int mm_util_encode_bmp_to_file(mm_image_info_s *decoded, const char *filename)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -287,7 +287,7 @@ int mm_util_encode_bmp_to_file(mm_util_bmp_data *decoded, const char *filename)
        return ret;
 }
 
-int mm_util_encode_bmp_to_memory(mm_util_bmp_data *decoded, void **buffer, size_t *size)
+int mm_util_encode_bmp_to_memory(mm_image_info_s *decoded, void **buffer, size_t *size)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
index da8a6e3..5a6ba41 100755 (executable)
@@ -62,7 +62,7 @@ static char *g_path = NULL;
 static void *g_readed_data = NULL;
 static size_t g_readed_size = 0;
 
-static mm_util_bmp_data g_decoded_data = {0,};
+static mm_image_info_s g_decoded_data = {0,};
 
 static gboolean _read_file(char *path, void **data, size_t *length)
 {
index ea4f20c..1e530fd 100755 (executable)
@@ -49,14 +49,6 @@ extern "C" {
 #define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
 #define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
 
-typedef struct {
-       unsigned long width;
-       unsigned long height;
-       mm_util_color_format_e color;
-       void *data;
-       size_t size;
-} color_image_data_s;
-
 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
 void mm_util_safe_fclose(FILE *fp);
 
index 446303f..67e7a76 100755 (executable)
@@ -74,6 +74,14 @@ typedef enum {
 
 typedef void *mm_util_color_image_h;
 
+typedef struct {
+       unsigned long width;
+       unsigned long height;
+       mm_util_color_format_e color;
+       void *data;
+       size_t size;
+} mm_image_info_s;
+
 #ifdef __cplusplus
 }
 #endif
index f350314..7a1afcc 100755 (executable)
@@ -33,11 +33,11 @@ gboolean mm_util_is_valid_color_format(mm_util_color_format_e color)
 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_image_info_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));
+       _color_image = (mm_image_info_s *)calloc(1, sizeof(mm_image_info_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;
@@ -48,11 +48,11 @@ int mm_util_create_empty_color_image(mm_util_color_image_h *image)
 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_image_info_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));
+       _color_image = (mm_image_info_s *)calloc(1, sizeof(mm_image_info_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);
@@ -71,7 +71,7 @@ int mm_util_create_color_image(mm_util_color_image_h *image, unsigned long width
 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_image_info_s *_color_image = (mm_image_info_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");
@@ -95,7 +95,7 @@ int mm_util_set_color_image(mm_util_color_image_h image, unsigned long width, un
 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_image_info_s *_color_image = (mm_image_info_s *)image;
 
        mm_util_retvm_if((_color_image == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
 
@@ -120,7 +120,7 @@ int mm_util_get_color_image(mm_util_color_image_h image, unsigned long *width, u
 
 void mm_util_destroy_color_image(mm_util_color_image_h image)
 {
-       color_image_data_s *_color_image = (color_image_data_s *)image;
+       mm_image_info_s *_color_image = (mm_image_info_s *)image;
 
        if (_color_image == NULL) {
                mm_util_error("[ERROR] - image");
index 56ac01a..92acf84 100755 (executable)
@@ -48,8 +48,8 @@ int main(int argc, char *argv[])
        }
 
        /* decode jpg image */
-       mm_util_jpeg_yuv_data decoded;
-       memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
+       mm_image_info_s decoded;
+       memset(&decoded, 0, sizeof(mm_image_info_s));
 
        ret = mm_util_decode_from_jpeg_file(argv[1], MM_UTIL_COLOR_RGB24, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, &decoded);
 
index 96dcd40..80687b4 100755 (executable)
@@ -84,8 +84,8 @@ typedef struct {
 } mm_util_cb_s;
 
 typedef struct {
-       color_image_data_s *src;
-       color_image_data_s *dst;
+       mm_image_info_s *src;
+       mm_image_info_s *dst;
 
        /* for converting colorspace */
        mm_util_color_format_e dst_format;
index 6f8088a..524567b 100755 (executable)
@@ -32,7 +32,7 @@
 #define GST "gstcs"
 
 typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char **, imgp_plugin_type_e);
-static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *source_image);
+static int __mm_util_transform_exec(mm_util_s *handle, mm_image_info_s *source_image);
 
 static int check_valid_picture_size(int width, int height)
 {
@@ -479,7 +479,7 @@ gpointer _mm_util_thread_repeate(gpointer data)
                        continue;
                }
 
-               ret = __mm_util_transform_exec(handle, (color_image_data_s *)pop_data); /* Need to block */
+               ret = __mm_util_transform_exec(handle, (mm_image_info_s *)pop_data); /* Need to block */
                if (ret == MM_UTIL_ERROR_NONE)
                        mm_util_debug("Success - transform_exec");
                else
@@ -622,7 +622,7 @@ static int __mm_util_processing(mm_util_s *handle)
        return ret;
 }
 
-static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *source_image)
+static int __mm_util_transform_exec(mm_util_s *handle, mm_image_info_s *source_image)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
index 952362c..1d51438 100755 (executable)
@@ -46,88 +46,11 @@ typedef enum {
        MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8 = 8,  /** 1/8 downscale decode */
 } mm_util_jpeg_decode_downscale;
 
-/**
- * YUV data
- */
-typedef struct {
-       mm_util_color_format_e format;     /**< pixel format*/
-       int width;                          /**< width */
-       int height;                         /**< heigt */
-       size_t size;                           /**< size */
-       void *data;                         /**< data */ //    int decode_yuv_subsample;                    /**< decode_yuv_subsample */
-} mm_util_jpeg_yuv_data;
-
-
-/**
- * This function encodes rawfile to jpeg file.
- *
- * @param decoded  [in]     pointer of input stream pointer, that is, pointer of decoded data.
- * @param quality  [in]     encoding quality, from 1 to 100
- * @param filename [in]     output file name
- * @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_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, const char *filename);
-
-
-/**
- * This function encodes raw file to jpeg into memory.
- *
- * @param decoded  [in]     pointer of input stream pointer, that is, pointer of decoded data.
- * @param quality  [in]     encoding quality, from 1 to 100
- * @param mem      [out]    pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
- * @param size     [out]    output stream size, that is, encoded stream size
- * @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_jpeg_encode_to_file(mm_image_info_s *decoded, int quality, const char *filename);
 int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, unsigned char *src, unsigned int width, unsigned int height, mm_util_color_format_e color, int quality);
-
-/**
- * This function encodes raw file to jpeg into memory.
- *
- * @param decoded  [in]     pointer of input stream pointer, that is, pointer of decoded data.
- * @param quality  [in]     encoding quality, from 1 to 100
- * @param mem      [out]    pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
- * @param size     [out]    output stream size, that is, encoded stream size
- * @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_encode_to_jpeg_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, size_t *size);
-
-/**
- * This function extracts yuv data from jpeg file with downscale decode option
- *
- * @param filename [in]     input file name, encoded stream file
- * @param fmt      [in]     color format
- * @param downscale [in]    downscale value
- * @param decoded  [out]    pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
- * @return This function returns zero on success, or negative value with error code.
- * @remark
- * @see         mm_util_jpeg_yuv_data, mm_util_color_format_e
- * @since       R1, 1.0
- */
-int mm_util_decode_from_jpeg_file(const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded);
-
-/**
- * This function extracts yuv data from jpeg buffer with downscale decode option
- *
- * @param src      [in]     input stream pointer(pointer of encoded jpeg stream data)
- * @param size     [in]     size of input stream(size of pointer of encoded jpeg stream data)
- * @param fmt      [in]     color format
- * @param downscale [in]    downscale value
- * @param decoded  [out]    pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
- * @return This function returns zero on success, or negative value with error code.
- * @remark
- * @see         mm_util_jpeg_yuv_data, mm_util_color_format_e
- * @since       R1, 1.0
- */
-int mm_util_decode_from_jpeg_memory(void *src, const size_t size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded);
+int mm_util_encode_to_jpeg_memory(mm_image_info_s *decoded, int quality, void **mem, size_t *size);
+int mm_util_decode_from_jpeg_file(const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_image_info_s *decoded);
+int mm_util_decode_from_jpeg_memory(void *src, const size_t size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_image_info_s *decoded);
 
 
 #ifdef __cplusplus
index 4f6a8bd..3a34ed5 100755 (executable)
@@ -287,7 +287,7 @@ static int __mm_image_encode_with_libjpeg(mm_util_jpeg_cont_format_e control_for
        return iErrorCode;
 }
 
-static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, FILE *fp, void *src, size_t size, mm_util_color_format_e color_format, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded_data)
+static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, FILE *fp, void *src, size_t size, mm_util_color_format_e color_format, mm_util_jpeg_decode_downscale downscale, mm_image_info_s *decoded_data)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        struct jpeg_decompress_struct dinfo;
@@ -373,7 +373,7 @@ static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_for
                dinfo.out_color_space = JCS_EXT_ARGB;
                mm_util_debug("cinfo.out_color_space = JCS_EXT_ARGB");
        }
-       decoded_data->format = color_format;
+       decoded_data->color = color_format;
 
        /* Start decompressor */
        jpeg_start_decompress(&dinfo);
@@ -411,7 +411,7 @@ static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_for
        }
 
        decoded_data->data = (void *) calloc(1, decoded_data->size);
-       decoded_data->format = color_format;
+       decoded_data->color = color_format;
 
        if (decoded_data->data == NULL) {
                jpeg_finish_decompress(&dinfo);
@@ -469,7 +469,7 @@ static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_for
        return iErrorCode;
 }
 
-int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, const char *filename)
+int mm_util_jpeg_encode_to_file(mm_image_info_s *decoded, int quality, const char *filename)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -479,8 +479,8 @@ int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, con
        mm_util_retvm_if(decoded == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
        mm_util_retvm_if(decoded->data == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src data");
        mm_util_retvm_if((decoded->width <= 0) || (decoded->height <= 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width[%d] height[%d]", decoded->width, decoded->height);
-       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(decoded->format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", decoded->format);
-       mm_util_retvm_if((!_mm_util_is_supported_color_format(decoded->format)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", decoded->format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(decoded->color) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", decoded->color);
+       mm_util_retvm_if((!_mm_util_is_supported_color_format(decoded->color)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", decoded->color);
        mm_util_retvm_if((quality < 1) || (quality > 100), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid quality [%d]", quality);
 
        mm_util_debug("#START# LIBJPEG");
@@ -491,7 +491,7 @@ int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, con
                return ret;
        }
 
-       if (decoded->format == MM_UTIL_COLOR_NV12) {
+       if (decoded->color == MM_UTIL_COLOR_NV12) {
                unsigned int res_w = 0;
                unsigned int res_h = 0;
                size_t res_buffer_size = 0;
@@ -503,7 +503,7 @@ int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, con
                MMUTIL_SAFE_FREE(dst);
 
        } else {
-               ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, decoded->data, decoded->width, decoded->height, decoded->format, quality, fp, NULL, NULL);
+               ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, decoded->data, decoded->width, decoded->height, decoded->color, quality, fp, NULL, NULL);
        }
 
        fsync((int)(fp->_fileno));
@@ -521,12 +521,12 @@ int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, unsigned char
        int ret = MM_UTIL_ERROR_NONE;
        size_t encoded_size = 0;
 
-       mm_util_jpeg_yuv_data decoded;
-       memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
+       mm_image_info_s decoded;
+       memset(&decoded, 0, sizeof(mm_image_info_s));
 
        decoded.width = (int)width;
        decoded.height = (int)height;
-       decoded.format = color;
+       decoded.color = color;
        decoded.data = src;
 
        ret = mm_util_encode_to_jpeg_memory(&decoded, quality, mem, &encoded_size);
@@ -536,7 +536,7 @@ int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, unsigned char
        return ret;
 }
 
-int mm_util_encode_to_jpeg_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, size_t *size)
+int mm_util_encode_to_jpeg_memory(mm_image_info_s *decoded, int quality, void **mem, size_t *size)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -547,12 +547,12 @@ int mm_util_encode_to_jpeg_memory(mm_util_jpeg_yuv_data *decoded, int quality, v
        mm_util_retvm_if(decoded == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
        mm_util_retvm_if(decoded->data == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src data");
        mm_util_retvm_if((decoded->width <= 0) || (decoded->height <= 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width[%d] height[%d]", decoded->width, decoded->height);
-       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(decoded->format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", decoded->format);
-       mm_util_retvm_if((!_mm_util_is_supported_color_format(decoded->format)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", decoded->format);
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(decoded->color) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", decoded->color);
+       mm_util_retvm_if((!_mm_util_is_supported_color_format(decoded->color)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", decoded->color);
        mm_util_retvm_if((quality < 1) || (quality > 100), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid quality [%d]", quality);
 
        mm_util_debug("#START# libjpeg");
-       if (decoded->format == MM_UTIL_COLOR_NV12) {
+       if (decoded->color == MM_UTIL_COLOR_NV12) {
                unsigned int res_w = 0;
                unsigned int res_h = 0;
                size_t res_buffer_size = 0;
@@ -564,7 +564,7 @@ int mm_util_encode_to_jpeg_memory(mm_util_jpeg_yuv_data *decoded, int quality, v
                MMUTIL_SAFE_FREE(dst);
 
        } else {
-               ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, decoded->data, decoded->width, decoded->height, decoded->format, quality, NULL, mem, size);
+               ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, decoded->data, decoded->width, decoded->height, decoded->color, quality, NULL, mem, size);
        }
        mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
 
@@ -573,7 +573,7 @@ int mm_util_encode_to_jpeg_memory(mm_util_jpeg_yuv_data *decoded, int quality, v
        return ret;
 }
 
-int mm_util_decode_from_jpeg_file(const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded)
+int mm_util_decode_from_jpeg_file(const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_image_info_s *decoded)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -626,7 +626,7 @@ int mm_util_decode_from_jpeg_file(const char *filename, mm_util_color_format_e f
        return ret;
 }
 
-int mm_util_decode_from_jpeg_memory(void *src, const size_t size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded)
+int mm_util_decode_from_jpeg_memory(void *src, const size_t size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_image_info_s *decoded)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
index 432e1b9..19496bd 100755 (executable)
@@ -65,7 +65,7 @@ static int g_downscale = MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1;
 static void *g_readed_data = NULL;
 static size_t g_readed_size = 0;
 
-static mm_util_jpeg_yuv_data g_decoded_data = {0,};
+static mm_image_info_s g_decoded_data = {0,};
 
 static gboolean _read_file(char *path, void **data, size_t *length)
 {
@@ -207,11 +207,11 @@ gboolean _get_arguments(int argc, char *argv[])
                        _print_help(argv[0]);
                        return FALSE;
                }
-               if (FALSE == _get_input_data(argv[3], 0, INT_MAX, &g_decoded_data.width)) {
+               if (FALSE == _get_input_data(argv[3], 0, INT_MAX, (int *)&g_decoded_data.width)) {
                        fprintf(stderr, "\t[JPEG_testsuite] wrong width %s\n", argv[3]);
                        return FALSE;
                }
-               if (FALSE == _get_input_data(argv[4], 0, INT_MAX, &g_decoded_data.height)) {
+               if (FALSE == _get_input_data(argv[4], 0, INT_MAX, (int *)&g_decoded_data.height)) {
                        fprintf(stderr, "\t[JPEG_testsuite] wrong height %s\n", argv[4]);
                        return FALSE;
                }
@@ -281,7 +281,7 @@ gboolean _test_encode(const jpeg_test_mode_e mode)
                fprintf(stderr, "\t[JPEG_testsuite] reading file error\n");
                return FALSE;
        }
-       g_decoded_data.format = (mm_util_color_format_e)g_color;
+       g_decoded_data.color = (mm_util_color_format_e)g_color;
 
        /* test encoding jpeg */
        if (mode == TEST_ENCODE_FILE) {
index 07505b2..0971b5a 100755 (executable)
 #include "mm_util_private.h"
 #include "mm_util_magick.h"
 
-typedef struct _util_image_s {
-       unsigned char *buffer;
-       unsigned int width;
-       unsigned int height;
-       size_t size;
-       mm_util_color_format_e format;
-} util_image_s;
-
 static bool __mm_util_check_angle(mm_util_magick_rotate_type angle);
 
 static void __mm_util_magick_log_method(const ExceptionType excep, const char *message)
@@ -131,7 +123,7 @@ static int __mm_util_get_map(mm_util_color_format_e format, char **map)
 
 static Image * __mm_util_constitute_image(mm_util_image_h handle, const char *map)
 {
-       util_image_s *_handle = (util_image_s*)handle;
+       mm_image_info_s *_handle = (mm_image_info_s*)handle;
        Image *_image = NULL;
        ExceptionInfo exception;
 
@@ -143,7 +135,7 @@ static Image * __mm_util_constitute_image(mm_util_image_h handle, const char *ma
        GetExceptionInfo(&exception);
 
        /* Read image from buffer */
-       _image = ConstituteImage(_handle->width, _handle->height, map, CharPixel, _handle->buffer, &exception);
+       _image = ConstituteImage(_handle->width, _handle->height, map, CharPixel, _handle->data, &exception);
        if (_image == NULL) {
                mm_util_error("Error: Getting Image failed.");
                if (exception.severity != UndefinedException)
@@ -365,14 +357,14 @@ int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer,
 
        mm_util_retvm_if(handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
 
-       util_image_s *_handle = (util_image_s*)calloc(1, sizeof(util_image_s));
+       mm_image_info_s *_handle = (mm_image_info_s*)calloc(1, sizeof(mm_image_info_s));
        mm_util_retvm_if(_handle == NULL, MM_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
 
-       _handle->buffer = (unsigned char *)buffer;
+       _handle->data = (unsigned char *)buffer;
        _handle->width = width;
        _handle->height = height;
        _handle->size = size;
-       _handle->format = format;
+       _handle->color = format;
 
        *handle = (mm_util_image_h)_handle;
 
@@ -390,13 +382,13 @@ int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned i
        mm_util_retvm_if(size == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid size");
        mm_util_retvm_if(format == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid format");
 
-       util_image_s *_handle = (util_image_s*)handle;
+       mm_image_info_s *_handle = (mm_image_info_s*)handle;
 
-       *buffer = _handle->buffer;
+       *buffer = _handle->data;
        *width = _handle->width;
        *height = _handle->height;
        *size = _handle->size;
-       *format = _handle->format;
+       *format = _handle->color;
 
        return ret;
 }
@@ -405,7 +397,7 @@ int mm_util_destroy_handle(mm_util_image_h handle)
 {
        mm_util_retvm_if(handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
 
-       util_image_s *_handle = (util_image_s*)handle;
+       mm_image_info_s *_handle = (mm_image_info_s*)handle;
 
        MMUTIL_SAFE_FREE(_handle);
 
@@ -415,7 +407,7 @@ 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 ret = MM_UTIL_ERROR_NONE;
-       util_image_s *_src_handle = (util_image_s*)src_handle;
+       mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
        char *map = NULL;
        Image *_image = NULL;
        Image *_processed_image = NULL;
@@ -429,7 +421,7 @@ int mm_util_rotate_B_B(mm_util_image_h src_handle, mm_util_magick_rotate_type an
 
        mm_util_debug("angle [%d]", angle);
 
-       ret = __mm_util_get_map(_src_handle->format, &map);
+       ret = __mm_util_get_map(_src_handle->color, &map);
        mm_util_retvm_if((ret != MM_UTIL_ERROR_NONE) || (map == NULL), ret, "fail to get map");
 
        __mm_util_init(&exception);
@@ -455,7 +447,7 @@ int mm_util_rotate_B_B(mm_util_image_h src_handle, mm_util_magick_rotate_type an
                goto ERROR;
        }
 
-       ret = mm_util_create_handle(dst_handle, pixels, _processed_image->columns, _processed_image->rows, pixels_size, _src_handle->format);
+       ret = mm_util_create_handle(dst_handle, pixels, _processed_image->columns, _processed_image->rows, pixels_size, _src_handle->color);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("Error: __mm_util_write_image_to_buffer failed.");
                MagickFree(pixels);
@@ -475,7 +467,7 @@ ERROR:
 int mm_util_rotate_B_P(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, const char *dst_path)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       util_image_s *_src_handle = (util_image_s*)src_handle;
+       mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
        char *map = NULL;
        Image *_image = NULL;
        Image *_processed_image = NULL;
@@ -488,7 +480,7 @@ int mm_util_rotate_B_P(mm_util_image_h src_handle, mm_util_magick_rotate_type an
 
        mm_util_sec_debug("angle [%d] dst_path [%s]", angle, dst_path);
 
-       ret = __mm_util_get_map(_src_handle->format, &map);
+       ret = __mm_util_get_map(_src_handle->color, &map);
        mm_util_retvm_if((ret != MM_UTIL_ERROR_NONE) || (map == NULL), ret, "fail to get map");
 
        __mm_util_init(&exception);
@@ -626,7 +618,7 @@ ERROR:
 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 ret = MM_UTIL_ERROR_NONE;
-       util_image_s *_src_handle = (util_image_s*)src_handle;
+       mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
        char *map = NULL;
        Image *_image = NULL;
        Image *_processed_image = NULL;
@@ -640,7 +632,7 @@ int mm_util_resize_B_B(mm_util_image_h src_handle, unsigned int req_width, unsig
 
        mm_util_debug("req_width [%u] req_height [%u]", req_width, req_height);
 
-       ret = __mm_util_get_map(_src_handle->format, &map);
+       ret = __mm_util_get_map(_src_handle->color, &map);
        mm_util_retvm_if((ret != MM_UTIL_ERROR_NONE) || (map == NULL), ret, "fail to get map");
 
        __mm_util_init(&exception);
@@ -672,7 +664,7 @@ int mm_util_resize_B_B(mm_util_image_h src_handle, unsigned int req_width, unsig
                goto ERROR;
        }
 
-       ret = mm_util_create_handle(dst_handle, pixels, _processed_image->columns, _processed_image->rows, pixels_size, _src_handle->format);
+       ret = mm_util_create_handle(dst_handle, pixels, _processed_image->columns, _processed_image->rows, pixels_size, _src_handle->color);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("Error: __mm_util_write_image_to_buffer failed.");
                MagickFree(pixels);
@@ -692,7 +684,7 @@ ERROR:
 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 ret = MM_UTIL_ERROR_NONE;
-       util_image_s *_src_handle = (util_image_s*)src_handle;
+       mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
        char *map = NULL;
        Image *_image = NULL;
        Image *_processed_image = NULL;
@@ -705,7 +697,7 @@ int mm_util_resize_B_P(mm_util_image_h src_handle, unsigned int req_width, unsig
 
        mm_util_sec_debug("req_width [%u] req_height [%u] dst_path [%s]", req_width, req_height, dst_path);
 
-       ret = __mm_util_get_map(_src_handle->format, &map);
+       ret = __mm_util_get_map(_src_handle->color, &map);
        mm_util_retvm_if((ret != MM_UTIL_ERROR_NONE) || (map == NULL), ret, "fail to get map");
 
        __mm_util_init(&exception);
@@ -860,7 +852,7 @@ ERROR:
 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;
+       mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
        char *map = NULL;
        Image *_image = NULL;
        ExceptionInfo exception;
@@ -870,9 +862,9 @@ int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_color_format_e req_f
        mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
        mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
 
-       mm_util_debug("input format [%d] req_format [%d]", _src_handle->format, req_format);
+       mm_util_debug("input format [%d] req_format [%d]", _src_handle->color, req_format);
 
-       ret = __mm_util_get_map(_src_handle->format, &map);
+       ret = __mm_util_get_map(_src_handle->color, &map);
        mm_util_retvm_if((ret != MM_UTIL_ERROR_NONE) || (map == NULL), ret, "fail to get map");
 
        __mm_util_init(&exception);
@@ -899,7 +891,7 @@ int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_color_format_e req_f
                goto ERROR;
        }
 
-       ret = mm_util_create_handle(dst_handle, pixels, _image->columns, _image->rows, pixels_size, _src_handle->format);
+       ret = mm_util_create_handle(dst_handle, pixels, _image->columns, _image->rows, pixels_size, _src_handle->color);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("Error: __mm_util_write_image_to_buffer failed.");
                MagickFree(pixels);
index 278b8f4..7552300 100755 (executable)
@@ -50,67 +50,10 @@ typedef enum {
        MM_UTIL_COMPRESSION_9 = 9       /* Best compression */
 } mm_util_png_compression;
 
-typedef struct {
-       unsigned long width;                    /**< Width*/
-       unsigned long height;                   /**< Height*/
-       size_t size;                    /**< size */
-       void *data;                             /**< data */
-} mm_util_png_data;
-
-/**
- * This function extracts raw data from png file
- *
- * @param fpath    [in]     input file name, encoded stream file
- * @param decoded  [out]    pointer of mm_util_png_data.
- *                          After using it, please free the allocated memory.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_png_data, mm_util_init_decode_png
- * @since                   R1, 1.0
- */
-int mm_util_decode_from_png_file(const char *fpath, mm_util_png_data * decoded);
-
-/**
- * This function extracts raw data from png buffer
- *
- * @param memory   [in]     input stream pointer(pointer of encoded png stream data)
- * @param src_size [in]     size of input stream(size of pointer of encoded png stream data)
- * @param decoded  [out]    pointer of mm_util_png_data.
- *                          After using it, please free the allocated memory.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_png_data, mm_util_init_decode_png
- * @since                   R1, 1.0
- */
-int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_util_png_data * decoded);
-
-/**
- * This function extracts raw data to png file
- *
- * @param decoded  [in]     information of the raw data.
- * @param compression_level  [in]     compression level
- * @param fpath [out]    output file name on to which the encoded stream will be written.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_png_data, mm_util_init_encode_png
- * @since                   R1, 1.0
- */
-int mm_util_encode_to_png_file(mm_util_png_data *decoded, mm_util_png_compression compression_level, const char *fpath);
-
-/**
- * This function extracts raw data to memory
- *
- * @param decoded  [in]     information of the raw data.
- * @param compression_level  [in]     compression level
- * @param data  [out]       pointer of encoded data.
- * @param size  [out]       size of encoded data.
- *                          After using it, please free the allocated memory.
- * @return                  This function returns zero on success, or negative value with error code.
- * @remark
- * @see                     mm_util_png_data, mm_util_init_encode_png
- * @since                   R1, 1.0
- */
-int mm_util_encode_to_png_memory(mm_util_png_data *decoded, mm_util_png_compression compression_level, void **data, size_t *size);
+int mm_util_decode_from_png_file(const char *fpath, mm_image_info_s * decoded);
+int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_image_info_s * decoded);
+int mm_util_encode_to_png_file(mm_image_info_s *decoded, mm_util_png_compression compression_level, const char *fpath);
+int mm_util_encode_to_png_memory(mm_image_info_s *decoded, mm_util_png_compression compression_level, void **data, size_t *size);
 
 #ifdef __cplusplus
 }
index 66251cd..2b11afc 100755 (executable)
@@ -143,7 +143,7 @@ static void __get_property(png_property_s *png_prop, png_structp png_ptr, png_in
 
 }
 
-static int _read_png(FILE *fp, void *memory, const size_t memory_size, mm_util_png_data *decoded)
+static int _read_png(FILE *fp, void *memory, const size_t memory_size, mm_image_info_s *decoded)
 {
        png_structp png_ptr;
        png_infop info_ptr;
@@ -229,7 +229,7 @@ static int _read_png(FILE *fp, void *memory, const size_t memory_size, mm_util_p
        return MM_UTIL_ERROR_NONE;
 }
 
-int _write_png(mm_util_png_data *decoded, mm_util_png_compression compression_level, FILE *fp, void **buffer, size_t *size)
+int _write_png(mm_image_info_s *decoded, mm_util_png_compression compression_level, FILE *fp, void **buffer, size_t *size)
 {
        png_structp png_ptr;
        png_infop info_ptr;
@@ -311,7 +311,7 @@ int _write_png(mm_util_png_data *decoded, mm_util_png_compression compression_le
        return MM_UTIL_ERROR_NONE;
 }
 
-int mm_util_decode_from_png_file(const char *fpath, mm_util_png_data *decoded)
+int mm_util_decode_from_png_file(const char *fpath, mm_image_info_s *decoded)
 {
        int ret = MM_UTIL_ERROR_NONE;
        FILE *fp = NULL;
@@ -340,7 +340,7 @@ int mm_util_decode_from_png_file(const char *fpath, mm_util_png_data *decoded)
        return ret;
 }
 
-int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_util_png_data *decoded)
+int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_image_info_s *decoded)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -358,7 +358,7 @@ int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_util_
        return ret;
 }
 
-int mm_util_encode_to_png_file(mm_util_png_data *decoded, mm_util_png_compression compression_level, const char *fpath)
+int mm_util_encode_to_png_file(mm_image_info_s *decoded, mm_util_png_compression compression_level, const char *fpath)
 {
        int ret = MM_UTIL_ERROR_NONE;
        FILE *fp = NULL;
@@ -387,7 +387,7 @@ int mm_util_encode_to_png_file(mm_util_png_data *decoded, mm_util_png_compressio
        return ret;
 }
 
-int mm_util_encode_to_png_memory(mm_util_png_data *decoded, mm_util_png_compression compression_level, void **data, size_t *size)
+int mm_util_encode_to_png_memory(mm_image_info_s *decoded, mm_util_png_compression compression_level, void **data, size_t *size)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
index ecdf2bd..6d6512d 100755 (executable)
@@ -63,7 +63,7 @@ static int g_compression = MM_UTIL_COMPRESSION_6;
 static void *g_readed_data = NULL;
 static size_t g_readed_size = 0;
 
-static mm_util_png_data g_decoded_data = {0,};
+static mm_image_info_s g_decoded_data = {0,};
 
 static gboolean _read_file(char *path, void **data, size_t *length)
 {