⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmscnvrt.c

📁 Linux下的无线网卡通用驱动程序
💻 C
📖 第 1 页 / 共 2 页
字号:
                 LPMAT3 m, LPVEC3 of){              switch (Phase2) {                     // From relative XYZ to Relative XYZ.                     case XYZRel:                            if (Absolute)                            {                                   // From input relative to absolute, and then                                   // back to output relative                                   Rel2RelStepAbsCoefs(AdaptationState,                                                       BlackPointIn,                                                       WhitePointIn,                                                       IlluminantIn,                                                       ChromaticAdaptationMatrixIn,                                                       BlackPointOut,                                                       WhitePointOut,                                                       IlluminantOut,                                                       ChromaticAdaptationMatrixOut,                                                       m, of);                                   *fn1 = XYZ2XYZ;                            }                            else                            {                                   // XYZ Relative to XYZ relative, no op required                                                                      *fn1 = NULL;                                   if (DoBlackPointCompensation) {                                      *fn1 = XYZ2XYZ;                                      ComputeBlackPointCompensationFactors(BlackPointIn,                                                                      WhitePointIn,                                                                      IlluminantIn,                                                                      BlackPointOut,                                                                      WhitePointOut,                                                                      IlluminantOut,                                                                      m, of);                                   }                            }                            break;                                         // From relative XYZ to Relative Lab                     case LabRel:                            // First pass XYZ to absolute, then to relative and                            // finally to Lab. I use here D50 for output in order                            // to prepare the "to Lab" conversion.                            if (Absolute)                            {                                   Rel2RelStepAbsCoefs(AdaptationState,                                                    BlackPointIn,                                                    WhitePointIn,                                                    IlluminantIn,                                                    ChromaticAdaptationMatrixIn,                                                    BlackPointOut,                                                    WhitePointOut,                                                    IlluminantOut,                                                    ChromaticAdaptationMatrixOut,                                                    m, of);                                                                *fn1 = XYZ2Lab;                            }                            else                            {                                   // Just Convert to Lab                                   MAT3identity(m);                                   VEC3init(of, 0, 0, 0);                                   *fn1 = XYZ2Lab;                                   if (DoBlackPointCompensation) {                                    ComputeBlackPointCompensationFactors(BlackPointIn,                                                                          WhitePointIn,                                                                          IlluminantIn,                                                                          BlackPointOut,                                                                          WhitePointOut,                                                                          IlluminantOut,                                                                          m, of);                                   }                            }                            break;                                         default: return FALSE;                     }              return TRUE;}// From Lab Relative type LUTstaticint FromLabRelLUT(int Absolute,                             LPcmsCIEXYZ BlackPointIn,                             LPcmsCIEXYZ WhitePointIn,                             LPcmsCIEXYZ IlluminantIn,                             LPMAT3 ChromaticAdaptationMatrixIn,                 int Phase2, LPcmsCIEXYZ BlackPointOut,                             LPcmsCIEXYZ WhitePointOut,                             LPcmsCIEXYZ IlluminantOut,                             LPMAT3 ChromaticAdaptationMatrixOut,                int DoBlackPointCompensation,                double AdaptationState,                 _cmsADJFN *fn1,                 LPMAT3 m, LPVEC3 of){          switch (Phase2) {              // From Lab Relative to XYZ Relative, very usual case              case XYZRel:                  if (Absolute) {  // Absolute intent                            // From lab relative, to XYZ absolute, and then,                            // back to XYZ relative                            Rel2RelStepAbsCoefs(AdaptationState,                                                BlackPointIn,                                                WhitePointIn,                                                cmsD50_XYZ(),                                                ChromaticAdaptationMatrixIn,                                                BlackPointOut,                                                WhitePointOut,                                                IlluminantOut,                                                ChromaticAdaptationMatrixOut,                                                m, of);                            *fn1 = Lab2XYZ;                     }                     else                     {                            // From Lab relative, to XYZ relative.                                                        *fn1 = Lab2XYZ;                            if (DoBlackPointCompensation) {                                 ComputeBlackPointCompensationFactors(BlackPointIn,                                                                      WhitePointIn,                                                                      IlluminantIn,                                                                      BlackPointOut,                                                                      WhitePointOut,                                                                      IlluminantOut,                                                                      m, of);                            }                     }                     break;              case LabRel:                     if (Absolute) {                             // First pass to XYZ using the input illuminant                             // * InIlluminant / D50, then to absolute. Then                             // to relative, but for input                             Rel2RelStepAbsCoefs(AdaptationState,                                                 BlackPointIn,                                                  WhitePointIn, IlluminantIn,                                                 ChromaticAdaptationMatrixIn,                                                 BlackPointOut,                                                  WhitePointOut, cmsD50_XYZ(),                                                 ChromaticAdaptationMatrixOut,                                                 m, of);                             *fn1 = Lab2XYZ2Lab;                     }                     else                     {      // Lab -> Lab relative don't need any adjust unless                            // black point compensation                            *fn1 = NULL;                             if (DoBlackPointCompensation) {                                 *fn1 = Lab2XYZ2Lab;                                 ComputeBlackPointCompensationFactors(BlackPointIn,                                                                      WhitePointIn,                                                                      IlluminantIn,                                                                      BlackPointOut,                                                                      WhitePointOut,                                                                      IlluminantOut,                                                                      m, of);                                                            }                     }                     break;              default: return FALSE;              }   return TRUE;}// This function does calculate the necessary conversion operations// needed from transpassing data from a LUT to a LUT. The conversion// is modeled as a pointer of function and two coefficients, a and b// The function is actually called only if not null pointer is provided,// and the two paramaters are passed in. There are several types of// conversions, but basically they do a linear scalling and a interchange// Main dispatcherint cmsChooseCnvrt(int Absolute,                  int Phase1, LPcmsCIEXYZ BlackPointIn,                              LPcmsCIEXYZ WhitePointIn,                              LPcmsCIEXYZ IlluminantIn,                              LPMAT3 ChromaticAdaptationMatrixIn,                  int Phase2, LPcmsCIEXYZ BlackPointOut,                              LPcmsCIEXYZ WhitePointOut,                              LPcmsCIEXYZ IlluminantOut,                              LPMAT3 ChromaticAdaptationMatrixOut,                  int DoBlackPointCompensation,                  double AdaptationState,                  _cmsADJFN *fn1,                  LPWMAT3 wm, LPWVEC3 wof){       int rc;       MAT3 m;       VEC3 of;       MAT3identity(&m);       VEC3init(&of, 0, 0, 0);       switch (Phase1) {       // Input LUT is giving XYZ relative values.       case XYZRel:  rc = FromXYZRelLUT(Absolute,                                          BlackPointIn,                                          WhitePointIn,                                          IlluminantIn,                                          ChromaticAdaptationMatrixIn,                                          Phase2,                                          BlackPointOut,                                          WhitePointOut,                                          IlluminantOut,                                          ChromaticAdaptationMatrixOut,                                          DoBlackPointCompensation,                                          AdaptationState,                                          fn1, &m, &of);                     break;              // Input LUT is giving Lab relative values       case LabRel:  rc =  FromLabRelLUT(Absolute,                                          BlackPointIn,                                          WhitePointIn,                                          IlluminantIn,                                          ChromaticAdaptationMatrixIn,                                          Phase2,                                          BlackPointOut,                                          WhitePointOut,                                          IlluminantOut,                                          ChromaticAdaptationMatrixOut,                                          DoBlackPointCompensation,                                          AdaptationState,                                          fn1, &m, &of);                     break;              // Unrecognized combination       default:    cmsSignalError(LCMS_ERRC_ABORTED, "(internal) Phase error");                   return FALSE;       }       MAT3toFix(wm, &m);       VEC3toFix(wof, &of);       // Do some optimization -- discard conversion if identity parameters.       if (*fn1 == XYZ2XYZ || *fn1 == Lab2XYZ2Lab) {           if (IdentityParameters(wm, wof))               *fn1 = NULL;       }              return rc;}      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -