Skip to content

Zstd compression level mapping #2081

@MerinoSheep

Description

@MerinoSheep

Bug description

Describe the bug
Documentation describes a 0-10 range which is not properly mapped to zstd's range of 1-22. The scaled value is saved to the PcapPlusPlus context but not the zstd compression parameter.

context->compression_level = compression_level * 2; //Input is scale 0-10 but zstd goes 0 - 20!
assert(!ZSTD_isError(ZSTD_CCtx_setParameter(context->cctx, ZSTD_c_compressionLevel, compression_level)));

Expected behavior
The scaling that gets applied to the context. For reference Technica-Engineering/LightPcapNG uses a slightly different calculation

//Input is scale 0-9 but zstd goes 1-22!
compression_level = (compression_level * 2) + 1;

PcapPlusPlus versions tested on

PcapPlusPlus master branch

Other PcapPlusPlus version (if applicable)

No response

Operating systems tested on

Linux

Other operation systems (if applicable)

No response

Compiler version

GCC 13.3.0

Packet capture backend (if applicable)

libpcap

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions