2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_MEDIA_IMAGE_UTIL_PRIVATE_H__
18 #define __TIZEN_MEDIA_IMAGE_UTIL_PRIVATE_H__
20 #include <image_util_type.h>
35 #define LOG_TAG "CAPI_MEDIA_IMAGE_UTIL"
37 #define FONT_COLOR_RESET "\033[0m"
38 #define FONT_COLOR_RED "\033[31m"
40 #define image_util_debug(fmt, arg...) do { \
41 LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
44 #define image_util_error(fmt, arg...) do { \
45 LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
48 #define image_util_warning(fmt, arg...) do { \
49 LOGW(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
52 #define image_util_retm_if(expr, fmt, arg...) do { \
54 LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
59 #define image_util_retvm_if(expr, val, fmt, arg...) do { \
61 LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
66 #define DEPRECATION_LOGW(deprecated, instead) do { \
67 image_util_warning("DEPRECATION WARNING: %s is deprecated and will be removed from next release. Use %s instead.", deprecated, instead); \
70 #define IMAGE_UTIL_STRING_VALID(str) \
71 ((str != NULL && strlen(str) > 0) ? true : false)
73 #define IMAGE_UTIL_SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
75 #define IMGCV_FUNC_NAME "mm_util_cv_extract_representative_color"
76 #define PATH_MMUTIL_IMGCV_LIB PATH_LIBDIR"/libmmutil_imgcv.so"
78 #define _NOT_SUPPORTED_COLORSPACE (-1)
80 #define TYPECAST_COLOR(c) convert_type_of_colorspace(c)
81 #define TYPECAST_COLOR_BY_TYPE(c, t) convert_type_of_colorspace_with_image_type(c, t)
83 #define NUM_OF_COLORSPACE get_number_of_colorspace()
85 typedef gboolean(*ModuleFunc)(void *, int, int, unsigned char *, unsigned char *, unsigned char *);
90 image_util_transform_completed_cb image_processing_completed_cb;
96 image_util_colorspace_e colorspace;
97 image_util_rotation_e dest_rotation;
98 bool hardware_acceleration;
100 image_util_cb_s *_util_cb;
103 image_util_rotation_e rotation;
104 unsigned int start_x;
105 unsigned int start_y;
116 image_util_decode_completed_cb image_decode_completed_cb;
121 image_util_encode_completed_cb image_encode_completed_cb;
125 image_util_type_e image_type;
127 unsigned long long src_size;
129 unsigned long long dst_size;
130 unsigned long gif_encode_size;
134 unsigned long height;
138 unsigned int current_buffer_count;
139 unsigned int current_resolution_count;
140 unsigned int current_delay_count;
141 image_util_colorspace_e colorspace;
142 image_util_scale_e down_scale;
143 decode_cb_s *_decode_cb;
144 encode_cb_s *_encode_cb;
159 } image_util_error_type_e;
161 gboolean is_valid_colorspace(image_util_colorspace_e colorspace);
162 gboolean is_supported_colorspace(image_util_colorspace_e colorspace, image_util_type_e type);
164 unsigned int get_number_of_colorspace(void);
165 int convert_type_of_colorspace(const image_util_colorspace_e colorspace);
166 int convert_type_of_colorspace_with_image_type(const image_util_colorspace_e colorspace, const image_util_type_e type);
167 int _image_error_capi(image_util_error_type_e error_type, int error_code);
168 bool _image_util_check_resolution(int width, int height);
178 #endif /* __TIZEN_MEDIA_IMAGE_UTIL_PRIVATE_H__ */