From: jiyong.min Date: Wed, 31 Mar 2021 00:44:28 +0000 (+0900) Subject: [UTC][capi-media-image-util][ACR-1623][Add the testcases and sample resources for... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56fd01fdf7b3ee54d2cbdf922134764dc2c09d8b;p=test%2Ftct%2Fnative%2Fapi.git [UTC][capi-media-image-util][ACR-1623][Add the testcases and sample resources for HEIF image decoder] Change-Id: If91c75f786198cc8433bd0c3c91a2b3b239c3a21 --- diff --git a/src/utc/image-util/res/mobile/sample.heic b/src/utc/image-util/res/mobile/sample.heic new file mode 100644 index 000000000..a605aacab Binary files /dev/null and b/src/utc/image-util/res/mobile/sample.heic differ diff --git a/src/utc/image-util/res/tizeniot/sample.heic b/src/utc/image-util/res/tizeniot/sample.heic new file mode 100644 index 000000000..a605aacab Binary files /dev/null and b/src/utc/image-util/res/tizeniot/sample.heic differ diff --git a/src/utc/image-util/res/tv/sample.heic b/src/utc/image-util/res/tv/sample.heic new file mode 100644 index 000000000..a605aacab Binary files /dev/null and b/src/utc/image-util/res/tv/sample.heic differ diff --git a/src/utc/image-util/res/wearable/sample.heic b/src/utc/image-util/res/wearable/sample.heic new file mode 100644 index 000000000..a605aacab Binary files /dev/null and b/src/utc/image-util/res/wearable/sample.heic differ 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 fb4aab584..c5916f831 100755 --- a/src/utc/image-util/utc-image-util-decode-encode.c +++ b/src/utc/image-util/utc-image-util-decode-encode.c @@ -25,7 +25,7 @@ #define WRONG_PATH "" -#define DECODE_IMAGE_TYPE_N IMAGE_UTIL_WEBP +#define DECODE_IMAGE_TYPE_N IMAGE_UTIL_HEIF #define ENCODE_IMAGE_TYPE_N IMAGE_UTIL_WEBP #define INVALID_IMAGE_TYPE ((DECODE_IMAGE_TYPE_N > ENCODE_IMAGE_TYPE_N) ? DECODE_IMAGE_TYPE_N * 2 : ENCODE_IMAGE_TYPE_N * 2) @@ -42,6 +42,7 @@ static const utc_config_t UTC_CONFIG[] = { [IMAGE_UTIL_GIF] = { true, "sample.gif", true, "test_output.gif" }, [IMAGE_UTIL_BMP] = { true, "sample.bmp", true, "test_output.bmp" }, [IMAGE_UTIL_WEBP] = { true, "sample.webp", true, "test_output.webp" }, + [IMAGE_UTIL_HEIF] = { true, "sample.heic", false, NULL }, }; typedef struct { @@ -64,6 +65,7 @@ static utc_decode_t utc_decode[] = { [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 } }, + [IMAGE_UTIL_HEIF] = { NULL, NULL, NULL, { NULL, 0, 0, 0 } }, }; typedef struct { @@ -175,6 +177,7 @@ static int __fill_test_buffer(image_util_type_e type) { int ret = IMAGE_UTIL_ERROR_NONE; image_util_image_h decoded_image = NULL; + GError *error = NULL; ret = _utc_decode_from_file(utc_decode[type].source, &decoded_image); if (ret != IMAGE_UTIL_ERROR_NONE) { @@ -190,9 +193,16 @@ static int __fill_test_buffer(image_util_type_e type) return ret; } - 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); + FPRINTF("[%d:%s] decode[%d] buffer: %zu \\n", __LINE__, __FUNCTION__, type, utc_decode[type].result.size); + + if (!g_file_get_contents(utc_decode[type].source, &utc_encode[type].result.buffer, &utc_encode[type].result.size, &error)) { + FPRINTF("[%d:%s] g_file_get_contents failed! %s \\n", __LINE__, __FUNCTION__, (error ? error->message : "none")); + if (error) + g_error_free(error); + ret = IMAGE_UTIL_ERROR_INVALID_PARAMETER; + } + + FPRINTF("[%d:%s] encode[%d] buffer: %zu \\n", __LINE__, __FUNCTION__, type, utc_encode[type].result.size); image_util_destroy_image(decoded_image); @@ -263,7 +273,7 @@ void utc_image_util_decode_startup(void) } utc_encode[type].output = _utc_get_test_path(pszValue, UTC_CONFIG[type].output); - FPRINTF("[%d:%s] PATH [Type: %d] [Decode: %s], [Encode: %s] \\n", __LINE__, __FUNCTION__, type, utc_encode[type].output); + FPRINTF("[%d:%s] PATH [Type: %d] [Encode: %s] \\n", __LINE__, __FUNCTION__, type, utc_encode[type].output); if (!utc_encode[type].output) FPRINTF("[%d:%s] Get UTC Path error! \\n", __LINE__, __FUNCTION__);