packing into 24bit

This commit is contained in:
wiredfool 2013-10-11 23:31:26 -07:00
parent 13d62c9f91
commit cb9440a2f5
3 changed files with 13 additions and 4 deletions

View File

@ -527,7 +527,7 @@ static struct {
{"YCbCr", "Cr", 8, band2}, {"YCbCr", "Cr", 8, band2},
/* LAB Color */ /* LAB Color */
{"LAB", "LAB", 24, ImagingPackRGB}, {"LAB", "LAB", 24, copy3},
{"LAB", "L", 8, band0}, {"LAB", "L", 8, band0},
{"LAB", "A", 8, band1}, {"LAB", "A", 8, band1},
{"LAB", "B", 8, band2}, {"LAB", "B", 8, band2},

View File

@ -180,9 +180,11 @@ ImagingNewPrologueSubtype(const char *mode, unsigned xsize, unsigned ysize,
} else if (strcmp(mode, "LAB") == 0) { } else if (strcmp(mode, "LAB") == 0) {
/* 24-bit color, luminance, + 2 color channels */ /* 24-bit color, luminance, + 2 color channels */
/* L is uint8, a,b are int8 */
im->bands = 3; im->bands = 3;
im->pixelsize = 4; im->pixelsize = 3;
im->linesize = xsize * 4; im->linesize = (xsize*4 + 3) & -4;
im->type = IMAGING_TYPE_SPECIAL;
} else { } else {
free(im); free(im);

View File

@ -674,6 +674,13 @@ copy2(UINT8* out, const UINT8* in, int pixels)
memcpy(out, in, pixels*2); memcpy(out, in, pixels*2);
} }
static void
copy3(UINT8* out, const UINT8* in, int pixels)
{
/* LAB triples, 24bit */
memcpy(out, in, 3 * pixels);
}
static void static void
copy4(UINT8* out, const UINT8* in, int pixels) copy4(UINT8* out, const UINT8* in, int pixels)
{ {
@ -958,7 +965,7 @@ static struct {
{"YCbCr", "YCbCrK", 32, copy4}, {"YCbCr", "YCbCrK", 32, copy4},
/* LAB Color */ /* LAB Color */
{"LAB", "LAB", 24, ImagingUnpackRGB}, {"LAB", "LAB", 24, copy3},
{"LAB", "L", 8, band0}, {"LAB", "L", 8, band0},
{"LAB", "A", 8, band1}, {"LAB", "A", 8, band1},
{"LAB", "B", 8, band2}, {"LAB", "B", 8, band2},