libcamera: Replace toString with operator<<() for geometry classes
Now that geometry classes implement the stream formatting operator<<(), use it instead of the toString() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
4f1d1a48fe
commit
37958dfd71
19 changed files with 37 additions and 45 deletions
|
@ -487,7 +487,7 @@ int CameraCapabilities::initializeStreamConfigurations()
|
|||
* JPEG encoder requirements into account (alignment and aspect ratio).
|
||||
*/
|
||||
const Size maxRes = cfg.size;
|
||||
LOG(HAL, Debug) << "Maximum supported resolution: " << maxRes.toString();
|
||||
LOG(HAL, Debug) << "Maximum supported resolution: " << maxRes;
|
||||
|
||||
/*
|
||||
* Build the list of supported image resolutions.
|
||||
|
@ -729,7 +729,7 @@ int CameraCapabilities::initializeStreamConfigurations()
|
|||
|
||||
LOG(HAL, Debug) << "Collected stream configuration map: ";
|
||||
for (const auto &entry : streamConfigurations_)
|
||||
LOG(HAL, Debug) << "{ " << entry.resolution.toString() << " - "
|
||||
LOG(HAL, Debug) << "{ " << entry.resolution << " - "
|
||||
<< utils::hex(entry.androidFormat) << " }";
|
||||
|
||||
return 0;
|
||||
|
@ -1321,7 +1321,7 @@ int CameraCapabilities::initializeStaticMetadata()
|
|||
|
||||
LOG(HAL, Debug)
|
||||
<< "Output Stream: " << utils::hex(entry.androidFormat)
|
||||
<< " (" << entry.resolution.toString() << ")["
|
||||
<< " (" << entry.resolution << ")["
|
||||
<< entry.minFrameDurationNsec << "]"
|
||||
<< "@" << fps;
|
||||
}
|
||||
|
|
|
@ -925,7 +925,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
|
|||
ss << i << " - (" << camera3Stream->width << "x"
|
||||
<< camera3Stream->height << ")"
|
||||
<< "[" << utils::hex(camera3Stream->format) << "] -> "
|
||||
<< "(" << cameraStream->configuration().size.toString() << ")["
|
||||
<< "(" << cameraStream->configuration().size << ")["
|
||||
<< cameraStream->configuration().pixelFormat.toString() << "]";
|
||||
|
||||
/*
|
||||
|
|
|
@ -34,8 +34,8 @@ int PostProcessorYuv::configure(const StreamConfiguration &inCfg,
|
|||
|
||||
if (inCfg.size < outCfg.size) {
|
||||
LOG(YUV, Error) << "Up-scaling is not supported"
|
||||
<< " (from " << inCfg.size.toString()
|
||||
<< " to " << outCfg.size.toString() << ")";
|
||||
<< " (from " << inCfg.size
|
||||
<< " to " << outCfg.size << ")";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,8 +150,7 @@ void CameraSession::infoConfiguration() const
|
|||
<< std::endl;
|
||||
|
||||
for (const Size &size : formats.sizes(pixelformat))
|
||||
std::cout << " - " << size.toString()
|
||||
<< std::endl;
|
||||
std::cout << " - " << size << std::endl;
|
||||
}
|
||||
|
||||
index++;
|
||||
|
|
|
@ -119,9 +119,7 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)
|
|||
mode.vdisplay == cfg.size.height;
|
||||
});
|
||||
if (iter == modes.end()) {
|
||||
std::cerr
|
||||
<< "No mode matching " << cfg.size.toString()
|
||||
<< std::endl;
|
||||
std::cerr << "No mode matching " << cfg.size << std::endl;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ int CameraSensor::validateSensorDriver()
|
|||
|
||||
LOG(CameraSensor, Warning)
|
||||
<< "The PixelArraySize property has been defaulted to "
|
||||
<< pixelArraySize_.toString();
|
||||
<< pixelArraySize_;
|
||||
err = -EINVAL;
|
||||
} else {
|
||||
pixelArraySize_ = rect.size();
|
||||
|
@ -249,7 +249,7 @@ int CameraSensor::validateSensorDriver()
|
|||
activeArea_ = Rectangle(pixelArraySize_);
|
||||
LOG(CameraSensor, Warning)
|
||||
<< "The PixelArrayActiveAreas property has been defaulted to "
|
||||
<< activeArea_.toString();
|
||||
<< activeArea_;
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -386,9 +386,9 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)
|
|||
pipeConfigs.clear();
|
||||
|
||||
LOG(IPU3, Debug) << "Calculating pipe configuration for: ";
|
||||
LOG(IPU3, Debug) << "input: " << pipe->input.toString();
|
||||
LOG(IPU3, Debug) << "main: " << pipe->main.toString();
|
||||
LOG(IPU3, Debug) << "vf: " << pipe->viewfinder.toString();
|
||||
LOG(IPU3, Debug) << "input: " << pipe->input;
|
||||
LOG(IPU3, Debug) << "main: " << pipe->main;
|
||||
LOG(IPU3, Debug) << "vf: " << pipe->viewfinder;
|
||||
|
||||
const Size &in = pipe->input;
|
||||
|
||||
|
@ -397,8 +397,7 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)
|
|||
* See https://bugs.libcamera.org/show_bug.cgi?id=32
|
||||
*/
|
||||
if (in.width < ImgUDevice::kIFMaxCropWidth || in.height < ImgUDevice::kIFMaxCropHeight) {
|
||||
LOG(IPU3, Error) << "Input resolution " << in.toString()
|
||||
<< " not supported";
|
||||
LOG(IPU3, Error) << "Input resolution " << in << " not supported";
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -460,9 +459,9 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)
|
|||
}
|
||||
|
||||
LOG(IPU3, Debug) << "Computed pipe configuration: ";
|
||||
LOG(IPU3, Debug) << "IF: " << pipeConfigs[bestIndex].iif.toString();
|
||||
LOG(IPU3, Debug) << "BDS: " << pipeConfigs[bestIndex].bds.toString();
|
||||
LOG(IPU3, Debug) << "GDC: " << pipeConfigs[bestIndex].gdc.toString();
|
||||
LOG(IPU3, Debug) << "IF: " << pipeConfigs[bestIndex].iif;
|
||||
LOG(IPU3, Debug) << "BDS: " << pipeConfigs[bestIndex].bds;
|
||||
LOG(IPU3, Debug) << "GDC: " << pipeConfigs[bestIndex].gdc;
|
||||
|
||||
return pipeConfigs[bestIndex];
|
||||
}
|
||||
|
@ -496,13 +495,13 @@ int ImgUDevice::configure(const PipeConfig &pipeConfig, V4L2DeviceFormat *inputF
|
|||
ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_CROP, &iif);
|
||||
if (ret)
|
||||
return ret;
|
||||
LOG(IPU3, Debug) << "ImgU IF rectangle = " << iif.toString();
|
||||
LOG(IPU3, Debug) << "ImgU IF rectangle = " << iif;
|
||||
|
||||
Rectangle bds{ 0, 0, pipeConfig.bds };
|
||||
ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_COMPOSE, &bds);
|
||||
if (ret)
|
||||
return ret;
|
||||
LOG(IPU3, Debug) << "ImgU BDS rectangle = " << bds.toString();
|
||||
LOG(IPU3, Debug) << "ImgU BDS rectangle = " << bds;
|
||||
|
||||
V4L2SubdeviceFormat gdcFormat = {};
|
||||
gdcFormat.mbus_code = MEDIA_BUS_FMT_FIXED;
|
||||
|
|
|
@ -166,7 +166,7 @@ V4L2SubdeviceFormat findBestFormat(const SensorFormats &formatsMap, const Size &
|
|||
bestFormat.size = size;
|
||||
}
|
||||
|
||||
LOG(RPI, Debug) << "Format: " << size.toString()
|
||||
LOG(RPI, Debug) << "Format: " << size
|
||||
<< " fmt " << format.toString()
|
||||
<< " Score: " << score
|
||||
<< " (best " << bestScore << ")";
|
||||
|
|
|
@ -592,13 +592,13 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
|
|||
|
||||
LOG(RkISP1, Debug)
|
||||
<< "ISP input pad configured with " << format.toString()
|
||||
<< " crop " << rect.toString();
|
||||
<< " crop " << rect;
|
||||
|
||||
/* YUYV8_2X8 is required on the ISP source path pad for YUV output. */
|
||||
format.mbus_code = MEDIA_BUS_FMT_YUYV8_2X8;
|
||||
LOG(RkISP1, Debug)
|
||||
<< "Configuring ISP output pad with " << format.toString()
|
||||
<< " crop " << rect.toString();
|
||||
<< " crop " << rect;
|
||||
|
||||
ret = isp_->setSelection(2, V4L2_SEL_TGT_CROP, &rect);
|
||||
if (ret < 0)
|
||||
|
@ -610,7 +610,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
|
|||
|
||||
LOG(RkISP1, Debug)
|
||||
<< "ISP output pad configured with " << format.toString()
|
||||
<< " crop " << rect.toString();
|
||||
<< " crop " << rect;
|
||||
|
||||
std::map<unsigned int, IPAStream> streamConfig;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ int RkISP1Path::configure(const StreamConfiguration &config,
|
|||
|
||||
LOG(RkISP1, Debug)
|
||||
<< "Configured " << name_ << " resizer input pad with "
|
||||
<< ispFormat.toString() << " crop " << rect.toString();
|
||||
<< ispFormat.toString() << " crop " << rect;
|
||||
|
||||
ispFormat.size = config.size;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,
|
|||
format.planes[0].bpl != inputCfg.stride) {
|
||||
LOG(SimplePipeline, Error)
|
||||
<< "Input format not supported (requested "
|
||||
<< inputCfg.size.toString() << "-" << videoFormat.toString()
|
||||
<< inputCfg.size << "-" << videoFormat.toString()
|
||||
<< ", got " << format.toString() << ")";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -474,7 +474,7 @@ int SimpleCameraData::init()
|
|||
video_->formats(format.mbus_code);
|
||||
|
||||
LOG(SimplePipeline, Debug)
|
||||
<< "Adding configuration for " << format.size.toString()
|
||||
<< "Adding configuration for " << format.size
|
||||
<< " in pixel formats [ "
|
||||
<< utils::join(videoFormats, ", ",
|
||||
[](const auto &f) {
|
||||
|
@ -808,8 +808,8 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
|
|||
|
||||
if (!pipeConfig_->outputSizes.contains(cfg.size)) {
|
||||
LOG(SimplePipeline, Debug)
|
||||
<< "Adjusting size from " << cfg.size.toString()
|
||||
<< " to " << pipeConfig_->captureSize.toString();
|
||||
<< "Adjusting size from " << cfg.size
|
||||
<< " to " << pipeConfig_->captureSize;
|
||||
cfg.size = pipeConfig_->captureSize;
|
||||
status = Adjusted;
|
||||
}
|
||||
|
@ -939,7 +939,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
|
|||
captureFormat.size != pipeConfig->captureSize) {
|
||||
LOG(SimplePipeline, Error)
|
||||
<< "Unable to configure capture in "
|
||||
<< pipeConfig->captureSize.toString() << "-"
|
||||
<< pipeConfig->captureSize << "-"
|
||||
<< videoFormat.toString();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -143,8 +143,7 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()
|
|||
|
||||
if (cfg.size != size) {
|
||||
LOG(UVC, Debug)
|
||||
<< "Adjusting size from " << size.toString()
|
||||
<< " to " << cfg.size.toString();
|
||||
<< "Adjusting size from " << size << " to " << cfg.size;
|
||||
status = Adjusted;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()
|
|||
|
||||
if (cfg.size != size) {
|
||||
LOG(VIMC, Debug)
|
||||
<< "Adjusting size to " << cfg.size.toString();
|
||||
<< "Adjusting size to " << cfg.size;
|
||||
status = Adjusted;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
|
|||
const std::string V4L2SubdeviceFormat::toString() const
|
||||
{
|
||||
std::stringstream mbus;
|
||||
mbus << size.toString() << "-";
|
||||
mbus << size << "-";
|
||||
|
||||
const auto it = formatInfoMap.find(mbus_code);
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const
|
|||
const std::string V4L2DeviceFormat::toString() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << size.toString() << "-" << fourcc.toString();
|
||||
ss << size << "-" << fourcc.toString();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,7 @@ protected:
|
|||
|
||||
const Size &resolution = sensor_->resolution();
|
||||
if (resolution != Size(4096, 2160)) {
|
||||
cerr << "Incorrect sensor resolution "
|
||||
<< resolution.toString() << endl;
|
||||
cerr << "Incorrect sensor resolution " << resolution << endl;
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,7 @@ protected:
|
|||
bool result = op(lhs, rhs);
|
||||
|
||||
if (result != expect) {
|
||||
cout << lhs.toString()
|
||||
<< opName << " "
|
||||
<< rhs.toString()
|
||||
cout << lhs << opName << " " << rhs
|
||||
<< "test failed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,10 @@ protected:
|
|||
cout << "Failed " << name << endl;
|
||||
cout << "Sizes to test:" << endl;
|
||||
for (Size &size : test)
|
||||
cout << size.toString() << endl;
|
||||
cout << size << endl;
|
||||
cout << "Valid sizes:" << endl;
|
||||
for (Size &size : valid)
|
||||
cout << size.toString() << endl;
|
||||
cout << size << endl;
|
||||
|
||||
return TestFail;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue