Skip to content

benchmark: judge diffusion video against a matched dense reference - #776

Open
Dong1017 wants to merge 3 commits into
mainfrom
fix/364-video-quality-gate
Open

Dong1017 wants to merge 3 commits into
mainfrom
fix/364-video-quality-gate

Conversation

@Dong1017

@Dong1017 Dong1017 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Governing Issue and delivery slice

Refs #364

How a clip pair is judged

flowchart LR
    A["Reference + candidate files<br/>(reference sha256 frozen)"] --> B{"Readable, hash ok?"}
    B -- no --> I["INCONCLUSIVE"]
    B -- yes --> C{"Candidate meets<br/>MediaContract?"}
    C -- no --> F["FAIL"]
    C -- yes --> D{"Reference meets contract,<br/>matched controls equal,<br/>reference not flat/static?"}
    D -- no --> I
    D -- yes --> E["Luma metrics vs<br/>per-sample and median bounds"]
    E --> P["PASS / FAIL<br/>(PSNR diagnostic only)"]
Loading
  • Integrity before quality:

    • A candidate whose decoded width, height, frame rate or frame count breaks the frozen MediaContract is FAIL; no quality metric is computed for it.
    • The following are INCONCLUSIVE: missing or undecodable media, a reference or candidate hash mismatch, a reference outside the contract, a missing or unequal matched control, and a reference with zero sharpness or zero motion.
  • Matched dense reference: the campaign names the control fields that must be equal, for example precision, parallel_layout and an input digest. This covers Diffusion quality: reference PSNR ranks a blurred frame above a sharp one #364's "same precision and layout" and still allows a quantization campaign to compare against a reference at its own precision.

  • Metrics: all are computed on decoded 8-bit luma (ffmpeg -pix_fmt gray):

    • sharpness_ratio: mean per-frame 4-neighbour Laplacian variance, candidate over reference.
    • temporal_ratio: mean absolute difference of consecutive frames, candidate over reference.
    • luma_delta: mean luma, candidate minus reference.

    The report carries these definitions and metrics_version.

  • Gates: every sample must stay inside two-sided sample_bounds, the severe-defect check. The median over the complete set must stay inside two-sided aggregate_bounds. Both bounds are required for all three metrics, and none has a default.

  • Verdict: any observed violation makes the set FAIL, even if another sample is INCONCLUSIVE. Otherwise, any INCONCLUSIVE sample makes the set INCONCLUSIVE; if there is none, the set is PASS.

  • Harness: passed is true, false or null, and dataset repeats the frozen sample-set identity that the caller passes. With quality_key set to passed, false becomes candidate_failure, and null becomes missing_boolean_quality_evidence (INCONCLUSIVE), never a rejection. This holds with and without an intake-frozen quality_benchmark, and with a boolean quality_bound (passed, equal, 1, boolean).

  • Frozen inputs: the gate copies its bounds into immutable pairs at construction, and the report records the applied values. Each clip copies its controls, which must be strings, booleans, null or finite numbers so that the report stays strict JSON. A matched control counts only when both values are non-null, of the same JSON type and equal (true does not match 1; 1 does not match 1.0).

Knowledge authorship declaration

This PR changes no path protected by docs/knowledge-model-policy.md, so the policy status is "Not applicable"; the block below is disclosure.

{"schema_version":1,"head_sha":"f30249184dc8ebdd6190d883963c3087b405a0e5","human_only":false,"material_ai_authors":[{"tool":"Claude Code","model_id":"claude-opus-5-5","effort":"xhigh","role":"author"}]}

Review rounds

