summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/pipeline/rpi/common/pipeline_base.cpp')
-rw-r--r--src/libcamera/pipeline/rpi/common/pipeline_base.cpp54
1 files changed, 6 insertions, 48 deletions
diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index 9449c3dc..7e420b3f 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -235,24 +235,16 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
for (auto &raw : rawStreams_) {
StreamConfiguration *rawStream = raw.cfg;
- /* Adjust the RAW stream to match the computed sensor format. */
- BayerFormat sensorBayer = BayerFormat::fromMbusCode(sensorFormat_.code);
-
/*
- * Some sensors change their Bayer order when they are h-flipped
- * or v-flipped, according to the transform. If this one does, we
- * must advertise the transformed Bayer order in the raw stream.
- * Note how we must fetch the "native" (i.e. untransformed) Bayer
- * order, because the sensor may currently be flipped!
+ * Some sensors change their Bayer order when they are
+ * h-flipped or v-flipped, according to the transform. Adjust
+ * the RAW stream to match the computed sensor format by
+ * applying the sensor Bayer order resulting from the transform
+ * to the user request.
*/
- if (data_->flipsAlterBayerOrder_) {
- sensorBayer.order = data_->nativeBayerOrder_;
- sensorBayer = sensorBayer.transform(combinedTransform_);
- }
- /* Apply the sensor adjusted Bayer order to the user request. */
BayerFormat cfgBayer = BayerFormat::fromPixelFormat(rawStream->pixelFormat);
- cfgBayer.order = sensorBayer.order;
+ cfgBayer.order = data_->sensor_->bayerOrder(combinedTransform_);
if (rawStream->pixelFormat != cfgBayer.toPixelFormat()) {
rawStream->pixelFormat = cfgBayer.toPixelFormat();
@@ -840,40 +832,6 @@ int PipelineHandlerBase::registerCamera(std::unique_ptr<RPi::CameraData> &camera
*/
data->properties_.set(properties::ScalerCropMaximum, Rectangle{});
- /*
- * We cache two things about the sensor in relation to transforms
- * (meaning horizontal and vertical flips): if they affect the Bayer
- * ordering, and what the "native" Bayer order is, when no transforms
- * are applied.
- *
- * If flips are supported verify if they affect the Bayer ordering
- * and what the "native" Bayer order is, when no transforms are
- * applied.
- *
- * We note that the sensor's cached list of supported formats is
- * already in the "native" order, with any flips having been undone.
- */
- const V4L2Subdevice *sensor = data->sensor_->device();
- const struct v4l2_query_ext_ctrl *hflipCtrl = sensor->controlInfo(V4L2_CID_HFLIP);
- if (hflipCtrl) {
- /* We assume it will support vflips too... */
- data->flipsAlterBayerOrder_ = hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT;
- }
-
- /* Look for a valid Bayer format. */
- BayerFormat bayerFormat;
- for (const auto &iter : data->sensorFormats_) {
- bayerFormat = BayerFormat::fromMbusCode(iter.first);
- if (bayerFormat.isValid())
- break;
- }
-
- if (!bayerFormat.isValid()) {
- LOG(RPI, Error) << "No Bayer format found";
- return -EINVAL;
- }
- data->nativeBayerOrder_ = bayerFormat.order;
-
ret = platformRegister(cameraData, frontend, backend);
if (ret)
return ret;