JasPer 3.0.3
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_math.h>
81
82#include <stdio.h>
83
84#ifdef __cplusplus
85extern "C" {
86#endif
87
93/******************************************************************************\
94* Constants.
95\******************************************************************************/
96
97/* This matrix is a reference to another matrix. */
98#define JAS_MATRIX_REF 0x0001
99
100/******************************************************************************\
101* Types.
102\******************************************************************************/
103
104/* An element in a sequence. */
105#ifdef JAS_ENABLE_32BIT
106typedef int_least32_t jas_seqent_t;
107#define PRIjas_seqent PRIiLEAST32
108#else
109typedef int_fast32_t jas_seqent_t;
110#define PRIjas_seqent PRIiFAST32
111#endif
112
113/* An element in a matrix. */
114#ifdef JAS_ENABLE_32BIT
115typedef int_least32_t jas_matent_t;
116#else
117typedef int_fast32_t jas_matent_t;
118#endif
119
120#ifdef JAS_ENABLE_32BIT
121typedef int_least32_t jas_matind_t;
122#else
123typedef int_fast32_t jas_matind_t;
124#endif
125
129typedef struct {
130
131 /* Additional state information. */
132 int flags_;
133
134 /* The starting horizontal index. */
135 jas_matind_t xstart_;
136
137 /* The starting vertical index. */
138 jas_matind_t ystart_;
139
140 /* The ending horizontal index. */
141 jas_matind_t xend_;
142
143 /* The ending vertical index. */
144 jas_matind_t yend_;
145
146 /* The number of rows in the matrix. */
147 jas_matind_t numrows_;
148
149 /* The number of columns in the matrix. */
150 jas_matind_t numcols_;
151
152 /* Pointers to the start of each row. */
153 jas_seqent_t **rows_;
154
155 /* The allocated size of the rows array. */
156 int_fast32_t maxrows_;
157
158 /* The matrix data buffer. */
159 jas_seqent_t *data_;
160
161 /* The allocated size of the data array. */
162 int_fast32_t datasize_;
163
165
171
176typedef jas_matrix_t jas_seq_t;
177
178/******************************************************************************\
179* Functions/macros for matrix class.
180\******************************************************************************/
181
186JAS_ATTRIBUTE_PURE
187static inline jas_matind_t jas_matrix_numrows(const jas_matrix_t *matrix)
188{
189 return matrix->numrows_;
190}
191
195JAS_ATTRIBUTE_PURE
196static inline jas_matind_t jas_matrix_numcols(const jas_matrix_t *matrix)
197{
198 return matrix->numcols_;
199}
200
205JAS_ATTRIBUTE_PURE
206static inline jas_matind_t jas_matrix_size(const jas_matrix_t *matrix)
207{
208 return jas_matrix_numcols(matrix) * jas_matrix_numrows(matrix);
209}
210
215JAS_ATTRIBUTE_PURE
216static inline bool jas_matrix_empty(const jas_matrix_t *matrix)
217{
218 return jas_matrix_numcols(matrix) == 0 || jas_matrix_numrows(matrix) == 0;
219}
220
225JAS_ATTRIBUTE_PURE
226static inline jas_seqent_t jas_matrix_get(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
227{
228 assert(i >= 0 && i < matrix->numrows_ && j >= 0 && j < matrix->numcols_);
229 return matrix->rows_[i][j];
230}
231
236static inline void jas_matrix_set(jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v)
237{
238 assert(i >= 0 && i < matrix->numrows_ && j >= 0 && j < matrix->numcols_);
239 matrix->rows_[i][j] = v;
240}
241
246JAS_ATTRIBUTE_PURE
247static inline jas_seqent_t jas_matrix_getv(const jas_matrix_t *matrix, jas_matind_t i)
248{
249 return matrix->numrows_ == 1
250 ? matrix->rows_[0][i]
251 : matrix->rows_[i][0];
252}
253
258static inline void jas_matrix_setv(jas_matrix_t *matrix, jas_matind_t i, jas_seqent_t v)
259{
260 if (matrix->numrows_ == 1)
261 matrix->rows_[0][i] = v;
262 else
263 matrix->rows_[i][0] = v;
264}
265
270JAS_ATTRIBUTE_PURE
271static inline jas_seqent_t *jas_matrix_getref(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
272{
273 return &matrix->rows_[i][j];
274}
275
280JAS_ATTRIBUTE_PURE
281static inline jas_seqent_t *jas_matrix_getvref(const jas_matrix_t *matrix, jas_matind_t i)
282{
283 return matrix->numrows_ > 1
284 ? jas_matrix_getref(matrix, i, 0)
285 : jas_matrix_getref(matrix, 0, i);
286}
287
292JAS_EXPORT
293jas_matrix_t *jas_matrix_create(jas_matind_t numrows, jas_matind_t numcols);
294
299JAS_EXPORT
300void jas_matrix_destroy(jas_matrix_t *matrix);
301
306JAS_EXPORT
307int jas_matrix_resize(jas_matrix_t *matrix, jas_matind_t numrows, jas_matind_t numcols);
308
313JAS_EXPORT
314int jas_matrix_output(jas_matrix_t *matrix, FILE *out);
315
320JAS_EXPORT
321int jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r0,
322 jas_matind_t c0, jas_matind_t r1, jas_matind_t c1);
323
328static inline int jas_matrix_bindrow(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r)
329{
330 return jas_matrix_bindsub(mat0, mat1, r, 0, r, mat1->numcols_ - 1);
331}
332
337static inline int jas_matrix_bindcol(jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t c)
338{
339 return jas_matrix_bindsub(mat0, mat1, 0, c, mat1->numrows_ - 1, c);
340}
341
346JAS_EXPORT
347void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval,
348 jas_seqent_t maxval);
349
354JAS_EXPORT
355void jas_matrix_asl(jas_matrix_t *matrix, unsigned n);
356
361JAS_EXPORT
362void jas_matrix_asr(jas_matrix_t *matrix, unsigned n);
363
368JAS_EXPORT
369void jas_matrix_divpow2(jas_matrix_t *matrix, unsigned n);
370
375JAS_EXPORT
376void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val);
377
382JAS_ATTRIBUTE_PURE
383static inline size_t jas_matrix_rowstep(const jas_matrix_t *matrix)
384{
385 return matrix->numrows_ > 1
386 ? (size_t)(matrix->rows_[1] - matrix->rows_[0])
387 : 0u;
388}
389
394JAS_ATTRIBUTE_PURE
395static inline size_t jas_matrix_step(const jas_matrix_t *matrix)
396{
397 return matrix->numrows_ > 1
398 ? jas_matrix_rowstep(matrix)
399 : 1;
400}
401
406JAS_EXPORT
408
413JAS_EXPORT
415
420JAS_EXPORT
422
426JAS_ATTRIBUTE_CONST
427static inline jas_seqent_t jas_seqent_asl(jas_seqent_t x, unsigned n)
428{
429#ifdef JAS_ENABLE_32BIT
430 return jas_least32_asl(x, n);
431#else
432 return jas_fast32_asl(x, n);
433#endif
434}
435
439JAS_ATTRIBUTE_CONST
440static inline jas_seqent_t jas_seqent_asr(jas_seqent_t x, unsigned n)
441{
442#ifdef JAS_ENABLE_32BIT
443 return jas_least32_asr(x, n);
444#else
445 return jas_fast32_asr(x, n);
446#endif
447}
448
449/******************************************************************************\
450* Functions/macros for 2-D sequence class.
451\******************************************************************************/
452
457JAS_EXPORT
459
464JAS_EXPORT
465jas_matrix_t *jas_seq2d_create(jas_matind_t xstart, jas_matind_t ystart,
466 jas_matind_t xend, jas_matind_t yend);
467
472static inline void jas_seq2d_destroy(jas_seq2d_t *s)
473{
475}
476
481JAS_ATTRIBUTE_PURE
482static inline jas_matind_t jas_seq2d_xstart(const jas_seq2d_t *s)
483{
484 return s->xstart_;
485}
486
491JAS_ATTRIBUTE_PURE
492static inline jas_matind_t jas_seq2d_ystart(const jas_seq2d_t *s)
493{
494 return s->ystart_;
495}
496
501JAS_ATTRIBUTE_PURE
502static inline jas_matind_t jas_seq2d_xend(const jas_seq2d_t *s)
503{
504 return s->xend_;
505}
506
511JAS_ATTRIBUTE_PURE
512static inline jas_matind_t jas_seq2d_yend(const jas_seq2d_t *s)
513{
514 return s->yend_;
515}
516
521JAS_ATTRIBUTE_PURE
522static inline jas_seqent_t *jas_seq2d_getref(const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
523{
524 return jas_matrix_getref(s, y - s->ystart_, x - s->xstart_);
525}
526
531JAS_ATTRIBUTE_PURE
532static inline jas_seqent_t jas_seq2d_get(const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
533{
534 return jas_matrix_get(s, y - s->ystart_, x - s->xstart_);
535}
536
541JAS_ATTRIBUTE_PURE
542static inline size_t jas_seq2d_rowstep(const jas_seq2d_t *s)
543{
544 return jas_matrix_rowstep(s);
545}
546
551JAS_ATTRIBUTE_PURE
552static inline unsigned jas_seq2d_width(const jas_seq2d_t *s)
553{
554 return (unsigned)(s->xend_ - s->xstart_);
555}
556
561JAS_ATTRIBUTE_PURE
562static inline unsigned jas_seq2d_height(const jas_seq2d_t *s)
563{
564 return (unsigned)(s->yend_ - s->ystart_);
565}
566
571static inline void jas_seq2d_setshift(jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
572{
573 s->xstart_ = x;
574 s->ystart_ = y;
575 s->xend_ = s->xstart_ + s->numcols_;
576 s->yend_ = s->ystart_ + s->numrows_;
577}
578
583JAS_ATTRIBUTE_PURE
584static inline jas_matind_t jas_seq2d_size(const jas_seq2d_t *s)
585{
586 return jas_seq2d_width(s) * jas_seq2d_height(s);
587}
588
593JAS_ATTRIBUTE_PURE
594static inline bool jas_seq2d_empty(const jas_seq2d_t *s)
595{
596 return jas_seq2d_width(s) == 0 || jas_seq2d_height(s) == 0;
597}
598
603JAS_EXPORT
604int jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, jas_matind_t xstart,
605 jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend);
606
607/******************************************************************************\
608* Functions/macros for 1-D sequence class.
609\******************************************************************************/
610
615static inline jas_seq_t *jas_seq_create(jas_matind_t start, jas_matind_t end)
616{
617 return jas_seq2d_create(start, 0, end, 1);
618}
619
624static inline void jas_seq_destroy(jas_seq_t *seq)
625{
627}
628
633static inline void jas_seq_set(jas_seq_t *seq, jas_matind_t i, jas_seqent_t v)
634{
635 seq->rows_[0][i - seq->xstart_] = v;
636}
637
642JAS_ATTRIBUTE_PURE
643static inline jas_seqent_t *jas_seq_getref(const jas_seq_t *seq, jas_matind_t i)
644{
645 return &seq->rows_[0][i - seq->xstart_];
646}
647
652JAS_ATTRIBUTE_PURE
653static inline jas_seqent_t jas_seq_get(const jas_seq_t *seq, jas_matind_t i)
654{
655 return seq->rows_[0][i - seq->xstart_];
656}
657
662JAS_ATTRIBUTE_PURE
663static inline jas_matind_t jas_seq_start(const jas_seq_t *seq)
664{
665 return seq->xstart_;
666}
667
672JAS_ATTRIBUTE_PURE
673static inline jas_matind_t jas_seq_end(const jas_seq_t *seq)
674{
675 return seq->xend_;
676}
677
682#ifdef __cplusplus
683}
684#endif
685
686#endif
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:653
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:552
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:584
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:281
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:502
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:492
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:258
static jas_seq_t * jas_seq_create(jas_matind_t start, jas_matind_t end)
Create a 1-D sequence.
Definition: jas_seq.h:615
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
JAS_EXPORT jas_seq2d_t * jas_seq2d_copy(jas_seq2d_t *x)
Copy a 2-D sequence.
Definition: jas_seq.c:172
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:216
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:562
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:512
static void jas_seq2d_destroy(jas_seq2d_t *s)
Destroy a 2-D sequence.
Definition: jas_seq.h:472
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 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:571
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:482
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:236
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:196
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:542
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:226
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:663
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:532
static void jas_seq_destroy(jas_seq_t *seq)
Destroy a 1-D sequence.
Definition: jas_seq.h:624
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:271
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:594
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:187
JAS_EXPORT jas_matrix_t * jas_matrix_copy(jas_matrix_t *x)
Copy a matrix.
Definition: jas_seq.c:188
JAS_EXPORT jas_matrix_t * jas_matrix_input(FILE *)
Read a matrix from a C standard library stream.
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:328
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:206
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:643
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:673
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
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 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:633
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 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:337
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:395
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
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
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:522
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:383
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:247
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
Math-Related Code.
Primitive Types.
Matrix type.
Definition: jas_seq.h:129
Two-dimensional sequence type.
One-dimensional sequence type.