Add CMYK support to the TurboJPEG Java API & clean up a few things in the C API

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1020 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2013-08-23 04:45:43 +00:00
parent cd7c3e6672
commit 38cb1ec2a7
18 changed files with 497 additions and 73 deletions

View File

@@ -115,6 +115,46 @@ TurboJPEG utility class (cannot be instantiated)
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_CMYK">CS_CMYK</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMYK colorspace.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_GRAY">CS_GRAY</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Grayscale colorspace.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_RGB">CS_RGB</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RGB colorspace.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCbCr">CS_YCbCr</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YCbCr colorspace.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK">CS_YCCK</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YCCK colorspace.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_ACCURATEDCT">FLAG_ACCURATEDCT</A></B></CODE>
<BR>
@@ -187,6 +227,14 @@ TurboJPEG utility class (cannot be instantiated)
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMCS">NUMCS</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The number of JPEG colorspaces</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</A></B></CODE>
<BR>
@@ -243,6 +291,14 @@ TurboJPEG utility class (cannot be instantiated)
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMYK pixel format.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</A></B></CODE>
<BR>
@@ -746,6 +802,130 @@ public static final int <B>PF_ARGB</B></PRE>
</DL>
<HR>
<A NAME="PF_CMYK"><!-- --></A><H3>
PF_CMYK</H3>
<PRE>
public static final int <B>PF_CMYK</B></PRE>
<DL>
<DD>CMYK pixel format. Unlike RGB, which is a display colorspace,
CMYK (Cyan/Magenta/Yellow/Key) is a print colorspace in which the
value of each color component corresponds to the amount of cyan, magenta,
yellow, or black ink that is applied to a white background. In order to
convert between CMYK and RGB, it is necessary to use a color management
system (CMS.) A CMS will attempt to map colors within the printer's gamut
to perceptually similar colors in the display's gamut and vice versa, but
the mapping is typically not 1:1 or reversible, nor can it be defined with
a simple formula. Thus, such a conversion is out of scope for a codec
library. However, the TurboJPEG API allows for compressing CMYK pixels
into a YCCK JPEG image (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#CS_YCCK"><CODE>CS_YCCK</CODE></A>) and decompressing YCCK JPEG
images into CMYK pixels.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_CMYK">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="NUMCS"><!-- --></A><H3>
NUMCS</H3>
<PRE>
public static final int <B>NUMCS</B></PRE>
<DL>
<DD>The number of JPEG colorspaces
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.NUMCS">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="CS_RGB"><!-- --></A><H3>
CS_RGB</H3>
<PRE>
public static final int <B>CS_RGB</B></PRE>
<DL>
<DD>RGB colorspace. When compressing the JPEG image, the R, G, and B
components in the source image are reordered into image planes, but no
colorspace conversion or subsampling is performed. RGB JPEG images can be
decompressed to any of the extended RGB pixel formats or grayscale, but
they cannot be decompressed to YUV images.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_RGB">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="CS_YCbCr"><!-- --></A><H3>
CS_YCbCr</H3>
<PRE>
public static final int <B>CS_YCbCr</B></PRE>
<DL>
<DD>YCbCr colorspace. YCbCr is not an absolute colorspace but rather a
mathematical transformation of RGB designed solely for storage and
transmission. YCbCr images must be converted to RGB before they can
actually be displayed. In the YCbCr colorspace, the Y (luminance)
component represents the black & white portion of the original image, and
the Cb and Cr (chrominance) components represent the color portion of the
original image. Originally, the analog equivalent of this transformation
allowed the same signal to drive both black & white and color televisions,
but JPEG images use YCbCr primarily because it allows the color data to be
optionally subsampled for the purposes of reducing bandwidth or disk
space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images
can be compressed from and decompressed to any of the extended RGB pixel
formats or grayscale, or they can be decompressed to YUV planar images.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_YCbCr">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="CS_GRAY"><!-- --></A><H3>
CS_GRAY</H3>
<PRE>
public static final int <B>CS_GRAY</B></PRE>
<DL>
<DD>Grayscale colorspace. The JPEG image retains only the luminance data (Y
component), and any color data from the source image is discarded.
Grayscale JPEG images can be compressed from and decompressed to any of
the extended RGB pixel formats or grayscale, or they can be decompressed
to YUV planar images.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_GRAY">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="CS_CMYK"><!-- --></A><H3>
CS_CMYK</H3>
<PRE>
public static final int <B>CS_CMYK</B></PRE>
<DL>
<DD>CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K
components in the source image are reordered into image planes, but no
colorspace conversion or subsampling is performed. CMYK JPEG images can
only be decompressed to CMYK pixels.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_CMYK">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="CS_YCCK"><!-- --></A><H3>
CS_YCCK</H3>
<PRE>
public static final int <B>CS_YCCK</B></PRE>
<DL>
<DD>YCCK colorspace. YCCK (AKA "YCbCrK") is not an absolute colorspace but
rather a mathematical transformation of CMYK designed solely for storage
and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be
reversibly transformed into YCCK, and as with YCbCr, the chrominance
components in the YCCK pixels can be subsampled without incurring major
perceptual loss. YCCK JPEG images can only be compressed from and
decompressed to CMYK pixels.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.CS_YCCK">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="FLAG_BOTTOMUP"><!-- --></A><H3>
FLAG_BOTTOMUP</H3>
<PRE>

View File

@@ -420,8 +420,8 @@ public void <B>setSourceImage</B>(byte[]&nbsp;srcImage,
<DD>Associate an uncompressed source image with this compressor instance.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing RGB or grayscale pixels to be
compressed<DD><CODE>x</CODE> - x offset (in pixels) of the region from which the JPEG image
<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing RGB, grayscale, or CMYK pixels to
be compressed<DD><CODE>x</CODE> - x offset (in pixels) of the region from which the JPEG image
should be compressed, relative to the start of <code>srcImage</code>.<DD><CODE>y</CODE> - y offset (in pixels) of the region from which the JPEG image
should be compressed, relative to the start of <code>srcImage</code>.<DD><CODE>width</CODE> - width (in pixels) of the region in the source image from
which the JPEG image should be compressed.<DD><CODE>pitch</CODE> - bytes per line of the source image. Normally, this should be

View File

@@ -122,7 +122,7 @@ Custom filter callback interface
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A callback function that can be used to modify the DCT coefficients after
they are losslessly transformed but before they are transcoded to a new
JPEG file.</TD>
JPEG image.</TD>
</TR>
</TABLE>
&nbsp;
@@ -151,7 +151,7 @@ void <B>customFilter</B>(java.nio.ShortBuffer&nbsp;coeffBuffer,
<DL>
<DD>A callback function that can be used to modify the DCT coefficients after
they are losslessly transformed but before they are transcoded to a new
JPEG file. This allows for custom filters or other transformations to be
JPEG image. This allows for custom filters or other transformations to be
applied in the frequency domain.
<P>
<DD><DL>

View File

@@ -136,6 +136,14 @@ TurboJPEG decompressor
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
@@ -504,6 +512,16 @@ protected int <B>jpegSubsamp</B></PRE>
<DL>
</DL>
</DL>
<HR>
<A NAME="jpegColorspace"><!-- --></A><H3>
jpegColorspace</H3>
<PRE>
protected int <B>jpegColorspace</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->

View File

@@ -120,7 +120,7 @@ TurboJPEG lossless transformer
<TH ALIGN="left"><B>Fields inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</A></CODE></TD>
<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegColorspace">jpegColorspace</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</A></CODE></TD>
</TR>
</TABLE>
&nbsp;