static void __print_help(const char *argv0)
{
- g_print("\t[usage]\n");
- g_print("\t\t1. decode : %s mode path color_format(opt.)\n", argv0);
- g_print("\t\t2. mode : 0 - auto, 1 - decode from file, 2 - decode from memory\n");
- g_print("\t\t\t e.g. %s 0 test.heif\n", argv0);
- g_print("\t\t\t e.g. %s 1 test.heif 7\n", argv0);
+ fprintf(stderr, "\t[usage]\n");
+ fprintf(stderr, "\t\t1. decode : %s mode path color_format(opt.)\n", argv0);
+ fprintf(stderr, "\t\t2. mode : 0 - auto, 1 - decode from file, 2 - decode from memory\n");
+ fprintf(stderr, "\t\t\t e.g. %s 0 test.heif\n", argv0);
+ fprintf(stderr, "\t\t\t e.g. %s 1 test.heif 7\n", argv0);
}
static bool __get_arguments(int argc, char *argv[])
{
if (!mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
- g_print("\t[HEIF_testsuite] wrong mode(%s) for test\n", argv[1]);
+ fprintf(stderr, "\t[HEIF_testsuite] wrong mode(%s) for test\n", argv[1]);
__print_help(argv[0]);
return false;
}
// do nothing
} else if (g_test_mode == TEST_DECODE_FILE) {
if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
- g_print("\t[HEIF_testsuite] color is default(%d)\n", g_color);
+ fprintf(stderr, "\t[HEIF_testsuite] color is default(%d)\n", g_color);
} else if (g_test_mode == TEST_DECODE_BUFFER) {
if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
- g_print("\t[HEIF_testsuite] color is default(%d)\n", g_color);
+ fprintf(stderr, "\t[HEIF_testsuite] color is default(%d)\n", g_color);
} else {
- g_print("\t[HEIF_testsuite] wrong mode for test %s\n", argv[1]);
+ fprintf(stderr, "\t[HEIF_testsuite] wrong mode for test %s\n", argv[1]);
return false;
}
int ret = 0;
if (!path) {
- g_print("\t[HEIF_testsuite] No-Error\n");
+ fprintf(stderr, "\t[HEIF_testsuite] No-Error\n");
return true;
}
if (mode == TEST_DECODE_FILE) {
ret = mm_util_decode_heif_from_file(g_path, color, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[HEIF_testsuite] mm_util_decode_heif_from_file failed %d\n", ret);
+ fprintf(stderr, "\t[HEIF_testsuite] mm_util_decode_heif_from_file failed %d\n", ret);
return false;
}
} else if (mode == TEST_DECODE_BUFFER) {
ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[HEIF_testsuite] mm_util_file_read failed %d\n", ret);
+ fprintf(stderr, "\t[HEIF_testsuite] mm_util_file_read failed %d\n", ret);
return false;
}
ret = mm_util_decode_heif_from_buffer(g_read_data, g_read_size, color, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[HEIF_testsuite] mm_util_decode_heif_from_buffer failed %d\n", ret);
+ fprintf(stderr, "\t[HEIF_testsuite] mm_util_decode_heif_from_buffer failed %d\n", ret);
return false;
}
}
ret = mm_util_jpeg_encode_to_file(g_decoded_data, 100, path);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[HEIF_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, path);
+ fprintf(stderr, "\t[HEIF_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, path);
return false;
}
bool result = false;
while (test_mode <= TEST_DECODE_BUFFER) {
- g_print("\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
+ fprintf(stderr, "\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
/* test decoding heif */
if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_BUFFER)) {
for (color = MM_UTIL_COLOR_YUV420; color < MM_UTIL_COLOR_NUM; color++) {
}
}
- g_print("\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST %s\n",
+ fprintf(stderr, "\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST %s\n",
MODE_TO_STR[test_mode], (result) ? "SUCCESS" : "FAIL");
test_mode++;
}
}
if (!__get_arguments(argc, argv)) {
- g_print("\t[HEIF_testsuite] _get_arguments failed\n");
+ fprintf(stderr, "\t[HEIF_testsuite] _get_arguments failed\n");
goto out;
}
/* test all functions automatically */
if (g_test_mode == TEST_AUTO) {
if (!__test_auto())
- g_print("\t[HEIF_testsuite] _test_auto failed\n");
+ fprintf(stderr, "\t[HEIF_testsuite] _test_auto failed\n");
goto out;
}
/* test decoding heif */
if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_BUFFER)) {
if (!__test_decode(g_test_mode, g_color, g_test_filename[g_test_mode][g_color]))
- g_print("\t[HEIF_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
+ fprintf(stderr, "\t[HEIF_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
}
out:
static void __print_help(const char *argv0)
{
- g_print("\t[usage]\n");
- g_print("\t\t1. decode : %s mode path color_format(opt.) lossless(opt.)\n", argv0);
- g_print("\t\t2. mode : %d - auto, %d - decode from file, %d - decode from buffer, %d - encode to file, %d - encode to buffer\n",
+ fprintf(stderr, "\t[usage]\n");
+ fprintf(stderr, "\t\t1. decode : %s mode path color_format(opt.) lossless(opt.)\n", argv0);
+ fprintf(stderr, "\t\t2. mode : %d - auto, %d - decode from file, %d - decode from buffer, %d - encode to file, %d - encode to buffer\n",
TEST_AUTO, TEST_DECODE_FILE, TEST_DECODE_BUFFER, TEST_ENCODE_FILE, TEST_ENCODE_BUFFER);
- g_print("\t\t\t e.g. %s %d test.jxl\n", argv0, TEST_AUTO);
- g_print("\t\t\t e.g. %s %d test.jxl 7\n", argv0, TEST_DECODE_FILE);
- g_print("\t\t\t e.g. %s %d test.jxl 1920 1280 7\n", argv0, TEST_ENCODE_FILE);
+ fprintf(stderr, "\t\t\t e.g. %s %d test.jxl\n", argv0, TEST_AUTO);
+ fprintf(stderr, "\t\t\t e.g. %s %d test.jxl 7\n", argv0, TEST_DECODE_FILE);
+ fprintf(stderr, "\t\t\t e.g. %s %d test.jxl 1920 1280 7\n", argv0, TEST_ENCODE_FILE);
}
static bool __get_arguments(int argc, char *argv[])
unsigned int lossless = 0;
if (!mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
- g_print("\t[JXL_testsuite] wrong mode(%s) for test\n", argv[1]);
+ fprintf(stderr, "\t[JXL_testsuite] wrong mode(%s) for test\n", argv[1]);
__print_help(argv[0]);
return false;
}
if (g_test_mode == TEST_AUTO) {
// optional : lossless
if (!mm_util_safe_str_to_valid_uint(argv[3], 0, 1, &lossless))
- g_print("\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
+ fprintf(stderr, "\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
else
g_lossless = (lossless == 1) ? true : false;
} else if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_BUFFER)) {
if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
- g_print("\t[JXL_testsuite] color is default(%d)\n", g_color);
+ fprintf(stderr, "\t[JXL_testsuite] color is default(%d)\n", g_color);
} else if (g_test_mode == TEST_ENCODE_FILE || g_test_mode == TEST_ENCODE_BUFFER) {
if (argc < 5) {
- g_print("\t[JPEG_testsuite] not enough args\n");
+ fprintf(stderr, "\t[JPEG_testsuite] not enough args\n");
__print_help(argv[0]);
return false;
}
if (!mm_util_safe_str_to_uint(argv[3], &g_width)) {
- g_print("\t[JXL_testsuite] wrong width %s\n", argv[3]);
+ fprintf(stderr, "\t[JXL_testsuite] wrong width %s\n", argv[3]);
return false;
}
if (!mm_util_safe_str_to_uint(argv[4], &g_height)) {
- g_print("\t[JXL_testsuite] wrong height %s\n", argv[4]);
+ fprintf(stderr, "\t[JXL_testsuite] wrong height %s\n", argv[4]);
return false;
}
if (!mm_util_safe_str_to_valid_uint(argv[5], 0, MM_UTIL_COLOR_NUM - 1, &g_color)) {
- g_print("\t[JXL_testsuite] wrong color %s\n", argv[5]);
+ fprintf(stderr, "\t[JXL_testsuite] wrong color %s\n", argv[5]);
return false;
}
// optional : lossless
if (!mm_util_safe_str_to_valid_uint(argv[6], 0, 1, &lossless))
- g_print("\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
+ fprintf(stderr, "\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
else
g_lossless = (lossless == 1) ? true : false;
} else {
- g_print("\t[JXL_testsuite] wrong mode for test %s\n", argv[1]);
+ fprintf(stderr, "\t[JXL_testsuite] wrong mode for test %s\n", argv[1]);
return false;
}
ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
return false;
}
ret = mm_image_create_image(g_width, g_height, g_color,
(const unsigned char*)g_read_data, g_read_size, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_image_create_image failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_image_create_image failed : %d\n", ret);
return false;
}
if (!g_enc_opt) {
ret = mm_util_enc_opt_create(&g_enc_opt);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_enc_opt_create failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_enc_opt_create failed : %d\n", ret);
return;
}
ret = mm_util_enc_opt_set_codec(g_enc_opt, IMG_CODEC_JPEGXL);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_enc_opt_set_codec failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_enc_opt_set_codec failed : %d\n", ret);
return;
}
}
ret = mm_util_enc_opt_set_lossless(g_enc_opt, lossless);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_enc_opt_set_lossless failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_enc_opt_set_lossless failed : %d\n", ret);
return;
}
- g_print("\t[JXL_testsuite] __set_enc_opt lossless: %s\n", (lossless) ? "lossless" : "lossy");
+ fprintf(stderr, "\t[JXL_testsuite] __set_enc_opt lossless: %s\n", (lossless) ? "lossless" : "lossy");
}
static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e color)
if (mode == TEST_DECODE_FILE) {
ret = mm_util_decode_jxl_from_file(g_path, color, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_decode_jxl_from_file failed %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_decode_jxl_from_file failed %d\n", ret);
return false;
}
} else if (mode == TEST_DECODE_BUFFER) {
ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
return false;
}
ret = mm_util_decode_jxl_from_buffer(g_read_data, g_read_size, color, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_decode_jxl_from_buffer failed %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_decode_jxl_from_buffer failed %d\n", ret);
return false;
}
}
ret = mm_util_jpeg_encode_to_file(g_decoded_data, 100, g_test_filename[mode][color]);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, g_test_filename[mode][color]);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, g_test_filename[mode][color]);
return false;
}
if (mode == TEST_ENCODE_FILE) {
ret = mm_util_encode_jxl_to_file(g_decoded_data, g_enc_opt, g_test_filename[mode][color]);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_encode_jxl_to_file failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_encode_jxl_to_file failed : %d\n", ret);
return false;
}
} else if (mode == TEST_ENCODE_BUFFER) {
ret = mm_util_encode_jxl_to_buffer(g_decoded_data, g_enc_opt, &encoded_data, &encoded_size);
if (ret != MM_UTIL_ERROR_NONE) {
- g_print("\t[JXL_testsuite] mm_util_encode_jxl_to_buffer failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_encode_jxl_to_buffer failed : %d\n", ret);
g_free(encoded_data);
return false;
}
ret = mm_util_file_write(g_test_filename[mode][color], encoded_data, encoded_size);
if (ret != MM_UTIL_ERROR_NONE)
- g_print("\t[JXL_testsuite] mm_util_file_write failed : %d\n", ret);
+ fprintf(stderr, "\t[JXL_testsuite] mm_util_file_write failed : %d\n", ret);
g_free(encoded_data);
}
for (color = 0; color < MM_UTIL_COLOR_NUM; color++) {
if (g_test_filename[TEST_DECODE_FILE][color]) { // check supported
result = __test_decode(TEST_DECODE_FILE, color);
- g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+ fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
MODE_TO_STR[TEST_DECODE_FILE], color, (result) ? "SUCCESS" : "FAIL");
}
if (g_test_filename[TEST_ENCODE_FILE][color]) { // check supported
result = __test_encode(TEST_ENCODE_FILE, color);
- g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+ fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
MODE_TO_STR[TEST_ENCODE_FILE], color, (result) ? "SUCCESS" : "FAIL");
}
if (g_test_filename[TEST_DECODE_BUFFER][color]) { // check supported
result = __test_decode(TEST_DECODE_BUFFER, color);
- g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+ fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
MODE_TO_STR[TEST_DECODE_BUFFER], color, (result) ? "SUCCESS" : "FAIL");
}
if (g_test_filename[TEST_ENCODE_BUFFER][color]) { // check supported
result = __test_encode(TEST_ENCODE_BUFFER, color);
- g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+ fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
MODE_TO_STR[TEST_ENCODE_BUFFER], color, (result) ? "SUCCESS" : "FAIL");
}
}
}
if (!__get_arguments(argc, argv)) {
- g_print("\t[JXL_testsuite] _get_arguments failed\n");
+ fprintf(stderr, "\t[JXL_testsuite] _get_arguments failed\n");
goto out;
}
break;
case TEST_DECODE_FILE:
case TEST_DECODE_BUFFER:
- g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
+ fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
g_color, (__test_decode(g_test_mode, g_color)) ? "SUCCESS" : "FAIL");
break;
case TEST_ENCODE_FILE:
case TEST_ENCODE_BUFFER:
if (!__get_decoded_data()) {
- g_print("\t[JXL_testsuite] __get_decoded_data failed\n");
+ fprintf(stderr, "\t[JXL_testsuite] __get_decoded_data failed\n");
goto out;
}
__set_enc_opt(g_lossless);
- g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
+ fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
g_color, (__test_encode(g_test_mode, g_color)) ? "SUCCESS" : "FAIL");
break;
default:
case MM_UTIL_ROTATE_FLIP_VERT:
return "/opt/usr/home/owner/dst_V.jpg";
default:
- printf("Invalid rotation\n");
+ fprintf(stderr, "Invalid rotation\n");
return "/opt/usr/home/owner/dst_default.jpg";
}
case MM_UTIL_ROTATE_FLIP_VERT:
return "/opt/usr/home/owner/dst_V.raw";
default:
- printf("Invalid rotation\n");
+ fprintf(stderr, "Invalid rotation\n");
return "/opt/usr/home/owner/dst_default.raw";
}
ret = mm_image_get_image(handle, &width, &height, &format, &buffer, &size);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_image_get_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_get_image [%d]\n", ret);
return;
}
- 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);
+ fprintf(stderr, "[save to file] buffer[%p], width[%u], height[%u], size[%zu], format [%d], out_path [%s]\n", buffer, width, height, size, format, out_path);
ret = mm_util_file_write(out_path, buffer, size);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_file_write [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_file_write [%d]\n", ret);
g_free(buffer);
}
ret = mm_util_resize_P_B(src_path, 4000, 3000, req_format, &dst_handle);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail [%d]\n", ret);
+ fprintf(stderr, "Fail [%d]\n", ret);
return ret;
}
ret = mm_image_get_image(dst_handle, width, height, format, buffer, size);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_image_get_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_get_image [%d]\n", ret);
mm_image_destroy_image(dst_handle);
g_free(*buffer);
return ret;
}
- printf("[get_buffer] buffer[%p], width[%u], height[%u], size[%zu], format [%d]\n", *buffer, *width, *height, *size, *format);
+ fprintf(stderr, "[get_buffer] buffer[%p], width[%u], height[%u], size[%zu], format [%d]\n", *buffer, *width, *height, *size, *format);
mm_image_destroy_image(dst_handle);
int ret = MM_UTIL_ERROR_NONE;
const char * src_path = "/opt/usr/home/owner/origin.jpg";
- printf("* Rotate P P Test * rotation = [%d]* \n", rotation);
+ fprintf(stderr, "* Rotate P P Test * rotation = [%d]* \n", rotation);
ret = mm_util_rotate_P_P(src_path, rotation, __get_dst_path(rotation));
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_rotate_P_P [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_rotate_P_P [%d]\n", ret);
return ret;
}
snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_pp_%u_%u.jpg", req_width, req_height);
//snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_%d_%d.png", req_width, req_height);
- printf("* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
+ fprintf(stderr, "* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
ret = mm_util_resize_P_P(src_path, req_width, req_height, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_resize_P_P [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_resize_P_P [%d]\n", ret);
return ret;
}
mm_util_image_h dst_handle = NULL;
const char * src_path = "/opt/usr/home/owner/origin.jpg";
- printf("* Rotate P B Test * rotation = [%d] format = [%d] \n", rotation, req_format);
+ fprintf(stderr, "* 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) {
- printf("Fail mm_util_rotate_P_B [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_rotate_P_B [%d]\n", ret);
return ret;
}
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], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+ fprintf(stderr, "* 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) {
- printf("Fail mm_util_resize_P_B [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_resize_P_B [%d]\n", ret);
return ret;
}
size_t size = 0;
mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
- printf("* Rotate B P Test * rotation = [%d] \n", rotation);
+ fprintf(stderr, "* Rotate B P Test * rotation = [%d] \n", rotation);
ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __get_buffer_for_test [%d]\n", ret);
+ fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
return ret;
}
ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_image_create_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
g_free(buffer);
return ret;
}
ret = mm_util_rotate_B_P(src_handle, rotation, __get_dst_path(rotation));
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_rotate_B_P [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_rotate_B_P [%d]\n", ret);
mm_image_destroy_image(src_handle);
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], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+ fprintf(stderr, "* 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) {
- printf("Fail __get_buffer_for_test [%d]\n", ret);
+ fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
return ret;
}
ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_image_create_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
g_free(buffer);
return ret;
}
ret = mm_util_resize_B_P(src_handle, req_width, req_height, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_resize_B_P [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_resize_B_P [%d]\n", ret);
mm_image_destroy_image(src_handle);
size_t size = 0;
mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
- printf("* Rotate B B Test * rotation = [%d] \n", rotation);
+ fprintf(stderr, "* Rotate B B Test * rotation = [%d] \n", rotation);
ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __get_buffer_for_test [%d]\n", ret);
+ fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
return ret;
}
ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_image_create_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
g_free(buffer);
return ret;
}
ret = mm_util_rotate_B_B(src_handle, rotation, &dst_handle);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_rotate_B_B [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_rotate_B_B [%d]\n", ret);
g_free(buffer);
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], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+ fprintf(stderr, "* 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) {
- printf("Fail __get_buffer_for_test [%d]\n", ret);
+ fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
return ret;
}
ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_image_create_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
g_free(buffer);
return ret;
}
ret = mm_util_resize_B_B(src_handle, req_width, req_height, &dst_handle);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_resize_B_B [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_resize_B_B [%d]\n", ret);
g_free(buffer);
ret = __get_buffer_for_test(in_format, &buffer, &width, &height, &size, &format);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __get_buffer_for_test [%d]\n", ret);
+ fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
return ret;
}
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_format [%d], output_formt [%d] path [%s]\n", in_format, out_format, dst_path);
+ fprintf(stderr, "* 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) {
- printf("Fail mm_image_create_image [%d]\n", ret);
+ fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
g_free(buffer);
return ret;
}
ret = mm_util_convert_B_B(src_handle, out_format, &dst_handle);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_convert_B_B [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_convert_B_B [%d]\n", ret);
g_free(buffer);
memset(dst_path, 0x00, sizeof(dst_path));
snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/resize_rotate_pp_%u_%u.jpg", req_width, req_height);
- printf("* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
+ fprintf(stderr, "* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
ret = mm_util_resize_and_rotate_P_P(src_path, req_width, req_height, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_resize_P_P [%d]\n", ret);
+ fprintf(stderr, "Fail mm_util_resize_P_P [%d]\n", ret);
return ret;
}
ret = mm_util_decode_image_from_file(path, format, decoded_image);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_decode_image_from_file [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_decode_image_from_file [0x%x]\n", ret);
return ret;
}
ret = mm_util_file_read(path, &src_buffer, &src_buffer_size);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_util_file_read [%s: %d]\n", path, ret);
+ fprintf(stderr, "Fail mm_util_file_read [%s: %d]\n", path, ret);
return ret;
}
ret = mm_util_decode_image_from_buffer(src_buffer, src_buffer_size, format, decoded_image);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_decode_image_from_buffer [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_decode_image_from_buffer [0x%x]\n", ret);
g_free(src_buffer);
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);
+ fprintf(stderr, "Fail mm_util_enc_opt_create [0x%x]\n", ret);
return ret;
}
ret = mm_util_enc_opt_set_codec(enc_option, codec);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
goto ERROR;
}
if (codec == IMG_CODEC_PNG) {
ret = mm_util_enc_opt_set_png_compression(enc_option, compression);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_util_enc_opt_set_png_compression [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_enc_opt_set_png_compression [0x%x]\n", ret);
goto ERROR;
}
} else if (codec == IMG_CODEC_WEBP) {
ret = mm_util_enc_opt_set_lossless(enc_option, lossless);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail mm_util_enc_opt_set_lossless [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_enc_opt_set_lossless [0x%x]\n", ret);
goto ERROR;
}
}
ret = __magick_encode_setup(codec, compression, lossless, &enc_option);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __magick_encode_setup [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_encode_setup [0x%x]\n", ret);
return ret;
}
ret = mm_util_encode_image_to_file(decoded_image, enc_option, path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_encode_image_to_file [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_encode_image_to_file [0x%x]\n", ret);
mm_util_enc_opt_destroy(enc_option);
ret = __magick_encode_setup(codec, compression, lossless, &enc_option);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __magick_encode_setup [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_encode_setup [0x%x]\n", ret);
return ret;
}
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);
+ fprintf(stderr, "Fail mm_util_encode_image_to_buffer [0x%x]\n", ret);
goto END;
}
ret = mm_util_file_write(path, buffer, buffer_size);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail mm_util_file_write [0x%x]\n", ret);
+ fprintf(stderr, "Fail mm_util_file_write [0x%x]\n", ret);
END:
mm_util_enc_opt_destroy(enc_option);
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);
+ fprintf(stderr, "* PNG test [%s] \n", dst_path);
ret = __magick_decode_file_test(src_path, format, &decoded_image);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __magick_decode_file_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_decode_file_test [0x%x]\n", ret);
return ret;
}
ret = __magick_encode_file_test(decoded_image, IMG_CODEC_PNG, comp_level, false, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail __magick_encode_file_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_encode_file_test [0x%x]\n", ret);
mm_image_destroy_image(decoded_image);
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);
+ fprintf(stderr, "* PNG test [%s] \n", dst_path);
ret = __magick_decode_buffer_test(src_path, format, &decoded_image);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __magick_decode_buffer_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_decode_buffer_test [0x%x]\n", ret);
return ret;
}
ret = __magick_encode_buffer_test(decoded_image, IMG_CODEC_PNG, comp_level, false, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail __magick_encode_buffer_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_encode_buffer_test [0x%x]\n", ret);
mm_image_destroy_image(decoded_image);
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);
+ fprintf(stderr, "* WEBP test [%s] \n", dst_path);
ret = __magick_decode_file_test(src_path, format, &decoded_image);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __magick_decode_file_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_decode_file_test [0x%x]\n", ret);
return ret;
}
ret = __magick_encode_file_test(decoded_image, IMG_CODEC_WEBP, 0, lossless, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail __magick_encode_file_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_encode_file_test [0x%x]\n", ret);
mm_image_destroy_image(decoded_image);
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);
+ fprintf(stderr, "* WEBP test [%s] \n", dst_path);
ret = __magick_decode_buffer_test(src_path, format, &decoded_image);
if (ret != MM_UTIL_ERROR_NONE) {
- printf("Fail __magick_decode_buffer_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_decode_buffer_test [0x%x]\n", ret);
return ret;
}
ret = __magick_encode_buffer_test(decoded_image, IMG_CODEC_WEBP, 0, lossless, dst_path);
if (ret != MM_UTIL_ERROR_NONE)
- printf("Fail __magick_encode_buffer_test [0x%x]\n", ret);
+ fprintf(stderr, "Fail __magick_encode_buffer_test [0x%x]\n", ret);
mm_image_destroy_image(decoded_image);
if (argv[1] == NULL) {
- printf("Choose menu!! ex) mm_util_magick_testsuite 1\n");
+ fprintf(stderr, "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_decenc_buffer_webp_test(MM_UTIL_COLOR_RGBA, true);
} else {
- printf("Invalid parameter\n");
+ fprintf(stderr, "Invalid parameter\n");
}
return ret;