# Triple AHD Example

## Overview

This example demonstrates how to use K230 for three-channel AHD (Analog High Definition) video input. AHD is an analog HD transmission technology that supports up to 1080P analog video input.

## Functional Description

### AHD Characteristics

- Three simultaneous AHD inputs
- Decoding analog HD video into digital frames
- Display output through the board display path
- Switching between channels at runtime

### AHD Specifications

- 720P and 1080P class input
- 25 fps or 30 fps
- YUV422 or YUV420 output formats
- AHD, TVI, and CVI style analog-HD sources

### Main Functions

- AHD video capture
- video decode processing
- video display output
- multi-channel switching

## Source Location

Demo source path: `src/rtsmart/examples/integrated_poc/smart_ipc/face_detection`

## Usage

### Build

In the `K230 RTOS SDK` root directory, run `make menuconfig`, enable the triple-AHD sample, then rebuild the firmware.

### Hardware Preparation

- prepare three AHD cameras
- connect all three cameras to K230 AHD input interfaces
- connect a display device (HDMI or LCD)

### Run

```bash
./sample_ahd
```

Example output:

```text
Three-way AHD Demo
=================

Initializing AHD channels...
Channel 1: 1080P @ 30fps
Channel 2: 1080P @ 30fps
Channel 3: 720P @ 25fps

Starting video capture...
Channel 1 active, outputting to display
Use keys 1-3 to switch channels

Press '1' to switch to Channel 1
Press '2' to switch to Channel 2
Press '3' to switch to Channel 3
Press 'q' to quit

Current channel: 1
[Video display...]
```

You can switch the displayed channel by key input.

```{admonition} Tip
AHD cameras require dedicated AHD input interfaces. Make sure your hardware supports AHD capture. For VICAP APIs, refer to [VICAP API](../../api_reference/mpp/vicap.md).
```
