From: Jiyong Min Date: Mon, 19 Feb 2018 04:33:39 +0000 (+0900) Subject: Add to calculate the buffer size for NV21 colorsapce X-Git-Tag: submit/tizen/20180219.051103^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=752dd452fbc2ba84618c4e9099ded0457dc2877a;p=platform%2Fcore%2Fmultimedia%2Flibmm-utility.git Add to calculate the buffer size for NV21 colorsapce Change-Id: I25da32e7cf667b58bfb1d5e4018b154043a848c0 --- diff --git a/imgp/mm_util_imgp.c b/imgp/mm_util_imgp.c index 6cb650f..6eca295 100755 --- a/imgp/mm_util_imgp.c +++ b/imgp/mm_util_imgp.c @@ -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; }