summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/ccodec_iccmodule.h2
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp13
-rw-r--r--core/fxcodec/codec/fx_codec_icc.cpp26
3 files changed, 22 insertions, 19 deletions
diff --git a/core/fxcodec/codec/ccodec_iccmodule.h b/core/fxcodec/codec/ccodec_iccmodule.h
index c568a9b3c2..08878acc98 100644
--- a/core/fxcodec/codec/ccodec_iccmodule.h
+++ b/core/fxcodec/codec/ccodec_iccmodule.h
@@ -22,7 +22,7 @@ class CCodec_IccModule {
int32_t intent = 0,
uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT);
void DestroyTransform(void* pTransform);
- void Translate(void* pTransform, float* pSrcValues, float* pDestValues);
+ void Translate(void* pTransform, const float* pSrcValues, float* pDestValues);
void TranslateScanline(void* pTransform,
uint8_t* pDest,
const uint8_t* pSrc,
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index 2ba505d059..f908908062 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -161,7 +161,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
m_pOutput = dest_buf;
m_Early = bEarlyChange ? 1 : 0;
m_nCodes = 0;
- uint32_t old_code = (uint32_t)-1;
+ uint32_t old_code = 0xFFFFFFFF;
uint8_t last_char = 0;
while (1) {
if (m_InPos + m_CodeLen > src_size * 8) {
@@ -193,20 +193,19 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
}
m_OutPos++;
last_char = (uint8_t)code;
- if (old_code != (uint32_t)-1) {
+ if (old_code != 0xFFFFFFFF)
AddCode(old_code, last_char);
- }
old_code = code;
} else if (code == 256) {
m_CodeLen = 9;
m_nCodes = 0;
- old_code = (uint32_t)-1;
+ old_code = 0xFFFFFFFF;
} else if (code == 257) {
break;
} else {
- if (old_code == (uint32_t)-1) {
+ if (old_code == 0xFFFFFFFF)
return 2;
- }
+
m_StackLen = 0;
if (code >= m_nCodes + 258) {
if (m_StackLen < sizeof(m_DecodeStack)) {
@@ -824,7 +823,7 @@ uint32_t CCodec_FlateModule::FlateOrLZWDecode(bool bLZW,
if (bLZW) {
{
std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder);
- dest_size = (uint32_t)-1;
+ dest_size = 0xFFFFFFFF;
offset = src_size;
int err =
decoder->Decode(nullptr, dest_size, src_buf, offset, bEarlyChange);
diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp
index 4f701aaed3..b143dcc0c9 100644
--- a/core/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/fxcodec/codec/fx_codec_icc.cpp
@@ -154,33 +154,32 @@ void IccLib_DestroyTransform(void* pTransform) {
cmsDeleteTransform(((CLcmsCmm*)pTransform)->m_hTransform);
delete (CLcmsCmm*)pTransform;
}
+
void IccLib_Translate(void* pTransform,
uint32_t nSrcComponents,
- float* pSrcValues,
+ const float* pSrcValues,
float* pDestValues) {
- if (!pTransform) {
+ if (!pTransform)
return;
- }
+
CLcmsCmm* p = (CLcmsCmm*)pTransform;
uint8_t output[4];
if (p->m_bLab) {
CFX_FixedBufGrow<double, 16> inputs(nSrcComponents);
double* input = inputs;
- for (uint32_t i = 0; i < nSrcComponents; i++) {
+ for (uint32_t i = 0; i < nSrcComponents; i++)
input[i] = pSrcValues[i];
- }
cmsDoTransform(p->m_hTransform, input, output, 1);
} else {
CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents);
uint8_t* input = inputs;
for (uint32_t i = 0; i < nSrcComponents; i++) {
- if (pSrcValues[i] > 1.0f) {
+ if (pSrcValues[i] > 1.0f)
input[i] = 255;
- } else if (pSrcValues[i] < 0) {
+ else if (pSrcValues[i] < 0)
input[i] = 0;
- } else {
- input[i] = (int)(pSrcValues[i] * 255.0f);
- }
+ else
+ input[i] = static_cast<int>(pSrcValues[i] * 255.0f);
}
cmsDoTransform(p->m_hTransform, input, output, 1);
}
@@ -201,6 +200,7 @@ void IccLib_Translate(void* pTransform,
break;
}
}
+
void IccLib_TranslateImage(void* pTransform,
unsigned char* pDest,
const unsigned char* pSrc,
@@ -225,17 +225,20 @@ void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData,
void CCodec_IccModule::DestroyTransform(void* pTransform) {
IccLib_DestroyTransform(pTransform);
}
+
void CCodec_IccModule::Translate(void* pTransform,
- float* pSrcValues,
+ const float* pSrcValues,
float* pDestValues) {
IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues);
}
+
void CCodec_IccModule::TranslateScanline(void* pTransform,
uint8_t* pDest,
const uint8_t* pSrc,
int32_t pixels) {
IccLib_TranslateImage(pTransform, pDest, pSrc, pixels);
}
+
const uint8_t g_CMYKSamples[81 * 81 * 3] = {
255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152,
123, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, 255, 253, 229,
@@ -1551,6 +1554,7 @@ const uint8_t g_CMYKSamples[81 * 81 * 3] = {
33, 28, 32, 22, 19, 23, 11, 6, 10, 1, 0, 0, 0, 0, 0,
0, 0, 0,
};
+
void AdobeCMYK_to_sRGB1(uint8_t c,
uint8_t m,
uint8_t y,