< prev index next >

src/java.desktop/share/native/liblcms/cmslut.c

Print this page

        

*** 28,38 **** // file: // //--------------------------------------------------------------------------------- // // Little Color Management System ! // Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, --- 28,38 ---- // file: // //--------------------------------------------------------------------------------- // // Little Color Management System ! // Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense,
*** 424,464 **** EvaluateMatrix, MatrixElemDup, MatrixElemTypeFree, NULL ); if (NewMPE == NULL) return NULL; NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageMatrixData)); ! if (NewElem == NULL) return NULL; ! NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFloat64Number)); ! ! if (NewElem->Double == NULL) { ! MatrixElemTypeFree(NewMPE); ! return NULL; ! } for (i=0; i < n; i++) { NewElem ->Double[i] = Matrix[i]; } - if (Offset != NULL) { NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Rows, sizeof(cmsFloat64Number)); ! if (NewElem->Offset == NULL) { ! MatrixElemTypeFree(NewMPE); ! return NULL; ! } for (i=0; i < Rows; i++) { NewElem ->Offset[i] = Offset[i]; } - } - NewMPE ->Data = (void*) NewElem; return NewMPE; } // ************************************************************************************************* // Type cmsSigCLutElemType --- 424,458 ---- EvaluateMatrix, MatrixElemDup, MatrixElemTypeFree, NULL ); if (NewMPE == NULL) return NULL; NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageMatrixData)); ! if (NewElem == NULL) goto Error; ! NewMPE->Data = (void*)NewElem; NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFloat64Number)); ! if (NewElem->Double == NULL) goto Error; for (i=0; i < n; i++) { NewElem ->Double[i] = Matrix[i]; } if (Offset != NULL) { NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Rows, sizeof(cmsFloat64Number)); ! if (NewElem->Offset == NULL) goto Error; for (i=0; i < Rows; i++) { NewElem ->Offset[i] = Offset[i]; } } return NewMPE; + + Error: + cmsStageFree(NewMPE); + return NULL; } // ************************************************************************************************* // Type cmsSigCLutElemType
*** 727,737 **** return NewMPE; } static ! int IdentitySampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void * Cargo) { int nChan = *(int*) Cargo; int i; for (i=0; i < nChan; i++) --- 721,731 ---- return NewMPE; } static ! int IdentitySampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void * Cargo) { int nChan = *(int*) Cargo; int i; for (i=0; i < nChan; i++)
*** 1344,1354 **** } // Default to evaluate the LUT on 16 bit-basis. Precision is retained. static ! void _LUTeval16(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register const void* D) { cmsPipeline* lut = (cmsPipeline*) D; cmsStage *mpe; cmsFloat32Number Storage[2][MAX_STAGE_CHANNELS]; int Phase = 0, NextPhase; --- 1338,1348 ---- } // Default to evaluate the LUT on 16 bit-basis. Precision is retained. static ! void _LUTeval16(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER const void* D) { cmsPipeline* lut = (cmsPipeline*) D; cmsStage *mpe; cmsFloat32Number Storage[2][MAX_STAGE_CHANNELS]; int Phase = 0, NextPhase;
*** 1370,1380 **** // Does evaluate the LUT on cmsFloat32Number-basis. static ! void _LUTevalFloat(register const cmsFloat32Number In[], register cmsFloat32Number Out[], const void* D) { cmsPipeline* lut = (cmsPipeline*) D; cmsStage *mpe; cmsFloat32Number Storage[2][MAX_STAGE_CHANNELS]; int Phase = 0, NextPhase; --- 1364,1374 ---- // Does evaluate the LUT on cmsFloat32Number-basis. static ! void _LUTevalFloat(CMSREGISTER const cmsFloat32Number In[], CMSREGISTER cmsFloat32Number Out[], const void* D) { cmsPipeline* lut = (cmsPipeline*) D; cmsStage *mpe; cmsFloat32Number Storage[2][MAX_STAGE_CHANNELS]; int Phase = 0, NextPhase;
< prev index next >