2 * Copyright@ Samsung Electronics Co. LTD
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 _EXYNOS_FORMAT_H_
18 #define _EXYNOS_FORMAT_H_
25 HAL_PIXEL_FORMAT_YCbCr_422_P
= 0x100,
26 HAL_PIXEL_FORMAT_YCbCr_420_P
= 0x101,
27 HAL_PIXEL_FORMAT_YCbCr_420_I
= 0x102,
28 HAL_PIXEL_FORMAT_CbYCrY_422_I
= 0x103,
29 HAL_PIXEL_FORMAT_CbYCrY_420_I
= 0x104,
30 HAL_PIXEL_FORMAT_YCbCr_420_SP
= 0x105,
31 HAL_PIXEL_FORMAT_YCrCb_422_SP
= 0x106,
32 HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED
= 0x107,
33 HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888
= 0x108,
34 // support custom format for zero copy
35 HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP
= 0x110,
36 HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP
= 0x111,
37 HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED
= 0x112,
38 HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP
= 0x113,
39 HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP
= 0x114,
40 HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I
= 0x115,
41 HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I
= 0x116,
42 HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I
= 0x117,
43 HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I
= 0x118,
44 HAL_PIXEL_FORMAT_CUSTOM_CbYCr_422_I
= 0x11B,
46 HAL_PIXEL_FORMAT_EXYNOS_YV12
= 0x11C,
47 HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP
= 0x11D,
48 HAL_PIXEL_FORMAT_CUSTOM_MAX
53 unsigned int addr_cbcr
;
55 unsigned int reserved
;
58 /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
59 #define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
61 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
62 #define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
63 #define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
64 #define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
66 #define GET_32BPP_FRAME_SIZE(w, h) (((w) * (h)) << 2)
67 #define GET_24BPP_FRAME_SIZE(w, h) (((w) * (h)) * 3)
68 #define GET_16BPP_FRAME_SIZE(w, h) (((w) * (h)) << 1)
71 * Convert hal_pixel_format to v4l2_pixel_format.
73 * @param hal_pixel_format
74 * hal_pixel_format[in]
79 int HAL_PIXEL_FORMAT_2_V4L2_PIX(
80 int hal_pixel_format
);
83 * Convert v4l2_pixel_format to hal_pixel_format.
85 * @param v4l2_pixel_format
86 * v4l2_pixel_format[in]
91 int V4L2_PIX_2_HAL_PIXEL_FORMAT(
92 int v4l2_pixel_format
);
95 * Get frame_size of hal_pixel_format.
97 * @param hal_pixel_format
98 * hal_pixel_format[in]
109 unsigned int FRAME_SIZE(
110 int hal_pixel_format
,
114 int PLANAR_FRAME_SIZE(
115 int hal_pixel_format
,
118 unsigned int *luma_size
,
119 unsigned int *chroma_size
);
121 int NUM_PLANES(int hal_pixel_format
);
125 * Get bpp and plane of v4l2_pixel_format.
127 * @param v4l2_pixel_format
128 * v4l2_pixel_format[in]
131 * address of bpp[out]
134 * address of planes[out]
139 int V4L2_PIX_2_YUV_INFO(
140 unsigned int v4l2_pixel_format
,
142 unsigned int *planes
);
145 * Get bpp of v4l2_pixel_format.
147 * @param v4l2_pixel_format
148 * v4l2_pixel_format[in]
153 unsigned int get_yuv_bpp(
154 unsigned int v4l2_pixel_format
);
157 * Get plane of v4l2_pixel_format.
159 * @param v4l2_pixel_format
160 * v4l2_pixel_format[in]
165 unsigned int get_yuv_planes(
166 unsigned int v4l2_pixel_format
);