Improve code formatting consistency

With rare exceptions ...
- Always separate line continuation characters by one space from
  preceding code.
- Always use two-space indentation.  Never use tabs.
- Always use K&R-style conditional blocks.
- Always surround operators with spaces, except in raw assembly code.
- Always put a space after, but not before, a comma.
- Never put a space between type casts and variables/function calls.
- Never put a space between the function name and the argument list in
  function declarations and prototypes.
- Always surround braces ('{' and '}') with spaces.
- Always surround statements (if, for, else, catch, while, do, switch)
  with spaces.
- Always attach pointer symbols ('*' and '**') to the variable or
  function name.
- Always precede pointer symbols ('*' and '**') by a space in type
  casts.
- Use the MIN() macro from jpegint.h within the libjpeg and TurboJPEG
  API libraries (using min() from tjutil.h is still necessary for
  TJBench.)
- Where it makes sense (particularly in the TurboJPEG code), put a blank
  line after variable declaration blocks.
- Always separate statements in one-liners by two spaces.

The purpose of this was to ease maintenance on my part and also to make
it easier for contributors to figure out how to format patch
submissions.  This was admittedly confusing (even to me sometimes) when
we had 3 or 4 different style conventions in the same source tree.  The
new convention is more consistent with the formatting of other OSS code
bases.

This commit corrects deviations from the chosen formatting style in the
libjpeg API code and reformats the TurboJPEG API code such that it
conforms to the same standard.

NOTES:
- Although it is no longer necessary for the function name in function
  declarations to begin in Column 1 (this was historically necessary
  because of the ansi2knr utility, which allowed libjpeg to be built
  with non-ANSI compilers), we retain that formatting for the libjpeg
  code because it improves readability when using libjpeg's function
  attribute macros (GLOBAL(), etc.)
- This reformatting project was accomplished with the help of AStyle and
  Uncrustify, although neither was completely up to the task, and thus
  a great deal of manual tweaking was required.  Note to developers of
  code formatting utilities:  the libjpeg-turbo code base is an
  excellent test bed, because AFAICT, it breaks every single one of the
  utilities that are currently available.
- The legacy (MMX, SSE, 3DNow!) assembly code for i386 has been
  formatted to match the SSE2 code (refer to
  ff5685d5344273df321eb63a005eaae19d2496e3.)  I hadn't intended to
  bother with this, but the Loongson MMI implementation demonstrated
  that there is still academic value to the MMX implementation, as an
  algorithmic model for other 64-bit vector implementations.  Thus, it
  is desirable to improve its readability in the same manner as that of
  the SSE2 implementation.
This commit is contained in:
DRC
2018-03-08 10:55:20 -06:00
parent 4508ab3e51
commit 19c791cdac
264 changed files with 28939 additions and 29177 deletions

View File

