g_free(frame_buffer);
}
-static int __gif_generate_frame_buffer(GifFileType *gif_image, GifRowType **screen_buf)
+static void __gif_generate_frame_buffer(GifFileType *gif_image, GifRowType **screen_buf)
{
int idx = 0;
size_t row_size = 0;
}
*screen_buf = _screen_buf;
-
- return MM_UTIL_ERROR_NONE;
}
static bool __gif_is_good_frame(GifFileType *gif_image)
return MM_UTIL_ERROR_NONE;
}
-static int __gif_convert_to_rgba(void **data, ColorMapObject *color_map, GifRowType *frame_buffer, unsigned int width, unsigned int height)
+static void __gif_convert_to_rgba(void **data, ColorMapObject *color_map, GifRowType *frame_buffer, unsigned int width, unsigned int height)
{
unsigned int i, j;
GifRowType gif_row;
*buffer++ = 255;
}
}
-
- return MM_UTIL_ERROR_NONE;
}
static int __read_gif(const char *file_path, void *memory, const size_t src_size, mm_util_image_h *decoded)
mm_util_retvm_if(GifFile->SWidth <= 0 || GifFile->SHeight <= 0, MM_UTIL_ERROR_INVALID_OPERATION, "Gif File wrong decode width & height");
- ret = __gif_generate_frame_buffer(GifFile, &frame_buffer);
- if (ret != MM_UTIL_ERROR_NONE) {
- mm_util_debug("__gif_generate_frame_buffer failed");
- goto error;
- }
+ __gif_generate_frame_buffer(GifFile, &frame_buffer);
/* Scan the content of the GIF file and load the image(s) in: */
do {
ret = __gif_fill_frame_buffer(GifFile, frame_buffer);
if (ret != MM_UTIL_ERROR_NONE) {
- mm_util_error("__gif_generate_frame_buffer failed");
+ mm_util_error("__gif_fill_frame_buffer failed");
goto error;
}
break;
}
/* decompress image with colormap(256) */
- ret = __gif_convert_to_rgba(&image_buffer, ColorMap, frame_buffer, GifFile->SWidth, GifFile->SHeight);
- if (ret != MM_UTIL_ERROR_NONE) {
- mm_util_error("could not convert gif to rgba");
- ret = MM_UTIL_ERROR_INVALID_OPERATION;
- goto error;
- }
+ __gif_convert_to_rgba(&image_buffer, ColorMap, frame_buffer, GifFile->SWidth, GifFile->SHeight);
ret = mm_image_create_image(GifFile->SWidth, GifFile->SHeight, MM_UTIL_COLOR_RGBA, image_buffer, GifFile->SWidth * GifFile->SHeight * 4, decoded);
g_free(image_buffer);
return MM_UTIL_ERROR_NONE;
}
-static int __jpeg_encode_yuv(j_compress_ptr cinfo, unsigned int width, unsigned int height, mm_image_info_s* decoded)
+static void __jpeg_encode_yuv(j_compress_ptr cinfo, unsigned int width, unsigned int height, mm_image_info_s* decoded)
{
JSAMPROW y[16], cb[16], cr[16]; /* y[2][5] = color sample of row 2 and pixel column 5; (one plane) */
JSAMPARRAY data[3] = { y, cb, cr }; /* t[0][2][5] = color sample 0 of row 2 and column 5 */
jpeg_write_raw_data(cinfo, data, 16);
g_free(large_rect);
g_free(small_rect);
-
- return MM_UTIL_ERROR_NONE;
} else {
for (j = 0; j < height; j += 16) {
for (i = 0; i < 16; i++) {
jpeg_write_raw_data(cinfo, data, 16);
}
}
-
- return MM_UTIL_ERROR_NONE;
}
static int __mm_util_jpeg_encode(mm_util_jpeg_ctrl_format_e control_format, mm_util_image_h decoded, int quality, FILE *fp, void **mem, size_t *csize)
jpeg_start_compress(&cinfo, true);
mm_util_debug("jpeg_start_compress");
- ret = __jpeg_encode_yuv(&cinfo, _width, _height, decoded);
- if (ret != MM_UTIL_ERROR_NONE)
- mm_util_error("__jpeg_encode_yuv failed");
+ __jpeg_encode_yuv(&cinfo, _width, _height, decoded);
} else if (_decoded->color == MM_UTIL_COLOR_RGB24 || _decoded->color == MM_UTIL_COLOR_GRAYSCALE || _decoded->color == MM_UTIL_COLOR_RGBA || _decoded->color == MM_UTIL_COLOR_BGRA || _decoded->color == MM_UTIL_COLOR_ARGB) {
unsigned int row_stride = 0;
JSAMPROW row_pointer[1];