Patch Detail
Show a patch.
GET /api/patches/10953/?format=api
{ "id": 10953, "url": "https://patchwork.libcamera.org/api/patches/10953/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10953/", "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": "<20210122102211.12768-3-david.plowman@raspberrypi.com>", "date": "2021-01-22T10:22:08", "name": "[libcamera-devel,2/5] ipa: raspberrypi: alsc: Replace Raspberry Pi debug with libcamera debug", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "d160502e548cc236404b4fa0786fd303b8da67fc", "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/10953/mbox/", "series": [ { "id": 1597, "url": "https://patchwork.libcamera.org/api/series/1597/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1597", "date": "2021-01-22T10:22:06", "name": "Remove Raspberry Pi logging", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1597/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10953/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10953/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 56E84BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 10:22:28 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 26E3F68245;\n\tFri, 22 Jan 2021 11:22:28 +0100 (CET)", "from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C01AE6823E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 11:22:25 +0100 (CET)", "by mail-wr1-x430.google.com with SMTP id 7so4559776wrz.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 02:22:25 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tp15sm11469221wrt.15.2021.01.22.02.22.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Jan 2021 02:22:24 -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=\"Jd4QQug1\"; 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=BVpqEkyfRSBU5rwlFMvrdOl3XxcNgdfc+RDlkGm4n4o=;\n\tb=Jd4QQug1SdAGd4xyjMqA3IYl2PE3WjbmO2jx8PbIbhnbZpwXCubQNfRTvrDpquoqvs\n\tCoZUcJ3UGsgwbg15wlwmaMY2YltagEPKdApXNQ5J/BKB3JXyAg8TKf8BHSG0S6Miv4bA\n\tmSgJHRTzWD4D3CkPg2dZdK4P5eC7UhAk9wYBQVkPrm2fhV5tRMpEx7X/2YQwXGI3nhGG\n\tXivnzEphtp3ppDRqR6dlV/IMgZGGEBBs4yz23u3488J6Z2xhnhGLYeOi9+/1MTfBOyrE\n\t2czAP+XusQ26WEKH+6fhtNzWq0w0xZJfp9o5ImeM6/hJYSHwxIkFDLhg99t+N2fc/BQ2\n\tA4iw==", "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=BVpqEkyfRSBU5rwlFMvrdOl3XxcNgdfc+RDlkGm4n4o=;\n\tb=mXur+gq8tlSHpdjtW8jB0Ehma64MXXgSV7T7wGdtkLLZNUm20nekmk2ImL9LNI6IZL\n\tZ214LEjukU6Zqzmdstzontu3MtknZ5GtIp1uOx/AfDyZ9Q4hzGhTNYXIDO/c2WrnRggO\n\tuovlzdgsUHw33DHvsKWT0en2fdJSLgeQMHGlyM8Qhp7GyF+NdwWLVKlde5ZuK86weqFV\n\tA3RHBR1Gl55Frfo0pV9aIV7VgTUNQjn8YNUxj1816vPEkeGwJhh1vAG+i5Ic+LOb3fa0\n\trJlSdNua0Z2cByglICSNMdA/4valRu+bexs1Bx5bZj9KDBYLfqibnm7smk5OZ+styn5z\n\tzwOg==", "X-Gm-Message-State": "AOAM530qz5n2a9lFUHoaCNHIEw0cTcNvqYk/br3qbfJeriCyCz7Pgkh8\n\t0MikYTgVaD6kU2gwm+w7VzjuviRtKwcH/p5g", "X-Google-Smtp-Source": "ABdhPJwx2wr8BX9HW7FhyeclcOY2QGBMJjwH5lZ6PVRuQrHY0bT4hVxTcuIlM+b6o5dhXhk7WUHLzA==", "X-Received": "by 2002:adf:e610:: with SMTP id\n\tp16mr3711421wrm.169.1611310945096; \n\tFri, 22 Jan 2021 02:22:25 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 22 Jan 2021 10:22:08 +0000", "Message-Id": "<20210122102211.12768-3-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20210122102211.12768-1-david.plowman@raspberrypi.com>", "References": "<20210122102211.12768-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 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": "Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/rpi/alsc.cpp | 59 +++++++++++----------\n 1 file changed, 32 insertions(+), 27 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex c354c985..4777238c 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,15 @@ 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) << \"Read \" << name << \" calibration for ct \"\n+\t\t\t\t\t << ct;\n \t\t}\n \t}\n }\n \n void Alsc::Read(boost::property_tree::ptree const ¶ms)\n {\n-\tRPI_LOG(\"Alsc\");\n+\tLOG(RPiAlsc, Debug) << \"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 +144,7 @@ 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) << \"Alsc: 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,7 @@ static void add_luminance_to_tables(double results[3][Y][X],\n \n void Alsc::Initialise()\n {\n-\tRPI_LOG(\"Alsc\");\n+\tLOG(RPiAlsc, Debug) << \"Alsc\";\n \tframe_count2_ = frame_count_ = frame_phase_ = 0;\n \tfirst_time_ = true;\n \tct_ = config_.default_ct;\n@@ -252,7 +257,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 +268,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) << \"Alsc: 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) << \"Alsc: AWB results found, using \"\n+\t\t\t\t << awb_status.temperature_K;\n \treturn awb_status.temperature_K;\n }\n \n@@ -289,7 +294,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 thread\";\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 +302,7 @@ 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) << \"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,11 +329,11 @@ 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) << \"Alsc: 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\t\tLOG(RPiAlsc, Debug) << \"ALSC thread finished\";\n \t\t\tfetchAsyncResults();\n \t\t}\n \t}\n@@ -354,11 +359,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) << \"Alsc: 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\t\tLOG(RPiAlsc, Debug) << \"ALSC thread starting\";\n \t\t\trestartAsync(stats, image_metadata);\n \t\t}\n \t}\n@@ -391,25 +396,25 @@ 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) << \"Alsc: 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) << \"Alsc: 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) << \"Alsc: 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) << \"Alsc: ct is \" << ct << \", interpolating between \"\n+\t\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 +665,15 @@ 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) << \"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) << \"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\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", "2/5" ] }