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

calcnd3.c File Reference

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

Go to the source code of this file.

Defines

#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)))
#define UNROLL_NDIM   1
#define NDIM_IN_DIM   3
#define NDIM_OUT_DIM   3
#define aElutShift   (16-adr_breite_elut)
#define aElutShiftNum   (1<<aElutShift)
#define NDIM_IN_DIM   3
#define NDIM_OUT_DIM   4
#define aElutShift   (16-adr_breite_elut)
#define aElutShiftNum   (1<<aElutShift)
#define NDIM_IN_DIM   4
#define NDIM_OUT_DIM   3
#define aElutShift   (16-adr_breite_elut)
#define aElutShiftNum   (1<<aElutShift)
#define NDIM_IN_DIM   4
#define NDIM_OUT_DIM   4
#define aElutShift   (16-adr_breite_elut)
#define aElutShiftNum   (1<<aElutShift)

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)


Define Documentation

#define aElutShift   (16-adr_breite_elut)
 

Definition at line 2815 of file lh_core/calcnd3.c.

#define aElutShift   (16-adr_breite_elut)
 

Definition at line 2815 of file lh_core/calcnd3.c.

#define aElutShift   (16-adr_breite_elut)
 

Definition at line 2815 of file lh_core/calcnd3.c.

#define aElutShift   (16-adr_breite_elut)
 

Definition at line 2815 of file lh_core/calcnd3.c.

Referenced by Calc323Dim_Data8To8_Lut16(), Calc324Dim_Data8To8_Lut16(), Calc423Dim_Data8To8_Lut16(), Calc424Dim_Data8To8_Lut16(), CalcNDim_Data8To8_Lut16(), and DoMatrixForCube16().

#define aElutShiftNum   (1<<aElutShift)
 

Definition at line 2816 of file lh_core/calcnd3.c.

#define aElutShiftNum   (1<<aElutShift)
 

Definition at line 2816 of file lh_core/calcnd3.c.

#define aElutShiftNum   (1<<aElutShift)
 

Definition at line 2816 of file lh_core/calcnd3.c.

#define aElutShiftNum   (1<<aElutShift)
 

Definition at line 2816 of file lh_core/calcnd3.c.

Referenced by Calc323Dim_Data8To8_Lut16(), Calc324Dim_Data8To8_Lut16(), Calc423Dim_Data8To8_Lut16(), Calc424Dim_Data8To8_Lut16(), CalcNDim_Data8To8_Lut16(), and DoMatrixForCube16().

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

Definition at line 32 of file lh_core/calcnd3.c.

Referenced by DoOnlyMatrixForCube(), and DoOnlyMatrixForCube16().

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

Definition at line 31 of file lh_core/calcnd3.c.

#define DebugPrint  ) 
 

Definition at line 28 of file lh_core/calcnd3.c.

#define NDIM_IN_DIM   4
 

Definition at line 2813 of file lh_core/calcnd3.c.

#define NDIM_IN_DIM   4
 

Definition at line 2813 of file lh_core/calcnd3.c.

#define NDIM_IN_DIM   3
 

Definition at line 2813 of file lh_core/calcnd3.c.

#define NDIM_IN_DIM   3
 

Definition at line 2813 of file lh_core/calcnd3.c.

Referenced by Calc323Dim_Data8To8_Lut16(), Calc324Dim_Data8To8_Lut16(), Calc423Dim_Data8To8_Lut16(), and Calc424Dim_Data8To8_Lut16().

#define NDIM_OUT_DIM   4
 

Definition at line 2814 of file lh_core/calcnd3.c.

#define NDIM_OUT_DIM   3
 

Definition at line 2814 of file lh_core/calcnd3.c.

#define NDIM_OUT_DIM   4
 

Definition at line 2814 of file lh_core/calcnd3.c.

#define NDIM_OUT_DIM   3
 

Definition at line 2814 of file lh_core/calcnd3.c.

Referenced by Calc323Dim_Data8To8_Lut16(), Calc324Dim_Data8To8_Lut16(), Calc423Dim_Data8To8_Lut16(), and Calc424Dim_Data8To8_Lut16().

#define UNROLL_NDIM   1
 

Definition at line 34 of file lh_core/calcnd3.c.

Referenced by CalcNDim_Data8To8_Lut16().


Function Documentation

