@@ -496,7 +496,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
case StreamRole::VideoRecording:
fmts = data->isp_[Isp::Output0].dev()->formats();
- pixelFormat = formats::NV12;
+ pixelFormat = formats::YUV420;
size = { 1920, 1080 };
bufferCount = 4;
outCount++;
@@ -608,6 +608,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
* StreamConfiguration appropriately.
*/
V4L2DeviceFormat format;
+ bool output1Set = false;
for (unsigned i = 0; i < config->size(); i++) {
StreamConfiguration &cfg = config->at(i);
@@ -632,6 +633,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
format.size = cfg.size;
format.fourcc = fourcc;
+ LOG(RPI, Info) << "Setting " << stream->name() << " to a resolution of "
+ << format.toString();
+
ret = stream->dev()->setFormat(&format);
if (ret)
return -EINVAL;
@@ -645,6 +649,35 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
cfg.setStream(stream);
stream->setExternal(true);
+
+ if (i != maxIndex)
+ output1Set = true;
+ }
+
+ /*
+ * If ISP::Output1 stream has not been requested by the application, we
+ * set it up for internal use now. This second stream will be used for
+ * fast colour denoise, and must be a quarter resolution of the ISP::Output0
+ * stream. However, also limit the maximum size to 1200 pixels in the
+ * larger dimension, just to avoid being wasteful with buffer allocations
+ * and memory bandwidth.
+ */
+ if (!output1Set) {
+ V4L2DeviceFormat output1Format = format;
+ constexpr unsigned int maxDimensions = 1200;
+ const Size limit = Size(maxDimensions, maxDimensions).boundedToAspectRatio(format.size);
+
+ output1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);
+
+ LOG(RPI, Info) << "Setting ISP Output1 (internal) to a resolution of "
+ << output1Format.toString();
+
+ ret = data->isp_[Isp::Output1].dev()->setFormat(&output1Format);
+ if (ret) {
+ LOG(RPI, Error) << "Failed to set format on ISP Output1: "
+ << ret;
+ return -EINVAL;
+ }
}
/* ISP statistics output format. */