Skip to content

hisilicon-osdrv-hi3516cv200: add a quieter [3dnr] profile for the OV2710 boards - #2884

Closed
zx97 wants to merge 1 commit into
OpenIPC:masterfrom
zx97:iq-quiet-ov2710
Closed

zx97 wants to merge 1 commit into
OpenIPC:masterfrom
zx97:iq-quiet-ov2710

Conversation

@zx97

@zx97 zx97 commented Nov 17, 2026

Copy link
Copy Markdown

Problem

On hi3516cv200 the streamer opens /etc/sensors/iq/default.ini and nothing
else. No file named after the sensor is tried, and no key in its configuration
selects an IQ profile: curl /api/v1/config.json enumerates every setting the
binary has, and none of them names an IQ file. The package links that single
name, statically, for every board:

ln -sf ar0130.ini $(TARGET_DIR)/etc/sensors/iq/default.ini

A cv200 board carrying an OV2710 therefore runs the tuning of an Aptina AR0130,
and the iq/ov2710.ini shipped two lines above is never read.

What is read of the chosen file is narrower still. On this build the loader
says so itself:

IQ /etc/sensors/iq/default.ini (day set): 13 sections, [static_ae] absent, [3dnr] loaded
IQ /etc/sensors/iq/default.ini: nothing reads common, AE, sharpen, gamma, ccm,
    h264venc, BLC, DYNAMIC, HLC, IR, DRC -- these are carried for PQTools and
    have no effect here. A binary PQ profile does carry them

So [ccm], [sharpen], [gamma] and [DRC] cannot be used from a text
profile, and iq/ov2710.ini would gain nothing by being selected: the section
that sets it apart from ar0130.ini is a [ccm] block, which is in that list.

The consequence is that the noise of every cv200 camera - the complaint in
OpenIPC/openhisilicon#304 - is decided by one [3dnr] ladder, written for a
sensor most of these boards do not carry.

What this adds

files/sensor/iq/ar0130_quiet.ini, a copy of ar0130.ini in which 46 lines
change, all of them inside [3dnr], on all twelve ISO steps:

-s32YSFStr_0 =    50          +s32YSFStr_0 =   170     luma spatial
-s32YTFStr_0 =    48          +s32YTFStr_0 =   104     luma temporal
-s32CSFStr_0 = 0              +s32CSFStr_0 = 48        chroma spatial
-s32CTFstr_0 = 0              +s32CTFstr_0 = 24        chroma temporal

Every other section is byte-identical, and the existing *.ini glob installs
the file, so the package needs no other change. Selecting it is a symlink:

ln -sf ar0130_quiet.ini /etc/sensors/iq/default.ini
/etc/init.d/S95majestic restart

Measurements

VStarcam C23S, Hi3518EV200, OV2710, MIPI 1080p30, one lamp-lit room at night,
camera untouched between runs. Exposure is pinned - see the note below - so
the figure is comparable across restarts; it reproduces to +-0.002 over
reboots.

sigma is the median standard deviation of the 8x8 luma blocks, detail the
mean absolute gradient at 1:1 on a box-filtered copy. One image and one row
per test are kept, 81 tests in all.

YSF YTF CSF/CTF sigma/Y detail
50 (shipped) 48 0/0 0.368 17.85
150 48 24/12 0.189 14.22
160 48 24/12 0.155 13.54
170 48 24/12 0.119 12.28
175 48 24/12 0.098 11.50
170 96 48/24 0.086 11.12
170 104 48/24 0.076 10.71
170 128 48/24 0.061 8.25

Two things the table shows that are not obvious from the defaults:

  • the temporal filter is the cheap dimension here: six points of YTFStr buy
    what fifteen points of YSFStr buy, for half the detail lost. It is at 48 in
    the shipped profile; 128 is still applied, 160 makes the ISP refuse the whole
    block and fall back to its own defaults.
  • the chroma filters are free at this operating point: CSFStr 48 / CTFstr 24
    cut the chroma blotches (median 8x8 Cb sigma 11.0 -> 2.1 at YSF 150) without moving the
    luma figures at all, which matters more than the sigma on a night image
    because the coloured speckle is what makes it look broken.

