src/io.c File Reference

#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <it/vec.h>
#include <it/mat.h>
#include <it/io.h>
#include <it/types.h>
#include <it/cplx.h>
#include <it/poly.h>

Go to the source code of this file.

Defines

#define it_fmt_max_length   (20)
#define FOURCC(a, b, c, d)   ((int)(a) | ((int)(b) << 8) | ((int)(c) << 16) | ((int)(d) << 24) )

Functions

void it_set_vec_default_fmt (char *fmt)
void it_set_mat_default_fmt (char *fmt)
void it_printf (char *fmt,...)
void it_vprintf (char *fmt, va_list args)
void it_warning (char *fmt,...)
void it_error (char *fmt,...)
void __it_assert (int a, const char *filename, int line, char *message)
void it_fprintf (FILE *output, char *fmt,...)
void it_vfprintf (FILE *output, char *fmt, va_list ap)
char * it_read_double (char *s, double *p_val)
char * it_read_float (char *s, float *p_val)
char * it_read_cplx (char *s, cplx *p_val)
char * it_read_int (char *s, int *p_val)
char * it_read_vec (char *s, vec *v)
char * it_read_fvec (char *s, vec *v)
char * it_read_cvec (char *s, cvec *v)
char * it_read_ivec (char *s, ivec *v)
char * it_read_bvec (char *s, bvec *v)
char * it_read_mat (char *s, mat *m)
char * it_read_fmat (char *s, mat *m)
char * it_read_cmat (char *s, cmat *m)
char * it_read_imat (char *s, imat *m)
char * it_read_bmat (char *s, bmat *m)
vec vec_new_string (char *s)
vec fvec_new_string (char *s)
ivec ivec_new_string (char *s)
bvec bvec_new_string (char *s)
cvec cvec_new_string (char *s)
mat mat_new_string (char *s)
mat fmat_new_string (char *s)
cmat cmat_new_string (char *s)
imat imat_new_string (char *s)
bmat bmat_new_string (char *s)
static void pnm_read_comments (FILE *F, char *comments, int length)
static int pnm_read_header (FILE *file, char *p_pnm_type, int *p_width, int *p_height, int *p_max_val, char *comments, int length)
static int pnm_write_header (FILE *file, char type, int width, int height, int max_val, const char *comments)
char pnm_type (const char *filename)
int pnm_info (const char *filename, char *p_pnm_type, int *p_width, int *p_height, int *p_max_val, char *comments, int length)
mat mat_pgm_read (const char *filename)
imat imat_pgm_read (const char *filename)
int mat_pgm_write (const char *filename, mat m)
int imat_pgm_write (const char *filename, imat m)
static byte wav_read8 (FILE *file)
static unsigned short wav_read16 (FILE *file)
static unsigned long wav_read32 (FILE *file)
static int wav_read_sample (FILE *file, int depth)
static void wav_write8 (FILE *file, byte c)
static void wav_write16 (FILE *file, unsigned short c)
static void wav_write32 (FILE *file, unsigned long c)
static void wav_write_sample (FILE *file, int depth, int v)
static int wav_read_header (FILE *file, int *p_channels, int *p_srate, int *p_depth, int *p_length)
static void wav_write_header (FILE *file, int channels, int srate, int depth, int length)
int wav_info (const char *filename, int *p_channels, int *p_srate, int *p_depth, int *p_length)
mat mat_wav_read (const char *filename)
imat imat_wav_read (const char *filename)
void mat_wav_write (const char *filename, mat m, int srate, int depth)
void imat_wav_write (const char *filename, imat m, int srate, int depth)
void vec_fwrite (FILE *stream, vec v)
void fvec_fwrite (FILE *stream, vec v)
void bvec_fwrite (FILE *stream, bvec v)
void ivec_fwrite (FILE *stream, ivec v)
void cvec_fwrite (FILE *stream, cvec v)
int vec_fread (FILE *stream, vec v)
int fvec_fread (FILE *stream, vec v)
int ivec_fread (FILE *stream, ivec v)
int bvec_fread (FILE *stream, bvec v)
int cvec_fread (FILE *stream, cvec v)
vec vec_new_fread (FILE *stream)
vec fvec_new_fread (FILE *stream)
bvec bvec_new_fread (FILE *stream)
ivec ivec_new_fread (FILE *stream)
cvec cvec_new_fread (FILE *stream)
void mat_fwrite (FILE *stream, mat m)
void fmat_fwrite (FILE *stream, mat m)
void bmat_fwrite (FILE *stream, bmat m)
void imat_fwrite (FILE *stream, imat m)
void cmat_fwrite (FILE *stream, cmat m)
int vec_sread (void *buffer, vec v)
int ivec_sread (void *buffer, ivec v)
mat mat_new_fread (FILE *stream)
bmat bmat_new_fread (FILE *stream)
imat imat_new_fread (FILE *stream)
cmat cmat_new_fread (FILE *stream)
bvec bvec_file_read_bits (const char *filename, int nb_max)
void bvec_file_write_bits (const char *filename, bvec v)

