]> granicus.if.org Git - libjpeg-turbo/commitdiff
Improve performance a bit for the non-SIMD case
authorDRC <dcommander@users.sourceforge.net>
Sun, 27 Feb 2011 10:51:20 +0000 (10:51 +0000)
committerDRC <dcommander@users.sourceforge.net>
Sun, 27 Feb 2011 10:51:20 +0000 (10:51 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@472 632fc199-4ca6-4c93-a231-07263d6284db

jdcolor.c

index bc73b3f4621ed45936b24cdbbf90d1a8d7138d97..0af024cc53a7222f7cba952b557f334328a117dd 100644 (file)
--- a/jdcolor.c
+++ b/jdcolor.c
@@ -130,6 +130,10 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
   register JSAMPROW inptr0, inptr1, inptr2;
   register JDIMENSION col;
   JDIMENSION num_cols = cinfo->output_width;
+  int rindex = rgb_red[cinfo->out_color_space];
+  int gindex = rgb_green[cinfo->out_color_space];
+  int bindex = rgb_blue[cinfo->out_color_space];
+  int rgbstride = rgb_pixelsize[cinfo->out_color_space];
   /* copy these pointers into registers if possible */
   register JSAMPLE * range_limit = cinfo->sample_range_limit;
   register int * Crrtab = cconvert->Cr_r_tab;
@@ -149,12 +153,12 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
       cb = GETJSAMPLE(inptr1[col]);
       cr = GETJSAMPLE(inptr2[col]);
       /* Range-limiting is essential due to noise introduced by DCT losses. */
-      outptr[rgb_red[cinfo->out_color_space]] =   range_limit[y + Crrtab[cr]];
-      outptr[rgb_green[cinfo->out_color_space]] = range_limit[y +
+      outptr[rindex] =   range_limit[y + Crrtab[cr]];
+      outptr[gindex] = range_limit[y +
                              ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
                                                 SCALEBITS))];
-      outptr[rgb_blue[cinfo->out_color_space]] =  range_limit[y + Cbbtab[cb]];
-      outptr += rgb_pixelsize[cinfo->out_color_space];
+      outptr[bindex] =  range_limit[y + Cbbtab[cb]];
+      outptr += rgbstride;
     }
   }
 }