libcdio-paranoia 10.2+2.0.2
|
Go to the source code of this file.
Data Structures | |
struct | sort_link |
struct | sort_info |
Macros | |
#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) |
Typedefs | |
typedef struct sort_link | sort_link_t |
typedef struct sort_info | sort_info_t |
Functions | |
sort_info_t * | sort_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_t * | sort_getmatch (sort_info_t *i, long post, long overlap, int value) |
sort_link_t * | sort_nextmatch (sort_info_t *i, sort_link_t *prev) |
#define ib | ( | i | ) | (*i->abspos) |
#define ie | ( | i | ) | (i->size+*i->abspos) |
#define ipos | ( | i, | |
l | |||
) | (l-i->revindex) |
#define is | ( | i | ) | (i->size) |
#define iv | ( | i | ) | (i->vector) |
typedef struct sort_info sort_info_t |
typedef struct sort_link sort_link_t |
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 | ) |
References sort_info::bucketusage, sort_info::head, and sort_info::revindex.
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::sortbegin.
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().