[ITC][image-util][ACR-1623][New heif enum addition] 26/256826/3
authorNibha Sharma <nibha.sharma@samsung.com>
Tue, 13 Apr 2021 12:27:46 +0000 (17:57 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 13 Apr 2021 13:28:25 +0000 (13:28 +0000)
Change-Id: I3be2c7ad588a5ef8ee67159251f1e828b3134a2b
Signed-off-by: Nibha Sharma <nibha.sharma@samsung.com>
scripts_tpk/spec.sh
src/itc/image-util/ITs-image-util-agif-encode.c [changed mode: 0644->0755]
src/itc/image-util/ITs-image-util-common.h
src/itc/image-util/ITs-image-util.c
src/itc/image-util/res/mobile/sample.heic [new file with mode: 0755]
src/itc/image-util/res/tizeniot/sample.heic [new file with mode: 0644]
src/itc/image-util/res/tv/sample.heic [new file with mode: 0644]
src/itc/image-util/res/wearable/sample.heic [new file with mode: 0644]
src/itc/image-util/sample.heic [new file with mode: 0755]
src/itc/image-util/tct-image-util-native_mobile.h

index 31c9b49893b13dedd372bfa2709a7aa9176261c2..4522cab936334542070a8065c3adf132d278d195 100755 (executable)
@@ -250,6 +250,7 @@ case "$1" in
                        cp sample.gif $APP_DATA_DIR/sample.gif
                        cp sample.png $APP_DATA_DIR/sample.png
                        cp sample.bmp $APP_DATA_DIR/sample.bmp
+                       cp sample.heic $APP_DATA_DIR/sample.heic
                        chown -R 5000:5000 $APP_DATA_DIR
                        cp res/sample_anim1.png $APP_DATA_DIR/sample_anim1.png
                        cp res/sample_anim2.png $APP_DATA_DIR/sample_anim2.png
old mode 100644 (file)
new mode 100755 (executable)
index afb60eb..b72529c
@@ -122,7 +122,7 @@ int ITc_image_util_agif_encode_add_frame_p(void)
        CHECK_HANDLE(dstHandle,"image_util_decode_create");
 
        nRet = image_util_decode_set_input_path(dstHandle, pPath);
-       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
+       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
 
        nRet = image_util_decode_run2(dstHandle, &stDecodedImage);
        PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_run2", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
index f9cdbb631a0ec745d725e4a826b2e9edb8e979e6..adf1af7f1087eb239a87f765bea3e01f1aa7f482 100755 (executable)
@@ -25,6 +25,7 @@
 #include <media_packet.h>
 #include <media_format.h>
 #include <app.h>
+#include <stdio.h>
 
 /** @addtogroup itc-image-util
 *  @ingroup itc
@@ -41,6 +42,7 @@
 #define SAMPLE_PNG_FILE_PATH           "sample.png"
 #define SAMPLE_GIF_FILE_PATH           "sample.gif"
 #define SAMPLE_BMP_FILE_PATH           "sample.bmp"
+#define SAMPLE_HEIF_FILE_PATH          "sample.heic"
 
 #define QUALITY                     100
 #define X                           5
index 266108a00e87819c5536631988f529f6a4d16a63..e6ff462cd1b45b451a6cc02c19bef2e5ead5bbea 100755 (executable)
@@ -656,7 +656,7 @@ int ITc_image_util_extract_color_from_memory_p(void)
        CHECK_HANDLE(dstHandle,"image_util_decode_create");
 
        nRet = image_util_decode_set_input_path(dstHandle, pPath);
-       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
+       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
 
        nRet = image_util_decode_set_colorspace(dstHandle, IMAGE_UTIL_COLORSPACE_RGB888);
        PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_colorspace", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
@@ -735,23 +735,35 @@ int ITc_image_util_decode_set_input_path_p(void)
        START_TEST;
 
        image_util_decode_h stHandle = NULL;
-       int nRet = image_util_decode_create(&stHandle);
-       PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
-       CHECK_HANDLE(stHandle,"image_util_decode_create");
-       
-       char pPath[PATH_LEN] = {0,};
-       if ( false == ImageUtilAppendToAppDataPath(SAMPLE_FILE_PATH, pPath) )
+       char *eImageUtilType[5] = {
+               "Image_01.jpg",
+               "sample.png",
+               "sample.gif",
+               "sample.bmp",
+               "sample.heic"
+       };
+       int enum_size = 5;
+       int enum_counter = 0;
+       for(enum_counter = 0;enum_counter<enum_size;enum_counter++)
        {
-               FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       //target api
-       nRet = image_util_decode_set_input_path(stHandle, pPath);
-       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+               int nRet = image_util_decode_create(&stHandle);
+               PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
+               CHECK_HANDLE(stHandle,"image_util_decode_create");
 
-       nRet = image_util_decode_destroy(stHandle);
-       PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
+               char pPath[PATH_LEN] = {0,};
+               if ( false == ImageUtilAppendToAppDataPath(eImageUtilType[enum_counter], pPath) )
+               {
+                       FPRINTF("[Line : %d][%s] unable to get the app data path of file %s\\n", __LINE__, API_NAMESPACE,eImageUtilType[enum_counter]);
+                       image_util_decode_destroy(stHandle);
+                       return 1;
+               }
+               //target api
+               nRet = image_util_decode_set_input_path(stHandle, pPath);
+               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
 
+               nRet = image_util_decode_destroy(stHandle);
+               PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
+       }
        return 0;
 }
 //& purpose: To create a handle to image util decoding.
@@ -883,7 +895,7 @@ int ITc_image_util_encode_create_destroy_p(void)
                IMAGE_UTIL_GIF,  /**< Image format GIF */
                IMAGE_UTIL_JPEG,
                IMAGE_UTIL_BMP,  /**< Image format BMP */
-               IMAGE_UTIL_WEBP  /**< Image format WEBP */
+               IMAGE_UTIL_WEBP,  /**< Image format WEBP */
        };
        int enum_size = sizeof(eImageUtilType) / sizeof(eImageUtilType[0]);
        int enum_counter = 0;
