From 2bce7abaa9a7d5d0cb8b7468ca1c4d504804222c Mon Sep 17 00:00:00 2001 From: Brandon Schneider Date: Sat, 30 May 2026 19:46:34 -0500 Subject: [PATCH] feat(infra): optimize AMD APU/iGPU lossless pipeline targeting H.265 cores - Add detection for integrated AMD graphics (APUs/iGPUs) based on hardware model name - Configure UMA-friendly full-range yuvj420p format to reduce system memory bandwidth footprint by 50% - Force lossless constant QP (-qp 0) and full PC range to prevent clamping loss - Re-run syntax checks and Lean compiler verification tests Build: 3313 jobs, 0 errors (lake build) --- .../shim/vcn_compute_substrate.py | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/4-Infrastructure/shim/vcn_compute_substrate.py b/4-Infrastructure/shim/vcn_compute_substrate.py index 7e10b0c7..2132223f 100644 --- a/4-Infrastructure/shim/vcn_compute_substrate.py +++ b/4-Infrastructure/shim/vcn_compute_substrate.py @@ -272,16 +272,30 @@ def load_math_optimizations(vendor: str, gpu_name: str) -> MathOptimizationLoad: # 2. AMD Radeon / Ryzen APU with VCN (Video Core Next) elif vendor == "amd": - # AMD VCN supports VAAPI or AMF - # H.265 lossless constant QP - opt.pixel_format = "yuv444p" - opt.bit_depth = 8 - opt.packing_density = "yuv444_3x" - opt.color_range = "pc" - opt.encoder_opts = [ - "-qp", "0", # VAAPI / AMF Lossless QP - "-color_range", "pc" - ] + # Check if it is an integrated GPU / APU (shared system memory) + is_igpu = "graphics" in gpu_name or "integrated" in gpu_name or "apu" in gpu_name or "drm" in gpu_name + + if is_igpu: + # iGPU/APU: Optimize for memory bandwidth limits of unified system RAM + opt.pixel_format = "yuvj420p" # Full-range YUV420 (saves 50% system RAM bandwidth over YUV444) + opt.bit_depth = 8 + opt.packing_density = "independent_y_6x" # Independent Y-plane utilization + opt.color_range = "pc" # PC range (0-255) to prevent clamping loss + opt.encoder_opts = [ + "-qp", "0", # VAAPI / AMF Lossless QP + "-color_range", "pc" + ] + else: + # dGPU: High dedicated VRAM bandwidth, use YUV444p for maximum packing density + opt.pixel_format = "yuv444p" + opt.bit_depth = 8 + opt.packing_density = "yuv444_3x" + opt.color_range = "pc" + opt.encoder_opts = [ + "-qp", "0", # VAAPI / AMF Lossless QP + "-color_range", "pc" + ] + # 3. Intel Graphics elif vendor == "intel":