aboutsummaryrefslogtreecommitdiff
path: root/jdmaster.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commitd9bb1510bee7d9bf2a0f2699c647a65e67ab9cf8 (patch)
treea23a17e9a6b51b90db0a8fa1f15423f488814866 /jdmaster.c
parentc6a7fc661d57f86ac08cd637abc881cbe687b11a (diff)
downloadjpeg-cdma-import.tar.gz
Diffstat (limited to 'jdmaster.c')
-rw-r--r--jdmaster.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/jdmaster.c b/jdmaster.c
index 2802c5b..8925013 100644
--- a/jdmaster.c
+++ b/jdmaster.c
@@ -47,11 +47,24 @@ use_merged_upsample (j_decompress_ptr cinfo)
/* Merging is the equivalent of plain box-filter upsampling */
if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
return FALSE;
+
+#ifdef ANDROID_RGB
+ /* jdmerge.c only supports YCC=>RGB565 and YCC=>RGB color conversion */
+ if (cinfo->jpeg_color_space != JCS_YCbCr ||
+ cinfo->num_components != 3 ||
+ cinfo->out_color_components != 3 ||
+ (cinfo->out_color_space != JCS_RGB_565 &&
+ cinfo->out_color_space != JCS_RGB)) {
+ return FALSE;
+ }
+#else
/* jdmerge.c only supports YCC=>RGB color conversion */
if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
cinfo->out_color_space != JCS_RGB ||
cinfo->out_color_components != RGB_PIXELSIZE)
return FALSE;
+#endif
+
/* and it only handles 2h1v or 2h2v sampling ratios */
if (cinfo->comp_info[0].h_samp_factor != 2 ||
cinfo->comp_info[1].h_samp_factor != 1 ||
@@ -179,11 +192,17 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
cinfo->out_color_components = RGB_PIXELSIZE;
break;
#endif /* else share code with YCbCr */
+#ifdef ANDROID_RGB
+ case JCS_RGB_565:
+#endif
case JCS_YCbCr:
cinfo->out_color_components = 3;
break;
case JCS_CMYK:
case JCS_YCCK:
+#ifdef ANDROID_RGB
+ case JCS_RGBA_8888:
+#endif
cinfo->out_color_components = 4;
break;
default: /* else must be same colorspace as in file */
@@ -217,7 +236,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
* For most steps we can mathematically guarantee that the initial value
* of x is within MAXJSAMPLE+1 of the legal range, so a table running from
* -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial
- * limiting step (just after the IDCT), a wildly out-of-range value is
+ * limiting step (just after the IDCT), a wildly out-of-range value is
* possible if the input data is corrupt. To avoid any chance of indexing
* off the end of memory and getting a bad-pointer trap, we perform the
* post-IDCT limiting thus: