fix(pipeline): 16-px-align the keep-aspect precrop so VENC does not stall - #110
fix(pipeline): 16-px-align the keep-aspect precrop so VENC does not stall#110vertexodessa wants to merge 1 commit into
Conversation
PR Summary by QodoFix keep-aspect precrop alignment (16/8) to prevent Star6E VENC stall
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. keep_aspect may distort
|
ec01eec to
2250d44
Compare
…tall pipeline_common_compute_precrop() aligned the keep-aspect crop to 2 px. The VIF/VPE capture window needs aligned geometry; an unaligned crop is accepted by every MI_* call and VPE then silently emits nothing, so the daemon sits at "waiting for encoder data" forever with no error logged anywhere. Reproduced on Star6E with imx415 1472x816@120 -> video0.size=1280x720: the 2-px-aligned crop is 1450x816@x=10 and VENC never produced a frame. 1280x704, whose crop is full-width 1472x808@y=4 with x=0, streamed immediately. The stab crop path (star6e_framing_stab.c) has always used width & ~7 with x & ~15 and is known good; the precrop now floors every size and offset to 16 px, a superset of that rule and of the working case. 1440x816@x=16 for 1280x720 is device-verified. Flooring changes the crop aspect by at most 16/size (0.74 % here), which the downstream scaler absorbs; rounding to nearest would halve that at the cost of replacing a hardware-verified geometry with an unverified one, so the floor stays and the bound is documented in the header. Existing precrop expectations are unchanged (1440x1080@x=240 and 2560x1440@y=240 are already 16-aligned). Adds the 1472x816 -> 1280x720 and -> 1280x704 cases to test_pipeline_common so the constraint is pinned: 1440x816@x=16 and 1472x800@y=0. Verified: make test 2491/0; star6e cross-build clean; 1280x720 streams on the bench drone with this crop.
2250d44 to
bd11baf
Compare
|
Adversarial review at The Star6E before/after observation is useful and credible as a regression repro, but the patch and PR text infer a stronger alignment rule than the experiment establishes:
Please scope or parameterize the alignment by backend/stage, preserve the centered-crop invariant, and add tests that distinguish size alignment from offset alignment (including the I reproduced the host gates: |
|
Maruko device test report (device observations only)
With
Additional mode-0 cases:
The kernel log contained no new fault, timeout, watchdog, Oops, panic, MMU, VIF/VPE/VENC error, or FIFO-full match. It did contain the existing JPEG-device warnings Not tested here: Star6E, IMX415, visual centering/image-quality comparison, |
|
Targeted follow-up on the alignment question at the current PR head ( What the device evidence currently establishes:
The narrow conclusion is therefore: 2-pixel alignment is not sufficient for the one tested Star6E horizontal-crop path, and 16-pixel alignment is sufficient for the tested replacement. The minimum constraint, and whether it applies to width, offset, or both, remain unproven. Could you isolate that with a small one-variable-at-a-time Star6E test on the same failing path (height
These can be temporary/manual test overrides; they do not need to be production crop choices. For each candidate, please report the exact programmed rectangle, whether the first encoded access unit arrives within a bounded timeout, and a sustained frame/RTP count over the same short interval. Once the minimum working constraint is known, the implementation should apply it only to the Star6E VIF/VPE precrop path and select the nearest legal centered rectangle. Maruko should retain its existing 2-pixel behavior, and CV610 should remain unchanged until there is device evidence for a stricter rule. If the immediate fix must remain conservative, 16-pixel alignment on Star6E only is device-verified as sufficient for the tested case, but should be described as a workaround rather than a universal hardware rule. |
|
Heads-up: #114 (parity sync v0.65.2 → v0.67.1, 54 commits) is open and will conflict with this one on bookkeeping. This PR claims The code itself doesn't overlap at all — #114 doesn't touch Sorry for the churn — this bundle had been accumulating on the fork for a while. Happy to help with the rebase if useful. |
|
#114 is merged, so this now shows as conflicting. The good news: the overlap is only After |
Summary
pipeline_common_compute_precrop()aligned the keep-aspect crop to 2 px. VIF/VPE capture geometry must be 16-px aligned in size and 8-px in offset; an unaligned crop is accepted by everyMI_*call and VPE then silently emits nothing, so the daemon sits at "waiting for encoder data" forever with no error logged anywhere.Reproduced on Star6E with imx415 1472x816@120 and
video0.size=1280x720: the 2-px-aligned crop is 1450x816@x=10 and VENC never produced a frame. 1280x704, whose crop is full-width 1472x808@y=4 with x=0, streamed immediately. The stab crop path (star6e_framing_stab.c) has always usedwidth & ~7withx & ~15and is known good; the precrop now floors every size and offset to 16 px, a superset of that rule and of the working case.On the review finding about aspect drift: flooring changes the crop aspect by at most 16/size, 0.74 % for this case, which the scaler absorbs invisibly. Rounding to nearest would halve that but replace the device-verified 1440x816@x=16 geometry with an unverified one, so the floor stays and the bound is documented in
pipeline_common.h.Changes
src/pipeline_common.c:& ~1u->& ~15uon sizes and offsets, with a comment recording the repro and the aspect bound.include/pipeline_common.h: contract now states the 16-px floor and the aspect bound (was "2-pixel alignment").tests/test_pipeline_common.c: pins 1472x816 -> 1280x720 = 1440x816@x=16 and -> 1280x704 = 1472x800@y=0, plus alignment and fits-in-sensor checks. Existing expectations (1440x1080@x=240, 2560x1440@y=240) are already aligned and unchanged.VERSION0.65.2 -> 0.65.3,HISTORY.mdentry.Verification
make test: 2491 passed, 0 failedmake build SOC_BUILD=star6e: clean