1 /*****************************************************************************/ 2 // Copyright 2006-2019 Adobe Systems Incorporated 3 // All Rights Reserved. 4 // 5 // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 // accordance with the terms of the Adobe license agreement accompanying it. 7 /*****************************************************************************/ 8 9 #ifndef __dng_reference__ 10 #define __dng_reference__ 11 12 /*****************************************************************************/ 13 14 #include "dng_bottlenecks.h" 15 #include "dng_simd_type.h" 16 #include "dng_flags.h" 17 18 /*****************************************************************************/ 19 20 void RefZeroBytes (void *dPtr, 21 uint32 count); 22 23 void RefCopyBytes (const void *sPtr, 24 void *dPtr, 25 uint32 count); 26 27 /*****************************************************************************/ 28 29 void RefSwapBytes16 (uint16 *dPtr, 30 uint32 count); 31 32 void RefSwapBytes32 (uint32 *dPtr, 33 uint32 count); 34 35 /*****************************************************************************/ 36 37 void RefSetArea8 (uint8 *dPtr, 38 uint8 value, 39 uint32 rows, 40 uint32 cols, 41 uint32 planes, 42 int32 rowStep, 43 int32 colStep, 44 int32 planeStep); 45 46 template <SIMDType simd, typename destType> 47 void RefSetArea (destType *dPtr, 48 destType value, 49 uint32 rows, 50 uint32 cols, 51 uint32 planes, 52 int32 rowStep, 53 int32 colStep, 54 int32 planeStep); 55 56 /*****************************************************************************/ 57 58 void RefCopyArea8 (const uint8 *sPtr, 59 uint8 *dPtr, 60 uint32 rows, 61 uint32 cols, 62 uint32 planes, 63 int32 sRowStep, 64 int32 sColStep, 65 int32 sPlaneStep, 66 int32 dRowStep, 67 int32 dColStep, 68 int32 dPlaneStep); 69 70 void RefCopyArea16 (const uint16 *sPtr, 71 uint16 *dPtr, 72 uint32 rows, 73 uint32 cols, 74 uint32 planes, 75 int32 sRowStep, 76 int32 sColStep, 77 int32 sPlaneStep, 78 int32 dRowStep, 79 int32 dColStep, 80 int32 dPlaneStep); 81 82 void RefCopyArea32 (const uint32 *sPtr, 83 uint32 *dPtr, 84 uint32 rows, 85 uint32 cols, 86 uint32 planes, 87 int32 sRowStep, 88 int32 sColStep, 89 int32 sPlaneStep, 90 int32 dRowStep, 91 int32 dColStep, 92 int32 dPlaneStep); 93 94 void RefCopyArea8_16 (const uint8 *sPtr, 95 uint16 *dPtr, 96 uint32 rows, 97 uint32 cols, 98 uint32 planes, 99 int32 sRowStep, 100 int32 sColStep, 101 int32 sPlaneStep, 102 int32 dRowStep, 103 int32 dColStep, 104 int32 dPlaneStep); 105 106 void RefCopyArea8_S16 (const uint8 *sPtr, 107 int16 *dPtr, 108 uint32 rows, 109 uint32 cols, 110 uint32 planes, 111 int32 sRowStep, 112 int32 sColStep, 113 int32 sPlaneStep, 114 int32 dRowStep, 115 int32 dColStep, 116 int32 dPlaneStep); 117 118 void RefCopyArea8_32 (const uint8 *sPtr, 119 uint32 *dPtr, 120 uint32 rows, 121 uint32 cols, 122 uint32 planes, 123 int32 sRowStep, 124 int32 sColStep, 125 int32 sPlaneStep, 126 int32 dRowStep, 127 int32 dColStep, 128 int32 dPlaneStep); 129 130 template <SIMDType simd> 131 void RefCopyArea16_S16 (const uint16 *sPtr, 132 int16 *dPtr, 133 uint32 rows, 134 uint32 cols, 135 uint32 planes, 136 int32 sRowStep, 137 int32 sColStep, 138 int32 sPlaneStep, 139 int32 dRowStep, 140 int32 dColStep, 141 int32 dPlaneStep); 142 143 void RefCopyArea16_32 (const uint16 *sPtr, 144 uint32 *dPtr, 145 uint32 rows, 146 uint32 cols, 147 uint32 planes, 148 int32 sRowStep, 149 int32 sColStep, 150 int32 sPlaneStep, 151 int32 dRowStep, 152 int32 dColStep, 153 int32 dPlaneStep); 154 155 void RefCopyArea8_R32 (const uint8 *sPtr, 156 real32 *dPtr, 157 uint32 rows, 158 uint32 cols, 159 uint32 planes, 160 int32 sRowStep, 161 int32 sColStep, 162 int32 sPlaneStep, 163 int32 dRowStep, 164 int32 dColStep, 165 int32 dPlaneStep, 166 uint32 pixelRange); 167 168 void RefCopyArea16_R32 (const uint16 *sPtr, 169 real32 *dPtr, 170 uint32 rows, 171 uint32 cols, 172 uint32 planes, 173 int32 sRowStep, 174 int32 sColStep, 175 int32 sPlaneStep, 176 int32 dRowStep, 177 int32 dColStep, 178 int32 dPlaneStep, 179 uint32 pixelRange); 180 181 void RefCopyAreaS16_R32 (const int16 *sPtr, 182 real32 *dPtr, 183 uint32 rows, 184 uint32 cols, 185 uint32 planes, 186 int32 sRowStep, 187 int32 sColStep, 188 int32 sPlaneStep, 189 int32 dRowStep, 190 int32 dColStep, 191 int32 dPlaneStep, 192 uint32 pixelRange); 193 194 void RefCopyAreaR32_8 (const real32 *sPtr, 195 uint8 *dPtr, 196 uint32 rows, 197 uint32 cols, 198 uint32 planes, 199 int32 sRowStep, 200 int32 sColStep, 201 int32 sPlaneStep, 202 int32 dRowStep, 203 int32 dColStep, 204 int32 dPlaneStep, 205 uint32 pixelRange); 206 207 void RefCopyAreaR32_16 (const real32 *sPtr, 208 uint16 *dPtr, 209 uint32 rows, 210 uint32 cols, 211 uint32 planes, 212 int32 sRowStep, 213 int32 sColStep, 214 int32 sPlaneStep, 215 int32 dRowStep, 216 int32 dColStep, 217 int32 dPlaneStep, 218 uint32 pixelRange); 219 220 void RefCopyAreaR32_S16 (const real32 *sPtr, 221 int16 *dPtr, 222 uint32 rows, 223 uint32 cols, 224 uint32 planes, 225 int32 sRowStep, 226 int32 sColStep, 227 int32 sPlaneStep, 228 int32 dRowStep, 229 int32 dColStep, 230 int32 dPlaneStep, 231 uint32 pixelRange); 232 233 /*****************************************************************************/ 234 235 void RefRepeatArea8 (const uint8 *sPtr, 236 uint8 *dPtr, 237 uint32 rows, 238 uint32 cols, 239 uint32 planes, 240 int32 rowStep, 241 int32 colStep, 242 int32 planeStep, 243 uint32 repeatV, 244 uint32 repeatH, 245 uint32 phaseV, 246 uint32 phaseH); 247 248 void RefRepeatArea16 (const uint16 *sPtr, 249 uint16 *dPtr, 250 uint32 rows, 251 uint32 cols, 252 uint32 planes, 253 int32 rowStep, 254 int32 colStep, 255 int32 planeStep, 256 uint32 repeatV, 257 uint32 repeatH, 258 uint32 phaseV, 259 uint32 phaseH); 260 261 void RefRepeatArea32 (const uint32 *sPtr, 262 uint32 *dPtr, 263 uint32 rows, 264 uint32 cols, 265 uint32 planes, 266 int32 rowStep, 267 int32 colStep, 268 int32 planeStep, 269 uint32 repeatV, 270 uint32 repeatH, 271 uint32 phaseV, 272 uint32 phaseH); 273 274 /*****************************************************************************/ 275 276 void RefShiftRight16 (uint16 *dPtr, 277 uint32 rows, 278 uint32 cols, 279 uint32 planes, 280 int32 rowStep, 281 int32 colStep, 282 int32 planeStep, 283 uint32 shift); 284 285 /*****************************************************************************/ 286 287 void RefBilinearRow16 (const uint16 *sPtr, 288 uint16 *dPtr, 289 uint32 cols, 290 uint32 patPhase, 291 uint32 patCount, 292 const uint32 * kernCounts, 293 const int32 * const * kernOffsets, 294 const uint16 * const * kernWeights, 295 uint32 sShift); 296 297 void RefBilinearRow32 (const real32 *sPtr, 298 real32 *dPtr, 299 uint32 cols, 300 uint32 patPhase, 301 uint32 patCount, 302 const uint32 * kernCounts, 303 const int32 * const * kernOffsets, 304 const real32 * const * kernWeights, 305 uint32 sShift); 306 307 /*****************************************************************************/ 308 309 void RefBaselineABCtoRGB (const real32 *sPtrA, 310 const real32 *sPtrB, 311 const real32 *sPtrC, 312 real32 *dPtrR, 313 real32 *dPtrG, 314 real32 *dPtrB, 315 uint32 count, 316 const dng_vector &cameraWhite, 317 const dng_matrix &cameraToRGB); 318 319 void RefBaselineABCDtoRGB (const real32 *sPtrA, 320 const real32 *sPtrB, 321 const real32 *sPtrC, 322 const real32 *sPtrD, 323 real32 *dPtrR, 324 real32 *dPtrG, 325 real32 *dPtrB, 326 uint32 count, 327 const dng_vector &cameraWhite, 328 const dng_matrix &cameraToRGB); 329 330 /*****************************************************************************/ 331 332 void RefBaselineHueSatMap (const real32 *sPtrR, 333 const real32 *sPtrG, 334 const real32 *sPtrB, 335 real32 *dPtrR, 336 real32 *dPtrG, 337 real32 *dPtrB, 338 uint32 count, 339 const dng_hue_sat_map &lut, 340 const dng_1d_table *encodeTable, 341 const dng_1d_table *decodeTable); 342 343 /*****************************************************************************/ 344 345 void RefBaselineRGBtoGray (const real32 *sPtrR, 346 const real32 *sPtrG, 347 const real32 *sPtrB, 348 real32 *dPtrG, 349 uint32 count, 350 const dng_matrix &matrix); 351 352 void RefBaselineRGBtoRGB (const real32 *sPtrR, 353 const real32 *sPtrG, 354 const real32 *sPtrB, 355 real32 *dPtrR, 356 real32 *dPtrG, 357 real32 *dPtrB, 358 uint32 count, 359 const dng_matrix &matrix); 360 361 /*****************************************************************************/ 362 363 void RefBaseline1DTable (const real32 *sPtr, 364 real32 *dPtr, 365 uint32 count, 366 const dng_1d_table &table); 367 368 /*****************************************************************************/ 369 370 void RefBaselineRGBTone (const real32 *sPtrR, 371 const real32 *sPtrG, 372 const real32 *sPtrB, 373 real32 *dPtrR, 374 real32 *dPtrG, 375 real32 *dPtrB, 376 uint32 count, 377 const dng_1d_table &table); 378 379 /*****************************************************************************/ 380 381 void RefResampleDown16 (const uint16 *sPtr, 382 uint16 *dPtr, 383 uint32 sCount, 384 int32 sRowStep, 385 const int16 *wPtr, 386 uint32 wCount, 387 uint32 pixelRange); 388 389 void RefResampleDown32 (const real32 *sPtr, 390 real32 *dPtr, 391 uint32 sCount, 392 int32 sRowStep, 393 const real32 *wPtr, 394 uint32 wCount); 395 396 /*****************************************************************************/ 397 398 void RefResampleAcross16 (const uint16 *sPtr, 399 uint16 *dPtr, 400 uint32 dCount, 401 const int32 *coord, 402 const int16 *wPtr, 403 uint32 wCount, 404 uint32 wStep, 405 uint32 pixelRange); 406 407 void RefResampleAcross32 (const real32 *sPtr, 408 real32 *dPtr, 409 uint32 dCount, 410 const int32 *coord, 411 const real32 *wPtr, 412 uint32 wCount, 413 uint32 wStep); 414 415 /*****************************************************************************/ 416 417 bool RefEqualBytes (const void *sPtr, 418 const void *dPtr, 419 uint32 count); 420 421 bool RefEqualArea8 (const uint8 *sPtr, 422 const uint8 *dPtr, 423 uint32 rows, 424 uint32 cols, 425 uint32 planes, 426 int32 sRowStep, 427 int32 sColStep, 428 int32 sPlaneStep, 429 int32 dRowStep, 430 int32 dColStep, 431 int32 dPlaneStep); 432 433 bool RefEqualArea16 (const uint16 *sPtr, 434 const uint16 *dPtr, 435 uint32 rows, 436 uint32 cols, 437 uint32 planes, 438 int32 sRowStep, 439 int32 sColStep, 440 int32 sPlaneStep, 441 int32 dRowStep, 442 int32 dColStep, 443 int32 dPlaneStep); 444 445 bool RefEqualArea32 (const uint32 *sPtr, 446 const uint32 *dPtr, 447 uint32 rows, 448 uint32 cols, 449 uint32 planes, 450 int32 sRowStep, 451 int32 sColStep, 452 int32 sPlaneStep, 453 int32 dRowStep, 454 int32 dColStep, 455 int32 dPlaneStep); 456 457 /*****************************************************************************/ 458 459 void RefVignetteMask16 (uint16 *mPtr, 460 uint32 rows, 461 uint32 cols, 462 int32 rowStep, 463 int64 offsetH, 464 int64 offsetV, 465 int64 stepH, 466 int64 stepV, 467 uint32 tBits, 468 const uint16 *table); 469 470 /*****************************************************************************/ 471 472 void RefVignette16 (int16 *sPtr, 473 const uint16 *mPtr, 474 uint32 rows, 475 uint32 cols, 476 uint32 planes, 477 int32 sRowStep, 478 int32 sPlaneStep, 479 int32 mRowStep, 480 uint32 mBits); 481 482 /*****************************************************************************/ 483 484 void RefVignette32 (real32 *sPtr, 485 const uint16 *mPtr, 486 uint32 rows, 487 uint32 cols, 488 uint32 planes, 489 int32 sRowStep, 490 int32 sPlaneStep, 491 int32 mRowStep, 492 uint32 mBits, 493 uint16 blackLevel); 494 495 /*****************************************************************************/ 496 497 void RefMapArea16 (uint16 *dPtr, 498 uint32 count0, 499 uint32 count1, 500 uint32 count2, 501 int32 step0, 502 int32 step1, 503 int32 step2, 504 const uint16 *map); 505 506 /*****************************************************************************/ 507 508 void RefBaselineMapPoly32 (real32 *dPtr, 509 const int32 rowStep, 510 const uint32 rows, 511 const uint32 cols, 512 const uint32 rowPitch, 513 const uint32 colPitch, 514 const real32 *coefficients, 515 const uint32 degree, 516 uint16 blackLevel); 517 518 /*****************************************************************************/ 519 520 #endif 521 522 /*****************************************************************************/ 523