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

dondim.h File Reference

Go to the source code of this file.

Classes

struct  DoMatrixForCubeStruct

Typedefs

typedef * DoMatrixForCubeStructPtr

Functions

void DoMatrixForCube16 (DoMatrixForCubeStructPtr aStructPtr)
void DoOnlyMatrixForCube16 (Matrix2D *theMatrix, Ptr aXlut, long aPointCount, long gridPointsCube)
void DoOnlyMatrixForCube (Matrix2D *theMatrix, Ptr aXlut, long aPointCount, long gridPointsCube)


Typedef Documentation

typedef * DoMatrixForCubeStructPtr
 

Referenced by DoMatrixForCube16().


Function Documentation

void DoMatrixForCube16 DoMatrixForCubeStructPtr  aStructPtr  ) 
 

Definition at line 130 of file lh_core/dondim.c.

00131 { 00132 register long ii,jj; 00133 register long i; 00134 /*long aLong[3];*/ 00135 register long aLong0; 00136 register long aLong1; 00137 register long aLong2; 00138 register long theEnd; 00139 register long aElutShift,aElutShiftNum,aAlutShift,aElutOffset,aAlutOffset; 00140 register unsigned long aElutAdrSize,separateEluts,separateAluts; 00141 register long aVal; 00142 long aMatrix[3][3]; 00143 register double aFactor,dVal; 00144 register unsigned long aMax; 00145 register UINT16 *ein_lut; 00146 register UINT16 *aus_lut; 00147 register UINT8 *aus_lutByte; 00148 register unsigned long aAlutAdrSize; 00149 register UINT16 *theArr; 00150 register UINT8 *theByteArr; 00151 register unsigned long ko,ko0; 00152 register long aElutShiftRight; 00153 /* FILE *aSt;*/ 00154 00155 #ifdef DEBUG_OUTPUT 00156 long err=0; 00157 #endif 00158 LH_START_PROC("DoMatrixForCube16") 00159 00160 /*DebugPrint("DoMatrixForCube16 with %d input pixels\n",aPointCount);*/ 00161 ein_lut = aStructPtr->ein_lut; 00162 aus_lut = (UINT16 *)aStructPtr->aus_lut; 00163 aus_lutByte = (UINT8 *)aus_lut; 00164 theArr = (UINT16 *)aStructPtr->theArr; 00165 theByteArr = (UINT8 *)theArr; 00166 aAlutAdrSize = aStructPtr->aAlutAdrSize; 00167 aElutAdrSize = aStructPtr->aElutAdrSize; 00168 separateEluts = aStructPtr->separateEluts; 00169 separateAluts = aStructPtr->separateAluts; 00170 theEnd = 3*aStructPtr->aPointCount; 00171 aMax = aAlutAdrSize-1; 00172 00173 for( i=0; i<33; i++) if( (1L<<i) == (long)aElutAdrSize )break; 00174 if( i > 32 ) return; 00175 aElutShift = 16-i; 00176 aElutShiftRight = aStructPtr->aElutWordSize - aElutShift + 0; /* use only 16 bit from elut*/ 00177 if( aElutShiftRight < 0 ) return; 00178 aElutShiftNum = 1<<aElutShift; 00179 00180 aFactor = 2*8. * aMax /(aStructPtr->gridPoints-1)*(double)aStructPtr->gridPoints; 00181 for( ii=0; ii<3; ii++){ 00182 for( jj=0; jj<3; jj++){ 00183 dVal = (*(aStructPtr->theMatrix))[ii][jj]*aFactor; 00184 aMatrix[ii][jj] = (long)Round(dVal); 00185 } 00186 } 00187 #if FARBR_DEBUG 00188 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) DebugPrint("%f ",aMatrix[ii][jj]); DebugPrint("\n"); 00189 /* 00190 aSt = fopen("Matrix","a"); 00191 for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) fprintf(aSt,"%f ",(*(aStructPtr->theMatrix))[ii][jj]); fprintf(aSt,"\n"); 00192 for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) fprintf(aSt,"%d ",aMatrix[ii][jj]); fprintf(aSt,"\n"); 00193 fclose(aSt); 00194 */ 00195 #endif 00196 if( aStructPtr->aBufferByteCount == 2 ){ 00197 aAlutShift = 16-aStructPtr->aAlutWordSize; 00198 for (i = 0; i < theEnd; i +=3){ /* Schleife der Points */ 00199 00200 aElutOffset = 0; 00201 ko = (theArr[i+0]); 00202 ko0 = ko - ( ko >> ( 16 - aElutShift )); 00203 ko = ko0 & ( aElutShiftNum - 1 ); 00204 ko0 = ko0 >> aElutShift; 00205 if( ko0 >= (aElutAdrSize-1) ){ 00206 aLong0 = ein_lut[ ko0 + aElutOffset ]<<(aElutShift-aElutShiftRight); 00207 } 00208 else{ 00209 ko0 += aElutOffset; 00210 aLong0 = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 + 1 ] * ko )>>aElutShiftRight; 00211 } 00212 if( separateEluts )aElutOffset += aElutAdrSize; 00213 00214 ko = (theArr[i+1]); 00215 ko0 = ko - ( ko >> ( 16 - aElutShift )); 00216 ko = ko0 & ( aElutShiftNum - 1 ); 00217 ko0 = ko0 >> aElutShift; 00218 if( ko0 >= (aElutAdrSize-1) ){ 00219 aLong1 = ein_lut[ ko0 + aElutOffset ]<<(aElutShift-aElutShiftRight); 00220 } 00221 else{ 00222 ko0 += aElutOffset; 00223 aLong1 = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 + 1 ] * ko )>>aElutShiftRight; 00224 } 00225 if( separateEluts )aElutOffset += aElutAdrSize; 00226 00227 ko = (theArr[i+2]); 00228 ko0 = ko - ( ko >> ( 16 - aElutShift )); 00229 ko = ko0 & ( aElutShiftNum - 1 ); 00230 ko0 = ko0 >> aElutShift; 00231 if( ko0 >= (aElutAdrSize-1) ){ 00232 aLong2 = ein_lut[ ko0 + aElutOffset ]<<(aElutShift-aElutShiftRight); 00233 } 00234 else{ 00235 ko0 += aElutOffset; 00236 aLong2 = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 + 1 ] * ko )>>aElutShiftRight; 00237 } 00238 00239 aLong0 = ( aLong0 +2 )>>2; 00240 aLong1 = ( aLong1 +2 )>>2; 00241 aLong2 = ( aLong2 +2 )>>2; 00242 aAlutOffset = 0; 00243 for( ii=0; ii<3; ii++){ 00244 aVal = aMatrix[ii][0] * aLong0; 00245 aVal += aMatrix[ii][1] * aLong1; 00246 aVal += aMatrix[ii][2] * aLong2; 00247 aVal = (aVal+((1<<9)-1))>>10; 00248 if( aVal < 0 ) aVal = 0; 00249 00250 ko0= ( aVal>> (3+2+3) ); 00251 if( ko0 >= (aAlutAdrSize-1) ){ 00252 theArr[i+ii] = aus_lut[ (aAlutAdrSize-1) + aAlutOffset ] <<aAlutShift; 00253 } 00254 else{ 00255 ko0 += aAlutOffset; 00256 ko = ( aVal & ((1<<(3+2+3))-1) ); 00257 theArr[i+ii] = (UINT16)(( aus_lut[ ko0 ] * ( (1<<(3+2+3)) - ko ) + aus_lut[ ko0 +1 ] * ko)>>((3+2+3)-aAlutShift)); 00258 } 00259 if( separateAluts )aAlutOffset += aAlutAdrSize; 00260 } 00261 #if FARBR_DEBUG 00262 DebugPrint("i=%ld\n",i); 00263 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) DebugPrint("%ld ",theArr[i+ii]); DebugPrint("\n"); 00264 DebugPrint("ein_reg=(d)");DebugPrint("%ld ",aLong0);DebugPrint("%ld ",aLong1);DebugPrint("%ld ",aLong2); DebugPrint("\n"); 00265 #endif 00266 } 00267 } 00268 else{ 00269 aAlutShift = aStructPtr->aAlutWordSize - 8; 00270 for (i = 0; i < theEnd; i +=3){ /* Schleife der Points*/ 00271 00272 00273 aElutOffset = 0; 00274 ko = (theArr[i+0]); 00275 ko0 = ko - ( ko >> ( 16 - aElutShift )); 00276 ko = ko0 & ( aElutShiftNum - 1 ); 00277 ko0 = ko0 >> aElutShift; 00278 if( ko0 >= (aElutAdrSize-1) ){ 00279 aLong0 = ein_lut[ ko0 + aElutOffset ]<<(aElutShift-aElutShiftRight); 00280 } 00281 else{ 00282 ko0 += aElutOffset; 00283 aLong0 = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 + 1 ] * ko )>>aElutShiftRight; 00284 } 00285 if( separateEluts )aElutOffset += aElutAdrSize; 00286 00287 ko = (theArr[i+1]); 00288 ko0 = ko - ( ko >> ( 16 - aElutShift )); 00289 ko = ko0 & ( aElutShiftNum - 1 ); 00290 ko0 = ko0 >> aElutShift; 00291 if( ko0 >= (aElutAdrSize-1) ){ 00292 aLong1 = ein_lut[ ko0 + aElutOffset ]<<(aElutShift-aElutShiftRight); 00293 } 00294 else{ 00295 ko0 += aElutOffset; 00296 aLong1 = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 + 1 ] * ko )>>aElutShiftRight; 00297 } 00298 if( separateEluts )aElutOffset += aElutAdrSize; 00299 00300 ko = (theArr[i+2]); 00301 ko0 = ko - ( ko >> ( 16 - aElutShift )); 00302 ko = ko0 & ( aElutShiftNum - 1 ); 00303 ko0 = ko0 >> aElutShift; 00304 if( ko0 >= (aElutAdrSize-1) ){ 00305 aLong2 = ein_lut[ ko0 + aElutOffset ]<<(aElutShift-aElutShiftRight); 00306 } 00307 else{ 00308 ko0 += aElutOffset; 00309 aLong2 = ( ein_lut[ ko0 ] * ( aElutShiftNum - ko ) + ein_lut[ ko0 + 1 ] * ko )>>aElutShiftRight; 00310 } 00311 00312 aLong0 = ( aLong0 +2 )>>2; 00313 aLong1 = ( aLong1 +2 )>>2; 00314 aLong2 = ( aLong2 +2 )>>2; 00315 aAlutOffset = 0; 00316 if( aStructPtr->aAlutWordSize > 8 ){ 00317 for( ii=0; ii<3; ii++){ 00318 aVal = aMatrix[ii][0] * aLong0; 00319 aVal += aMatrix[ii][1] * aLong1; 00320 aVal += aMatrix[ii][2] * aLong2; 00321 aVal = (aVal+((1<<12)-1))>>13; 00322 if( aVal < 0 ) aVal = 0; 00323 00324 ko0= (aVal+((1<<(3+2-1))-1)) >> (3+2); 00325 if( ko0 >= (aAlutAdrSize-1) ){ 00326 theByteArr[i+ii] = aus_lut[ (aAlutAdrSize-1) + aAlutOffset ] >>aAlutShift; 00327 } 00328 else{ 00329 theByteArr[i+ii] = aus_lut[ ko0 + aAlutOffset ] >>aAlutShift; 00330 } 00331 if( separateAluts )aAlutOffset += aAlutAdrSize; 00332 } 00333 } 00334 else{ 00335 for( ii=0; ii<3; ii++){ 00336 aVal = aMatrix[ii][0] * aLong0; 00337 aVal += aMatrix[ii][1] * aLong1; 00338 aVal += aMatrix[ii][2] * aLong2; 00339 aVal = (aVal+((1<<12)-1))>>13; 00340 if( aVal < 0 ) aVal = 0; 00341 00342 ko0= (aVal+((1<<(3+2-1))-1)) >> (3+2); 00343 if( ko0 >= (aAlutAdrSize-1) ){ 00344 theByteArr[i+ii] = aus_lutByte[ (aAlutAdrSize-1) + aAlutOffset ] ; 00345 } 00346 else{ 00347 theByteArr[i+ii] = aus_lutByte[ ko0 + aAlutOffset ] ; 00348 } 00349 if( separateAluts )aAlutOffset += aAlutAdrSize; 00350 } 00351 } 00352 #if FARBR_DEBUG 00353 DebugPrint("i=%ld\n",i); 00354 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) DebugPrint("%ld ",theArr[i+ii]); DebugPrint("\n"); 00355 DebugPrint("ein_reg=(d)");DebugPrint("%ld ",aLong0);DebugPrint("%ld ",aLong1);DebugPrint("%ld ",aLong2); DebugPrint("\n"); 00356 #endif 00357 } 00358 } 00359 LH_END_PROC("DoMatrixForCube16") 00360 }

void DoOnlyMatrixForCube Matrix2D theMatrix,
Ptr  aXlut,
long  aPointCount,
long  gridPointsCube
 

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

00059 { 00060 register long ii,jj; 00061 register long i; 00062 register long aLong0; 00063 register long aLong1; 00064 register long aLong2; 00065 register long theEnd; 00066 register long aVal; 00067 long aMatrix[3][3]; 00068 register double aFactor,dVal; 00069 register UINT16 accu,aMax; 00070 register UINT8 *theArr = (UINT8 *)aXlut; 00071 /* FILE *aSt; */ 00072 00073 00074 #ifdef DEBUG_OUTPUT 00075 long err=0; 00076 #endif 00077 LH_START_PROC("DoOnlyMatrixForCube") 00078 jj=aPointCount; 00079 theEnd = 3 * aPointCount; 00080 /*for( i=1; i<100; ++i)if( i*i*i == jj )break;*/ /* calculate gridpoints*/ 00081 /*if( i<= 0 || i >= 100 ) return;*/ 00082 i = gridPointsCube; 00083 aMax = 256 - 1; 00084 aFactor = 4096.*255./(256.*(i-1)/i); 00085 for( ii=0; ii<3; ii++){ 00086 for( jj=0; jj<3; jj++){ 00087 dVal = (*theMatrix)[ii][jj]*aFactor; 00088 aMatrix[ii][jj] = (long)Round(dVal); 00089 } 00090 } 00091 #if FARBR_DEBUG 00092 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) DebugPrint("%f ",aMatrix[ii][jj]); DebugPrint("\n"); 00093 #endif 00094 /* 00095 aSt = fopen("Matrix","a"); 00096 for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) fprintf(aSt,"%f ",(*(aStructPtr->theMatrix))[ii][jj]); fprintf(aSt,"\n"); 00097 for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) fprintf(aSt,"%d ",aMatrix[ii][jj]); fprintf(aSt,"\n"); 00098 fclose(aSt); 00099 */ 00100 for (i = 0; i < theEnd; i +=3){ /* Schleife der Points */ 00101 aLong0=theArr[i+0]; 00102 aLong1=theArr[i+1]; 00103 aLong2=theArr[i+2]; 00104 for( ii=0; ii<3; ii++){ 00105 aVal = aMatrix[ii][0] * aLong0; 00106 aVal += aMatrix[ii][1] * aLong1; 00107 aVal += aMatrix[ii][2] * aLong2; 00108 if( aVal > 0) aVal = (aVal+2047)>>12; 00109 else aVal = (aVal-2047)>>12; 00110 accu = (UINT16)CLIPP(aVal,0,(long)aMax); 00111 theArr[i+ii] = (UINT8)accu; 00112 } 00113 #if FARBR_DEBUG 00114 DebugPrint("i=%ld\n",i); 00115 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) DebugPrint("%ld ",theArr[i+ii]); DebugPrint("\n"); 00116 DebugPrint("ein_reg=(d)");DebugPrint("%ld ",aLong0);DebugPrint("%ld ",aLong1);DebugPrint("%ld ",aLong2); DebugPrint("\n"); 00117 #endif 00118 } 00119 00120 LH_END_PROC("DoOnlyMatrixForCube") 00121 }

void DoOnlyMatrixForCube16 Matrix2D theMatrix,
Ptr  aXlut,
long  aPointCount,
long  gridPointsCube
 

Definition at line 362 of file lh_core/dondim.c.

00363 { 00364 register long ii,jj; 00365 register long i; 00366 register long aLong0; 00367 register long aLong1; 00368 register long aLong2; 00369 register long theEnd; 00370 register long aVal; 00371 long aMatrix[3][3]; 00372 register double aFactor,dVal; 00373 register UINT16 accu,aMax; 00374 register UINT16 *theArr = (UINT16 *)aXlut; 00375 /* FILE *aSt;*/ 00376 00377 00378 #ifdef DEBUG_OUTPUT 00379 long err = 0; 00380 #endif 00381 LH_START_PROC("DoOnlyMatrixForCube16") 00382 jj=aPointCount; 00383 theEnd = 3 * aPointCount; 00384 /*for( i=1; i<100; ++i)if( i*i*i == jj )break; */ /* calculate gridpoints*/ 00385 /*if( i<= 0 || i >= 100 ) return;*/ 00386 i = gridPointsCube; 00387 aMax = VAL_MAXM1; 00388 aFactor = 4096.; 00389 for( ii=0; ii<3; ii++){ 00390 for( jj=0; jj<3; jj++){ 00391 dVal = (*theMatrix)[ii][jj]*aFactor; 00392 aMatrix[ii][jj] = (long)Round(dVal); 00393 } 00394 } 00395 #if FARBR_DEBUG 00396 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) DebugPrint("%f ",aMatrix[ii][jj]); DebugPrint("\n"); 00397 #endif 00398 /* 00399 aSt = fopen("Matrix","a"); 00400 for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) fprintf(aSt,"%f ",(*(aStructPtr->theMatrix))[ii][jj]); fprintf(aSt,"\n"); 00401 for(ii=0; ii<3; ++ii) for( jj=0; jj<3; jj++) fprintf(aSt,"%d ",aMatrix[ii][jj]); fprintf(aSt,"\n"); 00402 fclose(aSt); 00403 */ 00404 for (i = 0; i < theEnd; i +=3){ /* Schleife der Points */ 00405 aLong0=theArr[i+0]; 00406 aLong1=theArr[i+1]; 00407 aLong2=theArr[i+2]; 00408 for( ii=0; ii<3; ii++){ 00409 aVal = aMatrix[ii][0] * aLong0; 00410 aVal += aMatrix[ii][1] * aLong1; 00411 aVal += aMatrix[ii][2] * aLong2; 00412 if( aVal > 0) aVal = (aVal+2047)>>12; 00413 else aVal = (aVal-2047)>>12; 00414 accu = (UINT16)CLIPP(aVal,0,(long)aMax); 00415 theArr[i+ii] = accu; 00416 } 00417 #if FARBR_DEBUG 00418 DebugPrint("i=%ld\n",i); 00419 DebugPrint("theArr=(d)");for(ii=0; ii<3; ++ii) DebugPrint("%ld ",theArr[i+ii]); DebugPrint("\n"); 00420 DebugPrint("ein_reg=(d)");DebugPrint("%ld ",aLong0);DebugPrint("%ld ",aLong1);DebugPrint("%ld ",aLong2); DebugPrint("\n"); 00421 #endif 00422 } 00423 LH_END_PROC("DoOnlyMatrixForCube16") 00424 }


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