From a5a44ce9b2a3702dd8b0b52401dfd9b0d85ff93c Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Tue, 15 Sep 2020 13:48:47 +0200 Subject: [PATCH] removes an unused function --- rtengine/iccstore.cc | 96 -------------------------------------------- rtengine/iccstore.h | 1 - 2 files changed, 97 deletions(-) diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index f53ddc893..2f443522c 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -1151,102 +1151,6 @@ std::vector rtengine::ICCStore::getWorkingProfiles() return implementation->getWorkingProfiles(); } -// WARNING: the caller must lock lcmsMutex -cmsHPROFILE rtengine::ICCStore::makeStdGammaProfile(cmsHPROFILE iprof) -{ - // forgive me for the messy code, quick hack to change gamma of an ICC profile to the RT standard gamma - if (!iprof) { - return nullptr; - } - - cmsUInt32Number bytesNeeded = 0; - cmsSaveProfileToMem(iprof, nullptr, &bytesNeeded); - - if (bytesNeeded == 0) { - return nullptr; - } - - uint8_t *data = new uint8_t[bytesNeeded + 1]; - cmsSaveProfileToMem(iprof, data, &bytesNeeded); - const uint8_t *p = &data[128]; // skip 128 byte header - uint32_t tag_count; - memcpy(&tag_count, p, 4); - p += 4; - tag_count = ntohl(tag_count); - - struct icctag { - uint32_t sig; - uint32_t offset; - uint32_t size; - } tags[tag_count]; - - constexpr uint32_t gamma = 0x239; - constexpr int gamma_size = 14; - int data_size = (gamma_size + 3) & ~3; - - for (uint32_t i = 0; i < tag_count; i++) { - memcpy(&tags[i], p, 12); - tags[i].sig = ntohl(tags[i].sig); - tags[i].offset = ntohl(tags[i].offset); - tags[i].size = ntohl(tags[i].size); - p += 12; - - if (tags[i].sig != 0x62545243 && // bTRC - tags[i].sig != 0x67545243 && // gTRC - tags[i].sig != 0x72545243 && // rTRC - tags[i].sig != 0x6B545243) { // kTRC - data_size += (tags[i].size + 3) & ~3; - } - } - - uint32_t sz = 128 + 4 + tag_count * 12 + data_size; - uint8_t *nd = new uint8_t[sz]; - memset(nd, 0, sz); - memcpy(nd, data, 128 + 4); - sz = htonl(sz); - memcpy(nd, &sz, 4); - uint32_t offset = 128 + 4 + tag_count * 12; - uint32_t gamma_offset = 0; - - for (uint32_t i = 0; i < tag_count; i++) { - struct icctag tag; - tag.sig = htonl(tags[i].sig); - - if (tags[i].sig == 0x62545243 || // bTRC - tags[i].sig == 0x67545243 || // gTRC - tags[i].sig == 0x72545243 || // rTRC - tags[i].sig == 0x6B545243) { // kTRC - if (gamma_offset == 0) { - gamma_offset = offset; - uint32_t pcurve[] = { htonl(0x63757276), htonl(0), htonl(/*gamma_size == 12 ? 0U : */1U) }; - memcpy(&nd[offset], pcurve, 12); - - //if (gamma_size == 14) { - uint16_t gm = htons(gamma); - memcpy(&nd[offset + 12], &gm, 2); - //} - - offset += (gamma_size + 3) & ~3; - } - - tag.offset = htonl(gamma_offset); - tag.size = htonl(gamma_size); - } else { - tag.offset = htonl(offset); - tag.size = htonl(tags[i].size); - memcpy(&nd[offset], &data[tags[i].offset], tags[i].size); - offset += (tags[i].size + 3) & ~3; - } - - memcpy(&nd[128 + 4 + i * 12], &tag, 12); - } - - cmsHPROFILE oprof = cmsOpenProfileFromMem(nd, ntohl(sz)); - delete [] nd; - delete [] data; - return oprof; -} - cmsHPROFILE rtengine::ICCStore::createFromMatrix(const double matrix[3][3], bool gamma, const Glib::ustring& name) { diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index 117124122..fb2331263 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -96,7 +96,6 @@ public: /*static*/ std::vector getWorkingProfiles(); - static cmsHPROFILE makeStdGammaProfile(cmsHPROFILE iprof); static cmsHPROFILE createFromMatrix(const double matrix[3][3], bool gamma = false, const Glib::ustring& name = Glib::ustring()); private: