Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccApplyBPC.h
Go to the documentation of this file.
1/** @file
2File: IccApplyBPC.h
3
4Contains: Header file for implementation of Black Point Compensation calculations.
5
6Version: V1
7
8Copyright: (c) see ICC Software License
9*/
10
11/*
12* The ICC Software License, Version 0.2
13*
14*
15* Copyright (c) 2003-2012 The International Color Consortium. All rights
16* reserved.
17*
18* Redistribution and use in source and binary forms, with or without
19* modification, are permitted provided that the following conditions
20* are met:
21*
22* 1. Redistributions of source code must retain the above copyright
23* notice, this list of conditions and the following disclaimer.
24*
25* 2. Redistributions in binary form must reproduce the above copyright
26* notice, this list of conditions and the following disclaimer in
27* the documentation and/or other materials provided with the
28* distribution.
29*
30* 3. In the absence of prior written permission, the names "ICC" and "The
31* International Color Consortium" must not be used to imply that the
32* ICC organization endorses or promotes products derived from this
33* software.
34*
35*
36* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39* DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
40* ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47* SUCH DAMAGE.
48* ====================================================================
49*
50* This software consists of voluntary contributions made by many
51* individuals on behalf of the The International Color Consortium.
52*
53*
54* Membership in the ICC is encouraged when this software is used for
55* commercial purposes.
56*
57*
58* For more information on The International Color Consortium, please
59* see <http://www.color.org/>.
60*
61*
62*/
63
64//////////////////////////////////////////////////////////////////////
65// HISTORY:
66//
67// -Initial implementation by Rohit Patil 12-8-2008
68//
69//////////////////////////////////////////////////////////////////////
70
71#if !defined(_ICCAPPLYBPC_H)
72#define _ICCAPPLYBPC_H
73
74#include "IccCmm.h"
75
76#ifdef USEREFICCMAXNAMESPACE
77namespace refIccMAX {
78#endif
79
80/**
81**************************************************************************
82* Type: Class
83*
84* Purpose:
85* Interface and hint for creating a BPC xform object
86**************************************************************************
87*/
88class ICCPROFLIB_API CIccApplyBPCHint : public CIccCreateAdjustPCSXformHint
89{
90public:
91 virtual const char *GetAdjustPCSType() const { return "CIccApplyBPCHint"; }
92 virtual IIccAdjustPCSXform* GetNewAdjustPCSXform() const;
93};
94
95/**
96 **************************************************************************
97 * Type: Class
98 *
99 * Purpose: This is the hint for applying black point compensation.
100 * Also does the calculations to setup actual application of BPC.
101 *
102 **************************************************************************
103*/
104class ICCPROFLIB_API CIccApplyBPC : public IIccAdjustPCSXform
105{
106public:
107 // virtual IIccAdjustPCSXform functions
108 // does all the calculations for BPC and returns the scale and offset in the arguments passed
109 virtual bool CalcFactors(const CIccProfile* pProfile, const CIccXform* pXfm, icFloatNumber* Scale, icFloatNumber* Offset) const;
110
111private:
112 // utility functions
113 void lab2pcs(icFloatNumber* pixel, const CIccProfile* pProfile) const;
114 void pcs2lab(icFloatNumber* pixel, const CIccProfile* pProfile) const;
115 icFloatNumber calcsum(icFloatNumber* x, icFloatNumber* y, int n, int j, int k) const;
116 icFloatNumber calcQuadraticVertex(icFloatNumber* x, icFloatNumber* y, int n) const;
117
118 // worker functions
119 bool calcBlackPoint(const CIccProfile* pProfile, const CIccXform* pXform, icFloatNumber* XYZb) const;
120 bool calcSrcBlackPoint(const CIccProfile* pProfile, const CIccXform* pXform, icFloatNumber* XYZb) const;
121 bool calcDstBlackPoint(const CIccProfile* pProfile, const CIccXform* pXform, icFloatNumber* XYZb) const;
122
123 bool pixelXfm(icFloatNumber *DstPixel, icFloatNumber *SrcPixel, icColorSpaceSignature SrcSpace,
124 icRenderingIntent nIntent, const CIccProfile *pProfile) const;
125
126 // PCS -> PCS round trip transform, always uses relative intent on the device -> pcs transform
127 CIccCmm* getBlackXfm(icRenderingIntent nIntent, const CIccProfile *pProfile) const;
128};
129
130#ifdef USEREFICCMAXNAMESPACE
131}; //namespace refIccMAX
132#endif
133
134#endif // _ICCAPPLYBPC_H
135
File: IccCmm.h.
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
#define ICCPROFLIB_API
Type: Class.
Definition IccApplyBPC.h:89
virtual const char * GetAdjustPCSType() const
Definition IccApplyBPC.h:91
Type: Class.
icColorSpaceSignature
Color Space Signatures.
icRenderingIntent
Rendering Intents, used in the profile header.