• Home
  • Raw
  • Download

Lines Matching refs:matrix

88     jas_matrix_t *matrix;  in jas_seq2d_create()  local
90 if (!(matrix = jas_matrix_create(yend - ystart, xend - xstart))) { in jas_seq2d_create()
93 matrix->xstart_ = xstart; in jas_seq2d_create()
94 matrix->ystart_ = ystart; in jas_seq2d_create()
95 matrix->xend_ = xend; in jas_seq2d_create()
96 matrix->yend_ = yend; in jas_seq2d_create()
97 return matrix; in jas_seq2d_create()
102 jas_matrix_t *matrix; in jas_matrix_create() local
105 if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) { in jas_matrix_create()
108 matrix->flags_ = 0; in jas_matrix_create()
109 matrix->numrows_ = numrows; in jas_matrix_create()
110 matrix->numcols_ = numcols; in jas_matrix_create()
111 matrix->rows_ = 0; in jas_matrix_create()
112 matrix->maxrows_ = numrows; in jas_matrix_create()
113 matrix->data_ = 0; in jas_matrix_create()
114 matrix->datasize_ = numrows * numcols; in jas_matrix_create()
116 if (matrix->maxrows_ > 0) { in jas_matrix_create()
117 if (!(matrix->rows_ = jas_alloc2(matrix->maxrows_, in jas_matrix_create()
119 jas_matrix_destroy(matrix); in jas_matrix_create()
124 if (matrix->datasize_ > 0) { in jas_matrix_create()
125 if (!(matrix->data_ = jas_alloc2(matrix->datasize_, in jas_matrix_create()
127 jas_matrix_destroy(matrix); in jas_matrix_create()
133 matrix->rows_[i] = &matrix->data_[i * matrix->numcols_]; in jas_matrix_create()
136 for (i = 0; i < matrix->datasize_; ++i) { in jas_matrix_create()
137 matrix->data_[i] = 0; in jas_matrix_create()
140 matrix->xstart_ = 0; in jas_matrix_create()
141 matrix->ystart_ = 0; in jas_matrix_create()
142 matrix->xend_ = matrix->numcols_; in jas_matrix_create()
143 matrix->yend_ = matrix->numrows_; in jas_matrix_create()
145 return matrix; in jas_matrix_create()
148 void jas_matrix_destroy(jas_matrix_t *matrix) in jas_matrix_destroy() argument
150 if (matrix->data_) { in jas_matrix_destroy()
151 assert(!(matrix->flags_ & JAS_MATRIX_REF)); in jas_matrix_destroy()
152 jas_free(matrix->data_); in jas_matrix_destroy()
153 matrix->data_ = 0; in jas_matrix_destroy()
155 if (matrix->rows_) { in jas_matrix_destroy()
156 jas_free(matrix->rows_); in jas_matrix_destroy()
157 matrix->rows_ = 0; in jas_matrix_destroy()
159 jas_free(matrix); in jas_matrix_destroy()
257 void jas_matrix_divpow2(jas_matrix_t *matrix, int n) in jas_matrix_divpow2() argument
265 rowstep = jas_matrix_rowstep(matrix); in jas_matrix_divpow2()
266 for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, in jas_matrix_divpow2()
268 for (j = matrix->numcols_, data = rowstart; j > 0; --j, in jas_matrix_divpow2()
276 void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval) in jas_matrix_clip() argument
285 rowstep = jas_matrix_rowstep(matrix); in jas_matrix_clip()
286 for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, in jas_matrix_clip()
289 for (j = matrix->numcols_, data = rowstart; j > 0; --j, in jas_matrix_clip()
301 void jas_matrix_asr(jas_matrix_t *matrix, int n) in jas_matrix_asr() argument
310 rowstep = jas_matrix_rowstep(matrix); in jas_matrix_asr()
311 for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, in jas_matrix_asr()
313 for (j = matrix->numcols_, data = rowstart; j > 0; --j, in jas_matrix_asr()
320 void jas_matrix_asl(jas_matrix_t *matrix, int n) in jas_matrix_asl() argument
328 rowstep = jas_matrix_rowstep(matrix); in jas_matrix_asl()
329 for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, in jas_matrix_asl()
331 for (j = matrix->numcols_, data = rowstart; j > 0; --j, in jas_matrix_asl()
342 int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols) in jas_matrix_resize() argument
348 if (size > matrix->datasize_ || numrows > matrix->maxrows_) { in jas_matrix_resize()
352 matrix->numrows_ = numrows; in jas_matrix_resize()
353 matrix->numcols_ = numcols; in jas_matrix_resize()
356 matrix->rows_[i] = &matrix->data_[numcols * i]; in jas_matrix_resize()
362 void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val) in jas_matrix_setall() argument
370 rowstep = jas_matrix_rowstep(matrix); in jas_matrix_setall()
371 for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, in jas_matrix_setall()
373 for (j = matrix->numcols_, data = rowstart; j > 0; --j, in jas_matrix_setall()
382 jas_matrix_t *matrix; in jas_seq2d_input() local
395 if (!(matrix = jas_seq2d_create(xoff, yoff, xoff + numcols, yoff + numrows))) in jas_seq2d_input()
398 if (jas_matrix_numrows(matrix) != numrows || jas_matrix_numcols(matrix) != numcols) { in jas_seq2d_input()
403 for (i = 0; i < jas_matrix_numrows(matrix); i++) { in jas_seq2d_input()
404 for (j = 0; j < jas_matrix_numcols(matrix); j++) { in jas_seq2d_input()
406 jas_matrix_destroy(matrix); in jas_seq2d_input()
409 jas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x)); in jas_seq2d_input()
413 return matrix; in jas_seq2d_input()
416 int jas_seq2d_output(jas_matrix_t *matrix, FILE *out) in jas_seq2d_output() argument
426 fprintf(out, "%d %d\n", (int)jas_seq2d_xstart(matrix), in jas_seq2d_output()
427 (int)jas_seq2d_ystart(matrix)); in jas_seq2d_output()
428 fprintf(out, "%d %d\n", (int)jas_matrix_numcols(matrix), in jas_seq2d_output()
429 (int)jas_matrix_numrows(matrix)); in jas_seq2d_output()
432 for (i = 0; i < jas_matrix_numrows(matrix); ++i) { in jas_seq2d_output()
433 for (j = 0; j < jas_matrix_numcols(matrix); ++j) { in jas_seq2d_output()
434 x = jas_matrix_get(matrix, i, j); in jas_seq2d_output()
444 if (j == jas_matrix_numcols(matrix) - 1) { in jas_seq2d_output()