Remove memory allocation code. because mm_imgp is changed to do alloc memory 43/169543/1
authorhj kim <backto.kim@samsung.com>
Wed, 7 Feb 2018 09:01:30 +0000 (18:01 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 7 Feb 2018 09:01:30 +0000 (18:01 +0900)
Change-Id: Icd030f536ab7c842845ec8f26fe47c4c18dc52e5

imgp/mm_util_imgp.c
imgp/test/mm_util_imgp_testsuite.c

index 32745ee..a9c267c 100755 (executable)
@@ -34,7 +34,7 @@
 #define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
 #define GST "gstcs"
 
-typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char *, imgp_plugin_type_e);
+typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char **, imgp_plugin_type_e);
 static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *source_image);
 
 static int check_valid_picture_size(int width, int height)
@@ -636,7 +636,7 @@ static GModule *__mm_util_imgp_initialize(imgp_plugin_type_e _imgp_plugin_type_e
                module = g_module_open(PATH_GSTCS_LIB, G_MODULE_BIND_LAZY);
 
        if (module == NULL) {
-               mm_util_error("%s | %s module open failed", PATH_NEON_LIB, PATH_GSTCS_LIB);
+               mm_util_error("[%d] %s | %s module open failed", _imgp_plugin_type_e, PATH_NEON_LIB, PATH_GSTCS_LIB);
                return NULL;
        }
        mm_util_debug("module: %p, g_module_name: %s", module, g_module_name(module));
@@ -1354,7 +1354,6 @@ static IMGPInfoFunc __mm_util_initialize(imgp_type_e function, mm_util_img_forma
        mm_util_debug("plugin type: %d", _imgp_plugin_type_e);
 
        _module = __mm_util_imgp_initialize(_imgp_plugin_type_e);
-       mm_util_debug("__mm_util_imgp_initialize: %p", _module);
 
        if (_module == NULL) { /* when IMGP_NEON is NULL */
                _imgp_plugin_type_e = IMGP_GSTCS;
@@ -1430,15 +1429,7 @@ int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width,
                goto ERROR;
        }
 
-       output_buffer = (unsigned char *) calloc(1, output_buffer_size);
-       if (output_buffer == NULL) {
-               mm_util_error("memory allocation failed");
-               ret = MM_UTIL_ERROR_OUT_OF_MEMORY;
-               goto ERROR;
-       }
-       mm_util_debug("memory allocation outputbuffer: %p (%d)", output_buffer, output_buffer_size);
-
-       ret = _mm_util_imgp_func(_imgp_info_s, src, output_buffer, IMGP_CSC);
+       ret = _mm_util_imgp_func(_imgp_info_s, src, &output_buffer, IMGP_CSC);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("image processing failed");
                goto ERROR;
@@ -1525,16 +1516,7 @@ int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsig
                goto ERROR;
        }
 
-       output_buffer = (unsigned char *) calloc(1, output_buffer_size);
-       if (output_buffer == NULL) {
-               mm_util_error("memory allocation failed");
-               ret = MM_UTIL_ERROR_OUT_OF_MEMORY;
-               goto ERROR;
-       }
-
-       mm_util_debug("memory allocation outputbuffer: %p (%d)", output_buffer, output_buffer_size);
-
-       ret = _mm_util_imgp_func(_imgp_info_s, src, output_buffer, IMGP_RSZ);
+       ret = _mm_util_imgp_func(_imgp_info_s, src, &output_buffer, IMGP_RSZ);
        mm_util_debug("_mm_util_imgp_func, ret: %d", ret);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("image processing failed");
@@ -1629,16 +1611,7 @@ int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsig
                goto ERROR;
        }
 
-       output_buffer = (unsigned char *) calloc(1, output_buffer_size);
-       if (output_buffer == NULL) {
-               mm_util_error("memory allocation failed");
-               ret = MM_UTIL_ERROR_OUT_OF_MEMORY;
-               goto ERROR;
-       }
-
-       mm_util_debug("memory allocation outputbuffer: %p (%d)", output_buffer, output_buffer_size);
-
-       ret = _mm_util_imgp_func(_imgp_info_s, src, output_buffer, IMGP_ROT);
+       ret = _mm_util_imgp_func(_imgp_info_s, src, &output_buffer, IMGP_ROT);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("image processing failed");
                goto ERROR;
index 3b40c81..041fc35 100755 (executable)
@@ -171,7 +171,8 @@ int main(int argc, char *argv[])
                        dst_format == MM_UTIL_IMG_FMT_I420) {
                        strncpy(output_fmt, "yuv", strlen("yuv"));
                } else {
-                       strncpy(output_fmt, "rgb", strlen("rgb"));
+                       //strncpy(output_fmt, "rgb", strlen("rgb"));
+                       strncpy(output_fmt, "rgb", strlen("raw"));
                }
                snprintf(output_file, 40, "result_%s_%dx%d.%s", command, dst_width, dst_height, output_fmt);
        }