Ranges found by bisection, because an out-of-range value makes the ISP drop the
whole block and fall back to its own defaults - visible as sigma/Y jumping
back to 0.36, which is a free validity oracle:

s32CSFStr    <= 64          above that the block is refused
s32CTFstr    <= 32
s32TFStrMax  =  14          any higher is refused
s32YTFStr     128 works, 160 is refused
s32YTFMdWin  =  1           only
s32YSFBriRat <= 48
s32YSmthRat  <= 32
s32YSFStrDlt >  0 flattens the picture (detail falls to 6.0)

Why it is a second file and not a change to the default

It changes the picture for every cv200 board, and what I measured is one room
at night with the exposure pinned. A board used outdoors in daylight would get
the same aggressive smoothing. Shipping it beside the default, reachable by one
symlink, lets the person who wants it take it.

Note on the exposure

The numbers above are only comparable because the exposure does not move on
this build: isp.aeMode: auto, with or without aeStrategy: fast|slow and
aeSpeed, leaves the exposure register at 0x20 (two lines) for forty
seconds, sampled every four seconds. Setting aeMode: manual with a maximum
exposure does work, and writes 1101 lines of 1104. I am not claiming that is
a defect of the platform - only that it is why the measurements are pinned.

What this does not fix

The colour of the brightest parts of the frame. On this board a white ceiling
and a daylight window come out magenta, and the cause is measurable: the
automatic white balance this build applies gives R x1.47 and B x1.58 in
daylight, so red and blue clip at 255 before green does, and in those areas the
green channel sits at 43 against 185 red and 178 blue.

Proof that it is the light level rather than the sensor: holding an ND filter in
front of the lens - a pair of sunglasses, so not colour neutral - drops mean
luma from 155 to 135 and the magenta pixels of the frame from 12.0 % to 3.3 %,
the green channel in the same area going from 43 to 131. With the AWB gains or
a DRC curve reachable, those surfaces would not clip; this build exposes
neither, which is a separate report. A denoise profile cannot help there, and
this one does not pretend to.

Hardware tested on

