JasPer  4.2.4
One- and Two-Dimensional Sequences

One- and Two-Dimensional Sequences. More...

Classes

struct  jas_matrix_t
 Matrix type. More...
 
struct  jas_seq2d_t
 Two-dimensional sequence type. More...
 
struct  jas_seq_t
 One-dimensional sequence type. More...
 

Functions

static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numrows (const jas_matrix_t *matrix)
 Get the number of rows in a matrix. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numcols (const jas_matrix_t *matrix)
 Get the number of columns in a matrix. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_size (const jas_matrix_t *matrix)
 Get the number of elements in a matrix. More...
 
static JAS_ATTRIBUTE_PURE bool jas_matrix_empty (const jas_matrix_t *matrix)
 Test if a matrix is empty (i.e., contains no elements). More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
JAS_EXPORT jas_matrix_tjas_matrix_create (jas_matind_t numrows, jas_matind_t numcols)
 Create a matrix with the specified dimensions. More...
 
JAS_EXPORT void jas_matrix_destroy (jas_matrix_t *matrix)
 Destroy a matrix. More...
 
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. More...
 
JAS_EXPORT int jas_matrix_output (jas_matrix_t *matrix, FILE *out)
 Write a matrix to a C standard library stream. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
JAS_EXPORT void jas_matrix_asl (jas_matrix_t *matrix, unsigned n)
 Arithmetic shift left of all elements in a matrix. More...
 
JAS_EXPORT void jas_matrix_asr (jas_matrix_t *matrix, unsigned n)
 Arithmetic shift right of all elements in a matrix. More...
 
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. More...
 
JAS_EXPORT void jas_matrix_setall (jas_matrix_t *matrix, jas_seqent_t val)
 Set all elements of a matrix to the specified value. More...
 
static JAS_ATTRIBUTE_PURE size_t jas_matrix_rowstep (const jas_matrix_t *matrix)
 The spacing between rows of a matrix. More...
 
static JAS_ATTRIBUTE_PURE size_t jas_matrix_step (const jas_matrix_t *matrix)
 The spacing between columns of a matrix. More...
 
JAS_EXPORT int jas_matrix_cmp (jas_matrix_t *mat0, jas_matrix_t *mat1)
 Compare two matrices for equality. More...
 
JAS_EXPORT jas_matrix_tjas_matrix_copy (jas_matrix_t *x)
 Copy a matrix. More...
 
JAS_EXPORT jas_matrix_tjas_matrix_input (FILE *)
 Read a matrix from a C standard library stream. More...
 
JAS_EXPORT jas_seq2d_tjas_seq2d_copy (jas_seq2d_t *x)
 Copy a 2-D sequence. More...
 
JAS_EXPORT jas_matrix_tjas_seq2d_create (jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend)
 Create a 2-D sequence. More...
 
static void jas_seq2d_destroy (jas_seq2d_t *s)
 Destroy a 2-D sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xstart (const jas_seq2d_t *s)
 Get the starting x-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_ystart (const jas_seq2d_t *s)
 Get the starting y-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xend (const jas_seq2d_t *s)
 Get the ending x-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_yend (const jas_seq2d_t *s)
 Get the ending y-coordinate of the sequence. More...
 
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. More...
 
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. More...
 
static JAS_ATTRIBUTE_PURE size_t jas_seq2d_rowstep (const jas_seq2d_t *s)
 Get the stride between successive rows in the sequence. More...
 
static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_width (const jas_seq2d_t *s)
 Get the number of columns in the sequence. More...
 
static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_height (const jas_seq2d_t *s)
 Get the number of rows in the sequence. More...
 
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. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_size (const jas_seq2d_t *s)
 Get the number of elements in the sequence. More...
 
static JAS_ATTRIBUTE_PURE bool jas_seq2d_empty (const jas_seq2d_t *s)
 Test if the sequence is empty (i.e., contains no elements). More...
 
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. More...
 
static jas_seq_tjas_seq_create (jas_matind_t start, jas_matind_t end)
 Create a 1-D sequence. More...
 
static void jas_seq_destroy (jas_seq_t *seq)
 Destroy a 1-D sequence. More...
 
static void jas_seq_set (jas_seq_t *seq, jas_matind_t i, jas_seqent_t v)
 Set an element of a sequence. More...
 
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. More...
 
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. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_start (const jas_seq_t *seq)
 Get the starting index of a sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_end (const jas_seq_t *seq)
 Get the ending index of a sequence. More...
 