Variables

static char it_printf_vec_default_fmt [it_fmt_max_length+1] = "%.3lf"
static char it_printf_mat_default_fmt [it_fmt_max_length+1] = "$9.3lf"


Define Documentation

#define FOURCC ( a,
b,
c,
 )     ((int)(a) | ((int)(b) << 8) | ((int)(c) << 16) | ((int)(d) << 24) )

Definition at line 1506 of file io.c.

Referenced by wav_read_header(), and wav_write_header().

#define it_fmt_max_length   (20)

Definition at line 38 of file io.c.

Referenced by it_set_mat_default_fmt(), and it_set_vec_default_fmt().


Function Documentation

void cmat_fwrite ( FILE *  stream,
cmat  m 
)

Definition at line 2154 of file io.c.

References cmat_height(), and cmat_width().

char* it_read_cmat ( char *  s,
cmat m 
)

Definition at line 929 of file io.c.

References cmat_push_row, cmat_set_height, cvec_delete(), cvec_new(), it_error(), and it_read_cvec().

static void pnm_read_comments ( FILE *  F,
char *  comments,
int  length 
) [static]

Definition at line 1177 of file io.c.

Referenced by pnm_read_header().

static int pnm_read_header ( FILE *  file,
char *  p_pnm_type,
int *  p_width,
int *  p_height,
int *  p_max_val,
char *  comments,
int  length 
) [static]

Definition at line 1204 of file io.c.

References it_warning(), and pnm_read_comments().

Referenced by imat_pgm_read(), mat_pgm_read(), pnm_info(), and pnm_type().

static int pnm_write_header ( FILE *  file,
char  type,
int  width,
int  height,
int  max_val,
const char *  comments 
) [static]

Definition at line 1263 of file io.c.

Referenced by imat_pgm_write(), and mat_pgm_write().

static unsigned short wav_read16 ( FILE *  file  )  [static]

Definition at line 1420 of file io.c.

References wav_read8().

Referenced by wav_read_header().

static unsigned long wav_read32 ( FILE *  file  )  [static]

Definition at line 1431 of file io.c.

References wav_read8().

Referenced by wav_read_header().

static byte wav_read8 ( FILE *  file  )  [static]

Definition at line 1409 of file io.c.

References it_warning().

Referenced by wav_read16(), wav_read32(), and wav_read_sample().

static int wav_read_header ( FILE *  file,
int *  p_channels,
int *  p_srate,
int *  p_depth,
int *  p_length 
) [static]

Definition at line 1509 of file io.c.

References FOURCC, it_warning(), wav_read16(), and wav_read32().

Referenced by imat_wav_read(), mat_wav_read(), and wav_info().

static int wav_read_sample ( FILE *  file,
int  depth 
) [static]

Definition at line 1444 of file io.c.

References wav_read8().

Referenced by imat_wav_read(), and mat_wav_read().

static void wav_write16 ( FILE *  file,
unsigned short  c 
) [static]

Definition at line 1472 of file io.c.

References wav_write8().

Referenced by wav_write_header().

static void wav_write32 ( FILE *  file,
unsigned long  c 
) [static]

Definition at line 1479 of file io.c.

References wav_write8().

Referenced by wav_write_header().

static void wav_write8 ( FILE *  file,
byte  c 
) [static]

Definition at line 1467 of file io.c.

Referenced by wav_write16(), wav_write32(), and wav_write_sample().

static void wav_write_header ( FILE *  file,
int  channels,
int  srate,
int  depth,
int  length 
) [static]

Definition at line 1599 of file io.c.

References FOURCC, wav_write16(), and wav_write32().

Referenced by imat_wav_write(), and mat_wav_write().

static void wav_write_sample ( FILE *  file,
int  depth,
int  v 
) [static]

Definition at line 1488 of file io.c.

References wav_write8().

Referenced by imat_wav_write(), and mat_wav_write().


Variable Documentation

char it_printf_mat_default_fmt[it_fmt_max_length+1] = "$9.3lf" [static]

Definition at line 40 of file io.c.

Referenced by it_vfprintf().

char it_printf_vec_default_fmt[it_fmt_max_length+1] = "%.3lf" [static]

Definition at line 39 of file io.c.

Referenced by it_set_mat_default_fmt(), it_set_vec_default_fmt(), and it_vfprintf().


Hosted by
Copyright (C) 2005-2006 Hervé Jégou
Vivien Chappelier
Francois Cayre
libit logo courtesy of Jonathan Delhumeau