mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 04:27:37 +00:00
50bc583645
--HG-- rename : media/libjpeg/config.h => media/libjpeg/jconfigint.h rename : media/libjpeg/simd/jcclrmmx.asm => media/libjpeg/simd/jccolext-mmx.asm rename : media/libjpeg/simd/jcclrss2-64.asm => media/libjpeg/simd/jccolext-sse2-64.asm rename : media/libjpeg/simd/jcclrss2.asm => media/libjpeg/simd/jccolext-sse2.asm rename : media/libjpeg/simd/jccolmmx.asm => media/libjpeg/simd/jccolor-mmx.asm rename : media/libjpeg/simd/jccolss2-64.asm => media/libjpeg/simd/jccolor-sse2-64.asm rename : media/libjpeg/simd/jccolss2.asm => media/libjpeg/simd/jccolor-sse2.asm rename : media/libjpeg/simd/jcgrammx.asm => media/libjpeg/simd/jcgray-mmx.asm rename : media/libjpeg/simd/jcgrass2-64.asm => media/libjpeg/simd/jcgray-sse2-64.asm rename : media/libjpeg/simd/jcgrass2.asm => media/libjpeg/simd/jcgray-sse2.asm rename : media/libjpeg/simd/jcgrymmx.asm => media/libjpeg/simd/jcgryext-mmx.asm rename : media/libjpeg/simd/jcgryss2-64.asm => media/libjpeg/simd/jcgryext-sse2-64.asm rename : media/libjpeg/simd/jcgryss2.asm => media/libjpeg/simd/jcgryext-sse2.asm rename : media/libjpeg/simd/jcsammmx.asm => media/libjpeg/simd/jcsample-mmx.asm rename : media/libjpeg/simd/jcsamss2-64.asm => media/libjpeg/simd/jcsample-sse2-64.asm rename : media/libjpeg/simd/jcsamss2.asm => media/libjpeg/simd/jcsample-sse2.asm rename : media/libjpeg/simd/jdclrmmx.asm => media/libjpeg/simd/jdcolext-mmx.asm rename : media/libjpeg/simd/jdclrss2-64.asm => media/libjpeg/simd/jdcolext-sse2-64.asm rename : media/libjpeg/simd/jdclrss2.asm => media/libjpeg/simd/jdcolext-sse2.asm rename : media/libjpeg/simd/jdcolmmx.asm => media/libjpeg/simd/jdcolor-mmx.asm rename : media/libjpeg/simd/jdcolss2-64.asm => media/libjpeg/simd/jdcolor-sse2-64.asm rename : media/libjpeg/simd/jdcolss2.asm => media/libjpeg/simd/jdcolor-sse2.asm rename : media/libjpeg/simd/jdmermmx.asm => media/libjpeg/simd/jdmerge-mmx.asm rename : media/libjpeg/simd/jdmerss2-64.asm => media/libjpeg/simd/jdmerge-sse2-64.asm rename : media/libjpeg/simd/jdmerss2.asm => media/libjpeg/simd/jdmerge-sse2.asm rename : media/libjpeg/simd/jdmrgmmx.asm => media/libjpeg/simd/jdmrgext-mmx.asm rename : media/libjpeg/simd/jdmrgss2-64.asm => media/libjpeg/simd/jdmrgext-sse2-64.asm rename : media/libjpeg/simd/jdmrgss2.asm => media/libjpeg/simd/jdmrgext-sse2.asm rename : media/libjpeg/simd/jdsammmx.asm => media/libjpeg/simd/jdsample-mmx.asm rename : media/libjpeg/simd/jdsamss2-64.asm => media/libjpeg/simd/jdsample-sse2-64.asm rename : media/libjpeg/simd/jdsamss2.asm => media/libjpeg/simd/jdsample-sse2.asm rename : media/libjpeg/simd/jf3dnflt.asm => media/libjpeg/simd/jfdctflt-3dn.asm rename : media/libjpeg/simd/jfsseflt-64.asm => media/libjpeg/simd/jfdctflt-sse-64.asm rename : media/libjpeg/simd/jfsseflt.asm => media/libjpeg/simd/jfdctflt-sse.asm rename : media/libjpeg/simd/jfmmxfst.asm => media/libjpeg/simd/jfdctfst-mmx.asm rename : media/libjpeg/simd/jfss2fst-64.asm => media/libjpeg/simd/jfdctfst-sse2-64.asm rename : media/libjpeg/simd/jfss2fst.asm => media/libjpeg/simd/jfdctfst-sse2.asm rename : media/libjpeg/simd/jfmmxint.asm => media/libjpeg/simd/jfdctint-mmx.asm rename : media/libjpeg/simd/jfss2int-64.asm => media/libjpeg/simd/jfdctint-sse2-64.asm rename : media/libjpeg/simd/jfss2int.asm => media/libjpeg/simd/jfdctint-sse2.asm rename : media/libjpeg/simd/ji3dnflt.asm => media/libjpeg/simd/jidctflt-3dn.asm rename : media/libjpeg/simd/jisseflt.asm => media/libjpeg/simd/jidctflt-sse.asm rename : media/libjpeg/simd/jiss2flt-64.asm => media/libjpeg/simd/jidctflt-sse2-64.asm rename : media/libjpeg/simd/jiss2flt.asm => media/libjpeg/simd/jidctflt-sse2.asm rename : media/libjpeg/simd/jimmxfst.asm => media/libjpeg/simd/jidctfst-mmx.asm rename : media/libjpeg/simd/jiss2fst-64.asm => media/libjpeg/simd/jidctfst-sse2-64.asm rename : media/libjpeg/simd/jiss2fst.asm => media/libjpeg/simd/jidctfst-sse2.asm rename : media/libjpeg/simd/jimmxint.asm => media/libjpeg/simd/jidctint-mmx.asm rename : media/libjpeg/simd/jiss2int-64.asm => media/libjpeg/simd/jidctint-sse2-64.asm rename : media/libjpeg/simd/jiss2int.asm => media/libjpeg/simd/jidctint-sse2.asm rename : media/libjpeg/simd/jimmxred.asm => media/libjpeg/simd/jidctred-mmx.asm rename : media/libjpeg/simd/jiss2red-64.asm => media/libjpeg/simd/jidctred-sse2-64.asm rename : media/libjpeg/simd/jiss2red.asm => media/libjpeg/simd/jidctred-sse2.asm rename : media/libjpeg/simd/jcqnt3dn.asm => media/libjpeg/simd/jquant-3dn.asm rename : media/libjpeg/simd/jcqntmmx.asm => media/libjpeg/simd/jquant-mmx.asm rename : media/libjpeg/simd/jcqntsse.asm => media/libjpeg/simd/jquant-sse.asm rename : media/libjpeg/simd/jcqnts2f-64.asm => media/libjpeg/simd/jquantf-sse2-64.asm rename : media/libjpeg/simd/jcqnts2f.asm => media/libjpeg/simd/jquantf-sse2.asm rename : media/libjpeg/simd/jcqnts2i-64.asm => media/libjpeg/simd/jquanti-sse2-64.asm rename : media/libjpeg/simd/jcqnts2i.asm => media/libjpeg/simd/jquanti-sse2.asm
384 lines
12 KiB
C
384 lines
12 KiB
C
/*
|
|
* jdcol565.c
|
|
*
|
|
* This file was part of the Independent JPEG Group's software:
|
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
|
* Modifications:
|
|
* Copyright (C) 2013, Linaro Limited.
|
|
* Copyright (C) 2014, D. R. Commander.
|
|
* 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 */
|
|
|
|
|
|
INLINE
|
|
LOCAL(void)
|
|
ycc_rgb565_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) {
|
|
INT32 rgb;
|
|
unsigned int r, g, b;
|
|
inptr0 = input_buf[0][input_row];
|
|
inptr1 = input_buf[1][input_row];
|
|
inptr2 = input_buf[2][input_row];
|
|
input_row++;
|
|
outptr = *output_buf++;
|
|
|
|
if (PACK_NEED_ALIGNMENT(outptr)) {
|
|
y = GETJSAMPLE(*inptr0++);
|
|
cb = GETJSAMPLE(*inptr1++);
|
|
cr = GETJSAMPLE(*inptr2++);
|
|
r = range_limit[y + Crrtab[cr]];
|
|
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS))];
|
|
b = range_limit[y + Cbbtab[cb]];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
outptr += 2;
|
|
num_cols--;
|
|
}
|
|
for (col = 0; col < (num_cols >> 1); col++) {
|
|
y = GETJSAMPLE(*inptr0++);
|
|
cb = GETJSAMPLE(*inptr1++);
|
|
cr = GETJSAMPLE(*inptr2++);
|
|
r = range_limit[y + Crrtab[cr]];
|
|
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS))];
|
|
b = range_limit[y + Cbbtab[cb]];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
|
|
y = GETJSAMPLE(*inptr0++);
|
|
cb = GETJSAMPLE(*inptr1++);
|
|
cr = GETJSAMPLE(*inptr2++);
|
|
r = range_limit[y + Crrtab[cr]];
|
|
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS))];
|
|
b = range_limit[y + Cbbtab[cb]];
|
|
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
|
|
|
|
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
|
|
outptr += 4;
|
|
}
|
|
if (num_cols & 1) {
|
|
y = GETJSAMPLE(*inptr0);
|
|
cb = GETJSAMPLE(*inptr1);
|
|
cr = GETJSAMPLE(*inptr2);
|
|
r = range_limit[y + Crrtab[cr]];
|
|
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS))];
|
|
b = range_limit[y + Cbbtab[cb]];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
INLINE
|
|
LOCAL(void)
|
|
ycc_rgb565D_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;
|
|
INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
|
|
SHIFT_TEMPS
|
|
|
|
while (--num_rows >= 0) {
|
|
INT32 rgb;
|
|
unsigned int r, g, b;
|
|
|
|
inptr0 = input_buf[0][input_row];
|
|
inptr1 = input_buf[1][input_row];
|
|
inptr2 = input_buf[2][input_row];
|
|
input_row++;
|
|
outptr = *output_buf++;
|
|
if (PACK_NEED_ALIGNMENT(outptr)) {
|
|
y = GETJSAMPLE(*inptr0++);
|
|
cb = GETJSAMPLE(*inptr1++);
|
|
cr = GETJSAMPLE(*inptr2++);
|
|
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
|
|
g = range_limit[DITHER_565_G(y +
|
|
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS)), d0)];
|
|
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
outptr += 2;
|
|
num_cols--;
|
|
}
|
|
for (col = 0; col < (num_cols >> 1); col++) {
|
|
y = GETJSAMPLE(*inptr0++);
|
|
cb = GETJSAMPLE(*inptr1++);
|
|
cr = GETJSAMPLE(*inptr2++);
|
|
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
|
|
g = range_limit[DITHER_565_G(y +
|
|
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS)), d0)];
|
|
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
|
|
d0 = DITHER_ROTATE(d0);
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
|
|
y = GETJSAMPLE(*inptr0++);
|
|
cb = GETJSAMPLE(*inptr1++);
|
|
cr = GETJSAMPLE(*inptr2++);
|
|
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
|
|
g = range_limit[DITHER_565_G(y +
|
|
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS)), d0)];
|
|
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
|
|
d0 = DITHER_ROTATE(d0);
|
|
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
|
|
|
|
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
|
|
outptr += 4;
|
|
}
|
|
if (num_cols & 1) {
|
|
y = GETJSAMPLE(*inptr0);
|
|
cb = GETJSAMPLE(*inptr1);
|
|
cr = GETJSAMPLE(*inptr2);
|
|
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
|
|
g = range_limit[DITHER_565_G(y +
|
|
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
|
SCALEBITS)), d0)];
|
|
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
INLINE
|
|
LOCAL(void)
|
|
rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
|
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
|
JSAMPARRAY output_buf, int num_rows)
|
|
{
|
|
register JSAMPROW outptr;
|
|
register JSAMPROW inptr0, inptr1, inptr2;
|
|
register JDIMENSION col;
|
|
JDIMENSION num_cols = cinfo->output_width;
|
|
SHIFT_TEMPS
|
|
|
|
while (--num_rows >= 0) {
|
|
INT32 rgb;
|
|
unsigned int r, g, b;
|
|
|
|
inptr0 = input_buf[0][input_row];
|
|
inptr1 = input_buf[1][input_row];
|
|
inptr2 = input_buf[2][input_row];
|
|
input_row++;
|
|
outptr = *output_buf++;
|
|
if (PACK_NEED_ALIGNMENT(outptr)) {
|
|
r = GETJSAMPLE(*inptr0++);
|
|
g = GETJSAMPLE(*inptr1++);
|
|
b = GETJSAMPLE(*inptr2++);
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
outptr += 2;
|
|
num_cols--;
|
|
}
|
|
for (col = 0; col < (num_cols >> 1); col++) {
|
|
r = GETJSAMPLE(*inptr0++);
|
|
g = GETJSAMPLE(*inptr1++);
|
|
b = GETJSAMPLE(*inptr2++);
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
|
|
r = GETJSAMPLE(*inptr0++);
|
|
g = GETJSAMPLE(*inptr1++);
|
|
b = GETJSAMPLE(*inptr2++);
|
|
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
|
|
|
|
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
|
|
outptr += 4;
|
|
}
|
|
if (num_cols & 1) {
|
|
r = GETJSAMPLE(*inptr0);
|
|
g = GETJSAMPLE(*inptr1);
|
|
b = GETJSAMPLE(*inptr2);
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
INLINE
|
|
LOCAL(void)
|
|
rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
|
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
|
JSAMPARRAY output_buf, int num_rows)
|
|
{
|
|
register JSAMPROW outptr;
|
|
register JSAMPROW inptr0, inptr1, inptr2;
|
|
register JDIMENSION col;
|
|
register JSAMPLE * range_limit = cinfo->sample_range_limit;
|
|
JDIMENSION num_cols = cinfo->output_width;
|
|
INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
|
|
SHIFT_TEMPS
|
|
|
|
while (--num_rows >= 0) {
|
|
INT32 rgb;
|
|
unsigned int r, g, b;
|
|
|
|
inptr0 = input_buf[0][input_row];
|
|
inptr1 = input_buf[1][input_row];
|
|
inptr2 = input_buf[2][input_row];
|
|
input_row++;
|
|
outptr = *output_buf++;
|
|
if (PACK_NEED_ALIGNMENT(outptr)) {
|
|
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)];
|
|
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
|
|
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
outptr += 2;
|
|
num_cols--;
|
|
}
|
|
for (col = 0; col < (num_cols >> 1); col++) {
|
|
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)];
|
|
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
|
|
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
|
|
d0 = DITHER_ROTATE(d0);
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
|
|
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)];
|
|
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
|
|
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
|
|
d0 = DITHER_ROTATE(d0);
|
|
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
|
|
|
|
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
|
|
outptr += 4;
|
|
}
|
|
if (num_cols & 1) {
|
|
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0), d0)];
|
|
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1), d0)];
|
|
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2), d0)];
|
|
rgb = PACK_SHORT_565(r, g, b);
|
|
*(INT16*)outptr = rgb;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
INLINE
|
|
LOCAL(void)
|
|
gray_rgb565_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) {
|
|
INT32 rgb;
|
|
unsigned int g;
|
|
|
|
inptr = input_buf[0][input_row++];
|
|
outptr = *output_buf++;
|
|
if (PACK_NEED_ALIGNMENT(outptr)) {
|
|
g = *inptr++;
|
|
rgb = PACK_SHORT_565(g, g, g);
|
|
*(INT16*)outptr = rgb;
|
|
outptr += 2;
|
|
num_cols--;
|
|
}
|
|
for (col = 0; col < (num_cols >> 1); col++) {
|
|
g = *inptr++;
|
|
rgb = PACK_SHORT_565(g, g, g);
|
|
g = *inptr++;
|
|
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g));
|
|
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
|
|
outptr += 4;
|
|
}
|
|
if (num_cols & 1) {
|
|
g = *inptr;
|
|
rgb = PACK_SHORT_565(g, g, g);
|
|
*(INT16*)outptr = rgb;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
INLINE
|
|
LOCAL(void)
|
|
gray_rgb565D_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;
|
|
register JSAMPLE * range_limit = cinfo->sample_range_limit;
|
|
JDIMENSION num_cols = cinfo->output_width;
|
|
INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
|
|
|
|
while (--num_rows >= 0) {
|
|
INT32 rgb;
|
|
unsigned int g;
|
|
|
|
inptr = input_buf[0][input_row++];
|
|
outptr = *output_buf++;
|
|
if (PACK_NEED_ALIGNMENT(outptr)) {
|
|
g = *inptr++;
|
|
g = range_limit[DITHER_565_R(g, d0)];
|
|
rgb = PACK_SHORT_565(g, g, g);
|
|
*(INT16*)outptr = rgb;
|
|
outptr += 2;
|
|
num_cols--;
|
|
}
|
|
for (col = 0; col < (num_cols >> 1); col++) {
|
|
g = *inptr++;
|
|
g = range_limit[DITHER_565_R(g, d0)];
|
|
rgb = PACK_SHORT_565(g, g, g);
|
|
d0 = DITHER_ROTATE(d0);
|
|
|
|
g = *inptr++;
|
|
g = range_limit[DITHER_565_R(g, d0)];
|
|
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g));
|
|
d0 = DITHER_ROTATE(d0);
|
|
|
|
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
|
|
outptr += 4;
|
|
}
|
|
if (num_cols & 1) {
|
|
g = *inptr;
|
|
g = range_limit[DITHER_565_R(g, d0)];
|
|
rgb = PACK_SHORT_565(g, g, g);
|
|
*(INT16*)outptr = rgb;
|
|
}
|
|
}
|
|
}
|