Skip to content

Fix IVTC preview vspipe crash on shutdown and IVTC parity test (task #65) - #224

Open
StuartCameronCode wants to merge 8 commits into
mainfrom
stuart/65-nightly-2026-11-16-main-dc9e36c-ivtc-hea
Open

StuartCameronCode wants to merge 8 commits into
mainfrom
stuart/65-nightly-2026-11-16-main-dc9e36c-ivtc-hea

Conversation

@StuartCameronCode

Copy link
Copy Markdown
Owner

Fixes the two IVTC heavy failures from nightly 43909344002 (main @ dc9e36c, 2026-11-16). Both came from task #46, which made the IVTC / Soft Telecine preview run VDecimate in the encode's phase.

1. "IVTC on 10-bit ProRes" preview exits 1 (vspipe crashes on shutdown)

  • Cause: vspipe R78's frameDoneCallback counts a frame as done before it writes it. If the one requested frame is already finished when the main thread reaches wait, vspipe frees the script under the callback, which still holds the frame, and segfaults. Fixed upstream in 4ff3f8a0 (R80).
  • Why Fix IVTC failure on >8-bit sources (e.g. 10-bit ProRes 422) #46 triggered it: Fix IVTC failure on >8-bit sources (e.g. 10-bit ProRes 422) #46's preview read VDecimate's drop with get_frame() while the script was being set up. That computed the target's frames in advance, so the preview frame was ready the moment vspipe asked for it.
  • Measured: 2–3% of x86 IVTC previews under load crashed (23/1320 Linux x64, 21/1320 x64-v2, 4/1320 macOS x64). With the fix: 0/2640 on Linux and 0/1320 on macOS.
  • Fix: the drop is now read inside the graph. _preview_decimate_pick is a FrameEval with prop_src set to the frame where the target would be, and it picks between the two outputs the worker computed. It prints PREVIEW_DECIMATE:corr=N at frame time. The change is preview-only, so encodes are unchanged.
  • Remaining risk: any preview can still hit the vspipe race rarely (2/1200 Bwdif previews on macOS x64). Moving the deps to R80+ is task MacOS unable to open VIDEO_TS - 0.9.12 #68.
  • Error reporting: the heavy tests' previewErrorTail now keeps the worker's Error generating preview: status line. In the nightly it had scrolled out of the tail behind plugin warnings.

2. "8-bit vs 10-bit result parity deinterlace_ivtc" equals passthrough

The parity master has no pulldown, so IVTC of frame 12 is frame 12 unchanged (0.000 levels from the passthrough). The case only "changed the picture" before because the preview showed the wrong frame. It now runs on the master telecined 3:2 (_telecineFixture): 5.2 levels from the passthrough, and 0.19 between 8-bit and 10-bit. ivtc_fix_fades uses the same fixture.

Tests

  • New test_259: the template requests no frame while the script is being set up (only the border colour's one-frame swatch is allowed), and the decimating preview picks its frame in the graph. test_55 and test_251 are updated to the new emitted text.
  • New preview_error_tail_test.dart (unit test).
  • New heavy test that repeats the decimating IVTC preview 36 times, three at a time. It is a smoke test; test_259 is the guard.
  • Run locally on macOS arm64:
    • the Rust tests above pass
    • the error-tail unit test passes
    • the heavy parity cases deinterlace_ivtc and ivtc_fix_fades pass
    • the new repeat test passes
  • The existing task-Fix IVTC failure on >8-bit sources (e.g. 10-bit ProRes 422) #46 IVTC preview cases still fail locally, and in nightly 44089342398. Each preview shows the right film frame but differs from the encode by 1.51–1.87 levels against a 1.5 limit. That is task fix(queue): guarantee a completion, and make the state machine testable #67's cause, not this change.
  • Not checked: Linux and Windows have not run this branch's code. The nightly runs above were on main.

Docs

  • Report: docs/reports/task-65-ivtc-preview-teardown, with its scripts, the backtrace and per-platform data.
  • ENGINEERING_NOTES entry, reports index row, and the CLAUDE.md preview section.

🤖 Generated with Claude Code

StuartCameronCode and others added 8 commits November 17, 2026 23:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l keeps the worker's status line

The parity master has no pulldown, so since the preview decimates in the
encode's phase (task #46) IVTC of frame 12 is that frame unchanged (0.000
levels from the passthrough); it passed only while the preview showed the
wrong frame. deinterlace_ivtc and ivtc_fix_fades now run on the master
telecined 3:2 (5.2 levels from the passthrough, 8 vs 10-bit 0.19).

PreviewResult.errorTail leads with the worker's 'Error generating
preview:' line (vspipe's exit status) when it has scrolled out of the last
four lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…me at evaluation (task #65)

The IVTC / Soft Telecine preview read VDecimate's _PreviewSlot tag with
get_frame() while the script was evaluated, running the whole source graph
once before vspipe started. The pick between the two candidate outputs is
now a FrameEval with prop_src on the probe frame, which prints
PREVIEW_DECIMATE:corr when vspipe requests the frame. test_259: the
template requests no frame at evaluation (the border swatch excepted).

The repro workflow now runs main's template and this one side by side, 4
loops each under CPU load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rden the repro script's rm

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er side and mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n race; remove the temporary repro workflow

Measured on CI: with four previews at a time under CPU load, main's
template crashed vspipe in 2-3% of x86 IVTC previews (SIGSEGV in
outputFrame / frameDoneCallback during freeScript), this branch's 0 in
3960. vspipe R78 counts a frame done before writing it (fixed upstream in
R80); the evaluation-time get_frame made the preview's frame ready at once.
The workflow is kept in the report's scripts/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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