@@ -1009,7 +1021,7 @@ int ITc_image_util_decode_run2_p(void)
        }
 
        nRet = image_util_decode_set_input_path(dstHandle, pPath);
-       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
+       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
 
        //target api
        nRet = image_util_decode_run2(dstHandle, &stDecodedImage);
@@ -1073,7 +1085,7 @@ int ITc_image_util_decode_run_async2_p(void)
                return 1;
        }
        nRet = image_util_decode_set_input_path(dstHandle, pPath);
-       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
+       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
 
        nRet = image_util_decode_run2(dstHandle, &stDecodedImage);
        PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_run2", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
@@ -1194,7 +1206,7 @@ int ITc_image_util_decode_set_colorspace_jpeg_p(void)
                }
 
                nRet = image_util_decode_set_input_path(stHandle, pPath);
-               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
 
                for (int nColorSpace = IMAGE_UTIL_COLORSPACE_YV12; nColorSpace <= IMAGE_UTIL_COLORSPACE_NV61; nColorSpace++)
                {
@@ -1257,7 +1269,7 @@ int ITc_image_util_decode_set_colorspace_png_p(void)
                }
 
                nRet = image_util_decode_set_input_path(stHandle, pPath);
-               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
 
                for (int nColorSpace = IMAGE_UTIL_COLORSPACE_YV12; nColorSpace <= IMAGE_UTIL_COLORSPACE_NV61; nColorSpace++)
                {
@@ -1320,7 +1332,7 @@ int ITc_image_util_decode_set_colorspace_gif_p(void)
                }
 
                nRet = image_util_decode_set_input_path(stHandle, pPath);
-               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
 
                for (int nColorSpace = IMAGE_UTIL_COLORSPACE_YV12; nColorSpace <= IMAGE_UTIL_COLORSPACE_NV61; nColorSpace++)
                {
@@ -1383,7 +1395,72 @@ int ITc_image_util_decode_set_colorspace_bmp_p(void)
                }
 
                nRet = image_util_decode_set_input_path(stHandle, pPath);
