From 6d9591703feeefa76c0e313258997f178d0a1973 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 5 Sep 2024 21:57:16 -0400 Subject: [PATCH] Minor TurboJPEG doc tweaks - When transforming, the worst-case JPEG buffer size depends on the subsampling level used in the destination image, since a grayscale transform might have been applied. - Parentheses Police --- doc/html/group___turbo_j_p_e_g.html | 2 +- java/doc/member-search-index.zip | Bin 1951 -> 1951 bytes .../turbojpeg/TJDecompressor.html | 2 +- .../libjpegturbo/turbojpeg/TJTransformer.html | 2 +- java/doc/package-search-index.zip | Bin 237 -> 237 bytes java/doc/type-search-index.zip | Bin 311 -> 311 bytes .../turbojpeg/TJDecompressor.java | 2 +- .../libjpegturbo/turbojpeg/TJTransformer.java | 2 +- turbojpeg.h | 14 +++++++------- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index eea39969..75321f91 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -3173,7 +3173,7 @@ If you choose option 1, then *jpegSize should be set to the size of dstBufspointer to an array of n byte buffers. dstBufs[i] will receive a JPEG image that has been transformed using the parameters in transforms[i]. TurboJPEG has the ability to reallocate the JPEG destination buffer to accommodate the size of the transformed JPEG image. Thus, you can choose to:
  1. pre-allocate the JPEG destination buffer with an arbitrary size using tj3Alloc() and let TurboJPEG grow the buffer as needed,
  2. set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer for you, or
  3. -
  4. pre-allocate the buffer to a "worst case" size determined by calling tj3JPEGBufSize() with the transformed or cropped width and height and the level of subsampling used in the source image. Under normal circumstances, this should ensure that the buffer never has to be re-allocated. (Setting TJPARAM_NOREALLOC guarantees that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded Exif or ICC profile data) in which the transformed JPEG image will be larger than the worst-case size, and TJPARAM_NOREALLOC cannot be used in those cases.
  5. +
  6. pre-allocate the buffer to a "worst case" size determined by calling tj3JPEGBufSize() with the transformed or cropped width and height and the level of subsampling used in the destination image. Under normal circumstances, this should ensure that the buffer never has to be re-allocated. (Setting TJPARAM_NOREALLOC guarantees that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded Exif or ICC profile data) in which the transformed JPEG image will be larger than the worst-case size, and TJPARAM_NOREALLOC cannot be used in those cases.
