diff options
author | Jiyong Min <jiyong.min@samsung.com> | 2016-11-29 12:27:54 +0900 |
---|---|---|
committer | Jiyong Min <jiyong.min@samsung.com> | 2016-11-29 12:29:42 +0900 |
commit | 9b0dfa7b48861a552fd1bd8c8f0345aab5a4d33b (patch) | |
tree | 043791c4ee9413f71f1b335cecce71f3ad362755 | |
parent | c2eba3480029851c2a07b8a42c1796ee589d5cc4 (diff) | |
download | libmedia-thumbnail-accepted/tizen/3.0/mobile/20161130.011517.tar.gz libmedia-thumbnail-accepted/tizen/3.0/mobile/20161130.011517.tar.bz2 libmedia-thumbnail-accepted/tizen/3.0/mobile/20161130.011517.zip |
Remove unneccessary conditionsubmit/tizen_3.0/20161129.051721accepted/tizen/3.0/wearable/20161130.011721accepted/tizen/3.0/tv/20161130.011640accepted/tizen/3.0/mobile/20161130.011517accepted/tizen/3.0/ivi/20161130.011806accepted/tizen/3.0/common/20161130.064806
Change-Id: I0b9cae33a0d4c4200a35187dd49f7f1c370282af
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
-rwxr-xr-x | src/media-thumb-internal.c | 140 |
1 files changed, 67 insertions, 73 deletions
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 246c357..2790c2b 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -552,91 +552,85 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed, thumb_width = decoded.width; thumb_height = decoded.height; - if (is_rotated) { #if THUMB_PERFORMANCE_ENHANCED - int rot_type = MM_UTIL_ROTATE_0; - if (orientation == ROT_90) { - rot_type = MM_UTIL_ROTATE_90; - } else if (orientation == ROT_180) { - rot_type = MM_UTIL_ROTATE_180; - } else if (orientation == ROT_270) { - rot_type = MM_UTIL_ROTATE_270; - } - err = _media_thumb_rotate_thumb(decoded.data, decoded.size, &(decoded.width), &(decoded.height), rot_type, MM_UTIL_JPEG_FMT_RGB888); - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("_media_thumb_rotate_thumb falied: %d", err); - SAFE_FREE(thumb_info->data); - return err; - } - //thumb_dbg("Width : %d, Height : %d", decoded.width, decoded.height); - thumb_info->data = decoded.data; - thumb_info->size = decoded.size; - thumb_info->width = decoded.width; - thumb_info->height = decoded.height; + int rot_type = MM_UTIL_ROTATE_0; + if (orientation == ROT_90) { + rot_type = MM_UTIL_ROTATE_90; + } else if (orientation == ROT_180) { + rot_type = MM_UTIL_ROTATE_180; + } else if (orientation == ROT_270) { + rot_type = MM_UTIL_ROTATE_270; + } + err = _media_thumb_rotate_thumb(decoded.data, decoded.size, &(decoded.width), &(decoded.height), rot_type, MM_UTIL_JPEG_FMT_RGB888); + if (err != MS_MEDIA_ERR_NONE) { + thumb_err("_media_thumb_rotate_thumb falied: %d", err); + SAFE_FREE(thumb_info->data); + return err; + } + //thumb_dbg("Width : %d, Height : %d", decoded.width, decoded.height); + thumb_info->data = decoded.data; + thumb_info->size = decoded.size; + thumb_info->width = decoded.width; + thumb_info->height = decoded.height; #else - /* Start to decode to rotate */ - unsigned char *rotated = NULL; - unsigned int r_w = decoded.height; - unsigned int r_h = decoded.width; - unsigned int r_size = 0; - mm_util_img_rotate_type rot_type = MM_UTIL_ROTATE_0; - - int i, rotate_cnt = 0; + /* Start to decode to rotate */ + unsigned char *rotated = NULL; + unsigned int r_w = decoded.height; + unsigned int r_h = decoded.width; + unsigned int r_size = 0; + mm_util_img_rotate_type rot_type = MM_UTIL_ROTATE_0; + + int i, rotate_cnt = 0; + + rot_type = MM_UTIL_ROTATE_90; + if (orientation == ROT_90) { + rotate_cnt = 1; + } else if (orientation == ROT_180) { + rotate_cnt = 2; + } else if (orientation == ROT_270) { + rotate_cnt = 3; + } - rot_type = MM_UTIL_ROTATE_90; - if (orientation == ROT_90) { - rotate_cnt = 1; - } else if (orientation == ROT_180) { - rotate_cnt = 2; - } else if (orientation == ROT_270) { - rotate_cnt = 3; + for (i = 0; i < rotate_cnt; i++) { + if (i == 1) { + r_w = decoded.width; + r_h = decoded.height; } - for (i = 0; i < rotate_cnt; i++) { - if (i == 1) { - r_w = decoded.width; - r_h = decoded.height; - } - - err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, r_w, r_h, &r_size); - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("mm_util_get_image_size failed : %d", err); - SAFE_FREE(decoded.data); - return err; - } - - rotated = (unsigned char *)malloc(r_size); - err = mm_util_rotate_image(decoded.data, decoded.width, decoded.height, - MM_UTIL_IMG_FMT_RGB888, - rotated, &r_w, &r_h, - rot_type); + err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, r_w, r_h, &r_size); + if (err != MS_MEDIA_ERR_NONE) { + thumb_err("mm_util_get_image_size failed : %d", err); + SAFE_FREE(decoded.data); + return err; + } - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("mm_util_rotate_image failed : %d", err); - SAFE_FREE(decoded.data); - SAFE_FREE(rotated); - return err; - } else { - thumb_err("mm_util_rotate_image succeed"); - } + rotated = (unsigned char *)malloc(r_size); + err = mm_util_rotate_image(decoded.data, decoded.width, decoded.height, + MM_UTIL_IMG_FMT_RGB888, + rotated, &r_w, &r_h, + rot_type); + if (err != MS_MEDIA_ERR_NONE) { + thumb_err("mm_util_rotate_image failed : %d", err); SAFE_FREE(decoded.data); - decoded.data = rotated; - decoded.width = r_w; - decoded.height = r_h; + SAFE_FREE(rotated); + return err; + } else { + thumb_err("mm_util_rotate_image succeed"); } - //thumb_dbg("Width : %d, Height : %d", r_w, r_h); - thumb_info->data = rotated; - thumb_info->size = r_size; - thumb_info->width = r_w; - thumb_info->height = r_h; -#endif - } else { - thumb_warn("Unknown orientation"); SAFE_FREE(decoded.data); - return MS_MEDIA_ERR_INVALID_PARAMETER; + decoded.data = rotated; + decoded.width = r_w; + decoded.height = r_h; } + + //thumb_dbg("Width : %d, Height : %d", r_w, r_h); + thumb_info->data = rotated; + thumb_info->size = r_size; + thumb_info->width = r_w; + thumb_info->height = r_h; +#endif } else { /*in this case, just write raw data in file */ thumb_dbg_slog("Thumb is :%s", thumb_path); |