Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 1 | .. -*- coding: utf-8; mode: rst -*- |
| 2 | |
| 3 | .. _V4L2-PIX-FMT-NV12: |
| 4 | |
| 5 | ****************************************************** |
| 6 | V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21') |
| 7 | ****************************************************** |
| 8 | |
| 9 | *man V4L2_PIX_FMT_NV12(2)* |
| 10 | |
| 11 | V4L2_PIX_FMT_NV21 |
| 12 | Formats with ½ horizontal and vertical chroma resolution, also known as |
| 13 | YUV 4:2:0. One luminance and one chrominance plane with alternating |
| 14 | chroma samples as opposed to ``V4L2_PIX_FMT_YVU420`` |
| 15 | |
| 16 | |
| 17 | Description |
| 18 | =========== |
| 19 | |
| 20 | These are two-plane versions of the YUV 4:2:0 format. The three |
| 21 | components are separated into two sub-images or planes. The Y plane is |
| 22 | first. The Y plane has one byte per pixel. For ``V4L2_PIX_FMT_NV12``, a |
| 23 | combined CbCr plane immediately follows the Y plane in memory. The CbCr |
| 24 | plane is the same width, in bytes, as the Y plane (and of the image), |
| 25 | but is half as tall in pixels. Each CbCr pair belongs to four pixels. |
Mauro Carvalho Chehab | eba9e91 | 2016-07-04 09:04:31 -0300 | [diff] [blame] | 26 | For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`, |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 27 | Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`. ``V4L2_PIX_FMT_NV21`` is |
| 28 | the same except the Cb and Cr bytes are swapped, the CrCb plane starts |
| 29 | with a Cr byte. |
| 30 | |
| 31 | If the Y plane has pad bytes after each row, then the CbCr plane has as |
| 32 | many pad bytes after its rows. |
| 33 | |
Mauro Carvalho Chehab | 056d2ee | 2016-07-04 13:58:01 -0300 | [diff] [blame^] | 34 | **Byte Order.** |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 35 | Each cell is one byte. |
| 36 | |
| 37 | |
| 38 | |
| 39 | .. flat-table:: |
| 40 | :header-rows: 0 |
| 41 | :stub-columns: 0 |
| 42 | :widths: 2 1 1 1 1 |
| 43 | |
| 44 | |
| 45 | - .. row 1 |
| 46 | |
| 47 | - start + 0: |
| 48 | |
| 49 | - Y'\ :sub:`00` |
| 50 | |
| 51 | - Y'\ :sub:`01` |
| 52 | |
| 53 | - Y'\ :sub:`02` |
| 54 | |
| 55 | - Y'\ :sub:`03` |
| 56 | |
| 57 | - .. row 2 |
| 58 | |
| 59 | - start + 4: |
| 60 | |
| 61 | - Y'\ :sub:`10` |
| 62 | |
| 63 | - Y'\ :sub:`11` |
| 64 | |
| 65 | - Y'\ :sub:`12` |
| 66 | |
| 67 | - Y'\ :sub:`13` |
| 68 | |
| 69 | - .. row 3 |
| 70 | |
| 71 | - start + 8: |
| 72 | |
| 73 | - Y'\ :sub:`20` |
| 74 | |
| 75 | - Y'\ :sub:`21` |
| 76 | |
| 77 | - Y'\ :sub:`22` |
| 78 | |
| 79 | - Y'\ :sub:`23` |
| 80 | |
| 81 | - .. row 4 |
| 82 | |
| 83 | - start + 12: |
| 84 | |
| 85 | - Y'\ :sub:`30` |
| 86 | |
| 87 | - Y'\ :sub:`31` |
| 88 | |
| 89 | - Y'\ :sub:`32` |
| 90 | |
| 91 | - Y'\ :sub:`33` |
| 92 | |
| 93 | - .. row 5 |
| 94 | |
| 95 | - start + 16: |
| 96 | |
| 97 | - Cb\ :sub:`00` |
| 98 | |
| 99 | - Cr\ :sub:`00` |
| 100 | |
| 101 | - Cb\ :sub:`01` |
| 102 | |
| 103 | - Cr\ :sub:`01` |
| 104 | |
| 105 | - .. row 6 |
| 106 | |
| 107 | - start + 20: |
| 108 | |
| 109 | - Cb\ :sub:`10` |
| 110 | |
| 111 | - Cr\ :sub:`10` |
| 112 | |
| 113 | - Cb\ :sub:`11` |
| 114 | |
| 115 | - Cr\ :sub:`11` |
| 116 | |
| 117 | |
| 118 | **Color Sample Location..** |
| 119 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 120 | .. flat-table:: |
| 121 | :header-rows: 0 |
| 122 | :stub-columns: 0 |
| 123 | |
| 124 | |
| 125 | - .. row 1 |
| 126 | |
| 127 | - |
| 128 | - 0 |
| 129 | |
| 130 | - |
| 131 | - 1 |
| 132 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 133 | - 2 |
| 134 | |
| 135 | - |
| 136 | - 3 |
| 137 | |
| 138 | - .. row 2 |
| 139 | |
| 140 | - 0 |
| 141 | |
| 142 | - Y |
| 143 | |
| 144 | - |
| 145 | - Y |
| 146 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 147 | - Y |
| 148 | |
| 149 | - |
| 150 | - Y |
| 151 | |
| 152 | - .. row 3 |
| 153 | |
| 154 | - |
| 155 | - |
| 156 | - C |
| 157 | |
| 158 | - |
| 159 | - |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 160 | - C |
| 161 | |
| 162 | - |
| 163 | |
| 164 | - .. row 4 |
| 165 | |
| 166 | - 1 |
| 167 | |
| 168 | - Y |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 169 | - |
Mauro Carvalho Chehab | 31ad250 | 2016-07-03 18:55:19 -0300 | [diff] [blame] | 170 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 171 | - Y |
| 172 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 173 | - Y |
| 174 | |
| 175 | - |
| 176 | - Y |
| 177 | |
| 178 | - .. row 5 |
| 179 | |
| 180 | - |
| 181 | |
| 182 | - .. row 6 |
| 183 | |
| 184 | - 2 |
| 185 | |
| 186 | - Y |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 187 | - |
Mauro Carvalho Chehab | 31ad250 | 2016-07-03 18:55:19 -0300 | [diff] [blame] | 188 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 189 | - Y |
| 190 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 191 | - Y |
| 192 | |
| 193 | - |
| 194 | - Y |
| 195 | |
| 196 | - .. row 7 |
| 197 | |
| 198 | - |
| 199 | - |
| 200 | - C |
| 201 | |
| 202 | - |
| 203 | - |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 204 | - C |
| 205 | |
| 206 | - |
| 207 | |
| 208 | - .. row 8 |
| 209 | |
| 210 | - 3 |
| 211 | |
| 212 | - Y |
| 213 | |
| 214 | - |
| 215 | - Y |
| 216 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 217 | - Y |
| 218 | |
| 219 | - |
| 220 | - Y |