@@ -32,7 +32,8 @@ progress_monitor (j_common_ptr cinfo)
{ {
cd_progress_ptr prog = (cd_progress_ptr)cinfo->progress; cd_progress_ptr prog = (cd_progress_ptr)cinfo->progress;
int total_passes = prog->pub.total_passes + prog->total_extra_passes; int total_passes = prog->pub.total_passes + prog->total_extra_passes;
int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); int percent_done =
(int)(prog->pub.pass_counter * 100L / prog->pub.pass_limit);
if (percent_done != prog->percent_done) { if (percent_done != prog->percent_done) {
prog->percent_done = percent_done; prog->percent_done = percent_done;

View File

@@ -98,8 +98,7 @@ typedef struct cdjpeg_progress_mgr *cd_progress_ptr;
EXTERN(cjpeg_source_ptr) jinit_read_bmp(j_compress_ptr cinfo, EXTERN(cjpeg_source_ptr) jinit_read_bmp(j_compress_ptr cinfo,
boolean use_inversion_array); boolean use_inversion_array);
EXTERN(djpeg_dest_ptr) jinit_write_bmp (j_decompress_ptr cinfo, EXTERN(djpeg_dest_ptr) jinit_write_bmp(j_decompress_ptr cinfo, boolean is_os2,
boolean is_os2,
boolean use_inversion_array); boolean use_inversion_array);
EXTERN(cjpeg_source_ptr) jinit_read_gif(j_compress_ptr cinfo); EXTERN(cjpeg_source_ptr) jinit_read_gif(j_compress_ptr cinfo);
EXTERN(djpeg_dest_ptr) jinit_write_gif(j_decompress_ptr cinfo); EXTERN(djpeg_dest_ptr) jinit_write_gif(j_decompress_ptr cinfo);

View File

@@ -307,7 +307,8 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
PACKAGE_NAME, VERSION, BUILD); PACKAGE_NAME, VERSION, BUILD);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { } else if (keymatch(arg, "grayscale", 2) ||
keymatch(arg, "greyscale", 2)) {
/* Force a monochrome JPEG file to be generated. */ /* Force a monochrome JPEG file to be generated. */
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);

15
cmyk.h
View File

@@ -1,7 +1,7 @@
/* /*
* cmyk.h * cmyk.h
* *
* Copyright (C) 2017, D. R. Commander. * Copyright (C) 2017-2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -11,16 +11,13 @@
* system. * system.
*/ */
#include <jpeglib.h>
#include "jconfigint.h"
#ifndef CMYK_H #ifndef CMYK_H
#define CMYK_H #define CMYK_H
#include <jinclude.h>
#ifndef min #define JPEG_INTERNALS
#define min(a, b) ((a) < (b) ? (a) : (b)) #include <jpeglib.h>
#endif #include "jconfigint.h"
/* Fully reversible */ /* Fully reversible */
@@ -33,7 +30,7 @@ rgb_to_cmyk(JSAMPLE r, JSAMPLE g, JSAMPLE b, JSAMPLE *c, JSAMPLE *m,
double ctmp = 1.0 - ((double)r / 255.0); double ctmp = 1.0 - ((double)r / 255.0);
double mtmp = 1.0 - ((double)g / 255.0); double mtmp = 1.0 - ((double)g / 255.0);
double ytmp = 1.0 - ((double)b / 255.0); double ytmp = 1.0 - ((double)b / 255.0);
double ktmp = min(min(ctmp, mtmp), ytmp); double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0; if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
else { else {

View File

@@ -298,7 +298,8 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
/* GIF output format. */ /* GIF output format. */
requested_fmt = FMT_GIF; requested_fmt = FMT_GIF;
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { } else if (keymatch(arg, "grayscale", 2) ||
keymatch(arg, "greyscale", 2)) {
/* Force monochrome output. */ /* Force monochrome output. */
cinfo->out_color_space = JCS_GRAYSCALE; cinfo->out_color_space = JCS_GRAYSCALE;

View File

@@ -29,7 +29,8 @@
* implementation (jbig_tab.c). * implementation (jbig_tab.c).
*/ */
#define V(i,a,b,c,d) (((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b) #define V(i, a, b, c, d) \
(((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b)
const JLONG jpeg_aritab[113 + 1] = { const JLONG jpeg_aritab[113 + 1] = {
/* /*

View File

@@ -34,7 +34,7 @@ import org.libjpegturbo.turbojpeg.*;
class TJBench { class TJBench {
static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1; static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvPad = 1;
static boolean compOnly, decompOnly, doTile, doYUV, write = true; static boolean compOnly, decompOnly, doTile, doYUV, write = true;
static final String[] pixFormatStr = { static final String[] pixFormatStr = {
@@ -96,6 +96,7 @@ class TJBench {
static String sigFig(double val, int figs) { static String sigFig(double val, int figs) {
String format; String format;
int digitsAfterDecimal = figs - (int)Math.ceil(Math.log10(Math.abs(val))); int digitsAfterDecimal = figs - (int)Math.ceil(Math.log10(Math.abs(val)));
if (digitsAfterDecimal < 1) if (digitsAfterDecimal < 1)
format = new String("%.0f"); format = new String("%.0f");
else else
@@ -107,10 +108,12 @@ class TJBench {
static byte[] loadImage(String fileName, int[] w, int[] h, int pixelFormat) static byte[] loadImage(String fileName, int[] w, int[] h, int pixelFormat)
throws Exception { throws Exception {
BufferedImage img = ImageIO.read(new File(fileName)); BufferedImage img = ImageIO.read(new File(fileName));
if (img == null) if (img == null)
throw new Exception("Could not read " + fileName); throw new Exception("Could not read " + fileName);
w[0] = img.getWidth(); w[0] = img.getWidth();
h[0] = img.getHeight(); h[0] = img.getHeight();
int[] rgb = img.getRGB(0, 0, w[0], h[0], null, 0, w[0]); int[] rgb = img.getRGB(0, 0, w[0], h[0], null, 0, w[0]);
int ps = TJ.getPixelSize(pixelFormat); int ps = TJ.getPixelSize(pixelFormat);
int rindex = TJ.getRedOffset(pixelFormat); int rindex = TJ.getRedOffset(pixelFormat);
@@ -118,6 +121,7 @@ class TJBench {
int bindex = TJ.getBlueOffset(pixelFormat); int bindex = TJ.getBlueOffset(pixelFormat);
byte[] dstBuf = new byte[w[0] * h[0] * ps]; byte[] dstBuf = new byte[w[0] * h[0] * ps];
int pixels = w[0] * h[0], dstPtr = 0, rgbPtr = 0; int pixels = w[0] * h[0], dstPtr = 0, rgbPtr = 0;
while (pixels-- > 0) { while (pixels-- > 0) {
dstBuf[dstPtr + rindex] = (byte)((rgb[rgbPtr] >> 16) & 0xff); dstBuf[dstPtr + rindex] = (byte)((rgb[rgbPtr] >> 16) & 0xff);
dstBuf[dstPtr + gindex] = (byte)((rgb[rgbPtr] >> 8) & 0xff); dstBuf[dstPtr + gindex] = (byte)((rgb[rgbPtr] >> 8) & 0xff);
@@ -137,11 +141,13 @@ class TJBench {
int rindex = TJ.getRedOffset(pixelFormat); int rindex = TJ.getRedOffset(pixelFormat);
int gindex = TJ.getGreenOffset(pixelFormat); int gindex = TJ.getGreenOffset(pixelFormat);
int bindex = TJ.getBlueOffset(pixelFormat); int bindex = TJ.getBlueOffset(pixelFormat);
for (int y = 0; y < h; y++) { for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++, srcPtr += ps) { for (int x = 0; x < w; x++, srcPtr += ps) {
int pixel = (srcBuf[srcPtr + rindex] & 0xff) << 16 | int pixel = (srcBuf[srcPtr + rindex] & 0xff) << 16 |
(srcBuf[srcPtr + gindex] & 0xff) << 8 | (srcBuf[srcPtr + gindex] & 0xff) << 8 |
(srcBuf[srcPtr + bindex] & 0xff); (srcBuf[srcPtr + bindex] & 0xff);
img.setRGB(x, y, pixel); img.setRGB(x, y, pixel);
} }
} }
@@ -177,7 +183,8 @@ class TJBench {
if (doYUV) { if (doYUV) {
int width = doTile ? tilew : scaledw; int width = doTile ? tilew : scaledw;
int height = doTile ? tileh : scaledh; int height = doTile ? tileh : scaledh;
yuvImage = new YUVImage(width, yuvpad, height, subsamp);
yuvImage = new YUVImage(width, yuvPad, height, subsamp);
Arrays.fill(yuvImage.getBuf(), (byte)127); Arrays.fill(yuvImage.getBuf(), (byte)127);
} }
@@ -187,13 +194,15 @@ class TJBench {
while (true) { while (true) {
int tile = 0; int tile = 0;
double start = getTime(); double start = getTime();
for (int y = 0; y < h; y += tileh) { for (int y = 0; y < h; y += tileh) {
for (int x = 0; x < w; x += tilew, tile++) { for (int x = 0; x < w; x += tilew, tile++) {
int width = doTile ? Math.min(tilew, w - x) : scaledw; int width = doTile ? Math.min(tilew, w - x) : scaledw;
int height = doTile ? Math.min(tileh, h - y) : scaledh; int height = doTile ? Math.min(tileh, h - y) : scaledh;
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]); tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
if (doYUV) { if (doYUV) {
yuvImage.setBuf(yuvImage.getBuf(), width, yuvpad, height, subsamp); yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height, subsamp);
try { try {
tjd.decompressToYUV(yuvImage, flags); tjd.decompressToYUV(yuvImage, flags);
} catch (TJException e) { handleTJException(e); } } catch (TJException e) { handleTJException(e); }
@@ -232,11 +241,13 @@ class TJBench {
if (quiet != 0) { if (quiet != 0) {
System.out.format("%-6s%s", System.out.format("%-6s%s",
sigFig((double)(w * h) / 1000000. * (double)iter / elapsed, 4), sigFig((double)(w * h) / 1000000. *
(double)iter / elapsed, 4),
quiet == 2 ? "\n" : " "); quiet == 2 ? "\n" : " ");
if (doYUV) if (doYUV)
System.out.format("%s\n", System.out.format("%s\n",
sigFig((double)(w * h) / 1000000. * (double)iter / elapsedDecode, 4)); sigFig((double)(w * h) / 1000000. *
(double)iter / elapsedDecode, 4));
else if (quiet != 2) else if (quiet != 2)
System.out.print("\n"); System.out.print("\n");
} else { } else {
@@ -249,7 +260,8 @@ class TJBench {
System.out.format("YUV Decode --> Frame rate: %f fps\n", System.out.format("YUV Decode --> Frame rate: %f fps\n",
(double)iter / elapsedDecode); (double)iter / elapsedDecode);
System.out.format(" Throughput: %f Megapixels/sec\n", System.out.format(" Throughput: %f Megapixels/sec\n",
(double)(w * h) / 1000000. * (double)iter / elapsedDecode); (double)(w * h) / 1000000. *
(double)iter / elapsedDecode);
} }
} }
@@ -282,6 +294,7 @@ class TJBench {
int lum = (int)((double)(srcBuf[rindex] & 0xff) * 0.299 + int lum = (int)((double)(srcBuf[rindex] & 0xff) * 0.299 +
(double)(srcBuf[gindex] & 0xff) * 0.587 + (double)(srcBuf[gindex] & 0xff) * 0.587 +
(double)(srcBuf[bindex] & 0xff) * 0.114 + 0.5); (double)(srcBuf[bindex] & 0xff) * 0.114 + 0.5);
if (lum > 255) lum = 255; if (lum > 255) lum = 255;
if (lum < 0) lum = 0; if (lum < 0) lum = 0;
dstBuf[rindex] = (byte)Math.abs((dstBuf[rindex] & 0xff) - lum); dstBuf[rindex] = (byte)Math.abs((dstBuf[rindex] & 0xff) - lum);
@@ -318,7 +331,8 @@ class TJBench {
if (quiet == 0) if (quiet == 0)
System.out.format(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", pfStr, System.out.format(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", pfStr,
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down", (flags & TJ.FLAG_BOTTOMUP) != 0 ?
"Bottom-up" : "Top-down",
subNameLong[subsamp], jpegQual); subNameLong[subsamp], jpegQual);
tjc = new TJCompressor(); tjc = new TJCompressor();
@@ -346,7 +360,7 @@ class TJBench {
tjc.setSubsamp(subsamp); tjc.setSubsamp(subsamp);
if (doYUV) { if (doYUV) {
yuvImage = new YUVImage(tilew, yuvpad, tileh, subsamp); yuvImage = new YUVImage(tilew, yuvPad, tileh, subsamp);
Arrays.fill(yuvImage.getBuf(), (byte)127); Arrays.fill(yuvImage.getBuf(), (byte)127);
} }
@@ -355,16 +369,19 @@ class TJBench {
elapsed = elapsedEncode = 0.0; elapsed = elapsedEncode = 0.0;
while (true) { while (true) {
int tile = 0; int tile = 0;
totalJpegSize = 0; totalJpegSize = 0;
start = getTime(); start = getTime();
for (int y = 0; y < h; y += tileh) { for (int y = 0; y < h; y += tileh) {
for (int x = 0; x < w; x += tilew, tile++) { for (int x = 0; x < w; x += tilew, tile++) {
int width = Math.min(tilew, w - x); int width = Math.min(tilew, w - x);
int height = Math.min(tileh, h - y); int height = Math.min(tileh, h - y);
tjc.setSourceImage(srcBuf, x, y, width, pitch, height, pf); tjc.setSourceImage(srcBuf, x, y, width, pitch, height, pf);
if (doYUV) { if (doYUV) {
double startEncode = getTime(); double startEncode = getTime();
yuvImage.setBuf(yuvImage.getBuf(), width, yuvpad, height,
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height,
subsamp); subsamp);
tjc.encodeYUV(yuvImage, flags); tjc.encodeYUV(yuvImage, flags);
if (iter >= 0) if (iter >= 0)
@@ -394,13 +411,16 @@ class TJBench {
if (quiet != 0) { if (quiet != 0) {
if (doYUV) if (doYUV)
System.out.format("%-6s%s", System.out.format("%-6s%s",
sigFig((double)(w * h) / 1000000. * (double)iter / elapsedEncode, 4), sigFig((double)(w * h) / 1000000. *
(double)iter / elapsedEncode, 4),
quiet == 2 ? "\n" : " "); quiet == 2 ? "\n" : " ");
System.out.format("%-6s%s", System.out.format("%-6s%s",
sigFig((double)(w * h) / 1000000. * (double)iter / elapsed, 4), sigFig((double)(w * h) / 1000000. *
(double)iter / elapsed, 4),
quiet == 2 ? "\n" : " "); quiet == 2 ? "\n" : " ");
System.out.format("%-6s%s", System.out.format("%-6s%s",
sigFig((double)(w * h * ps) / (double)totalJpegSize, 4), sigFig((double)(w * h * ps) / (double)totalJpegSize,
4),
quiet == 2 ? "\n" : " "); quiet == 2 ? "\n" : " ");
} else { } else {
System.out.format("\n%s size: %d x %d\n", doTile ? "Tile" : "Image", System.out.format("\n%s size: %d x %d\n", doTile ? "Tile" : "Image",
@@ -413,9 +433,11 @@ class TJBench {
System.out.format(" Compression ratio: %f:1\n", System.out.format(" Compression ratio: %f:1\n",
(double)(w * h * ps) / (double)yuvImage.getSize()); (double)(w * h * ps) / (double)yuvImage.getSize());
System.out.format(" Throughput: %f Megapixels/sec\n", System.out.format(" Throughput: %f Megapixels/sec\n",
(double)(w * h) / 1000000. * (double)iter / elapsedEncode); (double)(w * h) / 1000000. *
(double)iter / elapsedEncode);
System.out.format(" Output bit stream: %f Megabits/sec\n", System.out.format(" Output bit stream: %f Megabits/sec\n",
(double)yuvImage.getSize() * 8. / 1000000. * (double)iter / elapsedEncode); (double)yuvImage.getSize() * 8. / 1000000. *
(double)iter / elapsedEncode);
} }
System.out.format("%s --> Frame rate: %f fps\n", System.out.format("%s --> Frame rate: %f fps\n",
doYUV ? "Comp from YUV" : "Compress ", doYUV ? "Comp from YUV" : "Compress ",
@@ -427,12 +449,14 @@ class TJBench {
System.out.format(" Throughput: %f Megapixels/sec\n", System.out.format(" Throughput: %f Megapixels/sec\n",
(double)(w * h) / 1000000. * (double)iter / elapsed); (double)(w * h) / 1000000. * (double)iter / elapsed);
System.out.format(" Output bit stream: %f Megabits/sec\n", System.out.format(" Output bit stream: %f Megabits/sec\n",
(double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed); (double)totalJpegSize * 8. / 1000000. *
(double)iter / elapsed);
} }
if (tilew == w && tileh == h && write) { if (tilew == w && tileh == h && write) {
String tempStr = fileName + "_" + subName[subsamp] + "_" + "Q" + String tempStr = fileName + "_" + subName[subsamp] + "_" + "Q" +
jpegQual + ".jpg"; jpegQual + ".jpg";
FileOutputStream fos = new FileOutputStream(tempStr); FileOutputStream fos = new FileOutputStream(tempStr);
fos.write(jpegBuf[0], 0, jpegSize[0]); fos.write(jpegBuf[0], 0, jpegSize[0]);
fos.close(); fos.close();
if (quiet == 0) if (quiet == 0)
@@ -494,7 +518,8 @@ class TJBench {
} else if (quiet == 0) } else if (quiet == 0)
System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n", System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n",
formatName(subsamp, cs), pixFormatStr[pf], formatName(subsamp, cs), pixFormatStr[pf],
(flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down"); (flags & TJ.FLAG_BOTTOMUP) != 0 ?
"Bottom-up" : "Top-down");
for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ; for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
tilew *= 2, tileh *= 2) { tilew *= 2, tileh *= 2) {
@@ -557,7 +582,8 @@ class TJBench {
} }
TJTransform[] t = new TJTransform[_ntilesw * _ntilesh]; TJTransform[] t = new TJTransform[_ntilesw * _ntilesh];
jpegBuf = new byte[_ntilesw * _ntilesh][TJ.bufSize(_tilew, _tileh, subsamp)]; jpegBuf =
new byte[_ntilesw * _ntilesh][TJ.bufSize(_tilew, _tileh, subsamp)];
for (y = 0, tile = 0; y < _h; y += _tileh) { for (y = 0, tile = 0; y < _h; y += _tileh) {
for (x = 0; x < _w; x += _tilew, tile++) { for (x = 0; x < _w; x += _tilew, tile++) {
@@ -599,7 +625,8 @@ class TJBench {
System.out.format("%-6s%s%-6s%s", System.out.format("%-6s%s%-6s%s",
sigFig((double)(w * h) / 1000000. / elapsed, 4), sigFig((double)(w * h) / 1000000. / elapsed, 4),
quiet == 2 ? "\n" : " ", quiet == 2 ? "\n" : " ",
sigFig((double)(w * h * ps) / (double)totalJpegSize, 4), sigFig((double)(w * h * ps) /
(double)totalJpegSize, 4),
quiet == 2 ? "\n" : " "); quiet == 2 ? "\n" : " ");
} else if (quiet == 0) { } else if (quiet == 0) {
System.out.format("Transform --> Frame rate: %f fps\n", System.out.format("Transform --> Frame rate: %f fps\n",
@@ -715,9 +742,9 @@ class TJBench {
public static void main(String[] argv) { public static void main(String[] argv) {
byte[] srcBuf = null; int w = 0, h = 0; byte[] srcBuf = null;
int minQual = -1, maxQual = -1; int w = 0, h = 0, minQual = -1, maxQual = -1;
int minArg = 1; int retval = 0; int minArg = 1, retval = 0;
int subsamp = -1; int subsamp = -1;
try { try {
@@ -754,24 +781,19 @@ class TJBench {
for (int i = minArg; i < argv.length; i++) { for (int i = minArg; i < argv.length; i++) {
if (argv[i].equalsIgnoreCase("-tile")) { if (argv[i].equalsIgnoreCase("-tile")) {
doTile = true; xformOpt |= TJTransform.OPT_CROP; doTile = true; xformOpt |= TJTransform.OPT_CROP;
} } else if (argv[i].equalsIgnoreCase("-fastupsample")) {
else if (argv[i].equalsIgnoreCase("-fastupsample")) {
System.out.println("Using fast upsampling code\n"); System.out.println("Using fast upsampling code\n");
flags |= TJ.FLAG_FASTUPSAMPLE; flags |= TJ.FLAG_FASTUPSAMPLE;
} } else if (argv[i].equalsIgnoreCase("-fastdct")) {
else if (argv[i].equalsIgnoreCase("-fastdct")) {
System.out.println("Using fastest DCT/IDCT algorithm\n"); System.out.println("Using fastest DCT/IDCT algorithm\n");
flags |= TJ.FLAG_FASTDCT; flags |= TJ.FLAG_FASTDCT;
} } else if (argv[i].equalsIgnoreCase("-accuratedct")) {
else if (argv[i].equalsIgnoreCase("-accuratedct")) {
System.out.println("Using most accurate DCT/IDCT algorithm\n"); System.out.println("Using most accurate DCT/IDCT algorithm\n");
flags |= TJ.FLAG_ACCURATEDCT; flags |= TJ.FLAG_ACCURATEDCT;
} } else if (argv[i].equalsIgnoreCase("-progressive")) {
else if (argv[i].equalsIgnoreCase("-progressive")) {
System.out.println("Using progressive entropy coding\n"); System.out.println("Using progressive entropy coding\n");
flags |= TJ.FLAG_PROGRESSIVE; flags |= TJ.FLAG_PROGRESSIVE;
} } else if (argv[i].equalsIgnoreCase("-rgb"))
else if (argv[i].equalsIgnoreCase("-rgb"))
pf = TJ.PF_RGB; pf = TJ.PF_RGB;
else if (argv[i].equalsIgnoreCase("-rgbx")) else if (argv[i].equalsIgnoreCase("-rgbx"))
pf = TJ.PF_RGBX; pf = TJ.PF_RGBX;
@@ -793,6 +815,7 @@ class TJBench {
int temp1 = 0, temp2 = 0; int temp1 = 0, temp2 = 0;
boolean match = false, scanned = true; boolean match = false, scanned = true;
Scanner scanner = new Scanner(argv[++i]).useDelimiter("/"); Scanner scanner = new Scanner(argv[++i]).useDelimiter("/");
try { try {
temp1 = scanner.nextInt(); temp1 = scanner.nextInt();
temp2 = scanner.nextInt(); temp2 = scanner.nextInt();
@@ -800,6 +823,7 @@ class TJBench {
if (temp2 <= 0) temp2 = 1; if (temp2 <= 0) temp2 = 1;
if (temp1 > 0) { if (temp1 > 0) {
TJScalingFactor[] scalingFactors = TJ.getScalingFactors(); TJScalingFactor[] scalingFactors = TJ.getScalingFactors();
for (int j = 0; j < scalingFactors.length; j++) { for (int j = 0; j < scalingFactors.length; j++) {
if ((double)temp1 / (double)temp2 == if ((double)temp1 / (double)temp2 ==
(double)scalingFactors[j].getNum() / (double)scalingFactors[j].getNum() /
@@ -811,8 +835,7 @@ class TJBench {
if (!match) usage(); if (!match) usage();
} else } else
usage(); usage();
} } else if (argv[i].equalsIgnoreCase("-hflip"))
else if (argv[i].equalsIgnoreCase("-hflip"))
xformOp = TJTransform.OP_HFLIP; xformOp = TJTransform.OP_HFLIP;
else if (argv[i].equalsIgnoreCase("-vflip")) else if (argv[i].equalsIgnoreCase("-vflip"))
xformOp = TJTransform.OP_VFLIP; xformOp = TJTransform.OP_VFLIP;
@@ -832,8 +855,10 @@ class TJBench {
xformOpt |= TJTransform.OPT_NOOUTPUT; xformOpt |= TJTransform.OPT_NOOUTPUT;
else if (argv[i].equalsIgnoreCase("-copynone")) else if (argv[i].equalsIgnoreCase("-copynone"))
xformOpt |= TJTransform.OPT_COPYNONE; xformOpt |= TJTransform.OPT_COPYNONE;
else if (argv[i].equalsIgnoreCase("-benchtime") && i < argv.length - 1) { else if (argv[i].equalsIgnoreCase("-benchtime") &&
i < argv.length - 1) {
double temp = -1; double temp = -1;
try { try {
temp = Double.parseDouble(argv[++i]); temp = Double.parseDouble(argv[++i]);
} catch (NumberFormatException e) {} } catch (NumberFormatException e) {}
@@ -841,20 +866,32 @@ class TJBench {
benchTime = temp; benchTime = temp;
else else
usage(); usage();
} } else if (argv[i].equalsIgnoreCase("-warmup") &&
else if (argv[i].equalsIgnoreCase("-yuv")) { i < argv.length - 1) {
double temp = -1;
try {
temp = Double.parseDouble(argv[++i]);
} catch (NumberFormatException e) {}
if (temp >= 0.0) {
warmup = temp;
System.out.format("Warmup time = %.1f seconds\n\n", warmup);
} else
usage();
} else if (argv[i].equalsIgnoreCase("-yuv")) {
System.out.println("Testing YUV planar encoding/decoding\n"); System.out.println("Testing YUV planar encoding/decoding\n");
doYUV = true; doYUV = true;
} } else if (argv[i].equalsIgnoreCase("-yuvpad") &&
else if (argv[i].equalsIgnoreCase("-yuvpad") && i < argv.length - 1) { i < argv.length - 1) {
int temp = 0; int temp = 0;
try { try {
temp = Integer.parseInt(argv[++i]); temp = Integer.parseInt(argv[++i]);
} catch (NumberFormatException e) {} } catch (NumberFormatException e) {}
if (temp >= 1) if (temp >= 1)
yuvpad = temp; yuvPad = temp;
} } else if (argv[i].equalsIgnoreCase("-subsamp") &&
else if (argv[i].equalsIgnoreCase("-subsamp") && i < argv.length - 1) { i < argv.length - 1) {
i++; i++;
if (argv[i].toUpperCase().startsWith("G")) if (argv[i].toUpperCase().startsWith("G"))
subsamp = TJ.SAMP_GRAY; subsamp = TJ.SAMP_GRAY;
@@ -868,22 +905,10 @@ class TJBench {
subsamp = TJ.SAMP_420; subsamp = TJ.SAMP_420;
else if (argv[i].equals("411")) else if (argv[i].equals("411"))
subsamp = TJ.SAMP_411; subsamp = TJ.SAMP_411;
} } else if (argv[i].equalsIgnoreCase("-componly"))
else if (argv[i].equalsIgnoreCase("-componly"))
compOnly = true; compOnly = true;
else if (argv[i].equalsIgnoreCase("-nowrite")) else if (argv[i].equalsIgnoreCase("-nowrite"))
write = false; write = false;
else if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) {
double temp = -1;
try {
temp = Double.parseDouble(argv[++i]);
} catch (NumberFormatException e) {}
if (temp >= 0.0) {
warmup = temp;
System.out.format("Warmup time = %.1f seconds\n\n", warmup);
} else
usage();
}
else if (argv[i].equalsIgnoreCase("-stoponwarning")) else if (argv[i].equalsIgnoreCase("-stoponwarning"))
flags |= TJ.FLAG_STOPONWARNING; flags |= TJ.FLAG_STOPONWARNING;
else usage(); else usage();
@@ -901,6 +926,7 @@ class TJBench {
if (!decompOnly) { if (!decompOnly) {
int[] width = new int[1], height = new int[1]; int[] width = new int[1], height = new int[1];
srcBuf = loadImage(argv[0], width, height, pf); srcBuf = loadImage(argv[0], width, height, pf);
w = width[0]; h = height[0]; w = width[0]; h = height[0];
int index = -1; int index = -1;
@@ -911,7 +937,8 @@ class TJBench {
if (quiet == 1 && !decompOnly) { if (quiet == 1 && !decompOnly) {
System.out.println("All performance values in Mpixels/sec\n"); System.out.println("All performance values in Mpixels/sec\n");
System.out.format("Bitmap JPEG JPEG %s %s ", System.out.format("Bitmap JPEG JPEG %s %s ",
(doTile ? "Tile " : "Image"), (doTile ? "Tile " : "Image")); (doTile ? "Tile " : "Image"),
(doTile ? "Tile " : "Image"));
if (doYUV) if (doYUV)
System.out.print("Encode "); System.out.print("Encode ");
System.out.print("Comp Comp Decomp "); System.out.print("Comp Comp Decomp ");
@@ -959,6 +986,7 @@ class TJBench {
} catch (Exception e) { } catch (Exception e) {
if (e instanceof TJException) { if (e instanceof TJException) {
TJException tje = (TJException)e; TJException tje = (TJException)e;
System.out.println((tje.getErrorCode() == TJ.ERR_WARNING ? System.out.println((tje.getErrorCode() == TJ.ERR_WARNING ?
"WARNING: " : "ERROR: ") + tje.getMessage()); "WARNING: " : "ERROR: ") + tje.getMessage());
} else } else

View File

@@ -70,7 +70,7 @@ public class TJExample implements TJCustomFilter {
} }
private static final void usage() throws Exception { private static void usage() throws Exception {
System.out.println("\nUSAGE: java [Java options] " + classname + System.out.println("\nUSAGE: java [Java options] " + classname +
" <Input image> <Output image> [options]\n"); " <Input image> <Output image> [options]\n");
@@ -187,8 +187,7 @@ public class TJExample implements TJCustomFilter {
} }
if (match != 1) if (match != 1)
usage(); usage();
} } else if (argv[i].length() > 2 &&
else if (argv[i].length() > 2 &&
argv[i].substring(0, 3).equalsIgnoreCase("-su") && argv[i].substring(0, 3).equalsIgnoreCase("-su") &&
i < argv.length - 1) { i < argv.length - 1) {
i++; i++;
@@ -202,8 +201,7 @@ public class TJExample implements TJCustomFilter {
outSubsamp = TJ.SAMP_420; outSubsamp = TJ.SAMP_420;
else else
usage(); usage();
} } else if (argv[i].substring(0, 2).equalsIgnoreCase("-q") &&
else if (argv[i].substring(0, 2).equalsIgnoreCase("-q") &&
i < argv.length - 1) { i < argv.length - 1) {
outQual = Integer.parseInt(argv[++i]); outQual = Integer.parseInt(argv[++i]);
if (outQual < 1 || outQual > 100) if (outQual < 1 || outQual > 100)
@@ -240,22 +238,18 @@ public class TJExample implements TJCustomFilter {
xform.height < 1) xform.height < 1)
usage(); usage();
xform.options |= TJTransform.OPT_CROP; xform.options |= TJTransform.OPT_CROP;
} } else if (argv[i].substring(0, 2).equalsIgnoreCase("-d"))
else if (argv[i].substring(0, 2).equalsIgnoreCase("-d"))
display = true; display = true;
else if (argv[i].equalsIgnoreCase("-fastupsample")) { else if (argv[i].equalsIgnoreCase("-fastupsample")) {
System.out.println("Using fast upsampling code"); System.out.println("Using fast upsampling code");
flags |= TJ.FLAG_FASTUPSAMPLE; flags |= TJ.FLAG_FASTUPSAMPLE;
} } else if (argv[i].equalsIgnoreCase("-fastdct")) {
else if (argv[i].equalsIgnoreCase("-fastdct")) {
System.out.println("Using fastest DCT/IDCT algorithm"); System.out.println("Using fastest DCT/IDCT algorithm");
flags |= TJ.FLAG_FASTDCT; flags |= TJ.FLAG_FASTDCT;
} } else if (argv[i].equalsIgnoreCase("-accuratedct")) {
else if (argv[i].equalsIgnoreCase("-accuratedct")) {
System.out.println("Using most accurate DCT/IDCT algorithm"); System.out.println("Using most accurate DCT/IDCT algorithm");
flags |= TJ.FLAG_ACCURATEDCT; flags |= TJ.FLAG_ACCURATEDCT;
} } else usage();
else usage();
} }
/* Determine input and output image formats based on file extensions. */ /* Determine input and output image formats based on file extensions. */

View File

@@ -242,6 +242,7 @@ public class TJUnitTest {
throws Exception { throws Exception {
WritableRaster wr = img.getRaster(); WritableRaster wr = img.getRaster();
int imgType = img.getType(); int imgType = img.getType();
if (imgType == BufferedImage.TYPE_INT_RGB || if (imgType == BufferedImage.TYPE_INT_RGB ||
imgType == BufferedImage.TYPE_INT_BGR || imgType == BufferedImage.TYPE_INT_BGR ||
imgType == BufferedImage.TYPE_INT_ARGB || imgType == BufferedImage.TYPE_INT_ARGB ||

View File

@@ -34,7 +34,6 @@ package org.libjpegturbo.turbojpeg;
*/ */
public final class TJ { public final class TJ {
/** /**
* The number of chrominance subsampling options * The number of chrominance subsampling options
*/ */

View File

@@ -208,12 +208,12 @@ public class YUVImage {
* @param subsamp the level of chrominance subsampling used in the YUV * @param subsamp the level of chrominance subsampling used in the YUV
* image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) * image (one of {@link TJ#SAMP_444 TJ.SAMP_*})
*/ */
public void setBuf(byte[][] planes, int[] offsets, int width, int strides[], public void setBuf(byte[][] planes, int[] offsets, int width, int[] strides,
int height, int subsamp) { int height, int subsamp) {
setBuf(planes, offsets, width, strides, height, subsamp, false); setBuf(planes, offsets, width, strides, height, subsamp, false);
} }
private void setBuf(byte[][] planes, int[] offsets, int width, int strides[], private void setBuf(byte[][] planes, int[] offsets, int width, int[] strides,
int height, int subsamp, boolean alloc) { int height, int subsamp, boolean alloc) {
if ((planes == null && !alloc) || width < 1 || height < 1 || subsamp < 0 || if ((planes == null && !alloc) || width < 1 || height < 1 || subsamp < 0 ||
subsamp >= TJ.NUMSAMP) subsamp >= TJ.NUMSAMP)
@@ -428,7 +428,7 @@ public class YUVImage {
return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp); return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp);
} }
private static final int PAD(int v, int p) { private static int PAD(int v, int p) {
return (v + p - 1) & (~(p - 1)); return (v + p - 1) & (~(p - 1));
} }

View File

@@ -204,8 +204,8 @@ jpeg_finish_compress (j_compress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_write_marker (j_compress_ptr cinfo, int marker, jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr,
const JOCTET *dataptr, unsigned int datalen) unsigned int datalen)
{ {
void (*write_marker_byte) (j_compress_ptr info, int val); void (*write_marker_byte) (j_compress_ptr info, int val);

View File

@@ -881,7 +881,8 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
#ifdef CALCULATE_SPECTRAL_CONDITIONING #ifdef CALCULATE_SPECTRAL_CONDITIONING
if (cinfo->progressive_mode) if (cinfo->progressive_mode)
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */ /* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4); cinfo->arith_ac_K[tbl] = cinfo->Ss +
((8 + cinfo->Se - cinfo->Ss) >> 4);
#endif #endif
} }
} }

View File

@@ -58,13 +58,11 @@ typedef my_coef_controller *my_coef_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(boolean) compress_data METHODDEF(boolean) compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
#ifdef FULL_COEF_BUFFER_SUPPORTED #ifdef FULL_COEF_BUFFER_SUPPORTED
METHODDEF(boolean) compress_first_pass METHODDEF(boolean) compress_first_pass(j_compress_ptr cinfo,
(j_compress_ptr cinfo, JSAMPIMAGE input_buf); JSAMPIMAGE input_buf);
METHODDEF(boolean) compress_output METHODDEF(boolean) compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
#endif #endif
@@ -167,8 +165,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
blkn = 0; blkn = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci]; compptr = cinfo->cur_comp_info[ci];
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
: compptr->last_col_width; compptr->last_col_width;
xpos = MCU_col_num * compptr->MCU_sample_width; xpos = MCU_col_num * compptr->MCU_sample_width;
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
for (yindex = 0; yindex < compptr->MCU_height; yindex++) { for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
@@ -183,7 +181,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
jzero_far((void *)coef->MCU_buffer[blkn + blockcnt], jzero_far((void *)coef->MCU_buffer[blkn + blockcnt],
(compptr->MCU_width - blockcnt) * sizeof(JBLOCK)); (compptr->MCU_width - blockcnt) * sizeof(JBLOCK));
for (bi = blockcnt; bi < compptr->MCU_width; bi++) { for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; coef->MCU_buffer[blkn + bi][0][0] =
coef->MCU_buffer[blkn + bi - 1][0][0];
} }
} }
} else { } else {
@@ -191,7 +190,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
jzero_far((void *)coef->MCU_buffer[blkn], jzero_far((void *)coef->MCU_buffer[blkn],
compptr->MCU_width * sizeof(JBLOCK)); compptr->MCU_width * sizeof(JBLOCK));
for (bi = 0; bi < compptr->MCU_width; bi++) { for (bi = 0; bi < compptr->MCU_width; bi++) {
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; coef->MCU_buffer[blkn + bi][0][0] =
coef->MCU_buffer[blkn - 1][0][0];
} }
} }
blkn += compptr->MCU_width; blkn += compptr->MCU_width;

View File

@@ -29,9 +29,9 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_ycc_convert_internal (j_compress_ptr cinfo, rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -58,17 +58,14 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro. * need the general RIGHT_SHIFT macro.
*/ */
/* Y */ /* Y */
outptr0[col] = (JSAMPLE) outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cb */ /* Cb */
outptr1[col] = (JSAMPLE) outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) ctab[b + B_CB_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cr */ /* Cr */
outptr2[col] = (JSAMPLE) outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) ctab[b + B_CR_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -86,9 +83,9 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_gray_convert_internal (j_compress_ptr cinfo, rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -108,9 +105,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
b = GETJSAMPLE(inptr[RGB_BLUE]); b = GETJSAMPLE(inptr[RGB_BLUE]);
inptr += RGB_PIXELSIZE; inptr += RGB_PIXELSIZE;
/* Y */ /* Y */
outptr[col] = (JSAMPLE) outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -123,9 +119,9 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb_convert_internal (j_compress_ptr cinfo, rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr0, outptr1, outptr2; register JSAMPROW outptr0, outptr1, outptr2;

View File

@@ -231,9 +231,8 @@ rgb_ycc_start (j_compress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
rgb_ycc_convert (j_compress_ptr cinfo, rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -280,9 +279,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
rgb_gray_convert (j_compress_ptr cinfo, rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -326,9 +324,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
rgb_rgb_convert (j_compress_ptr cinfo, rgb_rgb_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -376,9 +373,8 @@ rgb_rgb_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
cmyk_ycck_convert (j_compress_ptr cinfo, cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -408,17 +404,14 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro. * need the general RIGHT_SHIFT macro.
*/ */
/* Y */ /* Y */
outptr0[col] = (JSAMPLE) outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cb */ /* Cb */
outptr1[col] = (JSAMPLE) outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) ctab[b + B_CB_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cr */ /* Cr */
outptr2[col] = (JSAMPLE) outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) ctab[b + B_CR_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -431,9 +424,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
grayscale_convert (j_compress_ptr cinfo, grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr; register JSAMPROW outptr;
@@ -460,8 +452,7 @@ grayscale_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
null_convert (j_compress_ptr cinfo, null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows) JDIMENSION output_row, int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;

View File

@@ -489,8 +489,7 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
METHODDEF(void) METHODDEF(void)
forward_DCT(j_compress_ptr cinfo, jpeg_component_info *compptr, forward_DCT(j_compress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
JDIMENSION start_row, JDIMENSION start_col, JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks)
JDIMENSION num_blocks)
/* This version is used for integer DCT implementations. */ /* This version is used for integer DCT implementations. */
{ {
/* This routine is heavily used, so it's worth coding it tightly. */ /* This routine is heavily used, so it's worth coding it tightly. */
@@ -522,9 +521,9 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr,
#ifdef DCT_FLOAT_SUPPORTED #ifdef DCT_FLOAT_SUPPORTED
METHODDEF(void) METHODDEF(void)
convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace) convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
FAST_FLOAT *workspace)
{ {
register FAST_FLOAT *workspaceptr; register FAST_FLOAT *workspaceptr;
register JSAMPROW elemptr; register JSAMPROW elemptr;
@@ -555,7 +554,8 @@ convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *worksp
METHODDEF(void) METHODDEF(void)
quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace) quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
FAST_FLOAT *workspace)
{ {
register FAST_FLOAT temp; register FAST_FLOAT temp;
register int i; register int i;

View File

@@ -55,10 +55,6 @@
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x) #define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
#endif #endif
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif
/* Expanded entropy encoder object for Huffman encoding. /* Expanded entropy encoder object for Huffman encoding.
* *
@@ -310,11 +306,12 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
/* Outputting bytes to the file */ /* Outputting bytes to the file */
/* Emit a byte, taking 'action' if must suspend. */ /* Emit a byte, taking 'action' if must suspend. */
#define emit_byte(state,val,action) \ #define emit_byte(state, val, action) { \
{ *(state)->next_output_byte++ = (JOCTET) (val); \ *(state)->next_output_byte++ = (JOCTET)(val); \
if (--(state)->free_in_buffer == 0) \ if (--(state)->free_in_buffer == 0) \
if (!dump_buffer(state)) \ if (!dump_buffer(state)) \
{ action; } } { action; } \
}
LOCAL(boolean) LOCAL(boolean)
@@ -434,8 +431,8 @@ dump_buffer (working_state *state)
if (state->free_in_buffer < BUFSIZE) { \ if (state->free_in_buffer < BUFSIZE) { \
localbuf = 1; \ localbuf = 1; \
buffer = _buffer; \ buffer = _buffer; \
} \ } else \
else buffer = state->next_output_byte; \ buffer = state->next_output_byte; \
} }
#define STORE_BUFFER() { \ #define STORE_BUFFER() { \
@@ -443,7 +440,7 @@ dump_buffer (working_state *state)
bytes = buffer - _buffer; \ bytes = buffer - _buffer; \
buffer = _buffer; \ buffer = _buffer; \
while (bytes > 0) { \ while (bytes > 0) { \
bytestocopy = min(bytes, state->free_in_buffer); \ bytestocopy = MIN(bytes, state->free_in_buffer); \
MEMCOPY(state->next_output_byte, buffer, bytestocopy); \ MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
state->next_output_byte += bytestocopy; \ state->next_output_byte += bytestocopy; \
buffer += bytestocopy; \ buffer += bytestocopy; \
@@ -452,8 +449,7 @@ dump_buffer (working_state *state)
if (!dump_buffer(state)) return FALSE; \ if (!dump_buffer(state)) return FALSE; \
bytes -= bytestocopy; \ bytes -= bytestocopy; \
} \ } \
} \ } else { \
else { \
state->free_in_buffer -= (buffer - state->next_output_byte); \ state->free_in_buffer -= (buffer - state->next_output_byte); \
state->next_output_byte = buffer; \ state->next_output_byte = buffer; \
} \ } \

View File

@@ -34,10 +34,9 @@ typedef struct {
} c_derived_tbl; } c_derived_tbl;
/* Expand a Huffman table definition into the derived format */ /* Expand a Huffman table definition into the derived format */
EXTERN(void) jpeg_make_c_derived_tbl EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC,
(j_compress_ptr cinfo, boolean isDC, int tblno, int tblno, c_derived_tbl **pdtbl);
c_derived_tbl ** pdtbl);
/* Generate an optimal table definition given the specified counts */ /* Generate an optimal table definition given the specified counts */
EXTERN(void) jpeg_gen_optimal_table EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl,
(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[]); long freq[]);

View File

@@ -60,8 +60,8 @@ jinit_compress_master (j_compress_ptr cinfo)
} }
/* Need a full-image coefficient buffer in any multi-pass mode. */ /* Need a full-image coefficient buffer in any multi-pass mode. */
jinit_c_coef_controller(cinfo, jinit_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); cinfo->optimize_coding));
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
jinit_marker_writer(cinfo); jinit_marker_writer(cinfo);

View File

@@ -39,8 +39,9 @@ typedef my_main_controller *my_main_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) process_data_simple_main METHODDEF(void) process_data_simple_main(j_compress_ptr cinfo,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JSAMPARRAY input_buf,
JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail); JDIMENSION in_rows_avail);
@@ -75,18 +76,17 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
process_data_simple_main (j_compress_ptr cinfo, process_data_simple_main(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)
JDIMENSION in_rows_avail)
{ {
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) { while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Read input data if we haven't filled the main buffer yet */ /* Read input data if we haven't filled the main buffer yet */
if (main_ptr->rowgroup_ctr < DCTSIZE) if (main_ptr->rowgroup_ctr < DCTSIZE)
(*cinfo->prep->pre_process_data) (cinfo, (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr,
input_buf, in_row_ctr, in_rows_avail, in_rows_avail, main_ptr->buffer,
main_ptr->buffer, &main_ptr->rowgroup_ctr, &main_ptr->rowgroup_ctr,
(JDIMENSION)DCTSIZE); (JDIMENSION)DCTSIZE);
/* If we don't have a full iMCU row buffered, return to application for /* If we don't have a full iMCU row buffered, return to application for

View File

@@ -296,8 +296,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
/* Make sure image isn't bigger than SOF field can handle */ /* Make sure image isn't bigger than SOF field can handle */
if ((long) cinfo->_jpeg_height > 65535L || if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
(long) cinfo->_jpeg_width > 65535L)
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535); ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
emit_byte(cinfo, cinfo->data_precision); emit_byte(cinfo, cinfo->data_precision);

View File

@@ -95,8 +95,8 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
#endif #endif
/* Sanity check on image dimensions */ /* Sanity check on image dimensions */
if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
|| cinfo->num_components <= 0 || cinfo->input_components <= 0) cinfo->num_components <= 0 || cinfo->input_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
/* Make sure image isn't bigger than I can handle */ /* Make sure image isn't bigger than I can handle */
@@ -124,8 +124,10 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
cinfo->max_v_samp_factor = 1; cinfo->max_v_samp_factor = 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || if (compptr->h_samp_factor <= 0 ||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) compptr->h_samp_factor > MAX_SAMP_FACTOR ||
compptr->v_samp_factor <= 0 ||
compptr->v_samp_factor > MAX_SAMP_FACTOR)
ERREXIT(cinfo, JERR_BAD_SAMPLING); ERREXIT(cinfo, JERR_BAD_SAMPLING);
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
compptr->h_samp_factor); compptr->h_samp_factor);
@@ -331,8 +333,7 @@ select_scan_parameters (j_compress_ptr cinfo)
cinfo->Se = scanptr->Se; cinfo->Se = scanptr->Se;
cinfo->Ah = scanptr->Ah; cinfo->Ah = scanptr->Ah;
cinfo->Al = scanptr->Al; cinfo->Al = scanptr->Al;
} } else
else
#endif #endif
{ {
/* Prepare for single sequential-JPEG scan containing all components */ /* Prepare for single sequential-JPEG scan containing all components */

View File

@@ -26,8 +26,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl, jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl,
const unsigned int *basic_table, const unsigned int *basic_table, int scale_factor,
int scale_factor, boolean force_baseline) boolean force_baseline)
/* Define a quantization table equal to the basic_table times /* Define a quantization table equal to the basic_table times
* a scale factor (given as a percentage). * a scale factor (given as a percentage).
* If force_baseline is TRUE, the computed quantization table entries * If force_baseline is TRUE, the computed quantization table entries
@@ -404,8 +404,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
#ifdef C_PROGRESSIVE_SUPPORTED #ifdef C_PROGRESSIVE_SUPPORTED
LOCAL(jpeg_scan_info *) LOCAL(jpeg_scan_info *)
fill_a_scan (jpeg_scan_info *scanptr, int ci, fill_a_scan(jpeg_scan_info *scanptr, int ci, int Ss, int Se, int Ah, int Al)
int Ss, int Se, int Ah, int Al)
/* Support routine: generate one scan for specified component */ /* Support routine: generate one scan for specified component */
{ {
scanptr->comps_in_scan = 1; scanptr->comps_in_scan = 1;
@@ -419,8 +418,7 @@ fill_a_scan (jpeg_scan_info *scanptr, int ci,
} }
LOCAL(jpeg_scan_info *) LOCAL(jpeg_scan_info *)
fill_scans (jpeg_scan_info *scanptr, int ncomps, fill_scans(jpeg_scan_info *scanptr, int ncomps, int Ss, int Se, int Ah, int Al)
int Ss, int Se, int Ah, int Al)
/* Support routine: generate one scan for each component */ /* Support routine: generate one scan for each component */
{ {
int ci; int ci;

View File

@@ -230,10 +230,11 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
*/ */
/* Emit a byte */ /* Emit a byte */
#define emit_byte(entropy,val) \ #define emit_byte(entropy, val) { \
{ *(entropy)->next_output_byte++ = (JOCTET) (val); \ *(entropy)->next_output_byte++ = (JOCTET)(val); \
if (--(entropy)->free_in_buffer == 0) \ if (--(entropy)->free_in_buffer == 0) \
dump_buffer(entropy); } dump_buffer(entropy); \
}
LOCAL(void) LOCAL(void)
@@ -744,7 +745,8 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
* 1. overflow of the EOB counter; * 1. overflow of the EOB counter;
* 2. overflow of the correction bit buffer during the next MCU. * 2. overflow of the correction bit buffer during the next MCU.
*/ */
if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1)) if (entropy->EOBRUN == 0x7FFF ||
entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
emit_eobrun(entropy); emit_eobrun(entropy);
} }

View File

@@ -106,14 +106,14 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
LOCAL(void) LOCAL(void)
expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, expand_bottom_edge(JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows,
int input_rows, int output_rows) int output_rows)
{ {
register int row; register int row;
for (row = input_rows; row < output_rows; row++) { for (row = input_rows; row < output_rows; row++) {
jcopy_sample_rows(image_data, input_rows-1, image_data, row, jcopy_sample_rows(image_data, input_rows - 1, image_data, row, 1,
1, num_cols); num_cols);
} }
} }
@@ -128,9 +128,8 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
*/ */
METHODDEF(void) METHODDEF(void)
pre_process_data (j_compress_ptr cinfo, pre_process_data(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
JDIMENSION in_rows_avail,
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
JDIMENSION out_row_groups_avail) JDIMENSION out_row_groups_avail)
{ {
@@ -172,12 +171,10 @@ pre_process_data (j_compress_ptr cinfo,
/* If at bottom of image, pad the output to a full iMCU height. /* If at bottom of image, pad the output to a full iMCU height.
* Note we assume the caller is providing a one-iMCU-height output buffer! * Note we assume the caller is providing a one-iMCU-height output buffer!
*/ */
if (prep->rows_to_go == 0 && if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) {
*out_row_group_ctr < out_row_groups_avail) {
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
expand_bottom_edge(output_buf[ci], expand_bottom_edge(output_buf[ci], compptr->width_in_blocks * DCTSIZE,
compptr->width_in_blocks * DCTSIZE,
(int)(*out_row_group_ctr * compptr->v_samp_factor), (int)(*out_row_group_ctr * compptr->v_samp_factor),
(int)(out_row_groups_avail * compptr->v_samp_factor)); (int)(out_row_groups_avail * compptr->v_samp_factor));
} }
@@ -195,9 +192,8 @@ pre_process_data (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
pre_process_context (j_compress_ptr cinfo, pre_process_context(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
JDIMENSION in_rows_avail,
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
JDIMENSION out_row_groups_avail) JDIMENSION out_row_groups_avail)
{ {
@@ -221,9 +217,8 @@ pre_process_context (j_compress_ptr cinfo,
for (ci = 0; ci < cinfo->num_components; ci++) { for (ci = 0; ci < cinfo->num_components; ci++) {
int row; int row;
for (row = 1; row <= cinfo->max_v_samp_factor; row++) { for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
jcopy_sample_rows(prep->color_buf[ci], 0, jcopy_sample_rows(prep->color_buf[ci], 0, prep->color_buf[ci],
prep->color_buf[ci], -row, -row, 1, cinfo->image_width);
1, cinfo->image_width);
} }
} }
} }
@@ -245,8 +240,7 @@ pre_process_context (j_compress_ptr cinfo,
} }
/* If we've gotten enough data, downsample a row group. */ /* If we've gotten enough data, downsample a row group. */
if (prep->next_buf_row == prep->next_buf_stop) { if (prep->next_buf_row == prep->next_buf_stop) {
(*cinfo->downsample->downsample) (cinfo, (*cinfo->downsample->downsample) (cinfo, prep->color_buf,
prep->color_buf,
(JDIMENSION)prep->this_row_group, (JDIMENSION)prep->this_row_group,
output_buf, *out_row_group_ctr); output_buf, *out_row_group_ctr);
(*out_row_group_ctr)++; (*out_row_group_ctr)++;

View File

@@ -91,8 +91,8 @@ start_pass_downsample (j_compress_ptr cinfo)
*/ */
LOCAL(void) LOCAL(void)
expand_right_edge (JSAMPARRAY image_data, int num_rows, expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols,
JDIMENSION input_cols, JDIMENSION output_cols) JDIMENSION output_cols)
{ {
register JSAMPROW ptr; register JSAMPROW ptr;
register JSAMPLE pixval; register JSAMPLE pixval;
@@ -118,9 +118,9 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows,
*/ */
METHODDEF(void) METHODDEF(void)
sep_downsample (j_compress_ptr cinfo, sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_index, JDIMENSION in_row_index, JSAMPIMAGE output_buf,
JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) JDIMENSION out_row_group_index)
{ {
my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample; my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample;
int ci; int ci;
@@ -162,8 +162,8 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more * by the standard loop. Special-casing padded output would be more
* efficient. * efficient.
*/ */
expand_right_edge(input_data, cinfo->max_v_samp_factor, expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, output_cols * h_expand); output_cols * h_expand);
inrow = 0; inrow = 0;
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
@@ -195,11 +195,11 @@ fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data) JSAMPARRAY input_data, JSAMPARRAY output_data)
{ {
/* Copy the data */ /* Copy the data */
jcopy_sample_rows(input_data, 0, output_data, 0, jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor,
cinfo->max_v_samp_factor, cinfo->image_width); cinfo->image_width);
/* Edge-expand */ /* Edge-expand */
expand_right_edge(output_data, cinfo->max_v_samp_factor, expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, compptr->width_in_blocks * DCTSIZE); compptr->width_in_blocks * DCTSIZE);
} }
@@ -229,16 +229,16 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more * by the standard loop. Special-casing padded output would be more
* efficient. * efficient.
*/ */
expand_right_edge(input_data, cinfo->max_v_samp_factor, expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, output_cols * 2); output_cols * 2);
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
outptr = output_data[outrow]; outptr = output_data[outrow];
inptr = input_data[outrow]; inptr = input_data[outrow];
bias = 0; /* bias = 0,1,0,1,... for successive samples */ bias = 0; /* bias = 0,1,0,1,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) { for (outcol = 0; outcol < output_cols; outcol++) {
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) *outptr++ =
+ bias) >> 1); (JSAMPLE)((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + bias) >> 1);
bias ^= 1; /* 0=>1, 1=>0 */ bias ^= 1; /* 0=>1, 1=>0 */
inptr += 2; inptr += 2;
} }
@@ -266,8 +266,8 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more * by the standard loop. Special-casing padded output would be more
* efficient. * efficient.
*/ */
expand_right_edge(input_data, cinfo->max_v_samp_factor, expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, output_cols * 2); output_cols * 2);
inrow = 0; inrow = 0;
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
@@ -276,9 +276,9 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
inptr1 = input_data[inrow + 1]; inptr1 = input_data[inrow + 1];
bias = 1; /* bias = 1,2,1,2,... for successive samples */ bias = 1; /* bias = 1,2,1,2,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) { for (outcol = 0; outcol < output_cols; outcol++) {
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + *outptr++ =
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) (JSAMPLE)((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ bias) >> 2); GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + bias) >> 2);
bias ^= 3; /* 1=>2, 2=>1 */ bias ^= 3; /* 1=>2, 2=>1 */
inptr0 += 2; inptr1 += 2; inptr0 += 2; inptr1 += 2;
} }

View File

@@ -20,10 +20,10 @@
/* Forward declarations */ /* Forward declarations */
LOCAL(void) transencode_master_selection LOCAL(void) transencode_master_selection(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays); jvirt_barray_ptr *coef_arrays);
LOCAL(void) transencode_coef_controller LOCAL(void) transencode_coef_controller(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays); jvirt_barray_ptr *coef_arrays);
/* /*
@@ -64,8 +64,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo)
j_compress_ptr dstinfo)
{ {
JQUANT_TBL **qtblptr; JQUANT_TBL **qtblptr;
jpeg_component_info *incomp, *outcomp; jpeg_component_info *incomp, *outcomp;
@@ -100,8 +99,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
qtblptr = &dstinfo->quant_tbl_ptrs[tblno]; qtblptr = &dstinfo->quant_tbl_ptrs[tblno];
if (*qtblptr == NULL) if (*qtblptr == NULL)
*qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo); *qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo);
MEMCOPY((*qtblptr)->quantval, MEMCOPY((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval,
srcinfo->quant_tbl_ptrs[tblno]->quantval,
sizeof((*qtblptr)->quantval)); sizeof((*qtblptr)->quantval));
(*qtblptr)->sent_table = FALSE; (*qtblptr)->sent_table = FALSE;
} }
@@ -321,8 +319,8 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci]; compptr = cinfo->cur_comp_info[ci];
start_col = MCU_col_num * compptr->MCU_width; start_col = MCU_col_num * compptr->MCU_width;
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
: compptr->last_col_width; compptr->last_col_width;
for (yindex = 0; yindex < compptr->MCU_height; yindex++) { for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
if (coef->iMCU_row_num < last_iMCU_row || if (coef->iMCU_row_num < last_iMCU_row ||
yindex + yoffset < compptr->last_row_height) { yindex + yoffset < compptr->last_row_height) {

View File

@@ -210,8 +210,7 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
/* Set the first and last iMCU columns that we must decompress. These values /* Set the first and last iMCU columns that we must decompress. These values
* will be used in single-scan decompressions. * will be used in single-scan decompressions.
*/ */
cinfo->master->first_iMCU_col = cinfo->master->first_iMCU_col = (JDIMENSION)(long)(*xoffset) / (long)align;
(JDIMENSION) (long) (*xoffset) / (long) align;
cinfo->master->last_iMCU_col = cinfo->master->last_iMCU_col =
(JDIMENSION)jdiv_round_up((long)(*xoffset + cinfo->output_width), (JDIMENSION)jdiv_round_up((long)(*xoffset + cinfo->output_width),
(long)align) - 1; (long)align) - 1;
@@ -236,8 +235,7 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
cinfo->master->first_MCU_col[ci] = cinfo->master->first_MCU_col[ci] =
(JDIMENSION)(long)(*xoffset * hsf) / (long)align; (JDIMENSION)(long)(*xoffset * hsf) / (long)align;
cinfo->master->last_MCU_col[ci] = cinfo->master->last_MCU_col[ci] =
(JDIMENSION) jdiv_round_up((long) ((*xoffset + cinfo->output_width) * (JDIMENSION)jdiv_round_up((long)((*xoffset + cinfo->output_width) * hsf),
hsf),
(long)align) - 1; (long)align) - 1;
} }
@@ -595,8 +593,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
/* Limit scan number to valid range */ /* Limit scan number to valid range */
if (scan_number <= 0) if (scan_number <= 0)
scan_number = 1; scan_number = 1;
if (cinfo->inputctl->eoi_reached && if (cinfo->inputctl->eoi_reached && scan_number > cinfo->input_scan_number)
scan_number > cinfo->input_scan_number)
scan_number = cinfo->input_scan_number; scan_number = cinfo->input_scan_number;
cinfo->output_scan_number = scan_number; cinfo->output_scan_number = scan_number;
/* Perform any dummy output passes, and set up for the real pass */ /* Perform any dummy output passes, and set up for the real pass */

