From: hj kim Date: Thu, 22 Feb 2018 01:11:41 +0000 (+0900) Subject: mm_util_decode_from_jpeg_memory() and mm_util_decode_from_jpeg_file() APIs are remove... X-Git-Tag: submit/tizen/20180223.061228^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=332893bb0d97e9a62e36210cc5fd595c8b36e163;p=platform%2Fcore%2Fapi%2Fimage-util.git mm_util_decode_from_jpeg_memory() and mm_util_decode_from_jpeg_file() APIs are removed. Use _downscale() APIs instead Change-Id: I51686b82eef915a243f650cd0bf0c3a1ad75fe82 --- diff --git a/include/image_util_private.h b/include/image_util_private.h index 4a881bb..22a34f9 100755 --- a/include/image_util_private.h +++ b/include/image_util_private.h @@ -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""FONT_COLOR_RESET); \ + } while (0) + +#define image_util__fleave() do { \ + LOGD(FONT_COLOR_YELLOW""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); \ diff --git a/packaging/capi-media-image-util.spec b/packaging/capi-media-image-util.spec index 1c31cbc..d6aa217 100755 --- a/packaging/capi-media-image-util.spec +++ b/packaging/capi-media-image-util.spec @@ -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 diff --git a/src/image_util_decode.c b/src/image_util_decode.c index 2d0a6d8..cb03962 100755 --- a/src/image_util_decode.c +++ b/src/image_util_decode.c @@ -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)