📄 data.h
字号:
/* * -*- Mode: ANSI C -*- * $Id: data.h,v 1.5 1996/08/16 17:23:19 fernande Exp $ * $Source: /sgi.acct/sweldens/cvs/liftpack/include/data.h,v $ * Author: Gabriel Fernandez * * Here are the definitions of basic data structures and * the prototype definitions of functions that manipulate them. *//* do not edit anything above this line */#ifndef __DATA_H__#define __DATA_H__#include "flwtdef.h"/*************//* INTERVALS *//*************//* * Interval data structure: The array describes a segment of a * sampled signal with approximate real numbers. * For convenience, this array may be indexed * using both positive and negative integer * indices; hence, the least and final indices * as well as a pointer to the origin of the * array are stored. * An Interval X contains 1+X.final-X.least * elements in its data array. */typedef struct IntervalStruct { Flt *origin; /* a pointer to the origin of a data array */ int least, /* the least valid index in the array */ final; /* the final valid index in the array */} Interval;/****************//* BINARY TREES *//****************//* * Array Binary Trees (ABT) related functions */#define abtblock(N,L,B) ((L)*(N)+(B)*((N)>>(L))) /* the first index of a blok */#define abtblength(N,L) ((N)>>(L)) /* the length of a block *//* * BTN data structure: the basic element in a binary tree is a "binary tree node" * data structure, which is defined as BTN. */typedef struct BTNStruct { void *tag, /* a pointer to a data structure containing further information about this node */ *content; /* the interval or whatnot represented by the node */ struct BTNStruct *left, /* a pointer to the left descendent of this node */ *right; /* a pointer to the right descendent of this node */} BTN;/**********//* HEDGES *//**********//* * Hedge data structure: in an adapted analysis we must choose a basis * subset from the library tree. Once a subset is * chosen, it is necesary to describe it in a * convenient manner, so that the subset and the * coefficients from inner products with its elements * may be used in further computation. It is called * a hedge and is defined as follows. */typedef struct HedgeStruct { Matrix contents; /* an array of data structures containing the coefficients of the signal in the adapted basis */ void *tag; /* a pointer to an optional data structure containing extra information about the decomposition */ int *levels, /* the sequence of levels in encounter order */ blocks; /* the number of elements in the levels array, also the number of elements in the contents array */} Hedge;/*********//* ATOMS *//*********//* * The coefficients in the output arrays of an adapted wavelet analysis * consist on amplitudes tagged with associated scale, frequency, and * position indices. To fold this information we can define "time-frequency" * data structures for one, two and D dimensions named TFA1, TF2, and TFAD. * *//* * TFA1 data structure: its parameters are used to signify the level in * the decomposition tree, the block number within * that level, and the offset within the data array * of the block. */typedef struct TFA1Struct { Flt amplitude; /* the amplitude of the coefficient */ int level, /* the scale index */ block, /* the frequency index */ offset; /* the position index */} TFA1;/* * TFA2 data structure: it can be seen the beginnings of combinatorial * explosions. */typedef struct TFA2Struct { Flt amplitude; /* the amplitude of the coefficients */ int xlevel, /* the scale index along the rows */ ylevel, /* the scale index along the columns */ xblock, /* the number of oscillations along the row */ yblock, /* the number of oscillations along the column */ xoffset, /* the position index within a row */ yoffset; /* the position index within a column */} TFA2;/***********************//* FUNCTION PROTOTYPES *//***********************//* Interval */extern Interval *makeinterval ( Vector __data, const int __least, const int __final );extern void *freeinterval ( Interval *__segment );extern boolean ininterval ( const Interval __segment, const int __offset );extern int intervalstotal ( Interval *__in, const int __n );extern Interval enlargeinterval ( Interval __old, int __least, int __final );/* BTN */extern BTN *makebtn ( void *__content, BTN *__left, BTN *__right, void *__tag );extern void *freebtn ( BTN *__node, void (*__FreeContent)(void *), void (*__FreeTag)(void *) );extern BTN *makebtnt ( const int __level );extern BTN *btnt2btn ( BTN *__root, const int __level, const int __block );extern void *freebtnt ( BTN *__root, void (*__FreeContent)(void *), void (*__FreeTag)(void *) );extern BTN *btn2branch ( BTN *__self, const int __level, const int __block );/* Hedge */extern Hedge *makehedge ( int __blocks, Matrix __contents, int *__levels, void *__tag );/* extern void *freehedge ( Hedge *__in, void (*__FreeContent)(), void (*__FreeLevels)(), void (*__FreeTag)() ); */extern void *freehedge ( Hedge *__in );/* Manipulation */extern void abt2hedge ( Hedge *__graph, Vector __data, const int __length );extern int btnt2hedge ( Hedge *__graph, BTN *__root );#endif /* __DATA_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -