зеркало из https://github.com/mozilla/mozjpeg.git
Per the conventions of the image compression and digital video communities, use "YCbCr" to describe the JPEG colorspace and "YUV" to describe an image format consisting of Y, Cb, and Cr planes (this partially reverts r959.)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1091 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
Родитель
7ebf2941a9
Коммит
5a7e9e5baa
|
@ -684,7 +684,8 @@ Variables</h2></td></tr>
|
|||
</div><div class="memdoc">
|
||||
|
||||
<p>Chrominance subsampling options. </p>
|
||||
<p>When an image is converted from the RGB to the YUV colorspace as part of the JPEG compression process, some of the U and V (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) This is called "chrominance subsampling". </p>
|
||||
<p>When an image is converted from the RGB to the YCbCr colorspace as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) This is called "chrominance subsampling". </p>
|
||||
<p>NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes. </p>
|
||||
<table class="fieldtable">
|
||||
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3"></a>TJSAMP_444</em> </td><td class="fielddoc">
|
||||
<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
|
||||
|
@ -1169,7 +1170,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
|||
</div><div class="memdoc">
|
||||
|
||||
<p>Decompress a JPEG image to a YUV planar image. </p>
|
||||
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The padding of the planes in this image is the same as in the images generated by <a class="el" href="group___turbo_j_p_e_g.html#ga0fa4e7b1943687c6a0c0304529c55d35" title="Encode an RGB or grayscale image into a YUV planar image.">tjEncodeYUV2()</a>. Note that, if the width or height of the image is not an even multiple of the MCU block size (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</p>
|
||||
<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The padding of the planes in this image is the same as in the images generated by <a class="el" href="group___turbo_j_p_e_g.html#ga0fa4e7b1943687c6a0c0304529c55d35" title="Encode an RGB or grayscale image into a YUV planar image.">tjEncodeYUV2()</a>. Note that, if the width or height of the image is not an even multiple of the MCU block size (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG. </p>
|
||||
<p>NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance </td></tr>
|
||||
|
@ -1276,7 +1278,8 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
|||
</div><div class="memdoc">
|
||||
|
||||
<p>Encode an RGB or grayscale image into a YUV planar image. </p>
|
||||
<p>This function uses the accelerated color conversion routines in TurboJPEG's underlying codec to produce a planar YUV image that is suitable for X Video. Specifically, if the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to the nearest multiple of 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.) Also, each line of each plane in the output image is padded to 4 bytes. Although this will work with any subsampling option, it is really only useful in combination with TJ_420, which produces an image compatible with the I420 (AKA "YUV420P") format.</p>
|
||||
<p>This function uses the accelerated color conversion routines in TurboJPEG's underlying codec to produce a planar YUV image that is suitable for X Video. Specifically, if the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to the nearest multiple of 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.) Also, each line of each plane in the output image is padded to 4 bytes. Although this will work with any subsampling option, it is really only useful in combination with TJ_420, which produces an image compatible with the I420 (AKA "YUV420P") format. </p>
|
||||
<p>NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance </td></tr>
|
||||
|
|
|
@ -9,8 +9,42 @@ Generated Documentation (Untitled)
|
|||
targetPage = "" + window.location.search;
|
||||
if (targetPage != "" && targetPage != "undefined")
|
||||
targetPage = targetPage.substring(1);
|
||||
if (targetPage.indexOf(":") != -1)
|
||||
if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage)))
|
||||
targetPage = "undefined";
|
||||
function validURL(url) {
|
||||
var pos = url.indexOf(".html");
|
||||
if (pos == -1 || pos != url.length - 5)
|
||||
return false;
|
||||
var allowNumber = false;
|
||||
var allowSep = false;
|
||||
var seenDot = false;
|
||||
for (var i = 0; i < url.length - 5; i++) {
|
||||
var ch = url.charAt(i);
|
||||
if ('a' <= ch && ch <= 'z' ||
|
||||
'A' <= ch && ch <= 'Z' ||
|
||||
ch == '$' ||
|
||||
ch == '_') {
|
||||
allowNumber = true;
|
||||
allowSep = true;
|
||||
} else if ('0' <= ch && ch <= '9'
|
||||
|| ch == '-') {
|
||||
if (!allowNumber)
|
||||
return false;
|
||||
} else if (ch == '/' || ch == '.') {
|
||||
if (!allowSep)
|
||||
return false;
|
||||
allowNumber = false;
|
||||
allowSep = false;
|
||||
if (ch == '.')
|
||||
seenDot = true;
|
||||
if (ch == '/' && seenDot)
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function loadFrames() {
|
||||
if (targetPage != "" && targetPage != "undefined")
|
||||
top.classFrame.location = top.targetPage;
|
||||
|
|
|
@ -590,6 +590,10 @@ public void <B>encodeYUV</B>(byte[] dstBuf,
|
|||
Although this will work with any subsampling option, it is really only
|
||||
useful in combination with <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420"><CODE>TJ.SAMP_420</CODE></A>, which produces an image
|
||||
compatible with the I420 (AKA "YUV420P") format.
|
||||
<p>
|
||||
NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the YUV planar image. Use
|
||||
|
|
|
@ -841,6 +841,10 @@ public void <B>decompressToYUV</B>(byte[] dstBuf,
|
|||
that, if the width or height of the image is not an even multiple of the
|
||||
MCU block size (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><CODE>TJ.getMCUWidth(int)</CODE></A> and <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><CODE>TJ.getMCUHeight(int)</CODE></A>),
|
||||
then an intermediate buffer copy will be performed within TurboJPEG.
|
||||
<p>
|
||||
NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
<P>
|
||||
<DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer that will receive the YUV planar image. Use
|
||||
|
|
|
@ -344,6 +344,10 @@ public class TJCompressor {
|
|||
* Although this will work with any subsampling option, it is really only
|
||||
* useful in combination with {@link TJ#SAMP_420}, which produces an image
|
||||
* compatible with the I420 (AKA "YUV420P") format.
|
||||
* <p>
|
||||
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
* convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
* refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
*
|
||||
* @param dstBuf buffer that will receive the YUV planar image. Use
|
||||
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
|
||||
|
|
|
@ -368,6 +368,10 @@ public class TJDecompressor {
|
|||
* that, if the width or height of the image is not an even multiple of the
|
||||
* MCU block size (see {@link TJ#getMCUWidth} and {@link TJ#getMCUHeight}),
|
||||
* then an intermediate buffer copy will be performed within TurboJPEG.
|
||||
* <p>
|
||||
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
* convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
* refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
*
|
||||
* @param dstBuf buffer that will receive the YUV planar image. Use
|
||||
* {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
|
||||
|
|
16
turbojpeg.h
16
turbojpeg.h
|
@ -53,12 +53,16 @@
|
|||
|
||||
/**
|
||||
* Chrominance subsampling options.
|
||||
* When an image is converted from the RGB to the YUV colorspace as part of
|
||||
* the JPEG compression process, some of the U and V (chrominance) components
|
||||
* When an image is converted from the RGB to the YCbCr colorspace as part of
|
||||
* the JPEG compression process, some of the Cb and Cr (chrominance) components
|
||||
* can be discarded or averaged together to produce a smaller image with little
|
||||
* perceptible loss of image clarity (the human eye is more sensitive to small
|
||||
* changes in brightness than small changes in color.) This is called
|
||||
* "chrominance subsampling".
|
||||
* <p>
|
||||
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
* convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
* refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
*/
|
||||
enum TJSAMP
|
||||
{
|
||||
|
@ -611,6 +615,10 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV(int width, int height,
|
|||
* padded to 4 bytes. Although this will work with any subsampling option, it
|
||||
* is really only useful in combination with TJ_420, which produces an image
|
||||
* compatible with the I420 (AKA "YUV420P") format.
|
||||
* <p>
|
||||
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
* convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
* refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
*
|
||||
* @param handle a handle to a TurboJPEG compressor or transformer instance
|
||||
* @param srcBuf pointer to an image buffer containing RGB or grayscale pixels
|
||||
|
@ -742,6 +750,10 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
|
|||
* that, if the width or height of the image is not an even multiple of the MCU
|
||||
* block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate buffer
|
||||
* copy will be performed within TurboJPEG.
|
||||
* <p>
|
||||
* NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the
|
||||
* convention of the digital video community, the TurboJPEG API uses "YUV" to
|
||||
* refer to an image format consisting of Y, Cb, and Cr image planes.
|
||||
*
|
||||
* @param handle a handle to a TurboJPEG decompressor or transformer instance
|
||||
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
|
||||
|
|
Загрузка…
Ссылка в новой задаче