If you choose option 1, then dstSizes[i] should be set to the size of your pre-allocated buffer. In any case, unless you have set TJPARAM_NOREALLOC, you should always check dstBufs[i] upon return from this function, as it may have changed. dstSizespointer to an array of n size_t variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If dstBufs[i] points to a pre-allocated buffer, then dstSizes[i] should be set to the size of the buffer. Upon return, dstSizes[i] will contain the size of the transformed JPEG image (in bytes.) diff --git a/java/doc/member-search-index.zip b/java/doc/member-search-index.zip index 98e815694a8cb43cd07f07177abd4e2f5da332f3..a67ea75cd420e0344b54be3f0a3d0aab51ee3bdf 100644 GIT binary patch delta 30 kcmbQwKcAmBz?+#xgn@&DgW=I;)s4JP?94!VauB;O0B-CD?*IS* delta 30 kcmbQwKcAmBz?+#xgn@&DgQ2`jc_XhAJ2Q};9K`Mm0AgYW!vFvP diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html index 96edfecc..7a66c201 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html @@ -869,7 +869,7 @@ implements java.io.Closeable subsampling in the JPEG image (see TJ.PARAM_SUBSAMP.) The cropping region should be specified relative to the scaled image dimensions. Unless croppingRegion is TJ.UNCROPPED, - the JPEG header must be read (see setSourceImage(byte[], int) + the JPEG header must be read (see setSourceImage(byte[], int)) prior to calling this method.
Throws:
TJException
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html index 440d153c..b767e6de 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html @@ -379,7 +379,7 @@ extends TJ.bufSize() to determine the maximum size for each buffer based on the transformed or cropped width and height and the level - of subsampling used in the source image. + of subsampling used in the destination image.
transforms - an array of TJTransform instances, each of which specifies the transform parameters and/or cropping region for the corresponding transformed JPEG image
diff --git a/java/doc/package-search-index.zip b/java/doc/package-search-index.zip index 02afb3a352bdf42da80fb786b4cf0e2823be9488..3b023f2025418cbe1a5410782f3ded45efaa53f1 100644 GIT binary patch delta 28 hcmaFM_?D43z?+#xgn@&DgW=I;)rq|Q%phvM9{_Q32-*Mu delta 28 hcmaFM_?D43z?+#xgn@&DgQ2`jc_ME=Gl-h+2LNWO2d)4B diff --git a/java/doc/type-search-index.zip b/java/doc/type-search-index.zip index 43b6eb73cb51263689c4b1cc4620ba1f0dbe2029..381ebb0c03461e0bb19d012ed43d78afdb150ab6 100644 GIT binary patch delta 28 hcmdnaw4I4Jz?+#xgn@&DgW=I;)rq`!m_gJVZvbgQ2?qcG delta 28 hcmdnaw4I4Jz?+#xgn@&DgQ2`jc_Qx}W)Stp8vtH;2ipJu diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java index 23da0321..58a6d9bc 100644 --- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java @@ -263,7 +263,7 @@ public class TJDecompressor implements Closeable { * subsampling in the JPEG image (see {@link TJ#PARAM_SUBSAMP}.) The * cropping region should be specified relative to the scaled image * dimensions. Unless croppingRegion is {@link TJ#UNCROPPED}, - * the JPEG header must be read (see {@link #setSourceImage(byte[], int)} + * the JPEG header must be read (see {@link #setSourceImage(byte[], int)}) * prior to calling this method. */ @SuppressWarnings("checkstyle:HiddenField") diff --git a/java/org/libjpegturbo/turbojpeg/TJTransformer.java b/java/org/libjpegturbo/turbojpeg/TJTransformer.java index 4d46b5a1..84bf3dfc 100644 --- a/java/org/libjpegturbo/turbojpeg/TJTransformer.java +++ b/java/org/libjpegturbo/turbojpeg/TJTransformer.java @@ -89,7 +89,7 @@ public class TJTransformer extends TJDecompressor { * transformed using the parameters in transforms[i]. Use * {@link TJ#bufSize TJ.bufSize()} to determine the maximum size for each * buffer based on the transformed or cropped width and height and the level - * of subsampling used in the source image. + * of subsampling used in the destination image. * * @param transforms an array of {@link TJTransform} instances, each of * which specifies the transform parameters and/or cropping region for the diff --git a/turbojpeg.h b/turbojpeg.h index e9de751f..934e4b05 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -2065,13 +2065,13 @@ DLLEXPORT int tj3DecodeYUV8(tjhandle handle, const unsigned char *srcBuf, * you, or * -# pre-allocate the buffer to a "worst case" size determined by calling * #tj3JPEGBufSize() with the transformed or cropped width and height and the - * level of subsampling used in the source image. Under normal circumstances, - * this should ensure that the buffer never has to be re-allocated. (Setting - * #TJPARAM_NOREALLOC guarantees that it won't be.) Note, however, that there - * are some rare cases (such as transforming images with a large amount of - * embedded Exif or ICC profile data) in which the transformed JPEG image will - * be larger than the worst-case size, and #TJPARAM_NOREALLOC cannot be used in - * those cases. + * level of subsampling used in the destination image. Under normal + * circumstances, this should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * Note, however, that there are some rare cases (such as transforming images + * with a large amount of embedded Exif or ICC profile data) in which the + * transformed JPEG image will be larger than the worst-case size, and + * #TJPARAM_NOREALLOC cannot be used in those cases. * . * If you choose option 1, then `dstSizes[i]` should be set to the size of your * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC,