| Index: jccolor.c
|
| ===================================================================
|
| --- jccolor.c (revision 134206)
|
| +++ jccolor.c (working copy)
|
| @@ -3,7 +3,7 @@
|
| *
|
| * Copyright (C) 1991-1996, Thomas G. Lane.
|
| * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
| - * Copyright (C) 2009-2011, D. R. Commander.
|
| + * Copyright (C) 2009-2012, D. R. Commander.
|
| * This file is part of the Independent JPEG Group's software.
|
| * For conditions of distribution and use, see the accompanying README file.
|
| *
|
| @@ -14,6 +14,7 @@
|
| #include "jinclude.h"
|
| #include "jpeglib.h"
|
| #include "jsimd.h"
|
| +#include "config.h"
|
|
|
|
|
| /* Private subobject */
|
| @@ -95,6 +96,7 @@
|
| #define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
|
| #define rgb_ycc_convert_internal extrgb_ycc_convert_internal
|
| #define rgb_gray_convert_internal extrgb_gray_convert_internal
|
| +#define rgb_rgb_convert_internal extrgb_rgb_convert_internal
|
| #include "jccolext.c"
|
| #undef RGB_RED
|
| #undef RGB_GREEN
|
| @@ -102,6 +104,7 @@
|
| #undef RGB_PIXELSIZE
|
| #undef rgb_ycc_convert_internal
|
| #undef rgb_gray_convert_internal
|
| +#undef rgb_rgb_convert_internal
|
|
|
| #define RGB_RED EXT_RGBX_RED
|
| #define RGB_GREEN EXT_RGBX_GREEN
|
| @@ -109,6 +112,7 @@
|
| #define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
|
| #define rgb_ycc_convert_internal extrgbx_ycc_convert_internal
|
| #define rgb_gray_convert_internal extrgbx_gray_convert_internal
|
| +#define rgb_rgb_convert_internal extrgbx_rgb_convert_internal
|
| #include "jccolext.c"
|
| #undef RGB_RED
|
| #undef RGB_GREEN
|
| @@ -116,6 +120,7 @@
|
| #undef RGB_PIXELSIZE
|
| #undef rgb_ycc_convert_internal
|
| #undef rgb_gray_convert_internal
|
| +#undef rgb_rgb_convert_internal
|
|
|
| #define RGB_RED EXT_BGR_RED
|
| #define RGB_GREEN EXT_BGR_GREEN
|
| @@ -123,6 +128,7 @@
|
| #define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
|
| #define rgb_ycc_convert_internal extbgr_ycc_convert_internal
|
| #define rgb_gray_convert_internal extbgr_gray_convert_internal
|
| +#define rgb_rgb_convert_internal extbgr_rgb_convert_internal
|
| #include "jccolext.c"
|
| #undef RGB_RED
|
| #undef RGB_GREEN
|
| @@ -130,6 +136,7 @@
|
| #undef RGB_PIXELSIZE
|
| #undef rgb_ycc_convert_internal
|
| #undef rgb_gray_convert_internal
|
| +#undef rgb_rgb_convert_internal
|
|
|
| #define RGB_RED EXT_BGRX_RED
|
| #define RGB_GREEN EXT_BGRX_GREEN
|
| @@ -137,6 +144,7 @@
|
| #define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
|
| #define rgb_ycc_convert_internal extbgrx_ycc_convert_internal
|
| #define rgb_gray_convert_internal extbgrx_gray_convert_internal
|
| +#define rgb_rgb_convert_internal extbgrx_rgb_convert_internal
|
| #include "jccolext.c"
|
| #undef RGB_RED
|
| #undef RGB_GREEN
|
| @@ -144,6 +152,7 @@
|
| #undef RGB_PIXELSIZE
|
| #undef rgb_ycc_convert_internal
|
| #undef rgb_gray_convert_internal
|
| +#undef rgb_rgb_convert_internal
|
|
|
| #define RGB_RED EXT_XBGR_RED
|
| #define RGB_GREEN EXT_XBGR_GREEN
|
| @@ -151,6 +160,7 @@
|
| #define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
|
| #define rgb_ycc_convert_internal extxbgr_ycc_convert_internal
|
| #define rgb_gray_convert_internal extxbgr_gray_convert_internal
|
| +#define rgb_rgb_convert_internal extxbgr_rgb_convert_internal
|
| #include "jccolext.c"
|
| #undef RGB_RED
|
| #undef RGB_GREEN
|
| @@ -158,6 +168,7 @@
|
| #undef RGB_PIXELSIZE
|
| #undef rgb_ycc_convert_internal
|
| #undef rgb_gray_convert_internal
|
| +#undef rgb_rgb_convert_internal
|
|
|
| #define RGB_RED EXT_XRGB_RED
|
| #define RGB_GREEN EXT_XRGB_GREEN
|
| @@ -165,6 +176,7 @@
|
| #define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
|
| #define rgb_ycc_convert_internal extxrgb_ycc_convert_internal
|
| #define rgb_gray_convert_internal extxrgb_gray_convert_internal
|
| +#define rgb_rgb_convert_internal extxrgb_rgb_convert_internal
|
| #include "jccolext.c"
|
| #undef RGB_RED
|
| #undef RGB_GREEN
|
| @@ -172,6 +184,7 @@
|
| #undef RGB_PIXELSIZE
|
| #undef rgb_ycc_convert_internal
|
| #undef rgb_gray_convert_internal
|
| +#undef rgb_rgb_convert_internal
|
|
|
|
|
| /*
|
| @@ -306,6 +319,52 @@
|
|
|
|
|
| /*
|
| + * Extended RGB to plain RGB conversion
|
| + */
|
| +
|
| +METHODDEF(void)
|
| +rgb_rgb_convert (j_compress_ptr cinfo,
|
| + JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
| + JDIMENSION output_row, int num_rows)
|
| +{
|
| + switch (cinfo->in_color_space) {
|
| + case JCS_EXT_RGB:
|
| + extrgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + case JCS_EXT_RGBX:
|
| + case JCS_EXT_RGBA:
|
| + extrgbx_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + case JCS_EXT_BGR:
|
| + extbgr_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + case JCS_EXT_BGRX:
|
| + case JCS_EXT_BGRA:
|
| + extbgrx_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + case JCS_EXT_XBGR:
|
| + case JCS_EXT_ABGR:
|
| + extxbgr_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + case JCS_EXT_XRGB:
|
| + case JCS_EXT_ARGB:
|
| + extxrgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + default:
|
| + rgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
|
| + num_rows);
|
| + break;
|
| + }
|
| +}
|
| +
|
| +
|
| +/*
|
| * Convert some rows of samples to the JPEG colorspace.
|
| * This version handles Adobe-style CMYK->YCCK conversion,
|
| * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same
|
| @@ -522,21 +581,25 @@
|
| break;
|
|
|
| case JCS_RGB:
|
| - case JCS_EXT_RGB:
|
| - case JCS_EXT_RGBX:
|
| - case JCS_EXT_BGR:
|
| - case JCS_EXT_BGRX:
|
| - case JCS_EXT_XBGR:
|
| - case JCS_EXT_XRGB:
|
| - case JCS_EXT_RGBA:
|
| - case JCS_EXT_BGRA:
|
| - case JCS_EXT_ABGR:
|
| - case JCS_EXT_ARGB:
|
| if (cinfo->num_components != 3)
|
| ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
| - if (cinfo->in_color_space == cinfo->jpeg_color_space &&
|
| - rgb_pixelsize[cinfo->in_color_space] == 3)
|
| + if (rgb_red[cinfo->in_color_space] == 0 &&
|
| + rgb_green[cinfo->in_color_space] == 1 &&
|
| + rgb_blue[cinfo->in_color_space] == 2 &&
|
| + rgb_pixelsize[cinfo->in_color_space] == 3)
|
| cconvert->pub.color_convert = null_convert;
|
| + else if (cinfo->in_color_space == JCS_RGB ||
|
| + cinfo->in_color_space == JCS_EXT_RGB ||
|
| + cinfo->in_color_space == JCS_EXT_RGBX ||
|
| + cinfo->in_color_space == JCS_EXT_BGR ||
|
| + cinfo->in_color_space == JCS_EXT_BGRX ||
|
| + cinfo->in_color_space == JCS_EXT_XBGR ||
|
| + cinfo->in_color_space == JCS_EXT_XRGB ||
|
| + cinfo->in_color_space == JCS_EXT_RGBA ||
|
| + cinfo->in_color_space == JCS_EXT_BGRA ||
|
| + cinfo->in_color_space == JCS_EXT_ABGR ||
|
| + cinfo->in_color_space == JCS_EXT_ARGB)
|
| + cconvert->pub.color_convert = rgb_rgb_convert;
|
| else
|
| ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
| break;
|
|
|