pipeline: rkisp1: Keep aspect ratio on imx8mp
In the current code, the input stage of the image resizer is used to apply a crop to keep the aspect ratio in cases where the requested output aspect ratio differs from the one of the selected sensor mode. On the imx8mp the resizer hardware is not capable of cropping (for reference see also rkisp1-resizer.c:rkisp1_rsz_set_sink_crop() in the linux kernel v6.10). Therefore apply the necessary cropping on the output of the ISP (on the image stabilization block). The cropping code on the image resizer doesn't need modifications as the requested crop gets ignored by the kernel. While at it, remove a todo comment that is no longer needed. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
parent
479e8c851c
commit
db9b6f8e23
2 changed files with 21 additions and 5 deletions
|
@ -812,6 +812,19 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
|
||||||
if (!isRaw_)
|
if (!isRaw_)
|
||||||
format.code = MEDIA_BUS_FMT_YUYV8_2X8;
|
format.code = MEDIA_BUS_FMT_YUYV8_2X8;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On devices without DUAL_CROP (like the imx8mp) cropping needs to be
|
||||||
|
* done on the ISP/IS output.
|
||||||
|
*/
|
||||||
|
if (media_->hwRevision() == RKISP1_V_IMX8MP) {
|
||||||
|
/* imx8mp has only a single path. */
|
||||||
|
const auto &cfg = config->at(0);
|
||||||
|
Size ispCrop = format.size.boundedToAspectRatio(cfg.size)
|
||||||
|
.alignedUpTo(2, 2);
|
||||||
|
rect = ispCrop.centeredTo(Rectangle(format.size).center());
|
||||||
|
format.size = ispCrop;
|
||||||
|
}
|
||||||
|
|
||||||
LOG(RkISP1, Debug)
|
LOG(RkISP1, Debug)
|
||||||
<< "Configuring ISP output pad with " << format
|
<< "Configuring ISP output pad with " << format
|
||||||
<< " crop " << rect;
|
<< " crop " << rect;
|
||||||
|
|
|
@ -417,11 +417,14 @@ int RkISP1Path::configure(const StreamConfiguration &config,
|
||||||
/*
|
/*
|
||||||
* Crop on the resizer input to maintain FOV before downscaling.
|
* Crop on the resizer input to maintain FOV before downscaling.
|
||||||
*
|
*
|
||||||
* \todo The alignment to a multiple of 2 pixels is required but may
|
* Note that this does not apply to devices without DUAL_CROP support
|
||||||
* change the aspect ratio very slightly. A more advanced algorithm to
|
* (like imx8mp) , where the cropping needs to be done on the
|
||||||
* compute the resizer input crop rectangle is needed, and it should
|
* ImageStabilizer block on the ISP source pad and therefore is
|
||||||
* also take into account the need to crop away the edge pixels affected
|
* configured before this stage. For simplicity we still set the crop.
|
||||||
* by the ISP processing blocks.
|
* This gets ignored by the kernel driver because the hardware is
|
||||||
|
* missing the capability.
|
||||||
|
*
|
||||||
|
* Alignment to a multiple of 2 pixels is required by the resizer.
|
||||||
*/
|
*/
|
||||||
Size ispCrop = inputFormat.size.boundedToAspectRatio(config.size)
|
Size ispCrop = inputFormat.size.boundedToAspectRatio(config.size)
|
||||||
.alignedUpTo(2, 2);
|
.alignedUpTo(2, 2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue