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> 96 extends 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) 438 throws java.lang.Exception</pre> 439 <div class="block">Create a new <code>YUVImage</code> instance backed by separate image 440 planes, and allocate memory for the image planes.</div> 441 <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 442 per line in the corresponding plane of the YUV image. Setting the stride 443 for any plane to 0 is the same as setting it to the plane width (see 444 <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 445 strides for all planes will be set to their respective plane widths. When 446 using this constructor, the stride for each plane must be equal to or 447 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 448 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd> 449 <dt><span class="strong">Throws:</span></dt> 450 <dd><code>java.lang.Exception</code></dd></dl> 451 </li> 452 </ul> 453 <a name="YUVImage(int, int, int, int)"> 454 <!-- --> 455 </a> 456 <ul class="blockList"> 457 <li class="blockList"> 458 <h4>YUVImage</h4> 459 <pre>public YUVImage(int width, 460 int pad, 461 int height, 462 int subsamp) 463 throws java.lang.Exception</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> 469 <dt><span class="strong">Throws:</span></dt> 470 <dd><code>java.lang.Exception</code></dd></dl> 471 </li> 472 </ul> 473 <a name="YUVImage(byte[][], int[], int, int[], int, int)"> 474 <!-- --> 475 </a> 476 <ul class="blockList"> 477 <li class="blockList"> 478 <h4>YUVImage</h4> 479 <pre>public YUVImage(byte[][] planes, 480 int[] offsets, 481 int width, 482 int[] strides, 483 int height, 484 int subsamp) 485 throws java.lang.Exception</pre> 486 <div class="block">Create a new <code>YUVImage</code> instance from a set of existing image 487 planes.</div> 488 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr) 489 image planes (or just the Y plane, if the image is grayscale.) These 490 planes can be contiguous or non-contiguous in memory. Plane 491 <code>i</code> should be at least <code>offsets[i] + 492 <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> 493 bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a 494 subregion of a larger image, then <code>offsets[i]</code> specifies the 495 offset (in bytes) of the subregion within plane <code>i</code> of the 496 larger image. Setting this to null is the same as setting the offsets for 497 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 498 per line in the corresponding plane of the YUV image. Setting the stride 499 for any plane to 0 is the same as setting it to the plane width (see 500 <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 501 strides for all planes will be set to their respective plane widths. You 502 can adjust the strides in order to add an arbitrary amount of line padding 503 to each plane or to specify that this <code>YUVImage</code> instance is a 504 subregion of a larger image (in which case, <code>strides[i]</code> should 505 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 506 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd> 507 <dt><span class="strong">Throws:</span></dt> 508 <dd><code>java.lang.Exception</code></dd></dl> 509 </li> 510 </ul> 511 <a name="YUVImage(byte[], int, int, int, int)"> 512 <!-- --> 513 </a> 514 <ul class="blockListLast"> 515 <li class="blockList"> 516 <h4>YUVImage</h4> 517 <pre>public YUVImage(byte[] yuvImage, 518 int width, 519 int pad, 520 int height, 521 int subsamp) 522 throws java.lang.Exception</pre> 523 <div class="block">Create a new <code>YUVImage</code> instance from an existing unified image 524 buffer.</div> 525 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar 526 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 527 this buffer. The Y, U (Cb), and V (Cr) image planes are stored 528 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 529 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 530 instance, if each line in each plane of the buffer is padded to the 531 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 532 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd> 533 <dt><span class="strong">Throws:</span></dt> 534 <dd><code>java.lang.Exception</code></dd></dl> 535 </li> 536 </ul> 537 </li> 538 </ul> 539 <!-- ============ METHOD DETAIL ========== --> 540 <ul class="blockList"> 541 <li class="blockList"><a name="method_detail"> 542 <!-- --> 543 </a> 544 <h3>Method Detail</h3> 545 <a name="setBuf(byte[][], int[], int, int[], int, int)"> 546 <!-- --> 547 </a> 548 <ul class="blockList"> 549 <li class="blockList"> 550 <h4>setBuf</h4> 551 <pre>public void setBuf(byte[][] planes, 552 int[] offsets, 553 int width, 554 int[] strides, 555 int height, 556 int subsamp) 557 throws java.lang.Exception</pre> 558 <div class="block">Assign a set of image planes to this <code>YUVImage</code> instance.</div> 559 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>planes</code> - an array of buffers representing the Y, U (Cb), and V (Cr) 560 image planes (or just the Y plane, if the image is grayscale.) These 561 planes can be contiguous or non-contiguous in memory. Plane 562 <code>i</code> should be at least <code>offsets[i] + 563 <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> 564 bytes in size.</dd><dd><code>offsets</code> - If this <code>YUVImage</code> instance represents a 565 subregion of a larger image, then <code>offsets[i]</code> specifies the 566 offset (in bytes) of the subregion within plane <code>i</code> of the 567 larger image. Setting this to null is the same as setting the offsets for 568 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 569 per line in the corresponding plane of the YUV image. Setting the stride 570 for any plane to 0 is the same as setting it to the plane width (see 571 <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 572 strides for all planes will be set to their respective plane widths. You 573 can adjust the strides in order to add an arbitrary amount of line padding 574 to each plane or to specify that this <code>YUVImage</code> image is a 575 subregion of a larger image (in which case, <code>strides[i]</code> should 576 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 577 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd> 578 <dt><span class="strong">Throws:</span></dt> 579 <dd><code>java.lang.Exception</code></dd></dl> 580 </li> 581 </ul> 582 <a name="setBuf(byte[], int, int, int, int)"> 583 <!-- --> 584 </a> 585 <ul class="blockList"> 586 <li class="blockList"> 587 <h4>setBuf</h4> 588 <pre>public void setBuf(byte[] yuvImage, 589 int width, 590 int pad, 591 int height, 592 int subsamp) 593 throws java.lang.Exception</pre> 594 <div class="block">Assign a unified image buffer to this <code>YUVImage</code> instance.</div> 595 <dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - image buffer that contains or will contain YUV planar 596 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 597 this buffer. The Y, U (Cb), and V (Cr) image planes are stored 598 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 599 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 600 instance, if each line in each plane of the buffer is padded to the 601 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 602 image (one of <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>)</dd> 603 <dt><span class="strong">Throws:</span></dt> 604 <dd><code>java.lang.Exception</code></dd></dl> 605 </li> 606 </ul> 607 <a name="getWidth()"> 608 <!-- --> 609 </a> 610 <ul class="blockList"> 611 <li class="blockList"> 612 <h4>getWidth</h4> 613 <pre>public int getWidth() 614 throws java.lang.Exception</pre> 615 <div class="block">Returns the width of the YUV image (or subregion.)</div> 616 <dl><dt><span class="strong">Returns:</span></dt><dd>the width of the YUV image (or subregion)</dd> 617 <dt><span class="strong">Throws:</span></dt> 618 <dd><code>java.lang.Exception</code></dd></dl> 619 </li> 620 </ul> 621 <a name="getHeight()"> 622 <!-- --> 623 </a> 624 <ul class="blockList"> 625 <li class="blockList"> 626 <h4>getHeight</h4> 627 <pre>public int getHeight() 628 throws java.lang.Exception</pre> 629 <div class="block">Returns the height of the YUV image (or subregion.)</div> 630 <dl><dt><span class="strong">Returns:</span></dt><dd>the height of the YUV image (or subregion)</dd> 631 <dt><span class="strong">Throws:</span></dt> 632 <dd><code>java.lang.Exception</code></dd></dl> 633 </li> 634 </ul> 635 <a name="getPad()"> 636 <!-- --> 637 </a> 638 <ul class="blockList"> 639 <li class="blockList"> 640 <h4>getPad</h4> 641 <pre>public int getPad() 642 throws java.lang.Exception</pre> 643 <div class="block">Returns the line padding used in the YUV image buffer (if this image is 644 stored in a unified buffer rather than separate image planes.)</div> 645 <dl><dt><span class="strong">Returns:</span></dt><dd>the line padding used in the YUV image buffer</dd> 646 <dt><span class="strong">Throws:</span></dt> 647 <dd><code>java.lang.Exception</code></dd></dl> 648 </li> 649 </ul> 650 <a name="getStrides()"> 651 <!-- --> 652 </a> 653 <ul class="blockList"> 654 <li class="blockList"> 655 <h4>getStrides</h4> 656 <pre>public int[] getStrides() 657 throws java.lang.Exception</pre> 658 <div class="block">Returns the number of bytes per line of each plane in the YUV image.</div> 659 <dl><dt><span class="strong">Returns:</span></dt><dd>the number of bytes per line of each plane in the YUV image</dd> 660 <dt><span class="strong">Throws:</span></dt> 661 <dd><code>java.lang.Exception</code></dd></dl> 662 </li> 663 </ul> 664 <a name="getOffsets()"> 665 <!-- --> 666 </a> 667 <ul class="blockList"> 668 <li class="blockList"> 669 <h4>getOffsets</h4> 670 <pre>public int[] getOffsets() 671 throws java.lang.Exception</pre> 672 <div class="block">Returns the offsets (in bytes) of each plane within the planes of a larger 673 YUV image.</div> 674 <dl><dt><span class="strong">Returns:</span></dt><dd>the offsets (in bytes) of each plane within the planes of a larger 675 YUV image</dd> 676 <dt><span class="strong">Throws:</span></dt> 677 <dd><code>java.lang.Exception</code></dd></dl> 678 </li> 679 </ul> 680 <a name="getSubsamp()"> 681 <!-- --> 682 </a> 683 <ul class="blockList"> 684 <li class="blockList"> 685 <h4>getSubsamp</h4> 686 <pre>public int getSubsamp() 687 throws java.lang.Exception</pre> 688 <div class="block">Returns the level of chrominance subsampling used in the YUV image. See 689 <a href="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><code>TJ.SAMP_*</code></a>.</div> 690 <dl><dt><span class="strong">Returns:</span></dt><dd>the level of chrominance subsampling used in the YUV image</dd> 691 <dt><span class="strong">Throws:</span></dt> 692 <dd><code>java.lang.Exception</code></dd></dl> 693 </li> 694 </ul> 695 <a name="getPlanes()"> 696 <!-- --> 697 </a> 698 <ul class="blockList"> 699 <li class="blockList"> 700 <h4>getPlanes</h4> 701 <pre>public byte[][] getPlanes() 702 throws java.lang.Exception</pre> 703 <div class="block">Returns the YUV image planes. If the image is stored in a unified buffer, 704 then all image planes will point to that buffer.</div> 705 <dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image planes</dd> 706 <dt><span class="strong">Throws:</span></dt> 707 <dd><code>java.lang.Exception</code></dd></dl> 708 </li> 709 </ul> 710 <a name="getBuf()"> 711 <!-- --> 712 </a> 713 <ul class="blockList"> 714 <li class="blockList"> 715 <h4>getBuf</h4> 716 <pre>public byte[] getBuf() 717 throws java.lang.Exception</pre> 718 <div class="block">Returns the YUV image buffer (if this image is stored in a unified 719 buffer rather than separate image planes.)</div> 720 <dl><dt><span class="strong">Returns:</span></dt><dd>the YUV image buffer</dd> 721 <dt><span class="strong">Throws:</span></dt> 722 <dd><code>java.lang.Exception</code></dd></dl> 723 </li> 724 </ul> 725 <a name="getSize()"> 726 <!-- --> 727 </a> 728 <ul class="blockListLast"> 729 <li class="blockList"> 730 <h4>getSize</h4> 731 <pre>public int getSize() 732 throws java.lang.Exception</pre> 733 <div class="block">Returns the size (in bytes) of the YUV image buffer (if this image is 734 stored in a unified buffer rather than separate image planes.)</div> 735 <dl><dt><span class="strong">Returns:</span></dt><dd>the size (in bytes) of the YUV image buffer</dd> 736 <dt><span class="strong">Throws:</span></dt> 737 <dd><code>java.lang.Exception</code></dd></dl> 738 </li> 739 </ul> 740 </li> 741 </ul> 742 </li> 743 </ul> 744 </div> 745 </div> 746 <!-- ========= END OF CLASS DATA ========= --> 747 <!-- ======= START OF BOTTOM NAVBAR ====== --> 748 <div class="bottomNav"><a name="navbar_bottom"> 749 <!-- --> 750 </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 751 <!-- --> 752 </a> 753 <ul class="navList" title="Navigation"> 754 <li><a href="../../../org/libjpegturbo/turbojpeg/package-summary.html">Package</a></li> 755 <li class="navBarCell1Rev">Class</li> 756 <li><a href="package-tree.html">Tree</a></li> 757 <li><a href="../../../deprecated-list.html">Deprecated</a></li> 758 <li><a href="../../../index-all.html">Index</a></li> 759 <li><a href="../../../help-doc.html">Help</a></li> 760 </ul> 761 </div> 762 <div class="subNav"> 763 <ul class="navList"> 764 <li><a href="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><span class="strong">Prev Class</span></a></li> 765 <li>Next Class</li> 766 </ul> 767 <ul class="navList"> 768 <li><a href="../../../index.html?org/libjpegturbo/turbojpeg/YUVImage.html" target="_top">Frames</a></li> 769 <li><a href="YUVImage.html" target="_top">No Frames</a></li> 770 </ul> 771 <ul class="navList" id="allclasses_navbar_bottom"> 772 <li><a href="../../../allclasses-noframe.html">All Classes</a></li> 773 </ul> 774 <div> 775 <script type="text/javascript"><!-- 776 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 777 if(window==top) { 778 allClassesLink.style.display = "block"; 779 } 780 else { 781 allClassesLink.style.display = "none"; 782 } 783 //--> 784 </script> 785 </div> 786 <div> 787 <ul class="subNavList"> 788 <li>Summary: </li> 789 <li>Nested | </li> 790 <li><a href="#field_summary">Field</a> | </li> 791 <li><a href="#constructor_summary">Constr</a> | </li> 792 <li><a href="#method_summary">Method</a></li> 793 </ul> 794 <ul class="subNavList"> 795 <li>Detail: </li> 796 <li><a href="#field_detail">Field</a> | </li> 797 <li><a href="#constructor_detail">Constr</a> | </li> 798 <li><a href="#method_detail">Method</a></li> 799 </ul> 800 </div> 801 <a name="skip-navbar_bottom"> 802 <!-- --> 803 </a></div> 804 <!-- ======== END OF BOTTOM NAVBAR ======= --> 805 </body> 806 </html> 807