mm_util_decode_from_jpeg_memory() and mm_util_decode_from_jpeg_file() APIs are remove... 28/170728/4 accepted/tizen/unified/20180226.142327 submit/tizen/20180223.061228
authorhj kim <backto.kim@samsung.com>
Thu, 22 Feb 2018 01:11:41 +0000 (10:11 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 22 Feb 2018 01:54:34 +0000 (01:54 +0000)
Change-Id: I51686b82eef915a243f650cd0bf0c3a1ad75fe82

include/image_util_private.h
packaging/capi-media-image-util.spec
src/image_util_decode.c

index 4a881bb46778814ef3cd6095e6444f22203560b4..22a34f9918e83ebc3198d72c2bc02ad118d665f6 100755 (executable)
@@ -35,6 +35,7 @@ extern "C"
 
 #define FONT_COLOR_RESET    "\033[0m"
 #define FONT_COLOR_RED      "\033[31m"
+#define FONT_COLOR_YELLOW   "\033[33m"
 
 #define image_util_debug(fmt, arg...) do { \
                LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg);     \
@@ -48,6 +49,14 @@ extern "C"
                LOGW(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
        } while (0)
 
+#define image_util_fenter() do { \
+                       LOGD(FONT_COLOR_YELLOW"<ENTER>"FONT_COLOR_RESET); \
+               } while (0)
+
+#define image_util__fleave() do { \
+                       LOGD(FONT_COLOR_YELLOW"<LEAVE>"FONT_COLOR_RESET); \
+               } while (0)
+
 #define image_util_retm_if(expr, fmt, arg...) do { \
                if (expr) { \
                        LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
index 1c31cbcfc0da00217f13370a7e5115bf7ce74c1c..d6aa217a39d1a00fd17abcb28d294ad50796b62b 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-image-util
 Summary:    A Image Utility library in Tizen Native API
-Version:    0.1.33
+Version:    0.1.34
 Release:    2
 Group:      Multimedia/API
 License:    Apache-2.0
index 2d0a6d858078d7a6c75be7527fe76b731f820fe0..cb0396275402e797a76454d5b03666e87d88d176 100755 (executable)
@@ -120,7 +120,7 @@ static int _image_util_decode_create_jpeg_handle(decode_encode_s * handle)
 
        handle->image_h = (mm_util_imgp_h) _handle;
        handle->colorspace = IMAGE_UTIL_COLORSPACE_RGBA8888;
-       handle->down_scale = sizeof(image_util_scale_e);
+       handle->down_scale = IMAGE_UTIL_DOWNSCALE_1_1;
 
        return IMAGE_UTIL_ERROR_NONE;
 }
@@ -174,7 +174,7 @@ static int _image_util_decode_create_bmp_handle(decode_encode_s * handle)
 
 int image_util_decode_create(image_util_decode_h * handle)
 {
-       image_util_debug("image_util_decode_create");
+       image_util_fenter();
 
        image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
 
@@ -351,17 +351,10 @@ static int _image_util_decode_internal(decode_encode_s * _handle)
                {
                        mm_util_jpeg_yuv_data *jpeg_data = (mm_util_jpeg_yuv_data *) _handle->image_h;
 
-                       if (_handle->path) {
-                               if (_handle->down_scale < sizeof(image_util_scale_e))
+                       if (_handle->path)
                                        err = mm_util_decode_from_jpeg_file_with_downscale(jpeg_data, _handle->path, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[_handle->down_scale]);
-                               else
-                                       err = mm_util_decode_from_jpeg_file(jpeg_data, _handle->path, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG));
-                       } else {
-                               if (_handle->down_scale < sizeof(image_util_scale_e))
+                       else
                                        err = mm_util_decode_from_jpeg_memory_with_downscale(jpeg_data, _handle->src_buffer[0], (unsigned int)_handle->src_size, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[_handle->down_scale]);
-                               else
-                                       err = mm_util_decode_from_jpeg_memory(jpeg_data, _handle->src_buffer[0], (unsigned int)_handle->src_size, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG));
-                       }
 
                        if (err == MM_UTIL_ERROR_NONE) {
                                *(_handle->dst_buffer) = jpeg_data->data;
@@ -439,7 +432,6 @@ int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsi
        image_util_retvm_if((_handle->path == NULL && _handle->src_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
        image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output");
 
-
        err = _image_util_decode_internal(_handle);
 
        if (err != IMAGE_UTIL_ERROR_NONE) {
@@ -553,61 +545,16 @@ int image_util_decode_destroy(image_util_decode_h handle)
 
 int image_util_decode_jpeg(const char *path, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
 {
-       int err = MM_UTIL_ERROR_NONE;
-
        DEPRECATION_LOGW("image_util_decode_jpeg()", "image_util_decode_create()");
 
-       image_util_retvm_if((path == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "path is null");
-       image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
-       image_util_retvm_if((size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "size is null");
-       image_util_retvm_if((strlen(path) == 0), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
-       image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
-       image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
-
-       mm_util_jpeg_yuv_data decoded;
-       memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
-
-       err = mm_util_decode_from_jpeg_file(&decoded, path, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG));
-       if (err == MM_UTIL_ERROR_NONE) {
-               *image_buffer = decoded.data;
-               if (width)
-                       *width = decoded.width;
-               if (height)
-                       *height = decoded.height;
-               if (size)
-                       *size = decoded.size;
-       }
-       return _image_error_capi(ERR_TYPE_DECODE, err);
+       return image_util_decode_jpeg_with_downscale(path, colorspace, IMAGE_UTIL_DOWNSCALE_1_1, image_buffer, width, height, size);
 }
 
 int image_util_decode_jpeg_from_memory(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
 {
-       int err = MM_UTIL_ERROR_NONE;
-
        DEPRECATION_LOGW("image_util_decode_jpeg_from_memory()", "image_util_decode_create()");
 
-       image_util_retvm_if((jpeg_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_buffer is null");
-       image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
-       image_util_retvm_if((size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "size is null");
-       image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
-       image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
-
-       mm_util_jpeg_yuv_data decoded;
-       memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
-
-       err = mm_util_decode_from_jpeg_memory(&decoded, (void *)jpeg_buffer, (unsigned int)jpeg_size, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG));
-
-       if (err == MM_UTIL_ERROR_NONE) {
-               *image_buffer = decoded.data;
-               if (width)
-                       *width = decoded.width;
-               if (height)
-                       *height = decoded.height;
-               if (size)
-                       *size = decoded.size;
-       }
-
-       return _image_error_capi(ERR_TYPE_DECODE, err);
+       return image_util_decode_jpeg_from_memory_with_downscale(jpeg_buffer, jpeg_size, colorspace, IMAGE_UTIL_DOWNSCALE_1_1, image_buffer, width, height, size);
 }
 
 int image_util_decode_jpeg_with_downscale(const char *path, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size)