chromium/media/capture/video/chromeos/mojom/effects_pipeline.mojom

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next min version: 7

module cros.mojom;

import "mojo/public/mojom/base/file_path.mojom";

// [Deprecated in version 1]
//
// Set of effects that can be enabled.
// Used by EffectsConfig to indicate which effect the g3 shared library
// should be applying. Needs to be kept in sync with g3 version found in
// chromeos/ml/effects_pipeline/effects_config.h
[Extensible]
enum CameraEffect {
  [Default] kNone = 0,
  kBackgroundBlur = 1,
  kBackgroundReplace = 2,
  kPortraitRelight = 3,
};

// Set of GPU APIs available.
[Extensible]
enum GpuApi {
  kOpenCL = 0,
  [Default] kOpenGL = 1,
};

// Indicates the state of setting an effect.
[Extensible]
enum SetEffectResult {
  [Default] kOk = 0,
  kError = 1,
};

// Defines which level of blur to apply with the background blur effect.
[Extensible]
enum BlurLevel {
  kLowest,
  kLight,
  [Default] kMedium,
  kHeavy,
  kMaximum,
};

// Defines the types of segmentation models that the video effects can use.
// Lower resolution models will reduce the workload on the GPU.
[Extensible]
enum SegmentationModel {
  kAuto = 0,
  [Default] kHighResolution = 1,
  kLowerResolution = 2,
};

// Defines the backends to run the ML model inference.
[Extensible]
enum InferenceBackend {
  kGpu = 0,
  kNpu = 1,
  [Default] kAuto = 2,
};

// Structure used for configuring and enabling video conferencing effects.
// This should be kept in sync with the google3 version found in:
// chromeos/ml/effects_pipeline/public/effects_pipeline_types.h
struct EffectsConfig {
  // Name of the effect to enable.
  CameraEffect effect = kNone;

  // How much blur to apply for the background blur effect.
  BlurLevel blur_level = kMedium;

  // Select which GPU API to use to perform the segmentation inference.
  GpuApi segmentation_gpu_api = kOpenGL;

  // Maximum number of frames allowed in flight.
  uint16 graph_max_frames_in_flight = 2;

  // Whether background background blur should be enabled.
  [MinVersion=1] bool blur_enabled;

  // Whether background replacement should be enabled.
  [MinVersion=1] bool replace_enabled;

  // Whether portrait relighting should be enabled.
  [MinVersion=1] bool relight_enabled;

  // The type of segmentation model to use. Lower resolution models will reduce
  // the workload on the GPU.
  [MinVersion=2] SegmentationModel segmentation_model;

  // The file path to use for the background image.
  // Must be readable from within camera stack.
  [MinVersion=3] mojo_base.mojom.RelativeFilePath? background_filepath;

  // Light intensity for relighting.
  [MinVersion=4] float? light_intensity;

  // The inference backend to run segmentation model.
  [MinVersion=5] InferenceBackend segmentation_inference_backend;

  // The inference backend to run portrait relighing model.
  [MinVersion=5] InferenceBackend relighting_inference_backend;

  // Whether face retouch should be enabled.
  [MinVersion=6] bool retouch_enabled;

  // Whether Studio Look should be enabled. If the Studio Look feature is not
  // available, set it to always true. Otherwise, it can be set to false by UI,
  // which will override |retouch_enabled| and |relight_enabled| and disable
  // both effects.
  [MinVersion=6] bool studio_look_enabled = true;
};