From patchwork Wed Oct 7 13:18:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10014 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 84028BEEE0 for ; Wed, 7 Oct 2020 13:18:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 520F8605BF; Wed, 7 Oct 2020 15:18:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ge7RcPdq"; dkim-atps=neutral Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B593E605BB for ; Wed, 7 Oct 2020 15:18:27 +0200 (CEST) Received: by mail-lj1-x241.google.com with SMTP id r24so1945906ljm.3 for ; Wed, 07 Oct 2020 06:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VjW3v+iYoAihvSHm5zPVY+BTaBGIbTXNOxQerJAtna0=; b=Ge7RcPdqm+NRes6TIn/8NVmumQ0A4lduEkXg7n4fb+mIN+GYxH04b5ksCev0HMorqg e6m/kHu+xgfSdgYsctvJhZpV/92J2TMz1OIzLmoFIZY4He44Rcu8SX/jA6EKpvqhAY2Q G/06dmXqCz41VOR4HhCS4yFOF2/GK2ewmhcrWOJaMyNCXyaDbX9GFJFrvvN5eGB9v9Zx 9cQWnT1WMr/v8qRGA9NHIdocXDGdN1WWU8OUekmz3OjSMAzIH7nIUht3LgZyAi5LVswZ zyU+VmVNnCbQx5eOJYn2Y1o4tR+2vVKCAtriQWDubbz5hcy0jZAdMTFWFPmIqUdchjS+ VsiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VjW3v+iYoAihvSHm5zPVY+BTaBGIbTXNOxQerJAtna0=; b=Ur/4kPWwcWtoOPEkGlLrF3AKvAR4T/ieIAerln3VBU4tkqIYj8rjq8idpttbW7Yu98 E09FC4QZmLNzG3CvqQXmUrZFDp3Im2U6WSIpIwOd8YzcOvDfRbXzknPJkkG5TFsNF9ZY pbQkvqsAkr1QWHiyiqS+Zr2OlOPdXEned5MRav3TAJAmiZSVAwSDaHDV0I5eYZFqDDGq rNt8vV2QrsiBopdN9QTQc1fwDx7SDNxcU/T7ponsirfBuwzoaLLeVJrkKW2mdod/15Ya MmnrZqh76Rz1A7UmX5Qut/0ZXBM4XpBvEcglBnC6ygYZollGgPrc3pTRI/v6EOFtSRYG jZYQ== X-Gm-Message-State: AOAM533ppHzBq2DbqreVGyMY4nKGjFrJzw3reNHMOCAiAezWiHc43kFB pReVXdZDQ1Ck6MkR6iAircaFEKqUsly3nqDt X-Google-Smtp-Source: ABdhPJxGr+vaGduO5nAz5Qz8mvo0SN6JUGsux2A3GvteXuP8w+UhjjhVw/57nCeFoGOibsYfavAEdw== X-Received: by 2002:a2e:9118:: with SMTP id m24mr1291571ljg.364.1602076707056; Wed, 07 Oct 2020 06:18:27 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id i139sm329539lfi.276.2020.10.07.06.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 06:18:26 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org, Naushir Patuck , David Plowman Date: Wed, 7 Oct 2020 16:18:10 +0300 Message-Id: <20201007131812.2688973-2-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> References: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/3] ipa: raspberrypi: fix bin_x calculation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" I presume this code is supposed to set bin_x and bin_y, and not bin_y two times. This caused use of uninitialized variable later when bin_x was used. Signed-off-by: Tomi Valkeinen Reviewed-by: Kieran Bingham Reviewed-by: David Plowman --- src/ipa/raspberrypi/raspberrypi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index b0c7d1c..48a72dd 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -178,7 +178,7 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo) * * \todo Get the pipeline handle to provide the full data */ - mode_.bin_y = std::min(2, static_cast(mode_.scale_x)); + mode_.bin_x = std::min(2, static_cast(mode_.scale_x)); mode_.bin_y = std::min(2, static_cast(mode_.scale_y)); /* The noise factor is the square root of the total binning factor. */ From patchwork Wed Oct 7 13:18:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10016 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4F39EBEEE0 for ; Wed, 7 Oct 2020 13:18:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 03BF6605C7; Wed, 7 Oct 2020 15:18:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="N/lcLhPC"; dkim-atps=neutral Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5ECEC605C1 for ; Wed, 7 Oct 2020 15:18:30 +0200 (CEST) Received: by mail-lf1-x142.google.com with SMTP id a9so2240054lfc.7 for ; Wed, 07 Oct 2020 06:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DV8vcqf/qgNOAuvGzM1EorYjKQ/K1c2uv/hvw8RyPIc=; b=N/lcLhPCL8gphSIoGKCI9WHk/dodyklktKCZP3J8wCPsiYJIhbrB0JHQG6QX1AJB2Y 5Rzk01Hie930ImTXi5vA504Adp1lNMUYltsIpgNdD9Ib59YEGATq34maONGGzt9U46yD 7secXuilzS5B1kSifTr+3/+YSkhndIu+WBSITyf25Ln82/gSbYbMIU99rsJn8BnsSr+n RGdLa2YNuAm+87si2ax95OdD6WlmLOcZ3ibubGLwoH5Op2PwtMfulOmOPtvYjzJacJD1 FEvidgw1Adfc5Xgd4XWgH5JpSkDeZZtREM5XfLQWndvZmslXx42QSS83tpbWw4f08vhk s4KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DV8vcqf/qgNOAuvGzM1EorYjKQ/K1c2uv/hvw8RyPIc=; b=Mi+IawAGuu+DdAkkl/udARBJ+6qGFP8hkaKgSwXLOuBvtcj/eU+zE4HRb8JMBGj3j2 MG+ze452UeJzr7DmI2ynYYQqGDRpVh9mXAuBDPkFE7rHyLLY7Pfz7iSOLufCNRuLXM0m i6BG1aPzSpWKPziZx7We0NhepGKSzlrNOslB/6T2kNQRP2bfSdaswTgHW1VRZQc2y+Wi evztP9J2h7mhoKb7S7Lf0jsNP1TQ0ApfXlWwfVv/YdIr12C3+PuDDmh+nC4uiX+iM44r 7TOwd/HuCcCXdXnxDTqiBG+RdZzh4g5g0GtIMVSRot4fSqdewMnQHkvVWhq0zbOurhVL mRKA== X-Gm-Message-State: AOAM532O4ejMWcK2eVrDdw73k84ce/pt3aF3lV9yySwPzi6F+Ni+FDYy rXmE3yFaURPm/ROUhdrhkjNCuXaxYNNHM1xw X-Google-Smtp-Source: ABdhPJz52jQ7h5jxZHy2fWqu1EH2ZSdDzRr49q5b8R14Lqoqcxm7xW9RxI+2P8fXX/Js9SjsNEKJsA== X-Received: by 2002:ac2:58d7:: with SMTP id u23mr873351lfo.311.1602076708142; Wed, 07 Oct 2020 06:18:28 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id i139sm329539lfi.276.2020.10.07.06.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 06:18:27 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org, Naushir Patuck , David Plowman Date: Wed, 7 Oct 2020 16:18:11 +0300 Message-Id: <20201007131812.2688973-3-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> References: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] ipa: raspberrypi: fix access to uninitialized variables X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Set span_r and span_b to -1 so that when they are passed to Pwl::Eval() they won't cause access to uninitialized memory. Signed-off-by: Tomi Valkeinen Reviewed-by: Kieran Bingham Reviewed-by: David Plowman --- src/ipa/raspberrypi/controller/rpi/awb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index a5536e4..469d0e5 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -430,7 +430,7 @@ double Awb::coarseSearch(Pwl const &prior) void Awb::fineSearch(double &t, double &r, double &b, Pwl const &prior) { - int span_r, span_b; + int span_r = -1, span_b = -1; config_.ct_r.Eval(t, &span_r); config_.ct_b.Eval(t, &span_b); double step = t / 10 * config_.coarse_step * 0.1; From patchwork Wed Oct 7 13:18:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10015 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D311BBEEE0 for ; Wed, 7 Oct 2020 13:18:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A2435605BD; Wed, 7 Oct 2020 15:18:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nUHT/lL9"; dkim-atps=neutral Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A29FA605C1 for ; Wed, 7 Oct 2020 15:18:29 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id a5so1920430ljj.11 for ; Wed, 07 Oct 2020 06:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Op4MknI1SgUbicnV8hX1MgQiNFJB/6qJmdYNwp8arEk=; b=nUHT/lL9EOjKiQj2Pw35xBx4/FTkHCWj8/1w9pUSWMYyMwSP0FN0yIceKGCpisnE86 sZ3ptdrMidG3DQJsKrt5VTMwI8Xr5T8+LrP09PXnSqhyrb/UUZLqTGlAyOZ59h3Pjq+G THpHxk0XmKasO57W0dU9M0obLCLP3rwswnpVpJzgsJ7oY6hSq5BFAjHr0MT6tk/rcy3w 5ucDwu0UzWmCOuP4T/1a/HxYIlt7WdHhbA+MuGtwyq2+IkAKsvn9ulKpolBMnoKQfXum lwtqDxJ+BeXKbADMhW/3i4fvqLkR6JMe6SFpqx5q2mLBR+4IOUEsDSJ9rkF5mm3WBqYR Q51w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Op4MknI1SgUbicnV8hX1MgQiNFJB/6qJmdYNwp8arEk=; b=U4Vp5Ojfn5zx1sZP7ZJ8zllzh/s8DuY1QZpm5ndRy3sHJgLXkQqgfwgB5ckKNi3gUC Ute030RCTE9b6sVXf2uR+ZFe3ZbPqSvmy/arDm/gtxnpiSIihj3uhvj6cfUq9Q2zZCA6 RIQ0eRVclxVrP0fYbpVpChQVPaGUvwmU0zmv2RkMBWedkihtt/gI56nLF4oqmOZcI5a4 cX0QQEkeTbILMLvd7AFbKZlqZSpYYw+sH3LV1eLAC130CQQQc7KtuYRDa3/erG9yrgzk QpMtKSDQzeCV89QhW2inMVgK2KHhJwpqUGRKxqaOr9TSyk5mp9mubN5ltdZB/3GyrVGZ fzvQ== X-Gm-Message-State: AOAM532MaKBWQxDeuNhx486z+Zo/GJooTVBVyGcZeuqenG0Iis0nvWz7 B7a2vPJs/nqeeD69bh2+HDQglcCjpQXk0g== X-Google-Smtp-Source: ABdhPJz7Y/HYo8t1xscqcHgMCnrlzMHuD88ifhRxnwR3ijIFTM6nhIlHtnQmqc44bEi5T4jO1JuzUg== X-Received: by 2002:a05:651c:141:: with SMTP id c1mr1279566ljd.182.1602076708947; Wed, 07 Oct 2020 06:18:28 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id i139sm329539lfi.276.2020.10.07.06.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 06:18:28 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org, Naushir Patuck , David Plowman Date: Wed, 7 Oct 2020 16:18:12 +0300 Message-Id: <20201007131812.2688973-4-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> References: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] ipa: raspberrypi: fix missing initialize of status_ X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Many fields in status_ are not initialized, causing use of uninitialized memory. Drop the code that clears some of the individual fields, and instead just memset the whole thing. Signed-off-by: Tomi Valkeinen Reviewed-by: David Plowman --- src/ipa/raspberrypi/controller/rpi/agc.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp index df4d364..6ae774d 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp @@ -148,14 +148,14 @@ Agc::Agc(Controller *controller) exposure_mode_(nullptr), constraint_mode_(nullptr), frame_count_(0), lock_count_(0) { - ev_ = status_.ev = 1.0; - flicker_period_ = status_.flicker_period = 0.0; - fixed_shutter_ = status_.fixed_shutter = 0; - fixed_analogue_gain_ = status_.fixed_analogue_gain = 0.0; - // set to zero initially, so we can tell it's not been calculated - status_.total_exposure_value = 0.0; - status_.target_exposure_value = 0.0; - status_.locked = false; + memset(&status_, 0, sizeof(status_)); + status_.ev = 1.0; + + ev_ = status_.ev; + flicker_period_ = status_.flicker_period; + fixed_shutter_ = status_.fixed_shutter; + fixed_analogue_gain_ = status_.fixed_analogue_gain; + output_status_ = status_; }