int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned int *width, unsigned int *height, size_t *size, mm_util_magick_format *format);
int mm_util_destroy_handle(mm_util_image_h handle);
-//src path and dst path must be the same format.
int mm_util_rotate_B_B(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, mm_util_image_h *dst_handle);
int mm_util_rotate_B_P(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, const char *dst_path);
int mm_util_rotate_P_B(const char *src_path, mm_util_magick_rotate_type angle, mm_util_magick_format req_format, mm_util_image_h *dst_handle);
int mm_util_resize_P_B(const char *src_path, unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format, mm_util_image_h *dst_handle);
int mm_util_resize_P_P(const char *src_path, unsigned int req_width, unsigned int req_height, const char *dst_path);
+int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_magick_format req_format, mm_util_image_h *dst_handle);
+
+
#endif /*__MM_UTILITY_MAGICK_H__*/
DestroyExceptionInfo(&exception);
+ mm_util_fleave();
+
return _image;
}
DestroyExceptionInfo(&exception);
+ mm_util_fleave();
+
return _processed_image;
}
DestroyExceptionInfo(&exception);
+ mm_util_fleave();
+
return _processed_image;
}
DestroyExceptionInfo(&exception);
+ mm_util_fleave();
+
return _image;
}
DestroyExceptionInfo(&exception);
+ mm_util_fleave();
+
return ret;
}
DestroyExceptionInfo(&exception);
+ mm_util_fleave();
+
return pixels;
}
MMUTIL_SAFE_FREE(map);
+ mm_util_fleave();
+
return ret;
}
MMUTIL_SAFE_FREE(map);
+ mm_util_fleave();
+
return ret;
}
MMUTIL_SAFE_FREE(map);
+ mm_util_fleave();
+
return ret;
}
__mm_util_finalize(_image, _processed_image, _image_info, &exception);
+ mm_util_fleave();
+
return ret;
}
MMUTIL_SAFE_FREE(map);
+ mm_util_fleave();
+
return ret;
}
MMUTIL_SAFE_FREE(map);
+ mm_util_fleave();
+
return ret;
}
MMUTIL_SAFE_FREE(map);
+ mm_util_fleave();
+
return ret;
}
__mm_util_finalize(_image, _processed_image, _image_info, &exception);
+ mm_util_fleave();
+
return ret;
}
+int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_magick_format req_format, mm_util_image_h *dst_handle)
+{
+ int ret = MM_UTIL_ERROR_NONE;
+ util_image_s *_src_handle = (util_image_s*)src_handle;
+ char *map = NULL;
+ Image *_image = NULL;
+ ExceptionInfo exception;
+ size_t pixels_size = 0;
+ void *pixels = 0;
+
+ mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
+ mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
+
+ mm_util_debug("input format [%d] req_format [%d]", _src_handle->format, req_format);
+
+ ret = __mm_util_get_map(_src_handle->format, &map);
+ mm_util_retvm_if((ret != MM_UTIL_ERROR_NONE) || (map == NULL), ret, "fail to get map");
+
+ __mm_util_init(&exception);
+
+ _image = __mm_util_constitute_image(src_handle, map);
+ if (_image == NULL) {
+ mm_util_error("Error: __mm_util_constitute_image failed.");
+ ret = MM_UTIL_ERROR_INVALID_OPERATION;
+ goto ERROR;
+ }
+
+ MMUTIL_SAFE_FREE(map);
+
+ ret = __mm_util_get_map(req_format, &map);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ mm_util_error("Error: __mm_util_get_map failed.");
+ goto ERROR;
+ }
+
+ pixels = __mm_util_write_image_to_buffer(_image, _image->columns, _image->rows, map, &pixels_size);
+ if (pixels == NULL) {
+ mm_util_error("Error: __mm_util_write_image_to_buffer failed.");
+ ret = MM_UTIL_ERROR_INVALID_OPERATION;
+ goto ERROR;
+ }
+
+ ret = mm_util_create_handle(dst_handle, pixels, _image->columns, _image->rows, pixels_size, _src_handle->format);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ mm_util_error("Error: __mm_util_write_image_to_buffer failed.");
+ MagickFree(pixels);
+ }
+
+ERROR:
+
+ __mm_util_finalize(_image, NULL, NULL, &exception);
+
+ MMUTIL_SAFE_FREE(map);
+
+ mm_util_fleave();
+
+ return ret;
+}
static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format);
static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format);
static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_magick_format req_format);
+static int _magick_convert_B_B_test(mm_util_magick_format in_format, mm_util_magick_format out_format);
static char *__get_dst_path(mm_util_magick_rotate_type angle)
{
return ret;
}
+static int _magick_convert_B_B_test(mm_util_magick_format in_format, mm_util_magick_format out_format)
+{
+ int ret = MM_UTIL_ERROR_NONE;
+ mm_util_image_h src_handle = NULL;
+ mm_util_image_h dst_handle = NULL;
+ unsigned char *buffer = NULL;
+ unsigned int width = 0;
+ unsigned int height = 0;
+ size_t size = 0;
+ mm_util_magick_format format = MM_UTIL_IMG_FMT_NUM;
+ char dst_path[1024] = {0, };
+ memset(dst_path, 0x00, sizeof(dst_path));
+
+ ret = __get_buffer_for_test(in_format, &buffer, &width, &height, &size, &format);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail __get_buffer_for_test [%d]\n", ret);
+ return ret;
+ }
+
+ snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/convert_bb_%d_%d_%d_%d.raw", width, height, in_format, out_format);
+ printf("* Convert B B Test * input_foramt [%d], output_formt [%d] path [%s]\n", in_format, out_format, dst_path);
+
+ ret = mm_util_create_handle(&src_handle, buffer, width, height, size, format);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_create_handle [%d]\n", ret);
+ MM_UTIL_SAFE_FREE(buffer);
+ return ret;
+ }
+
+ ret = mm_util_convert_B_B(src_handle, out_format, &dst_handle);
+ if (ret != MM_UTIL_ERROR_NONE)
+ printf("Fail mm_util_convert_B_B [%d]\n", ret);
+
+ MM_UTIL_SAFE_FREE(buffer);
+
+ __save_to_file(dst_handle, dst_path);
+
+ ret = mm_util_destroy_handle(src_handle);
+ if (ret != MM_UTIL_ERROR_NONE)
+ printf("Fail destroy src_handle [%d]\n", ret);
+
+ ret = mm_util_destroy_handle(dst_handle);
+ if (ret != MM_UTIL_ERROR_NONE)
+ printf("Fail destroy dst_handle [%d]\n", ret);
+
+ return ret;
+}
+
int main(int argc, char *argv[])
{
int ret = MM_UTIL_ERROR_NONE;
ret = _magick_resize_B_B_test(10000, 999, MM_UTIL_IMG_FMT_RGBA8888);
} else if (strcmp(argv[1], "9") == 0) {
+ ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_RGB888, MM_UTIL_IMG_FMT_RGBA8888);
+ ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_ARGB8888, MM_UTIL_IMG_FMT_RGBA8888);
+ ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_BGRA8888, MM_UTIL_IMG_FMT_RGBA8888);
+ ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_RGBA8888, MM_UTIL_IMG_FMT_RGB888);
+ ret = _magick_convert_B_B_test(MM_UTIL_IMG_FMT_BGRA8888, MM_UTIL_IMG_FMT_RGB888);
} else {
printf("Invalid parameter\n");
Name: libmm-utility
Summary: Multimedia Framework Utility Library
-Version: 0.1.5
+Version: 0.1.6
Release: 0
Group: System/Libraries
License: Apache-2.0