Message ID | 20220429010441.27110-1-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Quoting Laurent Pinchart via libcamera-devel (2022-04-29 02:04:41) > Now that geometry classes implement the stream formatting operator<<(), > use it instead of the toString() function. Seems pretty clear and straightforward. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/android/camera_capabilities.cpp | 6 +++--- > src/android/camera_device.cpp | 2 +- > src/android/yuv/post_processor_yuv.cpp | 4 ++-- > src/cam/camera_session.cpp | 3 +-- > src/cam/kms_sink.cpp | 4 +--- > src/libcamera/camera_sensor.cpp | 4 ++-- > src/libcamera/pipeline/ipu3/imgu.cpp | 19 +++++++++---------- > .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 +++--- > src/libcamera/pipeline/simple/converter.cpp | 2 +- > src/libcamera/pipeline/simple/simple.cpp | 8 ++++---- > src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +-- > src/libcamera/pipeline/vimc/vimc.cpp | 2 +- > src/libcamera/v4l2_subdevice.cpp | 2 +- > src/libcamera/v4l2_videodevice.cpp | 2 +- > test/camera-sensor.cpp | 3 +-- > test/geometry.cpp | 4 +--- > test/stream/stream_formats.cpp | 4 ++-- > 18 files changed, 36 insertions(+), 44 deletions(-) > > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp > index 55d651f38870..e06a517d84b8 100644 > --- a/src/android/camera_capabilities.cpp > +++ b/src/android/camera_capabilities.cpp > @@ -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; > } > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 00d484716045..f7ec95eb720e 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -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() << "]"; > > /* > diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp > index 9f88392476f1..513c6ef86153 100644 > --- a/src/android/yuv/post_processor_yuv.cpp > +++ b/src/android/yuv/post_processor_yuv.cpp > @@ -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; > } > > diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp > index 0428b5386537..bacb42561560 100644 > --- a/src/cam/camera_session.cpp > +++ b/src/cam/camera_session.cpp > @@ -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++; > diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp > index da579846fd8e..29be5623cb17 100644 > --- a/src/cam/kms_sink.cpp > +++ b/src/cam/kms_sink.cpp > @@ -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; > } > > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp > index eaa2da6bad32..4bb2066f0fd4 100644 > --- a/src/libcamera/camera_sensor.cpp > +++ b/src/libcamera/camera_sensor.cpp > @@ -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; > } > > diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp > index e5bbc3829c68..3ac997cc1acf 100644 > --- a/src/libcamera/pipeline/ipu3/imgu.cpp > +++ b/src/libcamera/pipeline/ipu3/imgu.cpp > @@ -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; > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > index acc0becaa5c0..d8c709b7a503 100644 > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > @@ -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 << ")"; > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > index 1624e2ecc5a0..1c53495c97cc 100644 > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > @@ -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; > > diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp > index 9cbc6ee30ce4..ee8376dea1e0 100644 > --- a/src/libcamera/pipeline/simple/converter.cpp > +++ b/src/libcamera/pipeline/simple/converter.cpp > @@ -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; > } > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index ece821bfe978..e76bf01261b0 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -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; > } > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp > index 40654a0bc40c..e5a79417f923 100644 > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp > @@ -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; > } > > diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp > index c3e33ecf048c..3db0ffe58c39 100644 > --- a/src/libcamera/pipeline/vimc/vimc.cpp > +++ b/src/libcamera/pipeline/vimc/vimc.cpp > @@ -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; > } > > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp > index fa216e85fde9..d5ae460571d8 100644 > --- a/src/libcamera/v4l2_subdevice.cpp > +++ b/src/libcamera/v4l2_subdevice.cpp > @@ -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); > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > index 05d3273ebb58..5ba866ad71bb 100644 > --- a/src/libcamera/v4l2_videodevice.cpp > +++ b/src/libcamera/v4l2_videodevice.cpp > @@ -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(); > } > > diff --git a/test/camera-sensor.cpp b/test/camera-sensor.cpp > index 372ee4aff69b..9b06a60e7695 100644 > --- a/test/camera-sensor.cpp > +++ b/test/camera-sensor.cpp > @@ -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; > } > > diff --git a/test/geometry.cpp b/test/geometry.cpp > index 5125692496b3..008d51eac0dd 100644 > --- a/test/geometry.cpp > +++ b/test/geometry.cpp > @@ -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; > } > diff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp > index 9353d0085e19..99fa0385e961 100644 > --- a/test/stream/stream_formats.cpp > +++ b/test/stream/stream_formats.cpp > @@ -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; > } > > base-commit: dc7fc90573b99bbc6d21a25a741891471d68f274 > -- > Regards, > > Laurent Pinchart >
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 55d651f38870..e06a517d84b8 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -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; } diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 00d484716045..f7ec95eb720e 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -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() << "]"; /* diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp index 9f88392476f1..513c6ef86153 100644 --- a/src/android/yuv/post_processor_yuv.cpp +++ b/src/android/yuv/post_processor_yuv.cpp @@ -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; } diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp index 0428b5386537..bacb42561560 100644 --- a/src/cam/camera_session.cpp +++ b/src/cam/camera_session.cpp @@ -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++; diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp index da579846fd8e..29be5623cb17 100644 --- a/src/cam/kms_sink.cpp +++ b/src/cam/kms_sink.cpp @@ -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; } diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index eaa2da6bad32..4bb2066f0fd4 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -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; } diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index e5bbc3829c68..3ac997cc1acf 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -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; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index acc0becaa5c0..d8c709b7a503 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -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 << ")"; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 1624e2ecc5a0..1c53495c97cc 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -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; diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 9cbc6ee30ce4..ee8376dea1e0 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -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; } diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index ece821bfe978..e76bf01261b0 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -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; } diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 40654a0bc40c..e5a79417f923 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -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; } diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index c3e33ecf048c..3db0ffe58c39 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -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; } diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index fa216e85fde9..d5ae460571d8 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -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); diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 05d3273ebb58..5ba866ad71bb 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -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(); } diff --git a/test/camera-sensor.cpp b/test/camera-sensor.cpp index 372ee4aff69b..9b06a60e7695 100644 --- a/test/camera-sensor.cpp +++ b/test/camera-sensor.cpp @@ -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; } diff --git a/test/geometry.cpp b/test/geometry.cpp index 5125692496b3..008d51eac0dd 100644 --- a/test/geometry.cpp +++ b/test/geometry.cpp @@ -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; } diff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp index 9353d0085e19..99fa0385e961 100644 --- a/test/stream/stream_formats.cpp +++ b/test/stream/stream_formats.cpp @@ -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; }
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> --- src/android/camera_capabilities.cpp | 6 +++--- src/android/camera_device.cpp | 2 +- src/android/yuv/post_processor_yuv.cpp | 4 ++-- src/cam/camera_session.cpp | 3 +-- src/cam/kms_sink.cpp | 4 +--- src/libcamera/camera_sensor.cpp | 4 ++-- src/libcamera/pipeline/ipu3/imgu.cpp | 19 +++++++++---------- .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 +++--- src/libcamera/pipeline/simple/converter.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 8 ++++---- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +-- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- src/libcamera/v4l2_subdevice.cpp | 2 +- src/libcamera/v4l2_videodevice.cpp | 2 +- test/camera-sensor.cpp | 3 +-- test/geometry.cpp | 4 +--- test/stream/stream_formats.cpp | 4 ++-- 18 files changed, 36 insertions(+), 44 deletions(-) base-commit: dc7fc90573b99bbc6d21a25a741891471d68f274