# xeon-smartupscale_v2

Experiment-faithful Intel Xeon video upscaler: **decode source -> in-memory Lanczos 480x270 -> Real-ESRGAN general-x4v3 x4 -> 1920x1080 H.264**.

This repository is intentionally narrow. It only packages the pipeline that produced the successful 1080p experiment result:

1. Decode source video frame by frame
2. Resize each frame in memory to `480x270` with Lanczos
3. Run `realesr-general-x4v3_480x270.xml` in OpenVINO CPU mode with a BF16 hint
4. Encode the final output as `1920x1080`, `libx264`, `preset=medium`, `crf=15`

## Install

```bash
bash install.sh
```

## Usage

```bash
./smartupscale.sh input.mp4
./smartupscale.sh input.mp4 -o out_1080p.mp4
```

## Notes

- Linux x86_64 only.
- Best on Intel CPUs with AMX-BF16.
- Output is always `1920x1080`.
- Lanczos pre-scale happens in memory. No intermediate stage file is encoded.
- The bundled model is the fixed `480x270 -> 1920x1080` OpenVINO IR used in the experiment.
- For ClawHub compatibility, the model weights are packaged as base64 data and restored to `.bin` during `install.sh`. Large payloads can be shipped as `*.bin.b64.part-*` chunks.
- This repo is meant for low-resolution sources that are close to the experiment input profile.
