Add quantization tables
Add various quantization tables suggested in #84 Still need to do chroma
This commit is contained in:
100
jcparam.c
100
jcparam.c
@@ -70,8 +70,9 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
||||
* 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[5][DCTSIZE2] = {
|
||||
static const unsigned int std_luminance_quant_tbl[6][DCTSIZE2] = {
|
||||
{
|
||||
// JPEG Annex K
|
||||
16, 11, 10, 16, 24, 40, 51, 61,
|
||||
12, 12, 14, 19, 26, 58, 60, 55,
|
||||
14, 13, 16, 24, 40, 57, 69, 56,
|
||||
@@ -82,6 +83,7 @@ static const unsigned int std_luminance_quant_tbl[5][DCTSIZE2] = {
|
||||
72, 92, 95, 98, 112, 100, 103, 99
|
||||
},
|
||||
{
|
||||
// Flat
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
@@ -102,14 +104,15 @@ static const unsigned int std_luminance_quant_tbl[5][DCTSIZE2] = {
|
||||
68, 90, 90, 96, 113, 102, 105, 103
|
||||
},
|
||||
{
|
||||
11, 15, 17, 19, 29, 40, 55, 62,
|
||||
16, 16, 18, 24, 33, 59, 60, 56,
|
||||
16, 19, 22, 29, 43, 59, 69, 58,
|
||||
22, 22, 30, 43, 59, 89, 81, 65,
|
||||
27, 35, 47, 75, 69, 115, 105, 78,
|
||||
49, 45, 59, 70, 85, 106, 113, 93,
|
||||
52, 67, 78, 89, 103, 123, 120, 102,
|
||||
71, 92, 96, 98, 112, 100, 103, 99
|
||||
// From http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=20333&p=98008#p98008
|
||||
16, 16, 16, 18, 25, 37, 56, 85,
|
||||
16, 17, 20, 27, 34, 40, 53, 75,
|
||||
16, 20, 24, 31, 43, 62, 91, 135,
|
||||
18, 27, 31, 40, 53, 74, 106, 156,
|
||||
25, 34, 43, 53, 69, 94, 131, 189,
|
||||
37, 40, 62, 74, 94, 124, 169, 238,
|
||||
56, 53, 91, 106, 131, 169, 226, 311,
|
||||
85, 75, 135, 156, 189, 238, 311, 418
|
||||
},
|
||||
{
|
||||
9, 10, 12, 14, 27, 32, 51, 62,
|
||||
@@ -120,10 +123,58 @@ static const unsigned int std_luminance_quant_tbl[5][DCTSIZE2] = {
|
||||
40, 42, 59, 84, 88, 124, 132, 111,
|
||||
42, 64, 78, 95, 105, 126, 125, 99,
|
||||
70, 75, 100, 102, 116, 100, 107, 98
|
||||
},
|
||||
{
|
||||
#if 0
|
||||
// DCTune perceptual optimization of compressed dental X-Rays (1997) Watson, Taylor, Borthwick
|
||||
7, 8, 10, 14, 23, 44, 95, 241,
|
||||
8, 8, 11, 15, 25, 47, 102, 255,
|
||||
10, 11, 13, 19, 31, 58, 127, 255,
|
||||
14, 15, 19, 27, 44, 83, 181, 255,
|
||||
23, 25, 31, 44, 72, 136, 255, 255,
|
||||
44, 47, 58, 83, 136, 255, 255, 255,
|
||||
95, 102, 127, 181, 255, 255, 255, 255,
|
||||
241, 255, 255, 255, 255, 255, 255, 255
|
||||
#endif
|
||||
#if 0
|
||||
// A visual detection model for DCT coefficient quantization (12/9/93) Ahumada, Watson, Peterson
|
||||
15, 11, 11, 12, 15, 19, 25, 32,
|
||||
11, 13, 10, 10, 12, 15, 19, 24,
|
||||
11, 10, 14, 14, 16, 18, 22, 27,
|
||||
12, 10, 14, 18, 21, 24, 28, 33,
|
||||
15, 12, 16, 21, 26, 31, 36, 42,
|
||||
19, 15, 18, 24, 31, 38, 45, 53,
|
||||
25, 19, 22, 28, 36, 45, 55, 65,
|
||||
32, 24, 27, 33, 42, 53, 65, 77
|
||||
#endif
|
||||
#if 1
|
||||
// Relevance of human vision to JPEG-DCT compression (1992) Klein, Silverstein and Carney.
|
||||
10, 12, 14, 19, 26, 38, 57, 86,
|
||||
12, 18, 21, 28, 35, 41, 54, 76,
|
||||
14, 21, 25, 32, 44, 63, 92, 136,
|
||||
19, 28, 32, 41, 54, 75, 107, 157,
|
||||
26, 35, 44, 54, 70, 95, 132, 190,
|
||||
38, 41, 63, 75, 95, 125, 170, 239,
|
||||
57, 54, 92, 107, 132, 170, 227, 312,
|
||||
86, 76, 136, 157, 190, 239, 312, 419
|
||||
#endif
|
||||
#if 0
|
||||
// An improved detection model for DCT coefficient quantization (1993) Peterson, Ahumada and Watson
|
||||
14, 10, 11, 14, 19, 25, 34, 45,
|
||||
10, 11, 11, 12, 15, 20, 26, 33,
|
||||
11, 11, 15, 18, 21, 25, 31, 38,
|
||||
14, 12, 18, 24, 28, 33, 39, 47,
|
||||
19, 15, 21, 28, 36, 43, 51, 59,
|
||||
25, 20, 25, 33, 43, 54, 64, 74,
|
||||
34, 26, 31, 39, 51, 64, 77, 91,
|
||||
45, 33, 38, 47, 59, 74, 91, 108
|
||||
#endif
|
||||
}
|
||||
};
|
||||
static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
|
||||
static const unsigned int std_chrominance_quant_tbl[6][DCTSIZE2] = {
|
||||
{
|
||||
// JPEG Annex K
|
||||
17, 18, 24, 47, 99, 99, 99, 99,
|
||||
18, 21, 26, 66, 99, 99, 99, 99,
|
||||
24, 26, 56, 99, 99, 99, 99, 99,
|
||||
@@ -134,6 +185,7 @@ static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
99, 99, 99, 99, 99, 99, 99, 99
|
||||
},
|
||||
{
|
||||
// Flat
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
@@ -154,14 +206,15 @@ static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
99, 99, 99, 99, 99, 99, 99, 99
|
||||
},
|
||||
{
|
||||
8, 14, 17, 21, 90, 98, 98, 99,
|
||||
14, 15, 17, 46, 92, 93, 90, 97,
|
||||
16, 21, 44, 94, 96, 96, 98, 98,
|
||||
27, 31, 84, 85, 96, 96, 98, 98,
|
||||
31, 92, 96, 94, 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
|
||||
// From http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=20333&p=98008#p98008
|
||||
16, 16, 16, 18, 25, 37, 56, 85,
|
||||
16, 17, 20, 27, 34, 40, 53, 75,
|
||||
16, 20, 24, 31, 43, 62, 91, 135,
|
||||
18, 27, 31, 40, 53, 74, 106, 156,
|
||||
25, 34, 43, 53, 69, 94, 131, 189,
|
||||
37, 40, 62, 74, 94, 124, 169, 238,
|
||||
56, 53, 91, 106, 131, 169, 226, 311,
|
||||
85, 75, 135, 156, 189, 238, 311, 418
|
||||
},
|
||||
{
|
||||
9, 10, 17, 19, 62, 89, 91, 97,
|
||||
@@ -172,6 +225,17 @@ static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
99, 100, 98, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
97, 97, 99, 99, 99, 99, 97, 99
|
||||
},
|
||||
{
|
||||
// JPEG Annex K
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
95
rdswitch.c
95
rdswitch.c
@@ -279,7 +279,7 @@ bogus:
|
||||
* 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[5][DCTSIZE2] = {
|
||||
static const unsigned int std_luminance_quant_tbl[6][DCTSIZE2] = {
|
||||
{
|
||||
16, 11, 10, 16, 24, 40, 51, 61,
|
||||
12, 12, 14, 19, 26, 58, 60, 55,
|
||||
@@ -311,14 +311,15 @@ static const unsigned int std_luminance_quant_tbl[5][DCTSIZE2] = {
|
||||
68, 90, 90, 96, 113, 102, 105, 103
|
||||
},
|
||||
{
|
||||
11, 15, 17, 19, 29, 40, 55, 62,
|
||||
16, 16, 18, 24, 33, 59, 60, 56,
|
||||
16, 19, 22, 29, 43, 59, 69, 58,
|
||||
22, 22, 30, 43, 59, 89, 81, 65,
|
||||
27, 35, 47, 75, 69, 115, 105, 78,
|
||||
49, 45, 59, 70, 85, 106, 113, 93,
|
||||
52, 67, 78, 89, 103, 123, 120, 102,
|
||||
71, 92, 96, 98, 112, 100, 103, 99
|
||||
// From http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=20333&p=98008#p98008
|
||||
16, 16, 16, 18, 25, 37, 56, 85,
|
||||
16, 17, 20, 27, 34, 40, 53, 75,
|
||||
16, 20, 24, 31, 43, 62, 91, 135,
|
||||
18, 27, 31, 40, 53, 74, 106, 156,
|
||||
25, 34, 43, 53, 69, 94, 131, 189,
|
||||
37, 40, 62, 74, 94, 124, 169, 238,
|
||||
56, 53, 91, 106, 131, 169, 226, 311,
|
||||
85, 75, 135, 156, 189, 238, 311, 418
|
||||
},
|
||||
{
|
||||
9, 10, 12, 14, 27, 32, 51, 62,
|
||||
@@ -329,9 +330,56 @@ static const unsigned int std_luminance_quant_tbl[5][DCTSIZE2] = {
|
||||
40, 42, 59, 84, 88, 124, 132, 111,
|
||||
42, 64, 78, 95, 105, 126, 125, 99,
|
||||
70, 75, 100, 102, 116, 100, 107, 98
|
||||
},
|
||||
{
|
||||
#if 0
|
||||
// DCTune perceptual optimization of compressed dental X-Rays (1997) Watson, Taylor, Borthwick
|
||||
7, 8, 10, 14, 23, 44, 95, 241,
|
||||
8, 8, 11, 15, 25, 47, 102, 255,
|
||||
10, 11, 13, 19, 31, 58, 127, 255,
|
||||
14, 15, 19, 27, 44, 83, 181, 255,
|
||||
23, 25, 31, 44, 72, 136, 255, 255,
|
||||
44, 47, 58, 83, 136, 255, 255, 255,
|
||||
95, 102, 127, 181, 255, 255, 255, 255,
|
||||
241, 255, 255, 255, 255, 255, 255, 255
|
||||
#endif
|
||||
#if 0
|
||||
// A visual detection model for DCT coefficient quantization (12/9/93) Ahumada, Watson, Peterson
|
||||
15, 11, 11, 12, 15, 19, 25, 32,
|
||||
11, 13, 10, 10, 12, 15, 19, 24,
|
||||
11, 10, 14, 14, 16, 18, 22, 27,
|
||||
12, 10, 14, 18, 21, 24, 28, 33,
|
||||
15, 12, 16, 21, 26, 31, 36, 42,
|
||||
19, 15, 18, 24, 31, 38, 45, 53,
|
||||
25, 19, 22, 28, 36, 45, 55, 65,
|
||||
32, 24, 27, 33, 42, 53, 65, 77
|
||||
#endif
|
||||
#if 1
|
||||
// Relevance of human vision to JPEG-DCT compression (1992) Klein, Silverstein and Carney.
|
||||
10, 12, 14, 19, 26, 38, 57, 86,
|
||||
12, 18, 21, 28, 35, 41, 54, 76,
|
||||
14, 21, 25, 32, 44, 63, 92, 136,
|
||||
19, 28, 32, 41, 54, 75, 107, 157,
|
||||
26, 35, 44, 54, 70, 95, 132, 190,
|
||||
38, 41, 63, 75, 95, 125, 170, 239,
|
||||
57, 54, 92, 107, 132, 170, 227, 312,
|
||||
86, 76, 136, 157, 190, 239, 312, 419
|
||||
#endif
|
||||
#if 0
|
||||
// An improved detection model for DCT coefficient quantization (1993) Peterson, Ahumada and Watson
|
||||
14, 10, 11, 14, 19, 25, 34, 45,
|
||||
10, 11, 11, 12, 15, 20, 26, 33,
|
||||
11, 11, 15, 18, 21, 25, 31, 38,
|
||||
14, 12, 18, 24, 28, 33, 39, 47,
|
||||
19, 15, 21, 28, 36, 43, 51, 59,
|
||||
25, 20, 25, 33, 43, 54, 64, 74,
|
||||
34, 26, 31, 39, 51, 64, 77, 91,
|
||||
45, 33, 38, 47, 59, 74, 91, 108
|
||||
#endif
|
||||
}
|
||||
};
|
||||
static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
|
||||
static const unsigned int std_chrominance_quant_tbl[6][DCTSIZE2] = {
|
||||
{
|
||||
17, 18, 24, 47, 99, 99, 99, 99,
|
||||
18, 21, 26, 66, 99, 99, 99, 99,
|
||||
@@ -363,14 +411,15 @@ static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
99, 99, 99, 99, 99, 99, 99, 99
|
||||
},
|
||||
{
|
||||
8, 14, 17, 21, 90, 98, 98, 99,
|
||||
14, 15, 17, 46, 92, 93, 90, 97,
|
||||
16, 21, 44, 94, 96, 96, 98, 98,
|
||||
27, 31, 84, 85, 96, 96, 98, 98,
|
||||
31, 92, 96, 94, 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
|
||||
// From http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=20333&p=98008#p98008
|
||||
16, 16, 16, 18, 25, 37, 56, 85,
|
||||
16, 17, 20, 27, 34, 40, 53, 75,
|
||||
16, 20, 24, 31, 43, 62, 91, 135,
|
||||
18, 27, 31, 40, 53, 74, 106, 156,
|
||||
25, 34, 43, 53, 69, 94, 131, 189,
|
||||
37, 40, 62, 74, 94, 124, 169, 238,
|
||||
56, 53, 91, 106, 131, 169, 226, 311,
|
||||
85, 75, 135, 156, 189, 238, 311, 418
|
||||
},
|
||||
{
|
||||
9, 10, 17, 19, 62, 89, 91, 97,
|
||||
@@ -381,6 +430,16 @@ static const unsigned int std_chrominance_quant_tbl[5][DCTSIZE2] = {
|
||||
99, 100, 98, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
97, 97, 99, 99, 99, 99, 97, 99
|
||||
},
|
||||
{
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user