JasPer  4.2.1
jas_seq.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2000 Image Power, Inc. and the University of
3  * British Columbia.
4  * Copyright (c) 2001-2002 Michael David Adams.
5  * All rights reserved.
6  */
7 
8 /* __START_OF_JASPER_LICENSE__
9  *
10  * JasPer License Version 2.0
11  *
12  * Copyright (c) 2001-2006 Michael David Adams
13  * Copyright (c) 1999-2000 Image Power, Inc.
14  * Copyright (c) 1999-2000 The University of British Columbia
15  *
16  * All rights reserved.
17  *
18  * Permission is hereby granted, free of charge, to any person (the
19  * "User") obtaining a copy of this software and associated documentation
20  * files (the "Software"), to deal in the Software without restriction,
21  * including without limitation the rights to use, copy, modify, merge,
22  * publish, distribute, and/or sell copies of the Software, and to permit
23  * persons to whom the Software is furnished to do so, subject to the
24  * following conditions:
25  *
26  * 1. The above copyright notices and this permission notice (which
27  * includes the disclaimer below) shall be included in all copies or
28  * substantial portions of the Software.
29  *
30  * 2. The name of a copyright holder shall not be used to endorse or
31  * promote products derived from the Software without specific prior
32  * written permission.
33  *
34  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
35  * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
36  * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
37  * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
39  * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
40  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
41  * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
42  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
43  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
44  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
45  * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
46  * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
47  * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
48  * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
49  * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
50  * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
51  * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
52  * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
53  * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
54  * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
55  * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
56  * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
57  * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
58  * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
59  * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
60  *
61  * __END_OF_JASPER_LICENSE__
62  */
63 
69 #ifndef JAS_SEQ_H
70 #define JAS_SEQ_H
71 
72 /******************************************************************************\
73 * Includes.
74 \******************************************************************************/
75 
76 /* The configuration header file should be included first. */
77 #include <jasper/jas_config.h> /* IWYU pragma: keep */
78 
79 #include <jasper/jas_types.h>
80 #include <jasper/jas_fix.h>
81 #include <jasper/jas_math.h>
82 
83 #include <stdio.h>
84 
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
88 
94 /******************************************************************************\
95 * Constants.
96 \******************************************************************************/
97 
98 /* This matrix is a reference to another matrix. */
99 #define JAS_MATRIX_REF 0x0001
100 
101 /******************************************************************************\
102 * Types.
103 \******************************************************************************/
104 
105 /* An element in a sequence. */
106 typedef jas_fix_t jas_seqent_t;
107 #define PRIjas_seqent PRIjas_fix
108 
109 /* An element in a matrix. */
110 typedef jas_fix_t jas_matent_t;
111 
112 typedef jas_fix_t jas_matind_t;
113 
117 typedef struct {
118 
119  /* Additional state information. */
120  int flags_;
121 
122  /* The starting horizontal index. */
123  jas_matind_t xstart_;
124 
125  /* The starting vertical index. */
126  jas_matind_t ystart_;
127 
128  /* The ending horizontal index. */
129  jas_matind_t xend_;
130 
131  /* The ending vertical index. */
132  jas_matind_t yend_;
133 
134  /* The number of rows in the matrix. */
135  jas_matind_t numrows_;
136 
137  /* The number of columns in the matrix. */
138  jas_matind_t numcols_;
139 
140  /* Pointers to the start of each row. */
141  jas_seqent_t **rows_;
142 
143  /* The allocated size of the rows array. */
144  int_fast32_t maxrows_;
145 
146  /* The matrix data buffer. */
147  jas_seqent_t *data_;
148 
149  /* The allocated size of the data array. */
150  int_fast32_t datasize_;
151 
152 } jas_matrix_t;
153 
158 typedef jas_matrix_t jas_seq2d_t;
159 
164 typedef jas_matrix_t jas_seq_t;
165 
166 /******************************************************************************\
167 * Functions/macros for matrix class.
168 \******************************************************************************/
169 
174 JAS_ATTRIBUTE_PURE
175 static inline jas_matind_t jas_matrix_numrows(const jas_matrix_t *matrix)
176 {
177  return matrix->numrows_;
178 }
179 
183 JAS_ATTRIBUTE_PURE
184 static inline jas_matind_t jas_matrix_numcols(const jas_matrix_t *matrix)
185 {
186  return matrix->numcols_;
187 }
188 
193 JAS_ATTRIBUTE_PURE
194 static inline jas_matind_t jas_matrix_size(const jas_matrix_t *matrix)
195 {
196  return jas_matrix_numcols(matrix) * jas_matrix_numrows(matrix);
197 }
198 
203 JAS_ATTRIBUTE_PURE
204 static inline bool jas_matrix_empty(const jas_matrix_t *matrix)
205 {
206  return jas_matrix_numcols(matrix) == 0 || jas_matrix_numrows(matrix) == 0;
207 }
208 
213 JAS_ATTRIBUTE_PURE
214 static inline jas_seqent_t jas_matrix_get(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
215 {
216  assert(i >= 0 && i < matrix->numrows_ && j >= 0 && j < matrix->numcols_);
217  return matrix->rows_[i][j];
218 }
219 
224 static inline void jas_matrix_set(jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v)
225 {
226  assert(i >= 0 && i < matrix->numrows_ && j >= 0 && j < matrix->numcols_);
227  matrix->rows_[i][j] = v;
228 }
229 
234 JAS_ATTRIBUTE_PURE
235 static inline jas_seqent_t jas_matrix_getv(const jas_matrix_t *matrix, jas_matind_t i)
236 {
237  return matrix->numrows_ == 1
238  ? matrix->rows_[0][i]
239  : matrix->rows_[i][0];
240 }
241 
246 static inline void jas_matrix_setv(jas_matrix_t *matrix, jas_matind_t i, jas_seqent_t v)
247 {
248  if (matrix->numrows_ == 1)
249  matrix->rows_[0][i] = v;
250  else
251  matrix->rows_[i][0] = v;
252 }
253 
258 JAS_ATTRIBUTE_PURE
259 static inline jas_seqent_t *jas_matrix_getref(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
260 {
261  return &matrix->rows_[i][j];
262 }
263 
268 JAS_ATTRIBUTE_PURE
269 static inline jas_seqent_t *jas_matrix_getvref(const jas_matrix_t *matrix, jas_matind_t i)
270 {
271  return matrix->numrows_ > 1
272  ? jas_matrix_getref(matrix, i, 0)
273  : jas_matrix_getref(matrix, 0, i);
274 }
275 
280 JAS_EXPORT
281 jas_matrix_t *jas_matrix_create(jas_matind_t numrows, jas_matind_t numcols);
282 
287 JAS_EXPORT
288 void jas_matrix_destroy(jas_matrix_t *matrix);
289 
294 JAS_EXPORT
295 int jas_matrix_resize(jas_matrix_t *matrix, jas_matind_t numrows, jas_matind_t numcols);
296 
301 JAS_EXPORT
302 int jas_matrix_output(jas_matrix_t *matrix, FILE *out);
303 
308 JAS_EXPORT
309 int jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r0,
310  jas_matind_t c0, jas_matind_t r1, jas_matind_t c1);
311 
316 static inline int jas_matrix_bindrow(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r)
317 {
318  return jas_matrix_bindsub(mat0, mat1, r, 0, r, mat1->numcols_ - 1);
319 }
320 
325 static inline int jas_matrix_bindcol(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t c)
326 {
327  return jas_matrix_bindsub(mat0, mat1, 0, c, mat1->numrows_ - 1, c);
328 }
329 
334 JAS_EXPORT
335 void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval,
336  jas_seqent_t maxval);
337 
342 JAS_EXPORT
343 void jas_matrix_asl(jas_matrix_t *matrix, unsigned n);
344 
349 JAS_EXPORT
350 void jas_matrix_asr(jas_matrix_t *matrix, unsigned n);
351 
356 JAS_EXPORT
357 void jas_matrix_divpow2(jas_matrix_t *matrix, unsigned n);
358 
363 JAS_EXPORT
364 void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val);
365 
370 JAS_ATTRIBUTE_PURE
371 static inline size_t jas_matrix_rowstep(const jas_matrix_t *matrix)
372 {
373  return matrix->numrows_ > 1
374  ? (size_t)(matrix->rows_[1] - matrix->rows_[0])
375  : 0u;
376 }
377 
382 JAS_ATTRIBUTE_PURE
383 static inline size_t jas_matrix_step(const jas_matrix_t *matrix)
384 {
385  return matrix->numrows_ > 1
386  ? jas_matrix_rowstep(matrix)
387  : 1;
388 }
389 
394 JAS_EXPORT
395 int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1);
396 
401 JAS_EXPORT
403 
408 JAS_EXPORT
410 
414 JAS_ATTRIBUTE_CONST
415 static inline jas_seqent_t jas_seqent_asl(jas_seqent_t x, unsigned n)
416 {
417 #if 0
418 #ifdef JAS_ENABLE_32BIT
419  return jas_least32_asl(x, n);
420 #else
421  return jas_fast32_asl(x, n);
422 #endif
423 #endif
424  return jas_fix_asl(x, n);
425 }
426 
430 JAS_ATTRIBUTE_CONST
431 static inline jas_seqent_t jas_seqent_asr(jas_seqent_t x, unsigned n)
432 {
433 #if 0
434 #ifdef JAS_ENABLE_32BIT
435  return jas_least32_asr(x, n);
436 #else
437  return jas_fast32_asr(x, n);
438 #endif
439 #endif
440  return jas_fix_asr(x, n);
441 }
442 
443 /******************************************************************************\
444 * Functions/macros for 2-D sequence class.
445 \******************************************************************************/
446 
451 JAS_EXPORT
453 
458 JAS_EXPORT
459 jas_matrix_t *jas_seq2d_create(jas_matind_t xstart, jas_matind_t ystart,
460  jas_matind_t xend, jas_matind_t yend);
461 
466 static inline void jas_seq2d_destroy(jas_seq2d_t *s)
467 {
469 }
470 
475 JAS_ATTRIBUTE_PURE
476 static inline jas_matind_t jas_seq2d_xstart(const jas_seq2d_t *s)
477 {
478  return s->xstart_;
479 }
480 
485 JAS_ATTRIBUTE_PURE
486 static inline jas_matind_t jas_seq2d_ystart(const jas_seq2d_t *s)
487 {
488  return s->ystart_;
489 }
490 
495 JAS_ATTRIBUTE_PURE
496 static inline jas_matind_t jas_seq2d_xend(const jas_seq2d_t *s)
497 {
498  return s->xend_;
499 }
500 
505 JAS_ATTRIBUTE_PURE
506 static inline jas_matind_t jas_seq2d_yend(const jas_seq2d_t *s)
507 {
508  return s->yend_;
509 }
510 
515 JAS_ATTRIBUTE_PURE
516 static inline jas_seqent_t *jas_seq2d_getref(const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
517 {
518  return jas_matrix_getref(s, y - s->ystart_, x - s->xstart_);
519 }
520 
525 JAS_ATTRIBUTE_PURE
526 static inline jas_seqent_t jas_seq2d_get(const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
527 {
528  return jas_matrix_get(s, y - s->ystart_, x - s->xstart_);
529 }
530 
535 JAS_ATTRIBUTE_PURE
536 static inline size_t jas_seq2d_rowstep(const jas_seq2d_t *s)
537 {
538  return jas_matrix_rowstep(s);
539 }
540 
545 JAS_ATTRIBUTE_PURE
546 static inline unsigned jas_seq2d_width(const jas_seq2d_t *s)
547 {
548  return (unsigned)(s->xend_ - s->xstart_);
549 }
550 
555 JAS_ATTRIBUTE_PURE
556 static inline unsigned jas_seq2d_height(const jas_seq2d_t *s)
557 {
558  return (unsigned)(s->yend_ - s->ystart_);
559 }
560 
565 static inline void jas_seq2d_setshift(jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
566 {
567  s->xstart_ = x;
568  s->ystart_ = y;
569  s->xend_ = s->xstart_ + s->numcols_;
570  s->yend_ = s->ystart_ + s->numrows_;
571 }
572 
577 JAS_ATTRIBUTE_PURE
578 static inline jas_matind_t jas_seq2d_size(const jas_seq2d_t *s)
579 {
580  return jas_seq2d_width(s) * jas_seq2d_height(s);
581 }
582 
587 JAS_ATTRIBUTE_PURE
588 static inline bool jas_seq2d_empty(const jas_seq2d_t *s)
589 {
590  return jas_seq2d_width(s) == 0 || jas_seq2d_height(s) == 0;
591 }
592 
597 JAS_EXPORT
598 int jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, jas_matind_t xstart,
599  jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend);
600 
601 /******************************************************************************\
602 * Functions/macros for 1-D sequence class.
603 \******************************************************************************/
604 
609 static inline jas_seq_t *jas_seq_create(jas_matind_t start, jas_matind_t end)
610 {
611  return jas_seq2d_create(start, 0, end, 1);
612 }
613 
618 static inline void jas_seq_destroy(jas_seq_t *seq)
619 {
620  jas_seq2d_destroy(seq);
621 }
622 
627 static inline void jas_seq_set(jas_seq_t *seq, jas_matind_t i, jas_seqent_t v)
628 {
629  seq->rows_[0][i - seq->xstart_] = v;
630 }
631 
636 JAS_ATTRIBUTE_PURE
637 static inline jas_seqent_t *jas_seq_getref(const jas_seq_t *seq, jas_matind_t i)
638 {
639  return &seq->rows_[0][i - seq->xstart_];
640 }
641 
646 JAS_ATTRIBUTE_PURE
647 static inline jas_seqent_t jas_seq_get(const jas_seq_t *seq, jas_matind_t i)
648 {
649  return seq->rows_[0][i - seq->xstart_];
650 }
651 
656 JAS_ATTRIBUTE_PURE
657 static inline jas_matind_t jas_seq_start(const jas_seq_t *seq)
658 {
659  return seq->xstart_;
660 }
661 
666 JAS_ATTRIBUTE_PURE
667 static inline jas_matind_t jas_seq_end(const jas_seq_t *seq)
668 {
669  return seq->xend_;
670 }
671 
676 #ifdef __cplusplus
677 }
678 #endif
679 
680 #endif
int_least64_t jas_fix_t
Definition: jas_fix.h:101
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_seq_get(const jas_seq_t *seq, jas_matind_t i)
Get an element of a sequence.
Definition: jas_seq.h:647
static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_width(const jas_seq2d_t *s)
Get the number of columns in the sequence.
Definition: jas_seq.h:546
JAS_EXPORT jas_matrix_t * jas_matrix_create(jas_matind_t numrows, jas_matind_t numcols)
Create a matrix with the specified dimensions.
Definition: jas_seq.c:102
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_size(const jas_seq2d_t *s)
Get the number of elements in the sequence.
Definition: jas_seq.h:578
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_matrix_getvref(const jas_matrix_t *matrix, jas_matind_t i)
Get a reference to a particular row of a 2-D sequence.
Definition: jas_seq.h:269
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xend(const jas_seq2d_t *s)
Get the ending x-coordinate of the sequence.
Definition: jas_seq.h:496
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_ystart(const jas_seq2d_t *s)
Get the starting y-coordinate of the sequence.
Definition: jas_seq.h:486
JAS_EXPORT int jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r0, jas_matind_t c0, jas_matind_t r1, jas_matind_t c1)
Create a matrix that references part of another matrix.
Definition: jas_seq.c:217
static void jas_matrix_setv(jas_matrix_t *matrix, jas_matind_t i, jas_seqent_t v)
Set an element in a matrix that is known to be a row or column vector.
Definition: jas_seq.h:246
JAS_EXPORT jas_seq2d_t * jas_seq2d_copy(jas_seq2d_t *x)
Copy a 2-D sequence.
Definition: jas_seq.c:172
JAS_EXPORT void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval)
Clip the values of matrix elements to the specified range.
Definition: jas_seq.c:298
static JAS_ATTRIBUTE_PURE bool jas_matrix_empty(const jas_matrix_t *matrix)
Test if a matrix is empty (i.e., contains no elements).
Definition: jas_seq.h:204
static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_height(const jas_seq2d_t *s)
Get the number of rows in the sequence.
Definition: jas_seq.h:556
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_yend(const jas_seq2d_t *s)
Get the ending y-coordinate of the sequence.
Definition: jas_seq.h:506
static void jas_seq2d_destroy(jas_seq2d_t *s)
Destroy a 2-D sequence.
Definition: jas_seq.h:466
JAS_EXPORT int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1)
Compare two matrices for equality.
Definition: jas_seq.c:257
JAS_EXPORT int jas_matrix_resize(jas_matrix_t *matrix, jas_matind_t numrows, jas_matind_t numcols)
Resize a matrix. The previous contents of the matrix are lost.
Definition: jas_seq.c:375
JAS_EXPORT jas_matrix_t * jas_seq2d_create(jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend)
Create a 2-D sequence.
Definition: jas_seq.c:87
JAS_EXPORT void jas_matrix_divpow2(jas_matrix_t *matrix, unsigned n)
Almost-but-not-quite arithmetic shift right of all elements in a matrix.
Definition: jas_seq.c:276
static void jas_seq2d_setshift(jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
Set the shift (i.e., starting x- and y-coordinates) of the sequence.
Definition: jas_seq.h:565
JAS_EXPORT jas_matrix_t * jas_matrix_input(FILE *)
Read a matrix from a C standard library stream.
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xstart(const jas_seq2d_t *s)
Get the starting x-coordinate of the sequence.
Definition: jas_seq.h:476
static void jas_matrix_set(jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v)
Set a matrix element.
Definition: jas_seq.h:224
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numcols(const jas_matrix_t *matrix)
Get the number of columns in a matrix.
Definition: jas_seq.h:184
static JAS_ATTRIBUTE_PURE size_t jas_seq2d_rowstep(const jas_seq2d_t *s)
Get the stride between successive rows in the sequence.
Definition: jas_seq.h:536
static jas_seq_t * jas_seq_create(jas_matind_t start, jas_matind_t end)
Create a 1-D sequence.
Definition: jas_seq.h:609
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_get(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
Get a matrix element.
Definition: jas_seq.h:214
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_start(const jas_seq_t *seq)
Get the starting index of a sequence.
Definition: jas_seq.h:657
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_seq2d_get(const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
Get an element of a 2-D sequence.
Definition: jas_seq.h:526
static void jas_seq_destroy(jas_seq_t *seq)
Destroy a 1-D sequence.
Definition: jas_seq.h:618
static JAS_ATTRIBUTE_PURE bool jas_seq2d_empty(const jas_seq2d_t *s)
Test if the sequence is empty (i.e., contains no elements).
Definition: jas_seq.h:588
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numrows(const jas_matrix_t *matrix)
Get the number of rows in a matrix.
Definition: jas_seq.h:175
static int jas_matrix_bindrow(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r)
Create a matrix that is a reference to a row of another matrix.
Definition: jas_seq.h:316
JAS_EXPORT void jas_matrix_destroy(jas_matrix_t *matrix)
Destroy a matrix.
Definition: jas_seq.c:162
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_size(const jas_matrix_t *matrix)
Get the number of elements in a matrix.
Definition: jas_seq.h:194
JAS_EXPORT jas_matrix_t * jas_matrix_copy(jas_matrix_t *x)
Copy a matrix.
Definition: jas_seq.c:188
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_seq2d_getref(const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
Get a pointer (i.e., reference) to an element of a 2-D sequence.
Definition: jas_seq.h:516
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_end(const jas_seq_t *seq)
Get the ending index of a sequence.
Definition: jas_seq.h:667
JAS_EXPORT void jas_matrix_asr(jas_matrix_t *matrix, unsigned n)
Arithmetic shift right of all elements in a matrix.
Definition: jas_seq.c:327
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_matrix_getref(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
Get the address of an element in a matrix.
Definition: jas_seq.h:259
static void jas_seq_set(jas_seq_t *seq, jas_matind_t i, jas_seqent_t v)
Set an element of a sequence.
Definition: jas_seq.h:627
JAS_EXPORT void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val)
Set all elements of a matrix to the specified value.
Definition: jas_seq.c:396
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_seq_getref(const jas_seq_t *seq, jas_matind_t i)
Get a pointer (i.e., reference) to an element of a sequence.
Definition: jas_seq.h:637
static int jas_matrix_bindcol(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t c)
Create a matrix that is a reference to a column of another matrix.
Definition: jas_seq.h:325
static JAS_ATTRIBUTE_PURE size_t jas_matrix_step(const jas_matrix_t *matrix)
The spacing between columns of a matrix.
Definition: jas_seq.h:383
JAS_EXPORT void jas_matrix_asl(jas_matrix_t *matrix, unsigned n)
Arithmetic shift left of all elements in a matrix.
Definition: jas_seq.c:349
static JAS_ATTRIBUTE_PURE size_t jas_matrix_rowstep(const jas_matrix_t *matrix)
The spacing between rows of a matrix.
Definition: jas_seq.h:371
JAS_EXPORT int jas_matrix_output(jas_matrix_t *matrix, FILE *out)
Write a matrix to a C standard library stream.
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_getv(const jas_matrix_t *matrix, jas_matind_t i)
Get an element from a matrix that is known to be a row or column vector.
Definition: jas_seq.h:235
JAS_EXPORT int jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend)
Initialize a sequence to reference a subsequence of another sequence.
Definition: jas_seq.c:206
JasPer Fixed-Point Number Class.
Math-Related Code.
Primitive Types.
Matrix type.
Definition: jas_seq.h:117
Two-dimensional sequence type.
One-dimensional sequence type.