TurboJPEG: Numerous documentation improvements
- Wordsmithing, formatting, and grammar tweaks
- Various clarifications and corrections, including specifying whether
a particular buffer or image is used as a source or destination
- Accommodate/mention features that were introduced since the API
documentation was created.
- For clarity, use "packed-pixel" to describe uncompressed
source/destination images that are not planar YUV.
- Use "row" rather than "line" to refer to a single horizontal group of
pixels or component values, for consistency with the libjpeg API
documentation. (libjpeg also uses "scanline", which is a more archaic
term.)
- Use "alignment" rather than "padding" to refer to the number of bytes
by which a row's width is evenly divisible. This consistifies the
documention of the YUV functions and tjLoadImage(). ("Padding"
typically refers to the number of bytes added to each row, which is
not the same thing.)
- Remove all references to "the underlying codec." Although the
TurboJPEG API originated as a cross-platform wrapper for the Intel
Integrated Performance Primitives, Sun mediaLib, QuickTime, and
libjpeg, none of those TurboJPEG implementations has been maintained
since 2009. Nothing would prevent someone from implementing the
TurboJPEG API without libjpeg-turbo, but such an implementation would
not necessarily have an "underlying codec." (It could be fully
self-contained.)
- Use "destination image" rather than "output image", for consistency,
or describe the type of image that will be output.
- Avoid the term "image buffer" and instead use "byte buffer" to
refer to buffers that will hold JPEG images, or describe the type of
image that will be contained in the buffer. (The Java documentation
doesn't use "byte buffer", because the buffer arrays literally have
"byte" in front of them, and since Java doesn't have pointers, it is
not possible for mere mortals to store any other type of data in those
arrays.)
- C: Use "unified" to describe YUV images stored in a single buffer, for
consistency with the Java documentation.
- Use "planar YUV" rather than "YUV planar". Is is our convention to
describe images using {component layout} {colorspace/pixel format}
{image function}, e.g. "packed-pixel RGB source image" or "planar YUV
destination image."
- C: Document the TurboJPEG API version in which a particular function
or macro was introduced, and reorder the backward compatibility
function stubs in turbojpeg.h alphabetically by API version.
- C: Use Markdown rather than HTML tags, where possible, in the Doxygen
comments.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011, 2013-2015 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2013-2015, 2023 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,10 +43,12 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
* image stored in <code>jpegImage</code> with the newly created instance.
|
||||
* source image stored in <code>jpegImage</code> with the newly created
|
||||
* instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
|
||||
* be the length of the array.) This buffer is not modified.
|
||||
* @param jpegImage buffer containing the JPEG source image to transform.
|
||||
* (The size of the JPEG image is assumed to be the length of the array.)
|
||||
* This buffer is not modified.
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage) throws TJException {
|
||||
init();
|
||||
@@ -55,12 +57,13 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG lossless transformer instance and associate the JPEG
|
||||
* image of length <code>imageSize</code> bytes stored in
|
||||
* source image of length <code>imageSize</code> bytes stored in
|
||||
* <code>jpegImage</code> with the newly created instance.
|
||||
*
|
||||
* @param jpegImage JPEG image buffer. This buffer is not modified.
|
||||
* @param jpegImage buffer containing the JPEG source image to transform.
|
||||
* This buffer is not modified.
|
||||
*
|
||||
* @param imageSize size of the JPEG image (in bytes)
|
||||
* @param imageSize size of the JPEG source image (in bytes)
|
||||
*/
|
||||
public TJTransformer(byte[] jpegImage, int imageSize) throws TJException {
|
||||
init();
|
||||
@@ -68,28 +71,29 @@ public class TJTransformer extends TJDecompressor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Losslessly transform the JPEG image associated with this transformer
|
||||
* instance into one or more JPEG images stored in the given destination
|
||||
* buffers. Lossless transforms work by moving the raw coefficients from one
|
||||
* JPEG image structure to another without altering the values of the
|
||||
* coefficients. While this is typically faster than decompressing the
|
||||
* image, transforming it, and re-compressing it, lossless transforms are not
|
||||
* free. Each lossless transform requires reading and performing Huffman
|
||||
* decoding on all of the coefficients in the source image, regardless of the
|
||||
* size of the destination image. Thus, this method provides a means of
|
||||
* generating multiple transformed images from the same source or of applying
|
||||
* multiple transformations simultaneously, in order to eliminate the need to
|
||||
* read the source coefficients multiple times.
|
||||
* Losslessly transform the JPEG source image associated with this
|
||||
* transformer instance into one or more JPEG images stored in the given
|
||||
* destination buffers. Lossless transforms work by moving the raw
|
||||
* coefficients from one JPEG image structure to another without altering the
|
||||
* values of the coefficients. While this is typically faster than
|
||||
* decompressing the image, transforming it, and re-compressing it, lossless
|
||||
* transforms are not free. Each lossless transform requires reading and
|
||||
* performing Huffman decoding on all of the coefficients in the source
|
||||
* image, regardless of the size of the destination image. Thus, this method
|
||||
* provides a means of generating multiple transformed images from the same
|
||||
* source or of applying multiple transformations simultaneously, in order to
|
||||
* eliminate the need to read the source coefficients multiple times.
|
||||
*
|
||||
* @param dstBufs an array of image buffers. <code>dstbufs[i]</code> will
|
||||
* receive a JPEG image that has been transformed using the parameters in
|
||||
* <code>transforms[i]</code>. Use {@link 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.
|
||||
* @param dstBufs an array of JPEG destination buffers.
|
||||
* <code>dstbufs[i]</code> will receive a JPEG image that has been
|
||||
* transformed using the parameters in <code>transforms[i]</code>. Use
|
||||
* {@link 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.
|
||||
*
|
||||
* @param transforms an array of {@link TJTransform} instances, each of
|
||||
* which specifies the transform parameters and/or cropping region for the
|
||||
* corresponding transformed output image
|
||||
* corresponding transformed JPEG image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -103,13 +107,13 @@ public class TJTransformer extends TJDecompressor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Losslessly transform the JPEG image associated with this transformer
|
||||
* instance and return an array of {@link TJDecompressor} instances, each of
|
||||
* which has a transformed JPEG image associated with it.
|
||||
* Losslessly transform the JPEG source image associated with this
|
||||
* transformer instance and return an array of {@link TJDecompressor}
|
||||
* instances, each of which has a transformed JPEG image associated with it.
|
||||
*
|
||||
* @param transforms an array of {@link TJTransform} instances, each of
|
||||
* which specifies the transform parameters and/or cropping region for the
|
||||
* corresponding transformed output image
|
||||
* corresponding transformed JPEG image
|
||||
*
|
||||
* @param flags the bitwise OR of one or more of
|
||||
* {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
|
||||
@@ -139,10 +143,10 @@ public class TJTransformer extends TJDecompressor {
|
||||
|
||||
/**
|
||||
* Returns an array containing the sizes of the transformed JPEG images
|
||||
* generated by the most recent transform operation.
|
||||
* (in bytes) generated by the most recent transform operation.
|
||||
*
|
||||
* @return an array containing the sizes of the transformed JPEG images
|
||||
* generated by the most recent transform operation.
|
||||
* (in bytes) generated by the most recent transform operation.
|
||||
*/
|
||||
public int[] getTransformedSizes() {
|
||||
if (transformedSizes == null)
|
||||
|
||||
Reference in New Issue
Block a user