Show a patch.

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

{
    "id": 12812,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12812/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12812/",
    "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": "<20210706142220.747614-1-umang.jain@ideasonboard.com>",
    "date": "2021-07-06T14:22:20",
    "name": "[libcamera-devel,RFC] camera_sensor: Do not always prioritize aspect-ratios",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c0a4918ca4684cc2e331f434ba37441e8115b578",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/12812/mbox/",
    "series": [
        {
            "id": 2212,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2212/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2212",
            "date": "2021-07-06T14:22:20",
            "name": "[libcamera-devel,RFC] camera_sensor: Do not always prioritize aspect-ratios",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2212/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12812/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12812/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 8D446BD794\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jul 2021 14:22:30 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA143684EA;\n\tTue,  6 Jul 2021 16:22:29 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21B7360288\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jul 2021 16:22:28 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [103.251.226.59])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E6027A5E;\n\tTue,  6 Jul 2021 16:22:26 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JxLx9MEz\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625581347;\n\tbh=SADRb4LmyLSLeImLAwgNKawSILoG6PjUEyGbx6WWUYY=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=JxLx9MEzyVnHHf65TCjetWOjFdVdljUy1IfFlnZXVRVxgrLSKqZ8y/U5Oiw8kckn9\n\tOv1y49SEGjoxF8RdZTZtMAp1LiFBOZ9FIyD5fJfolhIz30u4E8vP5h2H4r7lby3gbz\n\tAOpm0xK19LkiwS+vVC+6Xgf++5Lcsqck3IhYQ37U=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  6 Jul 2021 19:52:20 +0530",
        "Message-Id": "<20210706142220.747614-1-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH] camera_sensor: Do not always\n\tprioritize aspect-ratios",
        "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": "In some cases, the maximum sensor resolution will provide the best\naspect-ratio for a requested stream size. It may also happen that,\nthe difference between max sensor resolution's aspect-ratio vs a lower\nsensor resolution aspect-ratio is very marginal(for e.g. <1%).\nIn such cases, we should actually lean towards the lower sensor\nresolution.\n\nOne of such cases is observed on nautilus, where all requested stream\nsizes seems to map to 4208x3118-SGRBG10_IPU3. Even though, the aspect\nratios for lower sensor resolution aren't that far from 4208x3118.\nFor a stream size request of 1080p:\n - 1080p     = 1.777777778 (requested)\n\n - 4208x3118 = 1.349583066 (originally selected)\n - 2104x1560 = 1.348717949\n - 1048x780  = 1.343589744\n\nThis patch introduces some flexibility on part of sensor resolution\nselection procedure. It attempts to provide a sensor resolution,\nclosest to the requested stream size, whilst keeping best aspect-ratio.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n\n---\n- This patch has been written with \"[PATCH] camera_sensor: Remove\n  redundant aspect-ratio check\" applied.\n\n- There is also known issue/handle on why IPU3 currently selects max\n  sensor resolution config possible, we will use \"raw\" to see this patch\n  in action.\n\n- Findings via cam:\n\n(master)\n\n($)  cam -c1 -swidth=640,height=320,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:12:57.975110123] [550]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:12:57.975199686] [550]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=1280,height=720,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:14:23.492963456] [651]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:14:23.493028736] [651]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=1920,height=1080,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:14:34.020592838] [660]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:14:34.020636493] [660]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=3840,height=2160,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:15:20.530557765] [727]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:15:20.530625404] [727]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=4200,height=3000,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:15:33.027468976] [737]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:15:33.027558684] [737]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n\n\n(With this Patch)\n\n($)  cam -c1 -swidth=640,height=320,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:19:04.270812870] [1457]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:19:04.270859868] [1457]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 1048x780-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=1280,height=720,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:19:15.515222045] [1465]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:19:15.515265834] [1465]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 2104x1560-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=1920,height=1080,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:19:23.333048232] [1471]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:19:23.333101431] [1471]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 2104x1560-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=3840,height=2160,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:19:29.774700339] [1480]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:19:29.774800035] [1480]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n\n($)  cam -c1 -swidth=4200,height=3000,role=raw\nUsing camera \\_SB_.PCI0.I2C2.CAM0\n[10:19:59.786068223] [1541]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\n[10:19:59.786176204] [1541]  INFO IPU3 ipu3.cpp:277 CIO2 configuration: 4208x3118-SGRBG10_IPU3\nCamera configuration adjusted\n---\n src/libcamera/camera_sensor.cpp | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 1bf42acf..fb24480b 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -569,7 +569,14 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu\n \t\t\tunsigned int area = sz.width * sz.height;\n \t\t\tunsigned int areaDiff = area - desiredArea;\n \n-\t\t\tif (ratioDiff > bestRatio)\n+\t\t\t/*\n+\t\t\t * Check if we have a better aspect ratio match than\n+\t\t\t * whatever we have seen before. ~1% change is acceptable\n+\t\t\t * if it leads to a selection of lower resolution below.\n+\t\t\t */\n+\t\t\tif (bestRatio == FLT_MAX)\n+\t\t\t\tbestRatio = ratioDiff;\n+\t\t\telse if (fabsf(ratioDiff - bestRatio) > 0.01)\n \t\t\t\tcontinue;\n \n \t\t\tif (areaDiff < bestArea) {\n",
    "prefixes": [
        "libcamera-devel",
        "RFC"
    ]
}