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;
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;
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");
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;
}
}
- 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) {
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;
}
}
- 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");