From: jiyong.min Date: Thu, 25 Mar 2021 01:46:03 +0000 (+0900) Subject: [UTC][capi-media-image-util][Non-ACR][Change serveral global variables to structure] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5fadeffef23dcdddc93080281e969f12a8bb731;p=test%2Ftct%2Fnative%2Fapi.git [UTC][capi-media-image-util][Non-ACR][Change serveral global variables to structure] There are too many global variables that need to be changed further when trying to add a new format(IMAGE_UTIL_TYPE). Related global variables such as decode/encode are grouped into a structure. Change-Id: I5d5327cb456432433fac3be1e7f1e52f27b01137 --- diff --git a/src/utc/image-util/utc-image-util-decode-encode.c b/src/utc/image-util/utc-image-util-decode-encode.c index 21b91899a..50e205bef 100755 --- a/src/utc/image-util/utc-image-util-decode-encode.c +++ b/src/utc/image-util/utc-image-util-decode-encode.c @@ -28,6 +28,19 @@ #define INVALID_IMAGE_TYPE sizeof(image_util_type_e) + 1 /* +1 margin due to new type */ #define LAST_IMAGE_TYPE IMAGE_UTIL_WEBP +typedef struct { + char *source; + char *output; +} utc_filename_t; + +static const utc_filename_t FILENAME[] = { + [IMAGE_UTIL_JPEG] = { "sample.jpg", "test_output.jpg" }, + [IMAGE_UTIL_PNG] = { "sample.png", "test_output.png" }, + [IMAGE_UTIL_GIF] = { "sample.gif", "test_output.gif" }, + [IMAGE_UTIL_BMP] = { "sample.bmp", "test_output.bmp" }, + [IMAGE_UTIL_WEBP] = { "sample.webp", "test_output.webp" }, +}; + typedef struct { unsigned char *buffer; size_t size; @@ -35,82 +48,39 @@ typedef struct { unsigned int height; } decode_result_t; +typedef struct { + char *source; + image_util_decode_h handle; + image_util_image_h decoded; + decode_result_t result; +} utc_decode_t; + +static utc_decode_t utc_decode[] = { + [IMAGE_UTIL_JPEG] = { NULL, NULL, NULL, { NULL, 0, 0, 0 } }, + [IMAGE_UTIL_PNG] = { NULL, NULL, NULL, { NULL, 0, 0, 0 } }, + [IMAGE_UTIL_GIF] = { NULL, NULL, NULL, { NULL, 0, 0, 0 } }, + [IMAGE_UTIL_BMP] = { NULL, NULL, NULL, { NULL, 0, 0, 0 } }, + [IMAGE_UTIL_WEBP] = { NULL, NULL, NULL, { NULL, 0, 0, 0 } }, +}; + typedef struct { unsigned char *buffer; unsigned long long size; size_t buffer_size; } encode_result_t; -static const char *g_source_filename[] = { - [IMAGE_UTIL_JPEG] = "sample.jpg", - [IMAGE_UTIL_PNG] = "sample.png", - [IMAGE_UTIL_GIF] = "sample.gif", - [IMAGE_UTIL_BMP] = "sample.bmp", - [IMAGE_UTIL_WEBP] = "sample.webp", -}; - -static const char *g_output_filename[] = { - [IMAGE_UTIL_JPEG] = "test_output.jpg", - [IMAGE_UTIL_PNG] = "test_output.png", - [IMAGE_UTIL_GIF] = "test_output.gif", - [IMAGE_UTIL_BMP] = "test_output.bmp", - [IMAGE_UTIL_WEBP] = "test_output.webp", -}; - -static char *g_source_path[] = { - [IMAGE_UTIL_JPEG] = NULL, - [IMAGE_UTIL_PNG] = NULL, - [IMAGE_UTIL_GIF] = NULL, - [IMAGE_UTIL_BMP] = NULL, - [IMAGE_UTIL_WEBP] = NULL, -}; - -static char *g_output_path[] = { - [IMAGE_UTIL_JPEG] = NULL, - [IMAGE_UTIL_PNG] = NULL, - [IMAGE_UTIL_GIF] = NULL, - [IMAGE_UTIL_BMP] = NULL, - [IMAGE_UTIL_WEBP] = NULL, -}; - -static image_util_decode_h g_decoder[] = { - [IMAGE_UTIL_JPEG] = NULL, - [IMAGE_UTIL_PNG] = NULL, - [IMAGE_UTIL_GIF] = NULL, - [IMAGE_UTIL_BMP] = NULL, - [IMAGE_UTIL_WEBP] = NULL, -}; - -static image_util_encode_h g_encoder[] = { - [IMAGE_UTIL_JPEG] = NULL, - [IMAGE_UTIL_PNG] = NULL, - [IMAGE_UTIL_GIF] = NULL, - [IMAGE_UTIL_BMP] = NULL, - [IMAGE_UTIL_WEBP] = NULL, -}; - -static decode_result_t g_decode_result[] = { - [IMAGE_UTIL_JPEG] = { NULL, 0, 0, 0 }, - [IMAGE_UTIL_PNG] = { NULL, 0, 0, 0 }, - [IMAGE_UTIL_GIF] = { NULL, 0, 0, 0 }, - [IMAGE_UTIL_BMP] = { NULL, 0, 0, 0 }, - [IMAGE_UTIL_WEBP] = { NULL, 0, 0, 0 }, -}; - -static encode_result_t g_encode_result[] = { - [IMAGE_UTIL_JPEG] = { NULL, 0, 0 }, - [IMAGE_UTIL_PNG] = { NULL, 0, 0 }, - [IMAGE_UTIL_GIF] = { NULL, 0, 0 }, - [IMAGE_UTIL_BMP] = { NULL, 0, 0 }, - [IMAGE_UTIL_WEBP] = { NULL, 0, 0 }, -}; - -static image_util_image_h g_decoded_image[] = { - [IMAGE_UTIL_JPEG] = NULL, - [IMAGE_UTIL_PNG] = NULL, - [IMAGE_UTIL_GIF] = NULL, - [IMAGE_UTIL_BMP] = NULL, - [IMAGE_UTIL_WEBP] = NULL, +typedef struct { + char *output; + image_util_encode_h handle; + encode_result_t result; +} utc_encode_t; + +static utc_encode_t utc_encode[] = { + [IMAGE_UTIL_JPEG] = { NULL, NULL, { NULL, 0, 0 } }, + [IMAGE_UTIL_PNG] = { NULL, NULL, { NULL, 0, 0 } }, + [IMAGE_UTIL_GIF] = { NULL, NULL, { NULL, 0, 0 } }, + [IMAGE_UTIL_BMP] = { NULL, NULL, { NULL, 0, 0 } }, + [IMAGE_UTIL_WEBP] = { NULL, NULL, { NULL, 0, 0 } }, }; static int callback_error = IMAGE_UTIL_ERROR_NONE; @@ -203,21 +173,21 @@ static int __fill_test_buffer(image_util_type_e type) int ret = IMAGE_UTIL_ERROR_NONE; image_util_image_h decoded_image = NULL; - ret = _utc_decode_from_file(g_source_path[type], &decoded_image); + ret = _utc_decode_from_file(utc_decode[type].source, &decoded_image); if (ret != IMAGE_UTIL_ERROR_NONE) { FPRINTF("[%d:%s] _utc_decode_from_file failed! %d \\n", __LINE__, __FUNCTION__, ret); return ret; } - ret = image_util_get_image(decoded_image, &g_decode_result[type].width, &g_decode_result[type].height, NULL, - &g_decode_result[type].buffer, &g_decode_result[type].size); + ret = image_util_get_image(decoded_image, &utc_decode[type].result.width, &utc_decode[type].result.height, NULL, + &utc_decode[type].result.buffer, &utc_decode[type].result.size); if (ret != IMAGE_UTIL_ERROR_NONE) { FPRINTF("[%d:%s] image_util_get_image failed! %d \\n", __LINE__, __FUNCTION__, ret); image_util_destroy_image(decoded_image); return ret; } - ret = _utc_encode_to_buffer(type, decoded_image, &g_encode_result[type].buffer, &g_encode_result[type].size); + ret = _utc_encode_to_buffer(type, decoded_image, &utc_encode[type].result.buffer, &utc_encode[type].result.size); if (ret != IMAGE_UTIL_ERROR_NONE) FPRINTF("[%d:%s] _utc_encode_to_buffer failed! %d \\n", __LINE__, __FUNCTION__, ret); @@ -226,6 +196,34 @@ static int __fill_test_buffer(image_util_type_e type) return ret; } + +static void __utc_decode_free() +{ + image_util_type_e type = 0; + + for (type = 0; type <= LAST_IMAGE_TYPE; type++) { + IMAGEUTIL_SAFE_G_FREE(utc_decode[type].result.buffer); + utc_decode[type].result.size = 0; + IMAGEUTIL_SAFE_G_FREE(utc_decode[type].source); + image_util_decode_destroy(utc_decode[type].handle); + utc_decode[type].handle = NULL; + } +} + +static void __utc_encode_free() +{ + image_util_type_e type = 0; + + for (type = 0; type <= LAST_IMAGE_TYPE; type++) { + IMAGEUTIL_SAFE_G_FREE(utc_encode[type].result.buffer); + utc_encode[type].result.size = 0; + utc_encode[type].result.buffer_size = 0; + IMAGEUTIL_SAFE_G_FREE(utc_encode[type].output); + image_util_encode_destroy(utc_encode[type].handle); + utc_encode[type].handle = NULL; + } +} + /** * @function utc_image_util_decode_startup * @description Called before each test @@ -243,12 +241,12 @@ void utc_image_util_decode_startup(void) PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue); for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - g_source_path[type] = _utc_get_test_path(pszValue, g_source_filename[type]); - g_output_path[type] = _utc_get_test_path(pszValue, g_output_filename[type]); + utc_decode[type].source = _utc_get_test_path(pszValue, FILENAME[type].source); + utc_encode[type].output = _utc_get_test_path(pszValue, FILENAME[type].output); FPRINTF("[%d:%s] PATH [Type: %d] [Decode: %s], [Encode: %s] \\n", __LINE__, __FUNCTION__, type, - g_source_path[type], g_output_path[type]); + utc_decode[type].source, utc_encode[type].output); - if (!g_source_path[type] || !g_output_path[type]) + if (!utc_decode[type].source || !utc_encode[type].output) FPRINTF("[%d:%s] Get UTC Path error! \\n", __LINE__, __FUNCTION__); } } @@ -258,7 +256,7 @@ void utc_image_util_decode_startup(void) } for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_create(&g_decoder[type]); + ret = image_util_decode_create(&utc_decode[type].handle); if (IMAGE_UTIL_ERROR_NONE != ret) PRINT_UTC_LOG("[Line : %d][%s] image_util_decode_create is failed(%d).\n", __LINE__, API_NAMESPACE, ret); } @@ -273,19 +271,8 @@ void utc_image_util_decode_startup(void) */ void utc_image_util_decode_cleanup(void) { - image_util_type_e type = 0; - - for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - IMAGEUTIL_SAFE_G_FREE(g_decode_result[type].buffer); - g_decode_result[type].size = 0; - IMAGEUTIL_SAFE_G_FREE(g_encode_result[type].buffer); - g_encode_result[type].size = 0; - g_encode_result[type].buffer_size = 0; - IMAGEUTIL_SAFE_G_FREE(g_source_path[type]); - IMAGEUTIL_SAFE_G_FREE(g_output_path[type]); - image_util_decode_destroy(g_decoder[type]); - g_decoder[type] = NULL; - } + __utc_decode_free(); + __utc_encode_free(); } static bool _image_util_supported_colorspace_cb(image_util_colorspace_e colorspace, void *user_data) @@ -359,11 +346,11 @@ int utc_image_util_decode_create_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_destroy(g_decoder[type]); + ret = image_util_decode_destroy(utc_decode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - g_decoder[type] = NULL; + utc_decode[type].handle = NULL; - ret = image_util_decode_create(&g_decoder[type]); + ret = image_util_decode_create(&utc_decode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -381,7 +368,7 @@ int utc_image_util_decode_set_input_path_n1(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(NULL, g_source_path[type]); + ret = image_util_decode_set_input_path(NULL, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -399,7 +386,7 @@ int utc_image_util_decode_set_input_path_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_encoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_encode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -417,7 +404,7 @@ int utc_image_util_decode_set_input_path_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], WRONG_PATH); + ret = image_util_decode_set_input_path(utc_decode[type].handle, WRONG_PATH); assert_eq(ret, IMAGE_UTIL_ERROR_NO_SUCH_FILE); } @@ -435,7 +422,7 @@ int utc_image_util_decode_set_input_path_n4(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], NULL); + ret = image_util_decode_set_input_path(utc_decode[type].handle, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NO_SUCH_FILE); } @@ -453,7 +440,7 @@ int utc_image_util_decode_set_input_path_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -474,7 +461,7 @@ int utc_image_util_decode_set_input_buffer_n1(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(NULL, g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(NULL, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -495,7 +482,7 @@ int utc_image_util_decode_set_input_buffer_n2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_encoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_encode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -516,7 +503,7 @@ int utc_image_util_decode_set_input_buffer_n3(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], NULL, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, NULL, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -537,7 +524,7 @@ int utc_image_util_decode_set_input_buffer_n4(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, 0); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, 0); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -558,7 +545,7 @@ int utc_image_util_decode_set_input_buffer_p(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -593,7 +580,7 @@ int utc_image_util_decode_set_output_buffer_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_output_buffer(g_encoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_encode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -611,7 +598,7 @@ int utc_image_util_decode_set_output_buffer_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_output_buffer(g_decoder[type], NULL); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -630,7 +617,7 @@ int utc_image_util_decode_set_output_buffer_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -735,7 +722,7 @@ int utc_image_util_decode_set_colorspace_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_colorspace(g_decoder[type], IMAGE_UTIL_COLORSPACE_RGBA8888); + ret = image_util_decode_set_colorspace(utc_decode[type].handle, IMAGE_UTIL_COLORSPACE_RGBA8888); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -753,13 +740,13 @@ int utc_image_util_decode_set_colorspace_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_colorspace(g_decoder[type], -1); + ret = image_util_decode_set_colorspace(utc_decode[type].handle, -1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_decode_set_colorspace(g_decoder[type], IMAGE_UTIL_COLORSPACE_NV61 + 1); + ret = image_util_decode_set_colorspace(utc_decode[type].handle, IMAGE_UTIL_COLORSPACE_NV61 + 1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -776,12 +763,12 @@ int utc_image_util_decode_set_colorspace_n4(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_JPEG], g_source_path[IMAGE_UTIL_JPEG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_JPEG].handle, utc_decode[IMAGE_UTIL_JPEG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (jpeg_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_JPEG], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_JPEG].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } } @@ -799,12 +786,12 @@ int utc_image_util_decode_set_colorspace_n5(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_PNG], g_source_path[IMAGE_UTIL_PNG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_PNG].handle, utc_decode[IMAGE_UTIL_PNG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (png_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_PNG], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_PNG].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } } @@ -822,12 +809,12 @@ int utc_image_util_decode_set_colorspace_n6(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_GIF], g_source_path[IMAGE_UTIL_GIF]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (gif_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_GIF], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_GIF].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } } @@ -845,12 +832,12 @@ int utc_image_util_decode_set_colorspace_n7(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_BMP], g_source_path[IMAGE_UTIL_BMP]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_BMP].handle, utc_decode[IMAGE_UTIL_BMP].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (bmp_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_BMP], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_BMP].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } } @@ -868,12 +855,12 @@ int utc_image_util_decode_set_colorspace_p1(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_JPEG], g_source_path[IMAGE_UTIL_JPEG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_JPEG].handle, utc_decode[IMAGE_UTIL_JPEG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (jpeg_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NONE) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_JPEG], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_JPEG].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } } @@ -891,12 +878,12 @@ int utc_image_util_decode_set_colorspace_p2(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_PNG], g_source_path[IMAGE_UTIL_PNG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_PNG].handle, utc_decode[IMAGE_UTIL_PNG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (png_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NONE) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_PNG], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_PNG].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } } @@ -914,12 +901,12 @@ int utc_image_util_decode_set_colorspace_p3(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_GIF], g_source_path[IMAGE_UTIL_GIF]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (gif_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NONE) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_GIF], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_GIF].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } } @@ -937,12 +924,12 @@ int utc_image_util_decode_set_colorspace_p4(void) int ret = IMAGE_UTIL_ERROR_NONE; int color_space = IMAGE_UTIL_COLORSPACE_YV12; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_BMP], g_source_path[IMAGE_UTIL_BMP]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_BMP].handle, utc_decode[IMAGE_UTIL_BMP].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); for (color_space = IMAGE_UTIL_COLORSPACE_YV12; color_space <= IMAGE_UTIL_COLORSPACE_NV61; color_space++) { if (bmp_colorspace_tbl[color_space] == IMAGE_UTIL_ERROR_NONE) { - ret = image_util_decode_set_colorspace(g_decoder[IMAGE_UTIL_BMP], color_space); + ret = image_util_decode_set_colorspace(utc_decode[IMAGE_UTIL_BMP].handle, color_space); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } } @@ -974,7 +961,7 @@ int utc_image_util_decode_set_jpeg_downscale_n2(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_decode_set_jpeg_downscale(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_DOWNSCALE_1_1); + ret = image_util_decode_set_jpeg_downscale(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_DOWNSCALE_1_1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -989,16 +976,16 @@ int utc_image_util_decode_set_jpeg_downscale_n3(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_JPEG], g_source_path[IMAGE_UTIL_JPEG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_JPEG].handle, utc_decode[IMAGE_UTIL_JPEG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_jpeg_downscale(g_decoder[IMAGE_UTIL_PNG], IMAGE_UTIL_DOWNSCALE_1_1); + ret = image_util_decode_set_jpeg_downscale(utc_decode[IMAGE_UTIL_PNG].handle, IMAGE_UTIL_DOWNSCALE_1_1); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_decode_set_jpeg_downscale(g_decoder[IMAGE_UTIL_GIF], IMAGE_UTIL_DOWNSCALE_1_1); + ret = image_util_decode_set_jpeg_downscale(utc_decode[IMAGE_UTIL_GIF].handle, IMAGE_UTIL_DOWNSCALE_1_1); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_decode_set_jpeg_downscale(g_decoder[IMAGE_UTIL_BMP], IMAGE_UTIL_DOWNSCALE_1_1); + ret = image_util_decode_set_jpeg_downscale(utc_decode[IMAGE_UTIL_BMP].handle, IMAGE_UTIL_DOWNSCALE_1_1); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); return 0; @@ -1013,13 +1000,13 @@ int utc_image_util_decode_set_jpeg_downscale_n4(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_JPEG], g_source_path[IMAGE_UTIL_JPEG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_JPEG].handle, utc_decode[IMAGE_UTIL_JPEG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_jpeg_downscale(g_decoder[IMAGE_UTIL_JPEG], -1); + ret = image_util_decode_set_jpeg_downscale(utc_decode[IMAGE_UTIL_JPEG].handle, -1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_decode_set_jpeg_downscale(g_decoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_DOWNSCALE_1_8 + 1); + ret = image_util_decode_set_jpeg_downscale(utc_decode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_DOWNSCALE_1_8 + 1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -1034,10 +1021,10 @@ int utc_image_util_decode_set_jpeg_downscale_p(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_decode_set_input_path(g_decoder[IMAGE_UTIL_JPEG], g_source_path[IMAGE_UTIL_JPEG]); + ret = image_util_decode_set_input_path(utc_decode[IMAGE_UTIL_JPEG].handle, utc_decode[IMAGE_UTIL_JPEG].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_jpeg_downscale(g_decoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_DOWNSCALE_1_1); + ret = image_util_decode_set_jpeg_downscale(utc_decode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_DOWNSCALE_1_1); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -1073,7 +1060,7 @@ int utc_image_util_decode_run_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_run(g_encoder[type], &image_width, &image_height, &image_size); + ret = image_util_decode_run(utc_encode[type].handle, &image_width, &image_height, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1094,10 +1081,10 @@ int utc_image_util_decode_run_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run(g_decoder[type], &image_width, &image_height, &image_size); + ret = image_util_decode_run(utc_decode[type].handle, &image_width, &image_height, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1117,10 +1104,10 @@ int utc_image_util_decode_run_n4(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run(g_decoder[type], &image_width, &image_height, &image_size); + ret = image_util_decode_run(utc_decode[type].handle, &image_width, &image_height, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1143,10 +1130,10 @@ int utc_image_util_decode_run_n5(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run(g_decoder[type], &image_width, &image_height, &image_size); + ret = image_util_decode_run(utc_decode[type].handle, &image_width, &image_height, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1167,13 +1154,13 @@ int utc_image_util_decode_run_p1(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run(g_decoder[type], &image_width, &image_height, &image_size); + ret = image_util_decode_run(utc_decode[type].handle, &image_width, &image_height, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); IMAGEUTIL_SAFE_FREE(data); } @@ -1198,13 +1185,13 @@ int utc_image_util_decode_run_p2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run(g_decoder[type], &image_width, &image_height, &image_size); + ret = image_util_decode_run(utc_decode[type].handle, &image_width, &image_height, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); IMAGEUTIL_SAFE_FREE(data); } @@ -1224,13 +1211,13 @@ int utc_image_util_decode_run2_n(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_run2(g_decoder[type], &decoded_image); + ret = image_util_decode_run2(utc_decode[type].handle, &decoded_image); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run2(g_decoder[type], NULL); + ret = image_util_decode_run2(utc_decode[type].handle, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1249,10 +1236,10 @@ int utc_image_util_decode_run2_p1(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run2(g_decoder[type], &decoded_image); + ret = image_util_decode_run2(utc_decode[type].handle, &decoded_image); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); ret = image_util_destroy_image(decoded_image); @@ -1277,10 +1264,10 @@ int utc_image_util_decode_run2_p2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run2(g_decoder[type], &decoded_image); + ret = image_util_decode_run2(utc_decode[type].handle, &decoded_image); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); ret = image_util_destroy_image(decoded_image); @@ -1316,7 +1303,7 @@ int utc_image_util_decode_run_async_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_run_async(g_encoder[type], (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); + ret = image_util_decode_run_async(utc_encode[type].handle, (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1335,10 +1322,10 @@ int utc_image_util_decode_run_async_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async(g_decoder[type], (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); + ret = image_util_decode_run_async(utc_decode[type].handle, (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1356,10 +1343,10 @@ int utc_image_util_decode_run_async_n4(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async(g_decoder[type], (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); + ret = image_util_decode_run_async(utc_decode[type].handle, (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1380,10 +1367,10 @@ int utc_image_util_decode_run_async_n5(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async(g_decoder[type], (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); + ret = image_util_decode_run_async(utc_decode[type].handle, (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1402,13 +1389,13 @@ int utc_image_util_decode_run_async_n6(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async(g_decoder[type], NULL, NULL); + ret = image_util_decode_run_async(utc_decode[type].handle, NULL, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1427,13 +1414,13 @@ int utc_image_util_decode_run_async_p1(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async(g_decoder[type], (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); + ret = image_util_decode_run_async(utc_decode[type].handle, (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); @@ -1459,13 +1446,13 @@ int utc_image_util_decode_run_async_p2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_output_buffer(g_decoder[type], &data); + ret = image_util_decode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async(g_decoder[type], (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); + ret = image_util_decode_run_async(utc_decode[type].handle, (image_util_decode_completed_cb) utc_decode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); @@ -1487,13 +1474,13 @@ int utc_image_util_decode_run_async2_n(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_run_async2(g_decoder[type], utc_decode_completed2_cb, NULL); + ret = image_util_decode_run_async2(utc_decode[type].handle, utc_decode_completed2_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async2(g_decoder[type], NULL, NULL); + ret = image_util_decode_run_async2(utc_decode[type].handle, NULL, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1512,10 +1499,10 @@ int utc_image_util_decode_run_async2_p1(void) for (type = 0; type <= LAST_IMAGE_TYPE; type++) { callback_error = -1; - ret = image_util_decode_set_input_path(g_decoder[type], g_source_path[type]); + ret = image_util_decode_set_input_path(utc_decode[type].handle, utc_decode[type].source); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async2(g_decoder[type], utc_decode_completed2_cb, NULL); + ret = image_util_decode_run_async2(utc_decode[type].handle, utc_decode_completed2_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); @@ -1540,10 +1527,10 @@ int utc_image_util_decode_run_async2_p2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_set_input_buffer(g_decoder[type], g_encode_result[type].buffer, g_encode_result[type].size); + ret = image_util_decode_set_input_buffer(utc_decode[type].handle, utc_encode[type].result.buffer, utc_encode[type].result.size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_decode_run_async2(g_decoder[type], utc_decode_completed2_cb, NULL); + ret = image_util_decode_run_async2(utc_decode[type].handle, utc_decode_completed2_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); @@ -1579,7 +1566,7 @@ int utc_image_util_decode_destroy_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_destroy(g_encoder[type]); + ret = image_util_decode_destroy(utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1597,9 +1584,9 @@ int utc_image_util_decode_destroy_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_decode_destroy(g_decoder[type]); + ret = image_util_decode_destroy(utc_decode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - g_decoder[type] = NULL; + utc_decode[type].handle = NULL; } return 0; @@ -1622,12 +1609,12 @@ void utc_image_util_encode_startup(void) PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue); for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - g_source_path[type] = _utc_get_test_path(pszValue, g_source_filename[type]); - g_output_path[type] = _utc_get_test_path(pszValue, g_output_filename[type]); + utc_decode[type].source = _utc_get_test_path(pszValue, FILENAME[type].source); + utc_encode[type].output = _utc_get_test_path(pszValue, FILENAME[type].output); FPRINTF("[%d:%s] PATH [Type: %d] [Decode: %s], [Encode: %s] \\n", __LINE__, __FUNCTION__, type, - g_source_path[type], g_output_path[type]); + utc_decode[type].source, utc_encode[type].output); - if (!g_source_path[type] || !g_output_path[type]) + if (!utc_decode[type].source || !utc_encode[type].output) FPRINTF("[%d:%s] Get UTC Path error! \\n", __LINE__, __FUNCTION__); } } @@ -1637,7 +1624,7 @@ void utc_image_util_encode_startup(void) } for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_create(type, &g_encoder[type]); + ret = image_util_encode_create(type, &utc_encode[type].handle); if (IMAGE_UTIL_ERROR_NONE != ret) PRINT_UTC_LOG("[Line : %d][%s] image_util_encode_create is failed(%d).\n", __LINE__, API_NAMESPACE, ret); } @@ -1652,21 +1639,8 @@ void utc_image_util_encode_startup(void) void utc_image_util_encode_cleanup(void) { /* end of TC */ - image_util_type_e type = 0; - - for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - IMAGEUTIL_SAFE_FREE(g_decode_result[type].buffer); - g_decode_result[type].size = 0; - IMAGEUTIL_SAFE_FREE(g_encode_result[type].buffer); - g_encode_result[type].size = 0; - g_encode_result[type].buffer_size = 0; - IMAGEUTIL_SAFE_G_FREE (g_source_path[type]); - IMAGEUTIL_SAFE_G_FREE (g_output_path[type]); - image_util_encode_destroy(g_encoder[type]); - g_encoder[type] = NULL; - image_util_destroy_image(g_decoded_image[type]); - g_decoded_image[type] = NULL; - } + __utc_decode_free(); + __utc_encode_free(); } /** @@ -1695,14 +1669,14 @@ int utc_image_util_encode_create_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_destroy(g_encoder[type]); + ret = image_util_encode_destroy(utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - g_encoder[type] = NULL; + utc_encode[type].handle = NULL; - ret = image_util_encode_create(-1, &g_encoder[type]); + ret = image_util_encode_create(-1, &utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_create(INVALID_IMAGE_TYPE, &g_encoder[type]); + ret = image_util_encode_create(INVALID_IMAGE_TYPE, &utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1720,11 +1694,11 @@ int utc_image_util_encode_create_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_destroy(g_encoder[type]); + ret = image_util_encode_destroy(utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - g_encoder[type] = NULL; + utc_encode[type].handle = NULL; - ret = image_util_encode_create(type, &g_encoder[type]); + ret = image_util_encode_create(type, &utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -1757,7 +1731,7 @@ int utc_image_util_encode_set_resolution_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_resolution(g_decoder[type], 320, 240); + ret = image_util_encode_set_resolution(utc_decode[type].handle, 320, 240); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1775,10 +1749,10 @@ int utc_image_util_encode_set_resolution_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_resolution(g_encoder[type], 0, 240); + ret = image_util_encode_set_resolution(utc_encode[type].handle, 0, 240); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_set_resolution(g_encoder[type], 320, 0); + ret = image_util_encode_set_resolution(utc_encode[type].handle, 320, 0); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -1794,10 +1768,10 @@ int utc_image_util_encode_set_resolution_n4(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], 320, 240); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, 320, 240); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], 320, 250); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, 320, 250); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -1814,7 +1788,7 @@ int utc_image_util_encode_set_resolution_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_resolution(g_encoder[type], 320, 240); + ret = image_util_encode_set_resolution(utc_encode[type].handle, 320, 240); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -1845,7 +1819,7 @@ int utc_image_util_encode_set_colorspace_n2(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_colorspace(g_decoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_RGBA8888); + ret = image_util_encode_set_colorspace(utc_decode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_RGBA8888); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -1860,10 +1834,10 @@ int utc_image_util_encode_set_colorspace_n3(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], -1); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, -1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_NV61 + 1); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_NV61 + 1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -1878,28 +1852,28 @@ int utc_image_util_encode_set_colorspace_n4(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_YUV422); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_YUV422); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_UYVY); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_UYVY); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_YUYV); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_YUYV); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_RGB565); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_RGB565); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_BGRX8888); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_BGRX8888); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_NV21); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_NV21); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_NV16); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_NV16); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_NV61); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_NV61); assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); return 0; @@ -1914,7 +1888,7 @@ int utc_image_util_encode_set_colorspace_p(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_colorspace(g_encoder[IMAGE_UTIL_JPEG], IMAGE_UTIL_COLORSPACE_RGBA8888); + ret = image_util_encode_set_colorspace(utc_encode[IMAGE_UTIL_JPEG].handle, IMAGE_UTIL_COLORSPACE_RGBA8888); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -1944,7 +1918,7 @@ int utc_image_util_encode_set_quality_n2(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_quality(g_decoder[IMAGE_UTIL_JPEG], 1); + ret = image_util_encode_set_quality(utc_decode[IMAGE_UTIL_JPEG].handle, 1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -1961,7 +1935,7 @@ int utc_image_util_encode_set_quality_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_quality(g_encoder[type], 1); + ret = image_util_encode_set_quality(utc_encode[type].handle, 1); if (type != IMAGE_UTIL_JPEG) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -1978,10 +1952,10 @@ int utc_image_util_encode_set_quality_n4(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_quality(g_encoder[IMAGE_UTIL_JPEG], 0); + ret = image_util_encode_set_quality(utc_encode[IMAGE_UTIL_JPEG].handle, 0); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_set_quality(g_encoder[IMAGE_UTIL_JPEG], 101); + ret = image_util_encode_set_quality(utc_encode[IMAGE_UTIL_JPEG].handle, 101); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -1996,7 +1970,7 @@ int utc_image_util_encode_set_quality_p(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_quality(g_encoder[IMAGE_UTIL_JPEG], 1); + ret = image_util_encode_set_quality(utc_encode[IMAGE_UTIL_JPEG].handle, 1); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -2026,7 +2000,7 @@ int utc_image_util_encode_set_png_compression_n2(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_png_compression(g_decoder[IMAGE_UTIL_PNG], IMAGE_UTIL_PNG_COMPRESSION_0); + ret = image_util_encode_set_png_compression(utc_decode[IMAGE_UTIL_PNG].handle, IMAGE_UTIL_PNG_COMPRESSION_0); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -2043,7 +2017,7 @@ int utc_image_util_encode_set_png_compression_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_png_compression(g_encoder[type], IMAGE_UTIL_PNG_COMPRESSION_0); + ret = image_util_encode_set_png_compression(utc_encode[type].handle, IMAGE_UTIL_PNG_COMPRESSION_0); if (type != IMAGE_UTIL_PNG) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -2060,10 +2034,10 @@ int utc_image_util_encode_set_png_compression_n4(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_png_compression(g_encoder[IMAGE_UTIL_PNG], -1); + ret = image_util_encode_set_png_compression(utc_encode[IMAGE_UTIL_PNG].handle, -1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_set_png_compression(g_encoder[IMAGE_UTIL_PNG], IMAGE_UTIL_PNG_COMPRESSION_9 + 1); + ret = image_util_encode_set_png_compression(utc_encode[IMAGE_UTIL_PNG].handle, IMAGE_UTIL_PNG_COMPRESSION_9 + 1); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -2078,7 +2052,7 @@ int utc_image_util_encode_set_png_compression_p(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_png_compression(g_encoder[IMAGE_UTIL_PNG], IMAGE_UTIL_PNG_COMPRESSION_0); + ret = image_util_encode_set_png_compression(utc_encode[IMAGE_UTIL_PNG].handle, IMAGE_UTIL_PNG_COMPRESSION_0); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -2108,7 +2082,7 @@ int utc_image_util_encode_set_gif_frame_delay_time_n2(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_gif_frame_delay_time(g_decoder[IMAGE_UTIL_GIF], 100); + ret = image_util_encode_set_gif_frame_delay_time(utc_decode[IMAGE_UTIL_GIF].handle, 100); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); return 0; @@ -2125,7 +2099,7 @@ int utc_image_util_encode_set_gif_frame_delay_time_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_gif_frame_delay_time(g_encoder[type], 100); + ret = image_util_encode_set_gif_frame_delay_time(utc_encode[type].handle, 100); if (type != IMAGE_UTIL_GIF) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -2142,7 +2116,7 @@ int utc_image_util_encode_set_gif_frame_delay_time_p(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_gif_frame_delay_time(g_encoder[IMAGE_UTIL_GIF], 100); + ret = image_util_encode_set_gif_frame_delay_time(utc_encode[IMAGE_UTIL_GIF].handle, 100); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -2175,7 +2149,7 @@ int utc_image_util_encode_set_webp_lossless_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_webp_lossless(g_encoder[type], true); + ret = image_util_encode_set_webp_lossless(utc_encode[type].handle, true); if (type != IMAGE_UTIL_WEBP) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -2192,10 +2166,10 @@ int utc_image_util_encode_set_webp_lossless_p(void) { int ret = IMAGE_UTIL_ERROR_NONE; - ret = image_util_encode_set_webp_lossless(g_encoder[IMAGE_UTIL_WEBP], true); + ret = image_util_encode_set_webp_lossless(utc_encode[IMAGE_UTIL_WEBP].handle, true); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_webp_lossless(g_encoder[IMAGE_UTIL_WEBP], false); + ret = image_util_encode_set_webp_lossless(utc_encode[IMAGE_UTIL_WEBP].handle, false); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -2215,7 +2189,7 @@ int utc_image_util_encode_set_input_buffer_n1(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(NULL, g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(NULL, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2236,7 +2210,7 @@ int utc_image_util_encode_set_input_buffer_n2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_decoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_decode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2254,7 +2228,7 @@ int utc_image_util_encode_set_input_buffer_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_input_buffer(g_encoder[type], NULL); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2275,7 +2249,7 @@ int utc_image_util_encode_set_input_buffer_p(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -2293,7 +2267,7 @@ int utc_image_util_encode_set_output_path_n1(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(NULL, g_output_path[type]); + ret = image_util_encode_set_output_path(NULL, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2311,7 +2285,7 @@ int utc_image_util_encode_set_output_path_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(g_decoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_decode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2329,7 +2303,7 @@ int utc_image_util_encode_set_output_path_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(g_encoder[type], WRONG_PATH); + ret = image_util_encode_set_output_path(utc_encode[type].handle, WRONG_PATH); assert_eq(ret, IMAGE_UTIL_ERROR_NO_SUCH_FILE); } @@ -2347,7 +2321,7 @@ int utc_image_util_encode_set_output_path_n4(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(g_encoder[type], NULL); + ret = image_util_encode_set_output_path(utc_encode[type].handle, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NO_SUCH_FILE); } @@ -2365,7 +2339,7 @@ int utc_image_util_encode_set_output_path_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -2400,7 +2374,7 @@ int utc_image_util_encode_set_output_buffer_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_buffer(g_decoder[type], &data); + ret = image_util_encode_set_output_buffer(utc_decode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2418,7 +2392,7 @@ int utc_image_util_encode_set_output_buffer_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_buffer(g_encoder[type], NULL); + ret = image_util_encode_set_output_buffer(utc_encode[type].handle, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2437,7 +2411,7 @@ int utc_image_util_encode_set_output_buffer_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_buffer(g_encoder[type], &data); + ret = image_util_encode_set_output_buffer(utc_encode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -2472,7 +2446,7 @@ int utc_image_util_encode_run_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_run(g_decoder[type], &image_size); + ret = image_util_encode_run(utc_decode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2491,7 +2465,7 @@ int utc_image_util_encode_run_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2513,10 +2487,10 @@ int utc_image_util_encode_run_n4(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2535,10 +2509,10 @@ int utc_image_util_encode_run_n5(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2558,10 +2532,10 @@ int utc_image_util_encode_run_n6(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_buffer(g_encoder[type], &data); + ret = image_util_encode_set_output_buffer(utc_encode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2583,13 +2557,13 @@ int utc_image_util_encode_run_n7(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2609,19 +2583,19 @@ int utc_image_util_encode_run_n8(void) ret = __fill_test_buffer(IMAGE_UTIL_GIF); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].width, g_decode_result[IMAGE_UTIL_GIF].height); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.width, utc_decode[IMAGE_UTIL_GIF].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].width, g_decode_result[IMAGE_UTIL_GIF].height); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.width, utc_decode[IMAGE_UTIL_GIF].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[IMAGE_UTIL_GIF], g_output_path[IMAGE_UTIL_GIF]); + ret = image_util_encode_set_output_path(utc_encode[IMAGE_UTIL_GIF].handle, utc_encode[IMAGE_UTIL_GIF].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[IMAGE_UTIL_GIF], &image_size); + ret = image_util_encode_run(utc_encode[IMAGE_UTIL_GIF].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_OPERATION); return 0; @@ -2642,16 +2616,16 @@ int utc_image_util_encode_run_p1(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[type], g_decode_result[type].width, g_decode_result[type].height); + ret = image_util_encode_set_resolution(utc_encode[type].handle, utc_decode[type].result.width, utc_decode[type].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -2674,16 +2648,16 @@ int utc_image_util_encode_run_p2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[type], g_decode_result[type].width, g_decode_result[type].height); + ret = image_util_encode_set_resolution(utc_encode[type].handle, utc_decode[type].result.width, utc_decode[type].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_buffer(g_encoder[type], &data); + ret = image_util_encode_set_output_buffer(utc_encode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &image_size); + ret = image_util_encode_run(utc_encode[type].handle, &image_size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); IMAGEUTIL_SAFE_FREE(data); } @@ -2706,16 +2680,16 @@ int utc_image_util_encode_run_p3(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[type], g_decode_result[type].width, g_decode_result[type].height); + ret = image_util_encode_set_resolution(utc_encode[type].handle, utc_decode[type].result.width, utc_decode[type].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[type], &size); + ret = image_util_encode_run(utc_encode[type].handle, &size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -2735,28 +2709,28 @@ int utc_image_util_encode_run_p4(void) ret = __fill_test_buffer(IMAGE_UTIL_GIF); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].width, g_decode_result[IMAGE_UTIL_GIF].height); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.width, utc_decode[IMAGE_UTIL_GIF].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].width, g_decode_result[IMAGE_UTIL_GIF].height); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.width, utc_decode[IMAGE_UTIL_GIF].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_gif_frame_delay_time(g_encoder[IMAGE_UTIL_GIF], 100); + ret = image_util_encode_set_gif_frame_delay_time(utc_encode[IMAGE_UTIL_GIF].handle, 100); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_gif_frame_delay_time(g_encoder[IMAGE_UTIL_GIF], 100); + ret = image_util_encode_set_gif_frame_delay_time(utc_encode[IMAGE_UTIL_GIF].handle, 100); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[IMAGE_UTIL_GIF], g_output_path[IMAGE_UTIL_GIF]); + ret = image_util_encode_set_output_path(utc_encode[IMAGE_UTIL_GIF].handle, utc_encode[IMAGE_UTIL_GIF].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run(g_encoder[IMAGE_UTIL_GIF], &size); + ret = image_util_encode_run(utc_encode[IMAGE_UTIL_GIF].handle, &size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); return 0; @@ -2788,7 +2762,7 @@ int utc_image_util_encode_run_async_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_run_async(g_decoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_decode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2806,7 +2780,7 @@ int utc_image_util_encode_run_async_n3(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2827,10 +2801,10 @@ int utc_image_util_encode_run_async_n4(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2848,10 +2822,10 @@ int utc_image_util_encode_run_async_n5(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2870,10 +2844,10 @@ int utc_image_util_encode_run_async_n6(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_set_output_buffer(g_encoder[type], &data); + ret = image_util_encode_set_output_buffer(utc_encode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2894,13 +2868,13 @@ int utc_image_util_encode_run_async_n7(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2921,16 +2895,16 @@ int utc_image_util_encode_run_async_n8(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[type], g_decode_result[type].width, g_decode_result[type].height); + ret = image_util_encode_set_resolution(utc_encode[type].handle, utc_decode[type].result.width, utc_decode[type].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], NULL, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, NULL, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -2948,15 +2922,15 @@ int utc_image_util_encode_run_async_n9(void) ret = __fill_test_buffer(IMAGE_UTIL_GIF); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].width, g_decode_result[IMAGE_UTIL_GIF].height); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.width, utc_decode[IMAGE_UTIL_GIF].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].width, g_decode_result[IMAGE_UTIL_GIF].height); + ret = image_util_encode_set_resolution(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.width, utc_decode[IMAGE_UTIL_GIF].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[IMAGE_UTIL_GIF], g_decode_result[IMAGE_UTIL_GIF].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[IMAGE_UTIL_GIF].handle, utc_decode[IMAGE_UTIL_GIF].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[IMAGE_UTIL_GIF], g_output_path[IMAGE_UTIL_GIF]); + ret = image_util_encode_set_output_path(utc_encode[IMAGE_UTIL_GIF].handle, utc_encode[IMAGE_UTIL_GIF].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[IMAGE_UTIL_GIF], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[IMAGE_UTIL_GIF].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); assert_eq(callback_error, IMAGE_UTIL_ERROR_INVALID_OPERATION); @@ -2978,16 +2952,16 @@ int utc_image_util_encode_run_async_p1(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[type], g_decode_result[type].width, g_decode_result[type].height); + ret = image_util_encode_set_resolution(utc_encode[type].handle, utc_decode[type].result.width, utc_decode[type].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_path(g_encoder[type], g_output_path[type]); + ret = image_util_encode_set_output_path(utc_encode[type].handle, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); assert_eq(callback_error, IMAGE_UTIL_ERROR_NONE); @@ -3011,16 +2985,16 @@ int utc_image_util_encode_run_async_p2(void) ret = __fill_test_buffer(type); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_resolution(g_encoder[type], g_decode_result[type].width, g_decode_result[type].height); + ret = image_util_encode_set_resolution(utc_encode[type].handle, utc_decode[type].result.width, utc_decode[type].result.height); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_input_buffer(g_encoder[type], g_decode_result[type].buffer); + ret = image_util_encode_set_input_buffer(utc_encode[type].handle, utc_decode[type].result.buffer); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_set_output_buffer(g_encoder[type], &data); + ret = image_util_encode_set_output_buffer(utc_encode[type].handle, &data); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async(g_encoder[type], (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); + ret = image_util_encode_run_async(utc_encode[type].handle, (image_util_encode_completed_cb) utc_encode_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); IMAGEUTIL_SAFE_FREE(data); @@ -3041,10 +3015,10 @@ int utc_image_util_encode_run_to_file_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_to_file(g_encoder[type], g_decoded_image[type], g_output_path[type]); + ret = image_util_encode_run_to_file(utc_encode[type].handle, utc_decode[type].decoded, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); } @@ -3062,16 +3036,16 @@ int utc_image_util_encode_run_to_file_n(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_to_file(NULL, g_decoded_image[type], g_output_path[type]); + ret = image_util_encode_run_to_file(NULL, utc_decode[type].decoded, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_to_file(g_encoder[type], NULL, g_output_path[type]); + ret = image_util_encode_run_to_file(utc_encode[type].handle, NULL, utc_encode[type].output); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_to_file(g_encoder[type], g_decoded_image[type], NULL); + ret = image_util_encode_run_to_file(utc_encode[type].handle, utc_decode[type].decoded, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -3089,13 +3063,13 @@ int utc_image_util_encode_run_to_buffer_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_to_buffer(g_encoder[type], g_decoded_image[type], &g_encode_result[type].buffer, &g_encode_result[type].buffer_size); + ret = image_util_encode_run_to_buffer(utc_encode[type].handle, utc_decode[type].decoded, &utc_encode[type].result.buffer, &utc_encode[type].result.buffer_size); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - assert_neq(g_encode_result[type].buffer, NULL); - assert_gt(g_encode_result[type].buffer_size, 0); + assert_neq(utc_encode[type].result.buffer, NULL); + assert_gt(utc_encode[type].result.buffer_size, 0); } return 0; @@ -3112,19 +3086,19 @@ int utc_image_util_encode_run_to_buffer_n(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_to_buffer(NULL, g_decoded_image[type], &g_encode_result[type].buffer, &g_encode_result[type].buffer_size); + ret = image_util_encode_run_to_buffer(NULL, utc_decode[type].decoded, &utc_encode[type].result.buffer, &utc_encode[type].result.buffer_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_to_buffer(g_encoder[type], NULL, &g_encode_result[type].buffer, &g_encode_result[type].buffer_size); + ret = image_util_encode_run_to_buffer(utc_encode[type].handle, NULL, &utc_encode[type].result.buffer, &utc_encode[type].result.buffer_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_to_buffer(g_encoder[type], g_decoded_image[type], NULL, &g_encode_result[type].buffer_size); + ret = image_util_encode_run_to_buffer(utc_encode[type].handle, utc_decode[type].decoded, NULL, &utc_encode[type].result.buffer_size); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_to_buffer(g_encoder[type], g_decoded_image[type], &g_encode_result[type].buffer, NULL); + ret = image_util_encode_run_to_buffer(utc_encode[type].handle, utc_decode[type].decoded, &utc_encode[type].result.buffer, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -3142,10 +3116,10 @@ int utc_image_util_encode_run_async_to_file_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async_to_file(g_encoder[type], g_decoded_image[type], g_output_path[type], + ret = image_util_encode_run_async_to_file(utc_encode[type].handle, utc_decode[type].decoded, utc_encode[type].output, utc_encode_to_file_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); @@ -3167,19 +3141,19 @@ int utc_image_util_encode_run_async_to_file_n(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async_to_file(NULL, g_decoded_image[type], g_output_path[type], utc_encode_to_file_completed_cb, NULL); + ret = image_util_encode_run_async_to_file(NULL, utc_decode[type].decoded, utc_encode[type].output, utc_encode_to_file_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_async_to_file(g_encoder[type], NULL, g_output_path[type], utc_encode_to_file_completed_cb, NULL); + ret = image_util_encode_run_async_to_file(utc_encode[type].handle, NULL, utc_encode[type].output, utc_encode_to_file_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_async_to_file(g_encoder[type], g_decoded_image[type], NULL, utc_encode_to_file_completed_cb, NULL); + ret = image_util_encode_run_async_to_file(utc_encode[type].handle, utc_decode[type].decoded, NULL, utc_encode_to_file_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_async_to_file(g_encoder[type], g_decoded_image[type], g_output_path[type], NULL, NULL); + ret = image_util_encode_run_async_to_file(utc_encode[type].handle, utc_decode[type].decoded, utc_encode[type].output, NULL, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -3197,17 +3171,17 @@ int utc_image_util_encode_run_async_to_buffer_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async_to_buffer(g_encoder[type], g_decoded_image[type], utc_encode_to_buffer_completed_cb, - &g_encode_result[type]); + ret = image_util_encode_run_async_to_buffer(utc_encode[type].handle, utc_decode[type].decoded, utc_encode_to_buffer_completed_cb, + &utc_encode[type].result); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); wait_for_async(); assert_eq(callback_error, IMAGE_UTIL_ERROR_NONE); - assert_neq(g_encode_result[type].buffer, NULL); - assert_gt(g_encode_result[type].buffer_size, 0); + assert_neq(utc_encode[type].result.buffer, NULL); + assert_gt(utc_encode[type].result.buffer_size, 0); } return 0; @@ -3224,16 +3198,16 @@ int utc_image_util_encode_run_async_to_buffer_n(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = _utc_decode_from_file(g_source_path[type], &g_decoded_image[type]); + ret = _utc_decode_from_file(utc_decode[type].source, &utc_decode[type].decoded); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - ret = image_util_encode_run_async_to_buffer(NULL, g_decoded_image[type], utc_encode_to_buffer_completed_cb, NULL); + ret = image_util_encode_run_async_to_buffer(NULL, utc_decode[type].decoded, utc_encode_to_buffer_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_async_to_buffer(g_encoder[type], NULL, utc_encode_to_buffer_completed_cb, NULL); + ret = image_util_encode_run_async_to_buffer(utc_encode[type].handle, NULL, utc_encode_to_buffer_completed_cb, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); - ret = image_util_encode_run_async_to_buffer(g_encoder[type], g_decoded_image[type], NULL, NULL); + ret = image_util_encode_run_async_to_buffer(utc_encode[type].handle, utc_decode[type].decoded, NULL, NULL); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -3266,7 +3240,7 @@ int utc_image_util_encode_destroy_n2(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_destroy(g_decoder[type]); + ret = image_util_encode_destroy(utc_decode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); } @@ -3284,9 +3258,9 @@ int utc_image_util_encode_destroy_p(void) image_util_type_e type = 0; for (type = 0; type <= LAST_IMAGE_TYPE; type++) { - ret = image_util_encode_destroy(g_encoder[type]); + ret = image_util_encode_destroy(utc_encode[type].handle); assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - g_encoder[type] = NULL; + utc_encode[type].handle = NULL; } return 0;