#define MM_UTIL_SAFE_FREE(src) { if (src) { free(src); src = NULL; } }
-static int _magick_rotate_P_P_test(mm_util_rotate_type_e rotation);
-static int _magick_rotate_P_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format);
-static int _magick_rotate_B_P_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format);
-static int _magick_rotate_B_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format);
-static int _magick_resize_P_P_test(unsigned int req_width, unsigned int req_height);
-static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
-static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
-static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
-static int _magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_color_format_e out_format);
-static int _magick_resize_and_rotate_P_P_test(unsigned int req_width, unsigned int req_height);
+static int __magick_rotate_P_P_test(mm_util_rotate_type_e rotation);
+static int __magick_rotate_P_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format);
+static int __magick_rotate_B_P_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format);
+static int __magick_rotate_B_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format);
+static int __magick_resize_P_P_test(unsigned int req_width, unsigned int req_height);
+static int __magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
+static int __magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
+static int __magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format);
+static int __magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_color_format_e out_format);
+static int __magick_resize_and_rotate_P_P_test(unsigned int req_width, unsigned int req_height);
static char *__get_dst_path(mm_util_rotate_type_e rotation)
{
return NULL;
}
-static void __write_to_file(const char *out_path, unsigned char *buffer, size_t buffer_size)
-{
- FILE *fp = NULL;
-
- fp = fopen(out_path, "w");
- if (fp != NULL) {
- fwrite(buffer, 1, buffer_size, fp);
- fclose(fp);
- }
-
- return;
-}
-
static void __save_to_file(mm_util_image_h handle, const char *out_path)
{
int ret = MM_UTIL_ERROR_NONE;
unsigned int height = 0;
size_t size = 0;
mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
+ GError *error = NULL;
ret = mm_image_get_image(handle, &width, &height, &format, &buffer, &size);
if (ret != MM_UTIL_ERROR_NONE) {
printf("[save to file] buffer[%p], width[%u], height[%u], size[%zu], format [%d], out_path [%s]\n", buffer, width, height, size, format, out_path);
- __write_to_file(out_path, buffer, size);
+ if (!g_file_set_contents(out_path, (gchar *)buffer, (gssize)size, &error))
+ printf("Fail g_file_set_contents [%s: %s]", out_path, (error ? error->message : "none"));
MM_UTIL_SAFE_FREE(buffer);
+ if (error)
+ g_error_free(error);
return;
}
return ret;
}
-static int _magick_rotate_P_P_test(mm_util_rotate_type_e rotation)
+static int __magick_rotate_P_P_test(mm_util_rotate_type_e rotation)
{
int ret = MM_UTIL_ERROR_NONE;
char * src_path = "/opt/usr/home/owner/origin.jpg";
return ret;
}
-static int _magick_resize_P_P_test(unsigned int req_width, unsigned int req_height)
+static int __magick_resize_P_P_test(unsigned int req_width, unsigned int req_height)
{
int ret = MM_UTIL_ERROR_NONE;
char * src_path = "/opt/usr/home/owner/origin.jpg";
return ret;
}
-static int _magick_rotate_P_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format)
+static int __magick_rotate_P_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h dst_handle = NULL;
char * src_path = "/opt/usr/home/owner/origin.jpg";
- printf("* Rotate P B Test * rotation = [%d] foramt = [%d] \n", rotation, req_format);
+ printf("* Rotate P B Test * rotation = [%d] format = [%d] \n", rotation, req_format);
ret = mm_util_rotate_P_B(src_path, rotation, req_format, &dst_handle);
if (ret != MM_UTIL_ERROR_NONE) {
return ret;
}
-static int _magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
+static int __magick_resize_P_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h dst_handle = NULL;
memset(dst_path, 0x00, sizeof(dst_path));
snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_pb_%u_%u.raw", req_width, req_height);
- printf("* Resize P B Test * W * H [%u * %u], foramt [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+ printf("* Resize P B Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
ret = mm_util_resize_P_B(src_path, req_width, req_height, req_format, &dst_handle);
if (ret != MM_UTIL_ERROR_NONE) {
return ret;
}
-static int _magick_rotate_B_P_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format)
+static int __magick_rotate_B_P_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h src_handle = NULL;
return ret;
}
-static int _magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
+static int __magick_resize_B_P_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h src_handle = NULL;
memset(dst_path, 0x00, sizeof(dst_path));
snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_bp_%u_%u.jpg", req_width, req_height);
- printf("* Resize B P Test * W * H [%u * %u], foramt [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+ printf("* Resize B P Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
if (ret != MM_UTIL_ERROR_NONE) {
return ret;
}
-static int _magick_rotate_B_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format)
+static int __magick_rotate_B_B_test(mm_util_rotate_type_e rotation, mm_util_color_format_e req_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h src_handle = NULL;
return ret;
}
-static int _magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
+static int __magick_resize_B_B_test(unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h src_handle = NULL;
memset(dst_path, 0x00, sizeof(dst_path));
snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_bb_%u_%u.raw", req_width, req_height);
- printf("* Resize B B Test * W * H [%u * %u], foramt [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+ printf("* Resize B B Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
if (ret != MM_UTIL_ERROR_NONE) {
return ret;
}
-static int _magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_color_format_e out_format)
+static int __magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_color_format_e out_format)
{
int ret = MM_UTIL_ERROR_NONE;
mm_util_image_h src_handle = NULL;
}
snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/convert_bb_%u_%u_%d_%d.raw", width, height, in_format, out_format);
- printf("* Convert B B Test * input_foramt [%d], output_formt [%d] path [%s]\n", in_format, out_format, dst_path);
+ printf("* Convert B B Test * input_format [%d], output_formt [%d] path [%s]\n", in_format, out_format, dst_path);
ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
if (ret != MM_UTIL_ERROR_NONE) {
return ret;
}
-static int _magick_resize_and_rotate_P_P_test(unsigned int req_width, unsigned int req_height)
+static int __magick_resize_and_rotate_P_P_test(unsigned int req_width, unsigned int req_height)
{
int ret = MM_UTIL_ERROR_NONE;
char * src_path = "/opt/usr/home/owner/origin.jpg";
return ret;
}
+static int __magick_decenc_file_png_test(mm_util_color_format_e format, unsigned int comp_level)
+{
+ int ret = MM_UTIL_ERROR_NONE;
+ char * src_path = "/opt/usr/home/owner/origin.png";
+ char dst_path[1024] = {0, };
+ mm_util_image_h decoded_image = NULL;
+ mm_util_enc_opt_h enc_option = NULL;
+
+ memset(dst_path, 0x00, sizeof(dst_path));
+ snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_file_png_test_%d_%u.png", format, comp_level);
+
+ printf("* PNG test [%s] \n", dst_path);
+
+ ret = mm_util_decode_image_from_file(src_path, format, &decoded_image);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_decode_image_from_file [0x%x]\n", ret);
+ return ret;
+ }
+
+ ret = mm_util_enc_opt_create(&enc_option);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_create [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_codec(enc_option, IMG_CODEC_PNG);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_png_compression(enc_option, comp_level);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_png_compression [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_encode_image_to_file(decoded_image, enc_option, dst_path);
+ if (ret != MM_UTIL_ERROR_NONE)
+ printf("Fail mm_util_encode_image_to_file [0x%x]\n", ret);
+
+END:
+ mm_util_enc_opt_destroy(enc_option);
+ mm_image_destroy_image(decoded_image);
+
+ return ret;
+}
+
+static int __magick_decenc_buffer_png_test(mm_util_color_format_e format, unsigned int comp_level)
+{
+ int ret = MM_UTIL_ERROR_NONE;
+ char * src_path = "/opt/usr/home/owner/origin.png";
+ char dst_path[1024] = {0, };
+ mm_util_image_h decoded_image = NULL;
+ mm_util_enc_opt_h enc_option = NULL;
+ gchar *src_buffer = NULL;
+ gsize src_buffer_size = 0;
+ void *buffer = NULL;
+ size_t buffer_size = 0;
+ GError *error = NULL;
+
+ memset(dst_path, 0x00, sizeof(dst_path));
+ snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_buffer_png_test_%d_%u.png", format, comp_level);
+
+ printf("* PNG test [%s] \n", dst_path);
+
+ if (!g_file_get_contents(src_path, &src_buffer, &src_buffer_size, &error)) {
+ printf("Fail g_file_get_contents [%s: %s]\n", src_path, (error ? error->message : "none"));
+ if (error)
+ g_error_free(error);
+ return ret;
+ }
+
+ ret = mm_util_decode_image_from_buffer((void *)src_buffer, (size_t)src_buffer_size, format, &decoded_image);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_decode_image_from_buffer [0x%x]\n", ret);
+ g_free(src_buffer);
+ return ret;
+ }
+
+ g_free(src_buffer);
+
+ ret = mm_util_enc_opt_create(&enc_option);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_create [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_codec(enc_option, IMG_CODEC_PNG);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_png_compression(enc_option, comp_level);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_png_compression [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_encode_image_to_buffer(decoded_image, enc_option, &buffer, &buffer_size);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_encode_image_to_buffer [0x%x]\n", ret);
+ goto END;
+ }
+
+ if (!g_file_set_contents(dst_path, (gchar *)buffer, (gssize)buffer_size, &error))
+ printf("Fail g_file_set_contents [%s: %s]", dst_path, (error ? error->message : "none"));
+
+END:
+ mm_util_enc_opt_destroy(enc_option);
+ mm_image_destroy_image(decoded_image);
+ g_free(buffer);
+ if (error)
+ g_error_free(error);
+
+ return ret;
+}
+
+static int __magick_decenc_file_webp_test(mm_util_color_format_e format, bool lossless)
+{
+ int ret = MM_UTIL_ERROR_NONE;
+ char * src_path = "/opt/usr/home/owner/origin.webp";
+ char dst_path[1024] = {0, };
+ mm_util_image_h decoded_image = NULL;
+ mm_util_enc_opt_h enc_option = NULL;
+
+ memset(dst_path, 0x00, sizeof(dst_path));
+ snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_file_webp_test_%d_%s.webp", format, (lossless ? "ll" : "nor"));
+
+ printf("* WEBP test [%s] \n", dst_path);
+
+ ret = mm_util_decode_image_from_file(src_path, format, &decoded_image);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_decode_image_from_file [0x%x]\n", ret);
+ return ret;
+ }
+
+ ret = mm_util_enc_opt_create(&enc_option);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_create [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_codec(enc_option, IMG_CODEC_WEBP);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_webp_lossless(enc_option, lossless);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_webp_lossless [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_encode_image_to_file(decoded_image, enc_option, dst_path);
+ if (ret != MM_UTIL_ERROR_NONE)
+ printf("Fail mm_util_encode_image_to_file [0x%x]\n", ret);
+
+END:
+ mm_util_enc_opt_destroy(enc_option);
+ mm_image_destroy_image(decoded_image);
+
+ return ret;
+}
+
+static int __magick_decenc_buffer_webp_test(mm_util_color_format_e format, bool lossless)
+{
+ int ret = MM_UTIL_ERROR_NONE;
+ char * src_path = "/opt/usr/home/owner/origin.webp";
+ char dst_path[1024] = {0, };
+ mm_util_image_h decoded_image = NULL;
+ mm_util_enc_opt_h enc_option = NULL;
+ gchar *src_buffer = NULL;
+ gsize src_buffer_size = 0;
+ void *buffer = NULL;
+ size_t buffer_size = 0;
+ GError *error = NULL;
+
+ memset(dst_path, 0x00, sizeof(dst_path));
+ snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_buffer_webp_test_%d_%s.webp", format, (lossless ? "ll" : "nor"));
+
+ printf("* WEBP test [%s] \n", dst_path);
+
+ if (!g_file_get_contents(src_path, &src_buffer, &src_buffer_size, &error)) {
+ printf("Fail g_file_get_contents [%s: %s]\n", src_path, (error ? error->message : "none"));
+ if (error)
+ g_error_free(error);
+ return ret;
+ }
+
+ ret = mm_util_decode_image_from_buffer((void *)src_buffer, (size_t)src_buffer_size, format, &decoded_image);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_decode_image_from_buffer [0x%x]\n", ret);
+ g_free(src_buffer);
+ return ret;
+ }
+
+ g_free(src_buffer);
+
+ ret = mm_util_enc_opt_create(&enc_option);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_create [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_codec(enc_option, IMG_CODEC_WEBP);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_enc_opt_set_webp_lossless(enc_option, lossless);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_enc_opt_set_webp_lossless [0x%x]\n", ret);
+ goto END;
+ }
+
+ ret = mm_util_encode_image_to_buffer(decoded_image, enc_option, &buffer, &buffer_size);
+ if (ret != MM_UTIL_ERROR_NONE) {
+ printf("Fail mm_util_encode_image_to_buffer [0x%x]\n", ret);
+ goto END;
+ }
+
+ if (!g_file_set_contents(dst_path, (gchar *)buffer, (gssize)buffer_size, &error))
+ printf("Fail g_file_set_contents [%s: %s]", dst_path, (error ? error->message : "none"));
+
+END:
+ mm_util_enc_opt_destroy(enc_option);
+ mm_image_destroy_image(decoded_image);
+ g_free(buffer);
+ if (error)
+ g_error_free(error);
+
+ return ret;
+}
+
int main(int argc, char *argv[])
{
int ret = MM_UTIL_ERROR_NONE;
printf("Choose menu!! ex) mm_util_magick_testsuite 1\n");
} else if (strcmp(argv[1], "1") == 0) {
- ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_0);
- ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_90);
- ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_180);
- ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_270);
- ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_FLIP_HORZ);
- ret = _magick_rotate_P_P_test(MM_UTIL_ROTATE_FLIP_VERT);
+ ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_0);
+ ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_90);
+ ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_180);
+ ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_270);
+ ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_FLIP_HORZ);
+ ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_FLIP_VERT);
} else if (strcmp(argv[1], "2") == 0) {
- ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
- ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
- ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
- ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
- ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
- ret = _magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
+ ret = __magick_rotate_P_B_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
+ ret = __magick_rotate_P_B_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
+ ret = __magick_rotate_P_B_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
+ ret = __magick_rotate_P_B_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
+ ret = __magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
+ ret = __magick_rotate_P_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
} else if (strcmp(argv[1], "3") == 0) {
- ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
- ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
- ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
- ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
- ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
- ret = _magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
+ ret = __magick_rotate_B_P_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
+ ret = __magick_rotate_B_P_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
+ ret = __magick_rotate_B_P_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
+ ret = __magick_rotate_B_P_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
+ ret = __magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
+ ret = __magick_rotate_B_P_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
} else if (strcmp(argv[1], "4") == 0) {
- ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
- ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
- ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
- ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
- ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
- ret = _magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
- ret = _magick_rotate_B_B_test(100, MM_UTIL_COLOR_RGBA); //invalid parameter
+ ret = __magick_rotate_B_B_test(MM_UTIL_ROTATE_0, MM_UTIL_COLOR_ARGB);
+ ret = __magick_rotate_B_B_test(MM_UTIL_ROTATE_90, MM_UTIL_COLOR_RGB24);
+ ret = __magick_rotate_B_B_test(MM_UTIL_ROTATE_180, MM_UTIL_COLOR_ARGB);
+ ret = __magick_rotate_B_B_test(MM_UTIL_ROTATE_270, MM_UTIL_COLOR_BGRA);
+ ret = __magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_HORZ, MM_UTIL_COLOR_RGBA);
+ ret = __magick_rotate_B_B_test(MM_UTIL_ROTATE_FLIP_VERT, MM_UTIL_COLOR_RGBA);
+ ret = __magick_rotate_B_B_test(100, MM_UTIL_COLOR_RGBA); //invalid parameter
} else if (strcmp(argv[1], "5") == 0) {
- ret = _magick_resize_P_P_test(3000, 2000);
- ret = _magick_resize_P_P_test(199, 299);
- ret = _magick_resize_P_P_test(3, 2);
- ret = _magick_resize_P_P_test(10000, 10000);
- ret = _magick_resize_P_P_test(0, 2000); //invalid parameter
+ ret = __magick_resize_P_P_test(3000, 2000);
+ ret = __magick_resize_P_P_test(199, 299);
+ ret = __magick_resize_P_P_test(3, 2);
+ ret = __magick_resize_P_P_test(10000, 10000);
+ ret = __magick_resize_P_P_test(0, 2000); //invalid parameter
} else if (strcmp(argv[1], "6") == 0) {
- ret = _magick_resize_P_B_test(3000, 2000, MM_UTIL_COLOR_RGB24);
- ret = _magick_resize_P_B_test(199, 299, MM_UTIL_COLOR_ARGB);
- ret = _magick_resize_P_B_test(3, 2, MM_UTIL_COLOR_BGRA);
- ret = _magick_resize_P_B_test(1000, 999, MM_UTIL_COLOR_RGBA);
- ret = _magick_resize_P_B_test(10000, 999, MM_UTIL_COLOR_RGBA);
+ ret = __magick_resize_P_B_test(3000, 2000, MM_UTIL_COLOR_RGB24);
+ ret = __magick_resize_P_B_test(199, 299, MM_UTIL_COLOR_ARGB);
+ ret = __magick_resize_P_B_test(3, 2, MM_UTIL_COLOR_BGRA);
+ ret = __magick_resize_P_B_test(1000, 999, MM_UTIL_COLOR_RGBA);
+ ret = __magick_resize_P_B_test(10000, 999, MM_UTIL_COLOR_RGBA);
} else if (strcmp(argv[1], "7") == 0) {
- ret = _magick_resize_B_P_test(3000, 2000, MM_UTIL_COLOR_RGB24);
- ret = _magick_resize_B_P_test(199, 299, MM_UTIL_COLOR_ARGB);
- ret = _magick_resize_B_P_test(3, 2, MM_UTIL_COLOR_BGRA);
- ret = _magick_resize_B_P_test(1000, 999, MM_UTIL_COLOR_RGBA);
- ret = _magick_resize_B_P_test(10000, 999, MM_UTIL_COLOR_RGBA);
+ ret = __magick_resize_B_P_test(3000, 2000, MM_UTIL_COLOR_RGB24);
+ ret = __magick_resize_B_P_test(199, 299, MM_UTIL_COLOR_ARGB);
+ ret = __magick_resize_B_P_test(3, 2, MM_UTIL_COLOR_BGRA);
+ ret = __magick_resize_B_P_test(1000, 999, MM_UTIL_COLOR_RGBA);
+ ret = __magick_resize_B_P_test(10000, 999, MM_UTIL_COLOR_RGBA);
} else if (strcmp(argv[1], "8") == 0) {
- ret = _magick_resize_B_B_test(3000, 2000, MM_UTIL_COLOR_RGB24);
- ret = _magick_resize_B_B_test(199, 299, MM_UTIL_COLOR_ARGB);
- ret = _magick_resize_B_B_test(3, 2, MM_UTIL_COLOR_BGRA);
- ret = _magick_resize_B_B_test(1000, 999, MM_UTIL_COLOR_RGBA);
- ret = _magick_resize_B_B_test(10000, 999, MM_UTIL_COLOR_RGBA);
+ ret = __magick_resize_B_B_test(3000, 2000, MM_UTIL_COLOR_RGB24);
+ ret = __magick_resize_B_B_test(199, 299, MM_UTIL_COLOR_ARGB);
+ ret = __magick_resize_B_B_test(3, 2, MM_UTIL_COLOR_BGRA);
+ ret = __magick_resize_B_B_test(1000, 999, MM_UTIL_COLOR_RGBA);
+ ret = __magick_resize_B_B_test(10000, 999, MM_UTIL_COLOR_RGBA);
} else if (strcmp(argv[1], "9") == 0) {
- ret = _magick_convert_B_B_test(MM_UTIL_COLOR_RGB24, MM_UTIL_COLOR_RGBA);
- ret = _magick_convert_B_B_test(MM_UTIL_COLOR_ARGB, MM_UTIL_COLOR_RGBA);
- ret = _magick_convert_B_B_test(MM_UTIL_COLOR_BGRA, MM_UTIL_COLOR_RGBA);
- ret = _magick_convert_B_B_test(MM_UTIL_COLOR_RGBA, MM_UTIL_COLOR_RGB24);
- ret = _magick_convert_B_B_test(MM_UTIL_COLOR_BGRA, MM_UTIL_COLOR_RGB24);
+ ret = __magick_convert_B_B_test(MM_UTIL_COLOR_RGB24, MM_UTIL_COLOR_RGBA);
+ ret = __magick_convert_B_B_test(MM_UTIL_COLOR_ARGB, MM_UTIL_COLOR_RGBA);
+ ret = __magick_convert_B_B_test(MM_UTIL_COLOR_BGRA, MM_UTIL_COLOR_RGBA);
+ ret = __magick_convert_B_B_test(MM_UTIL_COLOR_RGBA, MM_UTIL_COLOR_RGB24);
+ ret = __magick_convert_B_B_test(MM_UTIL_COLOR_BGRA, MM_UTIL_COLOR_RGB24);
} else if (strcmp(argv[1], "10") == 0) {
- ret = _magick_resize_and_rotate_P_P_test(3000, 2000);
- ret = _magick_resize_and_rotate_P_P_test(199, 299);
- ret = _magick_resize_and_rotate_P_P_test(3, 2);
- ret = _magick_resize_and_rotate_P_P_test(10000, 10000);
- ret = _magick_resize_and_rotate_P_P_test(0, 2000); //invalid parameter
+ ret = __magick_resize_and_rotate_P_P_test(3000, 2000);
+ ret = __magick_resize_and_rotate_P_P_test(199, 299);
+ ret = __magick_resize_and_rotate_P_P_test(3, 2);
+ ret = __magick_resize_and_rotate_P_P_test(10000, 10000);
+ ret = __magick_resize_and_rotate_P_P_test(0, 2000); //invalid parameter
+
+ } else if (strcmp(argv[1], "11") == 0) {
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_ARGB, 0);
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_BGRA, 0);
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_RGBA, 0);
+
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_ARGB, 6);
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_BGRA, 6);
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_RGBA, 6);
+
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_ARGB, 9);
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_BGRA, 9);
+ ret = __magick_decenc_file_png_test(MM_UTIL_COLOR_RGBA, 9);
+
+ } else if (strcmp(argv[1], "12") == 0) {
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_ARGB, 0);
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_BGRA, 0);
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_RGBA, 0);
+
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_ARGB, 6);
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_BGRA, 6);
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_RGBA, 6);
+
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_ARGB, 9);
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_BGRA, 9);
+ ret = __magick_decenc_buffer_png_test(MM_UTIL_COLOR_RGBA, 9);
+
+ } else if (strcmp(argv[1], "13") == 0) {
+ ret = __magick_decenc_file_webp_test(MM_UTIL_COLOR_ARGB, false);
+ ret = __magick_decenc_file_webp_test(MM_UTIL_COLOR_BGRA, false);
+ ret = __magick_decenc_file_webp_test(MM_UTIL_COLOR_RGBA, false);
+
+ ret = __magick_decenc_file_webp_test(MM_UTIL_COLOR_ARGB, true);
+ ret = __magick_decenc_file_webp_test(MM_UTIL_COLOR_BGRA, true);
+ ret = __magick_decenc_file_webp_test(MM_UTIL_COLOR_RGBA, true);
+
+ } else if (strcmp(argv[1], "14") == 0) {
+ ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_ARGB, false);
+ ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_BGRA, false);
+ ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_RGBA, false);
+
+ ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_ARGB, true);
+ ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_BGRA, true);
+ ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_RGBA, true);
} else {
printf("Invalid parameter\n");