blob: eb2eae364c3cf1ce7ace42646a3bd009f5ce686d [file] [log] [blame]
codeworkxf1be2fe2012-03-24 17:38:29 +01001/*
2 *
3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18/*
19 * @file swconverter.h
20 * @brief SEC_OMX specific define. It support MFC 5.x tiled.
21 * NV12T(tiled) layout:
22 * Each element is not pixel. It is 64x32 pixel block.
23 * uv pixel block is interleaved as u v u v u v ...
24 * y1 y2 y7 y8 y9 y10 y15 y16
25 * y3 y4 y5 y6 y11 y12 y13 y14
26 * y17 y18 y23 y24 y25 y26 y31 y32
27 * y19 y20 y21 y22 y27 y28 y29 y30
28 * uv1 uv2 uv7 uv8 uv9 uv10 uv15 uv16
29 * uv3 uv4 uv5 uv6 uv11 uv12 uv13 uv14
30 * YUV420Planar(linear) layout:
31 * Each element is not pixel. It is 64x32 pixel block.
32 * y1 y2 y3 y4 y5 y6 y7 y8
33 * y9 y10 y11 y12 y13 y14 y15 y16
34 * y17 y18 y19 y20 y21 y22 y23 y24
35 * y25 y26 y27 y28 y29 y30 y31 y32
36 * u1 u2 u3 u4 u5 u6 u7 u8
37 * v1 v2 v3 v4 v5 v6 v7 v8
38 * YUV420Semiplanar(linear) layout:
39 * Each element is not pixel. It is 64x32 pixel block.
40 * uv pixel block is interleaved as u v u v u v ...
41 * y1 y2 y3 y4 y5 y6 y7 y8
42 * y9 y10 y11 y12 y13 y14 y15 y16
43 * y17 y18 y19 y20 y21 y22 y23 y24
44 * y25 y26 y27 y28 y29 y30 y31 y32
45 * uv1 uv2 uv3 uv4 uv5 uv6 uv7 uv8
46 * uv9 uv10 uv11 uv12 uv13 uv14 uv15 uv16
47 * @author ShinWon Lee (shinwon.lee@samsung.com)
48 * @version 1.0
49 * @history
50 * 2012.02.01 : Create
51 */
52
53#ifndef SW_CONVERTOR_H_
54#define SW_CONVERTOR_H_
55
56/*--------------------------------------------------------------------------------*/
57/* Format Conversion API */
58/*--------------------------------------------------------------------------------*/
59/*
60 * De-interleaves src to dest1, dest2
61 *
62 * @param dest1
63 * Address of de-interleaved data[out]
64 *
65 * @param dest2
66 * Address of de-interleaved data[out]
67 *
68 * @param src
69 * Address of interleaved data[in]
70 *
71 * @param src_size
72 * Size of interleaved data[in]
73 */
74void csc_deinterleave_memcpy(
75 unsigned char *dest1,
76 unsigned char *dest2,
77 unsigned char *src,
78 unsigned int src_size);
79
80/*
81 * Interleaves src1, src2 to dest
82 *
83 * @param dest
84 * Address of interleaved data[out]
85 *
86 * @param src1
87 * Address of de-interleaved data[in]
88 *
89 * @param src2
90 * Address of de-interleaved data[in]
91 *
92 * @param src_size
93 * Size of de-interleaved data[in]
94 */
95void csc_interleave_memcpy(
96 unsigned char *dest,
97 unsigned char *src1,
98 unsigned char *src2,
99 unsigned int src_size);
100
101/* C Code */
102/*
103 * Converts tiled data to linear
104 * 1. y of nv12t to y of yuv420p
105 * 2. y of nv12t to y of yuv420s
106 *
107 * @param dst
108 * y address of yuv420[out]
109 *
110 * @param src
111 * y address of nv12t[in]
112 *
113 * @param yuv420_width
114 * real width of yuv420[in]
115 * it should be even
116 *
117 * @param yuv420_height
118 * real height of yuv420[in]
119 * it should be even.
120 *
121 */
122void csc_tiled_to_linear_y(
123 unsigned char *y_dst,
124 unsigned char *y_src,
125 unsigned int width,
126 unsigned int height);
127
128/*
129 * Converts tiled data to linear
130 * 1. uv of nv12t to y of yuv420s
131 *
132 * @param dst
133 * uv address of yuv420s[out]
134 *
135 * @param src
136 * uv address of nv12t[in]
137 *
138 * @param yuv420_width
139 * real width of yuv420s[in]
140 *
141 * @param yuv420_height
142 * real height of yuv420s[in]
143 *
144 */
145void csc_tiled_to_linear_uv(
146 unsigned char *uv_dst,
147 unsigned char *uv_src,
148 unsigned int width,
149 unsigned int height);
150
151/*
152 * Converts tiled data to linear
153 * 1. uv of nt12t to uv of yuv420p
154 *
155 * @param u_dst
156 * u address of yuv420p[out]
157 *
158 * @param v_dst
159 * v address of yuv420p[out]
160 *
161 * @param uv_src
162 * uv address of nt12t[in]
163 *
164 * @param yuv420_width
165 * real width of yuv420p[in]
166 *
167 * @param yuv420_height
168 * real height of yuv420p[in]
169 */
170void csc_tiled_to_linear_uv_deinterleave(
171 unsigned char *u_dst,
172 unsigned char *v_dst,
173 unsigned char *uv_src,
174 unsigned int width,
175 unsigned int height);
176
177/*
178 * Converts linear data to tiled
179 * 1. y of yuv420 to y of nv12t
180 *
181 * @param dst
182 * y address of nv12t[out]
183 *
184 * @param src
185 * y address of yuv420[in]
186 *
187 * @param yuv420_width
188 * real width of yuv420[in]
189 * it should be even
190 *
191 * @param yuv420_height
192 * real height of yuv420[in]
193 * it should be even.
194 *
195 */
196void csc_linear_to_tiled_y(
197 unsigned char *y_dst,
198 unsigned char *y_src,
199 unsigned int width,
200 unsigned int height);
201
202/*
203 * Converts and interleaves linear data to tiled
204 * 1. uv of nv12t to uv of yuv420
205 *
206 * @param dst
207 * uv address of nv12t[out]
208 *
209 * @param src
210 * u address of yuv420[in]
211 *
212 * @param src
213 * v address of yuv420[in]
214 *
215 * @param yuv420_width
216 * real width of yuv420[in]
217 *
218 * @param yuv420_height
219 * real height of yuv420[in]
220 *
221 */
222void csc_linear_to_tiled_uv(
223 unsigned char *uv_dst,
224 unsigned char *u_src,
225 unsigned char *v_src,
226 unsigned int width,
227 unsigned int height);
228
229/*
230 * Converts tiled data to linear for mfc 6.x
231 * 1. Y of NV12T to Y of YUV420P
232 * 2. Y of NV12T to Y of YUV420S
233 *
234 * @param dst
235 * Y address of YUV420[out]
236 *
237 * @param src
238 * Y address of NV12T[in]
239 *
240 * @param yuv420_width
241 * real width of YUV420[in]
242 *
243 * @param yuv420_height
244 * Y: real height of YUV420[in]
245 *
246 */
247void csc_tiled_to_linear_y_neon(
248 unsigned char *y_dst,
249 unsigned char *y_src,
250 unsigned int width,
251 unsigned int height);
252
253/*
254 * Converts tiled data to linear for mfc 6.x
255 * 1. UV of NV12T to Y of YUV420S
256 *
257 * @param u_dst
258 * UV plane address of YUV420P[out]
259 *
260 * @param nv12t_src
261 * Y or UV plane address of NV12T[in]
262 *
263 * @param yuv420_width
264 * real width of YUV420[in]
265 *
266 * @param yuv420_height
267 * (real height)/2 of YUV420[in]
268 */
269void csc_tiled_to_linear_uv_neon(
270 unsigned char *uv_dst,
271 unsigned char *uv_src,
272 unsigned int width,
273 unsigned int height);
274
275/*
276 * Converts tiled data to linear for mfc 6.x
277 * Deinterleave src to u_dst, v_dst
278 * 1. UV of NV12T to Y of YUV420P
279 *
280 * @param u_dst
281 * U plane address of YUV420P[out]
282 *
283 * @param v_dst
284 * V plane address of YUV420P[out]
285 *
286 * @param nv12t_src
287 * Y or UV plane address of NV12T[in]
288 *
289 * @param yuv420_width
290 * real width of YUV420[in]
291 *
292 * @param yuv420_height
293 * (real height)/2 of YUV420[in]
294 */
295void csc_tiled_to_linear_uv_deinterleave_neon(
296 unsigned char *u_dst,
297 unsigned char *v_dst,
298 unsigned char *uv_src,
299 unsigned int width,
300 unsigned int height);
301
302/*
303 * Converts linear data to tiled
304 * 1. y of yuv420 to y of nv12t
305 *
306 * @param dst
307 * y address of nv12t[out]
308 *
309 * @param src
310 * y address of yuv420[in]
311 *
312 * @param yuv420_width
313 * real width of yuv420[in]
314 * it should be even
315 *
316 * @param yuv420_height
317 * real height of yuv420[in]
318 * it should be even.
319 *
320 */
321void csc_linear_to_tiled_y_neon(
322 unsigned char *y_dst,
323 unsigned char *y_src,
324 unsigned int width,
325 unsigned int height);
326
327/*
328 * Converts and interleaves linear data to tiled
329 * 1. uv of nv12t to uv of yuv420
330 *
331 * @param dst
332 * uv address of nv12t[out]
333 *
334 * @param src
335 * u address of yuv420[in]
336 *
337 * @param src
338 * v address of yuv420[in]
339 *
340 * @param yuv420_width
341 * real width of yuv420[in]
342 *
343 * @param yuv420_height
344 * real height of yuv420[in]
345 *
346 */
347void csc_linear_to_tiled_uv_neon(
348 unsigned char *uv_dst,
349 unsigned char *u_src,
350 unsigned char *v_src,
351 unsigned int width,
352 unsigned int height);
353
354/*
355 * Converts RGB565 to YUV420P
356 *
357 * @param y_dst
358 * Y plane address of YUV420P[out]
359 *
360 * @param u_dst
361 * U plane address of YUV420P[out]
362 *
363 * @param v_dst
364 * V plane address of YUV420P[out]
365 *
366 * @param rgb_src
367 * Address of RGB565[in]
368 *
369 * @param width
370 * Width of RGB565[in]
371 *
372 * @param height
373 * Height of RGB565[in]
374 */
375void csc_RGB565_to_YUV420P(
376 unsigned char *y_dst,
377 unsigned char *u_dst,
378 unsigned char *v_dst,
379 unsigned char *rgb_src,
380 unsigned int width,
381 unsigned int height);
382
383/*
384 * Converts RGB565 to YUV420S
385 *
386 * @param y_dst
387 * Y plane address of YUV420S[out]
388 *
389 * @param uv_dst
390 * UV plane address of YUV420S[out]
391 *
392 * @param rgb_src
393 * Address of RGB565[in]
394 *
395 * @param width
396 * Width of RGB565[in]
397 *
398 * @param height
399 * Height of RGB565[in]
400 */
401void csc_RGB565_to_YUV420SP(
402 unsigned char *y_dst,
403 unsigned char *uv_dst,
404 unsigned char *rgb_src,
405 unsigned int width,
406 unsigned int height);
407
408/*
409 * Converts ARGB8888 to YUV420P
410 *
411 * @param y_dst
412 * Y plane address of YUV420P[out]
413 *
414 * @param u_dst
415 * U plane address of YUV420P[out]
416 *
417 * @param v_dst
418 * V plane address of YUV420P[out]
419 *
420 * @param rgb_src
421 * Address of ARGB8888[in]
422 *
423 * @param width
424 * Width of ARGB8888[in]
425 *
426 * @param height
427 * Height of ARGB8888[in]
428 */
429void csc_ARGB8888_to_YUV420P(
430 unsigned char *y_dst,
431 unsigned char *u_dst,
432 unsigned char *v_dst,
433 unsigned char *rgb_src,
434 unsigned int width,
435 unsigned int height);
436
437/*
438 * Converts ARGB888 to YUV420SP
439 *
440 * @param y_dst
441 * Y plane address of YUV420SP[out]
442 *
443 * @param uv_dst
444 * UV plane address of YUV420SP[out]
445 *
446 * @param rgb_src
447 * Address of ARGB8888[in]
448 *
449 * @param width
450 * Width of ARGB8888[in]
451 *
452 * @param height
453 * Height of ARGB8888[in]
454 */
455void csc_ARGB8888_to_YUV420SP(
456 unsigned char *y_dst,
457 unsigned char *uv_dst,
458 unsigned char *rgb_src,
459 unsigned int width,
460 unsigned int height);
461
462#endif /*COLOR_SPACE_CONVERTOR_H_*/