Apply coding rule & remove unused testsuite 96/54796/1 accepted/tizen/mobile/20151218.084647 accepted/tizen/tv/20151218.084441 accepted/tizen/wearable/20151218.084623 submit/tizen/20151218.044348 submit/tizen_common/20151229.142028 submit/tizen_common/20151229.144031 submit/tizen_common/20151229.154718
authorJi Yong Min <jiyong.min@samsung.com>
Fri, 18 Dec 2015 02:58:32 +0000 (11:58 +0900)
committerJi Yong Min <jiyong.min@samsung.com>
Fri, 18 Dec 2015 02:59:35 +0000 (11:59 +0900)
Change-Id: I7afbbcc40c57c293afb059c5ef40471d40203fbc
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
12 files changed:
bmp/mm_util_bmp.c
configure.ac
gif/mm_util_gif.c
imgcv/mm_util_imgcv.c
imgcv/test/mm_util_imgcv_testsuite.c
imgp/mm_util_imgp.c
imgp/test/mm_util_imgp_testsuite.c
jpeg/mm_util_jpeg.c
packaging/libmm-utility.spec
png/mm_util_png.c
test/Makefile.am [deleted file]
test/mm_utility_testsuite.c [deleted file]

index 607605c..539497e 100755 (executable)
@@ -122,7 +122,7 @@ void bitmap_destroy(void *bitmap)
        free(bitmap);
 }
 
