diff options
author | DRC <dcommander@users.sourceforge.net> | 2012-03-11 22:06:54 +0000 |
---|---|---|
committer | DRC <dcommander@users.sourceforge.net> | 2012-03-11 22:06:54 +0000 |
commit | a9b646c202a2a154a125545b4347cbfd70598c9e (patch) | |
tree | 18eca92bd329dfaf7c09a92bf5d64eb76254b528 /jdcolext.c | |
parent | 69c1408e9d5ea1db45ae537b911c60088d813ad5 (diff) | |
download | libjpeg-turbo-a9b646c202a2a154a125545b4347cbfd70598c9e.tar.gz |
Allow RGB JPEG files to be created/decoded when using the LJT colorspace extensions
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@809 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'jdcolext.c')
-rw-r--r-- | jdcolext.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -102,3 +102,40 @@ gray_rgb_convert_internal (j_decompress_ptr cinfo, } } } + + +/* + * Convert RGB to extended RGB: just swap the order of source pixels + */ + +INLINE +LOCAL(void) +rgb_rgb_convert_internal (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW inptr0, inptr1, inptr2; + register JSAMPROW outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + 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++) { + /* We can dispense with GETJSAMPLE() here */ + outptr[RGB_RED] = inptr0[col]; + outptr[RGB_GREEN] = inptr1[col]; + outptr[RGB_BLUE] = inptr2[col]; + /* Set unused byte to 0xFF so it can be interpreted as an opaque */ + /* alpha channel value */ +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + outptr += RGB_PIXELSIZE; + } + } +} |