# rust-av/ssimulacra2 architecture

> Architecture diagram of the GitHub repository rust-av/ssimulacra2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rust-av/ssimulacra2
- Repository: https://github.com/rust-av/ssimulacra2

## Overview

##### Project Type Analysis
This is a specialized image processing library that implements the SSIMULACRA2 metric, focusing on comparing image quality. It's a standalone library crate (not a binary application) meant to be used as a dependency in other Rust projects.

##### Main Components

a. Core Components:
- Input Handler (Image Loading)
- Blur Processing Module
- Gaussian Blur Implementation
- SSIMULACRA2 Core Metric Calculator
- Output Score Generator

b. Supporting Components:
- Benchmarking System
- Test Data Handler

##### Main Processing Pipeline (Center)
- [Input Image] → [Blur Processing] → [Metric Calculation] → [Quality Score]

##### Blur Module Detail (Sub-section)
- [Gaussian Blur]
- ↑
- [Blur Module Interface]

##### Supporting Systems (Side Panels)
- [Benchmark System]   [Test Data]
- ↓                  ↓
- [Core Processing] ← [Validation]

##### Key Relationships to Highlight

- Relationship between the blur module and the core metric calculation
- Benchmark system's interaction with the core processing
- Demonstrate how test data feeds into the validation process

##### Technical Details

- Rust version requirement (1.62.0+)
- File formats supported (JXL, PFM as seen in test_data)
- Gaussian blur as a key processing component

**┌─ Development Support ─┐  ┌─ Core Processing ─┐  ┌─ Quality Assessment ─┐**
- Benchmarking       │  │ - Image Loading   │  │ - Metric Calculation │
- Test Data         │  │ - Blur Processing │  │ - Score Generation   │
- ┘  └─────────────────┘  └──────────────────────┘

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Development
        Bench["Benchmarking System"]:::bench
        TestData["Test Data Handler"]:::test
    end

    subgraph Core["Core Processing"]
        Input["Input Handler"]:::core
        BlurMod["Blur Processing Module"]:::core
        GaussBlur["Gaussian Blur Implementation"]:::core
        MetricCalc["SSIMULACRA2 Core Calculator"]:::core
        Score["Output Score Generator"]:::core
    end

    Input --> BlurMod
    BlurMod --> GaussBlur
    GaussBlur --> MetricCalc
    MetricCalc --> Score
    
    Bench -.-> MetricCalc
    TestData -.-> Input
    
    Build["Build Configuration"]:::support

    %% Click Events
    click BlurMod "https://github.com/rust-av/ssimulacra2/tree/main/src/blur/"
    click GaussBlur "https://github.com/rust-av/ssimulacra2/blob/main/src/blur/gaussian.rs"
    click MetricCalc "https://github.com/rust-av/ssimulacra2/blob/main/src/lib.rs"
    click Bench "https://github.com/rust-av/ssimulacra2/blob/main/benches/benches.rs"
    click TestData "https://github.com/rust-av/ssimulacra2/tree/main/test_data/"
    click Build "https://github.com/rust-av/ssimulacra2/blob/main/build.rs"

    %% Styling
    classDef core fill:#a8d1ff,stroke:#333
    classDef bench fill:#ffd7a8,stroke:#333
    classDef test fill:#a8ffc1,stroke:#333
    classDef support fill:#e6e6e6,stroke:#333

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Benchmarking"]:::bench
        L3["Testing"]:::test
        L4["Support"]:::support
    end
```
