From 1c7680eb414a27fd314cd1596e8bb01f9624ec68 Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Mon, 12 Mar 2018 19:31:42 +0900 Subject: [PATCH] Change the parameter order of internal functions (set input parameter before output parameter) Change-Id: I274aae2dba1d1461d324062b81ae061cc905176c --- jpeg/mm_util_jpeg.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/jpeg/mm_util_jpeg.c b/jpeg/mm_util_jpeg.c index b1681f9..93bae3d 100755 --- a/jpeg/mm_util_jpeg.c +++ b/jpeg/mm_util_jpeg.c @@ -57,7 +57,7 @@ typedef enum { MM_UTIL_JPEG_MEM, } mm_util_jpeg_cont_format_e; -static int __mm_image_encode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, FILE *fp, void **mem, size_t *csize, void *rawdata, int width, int height, mm_util_color_format_e color_format, int quality) +static int __mm_image_encode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, void *rawdata, int width, int height, mm_util_color_format_e color_format, int quality, FILE *fp, void **mem, size_t *csize) { int iErrorCode = MM_UTIL_ERROR_NONE; @@ -251,7 +251,7 @@ static int __mm_image_encode_with_libjpeg(mm_util_jpeg_cont_format_e control_for return iErrorCode; } -static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, mm_util_jpeg_yuv_data *decoded_data, FILE *fp, void *src, size_t size, mm_util_color_format_e color_format, mm_util_jpeg_decode_downscale downscale) +static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, FILE *fp, void *src, size_t size, mm_util_color_format_e color_format, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded_data) { int iErrorCode = MM_UTIL_ERROR_NONE; struct jpeg_decompress_struct dinfo; @@ -339,7 +339,7 @@ static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_for } decoded_data->format = color_format; - /* Start decompressor*/ + /* Start decompressor */ jpeg_start_decompress(&dinfo); mm_util_debug("jpeg_start_decompress"); @@ -461,7 +461,7 @@ int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, con unsigned char *dst = NULL; ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_COLOR_NV12, MM_UTIL_COLOR_YUV420, &dst, &res_w, &res_h, &res_buffer_size); - ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, fp, NULL, NULL, dst, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, quality); + ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, dst, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, quality, fp, NULL, NULL); MMUTIL_SAFE_FREE(dst); @@ -470,7 +470,7 @@ int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, con ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT; } else { - ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, fp, NULL, NULL, decoded->data, decoded->width, decoded->height, decoded->format, quality); + ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, decoded->data, decoded->width, decoded->height, decoded->format, quality, fp, NULL, NULL); } fsync((int)(fp->_fileno)); @@ -505,14 +505,14 @@ int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, v unsigned char *dst = NULL; ret = mm_util_convert_colorspace(decoded->data, decoded->width, decoded->height, MM_UTIL_COLOR_NV12, MM_UTIL_COLOR_YUV420, &dst, &res_w, &res_h, &res_buffer_size); - ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, NULL, mem, size, dst, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, quality); + ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, dst, decoded->width, decoded->height, MM_UTIL_COLOR_YUV420, quality, NULL, mem, size); MMUTIL_SAFE_FREE(dst); } else if (decoded->format == MM_UTIL_COLOR_NV21) { return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT; } else { - ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, NULL, mem, size, decoded->data, decoded->width, decoded->height, decoded->format, quality); + ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, decoded->data, decoded->width, decoded->height, decoded->format, quality, NULL, mem, size); } mm_util_debug("#END# libjpeg, Success!! ret: %d", ret); @@ -567,7 +567,7 @@ int mm_util_decode_from_jpeg_file_with_downscale(const char *filename, mm_util_c #else mm_util_debug("#START# libjpeg fmt [%d]", fmt); if (fmt == MM_UTIL_COLOR_NV12) { - ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_FILE, decoded, fp, NULL, 0, MM_UTIL_COLOR_YUV420, downscale); + ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_FILE, fp, NULL, 0, MM_UTIL_COLOR_YUV420, downscale, decoded); if (ret == MM_UTIL_ERROR_NONE) { unsigned int res_w = 0; unsigned int res_h = 0; @@ -582,7 +582,7 @@ int mm_util_decode_from_jpeg_file_with_downscale(const char *filename, mm_util_c decoded->size = res_buffer_size; } } else { - ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_FILE, decoded, fp, NULL, 0, fmt, downscale); + ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_FILE, fp, NULL, 0, fmt, downscale, decoded); } #endif mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size); @@ -626,7 +626,7 @@ int mm_util_decode_from_jpeg_memory_with_downscale(void *src, const size_t size, mm_util_debug("#START# libjpeg"); if (fmt == MM_UTIL_COLOR_NV12) { - ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_MEM, decoded, NULL, src, size, MM_UTIL_COLOR_YUV420, downscale); + ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_MEM, NULL, src, size, MM_UTIL_COLOR_YUV420, downscale, decoded); if (ret == MM_UTIL_ERROR_NONE) { unsigned int res_w = 0; unsigned int res_h = 0; @@ -641,7 +641,7 @@ int mm_util_decode_from_jpeg_memory_with_downscale(void *src, const size_t size, decoded->size = res_buffer_size; } } else { - ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_MEM, decoded, NULL, src, size, fmt, downscale); + ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_MEM, NULL, src, size, fmt, downscale, decoded); } mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size); mm_util_debug("#END# libjpeg, Success!! ret: %d", ret); -- 2.7.4