[{"id":4488,"web_url":"https://patchwork.libcamera.org/comment/4488/","msgid":"<20200423173443.GH6196@pendragon.ideasonboard.com>","date":"2020-04-23T17:34:43","subject":"Re: [libcamera-devel] [PATCH v3 1/5] libcamera: controls: Updates\n\tto gain and exposure controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Fri, Apr 03, 2020 at 03:53:01PM +0100, Naushir Patuck wrote:\n> Rename:\n> ManualExposure -> ExposureTime\n> ManualGain -> AnalogueGain\n> \n> Use micro-seconds units for ExposureTime. This is changed from milli-\n> seconds. The latter would not allow very low exposure times.\n> \n> AnalogueGain switch to use a float to allow fractional gain adjustments.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/libcamera/control_ids.yaml               | 20 ++++++++++++++------\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp |  8 ++++----\n>  2 files changed, 18 insertions(+), 10 deletions(-)\n> \n> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n> index 4befec74..839eea76 100644\n> --- a/src/libcamera/control_ids.yaml\n> +++ b/src/libcamera/control_ids.yaml\n> @@ -10,7 +10,7 @@ controls:\n>        description: |\n>          Enable or disable the AE.\n>  \n> -        \\sa ManualExposure\n> +        \\sa ExposureTime AnalogueGain\n>  \n>    - AeLocked:\n>        type: bool\n> @@ -42,12 +42,20 @@ controls:\n>        type: int32_t\n>        description: Specify a fixed saturation parameter\n>  \n> -  - ManualExposure:\n> +  - ExposureTime:\n>        type: int32_t\n> -      description: Specify a fixed exposure time in milli-seconds\n> +      description: |\n> +        Exposure time (shutter speed) for the frame applied in the sensor\n> +        device. This value is specified in micro-seconds.\n>  \n> -  - ManualGain:\n> -      type: int32_t\n> -      description: Specify a fixed gain parameter\n> +        \\sa AnalogueGain AeEnable\n> +\n> +  - AnalogueGain:\n> +      type: float\n> +      description: |\n> +        Analogue gain value applied in the sensor device.\n> +        The value of the control specifies the gain multiplier applied to all\n> +        colour channels. This value cannot be lower than 1.0.\n\nI wonder if there could be use cases for a value lower than 1.0, but\nthat can be done later if/when needed, so no issue for now.\n\n>  \n> +        \\sa ExposureTime AeEnable\n>  ...\n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index ffbddf27..d7df95e4 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -251,10 +251,10 @@ int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)\n>  \t\t\tcontrols.set(V4L2_CID_CONTRAST, value);\n>  \t\t} else if (id == controls::Saturation) {\n>  \t\t\tcontrols.set(V4L2_CID_SATURATION, value);\n> -\t\t} else if (id == controls::ManualExposure) {\n> +\t\t} else if (id == controls::ExposureTime) {\n>  \t\t\tcontrols.set(V4L2_CID_EXPOSURE_AUTO, static_cast<int32_t>(1));\n>  \t\t\tcontrols.set(V4L2_CID_EXPOSURE_ABSOLUTE, value);\n> -\t\t} else if (id == controls::ManualGain) {\n> +\t\t} else if (id == controls::AnalogueGain) {\n>  \t\t\tcontrols.set(V4L2_CID_GAIN, value);\n>  \t\t}\n>  \t}\n\nThe unit change breaks UVC support, which you then fixed in the next\npatch in the series. We try to avoid bisection breakages when possible,\nso I would like to squash 1/5 and 2/5 together unless there's an\nobjection.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> @@ -364,10 +364,10 @@ int UVCCameraData::init(MediaEntity *entity)\n>  \t\t\tid = &controls::Saturation;\n>  \t\t\tbreak;\n>  \t\tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n> -\t\t\tid = &controls::ManualExposure;\n> +\t\t\tid = &controls::ExposureTime;\n>  \t\t\tbreak;\n>  \t\tcase V4L2_CID_GAIN:\n> -\t\t\tid = &controls::ManualGain;\n> +\t\t\tid = &controls::AnalogueGain;\n>  \t\t\tbreak;\n>  \t\tdefault:\n>  \t\t\tcontinue;","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 ADA8E62E45\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Apr 2020 19:34:58 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EC9924F7;\n\tThu, 23 Apr 2020 19:34:57 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"YMM0ZKUX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587663298;\n\tbh=Sn2up7iQGrVFHmeAJmNpN84hKjnCgA91pItmyXyQxwY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YMM0ZKUXQdrjXzPlqo8yVdmB9Yt5/sOmpiZXj9q6ZTjOTIPUU18RULjMQQfhTBpG4\n\t1wubAi2veJTO5kD0MP7dw+Aex2gpPGpOhPRu8VlmZcLKpo3Rk6ocWbhYUCZRrONzxI\n\tXhs+nGFObEC1dZ1gU91Uqf0xbNNJ50paPl/XZ7bA=","Date":"Thu, 23 Apr 2020 20:34:43 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200423173443.GH6196@pendragon.ideasonboard.com>","References":"<20200403145305.10288-1-naush@raspberrypi.com>\n\t<20200403145305.10288-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200403145305.10288-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/5] libcamera: controls: Updates\n\tto gain and exposure controls","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>","X-List-Received-Date":"Thu, 23 Apr 2020 17:34:59 -0000"}},{"id":4491,"web_url":"https://patchwork.libcamera.org/comment/4491/","msgid":"<20200423191610.GK6196@pendragon.ideasonboard.com>","date":"2020-04-23T19:16:10","subject":"Re: [libcamera-devel] [PATCH v3 1/5] libcamera: controls: Updates\n\tto gain and exposure controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Thu, Apr 23, 2020 at 08:34:43PM +0300, Laurent Pinchart wrote:\n> On Fri, Apr 03, 2020 at 03:53:01PM +0100, Naushir Patuck wrote:\n> > Rename:\n> > ManualExposure -> ExposureTime\n> > ManualGain -> AnalogueGain\n\nI forgot to mention that AwbEnable still references ManualGain. It's\nfixed by a patch further in the series, but it's best to fix it here.\nI'll do that in my tree, but if you post a new version, could you please\ninclude that fix ?\n\n> > Use micro-seconds units for ExposureTime. This is changed from milli-\n> > seconds. The latter would not allow very low exposure times.\n> > \n> > AnalogueGain switch to use a float to allow fractional gain adjustments.\n> > \n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  src/libcamera/control_ids.yaml               | 20 ++++++++++++++------\n> >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp |  8 ++++----\n> >  2 files changed, 18 insertions(+), 10 deletions(-)\n> > \n> > diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n> > index 4befec74..839eea76 100644\n> > --- a/src/libcamera/control_ids.yaml\n> > +++ b/src/libcamera/control_ids.yaml\n> > @@ -10,7 +10,7 @@ controls:\n> >        description: |\n> >          Enable or disable the AE.\n> >  \n> > -        \\sa ManualExposure\n> > +        \\sa ExposureTime AnalogueGain\n> >  \n> >    - AeLocked:\n> >        type: bool\n> > @@ -42,12 +42,20 @@ controls:\n> >        type: int32_t\n> >        description: Specify a fixed saturation parameter\n> >  \n> > -  - ManualExposure:\n> > +  - ExposureTime:\n> >        type: int32_t\n> > -      description: Specify a fixed exposure time in milli-seconds\n> > +      description: |\n> > +        Exposure time (shutter speed) for the frame applied in the sensor\n> > +        device. This value is specified in micro-seconds.\n> >  \n> > -  - ManualGain:\n> > -      type: int32_t\n> > -      description: Specify a fixed gain parameter\n> > +        \\sa AnalogueGain AeEnable\n> > +\n> > +  - AnalogueGain:\n> > +      type: float\n> > +      description: |\n> > +        Analogue gain value applied in the sensor device.\n> > +        The value of the control specifies the gain multiplier applied to all\n> > +        colour channels. This value cannot be lower than 1.0.\n> \n> I wonder if there could be use cases for a value lower than 1.0, but\n> that can be done later if/when needed, so no issue for now.\n> \n> >  \n> > +        \\sa ExposureTime AeEnable\n> >  ...\n> > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > index ffbddf27..d7df95e4 100644\n> > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > @@ -251,10 +251,10 @@ int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)\n> >  \t\t\tcontrols.set(V4L2_CID_CONTRAST, value);\n> >  \t\t} else if (id == controls::Saturation) {\n> >  \t\t\tcontrols.set(V4L2_CID_SATURATION, value);\n> > -\t\t} else if (id == controls::ManualExposure) {\n> > +\t\t} else if (id == controls::ExposureTime) {\n> >  \t\t\tcontrols.set(V4L2_CID_EXPOSURE_AUTO, static_cast<int32_t>(1));\n> >  \t\t\tcontrols.set(V4L2_CID_EXPOSURE_ABSOLUTE, value);\n> > -\t\t} else if (id == controls::ManualGain) {\n> > +\t\t} else if (id == controls::AnalogueGain) {\n> >  \t\t\tcontrols.set(V4L2_CID_GAIN, value);\n> >  \t\t}\n> >  \t}\n> \n> The unit change breaks UVC support, which you then fixed in the next\n> patch in the series. We try to avoid bisection breakages when possible,\n> so I would like to squash 1/5 and 2/5 together unless there's an\n> objection.\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > @@ -364,10 +364,10 @@ int UVCCameraData::init(MediaEntity *entity)\n> >  \t\t\tid = &controls::Saturation;\n> >  \t\t\tbreak;\n> >  \t\tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n> > -\t\t\tid = &controls::ManualExposure;\n> > +\t\t\tid = &controls::ExposureTime;\n> >  \t\t\tbreak;\n> >  \t\tcase V4L2_CID_GAIN:\n> > -\t\t\tid = &controls::ManualGain;\n> > +\t\t\tid = &controls::AnalogueGain;\n> >  \t\t\tbreak;\n> >  \t\tdefault:\n> >  \t\t\tcontinue;","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 820C062E45\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Apr 2020 21:16:26 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 98C9B4F7;\n\tThu, 23 Apr 2020 21:16:25 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ep/enyOC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587669386;\n\tbh=A/gnQRgbZIfsj/pU/pPNmacB7dvZgTQ7BpFGkZupRvE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ep/enyOCgGLPjtwzlBRnPkIYEGsFAraUvtEtn869duipgaPOWgmwaz2J2UcGbS3rW\n\tYRAhqpj/UurjuDr6ZPk49QxWWiu2NjUWMpbTUTN+xhOChu0gCaay9KjV5ODbSV95c+\n\tU6+XEk07aQACbUbxpOWE1YmRMlJ8VGRpY1VjdTUs=","Date":"Thu, 23 Apr 2020 22:16:10 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200423191610.GK6196@pendragon.ideasonboard.com>","References":"<20200403145305.10288-1-naush@raspberrypi.com>\n\t<20200403145305.10288-2-naush@raspberrypi.com>\n\t<20200423173443.GH6196@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200423173443.GH6196@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/5] libcamera: controls: Updates\n\tto gain and exposure controls","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>","X-List-Received-Date":"Thu, 23 Apr 2020 19:16:26 -0000"}}]