mm_util_retvm_if(!intermediate_image, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid intermediate_image");
mm_util_retvm_if(!intermediate_image_size, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid intermediate_image_size");
- num_of_pixels = gif_image->width * gif_image->height;
+ num_of_pixels = (unsigned long)(gif_image->width) * gif_image->height;
if ((gif_color_map = GifMakeMapObject(colormap_size, NULL)) == NULL) {
mm_util_error("failed to make color map");
return ret;
}
-static int __gif_image_create_ext_block(int function, int byte_count, ExtensionBlock **ext_block)
+static int __gif_image_create_ext_block(int function, unsigned int byte_count, ExtensionBlock **ext_block)
{
ExtensionBlock *_ext_block = NULL;
{
unsigned char x_chroma_shift = 0;
unsigned char y_chroma_shift = 0;
- unsigned int w2, h2, stride, stride2;
+ size_t w2, h2, stride, stride2;
size_t size, size2;
+ size_t _width = (size_t)width;
mm_util_fenter();
case MM_UTIL_COLOR_YUV420:
x_chroma_shift = 1;
y_chroma_shift = 1;
- stride = MM_UTIL_ROUND_UP_4(width);
+ 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);
+ 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;
case MM_UTIL_COLOR_UYVY:
case MM_UTIL_COLOR_NV16:
case MM_UTIL_COLOR_NV61:
- stride = MM_UTIL_ROUND_UP_4(width) * 2;
+ stride = MM_UTIL_ROUND_UP_4(_width) * 2;
size = stride * height;
*imgsize = size;
break;
case MM_UTIL_COLOR_RGB16:
- stride = 2 * (is_crop ? width : MM_UTIL_ROUND_UP_4(width));
+ stride = 2 * (is_crop ? _width : MM_UTIL_ROUND_UP_4(_width));
size = stride * height;
*imgsize = size;
break;
case MM_UTIL_COLOR_RGB24:
- stride = 3 * (is_crop ? width : MM_UTIL_ROUND_UP_4(width));
+ stride = 3 * (is_crop ? _width : MM_UTIL_ROUND_UP_4(_width));
size = stride * height;
*imgsize = size;
break;
case MM_UTIL_COLOR_BGRA:
case MM_UTIL_COLOR_RGBA:
case MM_UTIL_COLOR_BGRX:
- stride = width * 4;
+ stride = _width * 4;
size = stride * height;
*imgsize = size;
break;
case MM_UTIL_COLOR_NV21:
x_chroma_shift = 1;
y_chroma_shift = 1;
- stride = MM_UTIL_ROUND_UP_4(width);
+ 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);
+ 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;
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 idx = 0;
- int src_bytesperline = src_width * 4;
- int dst_bytesperline = crop_dest_width * 4;
+ unsigned long src_bytesperline = (unsigned long)src_width * 4;
+ unsigned long dst_bytesperline = (unsigned long)crop_dest_width * 4;
src += crop_start_y * src_bytesperline + 4 * crop_start_x;
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 idx = 0;
- unsigned long src_bytesperline = src_width * 3;
- unsigned long dst_bytesperline = crop_dest_width * 3;
+ unsigned long src_bytesperline = (unsigned long)src_width * 3;
+ unsigned long dst_bytesperline = (unsigned long)crop_dest_width * 3;
src += crop_start_y * src_bytesperline + 3 * crop_start_x;
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 idx = 0;
- unsigned long src_bytesperline = src_width * 2;
- unsigned long dst_bytesperline = crop_dest_width * 2;
+ unsigned long src_bytesperline = (unsigned long)src_width * 2;
+ unsigned long dst_bytesperline = (unsigned long)crop_dest_width * 2;
src += crop_start_y * src_bytesperline + 2 * crop_start_x;
*size = 0;
if (color_format == MM_UTIL_COLOR_RGB24 || color_format == MM_UTIL_COLOR_RGBA || color_format == MM_UTIL_COLOR_BGRA || color_format == MM_UTIL_COLOR_ARGB) {
- *size = dinfo->output_height * row_stride;
+ *size = (size_t)(dinfo->output_height) * row_stride;
} else if (color_format == MM_UTIL_COLOR_YUV420) {
- *size = dinfo->output_height * row_stride / 2;
+ *size = (size_t)(dinfo->output_height) * row_stride / 2;
} else if (color_format == MM_UTIL_COLOR_YUV422 || color_format == MM_UTIL_COLOR_UYVY) {
- *size = dinfo->output_height * dinfo->output_width * 2;
+ *size = (size_t)(dinfo->output_height) * dinfo->output_width * 2;
} else if (color_format == MM_UTIL_COLOR_GRAYSCALE) {
- *size = dinfo->output_height * dinfo->output_width;
+ *size = (size_t)(dinfo->output_height) * dinfo->output_width;
} else {
mm_util_error("[%d] We can't decode the IMAGE format", color_format);
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;