--- /dev/null
+//
+// Copyright (c) 2019 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-image-util-common.h"
+
+#define SAMPLE_GIF_FILE_PATH "sample.gif"
+
+/** @addtogroup itc-image-util
+* @ingroup itc
+* @{
+*/
+
+/**
+* @function ITs_image_util_agif_encode_startup
+* @description Called before each test
+* @parameter NA
+* @return NA
+*/
+void ITs_image_util_agif_encode_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Image_Util_p\\n", __LINE__, API_NAMESPACE);
+#endif
+ return;
+}
+
+/**
+* @function ITs_image_util_agif_encode_cleanup
+* @description Called after each test
+* @parameter NA
+* @return NA
+*/
+void ITs_image_util_agif_encode_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Image_Util_p\\n", __LINE__, API_NAMESPACE);
+#endif
+ return;
+}
+
+//& purpose: Creates and destroys handle of animated GIF encoding.
+//& type: auto
+/**
+* @testcase ITc_image_util_agif_encode_create_destroy_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and destroys handle of animated GIF encoding.
+* @scenario Creates and destroys handle of animated GIF encoding.
+* @apicovered image_util_agif_encode_create, image_util_agif_encode_destroy
+* @passcase When image_util_agif_encode_create and image_util_agif_encode_destroy is successful.
+* @failcase If target API image_util_agif_encode_create or image_util_agif_encode_destroy fails or any precondition API fails.
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_image_util_agif_encode_create_destroy_p(void)
+{
+ START_TEST;
+ image_util_agif_encode_h hImgUtilAgifEncode;
+
+ int nRet = image_util_agif_encode_create(&hImgUtilAgifEncode);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_create", ImageUtilGetError(nRet));
+ CHECK_HANDLE(hImgUtilAgifEncode, "image_util_agif_encode_create");
+
+ nRet = image_util_agif_encode_destroy(hImgUtilAgifEncode);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_destroy", ImageUtilGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: Encodes an image and adds the encoded image to the frames of the animated GIF.
+//& type: auto
+/**
+* @testcase ITc_image_util_agif_encode_add_frame_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Encodes an image and adds the encoded image to the frames of the animated GIF.
+* @scenario Encodes an image and adds the encoded image to the frames of the animated GIF.
+* @apicovered image_util_agif_encode_add_frame
+* @passcase When image_util_agif_encode_add_frame is successful.
+* @failcase If target API image_util_agif_encode_add_frame fails or any precondition API fails.
+* @precondition image_util_agif_encode_create
+* @postcondition image_util_agif_encode_destroy
+*/
+int ITc_image_util_agif_encode_add_frame_p(void)
+{
+ START_TEST;
+ image_util_agif_encode_h hImgUtilAgifEncode = NULL;
+ image_util_decode_h dstHandle = NULL;
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+ unsigned int nDelayTime = 20;
+
+ char pPath[PATH_LEN] = {0,};
+ if ( false == ImageUtilAppendToAppDataPath(SAMPLE_GIF_FILE_PATH, pPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ int nRet = image_util_decode_create(&dstHandle);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
+ 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));
+
+ 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));
+ CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(dstHandle));
+
+ nRet = image_util_decode_destroy(dstHandle);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_agif_encode_create(&hImgUtilAgifEncode);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_create", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+ CHECK_HANDLE_CLEANUP(hImgUtilAgifEncode,"image_util_agif_encode_create", image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_agif_encode_add_frame(hImgUtilAgifEncode, stDecodedImage, nDelayTime);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_add_frame", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_agif_encode_destroy(hImgUtilAgifEncode));
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_agif_encode_destroy(hImgUtilAgifEncode);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_destroy", ImageUtilGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: Saves the animated GIF image to the file.
+//& type: auto
+/**
+* @testcase ITc_image_util_agif_encode_save_to_file_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Saves the animated GIF image to the file.
+* @scenario Saves the animated GIF image to the file.
+* @apicovered image_util_agif_encode_save_to_file
+* @passcase When image_util_agif_encode_save_to_file is successful.
+* @failcase If target API image_util_agif_encode_save_to_file fails or any precondition API fails.
+* @precondition image_util_agif_encode_create
+* @postcondition image_util_agif_encode_destroy
+*/
+int ITc_image_util_agif_encode_save_to_file_p(void)
+{
+ START_TEST;
+ image_util_agif_encode_h hImgUtilAgifEncode = NULL;
+ image_util_decode_h dstHandle = NULL;
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+ unsigned int nDelayTime = 20;
+
+ char pPath[PATH_LEN] = {0,};
+ if ( false == ImageUtilAppendToAppDataPath(SAMPLE_GIF_FILE_PATH, pPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ int nRet = image_util_decode_create(&dstHandle);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
+ 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_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));
+ CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(dstHandle));
+
+ nRet = image_util_decode_destroy(dstHandle);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_agif_encode_create(&hImgUtilAgifEncode);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_create", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+ CHECK_HANDLE_CLEANUP(hImgUtilAgifEncode,"image_util_agif_encode_create", image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_agif_encode_add_frame(hImgUtilAgifEncode, stDecodedImage, nDelayTime);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_add_frame", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_agif_encode_destroy(hImgUtilAgifEncode));
+
+ nRet = image_util_agif_encode_save_to_file(hImgUtilAgifEncode, pPath);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_save_to_file", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_agif_encode_destroy(hImgUtilAgifEncode));
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_agif_encode_destroy(hImgUtilAgifEncode);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_destroy", ImageUtilGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: Saves the animated GIF image to the buffer.
+//& type: auto
+/**
+* @testcase ITc_image_util_agif_encode_save_to_buffer_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Saves the animated GIF image to the buffer.
+* @scenario Saves the animated GIF image to the buffer.
+* @apicovered image_util_agif_encode_save_to_buffer
+* @passcase When image_util_agif_encode_save_to_buffer is successful.
+* @failcase If target API image_util_agif_encode_save_to_buffer fails or any precondition API fails.
+* @precondition image_util_agif_encode_create
+* @postcondition image_util_agif_encode_destroy
+*/
+int ITc_image_util_agif_encode_save_to_buffer_p(void)
+{
+ START_TEST;
+ image_util_agif_encode_h hImgUtilAgifEncode = NULL;
+ image_util_decode_h dstHandle = NULL;
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+ unsigned int nDelayTime = 20;
+ char *pszBuffer = NULL;
+ size_t tBufferSize;
+
+ char pPath[PATH_LEN] = {0,};
+ if ( false == ImageUtilAppendToAppDataPath(SAMPLE_GIF_FILE_PATH, pPath) )
+ {
+ FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ int nRet = image_util_decode_create(&dstHandle);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
+ 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_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));
+ CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(dstHandle));
+
+ nRet = image_util_decode_destroy(dstHandle);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_agif_encode_create(&hImgUtilAgifEncode);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_create", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+ CHECK_HANDLE_CLEANUP(hImgUtilAgifEncode,"image_util_agif_encode_create", image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_agif_encode_add_frame(hImgUtilAgifEncode, stDecodedImage, nDelayTime);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_add_frame", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_agif_encode_destroy(hImgUtilAgifEncode));
+
+ nRet = image_util_agif_encode_save_to_buffer(hImgUtilAgifEncode, &pszBuffer, &tBufferSize);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_save_to_buffer", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_agif_encode_destroy(hImgUtilAgifEncode));
+ CHECK_HANDLE_CLEANUP(hImgUtilAgifEncode,"image_util_agif_encode_save_to_buffer", image_util_destroy_image(stDecodedImage);image_util_agif_encode_destroy(hImgUtilAgifEncode));
+ if(tBufferSize <= 0)
+ {
+ FPRINTF("image_util_agif_encode_save_to_buffer failed, tBufferSize is %d", tBufferSize);
+ image_util_destroy_image(stDecodedImage);
+ image_util_agif_encode_destroy(hImgUtilAgifEncode);
+ return 1;
+ }
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_agif_encode_destroy(hImgUtilAgifEncode);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_agif_encode_destroy", ImageUtilGetError(nRet));
+}
+/** @} */
+/** @} */
bool g_bImageUtilEncodeCompletedCallback;
bool g_bImageUtilDecodeCompletedCallback;
bool g_bImageUtilForeachSupporedColorspace;
+bool g_bImageUtilEncodeToFileCompletedCallback;
+bool g_bImageUtilEncodeToBufferCompletedCallback;
+static image_util_colorspace_e eSupportedColorspace = 0;
image_util_colorspace_e eImageUtilColorspace[] = {
IMAGE_UTIL_COLORSPACE_RGB888,
int enum_size = sizeof(eImageUtilColorspace) / sizeof(eImageUtilColorspace[0]);
int enum_counter = 0;
+typedef struct {
+ unsigned char *pszBuffer;
+ size_t tBufferSize;
+} g_sBufferEncodedImage;
+
+
/**
* @function ITs_image_util_startup
* @description Called before each test
}
}
+/**
+* @function Image_util_supported_colorspace_CallBack
+* @description Called once for each supported image encode/decode colorspace.
+* @parameter[IN] colorspace The colorspace
+* @return NA
+*/
+void Image_util_supported_colorspace_CallBack(image_util_colorspace_e colorspace, void *user_data)
+{
+ g_bImageUtilForeachSupporedColorspace = true;
+ eSupportedColorspace = colorspace;
+#if DEBUG
+ FPRINTF("[Line : %d][%s] Image_util_supported_colorspace_CallBack is called\\n", __LINE__, API_NAMESPACE);
+#endif
+}
+
+/**
+* @function Image_util_encode_to_buffer_completed_Callback
+* @description Callback to encode the image to a buffer with the given encode handle asynchronously.
+* @parameter[IN] image_util_error_e error, unsigned char *buffer, size_t buffer_size, void *user_data
+* @return NA
+*/
+static void Image_util_encode_to_buffer_completed_Callback(image_util_error_e error, unsigned char *buffer, size_t buffer_size, void *user_data)
+{
+#if DEBUG
+ FPRINTF("Image_util_encode_to_buffer_completed_Callback invoked\\n");
+#endif
+ g_sBufferEncodedImage *buf_enc = (g_sBufferEncodedImage *)user_data;
+
+ if (buffer && buffer_size > 0) {
+ buf_enc->pszBuffer = calloc(1, buffer_size);
+ if (!buf_enc->pszBuffer) {
+ FPRINTF("[%d:%s] Memory allocation error\\n", __LINE__, __FUNCTION__);
+ signal_for_async();
+ return;
+ }
+ memcpy(buf_enc->pszBuffer, buffer, buffer_size);
+ buf_enc->tBufferSize = buffer_size;
+ g_bImageUtilEncodeToBufferCompletedCallback = true;
+ }
+
+ signal_for_async();
+}
+
+/**
+* @function Image_util_encode_to_file_completed_Callback
+* @description Callback to encode the image to a file with the given encode handle asynchronously.
+* @parameter[IN] image_util_error_e error, void *user_data
+* @return NA
+*/
+static void Image_util_encode_to_file_completed_Callback(image_util_error_e error, void *user_data)
+{
+#if DEBUG
+ FPRINTF("Image_util_encode_to_file_completed_Callback invoked\\n");
+#endif
+ g_bImageUtilEncodeToFileCompletedCallback = true;
+ signal_for_async();
+}
//& purpose: Creates and destroy a handle to image-util transform.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_transform_create_destroy_p
* @since_tizen 2.3
}
//& purpose: To Set and get the information of the converting
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_transform_set_get_colorspace_p
* @since_tizen 2.3
}
//& purpose: To Set and Get the information of the cropping
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_transform_set_get_crop_area_p
* @since_tizen 2.3
}
//& purpose: To Set and Get the resolution of the image buffer
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_transform_set_get_resolution_p
* @since_tizen 2.3
}
//& purpose: To set and get the information of the rotating
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_transform_set_get_rotation_p
* @since_tizen 2.3
}
//& purpose: To Transform the image for given image-util handle.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_transform_run_p
* @since_tizen 2.3
return 0;
}
//& purpose: To create and destroy a handle to image util decoding.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_decode_create_destroy_p
* @since_tizen 3.0
return 0;
}
//& purpose: To set the input file path from which to decode.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_decode_set_input_path_p
* @since_tizen 3.0
image_util_decode_h stDecHandle = NULL;
image_util_decode_h stDecodedHandle = NULL;
image_util_image_h stDecodedImage = NULL;
- unsigned char *puszImageInputBuffer = NULL;
unsigned char *puszImageOutputbuffer = NULL;
unsigned long long nDecsize;
unsigned long nDecWidth;
unsigned long nDecHeight;
- unsigned long long nEncsize;
+ unsigned char *pszBuffer = NULL;
+ size_t tBufferSize;
+
+ int nRet = image_util_foreach_supported_colorspace(IMAGE_UTIL_JPEG,(image_util_supported_colorspace_cb)Image_util_supported_colorspace_CallBack , NULL);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_foreach_supported_colorspace", ImageUtilGetError(nRet));
+ if ( !g_bImageUtilForeachSupporedColorspace )
+ {
+ FPRINTF("[Line : %d][%s] image_util_foreach_supported_colorspace failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
- int nRet = image_util_decode_create(&stDecHandle);
+ nRet = image_util_decode_create(&stDecHandle);
PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
CHECK_HANDLE(stDecHandle,"image_util_decode_create");
nRet = image_util_decode_set_input_path(stDecHandle, pPath);
PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stDecHandle));
+ nRet = image_util_decode_set_colorspace(stDecHandle, eSupportedColorspace);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_colorspace", ImageUtilGetError(nRet), image_util_decode_destroy(stDecHandle));
+
nRet = image_util_decode_run2(stDecHandle, &stDecodedImage);
PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_run2", ImageUtilGetError(nRet), image_util_decode_destroy(stDecHandle));
CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(stDecHandle));
nRet = image_util_destroy_image(stDecodedImage);
PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
- nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stEncHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stEncHandle,"image_util_encode_create");
-
- nRet = image_util_encode_set_resolution(stEncHandle, nDecWidth, nDecHeight);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_resolution", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
-
- nRet = image_util_encode_set_input_buffer(stEncHandle, puszImageOutputbuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_input_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
+ nRet = image_util_create_image(nDecWidth, nDecHeight, eSupportedColorspace, puszImageOutputbuffer, nDecsize, &stDecodedImage);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_create_image", ImageUtilGetError(nRet));
+ CHECK_HANDLE(stDecodedImage,"image_util_create_image");
- nRet = image_util_encode_set_output_buffer(stEncHandle, &puszImageInputBuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_output_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
+ nRet = image_util_encode_create(IMAGE_UTIL_JPEG, &stEncHandle);
+ PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
+ CHECK_HANDLE_CLEANUP(stEncHandle,"image_util_encode_create", image_util_destroy_image(stDecodedImage));
- nRet = image_util_encode_run(stEncHandle, &nEncsize);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
+ nRet = image_util_encode_run_to_buffer(stEncHandle, stDecodedImage, &pszBuffer, &tBufferSize);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run_to_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle);image_util_destroy_image(stDecodedImage));
+ CHECK_HANDLE_CLEANUP(pszBuffer,"image_util_encode_run_to_buffer", image_util_encode_destroy(stEncHandle);image_util_destroy_image(stDecodedImage));
nRet = image_util_encode_destroy(stEncHandle);
PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
nRet = image_util_decode_create(&stDecodedHandle);
PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
CHECK_HANDLE(stDecodedHandle,"image_util_decode_create");
//Target API
- nRet = image_util_decode_set_input_buffer(stDecodedHandle, puszImageInputBuffer, nEncsize);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet));
+ nRet = image_util_decode_set_input_buffer(stDecodedHandle, pszBuffer, tBufferSize);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_buffer", ImageUtilGetError(nRet), image_util_decode_destroy(stDecodedHandle));
nRet = image_util_decode_destroy(stDecodedHandle);
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.
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_set_resolution_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description To set the resolution to image util decoding.
-* @scenario To set the resolution to image util decoding.
-* @apicovered image_util_encode_set_resolution
-* @passcase When image_util_encode_set_resolution is successful.
-* @failcase If target API image_util_encode_set_resolution fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_set_resolution_p(void)
-{
- START_TEST;
- unsigned long unHeight = 16,unWidth = 9;
- image_util_encode_h stHandle = NULL;
-
- int nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stHandle,"image_util_encode_create");
- //Target API
- nRet = image_util_encode_set_resolution(stHandle, unWidth, unHeight );
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_resolution", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
- return 0;
-}
//& purpose: To create a handle to image util decoding.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_encode_set_png_compression_p
* @since_tizen 3.0
return 0;
}
-//& purpose: To create a handle to image util decoding.
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_set_input_buffer_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description To set the input buffer to image util encoding.
-* @scenario To set the input buffer to image util encoding.
-* @apicovered image_util_encode_set_input_buffer
-* @passcase When image_util_encode_set_input_buffer is successful.
-* @failcase If target API image_util_encode_set_input_buffer fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_set_input_buffer_p(void)
-{
- START_TEST;
-
- image_util_encode_h stEncHandle = NULL;
- image_util_decode_h stDecHandle = NULL;
- image_util_image_h stDecodedImage = NULL;
- unsigned char *puszImageInputBuffer = NULL;
- unsigned char *puszImageOutputbuffer = NULL;
- unsigned long long nDecsize;
- unsigned long nDecWidth;
- unsigned long nDecHeight;
- unsigned long long nEncsize;
-
- int nRet = image_util_decode_create(&stDecHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stDecHandle,"image_util_decode_create");
-
- char pPath[PATH_LEN] = {0,};
- if ( false == ImageUtilAppendToAppDataPath(SAMPLE_FILE_PATH, pPath) )
- {
- FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
- return 1;
- }
-
- nRet = image_util_decode_set_input_path(stDecHandle, pPath);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_set_input_path", ImageUtilGetError(nRet), image_util_decode_destroy(stDecHandle));
-
- nRet = image_util_decode_run2(stDecHandle, &stDecodedImage);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_run2", ImageUtilGetError(nRet), image_util_decode_destroy(stDecHandle));
- CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(stDecHandle));
-
- nRet = image_util_decode_destroy(stDecHandle);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
-
- nRet = image_util_get_image(stDecodedImage, &nDecWidth, &nDecHeight, NULL, &puszImageOutputbuffer, &nDecsize);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_get_image", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
- CHECK_HANDLE_CLEANUP(puszImageOutputbuffer, "image_util_get_image", image_util_destroy_image(stDecodedImage));
-
- nRet = image_util_destroy_image(stDecodedImage);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
-
- nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stEncHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stEncHandle,"image_util_encode_create");
-
- nRet = image_util_encode_set_resolution(stEncHandle, nDecWidth, nDecHeight);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_resolution", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
-
- //Target API
- nRet = image_util_encode_set_input_buffer(stEncHandle, puszImageOutputbuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_input_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
-
- nRet = image_util_encode_set_output_buffer(stEncHandle, &puszImageInputBuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_output_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
-
- nRet = image_util_encode_run(stEncHandle, &nEncsize);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run", ImageUtilGetError(nRet), image_util_encode_destroy(stEncHandle));
-
- nRet = image_util_encode_destroy(stEncHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
- return 0;
-}
-//& purpose: To set the input file path from which to decode.
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_set_output_path_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description To set the output file path from which to encode.
-* @scenario To set the output file path from which to encode.
-* @apicovered image_util_encode_set_output_path
-* @passcase When image_util_encode_set_output_path is successful.
-* @failcase If target API image_util_encode_set_output_path fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_set_output_path_p(void)
-{
- START_TEST;
-
- image_util_encode_h stHandle = NULL;
- int nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stHandle,"image_util_encode_create");
-
- char pPathOutput[PATH_LEN] = {0,};
- if ( false == ImageUtilAppendToAppDataPath(OUTPUT_FILE_PATH, pPathOutput) )
- {
- FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
- return 1;
- }
- //target api
- nRet = image_util_encode_set_output_path(stHandle, pPathOutput);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_output_path", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
- return 0;
-}
-//& purpose: To create a handle to image util decoding.
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_set_output_buffer_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description To set output buffer to image util encoding.
-* @scenario To set output buffer to image util encoding.
-* @apicovered image_util_encode_set_output_buffer
-* @passcase When image_util_encode_set_output_buffer is successful.
-* @failcase If target API image_util_encode_set_output_buffer fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_set_output_buffer_p(void)
-{
- START_TEST;
- image_util_encode_h stHandle = NULL;
- unsigned char *puszImageOutputBuffer = NULL;
-
- int nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stHandle,"image_util_encode_create");
- //target api
- nRet = image_util_encode_set_output_buffer(stHandle, &puszImageOutputBuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_output_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
-
- return 0;
-}
-//& purpose: To create a handle to image util encoding.
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_run_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description To run image util encoding.
-* @scenario To run image util encoding.
-* @apicovered image_util_encode_run
-* @passcase When image_util_encode_run is successful.
-* @failcase If target API image_util_encode_run fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_run_p(void)
-{
- START_TEST;
- image_util_encode_h stHandle = NULL;
- unsigned char *puszImageOutputBuffer = NULL;
- unsigned long long unSize = 0;
- unsigned long unHeight = 16,unWidth = 9;
- image_util_decode_h dstHandle = NULL;
- image_util_image_h stDecodedImage = NULL;
- unsigned long nWidth = 0, nHeight = 0;
-
- int nRet = image_util_decode_create(&dstHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(dstHandle,"image_util_decode_create");
-
- char pPath[PATH_LEN] = {0,};
- if ( false == ImageUtilAppendToAppDataPath(SAMPLE_FILE_PATH, pPath) )
- {
- FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
- 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));
-
- 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));
- CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(dstHandle));
-
- nRet = image_util_decode_destroy(dstHandle);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
-
- nRet = image_util_get_image(stDecodedImage, &nWidth, &nHeight, NULL, &puszImageOutputBuffer, &unSize);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_get_image", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
- CHECK_HANDLE_CLEANUP(puszImageOutputBuffer, "image_util_get_image", image_util_destroy_image(stDecodedImage));
-
- nRet = image_util_destroy_image(stDecodedImage);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
-
- nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stHandle,"image_util_encode_create");
-
- nRet = image_util_encode_set_resolution(stHandle, unWidth, unHeight );
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_resolution", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_set_input_buffer(stHandle, puszImageOutputBuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_input_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- char pPathOutput[PATH_LEN] = {0,};
- if ( false == ImageUtilAppendToAppDataPath(OUTPUT_FILE_PATH, pPathOutput) )
- {
- FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
- return 1;
- }
- nRet = image_util_encode_set_output_path(stHandle, pPathOutput);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_output_path", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- //target api
- nRet = image_util_encode_run(stHandle, &unSize);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
- CHECK_RETURN_CLEANUP(unSize, "image_util_encode_run", image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
-
- free(puszImageOutputBuffer);
- return 0;
-}
//& purpose: To decode the image with the given decode handle.
//& type: auto
/**
-* @testcase ITc_image_util_encode_run_p
+* @testcase ITc_image_util_decode_run2_p
* @since_tizen 5.5
* @author SRID(karanam.s)
* @reviewer SRID(manoj.g2)
#endif
}
-/**
-* @function Image_util_encode_completed_CallBack
-* @description Called when transform is finished just before returning the output.
-* @parameter[IN] The error code of image-util transfrom
-* @parameter[IN] Media packet handle
-* @parameter[IN] The user data passed from the for each function
-* @return NA
-*/
-void Image_util_encode_completed_CallBack(int error_code, void *user_data, unsigned long long size)
-{
- g_bImageUtilEncodeCompletedCallback = true;
-#if DEBUG
- FPRINTF("[Line : %d][%s] Image_util_encode_completed_CallBack is called\\n", __LINE__, API_NAMESPACE);
-#endif
-}
-
-//& purpose: To start encoding of the image and fill the output buffer.
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_run_async_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description To create a handle to image util encoding.
-* @scenario To create a handle to image util encoding.
-* @apicovered image_util_encode_run_async
-* @passcase When image_util_encode_run_async is successful.
-* @failcase If target API image_util_encode_run_async fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_run_async_p(void)
-{
- START_TEST;
- image_util_encode_h stHandle = NULL;
- unsigned char *puszImageOutputBuffer = NULL;
- unsigned char *puszImageInputBuffer = NULL;
- unsigned long unHeight = 16,unWidth = 9;
- image_util_decode_h dstHandle = NULL;
- image_util_image_h stDecodedImage = NULL;
- unsigned long nDecWidth = 0, nDecHeight = 0, nDecsize = 0;
-
- int nRet = image_util_decode_create(&dstHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(dstHandle,"image_util_decode_create");
-
- char pPath[PATH_LEN] = {0,};
- if ( false == ImageUtilAppendToAppDataPath(SAMPLE_FILE_PATH, pPath) )
- {
- FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
- 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));
-
- 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));
- CHECK_HANDLE_CLEANUP(stDecodedImage,"image_util_decode_run2", image_util_decode_destroy(dstHandle));
-
- g_bImageUtilDecodeCompletedCallback = false;
- //target api
- nRet = image_util_decode_run_async2(dstHandle, (image_util_decode_completed2_cb) Image_util_decode_completed2_CallBack, NULL);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_run_async2", ImageUtilGetError(nRet), image_util_decode_destroy(dstHandle));
- wait_for_async();
-
- if ( !g_bImageUtilDecodeCompletedCallback )
- {
- FPRINTF("[Line : %d][%s] Image_util_decode_completed2_CallBack failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
- nRet = image_util_decode_destroy(dstHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
- nRet = image_util_destroy_image(stDecodedImage);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
- return 1;
- }
- else
- {
- #if DEBUG
- FPRINTF("[Line : %d][%s] image_util_decode_run_async2 is successful\\n", __LINE__, API_NAMESPACE);
- #endif
- }
-
- nRet = image_util_decode_destroy(dstHandle);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
-
- nRet = image_util_get_image(stDecodedImage, &nDecWidth, &nDecHeight, NULL, &puszImageOutputBuffer, &nDecsize);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_get_image", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
- CHECK_HANDLE_CLEANUP(puszImageOutputBuffer, "image_util_get_image", image_util_destroy_image(stDecodedImage));
-
- nRet = image_util_destroy_image(stDecodedImage);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
-
- nRet = image_util_encode_create(IMAGE_UTIL_PNG, &stHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stHandle,"image_util_encode_create");
-
- nRet = image_util_encode_set_resolution(stHandle, unWidth, unHeight );
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_resolution", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_set_input_buffer(stHandle, puszImageOutputBuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_input_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_set_output_buffer(stHandle, &puszImageInputBuffer);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_output_buffer", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
- g_bImageUtilEncodeCompletedCallback = false;
- //target api
- nRet = image_util_encode_run_async(stHandle, (image_util_encode_completed_cb) Image_util_encode_completed_CallBack, NULL);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run_async", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
- wait_for_async();
- if ( !g_bImageUtilEncodeCompletedCallback )
- {
- FPRINTF("[Line : %d][%s] Image_util_encode_completed_CallBack failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
- free(puszImageInputBuffer);
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
- return 1;
- }
- else
- {
- #if DEBUG
- FPRINTF("[Line : %d][%s] image_util_encode_run_async is successful\\n", __LINE__, API_NAMESPACE);
- #endif
- }
- free(puszImageInputBuffer);
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
- free(puszImageOutputBuffer);
- return 0;
-}
-
//& purpose: To start decoding of the image with the given decode handle.
//& type: auto
/**
return 0;
}
-/**
-* @function Image_util_supported_colorspace_CallBack
-* @description Called once for each supported image encode/decode colorspace.
-* @parameter[IN] colorspace The colorspace
-* @return true to continue with the next iteration of the loop, \n
-* otherwise @c false to break out of the loop
-*/
-void Image_util_supported_colorspace_CallBack(image_util_colorspace_e colorspace, void *user_data)
-{
- g_bImageUtilForeachSupporedColorspace = true;
-#if DEBUG
- FPRINTF("[Line : %d][%s] Image_util_supported_colorspace_CallBack is called\\n", __LINE__, API_NAMESPACE);
-#endif
-}
//& purpose: Retrieves all supported image encoding/decoding colorspace by invoking a
// callback function once for each one.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_foreach_supported_colorspace_p
* @since_tizen 3.0
return 0;
}
//& purpose: Sets the decoded image colorspace format
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_decode_set_colorspace_p
* @since_tizen 3.0
return 0;
}
-//& purpose: Sets the colorspace format for image encoding
-//& type: auto
-/**
-* @testcase ITc_image_util_encode_set_colorspace_p
-* @since_tizen 3.0
-* @author SRID(manu.tiwari)
-* @reviewer SRID(parshant.v)
-* @type auto
-* @description Sets the colorspace format for image encoding
-* @scenario
-* @apicovered image_util_encode_set_colorspace
-* @passcase When image_util_encode_set_colorspace is successful.
-* @failcase If target API image_util_encode_set_colorspace fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
-*/
-int ITc_image_util_encode_set_colorspace_p(void)
-{
- START_TEST;
- image_util_encode_h stHandle = NULL;
- int nRet = image_util_encode_create(IMAGE_UTIL_JPEG, &stHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(stHandle,"image_util_encode_create");
- //Target API
- nRet = image_util_encode_set_colorspace(stHandle, IMAGE_UTIL_COLORSPACE_RGBA8888);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_colorspace", ImageUtilGetError(nRet), image_util_encode_destroy(stHandle));
-
- nRet = image_util_encode_destroy(stHandle);
- PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
- return 0;
-}
//& purpose: Sets the downscale value at which JPEG image should be decoded.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_decode_set_jpeg_downscale_p
* @since_tizen 3.0
PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_decode_destroy", ImageUtilGetError(nRet));
return 0;
}
+
//& purpose: Sets the quality for JPEG image encoding.
-//& type: auto
+//& type: auto
/**
* @testcase ITc_image_util_encode_set_quality_p
* @since_tizen 3.0
return 0;
}
-#if (defined(MOBILE) || defined(TIZENIOT)) //Starts MOBILE or TIZENIOT
+//& purpose: Encodes the image to a file with the given encode handle.
+//& type: auto
+/**
+* @testcase ITc_image_util_encode_run_to_file_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Encodes the image to a file with the given encode handle.
+* @scenario The function executes synchronously.
+* @apicovered image_util_encode_run_to_file
+* @passcase When image_util_encode_run_to_file is successful.
+* @failcase If target API image_util_encode_run_to_file fails or any precondition API fails.
+* @precondition image_util_encode_create
+* @postcondition image_util_encode_destroy
+*/
+int ITc_image_util_encode_run_to_file_p(void)
+{
+ START_TEST;
-//& purpose: To set the time delay between each frame in the encoded animated gif image
-//& type: auto
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+
+ char pPath[PATH_LEN] = {0,};
+
+ int nRet = ImageUtilEncodeRunSetUp(&stDecodedImage, &stHandle, pPath);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "ImageUtilEncodeRunSetUp", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_encode_run_to_file(stHandle, stDecodedImage, pPath);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run_to_file", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_encode_destroy(stHandle));
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_encode_destroy(stHandle);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
+
+ return 0;
+
+}
+
+//& purpose: Encodes the image to a buffer with the given encode handle.
+//& type: auto
/**
-* @testcase ITc_image_util_encode_set_gif_frame_delay_time_p
-* @since_tizen 3.0
-* @author SRID(nibha.sharma)
-* @reviewer SRID(parshant.v)
+* @testcase ITc_image_util_encode_run_to_buffer_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
* @type auto
-* @description Sets the time delay between each frame in the encoded animated gif image
-* @scenario Sets the time delay between each frame in the encoded animated gif image
-* @apicovered image_util_encode_set_gif_frame_delay_time
-* @passcase When image_util_encode_set_gif_frame_delay_time is successful.
-* @failcase If target API image_util_encode_set_gif_frame_delay_time fails or any precondition API fails.
-* @precondition NA
-* @postcondition NA
+* @description Encodes the image to a buffer with the given encode handle.
+* @scenario The function executes synchronously.
+* @apicovered image_util_encode_run_to_buffer
+* @passcase When image_util_encode_run_to_buffer is successful.
+* @failcase If target API image_util_encode_run_to_buffer fails or any precondition API fails.
+* @precondition image_util_encode_create
+* @postcondition image_util_encode_destroy
*/
-int ITc_image_util_encode_set_gif_frame_delay_time_p(void)
+int ITc_image_util_encode_run_to_buffer_p(void)
{
START_TEST;
-
- image_util_encode_h hImageHandle = NULL;
- unsigned long long nDelayTime = 0.01;
- int nRet = image_util_encode_create(IMAGE_UTIL_GIF, &hImageHandle);
- PRINT_RESULT(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_create", ImageUtilGetError(nRet));
- CHECK_HANDLE(hImageHandle,"image_util_encode_create");
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+ unsigned char *pszBuffer = NULL;
+ size_t tBufferSize;
+ char pPath[PATH_LEN] = {0,};
+ int nRet = ImageUtilEncodeRunSetUp(&stDecodedImage, &stHandle, pPath);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "ImageUtilEncodeRunSetUp", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
- //Target API
- nRet = image_util_encode_set_gif_frame_delay_time(hImageHandle, nDelayTime);
- PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_set_gif_frame_delay_time", ImageUtilGetError(nRet), image_util_encode_destroy(hImageHandle));
+ nRet = image_util_encode_run_to_buffer(stHandle, stDecodedImage, &pszBuffer, &tBufferSize);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run_to_buffer", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_encode_destroy(stHandle));
+ CHECK_HANDLE_CLEANUP(pszBuffer,"image_util_encode_run_to_buffer", image_util_destroy_image(stDecodedImage);image_util_encode_destroy(stHandle));
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_encode_destroy(stHandle);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: Encodes the image to a file with the given encode handle asynchronously.
+//& type: auto
+/**
+* @testcase ITc_image_util_encode_run_async_to_file_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Encodes the image to a file with the given encode handle asynchronously.
+* @scenario The function executes asynchronously.
+* @apicovered image_util_encode_run_async_to_file
+* @passcase When image_util_encode_run_async_to_file is successful.
+* @failcase If target API image_util_encode_run_async_to_file fails or any precondition API fails.
+* @precondition image_util_encode_create
+* @postcondition image_util_encode_destroy
+*/
+int ITc_image_util_encode_run_async_to_file_p(void)
+{
+ START_TEST;
+
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+ g_bImageUtilEncodeToFileCompletedCallback = false;
+ char pPath[PATH_LEN] = {0,};
+
+ int nRet = ImageUtilEncodeRunSetUp(&stDecodedImage, &stHandle, pPath);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "ImageUtilEncodeRunSetUp", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
- nRet = image_util_encode_destroy(hImageHandle);
+ nRet = image_util_encode_run_async_to_file(stHandle, stDecodedImage, pPath, Image_util_encode_to_file_completed_Callback, NULL);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run_async_to_file", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_encode_destroy(stHandle));
+
+ wait_for_async();
+
+ if ( !g_bImageUtilEncodeToFileCompletedCallback )
+ {
+ FPRINTF("[Line : %d][%s] Image_util_encode_to_file_completed_Callback failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
+ nRet = image_util_encode_destroy(stHandle);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+ return 1;
+ }
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_encode_destroy(stHandle);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
+}
+
+//& purpose: Encodes the image to a buffer with the given encode handle asynchronously.
+//& type: auto
+/**
+* @testcase ITc_image_util_encode_run_async_to_buffer_p
+* @since_tizen 5.5
+* @author SRID(karanam.s)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Encodes the image to a buffer with the given encode handle asynchronously.
+* @scenario The function executes asynchronously.
+* @apicovered image_util_encode_run_async_to_buffer
+* @passcase When image_util_encode_run_async_to_buffer is successful.
+* @failcase If target API image_util_encode_run_async_to_buffer fails or any precondition API fails.
+* @precondition image_util_encode_create
+* @postcondition image_util_encode_destroy
+*/
+int ITc_image_util_encode_run_async_to_buffer_p(void)
+{
+ START_TEST;
+ image_util_decode_h dstHandle = NULL;
+ image_util_image_h stDecodedImage = NULL;
+ image_util_encode_h stHandle = NULL;
+ g_bImageUtilEncodeToBufferCompletedCallback = false;
+ g_sBufferEncodedImage sBufencImg = { NULL, 0 };
+ char pPath[PATH_LEN] = {0,};
+
+
+ int nRet = ImageUtilEncodeRunSetUp(&stDecodedImage, &stHandle, pPath);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "ImageUtilEncodeRunSetUp", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage));
+
+ nRet = image_util_encode_run_async_to_buffer(stHandle, stDecodedImage, Image_util_encode_to_buffer_completed_Callback, &sBufencImg);
+ PRINT_RESULT_CLEANUP(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_run_async_to_buffer", ImageUtilGetError(nRet), image_util_destroy_image(stDecodedImage);image_util_encode_destroy(stHandle));
+
+ wait_for_async();
+
+ if ( !g_bImageUtilEncodeToBufferCompletedCallback )
+ {
+ FPRINTF("[Line : %d][%s] Image_util_encode_to_buffer_completed_Callback failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
+ nRet = image_util_encode_destroy(stHandle);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+ return 1;
+ }
+
+ nRet = image_util_destroy_image(stDecodedImage);
+ PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_destroy_image", ImageUtilGetError(nRet));
+
+ nRet = image_util_encode_destroy(stHandle);
PRINT_RESULT_NORETURN(IMAGE_UTIL_ERROR_NONE, nRet, "image_util_encode_destroy", ImageUtilGetError(nRet));
return 0;
}
-#endif // End MOBILE or TIZENIOT
+
/** @} */
/** @} */