scuffle_h264/enums/
aspect_ratio_idc.rs

1use nutype_enum::nutype_enum;
2
3nutype_enum! {
4    /// The `AspectRatioIdc` is a nutype enum for `aspect_ratio_idc` as defined in
5    /// ISO/IEC-14496-10-2022 - E.2.1 Table E-1.
6    ///
7    /// Values 17..=254** are reserved (should be ignored if encountered)
8    /// **Value 255 (`ExtendedSar`)** indicates that the aspect ratio is specified by
9    ///   additional fields (`sar_width` and `sar_height`) in the bitstream.
10    ///
11    /// ## Examples of aspect_ratio_idc values:
12    /// - `1` => 1:1 ("square")
13    /// - `4` => 16:11
14    /// - `14` => 4:3
15    /// - `15` => 3:2
16    /// - `16` => 2:1
17    pub enum AspectRatioIdc(u8) {
18        /// 0: Unspecified (not used in decoding)
19        Unspecified = 0,
20
21        /// 1: 1:1 (square)
22        /// ## Examples
23        /// - 7680 x 4320 16:9 w/o horizontal overscan
24        /// - 3840 x 2160 16:9 w/o horizontal overscan
25        /// - 1280 x 720 16:9 w/o horizontal overscan
26        /// - 1920 x 1080 16:9 w/o horizontal overscan (cropped from 1920x1088)
27        /// - 640 x 480 4:3 w/o horizontal overscan
28        Square = 1,
29
30        /// 2: 12:11
31        /// ## Examples
32        /// - 720 x 576 4:3 with horizontal overscan
33        /// - 352 x 288 4:3 w/o horizontal overscan
34        Aspect12_11 = 2,
35
36        /// 3: 10:11
37        /// ## Examples
38        /// - 720 x 480 4:3 with horizontal overscan
39        /// - 352 x 240 4:3 w/o horizontal overscan
40        Aspect10_11 = 3,
41
42        /// 4: 16:11
43        /// ## Examples
44        /// - 720 x 576 16:9 with horizontal overscan
45        /// - 528 x 576 4:3 w/o horizontal overscan
46        Aspect16_11 = 4,
47
48        /// 5: 40:33
49        /// ## Examples
50        /// - 720 x 480 16:9 with horizontal overscan
51        /// - 528 x 480 4:3 w/o horizontal overscan
52        Aspect40_33 = 5,
53
54        /// 6: 24:11
55        /// ## Examples
56        /// - 352 x 576 4:3 w/o horizontal overscan
57        /// - 480 x 576 16:9 with horizontal overscan
58        Aspect24_11 = 6,
59
60        /// 7: 20:11
61        /// ## Examples
62        /// - 352 x 480 4:3 w/o horizontal overscan
63        /// - 480 x 480 16:9 with horizontal overscan
64        Aspect20_11 = 7,
65
66        /// 8: 32:11
67        /// ## Example
68        /// - 352 x 576 16:9 w/o horizontal overscan
69        Aspect32_11 = 8,
70
71        /// 9: 80:33
72        /// ## Example
73        /// - 352 x 480 16:9 w/o horizontal overscan
74        Aspect80_33 = 9,
75
76        /// 10: 18:11
77        /// ## Example
78        /// - 480 x 576 16:9 with horizontal overscan
79        Aspect18_11 = 10,
80
81        /// 11: 15:11
82        /// ## Example
83        /// - 480 x 480 4:3 with horizontal overscan
84        Aspect15_11 = 11,
85
86        /// 12: 64:33
87        /// ## Example
88        /// - 528 x 576 16:9 w/o horizontal overscan
89        Aspect64_33 = 12,
90
91        /// 13: 160:99
92        /// ## Example
93        /// - 528 x 480 16:9 w/o horizontal overscan
94        Aspect160_99 = 13,
95
96        /// 14: 4:3
97        /// ## Example
98        /// - 1440 x 1080 16:9 w/o horizontal overscan
99        Aspect4_3 = 14,
100
101        /// 15: 3:2
102        /// ## Example
103        /// - 1280 x 1080 16:9 w/o horizontal overscan
104        Aspect3_2 = 15,
105
106        /// 16: 2:1
107        /// ## Example
108        /// - 960 x 1080 16:9 w/o horizontal overscan
109        Aspect2_1 = 16,
110
111        /// 17..=254: Reserved (should be ignored)
112        Reserved = 17,
113
114        /// 255: Extended SAR (use `sar_width` & `sar_height` from bitstream)
115        ExtendedSar = 255
116    }
117}