#define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
#define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
#define MM_UTIL_ROUND_UP_8(num) (((num)+7)&~7)
-#define MM_UTIL_ROUND_UP_16(num) (((num)+15)&~15)
#define MM_UTIL_ROUND_DOWN_2(num) ((num)&(~1))
#define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
#define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
} mm_util_img_rotate_type;
int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, size_t *imgsize);
-int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, mm_util_color_format_e dst_format, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned int dst_width, unsigned int dst_height, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, mm_util_img_rotate_type angle, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format,
- unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height,
- unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+ mm_util_color_format_e src_format, mm_util_color_format_e dst_format, unsigned char **dst,
+ unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+ mm_util_color_format_e src_format, unsigned int dst_width, unsigned int dst_height, unsigned char **dst,
+ unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+ mm_util_color_format_e src_format, mm_util_img_rotate_type angle, unsigned char **dst,
+ unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+ mm_util_color_format_e src_format, unsigned int crop_start_x, unsigned int crop_start_y,
+ unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char **dst,
+ unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
#ifdef __cplusplus
typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char **, imgp_plugin_type_e);
-static int check_valid_picture_size(int width, int height)
+static int __check_valid_picture_size(unsigned int width, unsigned int height)
{
- if ((int)width > 0 && (int)height > 0 &&
- ((width + 128) * (unsigned long long)(height + 128)) < INT_MAX/4)
+ if ((size_t)((width + 128) * (height + 128)) < (size_t)(INT_MAX/4))
return MM_UTIL_ERROR_NONE;
return MM_UTIL_ERROR_INVALID_PARAMETER;
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;
+ unsigned int w2, h2, stride, stride2;
+ size_t size, size2;
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");
+ 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;
{
int ret = MM_UTIL_ERROR_NONE;
unsigned int idx = 0;
- int src_bytesperline = src_width * 3;
- int dst_bytesperline = crop_dest_width * 3;
+ unsigned long src_bytesperline = src_width * 3;
+ unsigned long dst_bytesperline = crop_dest_width * 3;
src += crop_start_y * src_bytesperline + 3 * crop_start_x;
{
int ret = MM_UTIL_ERROR_NONE;
unsigned int idx = 0;
- int src_bytesperline = src_width * 2;
- int dst_bytesperline = crop_dest_width * 2;
+ unsigned long src_bytesperline = src_width * 2;
+ unsigned long dst_bytesperline = crop_dest_width * 2;
src += crop_start_y * src_bytesperline + 2 * crop_start_x;
{
int ret = MM_UTIL_ERROR_NONE;
unsigned int idx = 0;
- int start_x = crop_start_x;
- int start_y = crop_start_y;
+ unsigned int start_x = crop_start_x;
+ unsigned int start_y = crop_start_y;
const unsigned char *_src = src + start_y * src_width + start_x;
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;
+ unsigned int w2, h2, stride, stride2;
+ size_t size, size2;
mm_util_fenter();
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");
+ 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;
Name: libmm-utility
Summary: Multimedia Framework Utility Library
-Version: 0.1.30
+Version: 0.1.31
Release: 0
Group: System/Libraries
License: Apache-2.0