View File

@@ -760,7 +760,8 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
int *coef_bit_ptr, ci; int *coef_bit_ptr, ci;
cinfo->coef_bits = (int (*)[DCTSIZE2]) cinfo->coef_bits = (int (*)[DCTSIZE2])
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components*DCTSIZE2*sizeof(int)); cinfo->num_components * DCTSIZE2 *
sizeof(int));
coef_bit_ptr = &cinfo->coef_bits[0][0]; coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++) for (i = 0; i < DCTSIZE2; i++)

View File

@@ -147,9 +147,8 @@ term_mem_destination (j_compress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_mem_dest_tj (j_compress_ptr cinfo, jpeg_mem_dest_tj(j_compress_ptr cinfo, unsigned char **outbuffer,
unsigned char **outbuffer, unsigned long *outsize, unsigned long *outsize, boolean alloc)
boolean alloc)
{ {
boolean reused = FALSE; boolean reused = FALSE;
my_mem_dest_ptr dest; my_mem_dest_ptr dest;
@@ -191,8 +190,8 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo,
if (dest->newbuffer == NULL) if (dest->newbuffer == NULL)
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10); ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
*outsize = OUTPUT_BUF_SIZE; *outsize = OUTPUT_BUF_SIZE;
} } else
else ERREXIT(cinfo, JERR_BUFFER_SIZE); ERREXIT(cinfo, JERR_BUFFER_SIZE);
} }
dest->pub.next_output_byte = dest->buffer = *outbuffer; dest->pub.next_output_byte = dest->buffer = *outbuffer;

