{"id":16789,"url":"https://patchwork.libcamera.org/api/1.1/patches/16789/?format=json","web_url":"https://patchwork.libcamera.org/patch/16789/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220726124549.1646-17-naush@raspberrypi.com>","date":"2022-07-26T12:45:48","name":"[libcamera-devel,16/17] ipa: raspberrypi: Remove #define constants","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a1e6a2871d81d7feb141674b962586440715d1b2","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16789/mbox/","series":[{"id":3325,"url":"https://patchwork.libcamera.org/api/1.1/series/3325/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3325","date":"2022-07-26T12:45:32","name":"Raspberry Pi IPA code refactor","version":1,"mbox":"https://patchwork.libcamera.org/series/3325/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16789/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16789/checks/","tags":{},"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 CA211C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 12:46:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83FF46333F;\n\tTue, 26 Jul 2022 14:46:19 +0200 (CEST)","from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com\n\t[IPv6:2a00:1450:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9EFC863337\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 14:46:13 +0200 (CEST)","by mail-wr1-x42c.google.com with SMTP id b26so20017780wrc.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 05:46:13 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ty17-20020adfd091000000b0021e87ec980bsm5948460wrh.84.2022.07.26.05.46.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Jul 2022 05:46:11 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658839579;\n\tbh=e6FvbeLkjaAUZP2qRm/ba8QTF9Z/rJow1YHM5XrAWBo=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=q/pfxZALlIz6c6yhRK09WOEtYnNyMptv9mxxTPxAtDWTubrnlXP68QjcYlf+1sYDs\n\tC/ODcykToU/AP58ZLVo0vD6wQhHiPJJ6OaqW5/G9bQuQU2fH5OIYXIp4apwxzGrmQM\n\t1OSDV7eBvEMqB6qTQiXyi7LanBPudW5kgKf2gJXw49IieMzr9JUaz4c1V9qrz0K1kH\n\tGpT6uEbiheuvAb4i0Ka7G5owZHyb1FCgEkWrUrWxv8plAGmOX6j8fe9hiSiAhn/uUO\n\t3qytmilwywN8lok4tucqNUMPC+qC4gJWc0d+Qt8IVo1SxpoHbL8EY5mzAj9yNs1gBE\n\tErCeB2we47zqw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=q9EarpEVg/g9/qwGp4A/c3Lb52RzZkR19iEqdrCfwI8=;\n\tb=cPgDCsfhm7l7wvGvRePEkOjgmuidNaGDpmJ7ujechj1f07n1xVChFeX0yBDjgX2x82\n\tzCQKwCr6fHErLn5DDjqtK9U6OFOCFMmgcjhV2TAJqiZRW1bi1FC2bdUTgJS8i45MoZfA\n\t94FYy5nZ7O7c+/v2uU7kbLvvidJi6tFEuIclNQiepwu9IXXyMaDdMkJSKPv2Mmv5EwPp\n\tS3WAN5aJaoFvWMbWe4LsFhNQHOBbk/xbO4IRY2P7TedLo3jYLUu/KHXjn6T8SILM4el9\n\tZwqeK3BKvchCI+v9hmbhkdneg7GiSvqr2+m7qtUulVtOwEBY4ebGraMnvOUrN2h+/ivz\n\tX+SA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"cPgDCsfh\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=q9EarpEVg/g9/qwGp4A/c3Lb52RzZkR19iEqdrCfwI8=;\n\tb=FBLj0QjTNN7VBVqSl0B4ZbDZDj3dupSEr3cwz8ypnygGxW+H6OGbqiN6oa1nrMZ6TW\n\tCBeZg3vTe56lZRbRLCiHOLeMz8JK40yygZTGje7nYOY9sP8xmHa58l6fIkqLdQK4Zws1\n\tF7XdSL3BZpoSeIUHQ5ko8wMwqxymf+zpT8t1LKYNO2ayRZHHJw/itpgYLZac+e3FvJx8\n\ttfo8/lcMwnJQIL8o34Fr/5fy/RqoXoYy8ETHvQX92h2YSLulZUYbTBqiwEcoKh2pBOUF\n\teXs1u5R9r77l8xJlQ/ojG9lmINpjRdtRQnJeJ3LudQGhlgWEsLeHt+vRXeVmmRxRjNEn\n\tPJLA==","X-Gm-Message-State":"AJIora/RO7wBoW+lvhsWHDExINhoVfvXmJ374/mGdZgFIk1ucz6WBgNu\n\twDFIEb77h5pTSf4R8BvmEbSeEIclH5+uyQ==","X-Google-Smtp-Source":"AGRyM1sbd064ImZhYIcm9TJvMXI6dRXPAdrSXBlNQJAa89lilw/bF4Ju1qo0Otma1V83nKcYzYBoNA==","X-Received":"by 2002:a05:6000:18c1:b0:21e:4712:b284 with SMTP id\n\tw1-20020a05600018c100b0021e4712b284mr10234057wrq.545.1658839573061; \n\tTue, 26 Jul 2022 05:46:13 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Jul 2022 13:45:48 +0100","Message-Id":"<20220726124549.1646-17-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220726124549.1646-1-naush@raspberrypi.com>","References":"<20220726124549.1646-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 16/17] ipa: raspberrypi: Remove #define\n\tconstants","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Replace all #define constant values with equivalent constexpr definitions.\nAs a drive-by, remove the CAMERA_MODE_NAME_LEN constant as it is unused.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/alsc_status.h  | 10 ++++-----\n src/ipa/raspberrypi/controller/camera_mode.h  |  2 --\n .../raspberrypi/controller/contrast_status.h  |  4 ++--\n src/ipa/raspberrypi/controller/rpi/agc.cpp    | 22 +++++++++----------\n src/ipa/raspberrypi/controller/rpi/agc.h      |  4 ++--\n src/ipa/raspberrypi/controller/rpi/alsc.cpp   |  4 ++--\n src/ipa/raspberrypi/controller/rpi/alsc.h     | 22 +++++++++----------\n src/ipa/raspberrypi/controller/rpi/awb.cpp    |  8 +++----\n .../raspberrypi/controller/rpi/contrast.cpp   |  6 ++---\n src/ipa/raspberrypi/raspberrypi.cpp           |  2 +-\n 10 files changed, 41 insertions(+), 43 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/alsc_status.h b/src/ipa/raspberrypi/controller/alsc_status.h\nindex 498880daf2d1..e5aa7e37c330 100644\n--- a/src/ipa/raspberrypi/controller/alsc_status.h\n+++ b/src/ipa/raspberrypi/controller/alsc_status.h\n@@ -11,11 +11,11 @@\n  * \"alsc.status\" metadata.\n  */\n \n-#define ALSC_CELLS_X 16\n-#define ALSC_CELLS_Y 12\n+constexpr unsigned int AlscCellsX = 16;\n+constexpr unsigned int AlscCellsY = 12;\n \n struct AlscStatus {\n-\tdouble r[ALSC_CELLS_Y][ALSC_CELLS_X];\n-\tdouble g[ALSC_CELLS_Y][ALSC_CELLS_X];\n-\tdouble b[ALSC_CELLS_Y][ALSC_CELLS_X];\n+\tdouble r[AlscCellsY][AlscCellsX];\n+\tdouble g[AlscCellsY][AlscCellsX];\n+\tdouble b[AlscCellsY][AlscCellsX];\n };\ndiff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h\nindex 0ac6c07fb7bf..a6ccf8c1c600 100644\n--- a/src/ipa/raspberrypi/controller/camera_mode.h\n+++ b/src/ipa/raspberrypi/controller/camera_mode.h\n@@ -16,8 +16,6 @@\n  * including binning, scaling, cropping etc.\n  */\n \n-#define CAMERA_MODE_NAME_LEN 32\n-\n struct CameraMode {\n \t/* bit depth of the raw camera output */\n \tuint32_t bitdepth;\ndiff --git a/src/ipa/raspberrypi/controller/contrast_status.h b/src/ipa/raspberrypi/controller/contrast_status.h\nindex 11d55295963b..ef2a7c680fc2 100644\n--- a/src/ipa/raspberrypi/controller/contrast_status.h\n+++ b/src/ipa/raspberrypi/controller/contrast_status.h\n@@ -11,7 +11,7 @@\n  * of contrast stretching based on the AGC histogram.\n  */\n \n-#define CONTRAST_NUM_POINTS 33\n+constexpr unsigned int ContrastNumPoints = 33;\n \n struct ContrastPoint {\n \tuint16_t x;\n@@ -19,7 +19,7 @@ struct ContrastPoint {\n };\n \n struct ContrastStatus {\n-\tstruct ContrastPoint points[CONTRAST_NUM_POINTS];\n+\tstruct ContrastPoint points[ContrastNumPoints];\n \tdouble brightness;\n \tdouble contrast;\n };\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex e9a945e3a630..e0c174b6580d 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -28,17 +28,17 @@ LOG_DEFINE_CATEGORY(RPiAgc)\n \n #define NAME \"rpi.agc\"\n \n-#define PIPELINE_BITS 13 /* seems to be a 13-bit pipeline */\n+static constexpr unsigned int PipelineBits = 13; /* seems to be a 13-bit pipeline */\n \n void AgcMeteringMode::read(boost::property_tree::ptree const &params)\n {\n \tint num = 0;\n \tfor (auto &p : params.get_child(\"weights\")) {\n-\t\tif (num == AGC_STATS_SIZE)\n+\t\tif (num == AgcStatsSize)\n \t\t\tLOG(RPiAgc, Fatal) << \"AgcConfig: too many weights\";\n \t\tweights[num++] = p.second.get_value<double>();\n \t}\n-\tif (num != AGC_STATS_SIZE)\n+\tif (num != AgcStatsSize)\n \t\tLOG(RPiAgc, Fatal) << \"AgcConfig: insufficient weights\";\n }\n \n@@ -525,11 +525,11 @@ static double computeInitialY(bcm2835_isp_stats *stats, AwbStatus const &awb,\n \t * \"average\" metering (i.e. all pixels equally important).\n \t */\n \tdouble rSum = 0, gSum = 0, bSum = 0, pixelSum = 0;\n-\tfor (int i = 0; i < AGC_STATS_SIZE; i++) {\n+\tfor (unsigned int i = 0; i < AgcStatsSize; i++) {\n \t\tdouble counted = regions[i].counted;\n-\t\tdouble rAcc = std::min(regions[i].r_sum * gain, ((1 << PIPELINE_BITS) - 1) * counted);\n-\t\tdouble gAcc = std::min(regions[i].g_sum * gain, ((1 << PIPELINE_BITS) - 1) * counted);\n-\t\tdouble bAcc = std::min(regions[i].b_sum * gain, ((1 << PIPELINE_BITS) - 1) * counted);\n+\t\tdouble rAcc = std::min(regions[i].r_sum * gain, ((1 << PipelineBits) - 1) * counted);\n+\t\tdouble gAcc = std::min(regions[i].g_sum * gain, ((1 << PipelineBits) - 1) * counted);\n+\t\tdouble bAcc = std::min(regions[i].b_sum * gain, ((1 << PipelineBits) - 1) * counted);\n \t\trSum += rAcc * weights[i];\n \t\tgSum += gAcc * weights[i];\n \t\tbSum += bAcc * weights[i];\n@@ -542,7 +542,7 @@ static double computeInitialY(bcm2835_isp_stats *stats, AwbStatus const &awb,\n \tdouble ySum = rSum * awb.gainR * .299 +\n \t\t      gSum * awb.gainG * .587 +\n \t\t      bSum * awb.gainB * .114;\n-\treturn ySum / pixelSum / (1 << PIPELINE_BITS);\n+\treturn ySum / pixelSum / (1 << PipelineBits);\n }\n \n /*\n@@ -553,13 +553,13 @@ static double computeInitialY(bcm2835_isp_stats *stats, AwbStatus const &awb,\n  * (contrived) cases.\n  */\n \n-#define EV_GAIN_Y_TARGET_LIMIT 0.9\n+static constexpr double EvGainYTargetLimit = 0.9;\n \n static double constraintComputeGain(AgcConstraint &c, Histogram &h, double lux,\n \t\t\t\t    double evGain, double &targetY)\n {\n \ttargetY = c.yTarget.eval(c.yTarget.domain().clip(lux));\n-\ttargetY = std::min(EV_GAIN_Y_TARGET_LIMIT, targetY * evGain);\n+\ttargetY = std::min(EvGainYTargetLimit, targetY * evGain);\n \tdouble iqm = h.interQuantileMean(c.qLo, c.qHi);\n \treturn (targetY * NUM_HISTOGRAM_BINS) / iqm;\n }\n@@ -578,7 +578,7 @@ void Agc::computeGain(bcm2835_isp_stats *statistics, Metadata *imageMetadata,\n \t * that we consider the histogram constraints.\n \t */\n \ttargetY = config_.yTarget.eval(config_.yTarget.domain().clip(lux.lux));\n-\ttargetY = std::min(EV_GAIN_Y_TARGET_LIMIT, targetY * evGain);\n+\ttargetY = std::min(EvGainYTargetLimit, targetY * evGain);\n \n \t/*\n \t * Do this calculation a few times as brightness increase can be\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.h b/src/ipa/raspberrypi/controller/rpi/agc.h\nindex 48b33a10c73a..f57afa6dc80c 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.h\n@@ -22,12 +22,12 @@\n  * number (which is 16).\n  */\n \n-#define AGC_STATS_SIZE 15\n+constexpr unsigned int AgcStatsSize = 15;\n \n namespace RPiController {\n \n struct AgcMeteringMode {\n-\tdouble weights[AGC_STATS_SIZE];\n+\tdouble weights[AgcStatsSize];\n \tvoid read(boost::property_tree::ptree const &params);\n };\n \ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex 7df89445711a..03ae33501dc0 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n@@ -23,8 +23,8 @@ LOG_DEFINE_CATEGORY(RPiAlsc)\n \n #define NAME \"rpi.alsc\"\n \n-static const int X = ALSC_CELLS_X;\n-static const int Y = ALSC_CELLS_Y;\n+static const int X = AlscCellsX;\n+static const int Y = AlscCellsY;\n static const int XY = X * Y;\n static const double InsufficientData = -1.0;\n \ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.h b/src/ipa/raspberrypi/controller/rpi/alsc.h\nindex e17f2fe93379..4e9a715ae0ab 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.h\n@@ -19,7 +19,7 @@ namespace RPiController {\n \n struct AlscCalibration {\n \tdouble ct;\n-\tdouble table[ALSC_CELLS_X * ALSC_CELLS_Y];\n+\tdouble table[AlscCellsX * AlscCellsY];\n };\n \n struct AlscConfig {\n@@ -35,7 +35,7 @@ struct AlscConfig {\n \tuint16_t minG;\n \tdouble omega;\n \tuint32_t nIter;\n-\tdouble luminanceLut[ALSC_CELLS_X * ALSC_CELLS_Y];\n+\tdouble luminanceLut[AlscCellsX * AlscCellsY];\n \tdouble luminanceStrength;\n \tstd::vector<AlscCalibration> calibrationsCr;\n \tstd::vector<AlscCalibration> calibrationsCb;\n@@ -61,7 +61,7 @@ private:\n \tAlscConfig config_;\n \tbool firstTime_;\n \tCameraMode cameraMode_;\n-\tdouble luminanceTable_[ALSC_CELLS_X * ALSC_CELLS_Y];\n+\tdouble luminanceTable_[AlscCellsX * AlscCellsY];\n \tstd::thread asyncThread_;\n \tvoid asyncFunc(); /* asynchronous thread function */\n \tstd::mutex mutex_;\n@@ -87,8 +87,8 @@ private:\n \tint frameCount_;\n \t/* counts up to startupFrames for Process function */\n \tint frameCount2_;\n-\tdouble syncResults_[3][ALSC_CELLS_Y][ALSC_CELLS_X];\n-\tdouble prevSyncResults_[3][ALSC_CELLS_Y][ALSC_CELLS_X];\n+\tdouble syncResults_[3][AlscCellsY][AlscCellsX];\n+\tdouble prevSyncResults_[3][AlscCellsY][AlscCellsX];\n \tvoid waitForAysncThread();\n \t/*\n \t * The following are for the asynchronous thread to use, though the main\n@@ -98,13 +98,13 @@ private:\n \t/* copy out the results from the async thread so that it can be restarted */\n \tvoid fetchAsyncResults();\n \tdouble ct_;\n-\tbcm2835_isp_stats_region statistics_[ALSC_CELLS_Y * ALSC_CELLS_X];\n-\tdouble asyncResults_[3][ALSC_CELLS_Y][ALSC_CELLS_X];\n-\tdouble asyncLambdaR_[ALSC_CELLS_X * ALSC_CELLS_Y];\n-\tdouble asyncLambdaB_[ALSC_CELLS_X * ALSC_CELLS_Y];\n+\tbcm2835_isp_stats_region statistics_[AlscCellsY * AlscCellsX];\n+\tdouble asyncResults_[3][AlscCellsY][AlscCellsX];\n+\tdouble asyncLambdaR_[AlscCellsX * AlscCellsY];\n+\tdouble asyncLambdaB_[AlscCellsX * AlscCellsY];\n \tvoid doAlsc();\n-\tdouble lambdaR_[ALSC_CELLS_X * ALSC_CELLS_Y];\n-\tdouble lambdaB_[ALSC_CELLS_X * ALSC_CELLS_Y];\n+\tdouble lambdaR_[AlscCellsX * AlscCellsY];\n+\tdouble lambdaB_[AlscCellsX * AlscCellsY];\n };\n \n } /* namespace RPiController */\ndiff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp\nindex c379e6b92649..ad75d55f0976 100644\n--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp\n@@ -18,8 +18,8 @@ LOG_DEFINE_CATEGORY(RPiAwb)\n \n #define NAME \"rpi.awb\"\n \n-#define AWB_STATS_SIZE_X DEFAULT_AWB_REGIONS_X\n-#define AWB_STATS_SIZE_Y DEFAULT_AWB_REGIONS_Y\n+static constexpr unsigned int AwbStatsSizeX = DEFAULT_AWB_REGIONS_X;\n+static constexpr unsigned int AwbStatsSizeY = DEFAULT_AWB_REGIONS_Y;\n \n /*\n  * todo - the locking in this algorithm needs some tidying up as has been done\n@@ -357,7 +357,7 @@ static void generateStats(std::vector<Awb::RGB> &zones,\n \t\t\t  bcm2835_isp_stats_region *stats, double minPixels,\n \t\t\t  double minG)\n {\n-\tfor (int i = 0; i < AWB_STATS_SIZE_X * AWB_STATS_SIZE_Y; i++) {\n+\tfor (unsigned int i = 0; i < AwbStatsSizeX * AwbStatsSizeY; i++) {\n \t\tAwb::RGB zone;\n \t\tdouble counted = stats[i].counted;\n \t\tif (counted >= minPixels) {\n@@ -599,7 +599,7 @@ void Awb::awbBayes()\n \t * valid... not entirely sure about this.\n \t */\n \tPwl prior = interpolatePrior();\n-\tprior *= zones_.size() / (double)(AWB_STATS_SIZE_X * AWB_STATS_SIZE_Y);\n+\tprior *= zones_.size() / (double)(AwbStatsSizeX * AwbStatsSizeY);\n \tprior.map([](double x, double y) {\n \t\tLOG(RPiAwb, Debug) << \"(\" << x << \",\" << y << \")\";\n \t});\ndiff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\nindex 04aeb91e4d61..9e60dc5d47e7 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n@@ -70,15 +70,15 @@ static void fillInStatus(ContrastStatus &status, double brightness,\n {\n \tstatus.brightness = brightness;\n \tstatus.contrast = contrast;\n-\tfor (int i = 0; i < CONTRAST_NUM_POINTS - 1; i++) {\n+\tfor (unsigned int i = 0; i < ContrastNumPoints - 1; i++) {\n \t\tint x = i < 16 ? i * 1024\n \t\t\t       : (i < 24 ? (i - 16) * 2048 + 16384\n \t\t\t\t\t : (i - 24) * 4096 + 32768);\n \t\tstatus.points[i].x = x;\n \t\tstatus.points[i].y = std::min(65535.0, gammaCurve.eval(x));\n \t}\n-\tstatus.points[CONTRAST_NUM_POINTS - 1].x = 65535;\n-\tstatus.points[CONTRAST_NUM_POINTS - 1].y = 65535;\n+\tstatus.points[ContrastNumPoints - 1].x = 65535;\n+\tstatus.points[ContrastNumPoints - 1].y = 65535;\n }\n \n void Contrast::initialise()\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 951d8c65abfd..9d550354d78e 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -1235,7 +1235,7 @@ void IPARPi::applyGamma(const struct ContrastStatus *contrastStatus, ControlList\n \tstruct bcm2835_isp_gamma gamma;\n \n \tgamma.enabled = 1;\n-\tfor (int i = 0; i < CONTRAST_NUM_POINTS; i++) {\n+\tfor (unsigned int i = 0; i < ContrastNumPoints; i++) {\n \t\tgamma.x[i] = contrastStatus->points[i].x;\n \t\tgamma.y[i] = contrastStatus->points[i].y;\n \t}\n","prefixes":["libcamera-devel","16/17"]}