[{"id":20157,"web_url":"https://patchwork.libcamera.org/comment/20157/","msgid":"<YWYs0JPyq6+CwbNK@pendragon.ideasonboard.com>","date":"2021-10-13T00:48:16","subject":"Re: [libcamera-devel] [PATCH v3 02/16] libcamera: ipu3: Centralize\n\tImgU sizes definition","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Oct 11, 2021 at 05:11:40PM +0200, Jacopo Mondi wrote:\n> The definition of several constants that describe the ImgU\n> characteristics are spread between two files: ipu3.cpp and imgu.cpp.\n> \n> As the ipu3.cpp uses definitions from the imgu.cpp file, in order to\n> remove the usage of magic numbers, it is required to move the\n> definitions to a common header file where they are accessible to the\n> other .cpp modules.\n> \n> Move all the definitions of the ImgU sizes and alignments to the\n> ImgUDevice class as static constexpr and update their users accordingly.\n> \n> Cosmetic changes, no functional changes intended.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 86 +++++++++++-----------------\n>  src/libcamera/pipeline/ipu3/imgu.h   | 23 ++++++++\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 47 +++++++--------\n>  3 files changed, 79 insertions(+), 77 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index 3e1ef645ec93..f326886bf3da 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -34,22 +34,6 @@ namespace {\n>   * at revision: 243d13446e44 (\"Fix some bug for some resolutions\")\n>   */\n>  \n> -static constexpr unsigned int FILTER_W = 4;\n> -static constexpr unsigned int FILTER_H = 4;\n> -\n> -static constexpr unsigned int IF_ALIGN_W = 2;\n> -static constexpr unsigned int IF_ALIGN_H = 4;\n> -\n> -static constexpr unsigned int BDS_ALIGN_W = 2;\n> -static constexpr unsigned int BDS_ALIGN_H = 4;\n> -\n> -static constexpr unsigned int IF_CROP_MAX_W = 40;\n> -static constexpr unsigned int IF_CROP_MAX_H = 540;\n> -\n> -static constexpr float BDS_SF_MAX = 2.5;\n> -static constexpr float BDS_SF_MIN = 1.0;\n> -static constexpr float BDS_SF_STEP = 0.03125;\n> -\n>  /* BSD scaling factors: min=1, max=2.5, step=1/32 */\n>  const std::vector<float> bdsScalingFactors = {\n>  \t1, 1.03125, 1.0625, 1.09375, 1.125, 1.15625, 1.1875, 1.21875, 1.25,\n> @@ -124,8 +108,8 @@ bool isSameRatio(const Size &in, const Size &out)\n>  void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc,\n>  \t\t\tunsigned int bdsWidth, float bdsSF)\n>  {\n> -\tunsigned int minIFHeight = iif.height - IF_CROP_MAX_H;\n> -\tunsigned int minBDSHeight = gdc.height + FILTER_H * 2;\n> +\tunsigned int minIFHeight = iif.height - ImgUDevice::kIFMaxCropHeight;\n> +\tunsigned int minBDSHeight = gdc.height + ImgUDevice::kFilterHeight * 2;\n>  \tunsigned int ifHeight;\n>  \tfloat bdsHeight;\n>  \n> @@ -135,7 +119,7 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n>  \t\t\t\t    static_cast<float>(gdc.width);\n>  \t\testIFHeight = std::clamp<float>(estIFHeight, minIFHeight, iif.height);\n>  \n> -\t\tifHeight = utils::alignUp(estIFHeight, IF_ALIGN_H);\n> +\t\tifHeight = utils::alignUp(estIFHeight, ImgUDevice::kAlignHeight);\n>  \t\twhile (ifHeight >= minIFHeight && ifHeight <= iif.height &&\n>  \t\t       ifHeight / bdsSF >= minBDSHeight) {\n>  \n> @@ -143,17 +127,17 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n>  \t\t\tif (std::fmod(height, 1.0) == 0) {\n>  \t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(height);\n>  \n> -\t\t\t\tif (!(bdsIntHeight % BDS_ALIGN_H)) {\n> +\t\t\t\tif (!(bdsIntHeight % ImgUDevice::kBDSAlignHeight)) {\n>  \t\t\t\t\tfoundIfHeight = ifHeight;\n>  \t\t\t\t\tbdsHeight = height;\n>  \t\t\t\t\tbreak;\n>  \t\t\t\t}\n>  \t\t\t}\n>  \n> -\t\t\tifHeight -= IF_ALIGN_H;\n> +\t\t\tifHeight -= ImgUDevice::kAlignHeight;\n>  \t\t}\n>  \n> -\t\tifHeight = utils::alignUp(estIFHeight, IF_ALIGN_H);\n> +\t\tifHeight = utils::alignUp(estIFHeight, ImgUDevice::kAlignHeight);\n>  \t\twhile (ifHeight >= minIFHeight && ifHeight <= iif.height &&\n>  \t\t       ifHeight / bdsSF >= minBDSHeight) {\n>  \n> @@ -161,14 +145,14 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n>  \t\t\tif (std::fmod(height, 1.0) == 0) {\n>  \t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(height);\n>  \n> -\t\t\t\tif (!(bdsIntHeight % BDS_ALIGN_H)) {\n> +\t\t\t\tif (!(bdsIntHeight % ImgUDevice::kBDSAlignHeight)) {\n>  \t\t\t\t\tfoundIfHeight = ifHeight;\n>  \t\t\t\t\tbdsHeight = height;\n>  \t\t\t\t\tbreak;\n>  \t\t\t\t}\n>  \t\t\t}\n>  \n> -\t\t\tifHeight += IF_ALIGN_H;\n> +\t\t\tifHeight += ImgUDevice::kAlignHeight;\n>  \t\t}\n>  \n>  \t\tif (foundIfHeight) {\n> @@ -179,32 +163,32 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n>  \t\t\treturn;\n>  \t\t}\n>  \t} else {\n> -\t\tifHeight = utils::alignUp(iif.height, IF_ALIGN_H);\n> +\t\tifHeight = utils::alignUp(iif.height, ImgUDevice::kAlignHeight);\n>  \t\twhile (ifHeight >= minIFHeight && ifHeight / bdsSF >= minBDSHeight) {\n>  \n>  \t\t\tbdsHeight = ifHeight / bdsSF;\n>  \t\t\tif (std::fmod(ifHeight, 1.0) == 0 && std::fmod(bdsHeight, 1.0) == 0) {\n>  \t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n>  \n> -\t\t\t\tif (!(ifHeight % IF_ALIGN_H) &&\n> -\t\t\t\t    !(bdsIntHeight % BDS_ALIGN_H)) {\n> +\t\t\t\tif (!(ifHeight % ImgUDevice::kAlignHeight) &&\n> +\t\t\t\t    !(bdsIntHeight % ImgUDevice::kBDSAlignHeight)) {\n>  \t\t\t\t\tpipeConfigs.push_back({ bdsSF, { iif.width, ifHeight },\n>  \t\t\t\t\t\t\t\t{ bdsWidth, bdsIntHeight }, gdc });\n>  \t\t\t\t}\n>  \t\t\t}\n>  \n> -\t\t\tifHeight -= IF_ALIGN_H;\n> +\t\t\tifHeight -= ImgUDevice::kAlignHeight;\n>  \t\t}\n>  \t}\n>  }\n>  \n>  void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, float bdsSF)\n>  {\n> -\tunsigned int minBDSWidth = gdc.width + FILTER_W * 2;\n> -\tunsigned int minBDSHeight = gdc.height + FILTER_H * 2;\n> +\tunsigned int minBDSWidth = gdc.width + ImgUDevice::kFilterWidth * 2;\n> +\tunsigned int minBDSHeight = gdc.height + ImgUDevice::kFilterHeight * 2;\n>  \n>  \tfloat sf = bdsSF;\n> -\twhile (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) {\n> +\twhile (sf <= ImgUDevice::kBDSSfMax && sf >= ImgUDevice::kBDSSfMin) {\n>  \t\tfloat bdsWidth = static_cast<float>(iif.width) / sf;\n>  \t\tfloat bdsHeight = static_cast<float>(iif.height) / sf;\n>  \n> @@ -212,16 +196,16 @@ void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, floa\n>  \t\t    std::fmod(bdsHeight, 1.0) == 0) {\n>  \t\t\tunsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth);\n>  \t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n> -\t\t\tif (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth &&\n> -\t\t\t    !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight)\n> +\t\t\tif (!(bdsIntWidth % ImgUDevice::kBDSAlignWidth) && bdsWidth >= minBDSWidth &&\n> +\t\t\t    !(bdsIntHeight % ImgUDevice::kBDSAlignHeight) && bdsHeight >= minBDSHeight)\n>  \t\t\t\tcalculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf);\n>  \t\t}\n>  \n> -\t\tsf += BDS_SF_STEP;\n> +\t\tsf += ImgUDevice::kBDSSfStep;\n>  \t}\n>  \n>  \tsf = bdsSF;\n> -\twhile (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) {\n> +\twhile (sf <= ImgUDevice::kBDSSfMax && sf >= ImgUDevice::kBDSSfMin) {\n>  \t\tfloat bdsWidth = static_cast<float>(iif.width) / sf;\n>  \t\tfloat bdsHeight = static_cast<float>(iif.height) / sf;\n>  \n> @@ -229,12 +213,12 @@ void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, floa\n>  \t\t    std::fmod(bdsHeight, 1.0) == 0) {\n>  \t\t\tunsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth);\n>  \t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n> -\t\t\tif (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth &&\n> -\t\t\t    !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight)\n> +\t\t\tif (!(bdsIntWidth % ImgUDevice::kBDSAlignWidth) && bdsWidth >= minBDSWidth &&\n> +\t\t\t    !(bdsIntHeight % ImgUDevice::kBDSAlignHeight) && bdsHeight >= minBDSHeight)\n>  \t\t\t\tcalculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf);\n>  \t\t}\n>  \n> -\t\tsf -= BDS_SF_STEP;\n> +\t\tsf -= ImgUDevice::kBDSSfStep;\n>  \t}\n>  }\n>  \n> @@ -412,7 +396,7 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)\n>  \t * \\todo Filter out all resolutions < IF_CROP_MAX.\n>  \t * See https://bugs.libcamera.org/show_bug.cgi?id=32\n>  \t */\n> -\tif (in.width < IF_CROP_MAX_W || in.height < IF_CROP_MAX_H) {\n> +\tif (in.width < ImgUDevice::kIFMaxCropWidth || in.height < ImgUDevice::kIFMaxCropHeight) {\n>  \t\tLOG(IPU3, Error) << \"Input resolution \" << in.toString()\n>  \t\t\t\t << \" not supported\";\n>  \t\treturn {};\n> @@ -424,25 +408,25 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)\n>  \tfloat sf = findScaleFactor(bdsSF, bdsScalingFactors, true);\n>  \n>  \t/* Populate the configurations vector by scaling width and height. */\n> -\tunsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);\n> -\tunsigned int ifHeight = utils::alignUp(in.height, IF_ALIGN_H);\n> -\tunsigned int minIfWidth = in.width - IF_CROP_MAX_W;\n> -\tunsigned int minIfHeight = in.height - IF_CROP_MAX_H;\n> +\tunsigned int ifWidth = utils::alignUp(in.width, ImgUDevice::kAlignWidth);\n> +\tunsigned int ifHeight = utils::alignUp(in.height, ImgUDevice::kAlignHeight);\n> +\tunsigned int minIfWidth = in.width - ImgUDevice::kIFMaxCropWidth;\n> +\tunsigned int minIfHeight = in.height - ImgUDevice::kIFMaxCropHeight;\n>  \twhile (ifWidth >= minIfWidth) {\n>  \t\twhile (ifHeight >= minIfHeight) {\n>  \t\t\tSize iif{ ifWidth, ifHeight };\n>  \t\t\tcalculateBDS(pipe, iif, gdc, sf);\n> -\t\t\tifHeight -= IF_ALIGN_H;\n> +\t\t\tifHeight -= ImgUDevice::kAlignHeight;\n>  \t\t}\n>  \n> -\t\tifWidth -= IF_ALIGN_W;\n> +\t\tifWidth -= ImgUDevice::kAlignWidth;\n>  \t}\n>  \n>  \t/* Repeat search by scaling width first. */\n> -\tifWidth = utils::alignUp(in.width, IF_ALIGN_W);\n> -\tifHeight = utils::alignUp(in.height, IF_ALIGN_H);\n> -\tminIfWidth = in.width - IF_CROP_MAX_W;\n> -\tminIfHeight = in.height - IF_CROP_MAX_H;\n> +\tifWidth = utils::alignUp(in.width, ImgUDevice::kAlignWidth);\n> +\tifHeight = utils::alignUp(in.height, ImgUDevice::kAlignHeight);\n> +\tminIfWidth = in.width - ImgUDevice::kIFMaxCropWidth;\n> +\tminIfHeight = in.height - ImgUDevice::kIFMaxCropHeight;\n>  \twhile (ifHeight >= minIfHeight) {\n>  \t\t/*\n>  \t\t * \\todo This procedure is probably broken:\n> @@ -451,10 +435,10 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)\n>  \t\twhile (ifWidth >= minIfWidth) {\n>  \t\t\tSize iif{ ifWidth, ifHeight };\n>  \t\t\tcalculateBDS(pipe, iif, gdc, sf);\n> -\t\t\tifWidth -= IF_ALIGN_W;\n> +\t\t\tifWidth -= ImgUDevice::kAlignWidth;\n>  \t\t}\n>  \n> -\t\tifHeight -= IF_ALIGN_H;\n> +\t\tifHeight -= ImgUDevice::kAlignHeight;\n>  \t}\n>  \n>  \tif (pipeConfigs.size() == 0) {\n> diff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h\n> index 9d4915116087..690a22e67d47 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.h\n> +++ b/src/libcamera/pipeline/ipu3/imgu.h\n> @@ -23,6 +23,29 @@ struct StreamConfiguration;\n>  class ImgUDevice\n>  {\n>  public:\n> +\tstatic constexpr unsigned int kFilterWidth = 4;\n> +\tstatic constexpr unsigned int kFilterHeight = 4;\n> +\n> +\tstatic constexpr unsigned int kAlignWidth = 2;\n> +\tstatic constexpr unsigned int kAlignHeight = 4;\n\nI'd name these kIFAlignWidth and kIFAlignHeight, they were called\nIF_ALIGN_W and IF_ALIGN_H.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +\tstatic constexpr unsigned int kIFMaxCropWidth = 40;\n> +\tstatic constexpr unsigned int kIFMaxCropHeight = 540;\n> +\n> +\tstatic constexpr unsigned int kBDSAlignWidth = 2;\n> +\tstatic constexpr unsigned int kBDSAlignHeight = 4;\n> +\n> +\tstatic constexpr float kBDSSfMax = 2.5;\n> +\tstatic constexpr float kBDSSfMin = 1.0;\n> +\tstatic constexpr float kBDSSfStep = 0.03125;\n> +\n> +\tstatic constexpr Size kOutputMinSize = { 2, 2 };\n> +\tstatic constexpr Size kOutputMaxSize = { 4480, 34004 };\n> +\tstatic constexpr unsigned int kOutputAlignWidth = 64;\n> +\tstatic constexpr unsigned int kOutputAlignHeight = 4;\n> +\tstatic constexpr unsigned int kOutputMarginWidth = 64;\n> +\tstatic constexpr unsigned int kOutputMarginHeight = 32;\n> +\n>  \tstruct PipeConfig {\n>  \t\tfloat bds_sf;\n>  \t\tSize iif;\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 5b2ab2ee6825..bb3826eee422 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -41,12 +41,6 @@ LOG_DEFINE_CATEGORY(IPU3)\n>  \n>  static constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n>  static constexpr unsigned int IPU3_MAX_STREAMS = 3;\n> -static const Size IMGU_OUTPUT_MIN_SIZE = { 2, 2 };\n> -static const Size IMGU_OUTPUT_MAX_SIZE = { 4480, 34004 };\n> -static constexpr unsigned int IMGU_OUTPUT_WIDTH_ALIGN = 64;\n> -static constexpr unsigned int IMGU_OUTPUT_HEIGHT_ALIGN = 4;\n> -static constexpr unsigned int IMGU_OUTPUT_WIDTH_MARGIN = 64;\n> -static constexpr unsigned int IMGU_OUTPUT_HEIGHT_MARGIN = 32;\n>  static constexpr Size IPU3ViewfinderSize(1280, 720);\n>  \n>  static const ControlInfoMap::Map IPU3Controls = {\n> @@ -287,9 +281,10 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t * https://bugs.libcamera.org/show_bug.cgi?id=32\n>  \t */\n>  \tif (rawSize.isNull())\n> -\t\trawSize = maxYuvSize.expandedTo({40, 540})\n> -\t\t\t\t    .alignedUpTo(IMGU_OUTPUT_WIDTH_MARGIN,\n> -\t\t\t\t\t\t IMGU_OUTPUT_HEIGHT_MARGIN)\n> +\t\trawSize = maxYuvSize.expandedTo({ImgUDevice::kIFMaxCropWidth,\n> +\t\t\t\t\t\t ImgUDevice::kIFMaxCropHeight})\n> +\t\t\t\t    .alignedUpTo(ImgUDevice::kOutputMarginWidth,\n> +\t\t\t\t\t\t ImgUDevice::kOutputMarginHeight)\n>  \t\t\t\t    .boundedTo(data_->cio2_.sensor()->resolution());\n>  \tcio2Configuration_ = data_->cio2_.generateConfiguration(rawSize);\n>  \tif (!cio2Configuration_.pixelFormat.isValid())\n> @@ -345,19 +340,19 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\t\t */\n>  \t\t\tunsigned int limit;\n>  \t\t\tlimit = utils::alignDown(cio2Configuration_.size.width - 1,\n> -\t\t\t\t\t\t IMGU_OUTPUT_WIDTH_MARGIN);\n> +\t\t\t\t\t\t ImgUDevice::kOutputMarginWidth);\n>  \t\t\tcfg->size.width = std::clamp(cfg->size.width,\n> -\t\t\t\t\t\t     IMGU_OUTPUT_MIN_SIZE.width,\n> +\t\t\t\t\t\t     ImgUDevice::kOutputMinSize.width,\n>  \t\t\t\t\t\t     limit);\n>  \n>  \t\t\tlimit = utils::alignDown(cio2Configuration_.size.height - 1,\n> -\t\t\t\t\t\t IMGU_OUTPUT_HEIGHT_MARGIN);\n> +\t\t\t\t\t\t ImgUDevice::kOutputMarginHeight);\n>  \t\t\tcfg->size.height = std::clamp(cfg->size.height,\n> -\t\t\t\t\t\t      IMGU_OUTPUT_MIN_SIZE.height,\n> +\t\t\t\t\t\t      ImgUDevice::kOutputMinSize.height,\n>  \t\t\t\t\t\t      limit);\n>  \n> -\t\t\tcfg->size.alignDownTo(IMGU_OUTPUT_WIDTH_ALIGN,\n> -\t\t\t\t\t      IMGU_OUTPUT_HEIGHT_ALIGN);\n> +\t\t\tcfg->size.alignDownTo(ImgUDevice::kOutputAlignWidth,\n> +\t\t\t\t\t      ImgUDevice::kOutputAlignHeight);\n>  \n>  \t\t\tcfg->pixelFormat = formats::NV12;\n>  \t\t\tcfg->bufferCount = IPU3_BUFFER_COUNT;\n> @@ -443,14 +438,14 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\t * \\todo Clarify the alignment constraints as explained\n>  \t\t\t * in validate()\n>  \t\t\t */\n> -\t\t\tsize = sensorResolution.boundedTo(IMGU_OUTPUT_MAX_SIZE);\n> +\t\t\tsize = sensorResolution.boundedTo(ImgUDevice::kOutputMaxSize);\n>  \t\t\tsize.width = utils::alignDown(size.width - 1,\n> -\t\t\t\t\t\t      IMGU_OUTPUT_WIDTH_MARGIN);\n> +\t\t\t\t\t\t      ImgUDevice::kOutputMarginWidth);\n>  \t\t\tsize.height = utils::alignDown(size.height - 1,\n> -\t\t\t\t\t\t       IMGU_OUTPUT_HEIGHT_MARGIN);\n> +\t\t\t\t\t\t       ImgUDevice::kOutputMarginHeight);\n>  \t\t\tpixelFormat = formats::NV12;\n>  \t\t\tbufferCount = IPU3_BUFFER_COUNT;\n> -\t\t\tstreamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };\n> +\t\t\tstreamFormats[pixelFormat] = { { ImgUDevice::kOutputMinSize, size } };\n>  \n>  \t\t\tbreak;\n>  \n> @@ -475,11 +470,11 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\t * to the ImgU output constraints.\n>  \t\t\t */\n>  \t\t\tsize = sensorResolution.boundedTo(IPU3ViewfinderSize)\n> -\t\t\t\t\t       .alignedDownTo(IMGU_OUTPUT_WIDTH_ALIGN,\n> -\t\t\t\t\t\t\t      IMGU_OUTPUT_HEIGHT_ALIGN);\n> +\t\t\t\t\t       .alignedDownTo(ImgUDevice::kOutputAlignWidth,\n> +\t\t\t\t\t\t\t      ImgUDevice::kOutputAlignHeight);\n>  \t\t\tpixelFormat = formats::NV12;\n>  \t\t\tbufferCount = IPU3_BUFFER_COUNT;\n> -\t\t\tstreamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };\n> +\t\t\tstreamFormats[pixelFormat] = { { ImgUDevice::kOutputMinSize, size } };\n>  \n>  \t\t\tbreak;\n>  \t\t}\n> @@ -1003,8 +998,8 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n>  \t/* The strictly smaller size than the sensor resolution, aligned to margins. */\n>  \tSize minSize = Size(sensor->resolution().width - 1,\n>  \t\t\t    sensor->resolution().height - 1)\n> -\t\t       .alignedDownTo(IMGU_OUTPUT_WIDTH_MARGIN,\n> -\t\t\t\t      IMGU_OUTPUT_HEIGHT_MARGIN);\n> +\t\t       .alignedDownTo(ImgUDevice::kOutputMarginWidth,\n> +\t\t\t\t      ImgUDevice::kOutputMarginHeight);\n>  \n>  \t/*\n>  \t * Either the smallest margin-aligned size larger than the viewfinder\n> @@ -1012,8 +1007,8 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n>  \t */\n>  \tminSize = Size(IPU3ViewfinderSize.width + 1,\n>  \t\t       IPU3ViewfinderSize.height + 1)\n> -\t\t  .alignedUpTo(IMGU_OUTPUT_WIDTH_MARGIN,\n> -\t\t\t       IMGU_OUTPUT_HEIGHT_MARGIN)\n> +\t\t  .alignedUpTo(ImgUDevice::kOutputMarginWidth,\n> +\t\t\t       ImgUDevice::kOutputMarginHeight)\n>  \t\t  .boundedTo(minSize);\n>  \n>  \t/*","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F38D1BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Oct 2021 00:48:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 855C368F4D;\n\tWed, 13 Oct 2021 02:48:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 967516012B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Oct 2021 02:48:30 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C278E7;\n\tWed, 13 Oct 2021 02:48:29 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YAAZZ/5w\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634086110;\n\tbh=QxgRJMWMn3KjsuEoiGLYZ4+nmEHquAPMaNyichfCSNk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YAAZZ/5wjkFPtoYktnfmxoz5bgcXnAQWaBIEwSvItJ6vFZuxgyUd7WcE/0bw4frAg\n\tO57M4qbtOymGm4Lvdja5B8LFRNx8X/EpTHhF3LzKm7QC2J1o8Zwo7L3GJCVAu4V/LQ\n\tqvDNm/EO53vBlG87qtKpvNqovU5Mcn/MaC5Kn5vA=","Date":"Wed, 13 Oct 2021 03:48:16 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YWYs0JPyq6+CwbNK@pendragon.ideasonboard.com>","References":"<20211011151154.72856-1-jacopo@jmondi.org>\n\t<20211011151154.72856-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211011151154.72856-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 02/16] libcamera: ipu3: Centralize\n\tImgU sizes definition","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]