X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Flz_optimal.h;h=95333db6b273851ec423337486f7e4ea45ac2b84;hb=349933ac7e49ee5a807396bfa27e2bf1684f4103;hp=3a07df5dabe3426716f3eedca3598861c2cb8601;hpb=c54fff5be87715448e2224bfc73f09ed7c570d22;p=wimlib diff --git a/include/wimlib/lz_optimal.h b/include/wimlib/lz_optimal.h index 3a07df5d..95333db6 100644 --- a/include/wimlib/lz_optimal.h +++ b/include/wimlib/lz_optimal.h @@ -237,16 +237,16 @@ typedef void (*lz_skip_bytes_t)(LZ_COMPRESSOR *ctx, input_idx_t n); * most recently been searched. This can optionally update the @state to take * into account format-dependent state that affects match costs, such as repeat * offsets. */ -typedef lz_mc_cost_t (lz_get_prev_literal_cost_t)(LZ_COMPRESSOR *ctx, - LZ_ADAPTIVE_STATE *state); +typedef lz_mc_cost_t (*lz_get_prev_literal_cost_t)(LZ_COMPRESSOR *ctx, + LZ_ADAPTIVE_STATE *state); /* Get the cost of a match. This can optionally update the @state to take into * account format-dependent state that affects match costs, such as repeat * offsets. */ -typedef lz_mc_cost_t (lz_get_match_cost_t)(LZ_COMPRESSOR *ctx, - LZ_ADAPTIVE_STATE *state, - input_idx_t length, - input_idx_t offset); +typedef lz_mc_cost_t (*lz_get_match_cost_t)(LZ_COMPRESSOR *ctx, + LZ_ADAPTIVE_STATE *state, + input_idx_t length, + input_idx_t offset); /* * lz_get_near_optimal_match() - @@ -413,31 +413,34 @@ lz_get_near_optimal_match(struct lz_match_chooser *mc, * at that position after the minimum-cost path is taken. The @cur_pos * variable stores the position at which the algorithm is currently * considering coding choices, and the @len_end variable stores the - * greatest offset at which the costs of coding choices have been saved. - * (The algorithm guarantees that all positions before @len_end are - * reachable by at least one path and therefore have costs computed.) + * greatest position at which the costs of coding choices have been + * saved. (Actually, the algorithm guarantees that all positions up to + * and including @len_end are reachable by at least one path.) * * The loop terminates when any one of the following conditions occurs: * - * 1. A match greater than @nice_len is found. When this is found, the - * algorithm chooses this match unconditionally, and consequently the - * near-optimal match/literal sequence up to and including that match - * is fully determined. + * 1. A match with length greater than or equal to @nice_len is found. + * When this occurs, the algorithm chooses this match + * unconditionally, and consequently the near-optimal match/literal + * sequence up to and including that match is fully determined and it + * can begin returning the match/literal list. * * 2. @cur_pos reaches a position not overlapped by a preceding match. * In such cases, the near-optimal match/literal sequence up to - * @cur_pos is fully determined. + * @cur_pos is fully determined and it can begin returning the + * match/literal list. * * 3. Failing either of the above in a degenerate case, the loop * terminates when space in the @mc->optimum array is exhausted. * This terminates the algorithm and forces it to start returning * matches/literals even though they may not be globally optimal. * - * Upon loop termination, a nonempty list of matches/literals has been - * produced and stored in the @optimum array. They are linked in - * reverse order, so the last thing this function does is reverse the - * links and return the first match/literal, leaving the rest to be - * returned immediately by subsequent calls to this function. + * Upon loop termination, a nonempty list of matches/literals will have + * been produced and stored in the @optimum array. These + * matches/literals are linked in reverse order, so the last thing this + * function does is reverse this list and return the first + * match/literal, leaving the rest to be returned immediately by + * subsequent calls to this function. */ input_idx_t cur_pos = 0; input_idx_t len_end = longest_match_len;