Skip to content

V4L2: Apply software binning after frame stacking#2407

Open
cfuture81 wants to merge 1 commit into
indilib:masterfrom
cfuture81:fix-v4l2-stacking-binning
Open

V4L2: Apply software binning after frame stacking#2407
cfuture81 wants to merge 1 commit into
indilib:masterfrom
cfuture81:fix-v4l2-stacking-binning

Conversation

@cfuture81

@cfuture81 cfuture81 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Fixes horizontal striping artifacts when both software binning and frame stacking (Mean/Additive/Take Dark) are enabled simultaneously in the V4L2 driver.

Problem

The non-stacked mono capture path correctly calls PrimaryCCD.binFrame() after writing frame data to the CCD buffer, applying the requested software binning. However, the stacked path writes the full-resolution accumulated frame directly to the buffer without calling binFrame(). This causes a stride mismatch — the buffer contains full-resolution data but the frame metadata expects binned dimensions — resulting in horizontal striping artifacts.

Fix

Add PrimaryCCD.binFrame() after the stacked frame is written to the output buffer, matching the behavior of the non-stacked path. This applies to all stacking modes (STACK_MEAN, STACK_ADDITIVE, STACK_TAKE_DARK).

Reported by

User on stellarmate discord forum using IMX415 sensor (3840x2160 native, 1920x1080 with 2x2 binning) with indi_v4l2_ccd v1.2. Binning and stacking work correctly individually but produce striped images when combined.

The non-stacked mono path calls PrimaryCCD.binFrame() to apply software
binning, but the stacked path (STACK_MEAN, STACK_ADDITIVE, STACK_TAKE_DARK)
writes the full-resolution accumulated frame directly to the CCD buffer
without ever calling binFrame(). This causes a stride mismatch when binning
is enabled, resulting in horizontal striping artifacts in the output image.

Add PrimaryCCD.binFrame() after the stacked frame is written to the output
buffer, matching the behavior of the non-stacked path.

Reported-by: User on indilib.org forum (IMX415 sensor, indi_v4l2_ccd v1.2)
@knro

knro commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Thank you. Was this fix verified by the reporter after this patch?

@cfuture81

Copy link
Copy Markdown
Contributor Author

Thank you. Was this fix verified by the reporter after this patch?

Hi. Not yet. I will post a update once confirmed

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