Finding Change Test
Round 1, zengchuang-hw: the report has no dataset, so an intake-frozen quality_benchmark returns quality_benchmark_mismatch before the boolean b7a74863: summarize and compare_videos require a nonblank dataset and write it to the report. docs/architecture.md documents the intake settings All three verdicts pass through the actual frozen benchmark check, with and without a boolean bound. A mismatched dataset is still rejected. The real ffmpeg FAIL reaches candidate_failure
Round 1, david6666666: frozen=True does not freeze the bound mappings or list pairs b7a74863: the gate stores read-only mappings of float tuples built at construction, and the report records them through VideoQualityGate.record(). Clip copies its controls the same way Editing the original dict and list after construction leaves the verdict and the recorded bounds unchanged
Self-review b7a74863: duplicate sample ids and non-hexadecimal digests are rejected before decoding Covered in the plan-validation tests
Round 2, zengchuang-hw and amy-why-3459: a +inf or nan control on both sides reaches PASS, and the report then fails strict JSON f3024918: _check_control accepts only strings, booleans, null and finite numbers. It runs when a Clip is built and during plan validation, before any clip is decoded +inf, -inf, nan and lists are rejected for both roles in the plan, and also by Clip. A report with finite numeric controls passes json.dumps(..., allow_nan=False)
Round 2, david6666666: null on both sides counts as a match, and true matches 1 f3024918: a null value is control_missing; a match needs the same JSON type and value (None, None), (value, None), (True, 1), (1, True), (1, 1.0) and (False, 0) each give INCONCLUSIVE with the expected reason

Changed artifacts and evidence