-               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+
+               for (int nColorSpace = IMAGE_UTIL_COLORSPACE_YV12; nColorSpace <= IMAGE_UTIL_COLORSPACE_NV61; nColorSpace++)
+               {
+                       if (BmpColorspace[nColorSpace] == IMAGE_UTIL_ERROR_NONE)
+                       {
+                               nRet = image_util_decode_set_colorspace(stHandle,nColorSpace);
+                               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_colorspace", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+                       }
+               }
+       }
+
+       nRet = image_util_decode_destroy(stHandle);
+       PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
+
+       return 0;
+}
+
+//& purpose: Sets the decoded image for HEIF colorspace format
+//& type: auto
+/**
+* @testcase                    ITc_image_util_decode_set_colorspace_heif_p
+* @since_tizen                 6.5
+* @author              SRID(nibha.sharma)
+* @reviewer            SRID(shobhit.v)
+* @type                                auto
+* @description                 Sets the decoded image for HEIF colorspace format
+* @scenario
+* @apicovered                  image_util_decode_set_colorspace
+* @passcase                            When image_util_decode_set_colorspace is successful.
+* @failcase                            If target API image_util_decode_set_colorspace fails or any precondition API fails.
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITc_image_util_decode_set_colorspace_heif_p(void)
+{
+       START_TEST;
+       image_util_decode_h stHandle = NULL;
+       g_bImageUtilForeachSupporedColorspace = false;
+
+       int nRet = image_util_decode_create(&stHandle);
+       PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
+       CHECK_HANDLE(stHandle,"image_util_decode_create");
+
+       nRet = image_util_foreach_supported_colorspace(IMAGE_UTIL_HEIF,(image_util_supported_colorspace_cb)Image_util_supported_colorspace_CallBack , NULL);
+       PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_foreach_supported_colorspace", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
+       if ( !g_bImageUtilForeachSupporedColorspace )
+       {
+               FPRINTF("[Line : %d][%s] image_util_foreach_supported_colorspace failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
+               nRet = image_util_decode_destroy(stHandle);
+               PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
+               return 1;
+       }
+       else
+       {
+               char pPath[PATH_LEN] = {0,};
+               if ( false == ImageUtilAppendToAppDataPath(SAMPLE_HEIF_FILE_PATH, pPath) )
+               {
+                       FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
+                       nRet = image_util_decode_destroy(stHandle);
+                       PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
+                       return 1;
+               }
+
+               nRet = image_util_decode_set_input_path(stHandle, pPath);
+               PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stHandle));
 
                for (int nColorSpace = IMAGE_UTIL_COLORSPACE_YV12; nColorSpace <= IMAGE_UTIL_COLORSPACE_NV61; nColorSpace++)
                {
diff --git a/src/itc/image-util/res/mobile/sample.heic b/src/itc/image-util/res/mobile/sample.heic
new file mode 100755 (executable)
index 0000000..659078c
Binary files /dev/null and b/src/itc/image-util/res/mobile/sample.heic differ
diff --git a/src/itc/image-util/res/tizeniot/sample.heic b/src/itc/image-util/res/tizeniot/sample.heic
new file mode 100644 (file)
index 0000000..659078c
Binary files /dev/null and b/src/itc/image-util/res/tizeniot/sample.heic differ
diff --git a/src/itc/image-util/res/tv/sample.heic b/src/itc/image-util/res/tv/sample.heic
new file mode 100644 (file)
index 0000000..659078c
Binary files /dev/null and b/src/itc/image-util/res/tv/sample.heic differ
diff --git a/src/itc/image-util/res/wearable/sample.heic b/src/itc/image-util/res/wearable/sample.heic
new file mode 100644 (file)
index 0000000..659078c
Binary files /dev/null and b/src/itc/image-util/res/wearable/sample.heic differ
diff --git a/src/itc/image-util/sample.heic b/src/itc/image-util/sample.heic
new file mode 100755 (executable)
index 0000000..659078c
Binary files /dev/null and b/src/itc/image-util/sample.heic differ
index 17e5a25f2c3bfff3bfae94a0195764905fed9d4f..6683b8d481534abe68a018755942b1225a36de65 100755 (executable)
@@ -70,6 +70,7 @@ extern int ITc_image_util_anim_encode_set_lossless_p(void);
 extern int ITc_image_util_anim_encode_add_frame_p(void);
 extern int ITc_image_util_anim_encode_save_to_file_p(void);
 extern int ITc_image_util_anim_encode_save_to_buffer_p(void);
+extern int ITc_image_util_decode_set_colorspace_heif_p(void);
 
 testcase tc_array[] = {
        {"ITc_image_util_transform_create_destroy_p",ITc_image_util_transform_create_destroy_p,ITs_image_util_startup,ITs_image_util_cleanup},
@@ -92,6 +93,7 @@ testcase tc_array[] = {
        {"ITc_image_util_decode_set_colorspace_png_p",ITc_image_util_decode_set_colorspace_png_p,ITs_image_util_startup,ITs_image_util_cleanup},
        {"ITc_image_util_decode_set_colorspace_gif_p",ITc_image_util_decode_set_colorspace_gif_p,ITs_image_util_startup,ITs_image_util_cleanup},
        {"ITc_image_util_decode_set_colorspace_bmp_p",ITc_image_util_decode_set_colorspace_bmp_p,ITs_image_util_startup,ITs_image_util_cleanup},
+       {"ITc_image_util_decode_set_colorspace_heif_p",ITc_image_util_decode_set_colorspace_heif_p,ITs_image_util_startup,ITs_image_util_cleanup},
        {"ITc_image_util_decode_set_jpeg_downscale_p",ITc_image_util_decode_set_jpeg_downscale_p,ITs_image_util_startup,ITs_image_util_cleanup},
        {"ITc_image_util_encode_set_quality_p",ITc_image_util_encode_set_quality_p,ITs_image_util_startup,ITs_image_util_cleanup},
        {"ITc_image_util_create_destroy_image_p",ITc_image_util_create_destroy_image_p,ITs_image_util_image_startup,ITs_image_util_image_cleanup},