| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved. | 2 * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * - Redistributions of source code must retain the above copyright notice, | 7 * - Redistributions of source code must retain the above copyright notice, |
| 8 * this list of conditions and the following disclaimer. | 8 * this list of conditions and the following disclaimer. |
| 9 * - Redistributions in binary form must reproduce the above copyright notice, | 9 * - Redistributions in binary form must reproduce the above copyright notice, |
| 10 * this list of conditions and the following disclaimer in the documentation | 10 * this list of conditions and the following disclaimer in the documentation |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 * - 16x8 for 4:2:2 | 106 * - 16x8 for 4:2:2 |
| 107 * - 8x16 for 4:4:0 | 107 * - 8x16 for 4:4:0 |
| 108 * - 16x16 for 4:2:0 | 108 * - 16x16 for 4:2:0 |
| 109 */ | 109 */ |
| 110 static const int tjMCUHeight[TJ_NUMSAMP] = {8, 8, 16, 8, 16}; | 110 static const int tjMCUHeight[TJ_NUMSAMP] = {8, 8, 16, 8, 16}; |
| 111 | 111 |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * The number of pixel formats | 114 * The number of pixel formats |
| 115 */ | 115 */ |
| 116 #define TJ_NUMPF 7 | 116 #define TJ_NUMPF 11 |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * Pixel formats | 119 * Pixel formats |
| 120 */ | 120 */ |
| 121 enum TJPF | 121 enum TJPF |
| 122 { | 122 { |
| 123 /** | 123 /** |
| 124 * RGB pixel format. The red, green, and blue components in the image are | 124 * RGB pixel format. The red, green, and blue components in the image are |
| 125 * stored in 3-byte pixels in the order R, G, B from lowest to highest byte | 125 * stored in 3-byte pixels in the order R, G, B from lowest to highest byte |
| 126 * address within each pixel. | 126 * address within each pixel. |
| 127 */ | 127 */ |
| 128 TJPF_RGB=0, | 128 TJPF_RGB=0, |
| 129 /** | 129 /** |
| 130 * BGR pixel format. The red, green, and blue components in the image are | 130 * BGR pixel format. The red, green, and blue components in the image are |
| 131 * stored in 3-byte pixels in the order B, G, R from lowest to highest byte | 131 * stored in 3-byte pixels in the order B, G, R from lowest to highest byte |
| 132 * address within each pixel. | 132 * address within each pixel. |
| 133 */ | 133 */ |
| 134 TJPF_BGR, | 134 TJPF_BGR, |
| 135 /** | 135 /** |
| 136 * RGBX pixel format. The red, green, and blue components in the image are | 136 * RGBX pixel format. The red, green, and blue components in the image are |
| 137 * stored in 4-byte pixels in the order R, G, B from lowest to highest byte | 137 * stored in 4-byte pixels in the order R, G, B from lowest to highest byte |
| 138 * address within each pixel. | 138 * address within each pixel. The X component is ignored when compressing |
| 139 * and undefined when decompressing. |
| 139 */ | 140 */ |
| 140 TJPF_RGBX, | 141 TJPF_RGBX, |
| 141 /** | 142 /** |
| 142 * BGRX pixel format. The red, green, and blue components in the image are | 143 * BGRX pixel format. The red, green, and blue components in the image are |
| 143 * stored in 4-byte pixels in the order B, G, R from lowest to highest byte | 144 * stored in 4-byte pixels in the order B, G, R from lowest to highest byte |
| 144 * address within each pixel. | 145 * address within each pixel. The X component is ignored when compressing |
| 146 * and undefined when decompressing. |
| 145 */ | 147 */ |
| 146 TJPF_BGRX, | 148 TJPF_BGRX, |
| 147 /** | 149 /** |
| 148 * XBGR pixel format. The red, green, and blue components in the image are | 150 * XBGR pixel format. The red, green, and blue components in the image are |
| 149 * stored in 4-byte pixels in the order R, G, B from highest to lowest byte | 151 * stored in 4-byte pixels in the order R, G, B from highest to lowest byte |
| 150 * address within each pixel. | 152 * address within each pixel. The X component is ignored when compressing |
| 153 * and undefined when decompressing. |
| 151 */ | 154 */ |
| 152 TJPF_XBGR, | 155 TJPF_XBGR, |
| 153 /** | 156 /** |
| 154 * XRGB pixel format. The red, green, and blue components in the image are | 157 * XRGB pixel format. The red, green, and blue components in the image are |
| 155 * stored in 4-byte pixels in the order B, G, R from highest to lowest byte | 158 * stored in 4-byte pixels in the order B, G, R from highest to lowest byte |
| 156 * address within each pixel. | 159 * address within each pixel. The X component is ignored when compressing |
| 160 * and undefined when decompressing. |
| 157 */ | 161 */ |
| 158 TJPF_XRGB, | 162 TJPF_XRGB, |
| 159 /** | 163 /** |
| 160 * Grayscale pixel format. Each 1-byte pixel represents a luminance | 164 * Grayscale pixel format. Each 1-byte pixel represents a luminance |
| 161 * (brightness) level from 0 to 255. | 165 * (brightness) level from 0 to 255. |
| 162 */ | 166 */ |
| 163 TJPF_GRAY | 167 TJPF_GRAY, |
| 168 /** |
| 169 * RGBA pixel format. This is the same as @ref TJPF_RGBX, except that when |
| 170 * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 171 * interpreted as an opaque alpha channel. |
| 172 */ |
| 173 TJPF_RGBA, |
| 174 /** |
| 175 * BGRA pixel format. This is the same as @ref TJPF_BGRX, except that when |
| 176 * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 177 * interpreted as an opaque alpha channel. |
| 178 */ |
| 179 TJPF_BGRA, |
| 180 /** |
| 181 * ABGR pixel format. This is the same as @ref TJPF_XBGR, except that when |
| 182 * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 183 * interpreted as an opaque alpha channel. |
| 184 */ |
| 185 TJPF_ABGR, |
| 186 /** |
| 187 * ARGB pixel format. This is the same as @ref TJPF_XRGB, except that when |
| 188 * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 189 * interpreted as an opaque alpha channel. |
| 190 */ |
| 191 TJPF_ARGB |
| 164 }; | 192 }; |
| 165 | 193 |
| 166 /** | 194 /** |
| 167 * Red offset (in bytes) for a given pixel format. This specifies the number | 195 * Red offset (in bytes) for a given pixel format. This specifies the number |
| 168 * of bytes that the red component is offset from the start of the pixel. For | 196 * of bytes that the red component is offset from the start of the pixel. For |
| 169 * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>, | 197 * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>, |
| 170 * then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>. | 198 * then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>. |
| 171 */ | 199 */ |
| 172 static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0}; | 200 static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1}; |
| 173 /** | 201 /** |
| 174 * Green offset (in bytes) for a given pixel format. This specifies the number | 202 * Green offset (in bytes) for a given pixel format. This specifies the number |
| 175 * of bytes that the green component is offset from the start of the pixel. | 203 * of bytes that the green component is offset from the start of the pixel. |
| 176 * For instance, if a pixel of format TJ_BGRX is stored in | 204 * For instance, if a pixel of format TJ_BGRX is stored in |
| 177 * <tt>char pixel[]</tt>, then the green component will be | 205 * <tt>char pixel[]</tt>, then the green component will be |
| 178 * <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>. | 206 * <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>. |
| 179 */ | 207 */ |
| 180 static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0}; | 208 static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2}; |
| 181 /** | 209 /** |
| 182 * Blue offset (in bytes) for a given pixel format. This specifies the number | 210 * Blue offset (in bytes) for a given pixel format. This specifies the number |
| 183 * of bytes that the Blue component is offset from the start of the pixel. For | 211 * of bytes that the Blue component is offset from the start of the pixel. For |
| 184 * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>, | 212 * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>, |
| 185 * then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>. | 213 * then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>. |
| 186 */ | 214 */ |
| 187 static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0}; | 215 static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3}; |
| 188 | 216 |
| 189 /** | 217 /** |
| 190 * Pixel size (in bytes) for a given pixel format. | 218 * Pixel size (in bytes) for a given pixel format. |
| 191 */ | 219 */ |
| 192 static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1}; | 220 static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4}; |
| 193 | 221 |
| 194 | 222 |
| 195 /** | 223 /** |
| 196 * The uncompressed source/destination image is stored in bottom-up (Windows, | 224 * The uncompressed source/destination image is stored in bottom-up (Windows, |
| 197 * OpenGL) order, not top-down (X11) order. | 225 * OpenGL) order, not top-down (X11) order. |
| 198 */ | 226 */ |
| 199 #define TJFLAG_BOTTOMUP 2 | 227 #define TJFLAG_BOTTOMUP 2 |
| 200 /** | 228 /** |
| 201 * Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and | 229 * Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and |
| 202 * 32-bit libjpeg-turbo versions only.) | 230 * 32-bit libjpeg-turbo versions only.) |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the | 510 * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the |
| 483 * buffer for you, or | 511 * buffer for you, or |
| 484 * -# pre-allocate the buffer to a "worst case" size determined by | 512 * -# pre-allocate the buffer to a "worst case" size determined by |
| 485 * calling #tjBufSize(). This should ensure that the buffer never has | 513 * calling #tjBufSize(). This should ensure that the buffer never has |
| 486 * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) | 514 * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) |
| 487 * . | 515 * . |
| 488 * If you choose option 1, <tt>*jpegSize</tt> should be set to the | 516 * If you choose option 1, <tt>*jpegSize</tt> should be set to the |
| 489 * size of your pre-allocated buffer. In any case, unless you have | 517 * size of your pre-allocated buffer. In any case, unless you have |
| 490 * set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon | 518 * set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon |
| 491 * return from this function, as it may have changed. | 519 * return from this function, as it may have changed. |
| 492 * @param jpegSize pointer to an unsigned long variable which holds the size of | 520 * @param jpegSize pointer to an unsigned long variable that holds the size of |
| 493 * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a | 521 * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a |
| 494 * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the | 522 * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the |
| 495 * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the | 523 * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the |
| 496 * size of the JPEG image (in bytes.) | 524 * size of the JPEG image (in bytes.) |
| 497 * @param jpegSubsamp the level of chrominance subsampling to be used when | 525 * @param jpegSubsamp the level of chrominance subsampling to be used when |
| 498 * generating the JPEG image (see @ref TJSAMP | 526 * generating the JPEG image (see @ref TJSAMP |
| 499 * "Chrominance subsampling options".) | 527 * "Chrominance subsampling options".) |
| 500 * @param jpegQual the image quality of the generated JPEG image (1 = worst, | 528 * @param jpegQual the image quality of the generated JPEG image (1 = worst, |
| 501 100 = best) | 529 100 = best) |
| 502 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP | 530 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 * @param pitch bytes per line of the source image. Normally, this should be | 597 * @param pitch bytes per line of the source image. Normally, this should be |
| 570 * <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, | 598 * <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, |
| 571 * or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of | 599 * or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of |
| 572 * the image is padded to the nearest 32-bit boundary, as is the case | 600 * the image is padded to the nearest 32-bit boundary, as is the case |
| 573 * for Windows bitmaps. You can also be clever and use this parameter | 601 * for Windows bitmaps. You can also be clever and use this parameter |
| 574 * to skip lines, etc. Setting this parameter to 0 is the equivalent of | 602 * to skip lines, etc. Setting this parameter to 0 is the equivalent of |
| 575 * setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>. | 603 * setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>. |
| 576 * @param height height (in pixels) of the source image | 604 * @param height height (in pixels) of the source image |
| 577 * @param pixelFormat pixel format of the source image (see @ref TJPF | 605 * @param pixelFormat pixel format of the source image (see @ref TJPF |
| 578 * "Pixel formats".) | 606 * "Pixel formats".) |
| 579 * @param dstBuf pointer to an image buffer which will receive the YUV image. | 607 * @param dstBuf pointer to an image buffer that will receive the YUV image. |
| 580 * Use #tjBufSizeYUV() to determine the appropriate size for this buffer | 608 * Use #tjBufSizeYUV() to determine the appropriate size for this buffer |
| 581 * based on the image width, height, and level of chrominance | 609 * based on the image width, height, and level of chrominance |
| 582 * subsampling. | 610 * subsampling. |
| 583 * @param subsamp the level of chrominance subsampling to be used when | 611 * @param subsamp the level of chrominance subsampling to be used when |
| 584 * generating the YUV image (see @ref TJSAMP | 612 * generating the YUV image (see @ref TJSAMP |
| 585 * "Chrominance subsampling options".) | 613 * "Chrominance subsampling options".) |
| 586 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP | 614 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 587 * "flags". | 615 * "flags". |
| 588 * | 616 * |
| 589 * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) | 617 * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 601 */ | 629 */ |
| 602 DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); | 630 DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); |
| 603 | 631 |
| 604 | 632 |
| 605 /** | 633 /** |
| 606 * Retrieve information about a JPEG image without decompressing it. | 634 * Retrieve information about a JPEG image without decompressing it. |
| 607 * | 635 * |
| 608 * @param handle a handle to a TurboJPEG decompressor or transformer instance | 636 * @param handle a handle to a TurboJPEG decompressor or transformer instance |
| 609 * @param jpegBuf pointer to a buffer containing a JPEG image | 637 * @param jpegBuf pointer to a buffer containing a JPEG image |
| 610 * @param jpegSize size of the JPEG image (in bytes) | 638 * @param jpegSize size of the JPEG image (in bytes) |
| 611 * @param width pointer to an integer variable which will receive the width (in | 639 * @param width pointer to an integer variable that will receive the width (in |
| 612 * pixels) of the JPEG image | 640 * pixels) of the JPEG image |
| 613 * @param height pointer to an integer variable which will receive the height | 641 * @param height pointer to an integer variable that will receive the height |
| 614 * (in pixels) of the JPEG image | 642 * (in pixels) of the JPEG image |
| 615 * @param jpegSubsamp pointer to an integer variable which will receive the | 643 * @param jpegSubsamp pointer to an integer variable that will receive the |
| 616 * level of chrominance subsampling used when compressing the JPEG image | 644 * level of chrominance subsampling used when compressing the JPEG image |
| 617 * (see @ref TJSAMP "Chrominance subsampling options".) | 645 * (see @ref TJSAMP "Chrominance subsampling options".) |
| 618 * | 646 * |
| 619 * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) | 647 * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| 620 */ | 648 */ |
| 621 DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle, | 649 DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle, |
| 622 unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, | 650 unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, |
| 623 int *jpegSubsamp); | 651 int *jpegSubsamp); |
| 624 | 652 |
| 625 | 653 |
| 626 /** | 654 /** |
| 627 * Returns a list of fractional scaling factors that the JPEG decompressor in | 655 * Returns a list of fractional scaling factors that the JPEG decompressor in |
| 628 * this implementation of TurboJPEG supports. | 656 * this implementation of TurboJPEG supports. |
| 629 * | 657 * |
| 630 * @param numscalingfactors pointer to an integer variable that will receive | 658 * @param numscalingfactors pointer to an integer variable that will receive |
| 631 * the number of elements in the list | 659 * the number of elements in the list |
| 632 * | 660 * |
| 633 * @return a pointer to a list of fractional scaling factors, or NULL if an | 661 * @return a pointer to a list of fractional scaling factors, or NULL if an |
| 634 * error is encountered (see #tjGetErrorStr().) | 662 * error is encountered (see #tjGetErrorStr().) |
| 635 */ | 663 */ |
| 636 DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); | 664 DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); |
| 637 | 665 |
| 638 | 666 |
| 639 /** | 667 /** |
| 640 * Decompress a JPEG image to an RGB or grayscale image. | 668 * Decompress a JPEG image to an RGB or grayscale image. |
| 641 * | 669 * |
| 642 * @param handle a handle to a TurboJPEG decompressor or transformer instance | 670 * @param handle a handle to a TurboJPEG decompressor or transformer instance |
| 643 * @param jpegBuf pointer to a buffer containing the JPEG image to decompress | 671 * @param jpegBuf pointer to a buffer containing the JPEG image to decompress |
| 644 * @param jpegSize size of the JPEG image (in bytes) | 672 * @param jpegSize size of the JPEG image (in bytes) |
| 645 * @param dstBuf pointer to an image buffer which will receive the decompressed | 673 * @param dstBuf pointer to an image buffer that will receive the decompressed |
| 646 * image. This buffer should normally be <tt>pitch * scaledHeight</tt> | 674 * image. This buffer should normally be <tt>pitch * scaledHeight</tt> |
| 647 * bytes in size, where <tt>scaledHeight</tt> can be determined by | 675 * bytes in size, where <tt>scaledHeight</tt> can be determined by |
| 648 * calling #TJSCALED() with the JPEG image height and one of the scaling | 676 * calling #TJSCALED() with the JPEG image height and one of the scaling |
| 649 * factors returned by #tjGetScalingFactors(). The dstBuf pointer may | 677 * factors returned by #tjGetScalingFactors(). The dstBuf pointer may |
| 650 * also be used to decompress into a specific region of a larger buffer. | 678 * also be used to decompress into a specific region of a larger buffer. |
| 651 * @param width desired width (in pixels) of the destination image. If this is | 679 * @param width desired width (in pixels) of the destination image. If this is |
| 652 * smaller than the width of the JPEG image being decompressed, then | 680 * smaller than the width of the JPEG image being decompressed, then |
| 653 * TurboJPEG will use scaling in the JPEG decompressor to generate the | 681 * TurboJPEG will use scaling in the JPEG decompressor to generate the |
| 654 * largest possible image that will fit within the desired width. If | 682 * largest possible image that will fit within the desired width. If |
| 655 * width is set to 0, then only the height will be considered when | 683 * width is set to 0, then only the height will be considered when |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 * decompression but leaves out the color conversion step, so a planar YUV | 716 * decompression but leaves out the color conversion step, so a planar YUV |
| 689 * image is generated instead of an RGB image. The padding of the planes in | 717 * image is generated instead of an RGB image. The padding of the planes in |
| 690 * this image is the same as the images generated by #tjEncodeYUV2(). Note | 718 * this image is the same as the images generated by #tjEncodeYUV2(). Note |
| 691 * that, if the width or height of the image is not an even multiple of the MCU | 719 * that, if the width or height of the image is not an even multiple of the MCU |
| 692 * block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate buffer | 720 * block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate buffer |
| 693 * copy will be performed within TurboJPEG. | 721 * copy will be performed within TurboJPEG. |
| 694 * | 722 * |
| 695 * @param handle a handle to a TurboJPEG decompressor or transformer instance | 723 * @param handle a handle to a TurboJPEG decompressor or transformer instance |
| 696 * @param jpegBuf pointer to a buffer containing the JPEG image to decompress | 724 * @param jpegBuf pointer to a buffer containing the JPEG image to decompress |
| 697 * @param jpegSize size of the JPEG image (in bytes) | 725 * @param jpegSize size of the JPEG image (in bytes) |
| 698 * @param dstBuf pointer to an image buffer which will receive the YUV image. | 726 * @param dstBuf pointer to an image buffer that will receive the YUV image. |
| 699 * Use #tjBufSizeYUV to determine the appropriate size for this buffer | 727 * Use #tjBufSizeYUV to determine the appropriate size for this buffer |
| 700 * based on the image width, height, and level of subsampling. | 728 * based on the image width, height, and level of subsampling. |
| 701 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP | 729 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 702 * "flags". | 730 * "flags". |
| 703 * | 731 * |
| 704 * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) | 732 * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| 705 */ | 733 */ |
| 706 DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle, | 734 DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle, |
| 707 unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, | 735 unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, |
| 708 int flags); | 736 int flags); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 * buffer for you, or | 773 * buffer for you, or |
| 746 * -# pre-allocate the buffer to a "worst case" size determined by | 774 * -# pre-allocate the buffer to a "worst case" size determined by |
| 747 * calling #tjBufSize() with the cropped width and height. This should | 775 * calling #tjBufSize() with the cropped width and height. This should |
| 748 * ensure that the buffer never has to be re-allocated (setting | 776 * ensure that the buffer never has to be re-allocated (setting |
| 749 * #TJFLAG_NOREALLOC guarantees this.) | 777 * #TJFLAG_NOREALLOC guarantees this.) |
| 750 * . | 778 * . |
| 751 * If you choose option 1, <tt>dstSizes[i]</tt> should be set to | 779 * If you choose option 1, <tt>dstSizes[i]</tt> should be set to |
| 752 * the size of your pre-allocated buffer. In any case, unless you have | 780 * the size of your pre-allocated buffer. In any case, unless you have |
| 753 * set #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt> | 781 * set #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt> |
| 754 * upon return from this function, as it may have changed. | 782 * upon return from this function, as it may have changed. |
| 755 * @param dstSizes pointer to an array of n unsigned long variables which will | 783 * @param dstSizes pointer to an array of n unsigned long variables that will |
| 756 * receive the actual sizes (in bytes) of each transformed JPEG image. | 784 * receive the actual sizes (in bytes) of each transformed JPEG image. |
| 757 * If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then | 785 * If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then |
| 758 * <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon | 786 * <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon |
| 759 * return, <tt>dstSizes[i]</tt> will contain the size of the JPEG image | 787 * return, <tt>dstSizes[i]</tt> will contain the size of the JPEG image |
| 760 * (in bytes.) | 788 * (in bytes.) |
| 761 * @param transforms pointer to an array of n tjtransform structures, each of | 789 * @param transforms pointer to an array of n tjtransform structures, each of |
| 762 * which specifies the transform parameters and/or cropping region for | 790 * which specifies the transform parameters and/or cropping region for |
| 763 * the corresponding transformed output image. | 791 * the corresponding transformed output image. |
| 764 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP | 792 * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 765 * "flags". | 793 * "flags". |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 | 888 |
| 861 /** | 889 /** |
| 862 * @} | 890 * @} |
| 863 */ | 891 */ |
| 864 | 892 |
| 865 #ifdef __cplusplus | 893 #ifdef __cplusplus |
| 866 } | 894 } |
| 867 #endif | 895 #endif |
| 868 | 896 |
| 869 #endif | 897 #endif |
| OLD | NEW |