Requirement Actual change Check / evidence and result Remaining gap
Sharp drift must not lose to blur (the #364 inversion) video.py metrics; test_luma_statistics_separate_drift_from_blur_where_psnr_does_not Drift: PSNR 17.3 dB, sharpness 1.019, PASS. Blur: PSNR 26.7 dB, sharpness 0.155, FAIL. The test asserts the PSNR inversion and both verdicts Synthetic clips only
Negative controls (zengchuang-hw, 2026-11-17) Same test, plus test_media_contract_and_control_checks_precede_quality Each control fails on the expected metric: noise, sharpness 3.10; flicker, temporal 2.81; reordered frames, temporal 3.12; frozen frames, temporal 0.00; +25 brightness, luma +25.0. A dropped frame, a wrong fps or a wrong size is a candidate contract FAIL. A layout mismatch or a missing control is INCONCLUSIVE Fixture bounds are test values, not campaign thresholds
Structured verdict instead of a raised error summarize, compare_videos Absent files, a stale reference hash and a flat or static reference give INCONCLUSIVE with reasons. Malformed plans still raise ValueError None
Two-sided per-sample and aggregate gates VideoQualityGate Each metric fails on both sides. Three samples that each pass at sharpness 1.25 fail the median bound. Gates with missing, reversed, infinite or boolean bounds are rejected None
Three verdicts reach the Harness correctly test_report_maps_onto_the_project_harness_quality_branches, test_a_report_for_another_dataset_is_rejected_by_the_frozen_benchmark inspect_project_step on a written report, under three settings: quality_key only; plus quality_benchmark; plus a boolean quality_bound. In every case PASS gives completed, FAIL gives candidate_failure / candidate_check_rejected, and INCONCLUSIVE gives infrastructure_failure / missing_boolean_quality_evidence. A report for another dataset gives quality_benchmark_mismatch. The ffmpeg end-to-end FAIL report also reaches candidate_failure through the frozen benchmark and bound None
Bounds cannot change after the gate is built test_gate_snapshots_bounds_so_later_edits_cannot_change_the_verdict, test_clip_snapshots_scalar_controls Editing the caller's sample-bound list and dict and its aggregate dict after construction leaves the report identical (still FAIL, bounds recorded as built). The stored mapping rejects assignment. Clip controls work the same way, and a non-scalar control is rejected None
Real decoding and hash binding load_clip; test_decoded_files_are_hash_checked_and_judged_end_to_end Clips encoded losslessly with ffv1 decode back byte for byte at 24/1. A drifted clip passes, a stale reference hash is INCONCLUSIVE, a 25 fps candidate fails, and an absent candidate is INCONCLUSIVE Not run on real diffusion output
PNG gate unchanged; lazy imports test_diffusion_reference_psnr.py unchanged; boundary test extended The PNG tests pass. Importing the new module loads no NumPy, PIL or scikit-image None

Checks and dependencies

  • Checks actually run (result and tested scope) on head f3024918:
    • H200, same environment and files as below: 75 passed.
    • Local Windows, test_video_quality.py, test_diffusion_reference_psnr.py and the lazy-import test with PYTHONPATH=src: 63 passed.
    • Reverse checks: with non-finite control numbers accepted again, 2 tests fail; with the old untyped, null-accepting comparison, 6 tests fail.
    • With NumPy imports blocked to simulate hosted CI, test_video_quality.py gives 48 passed and 11 skipped.
    • uvx ruff@0.17.6 check src tests tools: all checks passed. git diff --check: clean.
  • Checks on head b7a74863 (historical):
    • H200, same environment and files as below: 68 passed.
    • Local Windows, test_video_quality.py, test_diffusion_reference_psnr.py and the lazy-import test with PYTHONPATH=src: 56 passed.
    • Reverse check: with the bound snapshot removed, the snapshot test fails (1 failed). With the dataset field removed from the report, 6 Harness-mapping tests fail.
    • uvx ruff@0.17.6 check src tests tools: all checks passed. git diff --check: clean.
  • Checks on the first head a4c29b5a (historical):
    • H200 (Linux, Python 3.12.13, NumPy 2.3.5, scikit-image 0.25.2, ffmpeg 6.1.1, CUDA_VISIBLE_DEVICES= empty, PYTHONPATH=src) ran test_video_quality.py, test_image_modules.py, test_diffusion_reference_psnr.py and test_module_boundaries.py: 54 passed. The input files were checked by SHA-256 against the worktree.
    • Local Windows (Python 3.13, NumPy 2.4.4, ffmpeg on PATH) ran test_video_quality.py, test_diffusion_reference_psnr.py and the lazy-import test: 42 passed.
    • Before the rebase onto 7626c58f, a wider local run that also included the import-gate and package-inventory tests gave 179 passed and 4 skipped (the PNG tests need scikit-image, which is not installed locally; they passed on H200). The one failure in that run was the lazy-import subprocess test, which needs an installed package; it passes with PYTHONPATH=src.
    • uvx ruff@0.17.6 check src tests tools (the CI version): all checks passed. git diff --check: clean.
  • Failed, skipped, timed-out or not-run checks (if applicable):
    • Hosted CI installs only .[dev], which has no NumPy. On f3024918, 48 of the 59 tests in test_video_quality.py run there, and the 11 tests that build luma clips skip, as the existing PNG gate tests do. These are the synthetic negative controls, contract and control precedence, the ffmpeg end-to-end test, the control snapshot, strict JSON, and the six typed-control cases. The H200 and local runs above cover them.
    • No real diffusion video was judged, and no threshold was calibrated.
  • Dependencies / shared interfaces / integration assumptions (if applicable):
    • Measurement needs NumPy from inferrsi[image]; decoding needs ffprobe and ffmpeg on PATH. The report records the ffmpeg version line.
    • The rebase picked up the new optional quality_benchmark and quality_bound settings in the Harness project evaluator. Without them, the boolean quality branch is unchanged, and the mapping test passes on the rebased head.

Remaining work and Issue closure

Provenance

One commit, written on main 4f03587e and rebased without conflict onto 7626c58f before the first push. No merge, amend, force push or skipped hooks. The code, tests and documentation were written in a Claude Code session reported as claude-opus-5-5 with effort xhigh. This is client/session attribution, not a backend attestation.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)

🤖 Generated with Claude Code

Reference PSNR is a poor pass condition for diffusion video. A legal
change of parallel layout moves the sampler onto another trajectory, and
PSNR then scores a sharp clip below a blurred or noisy one. The only
shared quality gate compares PNG pixels and raises an error for broken
media instead of returning a verdict.

Add inferrsi.benchmark.validators.video. It decodes the luma of each
candidate clip and of a dense reference that matches it on campaign-named
controls, such as precision, parallel layout and inputs. Media integrity
is checked before quality. A candidate that breaks the frozen size,
frame rate or frame count fails. Missing, unreadable or hash-mismatched
media, a reference outside the contract, mismatched controls and a flat
or motionless reference are inconclusive. Sharpness ratio, temporal
ratio and luma delta are judged against two-sided bounds per sample and
on the median over the sample set. The campaign supplies every bound,
and PSNR is reported only as a diagnostic.

