From 8019054e0d097786cec27e8ecdd5e4d6ab35428c Mon Sep 17 00:00:00 2001 From: Tom Gall Date: Thu, 22 Dec 2011 14:24:29 -0600 Subject: r698 : Improve performance of non-SIMD color conversion routines and use global constants to define colorspace extension parameters --- configure.ac | 14 +++ jccolext.c | 114 ++++++++++++++++++++++ jccolor.c | 231 +++++++++++++++++++++++++++++--------------- jconfig.h.in | 9 +- jdcolext.c | 94 ++++++++++++++++++ jdcolor.c | 216 +++++++++++++++++++++++++++++------------ jdmerge.c | 267 +++++++++++++++++++++++++++++---------------------- jdmrgext.c | 156 ++++++++++++++++++++++++++++++ jmorecfg.h | 42 +++++++- simd/jccolmmx.asm | 48 ++++----- simd/jccolss2-64.asm | 48 ++++----- simd/jccolss2.asm | 48 ++++----- simd/jcgrammx.asm | 48 ++++----- simd/jcgrass2-64.asm | 48 ++++----- simd/jcgrass2.asm | 48 ++++----- simd/jdcolmmx.asm | 48 ++++----- simd/jdcolss2-64.asm | 48 ++++----- simd/jdcolss2.asm | 48 ++++----- simd/jdmermmx.asm | 48 ++++----- simd/jdmerss2-64.asm | 48 ++++----- simd/jdmerss2.asm | 48 ++++----- simd/jsimdcfg.inc.h | 31 +++++- win/jconfig.h.in | 10 +- win/jsimdcfg.inc | 24 +++++ 24 files changed, 1227 insertions(+), 557 deletions(-) create mode 100644 jccolext.c create mode 100644 jdcolext.c create mode 100644 jdmrgext.c diff --git a/configure.ac b/configure.ac index 44a3ac1..91ca8ff 100644 --- a/configure.ac +++ b/configure.ac @@ -173,6 +173,20 @@ AC_MSG_RESULT($VERSION_SCRIPT) AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes") AC_SUBST(VERSION_SCRIPT_FLAG) +# Check for non-broken inline under various spellings +AC_MSG_CHECKING(for inline) +ljt_cv_inline="" +AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; } +int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))", +AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; } +int bar() { return foo();], ljt_cv_inline="__inline__", +AC_TRY_COMPILE(, [} __inline int foo() { return 0; } +int bar() { return foo();], ljt_cv_inline="__inline", +AC_TRY_COMPILE(, [} inline int foo() { return 0; } +int bar() { return foo();], ljt_cv_inline="inline")))) +AC_MSG_RESULT($ljt_cv_inline) +AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.]) + AC_MSG_CHECKING([whether to include arithmetic encoding support]) AC_ARG_WITH([arith-enc], AC_HELP_STRING([--without-arith-enc], [Omit arithmetic encoding support])) diff --git a/jccolext.c b/jccolext.c new file mode 100644 index 0000000..acbfa23 --- /dev/null +++ b/jccolext.c @@ -0,0 +1,114 @@ +/* + * jccolext.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * Copyright (C) 2009-2011, 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. + * + * This file contains input colorspace conversion routines. + */ + + +/* This file is included by jccolor.c */ + + +/* + * Convert some rows of samples to the JPEG colorspace. + * + * Note that we change from the application's interleaved-pixel format + * to our internal noninterleaved, one-plane-per-component format. + * The input buffer is therefore three times as wide as the output buffer. + * + * A starting row offset is provided only for the output buffer. The caller + * can easily adjust the passed input_buf value to accommodate any row + * offset required on that side. + */ + +INLINE +LOCAL(void) +rgb_ycc_convert_internal (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int r, g, b; + register INT32 * ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr0, outptr1, outptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = GETJSAMPLE(inptr[RGB_RED]); + g = GETJSAMPLE(inptr[RGB_GREEN]); + b = GETJSAMPLE(inptr[RGB_BLUE]); + inptr += RGB_PIXELSIZE; + /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations + * must be too; we do not need an explicit range-limiting operation. + * Hence the value being shifted is never negative, and we don't + * need the general RIGHT_SHIFT macro. + */ + /* Y */ + outptr0[col] = (JSAMPLE) + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); + /* Cb */ + outptr1[col] = (JSAMPLE) + ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) + >> SCALEBITS); + /* Cr */ + outptr2[col] = (JSAMPLE) + ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) + >> SCALEBITS); + } + } +} + + +/**************** Cases other than RGB -> YCbCr **************/ + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles RGB->grayscale conversion, which is the same + * as the RGB->Y portion of RGB->YCbCr. + * We assume rgb_ycc_start has been called (we only use the Y tables). + */ + +INLINE +LOCAL(void) +rgb_gray_convert_internal (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int r, g, b; + register INT32 * ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr = output_buf[0][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = GETJSAMPLE(inptr[RGB_RED]); + g = GETJSAMPLE(inptr[RGB_GREEN]); + b = GETJSAMPLE(inptr[RGB_BLUE]); + inptr += RGB_PIXELSIZE; + /* Y */ + outptr[col] = (JSAMPLE) + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); + } + } +} diff --git a/jccolor.c b/jccolor.c index 9559aa5..12804f3 100644 --- a/jccolor.c +++ b/jccolor.c @@ -3,7 +3,7 @@ * * Copyright (C) 1991-1996, Thomas G. Lane. * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2009-2011 D. R. Commander + * Copyright (C) 2009-2011, 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. * @@ -81,6 +81,99 @@ typedef my_color_converter * my_cconvert_ptr; #define TABLE_SIZE (8*(MAXJSAMPLE+1)) +/* Include inline routines for colorspace extensions */ + +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE + +#define RGB_RED EXT_RGB_RED +#define RGB_GREEN EXT_RGB_GREEN +#define RGB_BLUE EXT_RGB_BLUE +#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +#define rgb_ycc_convert_internal extrgb_ycc_convert_internal +#define rgb_gray_convert_internal extrgb_gray_convert_internal +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE +#undef rgb_ycc_convert_internal +#undef rgb_gray_convert_internal + +#define RGB_RED EXT_RGBX_RED +#define RGB_GREEN EXT_RGBX_GREEN +#define RGB_BLUE EXT_RGBX_BLUE +#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +#define rgb_ycc_convert_internal extrgbx_ycc_convert_internal +#define rgb_gray_convert_internal extrgbx_gray_convert_internal +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE +#undef rgb_ycc_convert_internal +#undef rgb_gray_convert_internal + +#define RGB_RED EXT_BGR_RED +#define RGB_GREEN EXT_BGR_GREEN +#define RGB_BLUE EXT_BGR_BLUE +#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +#define rgb_ycc_convert_internal extbgr_ycc_convert_internal +#define rgb_gray_convert_internal extbgr_gray_convert_internal +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE +#undef rgb_ycc_convert_internal +#undef rgb_gray_convert_internal + +#define RGB_RED EXT_BGRX_RED +#define RGB_GREEN EXT_BGRX_GREEN +#define RGB_BLUE EXT_BGRX_BLUE +#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +#define rgb_ycc_convert_internal extbgrx_ycc_convert_internal +#define rgb_gray_convert_internal extbgrx_gray_convert_internal +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE +#undef rgb_ycc_convert_internal +#undef rgb_gray_convert_internal + +#define RGB_RED EXT_XBGR_RED +#define RGB_GREEN EXT_XBGR_GREEN +#define RGB_BLUE EXT_XBGR_BLUE +#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +#define rgb_ycc_convert_internal extxbgr_ycc_convert_internal +#define rgb_gray_convert_internal extxbgr_gray_convert_internal +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE +#undef rgb_ycc_convert_internal +#undef rgb_gray_convert_internal + +#define RGB_RED EXT_XRGB_RED +#define RGB_GREEN EXT_XRGB_GREEN +#define RGB_BLUE EXT_XRGB_BLUE +#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +#define rgb_ycc_convert_internal extxrgb_ycc_convert_internal +#define rgb_gray_convert_internal extxrgb_gray_convert_internal +#include "jccolext.c" +#undef RGB_RED +#undef RGB_GREEN +#undef RGB_BLUE +#undef RGB_PIXELSIZE +#undef rgb_ycc_convert_internal +#undef rgb_gray_convert_internal + + /* * Initialize for RGB->YCC colorspace conversion. */ @@ -119,14 +212,6 @@ rgb_ycc_start (j_compress_ptr cinfo) /* * Convert some rows of samples to the JPEG colorspace. - * - * Note that we change from the application's interleaved-pixel format - * to our internal noninterleaved, one-plane-per-component format. - * The input buffer is therefore three times as wide as the output buffer. - * - * A starting row offset is provided only for the output buffer. The caller - * can easily adjust the passed input_buf value to accommodate any row - * offset required on that side. */ METHODDEF(void) @@ -134,47 +219,35 @@ rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register INT32 * ctab = cconvert->rgb_ycc_tab; - register JSAMPROW inptr; - register JSAMPROW outptr0, outptr1, outptr2; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->image_width; - int rindex = rgb_red[cinfo->in_color_space]; - int gindex = rgb_green[cinfo->in_color_space]; - int bindex = rgb_blue[cinfo->in_color_space]; - int rgbstride = rgb_pixelsize[cinfo->in_color_space]; - - while (--num_rows >= 0) { - inptr = *input_buf++; - outptr0 = output_buf[0][output_row]; - outptr1 = output_buf[1][output_row]; - outptr2 = output_buf[2][output_row]; - output_row++; - for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[rindex]); - g = GETJSAMPLE(inptr[gindex]); - b = GETJSAMPLE(inptr[bindex]); - inptr += rgbstride; - /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations - * must be too; we do not need an explicit range-limiting operation. - * Hence the value being shifted is never negative, and we don't - * need the general RIGHT_SHIFT macro. - */ - /* Y */ - outptr0[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); - /* Cb */ - outptr1[col] = (JSAMPLE) - ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) - >> SCALEBITS); - /* Cr */ - outptr2[col] = (JSAMPLE) - ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) - >> SCALEBITS); - } + switch (cinfo->in_color_space) { + case JCS_EXT_RGB: + extrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_RGBX: + extrgbx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_BGR: + extbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_BGRX: + extbgrx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_XBGR: + extxbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_XRGB: + extxrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + default: + rgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; } } @@ -184,9 +257,6 @@ rgb_ycc_convert (j_compress_ptr cinfo, /* * Convert some rows of samples to the JPEG colorspace. - * This version handles RGB->grayscale conversion, which is the same - * as the RGB->Y portion of RGB->YCbCr. - * We assume rgb_ycc_start has been called (we only use the Y tables). */ METHODDEF(void) @@ -194,32 +264,35 @@ rgb_gray_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { - my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register INT32 * ctab = cconvert->rgb_ycc_tab; - register JSAMPROW inptr; - register JSAMPROW outptr; - register JDIMENSION col; - JDIMENSION num_cols = cinfo->image_width; - int rindex = rgb_red[cinfo->in_color_space]; - int gindex = rgb_green[cinfo->in_color_space]; - int bindex = rgb_blue[cinfo->in_color_space]; - int rgbstride = rgb_pixelsize[cinfo->in_color_space]; - - while (--num_rows >= 0) { - inptr = *input_buf++; - outptr = output_buf[0][output_row]; - output_row++; - for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[rindex]); - g = GETJSAMPLE(inptr[gindex]); - b = GETJSAMPLE(inptr[bindex]); - inptr += rgbstride; - /* Y */ - outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); - } + switch (cinfo->in_color_space) { + case JCS_EXT_RGB: + extrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_RGBX: + extrgbx_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_BGR: + extbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_BGRX: + extbgrx_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_XBGR: + extxbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + case JCS_EXT_XRGB: + extxrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; + default: + rgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row, + num_rows); + break; } } diff --git a/jconfig.h.in b/jconfig.h.in index fbddf7d..4aef763 100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@ -27,6 +27,9 @@ /* Compiler does not support pointers to unspecified structures. */ #undef INCOMPLETE_TYPES_BROKEN +/* How to obtain function inlining. */ +#undef INLINE + /* Compiler has rather than standard . */ #undef NEED_BSD_STRINGS @@ -50,11 +53,5 @@ /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - /* Define to `unsigned int' if does not define. */ #undef size_t diff --git a/jdcolext.c b/jdcolext.c new file mode 100644 index 0000000..d0ccca3 --- /dev/null +++ b/jdcolext.c @@ -0,0 +1,94 @@ +/* + * jdcolext.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * Copyright (C) 2009, 2011, 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. + * + * This file contains output colorspace conversion routines. + */ + + +/* This file is included by jdcolor.c */ + + +/* + * Convert some rows of samples to the output colorspace. + * + * Note that we change from noninterleaved, one-plane-per-component format + * to interleaved-pixel format. The output buffer is therefore three times + * as wide as the input buffer. + * A starting row offset is provided only for the input buffer. The caller + * can easily adjust the passed output_buf value to accommodate any row + * offset required on that side. + */ + +INLINE +LOCAL(void) +ycc_rgb_convert_internal (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; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* 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]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + y = GETJSAMPLE(inptr0[col]); + cb = GETJSAMPLE(inptr1[col]); + cr = GETJSAMPLE(inptr2[col]); + /* Range-limiting is essential due to noise introduced by DCT losses. */ + outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; + outptr[RGB_GREEN] = range_limit[y + + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; + outptr += RGB_PIXELSIZE; + } + } +} + + +/* + * Convert grayscale to RGB: just duplicate the graylevel three times. + * This is provided to support applications that don't want to cope + * with grayscale as a separate case. + */ + +INLINE +LOCAL(void) +gray_rgb_convert_internal (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + while (--num_rows >= 0) { + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + /* We can dispense with GETJSAMPLE() here */ + outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; + outptr += RGB_PIXELSIZE; + } + } +} diff --git a/jdcolor.c b/jdcolor.c index 0af024c..d6e5a10 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -3,7 +3,7 @@ * * Copyright (C) 1991-1997, Thomas G. Lane. * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2009, D. R. Commander. + * Copyright (C) 2009, 2011, 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. * @@ -65,6 +65,99 @@ typedef my_color_deconverter * my_cconvert_ptr; #define FIX(x) ((INT32) ((x) * (1L<RGB colorspace conversion. */ @@ -110,13 +203,6 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) /* * Convert some rows of samples to the output colorspace. - * - * Note that we change from noninterleaved, one-plane-per-component format - * to interleaved-pixel format. The output buffer is therefore three times - * as wide as the input buffer. - * A starting row offset is provided only for the input buffer. The caller - * can easily adjust the passed output_buf value to accommodate any row - * offset required on that side. */ METHODDEF(void) @@ -124,42 +210,35 @@ ycc_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; - register int y, cb, cr; - register JSAMPROW outptr; - 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; - 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]; - input_row++; - outptr = *output_buf++; - for (col = 0; col < num_cols; col++) { - y = GETJSAMPLE(inptr0[col]); - cb = GETJSAMPLE(inptr1[col]); - cr = GETJSAMPLE(inptr2[col]); - /* Range-limiting is essential due to noise introduced by DCT losses. */ - outptr[rindex] = range_limit[y + Crrtab[cr]]; - outptr[gindex] = range_limit[y + - ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], - SCALEBITS))]; - outptr[bindex] = range_limit[y + Cbbtab[cb]]; - outptr += rgbstride; - } + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + ycc_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_RGBX: + ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_BGR: + ycc_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_BGRX: + ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_XBGR: + ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_XRGB: + ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + default: + ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; } } @@ -215,9 +294,7 @@ grayscale_convert (j_decompress_ptr cinfo, /* - * Convert grayscale to RGB: just duplicate the graylevel three times. - * This is provided to support applications that don't want to cope - * with grayscale as a separate case. + * Convert grayscale to RGB */ METHODDEF(void) @@ -225,22 +302,35 @@ gray_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { - register JSAMPROW inptr, outptr; - JSAMPLE *maxinptr; - 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) { - inptr = input_buf[0][input_row++]; - maxinptr = &inptr[num_cols]; - outptr = *output_buf++; - for (; inptr < maxinptr; inptr++, outptr += rgbstride) { - /* We can dispense with GETJSAMPLE() here */ - outptr[rindex] = outptr[gindex] = outptr[bindex] = *inptr; - } + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + gray_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_RGBX: + gray_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_BGR: + gray_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_BGRX: + gray_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_XBGR: + gray_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + case JCS_EXT_XRGB: + gray_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; + default: + gray_rgb_convert_internal(cinfo, input_buf, input_row, output_buf, + num_rows); + break; } } diff --git a/jdmerge.c b/jdmerge.c index edf061a..c75497a 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -3,7 +3,7 @@ * * Copyright (C) 1994-1996, Thomas G. Lane. * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2009, D. R. Commander. + * Copyright (C) 2009, 2011, 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. * @@ -77,6 +77,99 @@ typedef my_upsampler * my_upsample_ptr; #define FIX(x) ((INT32) ((x) * (1L<RGB colorspace conversion. * This is taken directly from jdcolor.c; see that file for more info. @@ -230,55 +323,35 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - register int y, cred, cgreen, cblue; - int cb, cr; - register JSAMPROW outptr; - JSAMPROW inptr0, inptr1, inptr2; - JDIMENSION col; - /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cinfo->sample_range_limit; - int * Crrtab = upsample->Cr_r_tab; - int * Cbbtab = upsample->Cb_b_tab; - INT32 * Crgtab = upsample->Cr_g_tab; - INT32 * Cbgtab = upsample->Cb_g_tab; - SHIFT_TEMPS - - inptr0 = input_buf[0][in_row_group_ctr]; - inptr1 = input_buf[1][in_row_group_ctr]; - inptr2 = input_buf[2][in_row_group_ctr]; - outptr = output_buf[0]; - /* Loop for each pair of output pixels */ - for (col = cinfo->output_width >> 1; col > 0; col--) { - /* Do the chroma part of the calculation */ - cb = GETJSAMPLE(*inptr1++); - cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - /* Fetch 2 Y values and emit 2 pixels */ - y = GETJSAMPLE(*inptr0++); - outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - outptr += rgb_pixelsize[cinfo->out_color_space]; - y = GETJSAMPLE(*inptr0++); - outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - outptr += rgb_pixelsize[cinfo->out_color_space]; - } - /* If image width is odd, do the last output column separately */ - if (cinfo->output_width & 1) { - cb = GETJSAMPLE(*inptr1); - cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - y = GETJSAMPLE(*inptr0); - outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + extrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_RGBX: + extrgbx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_BGR: + extbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_BGRX: + extbgrx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_XBGR: + extxbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_XRGB: + extxrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + default: + h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; } } @@ -292,71 +365,35 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { - my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; - register int y, cred, cgreen, cblue; - int cb, cr; - register JSAMPROW outptr0, outptr1; - JSAMPROW inptr00, inptr01, inptr1, inptr2; - JDIMENSION col; - /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cinfo->sample_range_limit; - int * Crrtab = upsample->Cr_r_tab; - int * Cbbtab = upsample->Cb_b_tab; - INT32 * Crgtab = upsample->Cr_g_tab; - INT32 * Cbgtab = upsample->Cb_g_tab; - SHIFT_TEMPS - - inptr00 = input_buf[0][in_row_group_ctr*2]; - inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; - inptr1 = input_buf[1][in_row_group_ctr]; - inptr2 = input_buf[2][in_row_group_ctr]; - outptr0 = output_buf[0]; - outptr1 = output_buf[1]; - /* Loop for each group of output pixels */ - for (col = cinfo->output_width >> 1; col > 0; col--) { - /* Do the chroma part of the calculation */ - cb = GETJSAMPLE(*inptr1++); - cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - /* Fetch 4 Y values and emit 4 pixels */ - y = GETJSAMPLE(*inptr00++); - outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - outptr0 += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr00++); - outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - outptr0 += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr01++); - outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - outptr1 += RGB_PIXELSIZE; - y = GETJSAMPLE(*inptr01++); - outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - outptr1 += RGB_PIXELSIZE; - } - /* If image width is odd, do the last output column separately */ - if (cinfo->output_width & 1) { - cb = GETJSAMPLE(*inptr1); - cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - y = GETJSAMPLE(*inptr00); - outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; - y = GETJSAMPLE(*inptr01); - outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; - outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; - outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + extrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_RGBX: + extrgbx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_BGR: + extbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_BGRX: + extbgrx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_XBGR: + extxbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + case JCS_EXT_XRGB: + extxrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; + default: + h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr, + output_buf); + break; } } diff --git a/jdmrgext.c b/jdmrgext.c new file mode 100644 index 0000000..95ddd55 --- /dev/null +++ b/jdmrgext.c @@ -0,0 +1,156 @@ +/* + * jdmrgext.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains code for merged upsampling/color conversion. + */ + + +/* This file is included by jdmerge.c */ + + +/* + * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. + */ + +INLINE +LOCAL(void) +h2v1_merged_upsample_internal (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + /* Fetch 2 Y values and emit 2 pixels */ + y = GETJSAMPLE(*inptr0++); + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr0++); + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr += RGB_PIXELSIZE; + } + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = GETJSAMPLE(*inptr0); + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; + } +} + + +/* + * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. + */ + +INLINE +LOCAL(void) +h2v2_merged_upsample_internal (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr*2]; + inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + /* Fetch 4 Y values and emit 4 pixels */ + y = GETJSAMPLE(*inptr00++); + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0 += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr00++); + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0 += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr01++); + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1 += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr01++); + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1 += RGB_PIXELSIZE; + } + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = GETJSAMPLE(*inptr00); + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; + y = GETJSAMPLE(*inptr01); + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; + } +} diff --git a/jmorecfg.h b/jmorecfg.h index c14a5f3..1448779 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -315,20 +315,54 @@ typedef int boolean; #define JPEG_NUMCS 12 +#define EXT_RGB_RED 0 +#define EXT_RGB_GREEN 1 +#define EXT_RGB_BLUE 2 +#define EXT_RGB_PIXELSIZE 3 + +#define EXT_RGBX_RED 0 +#define EXT_RGBX_GREEN 1 +#define EXT_RGBX_BLUE 2 +#define EXT_RGBX_PIXELSIZE 4 + +#define EXT_BGR_RED 2 +#define EXT_BGR_GREEN 1 +#define EXT_BGR_BLUE 0 +#define EXT_BGR_PIXELSIZE 3 + +#define EXT_BGRX_RED 2 +#define EXT_BGRX_GREEN 1 +#define EXT_BGRX_BLUE 0 +#define EXT_BGRX_PIXELSIZE 4 + +#define EXT_XBGR_RED 3 +#define EXT_XBGR_GREEN 2 +#define EXT_XBGR_BLUE 1 +#define EXT_XBGR_PIXELSIZE 4 + +#define EXT_XRGB_RED 1 +#define EXT_XRGB_GREEN 2 +#define EXT_XRGB_BLUE 3 +#define EXT_XRGB_PIXELSIZE 4 + static const int rgb_red[JPEG_NUMCS] = { - -1, -1, RGB_RED, -1, -1, -1, 0, 0, 2, 2, 3, 1 + -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED, + EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED }; static const int rgb_green[JPEG_NUMCS] = { - -1, -1, RGB_GREEN, -1, -1, -1, 1, 1, 1, 1, 2, 2 + -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN, + EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN }; static const int rgb_blue[JPEG_NUMCS] = { - -1, -1, RGB_BLUE, -1, -1, -1, 2, 2, 0, 0, 1, 3 + -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE, + EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE }; static const int rgb_pixelsize[JPEG_NUMCS] = { - -1, -1, RGB_PIXELSIZE, -1, -1, -1, 3, 4, 3, 4, 4, 4 + -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, + EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE }; /* Definitions for speed-related optimizations. */ diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm index d0f0d79..9650e47 100644 --- a/simd/jccolmmx.asm +++ b/simd/jccolmmx.asm @@ -60,10 +60,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extrgb_ycc_convert_mmx %include "jcclrmmx.asm" @@ -71,10 +71,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extrgbx_ycc_convert_mmx %include "jcclrmmx.asm" @@ -82,10 +82,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extbgr_ycc_convert_mmx %include "jcclrmmx.asm" @@ -93,10 +93,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extbgrx_ycc_convert_mmx %include "jcclrmmx.asm" @@ -104,10 +104,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extxbgr_ycc_convert_mmx %include "jcclrmmx.asm" @@ -115,9 +115,9 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extxrgb_ycc_convert_mmx %include "jcclrmmx.asm" diff --git a/simd/jccolss2-64.asm b/simd/jccolss2-64.asm index 18de456..ae60148 100644 --- a/simd/jccolss2-64.asm +++ b/simd/jccolss2-64.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 %include "jcclrss2-64.asm" @@ -68,10 +68,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 %include "jcclrss2-64.asm" @@ -79,10 +79,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 %include "jcclrss2-64.asm" @@ -90,10 +90,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 %include "jcclrss2-64.asm" @@ -101,10 +101,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 %include "jcclrss2-64.asm" @@ -112,9 +112,9 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 %include "jcclrss2-64.asm" diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm index 7acb59c..ac001d1 100644 --- a/simd/jccolss2.asm +++ b/simd/jccolss2.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 %include "jcclrss2.asm" @@ -68,10 +68,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 %include "jcclrss2.asm" @@ -79,10 +79,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 %include "jcclrss2.asm" @@ -90,10 +90,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 %include "jcclrss2.asm" @@ -101,10 +101,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 %include "jcclrss2.asm" @@ -112,9 +112,9 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 %include "jcclrss2.asm" diff --git a/simd/jcgrammx.asm b/simd/jcgrammx.asm index 8c96824..b8b8dd3 100644 --- a/simd/jcgrammx.asm +++ b/simd/jcgrammx.asm @@ -53,10 +53,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extrgb_gray_convert_mmx %include "jcgrymmx.asm" @@ -64,10 +64,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extrgbx_gray_convert_mmx %include "jcgrymmx.asm" @@ -75,10 +75,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extbgr_gray_convert_mmx %include "jcgrymmx.asm" @@ -86,10 +86,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extbgrx_gray_convert_mmx %include "jcgrymmx.asm" @@ -97,10 +97,10 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extxbgr_gray_convert_mmx %include "jcgrymmx.asm" @@ -108,9 +108,9 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extxrgb_gray_convert_mmx %include "jcgrymmx.asm" diff --git a/simd/jcgrass2-64.asm b/simd/jcgrass2-64.asm index 232f329..ba28cc3 100644 --- a/simd/jcgrass2-64.asm +++ b/simd/jcgrass2-64.asm @@ -50,10 +50,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 %include "jcgryss2-64.asm" @@ -61,10 +61,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 %include "jcgryss2-64.asm" @@ -72,10 +72,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 %include "jcgryss2-64.asm" @@ -83,10 +83,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 %include "jcgryss2-64.asm" @@ -94,10 +94,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 %include "jcgryss2-64.asm" @@ -105,9 +105,9 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 %include "jcgryss2-64.asm" diff --git a/simd/jcgrass2.asm b/simd/jcgrass2.asm index 45ea33a..998968e 100644 --- a/simd/jcgrass2.asm +++ b/simd/jcgrass2.asm @@ -50,10 +50,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 %include "jcgryss2.asm" @@ -61,10 +61,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 %include "jcgryss2.asm" @@ -72,10 +72,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 %include "jcgryss2.asm" @@ -83,10 +83,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 %include "jcgryss2.asm" @@ -94,10 +94,10 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 %include "jcgryss2.asm" @@ -105,9 +105,9 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 %include "jcgryss2.asm" diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm index 0834bab..5e4e47d 100644 --- a/simd/jdcolmmx.asm +++ b/simd/jdcolmmx.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgb_convert_mmx %include "jdclrmmx.asm" @@ -68,10 +68,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgbx_convert_mmx %include "jdclrmmx.asm" @@ -79,10 +79,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgr_convert_mmx %include "jdclrmmx.asm" @@ -90,10 +90,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgrx_convert_mmx %include "jdclrmmx.asm" @@ -101,10 +101,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxbgr_convert_mmx %include "jdclrmmx.asm" @@ -112,9 +112,9 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxrgb_convert_mmx %include "jdclrmmx.asm" diff --git a/simd/jdcolss2-64.asm b/simd/jdcolss2-64.asm index d14a28a..01b3dce 100644 --- a/simd/jdcolss2-64.asm +++ b/simd/jdcolss2-64.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 %include "jdclrss2-64.asm" @@ -68,10 +68,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 %include "jdclrss2-64.asm" @@ -79,10 +79,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 %include "jdclrss2-64.asm" @@ -90,10 +90,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 %include "jdclrss2-64.asm" @@ -101,10 +101,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 %include "jdclrss2-64.asm" @@ -112,9 +112,9 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 %include "jdclrss2-64.asm" diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm index cab4dd0..1912d92 100644 --- a/simd/jdcolss2.asm +++ b/simd/jdcolss2.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 %include "jdclrss2.asm" @@ -68,10 +68,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 %include "jdclrss2.asm" @@ -79,10 +79,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 %include "jdclrss2.asm" @@ -90,10 +90,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 %include "jdclrss2.asm" @@ -101,10 +101,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 %include "jdclrss2.asm" @@ -112,9 +112,9 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 %include "jdclrss2.asm" diff --git a/simd/jdmermmx.asm b/simd/jdmermmx.asm index 75baaa5..7b86c74 100644 --- a/simd/jdmermmx.asm +++ b/simd/jdmermmx.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgb_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgb_merged_upsample_mmx %include "jdmrgmmx.asm" @@ -69,10 +69,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgbx_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgbx_merged_upsample_mmx %include "jdmrgmmx.asm" @@ -81,10 +81,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgr_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgr_merged_upsample_mmx %include "jdmrgmmx.asm" @@ -93,10 +93,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgrx_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgrx_merged_upsample_mmx %include "jdmrgmmx.asm" @@ -105,10 +105,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxbgr_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxbgr_merged_upsample_mmx %include "jdmrgmmx.asm" @@ -117,10 +117,10 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxrgb_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxrgb_merged_upsample_mmx %include "jdmrgmmx.asm" diff --git a/simd/jdmerss2-64.asm b/simd/jdmerss2-64.asm index a1fe963..a184ea6 100644 --- a/simd/jdmerss2-64.asm +++ b/simd/jdmerss2-64.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 %include "jdmrgss2-64.asm" @@ -69,10 +69,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 %include "jdmrgss2-64.asm" @@ -81,10 +81,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 %include "jdmrgss2-64.asm" @@ -93,10 +93,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 %include "jdmrgss2-64.asm" @@ -105,10 +105,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 %include "jdmrgss2-64.asm" @@ -117,10 +117,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 %include "jdmrgss2-64.asm" diff --git a/simd/jdmerss2.asm b/simd/jdmerss2.asm index 21881b4..e536c80 100644 --- a/simd/jdmerss2.asm +++ b/simd/jdmerss2.asm @@ -57,10 +57,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 %include "jdmrgss2.asm" @@ -69,10 +69,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 0 -%define RGB_GREEN 1 -%define RGB_BLUE 2 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 %include "jdmrgss2.asm" @@ -81,10 +81,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 3 +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 %include "jdmrgss2.asm" @@ -93,10 +93,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 2 -%define RGB_GREEN 1 -%define RGB_BLUE 0 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 %include "jdmrgss2.asm" @@ -105,10 +105,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 3 -%define RGB_GREEN 2 -%define RGB_BLUE 1 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 %include "jdmrgss2.asm" @@ -117,10 +117,10 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %undef RGB_GREEN %undef RGB_BLUE %undef RGB_PIXELSIZE -%define RGB_RED 1 -%define RGB_GREEN 2 -%define RGB_BLUE 3 -%define RGB_PIXELSIZE 4 +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 %include "jdmrgss2.asm" diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index 4876038..13cff03 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -32,9 +32,38 @@ definev(DCTSIZE2) definev(RGB_RED) definev(RGB_GREEN) definev(RGB_BLUE) - definev(RGB_PIXELSIZE) +definev(EXT_RGB_RED) +definev(EXT_RGB_GREEN) +definev(EXT_RGB_BLUE) +definev(EXT_RGB_PIXELSIZE) + +definev(EXT_RGBX_RED) +definev(EXT_RGBX_GREEN) +definev(EXT_RGBX_BLUE) +definev(EXT_RGBX_PIXELSIZE) + +definev(EXT_BGR_RED) +definev(EXT_BGR_GREEN) +definev(EXT_BGR_BLUE) +definev(EXT_BGR_PIXELSIZE) + +definev(EXT_BGRX_RED) +definev(EXT_BGRX_GREEN) +definev(EXT_BGRX_BLUE) +definev(EXT_BGRX_PIXELSIZE) + +definev(EXT_XBGR_RED) +definev(EXT_XBGR_GREEN) +definev(EXT_XBGR_BLUE) +definev(EXT_XBGR_PIXELSIZE) + +definev(EXT_XRGB_RED) +definev(EXT_XRGB_GREEN) +definev(EXT_XRGB_BLUE) +definev(EXT_XRGB_PIXELSIZE) + ; Representation of a single sample (pixel element value). ; On this SIMD implementation, this must be 'unsigned char'. ; diff --git a/win/jconfig.h.in b/win/jconfig.h.in index 3b835ea..373976d 100644 --- a/win/jconfig.h.in +++ b/win/jconfig.h.in @@ -32,7 +32,15 @@ typedef signed int INT32; #endif #define XMD_H /* prevent jmorecfg.h from redefining it */ -#define inline __inline +#ifndef INLINE +#if defined(__GNUC__) +#define INLINE __attribute__((always_inline)) +#elif defined(_MSC_VER) +#define INLINE __forceinline +#else +#define INLINE +#endif +#endif #ifdef JPEG_INTERNALS diff --git a/win/jsimdcfg.inc b/win/jsimdcfg.inc index 68e22e8..a852849 100755 --- a/win/jsimdcfg.inc +++ b/win/jsimdcfg.inc @@ -13,6 +13,30 @@ %define RGB_GREEN 1 %define RGB_BLUE 2 %define RGB_PIXELSIZE 3 +%define EXT_RGB_RED 0 +%define EXT_RGB_GREEN 1 +%define EXT_RGB_BLUE 2 +%define EXT_RGB_PIXELSIZE 3 +%define EXT_RGBX_RED 0 +%define EXT_RGBX_GREEN 1 +%define EXT_RGBX_BLUE 2 +%define EXT_RGBX_PIXELSIZE 4 +%define EXT_BGR_RED 2 +%define EXT_BGR_GREEN 1 +%define EXT_BGR_BLUE 0 +%define EXT_BGR_PIXELSIZE 3 +%define EXT_BGRX_RED 2 +%define EXT_BGRX_GREEN 1 +%define EXT_BGRX_BLUE 0 +%define EXT_BGRX_PIXELSIZE 4 +%define EXT_XBGR_RED 3 +%define EXT_XBGR_GREEN 2 +%define EXT_XBGR_BLUE 1 +%define EXT_XBGR_PIXELSIZE 4 +%define EXT_XRGB_RED 1 +%define EXT_XRGB_GREEN 2 +%define EXT_XRGB_BLUE 3 +%define EXT_XRGB_PIXELSIZE 4 ; Representation of a single sample (pixel element value). ; On this SIMD implementation, this must be 'unsigned char'. ; -- cgit v1.2.3