tizen 2.4 release accepted/tizen/2.4/mobile/20151029.032421 submit/tizen_2.4/20151028.064434 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 07:53:38 +0000 (16:53 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 07:53:38 +0000 (16:53 +0900)
33 files changed:
TC/build.sh [deleted file]
TC/execute.sh [deleted file]
TC/making_new_tet_scen.py [deleted file]
TC/tet_scen [deleted file]
TC/tetbuild.cfg [deleted file]
TC/tetclean.cfg [deleted file]
TC/tetexec.cfg [deleted file]
TC/tslist.txt [deleted file]
TC/utc/Makefile [deleted file]
TC/utc/test_data/test.jpg [deleted file]
TC/utc/test_data/test.yuv [deleted file]
TC/utc/tslist [deleted file]
TC/utc/utc_mm_util_common.h [deleted file]
TC/utc/utc_mm_util_convert_colorspace_func.c [deleted file]
TC/utc/utc_mm_util_decode_from_jpeg_file_func.c [deleted file]
TC/utc/utc_mm_util_decode_from_jpeg_memory_func.c [deleted file]
TC/utc/utc_mm_util_get_image_size_func.c [deleted file]
TC/utc/utc_mm_util_jpeg_encode_to_file_func.c [deleted file]
TC/utc/utc_mm_util_jpeg_encode_to_memory_func.c [deleted file]
TC/utc/utc_mm_util_resize_image_func.c [deleted file]
TC/utc/utc_mm_util_rotate_image_func.c [deleted file]
configure.ac
imgp/Makefile.am
imgp/include/mm_util_imgp.h
imgp/include/mm_util_imgp_internal.h [changed mode: 0644->0755]
imgp/mm_util_imgp.c
imgp/test/mm_util_imgp_testsuite.c
jpeg/Makefile.am
jpeg/include/mm_util_jpeg.h
jpeg/mm_util_jpeg.c
jpeg/test/mm_util_jpeg_testsuite.c
packaging/libmm-utility.spec [changed mode: 0644->0755]
test/Makefile.am

diff --git a/TC/build.sh b/TC/build.sh
deleted file mode 100755 (executable)
index 1276482..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#./_export_env.sh                              # setting environment variables
-#!/bin/sh
-export ARCH=target
-export TET_INSTALL_PATH=/scratchbox/TETware/
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-
-export TET_ROOT=$TET_TARGET_PATH
-
-set $(pwd)
-export TET_SUITE_ROOT=$1
-
-set $(date +%s)
-FILE_NAME_EXTENSION=$1
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir $RESULT_DIR
-
-tcc -c -p ./                                # executing tcc, with clean option (-c)
-tcc -b -j $JOURNAL_RESULT -p ./            # executing tcc to build test cases (-b)
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT  # reporting the result
-
diff --git a/TC/execute.sh b/TC/execute.sh
deleted file mode 100755 (executable)
index 8e414df..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-export ARCH=target
-
-export TET_INSTALL_PATH=/mnt/nfs/TETware  # path to mount
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-
-export TET_ROOT=$TET_TARGET_PATH
-
-set $(pwd)
-export TET_SUITE_ROOT=$1
-
-set $(date +%s)
-FILE_NAME_EXTENSION=$1
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT  # reporting the result
-
diff --git a/TC/making_new_tet_scen.py b/TC/making_new_tet_scen.py
deleted file mode 100755 (executable)
index 6c5b845..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-
-#############################################
-# tet_scen  auto generator
-#
-# ** argv[1] = TC root
-#############################################
-
-import sys,string,os
-
-
-write_file = open("tet_scen", 'w')
-
-#
-# making new tet_scen
-#
-def making_tet_scen (filename):
-       #tmp_list = filename.strip().split('/')
-       n_filename = filename.replace(' ', '\\ ')
-       #print n_filename
-       #new_path = "/"+ sys.argv[1] +"/"+n_filename[2:-6]
-       new_path = "/"+n_filename[:-6]
-       #print new_path
-       file = open(filename, 'r')
-       lines = file.readlines()
-       for line in lines:
-               if len(line.strip()) > 1:
-                       list = line.strip().split('/')
-                       #print new_path + list[-1]
-                       write_file.write("\t"+new_path+list[-1]+"\n")
-
-#
-# usage()
-#
-def usage():
-       print(" ")
-       print("./making_new_tet_scen.py tc_root")
-       print("Put the Test Case's root directory.")
-       print("Do not include '/' at the end")
-       print(" ")
-
-#
-# main()
-#
-def main():
-       if len(sys.argv) < 2:
-               usage()
-               sys.exit(0)
-               
-       os.system('find '+ sys.argv[1] +' -name "tslist" > tslist.txt')
-       
-       #write_file = open("tetscen", w)
-       write_file.write("# auto generated tet_scen\n")
-       write_file.write("all\n")
-       write_file.write("\t\"Starting Full Test Suite\"\n")
-       
-       for file in open("tslist.txt", 'r'):
-               #print file.strip()
-               making_tet_scen(file.strip())
-                       
-       write_file.write("\t\"Completed Full Test Suite\"\n")
-       write_file.write("# EOF\n")
-       write_file.close()
-       print(" ")
-       print("==============================")
-       print("New tet_scen file is made~~~~")
-       print("==============================")
-       print(" ")
-main()
diff --git a/TC/tet_scen b/TC/tet_scen
deleted file mode 100755 (executable)
index 2bdd84a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# auto generated tet_scen
-all
-       "Starting Full Test Suite"
-       /utc/utc_mm_util_convert_colorspace_func
-       /utc/utc_mm_util_resize_image_func
-       /utc/utc_mm_util_rotate_image_func
-       /utc/utc_mm_util_jpeg_encode_to_file_func
-       /utc/utc_mm_util_jpeg_encode_to_memory_func
-       /utc/utc_mm_util_decode_from_jpeg_file_func
-       /utc/utc_mm_util_decode_from_jpeg_memory_func
-       "Completed Full Test Suite"
-# EOF
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
deleted file mode 100755 (executable)
index addcce9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-TET_OUTPUT_CAPTURE=True # capture option for build operation checking
-TET_BUILD_TOOL=make # build with using make command
-TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
-TET_API_COMPLIANT=True # use TET API in Test Case ?
-TET_PASS_TC_NAME=True # report passed TC name in Journal file?
-
-
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
deleted file mode 100755 (executable)
index 00d58d5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-TET_OUTPUT_CAPTURE=True # capture option
-TET_CLEAN_TOOL= make clean # clean tool
-TET_CLEAN_FILE= Makefile # file for clean
-TET_API_COMPLIANT=True # TET API useage 
-TET_PASS_TC_NAME=True # showing name , passed TC
-
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
deleted file mode 100755 (executable)
index e726ecc..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-TET_OUTPUT_CAPTURE=True # capturing execution or not
-TET_EXEC_TOOL=  # ex) exec : execution tool set up/ Optional
-TET_EXEC_FILE=   # ex) exectool : execution file/ Optional
-TET_API_COMPLIANT=True # Test case or Tool usesTET API?
-TET_PASS_TC_NAME=True # showing Passed TC name ?
-
diff --git a/TC/tslist.txt b/TC/tslist.txt
deleted file mode 100644 (file)
index 24c0a1a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-utc/tslist
diff --git a/TC/utc/Makefile b/TC/utc/Makefile
deleted file mode 100755 (executable)
index f81ab95..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-ifeq ($(ARCH),target)\r
-       PKG_CONFIG_PATH=/usr/lib/pkgconfig\r
-       export PKG_CONFIG_PATH\r
-       CC=arm-linux-gcc -Wall\r
-       CXX=arm-linux-g++ -Wall\r
-else\r
-       PKG_CONFIG_PATH=/usr/lib/pkgconfig\r
-       export PKG_CONFIG_PATH\r
-       CC=gcc -Wall\r
-    CXX=gcc -Wall\r
-endif\r
-\r
-TS1=utc_mm_util_convert_colorspace_func\r
-TS2=utc_mm_util_decode_from_jpeg_file_func\r
-TS3=utc_mm_util_decode_from_jpeg_memory_func\r
-TS4=utc_mm_util_get_image_size_func\r
-TS5=utc_mm_util_jpeg_encode_to_file_func\r
-TS6=utc_mm_util_jpeg_encode_to_memory_func\r
-TS7=utc_mm_util_resize_image_func\r
-TS8=utc_mm_util_rotate_image_func\r
-\r
-LIBS = `pkg-config --libs mmutil-imgp mmutil-jpeg glib-2.0`  \r
-LIBS +=-L/usr/lib/:/usr/lib/pkgconfig\r
-LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o\r
-LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s\r
-LIBS +=-L$(TET_ROOT)/lib/tet3/ -lapi_s\r
-\r
-INCS = -I. `pkg-config --cflags mmutil-imgp mmutil-jpeg glib-2.0`\r
-INCS += -I$(TET_ROOT)/inc/tet3\r
-INCS += -I/usr/include/mmf\r
-\r
-CFLAGS = $(INCS) \r
-CC += $(CFLAGS)\r
-LDFLAGS = $(LIBS)\r
-\r
-all : $(TS1) $(TS2) $(TS3) $(TS4) $(TS5) $(TS6) $(TS7) $(TS8)\r
-\r
-$(TS1): $(TS1).c\r
-       $(CC) -o $(TS1) $(TS1).c $(LDFLAGS)\r
-\r
-$(TS2): $(TS2).c\r
-       $(CC) -o $(TS2) $(TS2).c $(LDFLAGS)\r
-       \r
-$(TS3): $(TS3).c\r
-       $(CC) -o $(TS3) $(TS3).c $(LDFLAGS)\r
-\r
-$(TS4): $(TS4).c\r
-       $(CC) -o $(TS4) $(TS4).c $(LDFLAGS)\r
-\r
-$(TS5): $(TS5).c\r
-       $(CC) -o $(TS5) $(TS5).c $(LDFLAGS)\r
-       \r
-$(TS6): $(TS6).c\r
-       $(CC) -o $(TS6) $(TS6).c $(LDFLAGS)\r
-\r
-$(TS7): $(TS7).c\r
-       $(CC) -o $(TS7) $(TS7).c $(LDFLAGS)\r
-\r
-$(TS8): $(TS8).c\r
-       $(CC) -o $(TS8) $(TS8).c $(LDFLAGS)\r
-\r
-clean:\r
-       rm -rf *~ *.o $(TS1) $(TS2) $(TS3) $(TS4) $(TS5) $(TS6) $(TS7) $(TS8)\r
-       \r
-\r
-\r
diff --git a/TC/utc/test_data/test.jpg b/TC/utc/test_data/test.jpg
deleted file mode 100755 (executable)
index 3b468c4..0000000
Binary files a/TC/utc/test_data/test.jpg and /dev/null differ
diff --git a/TC/utc/test_data/test.yuv b/TC/utc/test_data/test.yuv
deleted file mode 100755 (executable)
index be62991..0000000
Binary files a/TC/utc/test_data/test.yuv and /dev/null differ
diff --git a/TC/utc/tslist b/TC/utc/tslist
deleted file mode 100755 (executable)
index e381d4f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-./utc_mm_util_convert_colorspace_func
-./utc_mm_util_resize_image_func
-./utc_mm_util_rotate_image_func
-./utc_mm_util_jpeg_encode_to_file_func
-./utc_mm_util_jpeg_encode_to_memory_func
-./utc_mm_util_decode_from_jpeg_file_func
-./utc_mm_util_decode_from_jpeg_memory_func
diff --git a/TC/utc/utc_mm_util_common.h b/TC/utc/utc_mm_util_common.h
deleted file mode 100755 (executable)
index 664017d..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * libmm-utility\r
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- */\r
-\r
-\r
-#ifndef UTS_MM_FRAMEWORK_UTIL_COMMON_H\r
-#define UTS_MM_FRAMEWORK_UTIL_COMMON_H\r
-\r
-#include <mm_util_imgp.h>\r
-#include <mm_util_jpeg.h>\r
-#include <mm_message.h>\r
-#include <mm_error.h>\r
-#include <mm_types.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <tet_api.h>\r
-#include <unistd.h>\r
-#include <glib-2.0/glib.h>\r
-\r
-void startup();\r
-void cleanup();\r
-\r
-void (*tet_startup)() = startup;\r
-void (*tet_cleanup)() = cleanup;\r
-\r
-\r
-\r
-/* Audio File Define */\r
-#define JPG_IMAGE_FILE "test_data/test.jpg"\r
-#define YUV_IMAGE_FILE "test_data/test.yuv"\r
-\r
-\r
-void utc_mm_util_get_image_size_func_01 ();\r
-void utc_mm_util_get_image_size_func_02 ();\r
-void utc_mm_util_get_image_size_func_03 ();\r
-void utc_mm_util_get_image_size_func_04 ();\r
-void utc_mm_util_get_image_size_func_05 ();\r
-void utc_mm_util_get_image_size_func_06 ();\r
-\r
-void utc_mm_util_convert_colorspace_func_01 ();\r
-void utc_mm_util_convert_colorspace_func_02 ();\r
-void utc_mm_util_convert_colorspace_func_03 ();\r
-void utc_mm_util_convert_colorspace_func_04 ();\r
-void utc_mm_util_convert_colorspace_func_05 ();\r
-void utc_mm_util_convert_colorspace_func_06 ();\r
-void utc_mm_util_convert_colorspace_func_07 ();\r
-void utc_mm_util_convert_colorspace_func_08 ();\r
-void utc_mm_util_convert_colorspace_func_09 ();\r
-\r
-void utc_mm_util_resize_image_func_01 ();\r
-void utc_mm_util_resize_image_func_02 ();\r
-void utc_mm_util_resize_image_func_03 ();\r
-void utc_mm_util_resize_image_func_04 ();\r
-void utc_mm_util_resize_image_func_05 ();\r
-void utc_mm_util_resize_image_func_06 ();\r
-void utc_mm_util_resize_image_func_07 ();\r
-void utc_mm_util_resize_image_func_08 ();\r
-void utc_mm_util_resize_image_func_09 ();\r
-\r
-void utc_mm_util_rotate_image_func_01 ();\r
-void utc_mm_util_rotate_image_func_02 ();\r
-void utc_mm_util_rotate_image_func_03 ();\r
-void utc_mm_util_rotate_image_func_04 ();\r
-void utc_mm_util_rotate_image_func_05 ();\r
-void utc_mm_util_rotate_image_func_06 ();\r
-void utc_mm_util_rotate_image_func_07 ();\r
-void utc_mm_util_rotate_image_func_08 ();\r
-void utc_mm_util_rotate_image_func_09 ();\r
-void utc_mm_util_rotate_image_func_10 ();\r
-void utc_mm_util_rotate_image_func_11 ();\r
-\r
-void utc_mm_util_jpeg_encode_to_file_func_01 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_02 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_03 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_04 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_05 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_06 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_07 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_08 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_09 ();\r
-\r
-void utc_mm_util_jpeg_encode_to_memory_func_01 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_02 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_03 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_04 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_05 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_06 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_07 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_08 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_09 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_10 ();\r
-\r
-void utc_mm_util_decode_from_jpeg_file_func_01 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_02 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_03 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_04 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_05 ();\r
-\r
-void utc_mm_util_decode_from_jpeg_memory_func_01 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_02 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_03 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_04 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_05 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_06 ();\r
-\r
-\r
-#endif /* UTS_MM_FRAMEWORK_UTIL_COMMON_H */\r
diff --git a/TC/utc/utc_mm_util_convert_colorspace_func.c b/TC/utc/utc_mm_util_convert_colorspace_func.c
deleted file mode 100755 (executable)
index 3622d99..0000000
+++ /dev/null
@@ -1,426 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_CONVERT_COLORSPACE Uts_Mmf_Util_Convert_Colorspace
-* @{
-*/
-
-/**
-* @file uts_mm_util_convert_colorspace.c
-* @brief This is a suit of unit test cases to test mm_util_convert_colorspace API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_convert_colorspace_func_01 , 1},
-       {utc_mm_util_convert_colorspace_func_02 , 2},
-       {utc_mm_util_convert_colorspace_func_03 , 3},
-       {utc_mm_util_convert_colorspace_func_04 , 4},
-       {utc_mm_util_convert_colorspace_func_05 , 5},
-       {utc_mm_util_convert_colorspace_func_06 , 6},
-       {utc_mm_util_convert_colorspace_func_07 , 7},
-       {utc_mm_util_convert_colorspace_func_08 , 8},
-       {utc_mm_util_convert_colorspace_func_09 , 9},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_convert_colorspace_func_01()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,dst, dst_format);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_02()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(NULL, src_width, src_height, src_format,dst, dst_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_03()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, -1, src_height, src_format,dst, dst_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_04()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, -1, src_format,dst, dst_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_05()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, src_height, -1,dst, dst_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_06()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, src_height, 20,dst, dst_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_07()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,NULL, dst_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_08()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,dst, -1);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_09()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,dst, 20);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_decode_from_jpeg_file_func.c b/TC/utc/utc_mm_util_decode_from_jpeg_file_func.c
deleted file mode 100755 (executable)
index 0afe073..0000000
+++ /dev/null
@@ -1,167 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_DECODE_FROM_JPEG_FILE Uts_Mmf_Util_Decode_From_Jpeg_File
-* @{
-*/
-
-/**
-* @file uts_mm_util_decode_from_jpeg_file.c
-* @brief This is a suit of unit test cases to test mm_util_decode_from_jpeg_file API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_decode_from_jpeg_file_func_01 , 1},
-       {utc_mm_util_decode_from_jpeg_file_func_02 , 2},
-       {utc_mm_util_decode_from_jpeg_file_func_03 , 3},
-       {utc_mm_util_decode_from_jpeg_file_func_04 , 4},
-       {utc_mm_util_decode_from_jpeg_file_func_05 , 5},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_decode_from_jpeg_file_func_01()
-{
-       int ret = 0;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
-       ret = mm_util_decode_from_jpeg_file(&decoded, JPG_IMAGE_FILE, src_format);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_02()
-{
-       int ret = 0;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       //mm_util_jpeg_yuv_data decoded;
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
-       ret = mm_util_decode_from_jpeg_file(NULL, JPG_IMAGE_FILE, src_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_03()
-{
-       int ret = 0;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
-       ret = mm_util_decode_from_jpeg_file(&decoded, NULL, src_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_04()
-{
-       int ret = 0;
-       //mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
-       ret = mm_util_decode_from_jpeg_file(&decoded, JPG_IMAGE_FILE, -1);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_05()
-{
-       int ret = 0;
-       //mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
-       ret = mm_util_decode_from_jpeg_file(&decoded, JPG_IMAGE_FILE, 100);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_decode_from_jpeg_memory_func.c b/TC/utc/utc_mm_util_decode_from_jpeg_memory_func.c
deleted file mode 100755 (executable)
index 67ee20e..0000000
+++ /dev/null
@@ -1,262 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_DECODE_FROM_JPEG_MEMORY Uts_Mmf_Util_Decode_From_Jpeg_Memory
-* @{
-*/
-
-/**
-* @file uts_mm_util_decode_from_jpeg_memory.c
-* @brief This is a suit of unit test cases to test mm_util_decode_from_jpeg_memory API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_decode_from_jpeg_memory_func_01 , 1},
-       {utc_mm_util_decode_from_jpeg_memory_func_02 , 2},
-       {utc_mm_util_decode_from_jpeg_memory_func_03 , 3},
-       {utc_mm_util_decode_from_jpeg_memory_func_04 , 4},
-       {utc_mm_util_decode_from_jpeg_memory_func_05 , 5},
-       {utc_mm_util_decode_from_jpeg_memory_func_06 , 6},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_decode_from_jpeg_memory_func_01()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 50;
-       unsigned int src_height = 50;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_decode_from_jpeg_memory(&decoded, src, src_size, src_format);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_02()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 50;
-       unsigned int src_height = 50;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       //mm_util_jpeg_yuv_data decoded;
-
-       FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_decode_from_jpeg_memory(NULL, src, src_size, src_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_03()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 50;
-       unsigned int src_height = 50;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_decode_from_jpeg_memory(&decoded, NULL, src_size, src_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_04()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 50;
-       unsigned int src_height = 50;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_decode_from_jpeg_memory(&decoded, src, -1, src_format);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_05()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 50;
-       unsigned int src_height = 50;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_decode_from_jpeg_memory(&decoded, src, src_size, -1);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_06()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 50;
-       unsigned int src_height = 50;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       mm_util_jpeg_yuv_data decoded;
-
-       FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_decode_from_jpeg_memory(&decoded, src, src_size, 100);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_get_image_size_func.c b/TC/utc/utc_mm_util_get_image_size_func.c
deleted file mode 100755 (executable)
index 3767963..0000000
+++ /dev/null
@@ -1,203 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_GET_IMAGE_SIZE Uts_Mmf_Util_Get_Image_Size
-* @{
-*/
-
-/**
-* @file uts_mm_util_get_image_size.c
-* @brief This is a suit of unit test cases to test mm_util_get_image_size API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_get_image_size_func_01 , 1},
-       {utc_mm_util_get_image_size_func_02 , 2},
-       {utc_mm_util_get_image_size_func_03 , 3},
-       {utc_mm_util_get_image_size_func_04 , 4},
-       {utc_mm_util_get_image_size_func_05 , 5},
-       {utc_mm_util_get_image_size_func_06 , 6},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_get_image_size_func_01()
-{
-       int ret = 0;
-       mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned int width = 50;
-       unsigned int height = 50;
-       unsigned int size;
-
-       tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(format, width, height, &size);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_get_image_size_func_02()
-{
-       int ret = 0;
-       mm_util_img_format format = -1;
-       unsigned int width = 50;
-       unsigned int height = 50;
-       unsigned int size;
-
-       tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(format, width, height, &size);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_get_image_size_func_03()
-{
-       int ret = 0;
-       mm_util_img_format format = 20;
-       unsigned int width = 50;
-       unsigned int height = 50;
-       unsigned int size;
-
-       tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(format, width, height, &size);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_get_image_size_func_04()
-{
-       int ret = 0;
-       mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned int width = -50;
-       unsigned int height = 50;
-       unsigned int size;
-
-       tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(format, width, height, &size);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_get_image_size_func_05()
-{
-       int ret = 0;
-       mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned int width = 50;
-       unsigned int height = -50;
-       unsigned int size;
-
-       tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(format, width, height, &size);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-void utc_mm_util_get_image_size_func_06()
-{
-       int ret = 0;
-       mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned int width = 50;
-       unsigned int height = 50;
-       unsigned int size;
-
-       tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(format, width, height, NULL);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       return;
-}
-
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_jpeg_encode_to_file_func.c b/TC/utc/utc_mm_util_jpeg_encode_to_file_func.c
deleted file mode 100755 (executable)
index 8857b1c..0000000
+++ /dev/null
@@ -1,353 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_JPEG_ENCODE_TO_FILE Uts_Mmf_Util_Jpeg_Encode_To_File
-* @{
-*/
-
-/**
-* @file uts_mm_util_jpeg_encode_to_file.c
-* @brief This is a suit of unit test cases to test mm_util_jpeg_encode_to_file API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_jpeg_encode_to_file_func_01 , 1},
-       {utc_mm_util_jpeg_encode_to_file_func_02 , 2},
-       {utc_mm_util_jpeg_encode_to_file_func_03 , 3},
-       {utc_mm_util_jpeg_encode_to_file_func_04 , 4},
-       {utc_mm_util_jpeg_encode_to_file_func_05 , 5},
-       {utc_mm_util_jpeg_encode_to_file_func_06 , 6},
-       {utc_mm_util_jpeg_encode_to_file_func_07 , 7},
-       {utc_mm_util_jpeg_encode_to_file_func_08 , 8},
-       {utc_mm_util_jpeg_encode_to_file_func_09 , 9},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_jpeg_encode_to_file_func_01()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, src_format, quality);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_02()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file(NULL, src, src_width, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_03()
-{
-       int ret = 0;
-       //unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       //unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       //FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       /*ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);*/
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", NULL, src_width, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       /*free(src);
-       fclose(fp);*/
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_04()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, -1, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_05()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, -1, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_06()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, -1, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_07()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, 100, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_08()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       //int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, src_format, -1);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_09()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       //int quality = 50;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, src_format, 200);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_jpeg_encode_to_memory_func.c b/TC/utc/utc_mm_util_jpeg_encode_to_memory_func.c
deleted file mode 100755 (executable)
index e4739f0..0000000
+++ /dev/null
@@ -1,421 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_JPEG_ENCODE_TO_MEMORY Uts_Mmf_Util_Jpeg_Encode_To_Memory
-* @{
-*/
-
-/**
-* @file uts_mm_util_jpeg_encode_to_memory.c
-* @brief This is a suit of unit test cases to test mm_util_jpeg_encode_to_memory API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_jpeg_encode_to_memory_func_01 , 1},
-       {utc_mm_util_jpeg_encode_to_memory_func_02 , 2},
-       {utc_mm_util_jpeg_encode_to_memory_func_03 , 3},
-       {utc_mm_util_jpeg_encode_to_memory_func_04 , 4},
-       {utc_mm_util_jpeg_encode_to_memory_func_05 , 5},
-       {utc_mm_util_jpeg_encode_to_memory_func_06 , 6},
-       {utc_mm_util_jpeg_encode_to_memory_func_07 , 7},
-       {utc_mm_util_jpeg_encode_to_memory_func_08 , 8},
-       {utc_mm_util_jpeg_encode_to_memory_func_09 , 9},
-       {utc_mm_util_jpeg_encode_to_memory_func_10 , 10},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_jpeg_encode_to_memory_func_01()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, src_format, quality);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_02()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       //void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-       size = (int)src_size;
-       //mem = malloc(src_size);
-       ret = mm_util_jpeg_encode_to_memory(NULL, &size, src, src_width, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_03()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       ret = mm_util_jpeg_encode_to_memory(&mem, NULL, src, src_width, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_04()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, NULL, src_width, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_05()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, -1, src_height, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_06()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, -1, src_format, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_07()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, -1, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_08()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, 100, quality);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_09()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, src_format, -1);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_10()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       int size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       int quality = 50;
-       void* mem;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       mem = malloc(src_size);
-       size = (int)src_size;
-       ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, src_format, 200);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-
-       free(src);
-       fclose(fp);
-       return;
-}
-
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_resize_image_func.c b/TC/utc/utc_mm_util_resize_image_func.c
deleted file mode 100755 (executable)
index 98e8e81..0000000
+++ /dev/null
@@ -1,425 +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.
- *
- */
-
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_RESIZE_IMAGE Uts_Mmf_Util_Resize_Image
-* @{
-*/
-
-/**
-* @file uts_mm_util_resize_image.c
-* @brief This is a suit of unit test cases to test mm_util_resize_image API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_resize_image_func_01 , 1},
-       {utc_mm_util_resize_image_func_02 , 2},
-       {utc_mm_util_resize_image_func_03 , 3},
-       {utc_mm_util_resize_image_func_04 , 4},
-       {utc_mm_util_resize_image_func_05 , 5},
-       {utc_mm_util_resize_image_func_06 , 6},
-       {utc_mm_util_resize_image_func_07 , 7},
-       {utc_mm_util_resize_image_func_08 , 8},
-       {utc_mm_util_resize_image_func_09 , 9},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_resize_image_func_01()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_resize_image_func_02()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(NULL, src_width, src_height, src_format, dst, &dst_width, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_03()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, -1, src_height, src_format, dst, &dst_width, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_04()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, -1, src_format, dst, &dst_width, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_05()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, src_height, -1, dst, &dst_width, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_06()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, src_height, src_format, NULL, &dst_width, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_07()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, NULL, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_08()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, &dst_width, NULL);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-void utc_mm_util_resize_image_func_09()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 50;
-       unsigned int dst_height = 50;
-       unsigned int dst_size;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_resize_image(src, src_width, src_height, 20, dst, &dst_width, &dst_height);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-
-/** @} */
-
-
-
-
diff --git a/TC/utc/utc_mm_util_rotate_image_func.c b/TC/utc/utc_mm_util_rotate_image_func.c
deleted file mode 100755 (executable)
index fa3502a..0000000
+++ /dev/null
@@ -1,500 +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.
- *
- */
-/**
-* @ingroup     MMF_UTIL_API
-* @addtogroup  UTIL
-*/
-
-/**
-* @ingroup     UTIL
-* @addtogroup  UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_UTIL Unit
-* @addtogroup  UTS_MMF_UTIL_ROTATE_IMAGE Uts_Mmf_Util_Rotate_Image
-* @{
-*/
-
-/**
-* @file uts_mm_util_rotate_image.c
-* @brief This is a suit of unit test cases to test mm_util_rotate_image API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_util_rotate_image_func_01 , 1},
-       {utc_mm_util_rotate_image_func_02 , 2},
-       {utc_mm_util_rotate_image_func_03 , 3},
-       {utc_mm_util_rotate_image_func_04 , 4},
-       {utc_mm_util_rotate_image_func_05 , 5},
-       {utc_mm_util_rotate_image_func_06 , 6},
-       {utc_mm_util_rotate_image_func_07 , 7},
-       {utc_mm_util_rotate_image_func_08 , 8},
-       {utc_mm_util_rotate_image_func_09 , 9},
-       {utc_mm_util_rotate_image_func_10 , 10},
-       {utc_mm_util_rotate_image_func_11 , 11},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-       tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-       tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_rotate_image_func_01()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, angle);
-
-       dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_02()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(NULL, src_width, src_height, src_format, dst, &dst_width, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_03()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, -1, src_height, src_format, dst, &dst_width, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_04()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, -1, src_format, dst, &dst_width, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_05()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, -1, dst, &dst_width, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_06()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, 20, dst, &dst_width, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_07()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, src_format, NULL, &dst_width, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_08()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, NULL, &dst_height, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_09()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, NULL, angle);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_10()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       //mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, -1);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-void utc_mm_util_rotate_image_func_11()
-{
-       int ret = 0;
-       unsigned char *src;
-       unsigned int src_width = 100;
-       unsigned int src_height = 100;
-       unsigned int src_size;
-       mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
-       unsigned char *dst;
-       unsigned int dst_width = 100;
-       unsigned int dst_height = 100;
-       unsigned int dst_size;
-       //mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
-       FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
-       tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
-       /* Get the data of the Image */
-       ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
-       src = malloc(src_size);
-       fread(src, 1, src_size, fp);
-
-       ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
-       dst = malloc(dst_size);
-
-       ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, 20);
-
-       dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-       free(src);
-       free(dst);
-       fclose(fp);
-       return;
-}
-
-
-
-/** @} */
-
-
-
-
index ae79387..a88b690 100755 (executable)
@@ -8,6 +8,8 @@ AC_CONFIG_HEADER([config.h])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
 # Checks for programs.
+m4_pattern_allow([AM_PROG_AR])
+AM_PROG_AR
 AC_PROG_CC
 AC_PROG_LIBTOOL
 
@@ -58,6 +60,9 @@ PKG_CHECK_MODULES(SYSTEMINFO, capi-system-info)
 AC_SUBST(SYSTEMINFO_CFLAGS)
 AC_SUBST(SYSTEMINFO_LIBS)
 
+PKG_CHECK_MODULES(TTRACE, [ttrace], AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available]))
+AC_SUBST(TTRACE)
+
 AC_CONFIG_FILES([Makefile
                 imgp/Makefile
                 imgp/test/Makefile
index 72dc083..8fcda4b 100755 (executable)
@@ -34,7 +34,7 @@ libmmutil_imgp_la_LIBADD = $(MMCOMMON_LIBS) \
                            $(TBM_LIBS) \
                            $(MMLOG_LIBS)
 
-libmmutil_imgp_la_CFLAGS += -lcapi-media-tool -DMMF_LOG_OWNER=0x0100 -DMMF_DEBUG_PREFIX=\"MMF-IMAGE\"
+libmmutil_imgp_la_CFLAGS += -lcapi-media-tool -lttrace -DMMF_LOG_OWNER=0x0100 -DMMF_DEBUG_PREFIX=\"MMF-IMAGE\"
 
 pcfiles = mmutil-imgp.pc
 pkgconfigdir = $(libdir)/pkgconfig
index a9dc627..8aeb171 100755 (executable)
@@ -201,7 +201,7 @@ mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned int
  */
 
 int
-mm_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
+mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
 
 /**
  *
@@ -211,7 +211,7 @@ mm_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
  * @param      completed_callback                                      [in]                    Completed_callback
  * @param      user_param                                              [in]                    User parameter which is received from user when callback function was set
 
- * @return     This function returns transcode processor result value
+ * @return     This function returns transform processor result value
  *             if the result is 0, then you can use output_Filename pointer(char** value)
  *             else if the result is -1, then do not execute when the colopsapce converter is not supported
  */
@@ -249,7 +249,7 @@ mm_util_destroy(MMHandleType MMHandle);
  * @since       R1, 1.0
  */
 int
-mm_util_convert_colorspace(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                            unsigned char *dst, mm_util_img_format dst_format);
 
 
@@ -270,7 +270,7 @@ mm_util_convert_colorspace(unsigned char *src, unsigned int src_width, unsigned
  * @since       R1, 1.0
  */
 int
-mm_util_resize_image(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                      unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height);
 
 
@@ -292,7 +292,7 @@ mm_util_resize_image(unsigned char *src, unsigned int src_width, unsigned int sr
  * @since       R1, 1.0
  */
 int
-mm_util_rotate_image(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                      unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle);
 
 /**
@@ -315,7 +315,7 @@ mm_util_rotate_image(unsigned char *src, unsigned int src_width, unsigned int sr
  * @since       R1, 1.0
  */
 int
-mm_util_crop_image(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                      unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_width, unsigned int *crop_dest_height, unsigned char *dst);
 
 #ifdef __cplusplus
old mode 100644 (file)
new mode 100755 (executable)
index 93729d0..71f86f0
@@ -47,7 +47,7 @@
 #define PATH_GSTCS_LIB                                 "/usr/lib/libmmutil_imgp_gstcs.so"
 
 #define IMGP_FUNC_NAME                                 "mm_imgp"
-#define IMGP_FREE(src) { if(src) {g_free(src); src = NULL;} }
+#define IMGP_FREE(src) { if(src != NULL) {g_free(src); src = NULL;} }
 #define SCMN_IMGB_MAX_PLANE         (4)
 #define MAX_SRC_BUF_NUM          12    /* Max number of upstream src plugins's buffer */
 #define MAX_DST_BUF_NUM          12
@@ -91,6 +91,7 @@ typedef struct _imgp_info_s
        unsigned int dst_height;
        unsigned int output_stride;
        unsigned int output_elevation;
+       unsigned int buffer_size;
        mm_util_img_rotate_type angle;
 } imgp_info_s;
 
@@ -153,10 +154,10 @@ typedef struct
        unsigned int dst_width;
        unsigned int dst_height;
        mm_util_rotation_e dst_rotation;
-
        bool hardware_acceleration;
        mm_util_cb_s *_util_cb;
        bool is_completed;
+       bool is_finish;
 
        tbm_bufmgr tbm;
        tbm_bo src_bo;
@@ -166,21 +167,25 @@ typedef struct
        unsigned int dst_key;
        tbm_bo_handle dst_bo_handle;
 
+       bool set_convert;
+       bool set_crop;
+       bool set_resize;
+       bool set_rotate;
+
        /* Src paramters */
        guint src_buf_size; /**< for a standard colorspace format */
        /* Dst paramters */
        guint dst_buf_size;
 
-       /* Properties */
-
        /* DRM/GEM information */
        guint src_buf_idx;
        guint dst_buf_idx;
 
        /* for multi instance */
-       GMutex * instance_lock;
-       GMutex *fd_lock;
-       GMutex *buf_idx_lock;
+       GCond thread_cond;
+       GMutex thread_mutex;
+       GThread* thread;
+       GAsyncQueue *queue;
 } mm_util_s;
 
 #ifdef __cplusplus
index 647e6c1..9b3f20d 100755 (executable)
 #include "mm_util_imgp_internal.h"
 #include <gmodule.h>
 #include <mm_error.h>
+#ifdef ENABLE_TTRACE
+#include <ttrace.h>
+#define TTRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_IMAGE, NAME)
+#define TTRACE_END() traceEnd(TTRACE_TAG_IMAGE)
+#else //ENABLE_TTRACE
+#define TTRACE_BEGIN(NAME)
+#define TTRACE_END()
+#endif //ENABLE_TTRACE
 
 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
 #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);
 
-static int
-check_valid_picture_size(int width, int height)
+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) {
                return MM_ERROR_NONE;
        }
+
        return MM_ERROR_IMAGE_INVALID_VALUE;
 }
 
