vidi/util/
mbus_list.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
use v4l2_subdev::MediaBusFmt;
use v4l2_subdev::MediaBusFmt::*;

pub const MBUS_LIST: &'static [(MediaBusFmt, &'static str)] = &[
    (FIXED, "FIXED"),
    (RGB444_1X12, "RGB444_1X12"),
    (RGB444_2X8_PADHI_BE, "RGB444_2X8_PADHI_BE"),
    (RGB444_2X8_PADHI_LE, "RGB444_2X8_PADHI_LE"),
    (RGB555_2X8_PADHI_BE, "RGB555_2X8_PADHI_BE"),
    (RGB555_2X8_PADHI_LE, "RGB555_2X8_PADHI_LE"),
    (RGB565_1X16, "RGB565_1X16"),
    (BGR565_2X8_BE, "BGR565_2X8_BE"),
    (BGR565_2X8_LE, "BGR565_2X8_LE"),
    (RGB565_2X8_BE, "RGB565_2X8_BE"),
    (RGB565_2X8_LE, "RGB565_2X8_LE"),
    (RGB666_1X18, "RGB666_1X18"),
    (RGB666_2X9_BE, "RGB666_2X9_BE"),
    (BGR666_1X18, "BGR666_1X18"),
    (RBG888_1X24, "RBG888_1X24"),
    (RGB666_1X24_CPADHI, "RGB666_1X24_CPADHI"),
    (BGR666_1X24_CPADHI, "BGR666_1X24_CPADHI"),
    (RGB565_1X24_CPADHI, "RGB565_1X24_CPADHI"),
    (RGB666_1X7X3_SPWG, "RGB666_1X7X3_SPWG"),
    (BGR888_1X24, "BGR888_1X24"),
    (BGR888_3X8, "BGR888_3X8"),
    (GBR888_1X24, "GBR888_1X24"),
    (RGB888_1X24, "RGB888_1X24"),
    (RGB888_2X12_BE, "RGB888_2X12_BE"),
    (RGB888_2X12_LE, "RGB888_2X12_LE"),
    (RGB888_3X8, "RGB888_3X8"),
    (RGB888_3X8_DELTA, "RGB888_3X8_DELTA"),
    (RGB888_1X7X4_SPWG, "RGB888_1X7X4_SPWG"),
    (RGB888_1X7X4_JEIDA, "RGB888_1X7X4_JEIDA"),
    (RGB666_1X30_CPADLO, "RGB666_1X30_CPADLO"),
    (RGB888_1X30_CPADLO, "RGB888_1X30_CPADLO"),
    (ARGB8888_1X32, "ARGB8888_1X32"),
    (RGB888_1X32_PADHI, "RGB888_1X32_PADHI"),
    (RGB101010_1X30, "RGB101010_1X30"),
    (RGB666_1X36_CPADLO, "RGB666_1X36_CPADLO"),
    (RGB888_1X36_CPADLO, "RGB888_1X36_CPADLO"),
    (RGB121212_1X36, "RGB121212_1X36"),
    (RGB161616_1X48, "RGB161616_1X48"),
    (Y8_1X8, "Y8_1X8"),
    (UV8_1X8, "UV8_1X8"),
    (UYVY8_1_5X8, "UYVY8_1_5X8"),
    (VYUY8_1_5X8, "VYUY8_1_5X8"),
    (YUYV8_1_5X8, "YUYV8_1_5X8"),
    (YVYU8_1_5X8, "YVYU8_1_5X8"),
    (UYVY8_2X8, "UYVY8_2X8"),
    (VYUY8_2X8, "VYUY8_2X8"),
    (YUYV8_2X8, "YUYV8_2X8"),
    (YVYU8_2X8, "YVYU8_2X8"),
    (Y10_1X10, "Y10_1X10"),
    (Y10_2X8_PADHI_LE, "Y10_2X8_PADHI_LE"),
    (UYVY10_2X10, "UYVY10_2X10"),
    (VYUY10_2X10, "VYUY10_2X10"),
    (YUYV10_2X10, "YUYV10_2X10"),
    (YVYU10_2X10, "YVYU10_2X10"),
    (Y12_1X12, "Y12_1X12"),
    (UYVY12_2X12, "UYVY12_2X12"),
    (VYUY12_2X12, "VYUY12_2X12"),
    (YUYV12_2X12, "YUYV12_2X12"),
    (YVYU12_2X12, "YVYU12_2X12"),
    (Y14_1X14, "Y14_1X14"),
    (Y16_1X16, "Y16_1X16"),
    (UYVY8_1X16, "UYVY8_1X16"),
    (VYUY8_1X16, "VYUY8_1X16"),
    (YUYV8_1X16, "YUYV8_1X16"),
    (YVYU8_1X16, "YVYU8_1X16"),
    (YDYUYDYV8_1X16, "YDYUYDYV8_1X16"),
    (UYVY10_1X20, "UYVY10_1X20"),
    (VYUY10_1X20, "VYUY10_1X20"),
    (YUYV10_1X20, "YUYV10_1X20"),
    (YVYU10_1X20, "YVYU10_1X20"),
    (VUY8_1X24, "VUY8_1X24"),
    (YUV8_1X24, "YUV8_1X24"),
    (UYYVYY8_0_5X24, "UYYVYY8_0_5X24"),
    (UYVY12_1X24, "UYVY12_1X24"),
    (VYUY12_1X24, "VYUY12_1X24"),
    (YUYV12_1X24, "YUYV12_1X24"),
    (YVYU12_1X24, "YVYU12_1X24"),
    (YUV10_1X30, "YUV10_1X30"),
    (UYYVYY10_0_5X30, "UYYVYY10_0_5X30"),
    (AYUV8_1X32, "AYUV8_1X32"),
    (UYYVYY12_0_5X36, "UYYVYY12_0_5X36"),
    (YUV12_1X36, "YUV12_1X36"),
    (YUV16_1X48, "YUV16_1X48"),
    (UYYVYY16_0_5X48, "UYYVYY16_0_5X48"),
    (SBGGR8_1X8, "SBGGR8_1X8"),
    (SGBRG8_1X8, "SGBRG8_1X8"),
    (SGRBG8_1X8, "SGRBG8_1X8"),
    (SRGGB8_1X8, "SRGGB8_1X8"),
    (SBGGR10_ALAW8_1X8, "SBGGR10_ALAW8_1X8"),
    (SGBRG10_ALAW8_1X8, "SGBRG10_ALAW8_1X8"),
    (SGRBG10_ALAW8_1X8, "SGRBG10_ALAW8_1X8"),
    (SRGGB10_ALAW8_1X8, "SRGGB10_ALAW8_1X8"),
    (SBGGR10_DPCM8_1X8, "SBGGR10_DPCM8_1X8"),
    (SGBRG10_DPCM8_1X8, "SGBRG10_DPCM8_1X8"),
    (SGRBG10_DPCM8_1X8, "SGRBG10_DPCM8_1X8"),
    (SRGGB10_DPCM8_1X8, "SRGGB10_DPCM8_1X8"),
    (SBGGR10_2X8_PADHI_BE, "SBGGR10_2X8_PADHI_BE"),
    (SBGGR10_2X8_PADHI_LE, "SBGGR10_2X8_PADHI_LE"),
    (SBGGR10_2X8_PADLO_BE, "SBGGR10_2X8_PADLO_BE"),
    (SBGGR10_2X8_PADLO_LE, "SBGGR10_2X8_PADLO_LE"),
    (SBGGR10_1X10, "SBGGR10_1X10"),
    (SGBRG10_1X10, "SGBRG10_1X10"),
    (SGRBG10_1X10, "SGRBG10_1X10"),
    (SRGGB10_1X10, "SRGGB10_1X10"),
    (SBGGR12_1X12, "SBGGR12_1X12"),
    (SGBRG12_1X12, "SGBRG12_1X12"),
    (SGRBG12_1X12, "SGRBG12_1X12"),
    (SRGGB12_1X12, "SRGGB12_1X12"),
    (SBGGR14_1X14, "SBGGR14_1X14"),
    (SGBRG14_1X14, "SGBRG14_1X14"),
    (SGRBG14_1X14, "SGRBG14_1X14"),
    (SRGGB14_1X14, "SRGGB14_1X14"),
    (SBGGR16_1X16, "SBGGR16_1X16"),
    (SGBRG16_1X16, "SGBRG16_1X16"),
    (SGRBG16_1X16, "SGRBG16_1X16"),
    (SRGGB16_1X16, "SRGGB16_1X16"),
    (JPEG_1X8, "JPEG_1X8"),
    (S5C_UYVY_JPEG_1X8, "S5C_UYVY_JPEG_1X8"),
    (AHSV8888_1X32, "AHSV8888_1X32"),
    (METADATA_FIXED, "METADATA_FIXED"),
    (META_8, "META_8"),
    (META_10, "META_10"),
    (META_12, "META_12"),
    (META_14, "META_14"),
    (META_16, "META_16"),
    (META_20, "META_20"),
    (META_24, "META_24"),
];

#[cfg(test)]
mod test {
    use super::*;
    
    #[test]
    fn complete() {
        for code in MediaBusFmt::iter() {
            MBUS_LIST.iter()
                .find(|(c, _)| *c == code)
                .expect(&format!("Code {:?} not in the list", code));
        }
    }

    #[test]
    fn dupes() {
        for (_, name) in MBUS_LIST.iter() {
            assert_eq!(
                MBUS_LIST.iter()
                    .filter(|(_, n)| n == name)
                    .count(),
                1,
            );
        }
    }
}