libcdio-paranoia  10.2+0.94+2git
Data Structures | Macros | Typedefs | Functions
isort.h File Reference

Go to the source code of this file.

Data Structures

struct  sort_link
struct  sort_info


#define is(i)   (i->size)
#define ib(i)   (*i->abspos)
#define ie(i)   (i->size+*i->abspos)
#define iv(i)   (i->vector)
#define ipos(i, l)   (l-i->revindex)


typedef struct sort_link sort_link_t
typedef struct sort_info sort_info_t


sort_info_tsort_alloc (long int size)
void sort_unsortall (sort_info_t *i)
void sort_setup (sort_info_t *i, int16_t *vector, long int *abspos, long int size, long int sortlo, long int sorthi)
void sort_free (sort_info_t *i)
sort_link_tsort_getmatch (sort_info_t *i, long post, long overlap, int value)
sort_link_tsort_nextmatch (sort_info_t *i, sort_link_t *prev)

Macro Definition Documentation

#define ib (   i)    (*i->abspos)
#define ie (   i)    (i->size+*i->abspos)
#define ipos (   i,
)    (l-i->revindex)

Referenced by sort_getmatch(), and sort_nextmatch().

#define is (   i)    (i->size)
#define iv (   i)    (i->vector)

Typedef Documentation

typedef struct sort_info sort_info_t
typedef struct sort_link sort_link_t

Function Documentation

sort_info_t* sort_alloc ( long int  size)

======================================================================== sort_alloc()

Allocates and initializes a new, empty sort_info object, which can be used to index up to (size) samples from a vector.

void sort_free ( sort_info_t i)
sort_link_t* sort_getmatch ( sort_info_t i,
long  post,
long  overlap,
int  value 

======================================================================== sort_getmatch()

This function returns a sort_link_t pointer which refers to the first sample equal to (value) in the vector. It only searches for hits within (overlap) samples of (post), where (post) is an offset within the vector. The caller can determine the position of the matched sample using ipos(sort_info *, sort_link *).

This function returns NULL if no matches were found.

References sort_info::head, sort_info::hi, ipos, sort_info::lo, max, min, sort_link::next, NULL, sort_info::size, sort_info::sortbegin, and sort_info::val.

sort_link_t* sort_nextmatch ( sort_info_t i,
sort_link_t prev 

======================================================================== sort_nextmatch()

This function returns a sort_link_t pointer which refers to the next sample matching the criteria previously passed to sort_getmatch(). See sort_getmatch() for details.

This function returns NULL if no further matches were found.

References sort_info::hi, ipos, sort_link::next, and NULL.

void sort_setup ( sort_info_t i,
int16_t *  vector,
long int *  abspos,
long int  size,
long int  sortlo,
long int  sorthi 

======================================================================== sort_setup()

This function initializes a previously allocated sort_info_t. The sort_info_t is associated with a vector of samples of length (size), whose position begins at (*abspos) within the CD's stream of samples. Only the range of samples between (sortlo, sorthi) will eventually be indexed for fast searching. (sortlo, sorthi) are absolute sample positions.

???: Why is abspos a pointer? Why not just store a copy?

Note: size must be <= the size given to the preceding sort_alloc(), but no error checking is done here.

References sort_info::abspos, sort_info::hi, sort_info::lo, max, min, sort_info::size, sort_unsortall(), sort_info::sortbegin, and sort_info::vector.

void sort_unsortall ( sort_info_t i)

======================================================================== sort_unsortall() (internal)

This function resets the index for further use with a different vector or range, without the overhead of an unnecessary free/alloc.

References sort_info::bucketusage, sort_info::head, sort_info::lastbucket, NULL, and sort_info::sortbegin.

Referenced by sort_setup().