intel: ipu3: Fix 1080p still capture distorted issue

The configuration from the app is as below:
one 3264x2448 YUV output stream,
one 1080p BLOB output stream,
one 1080p IMPL output stream.

The IMPL output stream runs in video pipe.
The YUV output stream and BLOB output stream
all run in still pipe. Because the YUV steam is the bigger,
the still pipe will out 3264x2448. And the BLOB's
source buffer is the 3264x2448, but the width:height ratio
is not the same as the out resolution 1080p.
The crop function is not implemented, so the issue happens.

Crop the 3264x2448 to 3264x1836, then let it to be the source
buffer of the JPEG encoder. The JPEG encoder will do the
downscaling and JPEG encoding to 1080p.

TEST=Build and deploy package to platform and camera works

Change-Id: I4df4dc9b11a5b674c15fcb0ae34553f4a0fb7741
Signed-off-by: Yang Liang <>
Commit-Ready: Wei Meng <>
Tested-by: Wei Meng <>
Reviewed-by: Ricky Liang <>
Reviewed-by: Hung-yu Wu <>
Reviewed-by: Liang L Yang <>
(cherry picked from commit 04e2262bd767af4ba813cd039a4fe56e06bc6790)
Tested-by: Ricky Liang <>
Commit-Queue: Ricky Liang <>
3 files changed
tree: 28fc923e33ed60d30dca8be48fe1ba615fcb97a8
  1. .presubmitignore
  3. CPPLINT.cfg
  5. PRESUBMIT.cfg
  7. android/
  8. build/
  9. camera3_test/
  10. common/
  11. docs/
  12. hal/
  13. hal_adapter/
  14. include/
  15. mojo/
  16. tools/

Chrome OS Platform Camera

The repository hosts the core Chrome OS platform camera components, including:

  • Camera Hardware Abstraction Layers (HALs) of different platforms
  • Common dependencies and libraries needed by the camera HALs
  • Camera HAL adapter to interface with all the camera clients through Mojo IPC
  • Camera conformance test suite for the camera HALs

System Overview

Chrome OS camera stack

The camera service provider on Chrome OS is a standalone process that can be divided into two part:

  • Platform-specific camera HAL that interfaces with the kernel drivers and provide all the camera functions through the Android camera HAL v3 APIs.
  • Camera HAL v3 adapter that provides Mojo IPC interface for all the clients on Chrome OS to access the platform-specific camera HAL.

Currently we have two major camera clients on Chrome OS: Chrome browser and Android container. All the clients connect to the camera HAL adapter through the Camera Module Mojo IPC interface and the Camera Device Mojo IPC interface to access camera functions. The Mojo IPC interface is very similar to the Android camera HAL v3 APIs.

Camera 3A Library Sandboxing

Usually the platform-specific camera HAL is accompanied with a proprietary camera 3A (auto focus, auto exposure, and auto white-balance) library that provides the algorithms to control the camera subsystem for capturing high quality images. We isolate the camera 3A library in a separated sandboxed process for security consideration. The camera HAL accesses the camera 3A library through the Camera Algorithm Mojo IPC interface.

Encoding / Decoding JPEG images

The camera HAL needs to generate JPEG images when processing still shot requests. On Chrome OS the JPEG codec service, if supported on the platform, is provided by the GPU process in Chrome browser. We provide libraries to handle JPEG encoding and decoding: On platform that supports hardware-accelerated JPEG encoder/decoder, the JPEG libraries connect to the Chrome GPU process through Mojo IPC channels to encode/decode JPEG images; othewise the JPEG encoding/decoding is done through software.

Adding a New Camera HAL

Creating a Camera HAL for Chrome OS

The Chrome OS camera HAL are essentially the following shared libraries, plus and dependencies required by them:

  • that provides the camera HAL interface. This is very similar to a regular Android camera HAL. (Required)
  • that provides the camera algorithm interface for the isolated camera 3A library. (Required if the camera HAL requires 3A library to work).

We provide the following packages that are required to build the camera HAL:

  • media-libs/cros-camera-android-headers

    A package that installs all the necessary Android headers files required by the camera HAL.

  • media-libs/cros-camera-libcab

    Provides functions to access the isolated camera 3A library if the camera HAL requires it to work.

  • media-libs/cros-camera-libcbm

    A replacement for Android gralloc. The library provides APIs to import and map buffer handles received in capture requests.

  • media-libs/cros-camera-libcamera_client

    A port of the Android libcamera_client.

  • media-libs/cros-camera-libcamera_metadata

    A port of the Android libcamera_metadata.

  • media-libs/cros-camera-libcamera_v4l2_device

    Provides functions to access camera V4L2 devices.

  • media-libs/libsync

    A port of the Android libsync.

In addition to the required packages, we also have some useful packages that can handle some general functions for the camera HAL:

  • media-libs/cros-camera-libcamera_exif

    Provides utility functions to fill in the EXIF headers of a JPEG image.

  • media-libs/cros-camera-libcamera_jpeg

    Provides utility functions to encode JPEG image.

  • media-libs/cros-camera-libcamera_timezone

    Provides utility functions to get the local timezone.

Uploading the Camera HAL Source Code

To add a new camera HAL for a new platform, one needs to upload the source code of the camera HAL to the camera HAL directory.

Examples: Intel camera HAL, USB camera HAL.

Adding ebuild Files

After the camera HAL source code is uploaded, one needs to add corresponding packages to build and install the camera HAL and the required libraries. On Chrome OS, packages are managed by ebuild files. The following ebuild files are required for a new camera HAL:

  • A ebuild file for the newly added camera HAL. The ebuild file is used to build the camera HAL and install the and shared libraries into the board sysroot. To integrate the camera HAL into the OS image, a virtual/cros-camera-hal ebuild that includes the newly added camera HAL as RDEPEND is required in the baseboard or board overlay.