[UTC][capi-media-image-util][ACR-1623][Add the testcases and sample resources for... 99/256199/4
authorjiyong.min <jiyong.min@samsung.com>
Wed, 31 Mar 2021 00:44:28 +0000 (09:44 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Mon, 5 Apr 2021 23:56:24 +0000 (23:56 +0000)
Change-Id: If91c75f786198cc8433bd0c3c91a2b3b239c3a21

src/utc/image-util/res/mobile/sample.heic [new file with mode: 0644]
src/utc/image-util/res/tizeniot/sample.heic [new file with mode: 0644]
src/utc/image-util/res/tv/sample.heic [new file with mode: 0644]
src/utc/image-util/res/wearable/sample.heic [new file with mode: 0644]
src/utc/image-util/utc-image-util-decode-encode.c

diff --git a/src/utc/image-util/res/mobile/sample.heic b/src/utc/image-util/res/mobile/sample.heic
new file mode 100644 (file)
index 0000000..a605aac
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 (file)
index 0000000..a605aac
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 (file)
index 0000000..a605aac
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 (file)
index 0000000..a605aac
Binary files /dev/null and b/src/utc/image-util/res/wearable/sample.heic differ
index fb4aab5849bc1300f003a34f5560150f7d8dafbb..c5916f8312f0d9e86461948a2ef3cc5e3a02de73 100755 (executable)
@@ -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__);