Enhance automated tests and code cleanup 18/319818/10 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20250228.005550 accepted/tizen/unified/x/20250228.033213
authorJiyong <jiyong.min@samsung.com>
Tue, 18 Feb 2025 07:49:35 +0000 (16:49 +0900)
committerJiyong <jiyong.min@samsung.com>
Mon, 24 Feb 2025 05:10:58 +0000 (14:10 +0900)
Change-Id: Iaa18b40807a25d93227b4ae43ff19c30229bfd61

packaging/capi-media-image-util.spec
test/image_util_testsuite.c

index f5d8770fb070dd9d8d8b00f07a9f30f0651efabc..8bc0ece14001717d166171ffa32ca7521f281090 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-image-util
 Summary:    A Image Utility library in Tizen Native API
-Version:    0.4.5
+Version:    0.4.6
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 843f8dc98f9144b060fc147e20febb7988a6db03..ca91562aabe97f60af6166b9502b345f86907126 100644 (file)
@@ -991,32 +991,35 @@ static const char *g_image_exts[] = {
        "gif",
        "bmp",
        "webp",
-       "",     // not supported HEIF
+       "jpg", // HEIF doesn't support encoding, so use jpg
        "jxl",
 };
 
-static void __get_auto_path(image_util_type_e image_type, char **path)
+static char *__get_auto_path(image_util_type_e image_type)
 {
-       char *_path = NULL;
-
-       if (!g_image_exts[image_type] || (strlen(g_image_exts[image_type]) == 0)) {
+       if (image_type >= G_N_ELEMENTS(g_image_exts)) {
                g_print("Not supported image_type[%d]!\n", image_type);
-               return;
+               return NULL;
        }
 
-       _path = g_strdup_printf("%s_%02d.%s", FILE_FOR_AUTO, g_num_of_file++, g_image_exts[image_type]);
+       return g_strdup_printf("%s_%02d.%s", FILE_FOR_AUTO, g_num_of_file++, g_image_exts[image_type]);
+}
 
-       g_free(*path);
-       *path = _path;
+static char *__get_auto_convert_path(image_util_type_e image_type, int src, int dst)
+{
+       if (image_type >= G_N_ELEMENTS(g_image_exts)) {
+               g_print("Not supported image_type[%d]!\n", image_type);
+               return NULL;
+       }
 
-       g_print("\t__get_auto_path: %s\n", *path);
+       return g_strdup_printf("%s_convert_%02d(%d_to_%d).%s", FILE_FOR_AUTO, g_num_of_file++, src, dst, g_image_exts[image_type]);
 }
 
 static void __get_encode_path(image_util_type_e image_type, const char *base, char **path)
 {
        char *_path = NULL;
 
-       if (!g_image_exts[image_type] || (strlen(g_image_exts[image_type]) == 0)) {
+       if (image_type >= G_N_ELEMENTS(g_image_exts)) {
                g_print("Not supported image_type[%d]!\n", image_type);
                return;
        }
@@ -1037,7 +1040,7 @@ static void __get_encode_anim_path(image_util_anim_type_e anim_type, const char
 {
        char *_path = NULL;
 
-       if (!g_anim_image_exts[anim_type] || (strlen(g_anim_image_exts[anim_type]) == 0)) {
+       if (anim_type >= G_N_ELEMENTS(g_anim_image_exts)) {
                g_print("Not supported anim_type[%d]!\n", anim_type);
                return;
        }
@@ -1093,6 +1096,7 @@ static void __encode_to_buffer_completed_cb(image_util_error_e error_code, unsig
        }
 
        result->buffer = g_memdup2(buffer, buffer_size);
+       result->buffer_size = buffer_size;
 
        __signal();
 }
@@ -1234,10 +1238,7 @@ static int __run_encode(test_encode_menu_e menu, test_complex_data_s *input,
                return ret;
        }
 
-       if (result->buffer) {
-               SAFE_FREE(result->buffer);
-               result->image = NULL;
-       }
+       SAFE_FREE(result->buffer);
 
        ret = image_util_encode_create(params->type, &handle);
        if (ret != IMAGE_UTIL_ERROR_NONE) {
@@ -1569,118 +1570,441 @@ ERROR:
        return ret;
 }
 
-static int __run_auto(void)
+static void __clear_test_complex_data(test_complex_data_s *tc_data)
 {
-       int ret = IMAGE_UTIL_ERROR_NONE;
-       image_util_type_e image_type = IMAGE_UTIL_JPEG;
-       static test_complex_data_s encode_temp_result;
+       if (!tc_data)
+               return;
 
-       g_num_of_file = 0;
+       if (tc_data->buffer) {
+               g_free(tc_data->buffer);
+               tc_data->buffer = NULL;
+       }
+       if (tc_data->image) {
+               image_util_destroy_image(tc_data->image);
+               tc_data->image = NULL;
+       }
+}
 
-       g_decode_params.color = IMAGE_UTIL_COLORSPACE_RGBA8888;
-       g_decode_params.downscale = IMAGE_UTIL_DOWNSCALE_1_1;
+static int __run_decode_encode_test(void)
+{
+       int ret = IMAGE_UTIL_ERROR_NONE;
+       test_complex_data_s tmp_encode_result;
 
-       ret = __run_decode(DECODE_RUN2, &g_input_data, &g_decode_params, &g_decode_result);
-       if (ret == IMAGE_UTIL_ERROR_NONE)
-               g_print("Success DECODE_RUN2!!!\n");
+       memset(&tmp_encode_result, 0, sizeof(test_complex_data_s));
+
+       if (!g_encode_result.buffer && !g_encode_result.image)
+               ret = __run_decode(DECODE_RUN2, &g_input_data, &g_decode_params, &g_decode_result);
        else
+               ret = __run_decode(DECODE_RUN2, &g_encode_result, &g_decode_params, &g_decode_result);
+       if (ret != IMAGE_UTIL_ERROR_NONE) {
                g_print("Fail DECODE_RUN2!!!\n");
+               goto END;
+       }
+       g_print("Success DECODE_RUN2!!!\n");
 
-       g_encode_params.type = IMAGE_UTIL_JPEG;
-       g_encode_params.quality = 100;
-       __get_auto_path(g_encode_params.type, &g_encode_result.path);
+       tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+       ret = __run_encode(ENCODE_RUN_TO_FILE, &g_decode_result, &g_encode_params, &tmp_encode_result);
+       g_free(tmp_encode_result.path);
+       if (ret != IMAGE_UTIL_ERROR_NONE) {
+               g_print("Fail ENCODE_RUN_TO_FILE!!!\n");
+               goto END;
+       }
+       g_print("Success ENCODE_RUN_TO_FILE!!!\n");
 
-       g_transform_params.crop_area.x = 0;
-       g_transform_params.crop_area.y = 0;
-       g_transform_params.crop_area.w = 640;
-       g_transform_params.crop_area.h = 480;
+       tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+       ret = __run_encode(ENCODE_RUN_TO_BUFFER, &g_decode_result, &g_encode_params, &tmp_encode_result);
+       g_free(tmp_encode_result.path);
+       if (ret != IMAGE_UTIL_ERROR_NONE) {
+               g_print("Fail ENCODE_RUN_TO_BUFFER!!!\n");
+               goto END;
+       }
+       g_print("Success ENCODE_RUN_TO_BUFFER!!!\n");
 
-       g_transform_params.resize.w = 320;
-       g_transform_params.resize.h = 240;
+       if (!g_encode_result.buffer && !g_encode_result.image)
+               ret = __run_decode(DECODE_RUN_ASYNC2, &g_input_data, &g_decode_params, &g_decode_result);
+       else
+               ret = __run_decode(DECODE_RUN2, &g_encode_result, &g_decode_params, &g_decode_result);
+       if (ret != IMAGE_UTIL_ERROR_NONE) {
+               g_print("Fail DECODE_RUN_ASYNC2!!!\n");
+               goto END;
+       }
+       g_print("Success DECODE_RUN_ASYNC2!!!\n");
 
-       g_transform_params.rotation = IMAGE_UTIL_ROTATION_90;
+       tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+       ret = __run_encode(ENCODE_RUN_ASYNC_TO_FILE, &g_decode_result, &g_encode_params, &tmp_encode_result);
+       g_free(tmp_encode_result.path);
+       if (ret != IMAGE_UTIL_ERROR_NONE) {
+               g_print("Fail ENCODE_RUN_ASYNC_TO_FILE!!!\n");
+               goto END;
+       }
+       g_print("Success ENCODE_RUN_ASYNC_TO_FILE!!!\n");
 
-       ret = __run_encode(ENCODE_RUN_TO_FILE, &g_decode_result, &g_encode_params, &g_encode_result);
-       if (ret == IMAGE_UTIL_ERROR_NONE)
-               g_print("Success ENCODE_RUN_TO_FILE!!!\n");
-       else
-               g_print("Fail ENCODE_RUN_TO_FILE!!!\n");
+       tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+       ret = __run_encode(ENCODE_RUN_ASYNC_TO_BUFFER, &g_decode_result, &g_encode_params, &tmp_encode_result);
+       g_free(tmp_encode_result.path);
+       if (ret != IMAGE_UTIL_ERROR_NONE) {
+               g_print("Fail ENCODE_RUN_ASYNC_TO_BUFFER!!!\n");
+               goto END;
+       }
+       g_print("Success ENCODE_RUN_ASYNC_TO_BUFFER!!!\n");
 
-       for (image_type = IMAGE_UTIL_JPEG; image_type <= IMAGE_UTIL_TYPE_MAX; image_type++) {
-               g_print("[[[ IMAGE_TYPE %d ]]]\n", image_type);
+END:
+       __clear_test_complex_data(&tmp_encode_result);
 
-               ret = __run_decode(DECODE_RUN2, &g_encode_result, &g_decode_params, &g_decode_result);
-               if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success DECODE_RUN2!!!\n");
-               else
-                       g_print("Fail DECODE_RUN2!!!\n");
+       return ret;
+}
+
+static int __run_decode_encode_tests(void)
+{
+       const struct {
+               image_util_type_e image_type;
+               const char* text;
+       } test_image_types[] = {
+               { IMAGE_UTIL_JPEG, "JPEG" },
+               { IMAGE_UTIL_PNG, "PNG" },
+               { IMAGE_UTIL_BMP, "BMP" },
+               { IMAGE_UTIL_WEBP, "WEBP" },
+               { IMAGE_UTIL_JPEG_XL, "JPEG XL" },
+               { IMAGE_UTIL_GIF, "GIF" }, // gif should be last order due to image quality
+       };
+
+       const struct {
+               int quality;
+               image_util_png_compression_e compression;
+               bool lossless;
+       } test_ops[] = {
+               { 75, IMAGE_UTIL_PNG_COMPRESSION_6, false }, // defaults
+               { 1, IMAGE_UTIL_PNG_COMPRESSION_9, false }, // low quality
+               { 100, IMAGE_UTIL_PNG_COMPRESSION_1, true }, // high quality
+       };
+
+       int ret = IMAGE_UTIL_ERROR_NONE;
+       unsigned int i = 0;
+       unsigned int j = 0;
+
+       for (i = 0; i < G_N_ELEMENTS(test_image_types); i++) {
+               // use only default test_opts for BMP, HEIF and GIF due to no-effect
+               bool no_use_test_opts = ((test_image_types[i].image_type == IMAGE_UTIL_BMP) ||
+                               (test_image_types[i].image_type == IMAGE_UTIL_HEIF) ||
+                               (test_image_types[i].image_type == IMAGE_UTIL_GIF)) ? true : false;
+
+               g_print("[[[ IMAGE_TYPE : %s ]]]\n", test_image_types[i].text);
+
+               g_encode_params.type = test_image_types[i].image_type;
+               for (j = 0; j < G_N_ELEMENTS(test_ops); j++) {
+                       if (no_use_test_opts && (j > 0))
+                               continue;
+
+                       g_encode_params.quality = test_ops[j].quality;
+                       g_encode_params.compression = test_ops[j].compression;
+                       g_encode_params.lossless = test_ops[j].lossless;
+
+                       g_print("[DECODE/ENCODE TESTS] [%s][Quality: %d, Comp: %d, Lossless: %d]\n", test_image_types[i].text,
+                                       test_ops[j].quality, test_ops[j].compression, test_ops[j].lossless);
+
+                       ret = __run_decode_encode_test();
+                       if (ret != IMAGE_UTIL_ERROR_NONE) {
+                               g_print("Fail DECODE/ENCODE TEST!!!\n");
+                               break;
+                       }
+                       g_print("Success DECODE/ENCODE TEST!!!\n");
+               }
+
+               /* generate next image_type using previous image_type */
+               if ((i + 1) < G_N_ELEMENTS(test_image_types)) {
+                       g_encode_params.type = test_image_types[i + 1].image_type;
+
+                       __get_encode_path(g_encode_params.type, FILE_FOR_ENCODE, &g_encode_result.path);
+                       ret = __run_encode(ENCODE_RUN_TO_FILE, &g_decode_result, &g_encode_params, &g_encode_result);
+                       if (ret == IMAGE_UTIL_ERROR_NONE)
+                               g_print("Success ENCODE_RUN_TO_FILE(next format)!!!\n");
+                       else
+                               g_print("Fail ENCODE_RUN_TO_FILE(next format)!!!\n");
+               }
+       }
+
+       return ret;
+}
 
+static int __run_crop_tests(void)
+{
+       const test_size_s test_crop_areas[] = {
+               { 0, 0, 640, 480},
+               { 0, 100, 320, 340},
+               { 100, 0, 420, 240},
+               { 100, 100, 420, 340},
+       };
+
+       int ret = IMAGE_UTIL_ERROR_NONE;
+       test_complex_data_s tmp_encode_result;
+       unsigned int i = 0;
+
+       memset(&tmp_encode_result, 0, sizeof(test_complex_data_s));
+
+       for (i = 0; i < G_N_ELEMENTS(test_crop_areas); i++) {
                g_transform_params.has_crop = TRUE;
-               __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
-               if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success TRANSFORM_RUN2(crop)!!!\n");
-               else
-                       g_print("Fail TRANSFORM_RUN2(crop)!!!\n");
+               g_transform_params.crop_area.x = test_crop_areas[i].x;
+               g_transform_params.crop_area.y = test_crop_areas[i].y;
+               g_transform_params.crop_area.w = test_crop_areas[i].w;
+               g_transform_params.crop_area.h = test_crop_areas[i].h;
 
-               g_transform_params.has_crop = FALSE;
+               g_print("[CROP TESTS] [x: %u, y: %u, w: %u, h: %u]\n",
+                               test_crop_areas[i].x, test_crop_areas[i].y, test_crop_areas[i].w, test_crop_areas[i].h);
 
-               __get_auto_path(image_type, &encode_temp_result.path);
-               ret = __run_encode(ENCODE_RUN_TO_FILE, &g_decode_result, &g_encode_params, &encode_temp_result);
+               ret = __run_decode(DECODE_RUN2, &g_input_data, &g_decode_params, &g_decode_result);
+               if (ret != IMAGE_UTIL_ERROR_NONE) {
+                       g_print("Fail DECODE_RUN2!!!\n");
+                       goto END;
+               }
+               g_print("Success DECODE_RUN2!!!\n");
+
+               ret = __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
+               if (ret != IMAGE_UTIL_ERROR_NONE) {
+                       g_print("Fail TRANSFORM_RUN2(crop)!!!\n");
+                       goto END;
+               }
+               g_print("Success TRANSFORM_RUN2(crop)!!!\n");
+
+               tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+               ret = __run_encode(ENCODE_RUN_TO_FILE, &g_transform_result, &g_encode_params, &tmp_encode_result);
+               g_free(tmp_encode_result.path);
                if (ret == IMAGE_UTIL_ERROR_NONE)
                        g_print("Success ENCODE_RUN_TO_FILE!!!\n");
                else
                        g_print("Fail ENCODE_RUN_TO_FILE!!!\n");
+       }
 
-               __run_decode(DECODE_RUN_ASYNC2, &g_encode_result, &g_decode_params, &g_decode_result);
-               if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success DECODE_RUN_ASYNC2!!!\n");
-               else
-                       g_print("Fail DECODE_RUN_ASYNC2!!!\n");
+END:
+       g_transform_params.has_crop = FALSE;
+       __clear_test_complex_data(&tmp_encode_result);
+
+       return ret;
+}
 
+static int __run_resize_tests(void)
+{
+       const test_size_s test_resolutions[] = {
+               { 0, 0, 320, 240},
+               { 0, 0, 240, 320},
+               { 0, 0, 320, 320},
+               { 0, 0, 240, 240},
+       };
+
+       int ret = IMAGE_UTIL_ERROR_NONE;
+       test_complex_data_s tmp_encode_result;
+       unsigned int i = 0;
+
+       memset(&tmp_encode_result, 0, sizeof(test_complex_data_s));
+
+       for (i = 0; i < G_N_ELEMENTS(test_resolutions); i++) {
                g_transform_params.has_resize = TRUE;
-               __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
-               if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success TRANSFORM_RUN2(resize)!!!\n");
-               else
-                       g_print("Fail TRANSFORM_RUN2(resize)!!!\n");
+               g_transform_params.resize.w = test_resolutions[i].w;
+               g_transform_params.resize.h = test_resolutions[i].h;
 
-               g_transform_params.has_resize = FALSE;
+               g_print("[RESIZE TESTS] [w: %u, h: %u]\n", test_resolutions[i].w, test_resolutions[i].h);
 
-               __get_auto_path(image_type, &encode_temp_result.path);
-               ret = __run_encode(ENCODE_RUN_TO_BUFFER, &g_transform_result, &g_encode_params, &encode_temp_result);
-               if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success ENCODE_RUN_TO_BUFFER!!!\n");
-               else
-                       g_print("Fail ENCODE_RUN_TO_BUFFER!!!\n");
+               ret = __run_decode(DECODE_RUN2, &g_input_data, &g_decode_params, &g_decode_result);
+               if (ret != IMAGE_UTIL_ERROR_NONE) {
+                       g_print("Fail DECODE_RUN2!!!\n");
+                       goto END;
+               }
+               g_print("Success DECODE_RUN2!!!\n");
 
-               __run_decode(DECODE_RUN_ASYNC2, &g_encode_result, &g_decode_params, &g_decode_result);
-               if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success DECODE_RUN_ASYNC2!!!\n");
-               else
-                       g_print("Fail DECODE_RUN_ASYNC2!!!\n");
+               ret = __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
+               if (ret != IMAGE_UTIL_ERROR_NONE) {
+                       g_print("Fail TRANSFORM_RUN2(resize)!!!\n");
+                       goto END;
+               }
+               g_print("Success TRANSFORM_RUN2(resize)!!!\n");
 
-               g_transform_params.has_rotation = TRUE;
-               __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
+               tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+               ret = __run_encode(ENCODE_RUN_TO_FILE, &g_transform_result, &g_encode_params, &tmp_encode_result);
+               g_free(tmp_encode_result.path);
                if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success TRANSFORM_RUN2(rotate)!!!\n");
+                       g_print("Success ENCODE_RUN_TO_FILE!!!\n");
                else
-                       g_print("Fail TRANSFORM_RUN2(rotate)!!!\n");
+                       g_print("Fail ENCODE_RUN_TO_FILE!!!\n");
+       }
+
+END:
+       g_transform_params.has_resize = FALSE;
+       __clear_test_complex_data(&tmp_encode_result);
+
+       return ret;
+}
+
+static int __run_rotate_tests(void)
+{
+       const image_util_rotation_e test_rotations[] = {
+               IMAGE_UTIL_ROTATION_90,
+               IMAGE_UTIL_ROTATION_180,
+               IMAGE_UTIL_ROTATION_270,
+               IMAGE_UTIL_ROTATION_FLIP_HORZ,
+               IMAGE_UTIL_ROTATION_FLIP_VERT,
+       };
+
+       int ret = IMAGE_UTIL_ERROR_NONE;
+       test_complex_data_s tmp_encode_result;
+       unsigned int i = 0;
+
+       memset(&tmp_encode_result, 0, sizeof(test_complex_data_s));
+       g_transform_params.has_rotation = TRUE;
 
-               g_transform_params.has_rotation = FALSE;
+       for (i = 0; i < G_N_ELEMENTS(test_rotations); i++) {
+               g_transform_params.rotation = test_rotations[i];
 
-               /* change next image_type */
-               g_encode_params.type = ((image_type == IMAGE_UTIL_TYPE_MAX) ? IMAGE_UTIL_TYPE_MAX : (image_type + 1));
-               __get_auto_path(g_encode_params.type, &g_encode_result.path);
+               g_print("[ROTATE TESTS] [rot: %d]\n", test_rotations[i]);
 
-               ret = __run_encode(ENCODE_RUN_ASYNC_TO_BUFFER, &g_transform_result, &g_encode_params, &g_encode_result);
+               ret = __run_decode(DECODE_RUN2, &g_input_data, &g_decode_params, &g_decode_result);
+               if (ret != IMAGE_UTIL_ERROR_NONE) {
+                       g_print("Fail DECODE_RUN2!!!\n");
+                       goto END;
+               }
+               g_print("Success DECODE_RUN2!!!\n");
+
+               ret = __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
+               if (ret != IMAGE_UTIL_ERROR_NONE) {
+                       g_print("Fail TRANSFORM_RUN2(rotate %d)!!!\n", g_transform_params.rotation);
+                       goto END;
+               }
+               g_print("Success TRANSFORM_RUN2(rotate %d)!!!\n", g_transform_params.rotation);
+
+               tmp_encode_result.path = __get_auto_path(g_encode_params.type);
+               ret = __run_encode(ENCODE_RUN_TO_FILE, &g_transform_result, &g_encode_params, &tmp_encode_result);
+               g_free(tmp_encode_result.path);
                if (ret == IMAGE_UTIL_ERROR_NONE)
-                       g_print("Success ENCODE_RUN_ASYNC_TO_BUFFER!!!\n");
+                       g_print("Success ENCODE_RUN_TO_FILE!!!\n");
                else
-                       g_print("Fail ENCODE_RUN_ASYNC_TO_BUFFER!!!\n");
+                       g_print("Fail ENCODE_RUN_TO_FILE!!!\n");
+       }
+
+END:
+       g_transform_params.has_rotation = FALSE;
+       __clear_test_complex_data(&tmp_encode_result);
+
+       return ret;
+}
+
+static int __run_convert_color_tests(void)
+{
+       const image_util_colorspace_e test_image_colors[] = {
+               IMAGE_UTIL_COLORSPACE_YV12,
+               IMAGE_UTIL_COLORSPACE_YUV422,
+               IMAGE_UTIL_COLORSPACE_I420,
+               IMAGE_UTIL_COLORSPACE_NV12,
+               IMAGE_UTIL_COLORSPACE_UYVY,
+               IMAGE_UTIL_COLORSPACE_YUYV,
+               IMAGE_UTIL_COLORSPACE_RGB565,
+               IMAGE_UTIL_COLORSPACE_RGB888,
+               IMAGE_UTIL_COLORSPACE_ARGB8888,
+               IMAGE_UTIL_COLORSPACE_BGRA8888,
+               IMAGE_UTIL_COLORSPACE_RGBA8888,
+               IMAGE_UTIL_COLORSPACE_BGRX8888,
+               IMAGE_UTIL_COLORSPACE_NV21,
+               IMAGE_UTIL_COLORSPACE_NV16,
+               IMAGE_UTIL_COLORSPACE_NV61,
+       };
+
+       int ret = IMAGE_UTIL_ERROR_NONE;
+       test_complex_data_s tmp_encode_result;
+       unsigned int i = 0;
+       unsigned int j = 0;
+
+       memset(&tmp_encode_result, 0, sizeof(test_complex_data_s));
+       g_transform_params.has_convert_color = TRUE;
+
+       for (i = 0; i < G_N_ELEMENTS(test_image_colors); i++) {
+               for (j = 0; j < G_N_ELEMENTS(test_image_colors); j++) {
+                       if (i == j)
+                               continue;
+
+                       g_decode_params.color = i;
+                       g_transform_params.convert_color = j;
+
+                       g_print("[CONVERT_COLOR TESTS] [%d to %d]\n", i, j);
+
+                       ret = __run_decode(DECODE_RUN2, &g_input_data, &g_decode_params, &g_decode_result);
+                       if (ret != IMAGE_UTIL_ERROR_NONE) {
+                               g_print("Fail DECODE_RUN2(%d)!!!\n", i);
+                               continue;
+                       }
+                       g_print("Success DECODE_RUN2!!!\n");
+
+                       ret = __run_transform(TRANSFORM_RUN2, &g_decode_result, &g_transform_params, &g_transform_result);
+                       if (ret != IMAGE_UTIL_ERROR_NONE) {
+                               g_print("Fail TRANSFORM_RUN2(convert %d to %d)!!!\n", i, j);
+                               continue;
+                       }
+                       g_print("Success TRANSFORM_RUN2(convert %d to %d)!!!\n", i, j);
+
+#if DUMP_RAW_IMAGE
+                       g_autofree gchar* filename = g_strdup_printf("%s(%d_to_%d)", "convert_test", i, j);
+                       __write_raw("convert_test", g_decode_result.image);
+                       __write_raw(filename, g_transform_result.image);
+#endif
+                       tmp_encode_result.path = __get_auto_convert_path(g_encode_params.type, i, j);
+                       ret = __run_encode(ENCODE_RUN_TO_FILE, &g_transform_result, &g_encode_params, &tmp_encode_result);
+                       g_free(tmp_encode_result.path);
+                       if (ret == IMAGE_UTIL_ERROR_NONE)
+                               g_print("Success ENCODE_RUN_TO_FILE!!!\n");
+                       else
+                               g_print("Fail ENCODE_RUN_TO_FILE!!!\n");
+               }
        }
 
+       g_transform_params.has_convert_color = FALSE;
+       __clear_test_complex_data(&tmp_encode_result);
+
        return ret;
 }
+
+static void __run_auto(void)
+{
+       int ret = IMAGE_UTIL_ERROR_NONE;
+
+       g_num_of_file = 0;
+
+       g_print("***** Start DECODE/ENCODE TESTS!!!\n");
+       ret = __run_decode_encode_tests();
+       if (ret == IMAGE_UTIL_ERROR_NONE)
+               g_print("***** Success DECODE/ENCODE TESTS!!!\n");
+       else
+               g_print("***** Fail DECODE/ENCODE TESTS!!!\n");
+
+       g_decode_params.color = IMAGE_UTIL_COLORSPACE_RGBA8888;
+       g_encode_params.type = IMAGE_UTIL_JPEG;
+       g_encode_params.quality = 100;
+
+       g_print("***** Start CROP TESTS!!!\n");
+       ret = __run_crop_tests();
+       if (ret == IMAGE_UTIL_ERROR_NONE)
+               g_print("***** Success CROP TESTS!!!\n");
+       else
+               g_print("***** Fail CROP TESTS!!!\n");
+
+       g_print("***** Start RESIZE TESTS!!!\n");
+       ret = __run_resize_tests();
+       if (ret == IMAGE_UTIL_ERROR_NONE)
+               g_print("***** Success RESIZE TESTS!!!\n");
+       else
+               g_print("***** Fail RESIZE TESTS!!!\n");
+
+       g_print("***** Start ROTATE TESTS!!!\n");
+       ret = __run_rotate_tests();
+       if (ret == IMAGE_UTIL_ERROR_NONE)
+               g_print("***** Success ROTATE TESTS!!!\n");
+       else
+               g_print("***** Fail ROTATE TESTS!!!\n");
+
+       g_num_of_file = 0;
+
+       g_print("***** Start CONVERT_COLOR TESTS!!!\n");
+       ret = __run_convert_color_tests();
+       if (ret == IMAGE_UTIL_ERROR_NONE)
+               g_print("***** Success __run_convert_color_test!!!\n");
+       else
+               g_print("***** Fail __run_convert_color_test!!!\n");
+}
 /* test functions for testsuite */