feat(image): sensor-level flip/mirror via MI_SNR_SetOrien (both backends)#84
Merged
Merged
Conversation
…h backends)
image.flip / image.mirror previously rode the VPE digital flip
(MI_VPE_SetChannelParam mirror/flip), which is unreliable on several
sensor combos — on IMX335 (Star6E) flip stalled the encoder outright.
Program the sensor's own orientation register via MI_SNR_SetOrien instead,
applied once at bring-up on both backends:
- sensor_select: before MI_SNR_Enable, so the driver's init picks up the
correct flip/mirror state.
- star6e_pipeline / maruko_pipeline: before the VPE channel starts.
The VPE digital flip stays disabled (param.mirror/flip = 0).
The sensor driver only rewrites orientation when we set it, so a single
apply holds for the life of the stream — device-verified on IMX335 (Star6E)
and IMX415 (Maruko), flip + mirror both correct and stable. A one-shot
re-apply follows the discrete MI_SNR_SetFps events that can reprogram sensor
timing (Star6E live ISP-bin reload; Maruko cold-boot fps kick).
No per-frame re-apply loop and no MI_SNR_GetOrien (it reads stale values
under AE I2C load on IMX335). MI_VPE_SetChannelParam failure stays fatal.
Adds test_orientation_applied_as_requested covering unconditional apply for
imx335/imx415 and no SetOrien call when neither is requested.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- VERSION 0.15.0 -> 0.16.0 - HISTORY.md: 0.16.0 entry describing the MI_SNR_SetOrien orientation path. - README image table: note flip/mirror apply at the sensor at bring-up, both backends. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
image.flip/image.mirrornow work correctly on both backends. Theypreviously rode the VPE digital flip (
MI_VPE_SetChannelParammirror/flip),which is unreliable on several sensor combos — on IMX335 (Star6E)
flipstalled the encoder outright (a brief flipped frame, then a hang).
Root cause of the stall was a per-frame
MI_SNR_SetOrien"storm" (re-applyingorientation every frame for ~5s to fight a phantom "CUS3A clears orientation"
theory); on IMX335 that repeatedly rewrote the sensor's vertical-timing
register table mid-stream and wedged the encoder. It is not a flip-vs-VIF
hardware incompatibility.
Change
Program the sensor's own orientation register via
MI_SNR_SetOrien, appliedonce at bring-up on both backends:
sensor_select: beforeMI_SNR_Enable, so the driver's init picks up thecorrect flip/mirror state.
star6e_pipeline/maruko_pipeline: before the VPE channel starts.param.mirror/flip = 0).The sensor driver only rewrites orientation when we set it, so a single apply
holds for the life of the stream. A one-shot re-apply follows the discrete
MI_SNR_SetFpsevents that can reprogram sensor timing (Star6E live ISP-binreload; Maruko cold-boot fps kick).
No per-frame re-apply loop and no
MI_SNR_GetOrien(it reads stale valuesunder AE I2C load on IMX335 — reports m=0/f=0 while the image is plainly held).
MI_VPE_SetChannelParamfailure stays fatal.Tests
tests/test_sensor_select.c:test_orientation_applied_as_requested—unconditional apply for imx335/imx415, and no
SetOriencall when neitheris requested. 1645 tests pass.
make pre-prgate OK (v0.16.0).Device verification
flip+mirrorboth visuallycorrect and stable — alive, stable PID, frames flowing, no orientation churn,
no reboot.
🤖 Generated with Claude Code