Add to calculate the buffer size for NV21 colorsapce 12/170312/4 submit/tizen/20180219.051103
authorJiyong Min <jiyong.min@samsung.com>
Mon, 19 Feb 2018 04:33:39 +0000 (13:33 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Mon, 19 Feb 2018 04:52:24 +0000 (13:52 +0900)
Change-Id: I25da32e7cf667b58bfb1d5e4018b154043a848c0

imgp/mm_util_imgp.c

index 6cb650f68ebf9067b5a228852631da65a7bf15b4..6eca2959010e06fa1896e050002be8d99678dcae 100755 (executable)
@@ -1480,18 +1480,12 @@ int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, un
 
        mm_util_fenter();
 
-       if (!imgsize) {
-               mm_util_error("imgsize can't be null");
-               return MM_UTIL_ERROR_NO_SUCH_FILE;
-       }
+       mm_util_retvm_if((imgsize == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid imgsize");
+       mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid format [%d]", format);
+       mm_util_retvm_if((check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE), MM_UTIL_ERROR_INVALID_PARAMETER, "image width & height is too big");
 
        *imgsize = 0;
 
-       if (check_valid_picture_size(width, height) < 0) {
-               mm_util_error("invalid width and height");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
        switch (format) {
        case MM_UTIL_COLOR_I420:
        case MM_UTIL_COLOR_YUV420:
@@ -1540,6 +1534,7 @@ int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, un
 
        case MM_UTIL_COLOR_NV12:
        case MM_UTIL_COLOR_NV12_TILED:
+       case MM_UTIL_COLOR_NV21:
                x_chroma_shift = 1;
                y_chroma_shift = 1;
                stride = MM_UTIL_ROUND_UP_4(width);
@@ -1557,7 +1552,7 @@ int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, un
                return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
        }
 
-       mm_util_debug("format: %d, *imgsize: %d", format, *imgsize);
+       mm_util_debug("format: %u, *imgsize: %u", format, *imgsize);
 
        return ret;
 }