#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;
}
}
-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;
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;
*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);
}
/* 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)) {
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));
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 */