return iErrorCode;
}
-static int __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_data *decoded_data, void *src, int size, mm_util_jpeg_yuv_format input_fmt)
+static int __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(mm_util_jpeg_yuv_data *decoded_data, void *src, unsigned int size, mm_util_jpeg_yuv_format input_fmt)
{
int iErrorCode = MM_UTIL_ERROR_NONE;
tjhandle dhandle = NULL;
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
- mm_util_debug("srcBuf[0]: 0x%2x, srcBuf[1]: 0x%2x, jpegSize:%d", srcBuf[0], srcBuf[1], size);
+ mm_util_debug("srcBuf[0]: 0x%2x, srcBuf[1]: 0x%2x, jpegSize:%u", srcBuf[0], srcBuf[1], size);
__mm_decode_libjpeg_turbo_decompress(dhandle, src, size, TD_BU, decoded_data, input_fmt);
if (dhandle)
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
_mm_encode_libjpeg_turbo_compress(chandle, src, &dstBuf, &size, width, height, quality, TD_BU, fmt);
- mm_util_debug("dstBuf: %p\t size: %d", dstBuf, size);
+ mm_util_debug("dstBuf: %p\t size: %u", dstBuf, size);
fwrite(dstBuf, 1, size, fout);
fclose(fout);
if (chandle)
return iErrorCode;
}
-static int __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(void **mem, int *csize, void *rawdata, int w, int h, mm_util_jpeg_yuv_format fmt, int quality)
+static int __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(void **mem, unsigned int *csize, void *rawdata, int w, int h, mm_util_jpeg_yuv_format fmt, int quality)
{
int iErrorCode = MM_UTIL_ERROR_NONE;
tjhandle chandle = NULL;
*csize = TJBUFSIZE(w, h);
if (fmt == MM_UTIL_JPEG_FMT_RGB888) {
- mm_util_debug("MM_UTIL_JPEG_FMT_RGB888 size: %d", *csize);
+ mm_util_debug("MM_UTIL_JPEG_FMT_RGB888 size: %u", *csize);
} else if (fmt == MM_UTIL_JPEG_FMT_YUV420 || fmt == MM_UTIL_JPEG_FMT_YUV422) {
- mm_util_debug("TJSAMP_420 ||TJSAMP_422 size: %d", *csize);
+ mm_util_debug("TJSAMP_420 ||TJSAMP_422 size: %u", *csize);
} else {
mm_util_error("We can't support the IMAGE format");
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
- mm_util_debug("width: %d height: %d, size: %d", w, h, *csize);
+ mm_util_debug("width: %d height: %d, size: %u", w, h, *csize);
_mm_encode_libjpeg_turbo_compress(chandle, rawdata, (unsigned char **)mem, (unsigned long *)csize, w, h, quality, TD_BU, fmt);
- mm_util_debug("dstBuf: %p &dstBuf:%p size: %d", *mem, mem, *csize);
+ mm_util_debug("dstBuf: %p &dstBuf:%p size: %u", *mem, mem, *csize);
if (chandle)
tjDestroy(chandle);
return iErrorCode;
return iErrorCode;
}
-static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, int *csize, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+static int __mm_image_encode_to_jpeg_memory_with_libjpeg(void **mem, unsigned int *csize, void *rawdata, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
{
int iErrorCode = MM_UTIL_ERROR_NONE;
jpeg_finish_compress(&cinfo);
mm_util_debug("jpeg_finish_compress");
jpeg_destroy_compress(&cinfo);
- mm_util_debug("Exit jpeg_destroy_compress, mem: %p\t size:%d", *mem, *csize);
+ mm_util_debug("Exit jpeg_destroy_compress, mem: %p\t size:%u", *mem, *csize);
}
else if (fmt == MM_UTIL_JPEG_FMT_RGB888 || fmt == MM_UTIL_JPEG_FMT_GraySacle || fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
mm_util_error("We can't encode the IMAGE format");
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
- *csize = (int)size;
+ *csize = (unsigned int)size;
return iErrorCode;
}
return iErrorCode;
}
-static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *decoded_data, void *src, int size, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
+static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data *decoded_data, void *src, unsigned int size, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
{
int iErrorCode = MM_UTIL_ERROR_NONE;
struct jpeg_decompress_struct dinfo;
return ret;
}
-EXPORT_API int mm_util_jpeg_encode_to_memory(void **mem, int *size, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
+EXPORT_API int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int width, int height, mm_util_jpeg_yuv_format fmt, int quality)
{
int ret = MM_UTIL_ERROR_NONE;
#if LIBJPEG_TURBO
mm_util_debug("#START# LIBJPEG_TURBO");
ret = __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
#else
mm_util_debug("#START# libjpeg");
ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
}
- mm_util_debug("decoded->data: %p\t width: %d\t height:%d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height:%d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
#endif
} else if (magic[0] == 0x47 && magic[1] == 0x49) {
return ret;
}
-EXPORT_API int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt)
+EXPORT_API int mm_util_decode_from_jpeg_memory(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_jpeg_yuv_format fmt)
{
int ret = MM_UTIL_ERROR_NONE;
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
- if (size < 0) {
- mm_util_error("#ERROR# size");
- TTRACE_END();
- return MM_UTIL_ERROR_INVALID_PARAMETER;
- }
-
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
mm_util_error("#ERROR# fmt value");
TTRACE_END();
mm_util_debug("#START# libjpeg");
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %u\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
#else
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
}
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
#endif
#if LIBJPEG_TURBO
mm_util_debug("#START# LIBJPEG_TURBO");
ret = __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
#else
mm_util_debug("#START# libjpeg");
ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, downscale);
}
- mm_util_debug("decoded->data: %p\t width: %d\t height:%d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height:%d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
#endif
} else if (magic[0] == 0x47 && magic[1] == 0x49) {
return ret;
}
-EXPORT_API int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+EXPORT_API int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
{
int ret = MM_UTIL_ERROR_NONE;
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
- if (size < 0) {
- mm_util_error("#ERROR# size");
- TTRACE_END();
- return MM_UTIL_ERROR_INVALID_PARAMETER;
- }
-
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
mm_util_error("#ERROR# fmt value");
TTRACE_END();
mm_util_debug("#START# libjpeg");
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
#else
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, downscale);
}
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u\n", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
#endif