-static int read_bmp(mm_util_bmp_data * decoded, const char *filename, void *memory, unsigned long long src_size)
+static int read_bmp(mm_util_bmp_data *decoded, const char *filename, void *memory, unsigned long long src_size)
 {
        bmp_bitmap_callback_vt bitmap_callbacks = {
                bitmap_create,
@@ -181,7 +181,7 @@ static int read_bmp(mm_util_bmp_data * decoded, const char *filename, void *memo
        return res;
 }
 
-int mm_util_decode_from_bmp_file(mm_util_bmp_data * decoded, const char *filename)
+int mm_util_decode_from_bmp_file(mm_util_bmp_data *decoded, const char *filename)
 {
        int ret;
 
@@ -192,7 +192,7 @@ int mm_util_decode_from_bmp_file(mm_util_bmp_data * decoded, const char *filenam
        return ret;
 }
 
-int mm_util_decode_from_bmp_memory(mm_util_bmp_data * decoded, void **memory, unsigned long long src_size)
+int mm_util_decode_from_bmp_memory(mm_util_bmp_data *decoded, void **memory, unsigned long long src_size)
 {
        int ret;
 
@@ -203,22 +203,22 @@ int mm_util_decode_from_bmp_memory(mm_util_bmp_data * decoded, void **memory, un
        return ret;
 }
 
-unsigned long mm_util_decode_get_width(mm_util_bmp_data * data)
+unsigned long mm_util_decode_get_width(mm_util_bmp_data *data)
 {
        return data->width;
 }
 
-unsigned long mm_util_decode_get_height(mm_util_bmp_data * data)
+unsigned long mm_util_decode_get_height(mm_util_bmp_data *data)
 {
        return data->height;
 }
 
-unsigned long long mm_util_decode_get_size(mm_util_bmp_data * data)
+unsigned long long mm_util_decode_get_size(mm_util_bmp_data *data)
 {
        return data->size;
 }
 
-int mm_util_encode_bmp_to_file(mm_util_bmp_data * encoded, const char *filename)
+int mm_util_encode_bmp_to_file(mm_util_bmp_data *encoded, const char *filename)
 {
        bmpfile_t *bmp;
        rgb_pixel_t pixel = { 0, 0, 0, 0 };
@@ -246,12 +246,12 @@ int mm_util_encode_bmp_to_file(mm_util_bmp_data * encoded, const char *filename)
        return MM_UTIL_ERROR_NONE;
 }
 
-void mm_util_bmp_encode_set_width(mm_util_bmp_data * data, unsigned long width)
+void mm_util_bmp_encode_set_width(mm_util_bmp_data *data, unsigned long width)
 {
        data->width = width;
 }
 
-void mm_util_bmp_encode_set_height(mm_util_bmp_data * data, unsigned long height)
+void mm_util_bmp_encode_set_height(mm_util_bmp_data *data, unsigned long height)
 {
        data->height = height;
 }
index c40ea7c..677db5c 100755 (executable)
@@ -88,7 +88,6 @@ AC_CONFIG_FILES([Makefile
                 bmp/Makefile
                 bmp/test/Makefile
                 bmp/mmutil-bmp.pc
-                test/Makefile
 ])
 
 AC_OUTPUT
index 2d7ca88..c79d00a 100755 (executable)
@@ -45,7 +45,7 @@ typedef struct {
        unsigned long long size;
 } write_data;
 
-static int convert_gif_to_rgba(mm_util_gif_data * decoded, ColorMapObject * color_map, GifRowType * screen_buffer, unsigned long width, unsigned long height)
+static int convert_gif_to_rgba(mm_util_gif_data *decoded, ColorMapObject *color_map, GifRowType *screen_buffer, unsigned long width, unsigned long height)
 {
        unsigned long i, j;
        GifRowType gif_row;
@@ -78,7 +78,7 @@ static int convert_gif_to_rgba(mm_util_gif_data * decoded, ColorMapObject * colo
        return MM_UTIL_ERROR_NONE;
 }
 
-static int read_function(GifFileType * gft, GifByteType * data, int size)
+static int read_function(GifFileType *gft, GifByteType *data, int size)
 {
        read_data *read_data_ptr = (read_data *) gft->UserData;
 
@@ -89,7 +89,7 @@ static int read_function(GifFileType * gft, GifByteType * data, int size)
        return size;
 }
 
-int read_gif(mm_util_gif_data * decoded, const char *filename, void *memory)
+int read_gif(mm_util_gif_data *decoded, const char *filename, void *memory)
 {
        int ExtCode, i, j, Row, Col, Width, Height;
        unsigned long Size;
@@ -251,7 +251,7 @@ error:
        return ret;
 }
 
-int mm_util_decode_from_gif_file(mm_util_gif_data * decoded, const char *fpath)
+int mm_util_decode_from_gif_file(mm_util_gif_data *decoded, const char *fpath)
 {
        int ret;
 
@@ -262,7 +262,7 @@ int mm_util_decode_from_gif_file(mm_util_gif_data * decoded, const char *fpath)
        return ret;
 }
 
-int mm_util_decode_from_gif_memory(mm_util_gif_data * decoded, void **memory)
+int mm_util_decode_from_gif_memory(mm_util_gif_data *decoded, void **memory)
 {
        int ret;
 
@@ -273,22 +273,22 @@ int mm_util_decode_from_gif_memory(mm_util_gif_data * decoded, void **memory)
        return ret;
 }
 
-unsigned long mm_util_decode_get_width(mm_util_gif_data * data)
+unsigned long mm_util_decode_get_width(mm_util_gif_data *data)
 {
        return data->width;
 }
 
-unsigned long mm_util_decode_get_height(mm_util_gif_data * data)
+unsigned long mm_util_decode_get_height(mm_util_gif_data *data)
 {
        return data->height;
 }
 
-unsigned long long mm_util_decode_get_size(mm_util_gif_data * data)
+unsigned long long mm_util_decode_get_size(mm_util_gif_data *data)
 {
        return data->size;
 }
 
-static void load_rgb_from_buffer(GifByteType * buffer, GifByteType ** red, GifByteType ** green, GifByteType ** blue, unsigned long width, unsigned long height)
+static void load_rgb_from_buffer(GifByteType *buffer, GifByteType **red, GifByteType **green, GifByteType **blue, unsigned long width, unsigned long height)
 {
        unsigned long i, j;
        unsigned long Size;
@@ -317,7 +317,7 @@ static void load_rgb_from_buffer(GifByteType * buffer, GifByteType ** red, GifBy
        return;
 }
 
-static int save_buffer_to_gif(GifFileType * GifFile, GifByteType * OutputBuffer, unsigned long width, unsigned long height, unsigned long long delay_time)
+static int save_buffer_to_gif(GifFileType *GifFile, GifByteType *OutputBuffer, unsigned long width, unsigned long height, unsigned long long delay_time)
 {
        unsigned long i;
        GifByteType *Ptr = OutputBuffer;
@@ -351,7 +351,7 @@ static int save_buffer_to_gif(GifFileType * GifFile, GifByteType * OutputBuffer,
        return MM_UTIL_ERROR_NONE;
 }
 
-static void outputbuffer_free(GifByteType ** OutputBuffer, unsigned int image_count)
+static void outputbuffer_free(GifByteType **OutputBuffer, unsigned int image_count)
 {
        unsigned int j;
 
@@ -364,7 +364,7 @@ static void outputbuffer_free(GifByteType ** OutputBuffer, unsigned int image_co
        free(OutputBuffer);
 }
 
-static int write_function(GifFileType * gft, const GifByteType * data, int size)
+static int write_function(GifFileType *gft, const GifByteType *data, int size)
 {
        write_data *write_data_ptr = (write_data *) gft->UserData;
 
@@ -376,7 +376,7 @@ static int write_function(GifFileType * gft, const GifByteType * data, int size)
        return size;
 }
 
-int write_gif(mm_util_gif_data * encoded, const char *filename, void **data)
+int write_gif(mm_util_gif_data *encoded, const char *filename, void **data)
 {
        int ColorMapSize;
        unsigned int i = 0;
@@ -490,7 +490,7 @@ int write_gif(mm_util_gif_data * encoded, const char *filename, void **data)
        return MM_UTIL_ERROR_NONE;
 }
 
-int mm_util_encode_gif_to_file(mm_util_gif_data * encoded, const char *fpath)
+int mm_util_encode_gif_to_file(mm_util_gif_data *encoded, const char *fpath)
 {
        int ret;
 
@@ -501,7 +501,7 @@ int mm_util_encode_gif_to_file(mm_util_gif_data * encoded, const char *fpath)
        return ret;
 }
 
-int mm_util_encode_gif_to_memory(mm_util_gif_data * encoded, void **data)
+int mm_util_encode_gif_to_memory(mm_util_gif_data *encoded, void **data)
 {
        int ret;
 
@@ -511,22 +511,22 @@ int mm_util_encode_gif_to_memory(mm_util_gif_data * encoded, void **data)
        return ret;
 }
 
-void mm_util_gif_encode_set_width(mm_util_gif_data * data, unsigned long width)
+void mm_util_gif_encode_set_width(mm_util_gif_data *data, unsigned long width)
 {
        data->width = width;
 }
 
-void mm_util_gif_encode_set_height(mm_util_gif_data * data, unsigned long height)
+void mm_util_gif_encode_set_height(mm_util_gif_data *data, unsigned long height)
 {
        data->height = height;
 }
 
-void mm_util_gif_encode_set_image_count(mm_util_gif_data * data, unsigned int image_count)
+void mm_util_gif_encode_set_image_count(mm_util_gif_data *data, unsigned int image_count)
 {
        data->image_count = image_count;
 }
 
-void mm_util_gif_encode_set_frame_delay_time(mm_util_gif_frame_data * frame, unsigned long long delay_time)
+void mm_util_gif_encode_set_frame_delay_time(mm_util_gif_frame_data *frame, unsigned long long delay_time)
 {
        frame->delay_time = delay_time;
 }
index 06dcbee..e1e38fd 100755 (executable)
 #include <ttrace.h>
 #define TTRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_IMAGE, NAME)
 #define TTRACE_END() traceEnd(TTRACE_TAG_IMAGE)
-#else //ENABLE_TTRACE
+#else /* ENABLE_TTRACE */
 #define TTRACE_BEGIN(NAME)
 #define TTRACE_END()
-#endif //ENABLE_TTRACE
+#endif /* ENABLE_TTRACE */
 
 #define RGB_COLOR_CHANNELS 3
 #define HSV_COLOR_CHANNELS 3
@@ -54,9 +54,8 @@ static int _mm_util_imgcv_init(mm_util_imgcv_s *handle, int width, int height)
        handle->height = height;
 
        handle->inImg = cvCreateImageHeader(cvSize(width, height), IPL_DEPTH_8U, RGB_COLOR_CHANNELS);
-       if (handle->inImg == NULL) {
+       if (handle->inImg == NULL)
                return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
 
        handle->hBins = DEFAULT_NUM_HBINS;
        handle->sBins = DEFAULT_NUM_SBINS;
@@ -99,9 +98,8 @@ static int _mm_util_imgcv_set_buffer(mm_util_imgcv_s *handle, void *image_buffer
        mm_util_debug("image_buffer [%p], width [%d]", buffer, handle->width);
 
        cvSetData(handle->inImg, buffer, RGB_COLOR_CHANNELS*(handle->width));
-       if (handle->inImg == NULL) {
+       if (handle->inImg == NULL)
                return  MM_UTIL_ERROR_INVALID_OPERATION;
-       }
 
        mm_util_debug("Leave _mm_util_imgcv_set_buffer");
 
@@ -164,14 +162,13 @@ static int _mm_util_imgcv_calculate_hist(mm_util_imgcv_s *handle, unsigned char
        cvCvtColor(handle->inImg, hsvImg, CV_RGB2HSV);
        cvSplit(hsvImg, hImg, sImg, vImg, NULL);
 
-       float * ranges[] = {handle->hRanges, handle->sRanges, handle->vRanges};
+       float *ranges[] = {handle->hRanges, handle->sRanges, handle->vRanges};
        int histsize[] = {handle->sizeOfHist[0], handle->sizeOfHist[1], handle->sizeOfHist[2]};
 
        /* create histogram*/
        CvHistogram *hist = cvCreateHist(HISTOGRAM_CHANNELS, histsize, CV_HIST_ARRAY, ranges, 1);
-       if (hist == NULL) {
+       if (hist == NULL)
                return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
 
        cvCalcHist(planes, hist, 0, NULL);
 
index 2b3e08d..19ad5e0 100755 (executable)
@@ -75,11 +75,10 @@ int main(int argc, char *argv[])
        unsigned char rgb_r, rgb_g, rgb_b;
        ret = mm_util_cv_extract_representative_color(img_buffer, width, height, &rgb_r, &rgb_g, &rgb_b);
 
-       if (!ret) {
+       if (!ret)
                fprintf(stderr, "Success - R[%d], G[%d], B[%d]", rgb_r, rgb_g, rgb_b);
-       } else {
+       else
                fprintf(stderr, "Error - fail to extract color");
-       }
 
        free(img_buffer);
        img_buffer = NULL;
index c84e827..c79a753 100755 (executable)
 #include <ttrace.h>
 #define TTRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_IMAGE, NAME)
 #define TTRACE_END() traceEnd(TTRACE_TAG_IMAGE)
-#else //ENABLE_TTRACE
+#else /* ENABLE_TTRACE */
 #define TTRACE_BEGIN(NAME)
 #define TTRACE_END()
-#endif //ENABLE_TTRACE
+#endif /* ENABLE_TTRACE */
 
 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
 #define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
 #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, media_packet_h src_packet);
+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, media_packet_h src_packet);
 
 static int check_valid_picture_size(int width, int height)
 {
-       if ((int)width > 0 && (int)height > 0 && (width + 128)*(unsigned long long)(height + 128) < INT_MAX/4) {
+       if ((int)width > 0 && (int)height > 0 &&
+               ((width + 128) * (unsigned long long)(height + 128)) < INT_MAX/4)
                return MM_UTIL_ERROR_NONE;
-       }
 
        return MM_UTIL_ERROR_INVALID_PARAMETER;
 }
@@ -57,9 +57,8 @@ static void __mm_destroy_temp_buffer(unsigned char *buffer[])
 {
        int i = 0;
 
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < 4; i++)
                IMGP_FREE(buffer[i]);
-       }
 }
 
 static gboolean __mm_cannot_convert_format(mm_util_img_format src_format, mm_util_img_format dst_format)
@@ -89,7 +88,7 @@ static gboolean __mm_cannot_convert_format(mm_util_img_format src_format, mm_uti
        return _bool;
 }
 
-static gboolean __mm_gst_can_resize_format(char__format_label)
+static gboolean __mm_gst_can_resize_format(char *__format_label)
 {
        gboolean _bool = FALSE;
 
@@ -110,7 +109,7 @@ static gboolean __mm_gst_can_resize_format(char* __format_label)
        return _bool;
 }
 
-static gboolean __mm_gst_can_rotate_format(const char__format_label)
+static gboolean __mm_gst_can_rotate_format(const char *__format_label)
 {
        gboolean _bool = FALSE;
 
@@ -208,11 +207,11 @@ static gboolean __mm_select_resize_plugin(mm_util_img_format _format)
 
        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_IMG_FMT_UYVY) || (_format == MM_UTIL_IMG_FMT_YUYV) ||
+               (_format == MM_UTIL_IMG_FMT_RGBA8888) || (_format == MM_UTIL_IMG_FMT_BGRX8888))
                _bool = FALSE;
-       } else {
+       else
                _bool = TRUE;
-       }
 
        return _bool;
 }
@@ -270,69 +269,69 @@ 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:
-                       x_chroma_shift = 1;
-                       y_chroma_shift = 1;
-                       stride = MM_UTIL_ROUND_UP_4(width);
-                       h2 = ROUND_UP_X(height, x_chroma_shift);
-                       size = stride * h2;
-                       w2 = DIV_ROUND_UP_X(width, x_chroma_shift);
-                       stride2 = MM_UTIL_ROUND_UP_4(w2);
-                       h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
-                       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:
-                       stride = MM_UTIL_ROUND_UP_4(width) * 2;
-                       size = stride * height;
-                       *imgsize = size;
-                       break;
-
-               case MM_UTIL_IMG_FMT_RGB565:
-                       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:
-                       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:
-                       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:
-                       x_chroma_shift = 1;
-                       y_chroma_shift = 1;
-                       stride = MM_UTIL_ROUND_UP_4(width);
-                       h2 = ROUND_UP_X(height, y_chroma_shift);
-                       size = stride * h2;
-                       w2 = 2 * DIV_ROUND_UP_X(width, x_chroma_shift);
-                       stride2 = MM_UTIL_ROUND_UP_4(w2);
-                       h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
-                       size2 = stride2 * h2;
-                       *imgsize = size + size2;
-                       break;
-
-               default:
-                       mm_util_error("Not supported format");
-                       TTRACE_END();
-                       return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
+       case MM_UTIL_IMG_FMT_I420:
+       case MM_UTIL_IMG_FMT_YUV420:
+               x_chroma_shift = 1;
+               y_chroma_shift = 1;
+               stride = MM_UTIL_ROUND_UP_4(width);
+               h2 = ROUND_UP_X(height, x_chroma_shift);
+               size = stride * h2;
+               w2 = DIV_ROUND_UP_X(width, x_chroma_shift);
+               stride2 = MM_UTIL_ROUND_UP_4(w2);
+               h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
+               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:
+               stride = MM_UTIL_ROUND_UP_4(width) * 2;
+               size = stride * height;
+               *imgsize = size;
+               break;
+
+       case MM_UTIL_IMG_FMT_RGB565:
+               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:
+               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:
+               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:
+               x_chroma_shift = 1;
+               y_chroma_shift = 1;
+               stride = MM_UTIL_ROUND_UP_4(width);
+               h2 = ROUND_UP_X(height, y_chroma_shift);
+               size = stride * h2;
+               w2 = 2 * DIV_ROUND_UP_X(width, x_chroma_shift);
+               stride2 = MM_UTIL_ROUND_UP_4(w2);
+               h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
+               size2 = stride2 * h2;
+               *imgsize = size + size2;
+               break;
+
+       default:
+               mm_util_error("Not supported format");
+               TTRACE_END();
+               return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        }
        mm_util_debug("format: %d, *imgsize: %d\n", format, *imgsize);
 
@@ -350,44 +349,44 @@ static int __mm_confirm_dst_width_height(unsigned int src_width, unsigned int sr
        }
 
        switch (angle) {
-               case MM_UTIL_ROTATE_0:
-               case MM_UTIL_ROTATE_180:
-               case MM_UTIL_ROTATE_FLIP_HORZ:
-               case MM_UTIL_ROTATE_FLIP_VERT:
-                       if (*dst_width != src_width) {
-                               mm_util_debug("*dst_width: %d", *dst_width);
-                               *dst_width = src_width;
-                               mm_util_debug("#Confirmed# *dst_width: %d", *dst_width);
-                       }
-                       if (*dst_height != src_height) {
-                               mm_util_debug("*dst_height: %d", *dst_height);
-                               *dst_height = src_height;
-                               mm_util_debug("#Confirmed# *dst_height: %d", *dst_height);
-                       }
-                       break;
-               case MM_UTIL_ROTATE_90:
-               case MM_UTIL_ROTATE_270:
-                       if (*dst_width != src_height) {
-                               mm_util_debug("*dst_width: %d", *dst_width);
-                               *dst_width = src_height;
-                               mm_util_debug("#Confirmed# *dst_width: %d", *dst_width);
-                       }
-                       if (*dst_height != src_width) {
-                               mm_util_debug("*dst_height: %d", *dst_height);
-                               *dst_height = src_width;
-                               mm_util_debug("#Confirmed# *dst_height: %d", *dst_height);
-                       }
-                       break;
+       case MM_UTIL_ROTATE_0:
+       case MM_UTIL_ROTATE_180:
+       case MM_UTIL_ROTATE_FLIP_HORZ:
+       case MM_UTIL_ROTATE_FLIP_VERT:
+               if (*dst_width != src_width) {
+                       mm_util_debug("*dst_width: %d", *dst_width);
+                       *dst_width = src_width;
+                       mm_util_debug("#Confirmed# *dst_width: %d", *dst_width);
+               }
+               if (*dst_height != src_height) {
+                       mm_util_debug("*dst_height: %d", *dst_height);
+                       *dst_height = src_height;
+                       mm_util_debug("#Confirmed# *dst_height: %d", *dst_height);
+               }
+               break;
+       case MM_UTIL_ROTATE_90:
+       case MM_UTIL_ROTATE_270:
+               if (*dst_width != src_height) {
+                       mm_util_debug("*dst_width: %d", *dst_width);
+                       *dst_width = src_height;
+                       mm_util_debug("#Confirmed# *dst_width: %d", *dst_width);
+               }
+               if (*dst_height != src_width) {
+                       mm_util_debug("*dst_height: %d", *dst_height);
+                       *dst_height = src_width;
+                       mm_util_debug("#Confirmed# *dst_height: %d", *dst_height);
+               }
+               break;
 
-               default:
-                       mm_util_error("Not supported rotate value");
-                       return MM_UTIL_ERROR_INVALID_PARAMETER;
+       default:
+               mm_util_error("Not supported rotate value");
+               return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
        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_img_format src_format, mm_util_img_format dst_format)
 {
        int ret = MM_UTIL_ERROR_NONE;
        char *src_fmt_lable = NULL;
@@ -398,92 +397,92 @@ static int __mm_set_format_label(imgp_info_s * _imgp_info_s, mm_util_img_format
        }
 
        switch (src_format) {
-               case MM_UTIL_IMG_FMT_YUV420:
-                       src_fmt_lable = (char *)"YV12";
-                       break;
-               case MM_UTIL_IMG_FMT_YUV422:
-                       src_fmt_lable = (char *)"Y42B";
-                       break;
-               case MM_UTIL_IMG_FMT_I420:
-                       src_fmt_lable = (char *)"I420";
-                       break;
-               case MM_UTIL_IMG_FMT_NV12:
-                       src_fmt_lable = (char *)"NV12";
-                       break;
-               case MM_UTIL_IMG_FMT_UYVY:
-                       src_fmt_lable = (char *)"UYVY";
-                       break;
-               case MM_UTIL_IMG_FMT_YUYV:
-                       src_fmt_lable = (char *)"YUYV";
-                       break;
-               case MM_UTIL_IMG_FMT_RGB565:
-                       src_fmt_lable = (char *)"RGB565";
-                       break;
-               case MM_UTIL_IMG_FMT_RGB888:
-                       src_fmt_lable = (char *)"RGB888";
-                       break;
-               case MM_UTIL_IMG_FMT_ARGB8888:
-                       src_fmt_lable = (char *)"ARGB8888";
-                       break;
-               case MM_UTIL_IMG_FMT_BGRA8888:
-                       src_fmt_lable = (char *)"BGRA8888";
-                       break;
-               case MM_UTIL_IMG_FMT_RGBA8888:
-                       src_fmt_lable = (char *)"RGBA8888";
-                       break;
-               case MM_UTIL_IMG_FMT_BGRX8888:
-                       src_fmt_lable = (char *)"BGRX";
-                       break;
-               default:
-                       mm_util_debug("[%d] Not supported format", src_fmt_lable);
-                       break;
+       case MM_UTIL_IMG_FMT_YUV420:
+               src_fmt_lable = (char *)"YV12";
+               break;
+       case MM_UTIL_IMG_FMT_YUV422:
+               src_fmt_lable = (char *)"Y42B";
+               break;
+       case MM_UTIL_IMG_FMT_I420:
+               src_fmt_lable = (char *)"I420";
+               break;
+       case MM_UTIL_IMG_FMT_NV12:
+               src_fmt_lable = (char *)"NV12";
+               break;
+       case MM_UTIL_IMG_FMT_UYVY:
+               src_fmt_lable = (char *)"UYVY";
+               break;
+       case MM_UTIL_IMG_FMT_YUYV:
+               src_fmt_lable = (char *)"YUYV";
+               break;
+       case MM_UTIL_IMG_FMT_RGB565:
+               src_fmt_lable = (char *)"RGB565";
+               break;
+       case MM_UTIL_IMG_FMT_RGB888:
+               src_fmt_lable = (char *)"RGB888";
+               break;
+       case MM_UTIL_IMG_FMT_ARGB8888:
+               src_fmt_lable = (char *)"ARGB8888";
+               break;
+       case MM_UTIL_IMG_FMT_BGRA8888:
+               src_fmt_lable = (char *)"BGRA8888";
+               break;
+       case MM_UTIL_IMG_FMT_RGBA8888:
+               src_fmt_lable = (char *)"RGBA8888";
+               break;
+       case MM_UTIL_IMG_FMT_BGRX8888:
+               src_fmt_lable = (char *)"BGRX";
+               break;
+       default:
+               mm_util_debug("[%d] Not supported format", src_fmt_lable);
+               break;
        }
 
        switch (dst_format) {
-               case MM_UTIL_IMG_FMT_YUV420:
-                       dst_fmt_lable = (char *)"YV12";
-                       break;
-               case MM_UTIL_IMG_FMT_YUV422:
-                       dst_fmt_lable = (char *)"Y42B";
-                       break;
-               case MM_UTIL_IMG_FMT_I420:
-                       dst_fmt_lable = (char *)"I420";
-                       break;
-               case MM_UTIL_IMG_FMT_NV12:
-                       dst_fmt_lable = (char *)"NV12";
-                       break;
-               case MM_UTIL_IMG_FMT_UYVY:
-                       dst_fmt_lable = (char *)"UYVY";
-                       break;
-               case MM_UTIL_IMG_FMT_YUYV:
-                       dst_fmt_lable = (char *)"YUYV";
-                       break;
-               case MM_UTIL_IMG_FMT_RGB565:
-                       dst_fmt_lable = (char *)"RGB565";
-                       break;
-               case MM_UTIL_IMG_FMT_RGB888:
-                       dst_fmt_lable = (char *)"RGB888";
-                       break;
-               case MM_UTIL_IMG_FMT_ARGB8888:
-                       dst_fmt_lable = (char *)"ARGB8888";
-                       break;
-               case MM_UTIL_IMG_FMT_BGRA8888:
-                       dst_fmt_lable = (char *)"BGRA8888";
-                       break;
-               case MM_UTIL_IMG_FMT_RGBA8888:
-                       dst_fmt_lable = (char *)"RGBA8888";
-                       break;
-               case MM_UTIL_IMG_FMT_BGRX8888:
-                       dst_fmt_lable = (char *)"BGRX";
-                       break;
-               default:
-                       mm_util_error("[%d] Not supported format", dst_format);
-                       break;
+       case MM_UTIL_IMG_FMT_YUV420:
+               dst_fmt_lable = (char *)"YV12";
+               break;
+       case MM_UTIL_IMG_FMT_YUV422:
+               dst_fmt_lable = (char *)"Y42B";
+               break;
+       case MM_UTIL_IMG_FMT_I420:
+               dst_fmt_lable = (char *)"I420";
+               break;
+       case MM_UTIL_IMG_FMT_NV12:
+               dst_fmt_lable = (char *)"NV12";
+               break;
+       case MM_UTIL_IMG_FMT_UYVY:
+               dst_fmt_lable = (char *)"UYVY";
+               break;
+       case MM_UTIL_IMG_FMT_YUYV:
+               dst_fmt_lable = (char *)"YUYV";
+               break;
+       case MM_UTIL_IMG_FMT_RGB565:
+               dst_fmt_lable = (char *)"RGB565";
+               break;
+       case MM_UTIL_IMG_FMT_RGB888:
+               dst_fmt_lable = (char *)"RGB888";
+               break;
+       case MM_UTIL_IMG_FMT_ARGB8888:
+               dst_fmt_lable = (char *)"ARGB8888";
+               break;
+       case MM_UTIL_IMG_FMT_BGRA8888:
+               dst_fmt_lable = (char *)"BGRA8888";
+               break;
+       case MM_UTIL_IMG_FMT_RGBA8888:
+               dst_fmt_lable = (char *)"RGBA8888";
+               break;
+       case MM_UTIL_IMG_FMT_BGRX8888:
+               dst_fmt_lable = (char *)"BGRX";
+               break;
+       default:
+               mm_util_error("[%d] Not supported format", dst_format);
+               break;
        }
 
        if (src_fmt_lable && dst_fmt_lable) {
                mm_util_debug("src_fmt_lable: %s dst_fmt_lable: %s", src_fmt_lable, dst_fmt_lable);
-               _imgp_info_s->input_format_label = (char*)malloc(strlen(src_fmt_lable) + 1);
+               _imgp_info_s->input_format_label = (char *)malloc(strlen(src_fmt_lable) + 1);
                if (_imgp_info_s->input_format_label == NULL) {
                        mm_util_error("[input] input_format_label is null");
                        return MM_UTIL_ERROR_OUT_OF_MEMORY;
@@ -491,7 +490,7 @@ static int __mm_set_format_label(imgp_info_s * _imgp_info_s, mm_util_img_format
                memset(_imgp_info_s->input_format_label, 0, strlen(src_fmt_lable) + 1);
                strncpy(_imgp_info_s->input_format_label, src_fmt_lable, strlen(src_fmt_lable));
 
-               _imgp_info_s->output_format_label = (char*)malloc(strlen(dst_fmt_lable) + 1);
+               _imgp_info_s->output_format_label = (char *)malloc(strlen(dst_fmt_lable) + 1);
                if (_imgp_info_s->output_format_label == NULL) {
                        mm_util_error("[input] input_format_label is null");
                        IMGP_FREE(_imgp_info_s->input_format_label);
@@ -509,7 +508,7 @@ static int __mm_set_format_label(imgp_info_s * _imgp_info_s, mm_util_img_format
        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_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)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -541,16 +540,15 @@ static int __mm_set_imgp_info_s(imgp_info_s * _imgp_info_s, mm_util_img_format s
        return ret;
 }
 
-static GModule * __mm_util_imgp_initialize(imgp_plugin_type_e _imgp_plugin_type_e)
+static GModule *__mm_util_imgp_initialize(imgp_plugin_type_e _imgp_plugin_type_e)
 {
        GModule *module = NULL;
        mm_util_fenter();
 
-       if (_imgp_plugin_type_e == IMGP_NEON) {
+       if (_imgp_plugin_type_e == IMGP_NEON)
                module = g_module_open(PATH_NEON_LIB, G_MODULE_BIND_LAZY);
-       } else if (_imgp_plugin_type_e == IMGP_GSTCS) {
+       else if (_imgp_plugin_type_e == IMGP_GSTCS)
                module = g_module_open(PATH_GSTCS_LIB, G_MODULE_BIND_LAZY);
-       }
 
        if (module == NULL) {
                mm_util_error("%s | %s module open failed", PATH_NEON_LIB, PATH_GSTCS_LIB);
@@ -571,13 +569,13 @@ static IMGPInfoFunc __mm_util_imgp_process(GModule *module)
                return NULL;
        }
 
-       g_module_symbol(module, IMGP_FUNC_NAME, (gpointer*)&mm_util_imgp_func);
+       g_module_symbol(module, IMGP_FUNC_NAME, (gpointer *)&mm_util_imgp_func);
        mm_util_debug("mm_util_imgp_func: %p", mm_util_imgp_func);
 
        return mm_util_imgp_func;
 }
 
-static int _mm_util_transform_packet_finalize_callback(media_packet_h packet, int err, voiduserdata)
+static int _mm_util_transform_packet_finalize_callback(media_packet_h packet, int err, void *userdata)
 {
        mm_util_debug("==> finalize callback func is called [%d] \n", err);
        return MEDIA_PACKET_FINALIZE;
@@ -786,46 +784,46 @@ static media_format_mimetype_e __mm_util_mapping_imgp_format_to_mime(mm_util_img
        media_format_mimetype_e mimetype = -1;
 
        switch (format) {
-               case MM_UTIL_IMG_FMT_NV12:
-                       mimetype = MEDIA_FORMAT_NV12;
-                       break;
-               case MM_UTIL_IMG_FMT_NV16:
-                       mimetype = MEDIA_FORMAT_NV16;
-                       break;
-               case MM_UTIL_IMG_FMT_YUYV:
-                       mimetype = MEDIA_FORMAT_YUYV;
-                       break;
-               case MM_UTIL_IMG_FMT_UYVY:
-                       mimetype = MEDIA_FORMAT_UYVY;
-                       break;
-               case MM_UTIL_IMG_FMT_YUV422:
-                       mimetype = MEDIA_FORMAT_422P;
-                       break;
-               case MM_UTIL_IMG_FMT_I420:
-                       mimetype = MEDIA_FORMAT_I420;
-                       break;
-               case MM_UTIL_IMG_FMT_YUV420:
-                       mimetype = MEDIA_FORMAT_YV12;
-                       break;
-               case MM_UTIL_IMG_FMT_RGB565:
-                       mimetype = MEDIA_FORMAT_RGB565;
-                       break;
-               case MM_UTIL_IMG_FMT_RGB888:
-                       mimetype = MEDIA_FORMAT_RGB888;
-                       break;
-               case MM_UTIL_IMG_FMT_RGBA8888:
-                       mimetype = MEDIA_FORMAT_RGBA;
-                       break;
-               case MM_UTIL_IMG_FMT_ARGB8888:
-                       mimetype = MEDIA_FORMAT_ARGB;
-                       break;
-               case MM_UTIL_IMG_FMT_NV12_TILED:
-                       mimetype = MEDIA_FORMAT_NV12T;
-                       break;
-               default:
-                       mimetype = -1;
-                       mm_util_error("Not Supported Format [%d]", format);
-                       break;
+       case MM_UTIL_IMG_FMT_NV12:
+               mimetype = MEDIA_FORMAT_NV12;
+               break;
+       case MM_UTIL_IMG_FMT_NV16:
+               mimetype = MEDIA_FORMAT_NV16;
+               break;
+       case MM_UTIL_IMG_FMT_YUYV:
+               mimetype = MEDIA_FORMAT_YUYV;
+               break;
+       case MM_UTIL_IMG_FMT_UYVY:
+               mimetype = MEDIA_FORMAT_UYVY;
+               break;
+       case MM_UTIL_IMG_FMT_YUV422:
+               mimetype = MEDIA_FORMAT_422P;
+               break;
+       case MM_UTIL_IMG_FMT_I420:
+               mimetype = MEDIA_FORMAT_I420;
+               break;
+       case MM_UTIL_IMG_FMT_YUV420:
+               mimetype = MEDIA_FORMAT_YV12;
+               break;
+       case MM_UTIL_IMG_FMT_RGB565:
+               mimetype = MEDIA_FORMAT_RGB565;
+               break;
+       case MM_UTIL_IMG_FMT_RGB888:
+               mimetype = MEDIA_FORMAT_RGB888;
+               break;
+       case MM_UTIL_IMG_FMT_RGBA8888:
+               mimetype = MEDIA_FORMAT_RGBA;
+               break;
+       case MM_UTIL_IMG_FMT_ARGB8888:
+               mimetype = MEDIA_FORMAT_ARGB;
+               break;
+       case MM_UTIL_IMG_FMT_NV12_TILED:
+               mimetype = MEDIA_FORMAT_NV12T;
+               break;
+       default:
+               mimetype = -1;
+               mm_util_error("Not Supported Format [%d]", format);
+               break;
        }
 
        mm_util_debug("imgp fmt: %d mimetype fmt: %d", format, mimetype);
@@ -838,46 +836,46 @@ static mm_util_img_format __mm_util_mapping_mime_format_to_imgp(media_format_mim
        mm_util_img_format format = -1;
 
        switch (mimetype) {
-               case MEDIA_FORMAT_NV12:
-                       format = MM_UTIL_IMG_FMT_NV12;
-                       break;
-               case MEDIA_FORMAT_NV16:
-                       format = MM_UTIL_IMG_FMT_NV16;
-                       break;
-               case MEDIA_FORMAT_YUYV:
-                       format = MM_UTIL_IMG_FMT_YUYV;
-                       break;
-               case MEDIA_FORMAT_UYVY:
-                       format = MM_UTIL_IMG_FMT_UYVY;
-                       break;
-               case MEDIA_FORMAT_422P:
-                       format = MM_UTIL_IMG_FMT_YUV422;
-                       break;
-               case MEDIA_FORMAT_I420:
-                       format = MM_UTIL_IMG_FMT_I420;
-                       break;
-               case MEDIA_FORMAT_YV12:
-                       format = MM_UTIL_IMG_FMT_YUV420;
-                       break;
-               case MEDIA_FORMAT_RGB565:
-                       format = MM_UTIL_IMG_FMT_RGB565;
-                       break;
-               case MEDIA_FORMAT_RGB888:
-                       format = MM_UTIL_IMG_FMT_RGB888;
-                       break;
-               case MEDIA_FORMAT_RGBA:
-                       format = MM_UTIL_IMG_FMT_RGBA8888;
-                       break;
-               case MEDIA_FORMAT_ARGB:
-                       format = MM_UTIL_IMG_FMT_ARGB8888;
-                       break;
-               case MEDIA_FORMAT_NV12T:
-                       format = MM_UTIL_IMG_FMT_NV12_TILED;
-                       break;
-               default:
-                       format = -1;
-                       mm_util_error("Not Supported Format [%d]", mimetype);
-                       break;
+       case MEDIA_FORMAT_NV12:
+               format = MM_UTIL_IMG_FMT_NV12;
+               break;
+       case MEDIA_FORMAT_NV16:
+               format = MM_UTIL_IMG_FMT_NV16;
+               break;
+       case MEDIA_FORMAT_YUYV:
+               format = MM_UTIL_IMG_FMT_YUYV;
+               break;
+       case MEDIA_FORMAT_UYVY:
+               format = MM_UTIL_IMG_FMT_UYVY;
+               break;
+       case MEDIA_FORMAT_422P:
+               format = MM_UTIL_IMG_FMT_YUV422;
+               break;
+       case MEDIA_FORMAT_I420:
+               format = MM_UTIL_IMG_FMT_I420;
+               break;
+       case MEDIA_FORMAT_YV12:
+               format = MM_UTIL_IMG_FMT_YUV420;
+               break;
+       case MEDIA_FORMAT_RGB565:
+               format = MM_UTIL_IMG_FMT_RGB565;
+               break;
+       case MEDIA_FORMAT_RGB888:
+               format = MM_UTIL_IMG_FMT_RGB888;
+               break;
+       case MEDIA_FORMAT_RGBA:
+               format = MM_UTIL_IMG_FMT_RGBA8888;
+               break;
+       case MEDIA_FORMAT_ARGB:
+               format = MM_UTIL_IMG_FMT_ARGB8888;
+               break;
+       case MEDIA_FORMAT_NV12T:
+               format = MM_UTIL_IMG_FMT_NV12_TILED;
+               break;
+       default:
+               format = -1;
+               mm_util_error("Not Supported Format [%d]", mimetype);
+               break;
        }
 
        mm_util_debug("mimetype: %d imgp fmt: %d", mimetype, format);
@@ -887,7 +885,7 @@ static mm_util_img_format __mm_util_mapping_mime_format_to_imgp(media_format_mim
 
 gpointer _mm_util_thread_repeate(gpointer data)
 {
-       mm_util_s* handle = (mm_util_s*) data;
+       mm_util_s *handle = (mm_util_s *) data;
        int ret = MM_UTIL_ERROR_NONE;
        gint64 end_time = 0;
 
@@ -915,11 +913,11 @@ gpointer _mm_util_thread_repeate(gpointer data)
                        mm_util_error("[NULL] Queue data");
                } else {
                        ret = __mm_util_transform_exec(handle, pop_data); /* Need to block */
-                       if (ret == MM_UTIL_ERROR_NONE) {
+                       if (ret == MM_UTIL_ERROR_NONE)
                                mm_util_debug("Success - transform_exec");
-                       } else{
+                       else
                                mm_util_error("Error - transform_exec");
-                       }
+
                        if (handle->_util_cb->completed_cb) {
                                mm_util_debug("completed_cb");
                                handle->_util_cb->completed_cb(&handle->dst_packet, ret, handle->_util_cb->user_data);
@@ -947,11 +945,10 @@ static int __mm_util_create_thread(mm_util_s *handle)
        g_mutex_init(&(handle->thread_mutex));
 
        /*These are a communicator for thread*/
-       if (!handle->queue) {
+       if (!handle->queue)
                handle->queue = g_async_queue_new();
-       } else {
+       else
                mm_util_error("ERROR - async queue is already created");
-       }
 
        g_cond_init(&(handle->thread_cond));
 
@@ -1097,14 +1094,14 @@ static int __mm_util_processing(mm_util_s *handle)
                if (handle->set_resize || handle->set_crop) {
                        unsigned int temp_swap = 0;
                        switch (handle->dst_rotation) {
-                               case  MM_UTIL_ROTATION_90:
-                               case MM_UTIL_ROTATION_270:
-                                       temp_swap = handle->dst_width;
-                                       handle->dst_width  = handle->dst_height;
-                                       handle->dst_height = temp_swap;
-                                       break;
-                               default:
-                                       break;
+                       case  MM_UTIL_ROTATION_90:
+                       case MM_UTIL_ROTATION_270:
+                               temp_swap = handle->dst_width;
+                               handle->dst_width  = handle->dst_height;
+                               handle->dst_height = temp_swap;
+                               break;
+                       default:
+                               break;
                        }
                }
                mm_util_get_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
@@ -1140,7 +1137,7 @@ static int __mm_util_processing(mm_util_s *handle)
        return ret;
 }
 
-static int __mm_util_transform_exec(mm_util_s * handle, media_packet_h src_packet)
+static int __mm_util_transform_exec(mm_util_s *handle, media_packet_h src_packet)
 {
        int ret = MM_UTIL_ERROR_NONE;
        media_format_h src_fmt;
@@ -1155,9 +1152,8 @@ static int __mm_util_transform_exec(mm_util_s * handle, media_packet_h src_packe
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if (media_format_get_video_info(src_fmt, &src_mimetype, &src_width, &src_height, &src_avg_bps, &src_max_bps) == MEDIA_FORMAT_ERROR_NONE) {
+       if (media_format_get_video_info(src_fmt, &src_mimetype, &src_width, &src_height, &src_avg_bps, &src_max_bps) == MEDIA_FORMAT_ERROR_NONE)
                mm_util_debug("[Fotmat: %d] W x H : %d x %d", src_mimetype, src_width, src_height);
-       }
 
        if (__mm_util_check_resolution(src_width, src_height)) {
                /* src */
@@ -1190,33 +1186,33 @@ static int __mm_util_transform_exec(mm_util_s * handle, media_packet_h src_packe
                if (handle->set_rotate) {
                        if ((handle->set_crop) || (handle->set_resize)) {
                                switch (handle->dst_rotation) {
-                                       case MM_UTIL_ROTATION_90:
-                                       case MM_UTIL_ROTATION_270:
-                                               dst_width = handle->dst_height;
-                                               dst_height = handle->dst_width;
-                                               break;
-                                       default:
-                                               dst_width = handle->dst_width;
-                                               dst_height = handle->dst_height;
-                                               break;
+                               case MM_UTIL_ROTATION_90:
+                               case MM_UTIL_ROTATION_270:
+                                       dst_width = handle->dst_height;
+                                       dst_height = handle->dst_width;
+                                       break;
+                               default:
+                                       dst_width = handle->dst_width;
+                                       dst_height = handle->dst_height;
+                                       break;
                                }
                        } else {
                                switch (handle->dst_rotation) {
-                                       case MM_UTIL_ROTATION_90:
-                                       case MM_UTIL_ROTATION_270:
-                                               dst_width = handle->dst_width  = handle->src_height;
-                                               dst_height = handle->dst_height = handle->src_width;
-                                               break;
-                                       case MM_UTIL_ROTATION_NONE:
-                                       case MM_UTIL_ROTATION_180:
-                                       case MM_UTIL_ROTATION_FLIP_HORZ:
-                                       case MM_UTIL_ROTATION_FLIP_VERT:
-                                               dst_width = handle->dst_width  = handle->src_width;
-                                               dst_height = handle->dst_height = handle->src_height;
-                                               break;
-                                       default:
-                                               mm_util_error("[Error] Wrong dst_rotation");
-                                               break;
+                               case MM_UTIL_ROTATION_90:
+                               case MM_UTIL_ROTATION_270:
+                                       dst_width = handle->dst_width  = handle->src_height;
+                                       dst_height = handle->dst_height = handle->src_width;
+                                       break;
+                               case MM_UTIL_ROTATION_NONE:
+                               case MM_UTIL_ROTATION_180:
+                               case MM_UTIL_ROTATION_FLIP_HORZ:
+                               case MM_UTIL_ROTATION_FLIP_VERT:
+                                       dst_width = handle->dst_width  = handle->src_width;
+                                       dst_height = handle->dst_height = handle->src_height;
+                                       break;
+                               default:
+                                       mm_util_error("[Error] Wrong dst_rotation");
+                                       break;
                                }
                        }
                } else {
@@ -1471,7 +1467,7 @@ int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsi
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:SET_CROP_AREA");
 
-       unsigned int dest_width = end_x -start_x;
+       unsigned int dest_width = end_x - start_x;
        unsigned int dest_height = end_y - start_y;
 
        if (!handle) {
@@ -1490,7 +1486,7 @@ int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsi
        return ret;
 }
 
-int mm_util_transform(mm_util_imgp_h imgp_handle, media_packet_h src_packet, mm_util_completed_callback completed_callback, void * user_data)
+int mm_util_transform(mm_util_imgp_h imgp_handle, media_packet_h src_packet, mm_util_completed_callback completed_callback, void *user_data)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) imgp_handle;
@@ -1569,7 +1565,7 @@ int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_complete
 int mm_util_destroy(mm_util_imgp_h imgp_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s*) imgp_handle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:DESTROY");
 
@@ -1624,7 +1620,7 @@ EXPORT_API int mm_util_convert_colorspace(const unsigned char *src, unsigned int
 
        mm_util_debug("[src] 0x%2x (%d x %d) [dst] 0x%2x", src, src_width, src_height, dst);
 
-       imgp_info_s* _imgp_info_s = (imgp_info_s*)g_malloc0(sizeof(imgp_info_s));
+       imgp_info_s *_imgp_info_s = (imgp_info_s *) g_malloc0(sizeof(imgp_info_s));
        if (_imgp_info_s == NULL) {
                mm_util_error("ERROR - alloc handle");
                TTRACE_END();
@@ -1636,11 +1632,10 @@ EXPORT_API int mm_util_convert_colorspace(const unsigned char *src, unsigned int
        imgp_plugin_type_e _imgp_plugin_type_e = 0;
 
        /* Initialize */
-       if (__mm_select_convert_plugin(src_format, dst_format)) {
+       if (__mm_select_convert_plugin(src_format, dst_format))
                _imgp_plugin_type_e = IMGP_NEON;
-       } else {
+       else
                _imgp_plugin_type_e = IMGP_GSTCS;
-       }
 
        mm_util_debug("plugin type: %d", _imgp_plugin_type_e);
 
@@ -1671,7 +1666,7 @@ EXPORT_API int mm_util_convert_colorspace(const unsigned char *src, unsigned int
                return ret;
        }
 
-       output_buffer = (unsigned char*)malloc(output_buffer_size);
+       output_buffer = (unsigned char *) malloc(output_buffer_size);
        if (output_buffer == NULL) {
                mm_util_error("malloc failed");
                __mm_util_imgp_finalize(_module, _imgp_info_s);
@@ -1771,7 +1766,7 @@ EXPORT_API int mm_util_resize_image(const unsigned char *src, unsigned int src_w
 
        mm_util_debug("[src] 0x%2x (%d x %d) [dst] 0x%2x", src, src_width, src_height, dst);
 
-       imgp_info_s* _imgp_info_s = (imgp_info_s*)g_malloc0(sizeof(imgp_info_s));
+       imgp_info_s *_imgp_info_s = (imgp_info_s *) g_malloc0(sizeof(imgp_info_s));
        if (_imgp_info_s == NULL) {
                mm_util_error("ERROR - alloc handle");
                TTRACE_END();
@@ -1783,11 +1778,11 @@ EXPORT_API int mm_util_resize_image(const unsigned char *src, unsigned int src_w
        imgp_plugin_type_e _imgp_plugin_type_e = 0;
 
        /* Initialize */
-       if (__mm_select_resize_plugin(src_format)) {
+       if (__mm_select_resize_plugin(src_format))
                _imgp_plugin_type_e = IMGP_NEON;
-       } else {
+       else
                _imgp_plugin_type_e = IMGP_GSTCS;
-       }
+
        mm_util_debug("plugin type: %d", _imgp_plugin_type_e);
 
        _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
@@ -1827,7 +1822,7 @@ EXPORT_API int mm_util_resize_image(const unsigned char *src, unsigned int src_w
                return ret;
        }
 
-       output_buffer = (unsigned char*)malloc(output_buffer_size);
+       output_buffer = (unsigned char *) malloc(output_buffer_size);
        if (output_buffer == NULL) {
                mm_util_error("malloc failed");
                __mm_util_imgp_finalize(_module, _imgp_info_s);
@@ -1932,7 +1927,7 @@ EXPORT_API int mm_util_rotate_image(const unsigned char *src, unsigned int src_w
 
        mm_util_debug("[src] 0x%2x (%d x %d) [dst] 0x%2x", src, src_width, src_height, dst);
 
-       imgp_info_s* _imgp_info_s = (imgp_info_s*)g_malloc0(sizeof(imgp_info_s));
+       imgp_info_s *_imgp_info_s = (imgp_info_s *) g_malloc0(sizeof(imgp_info_s));
        if (_imgp_info_s == NULL) {
                mm_util_error("ERROR - alloc handle");
                TTRACE_END();
@@ -1943,11 +1938,11 @@ EXPORT_API int mm_util_rotate_image(const unsigned char *src, unsigned int src_w
        imgp_plugin_type_e _imgp_plugin_type_e = 0;
 
        /* Initialize */
-       if (__mm_select_rotate_plugin(src_format, src_width, src_height, angle)) {
+       if (__mm_select_rotate_plugin(src_format, src_width, src_height, angle))
                _imgp_plugin_type_e = IMGP_NEON;
-       } else {
+       else
                _imgp_plugin_type_e = IMGP_GSTCS;
-       }
+
        mm_util_debug("plugin type: %d", _imgp_plugin_type_e);
 
        _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
@@ -1994,7 +1989,7 @@ EXPORT_API int mm_util_rotate_image(const unsigned char *src, unsigned int src_w
                return ret;
        }
 
-       output_buffer = (unsigned char*)malloc(output_buffer_size);
+       output_buffer = (unsigned char *) malloc(output_buffer_size);
        if (output_buffer == NULL) {
                mm_util_error("malloc failed");
                __mm_util_imgp_finalize(_module, _imgp_info_s);
@@ -2094,41 +2089,41 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_wi
        }
 
        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);
-                       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);
-                       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);
-                       break;
-                       }
-               case MM_UTIL_IMG_FMT_I420:
-               case MM_UTIL_IMG_FMT_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;
-                               mm_util_debug("Image isplay is suceeded when YUV crop width value %d", *crop_dest_width);
-                       }
+       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);
+               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);
+               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);
+               break;
+               }
+       case MM_UTIL_IMG_FMT_I420:
+       case MM_UTIL_IMG_FMT_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;
+                       mm_util_debug("Image isplay is suceeded when YUV crop width value %d", *crop_dest_width);
+               }
 
-                       if ((*crop_dest_height % 2) != 0) { /* height value must be also even when crop yuv image */
-                               mm_util_warn("#YUV Height value(%d) must be even at least# ", *crop_dest_height);
-                               *crop_dest_height = ((*crop_dest_height+1)>>1)<<1;
-                               mm_util_debug("Image isplay is suceeded when YUV crop height value %d", *crop_dest_height);
-                       }
+               if ((*crop_dest_height % 2) != 0) { /* height value must be also even when crop yuv image */
+                       mm_util_warn("#YUV Height value(%d) must be even at least# ", *crop_dest_height);
+                       *crop_dest_height = ((*crop_dest_height+1)>>1)<<1;
+                       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);
-                       break;
-                       }
-               default:
-                       mm_util_debug("Not supported format");
-                       ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
+               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);
+               break;
+               }
+       default:
+               mm_util_debug("Not supported format");
+               ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        }
 
        TTRACE_END();
@@ -2160,69 +2155,69 @@ EXPORT_API int mm_util_get_image_size(mm_util_img_format format, unsigned int wi
        }
 
        switch (format) {
-               case MM_UTIL_IMG_FMT_I420:
-               case MM_UTIL_IMG_FMT_YUV420:
-                       x_chroma_shift = 1;
-                       y_chroma_shift = 1;
-                       stride = MM_UTIL_ROUND_UP_4(width);
-                       h2 = ROUND_UP_X(height, x_chroma_shift);
-                       size = stride * h2;
-                       w2 = DIV_ROUND_UP_X(width, x_chroma_shift);
-                       stride2 = MM_UTIL_ROUND_UP_4(w2);
-                       h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
-                       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:
-                       stride = MM_UTIL_ROUND_UP_4(width) * 2;
-                       size = stride * height;
-                       *imgsize = size;
-                       break;
-
-               case MM_UTIL_IMG_FMT_RGB565:
-                       stride = MM_UTIL_ROUND_UP_4(width) * 2;
-                       size = stride * height;
-                       *imgsize = size;
-                       break;
-
-               case MM_UTIL_IMG_FMT_RGB888:
-                       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:
-                       stride = width * 4;
-                       size = stride * height;
-                       *imgsize = size;
-                       break;
-
-
-               case MM_UTIL_IMG_FMT_NV12:
-               case MM_UTIL_IMG_FMT_NV12_TILED:
-                       x_chroma_shift = 1;
-                       y_chroma_shift = 1;
-                       stride = MM_UTIL_ROUND_UP_4(width);
-                       h2 = ROUND_UP_X(height, y_chroma_shift);
-                       size = stride * h2;
-                       w2 = 2 * DIV_ROUND_UP_X(width, x_chroma_shift);
-                       stride2 = MM_UTIL_ROUND_UP_4(w2);
-                       h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
-                       size2 = stride2 * h2;
-                       *imgsize = size + size2;
-                       break;
-
-               default:
-                       mm_util_error("Not supported format");
-                       TTRACE_END();
-                       return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
+       case MM_UTIL_IMG_FMT_I420:
+       case MM_UTIL_IMG_FMT_YUV420:
+               x_chroma_shift = 1;
+               y_chroma_shift = 1;
+               stride = MM_UTIL_ROUND_UP_4(width);
+               h2 = ROUND_UP_X(height, x_chroma_shift);
+               size = stride * h2;
+               w2 = DIV_ROUND_UP_X(width, x_chroma_shift);
+               stride2 = MM_UTIL_ROUND_UP_4(w2);
+               h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
+               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:
+               stride = MM_UTIL_ROUND_UP_4(width) * 2;
+               size = stride * height;
+               *imgsize = size;
+               break;
+
+       case MM_UTIL_IMG_FMT_RGB565:
+               stride = MM_UTIL_ROUND_UP_4(width) * 2;
+               size = stride * height;
+               *imgsize = size;
+               break;
+
+       case MM_UTIL_IMG_FMT_RGB888:
+               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:
+               stride = width * 4;
+               size = stride * height;
+               *imgsize = size;
+               break;
+
+
+       case MM_UTIL_IMG_FMT_NV12:
+       case MM_UTIL_IMG_FMT_NV12_TILED:
+               x_chroma_shift = 1;
+               y_chroma_shift = 1;
+               stride = MM_UTIL_ROUND_UP_4(width);
+               h2 = ROUND_UP_X(height, y_chroma_shift);
+               size = stride * h2;
+               w2 = 2 * DIV_ROUND_UP_X(width, x_chroma_shift);
+               stride2 = MM_UTIL_ROUND_UP_4(w2);
+               h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
+               size2 = stride2 * h2;
+               *imgsize = size + size2;
+               break;
+
+       default:
+               mm_util_error("Not supported format");
+               TTRACE_END();
+               return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        }
        mm_util_debug("format: %d, *imgsize: %d\n", format, *imgsize);
 
index 99a4998..ec69dd2 100755 (executable)
@@ -95,7 +95,7 @@ media_format_mimetype_e _format_to_mime(mm_util_img_format colorspace)
        return mimetype;
 }
 
-int _packet_finalize_callback(media_packet_h packet, int err, voiduser_data)
+int _packet_finalize_callback(media_packet_h packet, int err, void *user_data)
 {
        mm_util_debug("==> finalize callback func is called [%d] \n", err);
        return MEDIA_PACKET_FINALIZE;
@@ -149,16 +149,16 @@ int main(int argc, char *argv[])
        void *src;
        unsigned char *dst = NULL;
 
-       if (argc < 9) {
+       if (argc < 12) {
                fprintf(stderr, "Usage: mm_util_imgp_testsuite sync {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n");
                fprintf(stderr, "Usage: mm_util_imgp_testsuite async {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n");
-               fprintf(stderr, "ex: mm_util_imgp_testsuite s test.rgb resize 1920 1080 7 1280 720 7 0 0 0 \n");
+               fprintf(stderr, "ex: mm_util_imgp_testsuite sync test.rgb resize 1920 1080 7 1280 720 7 0 0 0 \n");
                return ret;
        }
 
        uint64_t src_size = 0;
        uint64_t dst_size = 0;
-       bool sync_mode = (strcmp(argv[1], "sync") == 0)?TRUE:FALSE;
+       bool sync_mode = (strcmp(argv[1], "sync") == 0) ? TRUE : FALSE;
        char *command = NULL;
        unsigned int src_width = atoi(argv[4]);
        unsigned int src_height = atoi(argv[5]);
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
 
        mm_util_debug("command: %s src_width: %d, src_height: %d, src_format: %d, dst_width: %d, dst_height: %d, dst_format:%d, rotation:%d", command, src_width, src_height, src_format, dst_width, dst_height, dst_format, rotation);
 
-       // mem allocation for src dst buffer
+       /* mem allocation for src dst buffer */
        mm_util_get_image_size(src_format, src_width, src_height, &size);
        src_size = (uint64_t)size;
        mm_util_get_image_size(dst_format, dst_width, dst_height, &size);
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
        src = malloc(src_size);
        dst = malloc(dst_size);
 
-       { // read input file
+       { /* read input file */
                FILE *fp = fopen(argv[2], "r");
                if (fp == NULL) {
                        mm_util_debug("\tfile open failed %d\n", errno);
@@ -204,11 +204,10 @@ int main(int argc, char *argv[])
                        goto TEST_FAIL;
                }
 
-               if(fread(src, 1, (int)src_size, fp)) {
+               if (fread(src, 1, (int)src_size, fp))
                        mm_util_debug("#Success# fread");
-               } else {
+               else
                        mm_util_error("#Error# fread");
-               }
 
                if (src == NULL || src_size <= 0) {
                        mm_util_error("#Error# fread");
@@ -217,41 +216,40 @@ int main(int argc, char *argv[])
 
        }
 
-       {  // ready output file
-               char *output_fmt = (char*)malloc(sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
+       {  /* ready output file */
+               char *output_fmt = (char *) g_malloc(sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
                memset(output_fmt, 0, IMAGE_FORMAT_LABEL_BUFFER_SIZE);
-               if(dst_format == MM_UTIL_IMG_FMT_YUV420 ||
+               if (dst_format == MM_UTIL_IMG_FMT_YUV420 ||
                        dst_format == MM_UTIL_IMG_FMT_YUV422 ||
                        dst_format == MM_UTIL_IMG_FMT_I420) {
                        strncpy(output_fmt, "yuv", strlen("yuv"));
                } else {
-                       strncpy(output_fmt,"rgb", strlen("rgb"));
+                       strncpy(output_fmt, "rgb", strlen("rgb"));
                }
                snprintf(output_file, 40, "result_%s_%dx%d.%s", command, dst_width, dst_height, output_fmt);
        }
 
        if (sync_mode) {
                mm_util_debug("SYNC");
-               if (strcmp(command, "convert") == 0) {
+               if (strcmp(command, "convert") == 0)
                        ret = mm_util_convert_colorspace(src, src_width, src_height, src_format, dst, dst_format);
-               } else if (strcmp(command, "resize") == 0) {
+               else if (strcmp(command, "resize") == 0)
                        ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height);
-               } else if (strcmp(command, "rotate") == 0) {
+               else if (strcmp(command, "rotate") == 0)
                        ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, rotation);
-               } else if (strcmp(command, "crop") == 0) {
+               else if (strcmp(command, "crop") == 0)
                        ret = mm_util_crop_image(src, src_width, src_height, src_format, start_x, start_y, &dst_width, &dst_height, dst);
-               }
 
-               if(ret == MM_UTIL_ERROR_NONE) {
+               if (ret == MM_UTIL_ERROR_NONE) {
                        mm_util_debug("Success - %s", command);
                } else {
                        mm_util_debug("ERROR - %s", command);
                        goto TEST_FAIL;
                }
 
-               {  // write output file
+               {  /* write output file */
                        FILE *fpout = fopen(output_file, "w");
-                       if(fpout) {
+                       if (fpout) {
                                mm_util_debug("dst: %p [%d]", dst, dst_size);
                                fwrite(dst, 1, dst_size, fpout);
                                mm_util_debug("FREE");
index d648c96..17af430 100755 (executable)
 #include <ttrace.h>
 #define TTRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_IMAGE, NAME)
 #define TTRACE_END() traceEnd(TTRACE_TAG_IMAGE)
-#else //ENABLE_TTRACE
+#else /* ENABLE_TTRACE */
 #define TTRACE_BEGIN(NAME)
 #define TTRACE_END()
-#endif //ENABLE_TTRACE
+#endif /* ENABLE_TTRACE */
 
 #ifndef YUV420_SIZE
 #define YUV420_SIZE(width, height)     (width*height*3>>1)
@@ -143,7 +143,7 @@ static void _mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char *
        unsigned long dstSize = 0;
        int i = 0, n = 0;
        tjscalingfactor _sf;
-       tjscalingfactor*sf = tjGetScalingFactors(&n), sf1 = {1, 1};
+       tjscalingfactor *sf = tjGetScalingFactors(&n), sf1 = {1, 1};
 
        if (jpegBuf == NULL) {
                mm_util_error("jpegBuf is NULL");
@@ -159,21 +159,19 @@ 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_JPEG_FMT_RGB888)
                _sf = sf[i];
-       } else {
+       else
                _sf = sf1;
-       }
 
        scaledWidth = TJSCALED(_hdrw, _sf);
        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_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422)
                mm_util_debug("JPEG -> YUV %s ... ", subName[_hdrsubsamp]);
-       } else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888) {
+       else if (input_fmt == MM_UTIL_JPEG_FMT_RGB888)
                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) {
                dstSize = TJBUFSIZEYUV(_hdrw, _hdrh, _hdrsubsamp);
@@ -184,7 +182,7 @@ static void _mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char *
                mm_util_debug("MM_UTIL_JPEG_FMT_RGB888 dstSize: %d _hdrsubsamp:%d", dstSize, _hdrsubsamp);
        }
 
-       if ((decoded_data->data = (void*)malloc(dstSize)) == NULL) {
+       if ((decoded_data->data = (void *)malloc(dstSize)) == NULL) {
                mm_util_error("dstBuf is NULL");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
@@ -214,20 +212,18 @@ static void _mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char *
                        mm_util_debug("_hdrsubsamp == TJSAMP_422", decoded_data->width, _hdrw);
                        decoded_data->width = MM_JPEG_ROUND_UP_2(_hdrw);
                } else {
-                       if (_hdrw % 4 != 0) {
+                       if (_hdrw % 4 != 0)
                                decoded_data->width = MM_JPEG_ROUND_UP_4(_hdrw);
-                       } else {
+                       else
                                decoded_data->width = _hdrw;
-                       }
                }
 
                if (_hdrsubsamp == TJSAMP_420) {
                        mm_util_debug("_hdrsubsamp == TJSAMP_420", decoded_data->width, _hdrw);
-                       if (_hdrh % 4 != 0) {
+                       if (_hdrh % 4 != 0)
                                decoded_data->height = MM_JPEG_ROUND_UP_4(_hdrh);
-                       } else {
-                       decoded_data->height = _hdrh;
-                       }
+                       else
+                               decoded_data->height = _hdrh;
                } else {
                        decoded_data->height = _hdrh;
                }
@@ -235,7 +231,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_jpeg_yuv_format input_fmt)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        tjhandle dhandle = NULL;
@@ -258,7 +254,7 @@ static int mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_da
                mm_util_error("dhandle=tjInitDecompress()) is NULL");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
-       srcBuf = (unsigned char *)malloc(sizeof(char) * jpegSize);
+       srcBuf = (unsigned char *) malloc(sizeof(char) * jpegSize);
        if (srcBuf == NULL) {
                fclose(src);
                tjDestroy(dhandle);
@@ -272,17 +268,15 @@ static int mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_da
        fclose(src);
        mm_util_debug("fclose");
 
-       if (dhandle) {
+       if (dhandle)
                tjDestroy(dhandle);
-       }
-       if (srcBuf) {
+       if (srcBuf)
                tjFree(srcBuf);
-       }
 
        return iErrorCode;
 }
 
-static int mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_data * decoded_data, void *src, 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, int size, mm_util_jpeg_yuv_format input_fmt)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        tjhandle dhandle = NULL;
@@ -293,7 +287,7 @@ static int mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_
                mm_util_error("dhandle=tjInitDecompress()) is NULL");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
-       srcBuf = (unsigned char *)malloc(sizeof(char) * size);
+       srcBuf = (unsigned char *) malloc(sizeof(char) * size);
        if (srcBuf == NULL) {
                fclose(src);
                tjDestroy(dhandle);
@@ -304,12 +298,10 @@ static int mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_
        mm_util_debug("srcBuf[0]: 0x%2x, srcBuf[1]: 0x%2x, jpegSize:%d", srcBuf[0], srcBuf[1], size);
        _mm_decode_libjpeg_turbo_decompress(dhandle, src, size, TD_BU, decoded_data, input_fmt);
 
-       if (dhandle) {
+       if (dhandle)
                tjDestroy(dhandle);
-       }
-       if (srcBuf) {
+       if (srcBuf)
                tjFree(srcBuf);
-       }
 
        return iErrorCode;
 }
@@ -392,12 +384,10 @@ static int mm_image_encode_to_jpeg_file_with_libjpeg_turbo(char *filename, void*
        mm_util_debug("dstBuf: %p\t size: %d", dstBuf, size);
        fwrite(dstBuf, 1, size, fout);
        fclose(fout);
-       if (chandle) {
+       if (chandle)
                tjDestroy(chandle);
-       }
-       if (dstBuf) {
+       if (dstBuf)
                tjFree(dstBuf);
-       }
        mm_util_debug("Done");
        return iErrorCode;
 }
@@ -432,9 +422,8 @@ static int mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(void **mem, int *cs
        mm_util_debug("width: %d height: %d, size: %d", w, h, *csize);
        _mm_encode_libjpeg_turbo_compress(chandle, rawdata, mem, csize, w, h, quality, TD_BU, fmt);
        mm_util_debug("dstBuf: %p &dstBuf:%p size: %d", *mem, mem, *csize);
-       if (chandle) {
+       if (chandle)
                tjDestroy(chandle);
-       }
        return iErrorCode;
 }
 #endif
@@ -445,15 +434,15 @@ struct my_error_mgr_s {
        jmp_buf setjmp_buffer; /* for return to caller */
 } my_error_mgr_s;
 
-typedef struct my_error_mgr_s * my_error_ptr;
+typedef struct my_error_mgr_s *my_error_ptr;
 
 struct {
        struct jpeg_destination_mgr pub; /* public fields */
-       FILE * outfile; /* target stream */
-       JOCTET * buffer; /* start of buffer */
+       FILE *outfile; /* target stream */
+       JOCTET *buffer; /* start of buffer */
 } my_destination_mgr_s;
 
-typedef struct my_destination_mgr_s * my_dest_ptr;
+typedef struct my_destination_mgr_s *my_dest_ptr;
 
 #define OUTPUT_BUF_SIZE  4096  /* choose an efficiently fwrite'able size */
 
@@ -462,14 +451,14 @@ typedef struct my_destination_mgr_s * my_dest_ptr;
 struct {
        struct jpeg_destination_mgr pub; /* public fields */
 
-       unsigned char ** outbuffer; /* target buffer */
-       unsigned long * outsize;
-       unsigned char * newbuffer; /* newly allocated buffer */
-       JOCTET * buffer; /* start of buffer */
+       unsigned char **outbuffer; /* target buffer */
+       unsigned long *outsize;
+       unsigned char *newbuffer; /* newly allocated buffer */
+       JOCTET *buffer; /* start of buffer */
        size_t bufsize;
 } my_mem_destination_mgr;
 
-typedef struct my_mem_destination_mgr * my_mem_dest_ptr;
+typedef struct my_mem_destination_mgr *my_mem_dest_ptr;
 
 static void my_error_exit(j_common_ptr cinfo)
 {
@@ -485,7 +474,7 @@ static int mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, void
        struct jpeg_compress_struct cinfo;
        struct jpeg_error_mgr jerr;
        int i, j, flag, _height;
-       FILE * fpWriter;
+       FILE *fpWriter;
 
        JSAMPROW y[16], cb[16], cr[16]; /* y[2][5] = color sample of row 2 and pixel column 5; (one plane) */
        JSAMPARRAY data[3]; /* t[0][2][5] = color sample 0 of row 2 and column 5 */
@@ -530,11 +519,10 @@ static int mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, void
                cinfo.do_fancy_downsampling = FALSE;
 
                cinfo.comp_info[0].h_samp_factor = 2;
-               if (fmt == MM_UTIL_JPEG_FMT_YUV420) {
+               if (fmt == MM_UTIL_JPEG_FMT_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_JPEG_FMT_YUV422 || fmt == MM_UTIL_JPEG_FMT_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;
                cinfo.comp_info[2].h_samp_factor = 1;
@@ -645,18 +633,16 @@ static int mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, void
                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_JPEG_FMT_RGB888)
                        iRowStride = width * 3;
-               } else if (fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+               else if (fmt == MM_UTIL_JPEG_FMT_GraySacle)
                        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_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888)
                        iRowStride = width * 4;
-               }
 
                JSAMPLE *image_buffer = (JSAMPLE *)rawdata;
                while (cinfo.next_scanline < cinfo.image_height) {
-                       //row_pointer[0] = (JSAMPROW)&rawdata[cinfo.next_scanline * iRowStride];
-                       row_pointer[0] = & image_buffer[cinfo.next_scanline * iRowStride];
+                       row_pointer[0] = &image_buffer[cinfo.next_scanline * iRowStride];
                        jpeg_write_scanlines(&cinfo, row_pointer, 1);
                }
                mm_util_debug("while");
@@ -729,11 +715,10 @@ static int mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, v
                cinfo.do_fancy_downsampling = FALSE;
 
                cinfo.comp_info[0].h_samp_factor = 2;
-               if (fmt == MM_UTIL_JPEG_FMT_YUV420) {
+               if (fmt == MM_UTIL_JPEG_FMT_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_JPEG_FMT_YUV422 || fmt == MM_UTIL_JPEG_FMT_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;
                cinfo.comp_info[2].h_samp_factor = 1;
@@ -844,18 +829,16 @@ static int mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, v
                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_JPEG_FMT_RGB888)
                        iRowStride = width * 3;
-               } else if (fmt == MM_UTIL_JPEG_FMT_GraySacle) {
+               else if (fmt == MM_UTIL_JPEG_FMT_GraySacle)
                        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_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888)
                        iRowStride = width * 4;
-               }
 
                JSAMPLE *image_buffer = (JSAMPLE *)rawdata;
                while (cinfo.next_scanline < cinfo.image_height) {
-                       //row_pointer[0] = (JSAMPROW)&rawdata[cinfo.next_scanline * iRowStride];
-                       row_pointer[0] = & image_buffer[cinfo.next_scanline * iRowStride];
+                       row_pointer[0] = &image_buffer[cinfo.next_scanline * iRowStride];
                        jpeg_write_scanlines(&cinfo, row_pointer, 1);
                }
                mm_util_debug("while");
@@ -873,7 +856,7 @@ static int mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, v
        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_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        FILE *infile = NULL;
@@ -894,9 +877,8 @@ static int mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * d
                mm_util_error("decoded_data");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
-       if (decoded_data) {
+       if (decoded_data)
                decoded_data->data = NULL;
-       }
 
        infile = fopen(pFileName, "rb");
        if (infile == NULL) {
@@ -978,12 +960,10 @@ static int mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * d
 
        /* byte-align for YUV format */
        if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
-               if (dinfo.output_width % 2 != 0) {
+               if (dinfo.output_width % 2 != 0)
                        dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
-               }
-               if (dinfo.output_height % 2 != 0) {
+               if (dinfo.output_height % 2 != 0)
                        dinfo.output_height = MM_JPEG_ROUND_DOWN_2(dinfo.output_height);
-               }
        }
 
        /* JSAMPLEs per row in output buffer */
@@ -1009,7 +989,7 @@ static int mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * d
                return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        }
 
-       decoded_data->data = (void*) g_malloc0(decoded_data->size);
+       decoded_data->data = (void *) g_malloc0(decoded_data->size);
        decoded_data->format = input_fmt;
 
        if (decoded_data->data == NULL) {
@@ -1066,7 +1046,7 @@ static int mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * d
        return iErrorCode;
 }
 
-static int mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data, void *src, 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, int size, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int iErrorCode = MM_UTIL_ERROR_NONE;
        struct jpeg_decompress_struct dinfo;
@@ -1087,9 +1067,8 @@ static int mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *
                mm_util_error("decoded_data");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
-       if (decoded_data) {
+       if (decoded_data)
                decoded_data->data = NULL;
-       }
 
        /* allocate and initialize JPEG decompression object   We set up the normal JPEG error routines, then override error_exit. */
        dinfo.err = jpeg_std_error(&jerr.pub);
@@ -1164,12 +1143,10 @@ static int mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *
 
        /* byte-align for YUV format */
        if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
-               if (dinfo.output_width % 2 != 0) {
+               if (dinfo.output_width % 2 != 0)
                        dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
-               }
-               if (dinfo.output_height % 2 != 0) {
+               if (dinfo.output_height % 2 != 0)
                        dinfo.output_height = MM_JPEG_ROUND_DOWN_2(dinfo.output_height);
-               }
        }
 
        /* JSAMPLEs per row in output buffer */
@@ -1194,7 +1171,7 @@ static int mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *
                return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        }
 
-       decoded_data->data = (void*) g_malloc0(decoded_data->size);
+       decoded_data->data = (void *) g_malloc0(decoded_data->size);
        decoded_data->format = input_fmt;
 
        if (decoded_data->data == NULL) {
@@ -1252,56 +1229,6 @@ static int mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *
        return iErrorCode;
 }
 
-#if 0
-static int _mm_util_set_exif_entry(ExifData *exif, ExifIfd ifd, ExifTag tag, ExifFormat format, unsigned long components, unsigned char* data)
-{
-       ExifData *ed = (ExifData *)exif;
-       ExifEntry *e = NULL;
-
-       if (exif == NULL || format <= 0 || components <= 0 || data == NULL) {
-               mm_util_error("invalid argument exif = %p format = %d, components = %lu data = %p!",
-                       exif, format, components, data);
-               return -1;
-       }
-
-       /*remove same tag in EXIF*/
-       exif_content_remove_entry(ed->ifd[ifd], exif_content_get_entry(ed->ifd[ifd], tag));
-
-       /*create new tag*/
-       e = exif_entry_new();
-       if (e == NULL) {
-               mm_util_error("entry create error!");
-               return -1;
-       }
-
-       exif_entry_initialize(e, tag);
-
-       e->tag = tag;
-       e->format = format;
-       e->components = components;
-
-       if (e->size == 0) {
-               e->data = NULL;
-               e->data = malloc(exif_format_get_size(format) * e->components);
-               if (!e->data) {
-                       exif_entry_unref(e);
-                       return -1;
-               }
-
-               if (format == EXIF_FORMAT_ASCII) {
-                       memset(e->data, '\0', exif_format_get_size(format) * e->components);
-               }
-       }
-
-       e->size = exif_format_get_size(format) * e->components;
-       memcpy(e->data, data, e->size);
-       exif_content_add_entry(ed->ifd[ifd], e);
-       exif_entry_unref(e);
-
-       return 0;
-}
-#endif
-
 EXPORT_API 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 ret = MM_UTIL_ERROR_NONE;
@@ -1526,7 +1453,7 @@ EXPORT_API int mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, con
        return ret;
 }
 
-EXPORT_API int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data* decoded, void* src, int size, mm_util_jpeg_yuv_format fmt)
+EXPORT_API int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -1703,7 +1630,7 @@ EXPORT_API int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_dat
        return ret;
 }
 
-EXPORT_API int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data* decoded, void* src, int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+EXPORT_API int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
index 90cc67c..cf65ac0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.20
+Version:    0.21
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index e102316..c2cc159 100755 (executable)
@@ -78,7 +78,7 @@ static void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg)
        mm_util_error("%s", warning_msg);
 }
 
-static void dec_set_prop(mm_util_png_data * decoded, png_structp png_ptr, png_infop info)
+static void dec_set_prop(mm_util_png_data *decoded, png_structp png_ptr, png_infop info)
 {
        png_color_16 my_background, *image_background;
 
@@ -139,7 +139,7 @@ static void read_function(png_structp png_ptr, png_bytep data, png_size_t size)
        }
 }
 
-int read_png(mm_util_png_data * decoded, FILE * fp, void *memory)
+int read_png(mm_util_png_data *decoded, FILE * fp, void *memory)
 {
        png_structp png_ptr;
        png_infop info_ptr;
@@ -196,9 +196,8 @@ int read_png(mm_util_png_data * decoded, FILE * fp, void *memory)
        {
                png_bytep row_pointers[decoded->height];
 
-               for (row_index = 0; row_index < decoded->height; row_index++) {
+               for (row_index = 0; row_index < decoded->height; row_index++)
                        row_pointers[row_index] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
-               }
 
                png_read_image(png_ptr, row_pointers);
 
@@ -245,7 +244,7 @@ static void user_end_callback(png_structp png_ptr, png_infop info)
        mm_util_debug("and we are done reading this image");
 }
 
-int read_png_progressive(mm_util_png_data * decoded, FILE * fp, void **memory, unsigned long long src_size)
+int read_png_progressive(mm_util_png_data *decoded, FILE * fp, void **memory, unsigned long long src_size)
 {
        png_structp png_ptr;
        png_infop info_ptr;
@@ -319,7 +318,7 @@ int read_png_progressive(mm_util_png_data * decoded, FILE * fp, void **memory, u
        return MM_UTIL_ERROR_NONE;
 }
 
-int mm_util_decode_from_png_file(mm_util_png_data * decoded, const char *fpath)
+int mm_util_decode_from_png_file(mm_util_png_data *decoded, const char *fpath)
 {
        int ret = MM_UTIL_ERROR_NONE;
        FILE *fp;
@@ -338,7 +337,7 @@ int mm_util_decode_from_png_file(mm_util_png_data * decoded, const char *fpath)
        return ret;
 }
 
-int mm_util_decode_from_png_memory(mm_util_png_data * decoded, void **memory, unsigned long long src_size)
+int mm_util_decode_from_png_memory(mm_util_png_data *decoded, void **memory, unsigned long long src_size)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
@@ -351,7 +350,7 @@ int mm_util_decode_from_png_memory(mm_util_png_data * decoded, void **memory, un
        return ret;
 }
 
-void mm_util_init_decode_png(mm_util_png_data * data)
+void mm_util_init_decode_png(mm_util_png_data *data)
 {
        mm_util_debug("mm_util_init_decode_png");
        data->png.progressive = 0;
@@ -359,37 +358,37 @@ void mm_util_init_decode_png(mm_util_png_data * data)
        data->png.transform = MM_UTIL_PNG_TRANSFORM_IDENTITY;
 }
 
-void mm_util_png_decode_set_progressive(mm_util_png_data * data, int progressive)
+void mm_util_png_decode_set_progressive(mm_util_png_data *data, int progressive)
 {
        data->png.progressive = progressive;
 }
 
-void mm_util_png_decode_set_progressive_bytes(mm_util_png_data * data, int progressive_bytes)
+void mm_util_png_decode_set_progressive_bytes(mm_util_png_data *data, int progressive_bytes)
 {
        data->png.progressive_bytes = progressive_bytes;
 }
 
-void mm_util_png_decode_set_transform(mm_util_png_data * data, int transform)
+void mm_util_png_decode_set_transform(mm_util_png_data *data, int transform)
 {
        data->png.transform = transform;
 }
 
-png_uint_32 mm_util_png_decode_get_width(mm_util_png_data * data)
+png_uint_32 mm_util_png_decode_get_width(mm_util_png_data *data)
 {
        return data->width;
 }
 
-png_uint_32 mm_util_png_decode_get_height(mm_util_png_data * data)
+png_uint_32 mm_util_png_decode_get_height(mm_util_png_data *data)
 {
        return data->height;
 }
 
-int mm_util_png_decode_get_bit_depth(mm_util_png_data * data)
+int mm_util_png_decode_get_bit_depth(mm_util_png_data *data)
 {
        return data->png.bit_depth;
 }
 
-png_uint_32 mm_util_png_decode_get_size(mm_util_png_data * data)
+png_uint_32 mm_util_png_decode_get_size(mm_util_png_data *data)
 {
        return data->size;
 }
@@ -410,7 +409,7 @@ static void user_write_data(png_structp png_ptr, png_bytep data, png_uint_32 len
        }
 }
 
-int write_png(void **data, mm_util_png_data * encoded, FILE * fp)
+int write_png(void **data, mm_util_png_data *encoded, FILE *fp)
 {
        png_structp png_ptr;
        png_infop info_ptr;
@@ -488,7 +487,7 @@ int write_png(void **data, mm_util_png_data * encoded, FILE * fp)
        return MM_UTIL_ERROR_NONE;
 }
 
-int mm_util_encode_to_png_file(void **data, mm_util_png_data * encoded, const char *fpath)
+int mm_util_encode_to_png_file(void **data, mm_util_png_data *encoded, const char *fpath)
 {
        int ret = MM_UTIL_ERROR_NONE;
        FILE *fp;
@@ -502,7 +501,7 @@ int mm_util_encode_to_png_file(void **data, mm_util_png_data * encoded, const ch
        return ret;
 }
 
-int mm_util_encode_to_png_memory(void **data, mm_util_png_data * encoded)
+int mm_util_encode_to_png_memory(void **data, mm_util_png_data *encoded)
 {
        int ret;
 
@@ -512,7 +511,7 @@ int mm_util_encode_to_png_memory(void **data, mm_util_png_data * encoded)
        return ret;
 }
 
-void mm_util_init_encode_png(mm_util_png_data * data)
+void mm_util_init_encode_png(mm_util_png_data *data)
 {
        mm_util_debug("mm_util_init_encode_png");
        data->png.compression_level = MM_UTIL_COMPRESSION_6;
@@ -523,42 +522,42 @@ void mm_util_init_encode_png(mm_util_png_data * data)
        data->png.bit_depth = MM_UTIL_BIT_DEPTH_8;
 }
 
-void mm_util_png_encode_set_compression_level(mm_util_png_data * data, mm_util_png_compression compression_level)
+void mm_util_png_encode_set_compression_level(mm_util_png_data *data, mm_util_png_compression compression_level)
 {
        data->png.compression_level = compression_level;
 }
 
-void mm_util_png_encode_set_filter(mm_util_png_data * data, mm_util_png_filter filter)
+void mm_util_png_encode_set_filter(mm_util_png_data *data, mm_util_png_filter filter)
 {
        data->png.filter = filter;
 }
 
-void mm_util_png_encode_set_color_type(mm_util_png_data * data, mm_util_png_color_type color_type)
+void mm_util_png_encode_set_color_type(mm_util_png_data *data, mm_util_png_color_type color_type)
 {
        data->png.color_type = color_type;
 }
 
-void mm_util_png_encode_set_filter_type(mm_util_png_data * data, mm_util_png_filter_type filter_type)
+void mm_util_png_encode_set_filter_type(mm_util_png_data *data, mm_util_png_filter_type filter_type)
 {
        data->png.filter_type = filter_type;
 }
 
-void mm_util_png_encode_set_interlace_type(mm_util_png_data * data, mm_util_png_interlace_type interlace_type)
+void mm_util_png_encode_set_interlace_type(mm_util_png_data *data, mm_util_png_interlace_type interlace_type)
 {
        data->png.interlace_type = interlace_type;
 }
 
-void mm_util_png_encode_set_width(mm_util_png_data * data, png_uint_32 width)
+void mm_util_png_encode_set_width(mm_util_png_data *data, png_uint_32 width)
 {
        data->width = width;
 }
 
-void mm_util_png_encode_set_height(mm_util_png_data * data, png_uint_32 height)
+void mm_util_png_encode_set_height(mm_util_png_data *data, png_uint_32 height)
 {
        data->height = height;
 }
 
-void mm_util_png_encode_set_bit_depth(mm_util_png_data * data, mm_util_png_bit_depth bit_depth)
+void mm_util_png_encode_set_bit_depth(mm_util_png_data *data, mm_util_png_bit_depth bit_depth)
 {
        data->png.bit_depth = bit_depth;
 }
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100755 (executable)
index 45050f5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-bin_PROGRAMS = mm_utility_testsuite
-
-mm_utility_testsuite_SOURCES = mm_utility_testsuite.c
-
-mm_utility_testsuite_CFLAGS = -I$(srcdir)/../include \
-                                -fPIE -pie
diff --git a/test/mm_utility_testsuite.c b/test/mm_utility_testsuite.c
deleted file mode 100755 (executable)
index 28b711d..0000000
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- * 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 <glib.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <glib/gstdio.h>
-
-#include <scmn_base.h>
-/**
- *  Image file format
- */
-typedef enum {
-       /* Image file format */
-       MM_UTILITY_IMAGE_FILE_FMT_NONE,                 /**< Nothing or not supported image file format */
-       MM_UTILITY_IMAGE_FILE_FMT_BMP,                  /**< Windows bitmap : .bmp, .dib, .rle, .2bp */
-       MM_UTILITY_IMAGE_FILE_FMT_GIF,                          /**< Graphics Interchange Format : .gif, .gfa, .giff  */
-       MM_UTILITY_IMAGE_FILE_FMT_PNG,                  /**< Portable Network Graphics : .png */
-       MM_UTILITY_IMAGE_FILE_FMT_JPG,                  /**< Joint Photographic Experts Group : .jpg, .jpeg, .jpe */
-} mm_utility_image_file_format;
-
-
-/**
- * YUV format for gif
- */
-typedef enum {
-       /* YUV planar format */
-       MM_UTILITY_GIF_FMT_YUV420 = 0x00,  /**< YUV420 format - planer */
-       MM_UTILITY_GIF_FMT_YUV422,         /**< YUV422 format - planer */
-       /* YUV packed format */
-       MM_UTILITY_GIF_FMT_UYVY,            /**< UYVY format - YUV packed format */
-} mm_utility_gif_yuv_format;
-
-/**
- * YUV data for gif
- */
-typedef struct {
-       mm_utility_gif_yuv_format format;     /**< pixel format*/
-       int width;                          /**< width */
-       int height;                         /**< heigt */
-       int size;                           /**< size */
-       void *data;                         /**< data */
-} mm_utility_decoded_data;
-
-static int get_file_format(const char * input_file)
-{
-       mm_utility_image_file_format file_format = MM_UTILITY_IMAGE_FILE_FMT_NONE;
-
-       if (g_str_has_suffix(input_file, "bmp")
-               || g_str_has_suffix(input_file, "dib")
-               || g_str_has_suffix(input_file, "rle")
-               || g_str_has_suffix(input_file, "2bp")
-               || g_str_has_suffix(input_file, "BMP")
-               || g_str_has_suffix(input_file, "DIB")
-               || g_str_has_suffix(input_file, "RLE")
-               || g_str_has_suffix(input_file, "2BP")) {
-               printf("Image file format is BMP. \n");
-               file_format = MM_UTILITY_IMAGE_FILE_FMT_BMP;
-       } else if (g_str_has_suffix(input_file, "gif")
-               || g_str_has_suffix(input_file, "gfa")
-               || g_str_has_suffix(input_file, "giff")
-               || g_str_has_suffix(input_file, "GIF")
-               || g_str_has_suffix(input_file, "GFA")
-               || g_str_has_suffix(input_file, "GIFF")) {
-               printf("Image file format is GIF. \n");
-               file_format = MM_UTILITY_IMAGE_FILE_FMT_GIF;
-       } else if (g_str_has_suffix(input_file, "png")
-               ||  g_str_has_suffix(input_file, "PNG")) {
-               printf("Image file format is PNG. \n");
-               file_format = MM_UTILITY_IMAGE_FILE_FMT_PNG;
-       } else if (g_str_has_suffix(input_file, "jpg")
-               || g_str_has_suffix(input_file, "jpeg")
-               || g_str_has_suffix(input_file, "jpe")
-               || g_str_has_suffix(input_file, "JPG")
-               || g_str_has_suffix(input_file, "JPEG")
-               || g_str_has_suffix(input_file, "JPE")) {
-               printf("Image file format is JPG. \n");
-               file_format = MM_UTILITY_IMAGE_FILE_FMT_JPG;
-       } else {
-               printf("Not supported image file format. \n");
-       }
-
-       return file_format;
-
-}
-
-static int  malloc_decoded_picture(SCMN_IMGB * img)
-{
-       int ret = 0;
-       int malloc_size = 0;
-
-       switch (img->cs)        {
-               case SCMN_CS_YUV444:
-                       printf("colorspace is YUV444.\n");
-                       img->w[1] = img->w[2] = img->w[0];
-                       img->h[1] = img->h[2] = img->h[0];
-                       img->s[0] = img->s[1] = img->s[2] = img->w[0];
-                       img->e[0] = img->e[1] = img->e[2] = img->h[0];
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 3;
-
-                       break;
-
-               case SCMN_CS_YUV422:
-                       printf("colorspace is YUV422 or YUV422N.\n");
-
-                       img->w[1] = img->w[2] = (img->w[0]+1) >> 1;
-                       img->h[1] = img->h[2] = img->h[0];
-                       img->s[0] = img->w[0];
-                       img->s[1] = img->s[2] = (img->w[0]+1) >> 1;
-                       img->e[0] = img->e[1] = img->e[2] = img->h[0];
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 3 >> 1;
-
-                       break;
-
-               case SCMN_CS_YUV422W:
-                       printf("colorspace is YUV422W.\n");
-
-                       img->w[1] = img->w[2] = img->w[0];
-                       img->h[1] = img->h[2] = (img->h[0]+1) >> 1;
-                       img->s[0] = img->s[1] = img->s[2] = img->w[0];
-                       img->e[0] = img->h[0];
-                       img->e[1] = img->e[2] = (img->h[0]+1) >> 1;
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 3 >> 1;
-
-                       break;
-
-               case SCMN_CS_YUV420:
-                       printf("colorspace is YUV420.\n");
-
-                       /* plus 1 for rounding */
-                       img->w[1] = img->w[2] = (img->w[0]+1) >> 1;
-                       img->h[1] = img->h[2] = (img->h[0]+1) >> 1;
-                       img->s[0] = img->w[0];
-                       img->s[1] = img->s[2] = (img->w[0]+1)  >> 1;
-                       img->e[0] = img->h[0];
-                       img->e[1] = img->e[2] = (img->h[0]+1) >> 1;
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 3 >> 1;
-
-                       break;
-
-               case SCMN_CS_YUV400:
-                       printf("colorspace is YUV400.\n");
-
-                       img->s[0] = img->w[0];
-                       img->e[0] = img->h[0];
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char);
-
-                       break;
-
-               case SCMN_CS_RGB565:
-                       printf("colorspace is RGB565.\n");
-
-                       img->s[0] = img->w[0];
-                       img->e[0] = img->h[0];
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 3 >> 1;
-
-                       break;
-
-               case SCMN_CS_RGB888:
-                       printf("colorspace is RGB888.\n");
-
-                       img->s[0] = img->w[0]*3;
-                       img->e[0] = img->h[0];
-
-                       printf("%d x %d \n", img->s[0], img->e[0]);
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 3 ;
-
-                       break;
-
-               case SCMN_CS_RGBA8888:
-                       printf("colorspace is RGBA8888.\n");
-
-                       img->s[0] = img->w[0];
-                       img->e[0] = img->h[0];
-
-                       malloc_size = img->s[0]*img->e[0]*sizeof(unsigned char) * 4 ;
-
-                       break;
-
-               default:
-                       printf("Not supported colorspace[%d].\n", img->cs);
-                       ret = -1;
-                       break;
-       }
-
-       /* allocate buffer */
-       if (SCMN_CS_IS_YUV(img->cs)) {
-               if (img->cs == SCMN_CS_YUV400) {
-                       img->a[0] = malloc(img->s[0]*img->e[0]*sizeof(unsigned char));
-               } else {
-                       img->a[0] = malloc(img->s[0]*img->e[0]*sizeof(unsigned char));
-                       img->a[1] = malloc(img->s[1]*img->e[1]*sizeof(unsigned char));
-                       img->a[2] = malloc(img->s[2]*img->e[2]*sizeof(unsigned char));
-               }
-       } else if (SCMN_CS_IS_RGB16_PACK(img->cs)) {
-               img->a[0] = malloc(img->s[0]*img->e[0]*sizeof(unsigned char) * 2);
-       } else if (SCMN_CS_IS_RGB24_PACK(img->cs)) {
-               img->a[0] = malloc(img->s[0]*img->e[0]*sizeof(unsigned char) * 3);
-       } else if (SCMN_CS_IS_RGB32_PACK(img->cs)) {
-               img->a[0] = malloc(img->s[0]*img->e[0]*sizeof(unsigned char) * 4);
-       } else {
-               printf("Fail to allocate memory.\n");
-               ret = -1;
-       }
-
-       if (!img->a[0])
-               ret = -1;
-
-       return ret;
-}
-
-
-static void write_decoded_image(const char *filename,  SCMN_IMGB imgb)
-{
-       printf("Write decoded image to %s.\n",  filename);
-
-       FILE *fp = fopen(filename, "wb");
-       fwrite(imgb.a[0], sizeof(unsigned char), imgb.s[0]*imgb.e[0], fp);
-       fwrite(imgb.a[1], sizeof(unsigned char), imgb.s[1]*imgb.e[1], fp);
-       fwrite(imgb.a[2], sizeof(unsigned char), imgb.s[2]*imgb.e[2], fp);
-
-       fclose(fp);
-
-       return;
-}
-
-
-static int decode_bmp(const char * input_file, int width, int height,  const char * output_file)
-{
-       SCMN_IMGB imgb;
-       SBMPD_INIT_DSC init_dsc;
-       SBMPD bmpd_hnd = NULL;
-       SBMPD_STAT bmpd_stat = {0,};
-       SBMPD_INFO bmpd_info = {0,};
-
-       FILE *input_fp = NULL;
-       unsigned char *filebuffer = NULL;
-       unsigned char *bufp = NULL;
-       unsigned int nread = 0, toread = 0, totalread = 0,  decoded_size = 0;
-       struct stat statbuf;
-
-       int sret = SBMP_OK;
-       int ret = 0;
-       int err = 0;
-
-       /* initialize struct variable */
-       memset(&imgb, 0x00, sizeof(SCMN_IMGB));
-       memset(&init_dsc, 0x00, sizeof(SBMPD_INIT_DSC));
-       memset(&bmpd_stat, 0x00, sizeof(SBMPD_STAT));
-       memset(&bmpd_info, 0x00, sizeof(SBMPD_INFO));
-
-       /* init bmp codec */
-       sret = sbmp_init();
-       if (SBMP_IS_ERR(sret)) {
-               printf("Fail to init bmp library\n");
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Initialize bmp library is success.\n");
-
-       /* read data from gif file */
-       input_fp = fopen(input_file, "rb");
-       if (input_fp == NULL) {
-               printf("Fail to read bmp file \n");
-               goto exit;
-       }
-
-       fstat(fileno(input_fp), &statbuf);
-
-       if (!(statbuf.st_mode & S_IFREG)) {
-               printf("Input file is not regular file\n");
-               ret = -1;
-               goto exit;
-       }
-
-       filebuffer = malloc(statbuf.st_size);
-       if (!filebuffer) {
-               printf("fail to allocate file buffer\n");
-               ret = -1;
-               goto exit;
-       }
-
-       toread = statbuf.st_size;
-       totalread = 0;
-       bufp = filebuffer;
-
-       while ((nread = fread(bufp+totalread, 1, toread, input_fp)) > 0) {
-               totalread += nread;
-               toread -= nread;
-       }
-
-       if (totalread != statbuf.st_size) {
-               printf("BMP read error, file size=%ld, read size=%d\n", statbuf.st_size, totalread);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Reading bmp image is success.\n");
-
-
-       /* set init data */
-       init_dsc.bitb.addr = filebuffer;
-       init_dsc.bitb.size = totalread;
-       init_dsc.bitb.mt = SCMN_MT_IMG_BMP;
-       init_dsc.use_accel = 0;
-
-       /* create BMP decoder's handle */
-       /* create BMP decoder's handle */
-       bmpd_hnd = sbmpd_create(&init_dsc, &bmpd_info, &err);
-       if (bmpd_hnd == NULL || SBMP_IS_ERR(err)) {
-               printf("fail in sbmpd_create, erro=%d\n", err);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Create bmp decoder is success.\n");
-
-       /* malloc for decoded picture */
-       if ((width > 0) && (height > 0)) {
-               /* Resize the image */
-               imgb.w[0] = width;
-               imgb.h[0] = height;
-       } else {
-               /* original image size */
-               imgb.w[0] = bmpd_info.w;
-               imgb.h[0] = bmpd_info.h;
-       }
-       imgb.cs = bmpd_info.cs;
-
-       printf("%d x %d --------> %d x %d \n" , bmpd_info.w, bmpd_info.h , imgb.w[0], imgb.h[0]);
-
-
-       ret = malloc_decoded_picture(&imgb);
-       if (ret == -1) {
-               printf("Fail to malloc decoded data\n");
-               goto exit;
-       }
-
-       printf("Success to malloc decoded data.\n");
-
-       /* decoding gif image */
-       sret = sbmpd_decode(bmpd_hnd, &imgb, &bmpd_stat);
-       if (SBMP_IS_ERR(sret)) {
-               printf("Fail to decode, erro=%d\n", sret);
-               ret = -1;
-               goto exit;
-       }
-
-       if (!bmpd_stat.pa) {
-               printf("decoded buffer is not available\n");
-               ret = -1;
-               goto exit;
-       }
-
-
-       /* Write decoded image if output_file name is set. */
-       if (output_file) {
-               printf("Write decoded image. \n");
-               write_decoded_image(output_file, imgb);
-       }
-
-
-exit:
-       if (bufp) {
-               free(bufp);
-               bufp = NULL;
-       }
-
-       if (input_fp)
-               fclose(input_fp);
-
-       if (bmpd_hnd)
-               sbmpd_delete(bmpd_hnd);
-
-
-       sbmp_deinit();
-
-       printf("ret=%d\n", ret);
-
-       return ret;
-}
-
-static int decode_png(const char * input_file, int width, int height,  const char * output_file)
-{
-       SCMN_IMGB imgb;
-       SPNGD_INIT_DSC init_dsc;
-       SPNGD pngd_hnd = NULL;
-       SPNGD_STAT pngd_stat = {0,};
-       SPNGD_INFO pngd_info = {0,};
-
-       FILE *input_fp = NULL;
-       unsigned char *filebuffer = NULL;
-       unsigned char *bufp = NULL;
-       unsigned int nread = 0, toread = 0, totalread = 0,  decoded_size = 0;
-       struct stat statbuf;
-
-       int sret = SPNG_OK;
-       int ret = 0;
-       int err = 0;
-
-
-       /* initialize struct variable */
-       memset(&imgb, 0x00, sizeof(SCMN_IMGB));
-       memset(&init_dsc, 0x00, sizeof(SPNGD_INIT_DSC));
-       memset(&pngd_stat, 0x00, sizeof(SPNGD_STAT));
-       memset(&pngd_info, 0x00, sizeof(SPNGD_INFO));
-
-       /* init png codec */
-       sret = spng_init();
-       if (SPNG_IS_ERR(sret)) {
-               printf("Fail to init png library\n");
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Initialize png library is success.\n");
-
-       /* read data from png file */
-       input_fp = fopen(input_file, "rb");
-       if (input_fp == NULL) {
-               printf("Fail to read png file \n");
-               goto exit;
-       }
-
-       fstat(fileno(input_fp), &statbuf);
-
-       if (!(statbuf.st_mode & S_IFREG)) {
-               printf("Input file is not regular file\n");
-               goto exit;
-       }
-
-       filebuffer = malloc(statbuf.st_size);
-       if (!filebuffer) {
-               printf("fail to allocate file buffer\n");
-               goto exit;
-       }
-
-       toread = statbuf.st_size;
-       totalread = 0;
-       bufp = filebuffer;
-
-       while ((nread = fread(bufp+totalread, 1, toread, input_fp)) > 0) {
-               totalread += nread;
-               toread -= nread;
-       }
-
-       if (totalread != statbuf.st_size) {
-               printf("PNG read error, file size=%ld, read size=%d\n", statbuf.st_size, totalread);
-               goto exit;
-       }
-
-       printf("Reading png image is success.\n");
-
-
-       /* set init data */
-       init_dsc.bitb.addr = filebuffer;
-       init_dsc.bitb.size = totalread;
-       init_dsc.bitb.mt = SCMN_MT_IMG_PNG;
-       init_dsc.use_accel = 0;
-
-       /* create PNG decoder's handle */
-       pngd_hnd = spngd_create(&init_dsc, &pngd_info, &err);
-       if (pngd_hnd == NULL || SPNG_IS_ERR(err)) {
-               printf("fail in spngd_create, erro=%d\n", err);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Create png decoder is success.\n");
-
-       /* malloc for decoded picture */
-       if ((width > 0) && (height > 0)) {
-               /* Resize the image */
-               imgb.w[0] = width;
-               imgb.h[0] = height;
-       } else {
-               /* original image size */
-               imgb.w[0] = pngd_info.img_dsc[0].w;
-               imgb.h[0] = pngd_info.img_dsc[0].h;
-       }
-       imgb.cs = pngd_info.cs;
-
-       printf("%d x %d --------> %d x %d \n" , pngd_info.img_dsc[0].w, pngd_info.img_dsc[0].h, imgb.w[0], imgb.h[0]);
-
-
-       ret = malloc_decoded_picture(&imgb);
-       if (ret == -1) {
-               printf("Fail to malloc decoded data\n");
-               goto exit;
-       }
-
-
-       printf("Success to malloc decoded data.\n");
-
-       /* decoding png image */
-       sret = spngd_decode(pngd_hnd, 0, &imgb, &pngd_stat);
-       if (SPNG_IS_ERR(sret)) {
-               printf("Fail to decode, erro=%d\n", sret);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Success to decode, erro=%d\n", sret);
-
-       if (!pngd_stat.pa) {
-               printf("decoded buffer is not available\n");
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Decoding success.\n");
-
-
-       /* Write decoded image if output_file name is set. */
-       if (output_file) {
-               printf("Write decoded image. \n");
-               write_decoded_image(output_file, imgb);
-       }
-
-
-exit:
-
-       if (bufp) {
-               free(bufp);
-               bufp = NULL;
-       }
-
-       if (input_fp)
-               fclose(input_fp);
-
-       if (pngd_hnd)
-               spngd_delete(pngd_hnd);
-
-
-       spng_deinit();
-
-       printf("ret=%d\n", ret);
-
-       return ret;
-}
-
-static int decode_gif(const char * input_file, int width, int height,  const char * output_file)
-{
-       SCMN_IMGB imgb;
-       SGIFD_INIT_DSC init_dsc;
-       SGIFD gifd_hnd = NULL;
-       SGIFD_STAT gifd_stat = {0,};
-       SGIFD_INFO gifd_info = {0,};
-
-       FILE *input_fp = NULL;
-       unsigned char *filebuffer = NULL;
-       unsigned char *bufp = NULL;
-       unsigned int nread = 0, toread = 0, totalread = 0,  decoded_size = 0;
-       struct stat statbuf;
-
-       int sret = SGIF_OK;
-       int ret = 0;
-       int err = 0;
-
-
-       /* initialize struct variable */
-       memset(&imgb, 0x00, sizeof(SCMN_IMGB));
-       memset(&init_dsc, 0x00, sizeof(SGIFD_INIT_DSC));
-       memset(&gifd_stat, 0x00, sizeof(SGIFD_STAT));
-       memset(&gifd_info, 0x00, sizeof(SGIFD_INFO));
-
-       /* init gif codec */
-       sret = sgif_init();
-       if (SGIF_IS_ERR(sret)) {
-               printf("Fail to init gif library\n");
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Initialize gif library is success.\n");
-
-       /* read data from gif file */
-       input_fp = fopen(input_file, "rb");
-       if (input_fp == NULL) {
-               printf("Fail to read gif file \n");
-               goto exit;
-       }
-
-       fstat(fileno(input_fp), &statbuf);
-
-       if (!(statbuf.st_mode & S_IFREG)) {
-               printf("Input file is not regular file\n");
-               goto exit;
-       }
-
-       filebuffer = malloc(statbuf.st_size);
-       if (!filebuffer) {
-               printf("fail to allocate file buffer\n");
-               goto exit;
-       }
-
-       toread = statbuf.st_size;
-       totalread = 0;
-       bufp = filebuffer;
-
-       while ((nread = fread(bufp+totalread, 1, toread, input_fp)) > 0) {
-               totalread += nread;
-               toread -= nread;
-       }
-
-       if (totalread != statbuf.st_size) {
-               printf("GIF read error, file size=%ld, read size=%d\n", statbuf.st_size, totalread);
-               goto exit;
-       }
-
-       printf("Reading gif image is success.\n");
-
-
-       /* set init data */
-       init_dsc.bitb.addr = filebuffer;
-       init_dsc.bitb.size = totalread;
-       init_dsc.bitb.mt = SCMN_MT_IMG_GIF;
-       init_dsc.use_accel = 0;
-
-       /* create GIF decoder's handle */
-       gifd_hnd = sgifd_create(&init_dsc, &gifd_info, &err);
-       if (gifd_hnd == NULL || SGIF_IS_ERR(err)) {
-               printf("fail in sgifd_create, erro=%d\n", err);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Create gif decoder is success.\n");
-
-       /* malloc for decoded picture */
-       if ((width > 0) && (height > 0)) {
-               /* Resize the image */
-               imgb.w[0] = width;
-               imgb.h[0] = height;
-       } else {
-               /* original image size */
-               imgb.w[0] = gifd_info.w;
-               imgb.h[0] = gifd_info.h;
-       }
-       imgb.cs = gifd_info.cs;
-
-       printf("%d x %d --------> %d x %d \n" , gifd_info.w, gifd_info.h , imgb.w[0], imgb.h[0]);
-
-
-       ret = malloc_decoded_picture(&imgb);
-       if (ret == -1) {
-               printf("Fail to malloc decoded data\n");
-               goto exit;
-       }
-
-       printf("Success to malloc decoded data.\n");
-
-       /* decoding gif image */
-       sret = sgifd_decode(gifd_hnd, 0, &imgb, &gifd_stat);
-       if (SGIF_IS_ERR(sret)) {
-               printf("Fail to decode, erro=%d\n", sret);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Success to decode, erro=%d\n", sret);
-
-       if (!gifd_stat.pa) {
-               printf("decoded buffer is not available\n");
-               ret = -1;
-               goto exit;
-       }
-
-
-       /* Write decoded image if output_file name is set. */
-       if (output_file) {
-               printf("Write decoded image. \n");
-               write_decoded_image(output_file, imgb);
-       }
-
-
-exit:
-
-       if (bufp) {
-               free(bufp);
-               bufp = NULL;
-       }
-
-       if (input_fp)
-               fclose(input_fp);
-
-       if (gifd_hnd)
-               sgifd_delete(gifd_hnd);
-
-
-       sgif_deinit();
-
-       printf("ret=%d\n", ret);
-
-       return ret;
-
-}
-static int decode_jpg(const char * input_file, int width, int height,  const char * output_file)
-{
-       SCMN_IMGB imgb;
-       SJPGD_INIT_DSC init_dsc;
-       SJPGD jpgd_hnd = NULL;
-       SJPGD_STAT jpgd_stat = {0,};
-       SJPGD_INFO jpgd_info = {0,};
-
-       FILE *input_fp = NULL;
-       unsigned char *filebuffer = NULL;
-       unsigned char *bufp = NULL;
-       unsigned int nread = 0, toread = 0, totalread = 0,  decoded_size = 0;
-       struct stat statbuf;
-
-       int sret = SJPG_OK;
-       int ret = 0;
-       int err = 0;
-
-
-       /* initialize struct variable */
-       memset(&imgb, 0x00, sizeof(SCMN_IMGB));
-       memset(&init_dsc, 0x00, sizeof(SJPGD_INIT_DSC));
-       memset(&jpgd_stat, 0x00, sizeof(SJPGD_STAT));
-       memset(&jpgd_info, 0x00, sizeof(SJPGD_INFO));
-
-       /* init jpg codec */
-       sret = sjpg_init();
-       if (SJPG_IS_ERR(sret)) {
-               printf("Fail to init jpg library\n");
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Initialize jpg library is success.\n");
-
-       /* read data from jpg file */
-       input_fp = fopen(input_file, "rb");
-       if (input_fp == NULL) {
-               printf("Fail to read jpg file \n");
-               goto exit;
-       }
-
-       fstat(fileno(input_fp), &statbuf);
-
-       if (!(statbuf.st_mode & S_IFREG)) {
-               printf("Input file is not regular file\n");
-               goto exit;
-       }
-
-       filebuffer = malloc(statbuf.st_size);
-       if (!filebuffer) {
-               printf("fail to allocate file buffer\n");
-               goto exit;
-       }
-
-       toread = statbuf.st_size;
-       totalread = 0;
-       bufp = filebuffer;
-
-       while ((nread = fread(bufp+totalread, 1, toread, input_fp)) > 0) {
-               totalread += nread;
-               toread -= nread;
-       }
-
-       if (totalread != statbuf.st_size) {
-               printf("JPG read error, file size=%ld, read size=%d\n", statbuf.st_size, totalread);
-               goto exit;
-       }
-
-       printf("Reading jpg image is success.\n");
-
-
-       /* set init data */
-       init_dsc.bitb.addr = filebuffer;
-       init_dsc.bitb.size = totalread;
-       init_dsc.bitb.mt = SCMN_MT_IMG_JPG;
-       init_dsc.use_accel = 0;
-
-       /* create JPG decoder's handle */
-       jpgd_hnd = sjpgd_create(&init_dsc, &jpgd_info, &err);
-       if (jpgd_hnd == NULL || SJPG_IS_ERR(err)) {
-               printf("fail in sjpgd_create, erro=%d\n", err);
-               ret = -1;
-               goto exit;
-       }
-
-       printf("Create jpg decoder is success.\n");
-
-       /* malloc for decoded picture */
-       if ((width > 0) && (height > 0)) {
-               /* Resize the image */
-               imgb.w[0] = width;
-               imgb.h[0] = height;
-       } else {
-               /* original image size */
-               imgb.w[0] = jpgd_info.w;
-               imgb.h[0] = jpgd_info.h;
-       }
-       imgb.cs = jpgd_info.cs;
-
-       printf("%d x %d --------> %d x %d \n" , jpgd_info.w, jpgd_info.h , imgb.w[0], imgb.h[0]);
-
-
-       ret = malloc_decoded_picture(&imgb);
-       if (ret == -1) {
-               printf("Fail to malloc decoded data\n");
-               goto exit;
-       }
-
-       printf("Success to malloc decoded data.\n");
-
-
-       /* decoding jpg image */
-       sret = sjpgd_decode(jpgd_hnd, &imgb, &jpgd_stat);
-       if (SJPG_IS_ERR(sret)) {
-               printf("Fail to decode, erro=%d\n", sret);
-               ret = -1;
-               goto exit;
-       }
-
-       if (!jpgd_stat.pa) {
-               printf("decoded buffer is not available\n");
-               ret = -1;
-               goto exit;
-       }
-
-       printf("jpgd_stat.w=%d, jpgd_stat.h=%d, jpgd_stat.read=%d \n", jpgd_stat.w, jpgd_stat.h, jpgd_stat.read);
-
-       /* Write decoded image if output_file name is set. */
-       if (output_file) {
-               printf("Write decoded image. \n");
-               write_decoded_image(output_file, imgb);
-       }
-
-exit:
-       if (bufp) {
-               free(bufp);
-               bufp = NULL;
-       }
-
-       if (input_fp)
-               fclose(input_fp);
-
-       if (jpgd_hnd)
-               sjpgd_delete(jpgd_hnd);
-
-
-       sjpg_deinit();
-
-       printf("ret=%d\n", ret);
-
-       return ret;
-}
-
-int main(int argc, char *argv[])
-{
-       mm_utility_image_file_format file_format;
-       char *input_file, *output_file;
-       int output_width, output_height;
-       int ret = 0;
-
-       file_format = MM_UTILITY_IMAGE_FILE_FMT_NONE;
-       input_file = output_file = NULL;
-       output_width = output_height = 0;
-
-       /* Check image file path */
-       if (!argv[1]) {
-               printf("Please input image file path. \n");
-               goto exit;
-       }
-
-       input_file = g_strdup((const char *) argv[1]);
-
-       printf("Input file name is %s\n", input_file);
-
-       /* Check outpue decoded image size. if not set, use original image size. */
-       if (argv[2] && argv[3]) {
-               output_width = atoi(argv[2]);
-               output_height = atoi(argv[3]);
-
-               printf("Resize decoded image : %dX%d\n", output_width, output_height);
-       }
-
-       /* Check output decoded image file path */
-       if (argc > 3 && argv[4]) {
-               output_file = g_strdup((const char *)argv[4]);
-               printf("Output decoded image file path [%s]. \n",  output_file);
-       }
-
-       /* Get image file format : bmp, gif, png, jpg */
-       file_format = get_file_format(input_file);
-
-
-       /* Decode image file */
-       switch (file_format) {
-               case MM_UTILITY_IMAGE_FILE_FMT_BMP:
-                       ret = decode_bmp(input_file, output_width, output_height, output_file);
-                       break;
-               case MM_UTILITY_IMAGE_FILE_FMT_GIF:
-                       ret = decode_gif(input_file, output_width, output_height, output_file);
-                       break;
-               case MM_UTILITY_IMAGE_FILE_FMT_PNG:
-                       ret = decode_png(input_file, output_width, output_height, output_file);
-                       break;
-               case MM_UTILITY_IMAGE_FILE_FMT_JPG:
-                       ret = decode_jpg(input_file, output_width, output_height, output_file);
-                       break;
-               default:
-                       printf(" This image file is not supported. \n");
-                       ret = -1;
-                       break;
-
-       }
-
-       if (ret == -1)
-               printf("Fail to decode [%s]. \n", input_file);
-
-exit:
-       if (input_file) {
-               g_free(input_file);
-               input_file = NULL;
-       }
-
-       if (output_file) {
-               g_free(output_file);
-               output_file = NULL;
-       }
-
-       return ret;
-
-}
-