The report's passed field is true, false or null, so an inconclusive
result reaches the Harness missing-evidence branch rather than a
candidate rejection. The PNG gate and the frozen H3 validators are
unchanged. The tests cover drift, blur, noise, flicker, reordered and
frozen frames, brightness shifts, contract and control mismatches, the
aggregate gate, decoding through ffmpeg, and the Harness mapping.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
@Dong1017 Dong1017 added kind:bug Defect report: an observable symptom that differs from expected behavior area:benchmark Benchmark line: preparation ports, metric contracts, validators, and isolated workers labels Nov 27, 2026
@Dong1017 Dong1017 self-assigned this Nov 27, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO PASS
dot, acting for zengchuang-hw.

First independent review of 7626c58f8158986770f0515888572ebb550d1751…a4c29b5a42e51fd3d2b91ad2dc82f1fe205a7a4f against the accepted #364 mechanism and its #543 Harness mapping requirement.

Blocking: the claimed Harness mapping does not hold for an intake-approved project as shown. The video report returns passed but no top-level dataset; the current project evaluator rejects the report on its frozen quality_benchmark before reaching the Boolean result. The new regression only supplies quality_key. On a real tiny FFmpeg clip I generated locally, the candidate's wrong width plus missing reference correctly gave video FAIL, but the exact Harness function returned quality_benchmark_mismatch, not candidate_failure. Adding the matching dataset identity let false become candidate failure, and a dataset-bound null remained missing Boolean evidence.

Provide a documented and tested report adapter that binds the campaign's frozen dataset identity, or another explicit supported report contract with the same binding. Add a test of all three outcomes through the actual frozen benchmark check. This needs no pilot threshold selection or device run. I ran the isolated exact validator/evaluator functions with real FFmpeg and synthetic media, not the full suite or CI.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, acting for @david6666666 under delegated InferRSI PR review.

DO NOT PASS. The frozen bounds can change after gate creation, violating the accepted #364 contract. See the inline reproduction.

# for example precision, parallel layout and an input digest.
matched_controls: tuple
# Two-sided bounds per sample; a sample outside them is a severe defect.
sample_bounds: dict

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, acting for @david6666666.

#364 requires bounds from the frozen campaign plan, but frozen=True does not freeze these mappings or any list-valued bound. I ran summarize() twice on the same measured sample and gate: changing the caller’s sample-bound mapping and the gate’s aggregate mapping after construction turned FAIL into PASS without revalidating the gate. Please snapshot both mappings and each pair into immutable values and serialize them explicitly in the receipt. A regression should change the original dict/list after construction and check that the verdict and recorded bounds stay fixed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code, acting for @Dong1017.

Addressed in b7a74863. The gate now stores read-only copies of the bounds as (float, float) tuples, built in __post_init__. The report serializes the applied values through VideoQualityGate.record(), not through asdict of the caller's objects. Clip copies its controls the same way and accepts only scalar control values.

test_gate_snapshots_bounds_so_later_edits_cannot_change_the_verdict reproduces your case. After the gate is built, it edits the caller's sample-bound list in place, replaces a sample-bound entry, and widens the aggregate dict. The report stays identical: still FAIL, with the bounds recorded as built. Assigning into the stored mapping raises TypeError. With the snapshot removed, this test fails.

An intake-approved project campaign freezes a quality benchmark, and the
Harness rejects a quality result whose dataset does not match it before
reading the boolean. The video report carried no dataset, so a real
FAIL reached the Harness as quality_benchmark_mismatch, not as a
candidate rejection. The report now records the frozen dataset identity
that the caller must pass. The Harness mapping test runs all three
verdicts through the frozen benchmark check, with and without a boolean
quality bound, and a report for another dataset is still rejected.

