libcdio-paranoia  10.2+0.94+2git
Functions
isort.c File Reference
#include "p_block.h"
#include "isort.h"

Functions

sort_info_tsort_alloc (long size)
 
void sort_unsortall (sort_info_t *i)
 
void sort_free (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)
 
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)
 

Function Documentation

sort_info_t* sort_alloc ( long  size)
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().