Index: third_party/libjpeg_turbo/jcparam.c |
=================================================================== |
--- third_party/libjpeg_turbo/jcparam.c (revision 95020) |
+++ third_party/libjpeg_turbo/jcparam.c (working copy) |
@@ -2,7 +2,8 @@ |
* jcparam.c |
* |
* Copyright (C) 1991-1998, Thomas G. Lane. |
- * Copyright (C) 2009, D. R. Commander. |
+ * Modified 2003-2008 by Guido Vollbeding. |
+ * Copyright (C) 2009-2010, D. R. Commander. |
* This file is part of the Independent JPEG Group's software. |
* For conditions of distribution and use, see the accompanying README file. |
* |
@@ -61,7 +62,50 @@ |
} |
+/* These are the sample quantization tables given in JPEG spec section K.1. |
+ * The spec says that the values given produce "good" quality, and |
+ * when divided by 2, "very good" quality. |
+ */ |
+static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { |
+ 16, 11, 10, 16, 24, 40, 51, 61, |
+ 12, 12, 14, 19, 26, 58, 60, 55, |
+ 14, 13, 16, 24, 40, 57, 69, 56, |
+ 14, 17, 22, 29, 51, 87, 80, 62, |
+ 18, 22, 37, 56, 68, 109, 103, 77, |
+ 24, 35, 55, 64, 81, 104, 113, 92, |
+ 49, 64, 78, 87, 103, 121, 120, 101, |
+ 72, 92, 95, 98, 112, 100, 103, 99 |
+}; |
+static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { |
+ 17, 18, 24, 47, 99, 99, 99, 99, |
+ 18, 21, 26, 66, 99, 99, 99, 99, |
+ 24, 26, 56, 99, 99, 99, 99, 99, |
+ 47, 66, 99, 99, 99, 99, 99, 99, |
+ 99, 99, 99, 99, 99, 99, 99, 99, |
+ 99, 99, 99, 99, 99, 99, 99, 99, |
+ 99, 99, 99, 99, 99, 99, 99, 99, |
+ 99, 99, 99, 99, 99, 99, 99, 99 |
+}; |
+ |
+ |
+#if JPEG_LIB_VERSION >= 70 |
GLOBAL(void) |
+jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) |
+/* Set or change the 'quality' (quantization) setting, using default tables |
+ * and straight percentage-scaling quality scales. |
+ * This entry point allows different scalings for luminance and chrominance. |
+ */ |
+{ |
+ /* Set up two quantization tables using the specified scaling */ |
+ jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, |
+ cinfo->q_scale_factor[0], force_baseline); |
+ jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, |
+ cinfo->q_scale_factor[1], force_baseline); |
+} |
+#endif |
+ |
+ |
+GLOBAL(void) |
jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, |
boolean force_baseline) |
/* Set or change the 'quality' (quantization) setting, using default tables |
@@ -70,31 +114,6 @@ |
* applications that insist on a linear percentage scaling. |
*/ |
{ |
- /* These are the sample quantization tables given in JPEG spec section K.1. |
- * The spec says that the values given produce "good" quality, and |
- * when divided by 2, "very good" quality. |
- */ |
- static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { |
- 16, 11, 10, 16, 24, 40, 51, 61, |
- 12, 12, 14, 19, 26, 58, 60, 55, |
- 14, 13, 16, 24, 40, 57, 69, 56, |
- 14, 17, 22, 29, 51, 87, 80, 62, |
- 18, 22, 37, 56, 68, 109, 103, 77, |
- 24, 35, 55, 64, 81, 104, 113, 92, |
- 49, 64, 78, 87, 103, 121, 120, 101, |
- 72, 92, 95, 98, 112, 100, 103, 99 |
- }; |
- static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { |
- 17, 18, 24, 47, 99, 99, 99, 99, |
- 18, 21, 26, 66, 99, 99, 99, 99, |
- 24, 26, 56, 99, 99, 99, 99, 99, |
- 47, 66, 99, 99, 99, 99, 99, 99, |
- 99, 99, 99, 99, 99, 99, 99, 99, |
- 99, 99, 99, 99, 99, 99, 99, 99, |
- 99, 99, 99, 99, 99, 99, 99, 99, |
- 99, 99, 99, 99, 99, 99, 99, 99 |
- }; |
- |
/* Set up two quantization tables using the specified scaling */ |
jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, |
scale_factor, force_baseline); |
@@ -285,6 +304,10 @@ |
/* Initialize everything not dependent on the color space */ |
+#if JPEG_LIB_VERSION >= 70 |
+ cinfo->scale_num = 1; /* 1:1 scaling */ |
+ cinfo->scale_denom = 1; |
+#endif |
cinfo->data_precision = BITS_IN_JSAMPLE; |
/* Set up two quantization tables using default quality of 75 */ |
jpeg_set_quality(cinfo, 75, TRUE); |
@@ -321,6 +344,11 @@ |
/* By default, use the simpler non-cosited sampling alignment */ |
cinfo->CCIR601_sampling = FALSE; |
+#if JPEG_LIB_VERSION >= 70 |
+ /* By default, apply fancy downsampling */ |
+ cinfo->do_fancy_downsampling = TRUE; |
+#endif |
+ |
/* No input smoothing */ |
cinfo->smoothing_factor = 0; |