Speed & Quality: Optimizing TDeint for Real-Time Playback
What TDeint does
TDeint is a temporal deinterlacer (commonly a VapourSynth/AVS plugin or script) that uses motion-compensated algorithms to convert interlaced video into progressive frames while preserving temporal detail and minimizing artifacts.
Key trade-offs
- Speed vs quality: Higher motion search ranges, more precise motion estimation, and larger block sizes improve quality but slow processing.
- Latency: Real-time playback needs low per-frame processing time; any multi-frame lookahead increases latency.
- Artifacts: Faster, simpler modes may produce combing, ghosting, or judder; aggressive temporal smoothing can blur motion.
Settings to tune (practical defaults for real-time)
- Mode / algorithm: Use a fast temporal mode (e.g., low-complexity motion estimation) for strict real-time; switch to higher-quality modes when CPU/GPU headroom exists.
- Search range: Lower (e.g., 4–8 pixels) for speed; increase (16–32) only when motion is large and CPU allows.
- Block size / precision: Use smaller blocks for better detail but costlier; default mid-range (8–16) balances both.
- Overlap / subpixel: Disable or set minimal subpixel refinement in low-latency scenarios.
- Frames of history (lookahead): 1–2 frames for low latency; 3+ for higher quality but higher latency.
- Multi-threading / GPU acceleration: Enable multi-threading; use GPU versions or hardware-accelerated motion estimation if available.
Optimization steps for real-time playback
- Measure baseline: Profile frame processing time on target hardware with current settings.
- Reduce search range first: Cut search range until per-frame time hits your latency target.
- Increase block size / reduce precision: Trade small detail loss for faster runtime.
- Limit lookahead frames: Keep to minimal frames needed to avoid combing.
- Enable parallelism: Use all cores, set thread counts according to CPU (avoid oversubscription).
- Use hardware motion estimation: If available (NVENC/VAAPI), prefer GPU paths.
- Profile again: Verify playback stutter is gone and artifacts are acceptable.
- Fallback adaptive mode: If available, enable adaptive quality that scales with CPU load.
Tips for common scenarios
- Low-power devices: Fixed low search range, larger blocks, no subpixel, single-frame lookahead.
- Desktop with spare CPU: Moderate search range (12–20), medium blocks, 1–2 lookahead frames.
- High-quality offline encode (not real-time): Maximize search range, subpixel refinement, smaller blocks, more lookahead.
Quick recommended presets
- Real-time low-latency: search=4–8, block=16, subpixel=off, lookahead=1
- Balanced: search=12–16, block=8–12, subpixel=1, lookahead=2
- Quality (offline): search=24–32, block=8, subpixel=2, lookahead=3+
Troubleshooting
- Ghosting: Reduce lookahead or lower temporal smoothing.
- Comb artifacts: Increase motion precision or search range slightly.
- Blurriness: Decrease temporal smoothing, use smaller blocks or enable subpixel.
If you want, I can produce exact VapourSynth/AVS TDeint parameter lines for one of the presets above—tell me which preset to target.
Leave a Reply