1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!-- NewPage --> 3<html lang="en"> 4<head> 5<title>YUVImage</title> 6<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> 7</head> 8<body> 9<script type="text/javascript"><!-- 10 try { 11 if (location.href.indexOf('is-external=true') == -1) { 12 parent.document.title="YUVImage"; 13 } 14 } 15 catch(err) { 16 } 17//--> 18</script> 19<noscript> 20<div>JavaScript is disabled on your browser.</div> 21</noscript> 22<!-- ========= START OF TOP NAVBAR ======= --> 23<div class="topNav"><a name="navbar_top"> 24<!-- --> 25</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> 26<!-- --> 27</a> 28<ul class="navList" title="Navigation"> 29<li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li> 30<li class="navBarCell1Rev">Class</li> 31<li><a href="package-tree.html">Tree</a></li> 32<li><a href="../../../deprecated-list.html">Deprecated</a></li> 33<li><a href="../../../index-all.html">Index</a></li> 34<li><a href="../../../help-doc.html">Help</a></li> 35</ul> 36</div> 37<div class="subNav"> 38<ul class="navList"> 39<li><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li> 40<li>Next Class</li> 41</ul> 42<ul class="navList"> 43<li><a href="../../../index.html?org/libjpegturbo/turbojpeg/YUVImage.html" target="_top">Frames</a></li> 44<li><a href="YUVImage.html" target="_top">No Frames</a></li> 45</ul> 46<ul class="navList" id="allclasses_navbar_top"> 47<li><a href="../../../allclasses-noframe.html">All Classes</a></li> 48</ul> 49<div> 50<script type="text/javascript"><!-- 51 allClassesLink = document.getElementById("allclasses_navbar_top"); 52 if(window==top) { 53 allClassesLink.style.display = "block"; 54 } 55 else { 56 allClassesLink.style.display = "none"; 57 } 58 //--> 59</script> 60</div> 61<div> 62<ul class="subNavList"> 63<li>Summary: </li> 64<li>Nested | </li> 65<li><a href="#field_summary">Field</a> | </li> 66<li><a href="#constructor_summary">Constr</a> | </li> 67<li><a href="#method_summary">Method</a></li> 68</ul> 69<ul class="subNavList"> 70<li>Detail: </li> 71<li><a href="#field_detail">Field</a> | </li> 72<li><a href="#constructor_detail">Constr</a> | </li> 73<li><a href="#method_detail">Method</a></li> 74</ul> 75</div> 76<a name="skip-navbar_top"> 77<!-- --> 78</a></div> 79<!-- ========= END OF TOP NAVBAR ========= --> 80<!-- ======== START OF CLASS DATA ======== --> 81<div class="header"> 82<div class="subTitle">org.libjpegturbo.turbojpeg</div> 83<h2 title="Class YUVImage" class="title">Class YUVImage</h2> 84</div> 85<div class="contentContainer"> 86<ul class="inheritance"> 87<li>java.lang.Object</li> 88<li> 89<ul class="inheritance"> 90<li>org.libjpegturbo.turbojpeg.YUVImage</li> 91</ul> 92</li> 93</ul> 94<div class="description"> 95<ul class="blockList"> 96<li class="blockList"> 97<hr> 98<br> 99<pre>public class <span class="strong">YUVImage</span> 100extends java.lang.Object</pre> 101<div class="block">This class encapsulates a YUV planar image and the metadata 102 associated with it. The TurboJPEG API allows both the JPEG compression and 103 decompression pipelines to be split into stages: YUV encode, compress from 104 YUV, decompress to YUV, and YUV decode. A <code>YUVImage</code> instance 105 serves as the destination image for YUV encode and decompress-to-YUV 106 operations and as the source image for compress-from-YUV and YUV decode 107 operations. 108 <p> 109 Technically, the JPEG format uses the YCbCr colorspace (which technically is 110 not a "colorspace" but rather a "color transform"), but per the convention 111 of the digital video community, the TurboJPEG API uses "YUV" to refer to an 112 image format consisting of Y, Cb, and Cr image planes. 113 <p> 114 Each plane is simply a 2D array of bytes, each byte representing the value 115 of one of the components (Y, Cb, or Cr) at a particular location in the 116 image. The width and height of each plane are determined by the image 117 width, height, and level of chrominance subsampling. The luminance plane 118 width is the image width padded to the nearest multiple of the horizontal 119 subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 120 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane 121 height is the image height padded to the nearest multiple of the vertical 122 subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 123 or grayscale.) The chrominance plane width is equal to the luminance plane 124 width divided by the horizontal subsampling factor, and the chrominance 125 plane height is equal to the luminance plane height divided by the vertical 126 subsampling factor. 127 <p> 128 For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is 129 used, then the luminance plane would be 36 x 35 bytes, and each of the 130 chrominance planes would be 18 x 35 bytes. If you specify a line padding of 131 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and 132 each of the chrominance planes would be 20 x 35 bytes.</div> 133</li> 134</ul> 135</div> 136<div class="summary"> 137<ul class="blockList"> 138<li class="blockList"> 139<!-- =========== FIELD SUMMARY =========== --> 140<ul class="blockList"> 141<li class="blockList"><a name="field_summary"> 142<!-- --> 143</a> 144<h3>Field Summary</h3> 145<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> 146<caption><span>Fields</span><span class="tabEnd"> </span></caption> 147<tr> 148<th class="colFirst" scope="col">Modifier and Type</th> 149<th class="colLast" scope="col">Field and Description</th> 150</tr> 151<tr class="altColor"> 152<td class="colFirst"><code>protected long</code></td> 153<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#handle">handle</a></strong></code> </td> 154</tr> 155<tr class="rowColor"> 156<td class="colFirst"><code>protected int</code></td> 157<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvHeight">yuvHeight</a></strong></code> </td> 158</tr> 159<tr class="altColor"> 160<td class="colFirst"><code>protected int[]</code></td> 161<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvOffsets">yuvOffsets</a></strong></code> </td> 162</tr> 163<tr class="rowColor"> 164<td class="colFirst"><code>protected int</code></td> 165<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvPad">yuvPad</a></strong></code> </td> 166</tr> 167<tr class="altColor"> 168<td class="colFirst"><code>protected byte[][]</code></td> 169<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvPlanes">yuvPlanes</a></strong></code> </td> 170</tr> 171<tr class="rowColor"> 172<td class="colFirst"><code>protected int[]</code></td> 173<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvStrides">yuvStrides</a></strong></code> </td> 174</tr> 175<tr class="altColor"> 176<td class="colFirst"><code>protected int</code></td> 177<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvSubsamp">yuvSubsamp</a></strong></code> </td> 178</tr> 179<tr class="rowColor"> 180<td class="colFirst"><code>protected int</code></td> 181<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#yuvWidth">yuvWidth</a></strong></code> </td> 182</tr> 183</table> 184</li> 185</ul> 186<!-- ======== CONSTRUCTOR SUMMARY ======== --> 187<ul class="blockList"> 188<li class="blockList"><a name="constructor_summary"> 189<!-- --> 190</a> 191<h3>Constructor Summary</h3> 192<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> 193<caption><span>Constructors</span><span class="tabEnd"> </span></caption> 194<tr> 195<th class="colOne" scope="col">Constructor and Description</th> 196</tr> 197<tr class="altColor"> 198<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[][],%20int[],%20int,%20int[],%20int,%20int)">YUVImage</a></strong>(byte[][] planes, 199 int[] offsets, 200 int width, 201 int[] strides, 202 int height, 203 int subsamp)</code> 204<div class="block">Create a new <code>YUVImage</code> instance from a set of existing image 205 planes.</div> 206</td> 207</tr> 208<tr class="rowColor"> 209<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(byte[],%20int,%20int,%20int,%20int)">YUVImage</a></strong>(byte[] yuvImage, 210 int width, 211 int pad, 212 int height, 213 int subsamp)</code> 214<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image 215 buffer.</div> 216</td> 217</tr> 218<tr class="altColor"> 219<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int[],%20int,%20int)">YUVImage</a></strong>(int width, 220 int[] strides, 221 int height, 222 int subsamp)</code> 223<div class="block">Create a new <code>YUVImage</code> instance backed by separate image 224 planes, and allocate memory for the image planes.</div> 225</td> 226</tr> 227<tr class="rowColor"> 228<td class="colOne"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#YUVImage(int,%20int,%20int,%20int)">YUVImage</a></strong>(int width, 229 int pad, 230 int height, 231 int subsamp)</code> 232<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image 233 buffer, and allocate memory for the image buffer.</div> 234</td> 235</tr> 236</table> 237</li> 238</ul> 239<!-- ========== METHOD SUMMARY =========== --> 240<ul class="blockList"> 241<li class="blockList"><a name="method_summary"> 242<!-- --> 243</a> 244<h3>Method Summary</h3> 245<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 246<caption><span>Methods</span><span class="tabEnd"> </span></caption> 247<tr> 248<th class="colFirst" scope="col">Modifier and Type</th> 249<th class="colLast" scope="col">Method and Description</th> 250</tr> 251<tr class="altColor"> 252<td class="colFirst"><code>byte[]</code></td> 253<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getBuf()">getBuf</a></strong>()</code> 254<div class="block">Returns the YUV image buffer (if this image is stored in a unified 255 buffer rather than separate image planes.)</div> 256</td> 257</tr> 258<tr class="rowColor"> 259<td class="colFirst"><code>int</code></td> 260<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getHeight()">getHeight</a></strong>()</code> 261<div class="block">Returns the height of the YUV image (or subregion.)</div> 262</td> 263</tr> 264<tr class="altColor"> 265<td class="colFirst"><code>int[]</code></td> 266<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getOffsets()">getOffsets</a></strong>()</code> 267<div class="block">Returns the offsets (in bytes) of each plane within the planes of a larger 268 YUV image.</div> 269</td> 270</tr> 271<tr class="rowColor"> 272<td class="colFirst"><code>int</code></td> 273<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getPad()">getPad</a></strong>()</code> 274<div class="block">Returns the line padding used in the YUV image buffer (if this image is 275 stored in a unified buffer rather than separate image planes.)</div> 276</td> 277</tr> 278<tr class="altColor"> 279<td class="colFirst"><code>byte[][]</code></td> 280<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getPlanes()">getPlanes</a></strong>()</code> 281<div class="block">Returns the YUV image planes.</div> 282</td> 283</tr> 284<tr class="rowColor"> 285<td class="colFirst"><code>int</code></td> 286<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getSize()">getSize</a></strong>()</code> 287<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is 288 stored in a unified buffer rather than separate image planes.)</div> 289</td> 290</tr> 291<tr class="altColor"> 292<td class="colFirst"><code>int[]</code></td> 293<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getStrides()">getStrides</a></strong>()</code> 294<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div> 295</td> 296</tr> 297<tr class="rowColor"> 298<td class="colFirst"><code>int</code></td> 299<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getSubsamp()">getSubsamp</a></strong>()</code> 300<div class="block">Returns the level of chrominance subsampling used in the YUV image.</div> 301</td> 302</tr> 303<tr class="altColor"> 304<td class="colFirst"><code>int</code></td> 305<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#getWidth()">getWidth</a></strong>()</code> 306<div class="block">Returns the width of the YUV image (or subregion.)</div> 307</td> 308</tr> 309<tr class="rowColor"> 310<td class="colFirst"><code>void</code></td> 311<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[][],%20int[],%20int,%20int[],%20int,%20int)">setBuf</a></strong>(byte[][] planes, 312 int[] offsets, 313 int width, 314 int[] strides, 315 int height, 316 int subsamp)</code> 317<div class="block">Assign a set of image planes to this <code>YUVImage</code> instance.</div> 318</td> 319</tr> 320<tr class="altColor"> 321<td class="colFirst"><code>void</code></td> 322<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html#setBuf(byte[],%20int,%20int,%20int,%20int)">setBuf</a></strong>(byte[] yuvImage, 323 int width, 324 int pad, 325 int height, 326 int subsamp)</code> 327<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div> 328</td> 329</tr> 330</table> 331<ul class="blockList"> 332<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> 333<!-- --> 334</a> 335<h3>Methods inherited from class java.lang.Object</h3> 336<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> 337</ul> 338</li> 339</ul> 340</li> 341</ul> 342</div> 343<div class="details"> 344<ul class="blockList"> 345<li class="blockList"> 346<!-- ============ FIELD DETAIL =========== --> 347<ul class="blockList"> 348<li class="blockList"><a name="field_detail"> 349<!-- --> 350</a> 351<h3>Field Detail</h3> 352<a name="handle"> 353<!-- --> 354</a> 355<ul class="blockList"> 356<li class="blockList"> 357<h4>handle</h4> 358<pre>protected long handle</pre> 359</li> 360</ul> 361<a name="yuvPlanes"> 362<!-- --> 363</a> 364<ul class="blockList"> 365<li class="blockList"> 366<h4>yuvPlanes</h4> 367<pre>protected byte[][] yuvPlanes</pre> 368</li> 369</ul> 370<a name="yuvOffsets"> 371<!-- --> 372</a> 373<ul class="blockList"> 374<li class="blockList"> 375<h4>yuvOffsets</h4> 376<pre>protected int[] yuvOffsets</pre> 377</li> 378</ul> 379<a name="yuvStrides"> 380<!-- --> 381</a> 382<ul class="blockList"> 383<li class="blockList"> 384<h4>yuvStrides</h4> 385<pre>protected int[] yuvStrides</pre> 386</li> 387</ul> 388<a name="yuvPad"> 389<!-- --> 390</a> 391<ul class="blockList"> 392<li class="blockList"> 393<h4>yuvPad</h4> 394<pre>protected int yuvPad</pre> 395</li> 396</ul> 397<a name="yuvWidth"> 398<!-- --> 399</a> 400<ul class="blockList"> 401<li class="blockList"> 402<h4>yuvWidth</h4> 403<pre>protected int yuvWidth</pre> 404</li> 405</ul> 406<a name="yuvHeight"> 407<!-- --> 408</a> 409<ul class="blockList"> 410<li class="blockList"> 411<h4>yuvHeight</h4> 412<pre>protected int yuvHeight</pre> 413</li> 414</ul> 415<a name="yuvSubsamp"> 416<!-- --> 417</a> 418<ul class="blockListLast"> 419<li class="blockList"> 420<h4>yuvSubsamp</h4> 421<pre>protected int yuvSubsamp</pre> 422</li> 423</ul> 424</li> 425</ul> 426<!-- ========= CONSTRUCTOR DETAIL ======== --> 427<ul class="blockList"> 428<li class="blockList"><a name="constructor_detail"> 429<!-- --> 430</a> 431<h3>Constructor Detail</h3> 432<a name="YUVImage(int, int[], int, int)"> 433<!-- --> 434</a> 435<ul class="blockList"> 436<li class="blockList"> 437<h4>YUVImage</h4> 438<pre>public YUVImage(int width, 439 int[] strides, 440 int height, 441 int subsamp)</pre> 442<div class="block">Create a new <code>YUVImage</code> instance backed by separate image 443 planes, and allocate memory for the image planes.</div> 444<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes 445 per line in the corresponding plane of the YUV image. Setting the stride 446 for any plane to 0 is the same as setting it to the plane width (see 447 <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the 448 strides for all planes will be set to their respective plane widths. When 449 using this constructor, the stride for each plane must be equal to or 450 greater than the plane width.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV 451 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl> 452</li> 453</ul> 454<a name="YUVImage(int, int, int, int)"> 455<!-- --> 456</a> 457<ul class="blockList"> 458<li class="blockList"> 459<h4>YUVImage</h4> 460<pre>public YUVImage(int width, 461 int pad, 462 int height, 463 int subsamp)</pre> 464<div class="block">Create a new <code>YUVImage</code> instance backed by a unified image 465 buffer, and allocate memory for the image buffer.</div> 466<dl><dt><span class="strong">Parameters:</span></dt><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - Each line of each plane in the YUV image buffer will be padded 467 to this number of bytes (must be a power of 2.)</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling to be used in the YUV 468 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl> 469</li> 470</ul> 471<a name="YUVImage(byte[][], int[], int, int[], int, int)"> 472<!-- --> 473</a> 474<ul class="blockList"> 475<li class="blockList"> 476<h4>YUVImage</h4> 477<pre>public YUVImage(byte[][] planes, 478 int[] offsets, 479 int width, 480 int[] strides, 481 int height, 482 int subsamp)</pre> 483<div class="block">Create a new <code>YUVImage</code> instance from a set of existing image 484 planes.</div> 485<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr) 486 image planes (or just the Y plane, if the image is grayscale.) These 487 planes can be contiguous or non-contiguous in memory. Plane 488 <code>i</code> should be at least <code>offsets[i] + 489 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code> 490 bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a 491 subregion of a larger image, then <code>offsets[i]</code> specifies the 492 offset (in bytes) of the subregion within plane <code>i</code> of the 493 larger image. Setting this to null is the same as setting the offsets for 494 all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the new YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes 495 per line in the corresponding plane of the YUV image. Setting the stride 496 for any plane to 0 is the same as setting it to the plane width (see 497 <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the 498 strides for all planes will be set to their respective plane widths. You 499 can adjust the strides in order to add an arbitrary amount of line padding 500 to each plane or to specify that this <code>YUVImage</code> instance is a 501 subregion of a larger image (in which case, <code>strides[i]</code> should 502 be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the new YUV image (or subregion)</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV 503 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl> 504</li> 505</ul> 506<a name="YUVImage(byte[], int, int, int, int)"> 507<!-- --> 508</a> 509<ul class="blockListLast"> 510<li class="blockList"> 511<h4>YUVImage</h4> 512<pre>public YUVImage(byte[] yuvImage, 513 int width, 514 int pad, 515 int height, 516 int subsamp)</pre> 517<div class="block">Create a new <code>YUVImage</code> instance from an existing unified image 518 buffer.</div> 519<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar 520 image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for 521 this buffer. The Y, U (Cb), and V (Cr) image planes are stored 522 sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description 523 of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For 524 instance, if each line in each plane of the buffer is padded to the 525 nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV 526 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl> 527</li> 528</ul> 529</li> 530</ul> 531<!-- ============ METHOD DETAIL ========== --> 532<ul class="blockList"> 533<li class="blockList"><a name="method_detail"> 534<!-- --> 535</a> 536<h3>Method Detail</h3> 537<a name="setBuf(byte[][], int[], int, int[], int, int)"> 538<!-- --> 539</a> 540<ul class="blockList"> 541<li class="blockList"> 542<h4>setBuf</h4> 543<pre>public void setBuf(byte[][] planes, 544 int[] offsets, 545 int width, 546 int[] strides, 547 int height, 548 int subsamp)</pre> 549<div class="block">Assign a set of image planes to this <code>YUVImage</code> instance.</div> 550<dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr) 551 image planes (or just the Y plane, if the image is grayscale.) These 552 planes can be contiguous or non-contiguous in memory. Plane 553 <code>i</code> should be at least <code>offsets[i] + 554 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)"><code>TJ.planeSizeYUV</code></a>(i, width, strides[i], height, subsamp)</code> 555 bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a 556 subregion of a larger image, then <code>offsets[i]</code> specifies the 557 offset (in bytes) of the subregion within plane <code>i</code> of the 558 larger image. Setting this to null is the same as setting the offsets for 559 all planes to 0.</dd><dd><code>width</code> - width (in pixels) of the YUV image (or subregion)</dd><dd><code>strides</code> - an array of integers, each specifying the number of bytes 560 per line in the corresponding plane of the YUV image. Setting the stride 561 for any plane to 0 is the same as setting it to the plane width (see 562 <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a>.) If <code>strides</code> is null, then the 563 strides for all planes will be set to their respective plane widths. You 564 can adjust the strides in order to add an arbitrary amount of line padding 565 to each plane or to specify that this <code>YUVImage</code> image is a 566 subregion of a larger image (in which case, <code>strides[i]</code> should 567 be set to the plane width of plane <code>i</code> in the larger image.)</dd><dd><code>height</code> - height (in pixels) of the YUV image (or subregion)</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV 568 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl> 569</li> 570</ul> 571<a name="setBuf(byte[], int, int, int, int)"> 572<!-- --> 573</a> 574<ul class="blockList"> 575<li class="blockList"> 576<h4>setBuf</h4> 577<pre>public void setBuf(byte[] yuvImage, 578 int width, 579 int pad, 580 int height, 581 int subsamp)</pre> 582<div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div> 583<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar 584 image data. Use <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int,%20int,%20int,%20int)"><code>TJ.bufSizeYUV(int, int, int, int)</code></a> to determine the minimum size for 585 this buffer. The Y, U (Cb), and V (Cr) image planes are stored 586 sequentially in the buffer (see <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>above</code></a> for a description 587 of the image format.)</dd><dd><code>width</code> - width (in pixels) of the YUV image</dd><dd><code>pad</code> - the line padding used in the YUV image buffer. For 588 instance, if each line in each plane of the buffer is padded to the 589 nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</dd><dd><code>height</code> - height (in pixels) of the YUV image</dd><dd><code>subsamp</code> - the level of chrominance subsampling used in the YUV 590 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd></dl> 591</li> 592</ul> 593<a name="getWidth()"> 594<!-- --> 595</a> 596<ul class="blockList"> 597<li class="blockList"> 598<h4>getWidth</h4> 599<pre>public int getWidth()</pre> 600<div class="block">Returns the width of the YUV image (or subregion.)</div> 601<dl><dt><span class="strong">Returns:</span></dt><dd>the width of the YUV image (or subregion)</dd></dl> 602</li> 603</ul> 604<a name="getHeight()"> 605<!-- --> 606</a> 607<ul class="blockList"> 608<li class="blockList"> 609<h4>getHeight</h4> 610<pre>public int getHeight()</pre> 611<div class="block">Returns the height of the YUV image (or subregion.)</div> 612<dl><dt><span class="strong">Returns:</span></dt><dd>the height of the YUV image (or subregion)</dd></dl> 613</li> 614</ul> 615<a name="getPad()"> 616<!-- --> 617</a> 618<ul class="blockList"> 619<li class="blockList"> 620<h4>getPad</h4> 621<pre>public int getPad()</pre> 622<div class="block">Returns the line padding used in the YUV image buffer (if this image is 623 stored in a unified buffer rather than separate image planes.)</div> 624<dl><dt><span class="strong">Returns:</span></dt><dd>the line padding used in the YUV image buffer</dd></dl> 625</li> 626</ul> 627<a name="getStrides()"> 628<!-- --> 629</a> 630<ul class="blockList"> 631<li class="blockList"> 632<h4>getStrides</h4> 633<pre>public int[] getStrides()</pre> 634<div class="block">Returns the number of bytes per line of each plane in the YUV image.</div> 635<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per line of each plane in the YUV image</dd></dl> 636</li> 637</ul> 638<a name="getOffsets()"> 639<!-- --> 640</a> 641<ul class="blockList"> 642<li class="blockList"> 643<h4>getOffsets</h4> 644<pre>public int[] getOffsets()</pre> 645<div class="block">Returns the offsets (in bytes) of each plane within the planes of a larger 646 YUV image.</div> 647<dl><dt><span class="strong">Returns:</span></dt><dd>the offsets (in bytes) of each plane within the planes of a larger 648 YUV image</dd></dl> 649</li> 650</ul> 651<a name="getSubsamp()"> 652<!-- --> 653</a> 654<ul class="blockList"> 655<li class="blockList"> 656<h4>getSubsamp</h4> 657<pre>public int getSubsamp()</pre> 658<div class="block">Returns the level of chrominance subsampling used in the YUV image. See 659 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>.</div> 660<dl><dt><span class="strong">Returns:</span></dt><dd>the level of chrominance subsampling used in the YUV image</dd></dl> 661</li> 662</ul> 663<a name="getPlanes()"> 664<!-- --> 665</a> 666<ul class="blockList"> 667<li class="blockList"> 668<h4>getPlanes</h4> 669<pre>public byte[][] getPlanes()</pre> 670<div class="block">Returns the YUV image planes. If the image is stored in a unified buffer, 671 then all image planes will point to that buffer.</div> 672<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image planes</dd></dl> 673</li> 674</ul> 675<a name="getBuf()"> 676<!-- --> 677</a> 678<ul class="blockList"> 679<li class="blockList"> 680<h4>getBuf</h4> 681<pre>public byte[] getBuf()</pre> 682<div class="block">Returns the YUV image buffer (if this image is stored in a unified 683 buffer rather than separate image planes.)</div> 684<dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image buffer</dd></dl> 685</li> 686</ul> 687<a name="getSize()"> 688<!-- --> 689</a> 690<ul class="blockListLast"> 691<li class="blockList"> 692<h4>getSize</h4> 693<pre>public int getSize()</pre> 694<div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is 695 stored in a unified buffer rather than separate image planes.)</div> 696<dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV image buffer</dd></dl> 697</li> 698</ul> 699</li> 700</ul> 701</li> 702</ul> 703</div> 704</div> 705<!-- ========= END OF CLASS DATA ========= --> 706<!-- ======= START OF BOTTOM NAVBAR ====== --> 707<div class="bottomNav"><a name="navbar_bottom"> 708<!-- --> 709</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 710<!-- --> 711</a> 712<ul class="navList" title="Navigation"> 713<li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li> 714<li class="navBarCell1Rev">Class</li> 715<li><a href="package-tree.html">Tree</a></li> 716<li><a href="../../../deprecated-list.html">Deprecated</a></li> 717<li><a href="../../../index-all.html">Index</a></li> 718<li><a href="../../../help-doc.html">Help</a></li> 719</ul> 720</div> 721<div class="subNav"> 722<ul class="navList"> 723<li><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li> 724<li>Next Class</li> 725</ul> 726<ul class="navList"> 727<li><a href="../../../index.html?org/libjpegturbo/turbojpeg/YUVImage.html" target="_top">Frames</a></li> 728<li><a href="YUVImage.html" target="_top">No Frames</a></li> 729</ul> 730<ul class="navList" id="allclasses_navbar_bottom"> 731<li><a href="../../../allclasses-noframe.html">All Classes</a></li> 732</ul> 733<div> 734<script type="text/javascript"><!-- 735 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 736 if(window==top) { 737 allClassesLink.style.display = "block"; 738 } 739 else { 740 allClassesLink.style.display = "none"; 741 } 742 //--> 743</script> 744</div> 745<div> 746<ul class="subNavList"> 747<li>Summary: </li> 748<li>Nested | </li> 749<li><a href="#field_summary">Field</a> | </li> 750<li><a href="#constructor_summary">Constr</a> | </li> 751<li><a href="#method_summary">Method</a></li> 752</ul> 753<ul class="subNavList"> 754<li>Detail: </li> 755<li><a href="#field_detail">Field</a> | </li> 756<li><a href="#constructor_detail">Constr</a> | </li> 757<li><a href="#method_detail">Method</a></li> 758</ul> 759</div> 760<a name="skip-navbar_bottom"> 761<!-- --> 762</a></div> 763<!-- ======== END OF BOTTOM NAVBAR ======= --> 764</body> 765</html> 766