Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: jdmaster.c

Issue 1270213002: Add support for decoding to 565 to libjpeg_turbo (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Link crbug in the README Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « jdcolor.c ('k') | jdmerge.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jdmaster.c
diff --git a/jdmaster.c b/jdmaster.c
index e1f9f9e7f54d8c16dbd68f53f01723b78204d29e..f0dd15f6c1e9d4a43fa8a0fda207b135bf9b3582 100644
--- a/jdmaster.c
+++ b/jdmaster.c
@@ -6,6 +6,8 @@
* Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, D. R. Commander.
+ * Copyright (C) 2013, Linaro Limited.
+
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains master control logic for the JPEG decompressor.
@@ -51,9 +53,10 @@ 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;
- /* jdmerge.c only supports YCC=>RGB color conversion */
+ /* jdmerge.c only supports YCC=>RGB and YCC=>RGB565 color conversion */
if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
(cinfo->out_color_space != JCS_RGB &&
+ cinfo->out_color_space != JCS_RGB565 &&
cinfo->out_color_space != JCS_EXT_RGB &&
cinfo->out_color_space != JCS_EXT_RGBX &&
cinfo->out_color_space != JCS_EXT_BGR &&
@@ -63,8 +66,12 @@ use_merged_upsample (j_decompress_ptr cinfo)
cinfo->out_color_space != JCS_EXT_RGBA &&
cinfo->out_color_space != JCS_EXT_BGRA &&
cinfo->out_color_space != JCS_EXT_ABGR &&
- cinfo->out_color_space != JCS_EXT_ARGB) ||
- cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space])
+ cinfo->out_color_space != JCS_EXT_ARGB))
+ return FALSE;
+ if ((cinfo->out_color_space == JCS_RGB565 &&
+ cinfo->out_color_components != 3) ||
+ (cinfo->out_color_space != JCS_RGB565 &&
+ cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]))
return FALSE;
/* and it only handles 2h1v or 2h2v sampling ratios */
if (cinfo->comp_info[0].h_samp_factor != 2 ||
@@ -352,6 +359,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
break;
case JCS_YCbCr:
+ case JCS_RGB565:
cinfo->out_color_components = 3;
break;
case JCS_CMYK:
« no previous file with comments | « jdcolor.c ('k') | jdmerge.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698