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
51 // Gamut (colorspace range)
53 HAL_PIXEL_GAMUT_DEFAULT
= 0,
55 HAL_PIXEL_GAMUT_WIDE_8
,
56 // Values range 16-235
57 HAL_PIXEL_GAMUT_NARROW_8
60 // Chromaticities (colorspace parameters)
62 HAL_PIXEL_CHROMA_DEFAULT
= 0,
63 // BT.601 "Standard Definition" color space
64 HAL_PIXEL_CHROMA_BT601_8
,
65 // BT.709 "High Definition" color space
66 HAL_PIXEL_CHROMA_BT709_8
71 unsigned int addr_cbcr
;
73 unsigned int reserved
;
76 /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
77 #define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
79 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
80 #define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
81 #define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
82 #define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
84 #define GET_32BPP_FRAME_SIZE(w, h) (((w) * (h)) << 2)
85 #define GET_24BPP_FRAME_SIZE(w, h) (((w) * (h)) * 3)
86 #define GET_16BPP_FRAME_SIZE(w, h) (((w) * (h)) << 1)
89 * Convert hal_pixel_format to v4l2_pixel_format.
91 * @param hal_pixel_format
92 * hal_pixel_format[in]
97 int HAL_PIXEL_FORMAT_2_V4L2_PIX(
98 int hal_pixel_format
);
101 * Convert v4l2_pixel_format to hal_pixel_format.
103 * @param v4l2_pixel_format
104 * v4l2_pixel_format[in]
109 int V4L2_PIX_2_HAL_PIXEL_FORMAT(
110 int v4l2_pixel_format
);
113 * Get frame_size of hal_pixel_format.
115 * @param hal_pixel_format
116 * hal_pixel_format[in]
127 unsigned int FRAME_SIZE(
128 int hal_pixel_format
,
132 int PLANAR_FRAME_SIZE(
133 int hal_pixel_format
,
136 unsigned int *luma_size
,
137 unsigned int *chroma_size
);
139 int NUM_PLANES(int hal_pixel_format
);
143 * Get bpp and plane of v4l2_pixel_format.
145 * @param v4l2_pixel_format
146 * v4l2_pixel_format[in]
149 * address of bpp[out]
152 * address of planes[out]
157 int V4L2_PIX_2_YUV_INFO(
158 unsigned int v4l2_pixel_format
,
160 unsigned int *planes
);
163 * Get bpp of v4l2_pixel_format.
165 * @param v4l2_pixel_format
166 * v4l2_pixel_format[in]
171 unsigned int get_yuv_bpp(
172 unsigned int v4l2_pixel_format
);
175 * Get plane of v4l2_pixel_format.
177 * @param v4l2_pixel_format
178 * v4l2_pixel_format[in]
183 unsigned int get_yuv_planes(
184 unsigned int v4l2_pixel_format
);