summaryrefslogtreecommitdiff
path: root/jpeg/jdct.h
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-01-09 19:57:49 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-01-09 19:57:49 +0100
commit82d279c2341c88da802b82e0d8732399d4f6b481 (patch)
tree8689e2a5f0b4615767916acf27a7ce4cad1a1743 /jpeg/jdct.h
parent8c4930a7d76efdb9c3e627912a100e9abaf3f504 (diff)
Upgrade bundled libjpeg from jpeg-9a to jpeg-9c
Release: 9a - Jan 14, 2018 For further details see README.bundled-libs.txt.
Diffstat (limited to 'jpeg/jdct.h')
-rw-r--r--jpeg/jdct.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/jpeg/jdct.h b/jpeg/jdct.h
index 360dec80c..bcfedfcfd 100644
--- a/jpeg/jdct.h
+++ b/jpeg/jdct.h
@@ -2,6 +2,7 @@
* jdct.h
*
* Copyright (C) 1994-1996, Thomas G. Lane.
+ * Modified 2002-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -78,13 +79,15 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
* be quite far out of range if the input data is corrupt, so a bulletproof
* range-limiting step is required. We use a mask-and-table-lookup method
- * to do the combined operations quickly. See the comments with
+ * to do the combined operations quickly, assuming that RANGE_CENTER
+ * (defined in jpegint.h) is a power of 2. See the comments with
* prepare_range_limit_table (in jdmaster.c) for more info.
*/
-#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE)
+#define RANGE_MASK (RANGE_CENTER * 2 - 1)
+#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
-#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
+#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
/* Short forms of external names for systems with brain-damaged linkers. */
@@ -391,3 +394,23 @@ EXTERN(void) jpeg_idct_1x2
#ifndef MULTIPLY16V16 /* default definition */
#define MULTIPLY16V16(var1,var2) ((var1) * (var2))
#endif
+
+/* Like RIGHT_SHIFT, but applies to a DCTELEM.
+ * We assume that int right shift is unsigned if INT32 right shift is.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define ISHIFT_TEMPS DCTELEM ishift_temp;
+#if BITS_IN_JSAMPLE == 8
+#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */
+#else
+#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */
+#endif
+#define IRIGHT_SHIFT(x,shft) \
+ ((ishift_temp = (x)) < 0 ? \
+ (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
+ (ishift_temp >> (shft)))
+#else
+#define ISHIFT_TEMPS
+#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif