| 10 |
|
#include "rmatrix.h" |
| 11 |
|
#include "platform.h" |
| 12 |
|
|
| 13 |
+ |
#ifndef MAXCOMP |
| 14 |
|
#define MAXCOMP MAXCSAMP /* #components we support */ |
| 15 |
+ |
#endif |
| 16 |
|
|
| 17 |
|
/* Unary matrix operation(s) */ |
| 18 |
|
typedef struct { |
| 36 |
|
int verbose = 0; /* verbose reporting? */ |
| 37 |
|
|
| 38 |
|
/* Load matrix */ |
| 39 |
< |
static int |
| 39 |
> |
int |
| 40 |
|
loadmatrix(ROPMAT *rop) |
| 41 |
|
{ |
| 42 |
|
if (rop->mtx != NULL) /* already loaded? */ |
| 47 |
|
return(!rop->mtx ? -1 : 1); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
< |
static int checksymbolic(ROPMAT *rop); |
| 50 |
> |
extern int checksymbolic(ROPMAT *rop); |
| 51 |
|
|
| 52 |
|
/* Check/set transform based on a reference input file */ |
| 53 |
< |
static int |
| 53 |
> |
int |
| 54 |
|
checkreffile(ROPMAT *rop) |
| 55 |
|
{ |
| 56 |
|
static const char *curRF = NULL; |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
/* Compute conversion row from spectrum to one channel of RGB */ |
| 112 |
< |
static void |
| 112 |
> |
void |
| 113 |
|
rgbrow(ROPMAT *rop, int r, int p) |
| 114 |
|
{ |
| 115 |
|
const int nc = rop->mtx->ncomp; |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
/* Compute conversion row from spectrum to one channel of XYZ */ |
| 129 |
< |
static void |
| 129 |
> |
void |
| 130 |
|
xyzrow(ROPMAT *rop, int r, int p) |
| 131 |
|
{ |
| 132 |
|
const int nc = rop->mtx->ncomp; |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
/* Use the spectral sensitivity function to compute matrix coefficients */ |
| 146 |
< |
static void |
| 146 |
> |
void |
| 147 |
|
sensrow(ROPMAT *rop, int r, double (*sf)(const SCOLOR sc, int ncs, const float wlpt[4])) |
| 148 |
|
{ |
| 149 |
|
const int nc = rop->mtx->ncomp; |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
/* Check/set symbolic transform */ |
| 161 |
< |
static int |
| 161 |
> |
int |
| 162 |
|
checksymbolic(ROPMAT *rop) |
| 163 |
|
{ |
| 164 |
|
const int nc = rop->mtx->ncomp; |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
/* Get matrix and perform unary operations */ |
| 272 |
< |
static RMATRIX * |
| 272 |
> |
RMATRIX * |
| 273 |
|
loadop(ROPMAT *rop) |
| 274 |
|
{ |
| 275 |
|
int outtype = 0; |
| 369 |
|
} |
| 370 |
|
|
| 371 |
|
/* Execute binary operation, free matrix arguments and return new result */ |
| 372 |
< |
static RMATRIX * |
| 372 |
> |
RMATRIX * |
| 373 |
|
binaryop(const char *inspec, RMATRIX *mleft, int op, RMATRIX *mright) |
| 374 |
|
{ |
| 375 |
|
RMATRIX *mres = NULL; |
| 446 |
|
} |
| 447 |
|
|
| 448 |
|
/* Perform matrix operations from left to right */ |
| 449 |
< |
static RMATRIX * |
| 449 |
> |
RMATRIX * |
| 450 |
|
op_left2right(ROPMAT *mop) |
| 451 |
|
{ |
| 452 |
|
RMATRIX *mleft = loadop(mop); |
| 462 |
|
} |
| 463 |
|
|
| 464 |
|
/* Perform matrix operations from right to left */ |
| 465 |
< |
static RMATRIX * |
| 465 |
> |
RMATRIX * |
| 466 |
|
op_right2left(ROPMAT *mop) |
| 467 |
|
{ |
| 468 |
|
RMATRIX *mright; |
| 491 |
|
: (mop)->mtx->ncols) |
| 492 |
|
|
| 493 |
|
/* Should we prefer concatenating from rightmost matrix towards left? */ |
| 494 |
< |
static int |
| 494 |
> |
int |
| 495 |
|
prefer_right2left(ROPMAT *mop) |
| 496 |
|
{ |
| 497 |
|
int mri = 0; |
| 518 |
|
return(t_ncols(mop+mri) < t_nrows(mop)); |
| 519 |
|
} |
| 520 |
|
|
| 521 |
< |
static int |
| 521 |
> |
int |
| 522 |
|
get_factors(double da[], int n, char *av[]) |
| 523 |
|
{ |
| 524 |
|
int ac; |
| 528 |
|
return(ac); |
| 529 |
|
} |
| 530 |
|
|
| 531 |
< |
static ROPMAT * |
| 531 |
> |
ROPMAT * |
| 532 |
|
resize_moparr(ROPMAT *mop, int n2alloc) |
| 533 |
|
{ |
| 534 |
|
int nmats = 0; |
| 536 |
|
|
| 537 |
|
while (mop[nmats++].binop) |
| 538 |
|
; |
| 539 |
< |
for (i = nmats; i > n2alloc; i--) |
| 539 |
> |
for (i = nmats; i >= n2alloc; i--) |
| 540 |
|
rmx_free(mop[i].mtx); |
| 541 |
|
mop = (ROPMAT *)realloc(mop, n2alloc*sizeof(ROPMAT)); |
| 542 |
|
if (mop == NULL) { |