TurboJPEG: Add alpha offset array/method
Also, set the red/green/blue offsets for TJPF_GRAY to -1 rather than 0. It was undefined behavior for an application to use those arrays/methods with TJPF_GRAY anyhow, and this makes it easier for applications to programmatically detect whether a given pixel format has red, green, and blue components.
This commit is contained in:
10
ChangeLog.md
10
ChangeLog.md
@@ -110,6 +110,16 @@ TJBench, and they also provide a convenient way for first-time users of
|
|||||||
libjpeg-turbo to quickly develop a complete JPEG compression/decompression
|
libjpeg-turbo to quickly develop a complete JPEG compression/decompression
|
||||||
program.
|
program.
|
||||||
|
|
||||||
|
14. The TurboJPEG C API now includes a new convenience array
|
||||||
|
(`tjAlphaOffset[]`) that contains the alpha component index for each pixel
|
||||||
|
format (or -1 if the pixel format lacks an alpha component.) The TurboJPEG
|
||||||
|
Java API now includes a new method (`TJ.getAlphaOffset()`) that returns the
|
||||||
|
same value. In addition, the `tjRedOffset[]`, `tjGreenOffset[]`, and
|
||||||
|
`tjBlueOffset[]` arrays-- and the corresponding `TJ.getRedOffset()`,
|
||||||
|
`TJ.getGreenOffset()`, and `TJ.getBlueOffset()` methods-- now return -1 for
|
||||||
|
`TJPF_GRAY`/`TJ.PF_GRAY` rather than 0. This allows programs to easily
|
||||||
|
determine whether a pixel format has red, green, blue, and alpha components.
|
||||||
|
|
||||||
|
|
||||||
1.5.2
|
1.5.2
|
||||||
=====
|
=====
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ Variables</h2></td></tr>
|
|||||||
<tr class="memitem:ga84e2e35d3f08025f976ec1ec53693dea"><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
|
<tr class="memitem:ga84e2e35d3f08025f976ec1ec53693dea"><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
|
||||||
<tr class="memdesc:ga84e2e35d3f08025f976ec1ec53693dea"><td class="mdescLeft"> </td><td class="mdescRight">Blue offset (in bytes) for a given pixel format. <a href="#ga84e2e35d3f08025f976ec1ec53693dea">More...</a><br/></td></tr>
|
<tr class="memdesc:ga84e2e35d3f08025f976ec1ec53693dea"><td class="mdescLeft"> </td><td class="mdescRight">Blue offset (in bytes) for a given pixel format. <a href="#ga84e2e35d3f08025f976ec1ec53693dea">More...</a><br/></td></tr>
|
||||||
<tr class="separator:ga84e2e35d3f08025f976ec1ec53693dea"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:ga84e2e35d3f08025f976ec1ec53693dea"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
|
<tr class="memitem:ga5af0ab065feefd526debf1e20c43e837"><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837">tjAlphaOffset</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
|
||||||
|
<tr class="memdesc:ga5af0ab065feefd526debf1e20c43e837"><td class="mdescLeft"> </td><td class="mdescRight">Alpha offset (in bytes) for a given pixel format. <a href="#ga5af0ab065feefd526debf1e20c43e837">More...</a><br/></td></tr>
|
||||||
|
<tr class="separator:ga5af0ab065feefd526debf1e20c43e837"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
|
<tr class="memitem:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a> [<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td></tr>
|
||||||
<tr class="memdesc:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="mdescLeft"> </td><td class="mdescRight">Pixel size (in bytes) for a given pixel format. <a href="#gad77cf8fe5b2bfd3cb3f53098146abb4c">More...</a><br/></td></tr>
|
<tr class="memdesc:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="mdescLeft"> </td><td class="mdescRight">Pixel size (in bytes) for a given pixel format. <a href="#gad77cf8fe5b2bfd3cb3f53098146abb4c">More...</a><br/></td></tr>
|
||||||
<tr class="separator:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:gad77cf8fe5b2bfd3cb3f53098146abb4c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
@@ -2581,6 +2584,29 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="groupheader">Variable Documentation</h2>
|
<h2 class="groupheader">Variable Documentation</h2>
|
||||||
|
<a class="anchor" id="ga5af0ab065feefd526debf1e20c43e837"></a>
|
||||||
|
<div class="memitem">
|
||||||
|
<div class="memproto">
|
||||||
|
<table class="mlabels">
|
||||||
|
<tr>
|
||||||
|
<td class="mlabels-left">
|
||||||
|
<table class="memname">
|
||||||
|
<tr>
|
||||||
|
<td class="memname">const int tjAlphaOffset[<a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a>]</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td class="mlabels-right">
|
||||||
|
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div><div class="memdoc">
|
||||||
|
|
||||||
|
<p>Alpha offset (in bytes) for a given pixel format. </p>
|
||||||
|
<p>This specifies the number of bytes that the Alpha component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRA is stored in <code>char pixel[]</code>, then the alpha component will be <code>pixel[tjAlphaOffset[TJ_BGRA]]</code>. This will be -1 if the pixel format does not have an alpha component. </p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<a class="anchor" id="ga84e2e35d3f08025f976ec1ec53693dea"></a>
|
<a class="anchor" id="ga84e2e35d3f08025f976ec1ec53693dea"></a>
|
||||||
<div class="memitem">
|
<div class="memitem">
|
||||||
<div class="memproto">
|
<div class="memproto">
|
||||||
@@ -2600,7 +2626,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
|||||||
</div><div class="memdoc">
|
</div><div class="memdoc">
|
||||||
|
|
||||||
<p>Blue offset (in bytes) for a given pixel format. </p>
|
<p>Blue offset (in bytes) for a given pixel format. </p>
|
||||||
<p>This specifies the number of bytes that the Blue component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJ_BGRX]]</code>. </p>
|
<p>This specifies the number of bytes that the Blue component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a blue component. </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2623,7 +2649,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
|||||||
</div><div class="memdoc">
|
</div><div class="memdoc">
|
||||||
|
|
||||||
<p>Green offset (in bytes) for a given pixel format. </p>
|
<p>Green offset (in bytes) for a given pixel format. </p>
|
||||||
<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJ_BGRX]]</code>. </p>
|
<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a green component. </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2728,7 +2754,7 @@ If you choose option 1, <code>dstSizes[i]</code> should be set to the size of yo
|
|||||||
</div><div class="memdoc">
|
</div><div class="memdoc">
|
||||||
|
|
||||||
<p>Red offset (in bytes) for a given pixel format. </p>
|
<p>Red offset (in bytes) for a given pixel format. </p>
|
||||||
<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJ_BGRX]]</code>. </p>
|
<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a red component. </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ var searchData=
|
|||||||
['tj_5fnumsamp',['TJ_NUMSAMP',['../group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c',1,'turbojpeg.h']]],
|
['tj_5fnumsamp',['TJ_NUMSAMP',['../group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c',1,'turbojpeg.h']]],
|
||||||
['tj_5fnumxop',['TJ_NUMXOP',['../group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c',1,'turbojpeg.h']]],
|
['tj_5fnumxop',['TJ_NUMXOP',['../group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c',1,'turbojpeg.h']]],
|
||||||
['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff',1,'turbojpeg.h']]],
|
['tjalloc',['tjAlloc',['../group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff',1,'turbojpeg.h']]],
|
||||||
|
['tjalphaoffset',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||||
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||||
['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b',1,'turbojpeg.h']]],
|
['tjbufsize',['tjBufSize',['../group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b',1,'turbojpeg.h']]],
|
||||||
['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]],
|
['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]],
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
var searchData=
|
var searchData=
|
||||||
[
|
[
|
||||||
|
['tjalphaoffset',['tjAlphaOffset',['../group___turbo_j_p_e_g.html#ga5af0ab065feefd526debf1e20c43e837',1,'turbojpeg.h']]],
|
||||||
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
['tjblueoffset',['tjBlueOffset',['../group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea',1,'turbojpeg.h']]],
|
||||||
['tjgreenoffset',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
['tjgreenoffset',['tjGreenOffset',['../group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f',1,'turbojpeg.h']]],
|
||||||
['tjmcuheight',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
['tjmcuheight',['tjMCUHeight',['../group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf',1,'turbojpeg.h']]],
|
||||||
|
|||||||
@@ -64,10 +64,6 @@ public class TJUnitTest {
|
|||||||
"RGBA", "BGRA", "ABGR", "ARGB", "CMYK"
|
"RGBA", "BGRA", "ABGR", "ARGB", "CMYK"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final int[] alphaOffset = {
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
|
|
||||||
};
|
|
||||||
|
|
||||||
private static final int[] _3byteFormats = {
|
private static final int[] _3byteFormats = {
|
||||||
TJ.PF_RGB, TJ.PF_BGR
|
TJ.PF_RGB, TJ.PF_BGR
|
||||||
};
|
};
|
||||||
@@ -146,7 +142,7 @@ public class TJUnitTest {
|
|||||||
int roffset = TJ.getRedOffset(pf);
|
int roffset = TJ.getRedOffset(pf);
|
||||||
int goffset = TJ.getGreenOffset(pf);
|
int goffset = TJ.getGreenOffset(pf);
|
||||||
int boffset = TJ.getBlueOffset(pf);
|
int boffset = TJ.getBlueOffset(pf);
|
||||||
int aoffset = alphaOffset[pf];
|
int aoffset = TJ.getAlphaOffset(pf);
|
||||||
int ps = TJ.getPixelSize(pf);
|
int ps = TJ.getPixelSize(pf);
|
||||||
int index, row, col, halfway = 16;
|
int index, row, col, halfway = 16;
|
||||||
|
|
||||||
@@ -215,7 +211,7 @@ public class TJUnitTest {
|
|||||||
int rshift = TJ.getRedOffset(pf) * 8;
|
int rshift = TJ.getRedOffset(pf) * 8;
|
||||||
int gshift = TJ.getGreenOffset(pf) * 8;
|
int gshift = TJ.getGreenOffset(pf) * 8;
|
||||||
int bshift = TJ.getBlueOffset(pf) * 8;
|
int bshift = TJ.getBlueOffset(pf) * 8;
|
||||||
int ashift = alphaOffset[pf] * 8;
|
int ashift = TJ.getAlphaOffset(pf) * 8;
|
||||||
int index, row, col, halfway = 16;
|
int index, row, col, halfway = 16;
|
||||||
|
|
||||||
Arrays.fill(buf, 0);
|
Arrays.fill(buf, 0);
|
||||||
@@ -298,7 +294,7 @@ public class TJUnitTest {
|
|||||||
int roffset = TJ.getRedOffset(pf);
|
int roffset = TJ.getRedOffset(pf);
|
||||||
int goffset = TJ.getGreenOffset(pf);
|
int goffset = TJ.getGreenOffset(pf);
|
||||||
int boffset = TJ.getBlueOffset(pf);
|
int boffset = TJ.getBlueOffset(pf);
|
||||||
int aoffset = alphaOffset[pf];
|
int aoffset = TJ.getAlphaOffset(pf);
|
||||||
int ps = TJ.getPixelSize(pf);
|
int ps = TJ.getPixelSize(pf);
|
||||||
int index, row, col, retval = 1;
|
int index, row, col, retval = 1;
|
||||||
int halfway = 16 * sf.getNum() / sf.getDenom();
|
int halfway = 16 * sf.getNum() / sf.getDenom();
|
||||||
@@ -306,6 +302,9 @@ public class TJUnitTest {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if (pf == TJ.PF_GRAY)
|
||||||
|
roffset = goffset = boffset = 0;
|
||||||
|
|
||||||
if (pf == TJ.PF_CMYK) {
|
if (pf == TJ.PF_CMYK) {
|
||||||
for (row = 0; row < h; row++) {
|
for (row = 0; row < h; row++) {
|
||||||
for (col = 0; col < w; col++) {
|
for (col = 0; col < w; col++) {
|
||||||
@@ -422,7 +421,7 @@ public class TJUnitTest {
|
|||||||
int rshift = TJ.getRedOffset(pf) * 8;
|
int rshift = TJ.getRedOffset(pf) * 8;
|
||||||
int gshift = TJ.getGreenOffset(pf) * 8;
|
int gshift = TJ.getGreenOffset(pf) * 8;
|
||||||
int bshift = TJ.getBlueOffset(pf) * 8;
|
int bshift = TJ.getBlueOffset(pf) * 8;
|
||||||
int ashift = alphaOffset[pf] * 8;
|
int ashift = TJ.getAlphaOffset(pf) * 8;
|
||||||
int index, row, col, retval = 1;
|
int index, row, col, retval = 1;
|
||||||
int halfway = 16 * sf.getNum() / sf.getDenom();
|
int halfway = 16 * sf.getNum() / sf.getDenom();
|
||||||
int blockSize = 8 * sf.getNum() / sf.getDenom();
|
int blockSize = 8 * sf.getNum() / sf.getDenom();
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="Constant Field Values";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Constant Field Values";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="Deprecated List";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Deprecated List";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="API Help";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="API Help";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="Index";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Index";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
@@ -349,6 +353,11 @@
|
|||||||
</a>
|
</a>
|
||||||
<h2 class="title">G</h2>
|
<h2 class="title">G</h2>
|
||||||
<dl>
|
<dl>
|
||||||
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getAlphaOffset(int)">getAlphaOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="block">For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
component is offset from the start of the pixel.</div>
|
||||||
|
</dd>
|
||||||
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
<dt><span class="strong"><a href="./org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset(int)</a></span> - Static method in class org.libjpegturbo.turbojpeg.<a href="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
||||||
|
|||||||
@@ -4,11 +4,12 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Generated Documentation (Untitled)</title>
|
<title>Generated Documentation (Untitled)</title>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
targetPage = "" + window.location.search;
|
tmpTargetPage = "" + window.location.search;
|
||||||
if (targetPage != "" && targetPage != "undefined")
|
if (tmpTargetPage != "" && tmpTargetPage != "undefined")
|
||||||
targetPage = targetPage.substring(1);
|
tmpTargetPage = tmpTargetPage.substring(1);
|
||||||
if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage)))
|
if (tmpTargetPage.indexOf(":") != -1 || (tmpTargetPage != "" && !validURL(tmpTargetPage)))
|
||||||
targetPage = "undefined";
|
tmpTargetPage = "undefined";
|
||||||
|
targetPage = tmpTargetPage;
|
||||||
function validURL(url) {
|
function validURL(url) {
|
||||||
try {
|
try {
|
||||||
url = decodeURIComponent(url);
|
url = decodeURIComponent(url);
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJ";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
@@ -417,53 +421,60 @@ extends java.lang.Object</pre>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getAlphaOffset(int)">getAlphaOffset</a></strong>(int pixelFormat)</code>
|
||||||
|
<div class="block">For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
component is offset from the start of the pixel.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
<div class="block">For the given pixel format, returns the number of bytes that the blue
|
||||||
component is offset from the start of the pixel.</div>
|
component is offset from the start of the pixel.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the green
|
<div class="block">For the given pixel format, returns the number of bytes that the green
|
||||||
component is offset from the start of the pixel.</div>
|
component is offset from the start of the pixel.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)">getMCUHeight</a></strong>(int subsamp)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)">getMCUHeight</a></strong>(int subsamp)</code>
|
||||||
<div class="block">Returns the MCU block height for the given level of chrominance
|
<div class="block">Returns the MCU block height for the given level of chrominance
|
||||||
subsampling.</div>
|
subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)">getMCUWidth</a></strong>(int subsamp)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)">getMCUWidth</a></strong>(int subsamp)</code>
|
||||||
<div class="block">Returns the MCU block width for the given level of chrominance
|
<div class="block">Returns the MCU block width for the given level of chrominance
|
||||||
subsampling.</div>
|
subsampling.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
|
<div class="block">Returns the pixel size (in bytes) for the given pixel format.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</a></strong>(int pixelFormat)</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</a></strong>(int pixelFormat)</code>
|
||||||
<div class="block">For the given pixel format, returns the number of bytes that the red
|
<div class="block">For the given pixel format, returns the number of bytes that the red
|
||||||
component is offset from the start of the pixel.</div>
|
component is offset from the start of the pixel.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[]</code></td>
|
<td class="colFirst"><code>static <a href="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>[]</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</a></strong>()</code>
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</a></strong>()</code>
|
||||||
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
<div class="block">Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||||
this implementation of TurboJPEG supports.</div>
|
this implementation of TurboJPEG supports.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeHeight(int,%20int,%20int)">planeHeight</a></strong>(int componentID,
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeHeight(int,%20int,%20int)">planeHeight</a></strong>(int componentID,
|
||||||
int height,
|
int height,
|
||||||
@@ -471,7 +482,7 @@ extends java.lang.Object</pre>
|
|||||||
<div class="block">Returns the plane height of a YUV image plane with the given parameters.</div>
|
<div class="block">Returns the plane height of a YUV image plane with the given parameters.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rowColor">
|
<tr class="altColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)">planeSizeYUV</a></strong>(int componentID,
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeSizeYUV(int,%20int,%20int,%20int,%20int)">planeSizeYUV</a></strong>(int componentID,
|
||||||
int width,
|
int width,
|
||||||
@@ -482,7 +493,7 @@ extends java.lang.Object</pre>
|
|||||||
plane with the given parameters.</div>
|
plane with the given parameters.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="altColor">
|
<tr class="rowColor">
|
||||||
<td class="colFirst"><code>static int</code></td>
|
<td class="colFirst"><code>static int</code></td>
|
||||||
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeWidth(int,%20int,%20int)">planeWidth</a></strong>(int componentID,
|
<td class="colLast"><code><strong><a href="../../../org/libjpegturbo/turbojpeg/TJ.html#planeWidth(int,%20int,%20int)">planeWidth</a></strong>(int componentID,
|
||||||
int width,
|
int width,
|
||||||
@@ -1137,7 +1148,8 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
then the red component will be
|
then the red component will be
|
||||||
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
|
<code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format.</dd></dl>
|
<dt><span class="strong">Returns:</span></dt><dd>the red offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a red component.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="getGreenOffset(int)">
|
<a name="getGreenOffset(int)">
|
||||||
@@ -1153,7 +1165,8 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
then the green component will be
|
then the green component will be
|
||||||
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
|
<code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format.</dd></dl>
|
<dt><span class="strong">Returns:</span></dt><dd>the green offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a green component.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="getBlueOffset(int)">
|
<a name="getBlueOffset(int)">
|
||||||
@@ -1169,7 +1182,25 @@ public static final int FLAG_FORCESSE3</pre>
|
|||||||
then the blue component will be
|
then the blue component will be
|
||||||
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
|
<code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.</div>
|
||||||
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format.</dd></dl>
|
<dt><span class="strong">Returns:</span></dt><dd>the blue offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a blue component.</dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getAlphaOffset(int)">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getAlphaOffset</h4>
|
||||||
|
<pre>public static int getAlphaOffset(int pixelFormat)</pre>
|
||||||
|
<div class="block">For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
component is offset from the start of the pixel. For instance, if a pixel
|
||||||
|
of format <code>TJ.PF_BGRA</code> is stored in <code>char pixel[]</code>,
|
||||||
|
then the alpha component will be
|
||||||
|
<code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.</div>
|
||||||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pixelFormat</code> - the pixel format (one of <code>PF_*</code>)</dd>
|
||||||
|
<dt><span class="strong">Returns:</span></dt><dd>the alpha offset for the given pixel format, or -1 if the pixel
|
||||||
|
format does not have a alpha component.</dd></dl>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="bufSize(int, int, int)">
|
<a name="bufSize(int, int, int)">
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJCompressor";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJCompressor";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJCustomFilter";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJCustomFilter";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJDecompressor";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJDecompressor";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJException";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJException";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJScalingFactor";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJScalingFactor";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJTransform";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJTransform";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="TJTransformer";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TJTransformer";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="YUVImage";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="YUVImage";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="org.libjpegturbo.turbojpeg";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="org.libjpegturbo.turbojpeg";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="org.libjpegturbo.turbojpeg Class Hierarchy";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="org.libjpegturbo.turbojpeg Class Hierarchy";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="Class Hierarchy";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Class Hierarchy";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
if (location.href.indexOf('is-external=true') == -1) {
|
try {
|
||||||
parent.document.title="Serialized Form";
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Serialized Form";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -235,7 +235,8 @@ public final class TJ {
|
|||||||
*
|
*
|
||||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
*
|
*
|
||||||
* @return the red offset for the given pixel format.
|
* @return the red offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a red component.
|
||||||
*/
|
*/
|
||||||
public static int getRedOffset(int pixelFormat) {
|
public static int getRedOffset(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
@@ -243,7 +244,7 @@ public final class TJ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] redOffset = {
|
private static final int[] redOffset = {
|
||||||
0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1, -1
|
0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -256,7 +257,8 @@ public final class TJ {
|
|||||||
*
|
*
|
||||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
*
|
*
|
||||||
* @return the green offset for the given pixel format.
|
* @return the green offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a green component.
|
||||||
*/
|
*/
|
||||||
public static int getGreenOffset(int pixelFormat) {
|
public static int getGreenOffset(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
@@ -264,7 +266,7 @@ public final class TJ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] greenOffset = {
|
private static final int[] greenOffset = {
|
||||||
1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2, -1
|
1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -277,7 +279,8 @@ public final class TJ {
|
|||||||
*
|
*
|
||||||
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
*
|
*
|
||||||
* @return the blue offset for the given pixel format.
|
* @return the blue offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a blue component.
|
||||||
*/
|
*/
|
||||||
public static int getBlueOffset(int pixelFormat) {
|
public static int getBlueOffset(int pixelFormat) {
|
||||||
checkPixelFormat(pixelFormat);
|
checkPixelFormat(pixelFormat);
|
||||||
@@ -285,7 +288,29 @@ public final class TJ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] blueOffset = {
|
private static final int[] blueOffset = {
|
||||||
2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3, -1
|
2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the given pixel format, returns the number of bytes that the alpha
|
||||||
|
* component is offset from the start of the pixel. For instance, if a pixel
|
||||||
|
* of format <code>TJ.PF_BGRA</code> is stored in <code>char pixel[]</code>,
|
||||||
|
* then the alpha component will be
|
||||||
|
* <code>pixel[TJ.getAlphaOffset(TJ.PF_BGRA)]</code>.
|
||||||
|
*
|
||||||
|
* @param pixelFormat the pixel format (one of <code>PF_*</code>)
|
||||||
|
*
|
||||||
|
* @return the alpha offset for the given pixel format, or -1 if the pixel
|
||||||
|
* format does not have a alpha component.
|
||||||
|
*/
|
||||||
|
public static int getAlphaOffset(int pixelFormat) {
|
||||||
|
checkPixelFormat(pixelFormat);
|
||||||
|
return alphaOffset[pixelFormat];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int[] alphaOffset = {
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ const char *pixFormatStr[TJ_NUMPF]=
|
|||||||
"RGBA", "BGRA", "ABGR", "ARGB", "CMYK"
|
"RGBA", "BGRA", "ABGR", "ARGB", "CMYK"
|
||||||
};
|
};
|
||||||
|
|
||||||
const int alphaOffset[TJ_NUMPF] = {-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1};
|
|
||||||
|
|
||||||
const int _3byteFormats[]={TJPF_RGB, TJPF_BGR};
|
const int _3byteFormats[]={TJPF_RGB, TJPF_BGR};
|
||||||
const int _4byteFormats[]={TJPF_RGBX, TJPF_BGRX, TJPF_XBGR, TJPF_XRGB,
|
const int _4byteFormats[]={TJPF_RGBX, TJPF_BGRX, TJPF_XBGR, TJPF_XRGB,
|
||||||
TJPF_CMYK};
|
TJPF_CMYK};
|
||||||
@@ -196,12 +194,14 @@ int checkBuf(unsigned char *buf, int w, int h, int pf, int subsamp,
|
|||||||
int roffset=tjRedOffset[pf];
|
int roffset=tjRedOffset[pf];
|
||||||
int goffset=tjGreenOffset[pf];
|
int goffset=tjGreenOffset[pf];
|
||||||
int boffset=tjBlueOffset[pf];
|
int boffset=tjBlueOffset[pf];
|
||||||
int aoffset=alphaOffset[pf];
|
int aoffset=tjAlphaOffset[pf];
|
||||||
int ps=tjPixelSize[pf];
|
int ps=tjPixelSize[pf];
|
||||||
int index, row, col, retval=1;
|
int index, row, col, retval=1;
|
||||||
int halfway=16*sf.num/sf.denom;
|
int halfway=16*sf.num/sf.denom;
|
||||||
int blocksize=8*sf.num/sf.denom;
|
int blocksize=8*sf.num/sf.denom;
|
||||||
|
|
||||||
|
if(pf==TJPF_GRAY) roffset=goffset=boffset=0;
|
||||||
|
|
||||||
if(pf==TJPF_CMYK)
|
if(pf==TJPF_CMYK)
|
||||||
{
|
{
|
||||||
for(row=0; row<h; row++)
|
for(row=0; row<h; row++)
|
||||||
@@ -738,7 +738,7 @@ int cmpBitmap(unsigned char *buf, int width, int pitch, int height, int pf,
|
|||||||
int roffset=tjRedOffset[pf];
|
int roffset=tjRedOffset[pf];
|
||||||
int goffset=tjGreenOffset[pf];
|
int goffset=tjGreenOffset[pf];
|
||||||
int boffset=tjBlueOffset[pf];
|
int boffset=tjBlueOffset[pf];
|
||||||
int aoffset=alphaOffset[pf];
|
int aoffset=tjAlphaOffset[pf];
|
||||||
int ps=tjPixelSize[pf];
|
int ps=tjPixelSize[pf];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
|||||||
39
turbojpeg.h
39
turbojpeg.h
@@ -256,33 +256,54 @@ enum TJPF
|
|||||||
TJPF_UNKNOWN = -1
|
TJPF_UNKNOWN = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Red offset (in bytes) for a given pixel format. This specifies the number
|
* Red offset (in bytes) for a given pixel format. This specifies the number
|
||||||
* of bytes that the red component is offset from the start of the pixel. For
|
* of bytes that the red component is offset from the start of the pixel. For
|
||||||
* instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
|
* instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
|
||||||
* then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>.
|
* then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>. This
|
||||||
|
* will be -1 if the pixel format does not have a red component.
|
||||||
*/
|
*/
|
||||||
static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1, -1};
|
static const int tjRedOffset[TJ_NUMPF] = {
|
||||||
|
0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Green offset (in bytes) for a given pixel format. This specifies the number
|
* Green offset (in bytes) for a given pixel format. This specifies the number
|
||||||
* of bytes that the green component is offset from the start of the pixel.
|
* of bytes that the green component is offset from the start of the pixel.
|
||||||
* For instance, if a pixel of format TJ_BGRX is stored in
|
* For instance, if a pixel of format TJ_BGRX is stored in
|
||||||
* <tt>char pixel[]</tt>, then the green component will be
|
* <tt>char pixel[]</tt>, then the green component will be
|
||||||
* <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>.
|
* <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>. This will be -1 if the pixel format
|
||||||
|
* does not have a green component.
|
||||||
*/
|
*/
|
||||||
static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2, -1};
|
static const int tjGreenOffset[TJ_NUMPF] = {
|
||||||
|
1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Blue offset (in bytes) for a given pixel format. This specifies the number
|
* Blue offset (in bytes) for a given pixel format. This specifies the number
|
||||||
* of bytes that the Blue component is offset from the start of the pixel. For
|
* of bytes that the Blue component is offset from the start of the pixel. For
|
||||||
* instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
|
* instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
|
||||||
* then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>.
|
* then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>. This
|
||||||
|
* will be -1 if the pixel format does not have a blue component.
|
||||||
*/
|
*/
|
||||||
static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3, -1};
|
static const int tjBlueOffset[TJ_NUMPF] = {
|
||||||
|
2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Pixel size (in bytes) for a given pixel format.
|
* Alpha offset (in bytes) for a given pixel format. This specifies the number
|
||||||
|
* of bytes that the Alpha component is offset from the start of the pixel.
|
||||||
|
* For instance, if a pixel of format TJ_BGRA is stored in
|
||||||
|
* <tt>char pixel[]</tt>, then the alpha component will be
|
||||||
|
* <tt>pixel[tjAlphaOffset[TJ_BGRA]]</tt>. This will be -1 if the pixel format
|
||||||
|
* does not have an alpha component.
|
||||||
*/
|
*/
|
||||||
static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4};
|
static const int tjAlphaOffset[TJ_NUMPF] = {
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Pixel size (in bytes) for a given pixel format
|
||||||
|
*/
|
||||||
|
static const int tjPixelSize[TJ_NUMPF] = {
|
||||||
|
3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user