mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-15 16:35:06 +03:00
android: camera_device: Generate RAW resolutions
The resolutions supported for the RAW formats cannot be tested from a list of known sizes like the processed ones. This is mainly due to the fact RAW streams are produced by capturing frames at the CSI-2 receiver output and their size corresponds to the sensor's native sizes. In order to obtain the RAW frame size generate a temporary CameraConfiguration for the Role::StillCaptureRAW role and inspect the map of StreamFormats returned by the pipeline handler. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
bfee6316fc
commit
4961033ac9
2 changed files with 22 additions and 3 deletions
|
@ -314,6 +314,17 @@ std::vector<Size> CameraDevice::getYUVResolutions(CameraConfiguration *cameraCon
|
||||||
return supportedResolutions;
|
return supportedResolutions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Size> CameraDevice::getRawResolutions(const libcamera::PixelFormat &pixelFormat)
|
||||||
|
{
|
||||||
|
std::unique_ptr<CameraConfiguration> cameraConfig =
|
||||||
|
camera_->generateConfiguration({ StillCaptureRaw });
|
||||||
|
StreamConfiguration &cfg = cameraConfig->at(0);
|
||||||
|
const StreamFormats &formats = cfg.formats();
|
||||||
|
std::vector<Size> supportedResolutions = formats.sizes(pixelFormat);
|
||||||
|
|
||||||
|
return supportedResolutions;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the format conversion map to translate from Android format
|
* Initialize the format conversion map to translate from Android format
|
||||||
* identifier to libcamera pixel formats and fill in the list of supported
|
* identifier to libcamera pixel formats and fill in the list of supported
|
||||||
|
@ -458,9 +469,15 @@ int CameraDevice::initializeStreamConfigurations()
|
||||||
<< camera3Format.name << " to "
|
<< camera3Format.name << " to "
|
||||||
<< mappedFormat.toString();
|
<< mappedFormat.toString();
|
||||||
|
|
||||||
std::vector<Size> resolutions = getYUVResolutions(cameraConfig.get(),
|
std::vector<Size> resolutions;
|
||||||
|
const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat);
|
||||||
|
if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
|
||||||
|
resolutions = getRawResolutions(mappedFormat);
|
||||||
|
else
|
||||||
|
resolutions = getYUVResolutions(cameraConfig.get(),
|
||||||
mappedFormat,
|
mappedFormat,
|
||||||
cameraResolutions);
|
cameraResolutions);
|
||||||
|
|
||||||
for (const Size &res : resolutions) {
|
for (const Size &res : resolutions) {
|
||||||
streamConfigurations_.push_back({ res, androidFormat });
|
streamConfigurations_.push_back({ res, androidFormat });
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,8 @@ private:
|
||||||
getYUVResolutions(libcamera::CameraConfiguration *cameraConfig,
|
getYUVResolutions(libcamera::CameraConfiguration *cameraConfig,
|
||||||
const libcamera::PixelFormat &pixelFormat,
|
const libcamera::PixelFormat &pixelFormat,
|
||||||
const std::vector<libcamera::Size> &resolutions);
|
const std::vector<libcamera::Size> &resolutions);
|
||||||
|
std::vector<libcamera::Size>
|
||||||
|
getRawResolutions(const libcamera::PixelFormat &pixelFormat);
|
||||||
|
|
||||||
std::tuple<uint32_t, uint32_t> calculateStaticMetadataSize();
|
std::tuple<uint32_t, uint32_t> calculateStaticMetadataSize();
|
||||||
libcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer);
|
libcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue