diff options
Diffstat (limited to 'src/cmspack.c')
-rw-r--r-- | src/cmspack.c | 379 |
1 files changed, 211 insertions, 168 deletions
diff --git a/src/cmspack.c b/src/cmspack.c index c66b39f..6a72edc 100644 --- a/src/cmspack.c +++ b/src/cmspack.c @@ -79,6 +79,7 @@ typedef struct { #define ANYSWAP DOSWAP_SH(1) #define ANYSWAPFIRST SWAPFIRST_SH(1) #define ANYFLAVOR FLAVOR_SH(1) +#define ANYPREMUL PREMUL_SH(1) // Suppress waning about info never being used @@ -102,19 +103,38 @@ cmsUInt8Number* UnrollChunkyBytes(CMSREGISTER _cmsTRANSFORM* info, cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number Premul = T_PREMUL(info->InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsUInt16Number v; - cmsUInt32Number i; + cmsUInt32Number i; + cmsUInt32Number alpha_factor = 1; if (ExtraFirst) { + + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(accum[0])); accum += Extra; } + else + { + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(accum[nChan - 1])); + } for (i=0; i < nChan; i++) { + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = FROM_8_TO_16(*accum); v = Reverse ? REVERSE_FLAVOR_16(v) : v; + + if (Premul && alpha_factor > 0) + { + v = (cmsUInt16Number)((cmsUInt32Number)((cmsUInt32Number)v << 16) / alpha_factor); + if (v > 0xffff) v = 0xffff; + } + wIn[index] = v; accum++; } @@ -137,57 +157,6 @@ cmsUInt8Number* UnrollChunkyBytes(CMSREGISTER _cmsTRANSFORM* info, } -/** -* Chunky bytes with premultiplied alpha. Extra channels is always 1 -*/ -static -cmsUInt8Number* UnrollChunkyBytesPremul(CMSREGISTER _cmsTRANSFORM* info, - CMSREGISTER cmsUInt16Number wIn[], - CMSREGISTER cmsUInt8Number* accum, - CMSREGISTER cmsUInt32Number Stride) -{ - cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); - cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; - cmsUInt32Number v; - cmsUInt32Number i; - - cmsUInt8Number alpha = (ExtraFirst ? accum[0] : accum[nChan - 1]); - cmsUInt32Number alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(alpha)); - - if (ExtraFirst) { - accum++; - } - - for (i=0; i < nChan; i++) { - cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; - - v = FROM_8_TO_16(*accum); - - v = (v << 16) / alpha_factor; - if (v > 0xffff) v = 0xffff; - - v = Reverse ? REVERSE_FLAVOR_16(v) : v; - - wIn[index] = (cmsUInt16Number) v; - accum++; - } - - if (!ExtraFirst) { - accum++; - } - - return accum; - - cmsUNUSED_PARAMETER(info); - cmsUNUSED_PARAMETER(Stride); - -} - - - // Extra channels are just ignored because come in the next planes static @@ -201,55 +170,40 @@ cmsUInt8Number* UnrollPlanarBytes(CMSREGISTER _cmsTRANSFORM* info, cmsUInt32Number SwapFirst = T_SWAPFIRST(info ->InputFormat); cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); cmsUInt32Number i; + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Extra = T_EXTRA(info->InputFormat); + cmsUInt32Number Premul = T_PREMUL(info->InputFormat); cmsUInt8Number* Init = accum; + cmsUInt32Number alpha_factor = 1; - if (DoSwap ^ SwapFirst) { - accum += T_EXTRA(info -> InputFormat) * Stride; - } + if (ExtraFirst) { - for (i=0; i < nChan; i++) { + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(accum[0])); - cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; - cmsUInt16Number v = FROM_8_TO_16(*accum); - wIn[index] = Reverse ? REVERSE_FLAVOR_16(v) : v; - accum += Stride; + accum += Extra * Stride; } - - return (Init + 1); -} - -// Extra channels are just ignored because come in the next planes -static -cmsUInt8Number* UnrollPlanarBytesPremul(CMSREGISTER _cmsTRANSFORM* info, - CMSREGISTER cmsUInt16Number wIn[], - CMSREGISTER cmsUInt8Number* accum, - CMSREGISTER cmsUInt32Number Stride) -{ - cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info ->InputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); - cmsUInt32Number i; - cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; - cmsUInt8Number* Init = accum; - - cmsUInt8Number alpha = (ExtraFirst ? accum[0] : accum[(nChan - 1) * Stride]); - cmsUInt32Number alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(alpha)); - - if (ExtraFirst) { - accum += Stride; + else + { + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(accum[(nChan - 1) * Stride])); } for (i=0; i < nChan; i++) { cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; - cmsUInt32Number v = FROM_8_TO_16(*accum); + cmsUInt16Number v = FROM_8_TO_16(*accum); + + v = Reverse ? REVERSE_FLAVOR_16(v) : v; - v = (v << 16) / alpha_factor; - if (v > 0xffff) v = 0xffff; + if (Premul && alpha_factor > 0) + { + v = (cmsUInt16Number)((cmsUInt32Number)((cmsUInt32Number)v << 16) / alpha_factor); + if (v > 0xffff) v = 0xffff; + } - wIn[index] = (cmsUInt16Number) (Reverse ? REVERSE_FLAVOR_16(v) : v); + wIn[index] = v; accum += Stride; } @@ -257,7 +211,6 @@ cmsUInt8Number* UnrollPlanarBytesPremul(CMSREGISTER _cmsTRANSFORM* info, } - // Special cases, provided for performance static cmsUInt8Number* Unroll4Bytes(CMSREGISTER _cmsTRANSFORM* info, @@ -1379,19 +1332,30 @@ cmsUInt8Number* UnrollFloatsToFloat(_cmsTRANSFORM* info, cmsUInt32Number Stride) { - cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); - cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info->InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->InputFormat); + cmsUInt32Number Extra = T_EXTRA(info->InputFormat); cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; - cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number Planar = T_PLANAR(info->InputFormat); + cmsUInt32Number Premul = T_PREMUL(info->InputFormat); cmsFloat32Number v; cmsUInt32Number i, start = 0; - cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F; + cmsFloat32Number maximum = IsInkSpace(info->InputFormat) ? 100.0F : 1.0F; + cmsFloat32Number alpha_factor = 1.0f; + cmsFloat32Number* ptr = (cmsFloat32Number*)accum; Stride /= PixelSize(info->InputFormat); + if (Premul) + { + if (Planar) + alpha_factor = (ExtraFirst ? ptr[0] : ptr[(nChan - 1) * Stride]) / maximum; + else + alpha_factor = (ExtraFirst ? ptr[0] : ptr[nChan - 1]) / maximum; + } + if (ExtraFirst) start = Extra; @@ -1400,9 +1364,12 @@ cmsUInt8Number* UnrollFloatsToFloat(_cmsTRANSFORM* info, cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) - v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[(i + start) * Stride]; + v = ptr[(i + start) * Stride]; else - v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[i + start]; + v = ptr[i + start]; + + if (Premul) + v /= alpha_factor; v /= maximum; @@ -1432,19 +1399,30 @@ cmsUInt8Number* UnrollDoublesToFloat(_cmsTRANSFORM* info, cmsUInt32Number Stride) { - cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); - cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info->InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->InputFormat); + cmsUInt32Number Extra = T_EXTRA(info->InputFormat); cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; - cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number Planar = T_PLANAR(info->InputFormat); + cmsUInt32Number Premul = T_PREMUL(info->InputFormat); cmsFloat64Number v; cmsUInt32Number i, start = 0; cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 100.0 : 1.0; + cmsFloat64Number alpha_factor = 1.0; + cmsFloat64Number* ptr = (cmsFloat64Number*)accum; Stride /= PixelSize(info->InputFormat); + if (Premul) + { + if (Planar) + alpha_factor = (ExtraFirst ? ptr[0] : ptr[(nChan - 1) * Stride]) / maximum; + else + alpha_factor = (ExtraFirst ? ptr[0] : ptr[nChan - 1]) / maximum; + } + if (ExtraFirst) start = Extra; @@ -1457,6 +1435,10 @@ cmsUInt8Number* UnrollDoublesToFloat(_cmsTRANSFORM* info, else v = (cmsFloat64Number) ((cmsFloat64Number*) accum)[i + start]; + + if (Premul) + v /= alpha_factor; + v /= maximum; wIn[index] = (cmsFloat32Number) (Reverse ? 1.0 - v : v); @@ -1538,8 +1520,6 @@ cmsUInt8Number* UnrollLabFloatToFloat(_cmsTRANSFORM* info, } } - - // 1.15 fixed point, that means maximum value is MAX_ENCODEABLE_XYZ (0xFFFF) static cmsUInt8Number* UnrollXYZDoubleToFloat(_cmsTRANSFORM* info, @@ -1678,28 +1658,38 @@ cmsUInt8Number* UnrollLabV2_16ToFloat(_cmsTRANSFORM* info, // Generic chunky for byte - static -cmsUInt8Number* PackAnyBytes(CMSREGISTER _cmsTRANSFORM* info, - CMSREGISTER cmsUInt16Number wOut[], - CMSREGISTER cmsUInt8Number* output, - CMSREGISTER cmsUInt32Number Stride) +cmsUInt8Number* PackChunkyBytes(CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { - cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); - cmsUInt32Number Extra = T_EXTRA(info -> OutputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> OutputFormat); + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Premul = T_PREMUL(info->OutputFormat); cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsUInt8Number* swap1; cmsUInt8Number v = 0; cmsUInt32Number i; + cmsUInt32Number alpha_factor = 0; swap1 = output; if (ExtraFirst) { + + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(output[0])); + output += Extra; } + else + { + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(output[nChan - 1])); + } for (i=0; i < nChan; i++) { @@ -1710,6 +1700,11 @@ cmsUInt8Number* PackAnyBytes(CMSREGISTER _cmsTRANSFORM* info, if (Reverse) v = REVERSE_FLAVOR_8(v); + if (Premul && alpha_factor != 0) + { + v = (cmsUInt8Number)((cmsUInt32Number)((cmsUInt32Number)v * alpha_factor + 0x8000) >> 16); + } + *output++ = v; } @@ -1723,37 +1718,44 @@ cmsUInt8Number* PackAnyBytes(CMSREGISTER _cmsTRANSFORM* info, *swap1 = v; } - return output; cmsUNUSED_PARAMETER(Stride); } - - - static -cmsUInt8Number* PackAnyWords(CMSREGISTER _cmsTRANSFORM* info, - CMSREGISTER cmsUInt16Number wOut[], - CMSREGISTER cmsUInt8Number* output, - CMSREGISTER cmsUInt32Number Stride) +cmsUInt8Number* PackChunkyWords(CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { - cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); - cmsUInt32Number SwapEndian = T_ENDIAN16(info -> OutputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); - cmsUInt32Number Extra = T_EXTRA(info -> OutputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> OutputFormat); + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number SwapEndian = T_ENDIAN16(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Premul = T_PREMUL(info->OutputFormat); cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsUInt16Number* swap1; cmsUInt16Number v = 0; cmsUInt32Number i; - + cmsUInt32Number alpha_factor = 0; + swap1 = (cmsUInt16Number*) output; if (ExtraFirst) { + + if (Premul) + alpha_factor = _cmsToFixedDomain(*(cmsUInt16Number*) output); + output += Extra * sizeof(cmsUInt16Number); } + else + { + if (Premul) + alpha_factor = _cmsToFixedDomain(((cmsUInt16Number*) output)[nChan - 1]); + } for (i=0; i < nChan; i++) { @@ -1767,6 +1769,11 @@ cmsUInt8Number* PackAnyWords(CMSREGISTER _cmsTRANSFORM* info, if (Reverse) v = REVERSE_FLAVOR_16(v); + if (Premul && alpha_factor != 0) + { + v = (cmsUInt16Number)((cmsUInt32Number)((cmsUInt32Number)v * alpha_factor + 0x8000) >> 16); + } + *(cmsUInt16Number*) output = v; output += sizeof(cmsUInt16Number); @@ -1782,29 +1789,42 @@ cmsUInt8Number* PackAnyWords(CMSREGISTER _cmsTRANSFORM* info, *swap1 = v; } - return output; cmsUNUSED_PARAMETER(Stride); } + static cmsUInt8Number* PackPlanarBytes(CMSREGISTER _cmsTRANSFORM* info, CMSREGISTER cmsUInt16Number wOut[], CMSREGISTER cmsUInt8Number* output, CMSREGISTER cmsUInt32Number Stride) { - cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); - cmsUInt32Number SwapFirst = T_SWAPFIRST(info ->OutputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Premul = T_PREMUL(info->OutputFormat); cmsUInt32Number i; cmsUInt8Number* Init = output; + cmsUInt32Number alpha_factor = 0; + + + if (ExtraFirst) { + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(output[0])); - if (DoSwap ^ SwapFirst) { - output += T_EXTRA(info -> OutputFormat) * Stride; + output += Extra * Stride; + } + else + { + if (Premul) + alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(output[(nChan - 1) * Stride])); } @@ -1813,7 +1833,15 @@ cmsUInt8Number* PackPlanarBytes(CMSREGISTER _cmsTRANSFORM* info, cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; cmsUInt8Number v = FROM_16_TO_8(wOut[index]); - *(cmsUInt8Number*) output = (cmsUInt8Number) (Reverse ? REVERSE_FLAVOR_8(v) : v); + v = (cmsUInt8Number)(Reverse ? REVERSE_FLAVOR_8(v) : v); + + if (Premul && alpha_factor != 0) + { + v = (cmsUInt8Number)((cmsUInt32Number)((cmsUInt32Number)v * alpha_factor + 0x8000) >> 16); + } + + *(cmsUInt8Number*)output = v; + output += Stride; } @@ -1829,16 +1857,30 @@ cmsUInt8Number* PackPlanarWords(CMSREGISTER _cmsTRANSFORM* info, CMSREGISTER cmsUInt8Number* output, CMSREGISTER cmsUInt32Number Stride) { - cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); - cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); - cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); - cmsUInt32Number SwapEndian = T_ENDIAN16(info -> OutputFormat); + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Premul = T_PREMUL(info->OutputFormat); + cmsUInt32Number SwapEndian = T_ENDIAN16(info->OutputFormat); cmsUInt32Number i; cmsUInt8Number* Init = output; cmsUInt16Number v; + cmsUInt32Number alpha_factor = 0; - if (DoSwap) { - output += T_EXTRA(info -> OutputFormat) * Stride; + if (ExtraFirst) { + + if (Premul) + alpha_factor = _cmsToFixedDomain(((cmsUInt16Number*) output)[0]); + + output += Extra * Stride; + } + else + { + if (Premul) + alpha_factor = _cmsToFixedDomain(((cmsUInt16Number*)output)[(nChan - 1) * Stride]); } for (i=0; i < nChan; i++) { @@ -1853,6 +1895,11 @@ cmsUInt8Number* PackPlanarWords(CMSREGISTER _cmsTRANSFORM* info, if (Reverse) v = REVERSE_FLAVOR_16(v); + if (Premul && alpha_factor != 0) + { + v = (cmsUInt16Number)((cmsUInt32Number)((cmsUInt32Number)v * alpha_factor + 0x8000) >> 16); + } + *(cmsUInt16Number*) output = v; output += Stride; } @@ -2999,10 +3046,6 @@ cmsUInt8Number* PackDoublesFromFloat(_cmsTRANSFORM* info, } - - - - static cmsUInt8Number* PackLabFloatFromFloat(_cmsTRANSFORM* Info, cmsFloat32Number wOut[], @@ -3387,18 +3430,12 @@ static const cmsFormatters16 InputFormatters16[] = { { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1), ANYSPACE, Unroll4BytesSwap}, { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Unroll4BytesSwapSwapFirst}, - { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAPFIRST| + { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYPREMUL| ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollPlanarBytes}, - { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP| + { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYPREMUL| ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollChunkyBytes}, - - { BYTES_SH(1) | PLANAR_SH(1), ANYFLAVOR | ANYSWAPFIRST | PREMUL_SH(1) | - ANYSWAP | ANYEXTRA | ANYCHANNELS | ANYSPACE, UnrollPlanarBytesPremul}, - - { BYTES_SH(1), ANYFLAVOR | ANYSWAPFIRST | ANYSWAP | PREMUL_SH(1) | - ANYEXTRA | ANYCHANNELS | ANYSPACE, UnrollChunkyBytesPremul}, - + { CHANNELS_SH(1)|BYTES_SH(2), ANYSPACE, Unroll1Word}, { CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1), ANYSPACE, Unroll1WordReversed}, { CHANNELS_SH(1)|BYTES_SH(2)|EXTRA_SH(3), ANYSPACE, Unroll1WordSkip3}, @@ -3437,10 +3474,10 @@ static const cmsFormattersFloat InputFormattersFloat[] = { { TYPE_XYZ_FLT, ANYPLANAR|ANYEXTRA, UnrollXYZFloatToFloat}, { FLOAT_SH(1)|BYTES_SH(4), ANYPLANAR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| - ANYCHANNELS|ANYSPACE, UnrollFloatsToFloat}, + ANYPREMUL|ANYCHANNELS|ANYSPACE, UnrollFloatsToFloat}, { FLOAT_SH(1)|BYTES_SH(0), ANYPLANAR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| - ANYCHANNELS|ANYSPACE, UnrollDoublesToFloat}, + ANYCHANNELS|ANYSPACE|ANYPREMUL, UnrollDoublesToFloat}, { TYPE_LabV2_8, 0, UnrollLabV2_8ToFloat }, { TYPE_ALabV2_8, 0, UnrollALabV2_8ToFloat }, @@ -3453,7 +3490,7 @@ static const cmsFormattersFloat InputFormattersFloat[] = { ANYCHANNELS|ANYSPACE, Unroll16ToFloat}, #ifndef CMS_NO_HALF_SUPPORT { FLOAT_SH(1)|BYTES_SH(2), ANYPLANAR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| - ANYCHANNELS|ANYSPACE, UnrollHalfToFloat}, + ANYCHANNELS|ANYSPACE, UnrollHalfToFloat}, #endif }; @@ -3547,16 +3584,20 @@ static const cmsFormatters16 OutputFormatters16[] = { ANYSPACE, Pack3BytesAndSkip1SwapSwapFirst}, { CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|EXTRA_SH(1), ANYSPACE, Pack3BytesAndSkip1Swap}, { CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1), ANYSPACE, Pack3BytesSwap}, - { CHANNELS_SH(6)|BYTES_SH(1), ANYSPACE, Pack6Bytes}, - { CHANNELS_SH(6)|BYTES_SH(1)|DOSWAP_SH(1), ANYSPACE, Pack6BytesSwap}, { CHANNELS_SH(4)|BYTES_SH(1), ANYSPACE, Pack4Bytes}, { CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1), ANYSPACE, Pack4BytesReverse}, { CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Pack4BytesSwapFirst}, { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1), ANYSPACE, Pack4BytesSwap}, { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Pack4BytesSwapSwapFirst}, + { CHANNELS_SH(6)|BYTES_SH(1), ANYSPACE, Pack6Bytes}, + { CHANNELS_SH(6)|BYTES_SH(1)|DOSWAP_SH(1), ANYSPACE, Pack6BytesSwap}, + + { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS| + ANYSPACE|ANYPREMUL, PackChunkyBytes}, - { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackAnyBytes}, - { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackPlanarBytes}, + { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| + ANYCHANNELS|ANYSPACE|ANYPREMUL, PackPlanarBytes}, + { CHANNELS_SH(1)|BYTES_SH(2), ANYSPACE, Pack1Word}, { CHANNELS_SH(1)|BYTES_SH(2)|EXTRA_SH(1), ANYSPACE, Pack1WordSkip1}, @@ -3581,9 +3622,11 @@ static const cmsFormatters16 OutputFormatters16[] = { { CHANNELS_SH(6)|BYTES_SH(2), ANYSPACE, Pack6Words}, { CHANNELS_SH(6)|BYTES_SH(2)|DOSWAP_SH(1), ANYSPACE, Pack6WordsSwap}, - { BYTES_SH(2)|PLANAR_SH(1), ANYFLAVOR|ANYENDIAN|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackPlanarWords}, - { BYTES_SH(2), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYENDIAN|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackAnyWords} - + { BYTES_SH(2), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYENDIAN| + ANYEXTRA|ANYCHANNELS|ANYSPACE|ANYPREMUL, PackChunkyWords}, + { BYTES_SH(2)|PLANAR_SH(1), ANYFLAVOR|ANYENDIAN|ANYSWAP|ANYEXTRA| + ANYCHANNELS|ANYSPACE|ANYPREMUL, PackPlanarWords} + }; |