# hijoouzc/hevc_reference_software architecture

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

- Interactive diagram: https://gitdiagram.com/hijoouzc/hevc_reference_software
- Repository: https://github.com/hijoouzc/hevc_reference_software
- Video tour (about a minute): https://gitdiagram.com/hijoouzc/hevc_reference_software/video

## Overview

HM is reference software for HEVC (H.265), providing encoder and decoder applications for producing and reconstructing video bitstreams. The main workflow is configured by a user: the encoder reads raw YUV, performs HEVC coding, and writes a bitstream; the decoder reads that bitstream, reconstructs pictures, and can write raw YUV output. The tree also documents supporting bitstream tools and SEI-focused applications, represented as separate branches. The sampled excerpts show decoder I/O, syntax parsing, and MCTS extraction; other links reflect the documented product purpose and module layout rather than inspected call sites.

Main entry points: [`source/App/TAppEncoder/TAppEncTop.cpp`](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppEncoder/TAppEncTop.cpp) (Encoder app), [`source/App/SEIRemovalApp/SEIRemovalApp.cpp`](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/SEIRemovalApp/SEIRemovalApp.cpp) (SEI removal), [`source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp`](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp) (Film grain tool), [`source/App/TAppDecoder/TAppDecTop.cpp`](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppDecoder/TAppDecTop.cpp) (Decoder app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["Applications"]
  node_encapp["Encoder app<br/>[TAppEncTop.cpp]"]
  node_enccfg["Encoder options<br/>[TAppEncCfg.cpp]"]
  node_decapp["Decoder app<br/>[TAppDecTop.cpp]"]
end

subgraph group_codec["Codec engines"]
  node_enc["HEVC encoder<br/>[TEncTop.cpp]"]
  node_search["Mode search<br/>[TEncSearch.cpp]"]
  node_nalwrite["NAL writer<br/>[NALwrite.cpp]"]
  node_dec["HEVC decoder<br/>[TDecTop.cpp]"]
  node_syntax["Syntax parser"]
end

subgraph group_common["Shared video core"]
  node_common["Video coding core"]
  node_yuvio["YUV I/O<br/>[TVideoIOYuv.cpp]"]
  node_sei["SEI messages<br/>[SEI.cpp]"]
end

subgraph group_tools["Bitstream and SEI tools"]
  node_mcts["MCTS extractor<br/>[TAppMctsExtTop.cpp]"]
  node_parcat["Bitstream concatenator<br/>[parcat.cpp]"]
  node_sei_remove["SEI removal<br/>[SEIRemovalApp.cpp]"]
  node_grain["Film grain tool"]
end

node_user(("User"))
node_rawin["Raw YUV input"]
node_bitstream["HEVC bitstream"]
node_recon["Reconstructed YUV"]
node_output["Tool output"]

node_user -->|"configures"| node_encapp
node_user -->|"invokes"| node_decapp
node_user -->|"invokes"| node_mcts
node_user -->|"invokes"| node_parcat
node_user -->|"invokes"| node_sei_remove
node_user -->|"invokes"| node_grain
node_enccfg -->|"configures"| node_encapp
node_encapp -->|"reads frames"| node_yuvio
node_rawin -->|"supplies frames"| node_yuvio
node_encapp -->|"encodes"| node_enc
node_enc -->|"searches modes"| node_search
node_enc -->|"uses coding data"| node_common
node_encapp -->|"writes NAL units"| node_nalwrite
node_nalwrite -->|"produces"| node_bitstream
node_decapp -->|"decodes"| node_dec
node_bitstream -->|"supplies stream"| node_decapp
node_dec -->|"parses syntax"| node_syntax
node_dec -->|"uses coding data"| node_common
node_decapp -->|"writes pictures"| node_yuvio
node_yuvio -->|"produces"| node_recon
node_mcts -->|"parses picture headers"| node_dec
node_mcts -->|"reads and rewrites"| node_bitstream
node_parcat -->|"combines streams"| node_bitstream
node_parcat -->|"writes"| node_output
node_sei_remove -->|"reads stream"| node_bitstream
node_sei_remove -->|"processes messages"| node_sei
node_sei_remove -->|"writes stream"| node_output
node_grain -->|"reads stream"| node_bitstream
node_grain -->|"processes grain SEI"| node_sei
node_grain -->|"writes stream"| node_output

click node_encapp "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppEncoder/TAppEncTop.cpp"
click node_enccfg "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppEncoder/TAppEncCfg.cpp"
click node_enc "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibEncoder/TEncTop.cpp"
click node_search "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibEncoder/TEncSearch.cpp"
click node_common "https://github.com/hijoouzc/hevc_reference_software/tree/master/source/Lib/TLibCommon"
click node_yuvio "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/Utilities/TVideoIOYuv.cpp"
click node_nalwrite "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibEncoder/NALwrite.cpp"
click node_decapp "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppDecoder/TAppDecTop.cpp"
click node_dec "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibDecoder/TDecTop.cpp"
click node_syntax "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibDecoder/SyntaxElementParser.cpp"
click node_mcts "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppMCTSExtractor/TAppMctsExtTop.cpp"
click node_parcat "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/Parcat/parcat.cpp"
click node_sei_remove "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/SEIRemovalApp/SEIRemovalApp.cpp"
click node_grain "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp"
click node_sei "https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibCommon/SEI.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_encapp,node_enccfg,node_decapp,node_user toneBlue
class node_enc,node_search,node_nalwrite,node_dec,node_syntax toneAmber
class node_common,node_yuvio,node_sei toneMint
class node_mcts,node_parcat,node_sei_remove,node_grain toneRose
class node_rawin,node_bitstream,node_recon,node_output toneIndigo
```

## Components

### Applications

- [Encoder app](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppEncoder/TAppEncTop.cpp): `source/App/TAppEncoder/TAppEncTop.cpp`
- [Encoder options](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppEncoder/TAppEncCfg.cpp): `source/App/TAppEncoder/TAppEncCfg.cpp`
- [Decoder app](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppDecoder/TAppDecTop.cpp): `source/App/TAppDecoder/TAppDecTop.cpp`

### Codec engines

- [HEVC encoder](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibEncoder/TEncTop.cpp): `source/Lib/TLibEncoder/TEncTop.cpp`
- [Mode search](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibEncoder/TEncSearch.cpp): `source/Lib/TLibEncoder/TEncSearch.cpp`
- [NAL writer](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibEncoder/NALwrite.cpp): `source/Lib/TLibEncoder/NALwrite.cpp`
- [HEVC decoder](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibDecoder/TDecTop.cpp): `source/Lib/TLibDecoder/TDecTop.cpp`
- [Syntax parser](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibDecoder/SyntaxElementParser.cpp): `source/Lib/TLibDecoder/SyntaxElementParser.cpp`

### Shared video core

- [Video coding core](https://github.com/hijoouzc/hevc_reference_software/tree/master/source/Lib/TLibCommon): `source/Lib/TLibCommon`
- [YUV I/O](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/Utilities/TVideoIOYuv.cpp): `source/Lib/Utilities/TVideoIOYuv.cpp`
- [SEI messages](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/Lib/TLibCommon/SEI.cpp): `source/Lib/TLibCommon/SEI.cpp`

### Bitstream and SEI tools

- [MCTS extractor](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/TAppMCTSExtractor/TAppMctsExtTop.cpp): `source/App/TAppMCTSExtractor/TAppMctsExtTop.cpp`
- [Bitstream concatenator](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/Parcat/parcat.cpp): `source/App/Parcat/parcat.cpp`
- [SEI removal](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/SEIRemovalApp/SEIRemovalApp.cpp): `source/App/SEIRemovalApp/SEIRemovalApp.cpp`
- [Film grain tool](https://github.com/hijoouzc/hevc_reference_software/blob/master/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp): `source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp`

### Other components

- **User**
- **Raw YUV input**
- **HEVC bitstream**
- **Reconstructed YUV**
- **Tool output**

## Connections

- User → Encoder app: configures
- User → Decoder app: invokes
- User → MCTS extractor: invokes
- User → Bitstream concatenator: invokes
- User → SEI removal: invokes
- User → Film grain tool: invokes
- Encoder options → Encoder app: configures
- Encoder app → YUV I/O: reads frames
- Raw YUV input → YUV I/O: supplies frames
- Encoder app → HEVC encoder: encodes
- HEVC encoder → Mode search: searches modes
- HEVC encoder → Video coding core: uses coding data
- Encoder app → NAL writer: writes NAL units
- NAL writer → HEVC bitstream: produces
- Decoder app → HEVC decoder: decodes
- HEVC bitstream → Decoder app: supplies stream
- HEVC decoder → Syntax parser: parses syntax
- HEVC decoder → Video coding core: uses coding data
- Decoder app → YUV I/O: writes pictures
- YUV I/O → Reconstructed YUV: produces
- MCTS extractor → HEVC decoder: parses picture headers
- MCTS extractor → HEVC bitstream: reads and rewrites
- Bitstream concatenator → HEVC bitstream: combines streams
- Bitstream concatenator → Tool output: writes
- SEI removal → HEVC bitstream: reads stream
- SEI removal → SEI messages: processes messages
- SEI removal → Tool output: writes stream
- Film grain tool → HEVC bitstream: reads stream
- Film grain tool → SEI messages: processes grain SEI
- Film grain tool → Tool output: writes stream
