Show a patch.

GET /api/1.1/patches/21783/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21783,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21783/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21783/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20241031094957.18471-3-naush@raspberrypi.com>",
    "date": "2024-10-31T09:49:52",
    "name": "[v4,2/7] pipeline: rpi: Remove CameraData::scalerCrop_",
    "commit_ref": "fb2326810570206a405e2ed6f59f9d91b1735f71",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "87d97381fccae6f2435285089603c50121ec6707",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21783/mbox/",
    "series": [
        {
            "id": 4760,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4760/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4760",
            "date": "2024-10-31T09:49:50",
            "name": "Raspberry Pi: Add controls::rpi::ScalerCrops",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4760/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21783/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21783/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 5E589C3292\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 31 Oct 2024 09:52:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EC2CF653AA;\n\tThu, 31 Oct 2024 10:52:47 +0100 (CET)",
            "from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 90566618BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Oct 2024 10:52:43 +0100 (CET)",
            "by mail-wm1-x32f.google.com with SMTP id\n\t5b1f17b1804b1-43155a6c3a6so1119225e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Oct 2024 02:52:43 -0700 (PDT)",
            "from naush-laptop.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4327d6983c2sm19789835e9.42.2024.10.31.02.52.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 31 Oct 2024 02:52:42 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"gclw96W/\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1730368363; x=1730973163;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=gF1CRK5658pUZV0uzy7B6zhR0H6HtzA+lmLE8dz6KjA=;\n\tb=gclw96W/7CaT7qDizkE+cbMrMwEvaAzUfQ4KN7VW2UV2chMq2Uo20+6u0p/XcZHYUO\n\toW4L6hw+Jr+o9VR0huTj38NnJDKUpa+E/XaPMGSN2HS/1V+gS3YI8p7aevFVwrbytc4y\n\txt+BEUnbne/5b3ZxQBiZQj7mbwBBZNSDFyAYuqz92Z1h3hfbOmq7LSPG2a3XdctseH2+\n\to5QaodNQnjogcY79npXyYX8EWIhOVOHoYoB2gBlPIKMg9rUzFSWWTC54ozRcUMf0dZGC\n\t/+R0o4TuXd6OMXzlcSq3/3UsWrh/OdtLY2IXNofmtUz2wSLFvhsHen08y8Ux2ZKgw4yb\n\twolw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1730368363; x=1730973163;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=gF1CRK5658pUZV0uzy7B6zhR0H6HtzA+lmLE8dz6KjA=;\n\tb=tQDnj+3XK0sg2PZgvQxh3/aCjQsaLWonual4gzNobkTKoE21tXx6wLDRQ2+qF/AS4q\n\twuzpaKW+pD45DmtNFRTSOhMpkgyJ52ybq4P/LTugQZEh/PTPk3uawn4ATQ1x1l5wZi4o\n\tT7KNZTIuHBAsyUJJg8S9vCk0aSL0qaCiAocn8Odf0t6INJvM4bAm4jKcA3ZIMgEzC9Q+\n\tgWHx40r60Q9+YzmeZMIhYtpiQwDVWm2trlcGuPYVX7f8/kD6XISmhgi+KLVINzY2rcQg\n\tzaARLFsJ2uHSRZ/Ds63Ucab/rezFw+zkwW8a5TWQRubYdzHxTsVAg6Hqtaakf9A7xYBa\n\tkOng==",
        "X-Gm-Message-State": "AOJu0YwWRKI6XrPzkrp0Lr+3TGonKAX4DOA5C7pGTJxUfM23/cIxealD\n\tDkohPX6Pe2f+nxG1XsSggInb8ErkUXdZryWfi/Pr1+njAb0lVvTPipxU0vSx6YGGZTNOOF2Dt/0\n\tS",
        "X-Google-Smtp-Source": "AGHT+IGnZKl1k4SGUoAE/692lZgoEpCE4p/mc7gB1jKD+YfgwS/3NtI5UCiRzSsZjvD6qSeN0o+Deg==",
        "X-Received": "by 2002:a05:600c:4f0c:b0:431:4983:e8fe with SMTP id\n\t5b1f17b1804b1-4319ad41c64mr69708655e9.9.1730368362846; \n\tThu, 31 Oct 2024 02:52:42 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Naushir Patuck <naush@raspberrypi.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Subject": "[PATCH v4 2/7] pipeline: rpi: Remove CameraData::scalerCrop_",
        "Date": "Thu, 31 Oct 2024 09:49:52 +0000",
        "Message-Id": "<20241031094957.18471-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20241031094957.18471-1-naush@raspberrypi.com>",
        "References": "<20241031094957.18471-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Do not cache the scalerCrop_ parameter. The cached value is used to\nupdate the request metadata, but since this is not an expensive\noperation (and can only occur once per frame), caching it is of limited\nvalue.\n\nThis will simplify logic in a future commit where we can specify a\ncrop per-output stream.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp      | 18 +++---------------\n .../pipeline/rpi/common/pipeline_base.h        |  1 -\n 2 files changed, 3 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 3041fd1ed9fd..11f1bfd4a5da 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -544,12 +544,6 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config)\n \t\treturn ret;\n \t}\n \n-\t/*\n-\t * Set the scaler crop to the value we are using (scaled to native sensor\n-\t * coordinates).\n-\t */\n-\tdata->scalerCrop_ = data->scaleIspCrop(data->ispCrop_);\n-\n \t/*\n \t * Update the ScalerCropMaximum to the correct value for this camera mode.\n \t * For us, it's the same as the \"analogue crop\".\n@@ -569,7 +563,8 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config)\n \n \t/* Add the ScalerCrop control limits based on the current mode. */\n \tRectangle ispMinCrop = data->scaleIspCrop(Rectangle(data->ispMinCropSize_));\n-\tctrlMap[&controls::ScalerCrop] = ControlInfo(ispMinCrop, data->sensorInfo_.analogCrop, data->scalerCrop_);\n+\tctrlMap[&controls::ScalerCrop] = ControlInfo(ispMinCrop, data->sensorInfo_.analogCrop,\n+\t\t\t\t\t\t     data->scaleIspCrop(data->ispCrop_));\n \n \tdata->controlInfo_ = ControlInfoMap(std::move(ctrlMap), result.controlInfo.idmap());\n \n@@ -1320,13 +1315,6 @@ void CameraData::applyScalerCrop(const ControlList &controls)\n \t\tif (ispCrop != ispCrop_) {\n \t\t\tispCrop_ = ispCrop;\n \t\t\tplatformSetIspCrop();\n-\n-\t\t\t/*\n-\t\t\t * Also update the ScalerCrop in the metadata with what we actually\n-\t\t\t * used. But we must first rescale that from ISP (camera mode) pixels\n-\t\t\t * back into sensor native pixels.\n-\t\t\t */\n-\t\t\tscalerCrop_ = scaleIspCrop(ispCrop_);\n \t\t}\n \t}\n }\n@@ -1483,7 +1471,7 @@ void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request\n \trequest->metadata().set(controls::SensorTimestamp,\n \t\t\t\tbufferControls.get(controls::SensorTimestamp).value_or(0));\n \n-\trequest->metadata().set(controls::ScalerCrop, scalerCrop_);\n+\trequest->metadata().set(controls::ScalerCrop, scaleIspCrop(ispCrop_));\n }\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex f9cecf70f179..5161c16e518f 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -134,7 +134,6 @@ public:\n \t/* For handling digital zoom. */\n \tIPACameraSensorInfo sensorInfo_;\n \tRectangle ispCrop_; /* crop in ISP (camera mode) pixels */\n-\tRectangle scalerCrop_; /* crop in sensor native pixels */\n \tSize ispMinCropSize_;\n \n \tunsigned int dropFrameCount_;\n",
    "prefixes": [
        "v4",
        "2/7"
    ]
}