# garlyx/garlyfg architecture

> Architecture diagram of the GitHub repository garlyx/garlyfg, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/garlyx/garlyfg
- Repository: https://github.com/garlyx/garlyfg

## Overview

GarlyFG is a Windows frame-generation application and library: it captures two real frames, estimates motion, synthesizes intermediate frames, then paces and presents them. Users can run this in a terminal UI, headless mode, or live game overlay; CPU and D3D11 backends provide generation, while tools cover quality, performance, capture, and live-mode validation. The live pipeline is documented, but most implementation files were not sampled, so some internal links are omitted rather than inferred.

Main entry points: [`src/live/live_session.cpp`](https://github.com/garlyx/garlyfg/blob/main/src/live/live_session.cpp) (Live Session), [`app/app.cpp`](https://github.com/garlyx/garlyfg/blob/main/app/app.cpp) (Terminal UI), [`include/garlyfg/interpolator.hpp`](https://github.com/garlyx/garlyfg/blob/main/include/garlyfg/interpolator.hpp) (Interpolator API), [`src/d3d11/d3d11_interpolator.cpp`](https://github.com/garlyx/garlyfg/blob/main/src/d3d11/d3d11_interpolator.cpp) (D3D11 Backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_ui["Terminal UI<br/>[app.cpp]"]
  node_settings["Settings &amp; Profiles<br/>[settings_io.cpp]"]
  node_canvas["Terminal Canvas<br/>[canvas.cpp]"]
end

subgraph group_generation["Frame Generation"]
  node_interpolator["Interpolator API<br/>[interpolator.hpp]"]
  node_cpu["CPU Backend"]
  node_d3d["D3D11 Backend"]
  node_shaders["Compute Shaders<br/>[d3d11_shaders.cpp]"]
  node_refine["Neural Refinement<br/>[refine.cpp]"]
  node_pacer["Frame Pacer<br/>[frame_pacer.cpp]"]
  node_gpuinfo["GPU Discovery<br/>[gpu_info.cpp]"]
  node_metrics["Image Metrics<br/>[metrics.cpp]"]
end

subgraph group_live["Live Game Mode"]
  node_live_session["Live Session<br/>[live_session.cpp]"]
  node_capture["Window Capture<br/>[wgc_capture.cpp]"]
  node_dxgi["DXGI Capture<br/>[dxgi_capture.cpp]"]
  node_overlay["Overlay Presenter"]
end

subgraph group_tools["Analysis Tools"]
  node_bench["Benchmark<br/>[main.cpp]"]
  node_quality["Quality Evaluation<br/>[main.cpp]"]
  node_record["Frame Recorder<br/>[main.cpp]"]
  node_livecheck["Live Mode Checks<br/>[main.cpp]"]
  node_pacing_tool["Pacing Simulation<br/>[main.cpp]"]
  node_imgtool["Image Utility<br/>[main.cpp]"]
end

node_user(("User"))

node_user -->|"operates"| node_ui
node_ui -->|"loads and saves"| node_settings
node_ui -->|"starts"| node_live_session
node_ui -->|"draws UI"| node_canvas
node_live_session -->|"captures frames"| node_capture
node_live_session -.->|"may capture"| node_dxgi
node_live_session -->|"submits frames"| node_interpolator
node_interpolator -->|"selects backend"| node_d3d
node_interpolator -->|"selects fallback"| node_cpu
node_d3d -->|"runs compute"| node_shaders
node_cpu -->|"may refine"| node_refine
node_d3d -->|"may refine"| node_refine
node_live_session -->|"schedules output"| node_pacer
node_live_session -->|"presents output"| node_overlay
node_ui -.->|"lists adapters"| node_gpuinfo
node_user -->|"runs"| node_bench
node_user -->|"runs"| node_quality
node_record -->|"supplies corpus"| node_quality
node_user -->|"runs"| node_livecheck
node_user -->|"runs"| node_pacing_tool
node_user -->|"runs"| node_imgtool
node_quality -.->|"measures quality"| node_metrics

click node_ui "https://github.com/garlyx/garlyfg/blob/main/app/app.cpp"
click node_settings "https://github.com/garlyx/garlyfg/blob/main/app/settings_io.cpp"
click node_canvas "https://github.com/garlyx/garlyfg/blob/main/app/tui/canvas.cpp"
click node_live_session "https://github.com/garlyx/garlyfg/blob/main/src/live/live_session.cpp"
click node_capture "https://github.com/garlyx/garlyfg/blob/main/src/live/wgc_capture.cpp"
click node_dxgi "https://github.com/garlyx/garlyfg/blob/main/src/live/dxgi_capture.cpp"
click node_interpolator "https://github.com/garlyx/garlyfg/blob/main/include/garlyfg/interpolator.hpp"
click node_cpu "https://github.com/garlyx/garlyfg/blob/main/src/cpu/cpu_interpolator.cpp"
click node_d3d "https://github.com/garlyx/garlyfg/blob/main/src/d3d11/d3d11_interpolator.cpp"
click node_shaders "https://github.com/garlyx/garlyfg/blob/main/src/d3d11/d3d11_shaders.cpp"
click node_refine "https://github.com/garlyx/garlyfg/blob/main/src/nn/refine.cpp"
click node_pacer "https://github.com/garlyx/garlyfg/blob/main/src/frame_pacer.cpp"
click node_overlay "https://github.com/garlyx/garlyfg/blob/main/src/live/overlay_presenter.cpp"
click node_gpuinfo "https://github.com/garlyx/garlyfg/blob/main/src/gpu_info.cpp"
click node_bench "https://github.com/garlyx/garlyfg/blob/main/tools/fg_bench/main.cpp"
click node_quality "https://github.com/garlyx/garlyfg/blob/main/tools/fg_quality/main.cpp"
click node_record "https://github.com/garlyx/garlyfg/blob/main/tools/fg_record/main.cpp"
click node_livecheck "https://github.com/garlyx/garlyfg/blob/main/tools/fg_livecheck/main.cpp"
click node_pacing_tool "https://github.com/garlyx/garlyfg/blob/main/tools/fg_pacing/main.cpp"
click node_imgtool "https://github.com/garlyx/garlyfg/blob/main/tools/fg_imgtool/main.cpp"
click node_metrics "https://github.com/garlyx/garlyfg/blob/main/src/metrics.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_settings,node_canvas,node_user toneBlue
class node_interpolator,node_cpu,node_d3d,node_shaders,node_refine,node_pacer,node_gpuinfo,node_metrics toneAmber
class node_live_session,node_capture,node_dxgi,node_overlay toneMint
class node_bench,node_quality,node_record,node_livecheck,node_pacing_tool,node_imgtool toneRose
```

## Components

### Application

- [Terminal UI](https://github.com/garlyx/garlyfg/blob/main/app/app.cpp): `app/app.cpp`
- [Settings & Profiles](https://github.com/garlyx/garlyfg/blob/main/app/settings_io.cpp): `app/settings_io.cpp`
- [Terminal Canvas](https://github.com/garlyx/garlyfg/blob/main/app/tui/canvas.cpp): `app/tui/canvas.cpp`

### Frame Generation

- [Interpolator API](https://github.com/garlyx/garlyfg/blob/main/include/garlyfg/interpolator.hpp): `include/garlyfg/interpolator.hpp`
- [CPU Backend](https://github.com/garlyx/garlyfg/blob/main/src/cpu/cpu_interpolator.cpp): `src/cpu/cpu_interpolator.cpp`
- [D3D11 Backend](https://github.com/garlyx/garlyfg/blob/main/src/d3d11/d3d11_interpolator.cpp): `src/d3d11/d3d11_interpolator.cpp`
- [Compute Shaders](https://github.com/garlyx/garlyfg/blob/main/src/d3d11/d3d11_shaders.cpp): `src/d3d11/d3d11_shaders.cpp`
- [Neural Refinement](https://github.com/garlyx/garlyfg/blob/main/src/nn/refine.cpp): `src/nn/refine.cpp`
- [Frame Pacer](https://github.com/garlyx/garlyfg/blob/main/src/frame_pacer.cpp): `src/frame_pacer.cpp`
- [GPU Discovery](https://github.com/garlyx/garlyfg/blob/main/src/gpu_info.cpp): `src/gpu_info.cpp`
- [Image Metrics](https://github.com/garlyx/garlyfg/blob/main/src/metrics.cpp): `src/metrics.cpp`

### Live Game Mode

- [Live Session](https://github.com/garlyx/garlyfg/blob/main/src/live/live_session.cpp): `src/live/live_session.cpp`
- [Window Capture](https://github.com/garlyx/garlyfg/blob/main/src/live/wgc_capture.cpp): `src/live/wgc_capture.cpp`
- [DXGI Capture](https://github.com/garlyx/garlyfg/blob/main/src/live/dxgi_capture.cpp): `src/live/dxgi_capture.cpp`
- [Overlay Presenter](https://github.com/garlyx/garlyfg/blob/main/src/live/overlay_presenter.cpp): `src/live/overlay_presenter.cpp`

### Analysis Tools

- [Benchmark](https://github.com/garlyx/garlyfg/blob/main/tools/fg_bench/main.cpp): `tools/fg_bench/main.cpp`
- [Quality Evaluation](https://github.com/garlyx/garlyfg/blob/main/tools/fg_quality/main.cpp): `tools/fg_quality/main.cpp`
- [Frame Recorder](https://github.com/garlyx/garlyfg/blob/main/tools/fg_record/main.cpp): `tools/fg_record/main.cpp`
- [Live Mode Checks](https://github.com/garlyx/garlyfg/blob/main/tools/fg_livecheck/main.cpp): `tools/fg_livecheck/main.cpp`
- [Pacing Simulation](https://github.com/garlyx/garlyfg/blob/main/tools/fg_pacing/main.cpp): `tools/fg_pacing/main.cpp`
- [Image Utility](https://github.com/garlyx/garlyfg/blob/main/tools/fg_imgtool/main.cpp): `tools/fg_imgtool/main.cpp`

### Other components

- **User**

## Connections

- User → Terminal UI: operates (evidence: `README.md`)
- Terminal UI → Settings & Profiles: loads and saves (evidence: `README.md`)
- Terminal UI → Live Session: starts (evidence: `app/app.cpp`)
- Terminal UI → Terminal Canvas: draws UI
- Live Session → Window Capture: captures frames
- Live Session → DXGI Capture: may capture
- Live Session → Interpolator API: submits frames
- Interpolator API → D3D11 Backend: selects backend (evidence: `README.md`)
- Interpolator API → CPU Backend: selects fallback (evidence: `README.md`)
- D3D11 Backend → Compute Shaders: runs compute (evidence: `src/d3d11/d3d11_interpolator.cpp`)
- CPU Backend → Neural Refinement: may refine (evidence: `src/cpu/cpu_interpolator.cpp`)
- D3D11 Backend → Neural Refinement: may refine (evidence: `src/d3d11/d3d11_interpolator.cpp`)
- Live Session → Frame Pacer: schedules output
- Live Session → Overlay Presenter: presents output
- Terminal UI → GPU Discovery: lists adapters (evidence: `README.md`)
- User → Benchmark: runs (evidence: `README.md`)
- User → Quality Evaluation: runs (evidence: `README.md`)
- Frame Recorder → Quality Evaluation: supplies corpus (evidence: `README.md`)
- User → Live Mode Checks: runs (evidence: `README.md`)
- User → Pacing Simulation: runs (evidence: `README.md`)
- User → Image Utility: runs (evidence: `README.md`)
- Quality Evaluation → Image Metrics: measures quality (evidence: `README.md`)
