libhwjpeg: resolve compilation errors
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos.git] / include / FimgApi.h
1 /*
2 **
3 ** Copyright 2009 Samsung Electronics Co, Ltd.
4 ** Copyright 2008, The Android Open Source Project
5 **
6 ** Licensed under the Apache License, Version 2.0 (the "License");
7 ** you may not use this file except in compliance with the License.
8 ** You may obtain a copy of the License at
9 **
10 ** http://www.apache.org/licenses/LICENSE-2.0
11 **
12 ** Unless required by applicable law or agreed to in writing, software
13 ** distributed under the License is distributed on an "AS IS" BASIS,
14 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ** See the License for the specific language governing permissions and
16 ** limitations under the License.
17 **
18 **
19 */
20
21 #ifndef FIMG_API_H
22 #define FIMG_API_H
23
24 #include <stdlib.h>
25 #include <string.h>
26 #include <utils/Log.h>
27
28 #if defined(FIMGAPI_V5X)
29 #include "sec_g2d_5x.h"
30 #else
31 #include "sec_g2d_4x.h"
32 #endif
33
34 #undef FIMGAPI_HAL_DEBUG
35 #undef REAL_DEBUG
36 #undef ANDROID_LOG
37
38 #if defined(REAL_DEBUG)
39 #ifdef ANDROID_LOG
40 #define PRINT SLOGE
41 #define PRINTD SLOGD
42 #else
43 #define PRINT printf
44 #define PRINTD printf
45 #endif
46 #else
47 void VOID_FUNC(const char *format, ...);
48
49 #define PRINT VOID_FUNC
50 #define PRINTD VOID_FUNC
51 #endif
52
53 struct Fimg {
54 int srcX;
55 int srcY;
56 int srcW;
57 int srcH;
58 int srcFWStride; // this is not w, just stride (w * bpp)
59 int srcFH;
60 int srcBPP;
61 int srcColorFormat;
62 int srcAlphaType;
63 unsigned char* srcAddr;
64
65 int dstX;
66 int dstY;
67 int dstW;
68 int dstH;
69 int dstFWStride; // this is not w, just stride (w * bpp)
70 int dstFH;
71 int dstBPP;
72 int dstColorFormat;
73 int dstAlphaType;
74 unsigned char* dstAddr;
75
76 int clipT;
77 int clipB;
78 int clipL;
79 int clipR;
80 int level;
81
82 unsigned int fillcolor;
83 int tileModeX;
84 int tileModeY;
85 int rotate;
86 unsigned int alpha;
87 int xfermode;
88 int isDither;
89 int isFilter;
90 int matrixType;
91 float matrixSw;
92 float matrixSh;
93
94 int called; /* 0 : drawRect 1 : drawBitmap */
95 };
96
97 #ifdef __cplusplus
98
99 struct blitinfo_table {
100 int op;
101 const char *str;
102 };
103
104 struct compromise_param {
105 int clipW;
106 int clipH;
107 int src_fmt;
108 int dst_fmt;
109 int isScaling;
110 int isFilter;
111 int isSrcOver;
112 };
113
114 extern struct blitinfo_table optbl[];
115
116 class FimgApi
117 {
118 public:
119 #endif
120
121 #ifdef __cplusplus
122 private :
123 bool m_flagCreate;
124
125 protected :
126 FimgApi();
127 FimgApi(const FimgApi& rhs __unused) {}
128 virtual ~FimgApi();
129
130 public:
131 bool Create(void);
132 bool Destroy(void);
133 inline bool FlagCreate(void) { return m_flagCreate; }
134 bool Stretch(struct fimg2d_blit *cmd);
135 #ifdef FIMG2D_USE_M2M1SHOT2
136 bool Stretch_v5(struct m2m1shot2 *cmd);
137 #endif
138 bool Sync(void);
139
140 protected:
141 virtual bool t_Create(void);
142 virtual bool t_Destroy(void);
143 virtual bool t_Stretch(struct fimg2d_blit *cmd);
144 #ifdef FIMG2D_USE_M2M1SHOT2
145 virtual bool t_Stretch_v5(struct m2m1shot2 *cmd);
146 #endif
147 virtual bool t_Sync(void);
148 virtual bool t_Lock(void);
149 virtual bool t_UnLock(void);
150
151 };
152 #endif
153
154 #ifdef __cplusplus
155 extern "C"
156 #endif
157 FimgApi *createFimgApi();
158
159 #ifdef __cplusplus
160 extern "C"
161 #endif
162 void destroyFimgApi(FimgApi *ptrFimgApi);
163
164 #ifdef __cplusplus
165 extern "C"
166 #endif
167 int stretchFimgApi(struct fimg2d_blit *cmd);
168
169 #ifdef FIMG2D_USE_M2M1SHOT2
170 #ifdef __cplusplus
171 extern "C"
172 #endif
173 int stretchFimgApi_v5(struct m2m1shot2 *cmd);
174 #endif
175
176 #ifdef __cplusplus
177 extern "C"
178 #endif
179 int stretchFimgApi_fast(struct fimg2d_blit *cmd, unsigned long temp_addr, int temp_size);
180
181 #ifdef __cplusplus
182 extern "C"
183 #endif
184 bool checkScaleFimgApi(Fimg *fimg);
185
186
187 #ifdef __cplusplus
188 extern "C"
189 #endif
190 int SyncFimgApi(void);
191
192 int requestFimgApi_v5(struct Fimg *fimg);
193 void printDataBlit(char *title, const char *called, struct fimg2d_blit *cmd);
194 void printDataBlitRotate(int rotate);
195 void printDataBlitImage(const char *title, struct fimg2d_image *image);
196 void printDataBlitRect(const char *title, struct fimg2d_rect *rect);
197 void printDataBlitRect(const char *title, struct fimg2d_clip *clipping);
198 void printDataBlitScale(struct fimg2d_scale *scaling);
199 #endif //FIMG_API_H