Skip to content

Warn when a filter or output setting reduces bit depth on high-bit-depth sources#47

Merged
StuartCameronCode merged 1 commit into
mainfrom
bit-depth-quality-warnings
Jul 1, 2026
Merged

Warn when a filter or output setting reduces bit depth on high-bit-depth sources#47
StuartCameronCode merged 1 commit into
mainfrom
bit-depth-quality-warnings

Conversation

@StuartCameronCode

Copy link
Copy Markdown
Owner

Follow-up to #46. Adds inline advisory banners so users know when enabling a pass — or picking an output option — will silently reduce colour precision on a >8-bit source (e.g. 10-bit ProRes 422).

Cases covered

  • Filter pass (input side): the filter schema gains an optional maxBitDepth. When set and the source exceeds it, the worker down-converts to that depth for the pass and restores it afterward (a lossy round-trip), so the pass settings panel shows a warning. DeScratch is the only such filter today (8-bit only, YV12/YV16/YV24), so its schema declares maxBitDepth: 8. IVTC/VFM is lossless now (clip2, Fix IVTC failure on >8-bit sources (e.g. 10-bit ProRes 422) #46); f3kdb/deblock/cas all handle 8–16 bit natively.
  • Output side: choosing a chroma-subsampling conversion (4:2:0 / 4:2:2) forces an 8-bit output format even for a 10-bit source, so the encoding settings show a warning next to the dropdown. "Original" preserves the source's bit depth (only HuffYUV forces a format otherwise, and the software/ProRes/lossless encoders keep the pipeline depth).

Implementation

  • utils/pixel_format.dart
    • pixelFormatBitDepth() — parses ffprobe pix_fmt strings (yuv422p10le → 10, p010le → 10, rgb48le → 16, unknown → 8 so no spurious warnings).
    • filterBitDepthWarning() / chromaConversionBitDepthWarning() — pure decision helpers returning the message or null.
  • widgets/warning_banner.dart — extracted the repeated advisory-banner widget (icon + text in the theme error-container style); the existing OpenCL-unavailable warning now reuses it.
  • pass_settings_container.dart / settings_dialog.dart — render a WarningBanner when the respective helper returns a message.

Tests

test/pixel_format_test.dart — 17 unit tests covering the parser (8/10/12/16-bit formats, null/unknown fallback, case/whitespace) and both decision helpers (enabled/disabled, no ceiling, source fits, 8-bit source, unknown format, converting vs Original). The UI widgets are thin wrappers over these tested pure functions.

Generated .g.dart is gitignored and regenerated by CI's build_runner, so only the model/JSON source changes are committed.

🤖 Generated with Claude Code

…th sources

Adds inline advisory banners so users know when enabling a pass — or picking an
output option — will silently reduce colour precision on a >8-bit source:

- Filter pass: schema gains an optional `maxBitDepth`. When set and the source
  exceeds it, the worker down-converts to that depth for the pass and back (a
  lossy round-trip), so the pass settings panel shows a warning. DeScratch is
  the only such filter today (8-bit only), so its schema declares maxBitDepth 8.
  (IVTC/VFM is lossless via clip2; f3kdb/deblock/cas/etc. handle 8–16 bit.)
- Output: choosing a chroma-subsampling conversion (4:2:0/4:2:2) forces 8-bit
  output even for a 10-bit source, so the encoding settings show a warning next
  to the dropdown; "Original" preserves the source's bit depth.

Implementation:
- utils/pixel_format.dart: pixelFormatBitDepth() parses ffprobe pix_fmt strings
  (yuv422p10le -> 10, etc.); filterBitDepthWarning()/chromaConversionBitDepthWarning()
  are pure decision helpers, fully unit-tested.
- widgets/warning_banner.dart: extracted the repeated advisory-banner widget;
  the existing OpenCL warning now reuses it too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@StuartCameronCode StuartCameronCode merged commit 08c62b2 into main Jul 1, 2026
4 checks passed
@StuartCameronCode StuartCameronCode deleted the bit-depth-quality-warnings branch July 1, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant