File indexing completed on 2025-01-19 03:55:14
0001 /*****************************************************************************/ 0002 // Copyright 2006-2019 Adobe Systems Incorporated 0003 // All Rights Reserved. 0004 // 0005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 0006 // accordance with the terms of the Adobe license agreement accompanying it. 0007 /*****************************************************************************/ 0008 0009 #ifndef __dng_reference__ 0010 #define __dng_reference__ 0011 0012 /*****************************************************************************/ 0013 0014 #include "dng_bottlenecks.h" 0015 #include "dng_simd_type.h" 0016 #include "dng_flags.h" 0017 0018 /*****************************************************************************/ 0019 0020 void RefZeroBytes (void *dPtr, 0021 uint32 count); 0022 0023 void RefCopyBytes (const void *sPtr, 0024 void *dPtr, 0025 uint32 count); 0026 0027 /*****************************************************************************/ 0028 0029 void RefSwapBytes16 (uint16 *dPtr, 0030 uint32 count); 0031 0032 void RefSwapBytes32 (uint32 *dPtr, 0033 uint32 count); 0034 0035 /*****************************************************************************/ 0036 0037 void RefSetArea8 (uint8 *dPtr, 0038 uint8 value, 0039 uint32 rows, 0040 uint32 cols, 0041 uint32 planes, 0042 int32 rowStep, 0043 int32 colStep, 0044 int32 planeStep); 0045 0046 template <SIMDType simd, typename destType> 0047 void RefSetArea (destType *dPtr, 0048 destType value, 0049 uint32 rows, 0050 uint32 cols, 0051 uint32 planes, 0052 int32 rowStep, 0053 int32 colStep, 0054 int32 planeStep); 0055 0056 /*****************************************************************************/ 0057 0058 void RefCopyArea8 (const uint8 *sPtr, 0059 uint8 *dPtr, 0060 uint32 rows, 0061 uint32 cols, 0062 uint32 planes, 0063 int32 sRowStep, 0064 int32 sColStep, 0065 int32 sPlaneStep, 0066 int32 dRowStep, 0067 int32 dColStep, 0068 int32 dPlaneStep); 0069 0070 void RefCopyArea16 (const uint16 *sPtr, 0071 uint16 *dPtr, 0072 uint32 rows, 0073 uint32 cols, 0074 uint32 planes, 0075 int32 sRowStep, 0076 int32 sColStep, 0077 int32 sPlaneStep, 0078 int32 dRowStep, 0079 int32 dColStep, 0080 int32 dPlaneStep); 0081 0082 void RefCopyArea32 (const uint32 *sPtr, 0083 uint32 *dPtr, 0084 uint32 rows, 0085 uint32 cols, 0086 uint32 planes, 0087 int32 sRowStep, 0088 int32 sColStep, 0089 int32 sPlaneStep, 0090 int32 dRowStep, 0091 int32 dColStep, 0092 int32 dPlaneStep); 0093 0094 void RefCopyArea8_16 (const uint8 *sPtr, 0095 uint16 *dPtr, 0096 uint32 rows, 0097 uint32 cols, 0098 uint32 planes, 0099 int32 sRowStep, 0100 int32 sColStep, 0101 int32 sPlaneStep, 0102 int32 dRowStep, 0103 int32 dColStep, 0104 int32 dPlaneStep); 0105 0106 void RefCopyArea8_S16 (const uint8 *sPtr, 0107 int16 *dPtr, 0108 uint32 rows, 0109 uint32 cols, 0110 uint32 planes, 0111 int32 sRowStep, 0112 int32 sColStep, 0113 int32 sPlaneStep, 0114 int32 dRowStep, 0115 int32 dColStep, 0116 int32 dPlaneStep); 0117 0118 void RefCopyArea8_32 (const uint8 *sPtr, 0119 uint32 *dPtr, 0120 uint32 rows, 0121 uint32 cols, 0122 uint32 planes, 0123 int32 sRowStep, 0124 int32 sColStep, 0125 int32 sPlaneStep, 0126 int32 dRowStep, 0127 int32 dColStep, 0128 int32 dPlaneStep); 0129 0130 template <SIMDType simd> 0131 void RefCopyArea16_S16 (const uint16 *sPtr, 0132 int16 *dPtr, 0133 uint32 rows, 0134 uint32 cols, 0135 uint32 planes, 0136 int32 sRowStep, 0137 int32 sColStep, 0138 int32 sPlaneStep, 0139 int32 dRowStep, 0140 int32 dColStep, 0141 int32 dPlaneStep); 0142 0143 void RefCopyArea16_32 (const uint16 *sPtr, 0144 uint32 *dPtr, 0145 uint32 rows, 0146 uint32 cols, 0147 uint32 planes, 0148 int32 sRowStep, 0149 int32 sColStep, 0150 int32 sPlaneStep, 0151 int32 dRowStep, 0152 int32 dColStep, 0153 int32 dPlaneStep); 0154 0155 void RefCopyArea8_R32 (const uint8 *sPtr, 0156 real32 *dPtr, 0157 uint32 rows, 0158 uint32 cols, 0159 uint32 planes, 0160 int32 sRowStep, 0161 int32 sColStep, 0162 int32 sPlaneStep, 0163 int32 dRowStep, 0164 int32 dColStep, 0165 int32 dPlaneStep, 0166 uint32 pixelRange); 0167 0168 void RefCopyArea16_R32 (const uint16 *sPtr, 0169 real32 *dPtr, 0170 uint32 rows, 0171 uint32 cols, 0172 uint32 planes, 0173 int32 sRowStep, 0174 int32 sColStep, 0175 int32 sPlaneStep, 0176 int32 dRowStep, 0177 int32 dColStep, 0178 int32 dPlaneStep, 0179 uint32 pixelRange); 0180 0181 void RefCopyAreaS16_R32 (const int16 *sPtr, 0182 real32 *dPtr, 0183 uint32 rows, 0184 uint32 cols, 0185 uint32 planes, 0186 int32 sRowStep, 0187 int32 sColStep, 0188 int32 sPlaneStep, 0189 int32 dRowStep, 0190 int32 dColStep, 0191 int32 dPlaneStep, 0192 uint32 pixelRange); 0193 0194 void RefCopyAreaR32_8 (const real32 *sPtr, 0195 uint8 *dPtr, 0196 uint32 rows, 0197 uint32 cols, 0198 uint32 planes, 0199 int32 sRowStep, 0200 int32 sColStep, 0201 int32 sPlaneStep, 0202 int32 dRowStep, 0203 int32 dColStep, 0204 int32 dPlaneStep, 0205 uint32 pixelRange); 0206 0207 void RefCopyAreaR32_16 (const real32 *sPtr, 0208 uint16 *dPtr, 0209 uint32 rows, 0210 uint32 cols, 0211 uint32 planes, 0212 int32 sRowStep, 0213 int32 sColStep, 0214 int32 sPlaneStep, 0215 int32 dRowStep, 0216 int32 dColStep, 0217 int32 dPlaneStep, 0218 uint32 pixelRange); 0219 0220 void RefCopyAreaR32_S16 (const real32 *sPtr, 0221 int16 *dPtr, 0222 uint32 rows, 0223 uint32 cols, 0224 uint32 planes, 0225 int32 sRowStep, 0226 int32 sColStep, 0227 int32 sPlaneStep, 0228 int32 dRowStep, 0229 int32 dColStep, 0230 int32 dPlaneStep, 0231 uint32 pixelRange); 0232 0233 /*****************************************************************************/ 0234 0235 void RefRepeatArea8 (const uint8 *sPtr, 0236 uint8 *dPtr, 0237 uint32 rows, 0238 uint32 cols, 0239 uint32 planes, 0240 int32 rowStep, 0241 int32 colStep, 0242 int32 planeStep, 0243 uint32 repeatV, 0244 uint32 repeatH, 0245 uint32 phaseV, 0246 uint32 phaseH); 0247 0248 void RefRepeatArea16 (const uint16 *sPtr, 0249 uint16 *dPtr, 0250 uint32 rows, 0251 uint32 cols, 0252 uint32 planes, 0253 int32 rowStep, 0254 int32 colStep, 0255 int32 planeStep, 0256 uint32 repeatV, 0257 uint32 repeatH, 0258 uint32 phaseV, 0259 uint32 phaseH); 0260 0261 void RefRepeatArea32 (const uint32 *sPtr, 0262 uint32 *dPtr, 0263 uint32 rows, 0264 uint32 cols, 0265 uint32 planes, 0266 int32 rowStep, 0267 int32 colStep, 0268 int32 planeStep, 0269 uint32 repeatV, 0270 uint32 repeatH, 0271 uint32 phaseV, 0272 uint32 phaseH); 0273 0274 /*****************************************************************************/ 0275 0276 void RefShiftRight16 (uint16 *dPtr, 0277 uint32 rows, 0278 uint32 cols, 0279 uint32 planes, 0280 int32 rowStep, 0281 int32 colStep, 0282 int32 planeStep, 0283 uint32 shift); 0284 0285 /*****************************************************************************/ 0286 0287 void RefBilinearRow16 (const uint16 *sPtr, 0288 uint16 *dPtr, 0289 uint32 cols, 0290 uint32 patPhase, 0291 uint32 patCount, 0292 const uint32 * kernCounts, 0293 const int32 * const * kernOffsets, 0294 const uint16 * const * kernWeights, 0295 uint32 sShift); 0296 0297 void RefBilinearRow32 (const real32 *sPtr, 0298 real32 *dPtr, 0299 uint32 cols, 0300 uint32 patPhase, 0301 uint32 patCount, 0302 const uint32 * kernCounts, 0303 const int32 * const * kernOffsets, 0304 const real32 * const * kernWeights, 0305 uint32 sShift); 0306 0307 /*****************************************************************************/ 0308 0309 void RefBaselineABCtoRGB (const real32 *sPtrA, 0310 const real32 *sPtrB, 0311 const real32 *sPtrC, 0312 real32 *dPtrR, 0313 real32 *dPtrG, 0314 real32 *dPtrB, 0315 uint32 count, 0316 const dng_vector &cameraWhite, 0317 const dng_matrix &cameraToRGB); 0318 0319 void RefBaselineABCDtoRGB (const real32 *sPtrA, 0320 const real32 *sPtrB, 0321 const real32 *sPtrC, 0322 const real32 *sPtrD, 0323 real32 *dPtrR, 0324 real32 *dPtrG, 0325 real32 *dPtrB, 0326 uint32 count, 0327 const dng_vector &cameraWhite, 0328 const dng_matrix &cameraToRGB); 0329 0330 /*****************************************************************************/ 0331 0332 void RefBaselineHueSatMap (const real32 *sPtrR, 0333 const real32 *sPtrG, 0334 const real32 *sPtrB, 0335 real32 *dPtrR, 0336 real32 *dPtrG, 0337 real32 *dPtrB, 0338 uint32 count, 0339 const dng_hue_sat_map &lut, 0340 const dng_1d_table *encodeTable, 0341 const dng_1d_table *decodeTable); 0342 0343 /*****************************************************************************/ 0344 0345 void RefBaselineRGBtoGray (const real32 *sPtrR, 0346 const real32 *sPtrG, 0347 const real32 *sPtrB, 0348 real32 *dPtrG, 0349 uint32 count, 0350 const dng_matrix &matrix); 0351 0352 void RefBaselineRGBtoRGB (const real32 *sPtrR, 0353 const real32 *sPtrG, 0354 const real32 *sPtrB, 0355 real32 *dPtrR, 0356 real32 *dPtrG, 0357 real32 *dPtrB, 0358 uint32 count, 0359 const dng_matrix &matrix); 0360 0361 /*****************************************************************************/ 0362 0363 void RefBaseline1DTable (const real32 *sPtr, 0364 real32 *dPtr, 0365 uint32 count, 0366 const dng_1d_table &table); 0367 0368 /*****************************************************************************/ 0369 0370 void RefBaselineRGBTone (const real32 *sPtrR, 0371 const real32 *sPtrG, 0372 const real32 *sPtrB, 0373 real32 *dPtrR, 0374 real32 *dPtrG, 0375 real32 *dPtrB, 0376 uint32 count, 0377 const dng_1d_table &table); 0378 0379 /*****************************************************************************/ 0380 0381 void RefResampleDown16 (const uint16 *sPtr, 0382 uint16 *dPtr, 0383 uint32 sCount, 0384 int32 sRowStep, 0385 const int16 *wPtr, 0386 uint32 wCount, 0387 uint32 pixelRange); 0388 0389 void RefResampleDown32 (const real32 *sPtr, 0390 real32 *dPtr, 0391 uint32 sCount, 0392 int32 sRowStep, 0393 const real32 *wPtr, 0394 uint32 wCount); 0395 0396 /*****************************************************************************/ 0397 0398 void RefResampleAcross16 (const uint16 *sPtr, 0399 uint16 *dPtr, 0400 uint32 dCount, 0401 const int32 *coord, 0402 const int16 *wPtr, 0403 uint32 wCount, 0404 uint32 wStep, 0405 uint32 pixelRange); 0406 0407 void RefResampleAcross32 (const real32 *sPtr, 0408 real32 *dPtr, 0409 uint32 dCount, 0410 const int32 *coord, 0411 const real32 *wPtr, 0412 uint32 wCount, 0413 uint32 wStep); 0414 0415 /*****************************************************************************/ 0416 0417 bool RefEqualBytes (const void *sPtr, 0418 const void *dPtr, 0419 uint32 count); 0420 0421 bool RefEqualArea8 (const uint8 *sPtr, 0422 const uint8 *dPtr, 0423 uint32 rows, 0424 uint32 cols, 0425 uint32 planes, 0426 int32 sRowStep, 0427 int32 sColStep, 0428 int32 sPlaneStep, 0429 int32 dRowStep, 0430 int32 dColStep, 0431 int32 dPlaneStep); 0432 0433 bool RefEqualArea16 (const uint16 *sPtr, 0434 const uint16 *dPtr, 0435 uint32 rows, 0436 uint32 cols, 0437 uint32 planes, 0438 int32 sRowStep, 0439 int32 sColStep, 0440 int32 sPlaneStep, 0441 int32 dRowStep, 0442 int32 dColStep, 0443 int32 dPlaneStep); 0444 0445 bool RefEqualArea32 (const uint32 *sPtr, 0446 const uint32 *dPtr, 0447 uint32 rows, 0448 uint32 cols, 0449 uint32 planes, 0450 int32 sRowStep, 0451 int32 sColStep, 0452 int32 sPlaneStep, 0453 int32 dRowStep, 0454 int32 dColStep, 0455 int32 dPlaneStep); 0456 0457 /*****************************************************************************/ 0458 0459 void RefVignetteMask16 (uint16 *mPtr, 0460 uint32 rows, 0461 uint32 cols, 0462 int32 rowStep, 0463 int64 offsetH, 0464 int64 offsetV, 0465 int64 stepH, 0466 int64 stepV, 0467 uint32 tBits, 0468 const uint16 *table); 0469 0470 /*****************************************************************************/ 0471 0472 void RefVignette16 (int16 *sPtr, 0473 const uint16 *mPtr, 0474 uint32 rows, 0475 uint32 cols, 0476 uint32 planes, 0477 int32 sRowStep, 0478 int32 sPlaneStep, 0479 int32 mRowStep, 0480 uint32 mBits); 0481 0482 /*****************************************************************************/ 0483 0484 void RefVignette32 (real32 *sPtr, 0485 const uint16 *mPtr, 0486 uint32 rows, 0487 uint32 cols, 0488 uint32 planes, 0489 int32 sRowStep, 0490 int32 sPlaneStep, 0491 int32 mRowStep, 0492 uint32 mBits, 0493 uint16 blackLevel); 0494 0495 /*****************************************************************************/ 0496 0497 void RefMapArea16 (uint16 *dPtr, 0498 uint32 count0, 0499 uint32 count1, 0500 uint32 count2, 0501 int32 step0, 0502 int32 step1, 0503 int32 step2, 0504 const uint16 *map); 0505 0506 /*****************************************************************************/ 0507 0508 void RefBaselineMapPoly32 (real32 *dPtr, 0509 const int32 rowStep, 0510 const uint32 rows, 0511 const uint32 cols, 0512 const uint32 rowPitch, 0513 const uint32 colPitch, 0514 const real32 *coefficients, 0515 const uint32 degree, 0516 uint16 blackLevel); 0517 0518 /*****************************************************************************/ 0519 0520 #endif 0521 0522 /*****************************************************************************/