419 |
|
} |
420 |
|
|
421 |
|
|
422 |
– |
static int |
423 |
– |
tmNewMap( /* allocate new tone-mapping array */ |
424 |
– |
TMstruct *tms |
425 |
– |
) |
426 |
– |
{ |
427 |
– |
if (tms->lumap != NULL && (tms->mbrmax - tms->mbrmin) != |
428 |
– |
(tms->hbrmax - tms->hbrmin)) { |
429 |
– |
free((MEM_PTR)tms->lumap); |
430 |
– |
tms->lumap = NULL; |
431 |
– |
} |
432 |
– |
tms->mbrmin = tms->hbrmin; |
433 |
– |
tms->mbrmax = tms->hbrmax; |
434 |
– |
if (tms->mbrmin > tms->mbrmax) |
435 |
– |
return 0; |
436 |
– |
if (tms->lumap == NULL) |
437 |
– |
tms->lumap = (unsigned short *)malloc(sizeof(unsigned short)* |
438 |
– |
(tms->mbrmax-tms->mbrmin+1)); |
439 |
– |
return(tms->lumap != NULL); |
440 |
– |
} |
441 |
– |
|
442 |
– |
|
422 |
|
int |
423 |
|
tmFixedMapping( /* compute fixed, linear tone-mapping */ |
424 |
|
TMstruct *tms, |
594 |
|
} |
595 |
|
|
596 |
|
|
618 |
– |
|
619 |
– |
|
597 |
|
TMstruct * |
598 |
|
tmDup( /* duplicate top tone mapping */ |
599 |
|
TMstruct *tms |
668 |
|
tmMesofact[i-BMESLOWER] = 256. * |
669 |
|
(tmLuminance(i) - LMESLOWER) / |
670 |
|
(LMESUPPER - LMESLOWER); |
671 |
+ |
} |
672 |
+ |
|
673 |
+ |
|
674 |
+ |
int |
675 |
+ |
tmNewMap( /* allocate new tone-mapping array */ |
676 |
+ |
TMstruct *tms |
677 |
+ |
) |
678 |
+ |
{ |
679 |
+ |
if (tms->lumap != NULL && (tms->mbrmax - tms->mbrmin) != |
680 |
+ |
(tms->hbrmax - tms->hbrmin)) { |
681 |
+ |
free((MEM_PTR)tms->lumap); |
682 |
+ |
tms->lumap = NULL; |
683 |
+ |
} |
684 |
+ |
tms->mbrmin = tms->hbrmin; |
685 |
+ |
tms->mbrmax = tms->hbrmax; |
686 |
+ |
if (tms->mbrmin > tms->mbrmax) |
687 |
+ |
return 0; |
688 |
+ |
if (tms->lumap == NULL) |
689 |
+ |
tms->lumap = (unsigned short *)malloc(sizeof(unsigned short)* |
690 |
+ |
(tms->mbrmax-tms->mbrmin+1)); |
691 |
+ |
return(tms->lumap != NULL); |
692 |
|
} |
693 |
|
|
694 |
|
|