Repository navigation
media: apple: isp: correct each module's colour shading from its NVM - #3930
Open
RyanTheTide wants to merge 3 commits into
Open
RyanTheTide wants to merge 3 commits into
RyanTheTide wants to merge 3 commits into
Conversation
The setfile's lens shading tables (section 0xc003) are made for a typical module. Each module's NVM carries its own measured shading of the four Bayer planes, which the previous change reads. Use it for the colour part of the correction: - Keep the stock brightness curve: the sum of the four stock gains at each table point, scaled from the point where it is lowest. - Give each plane this module's colour ratio there, (sum of the NVM planes) / (NVM plane), relative to the same point. Every plane then leaves the same shape, so a grey scene stays grey towards the corners, and the centre keeps its stock gains. - The NVM grid can be stored turned by 180 degrees against the tables. Use the orientation whose colour ratios are closer to the stock ones. - Sample the NVM grid bilinearly at its own (non-uniform) knots, in integer fixed point. Leave the stock tables untouched if the grid or the tables look wrong (zero samples, knots out of order, tables that do not share one grid). - Keep each record's leading field equal to its table's largest gain, as in every shipped setfile. The spatial noise filter gains are computed afterwards, from the new tables. Add a KUnit test: colour flatness on a synthetic module in both orientations, centre gains and record maxima, and rejection of bad grids. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The reference point was the table point with the lowest stock gain sum. In isp_2224_01XX.dat that point sits at the bottom edge, not at the optical centre, so the per-module colour shading was normalised to an edge of the frame there. Use the table point at the shading centre instead: the frame's centre moved down by the setfile's snf_centre_dy, the same centre the spatial noise filter uses. Reject a centre outside the frame. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This was referenced Dec 2, 2026
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Contributor
Author
|
#3929 merged on 12-02, so this merged main f02bd68 cleanly as 6115b30; the diff is now only this PR's two commits (isp-cam.c and its test). Local: arm64 LLVM W=1 |
RyanTheTide
marked this pull request as ready for review
December 5, 2026 01:32
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
This branch has not been deployed
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.
What
The setfile's lens shading tables (section
0xc003) are made for a typical module. Use this module's own NVM measurement (read by #3929) for the colour part of the correction:No tuning constants: every value comes from the setfile, the module's NVM or the existing
snf_centre_dy.Where each field comes from
0xc003layout (frame size at +6, four 18-byte records from +0xa with step x/y, offset, grid width/height, Q12 tables from +0x54): the existing parser inisp_setfile_snf_radial()/isp_setfile_fixup_h17()on main.isp_1820_01..isp_8723_01), 44 of 44 records, all four records on one grid with words 5/6 zero. Structure only; no table values are used or quoted.Replaces #3902 with a new design. #3929 has merged; this is now on
mainalone.Tested: K114s T6050 (
7.3.0-k114sstack9) at 85d2365 pass: runs clean (NVM 19x17, orientation upright, reference point 24/21), 40/40 1920x1080 NV12 frames, 0 firmware errors, stock module restored; also on the combined tree with #3928. ARM64 KUnitapple-isp*62/62 pass (CONFIG_WERROR=y, combined tree);checkpatch --strictclean.Risk: two-way · every Mac whose module NVM has the grid: shading tables change.
Not yet (draft)