]> granicus.if.org Git - libjpeg-turbo/commitdiff
Use plain upsampling if merged isn't accelerated
authorDRC <information@libjpeg-turbo.org>
Thu, 14 Jul 2016 01:39:11 +0000 (20:39 -0500)
committerDRC <information@libjpeg-turbo.org>
Thu, 14 Jul 2016 03:06:11 +0000 (22:06 -0500)
Currently, this only affects ARM, since it is the only platform that
accelerates YCbCr-to-RGB conversion but not merged upsampling.  Even if
"plain" upsampling isn't accelerated, the combination of accelerated
color conversion + unaccelerated plain upsampling is still faster than
the unaccelerated merged upsampling algorithms.

Closes #81

ChangeLog.md
jdmaster.c

index dfd11b44b621235f14b383875329bcbd364872cc..7ab1bdc3add86aadbe0154fd3a716ab1683b2aac 100644 (file)
@@ -48,6 +48,13 @@ conformance issue.
 rotating or transposing JPEG images that use 4:2:2 (h2v1) chroma subsampling.
 The h1v2 fancy upsampling algorithm is not currently SIMD-accelerated.
 
+5. If merged upsampling isn't SIMD-accelerated but YCbCr-to-RGB conversion is,
+then libjpeg-turbo will now disable merged upsampling when decompressing YCbCr
+JPEG images into RGB or extended RGB output images.  This significantly speeds
+up the decompression of 4:2:0 and 4:2:2 JPEGs on ARM platforms if fancy
+upsampling is not used (for example, if the `-nosmooth` option to djpeg is
+specified.)
+
 
 1.5.0
 =====
index 7908849bf9faee5d52ce03e94c633873381967c2..9079dda65c726b73723f35f91e16cb895c468365 100644 (file)
@@ -22,6 +22,7 @@
 #include "jpeglib.h"
 #include "jpegcomp.h"
 #include "jdmaster.h"
+#include "jsimd.h"
 
 
 /*
@@ -69,6 +70,17 @@ use_merged_upsample (j_decompress_ptr cinfo)
       cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
       cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
     return FALSE;
+#ifdef WITH_SIMD
+  /* If YCbCr-to-RGB color conversion is SIMD-accelerated but merged upsampling
+     isn't, then disabling merged upsampling is likely to be faster when
+     decompressing YCbCr JPEG images. */
+  if (!jsimd_can_h2v2_merged_upsample() && !jsimd_can_h2v1_merged_upsample() &&
+      jsimd_can_ycc_rgb() && cinfo->jpeg_color_space == JCS_YCbCr &&
+      (cinfo->out_color_space == JCS_RGB ||
+       (cinfo->out_color_space >= JCS_EXT_RGB &&
+        cinfo->out_color_space <= JCS_EXT_ARGB)))
+    return FALSE;
+#endif
   /* ??? also need to test for upsample-time rescaling, when & if supported */
   return TRUE;                  /* by golly, it'll work... */
 #else