View File

@@ -249,8 +249,8 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_mem_dest (j_compress_ptr cinfo, jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
unsigned char **outbuffer, unsigned long *outsize) unsigned long *outsize)
{ {
my_mem_dest_ptr dest; my_mem_dest_ptr dest;

View File

@@ -157,8 +157,8 @@ term_source (j_decompress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_mem_src_tj (j_decompress_ptr cinfo, jpeg_mem_src_tj(j_decompress_ptr cinfo, const unsigned char *inbuffer,
const unsigned char *inbuffer, unsigned long insize) unsigned long insize)
{ {
struct jpeg_source_mgr *src; struct jpeg_source_mgr *src;

View File

@@ -260,8 +260,8 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_mem_src (j_decompress_ptr cinfo, jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
const unsigned char *inbuffer, unsigned long insize) unsigned long insize)
{ {
struct jpeg_source_mgr *src; struct jpeg_source_mgr *src;

View File

@@ -25,16 +25,15 @@
/* Forward declarations */ /* Forward declarations */
METHODDEF(int) decompress_onepass METHODDEF(int) decompress_onepass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE output_buf); JSAMPIMAGE output_buf);
#ifdef D_MULTISCAN_FILES_SUPPORTED #ifdef D_MULTISCAN_FILES_SUPPORTED
METHODDEF(int) decompress_data METHODDEF(int) decompress_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
(j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
#endif #endif
#ifdef BLOCK_SMOOTHING_SUPPORTED #ifdef BLOCK_SMOOTHING_SUPPORTED
LOCAL(boolean) smoothing_ok(j_decompress_ptr cinfo); LOCAL(boolean) smoothing_ok(j_decompress_ptr cinfo);
METHODDEF(int) decompress_smooth_data METHODDEF(int) decompress_smooth_data(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE output_buf); JSAMPIMAGE output_buf);
#endif #endif
@@ -129,8 +128,8 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
continue; continue;
} }
inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width useful_width = (MCU_col_num < last_MCU_col) ?
: compptr->last_col_width; compptr->MCU_width : compptr->last_col_width;
output_ptr = output_buf[compptr->component_index] + output_ptr = output_buf[compptr->component_index] +
yoffset * compptr->_DCT_scaled_size; yoffset * compptr->_DCT_scaled_size;
start_col = (MCU_col_num - cinfo->master->first_iMCU_col) * start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
@@ -307,8 +306,8 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
output_col = 0; output_col = 0;
for (block_num = cinfo->master->first_MCU_col[ci]; for (block_num = cinfo->master->first_MCU_col[ci];
block_num <= cinfo->master->last_MCU_col[ci]; block_num++) { block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
output_ptr, output_col); output_col);
buffer_ptr++; buffer_ptr++;
output_col += compptr->_DCT_scaled_size; output_col += compptr->_DCT_scaled_size;
} }
@@ -599,8 +598,8 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
workspace[2] = (JCOEF)pred; workspace[2] = (JCOEF)pred;
} }
/* OK, do the IDCT */ /* OK, do the IDCT */
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
output_ptr, output_col); output_col);
/* Advance for next column */ /* Advance for next column */
DC1 = DC2; DC2 = DC3; DC1 = DC2; DC2 = DC3;
DC4 = DC5; DC5 = DC6; DC4 = DC5; DC5 = DC6;

View File

