{
size_t data_size = 0;
size_t y_size = 0, u_size = 0, v_size = 0;
+ size_t _width = (size_t)width;
heif_retvm_if_failed(width > 0, 0, "invalid width");
heif_retvm_if_failed(height > 0, 0, "invalid height");
switch (color_format) {
case HEIF_COLOR_FORMAT_RGB24:
- data_size = width * height * 3;
+ data_size = _width * height * 3;
break;
case HEIF_COLOR_FORMAT_ARGB:
case HEIF_COLOR_FORMAT_BGRA:
// fall through
case HEIF_COLOR_FORMAT_RGBA:
- data_size = width * height * 4;
+ data_size = _width * height * 4;
break;
case HEIF_COLOR_FORMAT_YUV420P:
- y_size = width * height;
- u_size = width / 2 * height / 2;
- v_size = width / 2 * height / 2;
+ y_size = _width * height;
+ u_size = _width / 2 * height / 2;
+ v_size = _width / 2 * height / 2;
heif_info("y_size: %zu, u_size: %zu, v_size: %zu", y_size, u_size, v_size);
data_size = y_size + u_size + v_size;
break;
static int __combine_rgb(heif_image_t *tile_image, unsigned int pos_x, unsigned int pos_y, heif_image_t *combine_image)
{
unsigned int bpp = 0; /* byte per pixel */
- unsigned int combine_stride = 0, tile_stride = 0;
+ size_t combine_stride = 0, tile_stride = 0;
unsigned int row = 0;
size_t copy_n = 0;
size_t total_copied_n = 0;
}
// combine_stride: row-bytes of combine_image
- combine_stride = combine_image->width * bpp;
+ combine_stride = (size_t)(combine_image->width) * bpp;
// tile_stride: row-bytes of tile
- tile_stride = tile_image->width * bpp;
+ tile_stride = (size_t)(tile_image->width) * bpp;
// copy_n: bytes to copy to combine_image
// Because the tile image was designed by the encoder limit of the device that was taken.
// The tile image doesn't make up the whole image(combine_image) properly.
static int __combine_yuv(heif_image_t *tile_image, unsigned int pos_x, unsigned int pos_y, heif_image_t *combine_image)
{
- unsigned int combine_stride = 0;
- unsigned int tile_stride = 0;
+ size_t combine_stride = 0, tile_stride = 0;
unsigned int row = 0;
size_t copy_n = 0;
size_t total_copied_n[3] = { 0, };