Merge from libjpeg-turbo 1.0.2, including fixes for errors in generation of grayscale and high-quality JPEGs


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4294 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/jpeg/turbojpegl.c b/common/jpeg/turbojpegl.c
index 2150a2d..eeaedd1 100644
--- a/common/jpeg/turbojpegl.c
+++ b/common/jpeg/turbojpegl.c
@@ -166,7 +166,8 @@
 		jpeg_set_colorspace(&j->cinfo, JCS_GRAYSCALE);
 	else
 		jpeg_set_colorspace(&j->cinfo, JCS_YCbCr);
-	j->cinfo.dct_method = JDCT_FASTEST;
+	if(qual>=96) j->cinfo.dct_method=JDCT_ISLOW;
+	else j->cinfo.dct_method=JDCT_FASTEST;
 
 	j->cinfo.comp_info[0].h_samp_factor=hsampfactor[jpegsub];
 	j->cinfo.comp_info[1].h_samp_factor=1;