summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg/src/LibJPEG/jdct.h
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2017-05-28 20:21:59 +0300
committerKirill Volinsky <mataes2007@gmail.com>2017-05-28 20:21:59 +0300
commit46cb763bffdbd1d2feea6d27344c48d16a511745 (patch)
tree4eea9dd37e649dbfb3d24bbb1b03671db2f7ae0e /plugins/AdvaImg/src/LibJPEG/jdct.h
parentc9bffd4f4e69fb1f34781cdf138b8b17e96b835b (diff)
AdvaImg: LibJPEG lib update to 9b
Diffstat (limited to 'plugins/AdvaImg/src/LibJPEG/jdct.h')
-rw-r--r--plugins/AdvaImg/src/LibJPEG/jdct.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/plugins/AdvaImg/src/LibJPEG/jdct.h b/plugins/AdvaImg/src/LibJPEG/jdct.h
index b1ff91250b..5f631f42e2 100644
--- a/plugins/AdvaImg/src/LibJPEG/jdct.h
+++ b/plugins/AdvaImg/src/LibJPEG/jdct.h
@@ -2,6 +2,7 @@
* jdct.h
*
* Copyright (C) 1994-1996, Thomas G. Lane.
+ * Modified 2002-2015 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,16 @@ 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
- * prepare_range_limit_table (in jdmaster.c) for more info.
+ * to do the combined operations quickly, assuming that MAXJSAMPLE+1
+ * 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 (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
+#define RANGE_CENTER (MAXJSAMPLE * 2 + 2)
+#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
+
+#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
/* Short forms of external names for systems with brain-damaged linkers. */
@@ -391,3 +395,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