-static gboolean
-_mm_cannot_convert_format(mm_util_img_format src_format, mm_util_img_format dst_format )
+static void __mm_destroy_temp_buffer(unsigned char *buffer[])
+{
+       int i = 0;
+
+       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 )
 {
        gboolean _bool=FALSE;
+
        debug_log("src_format: %d, dst_format:%d", src_format, dst_format);
+
        if((dst_format == MM_UTIL_IMG_FMT_NV16) || (dst_format == MM_UTIL_IMG_FMT_NV61) ||
                ((src_format == MM_UTIL_IMG_FMT_YUV422) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
                ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
                ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
                ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
                ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
                ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
                ((src_format == MM_UTIL_IMG_FMT_BGRX8888) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUV422)) || ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_UYVY)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUYV)) || ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_BGRX8888)) ) {
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUV422)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_UYVY)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUYV)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_BGRX8888)) ) {
 
                _bool = TRUE;
        }
@@ -75,84 +90,111 @@ _mm_cannot_convert_format(mm_util_img_format src_format, mm_util_img_format dst_
        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;
+
        debug_log("Format label: %s",__format_label);
+
        if(strcmp(__format_label, "AYUV") == 0
                || strcmp(__format_label, "UYVY") == 0 ||strcmp(__format_label, "Y800") == 0 || strcmp(__format_label, "I420") == 0 || strcmp(__format_label, "YV12") == 0
                || strcmp(__format_label, "RGB888") == 0 || strcmp(__format_label, "RGB565") == 0 || strcmp(__format_label, "BGR888") == 0 || strcmp(__format_label, "RGBA8888") == 0
-               || strcmp(__format_label, "ARGB8888") == 0 ||strcmp(__format_label, "BGRA8888") == 0 ||strcmp(__format_label, "ABGR8888") == 0 ||strcmp(__format_label, "RGBX") == 0
-               ||strcmp(__format_label, "XRGB") == 0 ||strcmp(__format_label, "BGRX") == 0 ||strcmp(__format_label, "XBGR") == 0 ||strcmp(__format_label, "Y444") == 0
-               ||strcmp(__format_label, "Y42B") == 0 ||strcmp(__format_label, "YUY2") == 0 ||strcmp(__format_label, "YUYV") == 0 ||strcmp(__format_label, "UYVY") == 0
-               ||strcmp(__format_label, "Y41B") == 0 ||strcmp(__format_label, "Y16") == 0 ||strcmp(__format_label, "Y800") == 0 ||strcmp(__format_label, "Y8") == 0
-               ||strcmp(__format_label, "GREY") == 0 ||strcmp(__format_label, "AY64") == 0 || strcmp(__format_label, "YUV422") == 0) {
+               || strcmp(__format_label, "ARGB8888") == 0 ||strcmp(__format_label, "BGRA8888") == 0 || strcmp(__format_label, "ABGR8888") == 0 || strcmp(__format_label, "RGBX") == 0
+               || strcmp(__format_label, "XRGB") == 0 || strcmp(__format_label, "BGRX") == 0 || strcmp(__format_label, "XBGR") == 0 || strcmp(__format_label, "Y444") == 0
+               || strcmp(__format_label, "Y42B") == 0 || strcmp(__format_label, "YUY2") == 0 || strcmp(__format_label, "YUYV") == 0 || strcmp(__format_label, "UYVY") == 0
+               || strcmp(__format_label, "Y41B") == 0 || strcmp(__format_label, "Y16") == 0 || strcmp(__format_label, "Y800") == 0 || strcmp(__format_label, "Y8") == 0
+               || strcmp(__format_label, "GREY") == 0 || strcmp(__format_label, "AY64") == 0 || strcmp(__format_label, "YUV422") == 0) {
 
                _bool=TRUE;
        }
+
        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;
-       debug_log("Format label: %s boolean: %d",__format_label, _bool);
+
+       debug_log("Format label: %s boolean: %d", __format_label, _bool);
+
        if(strcmp(__format_label, "I420") == 0 ||strcmp(__format_label, "YV12") == 0 || strcmp(__format_label, "IYUV") == 0
                || strcmp(__format_label, "RGB888") == 0||strcmp(__format_label, "BGR888") == 0 ||strcmp(__format_label, "RGBA8888") == 0
                || strcmp(__format_label, "ARGB8888") == 0 ||strcmp(__format_label, "BGRA8888") == 0 ||strcmp(__format_label, "ABGR8888") == 0 ) {
+
                _bool=TRUE;
        }
+
        debug_log("boolean: %d",_bool);
+
        return _bool;
 }
 
-static gboolean
-_mm_select_convert_plugin(mm_util_img_format src_format, mm_util_img_format dst_format )
+static gboolean __mm_select_convert_plugin(mm_util_img_format src_format, mm_util_img_format dst_format )
 {
        gboolean _bool=FALSE;
+
        debug_log("src_format: %d, dst_format:%d", src_format, dst_format);
-       if(((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_NV12)) || ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) || ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) || ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
+
+       if(((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
                ((src_format == MM_UTIL_IMG_FMT_YUV420) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_NV12)) || ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) || ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) || ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
+               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
                ((src_format == MM_UTIL_IMG_FMT_I420) && (dst_format == MM_UTIL_IMG_FMT_NV12_TILED)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) || ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) || ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
                ((src_format == MM_UTIL_IMG_FMT_NV12) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) || ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+               ((src_format == MM_UTIL_IMG_FMT_UYVY) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) || ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) || ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
                ((src_format == MM_UTIL_IMG_FMT_YUYV) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
                ((src_format == MM_UTIL_IMG_FMT_RGB565) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
                ((src_format == MM_UTIL_IMG_FMT_RGB888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
                ((src_format == MM_UTIL_IMG_FMT_ARGB8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
 
-               ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
                ((src_format == MM_UTIL_IMG_FMT_BGRA8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) || ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
-
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) || ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_NV12)) || ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
+               ((src_format == MM_UTIL_IMG_FMT_RGBA8888) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
+
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_YUV420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_I420)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_NV12)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGB565)) ||
                ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGB888)) ||
-               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) || ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_ARGB8888)) ||
+               ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_BGRA8888)) ||
                ((src_format == MM_UTIL_IMG_FMT_NV12_TILED) && (dst_format == MM_UTIL_IMG_FMT_RGBA8888))) {
 
                _bool = TRUE;
@@ -161,25 +203,26 @@ _mm_select_convert_plugin(mm_util_img_format src_format, mm_util_img_format dst_
        return _bool;
 }
 
-static gboolean
-_mm_select_resize_plugin(mm_util_img_format _format)
+static gboolean __mm_select_resize_plugin(mm_util_img_format _format)
 {
        gboolean _bool = FALSE;
+
        debug_log("_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;
 }
 
-static gboolean
-_mm_select_rotate_plugin(mm_util_img_format _format, unsigned int width, unsigned int height, mm_util_img_rotate_type angle)
+static gboolean __mm_select_rotate_plugin(mm_util_img_format _format, unsigned int width, unsigned int height, mm_util_img_rotate_type angle)
 {
        debug_log("_format: %d (angle: %d)", _format, angle);
 
-       if((_format == MM_UTIL_IMG_FMT_YUV420) || (_format == MM_UTIL_IMG_FMT_I420) || (_format == MM_UTIL_IMG_FMT_NV12)
+       if ((_format == MM_UTIL_IMG_FMT_YUV420) || (_format == MM_UTIL_IMG_FMT_I420) || (_format == MM_UTIL_IMG_FMT_NV12)
                ||(_format == MM_UTIL_IMG_FMT_RGB888 ||_format == MM_UTIL_IMG_FMT_RGB565)) {
                return TRUE;
        }
@@ -187,12 +230,123 @@ _mm_select_rotate_plugin(mm_util_img_format _format, unsigned int width, unsigne
        return FALSE;
 }
 
-static int
-_mm_confirm_dst_width_height(unsigned int src_width, unsigned int src_height, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
+static gboolean __mm_is_rgb_format(mm_util_img_format format)
+{
+       debug_log("format: %d", format);
+
+       if ((format == MM_UTIL_IMG_FMT_RGB565) ||
+               (format == MM_UTIL_IMG_FMT_RGB888) ||
+               (format == MM_UTIL_IMG_FMT_ARGB8888) ||
+               (format == MM_UTIL_IMG_FMT_BGRA8888) ||
+               (format == MM_UTIL_IMG_FMT_RGBA8888) ||
+               (format == MM_UTIL_IMG_FMT_BGRX8888)) {
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+int __mm_util_get_buffer_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize)
+{
+       int ret = MM_ERROR_NONE;
+       unsigned char x_chroma_shift = 0;
+       unsigned char y_chroma_shift = 0;
+       int size, w2, h2, size2;
+       int stride, stride2;
+
+       TTRACE_BEGIN("MM_UTILITY:IMGP:GET_SIZE");
+
+       if (!imgsize) {
+               debug_error("imgsize can't be null");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_FILEOPEN;
+       }
+
+       *imgsize = 0;
+
+       if (check_valid_picture_size(width, height) < 0) {
+               debug_error("invalid width and height");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       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:
+                       debug_error("Not supported format");
+                       TTRACE_END();
+                       return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+       }
+       debug_log("format: %d, *imgsize: %d\n", format, *imgsize);
+
+       TTRACE_END();
+       return ret;
+}
+
+static int __mm_confirm_dst_width_height(unsigned int src_width, unsigned int src_height, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
 {
        int ret = MM_ERROR_NONE;
 
-       if(!dst_width || !dst_height) {
+       if (!dst_width || !dst_height) {
                debug_error("[%s][%05d] dst_width || dst_height Buffer is NULL");
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
@@ -228,14 +382,14 @@ _mm_confirm_dst_width_height(unsigned int src_width, unsigned int src_height, un
                        break;
 
                default:
-                       debug_error("Not supported rotate value\n");
+                       debug_error("Not supported rotate value");
                        return MM_ERROR_IMAGE_INVALID_VALUE;
        }
+
        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_ERROR_NONE;
        char *src_fmt_lable = NULL;
@@ -247,40 +401,40 @@ _mm_set_format_label(imgp_info_s * _imgp_info_s, mm_util_img_format src_format,
 
        switch(src_format) {
                case MM_UTIL_IMG_FMT_YUV420:
-                       src_fmt_lable = "YV12";
+                       src_fmt_lable = (char *)"YV12";
                        break;
                case MM_UTIL_IMG_FMT_YUV422:
-                       src_fmt_lable = "Y42B";
+                       src_fmt_lable = (char *)"Y42B";
                        break;
                case MM_UTIL_IMG_FMT_I420:
-                       src_fmt_lable = "I420";
+                       src_fmt_lable = (char *)"I420";
                        break;
                case MM_UTIL_IMG_FMT_NV12:
-                       src_fmt_lable = "NV12";
+                       src_fmt_lable = (char *)"NV12";
                        break;
                case MM_UTIL_IMG_FMT_UYVY:
-                       src_fmt_lable = "UYVY";
+                       src_fmt_lable = (char *)"UYVY";
                        break;
                case MM_UTIL_IMG_FMT_YUYV:
-                       src_fmt_lable = "YUYV";
+                       src_fmt_lable = (char *)"YUYV";
                        break;
                case MM_UTIL_IMG_FMT_RGB565:
-                       src_fmt_lable = "RGB565";
+                       src_fmt_lable = (char *)"RGB565";
                        break;
                case MM_UTIL_IMG_FMT_RGB888:
-                       src_fmt_lable = "RGB888";
+                       src_fmt_lable = (char *)"RGB888";
                        break;
                case MM_UTIL_IMG_FMT_ARGB8888:
-                       src_fmt_lable = "ARGB8888";
+                       src_fmt_lable = (char *)"ARGB8888";
                        break;
                case MM_UTIL_IMG_FMT_BGRA8888:
-                       src_fmt_lable = "BGRA8888";
+                       src_fmt_lable = (char *)"BGRA8888";
                        break;
                case MM_UTIL_IMG_FMT_RGBA8888:
-                       src_fmt_lable = "RGBA8888";
+                       src_fmt_lable = (char *)"RGBA8888";
                        break;
                case MM_UTIL_IMG_FMT_BGRX8888:
-                       src_fmt_lable = "BGRX";
+                       src_fmt_lable = (char *)"BGRX";
                        break;
                default:
                        debug_log("[%d] Not supported format", src_fmt_lable);
@@ -289,40 +443,40 @@ _mm_set_format_label(imgp_info_s * _imgp_info_s, mm_util_img_format src_format,
 
        switch(dst_format) {
                case MM_UTIL_IMG_FMT_YUV420:
-                       dst_fmt_lable = "YV12";
+                       dst_fmt_lable = (char *)"YV12";
                        break;
                case MM_UTIL_IMG_FMT_YUV422:
-                       dst_fmt_lable = "Y42B";
+                       dst_fmt_lable = (char *)"Y42B";
                        break;
                case MM_UTIL_IMG_FMT_I420:
-                       dst_fmt_lable = "I420";
+                       dst_fmt_lable = (char *)"I420";
                        break;
                case MM_UTIL_IMG_FMT_NV12:
-                       dst_fmt_lable = "NV12";
+                       dst_fmt_lable = (char *)"NV12";
                        break;
                case MM_UTIL_IMG_FMT_UYVY:
-                       dst_fmt_lable = "UYVY";
+                       dst_fmt_lable = (char *)"UYVY";
                        break;
                case MM_UTIL_IMG_FMT_YUYV:
-                       dst_fmt_lable = "YUYV";
+                       dst_fmt_lable = (char *)"YUYV";
                        break;
                case MM_UTIL_IMG_FMT_RGB565:
-                       dst_fmt_lable = "RGB565";
+                       dst_fmt_lable = (char *)"RGB565";
                        break;
                case MM_UTIL_IMG_FMT_RGB888:
-                       dst_fmt_lable = "RGB888";
+                       dst_fmt_lable = (char *)"RGB888";
                        break;
                case MM_UTIL_IMG_FMT_ARGB8888:
-                       dst_fmt_lable = "ARGB8888";
+                       dst_fmt_lable = (char *)"ARGB8888";
                        break;
                case MM_UTIL_IMG_FMT_BGRA8888:
-                       dst_fmt_lable = "BGRA8888";
+                       dst_fmt_lable = (char *)"BGRA8888";
                        break;
                case MM_UTIL_IMG_FMT_RGBA8888:
-                       dst_fmt_lable = "RGBA8888";
+                       dst_fmt_lable = (char *)"RGBA8888";
                        break;
                case MM_UTIL_IMG_FMT_BGRX8888:
-                       dst_fmt_lable = "BGRX";
+                       dst_fmt_lable = (char *)"BGRX";
                        break;
                default:
                        debug_error("[%d] Not supported format", dst_format);
@@ -353,31 +507,33 @@ _mm_set_format_label(imgp_info_s * _imgp_info_s, mm_util_img_format src_format,
                debug_error("[error] src_fmt_lable && dst_fmt_lable");
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
+
        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_ERROR_NONE;
+
        if(_imgp_info_s == NULL) {
                debug_error("_imgp_info_s is NULL");
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       ret=_mm_set_format_label(_imgp_info_s, src_format, dst_format);
+       ret = __mm_set_format_label(_imgp_info_s, src_format, dst_format);
        if(ret != MM_ERROR_NONE) {
                debug_error("[input] mm_set_format_label error");
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       _imgp_info_s->src_format=src_format;
+       _imgp_info_s->src_format = src_format;
        _imgp_info_s->src_width = src_width;
        _imgp_info_s->src_height= src_height;
 
-       _imgp_info_s->dst_format=dst_format;
+       _imgp_info_s->dst_format = dst_format;
        _imgp_info_s->dst_width = dst_width;
        _imgp_info_s->dst_height = dst_height;
+       _imgp_info_s->buffer_size = 0;
        _imgp_info_s->angle= angle;
 
        debug_log("[input] format label: %s width: %d height: %d [output] format label: %s width: %d height: %d rotation_value: %d",
@@ -387,46 +543,49 @@ _mm_set_imgp_info_s(imgp_info_s * _imgp_info_s, mm_util_img_format src_format, u
        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;
-       debug_log("#Start dlopen#");
+       debug_fenter();
 
        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) {
                module = g_module_open(PATH_GSTCS_LIB, G_MODULE_BIND_LAZY);
        }
-       debug_log("#Success g_module_open#");
+
        if( module == NULL ) {
                debug_error("%s | %s module open failed", PATH_NEON_LIB, PATH_GSTCS_LIB);
                return NULL;
        }
        debug_log("module: %p, g_module_name: %s", module, g_module_name (module));
+
        return module;
 }
 
-static IMGPInfoFunc
-_mm_util_imgp_process(GModule *module)
+static IMGPInfoFunc __mm_util_imgp_process(GModule *module)
 {
        IMGPInfoFunc mm_util_imgp_func = NULL;
+       debug_fenter();
 
        if(module == NULL) {
                debug_error("module is NULL");
                return NULL;
        }
 
-       debug_log("#_mm_util_imgp_process#");
-
        g_module_symbol(module, IMGP_FUNC_NAME, (gpointer*)&mm_util_imgp_func);
        debug_log("mm_util_imgp_func: %p", mm_util_imgp_func);
 
        return mm_util_imgp_func;
 }
 
-static int
-_mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s)
+static int _mm_util_transform_packet_finalize_callback(media_packet_h packet, int err, void* userdata)
+{
+       debug_log("==> finalize callback func is called [%d] \n", err);
+       return MEDIA_PACKET_FINALIZE;
+}
+
+static int __mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s)
 {
        int ret = MM_ERROR_NONE;
 
@@ -447,12 +606,11 @@ _mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s)
        return ret;
 }
 
-static int
-_mm_util_crop_rgba32(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_rgba32(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_ERROR_NONE;
-       int i;
+       unsigned int idx = 0;
        int src_bytesperline = src_width * 4;
        int dst_bytesperline = crop_dest_width * 4;
 
@@ -460,7 +618,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        src, src_width, src_height, src_format, crop_start_x, crop_start_y, crop_dest_width, crop_dest_height);
        src += crop_start_y * src_bytesperline + 4 * crop_start_x;
 
-       for (i = 0; i < crop_dest_height; i++) {
+       for (idx = 0; idx < crop_dest_height; idx++) {
                memcpy(dst, src, dst_bytesperline);
                src += src_bytesperline;
                dst += dst_bytesperline;
@@ -469,12 +627,11 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static int
-_mm_util_crop_rgb888(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_rgb888(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_ERROR_NONE;
-       int i;
+       unsigned int idx = 0;
        int src_bytesperline = src_width * 3;
        int dst_bytesperline = crop_dest_width * 3;
 
@@ -482,7 +639,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        src, src_width, src_height, src_format, crop_start_x, crop_start_y, crop_dest_width, crop_dest_height);
        src += crop_start_y * src_bytesperline + 3 * crop_start_x;
 
-       for (i = 0; i < crop_dest_height; i++) {
+       for (idx = 0; idx < crop_dest_height; idx++) {
                memcpy(dst, src, dst_bytesperline);
                src += src_bytesperline;
                dst += dst_bytesperline;
@@ -491,12 +648,11 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static int
-_mm_util_crop_rgb565(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_rgb565(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_ERROR_NONE;
-       int i;
+       unsigned int idx = 0;
        int src_bytesperline = src_width * 2;
        int dst_bytesperline = crop_dest_width * 2;
 
@@ -504,7 +660,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        src, src_width, src_height, src_format, crop_start_x, crop_start_y, crop_dest_width, crop_dest_height);
        src += crop_start_y * src_bytesperline + 2 * crop_start_x;
 
-       for (i = 0; i < crop_dest_height; i++) {
+       for (idx = 0; idx < crop_dest_height; idx++) {
                memcpy(dst, src, dst_bytesperline);
                src += src_bytesperline;
                dst += dst_bytesperline;
@@ -513,12 +669,11 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static int
-_mm_util_crop_yuv420(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+static int __mm_util_crop_yuv420(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char *dst)
 {
        int ret = MM_ERROR_NONE;
-       int i;
+       unsigned int idx = 0;
        int start_x = crop_start_x;
        int start_y = crop_start_y;
        debug_log("[Input] src: 0x%2x src, src_width: %d src_height: %d src_format: %d crop_start_x: %d crop_start_y: %d crop_dest_width: %d crop_dest_height: %d\n",
@@ -526,7 +681,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        const unsigned char *_src = src + start_y * src_width + start_x;
 
        /* Y */
-       for (i = 0; i < crop_dest_height; i++) {
+       for (idx = 0; idx < crop_dest_height; idx++) {
                memcpy(dst, _src, crop_dest_width);
                _src += src_width;
                dst += crop_dest_width;
@@ -534,7 +689,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
 
        /* U */
        _src = src + src_height * src_width + (start_y / 2) * src_width / 2 + start_x / 2;
-       for (i = 0; i < crop_dest_height / 2; i++) {
+       for (idx = 0; idx < crop_dest_height / 2; idx++) {
                memcpy(dst, _src, crop_dest_width / 2);
                _src += src_width / 2;
                dst += crop_dest_width / 2;
@@ -542,7 +697,7 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
 
        /* V */
        _src = src + src_height * src_width * 5 / 4 + (start_y / 2) * src_width / 2 + start_x / 2;
-       for (i = 0; i < crop_dest_height / 2; i++) {
+       for (idx = 0; idx < crop_dest_height / 2; idx++) {
                memcpy(dst, _src, crop_dest_width / 2);
                _src += src_width / 2;
                dst += crop_dest_width / 2;
@@ -551,26 +706,24 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
        return ret;
 }
 
-static bool
-_mm_util_check_resolution(unsigned int width, unsigned int height)
+static bool __mm_util_check_resolution(unsigned int width, unsigned int height)
 {
        if(width == 0)
        {
                debug_error("invalid width [%d]", width);
-               return false;
+               return FALSE;
        }
 
        if(height == 0)
        {
                debug_error("invalid height [%d]", height);
-               return false;
+               return FALSE;
        }
 
-       return true;
+       return TRUE;
 }
 
-static int
-_mm_util_handle_init(mm_util_s *handle)
+static int __mm_util_handle_init(mm_util_s *handle)
 {
        int ret = MM_ERROR_NONE;
 
@@ -580,24 +733,59 @@ _mm_util_handle_init(mm_util_s *handle)
        }
 
        /* private values init */
-       handle->src = 0;
-       handle->dst = 0;
+       handle->src = NULL;
+       handle->dst = NULL;
        handle->drm_fd = -1;
-       handle->dst_format = -1;
+       handle->dst_format = MM_UTIL_IMG_FMT_NUM;
        handle->dst_format_mime = -1;
        handle->src_buf_idx = 0;
        handle->dst_buf_idx = 0;
+       handle->dst_rotation = MM_UTIL_ROTATION_NONE;
 
        handle->start_x = -1;
        handle->start_y = -1;
+       handle->src_width = 0;
+       handle->src_height = 0;
+       handle->dst_width = 0;
+       handle->dst_height = 0;
        handle->is_completed = FALSE;
+       handle->is_finish = FALSE;
+
+       handle->set_convert = FALSE;
+       handle->set_crop = FALSE;
+       handle->set_resize = FALSE;
+       handle->set_rotate = FALSE;
 
        return ret;
 }
 
+static int __mm_util_handle_refresh(mm_util_s *handle)
+{
+       int ret = MM_ERROR_NONE;
+
+       if (!handle) {
+               debug_error("[ERROR] - handle");
+               return MM_ERROR_IMAGE_INTERNAL;
+       }
+
+       /* restore original settings */
+       if (handle->set_rotate && (handle->set_crop || handle->set_resize)) {
+               if ((handle->dst_rotation == MM_UTIL_ROTATION_90) || (handle->dst_rotation == MM_UTIL_ROTATION_270)) {
+                       unsigned int temp = 0;
+                       temp = handle->dst_width;
+                       handle->dst_width = handle->dst_height;
+                       handle->dst_height = temp;
+               }
+       }
+
+       handle->is_completed = FALSE;
+
+       handle->dst_packet = NULL;
+
+       return ret;
+}
 
-media_format_mimetype_e
-_mm_util_mapping_imgp_format_to_mime(mm_util_img_format format)
+static media_format_mimetype_e __mm_util_mapping_imgp_format_to_mime(mm_util_img_format format)
 {
        media_format_mimetype_e mimetype = -1;
 
@@ -635,24 +823,21 @@ _mm_util_mapping_imgp_format_to_mime(mm_util_img_format format)
                case MM_UTIL_IMG_FMT_ARGB8888 :
                        mimetype = MEDIA_FORMAT_ARGB;
                        break;
-               case MM_UTIL_IMG_FMT_BGRA8888 :
-               case MM_UTIL_IMG_FMT_BGRX8888 :
-               case MM_UTIL_IMG_FMT_NV61 :
-               case MM_UTIL_IMG_FMT_NUM :
-                       mimetype = -1;
-                       debug_error("Not Supported Format");
-                       break;
                case MM_UTIL_IMG_FMT_NV12_TILED :
                        mimetype = MEDIA_FORMAT_NV12T;
                        break;
+               default:
+                       mimetype = -1;
+                       debug_error("Not Supported Format [%d]", format);
+                       break;
        }
 
        debug_log("imgp fmt: %d mimetype fmt: %d", format, mimetype);
+
        return mimetype;
 }
 
-mm_util_img_format
-_mm_util_mapping_mime_format_to_imgp(media_format_mimetype_e mimetype)
+static mm_util_img_format __mm_util_mapping_mime_format_to_imgp(media_format_mimetype_e mimetype)
 {
        mm_util_img_format format = -1;
 
@@ -690,67 +875,111 @@ _mm_util_mapping_mime_format_to_imgp(media_format_mimetype_e mimetype)
                case MEDIA_FORMAT_ARGB :
                        format = MM_UTIL_IMG_FMT_ARGB8888;
                        break;
-               case MEDIA_FORMAT_NV21 :
-               case MEDIA_FORMAT_H261 :
-               case MEDIA_FORMAT_H263 :
-               case MEDIA_FORMAT_H263P :
-               case MEDIA_FORMAT_H264_SP :
-               case MEDIA_FORMAT_H264_MP :
-               case MEDIA_FORMAT_H264_HP :
-               case MEDIA_FORMAT_MJPEG :
-               case MEDIA_FORMAT_MPEG1 :
-               case MEDIA_FORMAT_MPEG2_SP :
-               case MEDIA_FORMAT_MPEG2_MP :
-               case MEDIA_FORMAT_MPEG2_HP :
-               case MEDIA_FORMAT_MPEG4_SP :
-               case MEDIA_FORMAT_MPEG4_ASP :
-               case MEDIA_FORMAT_L16:
-               case MEDIA_FORMAT_PCM :
-               case MEDIA_FORMAT_PCMA :
-               case MEDIA_FORMAT_ALAW :
-               case MEDIA_FORMAT_PCMU :
-               case MEDIA_FORMAT_ULAW :
-               case MEDIA_FORMAT_AMR :
-               case MEDIA_FORMAT_G729 :
-               case MEDIA_FORMAT_AAC:
-               case MEDIA_FORMAT_MP3:
-               case MEDIA_FORMAT_MAX :
-                       format = -1;
-                       debug_error("Not Supported Format");
-                       break;
                case MEDIA_FORMAT_NV12T :
                        format = MM_UTIL_IMG_FMT_NV12_TILED;
                        break;
+               default:
+                       format = -1;
+                       debug_error("Not Supported Format [%d]", mimetype);
+                       break;
        }
+
        debug_log("mimetype: %d imgp fmt: %d", mimetype, format);
+
        return format;
 }
 
-bool
-_mm_transform_completed_cb(media_packet_h *dst, int error, void *user_param)
+gpointer _mm_util_thread_repeate(gpointer data)
 {
-       if (!user_param) {
+       mm_util_s* handle = (mm_util_s*) data;
+       int ret = MM_ERROR_NONE;
+       gint64 end_time = 0;
+
+       if (!handle) {
                debug_error("[ERROR] - handle");
-               return MM_ERROR_IMAGE_INTERNAL;
+               return NULL;
+       }
+
+       while (!handle->is_finish) {
+               end_time = g_get_monotonic_time() + 1 * G_TIME_SPAN_SECOND;
+               debug_log("waiting...");
+               g_mutex_lock (&(handle->thread_mutex));
+               g_cond_wait_until(&(handle->thread_cond), &(handle->thread_mutex), end_time);
+               debug_log("<=== get run transform thread signal");
+               g_mutex_unlock (&(handle->thread_mutex));
+
+               if (handle->is_finish) {
+                       debug_log("exit loop");
+                       break;
+               }
+
+               media_packet_h pop_data = (media_packet_h) g_async_queue_try_pop(handle->queue);
+
+               if(!pop_data) {
+                       debug_error("[NULL] Queue data");
+               } else {
+                       ret = __mm_util_transform_exec(handle, pop_data); /* Need to block */
+                       if(ret == MM_ERROR_NONE) {
+                               debug_log("Success - transform_exec");
+                       } else{
+                               debug_error("Error - transform_exec");
+                       }
+                       if(handle->_util_cb->completed_cb) {
+                               debug_log("completed_cb");
+                               handle->_util_cb->completed_cb(&handle->dst_packet, ret, handle->_util_cb->user_data);
+                               debug_log("completed_cb %p", &handle->dst);
+                       }
+
+                       __mm_util_handle_refresh(handle);
+               }
+       }
+
+       debug_log("exit thread");
+
+       return NULL;
+}
+
+static int __mm_util_create_thread(mm_util_s *handle)
+{
+       int ret = MM_ERROR_NONE;
+
+       if (!handle) {
+               debug_error("[ERROR] - handle");
+               return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       mm_util_s * handle = (mm_util_s *)user_param;
-       if(error == MM_ERROR_NONE) {
-               handle->is_completed = TRUE;
-               debug_log("completed");
+       g_mutex_init(&(handle->thread_mutex));
+
+       /*These are a communicator for thread*/
+       if(!handle->queue) {
+               handle->queue = g_async_queue_new();
        } else {
-               debug_error("[ERROR] complete cb");
+               debug_error("ERROR - async queue is already created");
        }
 
-       return TRUE;
+       g_cond_init(&(handle->thread_cond));
+
+       /*create threads*/
+       handle->thread = g_thread_new("transform_thread", (GThreadFunc)_mm_util_thread_repeate, (gpointer)handle);
+       if(!handle->thread) {
+               debug_error("ERROR - create thread");
+               return MM_ERROR_IMAGE_INTERNAL;
+       }
+
+       return ret;
 }
 
-int _mm_util_processing(mm_util_s *handle)
+static int __mm_util_processing(mm_util_s *handle)
 {
        int ret = MM_ERROR_NONE;
+       unsigned char *dst_buf[4] = {NULL,};
+       unsigned int dst_buf_size = 0;
+       unsigned int src_width = 0, src_height = 0;
+       mm_util_img_format src_format;
+       unsigned int src_index = 0, dst_index = 0;
 
        if(handle == NULL) {
-               debug_error ("Invalid arguments [tag null]\n");
+               debug_error ("Invalid arguments [tag null]");
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
@@ -786,217 +1015,501 @@ int _mm_util_processing(mm_util_s *handle)
 
        debug_log("src: %p, dst: %p", handle->src, handle->dst);
 
-       if(handle->src_format == handle->dst_format) {
-               if((handle->src_width == handle->dst_width) && (handle->src_height == handle->dst_height)) {
-                       if(handle->dst_rotation !=MM_UTIL_ROTATION_NONE) {
-                               ret = mm_util_rotate_image(handle->src, handle->src_width, handle->src_height,handle->src_format, handle->dst, &handle->dst_width, &handle->dst_height, handle->dst_rotation);
-                               if (ret != MM_ERROR_NONE) {
-                                       IMGP_FREE(handle->src);
-                                       IMGP_FREE(handle->dst);
-                                       debug_error("mm_util_rotate_image failed");
-                                       return MM_ERROR_IMAGE_INTERNAL;
-                               }
-                       } else {
-                               IMGP_FREE(handle->src);
-                               IMGP_FREE(handle->dst);
-                               debug_error("[Error] rotate info");
-                               return MM_ERROR_IMAGE_INVALID_VALUE;
-                       }
-               } else {
-                       ret = mm_util_resize_image(handle->src, handle->src_width, handle->src_height,handle->src_format, handle->dst, &handle->dst_width, &handle->dst_height);
-                       if (ret != MM_ERROR_NONE) {
-                               debug_error("mm_util_resize_image failed");
-                               return MM_ERROR_IMAGE_INTERNAL;
-                       }
+       dst_buf[src_index] = g_malloc(handle->src_buf_size);
+       src_width = handle->src_width;
+       src_height = handle->src_height;
+       src_format = handle->src_format;
+       if (dst_buf[src_index] == NULL) {
+               debug_error ("[multi func] memory allocation error");
+               IMGP_FREE(handle->src);
+               IMGP_FREE(handle->dst);
+               return MM_ERROR_IMAGE_INTERNAL;
+       }
+       memcpy(dst_buf[src_index], handle->src, handle->src_buf_size);
+       if (handle->set_crop) {
+               dst_index++;
+               mm_util_get_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
+               dst_buf[dst_index] = g_malloc(dst_buf_size);
+               if (dst_buf[dst_index] == NULL) {
+                       debug_error ("[multi func] memory allocation error");
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       return MM_ERROR_IMAGE_INTERNAL;
                }
-       } else if(handle->src_format != handle->dst_format){
-               if((handle->src_width == handle->dst_width) && (handle->src_height == handle->dst_height)) {
-                       if(handle->start_x == -1 && handle->start_y == -1) {
-                               ret = mm_util_convert_colorspace(handle->src, handle->src_width, handle->src_height,handle->src_format, handle->dst, handle->dst_format);
-                               if (ret != MM_ERROR_NONE) {
-                                       IMGP_FREE(handle->src);
-                                       IMGP_FREE(handle->dst);
-                                       debug_error("mm_util_convert_colorspace failed");
-                                       return MM_ERROR_IMAGE_INTERNAL;
-                               }
-                       } else {
-                               ret = mm_util_crop_image(handle->src, handle->src_width, handle->src_height, handle->src_format,
-                               handle->start_x, handle->start_y, &handle->dst_width, &handle->dst_height, handle->dst);
-                               if (ret != MM_ERROR_NONE) {
-                                       IMGP_FREE(handle->src);
-                                       IMGP_FREE(handle->dst);
-                                       debug_error("mm_util_convert_colorspace failed");
-                                       return MM_ERROR_IMAGE_INTERNAL;
-                               }
+               ret = mm_util_crop_image(dst_buf[src_index], src_width, src_height, src_format,
+               handle->start_x, handle->start_y, &handle->dst_width, &handle->dst_height, dst_buf[dst_index]);
+               if (ret != MM_ERROR_NONE) {
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       debug_error("mm_util_crop_image failed");
+                       return ret;
+               }
+               src_index = dst_index;
+               src_width = handle->dst_width;
+               src_height = handle->dst_height;
+       } else if (handle->set_resize) {
+               dst_index++;
+               mm_util_get_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
+               dst_buf[dst_index] = g_malloc(dst_buf_size);
+               if (dst_buf[dst_index] == NULL) {
+                       debug_error ("[multi func] memory allocation error");
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       return MM_ERROR_IMAGE_INTERNAL;
+               }
+               ret = mm_util_resize_image(dst_buf[src_index], src_width, src_height,src_format, dst_buf[dst_index], &handle->dst_width, &handle->dst_height);
+               if (ret != MM_ERROR_NONE) {
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       debug_error("mm_util_resize_image failed");
+                       return ret;
+               }
+               src_index = dst_index;
+               src_width = handle->dst_width;
+               src_height = handle->dst_height;
+       }
+
+       if (handle->set_convert) {
+               dst_index++;
+               mm_util_get_image_size(handle->dst_format, handle->dst_width, handle->dst_height, &dst_buf_size);
+               dst_buf[dst_index] = g_malloc(dst_buf_size);
+               if (dst_buf[dst_index] == NULL) {
+                       debug_error ("[multi func] memory allocation error");
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       return MM_ERROR_IMAGE_INTERNAL;
+               }
+               ret = mm_util_convert_colorspace(dst_buf[src_index], src_width, src_height, src_format, dst_buf[dst_index], handle->dst_format);
+               if (ret != MM_ERROR_NONE) {
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       debug_error("mm_util_convert_colorspace failed");
+                       return ret;
+               }
+               src_index = dst_index;
+               src_format = handle->dst_format;
+       }
+
+       if (handle->set_rotate) {
+               dst_index++;
+               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;
                        }
-               } else {
+               }
+               mm_util_get_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
+               dst_buf[dst_index] = g_malloc(dst_buf_size);
+               if (dst_buf[dst_index] == NULL) {
+                       debug_error ("[multi func] memory allocation error");
                        IMGP_FREE(handle->src);
                        IMGP_FREE(handle->dst);
-                       debug_error("[Error] Not supported");
-                       return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+                       __mm_destroy_temp_buffer(dst_buf);
+                       return MM_ERROR_IMAGE_INTERNAL;
+               }
+               ret = mm_util_rotate_image(dst_buf[src_index], src_width, src_height, src_format, dst_buf[dst_index], &handle->dst_width, &handle->dst_height, handle->dst_rotation);
+               if (ret != MM_ERROR_NONE) {
+                       IMGP_FREE(handle->src);
+                       IMGP_FREE(handle->dst);
+                       __mm_destroy_temp_buffer(dst_buf);
+                       debug_error("mm_util_rotate_image failed");
+                       return ret;
                }
+               src_index = dst_index;
+               src_width = handle->dst_width;
+               src_height = handle->dst_height;
        }
 
-       debug_log("End processing");
+       if (dst_buf[dst_index] != NULL && dst_buf_size != 0) {
+               memcpy(handle->dst, dst_buf[dst_index], dst_buf_size);
+               handle->dst_buf_size = dst_buf_size;
+       }
+       __mm_destroy_temp_buffer(dst_buf);
+
+       debug_error("mm_util_processing was finished");
+
        return ret;
 }
 
-static int
-_mm_util_handle_finalize(mm_util_s *handle)
+static int __mm_util_transform_exec(mm_util_s * handle, media_packet_h src_packet)
 {
        int ret = MM_ERROR_NONE;
-
-       if (!handle) {
-               debug_error("[ERROR] - handle");
+       media_format_h src_fmt;
+       media_format_h dst_fmt;
+       media_format_mimetype_e src_mimetype;
+       int src_width, src_height, src_avg_bps, src_max_bps;
+       unsigned int dst_width = 0, dst_height = 0;
+       uint64_t size = 0;
+
+       if(media_packet_get_format(src_packet, &src_fmt) != MM_ERROR_NONE) {
+               debug_error("Imedia_packet_get_format)");
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       if(media_format_get_video_info(src_fmt, &src_mimetype, &src_width, &src_height, &src_avg_bps, &src_max_bps) == MEDIA_FORMAT_ERROR_NONE) {
+               debug_log("[Fotmat: %d] W x H : %d x %d", src_mimetype, src_width, src_height);
+       }
+
+       if(__mm_util_check_resolution(src_width, src_height)) {
+               /* src */
+               handle->src_packet = src_packet;
+               debug_log("src_packet: %p handle->src_packet: %p 0x%2x [W X H] %d X %d", src_packet, handle->src_packet, src_fmt, src_width, src_height);
+               if(handle->src_packet) {
+                       handle->src_format = __mm_util_mapping_mime_format_to_imgp(src_mimetype);
+                       handle->src_width = src_width;
+                       handle->src_height = src_height;
+               } else {
+                       debug_error("[Error] handle->src");
+                       media_format_unref(src_fmt);
+                       return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
+               }
+
+               if(media_packet_get_buffer_size(handle->src_packet, &size) == MM_ERROR_NONE) {
+                       handle->src_buf_size = (guint)size;
+                       debug_log("src buffer(%p) %d size: %d", handle->src_packet, handle->src_packet, handle->src_buf_size);
+               } else {
+                       debug_error("Error buffer size");
+               }
+
+               if(handle->dst_format == MM_UTIL_IMG_FMT_NUM) {
+                       debug_log("dst format is changed");
+                       handle->dst_format = handle->src_format;
+                       handle->dst_format_mime = src_mimetype;
+               }
+
+               debug_log("src: %p handle->src_packet: %p (%d),(%d X %d)", src_packet, handle->src_packet, handle->src_packet, handle->src_width, handle->src_height);
+               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;
+                               }
+                       } 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:
+                                               debug_error("[Error] Wrong dst_rotation");
+                                               break;
+                               }
+                       }
+               } else {
+                       if ((handle->set_crop) || (handle->set_resize)) {
+                               dst_width = handle->dst_width;
+                               dst_height = handle->dst_height;
+                       } else {
+                               dst_width = handle->dst_width  = handle->src_width;
+                               dst_height = handle->dst_height = handle->src_height;
+                       }
+               }
+               debug_log("dst (%d X %d)", dst_width, dst_height);
+               if(media_format_make_writable(src_fmt, &dst_fmt) != MEDIA_FORMAT_ERROR_NONE) {
+                       media_format_unref(src_fmt);
+                       debug_error("[Error] Writable - dst format");
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               }
+
+               if(media_format_set_video_mime(dst_fmt, handle->dst_format_mime) != MEDIA_FORMAT_ERROR_NONE) {
+                       media_format_unref(src_fmt);
+                       media_format_unref(dst_fmt);
+                       debug_error("[Error] Set - video mime");
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               }
+
+               if(media_format_set_video_width(dst_fmt, dst_width) != MEDIA_FORMAT_ERROR_NONE) {
+                       media_format_unref(src_fmt);
+                       media_format_unref(dst_fmt);
+                       debug_error("[Error] Set - video width");
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               }
+
+               if(media_format_set_video_height(dst_fmt, dst_height) != MEDIA_FORMAT_ERROR_NONE) {
+                       media_format_unref(src_fmt);
+                       media_format_unref(dst_fmt);
+                       debug_error("[Error] Set - video height");
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               }
+
+               if(media_format_set_video_avg_bps(dst_fmt, src_avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
+                       media_format_unref(src_fmt);
+                       media_format_unref(dst_fmt);
+                       debug_error("[Error] Set - video avg bps");
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               }
+
+               if(media_format_set_video_max_bps(dst_fmt, src_max_bps) != MEDIA_FORMAT_ERROR_NONE) {
+                       media_format_unref(src_fmt);
+                       media_format_unref(dst_fmt);
+                       debug_error("[Error] Set - video max bps");
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               }
+
+               if(media_packet_create_alloc(dst_fmt, (media_packet_finalize_cb)_mm_util_transform_packet_finalize_callback, NULL, &handle->dst_packet) != MM_ERROR_NONE) {
+                       debug_error("[Error] Create allocation memory");
+                       media_format_unref(src_fmt);
+                       media_format_unref(dst_fmt);
+                       return MM_ERROR_IMAGE_INVALID_VALUE;
+               } else {
+                       debug_log("Success - dst media packet");
+                       if(media_packet_get_buffer_size(handle->dst_packet, &size) != MM_ERROR_NONE) {
+                               debug_error("Imedia_packet_get_format)");
+                               media_format_unref(src_fmt);
+                               media_format_unref(dst_fmt);
+                               return MM_ERROR_IMAGE_INVALID_VALUE;
+                       }
+                       handle->dst_buf_size = (guint)size;
+                       debug_log("handle->src_packet: %p [%d] %d X %d (%d) => handle->dst_packet: %p [%d] %d X %d (%d)",
+                               handle->src_packet, handle->src_format, handle->src_width, handle->src_height, handle->src_buf_size,
+                               handle->dst_packet, handle->dst_format,dst_width, dst_height, handle->dst_buf_size);
+               }
+       }else {
+               debug_error("%d %d", src_width, src_height);
+               media_format_unref(src_fmt);
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       ret = __mm_util_processing(handle);
+
+       if(ret != MM_ERROR_NONE) {
+               debug_error("__mm_util_processing failed");
+               IMGP_FREE(handle);
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       media_format_unref(src_fmt);
+       media_format_unref(dst_fmt);
+
+       return ret;
+}
+
+static int
+_mm_util_handle_finalize(mm_util_s *handle)
+{
+       int ret = MM_ERROR_NONE;
+
+       if (!handle) {
+               debug_error("[ERROR] - handle");
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
+       /* g_thread_exit(handle->thread); */
+       if(handle->thread) {
+               handle->is_finish = TRUE;
+               g_mutex_lock (&(handle->thread_mutex));
+               g_cond_signal(&(handle->thread_cond));
+               debug_log("===> send signal(finish) to transform_thread");
+               g_mutex_unlock (&(handle->thread_mutex));
+
+               g_thread_join(handle->thread);
+       }
+
+       if(handle->queue) {
+               g_async_queue_unref(handle->queue);
+               handle->queue = NULL;
+       }
+
+       g_mutex_clear(&(handle->thread_mutex));
+
+       g_cond_clear(&(handle->thread_cond));
+
+       debug_log("Success - Finalize Handle");
+
        return ret;
 }
 
-int
-mm_util_create(MMHandleType* MMHandle)
+int mm_util_create(MMHandleType* MMHandle)
 {
        int ret = MM_ERROR_NONE;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:CREATE");
+
        if(MMHandle == NULL) {
-               debug_error ("Invalid arguments [tag null]\n");
+               debug_error ("Invalid arguments [tag null]");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       mm_util_s *_handle = calloc(1,sizeof(mm_util_s));
-       if (!_handle) {
+       mm_util_s *handle = calloc(1,sizeof(mm_util_s));
+       if (!handle) {
                debug_error("[ERROR] - _handle");
                ret = MM_ERROR_IMAGE_INTERNAL;
        }
 
-       ret = _mm_util_handle_init (_handle);
+       ret = __mm_util_handle_init (handle);
        if(ret != MM_ERROR_NONE) {
                debug_error("_mm_util_handle_init failed");
-               IMGP_FREE(_handle);
+               IMGP_FREE(handle);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       *MMHandle = (MMHandleType)_handle;
+       ret = __mm_util_create_thread(handle);
+       if(ret != MM_ERROR_NONE) {
+               debug_error("ERROR - Create thread");
+               TTRACE_END();
+               return ret;
+       } else {
+               debug_log("Success -__mm_util_create_thread");
+       }
 
+       *MMHandle = (MMHandleType)handle;
+
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_set_hardware_acceleration(MMHandleType MMHandle, bool mode)
+int mm_util_set_hardware_acceleration(MMHandleType MMHandle, bool mode)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:SET_HARDWARE_ACCELERATION");
+
        if (!handle) {
                debug_error("[ERROR] - handle");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
        handle->hardware_acceleration = mode;
 
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_set_colorspace_convert(MMHandleType MMHandle, mm_util_img_format colorspace)
+int mm_util_set_colorspace_convert(MMHandleType MMHandle, mm_util_img_format colorspace)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:SET_HARDWARE_ACCELERATION");
+
        if (!handle) {
                debug_error("[ERROR] - handle");
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
+       handle->set_convert = TRUE;
        handle->dst_format = colorspace;
-       handle->dst_format_mime = _mm_util_mapping_imgp_format_to_mime(colorspace);
+       handle->dst_format_mime = __mm_util_mapping_imgp_format_to_mime(colorspace);
        debug_log("imgp fmt: %d mimetype: %d", handle->dst_format, handle->dst_format_mime);
 
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_set_resolution(MMHandleType MMHandle, unsigned int width, unsigned int height)
+int mm_util_set_resolution(MMHandleType MMHandle, unsigned int width, unsigned int height)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:SET_RESOLUTION");
+
        if (!handle) {
                debug_error("[ERROR] - handle");
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
+       handle->set_resize = TRUE;
        handle->dst_width = width;
        handle->dst_height = height;
 
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_set_rotation(MMHandleType MMHandle, mm_util_img_rotate_type rotation)
+int mm_util_set_rotation(MMHandleType MMHandle, mm_util_img_rotate_type rotation)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:SET_ROTATION");
+
        if (!handle) {
                debug_error("[ERROR] - handle");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
-       if(rotation == MM_UTIL_ROTATE_0 || rotation == MM_UTIL_ROTATE_180 || rotation == MM_UTIL_ROTATE_FLIP_HORZ || rotation == MM_UTIL_ROTATE_FLIP_VERT) {
-               handle->dst_width = handle->src_width;
-               handle->dst_height = handle->src_height;
-       } else if(rotation == MM_UTIL_ROTATE_90 || rotation == MM_UTIL_ROTATE_270) {
-               handle->dst_width = handle->src_height;
-               handle->dst_height = handle->src_width;
-       }
-
+       handle->set_rotate = TRUE;
        handle->dst_rotation = rotation;
 
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y)
+int mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:SET_CROP_AREA");
+
        unsigned int dest_width = end_x -start_x;
        unsigned int dest_height = end_y - start_y;
 
        if (!handle) {
                debug_error("[ERROR] - handle");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
+       handle->set_crop = TRUE;
        handle->start_x = start_x;
        handle->start_y = start_y;
        handle->dst_width = dest_width;
        handle->dst_height = dest_height;
 
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_transform(MMHandleType MMHandle, media_packet_h src_packet, mm_util_completed_callback completed_callback, void * user_data)
+int mm_util_transform(MMHandleType MMHandle, media_packet_h src_packet, mm_util_completed_callback completed_callback, void * user_data)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) MMHandle;
-       media_format_h src_fmt;
-       media_format_h dst_fmt;
-       media_format_mimetype_e src_mimetype;
-       int src_width, src_height, src_avg_bps, src_max_bps;
-       uint64_t size = 0;
+
+       TTRACE_BEGIN("MM_UTILITY:IMGP:TRANSFORM");
 
        if (!handle) {
                debug_error("[ERROR] - handle");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INTERNAL;
        }
 
        if(!src_packet) {
                debug_error("[ERROR] - src_packet");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        } else {
                debug_log("src: %p", src_packet);
@@ -1004,9 +1517,11 @@ mm_util_transform(MMHandleType MMHandle, media_packet_h src_packet, mm_util_comp
 
        if(!completed_callback) {
                debug_error("[ERROR] - completed_callback");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
+       IMGP_FREE(handle->_util_cb);
        handle->_util_cb = (mm_util_cb_s *)malloc(sizeof(mm_util_cb_s));
        if(handle->_util_cb) {
                handle->_util_cb->completed_cb= completed_callback;
@@ -1015,290 +1530,247 @@ mm_util_transform(MMHandleType MMHandle, media_packet_h src_packet, mm_util_comp
                debug_error("[ERROR] _util_cb_s");
        }
 
-       if(media_packet_get_format(src_packet, &src_fmt) != MM_ERROR_NONE) {
-               debug_error("Imedia_packet_get_format)");
-               return MM_ERROR_IMAGE_INVALID_VALUE;
+       if(handle->queue) {
+               debug_log("g_async_queue_push");
+               g_async_queue_push (handle->queue, GINT_TO_POINTER(src_packet));
+               g_mutex_lock (&(handle->thread_mutex));
+               g_cond_signal(&(handle->thread_cond));
+               debug_log("===> send signal to transform_thread");
+               g_mutex_unlock (&(handle->thread_mutex));
        }
 
-       if(media_format_get_video_info(src_fmt, &src_mimetype, &src_width, &src_height, &src_avg_bps, &src_max_bps) == MEDIA_FORMAT_ERROR_NONE) {
-               debug_log("[Fotmat: %d] W x H : %d x %d", src_mimetype, src_width, src_height);
-       }
-
-       if(_mm_util_check_resolution(src_width, src_height)) {
-               /* src */
-               handle->src_packet = src_packet;
-               debug_log("src_packet: %p handle->src_packet: %p 0x%2x [W X H] %d X %d", src_packet, handle->src_packet, src_fmt, src_width, src_height);
-               if(handle->src_packet) {
-                       handle->src_format = _mm_util_mapping_mime_format_to_imgp(src_mimetype);
-                       handle->src_width = src_width;
-                       handle->src_height = src_height;
-               } else {
-                       debug_error("[Error] handle->src");
-                       return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
-               }
-
-               if(media_packet_get_buffer_size(handle->src_packet, &size) == MM_ERROR_NONE) {
-                       handle->src_buf_size = (guint)size;
-                       debug_log("src buffer(%p) %d size: %d", handle->src_packet, handle->src_packet, handle->src_buf_size);
-               } else {
-                       debug_error("Error buffer size");
-               }
-
-               if(handle->dst_format == -1) {
-                       handle->dst_format = handle->src_format;
-                       handle->dst_format_mime = src_mimetype;
-               }
-
-               debug_log("src: %p handle->src_packet: %p (%d),(%d X %d)", src_packet, handle->src_packet, handle->src_packet, handle->src_width, handle->src_height);
-               if(handle->dst_width ==0 && handle->dst_height ==0) {
-                       switch(handle->dst_rotation) {
-                               case  MM_UTIL_ROTATION_90:
-                               case MM_UTIL_ROTATION_270:
-                                       handle->dst_width  = handle->src_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:
-                                       handle->dst_width  = handle->src_width;
-                                       handle->dst_height = handle->src_height;
-                                       break;
-                       }
-               }
-               debug_log("dst (%d X %d)", handle->dst_width, handle->dst_height);
-               if(media_format_make_writable(src_fmt, &dst_fmt) != MEDIA_FORMAT_ERROR_NONE) {
-                       media_format_unref(src_fmt);
-                       debug_error("[Error] Writable - dst format");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               }
-
-               if(media_format_set_video_mime(dst_fmt, handle->dst_format_mime) != MEDIA_FORMAT_ERROR_NONE) {
-                       media_format_unref(src_fmt);
-                       media_format_unref(dst_fmt);
-                       debug_error("[Error] Set - video mime");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               }
-
-               if(media_format_set_video_width(dst_fmt, handle->dst_width) != MEDIA_FORMAT_ERROR_NONE) {
-                       media_format_unref(src_fmt);
-                       media_format_unref(dst_fmt);
-                       debug_error("[Error] Set - video width");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               }
-
-               if(media_format_set_video_height(dst_fmt, handle->dst_height) != MEDIA_FORMAT_ERROR_NONE) {
-                       media_format_unref(src_fmt);
-                       media_format_unref(dst_fmt);
-                       debug_error("[Error] Set - video height");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               }
-
-               if(media_format_set_video_avg_bps(dst_fmt, src_avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
-                       media_format_unref(src_fmt);
-                       media_format_unref(dst_fmt);
-                       debug_error("[Error] Set - video avg bps");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               }
-
-               if(media_format_set_video_max_bps(dst_fmt, src_max_bps) != MEDIA_FORMAT_ERROR_NONE) {
-                       media_format_unref(src_fmt);
-                       media_format_unref(dst_fmt);
-                       debug_error("[Error] Set - video max bps");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               }
-               if(media_packet_create_alloc(dst_fmt, (media_packet_finalize_cb)_mm_transform_completed_cb, NULL, &handle->dst_packet) != MM_ERROR_NONE) {
-                       debug_error("Imedia_packet_get_format)");
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
-               } else {
-                       debug_log("Success - dst media packet");
-                       if(media_packet_get_buffer_size(handle->dst_packet, &size) != MM_ERROR_NONE) {
-                               debug_error("Imedia_packet_get_format)");
-                               return MM_ERROR_IMAGE_INVALID_VALUE;
-                       }
-                       handle->dst_buf_size = (guint)size;
-                       debug_log("handle->src_packet: %p [%d] %d X %d (%d) => handle->dst_packet: %p [%d] %d X %d (%d)",
-                               handle->src_packet, handle->src_format, handle->src_width, handle->src_height, handle->src_buf_size,
-                               handle->dst_packet, handle->dst_format,handle->dst_width, handle->dst_height, handle->dst_buf_size);
-               }
-       }else {
-               debug_error("%d %d", src_width, src_height);
-               return MM_ERROR_IMAGE_INVALID_VALUE;
-       }
-
-       ret = _mm_util_processing(handle);
-
-       if(ret == MM_ERROR_NONE) {
-               if(handle->_util_cb->completed_cb) {
-                       debug_log("completed_cb");
-                       handle->_util_cb->completed_cb(&handle->dst_packet, MM_ERROR_NONE, handle->_util_cb->user_data);
-                       debug_log("completed_cb %p", &handle->dst);
-               }
-               debug_log("Success - Transform");
-       } else {
-               debug_error("Error - Transform");
-       }
-       media_format_unref(src_fmt);
-       media_format_unref(dst_fmt);
-
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_transform_is_completed(MMHandleType MMHandle, bool *is_completed)
+int mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed)
 {
        int ret = MM_ERROR_NONE;
 
        mm_util_s *handle = (mm_util_s *) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:TRANSFORM_IS_COMPLETED");
+
        if (!handle) {
                debug_error("[ERROR] - handle");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if (!is_completed) {
                debug_error("[ERROR] - is_completed");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        *is_completed = handle->is_completed;
        debug_log("[Transform....] %d", *is_completed);
 
+       TTRACE_END();
        return ret;
 }
 
-int
-mm_util_destroy(MMHandleType MMHandle)
+int mm_util_destroy(MMHandleType MMHandle)
 {
        int ret = MM_ERROR_NONE;
        mm_util_s *handle = (mm_util_s*) MMHandle;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:DESTROY");
+
        if (!handle) {
                debug_error("[ERROR] - handle");
+               TTRACE_END();
                return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
        }
 
        /* Close */
        if(_mm_util_handle_finalize(handle) != MM_ERROR_NONE) {
                debug_error("_mm_util_handle_finalize)");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        IMGP_FREE(handle->_util_cb);
        IMGP_FREE(handle);
+       debug_log("Success - Destroy Handle");
 
+       TTRACE_END();
        return ret;
 }
 
-EXPORT_API int
-mm_util_convert_colorspace(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, mm_util_img_format dst_format)
+EXPORT_API int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, mm_util_img_format dst_format)
 {
        int ret = MM_ERROR_NONE;
+       unsigned char *output_buffer = NULL;
+       unsigned int output_buffer_size = 0;
+
+       TTRACE_BEGIN("MM_UTILITY:IMGP:CONVERT_COLORSPACE");
+
+       debug_fenter();
 
-       if(!src || !dst) {
-               debug_error("invalid mm_util_convert_colorspace\n");
+       if (!src || !dst) {
+               debug_error("invalid src or dst");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM) || (dst_format < MM_UTIL_IMG_FMT_YUV420) || (dst_format > MM_UTIL_IMG_FMT_NUM) ) {
-               debug_error("#ERROR# src_format: %d || dst_format:%d value ", src_format, dst_format);
+       if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM) || (dst_format < MM_UTIL_IMG_FMT_YUV420) || (dst_format > MM_UTIL_IMG_FMT_NUM)) {
+               debug_error("#ERROR# src_format : [%d] dst_format : [%d] value ", src_format, dst_format);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       debug_log("#START#");
-
-       if(_mm_cannot_convert_format(src_format, dst_format)) {
+       if (__mm_cannot_convert_format(src_format, dst_format)) {
                debug_error("#ERROR# Cannot Support Image Format Convert");
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
 
        debug_log("[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));
-       if(_imgp_info_s == NULL) {
+       if (_imgp_info_s == NULL) {
                debug_error("ERROR - alloc handle");
-               return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
+               TTRACE_END();
+               return MM_ERROR_IMAGE_NO_FREE_SPACE;
        }
+
        IMGPInfoFunc _mm_util_imgp_func = NULL;
        GModule *_module = NULL;
        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;
        }
+
        debug_log("plugin type: %d", _imgp_plugin_type_e);
-       _module = _mm_util_imgp_initialize(_imgp_plugin_type_e);
-       debug_log("_mm_util_imgp_init: %p", _module);
+
+       _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
+       debug_log("__mm_util_imgp_initialize: %p", _module);
+
        if(_module == NULL) { /* when IMGP_NEON is NULL */
                _imgp_plugin_type_e = IMGP_GSTCS;
                debug_log("You use %s module", PATH_GSTCS_LIB);
-               _module = _mm_util_imgp_initialize(_imgp_plugin_type_e);
+               _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
        }
        debug_log("mm_util_imgp_func: %p", _module);
-       ret=_mm_set_imgp_info_s(_imgp_info_s, src_format, src_width, src_height, dst_format, src_width, src_height, MM_UTIL_ROTATE_0);
+
+       ret = __mm_set_imgp_info_s(_imgp_info_s, src_format, src_width, src_height, dst_format, src_width, src_height, MM_UTIL_ROTATE_0);
        if(ret != MM_ERROR_NONE) {
-               debug_error("_mm_set_imgp_info_s failed");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               debug_error("__mm_set_imgp_info_s failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
-       debug_log("Sucess _mm_set_imgp_info_s");
+       debug_log("Sucess __mm_set_imgp_info_s");
+
+       ret = __mm_util_get_buffer_size(dst_format, src_width, src_height, &output_buffer_size);
+       if (ret != MM_ERROR_NONE) {
+               debug_error("__mm_set_imgp_info_s failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
+               return ret;
+       }
+
+       output_buffer = (unsigned char*)malloc(output_buffer_size);
+       if (output_buffer == NULL) {
+               debug_error("malloc failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
+               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+       }
+       debug_log("malloc outputbuffer: %p (%d)", output_buffer, output_buffer_size);
 
        /* image processing */
-       _mm_util_imgp_func = _mm_util_imgp_process(_module);
-       debug_log("Sucess _mm_util_imgp_process");
+       _mm_util_imgp_func = __mm_util_imgp_process(_module);
+       debug_log("Sucess __mm_util_imgp_process");
 
-       if(_mm_util_imgp_func) {
-               ret=_mm_util_imgp_func(_imgp_info_s, src, dst, IMGP_CSC);
+       if (_mm_util_imgp_func) {
+               ret=_mm_util_imgp_func(_imgp_info_s, src, output_buffer, IMGP_CSC);
                if (ret != MM_ERROR_NONE)
                {
                        debug_error("image processing failed");
-                       _mm_util_imgp_finalize(_module, _imgp_info_s);
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
+                       __mm_util_imgp_finalize(_module, _imgp_info_s);
+                       IMGP_FREE(output_buffer);
+                       TTRACE_END();
+                       return ret;
                }
-       }else {
+       } else {
                debug_error("g_module_symbol failed");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               IMGP_FREE(output_buffer);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
+       if ((_imgp_info_s->dst_width != _imgp_info_s->output_stride || _imgp_info_s->dst_height != _imgp_info_s->output_elevation) && __mm_is_rgb_format(src_format)) {
+               ret = mm_util_crop_image(output_buffer, _imgp_info_s->output_stride, _imgp_info_s->output_elevation, dst_format, 0, 0, &_imgp_info_s->dst_width, &_imgp_info_s->dst_height, dst);
+               if(ret != MM_ERROR_NONE) {
+                       debug_error("__mm_util_imgp_finalize failed");
+                       IMGP_FREE(output_buffer);
+                       TTRACE_END();
+                       return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+               }
+       } else {
+               memcpy(dst, output_buffer, _imgp_info_s->buffer_size);
+       }
+
        /* Output result*/
        debug_log("dst: %p dst_width: %d, dst_height: %d, output_stride: %d, output_elevation: %d",
                        dst, _imgp_info_s->dst_width, _imgp_info_s->dst_height, _imgp_info_s->output_stride, _imgp_info_s->output_elevation);
-       debug_log("#Success# dst");
 
        /* Finalize */
-       ret = _mm_util_imgp_finalize(_module, _imgp_info_s);
+       ret = __mm_util_imgp_finalize(_module, _imgp_info_s);
        if(ret != MM_ERROR_NONE) {
-               debug_error("_mm_util_imgp_finalize failed");
+               debug_error("__mm_util_imgp_finalize failed");
+               IMGP_FREE(output_buffer);
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
+
+       IMGP_FREE(output_buffer);
+
+       debug_fleave();
+
+       TTRACE_END();
+
        return ret;
 }
 
-EXPORT_API int
-mm_util_resize_image(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height)
+EXPORT_API int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height)
 {
        int ret = MM_ERROR_NONE;
-       if(!src || !dst) {
-               debug_error("invalid argument\n");
+       unsigned char *output_buffer = NULL;
+       unsigned int output_buffer_size = 0;
+
+       TTRACE_BEGIN("MM_UTILITY:IMGP:RESIZE_IMAGE");
+
+       debug_fenter();
+
+       if (!src || !dst) {
+               debug_error("invalid argument");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM) ) {
+       if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM)) {
                debug_error("#ERROR# src_format value ");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if!dst_width || !dst_height ) {
+       if (!dst_width || !dst_height ) {
                debug_error("#ERROR# dst width/height buffer is NULL");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if!src_width || !src_height) {
+       if (!src_width || !src_height) {
                debug_error("#ERROR# src_width || src_height valuei is 0 ");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
@@ -1307,230 +1779,340 @@ mm_util_resize_image(unsigned char *src, unsigned int src_width, unsigned int sr
        imgp_info_s* _imgp_info_s=(imgp_info_s*)g_malloc0(sizeof(imgp_info_s));
        if(_imgp_info_s == NULL) {
                debug_error("ERROR - alloc handle");
-               return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
+               TTRACE_END();
+               return MM_ERROR_IMAGE_NO_FREE_SPACE;
        }
+
        IMGPInfoFunc _mm_util_imgp_func = NULL;
        GModule *_module = NULL;
        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 {
                _imgp_plugin_type_e = IMGP_GSTCS;
        }
        debug_log("plugin type: %d", _imgp_plugin_type_e);
-       _module = _mm_util_imgp_initialize(_imgp_plugin_type_e);
-       debug_log("_mm_util_imgp_init: %p", _module);
+
+       _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
+       debug_log("__mm_util_imgp_initialize: %p", _module);
        if(_module == NULL) /* when IMGP_NEON is NULL */
        {
                _imgp_plugin_type_e = IMGP_GSTCS;
                debug_log("You use %s module", PATH_GSTCS_LIB);
-               _module = _mm_util_imgp_initialize(_imgp_plugin_type_e);
+               _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
        }
-       debug_log("_mm_set_imgp_info_s");
-       ret=_mm_set_imgp_info_s(_imgp_info_s, src_format, src_width, src_height, src_format, *dst_width, *dst_height, MM_UTIL_ROTATE_0);
-       debug_log("_mm_set_imgp_info_s ret: %d", ret);
+
+       debug_log("__mm_set_imgp_info_s");
+       ret =__mm_set_imgp_info_s(_imgp_info_s, src_format, src_width, src_height, src_format, *dst_width, *dst_height, MM_UTIL_ROTATE_0);
        if(ret != MM_ERROR_NONE) {
-               debug_error("_mm_set_imgp_info_s failed");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               debug_error("__mm_set_imgp_info_s failed [%d]", ret);
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
-       debug_log("Sucess _mm_set_imgp_info_s");
+
+       debug_log("Sucess __mm_set_imgp_info_s");
 
        if(g_strrstr(g_module_name (_module), GST)) {
-               if(_mm_gst_can_resize_format(_imgp_info_s->input_format_label) == FALSE) {
+               if(__mm_gst_can_resize_format(_imgp_info_s->input_format_label) == FALSE) {
                        debug_error("[%s][%05d] #RESIZE ERROR# IMAGE_NOT_SUPPORT_FORMAT");
-                       _mm_util_imgp_finalize(_module, _imgp_info_s);
+                       __mm_util_imgp_finalize(_module, _imgp_info_s);
+                       TTRACE_END();
                        return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
                }
        }
 
+       ret = __mm_util_get_buffer_size(src_format, *dst_width, *dst_height, &output_buffer_size);
+       if (ret != MM_ERROR_NONE) {
+               debug_error("__mm_set_imgp_info_s failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
+               return ret;
+       }
+
+       output_buffer = (unsigned char*)malloc(output_buffer_size);
+       if (output_buffer == NULL) {
+               debug_error("malloc failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
+               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+       }
+
+       debug_log("malloc outputbuffer: %p (%d)", output_buffer, output_buffer_size);
+
        /* image processing */
-       _mm_util_imgp_func = _mm_util_imgp_process(_module);
-       debug_log("Sucess _mm_util_imgp_process");
-       if(_mm_util_imgp_func) {
-               ret=_mm_util_imgp_func(_imgp_info_s, src, dst, IMGP_RSZ);
+       _mm_util_imgp_func = __mm_util_imgp_process(_module);
+       debug_log("Sucess __mm_util_imgp_process");
+       if (_mm_util_imgp_func) {
+               ret=_mm_util_imgp_func(_imgp_info_s, src, output_buffer, IMGP_RSZ);
                debug_log("_mm_util_imgp_func, ret: %d", ret);
                if (ret != MM_ERROR_NONE)
                {
                        debug_error("image processing failed");
-                       _mm_util_imgp_finalize(_module, _imgp_info_s);
-                       return MM_ERROR_IMAGE_INVALID_VALUE;
+                       __mm_util_imgp_finalize(_module, _imgp_info_s);
+                       IMGP_FREE(output_buffer);
+                       TTRACE_END();
+                       return ret;
                }
-       }else {
+       } else {
                debug_error("g_module_symbol failed");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               IMGP_FREE(output_buffer);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
+       if ((_imgp_info_s->dst_width != _imgp_info_s->output_stride || _imgp_info_s->dst_height != _imgp_info_s->output_elevation) && __mm_is_rgb_format(src_format)) {
+               mm_util_crop_image(output_buffer, _imgp_info_s->output_stride, _imgp_info_s->output_elevation, src_format, 0, 0, &_imgp_info_s->dst_width, &_imgp_info_s->dst_height, dst);
+               *dst_width = _imgp_info_s->dst_width;
+               *dst_height = _imgp_info_s->dst_height;
+       } else {
+               memcpy(dst, output_buffer, _imgp_info_s->buffer_size);
+               *dst_width = _imgp_info_s->dst_width;
+               *dst_height = _imgp_info_s->dst_height;
+       }
+
        /* Output result*/
        debug_log("dst: %p dst_width: %d, dst_height: %d, output_stride: %d, output_elevation: %d",
                        dst, _imgp_info_s->dst_width, _imgp_info_s->dst_height, _imgp_info_s->output_stride, _imgp_info_s->output_elevation);
-       debug_log("#Success# dst");
-
-       *dst_width = _imgp_info_s->dst_width;
-       *dst_height = _imgp_info_s->dst_height;
 
        /* Finalize */
-       ret = _mm_util_imgp_finalize(_module, _imgp_info_s);
+       ret = __mm_util_imgp_finalize(_module, _imgp_info_s);
        if(ret != MM_ERROR_NONE) {
-               debug_error("_mm_util_imgp_finalize failed");
+               debug_error("__mm_util_imgp_finalize failed");
+               IMGP_FREE(output_buffer);
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
+
+       IMGP_FREE(output_buffer);
+
+       debug_fenter();
+
+       TTRACE_END();
+
        return ret;
 }
 
-EXPORT_API int
-mm_util_rotate_image(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
+EXPORT_API int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format, unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
 {
        int ret = MM_ERROR_NONE;
+       unsigned char *output_buffer = NULL;
+       unsigned int output_buffer_size = 0;
 
-       if(!src || !dst) {
-               debug_error("invalid argument\n");
+       TTRACE_BEGIN("MM_UTILITY:IMGP:ROTATE_IMAGE");
+
+       debug_fenter();
+
+       if (!src || !dst) {
+               debug_error("invalid argument");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM) ) {
+       if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM)) {
                debug_error("#ERROR# src_format value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( !dst_width || !dst_height ) {
+       if ( !dst_width || !dst_height ) {
                debug_error("#ERROR# dst width/height buffer is NUL");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( !src_width || !src_height) {
+       if ( !src_width || !src_height) {
                debug_error("#ERROR# src_width || src_height value is 0 ");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (angle < MM_UTIL_ROTATE_0) || (angle > MM_UTIL_ROTATE_NUM) ) {
+       if ((angle < MM_UTIL_ROTATE_0) || (angle > MM_UTIL_ROTATE_NUM)) {
                debug_error("#ERROR# angle vaule");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        debug_log("[src] 0x%2x (%d x %d) [dst] 0x%2x", src, src_width, src_height, dst);
 
-       debug_log("#START#");
        imgp_info_s* _imgp_info_s=(imgp_info_s*)g_malloc0(sizeof(imgp_info_s));
        if(_imgp_info_s == NULL) {
                debug_error("ERROR - alloc handle");
+               TTRACE_END();
                return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
        }
-       unsigned int dst_size=0;
        IMGPInfoFunc _mm_util_imgp_func = NULL;
        GModule *_module = NULL;
        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 {
                _imgp_plugin_type_e = IMGP_GSTCS;
        }
        debug_log("plugin type: %d", _imgp_plugin_type_e);
-       _module = _mm_util_imgp_initialize(_imgp_plugin_type_e);
-       debug_log("_mm_util_imgp_func: %p", _module);
+
+       _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
+       debug_log("__mm_util_imgp_initialize: %p", _module);
        if(_module == NULL) { /* when IMGP_NEON is NULL */
                _imgp_plugin_type_e = IMGP_GSTCS;
                debug_log("You use %s module", PATH_GSTCS_LIB);
-               _module = _mm_util_imgp_initialize(_imgp_plugin_type_e);
+               _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
        }
-       debug_log("_mm_set_imgp_info_s");
-       ret=_mm_confirm_dst_width_height(src_width, src_height, dst_width, dst_height, angle);
+
+       debug_log("__mm_confirm_dst_width_height");
+       ret = __mm_confirm_dst_width_height(src_width, src_height, dst_width, dst_height, angle);
        if(ret != MM_ERROR_NONE) {
                debug_error("dst_width || dest_height size Error");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       ret=_mm_set_imgp_info_s(_imgp_info_s, src_format, src_width, src_height, src_format, *dst_width, *dst_height, angle);
-       debug_log("_mm_set_imgp_info_s");
+       ret = __mm_set_imgp_info_s(_imgp_info_s, src_format, src_width, src_height, src_format, *dst_width, *dst_height, angle);
+       debug_log("__mm_set_imgp_info_s");
        if(ret != MM_ERROR_NONE) {
-               debug_error("_mm_set_imgp_info_s failed");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               debug_error("__mm_set_imgp_info_s failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
-       debug_log("Sucess _mm_set_imgp_info_s");
+       debug_log("Sucess __mm_set_imgp_info_s");
 
        if(g_strrstr(g_module_name (_module), GST)) {
-               if(_mm_gst_can_rotate_format(_imgp_info_s->input_format_label) == FALSE) {
+               if(__mm_gst_can_rotate_format(_imgp_info_s->input_format_label) == FALSE) {
                        debug_error("[%s][%05d] #gstreamer ROTATE ERROR# IMAGE_NOT_SUPPORT_FORMAT");
-                       _mm_util_imgp_finalize(_module, _imgp_info_s);
+                       __mm_util_imgp_finalize(_module, _imgp_info_s);
+                       TTRACE_END();
                        return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
                }
        }
 
+       ret = __mm_util_get_buffer_size(src_format, *dst_width, *dst_height, &output_buffer_size);
+       if (ret != MM_ERROR_NONE) {
+               debug_error("__mm_set_imgp_info_s failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
+               return ret;
+       }
+
+       output_buffer = (unsigned char*)malloc(output_buffer_size);
+       if (output_buffer == NULL) {
+               debug_error("malloc failed");
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               TTRACE_END();
+               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+       }
+
+       debug_log("malloc outputbuffer: %p (%d)", output_buffer, output_buffer_size);
+
        /* image processing */
-       _mm_util_imgp_func = _mm_util_imgp_process(_module);
-       debug_log("Sucess _mm_util_imgp_process");
-       if(_mm_util_imgp_func) {
-               ret=_mm_util_imgp_func(_imgp_info_s, src, dst, IMGP_ROT);
+       _mm_util_imgp_func = __mm_util_imgp_process(_module);
+       debug_log("Sucess __mm_util_imgp_process");
+       if (_mm_util_imgp_func) {
+               ret=_mm_util_imgp_func(_imgp_info_s, src, output_buffer, IMGP_ROT);
                if (ret!= MM_ERROR_NONE)        {
                        debug_error("image processing failed");
-                       _mm_util_imgp_finalize(_module, _imgp_info_s);
-                       return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+                       __mm_util_imgp_finalize(_module, _imgp_info_s);
+                       IMGP_FREE(output_buffer);
+                       TTRACE_END();
+                       return ret;
                }
-       }else {
+       } else {
                debug_error("g_module_symbol failed");
-               _mm_util_imgp_finalize(_module, _imgp_info_s);
+               __mm_util_imgp_finalize(_module, _imgp_info_s);
+               IMGP_FREE(output_buffer);
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
 
-       /* Output result*/
-       debug_log("dst: %p dst_width: %d, dst_height: %d, output_stride: %d, output_elevation: %d, dst_size: %d",
-                       dst, _imgp_info_s->dst_width, _imgp_info_s->dst_height, _imgp_info_s->output_stride, _imgp_info_s->output_elevation,dst_size);
-       debug_log("#Success# dst");
+       if ((_imgp_info_s->dst_width != _imgp_info_s->output_stride || _imgp_info_s->dst_height != _imgp_info_s->output_elevation) && __mm_is_rgb_format(src_format)) {
+               unsigned int start_x = 0;
+               unsigned int start_y = 0;
+               if (angle == MM_UTIL_ROTATE_90) {
+                       start_x = 0;
+                       start_y = 0;
+               } else if (angle == MM_UTIL_ROTATE_180) {
+                       start_x = _imgp_info_s->output_stride-_imgp_info_s->dst_width;
+                       start_y = 0;
+               } else if (angle == MM_UTIL_ROTATE_270) {
+                       start_x = 0;
+                       start_y = _imgp_info_s->output_elevation - _imgp_info_s->dst_height;
+               }
+               mm_util_crop_image(output_buffer, _imgp_info_s->output_stride, _imgp_info_s->output_elevation, src_format, start_x, start_y, &_imgp_info_s->dst_width, &_imgp_info_s->dst_height, dst);
+               *dst_width = _imgp_info_s->dst_width;
+               *dst_height = _imgp_info_s->dst_height;
+       } else {
+               memcpy(dst, output_buffer, _imgp_info_s->buffer_size);
+               *dst_width = _imgp_info_s->dst_width;
+               *dst_height = _imgp_info_s->dst_height;
+       }
 
-       *dst_width = _imgp_info_s->dst_width;
-       *dst_height = _imgp_info_s->dst_height;
+       /* Output result*/
+       debug_log("dst: %p dst_width: %d, dst_height: %d, output_stride: %d, output_elevation: %d",
+                       dst, _imgp_info_s->dst_width, _imgp_info_s->dst_height, _imgp_info_s->output_stride, _imgp_info_s->output_elevation);
 
        /* Finalize */
-       ret = _mm_util_imgp_finalize(_module, _imgp_info_s);
+       ret = __mm_util_imgp_finalize(_module, _imgp_info_s);
        if(ret != MM_ERROR_NONE) {
-               debug_error("_mm_util_imgp_finalize failed");
+               debug_error("__mm_util_imgp_finalize failed");
+               IMGP_FREE(output_buffer);
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
+
+       IMGP_FREE(output_buffer);
+
+       debug_fleave();
+
+       TTRACE_END();
+
        return ret;
 }
 
-EXPORT_API int
-mm_util_crop_image(unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+EXPORT_API int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
 unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_width, unsigned int *crop_dest_height, unsigned char *dst)
 {
        int ret = MM_ERROR_NONE;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:CROP_IMAGE");
+
        if (!src || !dst) {
-               debug_error("invalid argument\n");
+               debug_error("invalid argument");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if( (src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM) ) {
                debug_error("#ERROR# src_format value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if( (crop_start_x +*crop_dest_width > src_width) || (crop_start_y +*crop_dest_height > src_height) ) {
                debug_error("#ERROR# dest width | height value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        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);
+                       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);
+                       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);
+                       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:
@@ -1547,18 +2129,19 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_wi
                                debug_log("Image isplay is suceeded when YUV crop height value %d ",*crop_dest_height);
                        }
 
-                       ret = _mm_util_crop_yuv420(src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
+                       ret = __mm_util_crop_yuv420(src, src_width, src_height, src_format, crop_start_x, crop_start_y, *crop_dest_width, *crop_dest_height, dst);
                        break;
                        }
                default:
                        debug_log("Not supported format");
+                       ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
 
+       TTRACE_END();
        return ret;
 }
 
-EXPORT_API int
-mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize)
+EXPORT_API int mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize)
 {
        int ret = MM_ERROR_NONE;
        unsigned char x_chroma_shift = 0;
@@ -1566,22 +2149,24 @@ mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned i
        int size, w2, h2, size2;
        int stride, stride2;
 
+       TTRACE_BEGIN("MM_UTILITY:IMGP:GET_SIZE");
+
        if (!imgsize) {
-               debug_error("imgsize can't be null\n");
+               debug_error("imgsize can't be null");
+               TTRACE_END();
                return MM_ERROR_IMAGE_FILEOPEN;
        }
 
        *imgsize = 0;
 
-
        if (check_valid_picture_size(width, height) < 0) {
-               debug_error("invalid width and height\n");
+               debug_error("invalid width and height");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        switch (format)
        {
-
                case MM_UTIL_IMG_FMT_I420:
                case MM_UTIL_IMG_FMT_YUV420:
                        x_chroma_shift = 1;
@@ -1600,19 +2185,19 @@ mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned i
                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);
+                       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);
+                       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);
+                       stride = MM_UTIL_ROUND_UP_4 (width) * 3;
                        size = stride * height;
                        *imgsize = size;
                        break;
@@ -1642,10 +2227,13 @@ mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned i
                        break;
 
                default:
-                       debug_error("Not supported format\n");
+                       debug_error("Not supported format");
+                       TTRACE_END();
                        return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
        debug_log("format: %d, *imgsize: %d\n", format, *imgsize);
 
+       TTRACE_END();
        return ret;
 }
+
index 6e87f7a..b55760d 100755 (executable)
 #define ONE_ALL 0
 #define IMAGE_FORMAT_LABEL_BUFFER_SIZE 4
 MMHandleType MMHandle = 0;
+bool completed = false;
+
+
+int packet_finalize_callback(media_packet_h packet, int err, void* userdata)
+{
+       debug_log("==> finalize callback func is called [%d] \n", err);
+       return MEDIA_PACKET_FINALIZE;
+}
 
 bool
 transform_completed_cb(media_packet_h *packet, int error, void *user_param)
@@ -35,57 +43,59 @@ transform_completed_cb(media_packet_h *packet, int error, void *user_param)
        media_format_h dst_fmt;
        media_format_mimetype_e dst_mimetype;
        int dst_width, dst_height, dst_avg_bps, dst_max_bps;
-       char *output_fmt = (char*)malloc(sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
-       if(output_fmt) {
-               if(media_packet_get_format(*packet, &dst_fmt) != MM_ERROR_NONE) {
-                       debug_error("Imedia_packet_get_format");
-                       IMGP_FREE(output_fmt);
-                       return FALSE;
+       char *output_fmt = NULL;
+
+       if(error == MM_ERROR_NONE) {
+               debug_log("completed");
+               output_fmt = (char*)malloc(sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
+               if(output_fmt) {
+                       if(media_packet_get_format(*packet, &dst_fmt) != MM_ERROR_NONE) {
+                               debug_error("Imedia_packet_get_format");
+                               IMGP_FREE(output_fmt);
+                               return FALSE;
+                       }
+
+                       if(media_format_get_video_info(dst_fmt, &dst_mimetype, &dst_width, &dst_height, &dst_avg_bps, &dst_max_bps) ==MEDIA_FORMAT_ERROR_NONE) {
+                               memset(output_fmt, 0, IMAGE_FORMAT_LABEL_BUFFER_SIZE);
+                               if(dst_mimetype  ==MEDIA_FORMAT_YV12 || dst_mimetype == MEDIA_FORMAT_422P ||dst_mimetype == MEDIA_FORMAT_I420
+                                       || dst_mimetype == MEDIA_FORMAT_NV12 || dst_mimetype == MEDIA_FORMAT_UYVY ||dst_mimetype == MEDIA_FORMAT_YUYV) {
+                                       strncpy(output_fmt, "yuv", strlen("yuv"));
+                               } else {
+                                       strncpy(output_fmt,"rgb", strlen("rgb"));
+                               }
+                               debug_log("[mimetype: %d] W x H : %d x %d", dst_mimetype, dst_width, dst_height);
+                               snprintf(output_file, 25, "result_%dx%d.%s", dst_width,dst_height, output_fmt);
+                       }
                }
 
-               if(media_format_get_video_info(dst_fmt, &dst_mimetype, &dst_width, &dst_height, &dst_avg_bps, &dst_max_bps) ==MEDIA_FORMAT_ERROR_NONE) {
-                       memset(output_fmt, 0, IMAGE_FORMAT_LABEL_BUFFER_SIZE);
-                       if(dst_mimetype  ==MEDIA_FORMAT_YV12 || dst_mimetype == MEDIA_FORMAT_422P ||dst_mimetype == MEDIA_FORMAT_I420
-                               || dst_mimetype == MEDIA_FORMAT_NV12 || dst_mimetype == MEDIA_FORMAT_UYVY ||dst_mimetype == MEDIA_FORMAT_YUYV) {
-                               strncpy(output_fmt, "yuv", strlen("yuv"));
-                       } else {
-                               strncpy(output_fmt,"rgb", strlen("rgb"));
+               FILE *fpout = fopen(output_file, "w");
+               if(fpout) {
+                       media_packet_get_buffer_size(*packet, &size);
+                       void *dst = NULL;
+                       if(media_packet_get_buffer_data_ptr(*packet, &dst) != MM_ERROR_NONE) {
+                               IMGP_FREE(dst);
+                               IMGP_FREE(output_fmt);
+                               fclose(fpout);
+                               debug_error ("[dst] media_packet_get_extra");
+                               return FALSE;
                        }
-                       debug_log("[mimetype: %d] W x H : %d x %d", dst_mimetype, dst_width, dst_height);
-                       snprintf(output_file, 25, "result_%dx%d.%s", dst_width,dst_height, output_fmt);
+                       debug_log("dst: %p [%d]", dst, size);
+                       fwrite(dst, 1, size, fpout);
+                       debug_log("FREE");
+                       fclose(fpout);
                }
-       }
 
-       if(error == MM_ERROR_NONE) {
-               debug_log("completed");
+               debug_log("write result");
+               debug_log("Free (output_fmt)");
+               IMGP_FREE(output_fmt);
        } else {
                debug_error("[ERROR] complete cb");
-               GThread * destroy_thread = g_thread_new(NULL, mm_util_destroy, MMHandle);
-               return_val_if_fail(destroy_thread, FALSE);
-               g_thread_unref(destroy_thread);
        }
 
-       FILE *fpout = fopen(output_file, "w");
-       if(fpout) {
-               media_packet_get_buffer_size(*packet, &size);
-               void *dst = NULL;
-               if(media_packet_get_buffer_data_ptr(*packet, &dst) != MM_ERROR_NONE) {
-                       IMGP_FREE(dst);
-                       IMGP_FREE(output_fmt);
-                       fclose(fpout);
-                       debug_error ("[dst] media_packet_get_extra");
-                       return FALSE;
-               }
-               debug_log("dst: %p [%d]", dst, size);
-               fwrite(dst, 1, size, fpout);
-               debug_log("FREE");
-               fclose(fpout);
-       }
-
-       debug_log("write result");
-       debug_log("Free (output_fmt)");
+       completed = true;
+       debug_log("Destory - dst packet");
        media_packet_destroy(*packet);
-       IMGP_FREE(output_fmt);
+
        return TRUE;
 }
 
@@ -102,7 +112,6 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-
        /* Create Transform */
        ret = mm_util_create (&MMHandle);
        if(ret == MM_ERROR_NONE) {
@@ -152,7 +161,7 @@ int main(int argc, char *argv[])
                debug_error("media_format_create failed...");
        }
 
-       ret = media_packet_create_alloc(fmt, (media_packet_finalize_cb)transform_completed_cb, NULL, &src_packet);
+       ret = media_packet_create_alloc(fmt, (media_packet_finalize_cb)packet_finalize_callback, NULL, &src_packet);
        if(ret == MM_ERROR_NONE) {
                debug_log("Success - Create Media Packet(%p)", src_packet);
                uint64_t size =0;
@@ -160,18 +169,18 @@ int main(int argc, char *argv[])
                        ptr = malloc(size);
                        if (ptr == NULL) {
                                debug_log("\tmemory allocation failed\n");
-                               return FALSE;
+                               return MM_ERROR_IMAGE_INTERNAL;
                        }
                        if (media_packet_get_buffer_data_ptr(src_packet, &ptr) == MEDIA_PACKET_ERROR_NONE) {
                                FILE *fp = fopen(argv[1], "r");
                                if (fp == NULL) {
-                                       fprintf(stderr, "\tfile open failed %d\n", errno);
-                                       return FALSE;
+                                       debug_log("\tfile open failed %d\n", errno);
+                                       return MM_ERROR_IMAGE_INTERNAL;
                                }
                                src = malloc(size);
                                if (src == NULL) {
                                        debug_log("\tmemory allocation failed\n");
-                                       return FALSE;
+                                       return MM_ERROR_IMAGE_INTERNAL;
                                }
                                if(fread(src, 1, (int)size, fp)) {
                                        debug_log("#Success# fread");
@@ -196,7 +205,7 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-       ret = mm_util_set_colorspace_convert(MMHandle, MM_UTIL_IMG_FMT_RGB888);
+       ret = mm_util_set_resolution(MMHandle, 176, 144);
        if(ret == MM_ERROR_NONE) {
                debug_log("Success - Set Convert Info");
        } else {
@@ -205,15 +214,6 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-       ret = mm_util_set_resolution(MMHandle, 320, 240);
-       if(ret == MM_ERROR_NONE) {
-               debug_log("Success - Set Resize Info");
-       } else {
-               media_format_unref(fmt);
-               debug_log("ERROR - Set Resize Info");
-               return ret;
-       }
-
        /* Transform */
        ret = mm_util_transform(MMHandle, src_packet, (mm_util_completed_callback) transform_completed_cb, handle);
        if(ret == MM_ERROR_NONE) {
@@ -225,9 +225,20 @@ int main(int argc, char *argv[])
        }
 
        debug_log("Wait...");
+       while (false == completed) {} // polling
+
+       ret = mm_util_destroy(MMHandle);
+       if(ret == MM_ERROR_NONE) {
+               debug_log("Success - Destroy");
+       } else {
+               media_format_unref(fmt);
+               debug_error("ERROR - Destroy");
+               return ret;
+       }
 
-       media_packet_destroy(src_packet);
        media_format_unref(fmt);
+       debug_log("Destory - src packet");
+       media_packet_destroy(src_packet);
        debug_log("destroy");
 
        return ret;
index c448a74..82db62b 100644 (file)
@@ -16,7 +16,7 @@ libmmutil_jpeg_la_CFLAGS = -I$(srcdir)/include \
                                $(SYSTEMINFO_CFLAGS) \
                                $(srcdir)/../imgp/libmmutil_imgp.la
 
-libmmutil_jpeg_la_LIBADD = $(MMCOMMON_LIBS) -ljpeg -ldl -lexif\
+libmmutil_jpeg_la_LIBADD = $(MMCOMMON_LIBS) -ljpeg -ldl -lexif -lttrace\
                                $(GLIB_LIBS) \
                                $(GMODULE_LIBS) \
                                $(SYSTEMINFO_LIBS)\
index 73247d1..8eaf652 100755 (executable)
@@ -61,6 +61,17 @@ typedef enum
 } mm_util_jpeg_yuv_format;
 
 /**
+ * downscale decoding for jpeg
+ */
+typedef enum
+{
+       MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1 = 1,  /** 1/1 downscale decode */
+       MM_UTIL_JPEG_DECODE_DOWNSCALE_1_2 = 2,  /** 1/2 downscale decode */
+       MM_UTIL_JPEG_DECODE_DOWNSCALE_1_4 = 4,  /** 1/4 downscale decode */
+       MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8 = 8,  /** 1/8 downscale decode */
+} mm_util_jpeg_decode_downscale;
+
+/**
  * YUV data
  */
 typedef struct
@@ -88,7 +99,7 @@ typedef struct
  * @since       R1, 1.0
  */
 int
-mm_util_jpeg_encode_to_file (char *filename, void *src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality);
+mm_util_jpeg_encode_to_file (const char *filename, void *src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality);
 
 
 /**
@@ -124,7 +135,7 @@ mm_util_jpeg_encode_to_memory (void **mem, int *size, void *src, int width, int
  * @since       R1, 1.0
  */
 int
-mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, char *filename, mm_util_jpeg_yuv_format fmt);
+mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt);
 
 
 /**
@@ -143,6 +154,40 @@ mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, char *filename, mm
 int
 mm_util_decode_from_jpeg_memory (mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt);
 
+/**
+ * This function extracts yuv data from jpeg file with downscale decode option
+ *
+ * @param decoded [out]     pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer.
+                            After using it, please free the allocated memory.
+ * @param filename [in]     input file name, encoded stream file
+ * @param fmt [in]          color format
+ * @param downscale [in]       downscale value
+ * @return This function returns zero on success, or negative value with error code.
+ * @remark
+ * @see         mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @since       R1, 1.0
+ */
+int
+mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale);
+
+/**
+ * This function extracts yuv data from jpeg buffer with downscale decode option
+ *
+ * @param decoded [out]     pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer.
+                            After using it, please free the allocated memory.
+ * @param src [in]          input stream pointer(pointer of encoded jpeg stream data)
+ * @param size [in]         size of input stream(size of pointer of encoded jpeg stream data)
+ * @param fmt [in]          color format
+ * @param downscale [in]       downscale value
+ * @return This function returns zero on success, or negative value with error code.
+ * @remark
+ * @see         mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @since       R1, 1.0
+ */
+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);
+
+
 #ifdef __cplusplus
 }
 #endif
index b79df97..5dc5d1e 100755 (executable)
@@ -40,9 +40,8 @@
 #include <turbojpeg.h>
 #endif
 #include <libexif/exif-data.h>
-#include <system_info.h>
-#include <system_info_internal.h>
 
+#include <system_info.h>
 #include <mm_error.h>
 #include <setjmp.h>
 #include <glib.h>
 #include <mm_attrs_private.h>
 #include "mm_util_jpeg.h"
 #include "mm_util_imgp.h"
+#ifdef ENABLE_TTRACE
+#include <ttrace.h>
+#define TTRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_IMAGE, NAME)
+#define TTRACE_END() traceEnd(TTRACE_TAG_IMAGE)
+#else //ENABLE_TTRACE
+#define TTRACE_BEGIN(NAME)
+#define TTRACE_END()
+#endif //ENABLE_TTRACE
+
 #ifndef YUV420_SIZE
 #define YUV420_SIZE(width, height)     (width*height*3>>1)
 #endif
@@ -62,6 +70,8 @@
 #define MM_JPEG_ROUND_UP_2(num)  (((num)+1)&~1)
 #define MM_JPEG_ROUND_UP_4(num)  (((num)+3)&~3)
 #define MM_JPEG_ROUND_UP_8(num)  (((num)+7)&~7)
+#define MM_JPEG_ROUND_DOWN_2(num) ((num)&(~1))
+#define MM_JPEG_ROUND_DOWN_4(num) ((num)&(~3))
 #define MM_JPEG_ROUND_DOWN_16(num) ((num)&(~15))
 
 #define ERR_BUF_LENGHT 256
@@ -71,6 +81,8 @@
                        debug_error(fmt" : standard error= [%s]", buf); \
                } while (0)
 
+#define IMG_JPEG_FREE(src) { if(src != NULL) {free(src); src = NULL;} }
+
 #if LIBJPEG_TURBO
 #define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
 #define _throwtj() {printf("TurboJPEG ERROR:\n%s\n", tjGetErrorStr());}
@@ -236,9 +248,9 @@ _mm_decode_libjpeg_turbo_decompress(tjhandle handle, unsigned char *jpegBuf, uns
 }
 
 static int
-mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_data * decoded_data, char *pFileName, mm_util_jpeg_yuv_format input_fmt)
+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_ERROR_NONE;
+       int iErrorCode = MM_ERROR_NONE;
        tjhandle dhandle=NULL;
        unsigned char *srcBuf=NULL;
        int jpegSize;
@@ -286,7 +298,7 @@ mm_image_decode_from_jpeg_file_with_libjpeg_turbo(mm_util_jpeg_yuv_data * decode
 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_ERROR_NONE;
+       int iErrorCode = MM_ERROR_NONE;
        tjhandle dhandle=NULL;
        unsigned char *srcBuf=NULL;
        int TD_BU=0;
@@ -335,7 +347,7 @@ _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsigned char **ds
                } else if(fmt==MM_UTIL_JPEG_FMT_YUV420 || fmt==MM_UTIL_JPEG_FMT_YUV422) {
                        initBuf(srcBuf, w, h, TJPF_GRAY, flags);
                } else {
-                       free(srcBuf);
+                       IMG_JPEG_FREE(srcBuf);
                        debug_error("[%s][%05d] We can't support the IMAGE format");
                        return;
                }
@@ -359,15 +371,14 @@ _mm_encode_libjpeg_turbo_compress(tjhandle handle, void *src, unsigned char **ds
        } else {
                debug_error("fmt:%d  is wrong", fmt);
        }
-       if(srcBuf) {
-               free(srcBuf);
-       }
+
+       IMG_JPEG_FREE(srcBuf);
 }
 
 static int
 mm_image_encode_to_jpeg_file_with_libjpeg_turbo(char *filename, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
 {
-       int iErrorCode  = MM_ERROR_NONE;
+       int iErrorCode = MM_ERROR_NONE;
        tjhandle chandle=NULL;
        unsigned char *dstBuf=NULL;
        unsigned long size=0;
@@ -410,7 +421,7 @@ mm_image_encode_to_jpeg_file_with_libjpeg_turbo(char *filename, void* src, int w
 static int
 mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(void **mem, int *csize, void *rawdata,  int w, int h, mm_util_jpeg_yuv_format fmt,int quality)
 {
-       int iErrorCode  = MM_ERROR_NONE;
+       int iErrorCode = MM_ERROR_NONE;
        tjhandle chandle=NULL;
        int TD_BU=0;
 
@@ -486,8 +497,7 @@ my_error_exit (j_common_ptr cinfo)
        longjmp(myerr->setjmp_buffer, 1); /*  Return control to the setjmp point */
 }
 
-static int
-mm_image_encode_to_jpeg_file_with_libjpeg(char *pFileName, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+static int mm_image_encode_to_jpeg_file_with_libjpeg(const char *pFileName, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
 {
        int iErrorCode = MM_ERROR_NONE;
 
@@ -562,14 +572,14 @@ mm_image_encode_to_jpeg_file_with_libjpeg(char *pFileName, void *rawdata, int wi
                        if(large_rect) {
                                memset(large_rect, 0x10, width);
                        } else {
-                               free(small_rect);
+                               IMG_JPEG_FREE(small_rect);
                                debug_error("large rectangle memory");
                                return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
                        }
                        if(small_rect) {
                                memset(small_rect, 0x80, width);
                        } else {
-                               free(large_rect);
+                               IMG_JPEG_FREE(large_rect);
                                debug_error("small rectangle memory");
                                return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
                        }
@@ -599,8 +609,8 @@ mm_image_encode_to_jpeg_file_with_libjpeg(char *pFileName, void *rawdata, int wi
                                }
                        }
                        jpeg_write_raw_data(&cinfo, data, 16);
-                       free(large_rect);
-                       free(small_rect);
+                       IMG_JPEG_FREE(large_rect);
+                       IMG_JPEG_FREE(small_rect);
                } else {
                        for (j = 0; j < height; j += 16) {
                                for (i = 0; i < 16; i++) {
@@ -662,8 +672,10 @@ mm_image_encode_to_jpeg_file_with_libjpeg(char *pFileName, void *rawdata, int wi
                        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] = (JSAMPROW)&rawdata[cinfo.next_scanline * iRowStride];
+                       row_pointer[0] = & image_buffer[cinfo.next_scanline * iRowStride];
                        jpeg_write_scanlines(&cinfo, row_pointer, 1);
                }
                debug_log("while");
@@ -676,7 +688,7 @@ mm_image_encode_to_jpeg_file_with_libjpeg(char *pFileName, void *rawdata, int wi
                debug_error("We can't encode the IMAGE format");
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
-       fsync((int)fpWriter);
+       fsync((int)(fpWriter->_fileno));
        debug_log("[fsync] FILE");
        fclose(fpWriter);
        return iErrorCode;
@@ -685,7 +697,7 @@ mm_image_encode_to_jpeg_file_with_libjpeg(char *pFileName, void *rawdata, int wi
 static int
 mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt,int quality)
 {
-       int iErrorCode  = MM_ERROR_NONE;
+       int iErrorCode = MM_ERROR_NONE;
 
        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 */
@@ -693,6 +705,7 @@ mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdat
        struct jpeg_compress_struct cinfo;
        struct jpeg_error_mgr jerr;
        int i, j, flag, _height;
+       unsigned long size = 0;
        *csize = 0;
        data[0] = y;
        data[1] = cb;
@@ -719,7 +732,7 @@ mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdat
        debug_log("[mm_image_encode_to_jpeg_memory_with_libjpeg] #After jpeg_mem_dest#, mem: %p\t width: %d\t height: %d\t fmt: %d\t quality: %d"
                , mem, width, height, fmt, quality);
 
-       jpeg_mem_dest(&cinfo, (unsigned char **)mem, (unsigned long *)csize);
+       jpeg_mem_dest(&cinfo, (unsigned char **)mem, &size);
        cinfo.image_width = width;
        cinfo.image_height = height;
        if (fmt ==MM_UTIL_JPEG_FMT_YUV420 ||fmt ==MM_UTIL_JPEG_FMT_YUV422 || fmt ==MM_UTIL_JPEG_FMT_UYVY) {
@@ -759,14 +772,14 @@ mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdat
                        if(large_rect) {
                                memset(large_rect, 0x10, width);
                        } else {
-                               free(small_rect);
+                               IMG_JPEG_FREE(small_rect);
                                debug_error("large rectangle memory");
                                return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
                        }
                        if(small_rect) {
                                memset(small_rect, 0x80, width);
                        } else {
-                               free(large_rect);
+                               IMG_JPEG_FREE(large_rect);
                                debug_error("small rectangle memory");
                                return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
                        }
@@ -796,8 +809,8 @@ mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdat
                                }
                        }
                        jpeg_write_raw_data(&cinfo, data, 16);
-                       free(large_rect);
-                       free(small_rect);
+                       IMG_JPEG_FREE(large_rect);
+                       IMG_JPEG_FREE(small_rect);
                } else {
                        for (j = 0; j < height; j += 16) {
                                for (i = 0; i < 16; i++) {
@@ -859,8 +872,10 @@ mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdat
                        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] = (JSAMPROW)&rawdata[cinfo.next_scanline * iRowStride];
+                       row_pointer[0] = & image_buffer[cinfo.next_scanline * iRowStride];
                        jpeg_write_scanlines(&cinfo, row_pointer, 1);
                }
                debug_log("while");
@@ -874,18 +889,19 @@ mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdat
                debug_error("We can't encode the IMAGE format");
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
+       *csize = (int)size;
        return iErrorCode;
 }
 
 static int
-mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data, char *pFileName, mm_util_jpeg_yuv_format input_fmt)
+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_ERROR_NONE;
-       FILE *infile            = NULL;
+       int iErrorCode = MM_ERROR_NONE;
+       FILE *infile = NULL;
        struct jpeg_decompress_struct dinfo;
        struct my_error_mgr_s jerr;
        JSAMPARRAY buffer; /* Output row buffer */
-       int row_stride = 0, state = 0; /* physical row width in output buffer */
+       int row_stride = 0; /* physical row width in output buffer */
        JSAMPROW image, u_image, v_image;
        JSAMPROW row; /* point to buffer[0] */
 
@@ -921,11 +937,7 @@ mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data
                /* If we get here, the JPEG code has signaled an error. We need to clean up the JPEG object, close the input file, and return.*/
                debug_log("setjmp");
                jpeg_destroy_decompress(&dinfo);
-               if(decoded_data->data) {
-                       free(decoded_data->data);
-                       decoded_data->data = NULL;
-                       debug_log("free data");
-               }
+               IMG_JPEG_FREE(decoded_data->data);
                fclose(infile);
                debug_log("fclose");
                return MM_ERROR_IMAGE_INVALID_VALUE;
@@ -950,6 +962,12 @@ mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data
                dinfo.do_fancy_upsampling = FALSE;
                dinfo.do_block_smoothing = FALSE;
                dinfo.dither_mode = JDITHER_ORDERED;
+       } else if (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) {
+               dinfo.scale_num = 1;
+               dinfo.scale_denom = (unsigned int)downscale;
+               dinfo.do_fancy_upsampling = FALSE;
+               dinfo.do_block_smoothing = FALSE;
+               dinfo.dither_mode = JDITHER_ORDERED;
        }
 #endif
        dinfo.dct_method = JDCT_FASTEST;
@@ -979,6 +997,16 @@ mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data
        /* Start decompressor*/
        jpeg_start_decompress(&dinfo);
 
+       /* byte-align for YUV format */
+       if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+               if(dinfo.output_width% 2 != 0) {
+                       dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
+               }
+               if(dinfo.output_height% 2 != 0) {
+                       dinfo.output_height = MM_JPEG_ROUND_DOWN_2(dinfo.output_height);
+               }
+       }
+
        /* JSAMPLEs per row in output buffer */
        row_stride = dinfo.output_width * dinfo.output_components;
 
@@ -1036,6 +1064,7 @@ mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data
                        }
                }
        }else if(input_fmt == MM_UTIL_JPEG_FMT_RGB888 ||input_fmt == MM_UTIL_JPEG_FMT_GraySacle || input_fmt == MM_UTIL_JPEG_FMT_RGB888 || input_fmt == MM_UTIL_JPEG_FMT_RGBA8888 || input_fmt == MM_UTIL_JPEG_FMT_BGRA8888 || input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+               int state = 0;
                /* while (scan lines remain to be read) jpeg_read_scanlines(...); */
                while (dinfo.output_scanline < dinfo.output_height) {
                        /* jpeg_read_scanlines expects an array of pointers to scanlines. Here the array is only one element long, but you could ask formore than one scanline at a time if that's more convenient. */
@@ -1059,13 +1088,13 @@ mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data
 }
 
 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_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_ERROR_NONE;
+       int iErrorCode = MM_ERROR_NONE;
        struct jpeg_decompress_struct dinfo;
        struct my_error_mgr_s jerr;
        JSAMPARRAY buffer; /* Output row buffer */
-       int row_stride = 0, state = 0; /* physical row width in output buffer */
+       int row_stride = 0; /* physical row width in output buffer */
        JSAMPROW image, u_image, v_image;
        JSAMPROW row; /* point to buffer[0] */
 
@@ -1094,11 +1123,7 @@ mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_da
        if (setjmp(jerr.setjmp_buffer)) {
                /* If we get here, the JPEG code has signaled an error.  We need to clean up the JPEG object, close the input file, and return.*/
                debug_log("setjmp");
-               if(decoded_data->data) {
-                       free(decoded_data->data);
-                       decoded_data->data = NULL;
-               }
-
+               IMG_JPEG_FREE(decoded_data->data);
                jpeg_destroy_decompress(&dinfo);
                return MM_ERROR_IMAGE_FILEOPEN;
        }
@@ -1123,6 +1148,12 @@ mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_da
                dinfo.do_fancy_upsampling = FALSE;
                dinfo.do_block_smoothing = FALSE;
                dinfo.dither_mode = JDITHER_ORDERED;
+       } else if (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) {
+               dinfo.scale_num = 1;
+               dinfo.scale_denom = (unsigned int)downscale;
+               dinfo.do_fancy_upsampling = FALSE;
+               dinfo.do_block_smoothing = FALSE;
+               dinfo.dither_mode = JDITHER_ORDERED;
        }
 #endif
        dinfo.dct_method = JDCT_FASTEST;
@@ -1153,6 +1184,16 @@ mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_da
        jpeg_start_decompress(&dinfo);
        debug_log("jpeg_start_decompress");
 
+       /* 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) {
+                       dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
+               }
+               if(dinfo.output_height% 2 != 0) {
+                       dinfo.output_height = MM_JPEG_ROUND_DOWN_2(dinfo.output_height);
+               }
+       }
+
        /* JSAMPLEs per row in output buffer */
        row_stride = dinfo.output_width * dinfo.output_components;
 
@@ -1209,6 +1250,7 @@ mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_da
                        }
                }
        } else if(input_fmt == MM_UTIL_JPEG_FMT_RGB888 ||input_fmt == MM_UTIL_JPEG_FMT_GraySacle || input_fmt == MM_UTIL_JPEG_FMT_RGB888 || input_fmt == MM_UTIL_JPEG_FMT_RGBA8888 || input_fmt == MM_UTIL_JPEG_FMT_BGRA8888 || input_fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
+               int state = 0;
                while (dinfo.output_scanline < dinfo.output_height) {
                        /* jpeg_read_scanlines expects an array of pointers to scanlines. Here the array is only one element long, but you could ask formore than one scanline at a time if that's more convenient. */
                        jpeg_read_scanlines(&dinfo, buffer, 1);
@@ -1217,7 +1259,6 @@ mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_da
                        state += row_stride;
                }
                debug_log("jpeg_read_scanlines");
-
        }
 
        /* Finish decompression */
@@ -1233,6 +1274,7 @@ mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_da
        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;
@@ -1298,9 +1340,20 @@ static unsigned char* _mm_util_add_basic_exif_info(unsigned char* jpeg_data, int
        ExifLong elong[10];
        ExifData *exif = NULL;
 
-       system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &model_name);
-       system_info_get_value_string(SYSTEM_INFO_KEY_MANUFACTURER, &manufacturer);
-       system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_STRING, &software_version);
+       if (system_info_get_platform_string("http://tizen.org/system/model_name", &model_name) != SYSTEM_INFO_ERROR_NONE) {
+               debug_error("Error - get the value of model_name with system_info");
+               goto ret_error;
+       }
+
+       if (system_info_get_platform_string("http://tizen.org/system/manufacturer", &manufacturer) != SYSTEM_INFO_ERROR_NONE) {
+               debug_error("Error - get the value of manufacturer with system_info");
+               goto ret_error;
+       }
+
+       if (system_info_get_platform_string("http://tizen.org/system/build.string", &software_version) != SYSTEM_INFO_ERROR_NONE) {
+               debug_error("Error - get the value of software_version with system_info");
+               goto ret_error;
+       }
 
        exif = exif_data_new();
        if (NULL == exif) {
@@ -1385,55 +1438,49 @@ static unsigned char* _mm_util_add_basic_exif_info(unsigned char* jpeg_data, int
 
        *jpeg_length = final_length;
 
- ret_error:
-
-       if (NULL != model_name) {
-               free(model_name);
-       }
+ret_error:
 
-       if (NULL != manufacturer) {
-               free(manufacturer);
-       }
+       IMG_JPEG_FREE(model_name);
+       IMG_JPEG_FREE(manufacturer);
+       IMG_JPEG_FREE(software_version);
+       IMG_JPEG_FREE(exif_data);
+       IMG_JPEG_FREE(time_buf);
 
-       if (NULL != software_version) {
-               free(software_version);
-       }
-
-       if (NULL != exif_data) {
-               free(exif_data);
-       }
-
-       if (NULL != time_buf) {
-               free(time_buf);
-       }
-
-       exif_data_unref(exif);
+       if(exif)
+               exif_data_unref(exif);
 
        return final_data;
 }
+#endif
 
 EXPORT_API int
-mm_util_jpeg_encode_to_file(char *filename, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+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_ERROR_NONE;
 
+       TTRACE_BEGIN("MM_UTILITY:JPEG:ENCODE_TO_FILE");
+
        if( !filename || !src) {
                debug_error("#ERROR# filename || src buffer is NULL");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (width < 0) || (height < 0)) {
+       if( (width <= 0) || (height <= 0)) {
                debug_error("#ERROR# src_width || src_height value ");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
                debug_error("#ERROR# fmt value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (quality < 0 ) || (quality>100) ) {
+       if( (quality < 1 ) || (quality>100) ) {
                debug_error("#ERROR# quality vaule");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
@@ -1451,18 +1498,21 @@ mm_util_jpeg_encode_to_file(char *filename, void* src, int width, int height, mm
                dst = malloc(dst_size);
                if(dst) {
                        ret = mm_util_convert_colorspace(src, width, height,MM_UTIL_IMG_FMT_NV12, dst, MM_UTIL_IMG_FMT_YUV420);
-                       ret =mm_image_encode_to_jpeg_file_with_libjpeg(filename, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
-                       free(dst); dst=NULL;
+                       ret = mm_image_encode_to_jpeg_file_with_libjpeg(filename, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
+                       IMG_JPEG_FREE(dst);
                } else {
+                       TTRACE_END();
                        return MM_ERROR_IMAGE_NO_FREE_SPACE;
                }
        } else if(fmt == MM_UTIL_JPEG_FMT_NV21) {
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        } else {
                ret = mm_image_encode_to_jpeg_file_with_libjpeg(filename, src, width, height, fmt, quality);
        }
        debug_log("#END# libjpeg, Success!! ret: %d", ret);
 #endif
+       TTRACE_END();
        return ret;
 }
 
@@ -1471,23 +1521,29 @@ mm_util_jpeg_encode_to_memory(void **mem, int *size, void* src, int width, int h
 {
        int ret = MM_ERROR_NONE;
 
+       TTRACE_BEGIN("MM_UTILITY:JPEG:ENCODE_TO_MEMORY");
+
        if( !mem || !size || !src) {
                debug_error("#ERROR# filename ||size ||  src buffer is NULL");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if( (width < 0) || (height < 0)) {
+       if( (width <= 0) || (height <= 0)) {
                debug_error("#ERROR# src_width || src_height value ");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
                debug_error("#ERROR# fmt value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
-       if(  (quality < 0 ) || (quality>100) ) {
+       if(  (quality < 1 ) || (quality>100) ) {
                debug_error("#ERROR# quality vaule");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
@@ -1505,42 +1561,62 @@ mm_util_jpeg_encode_to_memory(void **mem, int *size, void* src, int width, int h
                if(dst) {
                        ret = mm_util_convert_colorspace(src, width, height,MM_UTIL_IMG_FMT_NV12, dst, MM_UTIL_IMG_FMT_YUV420);
                        ret = mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
-                       free(dst); dst=NULL;
+                       IMG_JPEG_FREE(dst);
                } else {
+                       TTRACE_END();
                        return MM_ERROR_IMAGE_NO_FREE_SPACE;
                }
        } else if(fmt == MM_UTIL_JPEG_FMT_NV21) {
+               TTRACE_END();
                return MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        } else {
                ret = mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, src, width, height, fmt, quality);
        }
 #endif /* LIBJPEG_TURBO */
        debug_log("#END# libjpeg, Success!! ret: %d", ret);
+
+       TTRACE_END();
        return ret;
 }
 
 EXPORT_API int
-mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, char *filename, mm_util_jpeg_yuv_format fmt)
+mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt)
 {
        int ret = MM_ERROR_NONE;
 
+       mm_util_jpeg_decode_downscale downscale = MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1;
+
+       TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_FILE");
+
        if( !decoded || !filename) {
                debug_error("#ERROR# decoded || filename buffer is NULL");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
                debug_error("#ERROR# fmt value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        FILE *fp = fopen(filename, "rb");
        unsigned char magic[2] = {0};
+       size_t read_size = 0;
        if(fp) {
-               fread((void *)magic, 1, 2, fp);
+               read_size = fread((void *)magic, 1, 2, fp);
+               if (read_size > 0)
+                       debug_log("Success fread");
+
                debug_log("%x %x", magic[0], magic[1]);
                fclose(fp);
+       } else {
+               debug_error("[infile] file open [%s]", filename);
+               mm_util_stderror("file open failed");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_FILEOPEN;
        }
+
        if(magic[0] == 0xff && magic[1] == 0xd8) {
                #if LIBJPEG_TURBO
                debug_log("#START# LIBJPEG_TURBO");
@@ -1549,7 +1625,40 @@ mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, char *filename, mm
                debug_log("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
                #else
                debug_log("#START# libjpeg");
-               ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt);
+               if(fmt == MM_UTIL_JPEG_FMT_NV12) {
+                       unsigned int dst_size = 0;
+                       ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, MM_UTIL_IMG_FMT_YUV420, downscale);
+                       if (ret == MM_ERROR_NONE) {
+                               int err = MM_ERROR_NONE;
+                               err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                               if (err != MM_ERROR_NONE)
+                                       debug_error("fail mm_util_get_image_size");
+
+                               unsigned char *dst = NULL;
+                               dst = malloc(dst_size);
+                               if(dst) {
+                                       ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                                       IMG_JPEG_FREE(decoded->data);
+                                       decoded->data = malloc(dst_size);
+                                       if (decoded->data == NULL) {
+                                               debug_log("memory allocation failed");
+                                               IMG_JPEG_FREE(dst);
+                                               TTRACE_END();
+                                               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                                       }
+                                       memcpy(decoded->data, dst, dst_size);
+                                       decoded->size = dst_size;
+                                       IMG_JPEG_FREE(dst);
+                               } else {
+                                       debug_log("memory allocation failed");
+                                       TTRACE_END();
+                                       return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                               }
+                       }
+               } else {
+                       ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, downscale);
+               }
+
                debug_log("decoded->data: %p\t width: %d\t height:%d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
                debug_log("#End# libjpeg, Success!! ret: %d", ret);
                #endif
@@ -1567,6 +1676,7 @@ mm_util_decode_from_jpeg_file(mm_util_jpeg_yuv_data *decoded, char *filename, mm
                ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
        }
 
+       TTRACE_END();
        return ret;
 }
 
@@ -1575,18 +1685,209 @@ mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data* decoded, void* src, int s
 {
        int ret = MM_ERROR_NONE;
 
+       TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_MEMORY");
+
+       mm_util_jpeg_decode_downscale downscale = MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1;
+
+       if( !decoded || !src) {
+               debug_error("#ERROR# decoded || src buffer is NULL");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       if(size < 0) {
+               debug_error("#ERROR# size");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
+               debug_error("#ERROR# fmt value");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       #if LIBJPEG_TURBO
+       debug_log("#START# libjpeg");
+       ret = mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
+
+       debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+       debug_log("#END# libjpeg, Success!! ret: %d", ret);
+
+       #else
+       debug_log("#START# libjpeg");
+       if(fmt == MM_UTIL_JPEG_FMT_NV12) {
+               unsigned int dst_size = 0;
+               unsigned char *dst = NULL;
+
+               ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, MM_UTIL_IMG_FMT_YUV420, downscale);
+               if (ret == MM_ERROR_NONE) {
+                       int err = MM_ERROR_NONE;
+                       err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                       if (err != MM_ERROR_NONE)
+                                       debug_error("fail mm_util_get_image_size");
+
+                       dst = malloc(dst_size);
+                       if(dst) {
+                               ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                               IMG_JPEG_FREE(decoded->data);
+                               decoded->data = malloc(dst_size);
+                               if (decoded->data == NULL) {
+                                       debug_log("memory allocation failed");
+                                       IMG_JPEG_FREE(dst);
+                                       TTRACE_END();
+                                       return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                               }
+                               memcpy(decoded->data, dst, dst_size);
+                               decoded->size = dst_size;
+                               IMG_JPEG_FREE(dst);
+                       } else {
+                               debug_log("memory allocation failed");
+                               TTRACE_END();
+                               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                       }
+               }
+       } else {
+               ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, downscale);
+       }
+
+       debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+       debug_log("#END# libjpeg, Success!! ret: %d", ret);
+       #endif
+
+       TTRACE_END();
+       return ret;
+}
+
+EXPORT_API int
+mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+{
+       int ret = MM_ERROR_NONE;
+
+       TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_FILE_WITH_DOWNSCALE");
+
+       if( !decoded || !filename) {
+               debug_error("#ERROR# decoded || filename buffer is NULL");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
+               debug_error("#ERROR# fmt value");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       if( (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_2)
+                && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_4) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8)) {
+               debug_error("#ERROR# fmt value");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       FILE *fp = fopen(filename, "rb");
+       unsigned char magic[2] = {0};
+       size_t read_size = 0;
+       if(fp) {
+               read_size = fread((void *)magic, 1, 2, fp);
+               if (read_size > 0)
+                       debug_log("Success fread");
+
+               debug_log("%x %x", magic[0], magic[1]);
+               fclose(fp);
+       }
+       if(magic[0] == 0xff && magic[1] == 0xd8) {
+               #if LIBJPEG_TURBO
+               debug_log("#START# LIBJPEG_TURBO");
+               ret = mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
+               debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+               debug_log("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
+               #else
+               debug_log("#START# libjpeg");
+               if(fmt == MM_UTIL_JPEG_FMT_NV12) {
+                       unsigned int dst_size = 0;
+                       ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, MM_UTIL_IMG_FMT_YUV420, downscale);
+                       if (ret == MM_ERROR_NONE) {
+                               int err = MM_ERROR_NONE;
+                               err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                               if (err != MM_ERROR_NONE)
+                                       debug_error("fail mm_util_get_image_size");
+
+                               unsigned char *dst = NULL;
+                               dst = malloc(dst_size);
+                               if(dst) {
+                                       ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                                       IMG_JPEG_FREE(decoded->data);
+                                       decoded->data = malloc(dst_size);
+                                       if (decoded->data == NULL) {
+                                               debug_log("memory allocation failed");
+                                               IMG_JPEG_FREE(dst);
+                                               TTRACE_END();
+                                               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                                       }
+                                       memcpy(decoded->data, dst, dst_size);
+                                       decoded->size = dst_size;
+                                       IMG_JPEG_FREE(dst);
+                               } else {
+                                       debug_log("memory allocation failed");
+                                       TTRACE_END();
+                                       return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                               }
+                       }
+               } else {
+                       ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, downscale);
+               }
+
+               debug_log("decoded->data: %p\t width: %d\t height:%d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+               debug_log("#End# libjpeg, Success!! ret: %d", ret);
+               #endif
+       } else if(magic[0] == 0x47 && magic[1] == 0x49) {
+               debug_error("Not JPEG IMAGE - GIF");
+               ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+       } else if(magic[0] == 0x89 && magic[1] == 0x50) {
+               debug_error("Not JPEG IMAGE - PNG");
+               ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+       } else if(magic[0] == 0x49 && magic[1] == 0x49) {
+               debug_error("Not JPEG IMAGE - TIFF");
+               ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+       } else {
+               debug_error("Not JPEG IMAGE");
+               ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+       }
+
+       TTRACE_END();
+       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)
+{
+       int ret = MM_ERROR_NONE;
+
+       TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_MEMORY_WITH_DOWNSCALE");
+
        if( !decoded || !src) {
                debug_error("#ERROR# decoded || src buffer is NULL");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if(size < 0) {
                debug_error("#ERROR# size");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
        if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
                debug_error("#ERROR# fmt value");
+               TTRACE_END();
+               return MM_ERROR_IMAGE_INVALID_VALUE;
+       }
+
+       if( (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_2)
+                && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_4) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8)) {
+               debug_error("#ERROR# fmt value");
+               TTRACE_END();
                return MM_ERROR_IMAGE_INVALID_VALUE;
        }
 
@@ -1599,10 +1900,45 @@ mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data* decoded, void* src, int s
 
        #else
        debug_log("#START# libjpeg");
-       ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt);
+       if(fmt == MM_UTIL_JPEG_FMT_NV12) {
+               unsigned int dst_size = 0;
+               unsigned char *dst = NULL;
+
+               ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, MM_UTIL_IMG_FMT_YUV420, downscale);
+               if (ret == MM_ERROR_NONE) {
+                       int err = MM_ERROR_NONE;
+                       err = mm_util_get_image_size(MM_UTIL_IMG_FMT_NV12, decoded->width, decoded->height, &dst_size);
+                       if (err != MM_ERROR_NONE)
+                                       debug_error("fail mm_util_get_image_size");
+
+                       dst = malloc(dst_size);
+                       if(dst) {
+                               ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_IMG_FMT_YUV420, dst, MM_UTIL_IMG_FMT_NV12);
+                               IMG_JPEG_FREE(decoded->data);
+                               decoded->data = malloc(dst_size);
+                               if (decoded->data == NULL) {
+                                       debug_log("memory allocation failed");
+                                       IMG_JPEG_FREE(dst);
+                                       TTRACE_END();
+                                       return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                               }
+                               memcpy(decoded->data, dst, dst_size);
+                               decoded->size = dst_size;
+                               IMG_JPEG_FREE(dst);
+                       } else {
+                               debug_log("memory allocation failed");
+                               TTRACE_END();
+                               return MM_ERROR_IMAGE_NO_FREE_SPACE;
+                       }
+               }
+       } else {
+               ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, downscale);
+       }
 
        debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
        debug_log("#END# libjpeg, Success!! ret: %d", ret);
        #endif
+
+       TTRACE_END();
        return ret;
 }
index 0de4bb0..f5a92cd 100755 (executable)
@@ -98,7 +98,7 @@ static int _read_file(char *file_name, void **data, int *data_size)
 }
 
 
-static int _write_file(char *file_name, void *data, int data_size)
+static int _write_file(const char *file_name, void *data, int data_size)
 {
        FILE *fp = NULL;
 
@@ -138,11 +138,13 @@ int main(int argc, char *argv[])
 
        mm_util_jpeg_yuv_data decoded_data = {0,};
        mm_util_jpeg_yuv_format fmt; /* = MM_UTIL_JPEG_FMT_RGB888; */
+       mm_util_jpeg_decode_downscale downscale;
 
        if (argc < 2) {
                fprintf(stderr, "\t[usage]\n");
                fprintf(stderr, "\t\t1. encode : mm_util_jpeg_testsuite encode filepath.yuv width height quality\n");
                fprintf(stderr, "\t\t2. decode : mm_util_jpeg_testsuite decode filepath.jpg\n");
+               fprintf(stderr, "\t\t3. decode_ds : mm_util_jpeg_testsuite decode_ds filepath.jpg format downscale\n");
                return 0;
        }
 
@@ -170,6 +172,17 @@ int main(int argc, char *argv[])
                } else {
                        ret = MM_ERROR_IMAGE_INTERNAL;
                }
+       } else if (!strcmp("decode_ds", argv[1])) {
+               if (_read_file(argv[2], &src, &src_size)) {
+                       fmt = atoi(argv[3]);
+                       downscale = atoi(argv[4]);
+                       ret = mm_util_decode_from_jpeg_memory_with_downscale(&decoded_data, src, src_size, fmt, downscale);
+
+                       free(src);
+                       src = NULL;
+               } else {
+                       ret = MM_ERROR_IMAGE_INTERNAL;
+               }
        } else {
                fprintf(stderr, "\tunknown command [%s]\n", argv[1]);
                return 0;
@@ -195,11 +208,12 @@ int main(int argc, char *argv[])
                        if(decoded_data.data) {
                                fprintf(stderr, "\t##Decoded data##: %p\t width: %d\t height:%d\t size: %d\n",
                                                decoded_data.data, decoded_data.width, decoded_data.height, decoded_data.size);
-                               char filename[BUFFER_SIZE];
+                               char filename[BUFFER_SIZE] = {0, };
                                memset(filename, 0, BUFFER_SIZE);
                                if(fmt == MM_UTIL_JPEG_FMT_RGB888 || fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
                                        snprintf(filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "rgb");
                                } else if((fmt == MM_UTIL_JPEG_FMT_YUV420) ||
+                                       (fmt == MM_UTIL_JPEG_FMT_YUV422) ||
                                        (fmt == MM_UTIL_JPEG_FMT_NV12) ||
                                        (fmt == MM_UTIL_JPEG_FMT_NV21) ||
                                        (fmt == MM_UTIL_JPEG_FMT_NV16) ||
old mode 100644 (file)
new mode 100755 (executable)
index 4fd01d6..9f5b51b
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.34
+Version:    0.53
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
@@ -16,6 +16,7 @@ BuildRequires:  pkgconfig(capi-media-tool)
 BuildRequires:  pkgconfig(libtbm)
 BuildRequires:  pkgconfig(libexif)
 BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires:  pkgconfig(ttrace)
 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
 %description
@@ -40,8 +41,11 @@ Requires:   %{name} = %{version}-%{release}
 
 %build
 ./autogen.sh
-
-CFLAGS="$CFLAGS -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" -D_MM_PROJECT_FLOATER" \
+export CFLAGS+=" -Wextra -Wno-array-bounds"
+export CFLAGS+=" -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow"
+export CFLAGS+=" -Wwrite-strings -Wswitch-default"
+export CFLAGS+=" -Werror"
+CFLAGS="$CFLAGS -DENABLE_TTRACE -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" -D_MM_PROJECT_FLOATER" \
 LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--hash-style=both -Wl,--as-needed" \
 ./configure --prefix=%{_prefix}
 
index 7048f60..5afd0f5 100755 (executable)
@@ -1,11 +1,11 @@
 bin_PROGRAMS = mm_utility_testsuite
 
-mm_utility_testsuite_SOURCES = mm_utility_testsuite.c  
-                            
+mm_utility_testsuite_SOURCES = mm_utility_testsuite.c
+
 mm_utility_testsuite_CFLAGS = -I$(srcdir)/../include \
                                 $(MMCOMMON_CFLAGS) -fPIE -pie
 
-                                               
+
 mm_utility_testsuite_LDADD = $(MMCOMMON_LIBS)