1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> 2<HTML 3><HEAD 4><TITLE 5>V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')</TITLE 6><META 7NAME="GENERATOR" 8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9REL="HOME" 10TITLE="Video for Linux Two API Specification" 11HREF="book1.htm"><LINK 12REL="UP" 13TITLE="YUV Formats" 14HREF="x3891.htm"><LINK 15REL="PREVIOUS" 16TITLE="V4L2_PIX_FMT_YUV411P ('411P')" 17HREF="r5319.htm"><LINK 18REL="NEXT" 19TITLE="Compressed Formats" 20HREF="x5634.htm"></HEAD 21><BODY 22CLASS="REFENTRY" 23BGCOLOR="#FFFFFF" 24TEXT="#000000" 25LINK="#0000FF" 26VLINK="#840084" 27ALINK="#0000FF" 28><DIV 29CLASS="NAVHEADER" 30><TABLE 31SUMMARY="Header navigation table" 32WIDTH="100%" 33BORDER="0" 34CELLPADDING="0" 35CELLSPACING="0" 36><TR 37><TH 38COLSPAN="3" 39ALIGN="center" 40>Video for Linux Two API Specification: Revision 0.24</TH 41></TR 42><TR 43><TD 44WIDTH="10%" 45ALIGN="left" 46VALIGN="bottom" 47><A 48HREF="r5319.htm" 49ACCESSKEY="P" 50>Prev</A 51></TD 52><TD 53WIDTH="80%" 54ALIGN="center" 55VALIGN="bottom" 56></TD 57><TD 58WIDTH="10%" 59ALIGN="right" 60VALIGN="bottom" 61><A 62HREF="x5634.htm" 63ACCESSKEY="N" 64>Next</A 65></TD 66></TR 67></TABLE 68><HR 69ALIGN="LEFT" 70WIDTH="100%"></DIV 71><H1 72><A 73NAME="AEN5470" 74></A 75>V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN5474" 80></A 81><H2 82>Name</H2 83><CODE 84CLASS="CONSTANT" 85>V4L2_PIX_FMT_NV12</CODE 86>, <CODE 87CLASS="CONSTANT" 88>V4L2_PIX_FMT_NV21</CODE 89> -- Formats with ½ horizontal and vertical 90chroma resolution, also known as YUV 4:2:0. One luminance and one 91chrominance plane with alternating chroma samples as opposed to 92<CODE 93CLASS="CONSTANT" 94>V4L2_PIX_FMT_YVU420</CODE 95></DIV 96><DIV 97CLASS="REFSECT1" 98><A 99NAME="AEN5481" 100></A 101><H2 102>Description</H2 103><P 104>These are two-plane versions of the YUV 4:2:0 format. 105The three components are separated into two sub-images or planes. The 106Y plane is first. The Y plane has one byte per pixel. For 107<CODE 108CLASS="CONSTANT" 109>V4L2_PIX_FMT_NV12</CODE 110>, a combined CbCr plane 111immediately follows the Y plane in memory. The CbCr plane is the same 112width, in bytes, as the Y plane (and of the image), but is half as 113tall in pixels. Each CbCr pair belongs to four pixels. For example, 114Cb<SUB 115>0</SUB 116>/Cr<SUB 117>0</SUB 118> belongs to 119Y'<SUB 120>00</SUB 121>, Y'<SUB 122>01</SUB 123>, 124Y'<SUB 125>10</SUB 126>, Y'<SUB 127>11</SUB 128>. 129<CODE 130CLASS="CONSTANT" 131>V4L2_PIX_FMT_NV21</CODE 132> is the same except the Cb and 133Cr bytes are swapped, the CrCb plane starts with a Cr byte.</P 134><P 135>If the Y plane has pad bytes after each row, then the 136CbCr plane has as many pad bytes after its rows.</P 137><DIV 138CLASS="EXAMPLE" 139><A 140NAME="AEN5493" 141></A 142><P 143><B 144>Example 2-1. <CODE 145CLASS="CONSTANT" 146>V4L2_PIX_FMT_NV12</CODE 147> 4 × 4 148pixel image</B 149></P 150><DIV 151CLASS="FORMALPARA" 152><P 153><B 154>Byte Order. </B 155>Each cell is one byte. 156 <DIV 157CLASS="INFORMALTABLE" 158><P 159></P 160><A 161NAME="AEN5499" 162></A 163><TABLE 164BORDER="0" 165FRAME="void" 166CLASS="CALSTABLE" 167><COL 168WIDTH="2*" 169ALIGN="LEFT"><COL><COL><COL><COL><TBODY 170VALIGN="TOP" 171><TR 172><TD 173>start + 0:</TD 174><TD 175>Y'<SUB 176>00</SUB 177></TD 178><TD 179>Y'<SUB 180>01</SUB 181></TD 182><TD 183>Y'<SUB 184>02</SUB 185></TD 186><TD 187>Y'<SUB 188>03</SUB 189></TD 190></TR 191><TR 192><TD 193>start + 4:</TD 194><TD 195>Y'<SUB 196>10</SUB 197></TD 198><TD 199>Y'<SUB 200>11</SUB 201></TD 202><TD 203>Y'<SUB 204>12</SUB 205></TD 206><TD 207>Y'<SUB 208>13</SUB 209></TD 210></TR 211><TR 212><TD 213>start + 8:</TD 214><TD 215>Y'<SUB 216>20</SUB 217></TD 218><TD 219>Y'<SUB 220>21</SUB 221></TD 222><TD 223>Y'<SUB 224>22</SUB 225></TD 226><TD 227>Y'<SUB 228>23</SUB 229></TD 230></TR 231><TR 232><TD 233>start + 12:</TD 234><TD 235>Y'<SUB 236>30</SUB 237></TD 238><TD 239>Y'<SUB 240>31</SUB 241></TD 242><TD 243>Y'<SUB 244>32</SUB 245></TD 246><TD 247>Y'<SUB 248>33</SUB 249></TD 250></TR 251><TR 252><TD 253>start + 16:</TD 254><TD 255>Cb<SUB 256>00</SUB 257></TD 258><TD 259>Cr<SUB 260>00</SUB 261></TD 262><TD 263>Cb<SUB 264>01</SUB 265></TD 266><TD 267>Cr<SUB 268>01</SUB 269></TD 270></TR 271><TR 272><TD 273>start + 20:</TD 274><TD 275>Cb<SUB 276>10</SUB 277></TD 278><TD 279>Cr<SUB 280>10</SUB 281></TD 282><TD 283>Cb<SUB 284>11</SUB 285></TD 286><TD 287>Cr<SUB 288>11</SUB 289></TD 290></TR 291></TBODY 292></TABLE 293><P 294></P 295></DIV 296> 297 </P 298></DIV 299><DIV 300CLASS="FORMALPARA" 301><P 302><B 303>Color Sample Location. </B 304> <DIV 305CLASS="INFORMALTABLE" 306><P 307></P 308><A 309NAME="AEN5566" 310></A 311><TABLE 312BORDER="0" 313FRAME="void" 314CLASS="CALSTABLE" 315><COL><COL><COL><COL><COL><COL><COL><TBODY 316VALIGN="TOP" 317><TR 318><TD 319> </TD 320><TD 321>0</TD 322><TD 323> </TD 324><TD 325>1</TD 326><TD 327> </TD 328><TD 329>2</TD 330><TD 331> </TD 332><TD 333>3</TD 334></TR 335><TR 336><TD 337>0</TD 338><TD 339>Y</TD 340><TD 341> </TD 342><TD 343>Y</TD 344><TD 345> </TD 346><TD 347>Y</TD 348><TD 349> </TD 350><TD 351>Y</TD 352></TR 353><TR 354><TD 355> </TD 356><TD 357> </TD 358><TD 359>C</TD 360><TD 361> </TD 362><TD 363> </TD 364><TD 365> </TD 366><TD 367>C</TD 368><TD 369> </TD 370></TR 371><TR 372><TD 373>1</TD 374><TD 375>Y</TD 376><TD 377> </TD 378><TD 379>Y</TD 380><TD 381> </TD 382><TD 383>Y</TD 384><TD 385> </TD 386><TD 387>Y</TD 388></TR 389><TR 390><TD 391> </TD 392><TD 393> </TD 394><TD 395> </TD 396><TD 397> </TD 398><TD 399> </TD 400><TD 401> </TD 402><TD 403> </TD 404></TR 405><TR 406><TD 407>2</TD 408><TD 409>Y</TD 410><TD 411> </TD 412><TD 413>Y</TD 414><TD 415> </TD 416><TD 417>Y</TD 418><TD 419> </TD 420><TD 421>Y</TD 422></TR 423><TR 424><TD 425> </TD 426><TD 427> </TD 428><TD 429>C</TD 430><TD 431> </TD 432><TD 433> </TD 434><TD 435> </TD 436><TD 437>C</TD 438><TD 439> </TD 440></TR 441><TR 442><TD 443>3</TD 444><TD 445>Y</TD 446><TD 447> </TD 448><TD 449>Y</TD 450><TD 451> </TD 452><TD 453>Y</TD 454><TD 455> </TD 456><TD 457>Y</TD 458></TR 459></TBODY 460></TABLE 461><P 462></P 463></DIV 464> 465 </P 466></DIV 467></DIV 468></DIV 469><DIV 470CLASS="NAVFOOTER" 471><HR 472ALIGN="LEFT" 473WIDTH="100%"><TABLE 474SUMMARY="Footer navigation table" 475WIDTH="100%" 476BORDER="0" 477CELLPADDING="0" 478CELLSPACING="0" 479><TR 480><TD 481WIDTH="33%" 482ALIGN="left" 483VALIGN="top" 484><A 485HREF="r5319.htm" 486ACCESSKEY="P" 487>Prev</A 488></TD 489><TD 490WIDTH="34%" 491ALIGN="center" 492VALIGN="top" 493><A 494HREF="book1.htm" 495ACCESSKEY="H" 496>Home</A 497></TD 498><TD 499WIDTH="33%" 500ALIGN="right" 501VALIGN="top" 502><A 503HREF="x5634.htm" 504ACCESSKEY="N" 505>Next</A 506></TD 507></TR 508><TR 509><TD 510WIDTH="33%" 511ALIGN="left" 512VALIGN="top" 513>V4L2_PIX_FMT_YUV411P ('411P')</TD 514><TD 515WIDTH="34%" 516ALIGN="center" 517VALIGN="top" 518><A 519HREF="x3891.htm" 520ACCESSKEY="U" 521>Up</A 522></TD 523><TD 524WIDTH="33%" 525ALIGN="right" 526VALIGN="top" 527>Compressed Formats</TD 528></TR 529></TABLE 530></DIV 531></BODY 532></HTML 533> 534