Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

calcndim.c File Reference

#include "General.h"
#include "CalcEng.h"
#include "CalcNDim.h"

Go to the source code of this file.

Defines

#define UNROLL_NDIM   1
#define SHRINK_FACTOR   13
#define DebugPrint(x)
#define CLIPPWord(x, a, b)   ((x)<(a)?(LH_UINT16)(a):((x)>(b)?(LH_UINT16)(b):(LH_UINT16)(x+.5)))
#define CLIPP(x, a, b)   ((x)<(a)?(a):((x)>(b)?(b):(x)))

Functions

CMError Calc323Dim_Data8To8_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError Calc324Dim_Data8To8_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError Calc423Dim_Data8To8_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError Calc424Dim_Data8To8_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data8To8_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data8To16_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data16To8_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data16To16_Lut16 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data8To8_Lut8 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data16To8_Lut8 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data8To16_Lut8 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)
CMError CalcNDim_Data16To16_Lut8 (CMCalcParamPtr calcParam, CMLutParamPtr lutParam)


Define Documentation

#define CLIPP x,
a,
 )     ((x)<(a)?(a):((x)>(b)?(b):(x)))
 

Definition at line 58 of file lh_core/calcndim.c.

#define CLIPPWord x,
a,
 )     ((x)<(a)?(LH_UINT16)(a):((x)>(b)?(LH_UINT16)(b):(LH_UINT16)(x+.5)))
 

Definition at line 57 of file lh_core/calcndim.c.

#define DebugPrint  ) 
 

Definition at line 54 of file lh_core/calcndim.c.

#define SHRINK_FACTOR   13
 

Definition at line 37 of file lh_core/calcndim.c.

Referenced by CalcNDim_Data8To8_Lut16().

#define UNROLL_NDIM   1
 

Definition at line 25 of file lh_core/calcndim.c.


Function Documentation

CMError Calc323Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 41 of file w98/lh_core/calcnd3.c.

