Module compare_groups

Source
Expand description

Processes custom field transformations and group comparisons defined in schemas.

This module implements analysis of user-defined field groupings and transformations, allowing comparison of different field arrangements and bit layouts. Unlike split comparisons which handle basic field reordering, this module supports complex transformations like:

  • Bit padding and alignment
  • Field slicing and partial reads
  • Custom field grouping patterns

§Core Types

§Example

compare_groups:
  - name: convert_7_to_8_bit
    description: "Convert 7-bit colors to 8-bit by padding"
    baseline:
      - type: array      # Original 7-bit values
        field: color7
        bits: 7
    comparisons:
      padded_8bit:      # Padded to 8 bits
        - type: struct
          fields:
            - type: field
              field: color7
              bits: 7
            - type: padding
              bits: 1
              value: 0

Each comparison analyzes:

  • Compression metrics (entropy, LZ matches)
  • Size comparisons (original, estimated, actual zstd)
  • Field-level statistics

§Usage Notes

  • Baseline group serves as reference for comparisons
  • Multiple comparison groups can be defined
  • Field transformations are applied during analysis
  • Bit padding and alignment can impact compression

§Submodules

  • generate_bytes: Core byte stream generation from schemas
  • [test_helpers]: Testing utilities (only in test builds)

Modules§

generate_bytes
Generates byte streams from schema-defined field groups for compression analysis.

Structs§

GroupComparisonResult
Contains the result of comparing custom field groupings defined in the schema.

Enums§

GroupComparisonError
Describes an error that occurred while computing a group comparison.