} mm_util_jpeg_decode_downscale;
int mm_util_jpeg_encode_to_file(mm_util_image_h decoded, int quality, const char *file_path);
-int mm_util_jpeg_encode_to_memory(void **buffer, unsigned int *size, unsigned char *src, unsigned int width, unsigned int height, mm_util_color_format_e color, int quality);
int mm_util_encode_to_jpeg_memory(mm_util_image_h decoded, int quality, void **buffer, size_t *size);
int mm_util_decode_from_jpeg_file(const char *file_path, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_image_h *decoded);
int mm_util_decode_from_jpeg_memory(void *memory, const size_t src_size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_image_h *decoded);
return ret;
}
-int mm_util_jpeg_encode_to_memory(void **buffer, unsigned int *size, unsigned char *src, unsigned int width, unsigned int height, mm_util_color_format_e color, int quality)
-{
- int ret = MM_UTIL_ERROR_NONE;
- size_t encoded_size = 0;
- mm_util_image_h decoded = NULL;
-
- mm_util_retvm_if(!size, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid size");
-
- ret = mm_image_create_image(width, height, color, src, TEMP_DATA_SIZE, &decoded);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "mm_image_create_image fail (%d)", ret);
-
- ret = mm_util_encode_to_jpeg_memory(decoded, quality, buffer, &encoded_size);
- mm_image_destroy_image(decoded);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "mm_util_encode_to_jpeg_memory fail (%d)", ret);
-
- *size = (unsigned int)encoded_size;
-
- return ret;
-}
-
int mm_util_encode_to_jpeg_memory(mm_util_image_h decoded, int quality, void **buffer, size_t *size)
{
int ret = MM_UTIL_ERROR_NONE;