ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/cmatrix.h
(Generate patch)

Comparing ray/src/util/cmatrix.h (file contents):
Revision 2.1 by greg, Mon Jan 20 21:29:04 2014 UTC vs.
Revision 2.8 by greg, Wed Oct 31 22:19:57 2018 UTC

# Line 8 | Line 8
8   #ifndef _RAD_CMATRIX_H_
9   #define _RAD_CMATRIX_H_
10  
11 + #include  <sys/types.h>
12   #include "color.h"
13  
14   #ifdef __cplusplus
# Line 15 | Line 16 | extern "C" {
16   #endif
17  
18   /* Data types for file loading */
19 < enum {DTfromHeader, DTascii, DTfloat, DTdouble, DTrgbe, DTxyze};
19 > enum {DTfromHeader=0, DTascii, DTrgbe, DTxyze, DTfloat, DTdouble, DTend};
20  
21 + extern const char       *cm_fmt_id[];
22 + extern const int        cm_elem_size[];
23 +
24   /* A color coefficient matrix -- vectors have ncols==1 */
25   typedef struct {
26          int     nrows, ncols;
# Line 25 | Line 29 | typedef struct {
29  
30   #define COLSPEC (sizeof(COLORV)==sizeof(float) ? "%f %f %f" : "%lf %lf %lf")
31  
32 < #define cm_lval(cm,r,c) ((cm)->cmem + 3*((r)*(cm)->ncols + (c)))
32 > #define cm_lval(cm,r,c) ((cm)->cmem + 3*((size_t)(r)*(cm)->ncols + (c)))
33  
34   #define cv_lval(cm,i)   ((cm)->cmem + 3*(i))
35  
36   /* Allocate a color coefficient matrix */
37 < extern CMATRIX *cm_alloc(int nrows, int ncols);
37 > extern CMATRIX  *cm_alloc(int nrows, int ncols);
38  
39   /* Resize color coefficient matrix */
40 < extern CMATRIX *cm_resize(CMATRIX *cm, int nrows);
40 > extern CMATRIX  *cm_resize(CMATRIX *cm, int nrows);
41  
42   #define cm_free(cm)     free(cm)
43  
44 < /* Load header to obtain data type */
45 < int getDTfromHeader(FILE *fp);
44 > /* Load header to obtain/check data type and matrix dimensions */
45 > extern char     *cm_getheader(int *dt, int *nr, int *nc, FILE *fp);
46  
47 < /* Allocate and load a matrix from the given file (or stdin if NULL) */
48 < extern CMATRIX *cm_load(const char *fname, int nrows, int ncols, int dtype);
47 > /* Allocate and load a matrix from the given input (or stdin if NULL) */
48 > extern CMATRIX  *cm_load(const char *inspec, int nrows, int ncols, int dtype);
49  
50   /* Extract a column vector from a matrix */
51 < extern CMATRIX *cm_column(const CMATRIX *cm, int c);
51 > extern CMATRIX  *cm_column(const CMATRIX *cm, int c);
52  
53   /* Scale a matrix by a single value */
54 < extern CMATRIX *cm_scale(const CMATRIX *cm1, const COLOR sca);
54 > extern CMATRIX  *cm_scale(const CMATRIX *cm1, const COLOR sca);
55  
56   /* Multiply two matrices (or a matrix and a vector) and allocate the result */
57 < extern CMATRIX *cm_multiply(const CMATRIX *cm1, const CMATRIX *cm2);
57 > extern CMATRIX  *cm_multiply(const CMATRIX *cm1, const CMATRIX *cm2);
58  
59 < /* print out matrix as ASCII text -- no header */
60 < extern void cm_print(const CMATRIX *cm, FILE *fp);
59 > /* write out matrix to file (precede by resolution string if picture) */
60 > extern int      cm_write(const CMATRIX *cm, int dtype, FILE *fp);
61  
62 < /* Load and convert a matrix BSDF from the given XML file */
63 < extern CMATRIX *cm_loadBSDF(char *fname, COLOR cLamb);
62 > /* Load and convert a matrix BTDF from the given XML file */
63 > extern CMATRIX  *cm_loadBTDF(char *fname);
64  
65   #ifdef __cplusplus
66   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines