summaryrefslogtreecommitdiff
path: root/src/media-thumb-internal.c
diff options
context:
space:
mode:
authorJiyong Min <jiyong.min@samsung.com>2016-11-29 03:27:54 (GMT)
committerJiyong Min <jiyong.min@samsung.com>2016-11-29 03:30:45 (GMT)
commit9a7f494e4a65d392bc75f9329175bcda0ffe3b72 (patch)
tree043791c4ee9413f71f1b335cecce71f3ad362755 /src/media-thumb-internal.c
parent038271980959429009937ce211fdff115fca946c (diff)
downloadlibmedia-thumbnail-9a7f494e4a65d392bc75f9329175bcda0ffe3b72.zip
libmedia-thumbnail-9a7f494e4a65d392bc75f9329175bcda0ffe3b72.tar.gz
libmedia-thumbnail-9a7f494e4a65d392bc75f9329175bcda0ffe3b72.tar.bz2
Change-Id: I0b9cae33a0d4c4200a35187dd49f7f1c370282af Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
Diffstat (limited to 'src/media-thumb-internal.c')
-rwxr-xr-xsrc/media-thumb-internal.c140
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);