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