From: Haejeong Kim Date: Thu, 6 Jul 2017 05:41:08 +0000 (+0900) Subject: Bug fix of face detection. orientation info was wrong X-Git-Tag: submit/tizen/20170706.073239^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc3b0fca33f4fafb34fda072184ffb1adbcb9ca9;p=platform%2Fcore%2Fmultimedia%2Fdcm-service.git Bug fix of face detection. orientation info was wrong Change-Id: Idb951be5b5abd2a1fc864528908b1b0c1874e081 --- diff --git a/libdcm-util/dcm_image_codec.c b/libdcm-util/dcm_image_codec.c index abb4b8d..852e521 100755 --- a/libdcm-util/dcm_image_codec.c +++ b/libdcm-util/dcm_image_codec.c @@ -26,6 +26,18 @@ #define OPT_IMAGE_WIDTH 1280 #define OPT_IMAGE_HEIGHT 720 +typedef enum { + NOT_AVAILABLE = 0, + NORMAL = 1, + HFLIP = 2, + ROT_180 = 3, + VFLIP = 4, + TRANSPOSE = 5, + ROT_90 = 6, + TRANSVERSE = 7, + ROT_270 = 8 +} dcm_exif_orientation_e; + static void __dcm_get_optimized_wh(unsigned int src_width, unsigned int src_height, unsigned int *calc_width, unsigned int *calc_height) { *calc_width = 0; @@ -47,7 +59,7 @@ static void __dcm_get_optimized_wh(unsigned int src_width, unsigned int src_heig } } -static int __dcm_rotate_image(const unsigned char *source, const dcm_image_format_e format, const int orientation, unsigned char **image_buffer, unsigned long long *size, unsigned int *buff_width, unsigned int *buff_height) +static int __dcm_rotate_image(const unsigned char *source, const dcm_image_format_e format, dcm_exif_orientation_e orientation, unsigned char **image_buffer, unsigned long long *size, unsigned int *buff_width, unsigned int *buff_height) { int ret = IMAGE_UTIL_ERROR_NONE; image_util_colorspace_e colorspace = IMAGE_UTIL_COLORSPACE_RGBA8888; @@ -68,12 +80,16 @@ static int __dcm_rotate_image(const unsigned char *source, const dcm_image_forma return MS_MEDIA_ERR_UNSUPPORTED_CONTENT; /* Get rotate angle enum */ - if (orientation == DEGREE_180) + if (orientation == ROT_180) rotate = IMAGE_UTIL_ROTATION_180; - else if (orientation == DEGREE_90) + else if (orientation == ROT_90) rotate = IMAGE_UTIL_ROTATION_90; - else if (orientation == DEGREE_270) + else if (orientation ==ROT_270) rotate = IMAGE_UTIL_ROTATION_270; + else if (orientation ==HFLIP) + rotate = IMAGE_UTIL_ROTATION_FLIP_HORZ; + else if (orientation ==VFLIP) + rotate = IMAGE_UTIL_ROTATION_FLIP_VERT; else rotate = IMAGE_UTIL_ROTATION_NONE; @@ -110,8 +126,7 @@ static int __dcm_rotate_image(const unsigned char *source, const dcm_image_forma *size = rotated_buffer_size; /* Rotate input buffer */ - ret = image_util_rotate(rotated_buffer, &rotated_width, &rotated_height, rotate, source, - *buff_width, *buff_height, colorspace); + ret = image_util_rotate(rotated_buffer, &rotated_width, &rotated_height, rotate, source, *buff_width, *buff_height, colorspace); if (ret != IMAGE_UTIL_ERROR_NONE || rotated_buffer == NULL) { dcm_error("Failed to rotate image buffer! err: %d", ret); @@ -271,7 +286,7 @@ int dcm_decode_image(const char *file_path, const dcm_image_format_e format, } /* Rotate the resized buffer according to orientation */ - if (orientation == 0) { + if (orientation == NOT_AVAILABLE || orientation == NORMAL) { *image_buffer = resize_buffer; } else { if ((format == DCM_IMAGE_FORMAT_RGBA) || (format == DCM_IMAGE_FORMAT_RGB)) { diff --git a/libdcm-util/include/dcm_image_codec.h b/libdcm-util/include/dcm_image_codec.h index f262046..2ee9ba8 100755 --- a/libdcm-util/include/dcm_image_codec.h +++ b/libdcm-util/include/dcm_image_codec.h @@ -20,11 +20,6 @@ #include -#define DEGREE_0 0 -#define DEGREE_90 1 -#define DEGREE_180 2 -#define DEGREE_270 3 - #define MIME_TYPE_JPEG "image/jpeg" #define MIME_TYPE_PNG "image/png" #define MIME_TYPE_BMP "image/bmp" diff --git a/packaging/dcm-service.spec b/packaging/dcm-service.spec index 596aa1a..2ead8f5 100755 --- a/packaging/dcm-service.spec +++ b/packaging/dcm-service.spec @@ -1,6 +1,6 @@ Name: dcm-service Summary: A media DCM(Digital Contents Management) Service -Version: 0.1.3 +Version: 0.1.4 Release: 0 Group: Multimedia/Service License: Apache-2.0 diff --git a/src/dcm_svc_internal.c b/src/dcm_svc_internal.c index f6eecdc..faec2b8 100755 --- a/src/dcm_svc_internal.c +++ b/src/dcm_svc_internal.c @@ -297,7 +297,7 @@ int _dcm_scan_process(dcm_svc_item_s *scan_item) image_info.original_height = scan_item->image_height; image_info.orientation = scan_item->image_orientation; - dcm_debug("scan media w : [%d], h : [%d], orientation : [%d]", image_info.original_width, image_info.original_height, scan_item->image_orientation); + dcm_info("scan media w : [%d], h : [%d], orientation : [%d]", image_info.original_width, image_info.original_height, scan_item->image_orientation); if (image_info.original_width <= 0 && image_info.original_height <= 0) { ret = ImgGetImageInfo((const char *)(scan_item->file_path), &type, &(image_info.original_width), &(image_info.original_height)); @@ -327,7 +327,7 @@ int _dcm_scan_process(dcm_svc_item_s *scan_item) return ret; } - dcm_debug("Image info width: %d, height: %d, buf_width: %d, buf_height: %d", + dcm_info("Image info width: %d, height: %d, buf_width: %d, buf_height: %d", image_info.original_width, image_info.original_height, image_info.buffer_width, image_info.buffer_height); /* Process face scan */