VStarcam C23S, Hi3518EV200 + OV2710
sensor config  ov2710_mipi_1lane_1080p.ini  (#2871)
build          OpenIPC 2026-11-16
video          /mjpeg 640x480, /image.jpg 1920x1080
symptom before a noisy, blue image at night; the noise figure is above

…710 boards

On this platform the streamer opens /etc/sensors/iq/default.ini and nothing
else: no sensor name is tried, and no key in its configuration selects an IQ
file (curl /api/v1/config.json lists every key the binary has). The package
links that name to ar0130.ini for every board, whatever sensor is fitted. Of
the file only [3dnr] reaches the ISP - the loader reports the other twelve
sections as "carried for PQTools and have no effect here" - so the noise of
every cv200 camera is decided by one ladder written for a 1.3 MP Aptina part.

ar0130_quiet.ini is ar0130.ini with 46 lines changed, all of them inside
[3dnr], on all twelve ISO steps: YSFStr 50 -> 170, YTFStr 48 -> 104,
CSFStr 0 -> 48, CTFstr 0 -> 24. The other sections are byte-identical.

Measured on an OV2710 (Hi3518EV200, MIPI 1080p30, exposure pinned at the
sensor maximum with gain 1x, one lamp-lit room at night): the median 8x8 luma
sigma over mean luma falls from 0.368 to 0.076, the mean absolute gradient at
1:1 from 17.9 to 10.7. The temporal filter is the cheap half of the trade:
YTFStr 96 with the same luma strength already takes 0.119 to 0.086.

It is shipped as a second file rather than as a change to the default,
because what I measured is one room at night and a different picture is not
what the other cv200 sensors should get without being asked. To use it:

    ln -sf ar0130_quiet.ini /etc/sensors/iq/default.ini
    /etc/init.d/S95majestic restart

The existing *.ini glob in the package installs it, so no other change is
needed.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add opt-in quiet 3DNR profile for Hi3516CV200 cameras

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds a quieter IQ profile to reduce night-image noise on tested OV2710 hardware.
• Retains the existing default to avoid changing image detail on other boards.
• Documents how to select the new profile through the default IQ symlink.
Diagram

graph TD
  P["Package install"] --> D["Default IQ link"] -->|stock| B["AR0130 profile"] --> S["Streamer loader"] --> I["ISP 3DNR"]
  U["Manual opt-in"] --> D -->|quiet| Q["Quiet profile"] --> S
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Select an IQ profile automatically by sensor
  • ➕ OV2710 boards would not require a manual symlink change.
  • ➖ Requires changing profile-selection behavior outside this package.
  • ➖ Applies night-oriented smoothing to OV2710 boards regardless of lighting or user preference.

Recommendation: Keep the opt-in profile. It uses the existing loader and packaging path while preserving current images on untested boards; automatic sensor selection is better considered separately from this measured night-noise tuning.

Files changed (2) +919 / -0

Enhancement (1) +911 / -0
ar0130_quiet.iniAdd an opt-in profile with stronger 3DNR at every ISO step +911/-0

Add an opt-in profile with stronger 3DNR at every ISO step

• Copies the existing AR0130 IQ file and increases luma spatial, luma temporal, and chroma filtering in its twelve-step [3dnr] ladder. Other sections, including IR tuning, remain unchanged. The stronger filtering reduces measured night noise at the cost of image detail.

general/package/hisilicon-osdrv-hi3516cv200/files/sensor/iq/ar0130_quiet.ini

Documentation (1) +8 / -0
hisilicon-osdrv-hi3516cv200.mkDocument manual selection of the quiet profile +8/-0

Document manual selection of the quiet profile

• Adds comments explaining the streamer's fixed IQ path and how to opt in by redirecting its symlink. The existing INI glob installs the new file, while the default continues to point to ar0130.ini.

general/package/hisilicon-osdrv-hi3516cv200/hisilicon-osdrv-hi3516cv200.mk

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (1) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. OV2710 boards still default to the AR0130 IQ profile 📎 Requirement gap ≡ Correctness
Description
The .mk change only adds a comment and leaves ln -sf ar0130.ini .../default.ini as the install
default, so every cv200 board, including the OV2710 boards this ticket is about, still gets the
AR0130 tuning unless someone manually re-points the symlink. The new ar0130_quiet.ini is itself a
copy of ar0130.ini with only the [3dnr] sections changed, so it is not an OV2710-specific
profile either. The PR's own text says iq/ov2710.ini is never read, and this change leaves that
gap in place for the default configuration.
Code

general/package/hisilicon-osdrv-hi3516cv200/hisilicon-osdrv-hi3516cv200.mk[R23-30]

+	# The streamer opens this one name, not a file named after the fitted
+	# sensor, and nothing in its configuration selects another: every cv200
+	# board gets ar0130.ini whatever it carries. Of that file only [3dnr]
+	# reaches the ISP; [ccm], [sharpen], [gamma], [DRC] and the rest are
+	# PQTools data the text loader reports as unread. ar0130_quiet.ini is
+	# the same file with [3dnr] retuned for boards whose noise matters more
+	# than their detail:
+	#   ln -sf ar0130_quiet.ini /etc/sensors/iq/default.ini
Evidence
The added comment states that every cv200 board gets ar0130.ini whatever sensor it carries and
that the quieter profile is opt-in via a manual symlink. The existing ln -sf ar0130.ini line is
unchanged, so the default for OV2710 boards remains the AR0130 profile. The new ar0130_quiet.ini
contains only AR0130 sections with a retuned [3dnr], with no OV2710-specific [ccm], [sharpen],
or [gamma] values.

Provide an OV2710-specific, validated IQ profile
general/package/hisilicon-osdrv-hi3516cv200/hisilicon-osdrv-hi3516cv200.mk[23-30]


Grey Divider

Context sources
Review mode: Auto: ⚖️ Balanced: Runtime ISP configuration has deployment risk despite being an additive profile.

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@zx97

zx97 commented Nov 17, 2026

Copy link
Copy Markdown
Author

On the gap Qodo raises: yes, every cv200 board still gets ar0130.ini, and this
change does not alter that. It cannot from inside this package. The streamer
opens the name default.ini and no configuration key selects another one -
curl /api/v1/config.json enumerates every key the binary has. Repointing that
link at an OV2710 profile would change the picture of every other cv200 sensor
on the strength of measurements taken in one room.

What makes a profile sensor-specific here is narrower than it sounds. The loader
reports that only [3dnr] is applied, so [ccm], [sharpen], [gamma] and
the rest cannot tell one sensor from another from a text profile at all.
iq/ov2710.ini is inert for exactly that reason: what it adds over
ar0130.ini is a [ccm] block that is never applied. A retuned [3dnr] is,
in practice, the only sensor-specific tuning a text profile can carry on this
platform, and that is what this file is.

If OV2710 boards should get it by default, that needs a selection mechanism in
the streamer - sensor name to IQ file - and I would rather have that decided
there than guessed here. Happy to send that change if the direction is welcome.

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The measurements are good and the bisected ranges are useful in their own right. The problem is where the file lands, and it starts with one premise in the description that doesn't hold.

There is a key that selects the IQ profile: isp.iqProfile (see majestic-config.md in OpenIPC/wiki). config.json doesn't show it because it lists keys that are set, and this one is empty by default. The web UI's hint for it states the order: empty uses the profile named after the sensor, or default.ini when there is none. Builder devices already use it, for example cli -s .isp.iqProfile /etc/sensors/iq/sc2235.ini in hi3516ev200_lite_imou-cue2-c22en. On your board the sensor name is ov2710_mipi, there is no ov2710_mipi.ini, and so it falls through to default.ini. That's why it looked fixed.

Why that blocks this PR as it stands:

  • Nothing in this tree selects ar0130_quiet.ini. Every cv200 image would carry 911 lines that no camera opens unless someone hand-edits a symlink. The tree's rule is that nothing ships that nothing runs.
  • The tuning is measured on one board, in one room at night, with exposure pinned. That's real evidence for that camera, not for the family. Your own "why a second file" section says the same.

Where it fits: OpenIPC/builder#254, the C23S device you've just opened. Ship the file in the device overlay, for example as general/overlay/etc/sensors/iq/c23s.ini, and select it from that device's customizer.sh with cli -s .isp.iqProfile /etc/sensors/iq/c23s.ini. Builder already does this for other boards (hi3516ev300_ultimate_xm-85h50ai and hi3518cv100_lite_xm-n51813l carry their own IQ files). Every C23S then gets it from first boot, and no other cv200 board changes.

If a family-wide [3dnr] change ever makes sense, it needs measurements from more than one sensor and in daylight. I'd close this one in favour of builder#254.

@zx97

zx97 commented Nov 17, 2026

Copy link
Copy Markdown
Author

You are right and my premise was wrong: isp.iqProfile exists, config.json
only lists what is set, and the fallthrough is exactly what you describe. I
confirmed it on the board rather than taking it on faith - pointing the key at
ov2710.ini makes the loader open that file and apply its [3dnr]
(70/54/12/4), and pointing it back at ar0130.ini restores the other ladder.

That settles it: the file belongs in the device, not in the shared package. It
now lives in OpenIPC/builder#254 as
general/overlay/etc/sensors/iq/c23s.ini, selected from that device's
customizer with cli -s .isp.iqProfile /etc/sensors/iq/c23s.ini, so a C23S gets
it from first boot and no other cv200 board changes.

Closing this in favour of #254, as you suggested. The bisected ranges and the
"what this does not fix" section are being carried over to the device PR and to
the note in OpenIPC/majestic#378.

@zx97 zx97 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants