• Home
  • Raw
  • Download

Lines Matching full:best

456  * Selects the best segment in an epoch.
474 /* Try each segment (activeSegment) and save the best (bestSegment) */
484 * Save the best segment in bestSegment.
515 /* If this segment is the best so far save it */
766 /* We fill the dictionary from the back to allow the best segments to be
895 void COVER_best_init(COVER_best_t *best) { argument
896 if (best==NULL) return; /* compatible with init on NULL */
897 (void)ZSTD_pthread_mutex_init(&best->mutex, NULL);
898 (void)ZSTD_pthread_cond_init(&best->cond, NULL);
899 best->liveJobs = 0;
900 best->dict = NULL;
901 best->dictSize = 0;
902 best->compressedSize = (size_t)-1;
903 memset(&best->parameters, 0, sizeof(best->parameters));
909 void COVER_best_wait(COVER_best_t *best) { argument
910 if (!best) {
913 ZSTD_pthread_mutex_lock(&best->mutex);
914 while (best->liveJobs != 0) {
915 ZSTD_pthread_cond_wait(&best->cond, &best->mutex);
917 ZSTD_pthread_mutex_unlock(&best->mutex);
923 void COVER_best_destroy(COVER_best_t *best) { argument
924 if (!best) {
927 COVER_best_wait(best);
928 if (best->dict) {
929 free(best->dict);
931 ZSTD_pthread_mutex_destroy(&best->mutex);
932 ZSTD_pthread_cond_destroy(&best->cond);
939 void COVER_best_start(COVER_best_t *best) { argument
940 if (!best) {
943 ZSTD_pthread_mutex_lock(&best->mutex);
944 ++best->liveJobs;
945 ZSTD_pthread_mutex_unlock(&best->mutex);
951 * If this dictionary is the best so far save it and its parameters.
953 void COVER_best_finish(COVER_best_t* best, argument
960 if (!best) {
965 ZSTD_pthread_mutex_lock(&best->mutex);
966 --best->liveJobs;
967 liveJobs = best->liveJobs;
969 if (compressedSize < best->compressedSize) {
971 if (!best->dict || best->dictSize < dictSize) {
972 if (best->dict) {
973 free(best->dict);
975 best->dict = malloc(dictSize);
976 if (!best->dict) {
977 best->compressedSize = ERROR(GENERIC);
978 best->dictSize = 0;
979 ZSTD_pthread_cond_signal(&best->cond);
980 ZSTD_pthread_mutex_unlock(&best->mutex);
986 memcpy(best->dict, dict, dictSize);
987 best->dictSize = dictSize;
988 best->parameters = parameters;
989 best->compressedSize = compressedSize;
993 ZSTD_pthread_cond_broadcast(&best->cond);
995 ZSTD_pthread_mutex_unlock(&best->mutex);
1112 COVER_best_t *best; member
1160 COVER_best_finish(data->best, parameters, selection);
1190 COVER_best_t best; local
1219 COVER_best_init(&best);
1233 COVER_best_destroy(&best);
1250 COVER_best_destroy(&best);
1256 data->best = &best;
1272 COVER_best_start(&best);
1283 COVER_best_wait(&best);
1287 /* Fill the output buffer and parameters with output of the best parameters */
1289 const size_t dictSize = best.dictSize;
1290 if (ZSTD_isError(best.compressedSize)) {
1291 const size_t compressedSize = best.compressedSize;
1292 COVER_best_destroy(&best);
1296 *parameters = best.parameters;
1297 memcpy(dictBuffer, best.dict, dictSize);
1298 COVER_best_destroy(&best);