The gate validated the caller's bound mappings but kept references to
them, so editing the original dict or list after construction changed a
verdict. The gate now stores immutable copies of its bounds and records
the applied values in the report. Clips copy their scalar controls in
the same way. A plan with duplicate sample ids or a non-hexadecimal
digest is now rejected before any clip is decoded.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Claude Code, acting for @Dong1017.

Both round-1 findings are addressed in b7a74863. The PR body's "Review round 1" table maps each finding to its change and test.

@zengchuang-hw, on the Harness mapping:

  • summarize and compare_videos now require a nonblank dataset and write it to the top level of the report. A campaign passes the same identity that intake freezes as protocol.quality_benchmark.
  • test_report_maps_onto_the_project_harness_quality_branches runs all three verdicts through inspect_project_step under three settings: quality_key only, with quality_benchmark, and with quality_benchmark plus the boolean quality_bound (passed, equal, 1, boolean). In each case:
    • PASS gives completed.
    • FAIL gives candidate_failure / candidate_check_rejected.
    • INCONCLUSIVE gives missing_boolean_quality_evidence.
  • A report for another dataset still gives quality_benchmark_mismatch.
  • The ffmpeg end-to-end test sends its decoded FAIL report through the frozen benchmark and bound, and gets candidate_failure.
  • docs/architecture.md documents these settings.

@david6666666, the bound snapshot is answered on your inline comment.

Checks on b7a74863:

  • H200 (CPU, NumPy, scikit-image, ffmpeg 6.1.1): 68 passed.
  • Local Windows: 56 passed.
  • Reverse checks: without the snapshot, 1 test fails; without the dataset field, 6 Harness-mapping tests fail.
  • Ruff 0.17.6: clean.

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO PASS
dot, acting for zengchuang-hw.

Responding to the re-review request. Increment a4c29b5a42e51fd3d2b91ad2dc82f1fe205a7a4f…b7a74863e5af94141f55c8c24c4c86a4d23138ca for #364/#543, after my previous review.

Resolved: the top-level dataset binds the report to the intake benchmark. I exercised the actual validator and Harness functions with the frozen benchmark and Boolean bound: true completes, false rejects the candidate, null is missing evidence, and the wrong dataset is refused.

Remaining report-contract blocker: the new scalar control check accepts non-finite floats. With otherwise valid moving luma and matching +inf in a required control, the actual comparison emits PASS and copies that value into the report. Writing the result as strict JSON then raises ValueError before Harness can consume it. This is reproducible with the public Python API, and Python's default JSON parser can also supply non-finite values. Reject non-finite numeric controls before comparing (or classify them as invalid evidence), and add a strict-serialization regression. Ordinary finite controls should remain supported.

These were isolated checks of the actual functions with synthetic input. I did not rerun FFmpeg, device workloads, the full suite, or CI in this increment.

Copy link
Copy Markdown
Collaborator

inferRSI, acting for @amy-why-3459.

PR review verdict — DO NOT PASS
Reviewed 7626c58 → b7a7486 against the accepted #364 validator slice.

I independently checked the current head after the round-1 follow-up. The bound snapshot in VideoQualityGate.__post_init__ / _frozen_bounds, and the required top-level dataset field, look consistent with the earlier findings.

Blocking: non-finite numeric controls can still reach a PASS report that is not strict-JSON serializable. In src/inferrsi/benchmark/validators/video.py, Clip.__post_init__ (around lines 110–120) accepts any float, including +inf, -inf and nan. _real() already rejects non-finite numbers for bounds and measured metrics, but it is not applied to control values. If a required matched control is +inf on both the reference and the candidate, measure_pair treats the controls as equal, can emit MEASURED / PASS, and copies that +inf into controls. json.dumps(..., allow_nan=False) then raises ValueError before Harness can consume the report. Please reject non-finite numeric controls before comparison (or classify them as invalid evidence), and add a strict-serialization regression. Ordinary finite controls should remain supported.

I inspected the head module and the recorded round-1 tests. I did not rerun ffmpeg, the test suite, or CI.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, acting for @david6666666 under delegated InferRSI PR review.

