Skip to content

GPU Encoding, Review Filters, and Slim Persistence

Choose a tag to compare

@captincrum captincrum released this 05 Jun 07:24
· 21 commits to main since this release

2.7.0 – GPU Encoding, Review Filters, and Slim Persistence

GPU Encoding (Common.psm1 / SmartCompression.psm1 / UM-Errors.ps1)

  • Auto‑detect NVIDIA NVENC, AMD AMF, and Intel QSV hardware encoders at startup
  • UM-ResolveEncoder selects the best available hardware encoder for the active codec family
  • UM-ResolveEncoderArgs applies encoder‑specific quality flags (CQP for NVENC, quality mode for AMF, global quality for QSV)
  • UM-TestGpuEncoder validates the hardware encoder can initialize before processing the library
  • GPU preflight in Smart Compression fails fast with one actionable message instead of failing per‑file
  • UM-ExplainGpuError extracts the relevant driver lines from ffmpeg output and suggests the CPU fallback
  • Sample encode bitrate now measured via output file size instead of parsing ffmpeg summary lines, fixing silent failures on GPU encoders that don't print the summary

Server (server.ps1)

  • Added /gpu-detect endpoint with cached hardware encoder detection (NVENC → AMF → QSV)
  • Added /disk-space endpoint for pre‑compression free‑space validation
  • Added /compress/start endpoint with payload validation, queue persistence, and pipeline launch
  • Added /compression/selections and /compression/selections/save endpoints for persistent review state
  • Config now persists UseGPU, CrfValue, and CompressionOutputPath across sessions
  • /logs/clear now removes CompressionSelections.json alongside log data

Client – GPU Toggle (app.js / index.html / style.css)

  • CPU ↔ GPU toggle in the main settings panel and inside the compression review modal
  • Toggle auto‑disables when no GPU is detected or in Scan Only mode
  • GPU status label shows the detected encoder name or "No GPU detected"
  • Modal GPU toggle syncs with the main settings toggle on open

Client – Compression Review Tree (app.js / index.html / style.css)

  • Three‑state folder checkboxes cycle smart (compress‑only) → none → smart for bulk select/deselect
  • Resizable Name column with drag handle
  • Skip‑reason labels replace generic "Skip" with specifics: HEVC/AV1, Too Short, Low Bitrate, Would Grow, < 10% Saving, Probe Failed
  • Confidence level shown per file in the verdict column (High / Medium / Low)
  • Folder verdict counts show selected vs total (e.g. "276 / 773")
  • Skip rows visually dimmed with disabled checkboxes and reduced opacity
  • Striped tree rows for readability
  • Summary card with live‑updating folder count, file count, size before/after, and total saved
  • Summary counts now display thousands separators
  • Independent Workers slider and CPU/GPU toggle inside the modal, separate from main settings
  • Compressed Root path saved to config and restored on modal reopen
  • Modal auto‑opens when a Smart Compression probe completes
  • Review button dynamically enables/disables based on probe data availability
  • Disk space validated against estimated output size before compression starts

Client – Filter & Cap System (app.js / index.html / style.css)

  • Filter panel added to the review modal with the same card styling as Options and Summary
  • Confidence filter: independent High / Medium / Low checkboxes, auto‑gated with a hover tooltip ("Requires accurate probe") when no variance exists in the data
  • Resolution filter: ≤720p / 1080p / ≥4K checkboxes, bucketed by video width (≤1280 / 1281–2560 / ≥2561); none checked means no restriction
  • Minimum saving (MB) threshold with themed stepper, range 1–9999, step 10
  • Minimum space saved (%) threshold with themed stepper, range 10–95, step 1
  • Cap selection dropdown: No limit / Top savers / Free up at least / Keep output under
  • Top savers keeps the N largest savers from the filtered pool
  • Free up at least accumulates savings until the GB target is met, including the file that crosses the line
  • Keep output under accumulates estimated compressed output up to the GB budget, stopping before it crosses
  • All predicate filters combine with AND logic; caps rank biggest‑saver‑first after filtering
  • Live filtering on all controls with 250ms debounce on typed numeric entry
  • Reset Defaults button restores all filter and cap controls to their initial state

Client – Selection Persistence (app.js)

  • CompressionSelections.json now stores only manual deviations from verdict defaults plus the active filter configuration, instead of a boolean for every scanned file
  • Skip‑verdict files are never stored — their state is re‑derived from the log on open
  • Manual picks are sticky: they survive filter and cap changes and persist across modal close/reopen
  • Filter configuration (confidence, resolution, thresholds, cap mode and value) saved and restored on reopen
  • File size reduced from ~1 MB to single‑digit KB on typical libraries
  • No server changes required — the save/load endpoints remain format‑agnostic

Pipeline (GUI-Core.ps1 / SmartCompression.psm1)

  • Config bootstraps the UseGPU field, passed through pipeline settings into the worker context
  • EncodeMethod, Encoder, and EncodeError fields logged on every probe result for diagnostics
  • Compression workers receive the GPU flag independently from the probe workers

Tests (Run-Tests.ps1 / ui_spec.js)

  • 165 PowerShell unit tests across 18 suites, up from 47 tests and 13 suites in v2.5
  • 160 Playwright UI tests across 18 suites, up from 17 tests and 5 suites in v2.5
  • Suite 16: GPU Encoder Resolution — verifies UM-ResolveEncoder and UM-ResolveEncoderArgs across NVENC, AMF, QSV, and CPU fallback
  • Suite 17: GPU Integration Contracts — validates preflight testing, error explanation, and module exports
  • Suite 18: GPU Client Contracts — confirms toggle wiring, modal sync, and /gpu-detect usage in app.js
  • Suite 15 expanded with contracts for the filter functions, cap modes, themed steppers, debounce, data‑gating, and slim selection persistence