CMError Calc323Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 49 of file lh_core/calcnd3.c.

References adr_bereich_alut, adr_bereich_elut, adr_breite_alut, adr_breite_elut, aElutShift, aElutShiftNum, cm8PerChannelPacking, CMError, CMCalcParam::cmInputBytesPerLine, CMCalcParam::cmInputPixelOffset, CMCalcParam::cmLineCount, cmLong8ColorPacking, CMCalcParam::cmOutputBytesPerLine, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, cmparamErr, CMCalcParam::cmPixelPerLine, CMLutParam::colorLut, CMLutParam::colorLutGridPoints, CMLutParam::colorLutWordSize, DebugPrint, Hold, Index, CMCalcParam::inputData, CMLutParam::inputLut, CMLutParam::inputLutWordSize, LH_END_PROC, LH_START_PROC, LH_UINT16, LH_UINT8, NDIM_IN_DIM, NDIM_OUT_DIM, noErr, CMCalcParam::outputData, CMLutParam::outputLut, CMLutParam::outputLutWordSize, and UINT32.

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

CMError Calc324Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 972 of file lh_core/calcnd3.c.

References adr_bereich_alut, adr_bereich_elut, adr_breite_alut, adr_breite_elut, aElutShift, aElutShiftNum, cm8PerChannelPacking, CMError, CMCalcParam::cmInputBytesPerLine, CMCalcParam::cmInputPixelOffset, CMCalcParam::cmLineCount, cmLong8ColorPacking, CMCalcParam::cmOutputBytesPerLine, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, cmparamErr, CMCalcParam::cmPixelPerLine, CMLutParam::colorLut, CMLutParam::colorLutGridPoints, CMLutParam::colorLutWordSize, DebugPrint, Hold, Index, CMCalcParam::inputData, CMLutParam::inputLut, CMLutParam::inputLutWordSize, LH_END_PROC, LH_START_PROC, LH_UINT16, LH_UINT8, NDIM_IN_DIM, NDIM_OUT_DIM, noErr, CMCalcParam::outputData, CMLutParam::outputLut, CMLutParam::outputLutWordSize, and UINT32.

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

CMError Calc423Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 1895 of file lh_core/calcnd3.c.

References adr_bereich_alut, adr_bereich_elut, adr_breite_alut, adr_breite_elut, aElutShift, aElutShiftNum, cm8PerChannelPacking, CMError, CMCalcParam::cmInputBytesPerLine, CMCalcParam::cmInputPixelOffset, CMCalcParam::cmLineCount, cmLong8ColorPacking, CMCalcParam::cmOutputBytesPerLine, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, cmparamErr, CMCalcParam::cmPixelPerLine, CMLutParam::colorLut, CMLutParam::colorLutGridPoints, CMLutParam::colorLutWordSize, DebugPrint, Hold, Index, CMCalcParam::inputData, CMLutParam::inputLut, CMLutParam::inputLutWordSize, LH_END_PROC, LH_START_PROC, LH_UINT16, LH_UINT8, NDIM_IN_DIM, NDIM_OUT_DIM, noErr, CMCalcParam::outputData, CMLutParam::outputLut, CMLutParam::outputLutWordSize, and UINT32.

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

CMError Calc424Dim_Data8To8_Lut16 CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam
 

Definition at line 2818 of file lh_core/calcnd3.c.

References adr_bereich_alut, adr_bereich_elut, adr_breite_alut, adr_breite_elut, aElutShift, aElutShiftNum, cm8PerChannelPacking, CMError, CMCalcParam::cmInputBytesPerLine, CMCalcParam::cmInputPixelOffset, CMCalcParam::cmLineCount, cmLong8ColorPacking, CMCalcParam::cmOutputBytesPerLine, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, cmparamErr, CMCalcParam::cmPixelPerLine, CMLutParam::colorLut, CMLutParam::colorLutGridPoints, CMLutParam::colorLutWordSize, DebugPrint, Hold, Index, CMCalcParam::inputData, CMLutParam::inputLut, CMLutParam::inputLutWordSize, LH_END_PROC, LH_START_PROC, LH_UINT16, LH_UINT8, NDIM_IN_DIM, NDIM_OUT_DIM, noErr, CMCalcParam::outputData, CMLutParam::outputLut, CMLutParam::outputLutWordSize, and UINT32.

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


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