From: hjkim Date: Wed, 24 Jan 2024 00:59:51 +0000 (+0900) Subject: [ACR-1818]Remove deprecated APIs X-Git-Tag: accepted/tizen/unified/20240307.171912~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78903d6a1d1e566b665eb7ff67fffb9cbc60bcfa;p=platform%2Fcore%2Fapi%2Fimage-util.git [ACR-1818]Remove deprecated APIs //image_util.h int image_util_calculate_buffer_size(int width, int height, image_util_colorspace_e colorspace , unsigned int *size) int image_util_transform_set_hardware_acceleration(transformation_h handle, bool mode) //image_util_encode.h int image_util_encode_set_resolution(image_util_encode_h handle, unsigned long width, unsigned long height) int image_util_encode_set_colorspace(image_util_encode_h handle, image_util_colorspace_e colorspace) int image_util_encode_set_webp_lossless(image_util_encode_h handle, bool lossless) int image_util_encode_set_gif_frame_delay_time(image_util_encode_h handle, unsigned long long delay_time) int image_util_encode_set_input_buffer(image_util_encode_h handle, const unsigned char *src_buffer) int image_util_encode_set_output_path(image_util_encode_h handle, const char *path) int image_util_encode_set_output_buffer(image_util_encode_h handle, unsigned char **dst_buffer) int image_util_encode_run(image_util_encode_h handle, unsigned long long *size) int image_util_encode_run_async(image_util_encode_h handle, image_util_encode_completed_cb completed_cb, void *user_data) //image_util_decode.h int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned char **dst_buffer) int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsigned long *height, unsigned long long *size) int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_completed_cb callback, void *user_data) //image_util_type.h typedef void (*image_util_encode_completed_cb) (int error_code, void *user_data, unsigned long long size) typedef void (*image_util_decode_completed_cb) (int error_code, void *user_data, unsigned long width, unsigned long height, unsigned long long size) Change-Id: Ib96c537ca31be5a284c335018453f285216220be --- diff --git a/doc/image_util_doc.h b/doc/image_util_doc.h index 84a4f14..db59dcd 100755 --- a/doc/image_util_doc.h +++ b/doc/image_util_doc.h @@ -122,10 +122,6 @@ * * * - * The decoding of a jpeg/png/gif/bmp/webp/heif/jpeg-xl image located at a given path, to a buffer can be done by calling #image_util_decode_run() function and decoding of a jpeg/png/gif/bmp/webp/heif/jpeg-xl image on memory - * can be done by calling #image_util_decode_set_output_buffer(). Similarly, for encoding #image_util_encode_run() and #image_util_encode_set_output_buffer() functions can be called - * to encode an image buffer to a jpeg/png/gif/bmp/webp/jpeg-xl image and a buffer respectively. - * * @subsection CAPI_MEDIA_IMAGE_UTIL_ENCODE_DECODE_FOREACH_OPERATIONS Foreach Operations *
* diff --git a/include/image_util.h b/include/image_util.h index b7f6f4c..ee7793c 100644 --- a/include/image_util.h +++ b/include/image_util.h @@ -36,26 +36,6 @@ extern "C" * @{ */ -/** -* @deprecated Deprecated since 5.5. -* @brief Calculates the size of the image buffer for the specified resolution and colorspace. -* @since_tizen 2.3 -* -* @param[in] width The image width -* @param[in] height The image height -* @param[in] colorspace The image colorspace -* @param[out] size The Calculated buffer size -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* -* @see image_util_transform_run() -*/ -int image_util_calculate_buffer_size(int width, int height, image_util_colorspace_e colorspace , unsigned int *size) TIZEN_DEPRECATED_API; - /** * @brief Extracts representative color from an image buffer. * @since_tizen 3.0 @@ -109,34 +89,6 @@ int image_util_extract_color_from_memory(const unsigned char *image_buffer, int */ int image_util_transform_create(transformation_h *handle); -/** -* @deprecated Deprecated since 5.0. -* @brief Sets the image util's accurate mode. -* @details This function set if you use hardware acceleration or not. -* @since_tizen 2.3 -* -* -* @remarks The value returned will be #IMAGE_UTIL_ERROR_NOT_SUPPORTED, if H/W acceleration doesn't support on the device. -* -* @param[in] handle The handle for transforming an image -* @param[in] mode Set @c true, user can use the hardware acceleration\n -* otherwise set @c false if user can only software image processing -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED The application does not have the hardware acceleration -* -* @pre image_util_transform_create(). -* -* @see image_util_transform_create() -* @see image_util_transform_destroy() -*/ -int image_util_transform_set_hardware_acceleration(transformation_h handle, bool mode) TIZEN_DEPRECATED_API; - /** * @brief Sets the information of the converting. * @since_tizen 2.3 diff --git a/include/image_util_decode.h b/include/image_util_decode.h index 0742ac0..d07b02e 100644 --- a/include/image_util_decode.h +++ b/include/image_util_decode.h @@ -125,40 +125,6 @@ int image_util_decode_set_input_path(image_util_decode_h handle, const char *pat */ int image_util_decode_set_input_buffer(image_util_decode_h handle, const unsigned char *src_buffer, unsigned long long src_size); -/** -* @deprecated Deprecated since 5.5. -* @brief Sets the output buffer to which the decoded buffer will be written to. -* @since_tizen 3.0 -* -* @remarks Either image_util_decode_set_input_path() or image_util_decode_set_input_buffer() should be set.\n -* By default the decoded output buffer colorspace will be #IMAGE_UTIL_COLORSPACE_RGBA8888. -* Use image_util_decode_set_colorspace() to change the colorspace. -* @a dst_buffer should be released after @c image_util_decode_run() or @c image_util_decode_run_async(). -* -* @param[in] handle The handle of image util decoding -* @param[in] dst_buffer The decoded output buffer -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_decode_create() -* -* @post image_util_decode_run() / image_util_decode_run_async() -* @post image_util_decode_destroy() -* -* @see image_util_decode_create() -* @see image_util_decode_set_input_path() -* @see image_util_decode_set_input_buffer() -* @see image_util_decode_run() -* @see image_util_decode_run_async() -* @see image_util_decode_destroy() -*/ -int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned char **dst_buffer) TIZEN_DEPRECATED_API; - /** * @brief Sets the decoded image colorspace format. * @since_tizen 3.0 @@ -225,75 +191,6 @@ int image_util_decode_set_colorspace(image_util_decode_h handle, image_util_colo */ int image_util_decode_set_jpeg_downscale(image_util_decode_h handle, image_util_scale_e down_scale); -/** -* @deprecated Deprecated since 5.5. Use image_util_decode_run2() instead. -* @brief Starts decoding of the image and fills the output buffer set using image_util_decode_set_output_buffer(). -* @since_tizen 3.0 -* -* @remarks The output will be stored in the pointer set using image_util_decode_set_output_buffer().\n -* The function executes synchronously.\n -* When any of the pre-condition are not called, #IMAGE_UTIL_ERROR_INVALID_PARAMETER is returned. -* -* @param[in] handle The handle of image util decoding -* @param[out] width Width of the decoded image -* @param[out] height Height of the decoded image -* @param[out] size Size of the decoded image -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_decode_create() -* @pre image_util_decode_set_input_buffer() / image_util_decode_set_input_path(). -* @pre image_util_decode_set_output_buffer() -* -* @post image_util_decode_destroy() -* -* @see image_util_decode_create() -* @see image_util_decode_set_input_path() -* @see image_util_decode_set_input_buffer() -* @see image_util_decode_set_output_buffer() -* @see image_util_decode_destroy() -*/ -int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsigned long *height, unsigned long long *size) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_decode_run_async2() instead. -* @brief Starts decoding of the image and fills the output buffer set using image_util_decode_set_output_buffer(). -* @since_tizen 3.0 -* -* @remarks The output will be stored in the pointer set using image_util_decode_set_output_buffer().\n -* The function executes asynchronously, which contains complete callback.\n -* When any of the pre-condition are not called, #IMAGE_UTIL_ERROR_INVALID_PARAMETER is returned. -* -* @param[in] handle The handle of image util decoding -* @param[in] callback The callback function to be invoked -* @param[in] user_data The user data to be passed to the callback function -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_decode_create() -* @pre image_util_decode_set_input_buffer() / image_util_decode_set_input_path(). -* @pre image_util_decode_set_output_buffer() -* -* @post image_util_decode_destroy() -* -* @see image_util_decode_create() -* @see image_util_decode_set_input_path() -* @see image_util_decode_set_input_buffer() -* @see image_util_decode_set_output_buffer() -* @see image_util_decode_destroy() -*/ -int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API; - /** * @brief Decodes the image with the given decode handle. * @details This function decodes the image synchronously. diff --git a/include/image_util_encode.h b/include/image_util_encode.h index 9aefb99..aeb8fe3 100644 --- a/include/image_util_encode.h +++ b/include/image_util_encode.h @@ -61,77 +61,6 @@ extern "C" */ int image_util_encode_create(image_util_type_e image_type, image_util_encode_h *handle); -/** -* @deprecated Deprecated since 5.5. Use image_util_create_image() instead. -* @brief Sets the resolution of the encoded image. -* @since_tizen 3.0 -* -* @remarks This should be called before calling image_util_encode_run().\n -* While encoding animated GIF image, resolution should be set for each frame. -* -* @param[in] handle The handle of image util encoding -* @param[in] width Width of the original image -* @param[in] height Height of the original image -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_set_output_path() -* @see image_util_encode_set_output_buffer() -* @see image_util_encode_run() -* @see image_util_encode_run_async() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_resolution(image_util_encode_h handle, unsigned long width, unsigned long height) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_create_image() instead. -* @brief Sets the colorspace format for image encoding. -* @since_tizen 3.0 -* -* @remarks The default colorspace is #IMAGE_UTIL_COLORSPACE_RGBA8888.\n -* Use image_util_foreach_supported_colorspace() to get supported colorspaces for each image format.\n -* Errors would be returned if not supported. -* -* @param[in] handle The handle of image util encoding -* @param[in] colorspace The colorspace of the input image to encode -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_supported_colorspace_cb() -* @see image_util_foreach_supported_colorspace() -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_set_output_path() -* @see image_util_encode_set_output_buffer() -* @see image_util_encode_run() -* @see image_util_encode_run_async() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_colorspace(image_util_encode_h handle, image_util_colorspace_e colorspace) TIZEN_DEPRECATED_API; - /** * @brief Sets the quality for image encoding. * @since_tizen 3.0 @@ -151,7 +80,7 @@ int image_util_encode_set_colorspace(image_util_encode_h handle, image_util_colo * * @pre image_util_encode_create() * -* @post image_util_encode_run() / image_util_encode_run_async() +* @post image_util_encode_run_to_file() / image_util_encode_run_to_buffer() * @post image_util_encode_destroy() * * @see image_util_encode_create() @@ -182,7 +111,7 @@ int image_util_encode_set_quality(image_util_encode_h handle, int quality); * * @pre image_util_encode_create() * -* @post image_util_encode_run() / image_util_encode_run_async() +* @post image_util_encode_run_to_file() / image_util_encode_run_to_buffer() * @post image_util_encode_destroy() * * @see image_util_encode_create() @@ -194,38 +123,6 @@ int image_util_encode_set_quality(image_util_encode_h handle, int quality); */ int image_util_encode_set_png_compression(image_util_encode_h handle, image_util_png_compression_e compression); -/** -* @deprecated Deprecated since 7.0. Use image_util_encode_set_lossless() instead. -* @brief Sets lossless compression of WEBP images. -* @since_tizen 6.0 -* -* @remarks If application does not set this, then the default value is @c false. -* -* @param[in] handle The handle of image util encoding -* @param[in] lossless The flag determining whether the compression is lossless or lossy: @c true for lossless, @c false for lossy -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_run_to_file() -* @see image_util_encode_run_to_buffer() -* @see image_util_encode_run_async_to_file() -* @see image_util_encode_run_async_to_buffer() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_webp_lossless(image_util_encode_h handle, bool lossless) TIZEN_DEPRECATED_API; - /** * @brief Sets lossless compression of WEBP and JPEG-XL images. * @since_tizen 7.0 @@ -245,7 +142,7 @@ int image_util_encode_set_webp_lossless(image_util_encode_h handle, bool lossles * * @pre image_util_encode_create() * -* @post image_util_encode_run() / image_util_encode_run_async() +* @post image_util_encode_run_to_file() / image_util_encode_run_to_buffer() * @post image_util_encode_destroy() * * @see image_util_encode_create() @@ -257,228 +154,6 @@ int image_util_encode_set_webp_lossless(image_util_encode_h handle, bool lossles */ int image_util_encode_set_lossless(image_util_encode_h handle, bool lossless); -/** -* @deprecated Deprecated since 5.5. Use image_util_agif_encode_add_frame() instead. -* @brief Sets the time delay between each frame in the encoded animated GIF image. -* @since_tizen 3.0 -* -* @remarks In case animated GIF image if this is not set then there will be no delay between each frame.\n -* This should be set for each frame in the animated GIF image.\n -* This can be set a different value for each frame, which results in different delay time between different frames. -* -* @param[in] handle The handle of image util encoding -* @param[in] delay_time Time delay between each frame in the encoded image, in 0.01sec units. -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_set_output_path() -* @see image_util_encode_set_output_buffer() -* @see image_util_encode_run() -* @see image_util_encode_run_async() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_gif_frame_delay_time(image_util_encode_h handle, unsigned long long delay_time) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_create_image() instead. -* @brief Sets the input buffer from which to encode. -* @since_tizen 3.0 -* -* @remarks Either image_util_encode_set_output_path() or image_util_encode_set_output_buffer() should be set.\n -* By default the input buffer colorspace will be considered as #IMAGE_UTIL_COLORSPACE_RGBA8888.\n -* Use image_util_encode_set_colorspace() to change the colorspace.\n -* While encoding animated GIF image, input buffer should be set for each frame. -* -* @param[in] handle The handle of image util decoding -* @param[in] src_buffer The input image buffer -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_output_path() -* @see image_util_encode_set_output_buffer() -* @see image_util_encode_run() -* @see image_util_encode_run_async() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_input_buffer(image_util_encode_h handle, const unsigned char *src_buffer) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_encode_run_to_file() or image_util_encode_run_async_to_file() instead. -* @brief Sets the output path to which to encoded buffer will be written to. -* @since_tizen 3.0 -* -* @remarks One of image_util_encode_set_output_path() or image_util_encode_set_output_buffer() should be set.\n -* If both are set then the latest output set is considered.\n -* %http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n -* %http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. -* -* @param[in] handle The handle of image util encoding -* @param[in] path The output file path -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* @retval #IMAGE_UTIL_ERROR_NO_SUCH_FILE No such file -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_run() -* @see image_util_encode_run_async() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_output_path(image_util_encode_h handle, const char *path) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_encode_run_to_buffer() or image_util_encode_run_async_to_buffer() instead. -* @brief Sets the output buffer to which to encoded buffer will be written to. -* @since_tizen 3.0 -* -* @remarks One of image_util_encode_set_output_path() or image_util_encode_set_output_buffer() should be set.\n -* If both are set then the latest output set is considered.\n -* Before 4.0, output buffer setting is not supported for BMP. #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT will be returned for BMP.\n -* Since 4.0, output buffer setting has been supported for BMP. Applications can set the output buffer to write encoded BMP.\n -* In case of GIF encoding, the output buffer will be completely available only after image_util_encode_destroy(). -* @a dst_buffer should be released after @c image_util_encode_run() or @c image_util_encode_run_async(). -* -* @param[in] handle The handle of image util encoding -* @param[in] dst_buffer The output image buffer -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format -* -* @pre image_util_encode_create() -* -* @post image_util_encode_run() / image_util_encode_run_async() -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_run() -* @see image_util_encode_run_async() -* @see image_util_encode_destroy() -*/ -int image_util_encode_set_output_buffer(image_util_encode_h handle, unsigned char **dst_buffer) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_encode_run_to_file() or image_util_encode_run_to_buffer() instead. -* @brief Starts encoding of the image and fills the output buffer, set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path(). -* @since_tizen 3.0 -* -* @remarks The output will be stored in the pointer set to image_util_encode_set_output_buffer() or image_util_encode_set_output_path().\n -* The function executes synchronously.\n -* When any of the functions at the pre-condition are not called, #IMAGE_UTIL_ERROR_INVALID_PARAMETER is returned.\n -* In case of animated GIF encoding, image_util_encode_set_resolution(), image_util_encode_set_input_buffer() and\n -* image_util_encode_set_gif_frame_delay_time() MUST be called for each frame. -* In case of animated GIF encoding, call image_util_encode_run() for each frame to encode progressively. -* -* @param[in] handle The handle of image util encoding -* @param[out] size Size of the encoded image -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_encode_create() -* @pre image_util_encode_set_resolution() -* @pre image_util_encode_set_input_buffer() -* @pre image_util_encode_set_output_buffer() / image_util_encode_set_output_path() -* -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_set_gif_frame_delay_time() -* @see image_util_encode_set_output_path() -* @see image_util_encode_set_output_buffer() -* @see image_util_encode_destroy() -*/ -int image_util_encode_run(image_util_encode_h handle, unsigned long long *size) TIZEN_DEPRECATED_API; - -/** -* @deprecated Deprecated since 5.5. Use image_util_encode_run_async_to_file() or image_util_encode_run_async_to_buffer() instead. -* @brief Starts encoding of the image and fills the output buffer, set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path(). -* @since_tizen 3.0 -* -* @remarks The output will be stored in the pointer set to image_util_encode_set_output_buffer() or image_util_encode_set_output_path().\n -* The function executes asynchronously, which contains complete callback.\n -* When any of the functions at the pre-condition are not called, #IMAGE_UTIL_ERROR_INVALID_PARAMETER is returned.\n -* In case of animated GIF encoding, image_util_encode_set_resolution(), image_util_encode_set_input_buffer() and\n -* image_util_encode_set_gif_frame_delay_time() MUST be called for each frame. -* In case of animated GIF encoding, call image_util_encode_run_async() for each frame to encode progressively. -* -* @param[in] handle The handle of image util encoding -* @param[in] callback The callback function to be invoked -* @param[in] user_data The user data to be passed to the callback function -* -* @return @c 0 on success, -* otherwise a negative error value -* -* @retval #IMAGE_UTIL_ERROR_NONE Successful -* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* -* @pre image_util_encode_create() -* @pre image_util_encode_set_resolution() -* @pre image_util_encode_set_input_buffer() -* @pre image_util_encode_set_output_buffer() / image_util_encode_set_output_path() -* -* @post image_util_encode_destroy() -* -* @see image_util_encode_create() -* @see image_util_encode_set_resolution() -* @see image_util_encode_set_input_buffer() -* @see image_util_encode_set_gif_frame_delay_time() -* @see image_util_encode_set_output_path() -* @see image_util_encode_set_output_buffer() -* @see image_util_encode_destroy() -*/ -int image_util_encode_run_async(image_util_encode_h handle, image_util_encode_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API; - /** * @brief Encodes the image and save it to a file in the given encoding handle. * @details The function executes synchronously. diff --git a/include/image_util_type.h b/include/image_util_type.h index 8b0e2ea..a271304 100644 --- a/include/image_util_type.h +++ b/include/image_util_type.h @@ -213,28 +213,6 @@ typedef enum { IMAGE_UTIL_PNG_COMPRESSION_9 = 9 /**< Compression Level 9. Best compression */ } image_util_png_compression_e; -/** -* @ingroup CAPI_MEDIA_IMAGE_UTIL_ENCODE_DECODE_MODULE -* @deprecated Deprecated since 5.5. -* @brief Called when Image-util decoding is finished just before returning the output. -* @since_tizen 3.0 -* -* @remarks The output will be stored in the pointer set using image_util_decode_set_output_buffer() after this callback. \n -* The callback is called in a separate thread(not in the main loop). -* -* @param[in] error_code The error code of image util decoding -* #IMAGE_UTIL_ERROR_NONE Successful -* #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* @param[in] user_data The user data passed from the callback registration function -* @param[in] width Width of the decoded image -* @param[in] height Height of the decoded image -* @param[in] size Size of the decoded image -* -* @pre image_util_decode_run_async() will invoke this function. -*/ -typedef void (*image_util_decode_completed_cb) (int error_code, void *user_data, unsigned long width, unsigned long height, unsigned long long size); - /** * @ingroup CAPI_MEDIA_IMAGE_UTIL_ENCODE_DECODE_MODULE * @brief Called when image_util_decode_run_async2() finishes decoding an image. @@ -258,26 +236,6 @@ typedef void (*image_util_decode_completed_cb) (int error_code, void *user_data, */ typedef void (*image_util_decode_completed2_cb) (int error_code, image_util_image_h image, void *user_data); -/** -* @ingroup CAPI_MEDIA_IMAGE_UTIL_ENCODE_DECODE_MODULE -* @deprecated Deprecated since 5.5. Use image_util_encode_run_async_to_file() or image_util_encode_run_async_to_buffer() instead. -* @brief Called when Image-util encoding is finished just before returning the output. -* @since_tizen 3.0 -* -* @remarks The output will be stored in the pointer set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path() after this callback. \n -* The callback is called in a separate thread(not in the main loop). -* -* @param[in] error_code The error code of image util encoding -* #IMAGE_UTIL_ERROR_NONE Successful -* #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter -* #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation -* @param[in] user_data The user data passed from the callback registration function -* @param[in] size Size of the encoded image -* -* @pre image_util_encode_run() will invoke this function. -*/ -typedef void (*image_util_encode_completed_cb) (int error_code, void *user_data, unsigned long long size) TIZEN_DEPRECATED_API; - /** * @ingroup CAPI_MEDIA_IMAGE_UTIL_ENCODE_DECODE_MODULE * @brief Called when image encoding is finished just after storing the output to the file. diff --git a/src/image_util.c b/src/image_util.c index 2eca6bc..2c20044 100644 --- a/src/image_util.c +++ b/src/image_util.c @@ -207,23 +207,6 @@ int image_util_transform_create(transformation_h * handle) return IMAGE_UTIL_ERROR_NONE; } -int image_util_transform_set_hardware_acceleration(transformation_h handle, bool mode) -{ - transformation_s *_handle = (transformation_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_transform_set_hardware_acceleration() is deprecated and will be removed from next release."); - image_util_debug("Set hardware_acceleration %d", mode); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); -#ifndef ENABLE_HW_ACCELERATION - image_util_retvm_if((mode == true), IMAGE_UTIL_ERROR_NOT_SUPPORTED, "hardware acceleration is not supported"); -#endif - - image_util_debug("Set hardware_acceleration %d", mode); - - return IMAGE_UTIL_ERROR_NONE; -} - int image_util_transform_set_colorspace(transformation_h handle, image_util_colorspace_e colorspace) { transformation_s *_handle = (transformation_s *) handle; @@ -497,24 +480,6 @@ int image_util_destroy_image(image_util_image_h image) return IMAGE_UTIL_ERROR_NONE; } -int image_util_calculate_buffer_size(int width, int height, image_util_colorspace_e colorspace, unsigned int *size) -{ - int err = IMAGE_UTIL_ERROR_NONE; - size_t size_ptr = 0; - - image_util_warning("DEPRECATION WARNING: image_util_calculate_buffer_size() is deprecated and will be removed from next release."); - - image_util_retvm_if((width <= 0 || height <= 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid width or Invalid height"); - image_util_retvm_if(!_is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace"); - image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid size"); - - err = mm_util_get_image_size(TYPECAST_COLOR(colorspace), width, height, &size_ptr); - - *size = (unsigned int)size_ptr; - - return _image_error_capi(err); -} - int image_util_extract_color_from_memory(const unsigned char *image_buffer, int width, int height, unsigned char *rgb_r, unsigned char *rgb_g, unsigned char *rgb_b) { int ret = IMAGE_UTIL_ERROR_NONE; diff --git a/src/image_util_decode.c b/src/image_util_decode.c index 2844c57..371dc12 100644 --- a/src/image_util_decode.c +++ b/src/image_util_decode.c @@ -27,11 +27,6 @@ #include #include -typedef struct { - void *user_data; - image_util_decode_completed_cb image_decode_completed_cb; -} decode_cb_s; - typedef struct { void *user_data; image_util_decode_completed2_cb image_decode_completed_cb; @@ -45,7 +40,6 @@ typedef struct { char *path; image_util_colorspace_e colorspace; image_util_scale_e down_scale; - decode_cb_s *_decode_cb; /* for async */ GThread *thread; @@ -208,22 +202,6 @@ int image_util_decode_set_input_buffer(image_util_decode_h handle, const unsigne return err; } -int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned char **dst_buffer) -{ - decode_s *_handle = (decode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_decode_set_output_buffer() is deprecated and will be removed from next release."); - - image_util_fenter(); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(!dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dst_buffer"); - - _handle->dst_buffer = (void **)dst_buffer; - - return IMAGE_UTIL_ERROR_NONE; -} - int image_util_decode_set_colorspace(image_util_decode_h handle, image_util_colorspace_e colorspace) { int err = IMAGE_UTIL_ERROR_NONE; @@ -253,116 +231,6 @@ int image_util_decode_set_jpeg_downscale(image_util_decode_h handle, image_util_ return IMAGE_UTIL_ERROR_NONE; } -static int __image_util_decode_internal(decode_s *_handle, mm_util_image_h *image_info) -{ - int err = MM_UTIL_ERROR_NONE; - int colorspace = 0; - int downscale = 0; - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid _handle"); - image_util_retvm_if(!image_info, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_info"); - - image_util_fenter(); - - colorspace = TYPECAST_COLOR_BY_TYPE(_handle->colorspace, _handle->image_type); - - switch (_handle->image_type) { - case IMAGE_UTIL_JPEG: - { - downscale = _convert_decode_scale_tbl[_handle->down_scale]; - - if (_handle->path) - err = mm_util_decode_from_jpeg_file(_handle->path, colorspace, downscale, image_info); - else - err = mm_util_decode_from_jpeg_memory(_handle->src_buffer, _handle->src_size, colorspace, downscale, image_info); - } - break; - - case IMAGE_UTIL_GIF: - { - if (_handle->path) - err = mm_util_decode_from_gif_file(_handle->path, image_info); - else - err = mm_util_decode_from_gif_memory(_handle->src_buffer, _handle->src_size, image_info); - } - break; - - case IMAGE_UTIL_PNG: - /* fall through */ - case IMAGE_UTIL_BMP: - /* fall through */ - case IMAGE_UTIL_WEBP: - { - if (_handle->path) - err = mm_util_decode_image_from_file(_handle->path, colorspace, image_info); - else - err = mm_util_decode_image_from_buffer(_handle->src_buffer, _handle->src_size, colorspace, image_info); - } - break; - - case IMAGE_UTIL_HEIF: - { - if (_handle->path) - err = mm_util_decode_heif_from_file(_handle->path, colorspace, image_info); - else - err = mm_util_decode_heif_from_buffer(_handle->src_buffer, _handle->src_size, colorspace, image_info); - } - break; - - case IMAGE_UTIL_JPEG_XL: - { - if (_handle->path) - err = mm_util_decode_jxl_from_file(_handle->path, colorspace, image_info); - else - err = mm_util_decode_jxl_from_buffer(_handle->src_buffer, _handle->src_size, colorspace, image_info); - } - break; - - default: - image_util_error("Not supported format [%d]", _handle->image_type); - return IMAGE_UTIL_ERROR_INVALID_PARAMETER; - break; - } - - image_util_fleave(); - - return _image_error_capi(err); -} - -int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsigned long *height, unsigned long long *size) -{ - int err = IMAGE_UTIL_ERROR_NONE; - decode_s *_handle = (decode_s *) handle; - mm_util_image_h image_info = NULL; - unsigned int _width = 0; - unsigned int _height = 0; - unsigned char *_buffer = NULL; - size_t _size = 0; - - image_util_warning("DEPRECATION WARNING: image_util_decode_run() is deprecated and will be removed from next release. Use image_util_decode_run2() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(!_handle->path && !_handle->src_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input"); - image_util_retvm_if(!_handle->dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output"); - image_util_retvm_if(!width, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid width"); - image_util_retvm_if(!height, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid height"); - image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid size"); - - err = __image_util_decode_internal(_handle, &image_info); - image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__image_util_decode_internal failed"); - - err = mm_image_get_image(image_info, &_width, &_height, NULL, &_buffer, &_size); - - *width = (unsigned long)_width; - *height = (unsigned long)_height; - *size = (unsigned long long)_size; - *(_handle->dst_buffer) = _buffer; - - mm_image_destroy_image(image_info); - - return _image_error_capi(err); -} - static int __image_util_decode_run_from_file(image_util_decode_h handle, const char *file_path, image_util_image_h *image) { int ret = IMAGE_UTIL_ERROR_NONE; @@ -491,53 +359,28 @@ static gpointer __image_util_decode_thread(gpointer data) { decode_s *_handle = (decode_s *) data; int ret = IMAGE_UTIL_ERROR_NONE; - unsigned int _width = 0; - unsigned int _height = 0; - size_t _size = 0; mm_util_image_h image_info = NULL; - unsigned char *_buffer = NULL; image_util_fenter(); image_util_retvm_if(!_handle, NULL, "Invalid Handle"); - if (_handle->is_decode2) { //new decode - if (_handle->path) - ret = __image_util_decode_run_from_file(_handle, _handle->path, &image_info); - else - ret = __image_util_decode_run_from_buffer(_handle, _handle->src_buffer, _handle->src_size, &image_info); - - if (_handle->decode2_cb) { - image_util_debug("call decode2_cb [%d]", ret); - _handle->decode2_cb->image_decode_completed_cb(ret, image_info, _handle->decode2_cb->user_data); - } else { - image_util_error("No decode2_cb"); - } + if (_handle->path) + ret = __image_util_decode_run_from_file(_handle, _handle->path, &image_info); + else + ret = __image_util_decode_run_from_buffer(_handle, _handle->src_buffer, _handle->src_size, &image_info); - mm_image_destroy_image(image_info); - IMAGE_UTIL_SAFE_G_FREE(_handle->decode2_cb); - IMAGE_UTIL_SAFE_G_FREE(_handle->path); + if (_handle->decode2_cb) { + image_util_debug("call decode2_cb [%d]", ret); + _handle->decode2_cb->image_decode_completed_cb(ret, image_info, _handle->decode2_cb->user_data); } else { - ret = __image_util_decode_internal(_handle, &image_info); - if (ret == IMAGE_UTIL_ERROR_NONE) - image_util_debug("Success - decode_internal"); - else - image_util_error("Error - decode_internal"); - - mm_image_get_image(image_info, &_width, &_height, NULL, &_buffer, &_size); - - *(_handle->dst_buffer) = _buffer; - - if (_handle->_decode_cb) { - image_util_debug("call completed_cb"); - _handle->_decode_cb->image_decode_completed_cb(ret, _handle->_decode_cb->user_data, (unsigned long)_width, (unsigned long)_height, (unsigned long long)_size); - } else { - image_util_error("No callback"); - } - - mm_image_destroy_image(image_info); + image_util_error("No decode2_cb"); } + mm_image_destroy_image(image_info); + IMAGE_UTIL_SAFE_G_FREE(_handle->decode2_cb); + IMAGE_UTIL_SAFE_G_FREE(_handle->path); + image_util_fleave(); return NULL; @@ -554,37 +397,6 @@ static int __image_util_decode_create_thread(decode_s * handle) return IMAGE_UTIL_ERROR_NONE; } -int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_completed_cb completed_cb, void *user_data) -{ - int err = IMAGE_UTIL_ERROR_NONE; - decode_s *_handle = (decode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_decode_run_async() is deprecated and will be removed from next release. Use image_util_decode_run_async2() instead."); - - image_util_fenter(); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(!_handle->path && !_handle->src_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input"); - image_util_retvm_if(!_handle->dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output"); - image_util_retvm_if(!completed_cb, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback"); - image_util_retvm_if(_handle->thread, IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running"); - - g_free(_handle->_decode_cb); - - _handle->_decode_cb = g_new0(decode_cb_s, 1); - - _handle->_decode_cb->user_data = user_data; - _handle->_decode_cb->image_decode_completed_cb = completed_cb; - - err = __image_util_decode_create_thread(_handle); - if (err != IMAGE_UTIL_ERROR_NONE) - IMAGE_UTIL_SAFE_G_FREE(_handle->_decode_cb); - - image_util_fleave(); - - return err; -} - int image_util_decode_run2(image_util_decode_h handle, image_util_image_h *image) { decode_s *_handle = (decode_s *) handle; @@ -634,10 +446,8 @@ int image_util_decode_destroy(image_util_decode_h handle) image_util_fenter(); /* g_thread_exit(handle->thread); */ - if (_handle->thread) { + if (_handle->thread) g_thread_join(_handle->thread); - IMAGE_UTIL_SAFE_G_FREE(_handle->_decode_cb); - } g_free(_handle->path); g_free(_handle->src_buffer); diff --git a/src/image_util_encode.c b/src/image_util_encode.c index 6dd6838..7ff3129 100644 --- a/src/image_util_encode.c +++ b/src/image_util_encode.c @@ -25,11 +25,6 @@ #include #include -typedef struct { - void *user_data; - image_util_encode_completed_cb image_encode_completed_cb; -} encode_cb_s; - typedef struct { void *user_data; image_util_encode_to_file_completed_cb image_encode_to_file_cb; @@ -58,7 +53,6 @@ typedef struct { gchar *path; int quality; gif_encode_s gif_encode_info; - encode_cb_s *_encode_cb; mm_util_enc_opt_h enc_opt; /* for async */ @@ -68,14 +62,6 @@ typedef struct { encode_to_buffer_cb_s *encode_to_buffer_cb; } encode_s; -static gboolean __is_invalid_image_info(mm_image_info_s image_info) -{ - if (image_info.width == 0 || image_info.height == 0 || image_info.data == NULL) - return TRUE; - else - return FALSE; -} - static int __allocate_source_buffer(encode_s *handle) { image_util_fenter(); @@ -172,54 +158,6 @@ int image_util_encode_create(image_util_type_e image_type, image_util_encode_h * return err; } -int image_util_encode_set_resolution(image_util_encode_h handle, unsigned long width, unsigned long height) -{ - int err = IMAGE_UTIL_ERROR_NONE; - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_resolution() is deprecated and will be removed from next release. Use image_util_create_image() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if((width == 0 || height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%lu] h : [%lu]", width, height); - image_util_retvm_if((width >= UINT_MAX || height >= UINT_MAX), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%lu] h : [%lu]", width, height); - - /* multi-src for a-gif */ - if (_handle->image_type == IMAGE_UTIL_GIF) { - if (_handle->gif_encode_info.source_count <= _handle->gif_encode_info.current_resolution_count) { - err = __allocate_source_buffer(_handle); - image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__allocate_source_buffer is failed"); - } - if (_handle->gif_encode_info.current_resolution_count != 0) { - image_util_retvm_if((width > _handle->gif_encode_info.sources[0]->width || height > _handle->gif_encode_info.sources[0]->height), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution"); - } - _handle->gif_encode_info.sources[_handle->gif_encode_info.current_resolution_count]->width = width; - _handle->gif_encode_info.sources[_handle->gif_encode_info.current_resolution_count]->height = height; - _handle->gif_encode_info.current_resolution_count++; - } else { - _handle->src.width = width; - _handle->src.height = height; - } - - return err; -} - -int image_util_encode_set_colorspace(image_util_encode_h handle, image_util_colorspace_e colorspace) -{ - int err = IMAGE_UTIL_ERROR_NONE; - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_colorspace() is deprecated and will be removed from next release. Use image_util_create_image() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - - err = _check_colorspace(_handle->image_type, colorspace); - image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "Invalid colorspace"); - - _handle->src.color = TYPECAST_COLOR_BY_TYPE(colorspace, _handle->image_type); - - return IMAGE_UTIL_ERROR_NONE; -} - int image_util_encode_set_quality(image_util_encode_h handle, int quality) { encode_s *_handle = (encode_s *) handle; @@ -243,18 +181,6 @@ int image_util_encode_set_png_compression(image_util_encode_h handle, image_util return _image_error_capi(mm_util_enc_opt_set_png_compression(_handle->enc_opt, compression)); } -int image_util_encode_set_webp_lossless(image_util_encode_h handle, bool lossless) -{ - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_webp_lossless() is deprecated and will be removed from next release. Use image_util_encode_set_lossless() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_WEBP); - - return _image_error_capi(mm_util_enc_opt_set_lossless(_handle->enc_opt, lossless)); -} - int image_util_encode_set_lossless(image_util_encode_h handle, bool lossless) { encode_s *_handle = (encode_s *) handle; @@ -264,157 +190,6 @@ int image_util_encode_set_lossless(image_util_encode_h handle, bool lossless) return _image_error_capi(mm_util_enc_opt_set_lossless(_handle->enc_opt, lossless)); } -int image_util_encode_set_gif_frame_delay_time(image_util_encode_h handle, unsigned long long delay_time) -{ - int err = IMAGE_UTIL_ERROR_NONE; - encode_s *_handle = (encode_s *) handle; - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_GIF); - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_gif_frame_delay_time() is deprecated and will be removed from next release. Use image_util_set_delay_time() instead."); - - image_util_retvm_if((delay_time > INT_MAX), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid delay time"); - - /* multi-src for a-gif */ - if (_handle->gif_encode_info.source_count <= _handle->gif_encode_info.current_delay_count) { - err = __allocate_source_buffer(_handle); - image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__allocate_source_buffer is failed"); - } - - _handle->gif_encode_info.sources[_handle->gif_encode_info.current_delay_count]->delay_time = (int)delay_time; - _handle->gif_encode_info.current_delay_count++; - - return err; -} - -int image_util_encode_set_input_buffer(image_util_encode_h handle, const unsigned char *src_buffer) -{ - int err = IMAGE_UTIL_ERROR_NONE; - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_input_buffer() is deprecated and will be removed from next release. Use image_util_create_image() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(!src_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid src_buffer"); - - /* multi-src for a-gif */ - if (_handle->image_type == IMAGE_UTIL_GIF) { - if (_handle->gif_encode_info.source_count <= _handle->gif_encode_info.current_buffer_count) { - err = __allocate_source_buffer(_handle); - image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__allocate_source_buffer is failed"); - } - _handle->gif_encode_info.sources[_handle->gif_encode_info.current_buffer_count]->data = (void *)src_buffer; - _handle->gif_encode_info.sources[_handle->gif_encode_info.current_buffer_count]->size = TEMP_DATA_SIZE; - _handle->gif_encode_info.current_buffer_count++; - } else { - _handle->src.data = (void *)src_buffer; - } - - return err; -} - -int image_util_encode_set_output_path(image_util_encode_h handle, const char *path) -{ - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_output_path() is deprecated and will be removed from next release. Use image_util_encode_run_to_file() or image_util_encode_run_async_to_file() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path"); - - _handle->dst_buffer = NULL; - - g_free(_handle->path); - _handle->path = g_strdup(path); - - return IMAGE_UTIL_ERROR_NONE; -} - -int image_util_encode_set_output_buffer(image_util_encode_h handle, unsigned char **dst_buffer) -{ - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_set_output_buffer() is deprecated and will be removed from next release. Use image_util_encode_run_to_buffer() or image_util_encode_run_async_to_buffer() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(!dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dst_buffer"); - - IMAGE_UTIL_SAFE_G_FREE(_handle->path); - - _handle->dst_buffer = (void **)dst_buffer; - - return IMAGE_UTIL_ERROR_NONE; -} - -static int __image_util_encode_internal(encode_s * _handle) -{ - int err = MM_UTIL_ERROR_NONE; - mm_util_image_h _src = NULL; - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid _handle"); - image_util_retvm_if((_handle->image_type != IMAGE_UTIL_GIF && __is_invalid_image_info(_handle->src)), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image"); - image_util_retvm_if((_handle->image_type == IMAGE_UTIL_GIF && (!_handle->gif_encode_info.sources || __is_invalid_image_info(*_handle->gif_encode_info.sources[0]))), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid gif"); - - image_util_fenter(); - - if (_handle->image_type != IMAGE_UTIL_GIF) { - err = mm_image_create_image(_handle->src.width, _handle->src.height, _handle->src.color, _handle->src.data, TEMP_DATA_SIZE, &_src); - image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "fail to mm_image_create_image"); - } - - switch (_handle->image_type) { - case IMAGE_UTIL_JPEG: - if (_handle->path) - err = mm_util_jpeg_encode_to_file(_src, _handle->quality, _handle->path); - else - err = mm_util_encode_to_jpeg_memory(_src, _handle->quality, _handle->dst_buffer, &_handle->dst_size); - break; - case IMAGE_UTIL_GIF: - image_util_debug("[Count] source_count:%u, buffer:%u, resolution:%u, delay:%u", _handle->gif_encode_info.source_count, _handle->gif_encode_info.current_buffer_count, _handle->gif_encode_info.current_resolution_count, _handle->gif_encode_info.current_delay_count); - if ((_handle->gif_encode_info.source_count > 1) && - ((_handle->gif_encode_info.source_count != _handle->gif_encode_info.current_buffer_count) || - (_handle->gif_encode_info.source_count != _handle->gif_encode_info.current_resolution_count) || - (_handle->gif_encode_info.source_count != _handle->gif_encode_info.current_delay_count))) { - image_util_error("Total frame count does not match with the data set, for animated gif encoding"); - return IMAGE_UTIL_ERROR_INVALID_OPERATION; - } - - if (_handle->path) - err = mm_util_encode_to_gif_file((mm_util_image_h *)_handle->gif_encode_info.sources, _handle->gif_encode_info.source_count, _handle->path); - else - err = mm_util_encode_to_gif_memory((mm_util_image_h *)_handle->gif_encode_info.sources, _handle->gif_encode_info.source_count, _handle->dst_buffer, &_handle->dst_size); - break; - case IMAGE_UTIL_PNG: - /* fall through */ - case IMAGE_UTIL_BMP: - /* fall through */ - case IMAGE_UTIL_WEBP: - if (_handle->path) - err = mm_util_encode_image_to_file(_src, _handle->enc_opt, _handle->path); - else - err = mm_util_encode_image_to_buffer(_src, _handle->enc_opt, _handle->dst_buffer, &_handle->dst_size); - break; - case IMAGE_UTIL_JPEG_XL: - if (_handle->path) - err = mm_util_encode_jxl_to_file(_src, _handle->enc_opt, _handle->path); - else - err = mm_util_encode_jxl_to_buffer(_src, _handle->enc_opt, _handle->dst_buffer, &_handle->dst_size); - break; - default: - image_util_error("Invalid image_type %d", _handle->image_type); - mm_image_destroy_image(_src); - return IMAGE_UTIL_ERROR_INVALID_PARAMETER; - } - - mm_image_destroy_image(_src); - __free_source_buffer(_handle); /* free gif_encode_info.sources */ - - image_util_fleave(); - - return _image_error_capi(err); -} - static int __image_util_encode_run_to_file(image_util_encode_h handle, image_util_image_h image, const char *file_path) { int ret = IMAGE_UTIL_ERROR_NONE; @@ -520,48 +295,32 @@ static gpointer __image_util_encode_thread(gpointer data) image_util_retvm_if(!_handle, NULL, "Invalid Handle"); - if (_handle->new_src) { //new encode - if (_handle->path) { - ret = __image_util_encode_run_to_file((image_util_encode_h) data, _handle->new_src, _handle->path); - - if (_handle->encode_to_file_cb) { - image_util_debug("call encode_to_file_cb [%d]", ret); - _handle->encode_to_file_cb->image_encode_to_file_cb(ret, _handle->encode_to_file_cb->user_data); - } else { - image_util_error("No encode_to_file_cb"); - } - - mm_image_destroy_image(_handle->new_src); - IMAGE_UTIL_SAFE_G_FREE(_handle->encode_to_file_cb); - IMAGE_UTIL_SAFE_G_FREE(_handle->path); + if (_handle->path) { + ret = __image_util_encode_run_to_file((image_util_encode_h) data, _handle->new_src, _handle->path); + if (_handle->encode_to_file_cb) { + image_util_debug("call encode_to_file_cb [%d]", ret); + _handle->encode_to_file_cb->image_encode_to_file_cb(ret, _handle->encode_to_file_cb->user_data); } else { - ret = __image_util_encode_run_to_buffer((image_util_encode_h) data, _handle->new_src, &buffer, &buffer_size); - if (_handle->encode_to_buffer_cb) { - image_util_debug("call encode_to_buffer_cb"); - _handle->encode_to_buffer_cb->image_encode_to_buffer_cb(ret, buffer, buffer_size, _handle->encode_to_buffer_cb->user_data); - } else { - image_util_error("No encode_to_buffer_cb"); - } - - mm_image_destroy_image(_handle->new_src); - IMAGE_UTIL_SAFE_G_FREE(_handle->encode_to_buffer_cb); - IMAGE_UTIL_SAFE_G_FREE(buffer); + image_util_error("No encode_to_file_cb"); } - } else { //old encode - ret = __image_util_encode_internal(_handle); - if (ret == IMAGE_UTIL_ERROR_NONE) - image_util_debug("Success - encode_internal"); - else - image_util_error("Error - encode_internal"); + mm_image_destroy_image(_handle->new_src); + IMAGE_UTIL_SAFE_G_FREE(_handle->encode_to_file_cb); + IMAGE_UTIL_SAFE_G_FREE(_handle->path); - if (_handle->_encode_cb) { - image_util_debug("completed_cb"); - _handle->_encode_cb->image_encode_completed_cb(ret, _handle->_encode_cb->user_data, _handle->dst_size); + } else { + ret = __image_util_encode_run_to_buffer((image_util_encode_h) data, _handle->new_src, &buffer, &buffer_size); + if (_handle->encode_to_buffer_cb) { + image_util_debug("call encode_to_buffer_cb"); + _handle->encode_to_buffer_cb->image_encode_to_buffer_cb(ret, buffer, buffer_size, _handle->encode_to_buffer_cb->user_data); + } else { + image_util_error("No encode_to_buffer_cb"); } - IMAGE_UTIL_SAFE_G_FREE(_handle->_encode_cb); + mm_image_destroy_image(_handle->new_src); + IMAGE_UTIL_SAFE_G_FREE(_handle->encode_to_buffer_cb); + IMAGE_UTIL_SAFE_G_FREE(buffer); } _handle->thread = NULL; @@ -581,51 +340,6 @@ static int __image_util_encode_create_thread(encode_s * handle) return IMAGE_UTIL_ERROR_NONE; } -int image_util_encode_run(image_util_encode_h handle, unsigned long long *size) -{ - int err = IMAGE_UTIL_ERROR_NONE; - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_run() is deprecated and will be removed from next release. Use image_util_encode_run_to_file() or image_util_encode_run_to_buffer() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(_handle->dst_buffer && !size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); - - err = __image_util_encode_internal(_handle); - image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__image_util_encode_internal failed"); - - if (size) - *size = _handle->dst_size; - - return err; -} - -int image_util_encode_run_async(image_util_encode_h handle, image_util_encode_completed_cb completed_cb, void *user_data) -{ - int err = IMAGE_UTIL_ERROR_NONE; - encode_s *_handle = (encode_s *) handle; - - image_util_warning("DEPRECATION WARNING: image_util_encode_run_async() is deprecated and will be removed from next release. Use image_util_encode_run_async_to_file() or image_util_encode_run_async_to_buffer() instead."); - - image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if((_handle->image_type != IMAGE_UTIL_GIF && __is_invalid_image_info(_handle->src)), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input"); - image_util_retvm_if((_handle->image_type == IMAGE_UTIL_GIF && (_handle->gif_encode_info.sources == NULL || __is_invalid_image_info(*_handle->gif_encode_info.sources[0]))), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input"); - image_util_retvm_if(!completed_cb, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback"); - image_util_retvm_if(_handle->thread, IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running"); - - g_free(_handle->_encode_cb); - _handle->_encode_cb = g_new0(encode_cb_s, 1); - - _handle->_encode_cb->user_data = user_data; - _handle->_encode_cb->image_encode_completed_cb = completed_cb; - - err = __image_util_encode_create_thread(_handle); - if (err != IMAGE_UTIL_ERROR_NONE) - IMAGE_UTIL_SAFE_G_FREE(_handle->_encode_cb); - - return err; -} - int image_util_encode_run_to_file(image_util_encode_h handle, image_util_image_h image, const char *file_path) { return __image_util_encode_run_to_file(handle, image, file_path); @@ -720,10 +434,8 @@ int image_util_encode_destroy(image_util_encode_h handle) image_util_debug("image_util_encode_destroy"); /* g_thread_exit(handle->thread); */ - if (_handle->thread) { + if (_handle->thread) g_thread_join(_handle->thread); - IMAGE_UTIL_SAFE_G_FREE(_handle->_encode_cb); - } __free_source_buffer(_handle); diff --git a/test/image_util_testsuite.c b/test/image_util_testsuite.c index c37d17d..15f793f 100644 --- a/test/image_util_testsuite.c +++ b/test/image_util_testsuite.c @@ -260,8 +260,6 @@ typedef enum { DECODE_SET_BUFFER = 0, DECODE_SET_COLOR, DECODE_SET_DOWNSCALE, - DECODE_RUN, - DECODE_RUN_ASYNC, DECODE_RUN2, DECODE_RUN_ASYNC2, DECODE_SAVE_TO_JPEG, @@ -272,8 +270,6 @@ static const test_menu_s g_disp_decode_menu[DECODE_MENU_MAX] = { { DECODE_SET_BUFFER, "set input buffer" }, { DECODE_SET_COLOR, "set color (mand. default=IMAGE_UTIL_COLORSPACE_RGBA8888)" }, { DECODE_SET_DOWNSCALE, "set downscale (opt. for jpeg only)" }, - { DECODE_RUN, "decode run (will be deprecated)" }, - { DECODE_RUN_ASYNC, "decode run async (will be deprecated)" }, { DECODE_RUN2, "decode run2" }, { DECODE_RUN_ASYNC2, "decode run async2" }, { DECODE_SAVE_TO_JPEG, "save decode result to jpg" }, @@ -299,9 +295,6 @@ typedef enum { ENCODE_SET_QUALITY, ENCODE_SET_COMPRESIION, ENCODE_SET_LOSSLESS, - ENCODE_SET_TO_BUFFER, - ENCODE_RUN, - ENCODE_RUN_ASYNC, ENCODE_RUN_TO_FILE, ENCODE_RUN_TO_BUFFER, ENCODE_RUN_ASYNC_TO_FILE, @@ -314,9 +307,6 @@ static const test_menu_s g_disp_encode_menu[ENCODE_MENU_MAX] = { { ENCODE_SET_QUALITY, "set quality (opt. for jpeg only)" }, { ENCODE_SET_COMPRESIION, "set compression (opt. for png only)" }, { ENCODE_SET_LOSSLESS, "set lossless (opt. for webp & jpeg-xl)" }, - { ENCODE_SET_TO_BUFFER, "set output buffer (opt. deprecated)" }, - { ENCODE_RUN, "encode run (will be deprecated)" }, - { ENCODE_RUN_ASYNC, "encode run async (will be deprecated)" }, { ENCODE_RUN_TO_FILE, "encode run to file" }, { ENCODE_RUN_TO_BUFFER, "encode run to buffer" }, { ENCODE_RUN_ASYNC_TO_FILE, "encode run async to file" }, @@ -341,9 +331,6 @@ static void __display_encode_menu(void) typedef enum { ENCODE_AGIF_SET_DIR = 0, ENCODE_AGIF_SET_DELAY, - ENCODE_AGIF_SET_TO_BUFFER, - ENCODE_AGIF_RUN, - ENCODE_AGIF_RUN_ASYNC, ENCODE_AGIF_SAVE_TO_FILE, ENCODE_AGIF_SAVE_TO_BUFFER, ENCODE_AGIF_MENU_MAX, @@ -352,9 +339,6 @@ typedef enum { static const test_menu_s g_disp_encode_agif_menu[ENCODE_AGIF_MENU_MAX] = { { ENCODE_AGIF_SET_DIR, "set directory" }, { ENCODE_AGIF_SET_DELAY, "set delay time (mand. default = 100)" }, - { ENCODE_AGIF_SET_TO_BUFFER, "set output buffer (opt. will be deprecated)" }, - { ENCODE_AGIF_RUN, "run agif (will be deprecated)" }, - { ENCODE_AGIF_RUN_ASYNC, "run async agif (will be deprecated)" }, { ENCODE_AGIF_SAVE_TO_FILE, "add frame by frame and save to file" }, { ENCODE_AGIF_SAVE_TO_BUFFER, "add frame by frame and save to buffer" }, }; @@ -1002,27 +986,6 @@ static void __get_encode_anim_path(image_util_anim_type_e anim_type, const char g_print("\t__get_encode_anim_path: %s\n", *path); } -/* internal functions for testsuite */ - - -/* callback functions for test */ -static void __decode_completed_cb(int error_code, void *user_data, unsigned long width, unsigned long height, unsigned long long size) -{ - test_complex_data_s *result = (test_complex_data_s *)user_data; - - g_print("\t__decode_completed_cb invoked %d\n", error_code); - - if (error_code != IMAGE_UTIL_ERROR_NONE) { - g_print("Fail to decode image %d\n", error_code); - __signal(); - return; - } - - result->size.w = (unsigned int)width; - result->size.h = (unsigned int)height; - result->buffer_size = (size_t)size; - __signal(); -} static void __decode_completed2_cb(int error_code, image_util_image_h image, void *user_data) { @@ -1044,19 +1007,6 @@ static void __decode_completed2_cb(int error_code, image_util_image_h image, voi __signal(); } -static void __encode_completed_cb(int error_code, void *user_data, unsigned long long size) -{ - test_complex_data_s *result = (test_complex_data_s *)user_data; - - g_print("\t__encode_to_file_completed_cb invoked %d\n", error_code); - - if (error_code != IMAGE_UTIL_ERROR_NONE) - g_print("Fail to decode image %d\n", error_code); - - result->buffer_size = (size_t)size; - __signal(); -} - static void __encode_to_file_completed_cb(image_util_error_e error_code, void *user_data) { g_print("\t__encode_to_file_completed_cb invoked %d\n", error_code); @@ -1134,9 +1084,6 @@ static int __run_decode(test_decode_menu_e menu, test_complex_data_s *input, { int ret = IMAGE_UTIL_ERROR_NONE; image_util_decode_h handle = NULL; - unsigned long width = 0; - unsigned long height = 0; - unsigned long long buffer_size = 0; if (!input || !params || !result) { g_print("invalid parameter!!! input: %p, params: %p, result: %p\n", input, params, result); @@ -1175,51 +1122,6 @@ static int __run_decode(test_decode_menu_e menu, test_complex_data_s *input, } switch(menu) { - case DECODE_RUN: - ret = image_util_decode_set_output_buffer(handle, &result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_decode_run failed %d\n", ret); - break; - } - - ret = image_util_decode_run(handle, &width, &height, &buffer_size); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_decode_run failed %d\n", ret); - break; - } - - ret = image_util_create_image((unsigned int)width, (unsigned int)height, params->color, - result->buffer, buffer_size, &result->image); - SAFE_FREE(result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_create_image failed %d\n", ret); - break; - } - break; - - case DECODE_RUN_ASYNC: - ret = image_util_decode_set_output_buffer(handle, &result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_decode_run failed %d\n", ret); - break; - } - - ret = image_util_decode_run_async(handle, __decode_completed_cb, result); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_decode_run failed %d\n", ret); - break; - } - __wait(); - - ret = image_util_create_image(result->size.w, result->size.h, params->color, - result->buffer, result->buffer_size, &result->image); - SAFE_FREE(result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_create_image failed %d\n", ret); - break; - } - break; - case DECODE_RUN2: ret = image_util_decode_run2(handle, &result->image); if (ret != IMAGE_UTIL_ERROR_NONE) { @@ -1257,7 +1159,6 @@ static int __run_encode(test_encode_menu_e menu, test_complex_data_s *input, { int ret = IMAGE_UTIL_ERROR_NONE; image_util_encode_h handle = NULL; - unsigned long long buffer_size = 0; if (!input || !params || !result) { g_print("invalid parameter!!! input: %p, params: %p, result: %p\n", input, params, result); @@ -1310,116 +1211,6 @@ static int __run_encode(test_encode_menu_e menu, test_complex_data_s *input, } switch(menu) { - case ENCODE_RUN: - if (input->image) { - SAFE_FREE(input->buffer); - ret = image_util_get_image(input->image, &input->size.w, &input->size.h, &input->color, &input->buffer, &input->buffer_size); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_get_image failed %d\n", ret); - break; - } - } - - ret = image_util_encode_set_resolution(handle, input->size.w, input->size.h); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_resolution failed %d\n", ret); - break; - } - - ret = image_util_encode_set_colorspace(handle, input->color); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_decode_run failed %d\n", ret); - break; - } - - ret = image_util_encode_set_input_buffer(handle, input->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_input_buffer failed %d\n", ret); - break; - } - - if (params->use_buffer) { - ret = image_util_encode_set_output_buffer(handle, &result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_buffer failed %d\n", ret); - break; - } - } else { - ret = image_util_encode_set_output_path(handle, result->path); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_path failed %d\n", ret); - break; - } - } - - ret = image_util_encode_run(handle, &buffer_size); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_run failed %d\n", ret); - break; - } - result->buffer_size = buffer_size; - - if (params->use_buffer) { - __write_file(result->path, result->buffer, result->buffer_size); - SAFE_FREE(result->buffer); - } - break; - - case ENCODE_RUN_ASYNC: - if (input->image) { - SAFE_FREE(input->buffer); - ret = image_util_get_image(input->image, &input->size.w, &input->size.h, &input->color, &input->buffer, &input->buffer_size); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_get_image failed %d\n", ret); - break; - } - } - - ret = image_util_encode_set_resolution(handle, input->size.w, input->size.h); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_resolution failed %d\n", ret); - break; - } - - ret = image_util_encode_set_colorspace(handle, input->color); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_decode_run failed %d\n", ret); - break; - } - - ret = image_util_encode_set_input_buffer(handle, input->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_input_buffer failed %d\n", ret); - break; - } - - if (params->use_buffer) { - ret = image_util_encode_set_output_buffer(handle, &result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_buffer failed %d\n", ret); - break; - } - } else { - ret = image_util_encode_set_output_path(handle, result->path); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_path failed %d\n", ret); - break; - } - } - - ret = image_util_encode_run_async(handle, __encode_completed_cb, result); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_run_async failed %d\n", ret); - break; - } - __wait(); - - if (params->use_buffer) { - __write_file(result->path, result->buffer, result->buffer_size); - SAFE_FREE(result->buffer); - } - break; - case ENCODE_RUN_TO_FILE: ret = image_util_encode_run_to_file(handle, input->image, result->path); if (ret != IMAGE_UTIL_ERROR_NONE) @@ -1464,133 +1255,6 @@ ERROR: return ret; } -/* encode animated GIF with deprecated APIs - * input : use image_cnt & images - * output : use path or buffer(buffer_size) - */ -static int __run_encode_agif_deprecated(test_encode_menu_e menu, test_complex_data_s *input, - test_encode_agif_params_s *params, test_complex_data_s *result) -{ - int ret = IMAGE_UTIL_ERROR_NONE; - image_util_encode_h handle = NULL; - unsigned int i = 0; - unsigned int width = 0, height = 0; - unsigned char **buffer = NULL; - size_t buffer_size = 0; - unsigned long long size = 0; - - if (!input || !params || !result) { - g_print("invalid parameter!!! input: %p, params: %p, result: %p\n", input, params, result); - return IMAGE_UTIL_ERROR_INVALID_PARAMETER; - } - - buffer = g_malloc0(sizeof(unsigned char *) * input->image_cnt); - - ret = image_util_encode_create(IMAGE_UTIL_GIF, &handle); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_create failed %d\n", ret); - g_free(buffer); - return ret; - } - - for (i = 0; i < input->image_cnt; i++) { - ret = image_util_get_image(input->images[i], &width, &height, NULL, &buffer[i], &buffer_size); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_get_image failed %d\n", ret); - goto ERROR; - } - - ret = image_util_encode_set_resolution(handle, (unsigned long) width, (unsigned long) height); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_resolution failed %d\n", ret); - goto ERROR; - } - - ret = image_util_encode_set_gif_frame_delay_time(handle, params->delay); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_gif_frame_delay_time failed %d\n", ret); - goto ERROR; - } - - ret = image_util_encode_set_input_buffer(handle, buffer[i]); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_input_buffer failed %d\n", ret); - goto ERROR; - } - } - - switch(menu) { - case ENCODE_AGIF_RUN: - if (params->use_buffer) { - ret = image_util_encode_set_output_buffer(handle, &result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_buffer failed %d\n", ret); - break; - } - } else { - ret = image_util_encode_set_output_path(handle, result->path); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_path failed %d\n", ret); - break; - } - } - - ret = image_util_encode_run(handle, &size); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_run failed %d\n", ret); - break; - } - - result->buffer_size = (size_t)size; - if (params->use_buffer) { - __write_file(result->path, result->buffer, result->buffer_size); - SAFE_FREE(result->buffer); - } - break; - - case ENCODE_AGIF_RUN_ASYNC: - if (params->use_buffer) { - ret = image_util_encode_set_output_buffer(handle, &result->buffer); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_buffer failed %d\n", ret); - break; - } - } else { - ret = image_util_encode_set_output_path(handle, result->path); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_set_output_path failed %d\n", ret); - break; - } - } - - ret = image_util_encode_run_async(handle, __encode_completed_cb, &result); - if (ret != IMAGE_UTIL_ERROR_NONE) { - g_print("image_util_encode_run_async failed %d\n", ret); - break; - } - __wait(); - - if (params->use_buffer) { - __write_file(result->path, result->buffer, result->buffer_size); - SAFE_FREE(result->buffer); - } - break; - default: - g_print("wrong encode agif menu %u", menu); - break; - } - -ERROR: - image_util_encode_destroy(handle); - - for (i = 0; i < input->image_cnt; i++) - g_free(buffer[i]); - - g_free(buffer); - - return ret; -} - /* encode animated GIF frame by frame * input : use image_cnt & images * output : use path or buffer(buffer_size) @@ -2075,8 +1739,6 @@ static void __interpret_decode(const char *cmd, unsigned int index) case DECODE_SET_DOWNSCALE: __menu_move(SET_DOWNSCALE_MENU); break; - case DECODE_RUN: - case DECODE_RUN_ASYNC: case DECODE_RUN2: case DECODE_RUN_ASYNC2: if (!__data_pop(&input_data)) { @@ -2124,11 +1786,6 @@ static void __interpret_encode(const char *cmd, unsigned int index) case ENCODE_SET_LOSSLESS: __menu_move(SET_LOSSLESS_MENU); break; - case ENCODE_SET_TO_BUFFER: - __menu_move(SET_TO_BUFFER_MENU); - break; - case ENCODE_RUN: - case ENCODE_RUN_ASYNC: case ENCODE_RUN_TO_FILE: case ENCODE_RUN_TO_BUFFER: case ENCODE_RUN_ASYNC_TO_FILE: @@ -2165,25 +1822,6 @@ static void __interpret_encode_agif(const char *cmd, unsigned int index) case ENCODE_AGIF_SET_DELAY: __menu_move(SET_DELAY_MENU); break; - case ENCODE_AGIF_SET_TO_BUFFER: - __menu_move(SET_TO_BUFFER_MENU); - break; - case ENCODE_AGIF_RUN: - case ENCODE_AGIF_RUN_ASYNC: - if (!__data_pop(&input_data)) { - g_print("There is no test data for decode.\n"); - break; - } - __get_encode_path(IMAGE_UTIL_GIF, FILE_FOR_ENCODE_AGIF, &g_encode_agif_result.path); - ret = __run_encode_agif_deprecated(index, input_data, &g_encode_agif_params, &g_encode_agif_result); - if (ret == IMAGE_UTIL_ERROR_NONE) { - g_print("Success to encode image!!!\n"); - __data_push(&g_encode_agif_result); - } else { - g_print("Fail to encode image!!!\n"); - __data_push(input_data); - } - break; case ENCODE_AGIF_SAVE_TO_FILE: case ENCODE_AGIF_SAVE_TO_BUFFER: if (!__data_pop(&input_data)) {