Repository navigation
sensor: imx335 on hi3516cv6xx leaves mesh shading to the ISP default, as the vendor ships it - #300
Merged
Merged
Conversation
… as the vendor ships it The cv6xx IMX335 driver set key.bit1_lsc = 1 with a table whose grid sums to 640x360 (16x40 / 9x40), i.e. a 2560x1440 geometry that no IMX335 mode captures. The CV610 ISP takes x/y_grid_width verbatim (lsc_image_size) and requires sum == be_total_width/4, be_total_height/4, so every ISP init logged isp_mesh_shading_grid_width_check ... x_sum 640 != width / 4, y_sum 360 != height / 4! and isp_lsc_init() returned before lsc_regs_initialize(): the LSC registers were never programmed, which is why the A/B in #299 measured no difference. The vendor Hi3516CV610 SDK ships bit1_lsc = 0 for all 15 of its CV610 sensors, IMX335 included. Its IMX335 table has the same gain LUT but a 16x45 / 9x45 grid (2880x1620), which matches no mode either, so the table is an unused leftover upstream too. With the flag off the ISP builds a geometric grid from the frame size with unity gains: valid, and no change to the image. Fixes #299
PR Summary by QodoDisable invalid IMX335 mesh shading on hi3516cv6xx
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding |
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.
Fixes #299.
Problem
imx335_cmos.con hi3516cv6xx setkey.bit1_lsc = 1with a mesh-shading table whose grid widths sum to 640x360 (16x40 / 9x40). That is a 2560x1440 geometry, and no IMX335 mode uses it. Modes 0/3 (2592x1944) would need 648/486, and mode 2 (1920x1080) would need 480/270.From the vendor CV610 ISP source (
firmware/arch/hi3516cv610/algorithms/isp_lsc.c,firmware/src/main/isp_param_check.c):bit1_lsc = 1,lsc_image_size()uses the sensor'sx_grid_width/y_grid_widthas they are, with no per-mode rescaling.isp_mesh_shading_grid_width_check()requiressum == be_total_width / 4andsum == be_total_height / 4. If that fails,isp_lsc_init()returnsTD_FAILUREbeforelsc_regs_initialize(), so the LSC registers are never programmed. That is the single error per ISP init, and it is why the A/B in sensor: imx335 on hi3516cv6xx: mesh-shading grid matches no selectable mode, and the correction measures inert #299 found no measurable difference.Vendor parity
The Hi3516CV610 SDK V1.0.2.0 ships
bit1_lsc = 0for all 15 of its CV610 sensor drivers, IMX335 included. Its IMX335 table has the same gain LUT as ours but a 16x45 / 9x45 grid (2880x1620), which matches no mode either, so the vendor ships the table switched off. In this tree IMX335 was the only cv6xx sensor with the flag on (from #270).With the flag off, the ISP builds a geometric grid from the frame size with unity gains. That configuration is valid and leaves the image unchanged.
isp_def->lscstill points at the table, as in the vendor driver.Testing
libsns_imx335.socross-compiles for hi3516cv6xx with no warnings.bit1_lsc = 0) is this exact configuration: the grid error disappears and corner luminance is within 1.7 points of the old build.Shading each mode properly would need a new flat-field calibration at every capture geometry. That is out of scope here.