Project Alice
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "../common/mem.h"
#include "../common/pool.h"
#include "../common/threading.h"
#include "../common/zstd_internal.h"
#include "../common/bits.h"
#include "../zdict.h"
#include "cover.h"
Go to the source code of this file.
Classes | |
struct | COVER_map_pair_t_s |
struct | COVER_map_s |
struct | COVER_ctx_t |
struct | COVER_tryParameters_data_s |
Macros | |
#define | ZDICT_STATIC_LINKING_ONLY |
#define | COVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB)) |
#define | COVER_DEFAULT_SPLITPOINT 1.0 |
#define | DISPLAY(...) |
#define | LOCALDISPLAYLEVEL(displayLevel, l, ...) |
#define | DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__) |
#define | LOCALDISPLAYUPDATE(displayLevel, l, ...) |
#define | DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__) |
#define | MAP_EMPTY_VALUE ((U32)-1) |
Typedefs | |
typedef struct COVER_map_pair_t_s | COVER_map_pair_t |
typedef struct COVER_map_s | COVER_map_t |
typedef struct COVER_tryParameters_data_s | COVER_tryParameters_data_t |
Functions | |
size_t | COVER_sum (const size_t *samplesSizes, unsigned nbSamples) |
void | COVER_warnOnSmallCorpus (size_t maxDictSize, size_t nbDmers, int displayLevel) |
COVER_epoch_info_t | COVER_computeEpochs (U32 maxDictSize, U32 nbDmers, U32 k, U32 passes) |
ZDICTLIB_STATIC_API size_t | ZDICT_trainFromBuffer_cover (void *dictBuffer, size_t dictBufferCapacity, const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, ZDICT_cover_params_t parameters) |
size_t | COVER_checkTotalCompressedSize (const ZDICT_cover_params_t parameters, const size_t *samplesSizes, const BYTE *samples, size_t *offsets, size_t nbTrainSamples, size_t nbSamples, BYTE *const dict, size_t dictBufferCapacity) |
void | COVER_best_init (COVER_best_t *best) |
void | COVER_best_wait (COVER_best_t *best) |
void | COVER_best_destroy (COVER_best_t *best) |
void | COVER_best_start (COVER_best_t *best) |
void | COVER_best_finish (COVER_best_t *best, ZDICT_cover_params_t parameters, COVER_dictSelection_t selection) |
COVER_dictSelection_t | COVER_dictSelectionError (size_t error) |
unsigned | COVER_dictSelectionIsError (COVER_dictSelection_t selection) |
void | COVER_dictSelectionFree (COVER_dictSelection_t selection) |
COVER_dictSelection_t | COVER_selectDict (BYTE *customDictContent, size_t dictBufferCapacity, size_t dictContentSize, const BYTE *samplesBuffer, const size_t *samplesSizes, unsigned nbFinalizeSamples, size_t nbCheckSamples, size_t nbSamples, ZDICT_cover_params_t params, size_t *offsets, size_t totalCompressedSize) |
ZDICTLIB_STATIC_API size_t | ZDICT_optimizeTrainFromBuffer_cover (void *dictBuffer, size_t dictBufferCapacity, const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, ZDICT_cover_params_t *parameters) |
#define COVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB)) |
#define DISPLAY | ( | ... | ) |
#define DISPLAYLEVEL | ( | l, | |
... | |||
) | LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__) |
#define DISPLAYUPDATE | ( | l, | |
... | |||
) | LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__) |
#define LOCALDISPLAYLEVEL | ( | displayLevel, | |
l, | |||
... | |||
) |
#define LOCALDISPLAYUPDATE | ( | displayLevel, | |
l, | |||
... | |||
) |
typedef struct COVER_map_pair_t_s COVER_map_pair_t |
typedef struct COVER_map_s COVER_map_t |
typedef struct COVER_tryParameters_data_s COVER_tryParameters_data_t |
Parameters for COVER_tryParameters().
void COVER_best_destroy | ( | COVER_best_t * | best | ) |
Call COVER_best_wait() and then destroy the COVER_best_t.
Definition at line 882 of file cover.c.
void COVER_best_finish | ( | COVER_best_t * | best, |
ZDICT_cover_params_t | parameters, | ||
COVER_dictSelection_t | selection | ||
) |
void COVER_best_init | ( | COVER_best_t * | best | ) |
void COVER_best_start | ( | COVER_best_t * | best | ) |
void COVER_best_wait | ( | COVER_best_t * | best | ) |
COVER_epoch_info_t COVER_computeEpochs | ( | U32 | maxDictSize, |
U32 | nbDmers, | ||
U32 | k, | ||
U32 | passes | ||
) |
Computes the number of epochs and the size of each epoch. We will make sure that each epoch gets at least 10 * k bytes.
The COVER algorithms divide the data up into epochs of equal size and select one segment from each epoch.
maxDictSize | The maximum allowed dictionary size. |
nbDmers | The number of dmers we are training on. |
k | The parameter k (segment size). |
passes | The target number of passes over the dmer corpus. More passes means a better dictionary. |
COVER_dictSelection_t COVER_dictSelectionError | ( | size_t | error | ) |
void COVER_dictSelectionFree | ( | COVER_dictSelection_t | selection | ) |
unsigned COVER_dictSelectionIsError | ( | COVER_dictSelection_t | selection | ) |
COVER_dictSelection_t COVER_selectDict | ( | BYTE * | customDictContent, |
size_t | dictBufferCapacity, | ||
size_t | dictContentSize, | ||
const BYTE * | samplesBuffer, | ||
const size_t * | samplesSizes, | ||
unsigned | nbFinalizeSamples, | ||
size_t | nbCheckSamples, | ||
size_t | nbSamples, | ||
ZDICT_cover_params_t | params, | ||
size_t * | offsets, | ||
size_t | totalCompressedSize | ||
) |
Called to finalize the dictionary and select one based on whether or not the shrink-dict flag was enabled. If enabled the dictionary used is the smallest dictionary within a specified regression of the compressed size from the largest dictionary.
Definition at line 979 of file cover.c.
size_t COVER_sum | ( | const size_t * | samplesSizes, |
unsigned | nbSamples | ||
) |
void COVER_warnOnSmallCorpus | ( | size_t | maxDictSize, |
size_t | nbDmers, | ||
int | displayLevel | ||
) |
ZDICTLIB_STATIC_API size_t ZDICT_optimizeTrainFromBuffer_cover | ( | void * | dictBuffer, |
size_t | dictBufferCapacity, | ||
const void * | samplesBuffer, | ||
const size_t * | samplesSizes, | ||
unsigned | nbSamples, | ||
ZDICT_cover_params_t * | parameters | ||
) |