- The order is input parameter before output parameter.
- The decoded data is composed with width, height, format, data and size.
- The source data of encoding is replaced to the decoded data.
Change-Id: Idf1de7e1515d5e5bc25e375031f81faaacdc07ba
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
/**
* This function extracts raw data from bmp file
*
+ * @param filename [in] input file name, encoded stream file
* @param decoded [out] pointer of mm_util_bmp_data.
* After using it, please free the allocated memory.
- * @param filename [in] input file name, encoded stream file
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_bmp_data
* @since R1, 1.0
*/
-int mm_util_decode_from_bmp_file(mm_util_bmp_data * decoded, const char *filename);
+int mm_util_decode_from_bmp_file(const char *filename, mm_util_bmp_data * decoded);
/**
* This function extracts raw data from bmp memory
*
+ * @param memory [in] input memory, encoded stream file
+ * @param src_size [in] input src size, encoded stream file
* @param decoded [out] pointer of mm_util_bmp_data.
* After using it, please free the allocated memory.
- * @param memory [in] input memory, encoded stream file
- * @param src_size [in] input src size, encoded stream file
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_bmp_data
* @since R1, 1.0
*/
-int mm_util_decode_from_bmp_memory(mm_util_bmp_data * decoded, void *memory, unsigned long long src_size);
+int mm_util_decode_from_bmp_memory(void *memory, unsigned long long src_size, mm_util_bmp_data * decoded);
/**
* This function encodes raw data to bmp file
*
- * @param encoded [in ] pointer of mm_util_bmp_data.
+ * @param decoded [in] pointer of mm_util_bmp_data.
* After using it, please free the allocated memory.
* @param filename [out] output file name on to which the encoded stream will be written.
* @return This function returns zero on success, or negative value with error code.
* @see mm_util_bmp_data
* @since R1, 1.0
*/
-int mm_util_encode_bmp_to_file(mm_util_bmp_data * encoded, const char *filename);
+int mm_util_encode_bmp_to_file(mm_util_bmp_data * decoded, const char *filename);
/**
* This function encodes raw data to buffer
*
- * @param encoded [in ] pointer of mm_util_bmp_data.
- * After using it, please free the allocated memory.
- * @param buffer [out] output buffer on to which the encoded stream will be written.
- * @param size [out] The size of output buffer on to which the encoded stream will be written.
+ * @param decoded [in] pointer of mm_util_bmp_data.
+ * After using it, please free the allocated memory.
+ * @param buffer [out] output buffer on to which the encoded stream will be written.
+ * @param size [out] The size of output buffer on to which the encoded stream will be written.
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_bmp_data
* @since R1, 1.0
*/
-int mm_util_encode_bmp_to_memory(mm_util_bmp_data *encoded, void **buffer, size_t *size);
+int mm_util_encode_bmp_to_memory(mm_util_bmp_data *decoded, void **buffer, size_t *size);
#ifdef __cplusplus
}
return res;
}
-int mm_util_decode_from_bmp_file(mm_util_bmp_data *decoded, const char *filename)
+int mm_util_decode_from_bmp_file(const char *filename, mm_util_bmp_data *decoded)
{
int ret;
return ret;
}
-int mm_util_decode_from_bmp_memory(mm_util_bmp_data *decoded, void *memory, unsigned long long src_size)
+int mm_util_decode_from_bmp_memory(void *memory, unsigned long long src_size, mm_util_bmp_data *decoded)
{
int ret;
return ret;
}
-int mm_util_encode_bmp_to_file(mm_util_bmp_data *encoded, const char *filename)
+int mm_util_encode_bmp_to_file(mm_util_bmp_data *decoded, const char *filename)
{
bmpfile_t *bmp;
rgb_pixel_t pixel = { 0, 0, 0, 0 };
uint16_t row, col;
uint8_t *image;
- if ((bmp = bmp_create(encoded->width, encoded->height, BYTES_PER_PIXEL * 8)) == NULL) {
+ if ((bmp = bmp_create(decoded->width, decoded->height, BYTES_PER_PIXEL * 8)) == NULL) {
mm_util_error("Invalid depth value.");
return MM_UTIL_ERROR_INVALID_OPERATION;
}
- image = (uint8_t *) encoded->data;
- for (row = 0; row != encoded->height; row++) {
- for (col = 0; col != encoded->width; col++) {
- size_t z = (row * encoded->width + col) * BYTES_PER_PIXEL;
+ image = (uint8_t *) decoded->data;
+ for (row = 0; row != decoded->height; row++) {
+ for (col = 0; col != decoded->width; col++) {
+ size_t z = (row * decoded->width + col) * BYTES_PER_PIXEL;
pixel.red = image[z];
pixel.green = image[z + 1];
pixel.blue = image[z + 2];
return MM_UTIL_ERROR_NONE;
}
-int mm_util_encode_bmp_to_memory(mm_util_bmp_data *encoded, void **buffer, size_t *size)
+int mm_util_encode_bmp_to_memory(mm_util_bmp_data *decoded, void **buffer, size_t *size)
{
bmpfile_t *bmp;
rgb_pixel_t pixel = { 0, 0, 0, 0 };
uint16_t row, col;
uint8_t *image;
- if ((bmp = bmp_create(encoded->width, encoded->height, BYTES_PER_PIXEL * 8)) == NULL) {
+ if ((bmp = bmp_create(decoded->width, decoded->height, BYTES_PER_PIXEL * 8)) == NULL) {
mm_util_error("Invalid depth value.");
return MM_UTIL_ERROR_INVALID_OPERATION;
}
- image = (uint8_t *) encoded->data;
- for (row = 0; row != encoded->height; row++) {
- for (col = 0; col != encoded->width; col++) {
- size_t z = (row * encoded->width + col) * BYTES_PER_PIXEL;
+ image = (uint8_t *) decoded->data;
+ for (row = 0; row != decoded->height; row++) {
+ for (col = 0; col != decoded->width; col++) {
+ size_t z = (row * decoded->width + col) * BYTES_PER_PIXEL;
pixel.red = image[z];
pixel.green = image[z + 1];
pixel.blue = image[z + 2];
/* test decoding bmp */
if (mode == TEST_DECODE_FILE) {
- ret = mm_util_decode_from_bmp_file(&g_decoded_data, g_path);
+ ret = mm_util_decode_from_bmp_file(g_path, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[BMP_testsuite] mm_util_decode_from_bmp_file failed %d\n", ret);
return FALSE;
return FALSE;
}
- ret = mm_util_decode_from_bmp_memory(&g_decoded_data, g_readed_data, (unsigned int)g_readed_size);
+ ret = mm_util_decode_from_bmp_memory(g_readed_data, (unsigned int)g_readed_size, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[BMP_testsuite] mm_util_decode_from_bmp_memory failed %d\n", ret);
return FALSE;
mm_util_jpeg_yuv_data decoded;
memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
- ret = mm_util_decode_from_jpeg_file_with_downscale(&decoded, filename, MM_UTIL_COLOR_RGB24, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
+ ret = mm_util_decode_from_jpeg_file_with_downscale(filename, MM_UTIL_COLOR_RGB24, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, &decoded);
if (!ret) {
img_buffer = decoded.data;
/**
* This function encodes rawfile to jpeg file.
*
+ * @param decoded [in] pointer of input stream pointer, that is, pointer of decoded data.
+ * @param quality [in] encoding quality, from 1 to 100
* @param filename [in] output file name
- * @param src [in] pointer of input stream pointer (raw data)
- * @param width [in] width of src data
- * @param height [in] height of src data
- * @param fmt [in] color format
- * @param quality [in] encoding quality, from 1 to 100
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_color_format_e
* @since R1, 1.0
*/
-int mm_util_jpeg_encode_to_file(const char *filename, void *src, int width, int height, mm_util_color_format_e fmt, int quality);
+int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, const char *filename);
/**
* This function encodes raw file to jpeg into memory.
*
- * @param mem [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
- * @param size [in] output stream size, that is, encoded stream size
- * @param src [in] pointer of input stream pointer (raw data)
- * @param width [in] width of src data
- * @param height [in] height of src data
- * @param fmt [in] color format
- * @param quality [in] encoding quality, from 1 to 100
+ * @param decoded [in] pointer of input stream pointer, that is, pointer of decoded data.
+ * @param quality [in] encoding quality, from 1 to 100
+ * @param mem [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
+ * @param size [out] output stream size, that is, encoded stream size
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_color_format_e
* @since R1, 1.0
*/
-int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void *src, int width, int height, mm_util_color_format_e fmt, int quality);
+int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, unsigned int *size);
/**
* This function extracts yuv data from jpeg file with downscale decode option
*
- * @param decoded [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
* @param filename [in] input file name, encoded stream file
- * @param fmt [in] color format
- * @param downscale [in] downscale value
+ * @param fmt [in] color format
+ * @param downscale [in] downscale value
+ * @param decoded [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_jpeg_yuv_data, mm_util_color_format_e
* @since R1, 1.0
*/
-int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale);
+int mm_util_decode_from_jpeg_file_with_downscale(const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded);
/**
* This function extracts yuv data from jpeg buffer with downscale decode option
*
- * @param decoded [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
- * @param src [in] input stream pointer(pointer of encoded jpeg stream data)
- * @param size [in] size of input stream(size of pointer of encoded jpeg stream data)
- * @param fmt [in] color format
- * @param downscale [in] downscale value
+ * @param src [in] input stream pointer(pointer of encoded jpeg stream data)
+ * @param size [in] size of input stream(size of pointer of encoded jpeg stream data)
+ * @param fmt [in] color format
+ * @param downscale [in] downscale value
+ * @param decoded [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer. After using it, please free the allocated memory.
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_jpeg_yuv_data, mm_util_color_format_e
* @since R1, 1.0
*/
-int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale);
+int mm_util_decode_from_jpeg_memory_with_downscale(void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded);
#ifdef __cplusplus
mm_util_retvm_if((control_format != MM_UTIL_JPEG_FILE) && (control_format != MM_UTIL_JPEG_MEM), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid control_format [%u]", control_format);
mm_util_retvm_if((control_format == MM_UTIL_JPEG_FILE) && (fp == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fp");
- mm_util_retvm_if((control_format == MM_UTIL_JPEG_MEM) && ((mem == NULL) || (csize == 0)), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src or csize");
+ mm_util_retvm_if((control_format == MM_UTIL_JPEG_MEM) && ((mem == NULL) || (csize == NULL)), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src or csize");
mm_util_retvm_if(rawdata == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid rawdata");
JSAMPROW y[16], cb[16], cr[16]; /* y[2][5] = color sample of row 2 and pixel column 5; (one plane) */
#endif
-int mm_util_jpeg_encode_to_file(const char *filename, void* src, int width, int height, mm_util_color_format_e fmt, int quality)
+int mm_util_jpeg_encode_to_file(mm_util_jpeg_yuv_data *decoded, int quality, const char *filename)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_fenter();
mm_util_retvm_if(filename == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid filename");
- mm_util_retvm_if(src == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
- mm_util_retvm_if((width <= 0) || (height <= 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width[%d] height[%d]", width, height);
- mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
+ mm_util_retvm_if(decoded == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
+ mm_util_retvm_if(decoded->data == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src data");
+ mm_util_retvm_if((decoded->width <= 0) || (decoded->height <= 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width[%d] height[%d]", decoded->width, decoded->height);
+ mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(decoded->format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", decoded->format);
mm_util_retvm_if((quality < 1) || (quality > 100), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid quality [%d]", quality);
#ifdef LIBJPEG_TURBO
mm_util_debug("#START# LIBJPEG_TURBO");
- ret = __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(filename, src, width, height, fmt, quality);
+ ret = __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(filename, decoded->data, decoded->width, decoded->height, decoded->format, quality);
#else
mm_util_debug("#START# LIBJPEG");
FILE *fp = NULL;
return ret;
}
- if (fmt == MM_UTIL_COLOR_NV12) {
+ if (decoded->format == MM_UTIL_COLOR_NV12) {
unsigned int res_w = 0;
unsigned int res_h = 0;
size_t res_buffer_size = 0;
unsigned char *dst = NULL;
- ret = mm_util_convert_colorspace(src, width, 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, width, height, MM_UTIL_COLOR_YUV420, quality);
+ 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);
MMUTIL_SAFE_FREE(dst);
- } else if (fmt == MM_UTIL_COLOR_NV21) {
+ } else if (decoded->format == MM_UTIL_COLOR_NV21) {
mm_util_error("Not supported format NV12");
ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
} else {
- ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, fp, NULL, NULL, src, width, height, fmt, quality);
+ ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_FILE, fp, NULL, NULL, decoded->data, decoded->width, decoded->height, decoded->format, quality);
}
fsync((int)(fp->_fileno));
mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
+ mm_util_fleave();
+
return ret;
}
-int mm_util_jpeg_encode_to_memory(void **mem, unsigned int *size, void* src, int width, int height, mm_util_color_format_e fmt, int quality)
+int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, unsigned int *size)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_retvm_if(mem == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid filename");
mm_util_retvm_if(size == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid size");
- mm_util_retvm_if(src == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
- mm_util_retvm_if((width <= 0) || (height <= 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width[%d] height[%d]", width, height);
- mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(fmt) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
+ mm_util_retvm_if(decoded == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src");
+ mm_util_retvm_if(decoded->data == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src data");
+ mm_util_retvm_if((decoded->width <= 0) || (decoded->height <= 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width[%d] height[%d]", decoded->width, decoded->height);
+ mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(decoded->format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", decoded->format);
mm_util_retvm_if((quality < 1) || (quality > 100), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid quality [%d]", quality);
#ifdef LIBJPEG_TURBO
mm_util_debug("#START# libjpeg-turbo");
- ret = __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(mem, size, src, width, height, fmt, quality);
+ ret = __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(mem, size, decoded->data, decoded->width, decoded->height, decoded->format, quality);
#else /* LIBJPEG_TURBO */
mm_util_debug("#START# libjpeg");
- if (fmt == MM_UTIL_COLOR_NV12) {
+ if (decoded->format == MM_UTIL_COLOR_NV12) {
unsigned int res_w = 0;
unsigned int res_h = 0;
size_t res_buffer_size = 0;
unsigned char *dst = NULL;
- ret = mm_util_convert_colorspace(src, width, 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, width, height, MM_UTIL_COLOR_YUV420, quality);
+ 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);
MMUTIL_SAFE_FREE(dst);
- } else if (fmt == MM_UTIL_COLOR_NV21) {
+ } 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, src, width, height, fmt, quality);
+ ret = __mm_image_encode_with_libjpeg(MM_UTIL_JPEG_MEM, NULL, mem, size, decoded->data, decoded->width, decoded->height, decoded->format, quality);
}
#endif /* LIBJPEG_TURBO */
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
+ mm_util_fleave();
+
return ret;
}
-int mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale)
+int mm_util_decode_from_jpeg_file_with_downscale(const char *filename, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded)
{
int ret = MM_UTIL_ERROR_NONE;
return ret;
}
-int mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data *decoded, void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale)
+int mm_util_decode_from_jpeg_memory_with_downscale(void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded)
{
int ret = MM_UTIL_ERROR_NONE;
/* test decoding jpeg */
if (mode == TEST_DECODE_FILE) {
- ret = mm_util_decode_from_jpeg_file_with_downscale(&g_decoded_data, g_path, g_color, g_downscale);
+ ret = mm_util_decode_from_jpeg_file_with_downscale(g_path, g_color, g_downscale, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[JPEG_testsuite] mm_util_decode_from_jpeg_file_with_downscale failed %d\n", ret);
return FALSE;
return FALSE;
}
- ret = mm_util_decode_from_jpeg_memory_with_downscale(&g_decoded_data, g_readed_data, (unsigned int)g_readed_size, g_color, g_downscale);
+ ret = mm_util_decode_from_jpeg_memory_with_downscale(g_readed_data, (unsigned int)g_readed_size, g_color, g_downscale, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[JPEG_testsuite] mm_util_decode_from_jpeg_memory_with_downscale failed %d\n", ret);
return FALSE;
/* test encoding jpeg */
if (mode == TEST_ENCODE_FILE) {
- ret = mm_util_jpeg_encode_to_file(ENCODE_FILE_PATH, g_decoded_data.data, g_decoded_data.width, g_decoded_data.height, g_decoded_data.format, g_quality);
+ ret = mm_util_jpeg_encode_to_file(&g_decoded_data, g_quality, ENCODE_FILE_PATH);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[JPEG_testsuite] mm_util_jpeg_encode_to_file failed : %d\n", ret);
return FALSE;
}
} else if (mode == TEST_ENCODE_MEMORY) {
- ret = mm_util_jpeg_encode_to_memory(&encoded_data, &encoded_size, g_decoded_data.data, g_decoded_data.width, g_decoded_data.height, g_decoded_data.format, g_quality);
+ ret = mm_util_jpeg_encode_to_memory(&g_decoded_data, g_quality, &encoded_data, &encoded_size);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[JPEG_testsuite] mm_util_jpeg_encode_to_file failed : %d\n", ret);
SAFE_FREE(encoded_data);
Name: libmm-utility
Summary: Multimedia Framework Utility Library
-Version: 0.1.17
+Version: 0.1.18
Release: 0
Group: System/Libraries
License: Apache-2.0
/**
* This function extracts raw data from png file
*
+ * @param fpath [in] input file name, encoded stream file
* @param decoded [out] pointer of mm_util_png_data.
* After using it, please free the allocated memory.
- * @param filename [in] input file name, encoded stream file
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_png_data, mm_util_init_decode_png
* @since R1, 1.0
*/
-int mm_util_decode_from_png_file(mm_util_png_data * decoded, const char *fpath);
+int mm_util_decode_from_png_file(const char *fpath, mm_util_png_data * decoded);
/**
* This function extracts raw data from png buffer
*
+ * @param memory [in] input stream pointer(pointer of encoded png stream data)
+ * @param src_size [in] size of input stream(size of pointer of encoded png stream data)
* @param decoded [out] pointer of mm_util_png_data.
* After using it, please free the allocated memory.
- * @param filename [in] input stream pointer(pointer of encoded png stream data)
- * @param memory [in] size of input stream(size of pointer of encoded png stream data)
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_png_data, mm_util_init_decode_png
* @since R1, 1.0
*/
-int mm_util_decode_from_png_memory(mm_util_png_data * decoded, void *memory, unsigned long long src_size);
+int mm_util_decode_from_png_memory(void *memory, unsigned long long src_size, mm_util_png_data * decoded);
/**
* This function extracts raw data to png file
return MM_UTIL_ERROR_NONE;
}
-int mm_util_decode_from_png_file(mm_util_png_data *decoded, const char *fpath)
+int mm_util_decode_from_png_file(const char *fpath, mm_util_png_data *decoded)
{
int ret = MM_UTIL_ERROR_NONE;
FILE *fp;
return ret;
}
-int mm_util_decode_from_png_memory(mm_util_png_data *decoded, void *memory, unsigned long long src_size)
+int mm_util_decode_from_png_memory(void *memory, unsigned long long src_size, mm_util_png_data *decoded)
{
int ret = MM_UTIL_ERROR_NONE;
/* test decoding png */
if (mode == TEST_DECODE_FILE) {
- ret = mm_util_decode_from_png_file(&g_decoded_data, g_path);
+ ret = mm_util_decode_from_png_file(g_path, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[PNG_testsuite] mm_util_decode_from_png_file failed %d\n", ret);
return FALSE;
return FALSE;
}
- ret = mm_util_decode_from_png_memory(&g_decoded_data, g_readed_data, (unsigned long long)g_readed_size);
+ ret = mm_util_decode_from_png_memory(g_readed_data, (unsigned long long)g_readed_size, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[PNG_testsuite] mm_util_decode_from_png_memory failed %d\n", ret);
return FALSE;