@@ -17,9 +17,9 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
ycc_rgb565_convert_internal (j_decompress_ptr cinfo, ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -96,9 +96,9 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
ycc_rgb565D_convert_internal (j_decompress_ptr cinfo, ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -182,9 +182,9 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb565_convert_internal (j_decompress_ptr cinfo, rgb_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
@@ -237,9 +237,9 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb565D_convert_internal (j_decompress_ptr cinfo, rgb_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
@@ -296,9 +296,9 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
gray_rgb565_convert_internal (j_decompress_ptr cinfo, gray_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr, outptr; register JSAMPROW inptr, outptr;
register JDIMENSION col; register JDIMENSION col;
@@ -336,9 +336,9 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
gray_rgb565D_convert_internal (j_decompress_ptr cinfo, gray_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr, outptr; register JSAMPROW inptr, outptr;
register JDIMENSION col; register JDIMENSION col;

View File

@@ -28,9 +28,9 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
ycc_rgb_convert_internal (j_decompress_ptr cinfo, ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -81,9 +81,9 @@ ycc_rgb_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
gray_rgb_convert_internal (j_decompress_ptr cinfo, gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr, outptr; register JSAMPROW inptr, outptr;
register JDIMENSION col; register JDIMENSION col;
@@ -112,9 +112,9 @@ gray_rgb_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb_convert_internal (j_decompress_ptr cinfo, rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
register JSAMPROW outptr; register JSAMPROW outptr;

View File

@@ -251,9 +251,8 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
ycc_rgb_convert (j_decompress_ptr cinfo, ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -324,9 +323,8 @@ build_rgb_y_table (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
rgb_gray_convert (j_decompress_ptr cinfo, rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -347,9 +345,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
g = GETJSAMPLE(inptr1[col]); g = GETJSAMPLE(inptr1[col]);
b = GETJSAMPLE(inptr2[col]); b = GETJSAMPLE(inptr2[col]);
/* Y */ /* Y */
outptr[col] = (JSAMPLE) outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -361,9 +358,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
null_convert (j_decompress_ptr cinfo, null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr; register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
register JDIMENSION col; register JDIMENSION col;
@@ -423,12 +419,11 @@ null_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
grayscale_convert (j_decompress_ptr cinfo, grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
num_rows, cinfo->output_width); cinfo->output_width);
} }
@@ -437,9 +432,8 @@ grayscale_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
gray_rgb_convert (j_decompress_ptr cinfo, gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -483,9 +477,8 @@ gray_rgb_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
rgb_rgb_convert (j_decompress_ptr cinfo, rgb_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -532,9 +525,8 @@ rgb_rgb_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
ycck_cmyk_convert (j_decompress_ptr cinfo, ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -662,9 +654,8 @@ static INLINE boolean is_big_endian(void)
METHODDEF(void) METHODDEF(void)
ycc_rgb565_convert (j_decompress_ptr cinfo, ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -674,9 +665,8 @@ ycc_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
ycc_rgb565D_convert (j_decompress_ptr cinfo, ycc_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -686,9 +676,8 @@ ycc_rgb565D_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
rgb_rgb565_convert (j_decompress_ptr cinfo, rgb_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -698,9 +687,8 @@ rgb_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
rgb_rgb565D_convert (j_decompress_ptr cinfo, rgb_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -710,9 +698,8 @@ rgb_rgb565D_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
gray_rgb565_convert (j_decompress_ptr cinfo, gray_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -722,9 +709,8 @@ gray_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
gray_rgb565D_convert (j_decompress_ptr cinfo, gray_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);

108
jdct.h
View File

@@ -94,60 +94,60 @@ EXTERN(void) jpeg_fdct_islow (DCTELEM *data);
EXTERN(void) jpeg_fdct_ifast(DCTELEM *data); EXTERN(void) jpeg_fdct_ifast(DCTELEM *data);
EXTERN(void) jpeg_fdct_float(FAST_FLOAT *data); EXTERN(void) jpeg_fdct_float(FAST_FLOAT *data);
EXTERN(void) jpeg_idct_islow EXTERN(void) jpeg_idct_islow(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_ifast EXTERN(void) jpeg_idct_ifast(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_float EXTERN(void) jpeg_idct_float(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_7x7 EXTERN(void) jpeg_idct_7x7(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_6x6 EXTERN(void) jpeg_idct_6x6(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_5x5 EXTERN(void) jpeg_idct_5x5(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_4x4 EXTERN(void) jpeg_idct_4x4(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_3x3 EXTERN(void) jpeg_idct_3x3(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_2x2 EXTERN(void) jpeg_idct_2x2(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_1x1 EXTERN(void) jpeg_idct_1x1(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_9x9 EXTERN(void) jpeg_idct_9x9(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_10x10 EXTERN(void) jpeg_idct_10x10(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_11x11 EXTERN(void) jpeg_idct_11x11(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_12x12 EXTERN(void) jpeg_idct_12x12(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_13x13 EXTERN(void) jpeg_idct_13x13(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_14x14 EXTERN(void) jpeg_idct_14x14(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_15x15 EXTERN(void) jpeg_idct_15x15(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_16x16 EXTERN(void) jpeg_idct_16x16(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
/* /*

View File

@@ -400,8 +400,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
handle markers. We have to hand off any blocks with markers to the handle markers. We have to hand off any blocks with markers to the
slower routines. */ slower routines. */
#define GET_BYTE \ #define GET_BYTE { \
{ \
register int c0, c1; \ register int c0, c1; \
c0 = GETJOCTET(*buffer++); \ c0 = GETJOCTET(*buffer++); \
c1 = GETJOCTET(*buffer); \ c1 = GETJOCTET(*buffer); \
@@ -493,21 +492,25 @@ jpeg_huff_decode (bitread_working_state *state,
#ifdef AVOID_TABLES #ifdef AVOID_TABLES
#define NEG_1 ((unsigned int)-1) #define NEG_1 ((unsigned int)-1)
#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((NEG_1)<<(s)) + 1))) #define HUFF_EXTEND(x, s) \
((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
#else #else
#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) #define HUFF_EXTEND(x, s) \
((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
static const int extend_test[16] = /* entry n is 2**(n-1) */ static const int extend_test[16] = { /* entry n is 2**(n-1) */
{ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
};
static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
{ 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1, ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1,
((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1, ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1,
((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1
};
#endif /* AVOID_TABLES */ #endif /* AVOID_TABLES */
@@ -766,8 +769,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
usefast = 0; usefast = 0;
} }
if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
|| cinfo->unread_marker != 0) cinfo->unread_marker != 0)
usefast = 0; usefast = 0;
/* If we've run out of data, just leave the MCU set to zeroes. /* If we've run out of data, just leave the MCU set to zeroes.
@@ -777,8 +780,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (usefast) { if (usefast) {
if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow; if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
} } else {
else {
use_slow: use_slow:
if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE; if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
} }

View File

@@ -47,9 +47,8 @@ typedef struct {
} d_derived_tbl; } d_derived_tbl;
/* Expand a Huffman table definition into the derived format */ /* Expand a Huffman table definition into the derived format */
EXTERN(void) jpeg_make_d_derived_tbl EXTERN(void) jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC,
(j_decompress_ptr cinfo, boolean isDC, int tblno, int tblno, d_derived_tbl **pdtbl);
d_derived_tbl ** pdtbl);
/* /*
@@ -149,11 +148,13 @@ typedef struct { /* Bitreading working state within an MCU */
* is evaluated multiple times. * is evaluated multiple times.
*/ */
#define CHECK_BIT_BUFFER(state,nbits,action) \ #define CHECK_BIT_BUFFER(state, nbits, action) { \
{ if (bits_left < (nbits)) { \ if (bits_left < (nbits)) { \
if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \ if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
{ action; } \ { action; } \
get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } get_buffer = (state).get_buffer; bits_left = (state).bits_left; \
} \
}
#define GET_BITS(nbits) \ #define GET_BITS(nbits) \
(((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1)) (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
@@ -165,8 +166,8 @@ typedef struct { /* Bitreading working state within an MCU */
(bits_left -= (nbits)) (bits_left -= (nbits))
/* Load up the bit buffer to a depth of at least nbits */ /* Load up the bit buffer to a depth of at least nbits */
EXTERN(boolean) jpeg_fill_bit_buffer EXTERN(boolean) jpeg_fill_bit_buffer(bitread_working_state *state,
(bitread_working_state *state, register bit_buf_type get_buffer, register bit_buf_type get_buffer,
register int bits_left, int nbits); register int bits_left, int nbits);
@@ -187,10 +188,11 @@ EXTERN(boolean) jpeg_fill_bit_buffer
* 3. jpeg_huff_decode returns -1 if forced to suspend. * 3. jpeg_huff_decode returns -1 if forced to suspend.
*/ */
#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \ #define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
{ register int nb, look; \ register int nb, look; \
if (bits_left < HUFF_LOOKAHEAD) { \ if (bits_left < HUFF_LOOKAHEAD) { \
if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \ if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
{ failaction; } \
get_buffer = state.get_buffer; bits_left = state.bits_left; \ get_buffer = state.get_buffer; bits_left = state.bits_left; \
if (bits_left < HUFF_LOOKAHEAD) { \ if (bits_left < HUFF_LOOKAHEAD) { \
nb = 1; goto slowlabel; \ nb = 1; goto slowlabel; \
@@ -202,7 +204,8 @@ EXTERN(boolean) jpeg_fill_bit_buffer
result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \ result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
} else { \ } else { \
slowlabel: \ slowlabel: \
if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ if ((result = \
jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
{ failaction; } \ { failaction; } \
get_buffer = state.get_buffer; bits_left = state.bits_left; \ get_buffer = state.get_buffer; bits_left = state.bits_left; \
} \ } \
@@ -229,6 +232,7 @@ slowlabel: \
} }
/* Out-of-line case for Huffman code fetching */ /* Out-of-line case for Huffman code fetching */
EXTERN(int) jpeg_huff_decode EXTERN(int) jpeg_huff_decode(bitread_working_state *state,
(bitread_working_state *state, register bit_buf_type get_buffer, register bit_buf_type get_buffer,
register int bits_left, d_derived_tbl *htbl, int min_bits); register int bits_left, d_derived_tbl *htbl,
int min_bits);

View File

@@ -66,8 +66,10 @@ initial_setup (j_decompress_ptr cinfo)
cinfo->max_v_samp_factor = 1; cinfo->max_v_samp_factor = 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || if (compptr->h_samp_factor <= 0 ||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) compptr->h_samp_factor > MAX_SAMP_FACTOR ||
compptr->v_samp_factor <= 0 ||
compptr->v_samp_factor > MAX_SAMP_FACTOR)
ERREXIT(cinfo, JERR_BAD_SAMPLING); ERREXIT(cinfo, JERR_BAD_SAMPLING);
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
compptr->h_samp_factor); compptr->h_samp_factor);
@@ -198,7 +200,8 @@ per_scan_setup (j_decompress_ptr cinfo)
compptr->MCU_width = compptr->h_samp_factor; compptr->MCU_width = compptr->h_samp_factor;
compptr->MCU_height = compptr->v_samp_factor; compptr->MCU_height = compptr->v_samp_factor;
compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
compptr->MCU_sample_width = compptr->MCU_width * compptr->_DCT_scaled_size; compptr->MCU_sample_width = compptr->MCU_width *
compptr->_DCT_scaled_size;
/* Figure number of non-dummy blocks in last MCU column & row */ /* Figure number of non-dummy blocks in last MCU column & row */
tmp = (int)(compptr->width_in_blocks % compptr->MCU_width); tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
if (tmp == 0) tmp = compptr->MCU_width; if (tmp == 0) tmp = compptr->MCU_width;

View File

@@ -112,16 +112,19 @@
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) process_data_simple_main METHODDEF(void) process_data_simple_main(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); JDIMENSION *out_row_ctr,
METHODDEF(void) process_data_context_main JDIMENSION out_rows_avail);
(j_decompress_ptr cinfo, JSAMPARRAY output_buf, METHODDEF(void) process_data_context_main(j_decompress_ptr cinfo,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail);
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void) process_data_crank_post METHODDEF(void) process_data_crank_post(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail);
#endif #endif
@@ -286,9 +289,8 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
process_data_simple_main (j_decompress_ptr cinfo, process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
JDIMENSION rowgroups_avail; JDIMENSION rowgroups_avail;
@@ -326,9 +328,8 @@ process_data_simple_main (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
process_data_context_main (j_decompress_ptr cinfo, process_data_context_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
@@ -349,9 +350,11 @@ process_data_context_main (j_decompress_ptr cinfo,
switch (main_ptr->context_state) { switch (main_ptr->context_state) {
case CTX_POSTPONED_ROW: case CTX_POSTPONED_ROW:
/* Call postprocessor using previously set pointers for postponed row */ /* Call postprocessor using previously set pointers for postponed row */
(*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], (*cinfo->post->post_process_data) (cinfo,
&main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, main_ptr->xbuffer[main_ptr->whichptr],
output_buf, out_row_ctr, out_rows_avail); &main_ptr->rowgroup_ctr,
main_ptr->rowgroups_avail, output_buf,
out_row_ctr, out_rows_avail);
if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */ return; /* Need to suspend */
main_ptr->context_state = CTX_PREPARE_FOR_IMCU; main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
@@ -371,9 +374,11 @@ process_data_context_main (j_decompress_ptr cinfo,
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case CTX_PROCESS_IMCU: case CTX_PROCESS_IMCU:
/* Call postprocessor using previously set pointers */ /* Call postprocessor using previously set pointers */
(*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], (*cinfo->post->post_process_data) (cinfo,
&main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, main_ptr->xbuffer[main_ptr->whichptr],
output_buf, out_row_ctr, out_rows_avail); &main_ptr->rowgroup_ctr,
main_ptr->rowgroups_avail, output_buf,
out_row_ctr, out_rows_avail);
if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */ return; /* Need to suspend */
/* After the first iMCU, change wraparound pointers to normal state */ /* After the first iMCU, change wraparound pointers to normal state */
@@ -400,9 +405,8 @@ process_data_context_main (j_decompress_ptr cinfo,
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void) METHODDEF(void)
process_data_crank_post (j_decompress_ptr cinfo, process_data_crank_post(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
(*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE)NULL, (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE)NULL,
(JDIMENSION *)NULL, (JDIMENSION)0, (JDIMENSION *)NULL, (JDIMENSION)0,

View File

@@ -267,8 +267,8 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
/* We don't support files in which the image height is initially specified */ /* We don't support files in which the image height is initially specified */
/* as 0 and is later redefined by DNL. As long as we have to check that, */ /* as 0 and is later redefined by DNL. As long as we have to check that, */
/* might as well have a general sanity check. */ /* might as well have a general sanity check. */
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|| cinfo->num_components <= 0) cinfo->num_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
if (length != (cinfo->num_components * 3)) if (length != (cinfo->num_components * 3))
@@ -598,8 +598,8 @@ get_dri (j_decompress_ptr cinfo)
LOCAL(void) LOCAL(void)
examine_app0 (j_decompress_ptr cinfo, JOCTET *data, examine_app0(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
unsigned int datalen, JLONG remaining) JLONG remaining)
/* Examine first few bytes from an APP0. /* Examine first few bytes from an APP0.
* Take appropriate action if it is a JFIF marker. * Take appropriate action if it is a JFIF marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data. * datalen is # of bytes at data[], remaining is length of rest of marker data.
@@ -674,8 +674,8 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET *data,
LOCAL(void) LOCAL(void)
examine_app14 (j_decompress_ptr cinfo, JOCTET *data, examine_app14(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
unsigned int datalen, JLONG remaining) JLONG remaining)
/* Examine first few bytes from an APP14. /* Examine first few bytes from an APP14.
* Take appropriate action if it is an Adobe marker. * Take appropriate action if it is an Adobe marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data. * datalen is # of bytes at data[], remaining is length of rest of marker data.

View File

@@ -469,7 +469,8 @@ master_selection (j_decompress_ptr cinfo)
prepare_range_limit_table(cinfo); prepare_range_limit_table(cinfo);
/* Width of an output scanline must be representable as JDIMENSION. */ /* Width of an output scanline must be representable as JDIMENSION. */
samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; samplesperrow = (long)cinfo->output_width *
(long)cinfo->out_color_components;
jd_samplesperrow = (JDIMENSION)samplesperrow; jd_samplesperrow = (JDIMENSION)samplesperrow;
if ((long)jd_samplesperrow != samplesperrow) if ((long)jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);

View File

@@ -248,11 +248,10 @@ start_pass_merged_upsample (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
merged_2v_upsample (j_decompress_ptr cinfo, merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */ /* 2:1 vertical sampling case: may need a spare row. */
{ {
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
@@ -264,8 +263,8 @@ merged_2v_upsample (j_decompress_ptr cinfo,
JDIMENSION size = upsample->out_row_width; JDIMENSION size = upsample->out_row_width;
if (cinfo->out_color_space == JCS_RGB565) if (cinfo->out_color_space == JCS_RGB565)
size = cinfo->output_width * 2; size = cinfo->output_width * 2;
jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, jcopy_sample_rows(&upsample->spare_row, 0, output_buf + *out_row_ctr, 0, 1,
1, size); size);
num_rows = 1; num_rows = 1;
upsample->spare_full = FALSE; upsample->spare_full = FALSE;
} else { } else {
@@ -300,11 +299,10 @@ merged_2v_upsample (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
merged_1v_upsample (j_decompress_ptr cinfo, merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */ /* 1:1 vertical sampling case: much easier, never need a spare row. */
{ {
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
@@ -333,9 +331,8 @@ merged_1v_upsample (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
h2v1_merged_upsample (j_decompress_ptr cinfo, h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -379,9 +376,8 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample (j_decompress_ptr cinfo, h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -510,9 +506,8 @@ static INLINE boolean is_big_endian(void)
METHODDEF(void) METHODDEF(void)
h2v1_merged_upsample_565 (j_decompress_ptr cinfo, h2v1_merged_upsample_565(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v1_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr, h2v1_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr,
@@ -524,9 +519,8 @@ h2v1_merged_upsample_565 (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
h2v1_merged_upsample_565D (j_decompress_ptr cinfo, h2v1_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v1_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr, h2v1_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr,
@@ -538,9 +532,8 @@ h2v1_merged_upsample_565D (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample_565 (j_decompress_ptr cinfo, h2v2_merged_upsample_565(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v2_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr, h2v2_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr,
@@ -552,9 +545,8 @@ h2v2_merged_upsample_565 (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample_565D (j_decompress_ptr cinfo, h2v2_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v2_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr, h2v2_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr,

View File

@@ -15,8 +15,7 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo, h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
@@ -160,8 +159,7 @@ h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo, h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {

View File

@@ -21,8 +21,7 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v1_merged_upsample_internal (j_decompress_ptr cinfo, h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
@@ -94,8 +93,7 @@ h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v2_merged_upsample_internal (j_decompress_ptr cinfo, h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {

View File

@@ -206,21 +206,25 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo)
#ifdef AVOID_TABLES #ifdef AVOID_TABLES
#define NEG_1 ((unsigned)-1) #define NEG_1 ((unsigned)-1)
#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((NEG_1)<<(s)) + 1) : (x)) #define HUFF_EXTEND(x, s) \
((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
#else #else
#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) #define HUFF_EXTEND(x, s) \
((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
static const int extend_test[16] = /* entry n is 2**(n-1) */ static const int extend_test[16] = { /* entry n is 2**(n-1) */
{ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
};
static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
{ 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1, ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1,
((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1, ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1,
((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1
};
#endif /* AVOID_TABLES */ #endif /* AVOID_TABLES */
@@ -664,7 +668,8 @@ jinit_phuff_decoder (j_decompress_ptr cinfo)
/* Create progression status table */ /* Create progression status table */
cinfo->coef_bits = (int (*)[DCTSIZE2]) cinfo->coef_bits = (int (*)[DCTSIZE2])
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components*DCTSIZE2*sizeof(int)); cinfo->num_components * DCTSIZE2 *
sizeof(int));
coef_bit_ptr = &cinfo->coef_bits[0][0]; coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++) for (i = 0; i < DCTSIZE2; i++)

View File

@@ -46,21 +46,27 @@ typedef my_post_controller *my_post_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) post_process_1pass METHODDEF(void) post_process_1pass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JDIMENSION *in_row_group_ctr,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail); JDIMENSION out_rows_avail);
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void) post_process_prepass METHODDEF(void) post_process_prepass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JDIMENSION *in_row_group_ctr,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail); JDIMENSION out_rows_avail);
METHODDEF(void) post_process_2pass METHODDEF(void) post_process_2pass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JDIMENSION *in_row_group_ctr,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail); JDIMENSION out_rows_avail);
#endif #endif
@@ -123,11 +129,10 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
post_process_1pass (j_decompress_ptr cinfo, post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_post_ptr post = (my_post_ptr)cinfo->post; my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION num_rows, max_rows; JDIMENSION num_rows, max_rows;
@@ -138,12 +143,13 @@ post_process_1pass (j_decompress_ptr cinfo,
if (max_rows > post->strip_height) if (max_rows > post->strip_height)
max_rows = post->strip_height; max_rows = post->strip_height;
num_rows = 0; num_rows = 0;
(*cinfo->upsample->upsample) (cinfo, (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr,
input_buf, in_row_group_ctr, in_row_groups_avail, in_row_groups_avail, post->buffer, &num_rows,
post->buffer, &num_rows, max_rows); max_rows);
/* Quantize and emit data. */ /* Quantize and emit data. */
(*cinfo->cquantize->color_quantize) (cinfo, (*cinfo->cquantize->color_quantize) (cinfo, post->buffer,
post->buffer, output_buf + *out_row_ctr, (int) num_rows); output_buf + *out_row_ctr,
(int)num_rows);
*out_row_ctr += num_rows; *out_row_ctr += num_rows;
} }
@@ -155,11 +161,10 @@ post_process_1pass (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
post_process_prepass (j_decompress_ptr cinfo, post_process_prepass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_post_ptr post = (my_post_ptr)cinfo->post; my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION old_next_row, num_rows; JDIMENSION old_next_row, num_rows;
@@ -173,9 +178,9 @@ post_process_prepass (j_decompress_ptr cinfo,
/* Upsample some data (up to a strip height's worth). */ /* Upsample some data (up to a strip height's worth). */
old_next_row = post->next_row; old_next_row = post->next_row;
(*cinfo->upsample->upsample) (cinfo, (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr,
input_buf, in_row_group_ctr, in_row_groups_avail, in_row_groups_avail, post->buffer,
post->buffer, &post->next_row, post->strip_height); &post->next_row, post->strip_height);
/* Allow quantizer to scan new data. No data is emitted, */ /* Allow quantizer to scan new data. No data is emitted, */
/* but we advance out_row_ctr so outer loop can tell when we're done. */ /* but we advance out_row_ctr so outer loop can tell when we're done. */
@@ -199,11 +204,10 @@ post_process_prepass (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
post_process_2pass (j_decompress_ptr cinfo, post_process_2pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_post_ptr post = (my_post_ptr)cinfo->post; my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION num_rows, max_rows; JDIMENSION num_rows, max_rows;
@@ -226,8 +230,8 @@ post_process_2pass (j_decompress_ptr cinfo,
num_rows = max_rows; num_rows = max_rows;
/* Quantize and emit data. */ /* Quantize and emit data. */
(*cinfo->cquantize->color_quantize) (cinfo, (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + post->next_row,
post->buffer + post->next_row, output_buf + *out_row_ctr, output_buf + *out_row_ctr,
(int)num_rows); (int)num_rows);
*out_row_ctr += num_rows; *out_row_ctr += num_rows;

View File

@@ -56,9 +56,8 @@ start_pass_upsample (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
sep_upsample (j_decompress_ptr cinfo, sep_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail,
JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail) JDIMENSION out_rows_avail)
{ {
@@ -97,8 +96,7 @@ sep_upsample (j_decompress_ptr cinfo,
(*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf, (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
(JDIMENSION)upsample->next_row_out, (JDIMENSION)upsample->next_row_out,
output_buf + *out_row_ctr, output_buf + *out_row_ctr, (int)num_rows);
(int) num_rows);
/* Adjust counts */ /* Adjust counts */
*out_row_ctr += num_rows; *out_row_ctr += num_rows;
@@ -247,8 +245,8 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*outptr++ = invalue; *outptr++ = invalue;
*outptr++ = invalue; *outptr++ = invalue;
} }
jcopy_sample_rows(output_data, outrow, output_data, outrow+1, jcopy_sample_rows(output_data, outrow, output_data, outrow + 1, 1,
1, cinfo->output_width); cinfo->output_width);
inrow++; inrow++;
outrow += 2; outrow += 2;
} }
@@ -459,8 +457,7 @@ jinit_upsampler (j_decompress_ptr cinfo)
/* Fullsize components can be processed without any work. */ /* Fullsize components can be processed without any work. */
upsample->methods[ci] = fullsize_upsample; upsample->methods[ci] = fullsize_upsample;
need_buffer = FALSE; need_buffer = FALSE;
} else if (h_in_group * 2 == h_out_group && } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
v_in_group == v_out_group) {
/* Special cases for 2h1v upsampling */ /* Special cases for 2h1v upsampling */
if (do_fancy && compptr->downsampled_width > 2) { if (do_fancy && compptr->downsampled_width > 2) {
if (jsimd_can_h2v1_fancy_upsample()) if (jsimd_can_h2v1_fancy_upsample())

View File

@@ -44,8 +44,7 @@ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */ /* For maintenance convenience, list is alphabetical by message code name */
#if JPEG_LIB_VERSION < 70 #if JPEG_LIB_VERSION < 70
JMESSAGE(JERR_ARITH_NOTIMPL, JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented")
"Sorry, arithmetic coding is not implemented")
#endif #endif
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
@@ -154,8 +153,7 @@ JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
"Warning: thumbnail image size does not match data length %u") "Warning: thumbnail image size does not match data length %u")
JMESSAGE(JTRC_JFIF_EXTENSION, JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u")
"JFIF extension marker: type 0x%02x, length %u")
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")

View File

@@ -242,9 +242,11 @@ jpeg_fdct_islow (DCTELEM *data)
dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS); dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), dataptr[DCTSIZE * 2] =
(DCTELEM)DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS + PASS1_BITS); CONST_BITS + PASS1_BITS);
dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), dataptr[DCTSIZE * 6] =
(DCTELEM)DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),
CONST_BITS + PASS1_BITS); CONST_BITS + PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2). /* Odd part per figure 8 --- note paper omits factor of sqrt(2).

View File

@@ -70,8 +70,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FAST_FLOAT tmp10, tmp11, tmp12, tmp13; FAST_FLOAT tmp10, tmp11, tmp12, tmp13;

View File

@@ -169,8 +169,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
DCTELEM tmp10, tmp11, tmp12, tmp13; DCTELEM tmp10, tmp11, tmp12, tmp13;
@@ -296,8 +296,8 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) JSAMPLE dcval =
& RANGE_MASK]; range_limit[IDESCALE(wsptr[0], PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -319,8 +319,8 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp11 = ((DCTELEM)wsptr[0] - (DCTELEM)wsptr[4]); tmp11 = ((DCTELEM)wsptr[0] - (DCTELEM)wsptr[4]);
tmp13 = ((DCTELEM)wsptr[2] + (DCTELEM)wsptr[6]); tmp13 = ((DCTELEM)wsptr[2] + (DCTELEM)wsptr[6]);
tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) tmp12 =
- tmp13; MULTIPLY((DCTELEM)wsptr[2] - (DCTELEM)wsptr[6], FIX_1_414213562) - tmp13;
tmp0 = tmp10 + tmp13; tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
@@ -347,22 +347,22 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: scale down by a factor of 8 and range-limit */ /* Final output stage: scale down by a factor of 8 and range-limit */
outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) outptr[0] =
& RANGE_MASK]; range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS + 3) & RANGE_MASK];
outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) outptr[7] =
& RANGE_MASK]; range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS + 3) & RANGE_MASK];
outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) outptr[1] =
& RANGE_MASK]; range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS + 3) & RANGE_MASK];
outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) outptr[6] =
& RANGE_MASK]; range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS + 3) & RANGE_MASK];
outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) outptr[2] =
& RANGE_MASK]; range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS + 3) & RANGE_MASK];
outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) outptr[5] =
& RANGE_MASK]; range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS + 3) & RANGE_MASK];
outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) outptr[4] =
& RANGE_MASK]; range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS + 3) & RANGE_MASK];
outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) outptr[3] =
& RANGE_MASK]; range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS + 3) & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }

View File

@@ -171,8 +171,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp3; JLONG tmp0, tmp1, tmp2, tmp3;
JLONG tmp10, tmp11, tmp12, tmp13; JLONG tmp10, tmp11, tmp12, tmp13;
@@ -208,8 +208,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
inptr[DCTSIZE * 7] == 0) { inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
PASS1_BITS); quantptr[DCTSIZE * 0]), PASS1_BITS);
wsptr[DCTSIZE * 0] = dcval; wsptr[DCTSIZE * 0] = dcval;
wsptr[DCTSIZE * 1] = dcval; wsptr[DCTSIZE * 1] = dcval;
@@ -314,8 +314,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
& RANGE_MASK]; PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -384,29 +384,29 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3, outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3, outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2, outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2, outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1, outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1, outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0, outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0, outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
@@ -425,8 +425,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_7x7(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_7x7(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13; JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13;
JLONG z1, z2, z3; JLONG z1, z2, z3;
@@ -538,26 +538,26 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 7; /* advance pointer to next row */ wsptr += 7; /* advance pointer to next row */
} }
@@ -574,8 +574,8 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12;
JLONG z1, z2, z3; JLONG z1, z2, z3;
@@ -662,23 +662,23 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 6; /* advance pointer to next row */ wsptr += 6; /* advance pointer to next row */
} }
@@ -695,8 +695,8 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_5x5(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_5x5(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp10, tmp11, tmp12; JLONG tmp0, tmp1, tmp10, tmp11, tmp12;
JLONG z1, z2, z3; JLONG z1, z2, z3;
@@ -780,20 +780,20 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 5; /* advance pointer to next row */ wsptr += 5; /* advance pointer to next row */
} }
@@ -810,8 +810,8 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_3x3(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_3x3(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp2, tmp10, tmp12; JLONG tmp0, tmp2, tmp10, tmp12;
JCOEFPTR inptr; JCOEFPTR inptr;
@@ -876,14 +876,14 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp2, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 3; /* advance pointer to next row */ wsptr += 3; /* advance pointer to next row */
} }
@@ -900,8 +900,8 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_9x9(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_9x9(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14; JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG z1, z2, z3, z4; JLONG z1, z2, z3, z4;
@@ -1029,32 +1029,32 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13 + tmp3, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp13 - tmp3, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp13 - tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1071,8 +1071,8 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_10x10(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_10x10(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14; JLONG tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24; JLONG tmp20, tmp21, tmp22, tmp23, tmp24;
@@ -1221,35 +1221,35 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1266,8 +1266,8 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_11x11(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_11x11(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14; JLONG tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25;
@@ -1412,38 +1412,38 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1460,8 +1460,8 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25;
@@ -1625,41 +1625,41 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1676,8 +1676,8 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_13x13(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_13x13(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26;
@@ -1850,44 +1850,44 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1904,8 +1904,8 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_14x14(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_14x14(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26;
@@ -2073,47 +2073,47 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -2130,8 +2130,8 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_15x15(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_15x15(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27;
@@ -2312,50 +2312,50 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -2372,8 +2372,8 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_16x16(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_16x16(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27;
@@ -2571,53 +2571,53 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[15] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp0, outptr[15] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp1, outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp2, outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp3, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp3, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp10, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp10, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp11, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp11, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp12, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp12, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27 + tmp13, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp27 - tmp13, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp27 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }

View File

@@ -119,8 +119,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp2, tmp10, tmp12; JLONG tmp0, tmp2, tmp10, tmp12;
JLONG z1, z2, z3, z4; JLONG z1, z2, z3, z4;
@@ -146,8 +146,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 5] == 0 &&
inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 7] == 0) { inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero; we need not examine term 4 for 4x4 output */ /* AC terms all zero; we need not examine term 4 for 4x4 output */
int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
PASS1_BITS); quantptr[DCTSIZE * 0]), PASS1_BITS);
wsptr[DCTSIZE * 0] = dcval; wsptr[DCTSIZE * 0] = dcval;
wsptr[DCTSIZE * 1] = dcval; wsptr[DCTSIZE * 1] = dcval;
@@ -177,22 +177,26 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z3 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]); z3 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
z4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]); z4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, -FIX_0_211164243) + /* sqrt(2) * ( c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ MULTIPLY(z2, FIX_1_451774981) + /* sqrt(2) * ( c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ MULTIPLY(z3, -FIX_2_172734803) + /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * ( c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ tmp2 = MULTIPLY(z1, -FIX_0_509795579) + /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ MULTIPLY(z2, -FIX_0_601344887) + /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ MULTIPLY(z3, FIX_0_899976223) + /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */ /* Final output stage */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE * 0] =
wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); (int)DESCALE(tmp10 + tmp2, CONST_BITS - PASS1_BITS + 1);
wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE * 3] =
wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); (int)DESCALE(tmp10 - tmp2, CONST_BITS - PASS1_BITS + 1);
wsptr[DCTSIZE * 1] =
(int)DESCALE(tmp12 + tmp0, CONST_BITS - PASS1_BITS + 1);
wsptr[DCTSIZE * 2] =
(int)DESCALE(tmp12 - tmp0, CONST_BITS - PASS1_BITS + 1);
} }
/* Pass 2: process 4 rows from work array, store into output array. */ /* Pass 2: process 4 rows from work array, store into output array. */
@@ -206,8 +210,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
& RANGE_MASK]; PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -223,8 +227,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp0 = LEFT_SHIFT((JLONG)wsptr[0], CONST_BITS + 1); tmp0 = LEFT_SHIFT((JLONG)wsptr[0], CONST_BITS + 1);
tmp2 = MULTIPLY((JLONG) wsptr[2], FIX_1_847759065) tmp2 = MULTIPLY((JLONG)wsptr[2], FIX_1_847759065) +
+ MULTIPLY((JLONG) wsptr[6], - FIX_0_765366865); MULTIPLY((JLONG)wsptr[6], -FIX_0_765366865);
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2; tmp12 = tmp0 - tmp2;
@@ -236,30 +240,30 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z3 = (JLONG)wsptr[3]; z3 = (JLONG)wsptr[3];
z4 = (JLONG)wsptr[1]; z4 = (JLONG)wsptr[1];
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, -FIX_0_211164243) + /* sqrt(2) * ( c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ MULTIPLY(z2, FIX_1_451774981) + /* sqrt(2) * ( c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ MULTIPLY(z3, -FIX_2_172734803) + /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * ( c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ tmp2 = MULTIPLY(z1, -FIX_0_509795579) + /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ MULTIPLY(z2, -FIX_0_601344887) + /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ MULTIPLY(z3, FIX_0_899976223) + /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp2, outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp2,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)DESCALE(tmp10 - tmp2, outptr[3] = range_limit[(int)DESCALE(tmp10 - tmp2,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)DESCALE(tmp12 + tmp0, outptr[1] = range_limit[(int)DESCALE(tmp12 + tmp0,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)DESCALE(tmp12 - tmp0, outptr[2] = range_limit[(int)DESCALE(tmp12 - tmp0,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
@@ -273,8 +277,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp10, z1; JLONG tmp0, tmp10, z1;
JCOEFPTR inptr; JCOEFPTR inptr;
@@ -298,8 +302,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 3] == 0 && if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 3] == 0 &&
inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 7] == 0) { inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
PASS1_BITS); quantptr[DCTSIZE * 0]), PASS1_BITS);
wsptr[DCTSIZE * 0] = dcval; wsptr[DCTSIZE * 0] = dcval;
wsptr[DCTSIZE * 1] = dcval; wsptr[DCTSIZE * 1] = dcval;
@@ -325,8 +329,10 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); wsptr[DCTSIZE * 0] =
wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); (int)DESCALE(tmp10 + tmp0, CONST_BITS - PASS1_BITS + 2);
wsptr[DCTSIZE * 1] =
(int)DESCALE(tmp10 - tmp0, CONST_BITS - PASS1_BITS + 2);
} }
/* Pass 2: process 2 rows from work array, store into output array. */ /* Pass 2: process 2 rows from work array, store into output array. */
@@ -339,8 +345,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
#ifndef NO_ZERO_ROW_TEST #ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
& RANGE_MASK]; PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -356,19 +362,19 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */ /* Odd part */
tmp0 = MULTIPLY((JLONG) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ tmp0 = MULTIPLY((JLONG)wsptr[7], -FIX_0_720959822) + /* sqrt(2) * ( c7-c5+c3-c1) */
+ MULTIPLY((JLONG) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ MULTIPLY((JLONG)wsptr[5], FIX_0_850430095) + /* sqrt(2) * (-c1+c3+c5+c7) */
+ MULTIPLY((JLONG) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ MULTIPLY((JLONG)wsptr[3], -FIX_1_272758580) + /* sqrt(2) * (-c1+c3-c5-c7) */
+ MULTIPLY((JLONG) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ MULTIPLY((JLONG)wsptr[1], FIX_3_624509785); /* sqrt(2) * ( c1+c3+c5+c7) */
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp0, outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3+2) CONST_BITS + PASS1_BITS + 3 + 2) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)DESCALE(tmp10 - tmp0, outptr[1] = range_limit[(int)DESCALE(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3+2) CONST_BITS + PASS1_BITS + 3 + 2) &
& RANGE_MASK]; RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
@@ -382,8 +388,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_1x1(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_1x1(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
int dcval; int dcval;
ISLOW_MULT_TYPE *quantptr; ISLOW_MULT_TYPE *quantptr;

View File

@@ -61,14 +61,18 @@
#ifdef NEED_BSD_STRINGS #ifdef NEED_BSD_STRINGS
#include <strings.h> #include <strings.h>
#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) #define MEMZERO(target, size) \
#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) bzero((void *)(target), (size_t)(size))
#define MEMCOPY(dest, src, size) \
bcopy((const void *)(src), (void *)(dest), (size_t)(size))
#else /* not BSD, assume ANSI/SysV string lib */ #else /* not BSD, assume ANSI/SysV string lib */
#include <string.h> #include <string.h>
#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) #define MEMZERO(target, size) \
#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) memset((void *)(target), 0, (size_t)(size))
#define MEMCOPY(dest, src, size) \
memcpy((void *)(dest), (const void *)(src), (size_t)(size))
#endif #endif

View File

@@ -208,15 +208,13 @@ print_mem_stats (j_common_ptr cinfo, int pool_id)
for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
lhdr_ptr = lhdr_ptr->next) { lhdr_ptr = lhdr_ptr->next) {
fprintf(stderr, " Large chunk used %ld\n", fprintf(stderr, " Large chunk used %ld\n", (long)lhdr_ptr->bytes_used);
(long) lhdr_ptr->bytes_used);
} }
for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;
shdr_ptr = shdr_ptr->next) { shdr_ptr = shdr_ptr->next) {
fprintf(stderr, " Small chunk used %ld free %ld\n", fprintf(stderr, " Small chunk used %ld free %ld\n",
(long) shdr_ptr->bytes_used, (long)shdr_ptr->bytes_used, (long)shdr_ptr->bytes_left);
(long) shdr_ptr->bytes_left);
} }
} }
@@ -252,14 +250,12 @@ out_of_memory (j_common_ptr cinfo, int which)
* adjustment. * adjustment.
*/ */
static const size_t first_pool_slop[JPOOL_NUMPOOLS] = static const size_t first_pool_slop[JPOOL_NUMPOOLS] = {
{
1600, /* first PERMANENT pool */ 1600, /* first PERMANENT pool */
16000 /* first IMAGE pool */ 16000 /* first IMAGE pool */
}; };
static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = {
{
0, /* additional PERMANENT pools */ 0, /* additional PERMANENT pools */
5000 /* additional IMAGE pools */ 5000 /* additional IMAGE pools */
}; };
@@ -435,8 +431,8 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
*/ */
METHODDEF(JSAMPARRAY) METHODDEF(JSAMPARRAY)
alloc_sarray (j_common_ptr cinfo, int pool_id, alloc_sarray(j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow,
JDIMENSION samplesperrow, JDIMENSION numrows) JDIMENSION numrows)
/* Allocate a 2-D sample array */ /* Allocate a 2-D sample array */
{ {
my_mem_ptr mem = (my_mem_ptr)cinfo->mem; my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
@@ -477,8 +473,8 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
while (currow < numrows) { while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow); rowsperchunk = MIN(rowsperchunk, numrows - currow);
workspace = (JSAMPROW)alloc_large(cinfo, pool_id, workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
(size_t) ((size_t) rowsperchunk * (size_t) samplesperrow (size_t)((size_t)rowsperchunk * (size_t)samplesperrow *
* sizeof(JSAMPLE))); sizeof(JSAMPLE)));
for (i = rowsperchunk; i > 0; i--) { for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace; result[currow++] = workspace;
workspace += samplesperrow; workspace += samplesperrow;
@@ -495,8 +491,8 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
*/ */
METHODDEF(JBLOCKARRAY) METHODDEF(JBLOCKARRAY)
alloc_barray (j_common_ptr cinfo, int pool_id, alloc_barray(j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow,
JDIMENSION blocksperrow, JDIMENSION numrows) JDIMENSION numrows)
/* Allocate a 2-D coefficient-block array */ /* Allocate a 2-D coefficient-block array */
{ {
my_mem_ptr mem = (my_mem_ptr)cinfo->mem; my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
@@ -529,8 +525,8 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
while (currow < numrows) { while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow); rowsperchunk = MIN(rowsperchunk, numrows - currow);
workspace = (JBLOCKROW)alloc_large(cinfo, pool_id, workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
(size_t) ((size_t) rowsperchunk * (size_t) blocksperrow (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
* sizeof(JBLOCK))); sizeof(JBLOCK)));
for (i = rowsperchunk; i > 0; i--) { for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace; result[currow++] = workspace;
workspace += blocksperrow; workspace += blocksperrow;
@@ -821,8 +817,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
METHODDEF(JSAMPARRAY) METHODDEF(JSAMPARRAY)
access_virt_sarray(j_common_ptr cinfo, jvirt_sarray_ptr ptr, access_virt_sarray(j_common_ptr cinfo, jvirt_sarray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
boolean writable)
/* Access the part of a virtual sample array starting at start_row */ /* Access the part of a virtual sample array starting at start_row */
/* and extending for num_rows rows. writable is true if */ /* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */ /* caller intends to modify the accessed area. */
@@ -906,8 +901,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
METHODDEF(JBLOCKARRAY) METHODDEF(JBLOCKARRAY)
access_virt_barray(j_common_ptr cinfo, jvirt_barray_ptr ptr, access_virt_barray(j_common_ptr cinfo, jvirt_barray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
boolean writable)
/* Access the part of a virtual block array starting at start_row */ /* Access the part of a virtual block array starting at start_row */
/* and extending for num_rows rows. writable is true if */ /* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */ /* caller intends to modify the accessed area. */
@@ -1050,8 +1044,7 @@ free_pool (j_common_ptr cinfo, int pool_id)
while (shdr_ptr != NULL) { while (shdr_ptr != NULL) {
small_pool_ptr next_shdr_ptr = shdr_ptr->next; small_pool_ptr next_shdr_ptr = shdr_ptr->next;
space_freed = shdr_ptr->bytes_used + space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
shdr_ptr->bytes_left +
sizeof(small_pool_hdr); sizeof(small_pool_hdr);
jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed); jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
mem->total_space_allocated -= space_freed; mem->total_space_allocated -= space_freed;
@@ -1168,7 +1161,8 @@ jinit_memory_mgr (j_common_ptr cinfo)
* this feature. * this feature.
*/ */
#ifndef NO_GETENV #ifndef NO_GETENV
{ char *memenv; {
char *memenv;
if ((memenv = getenv("JPEGMEM")) != NULL) { if ((memenv = getenv("JPEGMEM")) != NULL) {
char ch = 'x'; char ch = 'x';

View File

@@ -921,8 +921,7 @@ EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile);
EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer, EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
unsigned long *outsize); unsigned long *outsize);
EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo, EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo,
const unsigned char *inbuffer, const unsigned char *inbuffer, unsigned long insize);
unsigned long insize);
#endif #endif
/* Default parameter setup for compression */ /* Default parameter setup for compression */

View File

@@ -233,7 +233,8 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
else else
usage(); usage();
} else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) { } else if (keymatch(arg, "grayscale", 1) ||
keymatch(arg, "greyscale", 1)) {
/* Force to grayscale. */ /* Force to grayscale. */
#if TRANSFORMS_SUPPORTED #if TRANSFORMS_SUPPORTED
transformoption.force_grayscale = TRUE; transformoption.force_grayscale = TRUE;
@@ -453,7 +454,8 @@ main (int argc, char **argv)
/* Open the input file. */ /* Open the input file. */
if (file_index < argc) { if (file_index < argc) {
if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) { if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) {
fprintf(stderr, "%s: can't open %s for reading\n", progname, argv[file_index]); fprintf(stderr, "%s: can't open %s for reading\n", progname,
argv[file_index]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} else { } else {
@@ -545,7 +547,8 @@ main (int argc, char **argv)
/* Open the output file. */ /* Open the output file. */
if (outfilename != NULL) { if (outfilename != NULL) {
if ((fp = fopen(outfilename, WRITE_BINARY)) == NULL) { if ((fp = fopen(outfilename, WRITE_BINARY)) == NULL) {
fprintf(stderr, "%s: can't open %s for writing\n", progname, outfilename); fprintf(stderr, "%s: can't open %s for writing\n", progname,
outfilename);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} else { } else {
@@ -570,8 +573,7 @@ main (int argc, char **argv)
/* Execute image transformation, if any */ /* Execute image transformation, if any */
#if TRANSFORMS_SUPPORTED #if TRANSFORMS_SUPPORTED
jtransform_execute_transformation(&srcinfo, &dstinfo, jtransform_execute_transformation(&srcinfo, &dstinfo, src_coef_arrays,
src_coef_arrays,
&transformoption); &transformoption);
#endif #endif
@@ -593,6 +595,7 @@ main (int argc, char **argv)
free(icc_profile); free(icc_profile);
/* All done. */ /* All done. */
exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); exit(jsrcerr.num_warnings + jdsterr.num_warnings ?
EXIT_WARNING : EXIT_SUCCESS);
return 0; /* suppress no-return-value warnings */ return 0; /* suppress no-return-value warnings */
} }

View File

@@ -285,9 +285,9 @@ create_colormap (j_decompress_ptr cinfo)
/* Report selected color counts */ /* Report selected color counts */
if (cinfo->out_color_components == 3) if (cinfo->out_color_components == 3)
TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, total_colors,
total_colors, cquantize->Ncolors[0], cquantize->Ncolors[0], cquantize->Ncolors[1],
cquantize->Ncolors[1], cquantize->Ncolors[2]); cquantize->Ncolors[2]);
else else
TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors); TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
@@ -413,8 +413,8 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors)
den = 2 * ODITHER_CELLS * ((JLONG)(ncolors - 1)); den = 2 * ODITHER_CELLS * ((JLONG)(ncolors - 1));
for (j = 0; j < ODITHER_SIZE; j++) { for (j = 0; j < ODITHER_SIZE; j++) {
for (k = 0; k < ODITHER_SIZE; k++) { for (k = 0; k < ODITHER_SIZE; k++) {
num = ((JLONG) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) num = ((JLONG)(ODITHER_CELLS - 1 -
* MAXJSAMPLE; 2 * ((int)base_dither_matrix[j][k]))) * MAXJSAMPLE;
/* Ensure round towards zero despite C's lack of consistency /* Ensure round towards zero despite C's lack of consistency
* about rounding negative values in integer division... * about rounding negative values in integer division...
*/ */
@@ -550,7 +550,8 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* inputs. The maximum dither is +- MAXJSAMPLE; this sets the * inputs. The maximum dither is +- MAXJSAMPLE; this sets the
* required amount of padding. * required amount of padding.
*/ */
*output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; *output_ptr +=
colorindex_ci[GETJSAMPLE(*input_ptr) + dither[col_index]];
input_ptr += nc; input_ptr += nc;
output_ptr++; output_ptr++;
col_index = (col_index + 1) & ODITHER_MASK; col_index = (col_index + 1) & ODITHER_MASK;
@@ -593,12 +594,12 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
col_index = 0; col_index = 0;
for (col = width; col > 0; col--) { for (col = width; col > 0; col--) {
pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + pixcode =
dither0[col_index]]); GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + dither0[col_index]]);
pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + pixcode +=
dither1[col_index]]); GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + dither1[col_index]]);
pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + pixcode +=
dither2[col_index]]); GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + dither2[col_index]]);
*output_ptr++ = (JSAMPLE)pixcode; *output_ptr++ = (JSAMPLE)pixcode;
col_index = (col_index + 1) & ODITHER_MASK; col_index = (col_index + 1) & ODITHER_MASK;
} }

View File

@@ -437,8 +437,7 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
cmax = c1; n = 1; cmax = c1; n = 1;
if (c0 > cmax) { cmax = c0; n = 0; } if (c0 > cmax) { cmax = c0; n = 0; }
if (c2 > cmax) { n = 2; } if (c2 > cmax) { n = 2; }
} } else {
else {
cmax = c1; n = 1; cmax = c1; n = 1;
if (c2 > cmax) { cmax = c2; n = 2; } if (c2 > cmax) { cmax = c2; n = 2; }
if (c0 > cmax) { n = 0; } if (c0 > cmax) { n = 0; }
@@ -892,8 +891,8 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
*/ */
METHODDEF(void) METHODDEF(void)
pass2_no_dither (j_decompress_ptr cinfo, pass2_no_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
/* This version performs no dithering */ /* This version performs no dithering */
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
@@ -926,8 +925,8 @@ pass2_no_dither (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
pass2_fs_dither (j_decompress_ptr cinfo, pass2_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
/* This version performs Floyd-Steinberg dithering */ /* This version performs Floyd-Steinberg dithering */
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
@@ -1004,13 +1003,16 @@ pass2_fs_dither (j_decompress_ptr cinfo,
cur1 = GETJSAMPLE(range_limit[cur1]); cur1 = GETJSAMPLE(range_limit[cur1]);
cur2 = GETJSAMPLE(range_limit[cur2]); cur2 = GETJSAMPLE(range_limit[cur2]);
/* Index into the cache with adjusted pixel value */ /* Index into the cache with adjusted pixel value */
cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT]; cachep =
&histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
/* If we have not seen this color before, find nearest colormap */ /* If we have not seen this color before, find nearest colormap */
/* entry and update the cache */ /* entry and update the cache */
if (*cachep == 0) if (*cachep == 0)
fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); fill_inverse_cmap(cinfo, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT,
cur2 >> C2_SHIFT);
/* Now emit the colormap index for this cell */ /* Now emit the colormap index for this cell */
{ register int pixcode = *cachep - 1; {
register int pixcode = *cachep - 1;
*outptr = (JSAMPLE)pixcode; *outptr = (JSAMPLE)pixcode;
/* Compute representation error for this pixel */ /* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]); cur0 -= GETJSAMPLE(colormap0[pixcode]);
@@ -1021,7 +1023,8 @@ pass2_fs_dither (j_decompress_ptr cinfo,
* Add these into the running sums, and simultaneously shift the * Add these into the running sums, and simultaneously shift the
* next-line error sums left by 1 column. * next-line error sums left by 1 column.
*/ */
{ register LOCFSERROR bnexterr; {
register LOCFSERROR bnexterr;
bnexterr = cur0; /* Process component 0 */ bnexterr = cur0; /* Process component 0 */
errorptr[0] = (FSERROR)(bpreverr0 + cur0 * 3); errorptr[0] = (FSERROR)(bpreverr0 + cur0 * 3);
@@ -1167,8 +1170,8 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
if (cinfo->dither_mode == JDITHER_FS) { if (cinfo->dither_mode == JDITHER_FS) {
size_t arraysize = (size_t) ((cinfo->output_width + 2) * size_t arraysize =
(3 * sizeof(FSERROR))); (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR)));
/* Allocate Floyd-Steinberg workspace if we didn't already. */ /* Allocate Floyd-Steinberg workspace if we didn't already. */
if (cquantize->fserrors == NULL) if (cquantize->fserrors == NULL)
cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large) cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)

100
jsimd.h
View File

@@ -19,75 +19,87 @@ EXTERN(int) jsimd_can_ycc_rgb (void);
EXTERN(int) jsimd_can_ycc_rgb565(void); EXTERN(int) jsimd_can_ycc_rgb565(void);
EXTERN(int) jsimd_c_can_null_convert(void); EXTERN(int) jsimd_c_can_null_convert(void);
EXTERN(void) jsimd_rgb_ycc_convert EXTERN(void) jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows); JDIMENSION output_row, int num_rows);
EXTERN(void) jsimd_rgb_gray_convert EXTERN(void) jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows); JDIMENSION output_row, int num_rows);
EXTERN(void) jsimd_ycc_rgb_convert EXTERN(void) jsimd_ycc_rgb_convert(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows); JSAMPARRAY output_buf, int num_rows);
EXTERN(void) jsimd_ycc_rgb565_convert EXTERN(void) jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPIMAGE input_buf,
JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows); JSAMPARRAY output_buf, int num_rows);
EXTERN(void) jsimd_c_null_convert EXTERN(void) jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows); int num_rows);
EXTERN(int) jsimd_can_h2v2_downsample(void); EXTERN(int) jsimd_can_h2v2_downsample(void);
EXTERN(int) jsimd_can_h2v1_downsample(void); EXTERN(int) jsimd_can_h2v1_downsample(void);
EXTERN(void) jsimd_h2v2_downsample EXTERN(void) jsimd_h2v2_downsample(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data); JSAMPARRAY input_data,
JSAMPARRAY output_data);
EXTERN(int) jsimd_can_h2v2_smooth_downsample(void); EXTERN(int) jsimd_can_h2v2_smooth_downsample(void);
EXTERN(void) jsimd_h2v2_smooth_downsample EXTERN(void) jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data); JSAMPARRAY input_data,
JSAMPARRAY output_data);
EXTERN(void) jsimd_h2v1_downsample EXTERN(void) jsimd_h2v1_downsample(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data); JSAMPARRAY input_data,
JSAMPARRAY output_data);
EXTERN(int) jsimd_can_h2v2_upsample(void); EXTERN(int) jsimd_can_h2v2_upsample(void);
EXTERN(int) jsimd_can_h2v1_upsample(void); EXTERN(int) jsimd_can_h2v1_upsample(void);
EXTERN(int) jsimd_can_int_upsample(void); EXTERN(int) jsimd_can_int_upsample(void);
EXTERN(void) jsimd_h2v2_upsample EXTERN(void) jsimd_h2v2_upsample(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); JSAMPARRAY input_data,
EXTERN(void) jsimd_h2v1_upsample JSAMPARRAY *output_data_ptr);
(j_decompress_ptr cinfo, jpeg_component_info *compptr, EXTERN(void) jsimd_h2v1_upsample(j_decompress_ptr cinfo,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); jpeg_component_info *compptr,
EXTERN(void) jsimd_int_upsample JSAMPARRAY input_data,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY *output_data_ptr);
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); EXTERN(void) jsimd_int_upsample(j_decompress_ptr cinfo,
jpeg_component_info *compptr,
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr);
EXTERN(int) jsimd_can_h2v2_fancy_upsample(void); EXTERN(int) jsimd_can_h2v2_fancy_upsample(void);
EXTERN(int) jsimd_can_h2v1_fancy_upsample(void); EXTERN(int) jsimd_can_h2v1_fancy_upsample(void);
EXTERN(void) jsimd_h2v2_fancy_upsample EXTERN(void) jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); JSAMPARRAY input_data,
EXTERN(void) jsimd_h2v1_fancy_upsample JSAMPARRAY *output_data_ptr);
(j_decompress_ptr cinfo, jpeg_component_info *compptr, EXTERN(void) jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); jpeg_component_info *compptr,
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr);
EXTERN(int) jsimd_can_h2v2_merged_upsample(void); EXTERN(int) jsimd_can_h2v2_merged_upsample(void);
EXTERN(int) jsimd_can_h2v1_merged_upsample(void); EXTERN(int) jsimd_can_h2v1_merged_upsample(void);
EXTERN(void) jsimd_h2v2_merged_upsample EXTERN(void) jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); JDIMENSION in_row_group_ctr,
EXTERN(void) jsimd_h2v1_merged_upsample JSAMPARRAY output_buf);
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, EXTERN(void) jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo,
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf);
EXTERN(int) jsimd_can_huff_encode_one_block(void); EXTERN(int) jsimd_can_huff_encode_one_block(void);
EXTERN(JOCTET*) jsimd_huff_encode_one_block EXTERN(JOCTET *) jsimd_huff_encode_one_block(void *state, JOCTET *buffer,
(void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, JCOEFPTR block, int last_dc_val,
c_derived_tbl *dctbl, c_derived_tbl *actbl); c_derived_tbl *dctbl,
c_derived_tbl *actbl);