Detailed Description

One- and Two-Dimensional Sequences.

Function Documentation

◆ jas_matrix_asl()

JAS_EXPORT void jas_matrix_asl ( jas_matrix_t matrix,
unsigned  n 
)

Arithmetic shift left of all elements in a matrix.

◆ jas_matrix_asr()

JAS_EXPORT void jas_matrix_asr ( jas_matrix_t matrix,
unsigned  n 
)

Arithmetic shift right of all elements in a matrix.

◆ jas_matrix_bindcol()

static int jas_matrix_bindcol ( jas_matrix_t mat0,
jas_matrix_t mat1,
jas_matind_t  c 
)
inlinestatic

Create a matrix that is a reference to a column of another matrix.

◆ jas_matrix_bindrow()

static int jas_matrix_bindrow ( jas_matrix_t mat0,
jas_matrix_t mat1,
jas_matind_t  r 
)
inlinestatic

Create a matrix that is a reference to a row of another matrix.

◆ jas_matrix_bindsub()

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.

◆ jas_matrix_clip()

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.

◆ jas_matrix_cmp()

JAS_EXPORT int jas_matrix_cmp ( jas_matrix_t mat0,
jas_matrix_t mat1 
)

Compare two matrices for equality.

◆ jas_matrix_copy()

JAS_EXPORT jas_matrix_t* jas_matrix_copy ( jas_matrix_t x)

Copy a matrix.

◆ jas_matrix_create()

JAS_EXPORT jas_matrix_t* jas_matrix_create ( jas_matind_t  numrows,
jas_matind_t  numcols 
)

Create a matrix with the specified dimensions.

◆ jas_matrix_destroy()

JAS_EXPORT void jas_matrix_destroy ( jas_matrix_t matrix)

Destroy a matrix.

◆ jas_matrix_divpow2()

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.

◆ jas_matrix_empty()

static JAS_ATTRIBUTE_PURE bool jas_matrix_empty ( const jas_matrix_t matrix)
inlinestatic

Test if a matrix is empty (i.e., contains no elements).

◆ jas_matrix_get()

static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_get ( const jas_matrix_t matrix,
jas_matind_t  i,
jas_matind_t  j 
)
inlinestatic

Get a matrix element.

◆ jas_matrix_getref()

static JAS_ATTRIBUTE_PURE jas_seqent_t* jas_matrix_getref ( const jas_matrix_t matrix,
jas_matind_t  i,
jas_matind_t  j 
)
inlinestatic

Get the address of an element in a matrix.

◆ jas_matrix_getv()

static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_getv ( const jas_matrix_t matrix,
jas_matind_t  i 
)
inlinestatic

Get an element from a matrix that is known to be a row or column vector.

◆ jas_matrix_getvref()

static JAS_ATTRIBUTE_PURE jas_seqent_t* jas_matrix_getvref ( const jas_matrix_t matrix,
jas_matind_t  i 
)
inlinestatic

Get a reference to a particular row of a 2-D sequence.

◆ jas_matrix_input()

JAS_EXPORT jas_matrix_t* jas_matrix_input ( FILE *  )

Read a matrix from a C standard library stream.

◆ jas_matrix_numcols()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numcols ( const jas_matrix_t matrix)
inlinestatic

Get the number of columns in a matrix.

◆ jas_matrix_numrows()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numrows ( const jas_matrix_t matrix)
inlinestatic

Get the number of rows in a matrix.

◆ jas_matrix_output()

JAS_EXPORT int jas_matrix_output ( jas_matrix_t matrix,
FILE *  out 
)

Write a matrix to a C standard library stream.

◆ jas_matrix_resize()

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.

◆ jas_matrix_rowstep()

static JAS_ATTRIBUTE_PURE size_t jas_matrix_rowstep ( const jas_matrix_t matrix)
inlinestatic

The spacing between rows of a matrix.

◆ jas_matrix_set()

static void jas_matrix_set ( jas_matrix_t matrix,
jas_matind_t  i,
jas_matind_t  j,
jas_seqent_t  v 
)
inlinestatic

Set a matrix element.

◆ jas_matrix_setall()

JAS_EXPORT void jas_matrix_setall ( jas_matrix_t matrix,
jas_seqent_t  val 
)

Set all elements of a matrix to the specified value.

◆ jas_matrix_setv()

static void jas_matrix_setv ( jas_matrix_t matrix,
jas_matind_t  i,
jas_seqent_t  v 
)
inlinestatic