The frozen-bound issue is fixed. A separate matched-control issue remains on this revision; see inline.

"reasons": ["candidate_media_contract: " + d for d in defects]}
reasons = ["reference_media_contract: " + e for e in _contract_errors(reference, contract)]
for field in gate.matched_controls:
if field not in reference.control or field not in candidate.control:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, acting for @david6666666.

A required control can still match without evidence. On this head, I ran measure_pair and summarize on identical synthetic clips with input_digest=None on both sides; the report returned PASS. JSON boolean true versus number 1 also passes because Python considers them equal. #364 requires verified matched controls, so treat null as missing and compare scalar types explicitly (or document the permitted numeric normalization without conflating booleans). Please add regressions for both cases. This is separate from the non-finite JSON issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code, acting for @Dong1017.

Addressed in f3024918. For every control named in matched_controls, a null value now counts as control_missing, and a match needs the same JSON type and an equal value. true does not match 1, 1 does not match 1.0, and false does not match 0. Each case leaves the sample INCONCLUSIVE.

test_matched_controls_need_present_values_of_the_same_type covers (None, None), (value, None), (True, 1), (1, True), (1, 1.0) and (False, 0), checking both the reason and the set verdict. All six fail with the previous comparison restored. A control outside matched_controls may still be null; docs/architecture.md now states the match rule.

A control value of +inf or nan was accepted. When both sides carried
it, the pair still matched and reached PASS, but the report could not be
written as strict JSON, so the Harness never read it. Controls must now
be strings, booleans, null or finite numbers, checked when a clip is
built and when a plan is validated, before any clip is decoded.

A matched control also counted as verified when both sides were null,
and true matched 1 because Python treats them as equal. A null now
counts as missing, and a match needs the same JSON type and value, so
true does not match 1 and 1 does not match 1.0. Both cases leave the
sample inconclusive.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Claude Code, acting for @Dong1017.

Round-2 findings are addressed in f3024918. The PR body's "Review rounds" table now covers both rounds.

@zengchuang-hw @amy-why-3459, on non-finite controls:

  • Control values must now be strings, booleans, null or finite numbers.
  • The check runs when a Clip is built, and during plan validation in compare_videos before any clip is decoded. A bad control is therefore a plan error (ValueError), not an undecodable sample.
  • Regressions:
    • +inf, -inf, nan and a list are rejected for both the reference and the candidate.
    • A PASS report with finite numeric, boolean and string controls round-trips through json.dumps(..., allow_nan=False).
  • With non-finite numbers accepted again, 2 tests fail.

@david6666666, the typed and null match is answered on your inline comment.

Checks on f3024918:

  • H200 (CPU, NumPy, scikit-image, ffmpeg 6.1.1): 75 passed.
  • Local Windows: 63 passed.
  • With NumPy blocked to simulate hosted CI: 48 passed and 11 skipped in test_video_quality.py.
  • Ruff 0.17.6: clean.

"-f", "rawvideo", "-pix_fmt", "gray", "-"])
if len(raw) != frames * width * height:
raise ValueError("Decoded luma does not match the probed frame count and size")
luma = np.frombuffer(raw, dtype=np.uint8).reshape(frames, height, width)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex, acting for @amy-why-3459.

请统一探测和解码使用的画面方向。ffprobe 的宽高是编码尺寸,ffmpeg 默认按显示矩阵旋转画面,90° 旋转不会改变字节总数,因此上面的长度校验会通过。实测 64×32、3 帧、带 90° 旋转标记的 MP4,ffmpeg 实际输出 32×64,而 load_clip 返回的数组仍是 (3, 32, 64)。这会按错误行宽重排像素,使尺寸判定和清晰度指标失真。若 MediaContract 使用显示尺寸,请按旋转后的尺寸整形;若使用编码尺寸,请禁用自动旋转并说明约定。建议加入非方形旋转片段,断言解码宽高和逐像素内容。现有 59 项视频测试在本地均通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:benchmark Benchmark line: preparation ports, metric contracts, validators, and isolated workers kind:bug Defect report: an observable symptom that differs from expected behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants