aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gall <tom.gall@linaro.org>2011-08-29 10:01:09 -0500
committerTom Gall <tom.gall@linaro.org>2011-08-29 10:01:09 -0500
commit80a9edd69dd458905189babf83630b35c4b3e3b5 (patch)
treefa801a127a5af37ed2357840c624b53587037251
parente15681f491e8dc2762ad449980b0a3eafbddaca8 (diff)
Repair conflicts (meaningless crap)
-rw-r--r--ChangeLog.txt7
-rw-r--r--jdcolor.c103
-rw-r--r--jversion.h3
-rw-r--r--simd/jsimd.h43
4 files changed, 152 insertions, 4 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index c16c571..63790b1 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -29,9 +29,8 @@ libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license.
[9] libjpeg-turbo can now be built with YASM.
-[10] Added SIMD-accelerated fast integer inverse DCT and YCbCr-to-RGB color
-conversion routines to accelerate JPEG decoding on ARM Linux and iOS platforms
-that have NEON instructions.
+[10] Added SIMD acceleration for ARM Linux and iOS platforms that support
+NEON instructions.
[11] Refactored the TurboJPEG C API so that it uses pixel formats to define the
size and component order of the uncompressed source/destination images as well
@@ -61,6 +60,8 @@ worst-case JPEG size based on the level of chrominance subsampling.
[16] Fixed 32-bit supplementary package for amd64 Debian systems which was
broken by enhancements to the packaging system in 1.1.
+[17] Support for decoding JPEG images that use the CMYK or YCCK colorspaces.
+
1.1.1
=====
diff --git a/jdcolor.c b/jdcolor.c
index 0af024c..f8b176e 100644
--- a/jdcolor.c
+++ b/jdcolor.c
@@ -107,6 +107,104 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
}
}
+/*
+ * Convert inverted CMYK to RGB
+ */
+METHODDEF(void)
+cmyk_rgb_convert (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ JSAMPLE cyan, magenta, yellow, black;
+ register JSAMPROW outptr;
+ register JSAMPROW inptr0, inptr1, inptr2, inptr3;
+ 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];
+
+ while (--num_rows >= 0) {
+ inptr0 = input_buf[0][input_row];
+ inptr1 = input_buf[1][input_row];
+ inptr2 = input_buf[2][input_row];
+ inptr3 = input_buf[3][input_row];
+ input_row++;
+ outptr = *output_buf++;
+ for (col = 0; col < num_cols; col++) {
+ cyan = GETJSAMPLE(inptr0[col]);
+ magenta = GETJSAMPLE(inptr1[col]);
+ yellow = GETJSAMPLE(inptr2[col]);
+ black = GETJSAMPLE(inptr3[col]);
+
+ outptr[rindex] = (JSAMPLE)((int)cyan * (int)black / MAXJSAMPLE);
+ outptr[gindex] = (JSAMPLE)((int)magenta * (int)black / MAXJSAMPLE);
+ outptr[bindex] = (JSAMPLE)((int)yellow * (int)black / MAXJSAMPLE);
+ outptr += rgbstride;
+ }
+ }
+}
+
+/*
+ * Convert YCCK to RGB
+ */
+METHODDEF(void)
+ycck_rgb_convert (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ JSAMPLE cyan, magenta, yellow, black;
+ register int y, cb, cr;
+ register JSAMPROW outptr;
+ register JSAMPROW inptr0, inptr1, inptr2, inptr3;
+ 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;
+ register int * Cbbtab = cconvert->Cb_b_tab;
+ register INT32 * Crgtab = cconvert->Cr_g_tab;
+ register INT32 * Cbgtab = cconvert->Cb_g_tab;
+ SHIFT_TEMPS
+
+ while (--num_rows >= 0) {
+ inptr0 = input_buf[0][input_row];
+ inptr1 = input_buf[1][input_row];
+ inptr2 = input_buf[2][input_row];
+ inptr3 = input_buf[3][input_row];
+ input_row++;
+ outptr = *output_buf++;
+ for (col = 0; col < num_cols; col++) {
+
+ /********* Read YCCK Pixel **********/
+ y = GETJSAMPLE(inptr0[col]);
+ cb = GETJSAMPLE(inptr1[col]);
+ cr = GETJSAMPLE(inptr2[col]);
+ black = GETJSAMPLE(inptr3[col]);
+
+ /********* Convert YCCK to CMYK **********/
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
+ cyan = range_limit[MAXJSAMPLE - (y + Crrtab[cr])];
+ magenta = range_limit[MAXJSAMPLE - (y +
+ ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
+ SCALEBITS)))];
+ yellow = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])];
+
+ /********* Convert CMYK to RGB **********/
+ outptr[rindex] = (JSAMPLE)((int)cyan * (int)black / MAXJSAMPLE);
+ outptr[gindex] = (JSAMPLE)((int)magenta * (int)black / MAXJSAMPLE);
+ outptr[bindex] = (JSAMPLE)((int)yellow * (int)black / MAXJSAMPLE);
+ outptr += rgbstride;
+ }
+ }
+}
/*
* Convert some rows of samples to the output colorspace.
@@ -386,6 +484,11 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
} else if (cinfo->jpeg_color_space == cinfo->out_color_space &&
rgb_pixelsize[cinfo->out_color_space] == 3) {
cconvert->pub.color_convert = null_convert;
+ } else if (cinfo->jpeg_color_space == JCS_CMYK) {
+ cconvert->pub.color_convert = cmyk_rgb_convert;
+ } else if (cinfo->jpeg_color_space == JCS_YCCK) {
+ cconvert->pub.color_convert = ycck_rgb_convert;
+ build_ycc_rgb_table(cinfo);
} else
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
break;
diff --git a/jversion.h b/jversion.h
index 8519172..a045405 100644
--- a/jversion.h
+++ b/jversion.h
@@ -32,4 +32,5 @@
#define LJTCOPYRIGHT "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
- "Copyright (C) 2009-2011 D. R. Commander"
+ "Copyright (C) 2009-2011 D. R. Commander\n" \
+ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)"
diff --git a/simd/jsimd.h b/simd/jsimd.h
index 39a0867..6ee99cc 100644
--- a/simd/jsimd.h
+++ b/simd/jsimd.h
@@ -328,6 +328,35 @@ EXTERN(void) jsimd_ycc_extxrgb_convert_sse2
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_rgb_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgb_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgbx_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgr_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgrx_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxbgr_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxrgb_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+
EXTERN(void) jsimd_ycc_rgb_convert_neon
JPP((JDIMENSION out_width,
JSAMPIMAGE input_buf, JDIMENSION input_row,
@@ -502,6 +531,10 @@ EXTERN(void) jsimd_convsamp_sse2 JPP((JSAMPARRAY sample_data,
JDIMENSION start_col,
DCTELEM * workspace));
+EXTERN(void) jsimd_convsamp_neon JPP((JSAMPARRAY sample_data,
+ JDIMENSION start_col,
+ DCTELEM * workspace));
+
EXTERN(void) jsimd_convsamp_float_3dnow JPP((JSAMPARRAY sample_data,
JDIMENSION start_col,
FAST_FLOAT * workspace));
@@ -523,6 +556,8 @@ EXTERN(void) jsimd_fdct_islow_sse2 JPP((DCTELEM * data));
extern const int jconst_fdct_islow_sse2[];
EXTERN(void) jsimd_fdct_ifast_sse2 JPP((DCTELEM * data));
+EXTERN(void) jsimd_fdct_ifast_neon JPP((DCTELEM * data));
+
EXTERN(void) jsimd_fdct_float_3dnow JPP((FAST_FLOAT * data));
extern const int jconst_fdct_float_sse[];
@@ -537,6 +572,10 @@ EXTERN(void) jsimd_quantize_sse2 JPP((JCOEFPTR coef_block,
DCTELEM * divisors,
DCTELEM * workspace));
+EXTERN(void) jsimd_quantize_neon JPP((JCOEFPTR coef_block,
+ DCTELEM * divisors,
+ DCTELEM * workspace));
+
EXTERN(void) jsimd_quantize_float_3dnow JPP((JCOEFPTR coef_block,
FAST_FLOAT * divisors,
FAST_FLOAT * workspace));
@@ -599,6 +638,10 @@ EXTERN(void) jsimd_idct_ifast_sse2 JPP((void * dct_table,
JSAMPARRAY output_buf,
JDIMENSION output_col));
+EXTERN(void) jsimd_idct_islow_neon JPP((void * dct_table,
+ JCOEFPTR coef_block,
+ JSAMPARRAY output_buf,
+ JDIMENSION output_col));
EXTERN(void) jsimd_idct_ifast_neon JPP((void * dct_table,
JCOEFPTR coef_block,
JSAMPARRAY output_buf,