View File

@@ -50,37 +50,37 @@ jsimd_c_can_null_convert (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_ycc_convert (j_compress_ptr cinfo, jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_gray_convert (j_compress_ptr cinfo, jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_c_null_convert (j_compress_ptr cinfo, jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
@@ -146,18 +146,14 @@ jsimd_int_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_upsample (j_decompress_ptr cinfo, jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_upsample (j_decompress_ptr cinfo, jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -174,18 +170,14 @@ jsimd_can_h2v1_fancy_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -202,18 +194,14 @@ jsimd_can_h2v1_merged_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
@@ -287,8 +275,7 @@ jsimd_can_quantize_float (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors, jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
DCTELEM *workspace)
{ {
} }

View File

@@ -14,8 +14,7 @@ EXTERN(int) jsimd_can_convsamp_float (void);
EXTERN(void) jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, EXTERN(void) jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
DCTELEM *workspace); DCTELEM *workspace);
EXTERN(void) jsimd_convsamp_float (JSAMPARRAY sample_data, EXTERN(void) jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
JDIMENSION start_col,
FAST_FLOAT *workspace); FAST_FLOAT *workspace);
EXTERN(int) jsimd_can_fdct_islow(void); EXTERN(int) jsimd_can_fdct_islow(void);
@@ -40,17 +39,14 @@ EXTERN(int) jsimd_can_idct_6x6 (void);
EXTERN(int) jsimd_can_idct_12x12(void); EXTERN(int) jsimd_can_idct_12x12(void);
EXTERN(void) jsimd_idct_2x2(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_2x2(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JSAMPARRAY output_buf, JDIMENSION output_col);
JDIMENSION output_col);
EXTERN(void) jsimd_idct_4x4(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_4x4(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JSAMPARRAY output_buf, JDIMENSION output_col);
JDIMENSION output_col);
EXTERN(void) jsimd_idct_6x6(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_6x6(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JSAMPARRAY output_buf, JDIMENSION output_col);
JDIMENSION output_col);
EXTERN(void) jsimd_idct_12x12(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_12x12(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,

View File

@@ -17,8 +17,8 @@
*/ */
LOCAL(void) LOCAL(void)
add_huff_table (j_common_ptr cinfo, add_huff_table(j_common_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits,
JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) const UINT8 *val)
/* Define a Huffman table */ /* Define a Huffman table */
{ {
int nsymbols, len; int nsymbols, len;
@@ -56,20 +56,25 @@ std_huff_tables (j_common_ptr cinfo)
{ {
JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs; JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs;
static const UINT8 bits_dc_luminance[17] = static const UINT8 bits_dc_luminance[17] = {
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
static const UINT8 val_dc_luminance[] = };
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static const UINT8 val_dc_luminance[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};
static const UINT8 bits_dc_chrominance[17] = static const UINT8 bits_dc_chrominance[17] = {
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
static const UINT8 val_dc_chrominance[] = };
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static const UINT8 val_dc_chrominance[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};
static const UINT8 bits_ac_luminance[17] = static const UINT8 bits_ac_luminance[17] = {
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
static const UINT8 val_ac_luminance[] = };
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, static const UINT8 val_ac_luminance[] = {
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
@@ -89,12 +94,14 @@ std_huff_tables (j_common_ptr cinfo)
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa }; 0xf9, 0xfa
};
static const UINT8 bits_ac_chrominance[17] = static const UINT8 bits_ac_chrominance[17] = {
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
static const UINT8 val_ac_chrominance[] = };
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, static const UINT8 val_ac_chrominance[] = {
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
@@ -114,7 +121,8 @@ std_huff_tables (j_common_ptr cinfo)
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa }; 0xf9, 0xfa
};
if (cinfo->is_decompressor) { if (cinfo->is_decompressor) {
dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs; dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs;

View File

@@ -92,8 +92,8 @@ jround_up (long a, long b)
GLOBAL(void) GLOBAL(void)
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, jcopy_sample_rows(JSAMPARRAY input_array, int source_row,
JSAMPARRAY output_array, int dest_row, JSAMPARRAY output_array, int dest_row, int num_rows,
int num_rows, JDIMENSION num_cols) JDIMENSION num_cols)
/* Copy some rows of samples from one place to another. /* Copy some rows of samples from one place to another.
* num_rows rows are copied from input_array[source_row++] * num_rows rows are copied from input_array[source_row++]
* to output_array[dest_row++]; these areas may overlap for duplication. * to output_array[dest_row++]; these areas may overlap for duplication.

View File

@@ -45,6 +45,6 @@
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
"Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding" \ "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding"
#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2017 The libjpeg-turbo Project and many others" #define JCOPYRIGHT_SHORT "Copyright (C) 1991-2017 The libjpeg-turbo Project and many others"

View File

@@ -1,8 +1,8 @@
/* /*
* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
* *
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991.
* rights reserved. * All rights reserved.
* *
* License to copy and use this software is granted provided that it * License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD5 Message-Digest * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
@@ -61,8 +61,8 @@ static void MD5Transform(unsigned int [4], const unsigned char [64]);
* a multiple of 4. * a multiple of 4.
*/ */
static void static void Encode(unsigned char *output, unsigned int *input,
Encode (unsigned char *output, unsigned int *input, unsigned int len) unsigned int len)
{ {
unsigned int i; unsigned int i;
unsigned int *op = (unsigned int *)output; unsigned int *op = (unsigned int *)output;
@@ -76,8 +76,8 @@ Encode (unsigned char *output, unsigned int *input, unsigned int len)
* a multiple of 4. * a multiple of 4.
*/ */
static void static void Decode(unsigned int *output, const unsigned char *input,
Decode (unsigned int *output, const unsigned char *input, unsigned int len) unsigned int len)
{ {
unsigned int i; unsigned int i;
const unsigned int *ip = (const unsigned int *)input; const unsigned int *ip = (const unsigned int *)input;
@@ -129,11 +129,8 @@ static unsigned char PADDING[64] = {
/* MD5 initialization. Begins an MD5 operation, writing a new context. */ /* MD5 initialization. Begins an MD5 operation, writing a new context. */
void void MD5Init(MD5_CTX *context)
MD5Init (context)
MD5_CTX *context;
{ {
context->count[0] = context->count[1] = 0; context->count[0] = context->count[1] = 0;
/* Load magic initialization constants. */ /* Load magic initialization constants. */
@@ -149,11 +146,7 @@ MD5Init (context)
* context. * context.
*/ */
void void MD5Update(MD5_CTX *context, const void *in, unsigned int inputLen)
MD5Update (context, in, inputLen)
MD5_CTX *context;
const void *in;
unsigned int inputLen;
{ {
unsigned int i, idx, partLen; unsigned int i, idx, partLen;
const unsigned char *input = in; const unsigned char *input = in;
@@ -162,8 +155,8 @@ MD5Update (context, in, inputLen)
idx = (unsigned int)((context->count[0] >> 3) & 0x3F); idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */ /* Update number of bits */
if ((context->count[0] += ((unsigned int)inputLen << 3)) if ((context->count[0] += ((unsigned int)inputLen << 3)) <
< ((unsigned int)inputLen << 3)) ((unsigned int)inputLen << 3))
context->count[1]++; context->count[1]++;
context->count[1] += ((unsigned int)inputLen >> 29); context->count[1] += ((unsigned int)inputLen >> 29);
@@ -171,30 +164,25 @@ MD5Update (context, in, inputLen)
/* Transform as many times as possible. */ /* Transform as many times as possible. */
if (inputLen >= partLen) { if (inputLen >= partLen) {
memcpy((void *)&context->buffer[idx], (const void *)input, memcpy((void *)&context->buffer[idx], (const void *)input, partLen);
partLen);
MD5Transform(context->state, context->buffer); MD5Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64) for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform(context->state, &input[i]); MD5Transform(context->state, &input[i]);
idx = 0; idx = 0;
} } else
else
i = 0; i = 0;
/* Buffer remaining input */ /* Buffer remaining input */
memcpy ((void *)&context->buffer[idx], (const void *)&input[i], memcpy((void *)&context->buffer[idx], (const void *)&input[i], inputLen - i);
inputLen-i);
} }
/* /*
* MD5 padding. Adds padding followed by original length. * MD5 padding. Adds padding followed by original length.
*/ */
void void MD5Pad(MD5_CTX *context)
MD5Pad (context)
MD5_CTX *context;
{ {
unsigned char bits[8]; unsigned char bits[8];
unsigned int idx, padLen; unsigned int idx, padLen;
@@ -216,10 +204,7 @@ MD5Pad (context)
* the message digest and zeroizing the context. * the message digest and zeroizing the context.
*/ */
void void MD5Final(unsigned char digest[16], MD5_CTX *context)
MD5Final (digest, context)
unsigned char digest[16];
MD5_CTX *context;
{ {
/* Do padding. */ /* Do padding. */
MD5Pad(context); MD5Pad(context);
@@ -233,10 +218,7 @@ MD5Final (digest, context)
/* MD5 basic transformation. Transforms state based on block. */ /* MD5 basic transformation. Transforms state based on block. */
static void static void MD5Transform(unsigned int state[4], const unsigned char block[64])
MD5Transform (state, block)
unsigned int state[4];
const unsigned char block[64];
{ {
unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16];

View File

@@ -3,8 +3,8 @@
*/ */
/*- /*-
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991.
rights reserved. All rights reserved.
License to copy and use this software is granted provided that it License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest is identified as the "RSA Data Security, Inc. MD5 Message-Digest

View File

@@ -1,4 +1,5 @@
/* mdXhl.c * ---------------------------------------------------------------------------- /* mdXhl.c
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42): * "THE BEER-WARE LICENSE" (Revision 42):
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think * can do whatever you want with this stuff. If we meet some day, and you think
@@ -32,8 +33,7 @@
#include "./md5.h" #include "./md5.h"
char * char *MD5End(MD5_CTX *ctx, char *buf)
MD5End(MD5_CTX *ctx, char *buf)
{ {
int i; int i;
unsigned char digest[LENGTH]; unsigned char digest[LENGTH];
@@ -52,14 +52,12 @@ MD5End(MD5_CTX *ctx, char *buf)
return buf; return buf;
} }
char * char *MD5File(const char *filename, char *buf)
MD5File(const char *filename, char *buf)
{ {
return (MD5FileChunk(filename, buf, 0, 0)); return (MD5FileChunk(filename, buf, 0, 0));
} }
char * char *MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
{ {
unsigned char buffer[BUFSIZ]; unsigned char buffer[BUFSIZ];
MD5_CTX ctx; MD5_CTX ctx;
@@ -103,8 +101,7 @@ MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
return (MD5End(&ctx, buf)); return (MD5End(&ctx, buf));
} }
char * char *MD5Data(const void *data, unsigned int len, char *buf)
MD5Data (const void *data, unsigned int len, char *buf)
{ {
MD5_CTX ctx; MD5_CTX ctx;

22
rdbmp.c
View File

@@ -26,8 +26,8 @@
* This code contributed by James Arthur Boucher. * This code contributed by James Arthur Boucher.
*/ */
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#include "cmyk.h" #include "cmyk.h"
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#ifdef BMP_SUPPORTED #ifdef BMP_SUPPORTED
@@ -48,7 +48,8 @@ typedef char U_CHAR;
#endif /* HAVE_UNSIGNED_CHAR */ #endif /* HAVE_UNSIGNED_CHAR */
#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) #define ReadOK(file, buffer, len) \
(JFREAD(file, buffer, len) == ((size_t)(len)))
static int alpha_index[JPEG_NUMCS] = { static int alpha_index[JPEG_NUMCS] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1
@@ -372,8 +373,7 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
(*progress->pub.progress_monitor) ((j_common_ptr)cinfo); (*progress->pub.progress_monitor) ((j_common_ptr)cinfo);
} }
image_ptr = (*cinfo->mem->access_virt_sarray) image_ptr = (*cinfo->mem->access_virt_sarray)
((j_common_ptr) cinfo, source->whole_image, ((j_common_ptr)cinfo, source->whole_image, row, (JDIMENSION)1, TRUE);
row, (JDIMENSION) 1, TRUE);
out_ptr = image_ptr[0]; out_ptr = image_ptr[0];
if (fread(out_ptr, 1, source->row_width, infile) != source->row_width) { if (fread(out_ptr, 1, source->row_width, infile) != source->row_width) {
if (feof(infile)) if (feof(infile))
@@ -416,12 +416,16 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
bmp_source_ptr source = (bmp_source_ptr)sinfo; bmp_source_ptr source = (bmp_source_ptr)sinfo;
U_CHAR bmpfileheader[14]; U_CHAR bmpfileheader[14];
U_CHAR bmpinfoheader[64]; U_CHAR bmpinfoheader[64];
#define GET_2B(array,offset) ((unsigned short) UCH(array[offset]) + \
#define GET_2B(array, offset) \
((unsigned short)UCH(array[offset]) + \
(((unsigned short)UCH(array[offset + 1])) << 8)) (((unsigned short)UCH(array[offset + 1])) << 8))
#define GET_4B(array,offset) ((unsigned int) UCH(array[offset]) + \ #define GET_4B(array, offset) \
((unsigned int)UCH(array[offset]) + \
(((unsigned int)UCH(array[offset + 1])) << 8) + \ (((unsigned int)UCH(array[offset + 1])) << 8) + \
(((unsigned int)UCH(array[offset + 2])) << 16) + \ (((unsigned int)UCH(array[offset + 2])) << 16) + \
(((unsigned int)UCH(array[offset + 3])) << 24)) (((unsigned int)UCH(array[offset + 3])) << 24))
unsigned int bfOffBits; unsigned int bfOffBits;
unsigned int headerSize; unsigned int headerSize;
int biWidth; int biWidth;
@@ -534,8 +538,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
ERREXIT(cinfo, JERR_BMP_BADCMAP); ERREXIT(cinfo, JERR_BMP_BADCMAP);
/* Allocate space to store the colormap */ /* Allocate space to store the colormap */
source->colormap = (*cinfo->mem->alloc_sarray) source->colormap = (*cinfo->mem->alloc_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE, ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)biClrUsed, (JDIMENSION)3);
(JDIMENSION) biClrUsed, (JDIMENSION) 3);
/* and read it from the file */ /* and read it from the file */
read_colormap(source, (int)biClrUsed, mapentrysize); read_colormap(source, (int)biClrUsed, mapentrysize);
/* account for size of colormap */ /* account for size of colormap */
@@ -604,8 +607,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
} }
} else { } else {
source->iobuffer = (U_CHAR *) source->iobuffer = (U_CHAR *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, row_width);
row_width);
switch (source->bits_per_pixel) { switch (source->bits_per_pixel) {
case 8: case 8:
source->pub.get_pixel_rows = get_8bit_row; source->pub.get_pixel_rows = get_8bit_row;

View File

@@ -22,8 +22,8 @@
* the file is indeed PPM format). * the file is indeed PPM format).
*/ */
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#include "cmyk.h" #include "cmyk.h"
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#ifdef PPM_SUPPORTED #ifdef PPM_SUPPORTED
@@ -57,7 +57,8 @@ typedef char U_CHAR;
#endif /* HAVE_UNSIGNED_CHAR */ #endif /* HAVE_UNSIGNED_CHAR */
#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) #define ReadOK(file, buffer, len) \
(JFREAD(file, buffer, len) == ((size_t)(len)))
static int alpha_index[JPEG_NUMCS] = { static int alpha_index[JPEG_NUMCS] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1

View File

@@ -78,8 +78,7 @@ static int q_scale_factor[NUM_QUANT_TBLS] = {100, 100, 100, 100};
#endif #endif
GLOBAL(boolean) GLOBAL(boolean)
read_quant_tables (j_compress_ptr cinfo, char *filename, read_quant_tables(j_compress_ptr cinfo, char *filename, boolean force_baseline)
boolean force_baseline)
/* Read a set of quantization tables from the specified file. /* Read a set of quantization tables from the specified file.
* The file is plain ASCII text: decimal numbers with whitespace between. * The file is plain ASCII text: decimal numbers with whitespace between.
* Comments preceded by '#' may be included in the file. * Comments preceded by '#' may be included in the file.
@@ -306,10 +305,10 @@ static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
LOCAL(void) LOCAL(void)
jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline) jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline)
{ {
jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, q_scale_factor[0],
q_scale_factor[0], force_baseline); force_baseline);
jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, q_scale_factor[1],
q_scale_factor[1], force_baseline); force_baseline);
} }
#endif #endif

View File

@@ -41,7 +41,8 @@ typedef char U_CHAR;
#endif /* HAVE_UNSIGNED_CHAR */ #endif /* HAVE_UNSIGNED_CHAR */
#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) #define ReadOK(file, buffer, len) \
(JFREAD(file, buffer, len) == ((size_t)(len)))
/* Private version of data source object */ /* Private version of data source object */

View File

@@ -38,6 +38,7 @@ LOCAL(int)
check_feature(char *buffer, char *feature) check_feature(char *buffer, char *feature)
{ {
char *p; char *p;
if (*feature == 0) if (*feature == 0)
return 0; return 0;
if (strncmp(buffer, "Features", 8) != 0) if (strncmp(buffer, "Features", 8) != 0)
@@ -67,6 +68,7 @@ parse_proc_cpuinfo (int bufsize)
{ {
char *buffer = (char *)malloc(bufsize); char *buffer = (char *)malloc(bufsize);
FILE *fd; FILE *fd;
simd_support = 0; simd_support = 0;
if (!buffer) if (!buffer)
@@ -197,9 +199,9 @@ jsimd_can_ycc_rgb565 (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_ycc_convert (j_compress_ptr cinfo, jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
void (*neonfct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*neonfct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
@@ -235,16 +237,16 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_gray_convert (j_compress_ptr cinfo, jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
void (*neonfct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*neonfct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
@@ -280,9 +282,9 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row, jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row,
output_buf, num_rows); output_buf, num_rows);
@@ -325,18 +327,14 @@ jsimd_can_h2v1_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_upsample (j_decompress_ptr cinfo, jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_upsample (j_decompress_ptr cinfo, jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -364,18 +362,14 @@ jsimd_can_h2v1_fancy_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor, jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, compptr->downsampled_width, input_data,
@@ -395,18 +389,14 @@ jsimd_can_h2v1_merged_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
@@ -521,8 +511,7 @@ jsimd_can_quantize_float (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors, jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
DCTELEM *workspace)
{ {
jsimd_quantize_neon(coef_block, divisors, workspace); jsimd_quantize_neon(coef_block, divisors, workspace);
} }
@@ -584,8 +573,7 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col);
output_col);
} }
GLOBAL(void) GLOBAL(void)
@@ -593,8 +581,7 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col);
output_col);
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -106,8 +106,7 @@ _\fname:
* Reference SIMD-friendly 1-D ISLOW iDCT C implementation. * Reference SIMD-friendly 1-D ISLOW iDCT C implementation.
* Uses some ideas from the comments in 'simd/jiss2int-64.asm' * Uses some ideas from the comments in 'simd/jiss2int-64.asm'
*/ */
#define REF_1D_IDCT(xrow0, xrow1, xrow2, xrow3, xrow4, xrow5, xrow6, xrow7) \ #define REF_1D_IDCT(xrow0, xrow1, xrow2, xrow3, xrow4, xrow5, xrow6, xrow7) { \
{ \
DCTELEM row0, row1, row2, row3, row4, row5, row6, row7; \ DCTELEM row0, row1, row2, row3, row4, row5, row6, row7; \
JLONG q1, q2, q3, q4, q5, q6, q7; \ JLONG q1, q2, q3, q4, q5, q6, q7; \
JLONG tmp11_plus_tmp2, tmp11_minus_tmp2; \ JLONG tmp11_plus_tmp2, tmp11_minus_tmp2; \

View File

@@ -44,6 +44,7 @@ LOCAL(int)
check_cpuinfo(char *buffer, const char *field, char *value) check_cpuinfo(char *buffer, const char *field, char *value)
{ {
char *p; char *p;
if (*value == 0) if (*value == 0)
return 0; return 0;
if (strncmp(buffer, field, strlen(field)) != 0) if (strncmp(buffer, field, strlen(field)) != 0)
@@ -224,9 +225,9 @@ jsimd_can_ycc_rgb565 (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_ycc_convert (j_compress_ptr cinfo, jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
void (*neonfct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*neonfct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
@@ -271,16 +272,16 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_gray_convert (j_compress_ptr cinfo, jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
void (*neonfct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*neonfct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
@@ -325,9 +326,9 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row, jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row,
output_buf, num_rows); output_buf, num_rows);
@@ -402,18 +403,14 @@ jsimd_can_h2v1_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_upsample (j_decompress_ptr cinfo, jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_upsample (j_decompress_ptr cinfo, jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -430,18 +427,14 @@ jsimd_can_h2v1_fancy_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -458,18 +451,14 @@ jsimd_can_h2v1_merged_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
@@ -596,8 +585,7 @@ jsimd_can_quantize_float (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors, jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
DCTELEM *workspace)
{ {
jsimd_quantize_neon(coef_block, divisors, workspace); jsimd_quantize_neon(coef_block, divisors, workspace);
} }
@@ -659,8 +647,7 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col);
output_col);
} }
GLOBAL(void) GLOBAL(void)
@@ -668,8 +655,7 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col);
output_col);
} }
GLOBAL(int) GLOBAL(int)

View File

@@ -23,9 +23,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_rgb_ycc_convert_avx2 (JDIMENSION img_width, ; jsimd_rgb_ycc_convert_avx2(JDIMENSION img_width, JSAMPARRAY input_buf,
; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JSAMPIMAGE output_buf, JDIMENSION output_row,
; JDIMENSION output_row, int num_rows); ; int num_rows);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION img_width %define img_width(b) (b) + 8 ; JDIMENSION img_width
@@ -35,12 +35,12 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_YMMWORD ; ymmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD
; ymmword wk[WK_NUM]
%define WK_NUM 8 %define WK_NUM 8
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr
align 32 align 32
GLOBAL_FUNCTION(jsimd_rgb_ycc_convert_avx2) GLOBAL_FUNCTION(jsimd_rgb_ycc_convert_avx2)
EXTN(jsimd_rgb_ycc_convert_avx2): EXTN(jsimd_rgb_ycc_convert_avx2):
@@ -437,7 +437,6 @@ EXTN(jsimd_rgb_ycc_convert_avx2):
vpsrld ymm0, ymm0, 1 ; ymm0=BEL*FIX(0.500) vpsrld ymm0, ymm0, 1 ; ymm0=BEL*FIX(0.500)
vpsrld ymm6, ymm6, 1 ; ymm6=BEH*FIX(0.500) vpsrld ymm6, ymm6, 1 ; ymm6=BEH*FIX(0.500)
vmovdqa ymm1, [GOTOFF(eax,PD_ONEHALFM1_CJ)] ; ymm1=[PD_ONEHALFM1_CJ] vmovdqa ymm1, [GOTOFF(eax,PD_ONEHALFM1_CJ)] ; ymm1=[PD_ONEHALFM1_CJ]
vpaddd ymm5, ymm5, ymm0 vpaddd ymm5, ymm5, ymm0

View File

@@ -23,9 +23,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_rgb_ycc_convert_mmx (JDIMENSION img_width, ; jsimd_rgb_ycc_convert_mmx(JDIMENSION img_width, JSAMPARRAY input_buf,
; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JSAMPIMAGE output_buf, JDIMENSION output_row,
; JDIMENSION output_row, int num_rows); ; int num_rows);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION img_width %define img_width(b) (b) + 8 ; JDIMENSION img_width
@@ -35,7 +35,8 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_MMWORD
; mmword wk[WK_NUM]
%define WK_NUM 8 %define WK_NUM 8
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -22,9 +22,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_rgb_ycc_convert_sse2 (JDIMENSION img_width, ; jsimd_rgb_ycc_convert_sse2(JDIMENSION img_width, JSAMPARRAY input_buf,
; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JSAMPIMAGE output_buf, JDIMENSION output_row,
; JDIMENSION output_row, int num_rows); ; int num_rows);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION img_width %define img_width(b) (b) + 8 ; JDIMENSION img_width
@@ -34,12 +34,12 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 8 %define WK_NUM 8
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr
align 32 align 32
GLOBAL_FUNCTION(jsimd_rgb_ycc_convert_sse2) GLOBAL_FUNCTION(jsimd_rgb_ycc_convert_sse2)
EXTN(jsimd_rgb_ycc_convert_sse2): EXTN(jsimd_rgb_ycc_convert_sse2):

View File

@@ -44,7 +44,8 @@ PW_F0299_F0337 times 8 dw F_0_299, F_0_337
PW_F0114_F0250 times 8 dw F_0_114, F_0_250 PW_F0114_F0250 times 8 dw F_0_114, F_0_250
PW_MF016_MF033 times 8 dw -F_0_168, -F_0_331 PW_MF016_MF033 times 8 dw -F_0_168, -F_0_331
PW_MF008_MF041 times 8 dw -F_0_081, -F_0_418 PW_MF008_MF041 times 8 dw -F_0_081, -F_0_418
PD_ONEHALFM1_CJ times 8 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) PD_ONEHALFM1_CJ times 8 dd (1 << (SCALEBITS - 1)) - 1 + \
(CENTERJSAMPLE << SCALEBITS)
PD_ONEHALF times 8 dd (1 << (SCALEBITS - 1)) PD_ONEHALF times 8 dd (1 << (SCALEBITS - 1))
alignz 32 alignz 32

View File

@@ -44,7 +44,8 @@ PW_F0299_F0337 times 2 dw F_0_299, F_0_337
PW_F0114_F0250 times 2 dw F_0_114, F_0_250 PW_F0114_F0250 times 2 dw F_0_114, F_0_250
PW_MF016_MF033 times 2 dw -F_0_168, -F_0_331 PW_MF016_MF033 times 2 dw -F_0_168, -F_0_331
PW_MF008_MF041 times 2 dw -F_0_081, -F_0_418 PW_MF008_MF041 times 2 dw -F_0_081, -F_0_418
PD_ONEHALFM1_CJ times 2 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) PD_ONEHALFM1_CJ times 2 dd (1 << (SCALEBITS - 1)) - 1 + \
(CENTERJSAMPLE << SCALEBITS)
PD_ONEHALF times 2 dd (1 << (SCALEBITS - 1)) PD_ONEHALF times 2 dd (1 << (SCALEBITS - 1))
alignz 32 alignz 32

View File

@@ -43,7 +43,8 @@ PW_F0299_F0337 times 4 dw F_0_299, F_0_337
PW_F0114_F0250 times 4 dw F_0_114, F_0_250 PW_F0114_F0250 times 4 dw F_0_114, F_0_250
PW_MF016_MF033 times 4 dw -F_0_168, -F_0_331 PW_MF016_MF033 times 4 dw -F_0_168, -F_0_331
PW_MF008_MF041 times 4 dw -F_0_081, -F_0_418 PW_MF008_MF041 times 4 dw -F_0_081, -F_0_418
PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS - 1)) - 1 + \
(CENTERJSAMPLE << SCALEBITS)
PD_ONEHALF times 4 dd (1 << (SCALEBITS - 1)) PD_ONEHALF times 4 dd (1 << (SCALEBITS - 1))
alignz 32 alignz 32

View File

@@ -23,9 +23,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_rgb_gray_convert_avx2 (JDIMENSION img_width, ; jsimd_rgb_gray_convert_avx2(JDIMENSION img_width, JSAMPARRAY input_buf,
; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JSAMPIMAGE output_buf, JDIMENSION output_row,
; JDIMENSION output_row, int num_rows); ; int num_rows);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION img_width %define img_width(b) (b) + 8 ; JDIMENSION img_width
@@ -35,12 +35,12 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_YMMWORD ; ymmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD
; ymmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr
align 32 align 32
GLOBAL_FUNCTION(jsimd_rgb_gray_convert_avx2) GLOBAL_FUNCTION(jsimd_rgb_gray_convert_avx2)
EXTN(jsimd_rgb_gray_convert_avx2): EXTN(jsimd_rgb_gray_convert_avx2):

View File

@@ -23,9 +23,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_rgb_gray_convert_mmx (JDIMENSION img_width, ; jsimd_rgb_gray_convert_mmx(JDIMENSION img_width, JSAMPARRAY input_buf,
; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JSAMPIMAGE output_buf, JDIMENSION output_row,
; JDIMENSION output_row, int num_rows); ; int num_rows);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION img_width %define img_width(b) (b) + 8 ; JDIMENSION img_width
@@ -35,7 +35,8 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_MMWORD
; mmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -22,9 +22,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_rgb_gray_convert_sse2 (JDIMENSION img_width, ; jsimd_rgb_gray_convert_sse2(JDIMENSION img_width, JSAMPARRAY input_buf,
; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JSAMPIMAGE output_buf, JDIMENSION output_row,
; JDIMENSION output_row, int num_rows); ; int num_rows);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION img_width %define img_width(b) (b) + 8 ; JDIMENSION img_width
@@ -34,12 +34,12 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr
align 32 align 32
GLOBAL_FUNCTION(jsimd_rgb_gray_convert_sse2) GLOBAL_FUNCTION(jsimd_rgb_gray_convert_sse2)
EXTN(jsimd_rgb_gray_convert_sse2): EXTN(jsimd_rgb_gray_convert_sse2):

View File

@@ -30,8 +30,8 @@
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v1_downsample_avx2(JDIMENSION image_width, int max_v_samp_factor, ; jsimd_h2v1_downsample_avx2(JDIMENSION image_width, int max_v_samp_factor,
; JDIMENSION v_samp_factor, ; JDIMENSION v_samp_factor,
; JDIMENSION width_in_blocks, ; JDIMENSION width_in_blocks, JSAMPARRAY input_data,
; JSAMPARRAY input_data, JSAMPARRAY output_data); ; JSAMPARRAY output_data);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION image_width %define img_width(b) (b) + 8 ; JDIMENSION image_width
@@ -203,8 +203,8 @@ EXTN(jsimd_h2v1_downsample_avx2):
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v2_downsample_avx2(JDIMENSION image_width, int max_v_samp_factor, ; jsimd_h2v2_downsample_avx2(JDIMENSION image_width, int max_v_samp_factor,
; JDIMENSION v_samp_factor, ; JDIMENSION v_samp_factor,
; JDIMENSION width_in_blocks, ; JDIMENSION width_in_blocks, JSAMPARRAY input_data,
; JSAMPARRAY input_data, JSAMPARRAY output_data); ; JSAMPARRAY output_data);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION image_width %define img_width(b) (b) + 8 ; JDIMENSION image_width

View File

@@ -29,8 +29,8 @@
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v1_downsample_sse2(JDIMENSION image_width, int max_v_samp_factor, ; jsimd_h2v1_downsample_sse2(JDIMENSION image_width, int max_v_samp_factor,
; JDIMENSION v_samp_factor, ; JDIMENSION v_samp_factor,
; JDIMENSION width_in_blocks, ; JDIMENSION width_in_blocks, JSAMPARRAY input_data,
; JSAMPARRAY input_data, JSAMPARRAY output_data); ; JSAMPARRAY output_data);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION image_width %define img_width(b) (b) + 8 ; JDIMENSION image_width
@@ -185,8 +185,8 @@ EXTN(jsimd_h2v1_downsample_sse2):
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v2_downsample_sse2(JDIMENSION image_width, int max_v_samp_factor, ; jsimd_h2v2_downsample_sse2(JDIMENSION image_width, int max_v_samp_factor,
; JDIMENSION v_samp_factor, ; JDIMENSION v_samp_factor,
; JDIMENSION width_in_blocks, ; JDIMENSION width_in_blocks, JSAMPARRAY input_data,
; JSAMPARRAY input_data, JSAMPARRAY output_data); ; JSAMPARRAY output_data);
; ;
%define img_width(b) (b) + 8 ; JDIMENSION image_width %define img_width(b) (b) + 8 ; JDIMENSION image_width

View File

@@ -24,9 +24,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_ycc_rgb_convert_avx2 (JDIMENSION out_width, ; jsimd_ycc_rgb_convert_avx2(JDIMENSION out_width, JSAMPIMAGE input_buf,
; JSAMPIMAGE input_buf, JDIMENSION input_row, ; JDIMENSION input_row, JSAMPARRAY output_buf,
; JSAMPARRAY output_buf, int num_rows) ; int num_rows)
; ;
%define out_width(b) (b) + 8 ; JDIMENSION out_width %define out_width(b) (b) + 8 ; JDIMENSION out_width
@@ -36,7 +36,8 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_YMMWORD ; ymmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD
; ymmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -23,9 +23,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_ycc_rgb_convert_mmx (JDIMENSION out_width, ; jsimd_ycc_rgb_convert_mmx(JDIMENSION out_width, JSAMPIMAGE input_buf,
; JSAMPIMAGE input_buf, JDIMENSION input_row, ; JDIMENSION input_row, JSAMPARRAY output_buf,
; JSAMPARRAY output_buf, int num_rows) ; int num_rows)
; ;
%define out_width(b) (b) + 8 ; JDIMENSION out_width %define out_width(b) (b) + 8 ; JDIMENSION out_width
@@ -35,7 +35,8 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_MMWORD
; mmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -23,9 +23,9 @@
; Convert some rows of samples to the output colorspace. ; Convert some rows of samples to the output colorspace.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_ycc_rgb_convert_sse2 (JDIMENSION out_width, ; jsimd_ycc_rgb_convert_sse2(JDIMENSION out_width, JSAMPIMAGE input_buf,
; JSAMPIMAGE input_buf, JDIMENSION input_row, ; JDIMENSION input_row, JSAMPARRAY output_buf,
; JSAMPARRAY output_buf, int num_rows) ; int num_rows)
; ;
%define out_width(b) (b) + 8 ; JDIMENSION out_width %define out_width(b) (b) + 8 ; JDIMENSION out_width
@@ -35,7 +35,8 @@
%define num_rows(b) (b) + 24 ; int num_rows %define num_rows(b) (b) + 24 ; int num_rows
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -36,7 +36,8 @@
%define output_buf(b) (b) + 20 ; JSAMPARRAY output_buf %define output_buf(b) (b) + 20 ; JSAMPARRAY output_buf
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_YMMWORD ; ymmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD
; ymmword wk[WK_NUM]
%define WK_NUM 3 %define WK_NUM 3
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -23,8 +23,7 @@
; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. ; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v1_merged_upsample_mmx (JDIMENSION output_width, ; jsimd_h2v1_merged_upsample_mmx(JDIMENSION output_width, JSAMPIMAGE input_buf,
; JSAMPIMAGE input_buf,
; JDIMENSION in_row_group_ctr, ; JDIMENSION in_row_group_ctr,
; JSAMPARRAY output_buf); ; JSAMPARRAY output_buf);
; ;
@@ -397,8 +396,7 @@ EXTN(jsimd_h2v1_merged_upsample_mmx):
; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. ; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v2_merged_upsample_mmx (JDIMENSION output_width, ; jsimd_h2v2_merged_upsample_mmx(JDIMENSION output_width, JSAMPIMAGE input_buf,
; JSAMPIMAGE input_buf,
; JDIMENSION in_row_group_ctr, ; JDIMENSION in_row_group_ctr,
; JSAMPARRAY output_buf); ; JSAMPARRAY output_buf);
; ;

View File

@@ -35,7 +35,8 @@
%define output_buf(b) (b) + 20 ; JSAMPARRAY output_buf %define output_buf(b) (b) + 20 ; JSAMPARRAY output_buf
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 3 %define WK_NUM 3
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr

View File

@@ -220,7 +220,8 @@ EXTN(jsimd_h2v1_fancy_upsample_avx2):
%define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr %define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_YMMWORD ; ymmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD
; ymmword wk[WK_NUM]
%define WK_NUM 4 %define WK_NUM 4
%define gotptr wk(0) - SIZEOF_POINTER ; void *gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void *gotptr
@@ -558,10 +559,8 @@ EXTN(jsimd_h2v2_fancy_upsample_avx2):
; It's still a box filter. ; It's still a box filter.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v1_upsample_avx2 (int max_v_samp_factor, ; jsimd_h2v1_upsample_avx2(int max_v_samp_factor, JDIMENSION output_width,
; JDIMENSION output_width, ; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
; JSAMPARRAY input_data,
; JSAMPARRAY *output_data_ptr);
; ;
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor %define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
@@ -659,10 +658,8 @@ EXTN(jsimd_h2v1_upsample_avx2):
; It's still a box filter. ; It's still a box filter.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v2_upsample_avx2 (int max_v_samp_factor, ; jsimd_h2v2_upsample_avx2(int max_v_samp_factor, JDIMENSION output_width,
; JDIMENSION output_width, ; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
; JSAMPARRAY input_data,
; JSAMPARRAY *output_data_ptr);
; ;
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor %define max_v_samp(b) (b) + 8 ; int max_v_samp_factor

View File

@@ -530,10 +530,8 @@ EXTN(jsimd_h2v2_fancy_upsample_mmx):
; It's still a box filter. ; It's still a box filter.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v1_upsample_mmx (int max_v_samp_factor, ; jsimd_h2v1_upsample_mmx(int max_v_samp_factor, JDIMENSION output_width,
; JDIMENSION output_width, ; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
; JSAMPARRAY input_data,
; JSAMPARRAY *output_data_ptr);
; ;
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor %define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
@@ -631,10 +629,8 @@ EXTN(jsimd_h2v1_upsample_mmx):
; It's still a box filter. ; It's still a box filter.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v2_upsample_mmx (int max_v_samp_factor, ; jsimd_h2v2_upsample_mmx(int max_v_samp_factor, JDIMENSION output_width,
; JDIMENSION output_width, ; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
; JSAMPARRAY input_data,
; JSAMPARRAY *output_data_ptr);
; ;
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor %define max_v_samp(b) (b) + 8 ; int max_v_samp_factor

View File

@@ -209,7 +209,8 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2):
%define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr %define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 4 %define WK_NUM 4
%define gotptr wk(0) - SIZEOF_POINTER ; void *gotptr %define gotptr wk(0) - SIZEOF_POINTER ; void *gotptr
@@ -526,10 +527,8 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2):
; It's still a box filter. ; It's still a box filter.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v1_upsample_sse2 (int max_v_samp_factor, ; jsimd_h2v1_upsample_sse2(int max_v_samp_factor, JDIMENSION output_width,
; JDIMENSION output_width, ; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
; JSAMPARRAY input_data,
; JSAMPARRAY *output_data_ptr);
; ;
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor %define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
@@ -625,10 +624,8 @@ EXTN(jsimd_h2v1_upsample_sse2):
; It's still a box filter. ; It's still a box filter.
; ;
; GLOBAL(void) ; GLOBAL(void)
; jsimd_h2v2_upsample_sse2 (nt max_v_samp_factor, ; jsimd_h2v2_upsample_sse2(int max_v_samp_factor, JDIMENSION output_width,
; JDIMENSION output_width, ; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
; JSAMPARRAY input_data,
; JSAMPARRAY *output_data_ptr);
; ;
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor %define max_v_samp(b) (b) + 8 ; int max_v_samp_factor

View File

@@ -61,7 +61,8 @@ PD_1_306 times 4 dd 1.306562964876376527856643
%define data(b) (b) + 8 ; FAST_FLOAT *data %define data(b) (b) + 8 ; FAST_FLOAT *data
%define original_ebp ebp + 0 %define original_ebp ebp + 0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 2 %define WK_NUM 2
align 32 align 32

Some files were not shown because too many files have changed in this diff Show More