Line 0
Link Here
|
|
|
1 |
--- jcdctmgr.c.orig 2015-05-18 16:28:09.000000000 +0200 |
2 |
+++ jcdctmgr.c 2015-08-30 02:21:25.079140000 +0200 |
3 |
@@ -6,7 +6,7 @@ |
4 |
* libjpeg-turbo Modifications: |
5 |
* Copyright (C) 1999-2006, MIYASAKA Masaru. |
6 |
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
7 |
- * Copyright (C) 2011, 2014 D. R. Commander |
8 |
+ * Copyright (C) 2011, 2014-2015 D. R. Commander |
9 |
* mozjpeg Modifications: |
10 |
* Copyright (C) 2014, Mozilla Corporation. |
11 |
* For conditions of distribution and use, see the accompanying README file. |
12 |
@@ -185,6 +185,19 @@ compute_reciprocal (UINT16 divisor, DCTE |
13 |
UDCTELEM c; |
14 |
int b, r; |
15 |
|
16 |
+ if (divisor == 1) { |
17 |
+ /* divisor == 1 means unquantized, so these reciprocal/correction/shift |
18 |
+ * values will cause the C quantization algorithm to act like the |
19 |
+ * identity function. Since only the C quantization algorithm is used in |
20 |
+ * these cases, the scale value is irrelevant. |
21 |
+ */ |
22 |
+ dtbl[DCTSIZE2 * 0] = (DCTELEM) 1; /* reciprocal */ |
23 |
+ dtbl[DCTSIZE2 * 1] = (DCTELEM) 0; /* correction */ |
24 |
+ dtbl[DCTSIZE2 * 2] = (DCTELEM) 1; /* scale */ |
25 |
+ dtbl[DCTSIZE2 * 3] = (DCTELEM) (-sizeof(DCTELEM) * 8); /* shift */ |
26 |
+ return 0; |
27 |
+ } |
28 |
+ |
29 |
b = flss(divisor) - 1; |
30 |
r = sizeof(DCTELEM) * 8 + b; |
31 |
|
32 |
@@ -589,7 +602,8 @@ quantize (JCOEFPTR coef_block, DCTELEM * |
33 |
|
34 |
#if BITS_IN_JSAMPLE == 8 |
35 |
|
36 |
- UDCTELEM recip, corr, shift; |
37 |
+ UDCTELEM recip, corr; |
38 |
+ int shift; |
39 |
UDCTELEM2 product; |
40 |
|
41 |
for (i = 0; i < DCTSIZE2; i++) { |