From: hj kim Date: Tue, 13 Feb 2018 08:12:28 +0000 (+0900) Subject: Remove useless format_label X-Git-Tag: submit/tizen/20180219.051103~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=541a6cd7ff7ef8b7ea56bef3408d7adace5fedda;p=platform%2Fcore%2Fmultimedia%2Flibmm-utility.git Remove useless format_label Change-Id: I8aa9106709c771c6a058070ea95d4619c18dfc68 --- diff --git a/imgp/include/mm_util_imgp_internal.h b/imgp/include/mm_util_imgp_internal.h index 8b99994..fb9fc18 100755 --- a/imgp/include/mm_util_imgp_internal.h +++ b/imgp/include/mm_util_imgp_internal.h @@ -43,11 +43,9 @@ * Image Process Info for dlopen */ typedef struct _imgp_info_s { - char *input_format_label; mm_util_color_format_e src_format; unsigned int src_width; unsigned int src_height; - char *output_format_label; mm_util_color_format_e dst_format; unsigned int dst_width; unsigned int dst_height; diff --git a/imgp/mm_util_imgp.c b/imgp/mm_util_imgp.c index ceab8ee..32841b6 100755 --- a/imgp/mm_util_imgp.c +++ b/imgp/mm_util_imgp.c @@ -82,42 +82,52 @@ static gboolean __mm_cannot_convert_format(mm_util_color_format_e src_format, mm return _bool; } -static gboolean __mm_gst_can_resize_format(char *__format_label) +static gboolean __mm_gst_can_resize_format(mm_util_color_format_e color_format) { gboolean _bool = FALSE; - mm_util_debug("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) { + mm_util_debug("color_format [%d]", color_format); + switch (color_format) { + case MM_UTIL_COLOR_YUV420: + case MM_UTIL_COLOR_YUV422: + case MM_UTIL_COLOR_I420: + case MM_UTIL_COLOR_UYVY: + case MM_UTIL_COLOR_YUYV: + case MM_UTIL_COLOR_RGB16: + case MM_UTIL_COLOR_RGB24: + case MM_UTIL_COLOR_ARGB: + case MM_UTIL_COLOR_BGRA: + case MM_UTIL_COLOR_RGBA: + case MM_UTIL_COLOR_BGRX: _bool = TRUE; + break; + default: + mm_util_error("Not supported format"); //only not support NV12 } return _bool; } -static gboolean __mm_gst_can_rotate_format(const char *__format_label) +static gboolean __mm_gst_can_rotate_format(mm_util_color_format_e color_format) { gboolean _bool = FALSE; - mm_util_debug("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) { + mm_util_debug("color_format [%d]", color_format); + switch (color_format) { + case MM_UTIL_COLOR_YUV420: + case MM_UTIL_COLOR_I420: + case MM_UTIL_COLOR_RGB24: + case MM_UTIL_COLOR_ARGB: + case MM_UTIL_COLOR_BGRA: + case MM_UTIL_COLOR_RGBA: _bool = TRUE; + break; + default: + mm_util_error("Not supported format"); } - mm_util_debug("boolean: %d", _bool); - return _bool; } @@ -469,131 +479,6 @@ static int __mm_confirm_dst_width_height(unsigned int src_width, unsigned int sr return ret; } -static int __mm_set_format_label(imgp_info_s *_imgp_info_s, mm_util_color_format_e src_format, mm_util_color_format_e dst_format) -{ - int ret = MM_UTIL_ERROR_NONE; - char *src_fmt_lable = NULL; - char *dst_fmt_lable = NULL; - - if (_imgp_info_s == NULL) { - mm_util_error("Invalid _imgp_info_s"); - return MM_UTIL_ERROR_INVALID_PARAMETER; - } - - switch (src_format) { - case MM_UTIL_COLOR_YUV420: - src_fmt_lable = (char *)"YV12"; - break; - case MM_UTIL_COLOR_YUV422: - src_fmt_lable = (char *)"Y42B"; - break; - case MM_UTIL_COLOR_I420: - src_fmt_lable = (char *)"I420"; - break; - case MM_UTIL_COLOR_NV12: - src_fmt_lable = (char *)"NV12"; - break; - case MM_UTIL_COLOR_UYVY: - src_fmt_lable = (char *)"UYVY"; - break; - case MM_UTIL_COLOR_YUYV: - src_fmt_lable = (char *)"YUYV"; - break; - case MM_UTIL_COLOR_RGB16: - src_fmt_lable = (char *)"RGB565"; - break; - case MM_UTIL_COLOR_RGB24: - src_fmt_lable = (char *)"RGB888"; - break; - case MM_UTIL_COLOR_ARGB: - src_fmt_lable = (char *)"ARGB8888"; - break; - case MM_UTIL_COLOR_BGRA: - src_fmt_lable = (char *)"BGRA8888"; - break; - case MM_UTIL_COLOR_RGBA: - src_fmt_lable = (char *)"RGBA8888"; - break; - case MM_UTIL_COLOR_BGRX: - src_fmt_lable = (char *)"BGRX"; - break; - default: - mm_util_debug("[%d] Not supported format", src_format); - break; - } - - switch (dst_format) { - case MM_UTIL_COLOR_YUV420: - dst_fmt_lable = (char *)"YV12"; - break; - case MM_UTIL_COLOR_YUV422: - dst_fmt_lable = (char *)"Y42B"; - break; - case MM_UTIL_COLOR_I420: - dst_fmt_lable = (char *)"I420"; - break; - case MM_UTIL_COLOR_NV12: - dst_fmt_lable = (char *)"NV12"; - break; - case MM_UTIL_COLOR_UYVY: - dst_fmt_lable = (char *)"UYVY"; - break; - case MM_UTIL_COLOR_YUYV: - dst_fmt_lable = (char *)"YUYV"; - break; - case MM_UTIL_COLOR_RGB16: - dst_fmt_lable = (char *)"RGB565"; - break; - case MM_UTIL_COLOR_RGB24: - dst_fmt_lable = (char *)"RGB888"; - break; - case MM_UTIL_COLOR_ARGB: - dst_fmt_lable = (char *)"ARGB8888"; - break; - case MM_UTIL_COLOR_BGRA: - dst_fmt_lable = (char *)"BGRA8888"; - break; - case MM_UTIL_COLOR_RGBA: - dst_fmt_lable = (char *)"RGBA8888"; - break; - case MM_UTIL_COLOR_BGRX: - dst_fmt_lable = (char *)"BGRX"; - break; - default: - mm_util_error("[%d] Not supported format", dst_format); - break; - } - - if (src_fmt_lable && dst_fmt_lable) { - unsigned int src_fmt_len = strlen(src_fmt_lable) + 1; - unsigned int dst_fmt_len = strlen(dst_fmt_lable) + 1; - mm_util_debug("src_fmt_lable: %s dst_fmt_lable: %s", src_fmt_lable, dst_fmt_lable); - _imgp_info_s->input_format_label = (char *)calloc(1, src_fmt_len); - if (_imgp_info_s->input_format_label == NULL) { - mm_util_error("[input] input_format_label is null"); - return MM_UTIL_ERROR_OUT_OF_MEMORY; - } - memset(_imgp_info_s->input_format_label, 0, src_fmt_len); - MMUTIL_SAFE_STRCPY(_imgp_info_s->input_format_label, src_fmt_lable, src_fmt_len); - - _imgp_info_s->output_format_label = (char *)calloc(1, dst_fmt_len); - if (_imgp_info_s->output_format_label == NULL) { - mm_util_error("[input] input_format_label is null"); - MMUTIL_SAFE_G_FREE(_imgp_info_s->input_format_label); - return MM_UTIL_ERROR_OUT_OF_MEMORY; - } - memset(_imgp_info_s->output_format_label, 0, dst_fmt_len); - MMUTIL_SAFE_STRCPY(_imgp_info_s->output_format_label, dst_fmt_lable, dst_fmt_len); - - mm_util_debug("input_format_label: %s output_format_label: %s", _imgp_info_s->input_format_label, _imgp_info_s->output_format_label); - } else { - mm_util_error("[error] src_fmt_lable && dst_fmt_lable"); - return MM_UTIL_ERROR_INVALID_PARAMETER; - } - - return ret; -} - static int __mm_set_imgp_info_s(imgp_info_s *_imgp_info_s, mm_util_color_format_e src_format, unsigned int src_width, unsigned int src_height, mm_util_color_format_e dst_format, unsigned int dst_width, unsigned int dst_height, mm_util_img_rotate_type angle) { int ret = MM_UTIL_ERROR_NONE; @@ -603,12 +488,6 @@ static int __mm_set_imgp_info_s(imgp_info_s *_imgp_info_s, mm_util_color_format_ return MM_UTIL_ERROR_INVALID_PARAMETER; } - ret = __mm_set_format_label(_imgp_info_s, src_format, dst_format); - if (ret != MM_UTIL_ERROR_NONE) { - mm_util_error("[input] mm_set_format_label error"); - return MM_UTIL_ERROR_INVALID_PARAMETER; - } - _imgp_info_s->src_format = src_format; _imgp_info_s->src_width = src_width; _imgp_info_s->src_height = src_height; @@ -619,9 +498,7 @@ static int __mm_set_imgp_info_s(imgp_info_s *_imgp_info_s, mm_util_color_format_ _imgp_info_s->buffer_size = 0; _imgp_info_s->angle = angle; - mm_util_debug("[input] format label: %s width: %d height: %d [output] format label: %s width: %d height: %d rotation_value: %d", - _imgp_info_s->input_format_label, _imgp_info_s->src_width, _imgp_info_s->src_height, - _imgp_info_s->output_format_label, _imgp_info_s->dst_width, _imgp_info_s->dst_height, _imgp_info_s->angle); + mm_util_debug("width: %d height: %d width: %d height: %d rotation_value: %d", _imgp_info_s->src_width, _imgp_info_s->src_height, _imgp_info_s->dst_width, _imgp_info_s->dst_height, _imgp_info_s->angle); return ret; } @@ -650,8 +527,6 @@ static void __mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s) if (module) g_module_close(module); - MMUTIL_SAFE_G_FREE(_imgp_info_s->input_format_label); - MMUTIL_SAFE_G_FREE(_imgp_info_s->output_format_label); MMUTIL_SAFE_FREE(_imgp_info_s); return; @@ -1404,7 +1279,7 @@ int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsig mm_util_debug("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->src_format) == FALSE) { mm_util_error("#RESIZE ERROR# IMAGE_NOT_SUPPORT_FORMAT"); ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT; goto ERROR; @@ -1499,7 +1374,7 @@ int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsig mm_util_debug("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->src_format) == FALSE) { mm_util_error("#gstreamer ROTATE ERROR# IMAGE_NOT_SUPPORT_FORMAT"); ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT; goto ERROR; diff --git a/packaging/libmm-utility.spec b/packaging/libmm-utility.spec index 3878f0d..c29832b 100755 --- a/packaging/libmm-utility.spec +++ b/packaging/libmm-utility.spec @@ -1,6 +1,6 @@ Name: libmm-utility Summary: Multimedia Framework Utility Library -Version: 0.1.11 +Version: 0.1.12 Release: 0 Group: System/Libraries License: Apache-2.0