-
Notifications
You must be signed in to change notification settings - Fork 257
indi-libcamera: use negotiated stream size for CCD geometry #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -621,6 +621,10 @@ RpiCamProperties INDILibCamera::getAvailableCamProperties() | |
|
|
||
| config->validate(); | ||
| cam->configure(config.get()); | ||
| // Save the negotiated StillCapture stream size. | ||
| // This is used to initialize the CCD geometry during Connect(). | ||
| m_CaptureWidth = config->at(0).size.width; | ||
| m_CaptureHeight = config->at(0).size.height; | ||
|
|
||
| const auto &controls = cam->controls(); | ||
|
|
||
|
|
@@ -926,10 +930,30 @@ void INDILibCamera::default_signal_handler(int signal_number) | |
| bool INDILibCamera::Connect() | ||
| { | ||
| LOGF_INFO("Connecting to %s", getDeviceName()); | ||
| auto pas = m_ControlList.get(properties::PixelArraySize); | ||
| // no idea why the IMX290 returns an uneven number of pixels, so just round down | ||
| auto width = 2.0 * (pas->width / 2); | ||
| auto height = pas->height; | ||
|
|
||
| // Use the negotiated StillCapture stream size when available. | ||
| // PixelArraySize describes the sensor array and may differ from | ||
| // the actual capture stream dimensions on some cameras. | ||
| uint32_t width = m_CaptureWidth; | ||
| uint32_t height = m_CaptureHeight; | ||
|
|
||
| if (width == 0 || height == 0) | ||
| { | ||
| auto pas = m_ControlList.get(properties::PixelArraySize); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: indentation looks to be of here too |
||
|
|
||
| if (pas) | ||
| { | ||
| width = 2 * (pas->width / 2); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I'd keep the comment here about rounding down |
||
| height = pas->height; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I'd remove this empty line |
||
| LOG_WARN("Negotiated stream size unavailable, falling back to PixelArraySize."); | ||
| } | ||
| else | ||
| { | ||
| LOG_ERROR("Unable to determine CCD size."); | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| PrimaryCCD.setResolution(width, height); | ||
| UpdateCCDFrame(0, 0, width, height); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,6 +167,10 @@ class INDILibCamera : public INDI::CCD | |
| int m_black_levels[4] {0, 0, 0, 0}; | ||
| int m_LiveVideoWidth {-1}, m_LiveVideoHeight {-1}; | ||
| uint8_t m_CameraIndex; | ||
|
|
||
| uint32_t m_CaptureWidth = 0; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: indentation looks of |
||
| uint32_t m_CaptureHeight = 0; | ||
|
|
||
| libcamera::ControlList m_ControlList; | ||
|
|
||
| RpiCamProperties getAvailableCamProperties(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indentation