Patch Detail
Show a patch.
GET /api/patches/10991/?format=api
{ "id": 10991, "url": "https://patchwork.libcamera.org/api/patches/10991/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10991/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210125184858.16339-3-david.plowman@raspberrypi.com>", "date": "2021-01-25T18:48:55", "name": "[libcamera-devel,v2,2/5] ipa: raspberrypi: alsc: Replace Raspberry Pi debug with libcamera debug", "commit_ref": "b2186c2b89d762475e45935c835dc900ff5a7149", "pull_url": null, "state": "accepted", "archived": false, "hash": "db21b87373ef33012bc7b3d7d11f93d9956d2cd8", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10991/mbox/", "series": [ { "id": 1606, "url": "https://patchwork.libcamera.org/api/series/1606/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1606", "date": "2021-01-25T18:48:53", "name": "Remove Raspberry Pi logging", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1606/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10991/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10991/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 1C8CDBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Jan 2021 18:49:09 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0753D682E9;\n\tMon, 25 Jan 2021 19:49:08 +0100 (CET)", "from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com\n\t[IPv6:2a00:1450:4864:20::52b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D6A7682D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jan 2021 19:49:06 +0100 (CET)", "by mail-ed1-x52b.google.com with SMTP id z22so2066347edb.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jan 2021 10:49:06 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\ty59sm11601836ede.59.2021.01.25.10.49.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 25 Jan 2021 10:49:04 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"rLCbHCQL\"; dkim-atps=neutral", "DKIM-Signature": "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=32lrAXJUjf0NlyXWSNkrlfCQIIMREPBcy/5qhF+MI+4=;\n\tb=rLCbHCQLBZbVt3nzYJPHnNK2cy8ZTjqJ6BMzsPIKHxpMfvAAmjiKrxvsPtsVXvh84L\n\t89WHskfygZxznQ7YGIC/T4tL5+Dutpy3WwuoS1EtAy257kqNzdSl4/o2WcFCbhFeK6On\n\toQF78qGPHLjVggGpA97bRpAW9b7sCO+O2Vgi3vod3vK7AHU7lYmLBDSfWVBMTuKgb/Jp\n\tZcIy1YxvM5bHiRvv4w9zv2hnmL90r/5BqVfXBbgMK4PB1pFoGPzBF/qEkAsG3ZSYFcn+\n\tupOez/2TQdz2NuduDnEMEe2CKDIN/LnQ6spB/8eLXTN6Y3mR6IRPSMTAUm7V79mYK5KF\n\tqy8Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=32lrAXJUjf0NlyXWSNkrlfCQIIMREPBcy/5qhF+MI+4=;\n\tb=agXwhsMIBu4kf6g6tRNXoyP+h20KzmIxyr0BerGZXkqFn354IqcFeK6nCBgGgN5Mqi\n\tFWtgcMKg5sUy/up9rbuzvIghMYjj4FrpT+u86kfPPrJCpsieipdeqyLqva5Z+klnSigv\n\t9acPKr9HFgn+bzeEOnyAInai4RX5t1PaeDxQru31KZIeBRC6ZOEU4/oVWjb5qL7bctdZ\n\tpYFwPEZFRIZksv1M5Ua96rwySXibbSP7uZSH9JJiv3jmxYV2E4mrA0VWoPAbMo2l42/i\n\tpIDuHqv3ApbNB5klvGbk7/dKWLiHaEGT5OTcyd7chXrtIaIGGZtTJxnPOx8VcTOC3aEe\n\tKXzw==", "X-Gm-Message-State": "AOAM531X7aGsxWBfVkA2/MTUGngpW6hNOSVGXCa0TF2i5Mquc2MG3UOt\n\t/lR4rfA9MobyioE0F6g8LD3nQjpxv77J1OdR", "X-Google-Smtp-Source": "ABdhPJwzlwmnZbDgFMWlRq9TzZIjHaMGmWRbU21mFZCAXlzRczcvwvxoAA9QcEHJjc3iBvsyEo5qMQ==", "X-Received": "by 2002:a05:6402:11c7:: with SMTP id\n\tj7mr1642529edw.290.1611600545515; \n\tMon, 25 Jan 2021 10:49:05 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 25 Jan 2021 18:48:55 +0000", "Message-Id": "<20210125184858.16339-3-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20210125184858.16339-1-david.plowman@raspberrypi.com>", "References": "<20210125184858.16339-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 2/5] ipa: raspberrypi: alsc: Replace\n\tRaspberry Pi debug with libcamera debug", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Some unhelpful debug messages have been removed.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/rpi/alsc.cpp | 66 +++++++++++----------\n 1 file changed, 35 insertions(+), 31 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex c354c985..5262bcab 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n@@ -6,12 +6,17 @@\n */\n #include <math.h>\n \n+#include \"libcamera/internal/log.h\"\n+\n #include \"../awb_status.h\"\n #include \"alsc.hpp\"\n \n // Raspberry Pi ALSC (Auto Lens Shading Correction) algorithm.\n \n using namespace RPiController;\n+using namespace libcamera;\n+\n+LOG_DEFINE_CATEGORY(RPiAlsc)\n \n #define NAME \"rpi.alsc\"\n \n@@ -110,15 +115,14 @@ static void read_calibrations(std::vector<AlscCalibration> &calibrations,\n \t\t\t\t\t\"Alsc: too few values for ct \" +\n \t\t\t\t\tstd::to_string(ct) + \" in \" + name);\n \t\t\tcalibrations.push_back(calibration);\n-\t\t\tRPI_LOG(\"Read \" << name << \" calibration for ct \"\n-\t\t\t\t\t<< ct);\n+\t\t\tLOG(RPiAlsc, Debug)\n+\t\t\t\t<< \"Read \" << name << \" calibration for ct \" << ct;\n \t\t}\n \t}\n }\n \n void Alsc::Read(boost::property_tree::ptree const ¶ms)\n {\n-\tRPI_LOG(\"Alsc\");\n \tconfig_.frame_period = params.get<uint16_t>(\"frame_period\", 12);\n \tconfig_.startup_frames = params.get<uint16_t>(\"startup_frames\", 10);\n \tconfig_.speed = params.get<double>(\"speed\", 0.05);\n@@ -139,7 +143,8 @@ void Alsc::Read(boost::property_tree::ptree const ¶ms)\n \t\tread_lut(config_.luminance_lut,\n \t\t\t params.get_child(\"luminance_lut\"));\n \telse\n-\t\tRPI_WARN(\"Alsc: no luminance table - assume unity everywhere\");\n+\t\tLOG(RPiAlsc, Warning)\n+\t\t\t<< \"no luminance table - assume unity everywhere\";\n \tread_calibrations(config_.calibrations_Cr, params, \"calibrations_Cr\");\n \tread_calibrations(config_.calibrations_Cb, params, \"calibrations_Cb\");\n \tconfig_.default_ct = params.get<double>(\"default_ct\", 4500.0);\n@@ -164,7 +169,6 @@ static void add_luminance_to_tables(double results[3][Y][X],\n \n void Alsc::Initialise()\n {\n-\tRPI_LOG(\"Alsc\");\n \tframe_count2_ = frame_count_ = frame_phase_ = 0;\n \tfirst_time_ = true;\n \tct_ = config_.default_ct;\n@@ -252,7 +256,7 @@ void Alsc::SwitchMode(CameraMode const &camera_mode,\n \n void Alsc::fetchAsyncResults()\n {\n-\tRPI_LOG(\"Fetch ALSC results\");\n+\tLOG(RPiAlsc, Debug) << \"Fetch ALSC results\";\n \tasync_finished_ = false;\n \tasync_started_ = false;\n \tmemcpy(sync_results_, async_results_, sizeof(sync_results_));\n@@ -263,11 +267,11 @@ double get_ct(Metadata *metadata, double default_ct)\n \tAwbStatus awb_status;\n \tawb_status.temperature_K = default_ct; // in case nothing found\n \tif (metadata->Get(\"awb.status\", awb_status) != 0)\n-\t\tRPI_WARN(\"Alsc: no AWB results found, using \"\n-\t\t\t << awb_status.temperature_K);\n+\t\tLOG(RPiAlsc, Warning) << \"no AWB results found, using \"\n+\t\t\t\t << awb_status.temperature_K;\n \telse\n-\t\tRPI_LOG(\"Alsc: AWB results found, using \"\n-\t\t\t<< awb_status.temperature_K);\n+\t\tLOG(RPiAlsc, Debug) << \"AWB results found, using \"\n+\t\t\t\t << awb_status.temperature_K;\n \treturn awb_status.temperature_K;\n }\n \n@@ -289,7 +293,7 @@ static void copy_stats(bcm2835_isp_stats_region regions[XY], StatisticsPtr &stat\n \n void Alsc::restartAsync(StatisticsPtr &stats, Metadata *image_metadata)\n {\n-\tRPI_LOG(\"Starting ALSC thread\");\n+\tLOG(RPiAlsc, Debug) << \"Starting ALSC calculation\";\n \t// Get the current colour temperature. It's all we need from the\n \t// metadata. Default to the last CT value (which could be the default).\n \tct_ = get_ct(image_metadata, ct_);\n@@ -297,7 +301,8 @@ void Alsc::restartAsync(StatisticsPtr &stats, Metadata *image_metadata)\n \t// the LSC table that the pipeline applied to them.\n \tAlscStatus alsc_status;\n \tif (image_metadata->Get(\"alsc.status\", alsc_status) != 0) {\n-\t\tRPI_WARN(\"No ALSC status found for applied gains!\");\n+\t\tLOG(RPiAlsc, Warning)\n+\t\t\t<< \"No ALSC status found for applied gains!\";\n \t\tfor (int y = 0; y < Y; y++)\n \t\t\tfor (int x = 0; x < X; x++) {\n \t\t\t\talsc_status.r[y][x] = 1.0;\n@@ -324,13 +329,12 @@ void Alsc::Prepare(Metadata *image_metadata)\n \tdouble speed = frame_count_ < (int)config_.startup_frames\n \t\t\t ? 1.0\n \t\t\t : config_.speed;\n-\tRPI_LOG(\"Alsc: frame_count \" << frame_count_ << \" speed \" << speed);\n+\tLOG(RPiAlsc, Debug)\n+\t\t<< \"frame_count \" << frame_count_ << \" speed \" << speed;\n \t{\n \t\tstd::unique_lock<std::mutex> lock(mutex_);\n-\t\tif (async_started_ && async_finished_) {\n-\t\t\tRPI_LOG(\"ALSC thread finished\");\n+\t\tif (async_started_ && async_finished_)\n \t\t\tfetchAsyncResults();\n-\t\t}\n \t}\n \t// Apply IIR filter to results and program into the pipeline.\n \tdouble *ptr = (double *)sync_results_,\n@@ -354,13 +358,11 @@ void Alsc::Process(StatisticsPtr &stats, Metadata *image_metadata)\n \t\tframe_phase_++;\n \tif (frame_count2_ < (int)config_.startup_frames)\n \t\tframe_count2_++;\n-\tRPI_LOG(\"Alsc: frame_phase \" << frame_phase_);\n+\tLOG(RPiAlsc, Debug) << \"frame_phase \" << frame_phase_;\n \tif (frame_phase_ >= (int)config_.frame_period ||\n \t frame_count2_ < (int)config_.startup_frames) {\n-\t\tif (async_started_ == false) {\n-\t\t\tRPI_LOG(\"ALSC thread starting\");\n+\t\tif (async_started_ == false)\n \t\t\trestartAsync(stats, image_metadata);\n-\t\t}\n \t}\n }\n \n@@ -391,25 +393,26 @@ void get_cal_table(double ct, std::vector<AlscCalibration> const &calibrations,\n \tif (calibrations.empty()) {\n \t\tfor (int i = 0; i < XY; i++)\n \t\t\tcal_table[i] = 1.0;\n-\t\tRPI_LOG(\"Alsc: no calibrations found\");\n+\t\tLOG(RPiAlsc, Debug) << \"no calibrations found\";\n \t} else if (ct <= calibrations.front().ct) {\n \t\tmemcpy(cal_table, calibrations.front().table,\n \t\t XY * sizeof(double));\n-\t\tRPI_LOG(\"Alsc: using calibration for \"\n-\t\t\t<< calibrations.front().ct);\n+\t\tLOG(RPiAlsc, Debug) << \"using calibration for \"\n+\t\t\t\t << calibrations.front().ct;\n \t} else if (ct >= calibrations.back().ct) {\n \t\tmemcpy(cal_table, calibrations.back().table,\n \t\t XY * sizeof(double));\n-\t\tRPI_LOG(\"Alsc: using calibration for \"\n-\t\t\t<< calibrations.front().ct);\n+\t\tLOG(RPiAlsc, Debug) << \"using calibration for \"\n+\t\t\t\t << calibrations.front().ct;\n \t} else {\n \t\tint idx = 0;\n \t\twhile (ct > calibrations[idx + 1].ct)\n \t\t\tidx++;\n \t\tdouble ct0 = calibrations[idx].ct,\n \t\t ct1 = calibrations[idx + 1].ct;\n-\t\tRPI_LOG(\"Alsc: ct is \" << ct << \", interpolating between \"\n-\t\t\t\t << ct0 << \" and \" << ct1);\n+\t\tLOG(RPiAlsc, Debug)\n+\t\t\t<< \"ct is \" << ct << \", interpolating between \"\n+\t\t\t<< ct0 << \" and \" << ct1;\n \t\tfor (int i = 0; i < XY; i++)\n \t\t\tcal_table[i] =\n \t\t\t\t(calibrations[idx].table[i] * (ct1 - ct) +\n@@ -660,15 +663,16 @@ static void run_matrix_iterations(double const C[XY], double lambda[XY],\n \tfor (int i = 0; i < n_iter; i++) {\n \t\tdouble max_diff = fabs(gauss_seidel2_SOR(M, omega, lambda));\n \t\tif (max_diff < threshold) {\n-\t\t\tRPI_LOG(\"Stop after \" << i + 1 << \" iterations\");\n+\t\t\tLOG(RPiAlsc, Debug)\n+\t\t\t\t<< \"Stop after \" << i + 1 << \" iterations\";\n \t\t\tbreak;\n \t\t}\n \t\t// this happens very occasionally (so make a note), though\n \t\t// doesn't seem to matter\n \t\tif (max_diff > last_max_diff)\n-\t\t\tRPI_LOG(\"Iteration \" << i << \": max_diff gone up \"\n-\t\t\t\t\t << last_max_diff << \" to \"\n-\t\t\t\t\t << max_diff);\n+\t\t\tLOG(RPiAlsc, Debug)\n+\t\t\t\t<< \"Iteration \" << i << \": max_diff gone up \"\n+\t\t\t\t<< last_max_diff << \" to \" << max_diff;\n \t\tlast_max_diff = max_diff;\n \t}\n \t// We're going to normalise the lambdas so the smallest is 1. Not sure\n", "prefixes": [ "libcamera-devel", "v2", "2/5" ] }