Set an element in a matrix that is known to be a row or column vector.

◆ jas_matrix_size()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_size ( const jas_matrix_t matrix)
inlinestatic

Get the number of elements in a matrix.

◆ jas_matrix_step()

static JAS_ATTRIBUTE_PURE size_t jas_matrix_step ( const jas_matrix_t matrix)
inlinestatic

The spacing between columns of a matrix.

◆ jas_seq2d_bindsub()

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.

◆ jas_seq2d_copy()

JAS_EXPORT jas_seq2d_t* jas_seq2d_copy ( jas_seq2d_t x)

Copy a 2-D sequence.

◆ jas_seq2d_create()

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.

◆ jas_seq2d_destroy()

static void jas_seq2d_destroy ( jas_seq2d_t s)
inlinestatic

Destroy a 2-D sequence.

◆ jas_seq2d_empty()

static JAS_ATTRIBUTE_PURE bool jas_seq2d_empty ( const jas_seq2d_t s)
inlinestatic

Test if the sequence is empty (i.e., contains no elements).

◆ jas_seq2d_get()

static JAS_ATTRIBUTE_PURE jas_seqent_t jas_seq2d_get ( const jas_seq2d_t s,
jas_matind_t  x,
jas_matind_t  y 
)
inlinestatic

Get an element of a 2-D sequence.

◆ jas_seq2d_getref()

static JAS_ATTRIBUTE_PURE jas_seqent_t* jas_seq2d_getref ( const jas_seq2d_t s,
jas_matind_t  x,
jas_matind_t  y 
)
inlinestatic

Get a pointer (i.e., reference) to an element of a 2-D sequence.

◆ jas_seq2d_height()

static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_height ( const jas_seq2d_t s)
inlinestatic

Get the number of rows in the sequence.

◆ jas_seq2d_rowstep()

static JAS_ATTRIBUTE_PURE size_t jas_seq2d_rowstep ( const jas_seq2d_t s)
inlinestatic

Get the stride between successive rows in the sequence.

◆ jas_seq2d_setshift()

static void jas_seq2d_setshift ( jas_seq2d_t s,
jas_matind_t  x,
jas_matind_t  y 
)
inlinestatic

Set the shift (i.e., starting x- and y-coordinates) of the sequence.

◆ jas_seq2d_size()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_size ( const jas_seq2d_t s)
inlinestatic

Get the number of elements in the sequence.

◆ jas_seq2d_width()

static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_width ( const jas_seq2d_t s)
inlinestatic

Get the number of columns in the sequence.

◆ jas_seq2d_xend()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xend ( const jas_seq2d_t s)
inlinestatic

Get the ending x-coordinate of the sequence.

◆ jas_seq2d_xstart()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xstart ( const jas_seq2d_t s)
inlinestatic

Get the starting x-coordinate of the sequence.

◆ jas_seq2d_yend()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_yend ( const jas_seq2d_t s)
inlinestatic

Get the ending y-coordinate of the sequence.

◆ jas_seq2d_ystart()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_ystart ( const jas_seq2d_t s)
inlinestatic

Get the starting y-coordinate of the sequence.

◆ jas_seq_create()

static jas_seq_t* jas_seq_create ( jas_matind_t  start,
jas_matind_t  end 
)
inlinestatic

Create a 1-D sequence.

◆ jas_seq_destroy()

static void jas_seq_destroy ( jas_seq_t seq)
inlinestatic

Destroy a 1-D sequence.

◆ jas_seq_end()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_end ( const jas_seq_t seq)
inlinestatic

Get the ending index of a sequence.

◆ jas_seq_get()

static JAS_ATTRIBUTE_PURE jas_seqent_t jas_seq_get ( const jas_seq_t seq,
jas_matind_t  i 
)
inlinestatic

Get an element of a sequence.

◆ jas_seq_getref()

static JAS_ATTRIBUTE_PURE jas_seqent_t* jas_seq_getref ( const jas_seq_t seq,
jas_matind_t  i 
)
inlinestatic

Get a pointer (i.e., reference) to an element of a sequence.

◆ jas_seq_set()

static void jas_seq_set ( jas_seq_t seq,
jas_matind_t  i,
jas_seqent_t  v 
)
inlinestatic

Set an element of a sequence.

◆ jas_seq_start()

static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_start ( const jas_seq_t seq)
inlinestatic

Get the starting index of a sequence.