Skip to content

hisilicon-ev200 / goke-gk7205v200: IMX335's day AE back to the vendor's highlight correction, so the sun in frame no longer halves the exposure - #2694

Merged
widgetii merged 1 commit into
masterfrom
imx335-ae-vendor-hist
Oct 26, 2026
Merged

widgetii merged 1 commit into
masterfrom
imx335-ae-vendor-hist

Conversation

@widgetii

Copy link
Copy Markdown
Member

The day half's [static_ae] ran HistRatioSlope 168 / MaxHistOffset 32,
tighter than the vendor's defaults (128 / 16 in HiISP 开发参考,
ISP_AE_ATTR_S), which also say not to exceed 0x100: "a small overexposed
area makes AE think the frame is far brighter than the target, so it keeps
lowering exposure and the picture goes dark". The night half already runs
128.

Measured on a west-facing gk7205v300 + IMX335 in the field, sun in frame,
highlight priority, a few minutes apart (widgetii/majestic#1122):

                    exposure   AE average   shaded ground   blown

168 / 32 (current) 67 us 27 36 / 44 3.0%
128 / 16 (this) 133 us 41 50 / 61 5.8%

and again an hour later: 128 / 16 at 370 us, AE average 42. With 168 / 32
the AE settles about 1 EV under its own target of 56 as soon as the sun
enters the frame.

Without a bright light source the pair does not engage, and the picture
does not change. Lab hi3516ev300 + IMX335 (behind glass) and gk7205v300 +
IMX335, this profile against the current one with day DRC, alternated,
tone controller on: mean 120.8-121.8 against 119.8-123.3 and 123.4-123.5
against 122.9-123.7, blown 0.02-0.04% either way, AE Offset 0-3.

The night half is unchanged.

…'s highlight correction, so the sun in frame no longer halves the exposure

The day half's [static_ae] ran HistRatioSlope 168 / MaxHistOffset 32,
tighter than the vendor's defaults (128 / 16 in HiISP 开发参考,
ISP_AE_ATTR_S), which also say not to exceed 0x100: "a small overexposed
area makes AE think the frame is far brighter than the target, so it keeps
lowering exposure and the picture goes dark". The night half already runs
128.

Measured on a west-facing gk7205v300 + IMX335 in the field, sun in frame,
highlight priority, a few minutes apart (widgetii/majestic#1122):

                        exposure   AE average   shaded ground   blown
  168 / 32 (current)      67 us        27          36 / 44       3.0%
  128 / 16 (this)        133 us        41          50 / 61       5.8%

and again an hour later: 128 / 16 at 370 us, AE average 42. With 168 / 32
the AE settles about 1 EV under its own target of 56 as soon as the sun
enters the frame.

Without a bright light source the pair does not engage, and the picture
does not change. Lab hi3516ev300 + IMX335 (behind glass) and gk7205v300 +
IMX335, this profile against the current one with day DRC, alternated,
tone controller on: mean 120.8-121.8 against 119.8-123.3 and 123.4-123.5
against 122.9-123.7, blown 0.02-0.04% either way, AE Offset 0-3.

The night half is unchanged.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Restore vendor highlight correction for IMX335 daytime AE

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Restore vendor daytime AE highlight settings to prevent the sun from darkening the frame.
• Leave night settings unchanged; field measurements show brighter shaded areas with more blown
 highlights.
Diagram

graph TD
  Config["IMX335 day profile"] --> AE["ISP auto exposure"] --> Exposure["Frame exposure"]
  Highlights["Bright highlights"] --> AE
Loading
High-Level Assessment

Keep the targeted profile adjustment. It restores the cited vendor values and addresses the measured sun-in-frame underexposure without changing night AE or introducing runtime logic; broader tone or AE changes are not justified by this diff.

Files changed (1) +2 / -2

Bug fix (1) +2 / -2
imx335.iniRestore daytime IMX335 AE highlight settings +2/-2

Restore daytime IMX335 AE highlight settings

• Changes daytime MaxHistOffset from 32 to 16 and HistRatioSlope from 168 to 128 to reduce underexposure when a small bright source enters the frame. The separate IR/night AE settings remain unchanged.

general/package/hisilicon-osdrv-hi3516ev200/files/sensor/iq/imx335.ini

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Shared IMX335 day exposure default changes for deployed cameras 📘 Rule violation ☼ Reliability
Description
The [static_ae] section of the shared imx335.ini changes MaxHistOffset from 32 to 16 and
HistRatioSlope from 168 to 128, which rewrites the existing default day AE profile for every
hi3516ev200 image that installs this file. The measurements come from a gk7205v300 and a lab
hi3516ev300, not the hi3516ev200 this package targets, so cameras already in the field pick up the
new exposure behaviour at upgrade time with no evidence from their own SoC.
Code

general/package/hisilicon-osdrv-hi3516ev200/files/sensor/iq/imx335.ini[R5-6]

+MaxHistOffset		   = "16"
+HistRatioSlope		   = "128"
Evidence
Rule 7 forbids changing an existing default profile in a shared *-osdrv-*/files/ location with
values tuned on a particular bench, because deployed cameras inherit the change at upgrade. The diff
edits the existing day [static_ae] values in a shared osdrv sensor profile, and the PR's
measurements are from other SoCs (gk7205v300, hi3516ev300).

Rule 7: No device-specific values in generic configuration
general/package/hisilicon-osdrv-hi3516ev200/files/sensor/iq/imx335.ini[4-8]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The shared hi3516ev200 IMX335 IQ profile changes the day `[static_ae]` defaults (`MaxHistOffset` 32 to 16, `HistRatioSlope` 168 to 128). The supporting measurements come from gk7205v300 and hi3516ev300 hardware, so the new default reaches every deployed hi3516ev200 camera using this sensor without evidence from that SoC.
## Fix Focus Areas
- general/package/hisilicon-osdrv-hi3516ev200/files/sensor/iq/imx335.ini[4-8]
## Recommended Fix
Either validate the new values on a hi3516ev200 + IMX335 board and include before/after output in the PR, or move the change to a per-board seam (for example a builder devices/<board>/ override) for the boards that were measured. Leave the shared profile unchanged until that evidence exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@widgetii

Copy link
Copy Markdown
Member Author

Follow-up from the same field camera (west gk7205v300 + IMX335), 2026-10-26 14:45Z. This was dusk: every arm ran at the 30 ms exposure ceiling and AE varied gain instead. The run waited for any anti-flicker hold to clear before measuring and found none.

arm AE avg ground R / L blown
highlight, 168/32 30 22 / 81 0.89 %
highlight, 128/16 36 22 / 74 1.43 %
highlight + day DRC 512, 168/32 33 62.5 / 116 0.26 %
highlight + day DRC 512, 128/16 (#2691 + this) 32 65 / 114 0.28 %

With #2691's day DRC in place, 128/16 is neutral at dusk: the same picture within noise and no extra blown area. With the sun in frame it doubles the exposure (67 → 133 µs, figures in the description). So the change helps when a bright source is in frame and costs nothing otherwise.

@widgetii
widgetii merged commit 8e17c04 into master Oct 26, 2026
44 of 48 checks passed
@widgetii
widgetii deleted the imx335-ae-vendor-hist branch October 26, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant