[libcamera-devel] [PATCH v1 1/3] ipa: rpi: tunings: Add missing short and long exposure profiles

Naushir Patuck naush at raspberrypi.com
Wed Jun 7 13:40:40 CEST 2023


Hi Kieran,

Thank you for the review.

On Wed, 7 Jun 2023 at 12:18, Kieran Bingham
<kieran.bingham at ideasonboard.com> wrote:
>
> Hi Naush,
>
> Quoting Naushir Patuck via libcamera-devel (2023-06-07 11:00:52)
> > Some sensor tuning files were missing the short and/or long exposure
> > mode profiles. Add the missing items to the relevant files.
> >
> > Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> > ---
> >  src/ipa/rpi/vc4/data/imx290.json           |  5 +++++
> >  src/ipa/rpi/vc4/data/imx296.json           |  5 +++++
> >  src/ipa/rpi/vc4/data/imx296_mono.json      |  5 +++++
> >  src/ipa/rpi/vc4/data/imx378.json           |  5 +++++
> >  src/ipa/rpi/vc4/data/imx519.json           |  5 +++++
> >  src/ipa/rpi/vc4/data/imx708.json           |  5 +++++
> >  src/ipa/rpi/vc4/data/imx708_noir.json      |  5 +++++
> >  src/ipa/rpi/vc4/data/imx708_wide.json      |  5 +++++
> >  src/ipa/rpi/vc4/data/imx708_wide_noir.json |  5 +++++
> >  src/ipa/rpi/vc4/data/ov9281_mono.json      | 10 ++++++++++
> >  src/ipa/rpi/vc4/data/se327m12.json         |  5 +++++
> >  src/ipa/rpi/vc4/data/uncalibrated.json     | 10 ++++++++++
> >  12 files changed, 70 insertions(+)
> >
> > diff --git a/src/ipa/rpi/vc4/data/imx290.json b/src/ipa/rpi/vc4/data/imx290.json
> > index ace68d0ebf1c..bcf9189b0008 100644
> > --- a/src/ipa/rpi/vc4/data/imx290.json
> > +++ b/src/ipa/rpi/vc4/data/imx290.json
> > @@ -74,6 +74,11 @@
> >                      {
> >                          "shutter": [ 10, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx296.json b/src/ipa/rpi/vc4/data/imx296.json
> > index ae8722c46a85..9330d0a9c81f 100644
> > --- a/src/ipa/rpi/vc4/data/imx296.json
> > +++ b/src/ipa/rpi/vc4/data/imx296.json
> > @@ -157,6 +157,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 30000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 8.0, 16.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx296_mono.json b/src/ipa/rpi/vc4/data/imx296_mono.json
> > index db020550d70e..955af43cccff 100644
> > --- a/src/ipa/rpi/vc4/data/imx296_mono.json
> > +++ b/src/ipa/rpi/vc4/data/imx296_mono.json
> > @@ -60,6 +60,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx378.json b/src/ipa/rpi/vc4/data/imx378.json
> > index 8b4ed22504b5..f7b68011b634 100644
> > --- a/src/ipa/rpi/vc4/data/imx378.json
> > +++ b/src/ipa/rpi/vc4/data/imx378.json
> > @@ -155,6 +155,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx519.json b/src/ipa/rpi/vc4/data/imx519.json
> > index 8ccfd3a631ff..1b0a77476aab 100644
> > --- a/src/ipa/rpi/vc4/data/imx519.json
> > +++ b/src/ipa/rpi/vc4/data/imx519.json
> > @@ -155,6 +155,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx708.json b/src/ipa/rpi/vc4/data/imx708.json
> > index b9830a3bf692..6b26d0a19609 100644
> > --- a/src/ipa/rpi/vc4/data/imx708.json
> > +++ b/src/ipa/rpi/vc4/data/imx708.json
> > @@ -165,6 +165,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx708_noir.json b/src/ipa/rpi/vc4/data/imx708_noir.json
> > index 075f70355cec..8d498153833b 100644
> > --- a/src/ipa/rpi/vc4/data/imx708_noir.json
> > +++ b/src/ipa/rpi/vc4/data/imx708_noir.json
> > @@ -165,6 +165,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx708_wide.json b/src/ipa/rpi/vc4/data/imx708_wide.json
> > index b772efee3b96..14bc918e7823 100644
> > --- a/src/ipa/rpi/vc4/data/imx708_wide.json
> > +++ b/src/ipa/rpi/vc4/data/imx708_wide.json
> > @@ -155,6 +155,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/imx708_wide_noir.json b/src/ipa/rpi/vc4/data/imx708_wide_noir.json
> > index c5f6b53dca7a..49442c0f9d81 100644
> > --- a/src/ipa/rpi/vc4/data/imx708_wide_noir.json
> > +++ b/src/ipa/rpi/vc4/data/imx708_wide_noir.json
> > @@ -155,6 +155,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/ov9281_mono.json b/src/ipa/rpi/vc4/data/ov9281_mono.json
> > index 37944c63ad92..2b7292ec7e20 100644
> > --- a/src/ipa/rpi/vc4/data/ov9281_mono.json
> > +++ b/src/ipa/rpi/vc4/data/ov9281_mono.json
> > @@ -44,6 +44,16 @@
> >                      {
> >                          "shutter": [ 100, 15000, 30000, 60000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 3.0, 4.0, 8.0 ]
> > +                    },
> > +                    "short":
> > +                    {
> > +                        "shutter": [ 100, 5000, 10000, 20000, 30000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/se327m12.json b/src/ipa/rpi/vc4/data/se327m12.json
> > index ee69caea50c0..8552ed92bce6 100644
> > --- a/src/ipa/rpi/vc4/data/se327m12.json
> > +++ b/src/ipa/rpi/vc4/data/se327m12.json
> > @@ -155,6 +155,11 @@
> >                      {
> >                          "shutter": [ 100, 5000, 10000, 20000, 120000 ],
>
> I know this isn't added by your patch ... but ...
>
> (Most?) other short modes have
>         100, 5000, 10000, 20000, 30000
>
> Is this a sensor specific anomoly, or an error?
>
> Though in fact, I see a few other files have this same short
> configuration so perhaps I need to compare the files more directly:
>
>
> (Extract all short exposure modes from tuning files:)
>
> for f in src/ipa/rpi/vc4/data/*.json; do basename $f; jq -c '.algorithms[] | ."rpi.agc"."exposure_modes"."short" ' $f; echo " "; done | grep -v 'null'
>
> imx219.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> imx219_noir.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> imx290.json
>
> imx296.json
> {"shutter":[100,5000,10000,20000,30000],"gain":[1,2,4,8,16]}
>
> imx296_mono.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,6]}
>
> imx378.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,8]}
>
> imx477.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> imx477_noir.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> imx477_scientific.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> imx477_v1.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> imx519.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,8]}
>
> imx708.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,6]}
>
> imx708_noir.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,6]}
>
> imx708_wide.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,6]}
>
> imx708_wide_noir.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,6]}
>
> ov5647.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> ov5647_noir.json
> {"shutter":[100,5000,10000,20000,33333],"gain":[1,2,4,6,8]}
>
> ov9281_mono.json
>
> se327m12.json
> {"shutter":[100,5000,10000,20000,120000],"gain":[1,2,4,6,8]}
>
> uncalibrated.json
>
>
> Ok - So I think these really are just sensor specific tunings so it's
> fine.
>
>
>
> And even better, now I've formulated that jq line, I can see the result
> of adding this patch provides:
>
> for f in src/ipa/rpi/vc4/data/*.json; do basename $f; jq -c '.algorithms[] | ."rpi.agc"."exposure_modes"."long" ' $f; echo " "; done | grep -v 'null'
> imx219.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> imx219_noir.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> imx290.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx296.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx296_mono.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx378.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx477.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> imx477_noir.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> imx477_scientific.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> imx477_v1.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> imx519.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx708.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx708_noir.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx708_wide.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> imx708_wide_noir.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> ov5647.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> ov5647_noir.json
> {"shutter":[100,10000,30000,60000,120000],"gain":[1,2,4,6,12]}
>
> ov9281_mono.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> se327m12.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
> uncalibrated.json
> {"shutter":[1000,30000,60000,90000,120000],"gain":[1,2,4,6,12]}
>
>
> So I expect that those additions which contain quite specific
> differences have been given the appropriate consideration.

These new additional "long" and "short" exposure mode configs are a sensible
starting point.  If we want sensor specific adjustments, we can do it on top.
Given that the existing code would simply throw a fatal error if an app used one
of these missing profiles, I think it's a good enough default.

>
>
> Having applied this patch, my short exposure query highlights that the
> imx290.json hasn't been updated with a short mode.

For some reason, imx290 has named the "short" exposure mode as "sport".  "sport"
can never be used/selected, I'll rename it and post a reply-to to this patch.

Regards,
Naush

>
> With that resolved:
>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
>
> >                          "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > diff --git a/src/ipa/rpi/vc4/data/uncalibrated.json b/src/ipa/rpi/vc4/data/uncalibrated.json
> > index 13eb3f177302..7654defa6dfe 100644
> > --- a/src/ipa/rpi/vc4/data/uncalibrated.json
> > +++ b/src/ipa/rpi/vc4/data/uncalibrated.json
> > @@ -31,6 +31,16 @@
> >                      {
> >                          "shutter": [ 100, 15000, 30000, 60000, 120000 ],
> >                          "gain": [ 1.0, 2.0, 3.0, 4.0, 6.0 ]
> > +                    },
> > +                    "short":
> > +                    {
> > +                        "shutter": [ 100, 5000, 10000, 20000, 30000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
> > +                    },
> > +                    "long":
> > +                    {
> > +                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
> > +                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
> >                      }
> >                  },
> >                  "constraint_modes":
> > --
> > 2.34.1
> >


More information about the libcamera-devel mailing list