[libcamera-devel] [PATCH 2/2] android: Introduce CameraCapabilties class

Hirokazu Honda hiroh at chromium.org
Wed Jun 23 09:08:00 CEST 2021


Hi Jacopo,

On Wed, Jun 23, 2021 at 4:02 PM Jacopo Mondi <jacopo at jmondi.org> wrote:
>
> Hi Hiro,
>
> On Wed, Jun 23, 2021 at 12:25:01PM +0900, Hirokazu Honda wrote:
> > Hi Jacopo,
> >
>
> [snip]
>
> > > > >  android_hal_sources = files([
> > > > >      'camera3_hal.cpp',
> > > > > +    'camera_capabilities.cpp',
> > > > >      'camera_device.cpp',
> > > > >      'camera_hal_config.cpp',
> > > > >      'camera_hal_manager.cpp',
> >
> > Since the code is copied as-is,
> > Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
>
> Thanks
>
> >
> > Although stylecheck script complains some part of code, do you think fixing it?
>
> To be honest, none of the suggested changes make much sense. I'll copy
> them here for reference.
>
> --- src/android/camera_capabilities.cpp
> +++ src/android/camera_capabilities.cpp
> @@ -55,62 +55,19 @@
>   * \brief Associate Android format code with ancillary data
>   */
>  const std::map<int, const Camera3Format> camera3FormatsMap = {
> -       {
> -               HAL_PIXEL_FORMAT_BLOB, {
> -                       { formats::MJPEG },
> -                       true,
> -                       "BLOB"
> -               }
> -       }, {
> -               HAL_PIXEL_FORMAT_YCbCr_420_888, {
> -                       { formats::NV12, formats::NV21 },
> -                       true,
> -                       "YCbCr_420_888"
> -               }
> -       }, {
> -               /*
> +       { HAL_PIXEL_FORMAT_BLOB, { { formats::MJPEG }, true, "BLOB" } },
> +       { HAL_PIXEL_FORMAT_YCbCr_420_888, { { formats::NV12, formats::NV21 }, true, "YCbCr_420_888" } },
> +       { /*
>                  * \todo Translate IMPLEMENTATION_DEFINED inspecting the gralloc
>                  * usage flag. For now, copy the YCbCr_420 configuration.
>                  */
> -               HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, {
> -                       { formats::NV12, formats::NV21 },
> -                       true,
> -                       "IMPLEMENTATION_DEFINED"
> -               }
> -       }, {
> -               HAL_PIXEL_FORMAT_RAW10, {
> -                       {
> -                               formats::SBGGR10_CSI2P,
> -                               formats::SGBRG10_CSI2P,
> -                               formats::SGRBG10_CSI2P,
> -                               formats::SRGGB10_CSI2P
> -                       },
> -                       false,
> -                       "RAW10"
> -               }
> -       }, {
> -               HAL_PIXEL_FORMAT_RAW12, {
> -                       {
> -                               formats::SBGGR12_CSI2P,
> -                               formats::SGBRG12_CSI2P,
> -                               formats::SGRBG12_CSI2P,
> -                               formats::SRGGB12_CSI2P
> -                       },
> -                       false,
> -                       "RAW12"
> -               }
> -       }, {
> -               HAL_PIXEL_FORMAT_RAW16, {
> -                       {
> -                               formats::SBGGR16,
> -                               formats::SGBRG16,
> -                               formats::SGRBG16,
> -                               formats::SRGGB16
> -                       },
> -                       false,
> -                       "RAW16"
> -               }
> -       },
> +         HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
> +         { { formats::NV12, formats::NV21 },
> +           true,
> +           "IMPLEMENTATION_DEFINED" } },
> +       { HAL_PIXEL_FORMAT_RAW10, { { formats::SBGGR10_CSI2P, formats::SGBRG10_CSI2P, formats::SGRBG10_CSI2P, formats::SRGGB10_CSI2P }, false, "RAW10" } },
> +       { HAL_PIXEL_FORMAT_RAW12, { { formats::SBGGR12_CSI2P, formats::SGBRG12_CSI2P, formats::SGRBG12_CSI2P, formats::SRGGB12_CSI2P }, false, "RAW12" } },
> +       { HAL_PIXEL_FORMAT_RAW16, { { formats::SBGGR16, formats::SGBRG16, formats::SGRBG16, formats::SRGGB16 }, false, "RAW16" } },
>  };
>
>  } /* namespace */
> @@ -276,7 +233,6 @@
>                  */
>                 PixelFormat mappedFormat;
>                 for (const PixelFormat &pixelFormat : libcameraFormats) {
> -
>                         LOG(HAL, Debug) << "Testing " << pixelFormat.toString();
>
>                         /*
> @@ -457,7 +413,8 @@
>         }
>
>         std::vector<int32_t> aeCompensationRange = {
> -               0, 0,
> +               0,
> +               0,
>         };
>         staticMetadata_->addEntry(ANDROID_CONTROL_AE_COMPENSATION_RANGE,
>                                   aeCompensationRange);
> @@ -503,7 +460,9 @@
>                                   availableAwbModes);
>
>         std::vector<int32_t> availableMaxRegions = {
> -               0, 0, 0,
> +               0,
> +               0,
> +               0,
>         };
>         staticMetadata_->addEntry(ANDROID_CONTROL_MAX_REGIONS,
>                                   availableMaxRegions);
> @@ -547,8 +506,8 @@
>                         continue;
>
>                 Size thumbnailSize = maxJpegThumbnail
> -                                    .boundedToAspectRatio({ entry.resolution.width,
> -                                                            entry.resolution.height });
> +                                            .boundedToAspectRatio({ entry.resolution.width,
> +                                                                    entry.resolution.height });
>                 thumbnailSizes.push_back(thumbnailSize);
>         }
>
> @@ -602,7 +561,8 @@
>         }
>
>         int32_t sensitivityRange[] = {
> -               32, 2400,
> +               32,
> +               2400,
>         };
>         staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
>                                   sensitivityRange);
> @@ -811,7 +771,10 @@
>                                   availableStreamConfigurations);
>
>         std::vector<int64_t> availableStallDurations = {
> -               ANDROID_SCALER_AVAILABLE_FORMATS_BLOB, 2560, 1920, 33333333,
> +               ANDROID_SCALER_AVAILABLE_FORMATS_BLOB,
> +               2560,
> +               1920,
> +               33333333,
>         };
>         staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,
>                                   availableStallDurations);
> ---
> 7 potential issues detected, please review
>
> I think I'll ignore them all.
> Thanks

Ack.
>    j
>
> > -Hiro
> > > > > --
> > > > > 2.31.1
> > > > >
> > > > >


More information about the libcamera-devel mailing list