1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef __IA_CSS_FRAME_FORMAT_H
8 #define __IA_CSS_FRAME_FORMAT_H
9 
10 /* @file
11  * This file contains information about formats supported in the ISP
12  */
13 
14 /* Frame formats, some of these come from fourcc.org, others are
15    better explained by video4linux2. The NV11 seems to be described only
16    on MSDN pages, but even those seem to be gone now.
17    Frames can come in many forms, the main categories are RAW, RGB and YUV
18    (or YCbCr). The YUV frames come in 4 flavors, determined by how the U and V
19    values are subsampled:
20    1. YUV420: hor = 2, ver = 2
21    2. YUV411: hor = 4, ver = 1
22    3. YUV422: hor = 2, ver = 1
23    4. YUV444: hor = 1, ver = 1
24 
25   Warning: not all frame formats are supported as input or output to/from ISP.
26     Some of these formats are therefore not defined in the output table module.
27     Modifications in below frame format enum can require modifications in the
28     output table module.
29 
30   Warning2: Throughout the CSS code assumptions are made on the order
31 	of formats in this enumeration type, or some sort of copy is maintained.
32 	The following files are identified:
33 	- FileSupport.h
34 	- css/isp/kernels/fc/fc_1.0/formats.isp.c
35 	- css/isp/kernels/output/output_1.0/output_table.isp.c
36 	- css/isp/kernels/output/sc_output_1.0/formats.hive.c
37 	- css/isp/modes/interface/isp_formats.isp.h
38 	- css/bxt_sandbox/psyspoc/interface/ia_css_pg_info.h
39 	- css/bxt_sandbox/psysapi/data/interface/ia_css_program_group_data.h
40 	- css/bxt_sandbox/isysapi/interface/ia_css_isysapi_fw_types.h
41 */
42 enum ia_css_frame_format {
43 	IA_CSS_FRAME_FORMAT_NV11 = 0,   /** 12 bit YUV 411, Y, UV plane */
44 	IA_CSS_FRAME_FORMAT_NV12,       /** 12 bit YUV 420, Y, UV plane */
45 	IA_CSS_FRAME_FORMAT_NV12_16,    /** 16 bit YUV 420, Y, UV plane */
46 	IA_CSS_FRAME_FORMAT_NV12_TILEY, /** 12 bit YUV 420, Intel proprietary tiled format, TileY */
47 	IA_CSS_FRAME_FORMAT_NV16,       /** 16 bit YUV 422, Y, UV plane */
48 	IA_CSS_FRAME_FORMAT_NV21,       /** 12 bit YUV 420, Y, VU plane */
49 	IA_CSS_FRAME_FORMAT_NV61,       /** 16 bit YUV 422, Y, VU plane */
50 	IA_CSS_FRAME_FORMAT_YV12,       /** 12 bit YUV 420, Y, V, U plane */
51 	IA_CSS_FRAME_FORMAT_YV16,       /** 16 bit YUV 422, Y, V, U plane */
52 	IA_CSS_FRAME_FORMAT_YUV420,     /** 12 bit YUV 420, Y, U, V plane */
53 	IA_CSS_FRAME_FORMAT_YUV420_16,  /** yuv420, 16 bits per subpixel */
54 	IA_CSS_FRAME_FORMAT_YUV422,     /** 16 bit YUV 422, Y, U, V plane */
55 	IA_CSS_FRAME_FORMAT_YUV422_16,  /** yuv422, 16 bits per subpixel */
56 	IA_CSS_FRAME_FORMAT_UYVY,       /** 16 bit YUV 422, UYVY interleaved */
57 	IA_CSS_FRAME_FORMAT_YUYV,       /** 16 bit YUV 422, YUYV interleaved */
58 	IA_CSS_FRAME_FORMAT_YUV444,     /** 24 bit YUV 444, Y, U, V plane */
59 	IA_CSS_FRAME_FORMAT_YUV_LINE,   /** Internal format, 2 y lines followed
60 					     by a uvinterleaved line */
61 	IA_CSS_FRAME_FORMAT_RAW,	/** RAW, 1 plane */
62 	IA_CSS_FRAME_FORMAT_RGB565,     /** 16 bit RGB, 1 plane. Each 3 sub
63 					     pixels are packed into one 16 bit
64 					     value, 5 bits for R, 6 bits for G
65 					     and 5 bits for B. */
66 	IA_CSS_FRAME_FORMAT_PLANAR_RGB888, /** 24 bit RGB, 3 planes */
67 	IA_CSS_FRAME_FORMAT_RGBA888,	/** 32 bit RGBA, 1 plane, A=Alpha
68 					     (alpha is unused) */
69 	IA_CSS_FRAME_FORMAT_QPLANE6, /** Internal, for advanced ISP */
70 	IA_CSS_FRAME_FORMAT_BINARY_8,	/** byte stream, used for jpeg. For
71 					     frames of this type, we set the
72 					     height to 1 and the width to the
73 					     number of allocated bytes. */
74 	IA_CSS_FRAME_FORMAT_MIPI,	/** MIPI frame, 1 plane */
75 	IA_CSS_FRAME_FORMAT_RAW_PACKED, /** RAW, 1 plane, packed */
76 	IA_CSS_FRAME_FORMAT_CSI_MIPI_YUV420_8,	      /** 8 bit per Y/U/V.
77 							   Y odd line; UYVY
78 							   interleaved even line */
79 	IA_CSS_FRAME_FORMAT_CSI_MIPI_LEGACY_YUV420_8, /** Legacy YUV420. UY odd
80 							   line; VY even line */
81 	IA_CSS_FRAME_FORMAT_CSI_MIPI_YUV420_10       /** 10 bit per Y/U/V. Y odd
82 							   line; UYVY interleaved
83 							   even line */
84 };
85 
86 /* NOTE: IA_CSS_FRAME_FORMAT_NUM was purposely defined outside of enum type ia_css_frame_format, */
87 /*       because of issues this would cause with the Clockwork code checking tool.               */
88 #define IA_CSS_FRAME_FORMAT_NUM (IA_CSS_FRAME_FORMAT_CSI_MIPI_YUV420_10 + 1)
89 
90 /* Number of valid output frame formats for ISP **/
91 #define IA_CSS_FRAME_OUT_FORMAT_NUM	(IA_CSS_FRAME_FORMAT_RGBA888 + 1)
92 
93 #endif /* __IA_CSS_FRAME_FORMAT_H */
94