2 * Copyright (C) 2014 The Android Open Source Project
3 * Copyright@ Samsung Electronics Co. LTD
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * \file libscaler-common.h
20 * \brief source file for Scaler HAL
21 * \author Cho KyongHo <pullip.cho@samsung.com>
24 * <b>Revision History: </b>
25 * - 2014.05.08 : Cho KyongHo (pullip.cho@samsung.com) \n
28 #ifndef _LIBSCALER_COMMON_H_
29 #define _LIBSCALER_COMMON_H_
31 #define LOG_TAG "libexynosscaler"
32 #include <cutils/log.h>
36 //#define LOG_NDEBUG 0
39 # define __UNUSED__ __attribute__((__unused__))
44 #define SC_LOGERR(fmt, args...) ((void)ALOG(LOG_ERROR, LOG_TAG, "%s: " fmt " [%s]", __func__, ##args, strerror(errno)))
45 #define SC_LOGE(fmt, args...) ((void)ALOG(LOG_ERROR, LOG_TAG, "%s: " fmt, __func__, ##args))
46 #define SC_LOGI(fmt, args...) ((void)ALOG(LOG_INFO, LOG_TAG, "%s: " fmt, __func__, ##args))
47 #define SC_LOGI_IF(cond, fmt, args...) do { \
49 SC_LOGI(fmt, ##args); \
51 #define SC_LOGE_IF(cond, fmt, args...) do { \
53 SC_LOGE(fmt, ##args); \
55 #define SC_LOG_ASSERT(cont, fmt, args...) ((void)ALOG_ASSERT(cond, "%s: " fmt, __func__, ##args))
58 #define SC_LOGD(args...) ((void)ALOG(LOG_INFO, LOG_TAG, ##args))
59 #define SC_LOGD_IF(cond, fmt, args...) do { \
61 SC_LOGD(fmt, ##args); \
64 #define SC_LOGD(args...) do { } while (0)
65 #define SC_LOGD_IF(cond, fmt, args...) do { } while (0)
68 #define ARRSIZE(arr) (sizeof(arr)/sizeof(arr[0]))
74 static inline T
min (T a
, T b
) {
75 return (a
> b
) ? b
: a
;
79 static inline void swap(T
&a
, T
&b
) {
85 static inline bool UnderOne16thScaling(unsigned int srcw
, unsigned int srch
,
86 unsigned int dstw
, unsigned int dsth
, unsigned int rot
) {
87 if ((rot
== 90) || (rot
== 270))
90 return ((srcw
> (dstw
* 16)) || (srch
> (dsth
* 16)));
94 // marker for output parameters
97 #endif //_LIBSCALER_COMMON_H_