From 85e49f883e53ce3105efd34cac05cb73b8e319ae Mon Sep 17 00:00:00 2001 From: hj kim Date: Wed, 10 Oct 2018 18:30:00 +0900 Subject: [PATCH] Replace simple internal APIs Change-Id: I73b54e6dca5103aef6776a93e864dfb80976e975 --- src/image_util.c | 67 +++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 49 deletions(-) diff --git a/src/image_util.c b/src/image_util.c index 1c360c8..57ef991 100755 --- a/src/image_util.c +++ b/src/image_util.c @@ -158,30 +158,6 @@ static int __mm_util_create_color_image(mm_image_info_s **image, unsigned long w return ret; } -static int __mm_util_get_color_image(mm_image_info_s *image, unsigned long *width, unsigned long *height, mm_util_color_format_e *color, void **data, size_t *size) -{ - int ret = IMAGE_UTIL_ERROR_NONE; - - image_util_retvm_if((image == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle"); - - if (width != NULL) - *width = image->width; - - if (height != NULL) - *height = image->height; - - if (color != NULL) - *color = image->color; - - if (data != NULL) - *data = image->data; - - if (size != NULL) - *size = image->size; - - return ret; -} - static void __mm_destroy_temp_buffer(unsigned char *buffer[]) { int i = 0; @@ -296,26 +272,6 @@ static int __mm_util_processing(transformation_s *handle) return ret; } -static int __mm_util_transform_exec(transformation_s *handle, mm_image_info_s *source_image) -{ - int ret = IMAGE_UTIL_ERROR_NONE; - - image_util_retvm_if(handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "invalid handle"); - image_util_retvm_if(source_image == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "invalid source_image"); - - image_util_debug("orig_image: %p [%zu] %lu X %lu (%u)", source_image->data, source_image->size, source_image->width, source_image->height, source_image->color); - - handle->src = source_image; - handle->dst = NULL; - - ret = __mm_util_processing(handle); - image_util_retvm_if(ret != IMAGE_UTIL_ERROR_NONE, ret, "__mm_util_processing failed [%d]", ret); - - image_util_debug("result_image: %p [%zu] %lu X %lu (%u)", handle->dst->data, handle->dst->size, handle->dst->width, handle->dst->height, handle->dst->color); - - return ret; -} - static int __image_util_image_to_packet(mm_image_info_s *image, media_packet_h *packet) { int err = IMAGE_UTIL_ERROR_NONE; @@ -330,8 +286,13 @@ static int __image_util_image_to_packet(mm_image_info_s *image, media_packet_h * image_util_fenter(); - err = __mm_util_get_color_image(image, &width, &height, &format, &buffer, &buffer_size); - image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__mm_util_get_color_image failed (%d)", err); + image_util_retvm_if((image == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle"); + + width = image->width; + height = image->height; + format = image->color; + buffer = image->data; + buffer_size = image->size; err = __create_media_format(__image_format_to_mimetype(format), (unsigned int)width, (unsigned int)height, &fmt); image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__create_media_format failed (%d)", err); @@ -404,11 +365,19 @@ gpointer __mm_util_thread_repeate(gpointer data) continue; } - ret = __mm_util_transform_exec(handle, (mm_image_info_s *)pop_data); /* Need to block */ + handle->src = pop_data; + handle->dst = NULL; + + image_util_debug("orig_image: %p [%zu] %lu X %lu (%u)", pop_data->data, pop_data->size, pop_data->width, pop_data->height, pop_data->color); + + ret = __mm_util_processing(handle); + + image_util_debug("result_image: %p [%zu] %lu X %lu (%u)", handle->dst->data, handle->dst->size, handle->dst->width, handle->dst->height, handle->dst->color); + if (ret == IMAGE_UTIL_ERROR_NONE) - image_util_debug("Success - transform_exec"); + image_util_debug("Success - transform"); else - image_util_error("Error - transform_exec"); + image_util_error("Error - transform"); if ((handle->_util_cb != NULL) && (handle->_util_cb->completed_cb != NULL)) { image_util_debug("completed_cb is called"); -- 2.34.1