00044 { 00045 LH_UINT8 * inputData[8], *outputData[8]; 00046 UINT32 OutputIncrement, inputDataRowOffset, outputDataRowOffset, Pixelcount, LineCount; 00047 register unsigned long adr0; 00048 register unsigned long ko0; 00049 unsigned long accu[8]; 00050 register long i; 00051 /*long Offsets[8];*/ 00052 00053 register long aAlutShift,aElutOffset,aAlutOffset; 00054 register long aElutWordSize; 00055 register long aAlutWordSize; 00056 register long aXlutAdrSize; 00057 register long aXlutAdrShift; 00058 register unsigned long aXlutWordSize; 00059 register unsigned long ii,jj; 00060 register long aOutputPackMode8Bit; 00061 long ein_Cache[8]; 00062 00063 LH_UINT16 * aus_lut = (LH_UINT16*)lutParam->outputLut; 00064 LH_UINT16 * ein_lut = (LH_UINT16*)lutParam->inputLut; 00065 LH_UINT16 * Xlut = (LH_UINT16*)lutParam->colorLut; 00066 00067 #ifdef DEBUG_OUTPUT 00068 long err = noErr; 00069 #endif 00070 LH_START_PROC("Calc323Dim_Data8To8_Lut16") 00071 00072 inputData[0] = (LH_UINT8 *)calcParam->inputData[0]; 00073 inputData[1] = (LH_UINT8 *)calcParam->inputData[1]; 00074 inputData[2] = (LH_UINT8 *)calcParam->inputData[2]; 00075 #if NDIM_IN_DIM == 4 00076 inputData[3] = (LH_UINT8 *)calcParam->inputData[3]; 00077 #endif 00078 outputData[0] = (LH_UINT8 *)calcParam->outputData[0]; 00079 outputData[1] = (LH_UINT8 *)calcParam->outputData[1]; 00080 outputData[2] = (LH_UINT8 *)calcParam->outputData[2]; 00081 #if NDIM_OUT_DIM == 4 00082 outputData[3] = (LH_UINT8 *)calcParam->outputData[3]; 00083 #endif 00084 00085 OutputIncrement = calcParam->cmOutputPixelOffset; 00086 inputDataRowOffset = calcParam->cmInputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmInputPixelOffset + (NDIM_IN_DIM * 2); 00087 outputDataRowOffset = calcParam->cmOutputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmOutputPixelOffset + OutputIncrement; 00088 00089 Pixelcount = calcParam->cmPixelPerLine; 00090 LineCount = calcParam->cmLineCount; 00091 00092 aElutWordSize = lutParam->inputLutWordSize; 00093 aAlutWordSize = lutParam->outputLutWordSize; 00094 aXlutAdrSize = lutParam->colorLutGridPoints; 00095 for ( i = 1; (i < 32) && (aXlutAdrSize >> i); i++) 00096 aXlutAdrShift = i; 00097 aXlutWordSize = lutParam->colorLutWordSize; 00098 00099 aOutputPackMode8Bit = calcParam->cmOutputColorSpace & cm8PerChannelPacking || calcParam->cmOutputColorSpace & cmLong8ColorPacking; 00100 /*DebugPrint("DoNDim with %d input elements\n",aByteCount);*/ 00101 #if FARBR_FILES 00102 WriteLuts( "DoNDim",1,adr_bereich_elut,aElutWordSize,ein_lut, 00103 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutWordSize,(LH_UINT16 *)Xlut,adr_bereich_alut,aAlutWordSize,(LH_UINT16 *)aus_lut); 00104 #endif 00105 00106 i=0; 00107 00108 { 00109 if( aElutShift < 0 ) 00110 { 00111 #ifdef DEBUG_OUTPUT 00112 DebugPrint("� DoNDim-Error: aElutShift < 0 (aElutShift = %d)\n",aElutShift); 00113 #endif 00114 return cmparamErr; 00115 } 00116 } 00117 00118 if( aOutputPackMode8Bit ){ 00119 aAlutShift = (aAlutWordSize-8); 00120 } 00121 else{ 00122 aAlutShift = (16 - aAlutWordSize); 00123 } 00124 00125 #ifdef DEBUG_OUTPUT 00126 if ( DebugCheck(kThisFile, kDebugReserved1) ){ 00127 DebugPrint("aElutAdrSize=%lx,aElutAdrShift=%lx,aElutWordSize=%lx,ein_lut=%lx,\n", 00128 adr_bereich_elut,adr_breite_elut,aElutWordSize,ein_lut); 00129 DebugPrint("aAlutAdrSize=%lx,aAlutAdrShift=%lx,aAlutWordSize=%lx,aus_lut=%lx,\n", 00130 adr_bereich_alut,adr_breite_alut,aAlutWordSize,aus_lut); 00131 DebugPrint("aXlutInDim=%lx,aXlutOutDim=%lx,aXlutAdrSize=%lx,aXlutAdrShift=%lx,aXlutWordSize=%lx,Xlut=%lx,\n", 00132 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutAdrShift,aXlutWordSize,Xlut); 00133 } 00134 #endif 00135 00136 /*if( 1 )*/ 00137 if( aXlutAdrSize != (1<<aXlutAdrShift )){ 00138 register long aXlutOffset; 00139 long theXlutOffsets[8]; 00140 register unsigned long aAlutInShift; 00141 register long aAlutInShiftRemainder; 00142 register unsigned long aAlutInShiftNum; 00143 register long aElutWordSizeMask = (1<<aElutWordSize) - 1; 00144 register unsigned long aAlutRound; 00145 aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut; 00146 aAlutInShiftRemainder = 0; 00147 if( aAlutInShift > 16 ){ 00148 aAlutInShiftRemainder = aAlutInShift - 16; 00149 aAlutInShift = 16; 00150 } 00151 aAlutInShiftNum = (1<<aAlutInShift); 00152 00153 #ifdef DEBUG_OUTPUT 00154 if ( DebugCheck(kThisFile, kDebugMiscInfo) ) 00155 DebugPrint(" DoNDim gripoints = %ld\n",aXlutAdrSize); 00156 #endif 00157 if( aElutWordSize <= 0 ){ 00158 #ifdef DEBUG_OUTPUT 00159 DebugPrint("� DoNDim-Error: (1<<aElutWordSize)/aXlutAdrSize <= 0 %d\n",(1<<aElutWordSize)/aXlutAdrSize); 00160 #endif 00161 return cmparamErr; 00162 } 00163 if( aAlutInShift <= 0 ){ 00164 #ifdef DEBUG_OUTPUT 00165 DebugPrint("� DoNDim-Error: aAlutInShift <= 0 %d\n",aAlutInShift); 00166 #endif 00167 return cmparamErr; 00168 } 00169 aXlutOffset =NDIM_OUT_DIM; 00170 for( i=0; i<(long)NDIM_IN_DIM; i++){ 00171 theXlutOffsets[ NDIM_IN_DIM-1-i] = aXlutOffset; 00172 aXlutOffset *=aXlutAdrSize; 00173 } 00174 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 00175 00176 #ifdef DEBUG_OUTPUT 00177 if ( DebugCheck(kThisFile, kDebugReserved1) ) 00178 DebugPrint(" aElutWordSize((1<<aElutWordSize)-0) = %ld\n aAlutInShift:((1<<aXlutWordSize)*aElutWordSize+(adr_bereich_alut/2))/adr_bereich_alut = %ld\n",aElutWordSize,aAlutInShift); 00179 #endif 00180 00181 while (LineCount){ 00182 i = Pixelcount; 00183 00184 while (i){ 00185 00186 long adr[8],Index[8]; 00187 LH_UINT16 ein_reg[8]; 00188 register unsigned long adrAdr,ko,adrOffset; 00189 00190 adr0=0; 00191 aElutOffset = 0; 00192 jj=0; 00193 00194 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 00195 ko0 = jj - ( jj >> ( adr_breite_elut )); 00196 ko = ko0 & ( aElutShiftNum - 1 ); 00197 ko0 = ko0 >> aElutShift; 00198 ko0 += aElutOffset; 00199 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00200 00201 jj *= aXlutAdrSize; 00202 aElutOffset += adr_bereich_elut; 00203 adr[0] = jj & aElutWordSizeMask; 00204 jj = jj >> aElutWordSize; 00205 adr0 += (jj)*theXlutOffsets[0]; 00206 ein_reg[0] = (LH_UINT16)jj; 00207 00208 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 00209 ko0 = jj - ( jj >> ( adr_breite_elut )); 00210 ko = ko0 & ( aElutShiftNum - 1 ); 00211 ko0 = ko0 >> aElutShift; 00212 ko0 += aElutOffset; 00213 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00214 00215 jj *= aXlutAdrSize; 00216 aElutOffset += adr_bereich_elut; 00217 adr[1] = jj & aElutWordSizeMask; 00218 jj = jj >> aElutWordSize; 00219 adr0 += (jj)*theXlutOffsets[1]; 00220 ein_reg[1] = (LH_UINT16)jj; 00221 00222 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 00223 ko0 = jj - ( jj >> ( adr_breite_elut )); 00224 ko = ko0 & ( aElutShiftNum - 1 ); 00225 ko0 = ko0 >> aElutShift; 00226 ko0 += aElutOffset; 00227 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00228 00229 jj *= aXlutAdrSize; 00230 aElutOffset += adr_bereich_elut; 00231 adr[2] = jj & aElutWordSizeMask; 00232 jj = jj >> aElutWordSize; 00233 adr0 += (jj)*theXlutOffsets[2]; 00234 ein_reg[2] = (LH_UINT16)jj; 00235 00236 #if NDIM_IN_DIM == 4 00237 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 00238 ko0 = jj - ( jj >> ( adr_breite_elut )); 00239 ko = ko0 & ( aElutShiftNum - 1 ); 00240 ko0 = ko0 >> aElutShift; 00241 ko0 += aElutOffset; 00242 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00243 00244 jj *= aXlutAdrSize; 00245 aElutOffset += adr_bereich_elut; 00246 adr[3] = jj & aElutWordSizeMask; 00247 jj = jj >> aElutWordSize; 00248 adr0 += (jj)*theXlutOffsets[3]; 00249 ein_reg[3] = (LH_UINT16)jj; 00250 #endif 00251 00252 00253 00254 { /* a kind of */ 00255 register long Hold; 00256 00257 00258 Index[0] = 0; 00259 Index[1] = 1; 00260 Index[2] = 2; 00261 #if NDIM_IN_DIM == 4 00262 Index[3] = 3; 00263 #endif 00264 if( adr[0] < adr[1] ){ 00265 Hold = Index[0]; 00266 Index[0] = Index[1]; 00267 Index[1] = Hold; 00268 } 00269 00270 if( adr[Index[1]] < adr[2] ){ 00271 Hold = Index[1]; 00272 Index[1] = Index[2]; 00273 Index[2] = Hold; 00274 if( adr[Index[0]] < adr[Index[1]] ){ 00275 Hold = Index[0]; 00276 Index[0] = Index[1]; 00277 Index[1] = Hold; 00278 } 00279 } 00280 00281 #if NDIM_IN_DIM == 4 00282 if( adr[Index[2]] < adr[3] ){ 00283 Hold = Index[2]; 00284 Index[2] = Index[3]; 00285 Index[3] = Hold; 00286 if( adr[Index[1]] < adr[Index[2]] ){ 00287 Hold = Index[1]; 00288 Index[1] = Index[2]; 00289 Index[2] = Hold; 00290 if( adr[Index[0]] < adr[Index[1]] ){ 00291 Hold = Index[0]; 00292 Index[0] = Index[1]; 00293 Index[1] = Hold; 00294 } 00295 } 00296 } 00297 #endif 00298 } 00299 00300 accu[0]=0; 00301 accu[1]=0; 00302 accu[2]=0; 00303 #if NDIM_OUT_DIM == 4 00304 accu[3]=0; 00305 #endif 00306 ko0 = (1<<aElutWordSize); 00307 adrAdr=adr0; 00308 adrOffset=0; 00309 if( aXlutWordSize == 16 ){ 00310 jj = Index[0]; 00311 ko = ko0 - adr[jj]; 00312 ko0 = adr[jj]; 00313 00314 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00315 adrOffset += theXlutOffsets[jj]; 00316 00317 accu[0]+=Xlut[adrAdr+(0)]*ko; 00318 accu[1]+=Xlut[adrAdr+(1)]*ko; 00319 accu[2]+=Xlut[adrAdr+(2)]*ko; 00320 #if NDIM_OUT_DIM == 4 00321 accu[3]+=Xlut[adrAdr+(3)]*ko; 00322 #endif 00323 00324 adrAdr = (adr0 + adrOffset); 00325 00326 jj = Index[1]; 00327 ko = ko0 - adr[jj]; 00328 ko0 = adr[jj]; 00329 00330 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00331 adrOffset += theXlutOffsets[jj]; 00332 00333 accu[0]+=Xlut[adrAdr+(0)]*ko; 00334 accu[1]+=Xlut[adrAdr+(1)]*ko; 00335 accu[2]+=Xlut[adrAdr+(2)]*ko; 00336 #if NDIM_OUT_DIM == 4 00337 accu[3]+=Xlut[adrAdr+(3)]*ko; 00338 #endif 00339 00340 adrAdr = (adr0 + adrOffset); 00341 00342 jj = Index[2]; 00343 ko = ko0 - adr[jj]; 00344 ko0 = adr[jj]; 00345 00346 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00347 adrOffset += theXlutOffsets[jj]; 00348 00349 accu[0]+=Xlut[adrAdr+(0)]*ko; 00350 accu[1]+=Xlut[adrAdr+(1)]*ko; 00351 accu[2]+=Xlut[adrAdr+(2)]*ko; 00352 #if NDIM_OUT_DIM == 4 00353 accu[3]+=Xlut[adrAdr+(3)]*ko; 00354 #endif 00355 00356 adrAdr = (adr0 + adrOffset); 00357 00358 #if NDIM_IN_DIM == 4 00359 jj = Index[3]; 00360 ko = ko0 - adr[jj]; 00361 ko0 = adr[jj]; 00362 00363 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00364 adrOffset += theXlutOffsets[jj]; 00365 00366 accu[0]+=Xlut[adrAdr+(0)]*ko; 00367 accu[1]+=Xlut[adrAdr+(1)]*ko; 00368 accu[2]+=Xlut[adrAdr+(2)]*ko; 00369 #if NDIM_OUT_DIM == 4 00370 accu[3]+=Xlut[adrAdr+(3)]*ko; 00371 #endif 00372 00373 adrAdr = (adr0 + adrOffset); 00374 #endif 00375 00376 accu[0]+=Xlut[adrAdr+0]*ko0; 00377 accu[1]+=Xlut[adrAdr+1]*ko0; 00378 accu[2]+=Xlut[adrAdr+2]*ko0; 00379 #if NDIM_OUT_DIM == 4 00380 accu[3]+=Xlut[adrAdr+3]*ko0; 00381 #endif 00382 } 00383 else{ 00384 00385 jj = Index[0]; 00386 ko = ko0 - adr[jj]; 00387 ko0 = adr[jj]; 00388 00389 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00390 adrOffset += theXlutOffsets[jj]; 00391 00392 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00393 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00394 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00395 #if NDIM_OUT_DIM == 4 00396 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00397 #endif 00398 adrAdr = (adr0 + adrOffset); 00399 00400 jj = Index[1]; 00401 ko = ko0 - adr[jj]; 00402 ko0 = adr[jj]; 00403 00404 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00405 adrOffset += theXlutOffsets[jj]; 00406 00407 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00408 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00409 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00410 #if NDIM_OUT_DIM == 4 00411 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00412 #endif 00413 adrAdr = (adr0 + adrOffset); 00414 00415 jj = Index[2]; 00416 ko = ko0 - adr[jj]; 00417 ko0 = adr[jj]; 00418 00419 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00420 adrOffset += theXlutOffsets[jj]; 00421 00422 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00423 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00424 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00425 #if NDIM_OUT_DIM == 4 00426 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00427 #endif 00428 adrAdr = (adr0 + adrOffset); 00429 00430 #if NDIM_IN_DIM == 4 00431 jj = Index[3]; 00432 ko = ko0 - adr[jj]; 00433 ko0 = adr[jj]; 00434 00435 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00436 adrOffset += theXlutOffsets[jj]; 00437 00438 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00439 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00440 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00441 #if NDIM_OUT_DIM == 4 00442 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00443 #endif 00444 adrAdr = (adr0 + adrOffset); 00445 #endif 00446 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 00447 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 00448 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 00449 #if NDIM_OUT_DIM == 4 00450 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 00451 #endif 00452 } 00453 00454 aAlutOffset = 0; 00455 00456 if( aOutputPackMode8Bit ){ 00457 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 00458 jj = accu[ii]; 00459 jj = jj + ( jj >> aXlutWordSize ); 00460 00461 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00462 00463 ko = ko0 & (aAlutInShiftNum - 1 ); 00464 ko0 = ko0 >> aAlutInShift; 00465 ko0 += aAlutOffset; 00466 if( aAlutWordSize <= 8) 00467 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 00468 else{ 00469 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 00470 jj = jj - ( jj >> aAlutShift ); 00471 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 00472 } 00473 *outputData[ii] = (LH_UINT8)jj; 00474 aAlutOffset += adr_bereich_alut; 00475 } 00476 } 00477 else{ 00478 if( aXlutWordSize >= 16 ){ 00479 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 00480 jj = accu[ii]; 00481 jj = jj + ( jj >> aXlutWordSize ); 00482 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00483 00484 ko = ko0 & (aAlutInShiftNum - 1 ); 00485 ko0 = ko0 >> aAlutInShift; 00486 ko0 += aAlutOffset; 00487 if( aAlutWordSize <= 8) 00488 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00489 else 00490 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00491 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00492 aAlutOffset += adr_bereich_alut; 00493 } 00494 } 00495 else{ 00496 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 00497 jj = accu[ii]; 00498 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 00499 ko0 = (jj - ( jj >> ( adr_breite_alut ))) ; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00500 00501 ko = ko0 & (aAlutInShiftNum - 1 ); 00502 ko0 = ko0 >> aAlutInShift; 00503 ko0 += aAlutOffset; 00504 if( aAlutWordSize <= 8) 00505 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00506 else 00507 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00508 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00509 aAlutOffset += adr_bereich_alut; 00510 } 00511 } 00512 } 00513 while (--i){ 00514 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 00515 inputData[jj] += (NDIM_IN_DIM * 2); 00516 } 00517 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00518 outputData[jj] += OutputIncrement; 00519 } 00520 00521 { 00522 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 00523 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 00524 } 00525 } 00526 if( jj<NDIM_IN_DIM ) break; 00527 if( aOutputPackMode8Bit ){ 00528 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00529 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 00530 } 00531 } 00532 else{ 00533 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00534 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 00535 } 00536 } 00537 } 00538 } 00539 00540 if( --LineCount ){ 00541 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 00542 inputData[jj] += inputDataRowOffset; 00543 } 00544 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00545 outputData[jj] += outputDataRowOffset; 00546 } 00547 } 00548 } 00549 } 00550 else{ 00551 00552 register unsigned long bit_breit_selektor; 00553 register unsigned long bit_maske_selektor; 00554 register unsigned long bit_breit_adr; 00555 register unsigned long bit_maske_adr; 00556 register unsigned long aAlutInShiftNum; 00557 register long aAlutInShift; 00558 register long aAlutInShiftRemainder; 00559 register unsigned long aAlutRound; 00560 /*register long aXlutPlaneShift = aXlutAdrShift*aXlutInDim;*/ 00561 bit_breit_selektor=aElutWordSize-aXlutAdrShift; 00562 if( aElutWordSize-aXlutAdrShift < 0 ) 00563 { 00564 #ifdef DEBUG_OUTPUT 00565 DebugPrint("� DoNDim-Error: bit_breit_selektor < 0 (bit_breit_selektor = %d)\n",bit_breit_selektor); 00566 #endif 00567 return cmparamErr; 00568 } 00569 bit_maske_selektor=(1<<bit_breit_selektor)-1; 00570 bit_breit_adr=aXlutAdrShift; 00571 bit_maske_adr=((1<<bit_breit_adr)-1)<<bit_breit_selektor; 00572 aAlutInShift = (aXlutWordSize+bit_breit_selektor-adr_breite_alut); 00573 /*aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00574 aAlutInShiftRemainder = 0; 00575 if( aAlutInShift > 16 ){ 00576 aAlutInShiftRemainder = aAlutInShift - 16; 00577 aAlutInShift = 16; 00578 } 00579 00580 aAlutInShiftNum = (1<<aAlutInShift); 00581 00582 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 00583 while (LineCount){ 00584 i = Pixelcount; 00585 00586 while (i){ 00587 00588 long adr[8],Index[8]; 00589 /*LH_UINT16 *ein_lut = (LH_UINT16 *)ein_lut;*/ 00590 LH_UINT16 ein_reg[8]; 00591 register unsigned long adrAdr,ko,adrOffset; 00592 /*register unsigned long aIndex;*/ 00593 00594 adr0=0; 00595 aElutOffset = 0; 00596 jj=0; 00597 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 00598 ko0 = jj - ( jj >> ( adr_breite_elut )); 00599 ko = ko0 & ( aElutShiftNum - 1 ); 00600 ko0 = ko0 >> aElutShift; 00601 ko0 += aElutOffset; 00602 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00603 00604 aElutOffset += adr_bereich_elut; 00605 adr[0] = (jj & bit_maske_selektor); 00606 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-0-1)*bit_breit_adr); 00607 ein_reg[0] = (LH_UINT16)jj; 00608 00609 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 00610 ko0 = jj - ( jj >> ( adr_breite_elut )); 00611 ko = ko0 & ( aElutShiftNum - 1 ); 00612 ko0 = ko0 >> aElutShift; 00613 ko0 += aElutOffset; 00614 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00615 00616 aElutOffset += adr_bereich_elut; 00617 adr[1] = (jj & bit_maske_selektor); 00618 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-1-1)*bit_breit_adr); 00619 ein_reg[1] = (LH_UINT16)jj; 00620 00621 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 00622 ko0 = jj - ( jj >> ( adr_breite_elut )); 00623 ko = ko0 & ( aElutShiftNum - 1 ); 00624 ko0 = ko0 >> aElutShift; 00625 ko0 += aElutOffset; 00626 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00627 00628 aElutOffset += adr_bereich_elut; 00629 adr[2] = (jj & bit_maske_selektor); 00630 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-2-1)*bit_breit_adr); 00631 ein_reg[2] = (LH_UINT16)jj; 00632 00633 #if NDIM_IN_DIM == 4 00634 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 00635 ko0 = jj - ( jj >> ( adr_breite_elut )); 00636 ko = ko0 & ( aElutShiftNum - 1 ); 00637 ko0 = ko0 >> aElutShift; 00638 ko0 += aElutOffset; 00639 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00640 00641 aElutOffset += adr_bereich_elut; 00642 adr[3] = (jj & bit_maske_selektor); 00643 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-3-1)*bit_breit_adr); 00644 ein_reg[3] = (LH_UINT16)jj; 00645 #endif 00646 adr0 *= NDIM_OUT_DIM; 00647 00648 { /* a kind of */ 00649 register long Hold; 00650 00651 00652 Index[0] = 0; 00653 Index[1] = 1; 00654 Index[2] = 2; 00655 #if NDIM_IN_DIM == 4 00656 Index[3] = 3; 00657 #endif 00658 if( adr[0] < adr[1] ){ 00659 Hold = Index[0]; 00660 Index[0] = Index[1]; 00661 Index[1] = Hold; 00662 } 00663 00664 if( adr[Index[1]] < adr[2] ){ 00665 Hold = Index[1]; 00666 Index[1] = Index[2]; 00667 Index[2] = Hold; 00668 if( adr[Index[0]] < adr[Index[1]] ){ 00669 Hold = Index[0]; 00670 Index[0] = Index[1]; 00671 Index[1] = Hold; 00672 } 00673 } 00674 00675 #if NDIM_IN_DIM == 4 00676 if( adr[Index[2]] < adr[3] ){ 00677 Hold = Index[2]; 00678 Index[2] = Index[3]; 00679 Index[3] = Hold; 00680 if( adr[Index[1]] < adr[Index[2]] ){ 00681 Hold = Index[1]; 00682 Index[1] = Index[2]; 00683 Index[2] = Hold; 00684 if( adr[Index[0]] < adr[Index[1]] ){ 00685 Hold = Index[0]; 00686 Index[0] = Index[1]; 00687 Index[1] = Hold; 00688 } 00689 } 00690 } 00691 #endif 00692 } 00693 00694 accu[0]=0; 00695 accu[1]=0; 00696 accu[2]=0; 00697 #if NDIM_OUT_DIM == 4 00698 accu[3]=0; 00699 #endif 00700 00701 ko0 = bit_maske_selektor+1; 00702 adrAdr=adr0; 00703 adrOffset=0; 00704 00705 if( aXlutWordSize == 16 ){ 00706 jj = Index[0]; 00707 ko = ko0 - adr[jj]; 00708 ko0 = adr[jj]; 00709 00710 if( ein_reg[jj] < bit_maske_adr ) 00711 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00712 00713 accu[0]+=Xlut[adrAdr+(0)]*ko; 00714 accu[1]+=Xlut[adrAdr+(1)]*ko; 00715 accu[2]+=Xlut[adrAdr+(2)]*ko; 00716 #if NDIM_OUT_DIM == 4 00717 accu[3]+=Xlut[adrAdr+(3)]*ko; 00718 #endif 00719 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00720 00721 jj = Index[1]; 00722 ko = ko0 - adr[jj]; 00723 ko0 = adr[jj]; 00724 00725 if( ein_reg[jj] < bit_maske_adr ) 00726 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00727 00728 accu[0]+=Xlut[adrAdr+(0)]*ko; 00729 accu[1]+=Xlut[adrAdr+(1)]*ko; 00730 accu[2]+=Xlut[adrAdr+(2)]*ko; 00731 #if NDIM_OUT_DIM == 4 00732 accu[3]+=Xlut[adrAdr+(3)]*ko; 00733 #endif 00734 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00735 00736 jj = Index[2]; 00737 ko = ko0 - adr[jj]; 00738 ko0 = adr[jj]; 00739 00740 if( ein_reg[jj] < bit_maske_adr ) 00741 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00742 00743 accu[0]+=Xlut[adrAdr+(0)]*ko; 00744 accu[1]+=Xlut[adrAdr+(1)]*ko; 00745 accu[2]+=Xlut[adrAdr+(2)]*ko; 00746 #if NDIM_OUT_DIM == 4 00747 accu[3]+=Xlut[adrAdr+(3)]*ko; 00748 #endif 00749 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00750 00751 #if NDIM_IN_DIM == 4 00752 jj = Index[3]; 00753 ko = ko0 - adr[jj]; 00754 ko0 = adr[jj]; 00755 00756 if( ein_reg[jj] < bit_maske_adr ) 00757 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00758 00759 accu[0]+=Xlut[adrAdr+(0)]*ko; 00760 accu[1]+=Xlut[adrAdr+(1)]*ko; 00761 accu[2]+=Xlut[adrAdr+(2)]*ko; 00762 #if NDIM_OUT_DIM == 4 00763 accu[3]+=Xlut[adrAdr+(3)]*ko; 00764 #endif 00765 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00766 #endif 00767 accu[0]+=Xlut[adrAdr+0]*ko0; 00768 accu[1]+=Xlut[adrAdr+1]*ko0; 00769 accu[2]+=Xlut[adrAdr+2]*ko0; 00770 #if NDIM_OUT_DIM == 4 00771 accu[3]+=Xlut[adrAdr+3]*ko0; 00772 #endif 00773 } 00774 else{ 00775 jj = Index[0]; 00776 ko = ko0 - adr[jj]; 00777 ko0 = adr[jj]; 00778 00779 if( ein_reg[jj] < bit_maske_adr ) 00780 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00781 00782 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00783 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00784 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00785 #if NDIM_OUT_DIM == 4 00786 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00787 #endif 00788 00789 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00790 00791 jj = Index[1]; 00792 ko = ko0 - adr[jj]; 00793 ko0 = adr[jj]; 00794 00795 if( ein_reg[jj] < bit_maske_adr ) 00796 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00797 00798 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00799 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00800 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00801 #if NDIM_OUT_DIM == 4 00802 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00803 #endif 00804 00805 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00806 00807 jj = Index[2]; 00808 ko = ko0 - adr[jj]; 00809 ko0 = adr[jj]; 00810 00811 if( ein_reg[jj] < bit_maske_adr ) 00812 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00813 00814 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00815 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00816 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00817 #if NDIM_OUT_DIM == 4 00818 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00819 #endif 00820 00821 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00822 00823 #if NDIM_IN_DIM == 4 00824 jj = Index[3]; 00825 ko = ko0 - adr[jj]; 00826 ko0 = adr[jj]; 00827 00828 if( ein_reg[jj] < bit_maske_adr ) 00829 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 00830 00831 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 00832 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 00833 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 00834 #if NDIM_OUT_DIM == 4 00835 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 00836 #endif 00837 00838 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 00839 #endif 00840 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 00841 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 00842 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 00843 #if NDIM_OUT_DIM == 4 00844 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 00845 #endif 00846 } 00847 00848 aAlutOffset = 0; 00849 00850 if( aOutputPackMode8Bit ){ 00851 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 00852 jj = accu[ii]; 00853 jj = jj + ( jj >> aXlutWordSize ); 00854 00855 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00856 00857 ko = ko0 & (aAlutInShiftNum - 1 ); 00858 ko0 = ko0 >> aAlutInShift; 00859 ko0 += aAlutOffset; 00860 if( aAlutWordSize <= 8) 00861 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 00862 else{ 00863 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 00864 jj = jj - ( jj >> aAlutShift ); 00865 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 00866 } 00867 00868 *outputData[ii] = (LH_UINT8)jj; 00869 aAlutOffset += adr_bereich_alut; 00870 } 00871 } 00872 else{ 00873 if( aXlutWordSize >= 16 ){ 00874 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 00875 jj = accu[ii]; 00876 jj = jj + ( jj >> aXlutWordSize ); 00877 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00878 00879 ko = ko0 & (aAlutInShiftNum - 1 ); 00880 ko0 = ko0 >> aAlutInShift; 00881 ko0 += aAlutOffset; 00882 if( aAlutWordSize <= 8) 00883 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00884 else 00885 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00886 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00887 aAlutOffset += adr_bereich_alut; 00888 } 00889 } 00890 else{ 00891 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 00892 jj = accu[ii]; 00893 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 00894 ko0 = (jj - ( jj >> ( adr_breite_alut ))); /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 00895 00896 ko = ko0 & (aAlutInShiftNum - 1 ); 00897 ko0 = ko0 >> aAlutInShift; 00898 ko0 += aAlutOffset; 00899 if( aAlutWordSize <= 8) 00900 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00901 else 00902 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00903 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00904 aAlutOffset += adr_bereich_alut; 00905 } 00906 } 00907 } 00908 00909 while (--i){ 00910 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 00911 inputData[jj] += (NDIM_IN_DIM * 2); 00912 } 00913 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00914 outputData[jj] += OutputIncrement; 00915 } 00916 00917 { 00918 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 00919 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 00920 } 00921 } 00922 if( jj<NDIM_IN_DIM ) break; 00923 if( aOutputPackMode8Bit ){ 00924 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00925 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 00926 } 00927 } 00928 else{ 00929 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00930 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 00931 } 00932 } 00933 } 00934 } 00935 00936 if( --LineCount ){ 00937 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 00938 inputData[jj] += inputDataRowOffset; 00939 } 00940 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 00941 outputData[jj] += outputDataRowOffset; 00942 } 00943 } 00944 } 00945 } 00946 00947 /* UNLOCK_DATA( aElutHdle ); */ 00948 /* UNLOCK_DATA( aAlutHdle ); */ 00949 /* UNLOCK_DATA( aXlutHdle ); */ 00950 00951 LH_END_PROC("Calc323Dim_Data8To8_Lut16") 00952 return noErr; 00953 }

CMError Calc324Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 964 of file w98/lh_core/calcnd3.c.

00967 { 00968 LH_UINT8 * inputData[8], *outputData[8]; 00969 UINT32 OutputIncrement, inputDataRowOffset, outputDataRowOffset, Pixelcount, LineCount; 00970 register unsigned long adr0; 00971 register unsigned long ko0; 00972 unsigned long accu[8]; 00973 register long i; 00974 /*long Offsets[8];*/ 00975 00976 register long aAlutShift,aElutOffset,aAlutOffset; 00977 register long aElutWordSize; 00978 register long aAlutWordSize; 00979 register long aXlutAdrSize; 00980 register long aXlutAdrShift; 00981 register unsigned long aXlutWordSize; 00982 register unsigned long ii,jj; 00983 register long aOutputPackMode8Bit; 00984 long ein_Cache[8]; 00985 00986 LH_UINT16 * aus_lut = (LH_UINT16*)lutParam->outputLut; 00987 LH_UINT16 * ein_lut = (LH_UINT16*)lutParam->inputLut; 00988 LH_UINT16 * Xlut = (LH_UINT16*)lutParam->colorLut; 00989 00990 #ifdef DEBUG_OUTPUT 00991 long err = noErr; 00992 #endif 00993 LH_START_PROC("Calc324Dim_Data8To8_Lut16") 00994 00995 inputData[0] = (LH_UINT8 *)calcParam->inputData[0]; 00996 inputData[1] = (LH_UINT8 *)calcParam->inputData[1]; 00997 inputData[2] = (LH_UINT8 *)calcParam->inputData[2]; 00998 #if NDIM_IN_DIM == 4 00999 inputData[3] = (LH_UINT8 *)calcParam->inputData[3]; 01000 #endif 01001 outputData[0] = (LH_UINT8 *)calcParam->outputData[0]; 01002 outputData[1] = (LH_UINT8 *)calcParam->outputData[1]; 01003 outputData[2] = (LH_UINT8 *)calcParam->outputData[2]; 01004 #if NDIM_OUT_DIM == 4 01005 outputData[3] = (LH_UINT8 *)calcParam->outputData[3]; 01006 #endif 01007 01008 OutputIncrement = calcParam->cmOutputPixelOffset; 01009 inputDataRowOffset = calcParam->cmInputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmInputPixelOffset + (NDIM_IN_DIM * 2); 01010 outputDataRowOffset = calcParam->cmOutputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmOutputPixelOffset + OutputIncrement; 01011 01012 Pixelcount = calcParam->cmPixelPerLine; 01013 LineCount = calcParam->cmLineCount; 01014 01015 aElutWordSize = lutParam->inputLutWordSize; 01016 aAlutWordSize = lutParam->outputLutWordSize; 01017 aXlutAdrSize = lutParam->colorLutGridPoints; 01018 for ( i = 1; (i < 32) && (aXlutAdrSize >> i); i++) 01019 aXlutAdrShift = i; 01020 aXlutWordSize = lutParam->colorLutWordSize; 01021 01022 aOutputPackMode8Bit = calcParam->cmOutputColorSpace & cm8PerChannelPacking || calcParam->cmOutputColorSpace & cmLong8ColorPacking; 01023 /*DebugPrint("DoNDim with %d input elements\n",aByteCount);*/ 01024 #if FARBR_FILES 01025 WriteLuts( "DoNDim",1,adr_bereich_elut,aElutWordSize,ein_lut, 01026 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutWordSize,(LH_UINT16 *)Xlut,adr_bereich_alut,aAlutWordSize,(LH_UINT16 *)aus_lut); 01027 #endif 01028 01029 i=0; 01030 01031 { 01032 if( aElutShift < 0 ) 01033 { 01034 #ifdef DEBUG_OUTPUT 01035 DebugPrint("� DoNDim-Error: aElutShift < 0 (aElutShift = %d)\n",aElutShift); 01036 #endif 01037 return cmparamErr; 01038 } 01039 } 01040 01041 if( aOutputPackMode8Bit ){ 01042 aAlutShift = (aAlutWordSize-8); 01043 } 01044 else{ 01045 aAlutShift = (16 - aAlutWordSize); 01046 } 01047 01048 #ifdef DEBUG_OUTPUT 01049 if ( DebugCheck(kThisFile, kDebugReserved1) ){ 01050 DebugPrint("aElutAdrSize=%lx,aElutAdrShift=%lx,aElutWordSize=%lx,ein_lut=%lx,\n", 01051 adr_bereich_elut,adr_breite_elut,aElutWordSize,ein_lut); 01052 DebugPrint("aAlutAdrSize=%lx,aAlutAdrShift=%lx,aAlutWordSize=%lx,aus_lut=%lx,\n", 01053 adr_bereich_alut,adr_breite_alut,aAlutWordSize,aus_lut); 01054 DebugPrint("aXlutInDim=%lx,aXlutOutDim=%lx,aXlutAdrSize=%lx,aXlutAdrShift=%lx,aXlutWordSize=%lx,Xlut=%lx,\n", 01055 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutAdrShift,aXlutWordSize,Xlut); 01056 } 01057 #endif 01058 01059 /*if( 1 )*/ 01060 if( aXlutAdrSize != (1<<aXlutAdrShift )){ 01061 register long aXlutOffset; 01062 long theXlutOffsets[8]; 01063 register unsigned long aAlutInShift; 01064 register long aAlutInShiftRemainder; 01065 register unsigned long aAlutInShiftNum; 01066 register long aElutWordSizeMask = (1<<aElutWordSize) - 1; 01067 register unsigned long aAlutRound; 01068 aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut; 01069 aAlutInShiftRemainder = 0; 01070 if( aAlutInShift > 16 ){ 01071 aAlutInShiftRemainder = aAlutInShift - 16; 01072 aAlutInShift = 16; 01073 } 01074 aAlutInShiftNum = (1<<aAlutInShift); 01075 01076 #ifdef DEBUG_OUTPUT 01077 if ( DebugCheck(kThisFile, kDebugMiscInfo) ) 01078 DebugPrint(" DoNDim gripoints = %ld\n",aXlutAdrSize); 01079 #endif 01080 if( aElutWordSize <= 0 ){ 01081 #ifdef DEBUG_OUTPUT 01082 DebugPrint("� DoNDim-Error: (1<<aElutWordSize)/aXlutAdrSize <= 0 %d\n",(1<<aElutWordSize)/aXlutAdrSize); 01083 #endif 01084 return cmparamErr; 01085 } 01086 if( aAlutInShift <= 0 ){ 01087 #ifdef DEBUG_OUTPUT 01088 DebugPrint("� DoNDim-Error: aAlutInShift <= 0 %d\n",aAlutInShift); 01089 #endif 01090 return cmparamErr; 01091 } 01092 aXlutOffset =NDIM_OUT_DIM; 01093 for( i=0; i<(long)NDIM_IN_DIM; i++){ 01094 theXlutOffsets[ NDIM_IN_DIM-1-i] = aXlutOffset; 01095 aXlutOffset *=aXlutAdrSize; 01096 } 01097 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 01098 01099 #ifdef DEBUG_OUTPUT 01100 if ( DebugCheck(kThisFile, kDebugReserved1) ) 01101 DebugPrint(" aElutWordSize((1<<aElutWordSize)-0) = %ld\n aAlutInShift:((1<<aXlutWordSize)*aElutWordSize+(adr_bereich_alut/2))/adr_bereich_alut = %ld\n",aElutWordSize,aAlutInShift); 01102 #endif 01103 01104 while (LineCount){ 01105 i = Pixelcount; 01106 01107 while (i){ 01108 01109 long adr[8],Index[8]; 01110 LH_UINT16 ein_reg[8]; 01111 register unsigned long adrAdr,ko,adrOffset; 01112 01113 adr0=0; 01114 aElutOffset = 0; 01115 jj=0; 01116 01117 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 01118 ko0 = jj - ( jj >> ( adr_breite_elut )); 01119 ko = ko0 & ( aElutShiftNum - 1 ); 01120 ko0 = ko0 >> aElutShift; 01121 ko0 += aElutOffset; 01122 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01123 01124 jj *= aXlutAdrSize; 01125 aElutOffset += adr_bereich_elut; 01126 adr[0] = jj & aElutWordSizeMask; 01127 jj = jj >> aElutWordSize; 01128 adr0 += (jj)*theXlutOffsets[0]; 01129 ein_reg[0] = (LH_UINT16)jj; 01130 01131 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 01132 ko0 = jj - ( jj >> ( adr_breite_elut )); 01133 ko = ko0 & ( aElutShiftNum - 1 ); 01134 ko0 = ko0 >> aElutShift; 01135 ko0 += aElutOffset; 01136 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01137 01138 jj *= aXlutAdrSize; 01139 aElutOffset += adr_bereich_elut; 01140 adr[1] = jj & aElutWordSizeMask; 01141 jj = jj >> aElutWordSize; 01142 adr0 += (jj)*theXlutOffsets[1]; 01143 ein_reg[1] = (LH_UINT16)jj; 01144 01145 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 01146 ko0 = jj - ( jj >> ( adr_breite_elut )); 01147 ko = ko0 & ( aElutShiftNum - 1 ); 01148 ko0 = ko0 >> aElutShift; 01149 ko0 += aElutOffset; 01150 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01151 01152 jj *= aXlutAdrSize; 01153 aElutOffset += adr_bereich_elut; 01154 adr[2] = jj & aElutWordSizeMask; 01155 jj = jj >> aElutWordSize; 01156 adr0 += (jj)*theXlutOffsets[2]; 01157 ein_reg[2] = (LH_UINT16)jj; 01158 01159 #if NDIM_IN_DIM == 4 01160 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 01161 ko0 = jj - ( jj >> ( adr_breite_elut )); 01162 ko = ko0 & ( aElutShiftNum - 1 ); 01163 ko0 = ko0 >> aElutShift; 01164 ko0 += aElutOffset; 01165 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01166 01167 jj *= aXlutAdrSize; 01168 aElutOffset += adr_bereich_elut; 01169 adr[3] = jj & aElutWordSizeMask; 01170 jj = jj >> aElutWordSize; 01171 adr0 += (jj)*theXlutOffsets[3]; 01172 ein_reg[3] = (LH_UINT16)jj; 01173 #endif 01174 01175 01176 01177 { /* a kind of */ 01178 register long Hold; 01179 01180 01181 Index[0] = 0; 01182 Index[1] = 1; 01183 Index[2] = 2; 01184 #if NDIM_IN_DIM == 4 01185 Index[3] = 3; 01186 #endif 01187 if( adr[0] < adr[1] ){ 01188 Hold = Index[0]; 01189 Index[0] = Index[1]; 01190 Index[1] = Hold; 01191 } 01192 01193 if( adr[Index[1]] < adr[2] ){ 01194 Hold = Index[1]; 01195 Index[1] = Index[2]; 01196 Index[2] = Hold; 01197 if( adr[Index[0]] < adr[Index[1]] ){ 01198 Hold = Index[0]; 01199 Index[0] = Index[1]; 01200 Index[1] = Hold; 01201 } 01202 } 01203 01204 #if NDIM_IN_DIM == 4 01205 if( adr[Index[2]] < adr[3] ){ 01206 Hold = Index[2]; 01207 Index[2] = Index[3]; 01208 Index[3] = Hold; 01209 if( adr[Index[1]] < adr[Index[2]] ){ 01210 Hold = Index[1]; 01211 Index[1] = Index[2]; 01212 Index[2] = Hold; 01213 if( adr[Index[0]] < adr[Index[1]] ){ 01214 Hold = Index[0]; 01215 Index[0] = Index[1]; 01216 Index[1] = Hold; 01217 } 01218 } 01219 } 01220 #endif 01221 } 01222 01223 accu[0]=0; 01224 accu[1]=0; 01225 accu[2]=0; 01226 #if NDIM_OUT_DIM == 4 01227 accu[3]=0; 01228 #endif 01229 ko0 = (1<<aElutWordSize); 01230 adrAdr=adr0; 01231 adrOffset=0; 01232 if( aXlutWordSize == 16 ){ 01233 jj = Index[0]; 01234 ko = ko0 - adr[jj]; 01235 ko0 = adr[jj]; 01236 01237 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01238 adrOffset += theXlutOffsets[jj]; 01239 01240 accu[0]+=Xlut[adrAdr+(0)]*ko; 01241 accu[1]+=Xlut[adrAdr+(1)]*ko; 01242 accu[2]+=Xlut[adrAdr+(2)]*ko; 01243 #if NDIM_OUT_DIM == 4 01244 accu[3]+=Xlut[adrAdr+(3)]*ko; 01245 #endif 01246 01247 adrAdr = (adr0 + adrOffset); 01248 01249 jj = Index[1]; 01250 ko = ko0 - adr[jj]; 01251 ko0 = adr[jj]; 01252 01253 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01254 adrOffset += theXlutOffsets[jj]; 01255 01256 accu[0]+=Xlut[adrAdr+(0)]*ko; 01257 accu[1]+=Xlut[adrAdr+(1)]*ko; 01258 accu[2]+=Xlut[adrAdr+(2)]*ko; 01259 #if NDIM_OUT_DIM == 4 01260 accu[3]+=Xlut[adrAdr+(3)]*ko; 01261 #endif 01262 01263 adrAdr = (adr0 + adrOffset); 01264 01265 jj = Index[2]; 01266 ko = ko0 - adr[jj]; 01267 ko0 = adr[jj]; 01268 01269 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01270 adrOffset += theXlutOffsets[jj]; 01271 01272 accu[0]+=Xlut[adrAdr+(0)]*ko; 01273 accu[1]+=Xlut[adrAdr+(1)]*ko; 01274 accu[2]+=Xlut[adrAdr+(2)]*ko; 01275 #if NDIM_OUT_DIM == 4 01276 accu[3]+=Xlut[adrAdr+(3)]*ko; 01277 #endif 01278 01279 adrAdr = (adr0 + adrOffset); 01280 01281 #if NDIM_IN_DIM == 4 01282 jj = Index[3]; 01283 ko = ko0 - adr[jj]; 01284 ko0 = adr[jj]; 01285 01286 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01287 adrOffset += theXlutOffsets[jj]; 01288 01289 accu[0]+=Xlut[adrAdr+(0)]*ko; 01290 accu[1]+=Xlut[adrAdr+(1)]*ko; 01291 accu[2]+=Xlut[adrAdr+(2)]*ko; 01292 #if NDIM_OUT_DIM == 4 01293 accu[3]+=Xlut[adrAdr+(3)]*ko; 01294 #endif 01295 01296 adrAdr = (adr0 + adrOffset); 01297 #endif 01298 01299 accu[0]+=Xlut[adrAdr+0]*ko0; 01300 accu[1]+=Xlut[adrAdr+1]*ko0; 01301 accu[2]+=Xlut[adrAdr+2]*ko0; 01302 #if NDIM_OUT_DIM == 4 01303 accu[3]+=Xlut[adrAdr+3]*ko0; 01304 #endif 01305 } 01306 else{ 01307 01308 jj = Index[0]; 01309 ko = ko0 - adr[jj]; 01310 ko0 = adr[jj]; 01311 01312 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01313 adrOffset += theXlutOffsets[jj]; 01314 01315 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01316 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01317 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01318 #if NDIM_OUT_DIM == 4 01319 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01320 #endif 01321 adrAdr = (adr0 + adrOffset); 01322 01323 jj = Index[1]; 01324 ko = ko0 - adr[jj]; 01325 ko0 = adr[jj]; 01326 01327 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01328 adrOffset += theXlutOffsets[jj]; 01329 01330 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01331 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01332 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01333 #if NDIM_OUT_DIM == 4 01334 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01335 #endif 01336 adrAdr = (adr0 + adrOffset); 01337 01338 jj = Index[2]; 01339 ko = ko0 - adr[jj]; 01340 ko0 = adr[jj]; 01341 01342 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01343 adrOffset += theXlutOffsets[jj]; 01344 01345 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01346 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01347 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01348 #if NDIM_OUT_DIM == 4 01349 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01350 #endif 01351 adrAdr = (adr0 + adrOffset); 01352 01353 #if NDIM_IN_DIM == 4 01354 jj = Index[3]; 01355 ko = ko0 - adr[jj]; 01356 ko0 = adr[jj]; 01357 01358 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 01359 adrOffset += theXlutOffsets[jj]; 01360 01361 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01362 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01363 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01364 #if NDIM_OUT_DIM == 4 01365 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01366 #endif 01367 adrAdr = (adr0 + adrOffset); 01368 #endif 01369 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 01370 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 01371 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 01372 #if NDIM_OUT_DIM == 4 01373 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 01374 #endif 01375 } 01376 01377 aAlutOffset = 0; 01378 01379 if( aOutputPackMode8Bit ){ 01380 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 01381 jj = accu[ii]; 01382 jj = jj + ( jj >> aXlutWordSize ); 01383 01384 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01385 01386 ko = ko0 & (aAlutInShiftNum - 1 ); 01387 ko0 = ko0 >> aAlutInShift; 01388 ko0 += aAlutOffset; 01389 if( aAlutWordSize <= 8) 01390 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 01391 else{ 01392 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 01393 jj = jj - ( jj >> aAlutShift ); 01394 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 01395 } 01396 *outputData[ii] = (LH_UINT8)jj; 01397 aAlutOffset += adr_bereich_alut; 01398 } 01399 } 01400 else{ 01401 if( aXlutWordSize >= 16 ){ 01402 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 01403 jj = accu[ii]; 01404 jj = jj + ( jj >> aXlutWordSize ); 01405 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01406 01407 ko = ko0 & (aAlutInShiftNum - 1 ); 01408 ko0 = ko0 >> aAlutInShift; 01409 ko0 += aAlutOffset; 01410 if( aAlutWordSize <= 8) 01411 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 01412 else 01413 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 01414 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 01415 aAlutOffset += adr_bereich_alut; 01416 } 01417 } 01418 else{ 01419 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 01420 jj = accu[ii]; 01421 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 01422 ko0 = (jj - ( jj >> ( adr_breite_alut ))) ; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01423 01424 ko = ko0 & (aAlutInShiftNum - 1 ); 01425 ko0 = ko0 >> aAlutInShift; 01426 ko0 += aAlutOffset; 01427 if( aAlutWordSize <= 8) 01428 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 01429 else 01430 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 01431 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 01432 aAlutOffset += adr_bereich_alut; 01433 } 01434 } 01435 } 01436 while (--i){ 01437 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 01438 inputData[jj] += (NDIM_IN_DIM * 2); 01439 } 01440 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01441 outputData[jj] += OutputIncrement; 01442 } 01443 01444 { 01445 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 01446 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 01447 } 01448 } 01449 if( jj<NDIM_IN_DIM ) break; 01450 if( aOutputPackMode8Bit ){ 01451 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01452 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 01453 } 01454 } 01455 else{ 01456 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01457 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 01458 } 01459 } 01460 } 01461 } 01462 01463 if( --LineCount ){ 01464 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 01465 inputData[jj] += inputDataRowOffset; 01466 } 01467 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01468 outputData[jj] += outputDataRowOffset; 01469 } 01470 } 01471 } 01472 } 01473 else{ 01474 01475 register unsigned long bit_breit_selektor; 01476 register unsigned long bit_maske_selektor; 01477 register unsigned long bit_breit_adr; 01478 register unsigned long bit_maske_adr; 01479 register unsigned long aAlutInShiftNum; 01480 register long aAlutInShift; 01481 register long aAlutInShiftRemainder; 01482 register unsigned long aAlutRound; 01483 /*register long aXlutPlaneShift = aXlutAdrShift*aXlutInDim;*/ 01484 bit_breit_selektor=aElutWordSize-aXlutAdrShift; 01485 if( aElutWordSize-aXlutAdrShift < 0 ) 01486 { 01487 #ifdef DEBUG_OUTPUT 01488 DebugPrint("� DoNDim-Error: bit_breit_selektor < 0 (bit_breit_selektor = %d)\n",bit_breit_selektor); 01489 #endif 01490 return cmparamErr; 01491 } 01492 bit_maske_selektor=(1<<bit_breit_selektor)-1; 01493 bit_breit_adr=aXlutAdrShift; 01494 bit_maske_adr=((1<<bit_breit_adr)-1)<<bit_breit_selektor; 01495 aAlutInShift = (aXlutWordSize+bit_breit_selektor-adr_breite_alut); 01496 /*aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01497 aAlutInShiftRemainder = 0; 01498 if( aAlutInShift > 16 ){ 01499 aAlutInShiftRemainder = aAlutInShift - 16; 01500 aAlutInShift = 16; 01501 } 01502 01503 aAlutInShiftNum = (1<<aAlutInShift); 01504 01505 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 01506 while (LineCount){ 01507 i = Pixelcount; 01508 01509 while (i){ 01510 01511 long adr[8],Index[8]; 01512 /*LH_UINT16 *ein_lut = (LH_UINT16 *)ein_lut;*/ 01513 LH_UINT16 ein_reg[8]; 01514 register unsigned long adrAdr,ko,adrOffset; 01515 /*register unsigned long aIndex;*/ 01516 01517 adr0=0; 01518 aElutOffset = 0; 01519 jj=0; 01520 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 01521 ko0 = jj - ( jj >> ( adr_breite_elut )); 01522 ko = ko0 & ( aElutShiftNum - 1 ); 01523 ko0 = ko0 >> aElutShift; 01524 ko0 += aElutOffset; 01525 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01526 01527 aElutOffset += adr_bereich_elut; 01528 adr[0] = (jj & bit_maske_selektor); 01529 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-0-1)*bit_breit_adr); 01530 ein_reg[0] = (LH_UINT16)jj; 01531 01532 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 01533 ko0 = jj - ( jj >> ( adr_breite_elut )); 01534 ko = ko0 & ( aElutShiftNum - 1 ); 01535 ko0 = ko0 >> aElutShift; 01536 ko0 += aElutOffset; 01537 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01538 01539 aElutOffset += adr_bereich_elut; 01540 adr[1] = (jj & bit_maske_selektor); 01541 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-1-1)*bit_breit_adr); 01542 ein_reg[1] = (LH_UINT16)jj; 01543 01544 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 01545 ko0 = jj - ( jj >> ( adr_breite_elut )); 01546 ko = ko0 & ( aElutShiftNum - 1 ); 01547 ko0 = ko0 >> aElutShift; 01548 ko0 += aElutOffset; 01549 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01550 01551 aElutOffset += adr_bereich_elut; 01552 adr[2] = (jj & bit_maske_selektor); 01553 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-2-1)*bit_breit_adr); 01554 ein_reg[2] = (LH_UINT16)jj; 01555 01556 #if NDIM_IN_DIM == 4 01557 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 01558 ko0 = jj - ( jj >> ( adr_breite_elut )); 01559 ko = ko0 & ( aElutShiftNum - 1 ); 01560 ko0 = ko0 >> aElutShift; 01561 ko0 += aElutOffset; 01562 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 01563 01564 aElutOffset += adr_bereich_elut; 01565 adr[3] = (jj & bit_maske_selektor); 01566 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-3-1)*bit_breit_adr); 01567 ein_reg[3] = (LH_UINT16)jj; 01568 #endif 01569 adr0 *= NDIM_OUT_DIM; 01570 01571 { /* a kind of */ 01572 register long Hold; 01573 01574 01575 Index[0] = 0; 01576 Index[1] = 1; 01577 Index[2] = 2; 01578 #if NDIM_IN_DIM == 4 01579 Index[3] = 3; 01580 #endif 01581 if( adr[0] < adr[1] ){ 01582 Hold = Index[0]; 01583 Index[0] = Index[1]; 01584 Index[1] = Hold; 01585 } 01586 01587 if( adr[Index[1]] < adr[2] ){ 01588 Hold = Index[1]; 01589 Index[1] = Index[2]; 01590 Index[2] = Hold; 01591 if( adr[Index[0]] < adr[Index[1]] ){ 01592 Hold = Index[0]; 01593 Index[0] = Index[1]; 01594 Index[1] = Hold; 01595 } 01596 } 01597 01598 #if NDIM_IN_DIM == 4 01599 if( adr[Index[2]] < adr[3] ){ 01600 Hold = Index[2]; 01601 Index[2] = Index[3]; 01602 Index[3] = Hold; 01603 if( adr[Index[1]] < adr[Index[2]] ){ 01604 Hold = Index[1]; 01605 Index[1] = Index[2]; 01606 Index[2] = Hold; 01607 if( adr[Index[0]] < adr[Index[1]] ){ 01608 Hold = Index[0]; 01609 Index[0] = Index[1]; 01610 Index[1] = Hold; 01611 } 01612 } 01613 } 01614 #endif 01615 } 01616 01617 accu[0]=0; 01618 accu[1]=0; 01619 accu[2]=0; 01620 #if NDIM_OUT_DIM == 4 01621 accu[3]=0; 01622 #endif 01623 01624 ko0 = bit_maske_selektor+1; 01625 adrAdr=adr0; 01626 adrOffset=0; 01627 01628 if( aXlutWordSize == 16 ){ 01629 jj = Index[0]; 01630 ko = ko0 - adr[jj]; 01631 ko0 = adr[jj]; 01632 01633 if( ein_reg[jj] < bit_maske_adr ) 01634 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01635 01636 accu[0]+=Xlut[adrAdr+(0)]*ko; 01637 accu[1]+=Xlut[adrAdr+(1)]*ko; 01638 accu[2]+=Xlut[adrAdr+(2)]*ko; 01639 #if NDIM_OUT_DIM == 4 01640 accu[3]+=Xlut[adrAdr+(3)]*ko; 01641 #endif 01642 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01643 01644 jj = Index[1]; 01645 ko = ko0 - adr[jj]; 01646 ko0 = adr[jj]; 01647 01648 if( ein_reg[jj] < bit_maske_adr ) 01649 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01650 01651 accu[0]+=Xlut[adrAdr+(0)]*ko; 01652 accu[1]+=Xlut[adrAdr+(1)]*ko; 01653 accu[2]+=Xlut[adrAdr+(2)]*ko; 01654 #if NDIM_OUT_DIM == 4 01655 accu[3]+=Xlut[adrAdr+(3)]*ko; 01656 #endif 01657 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01658 01659 jj = Index[2]; 01660 ko = ko0 - adr[jj]; 01661 ko0 = adr[jj]; 01662 01663 if( ein_reg[jj] < bit_maske_adr ) 01664 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01665 01666 accu[0]+=Xlut[adrAdr+(0)]*ko; 01667 accu[1]+=Xlut[adrAdr+(1)]*ko; 01668 accu[2]+=Xlut[adrAdr+(2)]*ko; 01669 #if NDIM_OUT_DIM == 4 01670 accu[3]+=Xlut[adrAdr+(3)]*ko; 01671 #endif 01672 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01673 01674 #if NDIM_IN_DIM == 4 01675 jj = Index[3]; 01676 ko = ko0 - adr[jj]; 01677 ko0 = adr[jj]; 01678 01679 if( ein_reg[jj] < bit_maske_adr ) 01680 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01681 01682 accu[0]+=Xlut[adrAdr+(0)]*ko; 01683 accu[1]+=Xlut[adrAdr+(1)]*ko; 01684 accu[2]+=Xlut[adrAdr+(2)]*ko; 01685 #if NDIM_OUT_DIM == 4 01686 accu[3]+=Xlut[adrAdr+(3)]*ko; 01687 #endif 01688 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01689 #endif 01690 accu[0]+=Xlut[adrAdr+0]*ko0; 01691 accu[1]+=Xlut[adrAdr+1]*ko0; 01692 accu[2]+=Xlut[adrAdr+2]*ko0; 01693 #if NDIM_OUT_DIM == 4 01694 accu[3]+=Xlut[adrAdr+3]*ko0; 01695 #endif 01696 } 01697 else{ 01698 jj = Index[0]; 01699 ko = ko0 - adr[jj]; 01700 ko0 = adr[jj]; 01701 01702 if( ein_reg[jj] < bit_maske_adr ) 01703 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01704 01705 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01706 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01707 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01708 #if NDIM_OUT_DIM == 4 01709 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01710 #endif 01711 01712 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01713 01714 jj = Index[1]; 01715 ko = ko0 - adr[jj]; 01716 ko0 = adr[jj]; 01717 01718 if( ein_reg[jj] < bit_maske_adr ) 01719 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01720 01721 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01722 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01723 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01724 #if NDIM_OUT_DIM == 4 01725 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01726 #endif 01727 01728 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01729 01730 jj = Index[2]; 01731 ko = ko0 - adr[jj]; 01732 ko0 = adr[jj]; 01733 01734 if( ein_reg[jj] < bit_maske_adr ) 01735 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01736 01737 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01738 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01739 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01740 #if NDIM_OUT_DIM == 4 01741 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01742 #endif 01743 01744 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01745 01746 #if NDIM_IN_DIM == 4 01747 jj = Index[3]; 01748 ko = ko0 - adr[jj]; 01749 ko0 = adr[jj]; 01750 01751 if( ein_reg[jj] < bit_maske_adr ) 01752 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 01753 01754 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 01755 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 01756 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 01757 #if NDIM_OUT_DIM == 4 01758 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 01759 #endif 01760 01761 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 01762 #endif 01763 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 01764 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 01765 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 01766 #if NDIM_OUT_DIM == 4 01767 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 01768 #endif 01769 } 01770 01771 aAlutOffset = 0; 01772 01773 if( aOutputPackMode8Bit ){ 01774 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 01775 jj = accu[ii]; 01776 jj = jj + ( jj >> aXlutWordSize ); 01777 01778 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01779 01780 ko = ko0 & (aAlutInShiftNum - 1 ); 01781 ko0 = ko0 >> aAlutInShift; 01782 ko0 += aAlutOffset; 01783 if( aAlutWordSize <= 8) 01784 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 01785 else{ 01786 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 01787 jj = jj - ( jj >> aAlutShift ); 01788 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 01789 } 01790 01791 *outputData[ii] = (LH_UINT8)jj; 01792 aAlutOffset += adr_bereich_alut; 01793 } 01794 } 01795 else{ 01796 if( aXlutWordSize >= 16 ){ 01797 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 01798 jj = accu[ii]; 01799 jj = jj + ( jj >> aXlutWordSize ); 01800 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01801 01802 ko = ko0 & (aAlutInShiftNum - 1 ); 01803 ko0 = ko0 >> aAlutInShift; 01804 ko0 += aAlutOffset; 01805 if( aAlutWordSize <= 8) 01806 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 01807 else 01808 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 01809 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 01810 aAlutOffset += adr_bereich_alut; 01811 } 01812 } 01813 else{ 01814 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 01815 jj = accu[ii]; 01816 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 01817 ko0 = (jj - ( jj >> ( adr_breite_alut ))); /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 01818 01819 ko = ko0 & (aAlutInShiftNum - 1 ); 01820 ko0 = ko0 >> aAlutInShift; 01821 ko0 += aAlutOffset; 01822 if( aAlutWordSize <= 8) 01823 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 01824 else 01825 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 01826 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 01827 aAlutOffset += adr_bereich_alut; 01828 } 01829 } 01830 } 01831 01832 while (--i){ 01833 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 01834 inputData[jj] += (NDIM_IN_DIM * 2); 01835 } 01836 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01837 outputData[jj] += OutputIncrement; 01838 } 01839 01840 { 01841 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 01842 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 01843 } 01844 } 01845 if( jj<NDIM_IN_DIM ) break; 01846 if( aOutputPackMode8Bit ){ 01847 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01848 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 01849 } 01850 } 01851 else{ 01852 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01853 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 01854 } 01855 } 01856 } 01857 } 01858 01859 if( --LineCount ){ 01860 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 01861 inputData[jj] += inputDataRowOffset; 01862 } 01863 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 01864 outputData[jj] += outputDataRowOffset; 01865 } 01866 } 01867 } 01868 } 01869 01870 /* UNLOCK_DATA( aElutHdle ); */ 01871 /* UNLOCK_DATA( aAlutHdle ); */ 01872 /* UNLOCK_DATA( aXlutHdle ); */ 01873 01874 LH_END_PROC("Calc324Dim_Data8To8_Lut16") 01875 return noErr; 01876 }

CMError Calc423Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 1887 of file w98/lh_core/calcnd3.c.

01890 { 01891 LH_UINT8 * inputData[8], *outputData[8]; 01892 UINT32 OutputIncrement, inputDataRowOffset, outputDataRowOffset, Pixelcount, LineCount; 01893 register unsigned long adr0; 01894 register unsigned long ko0; 01895 unsigned long accu[8]; 01896 register long i; 01897 /*long Offsets[8];*/ 01898 01899 register long aAlutShift,aElutOffset,aAlutOffset; 01900 register long aElutWordSize; 01901 register long aAlutWordSize; 01902 register long aXlutAdrSize; 01903 register long aXlutAdrShift; 01904 register unsigned long aXlutWordSize; 01905 register unsigned long ii,jj; 01906 register long aOutputPackMode8Bit; 01907 long ein_Cache[8]; 01908 01909 LH_UINT16 * aus_lut = (LH_UINT16*)lutParam->outputLut; 01910 LH_UINT16 * ein_lut = (LH_UINT16*)lutParam->inputLut; 01911 LH_UINT16 * Xlut = (LH_UINT16*)lutParam->colorLut; 01912 01913 #ifdef DEBUG_OUTPUT 01914 long err = noErr; 01915 #endif 01916 LH_START_PROC("Calc423Dim_Data8To8_Lut16") 01917 01918 inputData[0] = (LH_UINT8 *)calcParam->inputData[0]; 01919 inputData[1] = (LH_UINT8 *)calcParam->inputData[1]; 01920 inputData[2] = (LH_UINT8 *)calcParam->inputData[2]; 01921 #if NDIM_IN_DIM == 4 01922 inputData[3] = (LH_UINT8 *)calcParam->inputData[3]; 01923 #endif 01924 outputData[0] = (LH_UINT8 *)calcParam->outputData[0]; 01925 outputData[1] = (LH_UINT8 *)calcParam->outputData[1]; 01926 outputData[2] = (LH_UINT8 *)calcParam->outputData[2]; 01927 #if NDIM_OUT_DIM == 4 01928 outputData[3] = (LH_UINT8 *)calcParam->outputData[3]; 01929 #endif 01930 01931 OutputIncrement = calcParam->cmOutputPixelOffset; 01932 inputDataRowOffset = calcParam->cmInputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmInputPixelOffset + (NDIM_IN_DIM * 2); 01933 outputDataRowOffset = calcParam->cmOutputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmOutputPixelOffset + OutputIncrement; 01934 01935 Pixelcount = calcParam->cmPixelPerLine; 01936 LineCount = calcParam->cmLineCount; 01937 01938 aElutWordSize = lutParam->inputLutWordSize; 01939 aAlutWordSize = lutParam->outputLutWordSize; 01940 aXlutAdrSize = lutParam->colorLutGridPoints; 01941 for ( i = 1; (i < 32) && (aXlutAdrSize >> i); i++) 01942 aXlutAdrShift = i; 01943 aXlutWordSize = lutParam->colorLutWordSize; 01944 01945 aOutputPackMode8Bit = calcParam->cmOutputColorSpace & cm8PerChannelPacking || calcParam->cmOutputColorSpace & cmLong8ColorPacking; 01946 /*DebugPrint("DoNDim with %d input elements\n",aByteCount);*/ 01947 #if FARBR_FILES 01948 WriteLuts( "DoNDim",1,adr_bereich_elut,aElutWordSize,ein_lut, 01949 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutWordSize,(LH_UINT16 *)Xlut,adr_bereich_alut,aAlutWordSize,(LH_UINT16 *)aus_lut); 01950 #endif 01951 01952 i=0; 01953 01954 { 01955 if( aElutShift < 0 ) 01956 { 01957 #ifdef DEBUG_OUTPUT 01958 DebugPrint("� DoNDim-Error: aElutShift < 0 (aElutShift = %d)\n",aElutShift); 01959 #endif 01960 return cmparamErr; 01961 } 01962 } 01963 01964 if( aOutputPackMode8Bit ){ 01965 aAlutShift = (aAlutWordSize-8); 01966 } 01967 else{ 01968 aAlutShift = (16 - aAlutWordSize); 01969 } 01970 01971 #ifdef DEBUG_OUTPUT 01972 if ( DebugCheck(kThisFile, kDebugReserved1) ){ 01973 DebugPrint("aElutAdrSize=%lx,aElutAdrShift=%lx,aElutWordSize=%lx,ein_lut=%lx,\n", 01974 adr_bereich_elut,adr_breite_elut,aElutWordSize,ein_lut); 01975 DebugPrint("aAlutAdrSize=%lx,aAlutAdrShift=%lx,aAlutWordSize=%lx,aus_lut=%lx,\n", 01976 adr_bereich_alut,adr_breite_alut,aAlutWordSize,aus_lut); 01977 DebugPrint("aXlutInDim=%lx,aXlutOutDim=%lx,aXlutAdrSize=%lx,aXlutAdrShift=%lx,aXlutWordSize=%lx,Xlut=%lx,\n", 01978 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutAdrShift,aXlutWordSize,Xlut); 01979 } 01980 #endif 01981 01982 /*if( 1 )*/ 01983 if( aXlutAdrSize != (1<<aXlutAdrShift )){ 01984 register long aXlutOffset; 01985 long theXlutOffsets[8]; 01986 register unsigned long aAlutInShift; 01987 register long aAlutInShiftRemainder; 01988 register unsigned long aAlutInShiftNum; 01989 register long aElutWordSizeMask = (1<<aElutWordSize) - 1; 01990 register unsigned long aAlutRound; 01991 aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut; 01992 aAlutInShiftRemainder = 0; 01993 if( aAlutInShift > 16 ){ 01994 aAlutInShiftRemainder = aAlutInShift - 16; 01995 aAlutInShift = 16; 01996 } 01997 aAlutInShiftNum = (1<<aAlutInShift); 01998 01999 #ifdef DEBUG_OUTPUT 02000 if ( DebugCheck(kThisFile, kDebugMiscInfo) ) 02001 DebugPrint(" DoNDim gripoints = %ld\n",aXlutAdrSize); 02002 #endif 02003 if( aElutWordSize <= 0 ){ 02004 #ifdef DEBUG_OUTPUT 02005 DebugPrint("� DoNDim-Error: (1<<aElutWordSize)/aXlutAdrSize <= 0 %d\n",(1<<aElutWordSize)/aXlutAdrSize); 02006 #endif 02007 return cmparamErr; 02008 } 02009 if( aAlutInShift <= 0 ){ 02010 #ifdef DEBUG_OUTPUT 02011 DebugPrint("� DoNDim-Error: aAlutInShift <= 0 %d\n",aAlutInShift); 02012 #endif 02013 return cmparamErr; 02014 } 02015 aXlutOffset =NDIM_OUT_DIM; 02016 for( i=0; i<(long)NDIM_IN_DIM; i++){ 02017 theXlutOffsets[ NDIM_IN_DIM-1-i] = aXlutOffset; 02018 aXlutOffset *=aXlutAdrSize; 02019 } 02020 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 02021 02022 #ifdef DEBUG_OUTPUT 02023 if ( DebugCheck(kThisFile, kDebugReserved1) ) 02024 DebugPrint(" aElutWordSize((1<<aElutWordSize)-0) = %ld\n aAlutInShift:((1<<aXlutWordSize)*aElutWordSize+(adr_bereich_alut/2))/adr_bereich_alut = %ld\n",aElutWordSize,aAlutInShift); 02025 #endif 02026 02027 while (LineCount){ 02028 i = Pixelcount; 02029 02030 while (i){ 02031 02032 long adr[8],Index[8]; 02033 LH_UINT16 ein_reg[8]; 02034 register unsigned long adrAdr,ko,adrOffset; 02035 02036 adr0=0; 02037 aElutOffset = 0; 02038 jj=0; 02039 02040 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 02041 ko0 = jj - ( jj >> ( adr_breite_elut )); 02042 ko = ko0 & ( aElutShiftNum - 1 ); 02043 ko0 = ko0 >> aElutShift; 02044 ko0 += aElutOffset; 02045 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02046 02047 jj *= aXlutAdrSize; 02048 aElutOffset += adr_bereich_elut; 02049 adr[0] = jj & aElutWordSizeMask; 02050 jj = jj >> aElutWordSize; 02051 adr0 += (jj)*theXlutOffsets[0]; 02052 ein_reg[0] = (LH_UINT16)jj; 02053 02054 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 02055 ko0 = jj - ( jj >> ( adr_breite_elut )); 02056 ko = ko0 & ( aElutShiftNum - 1 ); 02057 ko0 = ko0 >> aElutShift; 02058 ko0 += aElutOffset; 02059 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02060 02061 jj *= aXlutAdrSize; 02062 aElutOffset += adr_bereich_elut; 02063 adr[1] = jj & aElutWordSizeMask; 02064 jj = jj >> aElutWordSize; 02065 adr0 += (jj)*theXlutOffsets[1]; 02066 ein_reg[1] = (LH_UINT16)jj; 02067 02068 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 02069 ko0 = jj - ( jj >> ( adr_breite_elut )); 02070 ko = ko0 & ( aElutShiftNum - 1 ); 02071 ko0 = ko0 >> aElutShift; 02072 ko0 += aElutOffset; 02073 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02074 02075 jj *= aXlutAdrSize; 02076 aElutOffset += adr_bereich_elut; 02077 adr[2] = jj & aElutWordSizeMask; 02078 jj = jj >> aElutWordSize; 02079 adr0 += (jj)*theXlutOffsets[2]; 02080 ein_reg[2] = (LH_UINT16)jj; 02081 02082 #if NDIM_IN_DIM == 4 02083 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 02084 ko0 = jj - ( jj >> ( adr_breite_elut )); 02085 ko = ko0 & ( aElutShiftNum - 1 ); 02086 ko0 = ko0 >> aElutShift; 02087 ko0 += aElutOffset; 02088 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02089 02090 jj *= aXlutAdrSize; 02091 aElutOffset += adr_bereich_elut; 02092 adr[3] = jj & aElutWordSizeMask; 02093 jj = jj >> aElutWordSize; 02094 adr0 += (jj)*theXlutOffsets[3]; 02095 ein_reg[3] = (LH_UINT16)jj; 02096 #endif 02097 02098 02099 02100 { /* a kind of */ 02101 register long Hold; 02102 02103 02104 Index[0] = 0; 02105 Index[1] = 1; 02106 Index[2] = 2; 02107 #if NDIM_IN_DIM == 4 02108 Index[3] = 3; 02109 #endif 02110 if( adr[0] < adr[1] ){ 02111 Hold = Index[0]; 02112 Index[0] = Index[1]; 02113 Index[1] = Hold; 02114 } 02115 02116 if( adr[Index[1]] < adr[2] ){ 02117 Hold = Index[1]; 02118 Index[1] = Index[2]; 02119 Index[2] = Hold; 02120 if( adr[Index[0]] < adr[Index[1]] ){ 02121 Hold = Index[0]; 02122 Index[0] = Index[1]; 02123 Index[1] = Hold; 02124 } 02125 } 02126 02127 #if NDIM_IN_DIM == 4 02128 if( adr[Index[2]] < adr[3] ){ 02129 Hold = Index[2]; 02130 Index[2] = Index[3]; 02131 Index[3] = Hold; 02132 if( adr[Index[1]] < adr[Index[2]] ){ 02133 Hold = Index[1]; 02134 Index[1] = Index[2]; 02135 Index[2] = Hold; 02136 if( adr[Index[0]] < adr[Index[1]] ){ 02137 Hold = Index[0]; 02138 Index[0] = Index[1]; 02139 Index[1] = Hold; 02140 } 02141 } 02142 } 02143 #endif 02144 } 02145 02146 accu[0]=0; 02147 accu[1]=0; 02148 accu[2]=0; 02149 #if NDIM_OUT_DIM == 4 02150 accu[3]=0; 02151 #endif 02152 ko0 = (1<<aElutWordSize); 02153 adrAdr=adr0; 02154 adrOffset=0; 02155 if( aXlutWordSize == 16 ){ 02156 jj = Index[0]; 02157 ko = ko0 - adr[jj]; 02158 ko0 = adr[jj]; 02159 02160 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02161 adrOffset += theXlutOffsets[jj]; 02162 02163 accu[0]+=Xlut[adrAdr+(0)]*ko; 02164 accu[1]+=Xlut[adrAdr+(1)]*ko; 02165 accu[2]+=Xlut[adrAdr+(2)]*ko; 02166 #if NDIM_OUT_DIM == 4 02167 accu[3]+=Xlut[adrAdr+(3)]*ko; 02168 #endif 02169 02170 adrAdr = (adr0 + adrOffset); 02171 02172 jj = Index[1]; 02173 ko = ko0 - adr[jj]; 02174 ko0 = adr[jj]; 02175 02176 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02177 adrOffset += theXlutOffsets[jj]; 02178 02179 accu[0]+=Xlut[adrAdr+(0)]*ko; 02180 accu[1]+=Xlut[adrAdr+(1)]*ko; 02181 accu[2]+=Xlut[adrAdr+(2)]*ko; 02182 #if NDIM_OUT_DIM == 4 02183 accu[3]+=Xlut[adrAdr+(3)]*ko; 02184 #endif 02185 02186 adrAdr = (adr0 + adrOffset); 02187 02188 jj = Index[2]; 02189 ko = ko0 - adr[jj]; 02190 ko0 = adr[jj]; 02191 02192 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02193 adrOffset += theXlutOffsets[jj]; 02194 02195 accu[0]+=Xlut[adrAdr+(0)]*ko; 02196 accu[1]+=Xlut[adrAdr+(1)]*ko; 02197 accu[2]+=Xlut[adrAdr+(2)]*ko; 02198 #if NDIM_OUT_DIM == 4 02199 accu[3]+=Xlut[adrAdr+(3)]*ko; 02200 #endif 02201 02202 adrAdr = (adr0 + adrOffset); 02203 02204 #if NDIM_IN_DIM == 4 02205 jj = Index[3]; 02206 ko = ko0 - adr[jj]; 02207 ko0 = adr[jj]; 02208 02209 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02210 adrOffset += theXlutOffsets[jj]; 02211 02212 accu[0]+=Xlut[adrAdr+(0)]*ko; 02213 accu[1]+=Xlut[adrAdr+(1)]*ko; 02214 accu[2]+=Xlut[adrAdr+(2)]*ko; 02215 #if NDIM_OUT_DIM == 4 02216 accu[3]+=Xlut[adrAdr+(3)]*ko; 02217 #endif 02218 02219 adrAdr = (adr0 + adrOffset); 02220 #endif 02221 02222 accu[0]+=Xlut[adrAdr+0]*ko0; 02223 accu[1]+=Xlut[adrAdr+1]*ko0; 02224 accu[2]+=Xlut[adrAdr+2]*ko0; 02225 #if NDIM_OUT_DIM == 4 02226 accu[3]+=Xlut[adrAdr+3]*ko0; 02227 #endif 02228 } 02229 else{ 02230 02231 jj = Index[0]; 02232 ko = ko0 - adr[jj]; 02233 ko0 = adr[jj]; 02234 02235 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02236 adrOffset += theXlutOffsets[jj]; 02237 02238 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02239 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02240 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02241 #if NDIM_OUT_DIM == 4 02242 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02243 #endif 02244 adrAdr = (adr0 + adrOffset); 02245 02246 jj = Index[1]; 02247 ko = ko0 - adr[jj]; 02248 ko0 = adr[jj]; 02249 02250 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02251 adrOffset += theXlutOffsets[jj]; 02252 02253 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02254 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02255 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02256 #if NDIM_OUT_DIM == 4 02257 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02258 #endif 02259 adrAdr = (adr0 + adrOffset); 02260 02261 jj = Index[2]; 02262 ko = ko0 - adr[jj]; 02263 ko0 = adr[jj]; 02264 02265 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02266 adrOffset += theXlutOffsets[jj]; 02267 02268 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02269 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02270 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02271 #if NDIM_OUT_DIM == 4 02272 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02273 #endif 02274 adrAdr = (adr0 + adrOffset); 02275 02276 #if NDIM_IN_DIM == 4 02277 jj = Index[3]; 02278 ko = ko0 - adr[jj]; 02279 ko0 = adr[jj]; 02280 02281 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 02282 adrOffset += theXlutOffsets[jj]; 02283 02284 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02285 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02286 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02287 #if NDIM_OUT_DIM == 4 02288 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02289 #endif 02290 adrAdr = (adr0 + adrOffset); 02291 #endif 02292 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 02293 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 02294 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 02295 #if NDIM_OUT_DIM == 4 02296 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 02297 #endif 02298 } 02299 02300 aAlutOffset = 0; 02301 02302 if( aOutputPackMode8Bit ){ 02303 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 02304 jj = accu[ii]; 02305 jj = jj + ( jj >> aXlutWordSize ); 02306 02307 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02308 02309 ko = ko0 & (aAlutInShiftNum - 1 ); 02310 ko0 = ko0 >> aAlutInShift; 02311 ko0 += aAlutOffset; 02312 if( aAlutWordSize <= 8) 02313 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 02314 else{ 02315 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 02316 jj = jj - ( jj >> aAlutShift ); 02317 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 02318 } 02319 *outputData[ii] = (LH_UINT8)jj; 02320 aAlutOffset += adr_bereich_alut; 02321 } 02322 } 02323 else{ 02324 if( aXlutWordSize >= 16 ){ 02325 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 02326 jj = accu[ii]; 02327 jj = jj + ( jj >> aXlutWordSize ); 02328 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02329 02330 ko = ko0 & (aAlutInShiftNum - 1 ); 02331 ko0 = ko0 >> aAlutInShift; 02332 ko0 += aAlutOffset; 02333 if( aAlutWordSize <= 8) 02334 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 02335 else 02336 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 02337 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 02338 aAlutOffset += adr_bereich_alut; 02339 } 02340 } 02341 else{ 02342 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 02343 jj = accu[ii]; 02344 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 02345 ko0 = (jj - ( jj >> ( adr_breite_alut ))) ; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02346 02347 ko = ko0 & (aAlutInShiftNum - 1 ); 02348 ko0 = ko0 >> aAlutInShift; 02349 ko0 += aAlutOffset; 02350 if( aAlutWordSize <= 8) 02351 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 02352 else 02353 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 02354 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 02355 aAlutOffset += adr_bereich_alut; 02356 } 02357 } 02358 } 02359 while (--i){ 02360 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 02361 inputData[jj] += (NDIM_IN_DIM * 2); 02362 } 02363 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02364 outputData[jj] += OutputIncrement; 02365 } 02366 02367 { 02368 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 02369 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 02370 } 02371 } 02372 if( jj<NDIM_IN_DIM ) break; 02373 if( aOutputPackMode8Bit ){ 02374 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02375 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 02376 } 02377 } 02378 else{ 02379 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02380 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 02381 } 02382 } 02383 } 02384 } 02385 02386 if( --LineCount ){ 02387 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 02388 inputData[jj] += inputDataRowOffset; 02389 } 02390 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02391 outputData[jj] += outputDataRowOffset; 02392 } 02393 } 02394 } 02395 } 02396 else{ 02397 02398 register unsigned long bit_breit_selektor; 02399 register unsigned long bit_maske_selektor; 02400 register unsigned long bit_breit_adr; 02401 register unsigned long bit_maske_adr; 02402 register unsigned long aAlutInShiftNum; 02403 register long aAlutInShift; 02404 register long aAlutInShiftRemainder; 02405 register unsigned long aAlutRound; 02406 /*register long aXlutPlaneShift = aXlutAdrShift*aXlutInDim;*/ 02407 bit_breit_selektor=aElutWordSize-aXlutAdrShift; 02408 if( aElutWordSize-aXlutAdrShift < 0 ) 02409 { 02410 #ifdef DEBUG_OUTPUT 02411 DebugPrint("� DoNDim-Error: bit_breit_selektor < 0 (bit_breit_selektor = %d)\n",bit_breit_selektor); 02412 #endif 02413 return cmparamErr; 02414 } 02415 bit_maske_selektor=(1<<bit_breit_selektor)-1; 02416 bit_breit_adr=aXlutAdrShift; 02417 bit_maske_adr=((1<<bit_breit_adr)-1)<<bit_breit_selektor; 02418 aAlutInShift = (aXlutWordSize+bit_breit_selektor-adr_breite_alut); 02419 /*aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02420 aAlutInShiftRemainder = 0; 02421 if( aAlutInShift > 16 ){ 02422 aAlutInShiftRemainder = aAlutInShift - 16; 02423 aAlutInShift = 16; 02424 } 02425 02426 aAlutInShiftNum = (1<<aAlutInShift); 02427 02428 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 02429 while (LineCount){ 02430 i = Pixelcount; 02431 02432 while (i){ 02433 02434 long adr[8],Index[8]; 02435 /*LH_UINT16 *ein_lut = (LH_UINT16 *)ein_lut;*/ 02436 LH_UINT16 ein_reg[8]; 02437 register unsigned long adrAdr,ko,adrOffset; 02438 /*register unsigned long aIndex;*/ 02439 02440 adr0=0; 02441 aElutOffset = 0; 02442 jj=0; 02443 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 02444 ko0 = jj - ( jj >> ( adr_breite_elut )); 02445 ko = ko0 & ( aElutShiftNum - 1 ); 02446 ko0 = ko0 >> aElutShift; 02447 ko0 += aElutOffset; 02448 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02449 02450 aElutOffset += adr_bereich_elut; 02451 adr[0] = (jj & bit_maske_selektor); 02452 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-0-1)*bit_breit_adr); 02453 ein_reg[0] = (LH_UINT16)jj; 02454 02455 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 02456 ko0 = jj - ( jj >> ( adr_breite_elut )); 02457 ko = ko0 & ( aElutShiftNum - 1 ); 02458 ko0 = ko0 >> aElutShift; 02459 ko0 += aElutOffset; 02460 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02461 02462 aElutOffset += adr_bereich_elut; 02463 adr[1] = (jj & bit_maske_selektor); 02464 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-1-1)*bit_breit_adr); 02465 ein_reg[1] = (LH_UINT16)jj; 02466 02467 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 02468 ko0 = jj - ( jj >> ( adr_breite_elut )); 02469 ko = ko0 & ( aElutShiftNum - 1 ); 02470 ko0 = ko0 >> aElutShift; 02471 ko0 += aElutOffset; 02472 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02473 02474 aElutOffset += adr_bereich_elut; 02475 adr[2] = (jj & bit_maske_selektor); 02476 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-2-1)*bit_breit_adr); 02477 ein_reg[2] = (LH_UINT16)jj; 02478 02479 #if NDIM_IN_DIM == 4 02480 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 02481 ko0 = jj - ( jj >> ( adr_breite_elut )); 02482 ko = ko0 & ( aElutShiftNum - 1 ); 02483 ko0 = ko0 >> aElutShift; 02484 ko0 += aElutOffset; 02485 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02486 02487 aElutOffset += adr_bereich_elut; 02488 adr[3] = (jj & bit_maske_selektor); 02489 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-3-1)*bit_breit_adr); 02490 ein_reg[3] = (LH_UINT16)jj; 02491 #endif 02492 adr0 *= NDIM_OUT_DIM; 02493 02494 { /* a kind of */ 02495 register long Hold; 02496 02497 02498 Index[0] = 0; 02499 Index[1] = 1; 02500 Index[2] = 2; 02501 #if NDIM_IN_DIM == 4 02502 Index[3] = 3; 02503 #endif 02504 if( adr[0] < adr[1] ){ 02505 Hold = Index[0]; 02506 Index[0] = Index[1]; 02507 Index[1] = Hold; 02508 } 02509 02510 if( adr[Index[1]] < adr[2] ){ 02511 Hold = Index[1]; 02512 Index[1] = Index[2]; 02513 Index[2] = Hold; 02514 if( adr[Index[0]] < adr[Index[1]] ){ 02515 Hold = Index[0]; 02516 Index[0] = Index[1]; 02517 Index[1] = Hold; 02518 } 02519 } 02520 02521 #if NDIM_IN_DIM == 4 02522 if( adr[Index[2]] < adr[3] ){ 02523 Hold = Index[2]; 02524 Index[2] = Index[3]; 02525 Index[3] = Hold; 02526 if( adr[Index[1]] < adr[Index[2]] ){ 02527 Hold = Index[1]; 02528 Index[1] = Index[2]; 02529 Index[2] = Hold; 02530 if( adr[Index[0]] < adr[Index[1]] ){ 02531 Hold = Index[0]; 02532 Index[0] = Index[1]; 02533 Index[1] = Hold; 02534 } 02535 } 02536 } 02537 #endif 02538 } 02539 02540 accu[0]=0; 02541 accu[1]=0; 02542 accu[2]=0; 02543 #if NDIM_OUT_DIM == 4 02544 accu[3]=0; 02545 #endif 02546 02547 ko0 = bit_maske_selektor+1; 02548 adrAdr=adr0; 02549 adrOffset=0; 02550 02551 if( aXlutWordSize == 16 ){ 02552 jj = Index[0]; 02553 ko = ko0 - adr[jj]; 02554 ko0 = adr[jj]; 02555 02556 if( ein_reg[jj] < bit_maske_adr ) 02557 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02558 02559 accu[0]+=Xlut[adrAdr+(0)]*ko; 02560 accu[1]+=Xlut[adrAdr+(1)]*ko; 02561 accu[2]+=Xlut[adrAdr+(2)]*ko; 02562 #if NDIM_OUT_DIM == 4 02563 accu[3]+=Xlut[adrAdr+(3)]*ko; 02564 #endif 02565 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02566 02567 jj = Index[1]; 02568 ko = ko0 - adr[jj]; 02569 ko0 = adr[jj]; 02570 02571 if( ein_reg[jj] < bit_maske_adr ) 02572 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02573 02574 accu[0]+=Xlut[adrAdr+(0)]*ko; 02575 accu[1]+=Xlut[adrAdr+(1)]*ko; 02576 accu[2]+=Xlut[adrAdr+(2)]*ko; 02577 #if NDIM_OUT_DIM == 4 02578 accu[3]+=Xlut[adrAdr+(3)]*ko; 02579 #endif 02580 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02581 02582 jj = Index[2]; 02583 ko = ko0 - adr[jj]; 02584 ko0 = adr[jj]; 02585 02586 if( ein_reg[jj] < bit_maske_adr ) 02587 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02588 02589 accu[0]+=Xlut[adrAdr+(0)]*ko; 02590 accu[1]+=Xlut[adrAdr+(1)]*ko; 02591 accu[2]+=Xlut[adrAdr+(2)]*ko; 02592 #if NDIM_OUT_DIM == 4 02593 accu[3]+=Xlut[adrAdr+(3)]*ko; 02594 #endif 02595 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02596 02597 #if NDIM_IN_DIM == 4 02598 jj = Index[3]; 02599 ko = ko0 - adr[jj]; 02600 ko0 = adr[jj]; 02601 02602 if( ein_reg[jj] < bit_maske_adr ) 02603 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02604 02605 accu[0]+=Xlut[adrAdr+(0)]*ko; 02606 accu[1]+=Xlut[adrAdr+(1)]*ko; 02607 accu[2]+=Xlut[adrAdr+(2)]*ko; 02608 #if NDIM_OUT_DIM == 4 02609 accu[3]+=Xlut[adrAdr+(3)]*ko; 02610 #endif 02611 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02612 #endif 02613 accu[0]+=Xlut[adrAdr+0]*ko0; 02614 accu[1]+=Xlut[adrAdr+1]*ko0; 02615 accu[2]+=Xlut[adrAdr+2]*ko0; 02616 #if NDIM_OUT_DIM == 4 02617 accu[3]+=Xlut[adrAdr+3]*ko0; 02618 #endif 02619 } 02620 else{ 02621 jj = Index[0]; 02622 ko = ko0 - adr[jj]; 02623 ko0 = adr[jj]; 02624 02625 if( ein_reg[jj] < bit_maske_adr ) 02626 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02627 02628 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02629 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02630 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02631 #if NDIM_OUT_DIM == 4 02632 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02633 #endif 02634 02635 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02636 02637 jj = Index[1]; 02638 ko = ko0 - adr[jj]; 02639 ko0 = adr[jj]; 02640 02641 if( ein_reg[jj] < bit_maske_adr ) 02642 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02643 02644 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02645 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02646 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02647 #if NDIM_OUT_DIM == 4 02648 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02649 #endif 02650 02651 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02652 02653 jj = Index[2]; 02654 ko = ko0 - adr[jj]; 02655 ko0 = adr[jj]; 02656 02657 if( ein_reg[jj] < bit_maske_adr ) 02658 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02659 02660 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02661 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02662 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02663 #if NDIM_OUT_DIM == 4 02664 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02665 #endif 02666 02667 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02668 02669 #if NDIM_IN_DIM == 4 02670 jj = Index[3]; 02671 ko = ko0 - adr[jj]; 02672 ko0 = adr[jj]; 02673 02674 if( ein_reg[jj] < bit_maske_adr ) 02675 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 02676 02677 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 02678 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 02679 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 02680 #if NDIM_OUT_DIM == 4 02681 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 02682 #endif 02683 02684 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 02685 #endif 02686 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 02687 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 02688 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 02689 #if NDIM_OUT_DIM == 4 02690 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 02691 #endif 02692 } 02693 02694 aAlutOffset = 0; 02695 02696 if( aOutputPackMode8Bit ){ 02697 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 02698 jj = accu[ii]; 02699 jj = jj + ( jj >> aXlutWordSize ); 02700 02701 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02702 02703 ko = ko0 & (aAlutInShiftNum - 1 ); 02704 ko0 = ko0 >> aAlutInShift; 02705 ko0 += aAlutOffset; 02706 if( aAlutWordSize <= 8) 02707 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 02708 else{ 02709 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 02710 jj = jj - ( jj >> aAlutShift ); 02711 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 02712 } 02713 02714 *outputData[ii] = (LH_UINT8)jj; 02715 aAlutOffset += adr_bereich_alut; 02716 } 02717 } 02718 else{ 02719 if( aXlutWordSize >= 16 ){ 02720 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 02721 jj = accu[ii]; 02722 jj = jj + ( jj >> aXlutWordSize ); 02723 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02724 02725 ko = ko0 & (aAlutInShiftNum - 1 ); 02726 ko0 = ko0 >> aAlutInShift; 02727 ko0 += aAlutOffset; 02728 if( aAlutWordSize <= 8) 02729 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 02730 else 02731 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 02732 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 02733 aAlutOffset += adr_bereich_alut; 02734 } 02735 } 02736 else{ 02737 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 02738 jj = accu[ii]; 02739 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 02740 ko0 = (jj - ( jj >> ( adr_breite_alut ))); /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 02741 02742 ko = ko0 & (aAlutInShiftNum - 1 ); 02743 ko0 = ko0 >> aAlutInShift; 02744 ko0 += aAlutOffset; 02745 if( aAlutWordSize <= 8) 02746 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 02747 else 02748 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 02749 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 02750 aAlutOffset += adr_bereich_alut; 02751 } 02752 } 02753 } 02754 02755 while (--i){ 02756 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 02757 inputData[jj] += (NDIM_IN_DIM * 2); 02758 } 02759 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02760 outputData[jj] += OutputIncrement; 02761 } 02762 02763 { 02764 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 02765 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 02766 } 02767 } 02768 if( jj<NDIM_IN_DIM ) break; 02769 if( aOutputPackMode8Bit ){ 02770 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02771 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 02772 } 02773 } 02774 else{ 02775 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02776 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 02777 } 02778 } 02779 } 02780 } 02781 02782 if( --LineCount ){ 02783 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 02784 inputData[jj] += inputDataRowOffset; 02785 } 02786 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 02787 outputData[jj] += outputDataRowOffset; 02788 } 02789 } 02790 } 02791 } 02792 02793 /* UNLOCK_DATA( aElutHdle ); */ 02794 /* UNLOCK_DATA( aAlutHdle ); */ 02795 /* UNLOCK_DATA( aXlutHdle ); */ 02796 02797 LH_END_PROC("Calc423Dim_Data8To8_Lut16") 02798 return noErr; 02799 }

CMError Calc424Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 2810 of file w98/lh_core/calcnd3.c.

02813 { 02814 LH_UINT8 * inputData[8], *outputData[8]; 02815 UINT32 OutputIncrement, inputDataRowOffset, outputDataRowOffset, Pixelcount, LineCount; 02816 register unsigned long adr0; 02817 register unsigned long ko0; 02818 unsigned long accu[8]; 02819 register long i; 02820 /*long Offsets[8];*/ 02821 02822 register long aAlutShift,aElutOffset,aAlutOffset; 02823 register long aElutWordSize; 02824 register long aAlutWordSize; 02825 register long aXlutAdrSize; 02826 register long aXlutAdrShift; 02827 register unsigned long aXlutWordSize; 02828 register unsigned long ii,jj; 02829 register long aOutputPackMode8Bit; 02830 long ein_Cache[8]; 02831 02832 LH_UINT16 * aus_lut = (LH_UINT16*)lutParam->outputLut; 02833 LH_UINT16 * ein_lut = (LH_UINT16*)lutParam->inputLut; 02834 LH_UINT16 * Xlut = (LH_UINT16*)lutParam->colorLut; 02835 02836 #ifdef DEBUG_OUTPUT 02837 long err = noErr; 02838 #endif 02839 LH_START_PROC("Calc424Dim_Data8To8_Lut16") 02840 02841 inputData[0] = (LH_UINT8 *)calcParam->inputData[0]; 02842 inputData[1] = (LH_UINT8 *)calcParam->inputData[1]; 02843 inputData[2] = (LH_UINT8 *)calcParam->inputData[2]; 02844 #if NDIM_IN_DIM == 4 02845 inputData[3] = (LH_UINT8 *)calcParam->inputData[3]; 02846 #endif 02847 outputData[0] = (LH_UINT8 *)calcParam->outputData[0]; 02848 outputData[1] = (LH_UINT8 *)calcParam->outputData[1]; 02849 outputData[2] = (LH_UINT8 *)calcParam->outputData[2]; 02850 #if NDIM_OUT_DIM == 4 02851 outputData[3] = (LH_UINT8 *)calcParam->outputData[3]; 02852 #endif 02853 02854 OutputIncrement = calcParam->cmOutputPixelOffset; 02855 inputDataRowOffset = calcParam->cmInputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmInputPixelOffset + (NDIM_IN_DIM * 2); 02856 outputDataRowOffset = calcParam->cmOutputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmOutputPixelOffset + OutputIncrement; 02857 02858 Pixelcount = calcParam->cmPixelPerLine; 02859 LineCount = calcParam->cmLineCount; 02860 02861 aElutWordSize = lutParam->inputLutWordSize; 02862 aAlutWordSize = lutParam->outputLutWordSize; 02863 aXlutAdrSize = lutParam->colorLutGridPoints; 02864 for ( i = 1; (i < 32) && (aXlutAdrSize >> i); i++) 02865 aXlutAdrShift = i; 02866 aXlutWordSize = lutParam->colorLutWordSize; 02867 02868 aOutputPackMode8Bit = calcParam->cmOutputColorSpace & cm8PerChannelPacking || calcParam->cmOutputColorSpace & cmLong8ColorPacking; 02869 /*DebugPrint("DoNDim with %d input elements\n",aByteCount);*/ 02870 #if FARBR_FILES 02871 WriteLuts( "DoNDim",1,adr_bereich_elut,aElutWordSize,ein_lut, 02872 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutWordSize,(LH_UINT16 *)Xlut,adr_bereich_alut,aAlutWordSize,(LH_UINT16 *)aus_lut); 02873 #endif 02874 02875 i=0; 02876 02877 { 02878 if( aElutShift < 0 ) 02879 { 02880 #ifdef DEBUG_OUTPUT 02881 DebugPrint("� DoNDim-Error: aElutShift < 0 (aElutShift = %d)\n",aElutShift); 02882 #endif 02883 return cmparamErr; 02884 } 02885 } 02886 02887 if( aOutputPackMode8Bit ){ 02888 aAlutShift = (aAlutWordSize-8); 02889 } 02890 else{ 02891 aAlutShift = (16 - aAlutWordSize); 02892 } 02893 02894 #ifdef DEBUG_OUTPUT 02895 if ( DebugCheck(kThisFile, kDebugReserved1) ){ 02896 DebugPrint("aElutAdrSize=%lx,aElutAdrShift=%lx,aElutWordSize=%lx,ein_lut=%lx,\n", 02897 adr_bereich_elut,adr_breite_elut,aElutWordSize,ein_lut); 02898 DebugPrint("aAlutAdrSize=%lx,aAlutAdrShift=%lx,aAlutWordSize=%lx,aus_lut=%lx,\n", 02899 adr_bereich_alut,adr_breite_alut,aAlutWordSize,aus_lut); 02900 DebugPrint("aXlutInDim=%lx,aXlutOutDim=%lx,aXlutAdrSize=%lx,aXlutAdrShift=%lx,aXlutWordSize=%lx,Xlut=%lx,\n", 02901 NDIM_IN_DIM,NDIM_OUT_DIM,aXlutAdrSize,aXlutAdrShift,aXlutWordSize,Xlut); 02902 } 02903 #endif 02904 02905 /*if( 1 )*/ 02906 if( aXlutAdrSize != (1<<aXlutAdrShift )){ 02907 register long aXlutOffset; 02908 long theXlutOffsets[8]; 02909 register unsigned long aAlutInShift; 02910 register long aAlutInShiftRemainder; 02911 register unsigned long aAlutInShiftNum; 02912 register long aElutWordSizeMask = (1<<aElutWordSize) - 1; 02913 register unsigned long aAlutRound; 02914 aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut; 02915 aAlutInShiftRemainder = 0; 02916 if( aAlutInShift > 16 ){ 02917 aAlutInShiftRemainder = aAlutInShift - 16; 02918 aAlutInShift = 16; 02919 } 02920 aAlutInShiftNum = (1<<aAlutInShift); 02921 02922 #ifdef DEBUG_OUTPUT 02923 if ( DebugCheck(kThisFile, kDebugMiscInfo) ) 02924 DebugPrint(" DoNDim gripoints = %ld\n",aXlutAdrSize); 02925 #endif 02926 if( aElutWordSize <= 0 ){ 02927 #ifdef DEBUG_OUTPUT 02928 DebugPrint("� DoNDim-Error: (1<<aElutWordSize)/aXlutAdrSize <= 0 %d\n",(1<<aElutWordSize)/aXlutAdrSize); 02929 #endif 02930 return cmparamErr; 02931 } 02932 if( aAlutInShift <= 0 ){ 02933 #ifdef DEBUG_OUTPUT 02934 DebugPrint("� DoNDim-Error: aAlutInShift <= 0 %d\n",aAlutInShift); 02935 #endif 02936 return cmparamErr; 02937 } 02938 aXlutOffset =NDIM_OUT_DIM; 02939 for( i=0; i<(long)NDIM_IN_DIM; i++){ 02940 theXlutOffsets[ NDIM_IN_DIM-1-i] = aXlutOffset; 02941 aXlutOffset *=aXlutAdrSize; 02942 } 02943 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 02944 02945 #ifdef DEBUG_OUTPUT 02946 if ( DebugCheck(kThisFile, kDebugReserved1) ) 02947 DebugPrint(" aElutWordSize((1<<aElutWordSize)-0) = %ld\n aAlutInShift:((1<<aXlutWordSize)*aElutWordSize+(adr_bereich_alut/2))/adr_bereich_alut = %ld\n",aElutWordSize,aAlutInShift); 02948 #endif 02949 02950 while (LineCount){ 02951 i = Pixelcount; 02952 02953 while (i){ 02954 02955 long adr[8],Index[8]; 02956 LH_UINT16 ein_reg[8]; 02957 register unsigned long adrAdr,ko,adrOffset; 02958 02959 adr0=0; 02960 aElutOffset = 0; 02961 jj=0; 02962 02963 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 02964 ko0 = jj - ( jj >> ( adr_breite_elut )); 02965 ko = ko0 & ( aElutShiftNum - 1 ); 02966 ko0 = ko0 >> aElutShift; 02967 ko0 += aElutOffset; 02968 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02969 02970 jj *= aXlutAdrSize; 02971 aElutOffset += adr_bereich_elut; 02972 adr[0] = jj & aElutWordSizeMask; 02973 jj = jj >> aElutWordSize; 02974 adr0 += (jj)*theXlutOffsets[0]; 02975 ein_reg[0] = (LH_UINT16)jj; 02976 02977 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 02978 ko0 = jj - ( jj >> ( adr_breite_elut )); 02979 ko = ko0 & ( aElutShiftNum - 1 ); 02980 ko0 = ko0 >> aElutShift; 02981 ko0 += aElutOffset; 02982 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02983 02984 jj *= aXlutAdrSize; 02985 aElutOffset += adr_bereich_elut; 02986 adr[1] = jj & aElutWordSizeMask; 02987 jj = jj >> aElutWordSize; 02988 adr0 += (jj)*theXlutOffsets[1]; 02989 ein_reg[1] = (LH_UINT16)jj; 02990 02991 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 02992 ko0 = jj - ( jj >> ( adr_breite_elut )); 02993 ko = ko0 & ( aElutShiftNum - 1 ); 02994 ko0 = ko0 >> aElutShift; 02995 ko0 += aElutOffset; 02996 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 02997 02998 jj *= aXlutAdrSize; 02999 aElutOffset += adr_bereich_elut; 03000 adr[2] = jj & aElutWordSizeMask; 03001 jj = jj >> aElutWordSize; 03002 adr0 += (jj)*theXlutOffsets[2]; 03003 ein_reg[2] = (LH_UINT16)jj; 03004 03005 #if NDIM_IN_DIM == 4 03006 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 03007 ko0 = jj - ( jj >> ( adr_breite_elut )); 03008 ko = ko0 & ( aElutShiftNum - 1 ); 03009 ko0 = ko0 >> aElutShift; 03010 ko0 += aElutOffset; 03011 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 03012 03013 jj *= aXlutAdrSize; 03014 aElutOffset += adr_bereich_elut; 03015 adr[3] = jj & aElutWordSizeMask; 03016 jj = jj >> aElutWordSize; 03017 adr0 += (jj)*theXlutOffsets[3]; 03018 ein_reg[3] = (LH_UINT16)jj; 03019 #endif 03020 03021 03022 03023 { /* a kind of */ 03024 register long Hold; 03025 03026 03027 Index[0] = 0; 03028 Index[1] = 1; 03029 Index[2] = 2; 03030 #if NDIM_IN_DIM == 4 03031 Index[3] = 3; 03032 #endif 03033 if( adr[0] < adr[1] ){ 03034 Hold = Index[0]; 03035 Index[0] = Index[1]; 03036 Index[1] = Hold; 03037 } 03038 03039 if( adr[Index[1]] < adr[2] ){ 03040 Hold = Index[1]; 03041 Index[1] = Index[2]; 03042 Index[2] = Hold; 03043 if( adr[Index[0]] < adr[Index[1]] ){ 03044 Hold = Index[0]; 03045 Index[0] = Index[1]; 03046 Index[1] = Hold; 03047 } 03048 } 03049 03050 #if NDIM_IN_DIM == 4 03051 if( adr[Index[2]] < adr[3] ){ 03052 Hold = Index[2]; 03053 Index[2] = Index[3]; 03054 Index[3] = Hold; 03055 if( adr[Index[1]] < adr[Index[2]] ){ 03056 Hold = Index[1]; 03057 Index[1] = Index[2]; 03058 Index[2] = Hold; 03059 if( adr[Index[0]] < adr[Index[1]] ){ 03060 Hold = Index[0]; 03061 Index[0] = Index[1]; 03062 Index[1] = Hold; 03063 } 03064 } 03065 } 03066 #endif 03067 } 03068 03069 accu[0]=0; 03070 accu[1]=0; 03071 accu[2]=0; 03072 #if NDIM_OUT_DIM == 4 03073 accu[3]=0; 03074 #endif 03075 ko0 = (1<<aElutWordSize); 03076 adrAdr=adr0; 03077 adrOffset=0; 03078 if( aXlutWordSize == 16 ){ 03079 jj = Index[0]; 03080 ko = ko0 - adr[jj]; 03081 ko0 = adr[jj]; 03082 03083 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03084 adrOffset += theXlutOffsets[jj]; 03085 03086 accu[0]+=Xlut[adrAdr+(0)]*ko; 03087 accu[1]+=Xlut[adrAdr+(1)]*ko; 03088 accu[2]+=Xlut[adrAdr+(2)]*ko; 03089 #if NDIM_OUT_DIM == 4 03090 accu[3]+=Xlut[adrAdr+(3)]*ko; 03091 #endif 03092 03093 adrAdr = (adr0 + adrOffset); 03094 03095 jj = Index[1]; 03096 ko = ko0 - adr[jj]; 03097 ko0 = adr[jj]; 03098 03099 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03100 adrOffset += theXlutOffsets[jj]; 03101 03102 accu[0]+=Xlut[adrAdr+(0)]*ko; 03103 accu[1]+=Xlut[adrAdr+(1)]*ko; 03104 accu[2]+=Xlut[adrAdr+(2)]*ko; 03105 #if NDIM_OUT_DIM == 4 03106 accu[3]+=Xlut[adrAdr+(3)]*ko; 03107 #endif 03108 03109 adrAdr = (adr0 + adrOffset); 03110 03111 jj = Index[2]; 03112 ko = ko0 - adr[jj]; 03113 ko0 = adr[jj]; 03114 03115 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03116 adrOffset += theXlutOffsets[jj]; 03117 03118 accu[0]+=Xlut[adrAdr+(0)]*ko; 03119 accu[1]+=Xlut[adrAdr+(1)]*ko; 03120 accu[2]+=Xlut[adrAdr+(2)]*ko; 03121 #if NDIM_OUT_DIM == 4 03122 accu[3]+=Xlut[adrAdr+(3)]*ko; 03123 #endif 03124 03125 adrAdr = (adr0 + adrOffset); 03126 03127 #if NDIM_IN_DIM == 4 03128 jj = Index[3]; 03129 ko = ko0 - adr[jj]; 03130 ko0 = adr[jj]; 03131 03132 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03133 adrOffset += theXlutOffsets[jj]; 03134 03135 accu[0]+=Xlut[adrAdr+(0)]*ko; 03136 accu[1]+=Xlut[adrAdr+(1)]*ko; 03137 accu[2]+=Xlut[adrAdr+(2)]*ko; 03138 #if NDIM_OUT_DIM == 4 03139 accu[3]+=Xlut[adrAdr+(3)]*ko; 03140 #endif 03141 03142 adrAdr = (adr0 + adrOffset); 03143 #endif 03144 03145 accu[0]+=Xlut[adrAdr+0]*ko0; 03146 accu[1]+=Xlut[adrAdr+1]*ko0; 03147 accu[2]+=Xlut[adrAdr+2]*ko0; 03148 #if NDIM_OUT_DIM == 4 03149 accu[3]+=Xlut[adrAdr+3]*ko0; 03150 #endif 03151 } 03152 else{ 03153 03154 jj = Index[0]; 03155 ko = ko0 - adr[jj]; 03156 ko0 = adr[jj]; 03157 03158 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03159 adrOffset += theXlutOffsets[jj]; 03160 03161 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03162 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03163 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03164 #if NDIM_OUT_DIM == 4 03165 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03166 #endif 03167 adrAdr = (adr0 + adrOffset); 03168 03169 jj = Index[1]; 03170 ko = ko0 - adr[jj]; 03171 ko0 = adr[jj]; 03172 03173 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03174 adrOffset += theXlutOffsets[jj]; 03175 03176 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03177 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03178 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03179 #if NDIM_OUT_DIM == 4 03180 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03181 #endif 03182 adrAdr = (adr0 + adrOffset); 03183 03184 jj = Index[2]; 03185 ko = ko0 - adr[jj]; 03186 ko0 = adr[jj]; 03187 03188 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03189 adrOffset += theXlutOffsets[jj]; 03190 03191 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03192 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03193 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03194 #if NDIM_OUT_DIM == 4 03195 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03196 #endif 03197 adrAdr = (adr0 + adrOffset); 03198 03199 #if NDIM_IN_DIM == 4 03200 jj = Index[3]; 03201 ko = ko0 - adr[jj]; 03202 ko0 = adr[jj]; 03203 03204 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 03205 adrOffset += theXlutOffsets[jj]; 03206 03207 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03208 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03209 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03210 #if NDIM_OUT_DIM == 4 03211 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03212 #endif 03213 adrAdr = (adr0 + adrOffset); 03214 #endif 03215 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 03216 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 03217 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 03218 #if NDIM_OUT_DIM == 4 03219 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 03220 #endif 03221 } 03222 03223 aAlutOffset = 0; 03224 03225 if( aOutputPackMode8Bit ){ 03226 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 03227 jj = accu[ii]; 03228 jj = jj + ( jj >> aXlutWordSize ); 03229 03230 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03231 03232 ko = ko0 & (aAlutInShiftNum - 1 ); 03233 ko0 = ko0 >> aAlutInShift; 03234 ko0 += aAlutOffset; 03235 if( aAlutWordSize <= 8) 03236 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 03237 else{ 03238 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 03239 jj = jj - ( jj >> aAlutShift ); 03240 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 03241 } 03242 *outputData[ii] = (LH_UINT8)jj; 03243 aAlutOffset += adr_bereich_alut; 03244 } 03245 } 03246 else{ 03247 if( aXlutWordSize >= 16 ){ 03248 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 03249 jj = accu[ii]; 03250 jj = jj + ( jj >> aXlutWordSize ); 03251 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03252 03253 ko = ko0 & (aAlutInShiftNum - 1 ); 03254 ko0 = ko0 >> aAlutInShift; 03255 ko0 += aAlutOffset; 03256 if( aAlutWordSize <= 8) 03257 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 03258 else 03259 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 03260 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 03261 aAlutOffset += adr_bereich_alut; 03262 } 03263 } 03264 else{ 03265 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 03266 jj = accu[ii]; 03267 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 03268 ko0 = (jj - ( jj >> ( adr_breite_alut ))) ; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03269 03270 ko = ko0 & (aAlutInShiftNum - 1 ); 03271 ko0 = ko0 >> aAlutInShift; 03272 ko0 += aAlutOffset; 03273 if( aAlutWordSize <= 8) 03274 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 03275 else 03276 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 03277 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 03278 aAlutOffset += adr_bereich_alut; 03279 } 03280 } 03281 } 03282 while (--i){ 03283 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 03284 inputData[jj] += (NDIM_IN_DIM * 2); 03285 } 03286 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03287 outputData[jj] += OutputIncrement; 03288 } 03289 03290 { 03291 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 03292 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 03293 } 03294 } 03295 if( jj<NDIM_IN_DIM ) break; 03296 if( aOutputPackMode8Bit ){ 03297 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03298 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 03299 } 03300 } 03301 else{ 03302 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03303 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 03304 } 03305 } 03306 } 03307 } 03308 03309 if( --LineCount ){ 03310 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 03311 inputData[jj] += inputDataRowOffset; 03312 } 03313 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03314 outputData[jj] += outputDataRowOffset; 03315 } 03316 } 03317 } 03318 } 03319 else{ 03320 03321 register unsigned long bit_breit_selektor; 03322 register unsigned long bit_maske_selektor; 03323 register unsigned long bit_breit_adr; 03324 register unsigned long bit_maske_adr; 03325 register unsigned long aAlutInShiftNum; 03326 register long aAlutInShift; 03327 register long aAlutInShiftRemainder; 03328 register unsigned long aAlutRound; 03329 /*register long aXlutPlaneShift = aXlutAdrShift*aXlutInDim;*/ 03330 bit_breit_selektor=aElutWordSize-aXlutAdrShift; 03331 if( aElutWordSize-aXlutAdrShift < 0 ) 03332 { 03333 #ifdef DEBUG_OUTPUT 03334 DebugPrint("� DoNDim-Error: bit_breit_selektor < 0 (bit_breit_selektor = %d)\n",bit_breit_selektor); 03335 #endif 03336 return cmparamErr; 03337 } 03338 bit_maske_selektor=(1<<bit_breit_selektor)-1; 03339 bit_breit_adr=aXlutAdrShift; 03340 bit_maske_adr=((1<<bit_breit_adr)-1)<<bit_breit_selektor; 03341 aAlutInShift = (aXlutWordSize+bit_breit_selektor-adr_breite_alut); 03342 /*aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03343 aAlutInShiftRemainder = 0; 03344 if( aAlutInShift > 16 ){ 03345 aAlutInShiftRemainder = aAlutInShift - 16; 03346 aAlutInShift = 16; 03347 } 03348 03349 aAlutInShiftNum = (1<<aAlutInShift); 03350 03351 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 03352 while (LineCount){ 03353 i = Pixelcount; 03354 03355 while (i){ 03356 03357 long adr[8],Index[8]; 03358 /*LH_UINT16 *ein_lut = (LH_UINT16 *)ein_lut;*/ 03359 LH_UINT16 ein_reg[8]; 03360 register unsigned long adrAdr,ko,adrOffset; 03361 /*register unsigned long aIndex;*/ 03362 03363 adr0=0; 03364 aElutOffset = 0; 03365 jj=0; 03366 ein_Cache[0]=jj=(*(LH_UINT16 *)inputData[0]); 03367 ko0 = jj - ( jj >> ( adr_breite_elut )); 03368 ko = ko0 & ( aElutShiftNum - 1 ); 03369 ko0 = ko0 >> aElutShift; 03370 ko0 += aElutOffset; 03371 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 03372 03373 aElutOffset += adr_bereich_elut; 03374 adr[0] = (jj & bit_maske_selektor); 03375 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-0-1)*bit_breit_adr); 03376 ein_reg[0] = (LH_UINT16)jj; 03377 03378 ein_Cache[1]=jj=(*(LH_UINT16 *)inputData[1]); 03379 ko0 = jj - ( jj >> ( adr_breite_elut )); 03380 ko = ko0 & ( aElutShiftNum - 1 ); 03381 ko0 = ko0 >> aElutShift; 03382 ko0 += aElutOffset; 03383 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 03384 03385 aElutOffset += adr_bereich_elut; 03386 adr[1] = (jj & bit_maske_selektor); 03387 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-1-1)*bit_breit_adr); 03388 ein_reg[1] = (LH_UINT16)jj; 03389 03390 ein_Cache[2]=jj=(*(LH_UINT16 *)inputData[2]); 03391 ko0 = jj - ( jj >> ( adr_breite_elut )); 03392 ko = ko0 & ( aElutShiftNum - 1 ); 03393 ko0 = ko0 >> aElutShift; 03394 ko0 += aElutOffset; 03395 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 03396 03397 aElutOffset += adr_bereich_elut; 03398 adr[2] = (jj & bit_maske_selektor); 03399 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-2-1)*bit_breit_adr); 03400 ein_reg[2] = (LH_UINT16)jj; 03401 03402 #if NDIM_IN_DIM == 4 03403 ein_Cache[3]=jj=(*(LH_UINT16 *)inputData[3]); 03404 ko0 = jj - ( jj >> ( adr_breite_elut )); 03405 ko = ko0 & ( aElutShiftNum - 1 ); 03406 ko0 = ko0 >> aElutShift; 03407 ko0 += aElutOffset; 03408 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 03409 03410 aElutOffset += adr_bereich_elut; 03411 adr[3] = (jj & bit_maske_selektor); 03412 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((NDIM_IN_DIM-3-1)*bit_breit_adr); 03413 ein_reg[3] = (LH_UINT16)jj; 03414 #endif 03415 adr0 *= NDIM_OUT_DIM; 03416 03417 { /* a kind of */ 03418 register long Hold; 03419 03420 03421 Index[0] = 0; 03422 Index[1] = 1; 03423 Index[2] = 2; 03424 #if NDIM_IN_DIM == 4 03425 Index[3] = 3; 03426 #endif 03427 if( adr[0] < adr[1] ){ 03428 Hold = Index[0]; 03429 Index[0] = Index[1]; 03430 Index[1] = Hold; 03431 } 03432 03433 if( adr[Index[1]] < adr[2] ){ 03434 Hold = Index[1]; 03435 Index[1] = Index[2]; 03436 Index[2] = Hold; 03437 if( adr[Index[0]] < adr[Index[1]] ){ 03438 Hold = Index[0]; 03439 Index[0] = Index[1]; 03440 Index[1] = Hold; 03441 } 03442 } 03443 03444 #if NDIM_IN_DIM == 4 03445 if( adr[Index[2]] < adr[3] ){ 03446 Hold = Index[2]; 03447 Index[2] = Index[3]; 03448 Index[3] = Hold; 03449 if( adr[Index[1]] < adr[Index[2]] ){ 03450 Hold = Index[1]; 03451 Index[1] = Index[2]; 03452 Index[2] = Hold; 03453 if( adr[Index[0]] < adr[Index[1]] ){ 03454 Hold = Index[0]; 03455 Index[0] = Index[1]; 03456 Index[1] = Hold; 03457 } 03458 } 03459 } 03460 #endif 03461 } 03462 03463 accu[0]=0; 03464 accu[1]=0; 03465 accu[2]=0; 03466 #if NDIM_OUT_DIM == 4 03467 accu[3]=0; 03468 #endif 03469 03470 ko0 = bit_maske_selektor+1; 03471 adrAdr=adr0; 03472 adrOffset=0; 03473 03474 if( aXlutWordSize == 16 ){ 03475 jj = Index[0]; 03476 ko = ko0 - adr[jj]; 03477 ko0 = adr[jj]; 03478 03479 if( ein_reg[jj] < bit_maske_adr ) 03480 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03481 03482 accu[0]+=Xlut[adrAdr+(0)]*ko; 03483 accu[1]+=Xlut[adrAdr+(1)]*ko; 03484 accu[2]+=Xlut[adrAdr+(2)]*ko; 03485 #if NDIM_OUT_DIM == 4 03486 accu[3]+=Xlut[adrAdr+(3)]*ko; 03487 #endif 03488 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03489 03490 jj = Index[1]; 03491 ko = ko0 - adr[jj]; 03492 ko0 = adr[jj]; 03493 03494 if( ein_reg[jj] < bit_maske_adr ) 03495 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03496 03497 accu[0]+=Xlut[adrAdr+(0)]*ko; 03498 accu[1]+=Xlut[adrAdr+(1)]*ko; 03499 accu[2]+=Xlut[adrAdr+(2)]*ko; 03500 #if NDIM_OUT_DIM == 4 03501 accu[3]+=Xlut[adrAdr+(3)]*ko; 03502 #endif 03503 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03504 03505 jj = Index[2]; 03506 ko = ko0 - adr[jj]; 03507 ko0 = adr[jj]; 03508 03509 if( ein_reg[jj] < bit_maske_adr ) 03510 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03511 03512 accu[0]+=Xlut[adrAdr+(0)]*ko; 03513 accu[1]+=Xlut[adrAdr+(1)]*ko; 03514 accu[2]+=Xlut[adrAdr+(2)]*ko; 03515 #if NDIM_OUT_DIM == 4 03516 accu[3]+=Xlut[adrAdr+(3)]*ko; 03517 #endif 03518 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03519 03520 #if NDIM_IN_DIM == 4 03521 jj = Index[3]; 03522 ko = ko0 - adr[jj]; 03523 ko0 = adr[jj]; 03524 03525 if( ein_reg[jj] < bit_maske_adr ) 03526 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03527 03528 accu[0]+=Xlut[adrAdr+(0)]*ko; 03529 accu[1]+=Xlut[adrAdr+(1)]*ko; 03530 accu[2]+=Xlut[adrAdr+(2)]*ko; 03531 #if NDIM_OUT_DIM == 4 03532 accu[3]+=Xlut[adrAdr+(3)]*ko; 03533 #endif 03534 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03535 #endif 03536 accu[0]+=Xlut[adrAdr+0]*ko0; 03537 accu[1]+=Xlut[adrAdr+1]*ko0; 03538 accu[2]+=Xlut[adrAdr+2]*ko0; 03539 #if NDIM_OUT_DIM == 4 03540 accu[3]+=Xlut[adrAdr+3]*ko0; 03541 #endif 03542 } 03543 else{ 03544 jj = Index[0]; 03545 ko = ko0 - adr[jj]; 03546 ko0 = adr[jj]; 03547 03548 if( ein_reg[jj] < bit_maske_adr ) 03549 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03550 03551 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03552 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03553 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03554 #if NDIM_OUT_DIM == 4 03555 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03556 #endif 03557 03558 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03559 03560 jj = Index[1]; 03561 ko = ko0 - adr[jj]; 03562 ko0 = adr[jj]; 03563 03564 if( ein_reg[jj] < bit_maske_adr ) 03565 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03566 03567 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03568 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03569 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03570 #if NDIM_OUT_DIM == 4 03571 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03572 #endif 03573 03574 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03575 03576 jj = Index[2]; 03577 ko = ko0 - adr[jj]; 03578 ko0 = adr[jj]; 03579 03580 if( ein_reg[jj] < bit_maske_adr ) 03581 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03582 03583 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03584 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03585 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03586 #if NDIM_OUT_DIM == 4 03587 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03588 #endif 03589 03590 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03591 03592 #if NDIM_IN_DIM == 4 03593 jj = Index[3]; 03594 ko = ko0 - adr[jj]; 03595 ko0 = adr[jj]; 03596 03597 if( ein_reg[jj] < bit_maske_adr ) 03598 adrOffset |= (1<<(NDIM_IN_DIM-1-jj)*bit_breit_adr); 03599 03600 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+(0)]*ko; 03601 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+(1)]*ko; 03602 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+(2)]*ko; 03603 #if NDIM_OUT_DIM == 4 03604 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+(3)]*ko; 03605 #endif 03606 03607 adrAdr = (adr0 + NDIM_OUT_DIM*adrOffset); 03608 #endif 03609 accu[0]+=((LH_UINT8 *)Xlut)[adrAdr+0]*ko0; 03610 accu[1]+=((LH_UINT8 *)Xlut)[adrAdr+1]*ko0; 03611 accu[2]+=((LH_UINT8 *)Xlut)[adrAdr+2]*ko0; 03612 #if NDIM_OUT_DIM == 4 03613 accu[3]+=((LH_UINT8 *)Xlut)[adrAdr+3]*ko0; 03614 #endif 03615 } 03616 03617 aAlutOffset = 0; 03618 03619 if( aOutputPackMode8Bit ){ 03620 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 03621 jj = accu[ii]; 03622 jj = jj + ( jj >> aXlutWordSize ); 03623 03624 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03625 03626 ko = ko0 & (aAlutInShiftNum - 1 ); 03627 ko0 = ko0 >> aAlutInShift; 03628 ko0 += aAlutOffset; 03629 if( aAlutWordSize <= 8) 03630 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 03631 else{ 03632 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 03633 jj = jj - ( jj >> aAlutShift ); 03634 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 03635 } 03636 03637 *outputData[ii] = (LH_UINT8)jj; 03638 aAlutOffset += adr_bereich_alut; 03639 } 03640 } 03641 else{ 03642 if( aXlutWordSize >= 16 ){ 03643 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 03644 jj = accu[ii]; 03645 jj = jj + ( jj >> aXlutWordSize ); 03646 ko0 = (jj - ( jj >> ( adr_breite_alut ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03647 03648 ko = ko0 & (aAlutInShiftNum - 1 ); 03649 ko0 = ko0 >> aAlutInShift; 03650 ko0 += aAlutOffset; 03651 if( aAlutWordSize <= 8) 03652 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 03653 else 03654 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 03655 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 03656 aAlutOffset += adr_bereich_alut; 03657 } 03658 } 03659 else{ 03660 for( ii=0; ii<NDIM_OUT_DIM; ++ii){ 03661 jj = accu[ii]; 03662 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 03663 ko0 = (jj - ( jj >> ( adr_breite_alut ))); /* aAlutInShift = aXlutWordSize + aElutWordSize - adr_breite_alut;*/ 03664 03665 ko = ko0 & (aAlutInShiftNum - 1 ); 03666 ko0 = ko0 >> aAlutInShift; 03667 ko0 += aAlutOffset; 03668 if( aAlutWordSize <= 8) 03669 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 03670 else 03671 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 03672 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 03673 aAlutOffset += adr_bereich_alut; 03674 } 03675 } 03676 } 03677 03678 while (--i){ 03679 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 03680 inputData[jj] += (NDIM_IN_DIM * 2); 03681 } 03682 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03683 outputData[jj] += OutputIncrement; 03684 } 03685 03686 { 03687 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 03688 if( *((LH_UINT16 *)inputData[jj]) ^ *(LH_UINT16 *)(&ein_Cache[jj]) )break; 03689 } 03690 } 03691 if( jj<NDIM_IN_DIM ) break; 03692 if( aOutputPackMode8Bit ){ 03693 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03694 *outputData[jj] = outputData[jj][-(long)(NDIM_OUT_DIM )]; 03695 } 03696 } 03697 else{ 03698 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03699 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)(NDIM_OUT_DIM * 2)]); 03700 } 03701 } 03702 } 03703 } 03704 03705 if( --LineCount ){ 03706 for( jj=0; jj<NDIM_IN_DIM; ++jj){ 03707 inputData[jj] += inputDataRowOffset; 03708 } 03709 for( jj=0; jj<NDIM_OUT_DIM; ++jj){ 03710 outputData[jj] += outputDataRowOffset; 03711 } 03712 } 03713 } 03714 } 03715 03716 /* UNLOCK_DATA( aElutHdle ); */ 03717 /* UNLOCK_DATA( aAlutHdle ); */ 03718 /* UNLOCK_DATA( aXlutHdle ); */ 03719 03720 LH_END_PROC("Calc424Dim_Data8To8_Lut16") 03721 return noErr; 03722 }

CMError CalcNDim_Data16To16_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 898 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00900 { 00901 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00902 }

CMError CalcNDim_Data16To16_Lut8 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 934 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00936 { 00937 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00938 }

CMError CalcNDim_Data16To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 889 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00891 { 00892 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00893 }

CMError CalcNDim_Data16To8_Lut8 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 916 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00918 { 00919 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00920 }

CMError CalcNDim_Data8To16_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 880 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00882 { 00883 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00884 }

CMError CalcNDim_Data8To16_Lut8 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 925 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00927 { 00928 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00929 }

CMError CalcNDim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 62 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00065 { 00066 LH_UINT8 * inputData[8], *outputData[8]; 00067 UINT32 InputIncrement, OutputIncrement, inputDataRowOffset, outputDataRowOffset, Pixelcount, LineCount; 00068 register unsigned long adr0; 00069 register unsigned long ko0; 00070 unsigned long accu[8]; 00071 register long i; 00072 /*long Offsets[8];*/ 00073 00074 register unsigned long nDim; 00075 register long aElutShift,aAlutShift,aElutOffset,aAlutOffset; 00076 register unsigned long aElutAdrSize; 00077 register long aElutAdrShift; 00078 register long aElutWordSize; 00079 register long aAlutAdrSize; 00080 register long aAlutAdrShift; 00081 register long aAlutWordSize; 00082 register unsigned long aXlutInDim; 00083 register unsigned long aXlutOutDim; 00084 register long aXlutAdrSize; 00085 register long aXlutAdrShift; 00086 register unsigned long aXlutWordSize; 00087 register long aInputPackMode8Bit; 00088 register long aOutputPackMode8Bit; 00089 register long aElutShiftNum; 00090 register unsigned long ii,jj; 00091 LH_UINT16 ein_Cache[8]; 00092 00093 00094 LH_UINT16 * aus_lut = (LH_UINT16*)lutParam->outputLut; 00095 LH_UINT16 * ein_lut = (LH_UINT16*)lutParam->inputLut; 00096 LH_UINT16 * Xlut = (LH_UINT16*)lutParam->colorLut; 00097 00098 Boolean aCopyAlpha; 00099 00100 #ifdef DEBUG_OUTPUT 00101 long err = noErr; 00102 #endif 00103 LH_START_PROC("CalcNDim_Data8To8_Lut16") 00104 #if UNROLL_NDIM 00105 if( lutParam->colorLutInDim == 3 && 00106 calcParam->cmInputPixelOffset == 6 ){ 00107 if( lutParam->colorLutOutDim == 3 && 00108 ( calcParam->cmOutputPixelOffset == 3 || 00109 calcParam->cmOutputPixelOffset == 6)){ 00110 return Calc323Dim_Data8To8_Lut16( calcParam, lutParam ); 00111 } 00112 if( lutParam->colorLutOutDim == 4 && 00113 ( calcParam->cmOutputPixelOffset == 4 || 00114 calcParam->cmOutputPixelOffset == 8) ){ 00115 return Calc324Dim_Data8To8_Lut16( calcParam, lutParam ); 00116 } 00117 } 00118 if( lutParam->colorLutInDim == 4 && 00119 calcParam->cmInputPixelOffset == 8 ){ 00120 if( lutParam->colorLutOutDim == 3 && 00121 ( calcParam->cmOutputPixelOffset == 3 || 00122 calcParam->cmOutputPixelOffset == 6) ){ 00123 return Calc423Dim_Data8To8_Lut16( calcParam, lutParam ); 00124 } 00125 if( lutParam->colorLutOutDim == 4 && 00126 ( calcParam->cmOutputPixelOffset == 4 || 00127 calcParam->cmOutputPixelOffset == 8) ){ 00128 return Calc424Dim_Data8To8_Lut16( calcParam, lutParam ); 00129 } 00130 } 00131 #endif 00132 00133 inputData[0] = (LH_UINT8 *)calcParam->inputData[0]; 00134 inputData[1] = (LH_UINT8 *)calcParam->inputData[1]; 00135 inputData[2] = (LH_UINT8 *)calcParam->inputData[2]; 00136 inputData[3] = (LH_UINT8 *)calcParam->inputData[3]; 00137 inputData[4] = (LH_UINT8 *)calcParam->inputData[4]; 00138 inputData[5] = (LH_UINT8 *)calcParam->inputData[5]; 00139 inputData[6] = (LH_UINT8 *)calcParam->inputData[6]; 00140 inputData[7] = (LH_UINT8 *)calcParam->inputData[7]; 00141 00142 outputData[0] = (LH_UINT8 *)calcParam->outputData[0]; 00143 outputData[1] = (LH_UINT8 *)calcParam->outputData[1]; 00144 outputData[2] = (LH_UINT8 *)calcParam->outputData[2]; 00145 outputData[3] = (LH_UINT8 *)calcParam->outputData[3]; 00146 outputData[4] = (LH_UINT8 *)calcParam->outputData[4]; 00147 outputData[5] = (LH_UINT8 *)calcParam->outputData[5]; 00148 outputData[6] = (LH_UINT8 *)calcParam->outputData[6]; 00149 outputData[7] = (LH_UINT8 *)calcParam->outputData[7]; 00150 InputIncrement = calcParam->cmInputPixelOffset; 00151 OutputIncrement = calcParam->cmOutputPixelOffset; 00152 inputDataRowOffset = calcParam->cmInputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmInputPixelOffset + InputIncrement; 00153 outputDataRowOffset = calcParam->cmOutputBytesPerLine - calcParam->cmPixelPerLine * calcParam->cmOutputPixelOffset + OutputIncrement; 00154 00155 Pixelcount = calcParam->cmPixelPerLine; 00156 LineCount = calcParam->cmLineCount; 00157 00158 aElutAdrSize = lutParam->inputLutEntryCount; 00159 for ( i = 1; (i < 32) && (aElutAdrSize >> i); i++) 00160 aElutAdrShift = i; 00161 aElutWordSize = lutParam->inputLutWordSize; 00162 aAlutAdrSize = lutParam->outputLutEntryCount; 00163 for ( i = 1; (i < 32) && (aAlutAdrSize >> i); i++) 00164 aAlutAdrShift = i; 00165 aAlutWordSize = lutParam->outputLutWordSize; 00166 aXlutInDim = lutParam->colorLutInDim; 00167 aXlutOutDim = lutParam->colorLutOutDim; 00168 aXlutAdrSize = lutParam->colorLutGridPoints; 00169 for ( i = 1; (i < 32) && (aXlutAdrSize >> i); i++) 00170 aXlutAdrShift = i; 00171 aXlutWordSize = lutParam->colorLutWordSize; 00172 00173 aInputPackMode8Bit = calcParam->cmInputColorSpace & cm8PerChannelPacking || calcParam->cmInputColorSpace & cmLong8ColorPacking; 00174 aOutputPackMode8Bit = calcParam->cmOutputColorSpace & cm8PerChannelPacking || calcParam->cmOutputColorSpace & cmLong8ColorPacking; 00175 00176 /*DebugPrint("DoNDim with %d input elements\n",aByteCount);*/ 00177 #if FARBR_FILES 00178 WriteLuts( "DoNDim",1,aElutAdrSize,aElutWordSize,ein_lut, 00179 aXlutInDim,aXlutOutDim,aXlutAdrSize,aXlutWordSize,(LH_UINT16 *)Xlut,aAlutAdrSize,aAlutWordSize,(LH_UINT16 *)aus_lut); 00180 #endif 00181 00182 i=0; 00183 00184 00185 if( calcParam->copyAlpha )aCopyAlpha = 1; 00186 else aCopyAlpha = 0; 00187 if( aXlutInDim > 7 || aXlutOutDim > 7 )aCopyAlpha = 0; 00188 if( aInputPackMode8Bit != aOutputPackMode8Bit )aCopyAlpha = 0; 00189 00190 nDim=aXlutInDim; 00191 00192 if( aInputPackMode8Bit ){ 00193 aElutShift = aElutAdrShift-8; 00194 if( aElutShift < 0 ) 00195 { 00196 #ifdef DEBUG_OUTPUT 00197 DebugPrint("� DoNDim-Error: aElutShift < 0 (aElutShift = %d)\n",aElutShift); 00198 #endif 00199 return cmparamErr; 00200 } 00201 } 00202 else{ 00203 aElutShift = 16-aElutAdrShift; 00204 if( aElutShift < 0 ) 00205 { 00206 #ifdef DEBUG_OUTPUT 00207 DebugPrint("� DoNDim-Error: aElutShift < 0 (aElutShift = %d)\n",aElutShift); 00208 #endif 00209 return cmparamErr; 00210 } 00211 } 00212 00213 if( aOutputPackMode8Bit ){ 00214 aAlutShift = (aAlutWordSize-8); 00215 } 00216 else{ 00217 aAlutShift = (16 - aAlutWordSize); 00218 } 00219 00220 #ifdef DEBUG_OUTPUT 00221 if ( DebugCheck(kThisFile, kDebugReserved1) ){ 00222 DebugPrint("aElutAdrSize=%lx,aElutAdrShift=%lx,aElutWordSize=%lx,ein_lut=%lx,\n", 00223 aElutAdrSize,aElutAdrShift,aElutWordSize,ein_lut); 00224 DebugPrint("aAlutAdrSize=%lx,aAlutAdrShift=%lx,aAlutWordSize=%lx,aus_lut=%lx,\n", 00225 aAlutAdrSize,aAlutAdrShift,aAlutWordSize,aus_lut); 00226 DebugPrint("aXlutInDim=%lx,aXlutOutDim=%lx,aXlutAdrSize=%lx,aXlutAdrShift=%lx,aXlutWordSize=%lx,Xlut=%lx,\n", 00227 aXlutInDim,aXlutOutDim,aXlutAdrSize,aXlutAdrShift,aXlutWordSize,Xlut); 00228 DebugPrint("aInputPackMode8Bit=%lx,aOutputPackMode8Bit=%lx\n", 00229 aInputPackMode8Bit,aOutputPackMode8Bit ); 00230 } 00231 #endif 00232 aElutShiftNum = 1<<aElutShift; 00233 00234 /*if( 1 )*/ 00235 if( aXlutAdrSize != (1<<aXlutAdrShift )){ 00236 register long aXlutOffset; 00237 #if FARBR_DEBUG 00238 register long aXlutPlaneOffset; 00239 #endif 00240 long theXlutOffsets[8]; 00241 register unsigned long aAlutInShift; 00242 register long aAlutInShiftRemainder; 00243 register unsigned long aAlutInShiftNum; 00244 register long aElutWordSizeMask = (1<<aElutWordSize) - 1; 00245 register unsigned long aAlutRound; 00246 aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift; 00247 aAlutInShiftRemainder = 0; 00248 if( aAlutInShift > 16 ){ 00249 aAlutInShiftRemainder = aAlutInShift - 16; 00250 aAlutInShift = 16; 00251 } 00252 aAlutInShiftNum = (1<<aAlutInShift); 00253 00254 #ifdef DEBUG_OUTPUT 00255 if ( DebugCheck(kThisFile, kDebugMiscInfo) ) 00256 DebugPrint(" DoNDim gripoints = %ld\n",aXlutAdrSize); 00257 #endif 00258 if( aElutWordSize <= 0 ){ 00259 #ifdef DEBUG_OUTPUT 00260 DebugPrint("� DoNDim-Error: (1<<aElutWordSize)/aXlutAdrSize <= 0 %d\n",(1<<aElutWordSize)/aXlutAdrSize); 00261 #endif 00262 return cmparamErr; 00263 } 00264 if( aAlutInShift <= 0 ){ 00265 #ifdef DEBUG_OUTPUT 00266 DebugPrint("� DoNDim-Error: aAlutInShift <= 0 %d\n",aAlutInShift); 00267 #endif 00268 return cmparamErr; 00269 } 00270 aXlutOffset =aXlutOutDim; 00271 for( i=0; i<(long)nDim; i++){ 00272 theXlutOffsets[ nDim-1-i] = aXlutOffset; 00273 aXlutOffset *=aXlutAdrSize; 00274 } 00275 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 00276 00277 #ifdef DEBUG_OUTPUT 00278 if ( DebugCheck(kThisFile, kDebugReserved1) ) 00279 DebugPrint(" aElutWordSize((1<<aElutWordSize)-0) = %ld\n aAlutInShift:((1<<aXlutWordSize)*aElutWordSize+(aAlutAdrSize/2))/aAlutAdrSize = %ld\n",aElutWordSize,aAlutInShift); 00280 #endif 00281 00282 while (LineCount){ 00283 i = Pixelcount; 00284 00285 while (i){ 00286 00287 long adr[8],Index[8]; 00288 LH_UINT16 ein_reg[8]; 00289 register unsigned long adrAdr,ko,adrOffset; 00290 00291 adr0=0; 00292 aElutOffset = 0; 00293 jj=0; 00294 if( aInputPackMode8Bit ){ 00295 for( ii=0; ii<nDim; ii++){ 00296 jj=ein_lut[((*(LH_UINT8 *)&ein_Cache[ii]=*inputData[ii])<<aElutShift)+aElutOffset]; 00297 jj *= aXlutAdrSize; 00298 aElutOffset += aElutAdrSize; 00299 adr[ii] = jj & aElutWordSizeMask; 00300 jj = jj >> aElutWordSize; 00301 adr0 += (jj)*theXlutOffsets[ii]; 00302 ein_reg[ii] = (LH_UINT16)jj; 00303 } 00304 } 00305 else{ 00306 for( ii=0; ii<nDim; ii++){ 00307 jj=ein_Cache[ii]=(*(LH_UINT16 *)inputData[ii]); 00308 ko0 = jj - ( jj >> ( aElutAdrShift )); 00309 ko = ko0 & ( aElutShiftNum - 1 ); 00310 ko0 = ko0 >> aElutShift; 00311 ko0 += aElutOffset; 00312 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00313 00314 jj *= aXlutAdrSize; 00315 aElutOffset += aElutAdrSize; 00316 adr[ii] = jj & aElutWordSizeMask; 00317 jj = jj >> aElutWordSize; 00318 adr0 += (jj)*theXlutOffsets[ii]; 00319 ein_reg[ii] = (LH_UINT16)jj; 00320 } 00321 } 00322 00323 #if FARBR_DEBUG 00324 aXlutPlaneOffset = nDim; 00325 DebugPrint("i=%ld o=%ld\n",i,o); 00326 if( aInputPackMode < k3ShortsUnpacked ){ DebugPrint("ein_arr=(d)");for(ii=0; ii<nDim; ++ii) DebugPrint("%ld ",ein_arr[i+ii]); DebugPrint("\n");} 00327 else{ DebugPrint("ein_arr=(d)");for(ii=0; ii<nDim; ++ii) DebugPrint("%ld ",aEinArr[i+ii]); DebugPrint("\n");} 00328 DebugPrint("ein_reg=(d)");for(ii=0; ii<nDim; ++ii) DebugPrint("%ld ",ein_reg[ii]/aXlutAdrSize); DebugPrint("\n"); 00329 DebugPrint("adr=(d)");for( ii=0; ii<nDim; ++ii) DebugPrint("%ld ",adr[ii] ); DebugPrint("\n"); 00330 #endif 00331 00332 { /* a kind of*/ 00333 register unsigned long Top, Gap; 00334 register long Hold,Switches; 00335 00336 Gap = nDim; 00337 00338 for( ii=0; ii<nDim; ++ii){ 00339 Index[ii] = ii; 00340 } 00341 do{ 00342 /*Gap = (Gap * 10 ) / SHRINK_FACTOR;*/ 00343 Gap = (Gap * ((10*16)/SHRINK_FACTOR) ) >>4; 00344 if( Gap == 0 ) Gap = 1; 00345 Switches = 0; 00346 Top = nDim - Gap; 00347 for( ii=0; ii<Top; ++ii){ 00348 jj = ii + Gap; 00349 if( adr[Index[ii]] < adr[Index[jj]] ){ 00350 Hold = Index[ii]; 00351 Index[ii] = Index[jj]; 00352 Index[jj] = Hold; 00353 Switches = 1; 00354 } 00355 } 00356 }while( Switches || Gap > 1 ); 00357 } 00358 #if FARBR_DEBUG 00359 DebugPrint("Index="); 00360 for( ii=0; ii<nDim; ++ii){ 00361 DebugPrint("%3ld ",Index[ii] ); 00362 } 00363 DebugPrint("\n"); 00364 #endif 00365 00366 for( jj=0; jj<aXlutOutDim; ++jj)accu[jj]=0; 00367 00368 ko0 = (1<<aElutWordSize); 00369 adrAdr=adr0; 00370 adrOffset=0; 00371 if( aXlutWordSize == 16 ){ 00372 for( ii=0; ii<nDim; ++ii){ 00373 jj = Index[ii]; 00374 ko = ko0 - adr[jj]; 00375 ko0 = adr[jj]; 00376 00377 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00378 adrOffset += theXlutOffsets[jj]; 00379 00380 for( jj=0; jj<aXlutOutDim; ++jj){ 00381 #if FARBR_DEBUG 00382 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj*aXlutPlaneOffset),Xlut[adrAdr+(jj*aXlutPlaneOffset)],ko); 00383 #endif 00384 accu[jj]+=Xlut[adrAdr+(jj)]*ko; 00385 } 00386 00387 adrAdr = (adr0 + adrOffset); 00388 } 00389 for( jj=0; jj<aXlutOutDim; ++jj){ 00390 #if FARBR_DEBUG 00391 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj*aXlutPlaneOffset),Xlut[adrAdr+(jj*aXlutPlaneOffset)],ko0); 00392 #endif 00393 accu[jj]+=Xlut[adrAdr+jj]*ko0; 00394 } 00395 } 00396 else{ 00397 00398 for( ii=0; ii<nDim; ++ii){ 00399 jj = Index[ii]; 00400 ko = ko0 - adr[jj]; 00401 ko0 = adr[jj]; 00402 00403 if( ein_reg[jj] < (LH_UINT16)(aXlutAdrSize-1) ) 00404 adrOffset += theXlutOffsets[jj]; 00405 00406 for( jj=0; jj<aXlutOutDim; ++jj){ 00407 #if FARBR_DEBUG 00408 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj*aXlutPlaneOffset),Xlut[adrAdr+(jj*aXlutPlaneOffset)],ko); 00409 #endif 00410 accu[jj]+=((LH_UINT8 *)Xlut)[adrAdr+(jj)]*ko; 00411 } 00412 00413 adrAdr = (adr0 + adrOffset); 00414 } 00415 for( jj=0; jj<aXlutOutDim; ++jj){ 00416 #if FARBR_DEBUG 00417 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj*aXlutPlaneOffset),Xlut[adrAdr+(jj*aXlutPlaneOffset)],ko0); 00418 #endif 00419 accu[jj]+=((LH_UINT8 *)Xlut)[adrAdr+jj]*ko0; 00420 /*ii = accu[jj]+((LH_UINT8 *)Xlut)[adrAdr+jj]*ko0; 00421 accu[jj] = ii +( ii >> 8 );*/ 00422 } 00423 } 00424 00425 #if FARBR_DEBUG 00426 DebugPrint("accu=(d)");for( ii=0; ii<aXlutOutDim; ++ii) DebugPrint("%3ld ",accu[ii] ); DebugPrint("\n"); 00427 #endif 00428 aAlutOffset = 0; 00429 00430 if( aOutputPackMode8Bit ){ 00431 for( ii=0; ii<aXlutOutDim; ++ii){ 00432 #if FARBR_DEBUG 00433 ii = ((accu[ii]) >> aAlutInShift)+aAlutOffset; 00434 DebugPrint("adr:((accu[ii]) >> aAlutInShift)+aAlutOffset = %ld\n",ii); 00435 DebugPrint("aus_lut[%ld]=%ld aus_lut[%ld]=%ld aus_lut[%ld]=%ld \n",ii-1,aus_lut[ii-1],ii,aus_lut[ii],ii+1,aus_lut[ii+1]); 00436 #endif 00437 jj = accu[ii]; 00438 jj = jj + ( jj >> aXlutWordSize ); 00439 00440 ko0 = (jj - ( jj >> ( aAlutAdrShift ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00441 00442 ko = ko0 & (aAlutInShiftNum - 1 ); 00443 ko0 = ko0 >> aAlutInShift; 00444 ko0 += aAlutOffset; 00445 if( aAlutWordSize <= 8) 00446 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 00447 else{ 00448 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 00449 jj = jj - ( jj >> aAlutShift ); 00450 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 00451 } 00452 *outputData[ii] = (LH_UINT8)jj; 00453 aAlutOffset += aAlutAdrSize; 00454 } 00455 } 00456 else{ 00457 if( aXlutWordSize >= 16 ){ 00458 for( ii=0; ii<aXlutOutDim; ++ii){ 00459 jj = accu[ii]; 00460 jj = jj + ( jj >> aXlutWordSize ); 00461 ko0 = (jj - ( jj >> ( aAlutAdrShift ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00462 00463 ko = ko0 & (aAlutInShiftNum - 1 ); 00464 ko0 = ko0 >> aAlutInShift; 00465 ko0 += aAlutOffset; 00466 if( aAlutWordSize <= 8) 00467 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00468 else 00469 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00470 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00471 aAlutOffset += aAlutAdrSize; 00472 } 00473 } 00474 else{ 00475 for( ii=0; ii<aXlutOutDim; ++ii){ 00476 jj = accu[ii]; 00477 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 00478 ko0 = (jj - ( jj >> ( aAlutAdrShift ))) ; /* aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00479 00480 ko = ko0 & (aAlutInShiftNum - 1 ); 00481 ko0 = ko0 >> aAlutInShift; 00482 ko0 += aAlutOffset; 00483 if( aAlutWordSize <= 8) 00484 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00485 else 00486 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00487 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00488 aAlutOffset += aAlutAdrSize; 00489 } 00490 } 00491 } 00492 #if FARBR_DEBUG 00493 if( aOutputPackMode8Bit ){DebugPrint("outputData=(d)");for( ii=0; ii<aXlutOutDim; ++ii) DebugPrint("%3ld ",outputData[ii+o] ); DebugPrint("\n");} 00494 else{DebugPrint("outputData=(d)");for( ii=0; ii<aXlutOutDim; ++ii) DebugPrint("%3ld ",aAusArr[ii+o] ); DebugPrint("\n");} 00495 #endif 00496 if( aCopyAlpha ){ 00497 if( aOutputPackMode8Bit ) 00498 *outputData[aXlutOutDim] = *inputData[aXlutInDim]; 00499 else 00500 *((LH_UINT16 *)outputData[aXlutOutDim]) = *((LH_UINT16 *)inputData[aXlutInDim]); 00501 } 00502 while (--i){ 00503 for( jj=0; jj<aXlutInDim; ++jj){ 00504 inputData[jj] += InputIncrement; 00505 } 00506 for( jj=0; jj<aXlutOutDim; ++jj){ 00507 outputData[jj] += OutputIncrement; 00508 } 00509 if( aCopyAlpha ){ 00510 inputData[aXlutInDim] += InputIncrement; 00511 outputData[aXlutOutDim] += OutputIncrement; 00512 } 00513 00514 if( aInputPackMode8Bit ){ 00515 for( jj=0; jj<aXlutInDim; ++jj){ 00516 if( *inputData[jj] ^ *(LH_UINT8 *)(&ein_Cache[jj]) )break; 00517 } 00518 } 00519 else{ 00520 for( jj=0; jj<aXlutInDim; ++jj){ 00521 if( *((LH_UINT16 *)inputData[jj]) ^ ein_Cache[jj] )break; 00522 } 00523 } 00524 if( jj<aXlutInDim ) break; 00525 if( aOutputPackMode8Bit ){ 00526 for( jj=0; jj<aXlutOutDim; ++jj){ 00527 *outputData[jj] = outputData[jj][-(long)OutputIncrement]; 00528 } 00529 if( aCopyAlpha ){ 00530 *outputData[aXlutOutDim] = *inputData[aXlutInDim]; 00531 } 00532 } 00533 else{ 00534 for( jj=0; jj<aXlutOutDim; ++jj){ 00535 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)OutputIncrement]); 00536 } 00537 if( aCopyAlpha ){ 00538 *((LH_UINT16 *)outputData[aXlutOutDim]) = *((LH_UINT16 *)inputData[aXlutInDim]); 00539 } 00540 } 00541 } 00542 } 00543 00544 if( --LineCount ){ 00545 for( jj=0; jj<aXlutInDim; ++jj){ 00546 inputData[jj] += inputDataRowOffset; 00547 } 00548 for( jj=0; jj<aXlutOutDim; ++jj){ 00549 outputData[jj] += outputDataRowOffset; 00550 } 00551 if( aCopyAlpha ){ 00552 inputData[aXlutInDim] += inputDataRowOffset; 00553 outputData[aXlutOutDim] += outputDataRowOffset; 00554 } 00555 } 00556 } 00557 } 00558 else{ 00559 00560 register unsigned long bit_breit_selektor; 00561 register unsigned long bit_maske_selektor; 00562 register unsigned long bit_breit_adr; 00563 register unsigned long bit_maske_adr; 00564 register unsigned long aAlutInShiftNum; 00565 register long aAlutInShift; 00566 register long aAlutInShiftRemainder; 00567 register unsigned long aAlutRound; 00568 /*register long aXlutPlaneShift = aXlutAdrShift*aXlutInDim;*/ 00569 bit_breit_selektor=aElutWordSize-aXlutAdrShift; 00570 if( aElutWordSize-aXlutAdrShift < 0 ) 00571 { 00572 #ifdef DEBUG_OUTPUT 00573 DebugPrint("� DoNDim-Error: bit_breit_selektor < 0 (bit_breit_selektor = %d)\n",bit_breit_selektor); 00574 #endif 00575 return cmparamErr; 00576 } 00577 bit_maske_selektor=(1<<bit_breit_selektor)-1; 00578 bit_breit_adr=aXlutAdrShift; 00579 bit_maske_adr=((1<<bit_breit_adr)-1)<<bit_breit_selektor; 00580 aAlutInShift = (aXlutWordSize+bit_breit_selektor-aAlutAdrShift); 00581 /*aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00582 aAlutInShiftRemainder = 0; 00583 if( aAlutInShift > 16 ){ 00584 aAlutInShiftRemainder = aAlutInShift - 16; 00585 aAlutInShift = 16; 00586 } 00587 00588 aAlutInShiftNum = (1<<aAlutInShift); 00589 00590 aAlutRound = 1<<( aAlutInShift + aAlutShift - 1 ); 00591 while (LineCount){ 00592 i = Pixelcount; 00593 00594 while (i){ 00595 00596 long adr[8],Index[8]; 00597 /*LH_UINT16 *ein_lut = (LH_UINT16 *)ein_lut;*/ 00598 LH_UINT16 ein_reg[8]; 00599 register unsigned long adrAdr,ko,adrOffset; 00600 /*register unsigned long aIndex;*/ 00601 00602 adr0=0; 00603 aElutOffset = 0; 00604 jj=0; 00605 if( aInputPackMode8Bit ){ 00606 for( ii=0; ii<nDim; ii++){ 00607 jj=ein_lut[((*(LH_UINT8 *)&ein_Cache[ii]=*inputData[ii])<<aElutShift)+aElutOffset]; 00608 aElutOffset += aElutAdrSize; 00609 adr[ii] = (jj & bit_maske_selektor); 00610 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((nDim-ii-1)*bit_breit_adr); 00611 ein_reg[ii] = (LH_UINT16)jj; 00612 } 00613 } 00614 else{ 00615 for( ii=0; ii<nDim; ii++){ 00616 jj=ein_Cache[ii]=(*(LH_UINT16 *)inputData[ii]); 00617 ko0 = jj - ( jj >> ( aElutAdrShift )); 00618 ko = ko0 & ( aElutShiftNum - 1 ); 00619 ko0 = ko0 >> aElutShift; 00620 ko0 += aElutOffset; 00621 jj = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 +1 ] * ko ) >> aElutShift; 00622 00623 aElutOffset += aElutAdrSize; 00624 adr[ii] = (jj & bit_maske_selektor); 00625 adr0 |= ((jj & bit_maske_adr)>>bit_breit_selektor)<<((nDim-ii-1)*bit_breit_adr); 00626 ein_reg[ii] = (LH_UINT16)jj; 00627 } 00628 } 00629 00630 adr0 *= aXlutOutDim; 00631 #if FARBR_DEBUG 00632 DebugPrint("i=%ld o=%ld\n",i,o); 00633 DebugPrint("adr0=%ld\n",adr0); 00634 if( aInputPackMode < k3ShortsUnpacked ){ DebugPrint("ein_arr=(d)");for(ii=0; ii<nDim; ++ii) DebugPrint("%ld ",ein_arr[i+ii]); DebugPrint("\n");} 00635 else{ DebugPrint("ein_arr=(d)");for(ii=0; ii<nDim; ++ii) DebugPrint("%ld ",aEinArr[i+ii]); DebugPrint("\n");} 00636 DebugPrint("ein_reg=(d)");for(ii=0; ii<nDim; ++ii) DebugPrint("%ld ",ein_reg[ii]); DebugPrint("\n"); 00637 DebugPrint("adr=(d)");for( ii=0; ii<nDim; ++ii) DebugPrint("%ld ",adr[ii] ); DebugPrint("\n"); 00638 #endif 00639 00640 { /* a kind of */ 00641 register unsigned long Top, Gap; 00642 register long Hold,Switches; 00643 00644 Gap = nDim; 00645 00646 for( ii=0; ii<nDim; ++ii){ 00647 Index[ii] = ii; 00648 } 00649 do{ 00650 /*Gap = (Gap * 10 ) / SHRINK_FACTOR;*/ 00651 Gap = (Gap * ((10*16)/SHRINK_FACTOR) ) >>4; 00652 if( Gap == 0 ) Gap = 1; 00653 Switches = 0; 00654 Top = nDim - Gap; 00655 for( ii=0; ii<Top; ++ii){ 00656 jj = ii + Gap; 00657 if( adr[Index[ii]] < adr[Index[jj]] ){ 00658 Hold = Index[ii]; 00659 Index[ii] = Index[jj]; 00660 Index[jj] = Hold; 00661 Switches = 1; 00662 } 00663 } 00664 }while( Switches || Gap > 1 ); 00665 } 00666 #if FARBR_DEBUG 00667 DebugPrint("Index="); 00668 for( ii=0; ii<nDim; ++ii){ 00669 DebugPrint("%3ld ",Index[ii] ); 00670 } 00671 DebugPrint("\n"); 00672 #endif 00673 00674 for( jj=0; jj<aXlutOutDim; ++jj)accu[jj]=0; 00675 00676 ko0 = bit_maske_selektor+1; 00677 adrAdr=adr0; 00678 adrOffset=0; 00679 00680 if( aXlutWordSize == 16 ){ 00681 for( ii=0; ii<nDim; ++ii){ 00682 jj = Index[ii]; 00683 ko = ko0 - adr[jj]; 00684 ko0 = adr[jj]; 00685 00686 if( ein_reg[jj] < bit_maske_adr ) 00687 adrOffset |= (1<<(nDim-1-jj)*bit_breit_adr); 00688 00689 for( jj=0; jj<aXlutOutDim; ++jj){ 00690 #if FARBR_DEBUG 00691 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj),Xlut[adrAdr+(jj)],ko); 00692 #endif 00693 accu[jj]+=Xlut[adrAdr+(jj)]*ko; 00694 } 00695 00696 adrAdr = (adr0 + aXlutOutDim*adrOffset); 00697 } 00698 for( jj=0; jj<aXlutOutDim; ++jj){ 00699 #if FARBR_DEBUG 00700 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj),Xlut[adrAdr+(jj)],ko0); 00701 #endif 00702 accu[jj]+=Xlut[adrAdr+(jj)]*ko0; 00703 } 00704 } 00705 else{ 00706 00707 for( ii=0; ii<nDim; ++ii){ 00708 jj = Index[ii]; 00709 ko = ko0 - adr[jj]; 00710 ko0 = adr[jj]; 00711 00712 if( ein_reg[jj] < bit_maske_adr ) 00713 adrOffset |= (1<<(nDim-1-jj)*bit_breit_adr); 00714 00715 for( jj=0; jj<aXlutOutDim; ++jj){ 00716 #if FARBR_DEBUG 00717 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj),Xlut[adrAdr+(jj)],ko); 00718 #endif 00719 accu[jj]+=((LH_UINT8 *)Xlut)[adrAdr+(jj)]*ko; 00720 } 00721 00722 adrAdr = (adr0 + aXlutOutDim*adrOffset); 00723 } 00724 for( jj=0; jj<aXlutOutDim; ++jj){ 00725 #if FARBR_DEBUG 00726 DebugPrint("jj=(d)%ld adrAdr=%lx Address=%lx Xlut[Address]=(d)%ld ko=(d)%ld\n",jj,adrAdr,adrAdr+(jj),Xlut[adrAdr+(jj)],ko0); 00727 #endif 00728 accu[jj]+=((LH_UINT8 *)Xlut)[adrAdr+(jj)]*ko0; 00729 } 00730 } 00731 00732 #if FARBR_DEBUG 00733 DebugPrint("accu=(d)");for( ii=0; ii<aXlutOutDim; ++ii) DebugPrint("%3ld ",accu[ii] ); DebugPrint("\n"); 00734 #endif 00735 aAlutOffset = 0; 00736 00737 if( aOutputPackMode8Bit ){ 00738 for( ii=0; ii<aXlutOutDim; ++ii){ 00739 #if FARBR_DEBUG 00740 ii = ((accu[ii]) >> aAlutInShift)+aAlutOffset; 00741 DebugPrint("adr:((accu[ii]) >> aAlutInShift)+aAlutOffset = %ld\n",ii); 00742 DebugPrint("aus_lut[%ld]=%ld aus_lut[%ld]=%ld aus_lut[%ld]=%ld \n",ii-1,aus_lut[ii-1],ii,aus_lut[ii],ii+1,aus_lut[ii+1]); 00743 #endif 00744 jj = accu[ii]; 00745 jj = jj + ( jj >> aXlutWordSize ); 00746 00747 ko0 = (jj - ( jj >> ( aAlutAdrShift ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00748 00749 ko = ko0 & (aAlutInShiftNum - 1 ); 00750 ko0 = ko0 >> aAlutInShift; 00751 ko0 += aAlutOffset; 00752 if( aAlutWordSize <= 8) 00753 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) >> ( aAlutInShift ); 00754 else{ 00755 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ); 00756 jj = jj - ( jj >> aAlutShift ); 00757 jj = ( jj + aAlutRound ) >> (aAlutInShift + aAlutShift); 00758 } 00759 00760 *outputData[ii] = (LH_UINT8)jj; 00761 aAlutOffset += aAlutAdrSize; 00762 } 00763 } 00764 else{ 00765 if( aXlutWordSize >= 16 ){ 00766 for( ii=0; ii<aXlutOutDim; ++ii){ 00767 jj = accu[ii]; 00768 jj = jj + ( jj >> aXlutWordSize ); 00769 ko0 = (jj - ( jj >> ( aAlutAdrShift ))) >> aAlutInShiftRemainder; /* aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00770 00771 ko = ko0 & (aAlutInShiftNum - 1 ); 00772 ko0 = ko0 >> aAlutInShift; 00773 ko0 += aAlutOffset; 00774 if( aAlutWordSize <= 8) 00775 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00776 else 00777 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00778 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00779 aAlutOffset += aAlutAdrSize; 00780 } 00781 } 00782 else{ 00783 for( ii=0; ii<aXlutOutDim; ++ii){ 00784 jj = accu[ii]; 00785 jj = jj + ( jj >> aXlutWordSize ) + ( jj >> 2*aXlutWordSize ); 00786 ko0 = (jj - ( jj >> ( aAlutAdrShift ))); /* aAlutInShift = aXlutWordSize + aElutWordSize - aAlutAdrShift;*/ 00787 00788 ko = ko0 & (aAlutInShiftNum - 1 ); 00789 ko0 = ko0 >> aAlutInShift; 00790 ko0 += aAlutOffset; 00791 if( aAlutWordSize <= 8) 00792 jj = ( ((LH_UINT8*)aus_lut)[ ko0 ] * ( aAlutInShiftNum - ko ) + ((LH_UINT8*)aus_lut)[ ko0 +1 ] * ko ) << ( aAlutShift - aAlutInShift ); 00793 else 00794 jj = ( aus_lut[ ko0 ] * ( aAlutInShiftNum - ko ) + aus_lut[ ko0 +1 ] * ko ) >> (aAlutInShift- aAlutShift); 00795 *((LH_UINT16 *)outputData[ii]) = (LH_UINT16)jj; 00796 aAlutOffset += aAlutAdrSize; 00797 } 00798 } 00799 } 00800 00801 #if FARBR_DEBUG 00802 if( aOutputPackMode < k3ShortsUnpacked ){DebugPrint("aus_arr=(d)");for( ii=0; ii<aXlutOutDim; ++ii) DebugPrint("%3ld ",aus_arr[ii+o] ); DebugPrint("\n");} 00803 else{DebugPrint("aus_arr=(d)");for( ii=0; ii<aXlutOutDim; ++ii) DebugPrint("%3ld ",aAusArr[ii+o] ); DebugPrint("\n");} 00804 #endif 00805 if( aCopyAlpha ){ 00806 if( aOutputPackMode8Bit ) 00807 *outputData[aXlutOutDim] = *inputData[aXlutInDim]; 00808 else 00809 *((LH_UINT16 *)outputData[aXlutOutDim]) = *((LH_UINT16 *)inputData[aXlutInDim]); 00810 } 00811 while (--i){ 00812 for( jj=0; jj<aXlutInDim; ++jj){ 00813 inputData[jj] += InputIncrement; 00814 } 00815 for( jj=0; jj<aXlutOutDim; ++jj){ 00816 outputData[jj] += OutputIncrement; 00817 } 00818 if( aCopyAlpha ){ 00819 inputData[aXlutInDim] += InputIncrement; 00820 outputData[aXlutOutDim] += OutputIncrement; 00821 } 00822 00823 if( aInputPackMode8Bit ){ 00824 for( jj=0; jj<aXlutInDim; ++jj){ 00825 if( *inputData[jj] ^ *(LH_UINT8 *)(&ein_Cache[jj]) )break; 00826 } 00827 } 00828 else{ 00829 for( jj=0; jj<aXlutInDim; ++jj){ 00830 if( *((LH_UINT16 *)inputData[jj]) ^ ein_Cache[jj] )break; 00831 } 00832 } 00833 if( jj<aXlutInDim ) break; 00834 if( aOutputPackMode8Bit ){ 00835 for( jj=0; jj<aXlutOutDim; ++jj){ 00836 *outputData[jj] = outputData[jj][-(long)OutputIncrement]; 00837 } 00838 if( aCopyAlpha ){ 00839 *outputData[aXlutOutDim] = *inputData[aXlutInDim]; 00840 } 00841 } 00842 else{ 00843 for( jj=0; jj<aXlutOutDim; ++jj){ 00844 *((LH_UINT16 *)outputData[jj]) = *(LH_UINT16 *)(&outputData[jj][-(long)OutputIncrement]); 00845 } 00846 if( aCopyAlpha ){ 00847 *((LH_UINT16 *)outputData[aXlutOutDim]) = *((LH_UINT16 *)inputData[aXlutInDim]); 00848 } 00849 } 00850 } 00851 } 00852 00853 if( --LineCount ){ 00854 for( jj=0; jj<aXlutInDim; ++jj){ 00855 inputData[jj] += inputDataRowOffset; 00856 } 00857 for( jj=0; jj<aXlutOutDim; ++jj){ 00858 outputData[jj] += outputDataRowOffset; 00859 } 00860 if( aCopyAlpha ){ 00861 inputData[aXlutInDim] += inputDataRowOffset; 00862 outputData[aXlutOutDim] += outputDataRowOffset; 00863 } 00864 } 00865 } 00866 } 00867 00868 /* UNLOCK_DATA( aElutHdle ); */ 00869 /* UNLOCK_DATA( aAlutHdle ); */ 00870 /* UNLOCK_DATA( aXlutHdle ); */ 00871 00872 LH_END_PROC("CalcNDim_Data8To8_Lut16") 00873 return noErr; 00874 }

CMError CalcNDim_Data8To8_Lut8 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 907 of file lh_core/calcndim.c.

Referenced by FindCalcRoutine().

00909 { 00910 return CalcNDim_Data8To8_Lut16( calcParam, lutParam ); 00911 }


Generated on Sat May 15 19:43:01 2004 for test by doxygen 1.3.7