7 |
|
|
8 |
|
#include <errno.h> |
9 |
|
#include "rtio.h" |
10 |
– |
#include "resolu.h" |
10 |
|
#include "rmatrix.h" |
11 |
|
#include "platform.h" |
12 |
|
|
34 |
|
int verbose = 0; /* verbose reporting? */ |
35 |
|
|
36 |
|
/* Load matrix */ |
37 |
< |
static int |
37 |
> |
int |
38 |
|
loadmatrix(ROPMAT *rop) |
39 |
|
{ |
40 |
|
if (rop->mtx != NULL) /* already loaded? */ |
45 |
|
return(!rop->mtx ? -1 : 1); |
46 |
|
} |
47 |
|
|
48 |
< |
static int checksymbolic(ROPMAT *rop); |
48 |
> |
extern int checksymbolic(ROPMAT *rop); |
49 |
|
|
50 |
|
/* Check/set transform based on a reference input file */ |
51 |
< |
static int |
51 |
> |
int |
52 |
|
checkreffile(ROPMAT *rop) |
53 |
|
{ |
54 |
|
static const char *curRF = NULL; |
107 |
|
} |
108 |
|
|
109 |
|
/* Compute conversion row from spectrum to one channel of RGB */ |
110 |
< |
static void |
110 |
> |
void |
111 |
|
rgbrow(ROPMAT *rop, int r, int p) |
112 |
|
{ |
113 |
|
const int nc = rop->mtx->ncomp; |
124 |
|
} |
125 |
|
|
126 |
|
/* Compute conversion row from spectrum to one channel of XYZ */ |
127 |
< |
static void |
127 |
> |
void |
128 |
|
xyzrow(ROPMAT *rop, int r, int p) |
129 |
|
{ |
130 |
|
const int nc = rop->mtx->ncomp; |
141 |
|
} |
142 |
|
|
143 |
|
/* Use the spectral sensitivity function to compute matrix coefficients */ |
144 |
< |
static void |
145 |
< |
sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, int ncs, const float wlpt[4])) |
144 |
> |
void |
145 |
> |
sensrow(ROPMAT *rop, int r, double (*sf)(const SCOLOR sc, int ncs, const float wlpt[4])) |
146 |
|
{ |
147 |
|
const int nc = rop->mtx->ncomp; |
148 |
|
int i; |
156 |
|
} |
157 |
|
|
158 |
|
/* Check/set symbolic transform */ |
159 |
< |
static int |
159 |
> |
int |
160 |
|
checksymbolic(ROPMAT *rop) |
161 |
|
{ |
162 |
|
const int nc = rop->mtx->ncomp; |
255 |
|
} |
256 |
|
} |
257 |
|
/* return recommended output type */ |
258 |
< |
if (!strcmp(rop->preop.csym, "XYZ")) { |
258 |
> |
if (!strcasecmp(rop->preop.csym, "XYZ")) { |
259 |
|
if (dt <= DTspec) |
260 |
|
return(DTxyze); |
261 |
< |
} else if (!strcmp(rop->preop.csym, "RGB")) { |
261 |
> |
} else if (!strcasecmp(rop->preop.csym, "RGB")) { |
262 |
|
if (dt <= DTspec) |
263 |
|
return(DTrgbe); |
264 |
|
} else if (dt == DTspec) |
267 |
|
} |
268 |
|
|
269 |
|
/* Get matrix and perform unary operations */ |
270 |
< |
static RMATRIX * |
270 |
> |
RMATRIX * |
271 |
|
loadop(ROPMAT *rop) |
272 |
|
{ |
273 |
|
int outtype = 0; |
367 |
|
} |
368 |
|
|
369 |
|
/* Execute binary operation, free matrix arguments and return new result */ |
370 |
< |
static RMATRIX * |
370 |
> |
RMATRIX * |
371 |
|
binaryop(const char *inspec, RMATRIX *mleft, int op, RMATRIX *mright) |
372 |
|
{ |
373 |
|
RMATRIX *mres = NULL; |
444 |
|
} |
445 |
|
|
446 |
|
/* Perform matrix operations from left to right */ |
447 |
< |
static RMATRIX * |
447 |
> |
RMATRIX * |
448 |
|
op_left2right(ROPMAT *mop) |
449 |
|
{ |
450 |
|
RMATRIX *mleft = loadop(mop); |
460 |
|
} |
461 |
|
|
462 |
|
/* Perform matrix operations from right to left */ |
463 |
< |
static RMATRIX * |
463 |
> |
RMATRIX * |
464 |
|
op_right2left(ROPMAT *mop) |
465 |
|
{ |
466 |
|
RMATRIX *mright; |
489 |
|
: (mop)->mtx->ncols) |
490 |
|
|
491 |
|
/* Should we prefer concatenating from rightmost matrix towards left? */ |
492 |
< |
static int |
492 |
> |
int |
493 |
|
prefer_right2left(ROPMAT *mop) |
494 |
|
{ |
495 |
|
int mri = 0; |
516 |
|
return(t_ncols(mop+mri) < t_nrows(mop)); |
517 |
|
} |
518 |
|
|
519 |
< |
static int |
519 |
> |
int |
520 |
|
get_factors(double da[], int n, char *av[]) |
521 |
|
{ |
522 |
|
int ac; |
526 |
|
return(ac); |
527 |
|
} |
528 |
|
|
529 |
< |
static ROPMAT * |
529 |
> |
ROPMAT * |
530 |
|
resize_moparr(ROPMAT *mop, int n2alloc) |
531 |
|
{ |
532 |
|
int nmats = 0; |
534 |
|
|
535 |
|
while (mop[nmats++].binop) |
536 |
|
; |
537 |
< |
for (i = nmats; i > n2alloc; i--) |
537 |
> |
for (i = nmats; i >= n2alloc; i--) |
538 |
|
rmx_free(mop[i].mtx); |
539 |
|
mop = (ROPMAT *)realloc(mop, n2alloc*sizeof(ROPMAT)); |
540 |
|
if (mop == NULL) { |