April 2023

lrzip-next can set zstd levels two ways.
1. Default mapping of lrzip-next levels 1-9 to zstd levels
2. Using --zstd-level=## which will map levels according to
   defaults enumerated in clevels.h -- excerpted below.

Method 1.

/* ZSTD strategies are mapped from ZSTD compression levels.
 * lrzip-next compression levels will be remapped between 1 and 22
 * zstd compression level will be max level for each strategy
 * mapping defined in clevels.h.
 * ZSTD_fast=1,		zstd level 2,  lrzip-next level 1
 * ZSTD_dfast=2,	zstd level 4,  lrzip-next level 2
 * ZSTD_greedy=3,	zstd level 5,  lrzip-next level 3
 * ZSTD_lazy=4,		zstd level 7,  lrzip-next level 4
 * ZSTD_lazy2=5,	zstd level 12, lrzip-next level 5
 * ZSTD_btlazy2=6,	zstd level 15, lrzip-next level 6
 * ZSTD_btopt=7,	zstd level 17, lrzip-next level 7
 * ZSTD_btultra=8,	zstd level 18, lrzip-next level 8
 * ZSTD_btultra2=9	zstd level 22, lrzip-next level 9
 */


Method 2. zstd levels 1-22 are mapped to 9 strategies.

clevels.h

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 * All rights reserved.
 *
 * This source code is licensed under both the BSD-style license (found in the
 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 * in the COPYING file in the root directory of this source tree).
 * You may select, at your option, one of the above-listed licenses.
 */


static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
{   /* "default" - for any srcSize > 256 KB */
    /* W,  C,  H,  S,  L, TL, strat */
    { 19, 12, 13,  1,  6,  1, ZSTD_fast    },  /* base for negative levels */
    { 19, 13, 14,  1,  7,  0, ZSTD_fast    },  /* level  1 */
    { 20, 15, 16,  1,  6,  0, ZSTD_fast    },  /* level  2 */
    { 21, 16, 17,  1,  5,  0, ZSTD_dfast   },  /* level  3 */
    { 21, 18, 18,  1,  5,  0, ZSTD_dfast   },  /* level  4 */
    { 21, 18, 19,  3,  5,  2, ZSTD_greedy  },  /* level  5 */
    { 21, 18, 19,  3,  5,  4, ZSTD_lazy    },  /* level  6 */
    { 21, 19, 20,  4,  5,  8, ZSTD_lazy    },  /* level  7 */
    { 21, 19, 20,  4,  5, 16, ZSTD_lazy2   },  /* level  8 */
    { 22, 20, 21,  4,  5, 16, ZSTD_lazy2   },  /* level  9 */
    { 22, 21, 22,  5,  5, 16, ZSTD_lazy2   },  /* level 10 */
    { 22, 21, 22,  6,  5, 16, ZSTD_lazy2   },  /* level 11 */
    { 22, 22, 23,  6,  5, 32, ZSTD_lazy2   },  /* level 12 */
    { 22, 22, 22,  4,  5, 32, ZSTD_btlazy2 },  /* level 13 */
    { 22, 22, 23,  5,  5, 32, ZSTD_btlazy2 },  /* level 14 */
    { 22, 23, 23,  6,  5, 32, ZSTD_btlazy2 },  /* level 15 */
    { 22, 22, 22,  5,  5, 48, ZSTD_btopt   },  /* level 16 */
    { 23, 23, 22,  5,  4, 64, ZSTD_btopt   },  /* level 17 */
    { 23, 23, 22,  6,  3, 64, ZSTD_btultra },  /* level 18 */
    { 23, 24, 22,  7,  3,256, ZSTD_btultra2},  /* level 19 */
    { 25, 25, 23,  7,  3,256, ZSTD_btultra2},  /* level 20 */
    { 26, 26, 24,  7,  3,512, ZSTD_btultra2},  /* level 21 */
    { 27, 27, 25,  9,  3,999, ZSTD_btultra2},  /* level 22 */
},
