Remove useless buffer calcurate code 52/170352/1
authorhj kim <backto.kim@samsung.com>
Mon, 19 Feb 2018 09:31:52 +0000 (18:31 +0900)
committerhj kim <backto.kim@samsung.com>
Mon, 19 Feb 2018 09:31:52 +0000 (18:31 +0900)
Change-Id: Ic32cf33c9acad51cebeadee457e3fcec04cf499b

imgp/mm_util_imgp.c

index 6e964b2..fd269b9 100755 (executable)
@@ -306,91 +306,6 @@ static int __mm_util_get_crop_image_size(mm_util_color_format_e format, unsigned
        return ret;
 }
 
-int __mm_util_get_buffer_size(mm_util_color_format_e format, unsigned int width, unsigned int height, unsigned int *imgsize)
-{
-       int ret = MM_UTIL_ERROR_NONE;
-       unsigned char x_chroma_shift = 0;
-       unsigned char y_chroma_shift = 0;
-       int size, w2, h2, size2;
-       int stride, stride2;
-
-       mm_util_fenter();
-
-       mm_util_retvm_if(imgsize == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid imgsize");
-       mm_util_retvm_if(check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width and height");
-
-       *imgsize = 0;
-
-       switch (format) {
-       case MM_UTIL_COLOR_I420:
-       case MM_UTIL_COLOR_YUV420:
-               x_chroma_shift = 1;
-               y_chroma_shift = 1;
-               stride = MM_UTIL_ROUND_UP_4(width);
-               h2 = ROUND_UP_X(height, x_chroma_shift);
-               size = stride * h2;
-               w2 = DIV_ROUND_UP_X(width, x_chroma_shift);
-               stride2 = MM_UTIL_ROUND_UP_4(w2);
-               h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
-               size2 = stride2 * h2;
-               *imgsize = size + 2 * size2;
-               break;
-       case MM_UTIL_COLOR_YUV422:
-       case MM_UTIL_COLOR_YUYV:
-       case MM_UTIL_COLOR_UYVY:
-       case MM_UTIL_COLOR_NV16:
-       case MM_UTIL_COLOR_NV61:
-               stride = MM_UTIL_ROUND_UP_4(width) * 2;
-               size = stride * height;
-               *imgsize = size;
-               break;
-
-       case MM_UTIL_COLOR_RGB16:
-               stride = MM_UTIL_ROUND_UP_4(width) * 2;
-               size = stride * MM_UTIL_ROUND_UP_2(height);
-               *imgsize = size;
-               break;
-
-       case MM_UTIL_COLOR_RGB24:
-               stride = MM_UTIL_ROUND_UP_4(width) * 3;
-               size = stride * MM_UTIL_ROUND_UP_2(height);
-               *imgsize = size;
-               break;
-
-       case MM_UTIL_COLOR_ARGB:
-       case MM_UTIL_COLOR_BGRA:
-       case MM_UTIL_COLOR_RGBA:
-       case MM_UTIL_COLOR_BGRX:
-               stride = width * 4;
-               size = stride * MM_UTIL_ROUND_UP_2(height);
-               *imgsize = size;
-               break;
-
-
-       case MM_UTIL_COLOR_NV12:
-       case MM_UTIL_COLOR_NV12_TILED:
-               x_chroma_shift = 1;
-               y_chroma_shift = 1;
-               stride = MM_UTIL_ROUND_UP_4(width);
-               h2 = ROUND_UP_X(height, y_chroma_shift);
-               size = stride * h2;
-               w2 = 2 * DIV_ROUND_UP_X(width, x_chroma_shift);
-               stride2 = MM_UTIL_ROUND_UP_4(w2);
-               h2 = DIV_ROUND_UP_X(height, y_chroma_shift);
-               size2 = stride2 * h2;
-               *imgsize = size + size2;
-               break;
-
-       default:
-               mm_util_error("Not supported format");
-               return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
-       }
-
-       mm_util_debug("format: %d, *imgsize: %d", format, *imgsize);
-
-       return ret;
-}
-
 static int __mm_confirm_dst_width_height(unsigned int src_width, unsigned int src_height, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -1058,7 +973,6 @@ int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width,
        IMGPInfoFunc _mm_util_imgp_func = NULL;
        GModule *_module = NULL;
        unsigned char *output_buffer = NULL;
-       unsigned int output_buffer_size = 0;
        unsigned int res_w = 0;
        unsigned int res_h = 0;
        unsigned char *res_buffer = NULL;
@@ -1093,12 +1007,6 @@ int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width,
                goto ERROR;
        }
 
-       ret = __mm_util_get_buffer_size(dst_format, src_width, src_height, &output_buffer_size);
-       if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("__mm_util_get_buffer_size failed");
-               goto ERROR;
-       }
-
        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");
@@ -1139,7 +1047,6 @@ int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsig
        IMGPInfoFunc _mm_util_imgp_func = NULL;
        GModule *_module = NULL;
        unsigned char *output_buffer = NULL;
-       unsigned int output_buffer_size = 0;
        unsigned int res_w = 0;
        unsigned int res_h = 0;
        unsigned char *res_buffer = NULL;
@@ -1182,12 +1089,6 @@ int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsig
                }
        }
 
-       ret = __mm_util_get_buffer_size(src_format, *dst_width, *dst_height, &output_buffer_size);
-       if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("__mm_util_get_buffer_size failed");
-               goto ERROR;
-       }
-
        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) {
@@ -1233,7 +1134,6 @@ int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsig
        IMGPInfoFunc _mm_util_imgp_func = NULL;
        GModule *_module = NULL;
        unsigned char *output_buffer = NULL;
-       unsigned int output_buffer_size = 0;
        unsigned int res_w = 0;
        unsigned int res_h = 0;
        unsigned char *res_buffer = NULL;
@@ -1287,12 +1187,6 @@ int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsig
                }
        }
 
-       ret = __mm_util_get_buffer_size(src_format, *dst_width, *dst_height, &output_buffer_size);
-       if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("__mm_util_get_buffer_size failed");
-               goto ERROR;
-       }
-
        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");