Debian Codegraph @

java/org/libjpegturbo/turbojpeg/TJ.java

raw
1 /*
2 * Copyright (C)2011-2013, 2017-2018, 2020-2024 D. R. Commander.
3 * All Rights Reserved.
4 * Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * - Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * - Neither the name of the libjpeg-turbo Project nor the names of its
15 * contributors may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 package org.libjpegturbo.turbojpeg;
32
33 import java.awt.Rectangle;
34
35 /**
36 * TurboJPEG utility class (cannot be instantiated)
37 */
38 public final class TJ {
39
40 private TJ() {}
41
42 /**
43 * The number of chrominance subsampling options
44 */
45 public static final int NUMSAMP = 7;
46 /**
47 * 4:4:4 chrominance subsampling (no chrominance subsampling)
48 *
49 * <p>The JPEG or YUV image will contain one chrominance component for every
50 * pixel in the source image.
51 */
52 public static final int SAMP_444 = 0;
53 /**
54 * 4:2:2 chrominance subsampling
55 *
56 * <p>The JPEG or YUV image will contain one chrominance component for every
57 * 2x1 block of pixels in the source image.
58 */
59 public static final int SAMP_422 = 1;
60 /**
61 * 4:2:0 chrominance subsampling
62 *
63 * <p>The JPEG or YUV image will contain one chrominance component for every
64 * 2x2 block of pixels in the source image.
65 */
66 public static final int SAMP_420 = 2;
67 /**
68 * Grayscale
69 *
70 * <p>The JPEG or YUV image will contain no chrominance components.
71 */
72 public static final int SAMP_GRAY = 3;
73 /**
74 * 4:4:0 chrominance subsampling
75 *
76 * <p>The JPEG or YUV image will contain one chrominance component for every
77 * 1x2 block of pixels in the source image.
78 *
79 * <p>NOTE: 4:4:0 subsampling is not fully accelerated in libjpeg-turbo.
80 */
81 public static final int SAMP_440 = 4;
82 /**
83 * 4:1:1 chrominance subsampling
84 *
85 * <p>The JPEG or YUV image will contain one chrominance component for every
86 * 4x1 block of pixels in the source image. All else being equal, a JPEG
87 * image with 4:1:1 subsampling is almost exactly the same size as a JPEG
88 * image with 4:2:0 subsampling, and in the aggregate, both subsampling
89 * methods produce approximately the same perceptual quality. However, 4:1:1
90 * is better able to reproduce sharp horizontal features.
91 *
92 * <p>NOTE: 4:1:1 subsampling is not fully accelerated in libjpeg-turbo.
93 */
94 public static final int SAMP_411 = 5;
95 /**
96 * 4:4:1 chrominance subsampling
97 *
98 * <p>The JPEG or YUV image will contain one chrominance component for every
99 * 1x4 block of pixels in the source image. All else being equal, a JPEG
100 * image with 4:4:1 subsampling is almost exactly the same size as a JPEG
101 * image with 4:2:0 subsampling, and in the aggregate, both subsampling
102 * methods produce approximately the same perceptual quality. However, 4:4:1
103 * is better able to reproduce sharp vertical features.
104 *
105 * <p>NOTE: 4:4:1 subsampling is not fully accelerated in libjpeg-turbo.
106 */
107 public static final int SAMP_441 = 6;
108 /**
109 * Unknown subsampling
110 *
111 * <p>The JPEG image uses an unusual type of chrominance subsampling. Such
112 * images can be decompressed into packed-pixel images, but they cannot be
113 * <ul>
114 * <li> decompressed into planar YUV images,
115 * <li> losslessly transformed if {@link TJTransform#OPT_CROP} is specified
116 * and {@link TJTransform#OPT_GRAY} is not specified,
117 * or
118 * <li> partially decompressed using a cropping region.
119 * </ul>
120 */
121 public static final int SAMP_UNKNOWN = -1;
122
123 /**
124 * Returns the iMCU width for the given level of chrominance subsampling.
125 *
126 * <p>In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each
127 * component are interleaved in a single scan. If the image uses chrominance
128 * subsampling, then multiple luminance blocks are stored together, followed
129 * by a single block for each chrominance component. The minimum set of
130 * full-resolution luminance block(s) and corresponding (possibly subsampled)
131 * chrominance blocks necessary to represent at least one DCT block per
132 * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU
133 * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of
134 * two luminance blocks followed by one block for each chrominance
135 * component.) In a non-interleaved lossy JPEG image, each component is
136 * stored in a separate scan, and an MCU is a single DCT block, so we use the
137 * term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in an
138 * interleaved JPEG image. For the common case of interleaved JPEG images,
139 * an iMCU is the same as an MCU.
140 *
141 * @param subsamp the level of chrominance subsampling (one of
142 * {@link #SAMP_444 SAMP_*})
143 *
144 * @return the iMCU width for the given level of chrominance subsampling.
145 */
146 public static int getMCUWidth(int subsamp) {
147 checkSubsampling(subsamp);
148 return MCU_WIDTH[subsamp];
149 }
150
151 private static final int[] MCU_WIDTH = {
152 8, 16, 16, 8, 8, 32, 8
153 };
154
155
156 /**
157 * Returns the iMCU height for the given level of chrominance subsampling.
158 *
159 * <p>In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each
160 * component are interleaved in a single scan. If the image uses chrominance
161 * subsampling, then multiple luminance blocks are stored together, followed
162 * by a single block for each chrominance component. The minimum set of
163 * full-resolution luminance block(s) and corresponding (possibly subsampled)
164 * chrominance blocks necessary to represent at least one DCT block per
165 * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU
166 * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of
167 * two luminance blocks followed by one block for each chrominance
168 * component.) In a non-interleaved lossy JPEG image, each component is
169 * stored in a separate scan, and an MCU is a single DCT block, so we use the
170 * term "iMCU" (interleaved MCU) to refer to the equivalent of an MCU in an
171 * interleaved JPEG image. For the common case of interleaved JPEG images,
172 * an iMCU is the same as an MCU.
173 *
174 * @param subsamp the level of chrominance subsampling (one of
175 * {@link #SAMP_444 SAMP_*})
176 *
177 * @return the iMCU height for the given level of chrominance subsampling.
178 */
179 public static int getMCUHeight(int subsamp) {
180 checkSubsampling(subsamp);
181 return MCU_HEIGHT[subsamp];
182 }
183
184 private static final int[] MCU_HEIGHT = {
185 8, 8, 16, 8, 16, 8, 32
186 };
187
188
189 /**
190 * The number of pixel formats
191 */
192 public static final int NUMPF = 12;
193 /**
194 * RGB pixel format
195 *
196 * <p>The red, green, and blue components in the image are stored in 3-sample
197 * pixels in the order R, G, B from lowest to highest memory address within
198 * each pixel.
199 */
200 public static final int PF_RGB = 0;
201 /**
202 * BGR pixel format
203 *
204 * <p>The red, green, and blue components in the image are stored in 3-sample
205 * pixels in the order B, G, R from lowest to highest memory address within
206 * each pixel.
207 */
208 public static final int PF_BGR = 1;
209 /**
210 * RGBX pixel format
211 *
212 * <p>The red, green, and blue components in the image are stored in 4-sample
213 * pixels in the order R, G, B from lowest to highest memory address within
214 * each pixel. The X component is ignored when compressing/encoding and
215 * undefined when decompressing/decoding.
216 */
217 public static final int PF_RGBX = 2;
218 /**
219 * BGRX pixel format
220 *
221 * <p>The red, green, and blue components in the image are stored in 4-sample
222 * pixels in the order B, G, R from lowest to highest memory address within
223 * each pixel. The X component is ignored when compressing/encoding and
224 * undefined when decompressing/decoding.
225 */
226 public static final int PF_BGRX = 3;
227 /**
228 * XBGR pixel format
229 *
230 * <p>The red, green, and blue components in the image are stored in 4-sample
231 * pixels in the order R, G, B from highest to lowest memory address within
232 * each pixel. The X component is ignored when compressing/encoding and
233 * undefined when decompressing/decoding.
234 */
235 public static final int PF_XBGR = 4;
236 /**
237 * XRGB pixel format
238 *
239 * <p>The red, green, and blue components in the image are stored in 4-sample
240 * pixels in the order B, G, R from highest to lowest memory address within
241 * each pixel. The X component is ignored when compressing/encoding and
242 * undefined when decompressing/decoding.
243 */
244 public static final int PF_XRGB = 5;
245 /**
246 * Grayscale pixel format
247 *
248 * Each 1-sample pixel represents a luminance (brightness) level from 0 to
249 * the maximum sample value (which is, for instance, 255 for 8-bit samples
250 * or 4095 for 12-bit samples or 65535 for 16-bit samples.)
251 */
252 public static final int PF_GRAY = 6;
253 /**
254 * RGBA pixel format
255 *
256 * <p>This is the same as {@link #PF_RGBX}, except that when
257 * decompressing/decoding, the X component is guaranteed to be equal to the
258 * maximum sample value, which can be interpreted as an opaque alpha channel.
259 */
260 public static final int PF_RGBA = 7;
261 /**
262 * BGRA pixel format
263 *
264 * <p>This is the same as {@link #PF_BGRX}, except that when
265 * decompressing/decoding, the X component is guaranteed to be equal to the
266 * maximum sample value, which can be interpreted as an opaque alpha channel.
267 */
268 public static final int PF_BGRA = 8;
269 /**
270 * ABGR pixel format
271 *
272 * <p>This is the same as {@link #PF_XBGR}, except that when
273 * decompressing/decoding, the X component is guaranteed to be equal to the
274 * maximum sample value, which can be interpreted as an opaque alpha channel.
275 */
276 public static final int PF_ABGR = 9;
277 /**
278 * ARGB pixel format
279 *
280 * <p>This is the same as {@link #PF_XRGB}, except that when
281 * decompressing/decoding, the X component is guaranteed to be equal to the
282 * maximum sample value, which can be interpreted as an opaque alpha channel.
283 */
284 public static final int PF_ARGB = 10;
285 /**
286 * CMYK pixel format
287 *
288 * <p>Unlike RGB, which is an additive color model used primarily for
289 * display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used
290 * primarily for printing. In the CMYK color model, the value of each color
291 * component typically corresponds to an amount of cyan, magenta, yellow, or
292 * black ink that is applied to a white background. In order to convert
293 * between CMYK and RGB, it is necessary to use a color management system
294 * (CMS.) A CMS will attempt to map colors within the printer's gamut to
295 * perceptually similar colors in the display's gamut and vice versa, but the
296 * mapping is typically not 1:1 or reversible, nor can it be defined with a
297 * simple formula. Thus, such a conversion is out of scope for a codec
298 * library. However, the TurboJPEG API allows for compressing packed-pixel
299 * CMYK images into YCCK JPEG images (see {@link #CS_YCCK}) and decompressing
300 * YCCK JPEG images into packed-pixel CMYK images.
301 */
302 public static final int PF_CMYK = 11;
303 /**
304 * Unknown pixel format
305 *
306 * <p>Currently this is only used by
307 * {@link TJCompressor#loadSourceImage TJCompressor.loadSourceImage()}.
308 */
309 public static final int PF_UNKNOWN = -1;
310
311
312 /**
313 * Returns the pixel size (in samples) for the given pixel format.
314 *
315 * @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
316 *
317 * @return the pixel size (in samples) for the given pixel format.
318 */
319 public static int getPixelSize(int pixelFormat) {
320 checkPixelFormat(pixelFormat);
321 return PIXEL_SIZE[pixelFormat];
322 }
323
324 private static final int[] PIXEL_SIZE = {
325 3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4
326 };
327
328
329 /**
330 * For the given pixel format, returns the number of samples that the red
331 * component is offset from the start of the pixel. For instance, if an
332 * 8-bit-per-sample pixel of format <code>TJ.PF_BGRX</code> is stored in
333 * <code>char pixel[]</code>, then the red component is
334 * <code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
335 *
336 * @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
337 *
338 * @return the red offset for the given pixel format, or -1 if the pixel
339 * format does not have a red component.
340 */
341 public static int getRedOffset(int pixelFormat) {
342 checkPixelFormat(pixelFormat);
343 return RED_OFFSET[pixelFormat];
344 }
345
346 private static final int[] RED_OFFSET = {
347 0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1
348 };
349
350
351 /**
352 * For the given pixel format, returns the number of samples that the green
353 * component is offset from the start of the pixel. For instance, if an
354 * 8-bit-per-sample pixel of format <code>TJ.PF_BGRX</code> is stored in
355 * <code>char pixel[]</code>, then the green component is
356 * <code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
357 *
358 * @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
359 *
360 * @return the green offset for the given pixel format, or -1 if the pixel
361 * format does not have a green component.
362 */
363 public static int getGreenOffset(int pixelFormat) {
364 checkPixelFormat(pixelFormat);
365 return GREEN_OFFSET[pixelFormat];
366 }
367
368 private static final int[] GREEN_OFFSET = {
369 1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1
370 };
371
372
373 /**
374 * For the given pixel format, returns the number of samples that the blue
375 * component is offset from the start of the pixel. For instance, if an
376 * 8-bit-per-sample pixel of format <code>TJ.PF_BGRX</code> is stored in
377 * <code>char pixel[]</code>, then the blue component is
378 * <code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
379 *
380 * @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
381 *
382 * @return the blue offset for the given pixel format, or -1 if the pixel
383 * format does not have a blue component.
384 */
385 public static int getBlueOffset(int pixelFormat) {
386 checkPixelFormat(pixelFormat);
387 return BLUE_OFFSET[pixelFormat];
388 }
389
390 private static final int[] BLUE_OFFSET = {
391 2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1
392 };
393
394
395 /**
396 * For the given pixel format, returns the number of samples that the alpha
397 * component is offset from the start of the pixel. For instance, if an
398 * 8-bit-per-sample pixel of format <code>TJ.PF_BGRA</code> is stored in
399 * <code>char pixel[]</code>, then the alpha component is
400 * <code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.
401 *
402 * @param pixelFormat the pixel format (one of {@link #PF_RGB PF_*})
403 *
404 * @return the alpha offset for the given pixel format, or -1 if the pixel
405 * format does not have a alpha component.
406 */
407 public static int getAlphaOffset(int pixelFormat) {
408 checkPixelFormat(pixelFormat);
409 return ALPHA_OFFSET[pixelFormat];
410 }
411
412 private static final int[] ALPHA_OFFSET = {
413 -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
414 };
415
416
417 /**
418 * The number of JPEG colorspaces
419 */
420 public static final int NUMCS = 5;
421 /**
422 * RGB colorspace
423 *
424 * <p>When generating the JPEG image, the R, G, and B components in the
425 * source image are reordered into image planes, but no colorspace conversion
426 * or subsampling is performed. RGB JPEG images can be generated from and
427 * decompressed to packed-pixel images with any of the extended RGB or
428 * grayscale pixel formats, but they cannot be generated from or
429 * decompressed to planar YUV images.
430 */
431 public static final int CS_RGB = 0;
432 /**
433 * YCbCr colorspace
434 *
435 * <p>YCbCr is not an absolute colorspace but rather a mathematical
436 * transformation of RGB designed solely for storage and transmission. YCbCr
437 * images must be converted to RGB before they can be displayed. In the
438 * YCbCr colorspace, the Y (luminance) component represents the black &amp;
439 * white portion of the original image, and the Cb and Cr (chrominance)
440 * components represent the color portion of the original image.
441 * Historically, the analog equivalent of this transformation allowed the
442 * same signal to be displayed to both black &amp; white and color
443 * televisions, but JPEG images use YCbCr primarily because it allows the
444 * color data to be optionally subsampled in order to reduce network and disk
445 * usage. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images
446 * can be generated from and decompressed to packed-pixel images with any of
447 * the extended RGB or grayscale pixel formats. YCbCr JPEG images can also
448 * be generated from and decompressed to planar YUV images.
449 */
450 @SuppressWarnings("checkstyle:ConstantName")
451 public static final int CS_YCbCr = 1;
452 /**
453 * Grayscale colorspace
454 *
455 * <p>The JPEG image retains only the luminance data (Y component), and any
456 * color data from the source image is discarded. Grayscale JPEG images can
457 * be generated from and decompressed to packed-pixel images with any of the
458 * extended RGB or grayscale pixel formats, or they can be generated from and
459 * decompressed to planar YUV images.
460 */
461 public static final int CS_GRAY = 2;
462 /**
463 * CMYK colorspace
464 *
465 * <p>When generating the JPEG image, the C, M, Y, and K components in the
466 * source image are reordered into image planes, but no colorspace conversion
467 * or subsampling is performed. CMYK JPEG images can only be generated from
468 * and decompressed to packed-pixel images with the CMYK pixel format.
469 */
470 public static final int CS_CMYK = 3;
471 /**
472 * YCCK colorspace
473 *
474 * <p>YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a
475 * mathematical transformation of CMYK designed solely for storage and
476 * transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be
477 * reversibly transformed into YCCK, and as with YCbCr, the chrominance
478 * components in the YCCK pixels can be subsampled without incurring major
479 * perceptual loss. YCCK JPEG images can only be generated from and
480 * decompressed to packed-pixel images with the CMYK pixel format.
481 */
482 public static final int CS_YCCK = 4;
483
484
485 /**
486 * Error handling behavior
487 *
488 * <p><b>Value</b>
489 * <ul>
490 * <li> <code>0</code> <i>[default]</i> Allow the current
491 * compression/decompression/transform operation to complete unless a fatal
492 * error is encountered.
493 * <li> <code>1</code> Immediately discontinue the current
494 * compression/decompression/transform operation if a warning (non-fatal
495 * error) occurs.
496 * </ul>
497 */
498 public static final int PARAM_STOPONWARNING = 0;
499 /**
500 * Row order in packed-pixel source/destination images
501 *
502 * <p><b>Value</b>
503 * <ul>
504 * <li> <code>0</code> <i>[default]</i> top-down (X11) order
505 * <li> <code>1</code> bottom-up (Windows, OpenGL) order
506 * </ul>
507 */
508 public static final int PARAM_BOTTOMUP = 1;
509 /**
510 * Perceptual quality of lossy JPEG images [compression only]
511 *
512 * <p><b>Value</b>
513 * <ul>
514 * <li> <code>1</code>-<code>100</code> (<code>1</code> = worst quality but
515 * best compression, <code>100</code> = best quality but worst compression)
516 * <i>[no default; must be explicitly specified]</i>
517 * </ul>
518 */
519 public static final int PARAM_QUALITY = 3;
520 /**
521 * Chrominance subsampling level
522 *
523 * <p>The JPEG or YUV image uses (decompression, decoding) or will use (lossy
524 * compression, encoding) the specified level of chrominance subsampling.
525 *
526 * <p>When pixels are converted from RGB to YCbCr (see {@link #CS_YCbCr}) or
527 * from CMYK to YCCK (see {@link #CS_YCCK}) as part of the JPEG compression
528 * process, some of the Cb and Cr (chrominance) components can be discarded
529 * or averaged together to produce a smaller image with little perceptible
530 * loss of image quality. (The human eye is more sensitive to small changes
531 * in brightness than to small changes in color.) This is called
532 * "chrominance subsampling".
533 *
534 * <p><b>Value</b>
535 * <ul>
536 * <li> One of {@link #SAMP_444 TJ.SAMP_*} <i>[no default; must be explicitly
537 * specified for lossy compression, encoding, and decoding]</i>
538 * </ul>
539 */
540 public static final int PARAM_SUBSAMP = 4;
541 /**
542 * JPEG width (in pixels) [decompression only, read-only]
543 */
544 public static final int PARAM_JPEGWIDTH = 5;
545 /**
546 * JPEG height (in pixels) [decompression only, read-only]
547 */
548 public static final int PARAM_JPEGHEIGHT = 6;
549 /**
550 * Data precision (bits per sample)
551 *
552 * <p>The JPEG image uses (decompression) or will use (lossless compression)
553 * the specified number of bits per sample. This parameter also specifies
554 * the target data precision when loading a PBMPLUS file with
555 * {@link TJCompressor#loadSourceImage TJCompressor.loadSourceImage()} and
556 * the source data precision when saving a PBMPLUS file with
557 * {@link TJDecompressor#saveImage TJDecompressor.saveImage()}.
558 *
559 * <p>The data precision is the number of bits in the maximum sample value,
560 * which may not be the same as the width of the data type used to store the
561 * sample.
562 *
563 * <p><b>Value</b>
564 * <ul>
565 * <li> <code>8</code> or <code>12</code> for lossy JPEG images;
566 * <code>2</code> to <code>16</code> for lossless JPEG and PBMPLUS images
567 * </ul>
568 *
569 * <p>12-bit JPEG data precision implies {@link #PARAM_OPTIMIZE} unless
570 * {@link #PARAM_ARITHMETIC} is set.
571 */
572 public static final int PARAM_PRECISION = 7;
573 /**
574 * JPEG colorspace
575 *
576 * <p>The JPEG image uses (decompression) or will use (lossy compression) the
577 * specified colorspace.
578 *
579 * <p><b>Value</b>
580 * <ul>
581 * <li> One of {@link #CS_RGB TJ.CS_*} <i>[default for lossy compression:
582 * automatically selected based on the subsampling level and pixel
583 * format]</i>
584 * </ul>
585 */
586 public static final int PARAM_COLORSPACE = 8;
587 /**
588 * Chrominance upsampling algorithm [lossy decompression only]
589 *
590 * <p><b>Value</b>
591 * <ul>
592 * <li> <code>0</code> <i>[default]</i> Use smooth upsampling when
593 * decompressing a JPEG image that was generated using chrominance
594 * subsampling. This creates a smooth transition between neighboring
595 * chrominance components in order to reduce upsampling artifacts in the
596 * decompressed image.
597 * <li> <code>1</code> Use the fastest chrominance upsampling algorithm
598 * available, which may combine upsampling with color conversion.
599 * </ul>
600 */
601 public static final int PARAM_FASTUPSAMPLE = 9;
602 /**
603 * DCT/IDCT algorithm [lossy compression and decompression]
604 *
605 * <p><b>Value</b>
606 * <ul>
607 * <li> <code>0</code> <i>[default]</i> Use the most accurate DCT/IDCT
608 * algorithm available.
609 * <li> <code>1</code> Use the fastest DCT/IDCT algorithm available.
610 * </ul>
611 *
612 * <p>This parameter is provided mainly for backward compatibility with
613 * libjpeg, which historically implemented several different DCT/IDCT
614 * algorithms because of performance limitations with 1990s CPUs. In the
615 * libjpeg-turbo implementation of the TurboJPEG API:
616 *
617 * <ul>
618 * <li> The "fast" and "accurate" DCT/IDCT algorithms perform similarly on
619 * modern x86/x86-64 CPUs that support AVX2 instructions.
620 * <li> The "fast" algorithm is generally only about 5-15% faster than the
621 * "accurate" algorithm on other types of CPUs.
622 * <li> The difference in accuracy between the "fast" and "accurate"
623 * algorithms is the most pronounced at JPEG quality levels above 90 and
624 * tends to be more pronounced with decompression than with compression.
625 * <li> For JPEG quality levels above 97, the "fast" algorithm degrades and
626 * is not fully accelerated, so it is slower than the "accurate" algorithm.
627 * </ul>
628 */
629 public static final int PARAM_FASTDCT = 10;
630 /**
631 * Huffman table optimization [lossy compression, lossless transformation]
632 *
633 * <p><b>Value</b>
634 * <ul>
635 * <li> <code>0</code> <i>[default]</i> The JPEG image will use the default
636 * Huffman tables.
637 * <li> <code>1</code> Optimal Huffman tables will be computed for the JPEG
638 * image. For lossless transformation, this can also be specified using
639 * {@link TJTransform#OPT_OPTIMIZE}.
640 * </ul>
641 *
642 * <p>Huffman table optimization improves compression slightly (generally 5%
643 * or less), but it reduces compression performance considerably.
644 */
645 public static final int PARAM_OPTIMIZE = 11;
646 /**
647 * Progressive JPEG
648 *
649 * <p>In a progressive JPEG image, the DCT coefficients are split across
650 * multiple "scans" of increasing quality. Thus, a low-quality scan
651 * containing the lowest-frequency DCT coefficients can be transmitted first
652 * and refined with subsequent higher-quality scans containing
653 * higher-frequency DCT coefficients. When using Huffman entropy coding, the
654 * progressive JPEG format also provides an "end-of-bands (EOB) run" feature
655 * that allows large groups of zeroes, potentially spanning multiple MCUs, to
656 * be represented using only a few bytes.
657 *
658 * <p><b>Value</b>
659 * <ul>
660 * <li> <code>0</code> <i>[default for compression, lossless
661 * transformation]</i> The lossy JPEG image is (decompression) or will be
662 * (compression, lossless transformation) single-scan.
663 * <li> <code>1</code> The lossy JPEG image is (decompression) or will be
664 * (compression, lossless transformation) progressive. For lossless
665 * transformation, this can also be specified using
666 * {@link TJTransform#OPT_PROGRESSIVE}.
667 * </ul>
668 *
669 * <p>Progressive JPEG images generally have better compression ratios than
670 * single-scan JPEG images (much better if the image has large areas of solid
671 * color), but progressive JPEG compression and decompression is considerably
672 * slower than single-scan JPEG compression and decompression. Can be
673 * combined with {@link #PARAM_ARITHMETIC}. Implies {@link #PARAM_OPTIMIZE}
674 * unless {@link #PARAM_ARITHMETIC} is also set.
675 */
676 public static final int PARAM_PROGRESSIVE = 12;
677 /**
678 * Progressive JPEG scan limit for lossy JPEG images [decompression, lossless
679 * transformation]
680 *
681 * <p>Setting this parameter causes the decompression and transform
682 * operations to throw an error if the number of scans in a progressive JPEG
683 * image exceeds the specified limit. The primary purpose of this is to
684 * allow security-critical applications to guard against an exploit of the
685 * progressive JPEG format described in
686 * <a href="https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf" target="_blank">this report</a>.
687 *
688 * <p><b>Value</b>
689 * <ul>
690 * <li> maximum number of progressive JPEG scans that the decompression and
691 * transform operations will process <i>[default: <code>0</code> (no
692 * limit)]</i>
693 * </ul>
694 *
695 * @see #PARAM_PROGRESSIVE
696 */
697 public static final int PARAM_SCANLIMIT = 13;
698 /**
699 * Arithmetic entropy coding
700 *
701 * <p><b>Value</b>
702 * <ul>
703 * <li> <code>0</code> <i>[default for compression, lossless
704 * transformation]</i> The lossy JPEG image uses (decompression) or will use
705 * (compression, lossless transformation) Huffman entropy coding.
706 * <li> <code>1</code> The lossy JPEG image uses (decompression) or will use
707 * (compression, lossless transformation) arithmetic entropy coding. For
708 * lossless transformation, this can also be specified using
709 * {@link TJTransform#OPT_ARITHMETIC}.
710 * </ul>
711 *
712 * <p>Arithmetic entropy coding generally improves compression relative to
713 * Huffman entropy coding, but it reduces compression and decompression
714 * performance considerably. Can be combined with
715 * {@link #PARAM_PROGRESSIVE}.
716 */
717 public static final int PARAM_ARITHMETIC = 14;
718 /**
719 * Lossless JPEG
720 *
721 * <p><b>Value</b>
722 * <ul>
723 * <li> <code>0</code> <i>[default for compression]</i> The JPEG image is
724 * (decompression) or will be (compression) lossy/DCT-based.
725 * <li> <code>1</code> The JPEG image is (decompression) or will be
726 * (compression) lossless/predictive.
727 * </ul>
728 *
729 * <p>In most cases, lossless JPEG compression and decompression is
730 * considerably slower than lossy JPEG compression and decompression, and
731 * lossless JPEG images are much larger than lossy JPEG images. Thus,
732 * lossless JPEG images are typically used only for applications that require
733 * mathematically lossless compression. Also note that the following
734 * features are not available with lossless JPEG images:
735 * <ul>
736 * <li> Colorspace conversion (lossless JPEG images always use
737 * {@link #CS_RGB}, {@link #CS_GRAY}, or {@link #CS_CMYK}, depending on the
738 * pixel format of the source image)
739 * <li> Chrominance subsampling (lossless JPEG images always use
740 * {@link #SAMP_444})
741 * <li> JPEG quality selection
742 * <li> DCT/IDCT algorithm selection
743 * <li> Progressive JPEG
744 * <li> Arithmetic entropy coding
745 * <li> Compression from/decompression to planar YUV images
746 * <li> Decompression scaling
747 * <li> Lossless transformation
748 * </ul>
749 *
750 * @see #PARAM_LOSSLESSPSV
751 * @see #PARAM_LOSSLESSPT
752 */
753 public static final int PARAM_LOSSLESS = 15;
754 /**
755 * Lossless JPEG predictor selection value (PSV)
756 *
757 * <p><b>Value</b>
758 * <ul>
759 * <li> <code>1</code>-<code>7</code> <i>[default for compression:
760 * <code>1</code>]</i>
761 * </ul>
762 *
763 * <p>Lossless JPEG compression shares no algorithms with lossy JPEG
764 * compression. Instead, it uses differential pulse-code modulation (DPCM),
765 * an algorithm whereby each sample is encoded as the difference between the
766 * sample's value and a "predictor", which is based on the values of
767 * neighboring samples. If Ra is the sample immediately to the left of the
768 * current sample, Rb is the sample immediately above the current sample, and
769 * Rc is the sample diagonally to the left and above the current sample, then
770 * the relationship between the predictor selection value and the predictor
771 * is as follows:
772 *
773 * <table border=1>
774 * <caption></caption>
775 * <tr> <th>PSV</th> <th>Predictor</th> </tr>
776 * <tr> <td>1</td> <td>Ra</td> </tr>
777 * <tr> <td>2</td> <td>Rb</td> </tr>
778 * <tr> <td>3</td> <td>Rc</td> </tr>
779 * <tr> <td>4</td> <td>Ra + Rb – Rc</td> </tr>
780 * <tr> <td>5</td> <td>Ra + (Rb – Rc) / 2</td> </tr>
781 * <tr> <td>6</td> <td>Rb + (Ra – Rc) / 2</td> </tr>
782 * <tr> <td>7</td> <td>(Ra + Rb) / 2</td> </tr>
783 * </table>
784 *
785 * <p>Predictors 1-3 are 1-dimensional predictors, whereas Predictors 4-7 are
786 * 2-dimensional predictors. The best predictor for a particular image
787 * depends on the image.
788 *
789 * @see #PARAM_LOSSLESS
790 */
791 public static final int PARAM_LOSSLESSPSV = 16;
792 /**
793 * Lossless JPEG point transform (Pt)
794 *
795 * <p><b>Value</b>
796 * <ul>
797 * <li> <code>0</code> through <i><b>precision</b> - 1</i>, where
798 * <b><i>precision</i></b> is the JPEG data precision in bits <i>[default for
799 * compression: <code>0</code>]</i>
800 * </ul>
801 *
802 * <p>A point transform value of <code>0</code> is necessary in order to
803 * generate a fully lossless JPEG image. (A non-zero point transform value
804 * right-shifts the input samples by the specified number of bits, which is
805 * effectively a form of lossy color quantization.)
806 *
807 * @see #PARAM_LOSSLESS
808 * @see #PARAM_PRECISION
809 */
810 public static final int PARAM_LOSSLESSPT = 17;
811 /**
812 * JPEG restart marker interval in MCUs [lossy compression only]
813 *
814 * <p>The nature of entropy coding is such that a corrupt JPEG image cannot
815 * be decompressed beyond the point of corruption unless it contains restart
816 * markers. A restart marker stops and restarts the entropy coding algorithm
817 * so that, if a JPEG image is corrupted, decompression can resume at the
818 * next marker. Thus, adding more restart markers improves the fault
819 * tolerance of the JPEG image, but adding too many restart markers can
820 * adversely affect the compression ratio and performance.
821 *
822 * <p>In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set
823 * of interleaved "data units" (8x8 DCT blocks if the image is lossy or
824 * samples if the image is lossless) necessary to represent at least one data
825 * unit per component. (For example, an MCU in an interleaved lossy JPEG
826 * image that uses 4:2:2 subsampling consists of two luminance blocks
827 * followed by one block for each chrominance component.) In
828 * single-component or non-interleaved JPEG images, an MCU is the same as a
829 * data unit.
830 *
831 * <p><b>Value</b>
832 * <ul>
833 * <li> the number of MCUs between each restart marker <i>[default:
834 * <code>0</code> (no restart markers)]</i>
835 * </ul>
836 *
837 * <p> Setting this parameter to a non-zero value sets
838 * {@link #PARAM_RESTARTROWS} to 0.
839 */
840 public static final int PARAM_RESTARTBLOCKS = 18;
841 /**
842 * JPEG restart marker interval in MCU rows [compression only]
843 *
844 * <p>See {@link #PARAM_RESTARTBLOCKS} for a description of restart markers
845 * and MCUs. An MCU row is a row of MCUs spanning the entire width of the
846 * image.
847 *
848 * <p><b>Value</b>
849 * <ul>
850 * <li> the number of MCU rows between each restart marker <i>[default:
851 * <code>0</code> (no restart markers)]</i>
852 * </ul>
853 *
854 * <p>Setting this parameter to a non-zero value sets
855 * {@link #PARAM_RESTARTBLOCKS} to 0.
856 */
857 public static final int PARAM_RESTARTROWS = 19;
858 /**
859 * JPEG horizontal pixel density
860 *
861 * <p><b>Value</b>
862 * <ul>
863 * <li> The JPEG image has (decompression) or will have (compression) the
864 * specified horizontal pixel density <i>[default for compression:
865 * <code>1</code>]</i>.
866 * </ul>
867 *
868 * <p>This value is stored in or read from the JPEG header. It does not
869 * affect the contents of the JPEG image. Note that this parameter is set by
870 * {@link TJCompressor#loadSourceImage TJCompressor.loadSourceImage()} when
871 * loading a Windows BMP file that contains pixel density information, and
872 * the value of this parameter is stored to a Windows BMP file by
873 * {@link TJDecompressor#saveImage TJDecompressor.saveImage()} if the value
874 * of {@link #PARAM_DENSITYUNITS} is <code>2</code>.
875 *
876 * <p>This parameter has no effect unless the JPEG colorspace (see
877 * {@link #PARAM_COLORSPACE}) is {@link #CS_YCbCr} or {@link #CS_GRAY}.
878 *
879 * @see #PARAM_DENSITYUNITS
880 */
881 public static final int PARAM_XDENSITY = 20;
882 /**
883 * JPEG vertical pixel density
884 *
885 * <p><b>Value</b>
886 * <ul>
887 * <li> The JPEG image has (decompression) or will have (compression) the
888 * specified vertical pixel density <i>[default for compression:
889 * <code>1</code>]</i>.
890 * </ul>
891 *
892 * <p>This value is stored in or read from the JPEG header. It does not
893 * affect the contents of the JPEG image. Note that this parameter is set by
894 * {@link TJCompressor#loadSourceImage TJCompressor.loadSourceImage()} when
895 * loading a Windows BMP file that contains pixel density information, and
896 * the value of this parameter is stored to a Windows BMP file by
897 * {@link TJDecompressor#saveImage TJDecompressor.saveImage()} if the value
898 * of {@link #PARAM_DENSITYUNITS} is <code>2</code>.
899 *
900 * <p>This parameter has no effect unless the JPEG colorspace (see
901 * {@link #PARAM_COLORSPACE}) is {@link #CS_YCbCr} or {@link #CS_GRAY}.
902 *
903 * @see #PARAM_DENSITYUNITS
904 */
905 public static final int PARAM_YDENSITY = 21;
906 /**
907 * JPEG pixel density units
908 *
909 * <p><b>Value</b>
910 * <ul>
911 * <li> <code>0</code> <i>[default for compression]</i> The pixel density of
912 * the JPEG image is expressed (decompression) or will be expressed
913 * (compression) in unknown units.
914 * <li> <code>1</code> The pixel density of the JPEG image is expressed
915 * (decompression) or will be expressed (compression) in units of
916 * pixels/inch.
917 * <li> <code>2</code> The pixel density of the JPEG image is expressed
918 * (decompression) or will be expressed (compression) in units of pixels/cm.
919 * </ul>
920 *
921 * <p>This value is stored in or read from the JPEG header. It does not
922 * affect the contents of the JPEG image. Note that this parameter is set by
923 * {@link TJCompressor#loadSourceImage TJCompressor.loadSourceImage()} when
924 * loading a Windows BMP file that contains pixel density information, and
925 * the value of this parameter is stored to a Windows BMP file by
926 * {@link TJDecompressor#saveImage TJDecompressor.saveImage()} if the value
927 * is <code>2</code>.
928 *
929 * <p>This parameter has no effect unless the JPEG colorspace (see
930 * {@link #PARAM_COLORSPACE}) is {@link #CS_YCbCr} or {@link #CS_GRAY}.
931 *
932 * @see #PARAM_XDENSITY
933 * @see #PARAM_YDENSITY
934 */
935 public static final int PARAM_DENSITYUNITS = 22;
936 /**
937 * Memory limit for intermediate buffers
938 *
939 * <p><b>Value</b>
940 * <ul>
941 * <li> the maximum amount of memory (in megabytes) that will be allocated
942 * for intermediate buffers, which are used with progressive JPEG compression
943 * and decompression, Huffman table optimization, lossless JPEG compression,
944 * and lossless transformation <i>[default: <code>0</code> (no limit)]</i>
945 * </ul>
946 */
947 public static final int PARAM_MAXMEMORY = 23;
948 /**
949 * Image size limit [decompression, lossless transformation]
950 *
951 * <p>Setting this parameter causes the decompression and transform
952 * operations to throw an error if the number of pixels in the JPEG source
953 * image exceeds the specified limit. This allows security-critical
954 * applications to guard against excessive memory consumption.
955 *
956 * <p><b>Value</b>
957 * <ul>
958 * <li> maximum number of pixels that the decompression and transform
959 * operations will process <i>[default: <code>0</code> (no limit)]</i>
960 * </ul>
961 */
962 public static final int PARAM_MAXPIXELS = 24;
963 /**
964 * Marker copying behavior [decompression, lossless transformation]
965 *
966 * <p><b>Value [lossless transformation]</b>
967 * <ul>
968 * <li> <code>0</code> Do not copy any extra markers (including comments,
969 * JFIF thumbnails, Exif data, and ICC profile data) from the source image to
970 * the destination image.
971 * <li> <code>1</code> Do not copy any extra markers, except comment (COM)
972 * markers, from the source image to the destination image.
973 * <li> <code>2</code> <i>[default]</i> Copy all extra markers from the
974 * source image to the destination image.
975 * <li> <code>3</code> Copy all extra markers, except ICC profile data (APP2
976 * markers), from the source image to the destination image.
977 * <li> <code>4</code> Do not copy any extra markers, except ICC profile data
978 * (APP2 markers), from the source image to the destination image.
979 * </ul>
980 *
981 * <p>{@link TJTransform#OPT_COPYNONE} overrides this parameter for a
982 * particular transform. This parameter overrides any ICC profile that was
983 * previously associated with a compressor instance using
984 * {@link TJCompressor#setICCProfile TJCompressor.setICCProfile()} or with a
985 * transformer instance using {@link TJTransformer#setICCProfile
986 * TJTransformer.setICCProfile()}.
987 *
988 * <p>When decompressing, associating a JPEG source image with the
989 * decompressor instance extracts the ICC profile from the source image if
990 * this parameter is set to <code>2</code> or <code>4</code>.
991 * {@link TJDecompressor#getICCProfile} can then be used to retrieve the
992 * profile.
993 */
994 public static final int PARAM_SAVEMARKERS = 25;
995
996
997 /**
998 * The number of error codes
999 */
1000 public static final int NUMERR = 2;
1001 /**
1002 * The error was non-fatal and recoverable, but the destination image may
1003 * still be corrupt.
1004 *
1005 * <p>NOTE: Due to the design of the TurboJPEG Java API, only certain methods
1006 * (specifically, {@link TJDecompressor TJDecompressor.decompress*()} methods
1007 * with a void return type) will complete and leave the destination image in
1008 * a fully recoverable state after a non-fatal error occurs.
1009 */
1010 public static final int ERR_WARNING = 0;
1011 /**
1012 * The error was fatal and non-recoverable.
1013 */
1014 public static final int ERR_FATAL = 1;
1015
1016
1017 /**
1018 * Returns the maximum size of the buffer (in bytes) required to hold a JPEG
1019 * image with the given width, height, and level of chrominance subsampling.
1020 *
1021 * @param width the width (in pixels) of the JPEG image
1022 *
1023 * @param height the height (in pixels) of the JPEG image
1024 *
1025 * @param jpegSubsamp the level of chrominance subsampling to be used when
1026 * generating the JPEG image (one of {@link #SAMP_444 TJ.SAMP_*}.)
1027 * {@link #SAMP_UNKNOWN} is treated like {@link #SAMP_444}, since a buffer
1028 * large enough to hold a JPEG image with no subsampling should also be large
1029 * enough to hold a JPEG image with an arbitrary level of subsampling. Note
1030 * that lossless JPEG images always use {@link #SAMP_444}.
1031 *
1032 * @return the maximum size of the buffer (in bytes) required to hold a JPEG
1033 * image with the given width, height, and level of chrominance subsampling.
1034 */
1035 public static native int bufSize(int width, int height, int jpegSubsamp);
1036
1037 /**
1038 * Returns the size of the buffer (in bytes) required to hold a unified
1039 * planar YUV image with the given width, height, and level of chrominance
1040 * subsampling.
1041 *
1042 * @param width the width (in pixels) of the YUV image
1043 *
1044 * @param align row alignment (in bytes) of the YUV image (must be a power of
1045 * 2.) Setting this parameter to n specifies that each row in each plane of
1046 * the YUV image will be padded to the nearest multiple of n bytes
1047 * (1 = unpadded.)
1048 *
1049 * @param height the height (in pixels) of the YUV image
1050 *
1051 * @param subsamp the level of chrominance subsampling used in the YUV
1052 * image (one of {@link #SAMP_444 TJ.SAMP_*})
1053 *
1054 * @return the size of the buffer (in bytes) required to hold a unified
1055 * planar YUV image with the given width, height, and level of chrominance
1056 * subsampling.
1057 */
1058 public static native int bufSizeYUV(int width, int align, int height,
1059 int subsamp);
1060
1061 /**
1062 * Returns the size of the buffer (in bytes) required to hold a YUV image
1063 * plane with the given parameters.
1064 *
1065 * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb,
1066 * 2 = V/Cr)
1067 *
1068 * @param width width (in pixels) of the YUV image. NOTE: This is the width
1069 * of the whole image, not the plane width.
1070 *
1071 * @param stride bytes per row in the image plane.
1072 *
1073 * @param height height (in pixels) of the YUV image. NOTE: This is the
1074 * height of the whole image, not the plane height.
1075 *
1076 * @param subsamp the level of chrominance subsampling used in the YUV
1077 * image (one of {@link #SAMP_444 TJ.SAMP_*})
1078 *
1079 * @return the size of the buffer (in bytes) required to hold a YUV image
1080 * plane with the given parameters.
1081 */
1082 public static native int planeSizeYUV(int componentID, int width, int stride,
1083 int height, int subsamp);
1084
1085 /**
1086 * Returns the plane width of a YUV image plane with the given parameters.
1087 * Refer to {@link YUVImage} for a description of plane width.
1088 *
1089 * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb,
1090 * 2 = V/Cr)
1091 *
1092 * @param width width (in pixels) of the YUV image
1093 *
1094 * @param subsamp the level of chrominance subsampling used in the YUV image
1095 * (one of {@link #SAMP_444 TJ.SAMP_*})
1096 *
1097 * @return the plane width of a YUV image plane with the given parameters.
1098 */
1099 public static native int planeWidth(int componentID, int width, int subsamp);
1100
1101 /**
1102 * Returns the plane height of a YUV image plane with the given parameters.
1103 * Refer to {@link YUVImage} for a description of plane height.
1104 *
1105 * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb,
1106 * 2 = V/Cr)
1107 *
1108 * @param height height (in pixels) of the YUV image
1109 *
1110 * @param subsamp the level of chrominance subsampling used in the YUV image
1111 * (one of {@link #SAMP_444 TJ.SAMP_*})
1112 *
1113 * @return the plane height of a YUV image plane with the given parameters.
1114 */
1115 public static native int planeHeight(int componentID, int height,
1116 int subsamp);
1117
1118 /**
1119 * Returns a list of fractional scaling factors that the JPEG decompressor
1120 * supports.
1121 *
1122 * @return a list of fractional scaling factors that the JPEG decompressor
1123 * supports.
1124 */
1125 public static native TJScalingFactor[] getScalingFactors();
1126
1127 /**
1128 * A {@link TJScalingFactor} instance that specifies a scaling factor of 1/1
1129 * (no scaling)
1130 */
1131 public static final TJScalingFactor UNSCALED = new TJScalingFactor(1, 1);
1132
1133 /**
1134 * A <code>java.awt.Rectangle</code> instance that specifies no cropping
1135 */
1136 public static final Rectangle UNCROPPED = new Rectangle(0, 0, 0, 0);
1137
1138 static {
1139 TJLoader.load();
1140 }
1141
1142 private static void checkPixelFormat(int pixelFormat) {
1143 if (pixelFormat < 0 || pixelFormat >= NUMPF)
1144 throw new IllegalArgumentException("Invalid pixel format");
1145 }
1146
1147 private static void checkSubsampling(int subsamp) {
1148 if (subsamp < 0 || subsamp >= NUMSAMP)
1149 throw new IllegalArgumentException("Invalid subsampling type");
1150 }
1151
1152 }