Change to resize image with mm_util_image_h 09/201409/4 accepted/tizen/unified/20190318.221224 submit/tizen/20190313.075153
authorjiyong.min <jiyong.min@samsung.com>
Wed, 13 Mar 2019 23:43:41 +0000 (08:43 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Thu, 14 Mar 2019 02:37:12 +0000 (11:37 +0900)
- Changed function
 : mm_util_resize_image()
- This function resize mm_util_image_h image with width & height,
  it will return allocated resized mm_util_image_h image.
  before changing, it has too few parameter to check problem
  like buffer overflow.
  So, change parameter to mm_util_image_h with mandotory information.

[Version] 0.10.180
[Profile] Common
[Issue Type] Update image-utility
[Dependency module] N/A
[Test] Svace=(OK, http://10.113.170.22:8810/build/2920)

Change-Id: I461f96a1051d9918b81e5ec76ed434df5739b0bb

packaging/libmm-camcorder.spec
src/mm_camcorder_util.c

index ea3e369..e1bce11 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.179
+Version:    0.10.180
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index bc34463..5fb7c21 100644 (file)
@@ -35,6 +35,7 @@
 #include "mm_camcorder_internal.h"
 #include "mm_camcorder_util.h"
 #include "mm_camcorder_sound.h"
+#include <mm_util_image.h>
 #include <mm_util_imgp.h>
 #include <mm_util_jpeg.h>
 
@@ -1733,6 +1734,8 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_wid
        int ret = TRUE;
        int mm_ret = MM_ERROR_NONE;
        int input_format = MM_UTIL_COLOR_YUV420;
+       mm_util_image_h src_image = NULL;
+       mm_util_image_h dst_image = NULL;
 
        if (!src_data || !dst_data || !dst_width || !dst_height || !dst_length) {
                _mmcam_dbg_err("something is NULL %p,%p,%p,%p,%p",
@@ -1767,14 +1770,26 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_wid
 
        _mmcam_dbg_log("src size %dx%d -> dst size %dx%d", src_width, src_height, *dst_width, *dst_height);
 
-       mm_ret = mm_util_resize_image(src_data, src_width, src_height, input_format,
-               *dst_width, *dst_height, dst_data, dst_width, dst_height, dst_length);
+       mm_ret = mm_image_create_image(src_width, src_height, input_format, src_data, (size_t)src_length, &src_image);
+       if (mm_ret != MM_ERROR_NONE) {
+               GST_ERROR("mm_image_create_image failed 0x%x", ret);
+               return FALSE;
+       }
 
+       mm_ret = mm_util_resize_image(src_image, *dst_width, *dst_height, &dst_image);
+       mm_image_destroy_image(src_image);
        if (mm_ret != MM_ERROR_NONE) {
                GST_ERROR("mm_util_resize_image failed 0x%x", ret);
                return FALSE;
        }
 
+       mm_ret = mm_image_get_image(dst_image, dst_width, dst_height, NULL, dst_data, dst_length);
+       mm_image_destroy_image(dst_image);
+       if (mm_ret != MM_ERROR_NONE) {
+               GST_ERROR("mm_image_get_image failed 0x%x", ret);
+               return FALSE;
+       }
+
        _mmcam_dbg_log("resize done %dx%d -> %dx%d, %p, length %zu",
                src_width, src_height, *dst_width, *dst_height, *dst_data, *dst_length);