libcdio-paranoia 10.2+2.0.2
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
 

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_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

◆ ib

#define ib (   i)    (*i->abspos)

◆ ie

#define ie (   i)    (i->size+*i->abspos)

◆ ipos

#define ipos (   i,
 
)    (l-i->revindex)

◆ is

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

◆ iv

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

Typedef Documentation

◆ sort_info_t

typedef struct sort_info sort_info_t

◆ sort_link_t

typedef struct sort_link sort_link_t

Function Documentation

◆ sort_alloc()

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.

◆ sort_free()

void sort_free ( sort_info_t i)

◆ sort_getmatch()

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_nextmatch()

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.

◆ sort_setup()

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.

◆ sort_unsortall()

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().