Skip to content

Commit

Permalink
[VC]: Add flag for varying light intensity
Browse files Browse the repository at this point in the history
BUG=b:283172052
TEST=unit tests

Change-Id: I61135485c74d32969127adc490a9f5e90a7047e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4546639
Reviewed-by: Charles Zhao <charleszhao@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Commit-Queue: Nikolas Bowe <nbowe@google.com>
Reviewed-by: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1146985}
  • Loading branch information
nbowe-google authored and Chromium LUCI CQ committed May 22, 2023
1 parent 2f27403 commit 2d3e0c5
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ash/constants/ash_features.cc
Expand Up @@ -2314,6 +2314,12 @@ BASE_FEATURE(kVcSegmentationModel,
"VCSegmentationModel",
base::FEATURE_DISABLED_BY_DEFAULT);

// Enables or disables alternative light intensity for ChromeOS video
// conferencing relighting.
BASE_FEATURE(kVcLightIntensity,
"VCLightIntensity",
base::FEATURE_DISABLED_BY_DEFAULT);

// Enable or disable multitouch for virtual keyboard on ChromeOS.
BASE_FEATURE(kVirtualKeyboardMultitouch,
"VirtualKeyboardMultitouch",
Expand Down
1 change: 1 addition & 0 deletions ash/constants/ash_features.h
Expand Up @@ -658,6 +658,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kVcBackgroundReplace);
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kVcPortraitRelight);
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kVcControlsUiFakeEffects);
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kVcSegmentationModel);
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kVcLightIntensity);
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kVideoConference);
COMPONENT_EXPORT(ASH_CONSTANTS)
BASE_DECLARE_FEATURE(kFeatureManagementVideoConference);
Expand Down
4 changes: 4 additions & 0 deletions ash/system/camera/camera_effects_controller.cc
Expand Up @@ -4,6 +4,7 @@

#include "ash/system/camera/camera_effects_controller.h"

#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/session/session_controller_impl.h"
Expand All @@ -17,6 +18,7 @@
#include "base/check_is_test.h"
#include "base/check_op.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
Expand Down Expand Up @@ -367,6 +369,8 @@ void CameraEffectsController::SetCameraEffects(

// Update effects config with settings from feature flags.
config->segmentation_model = GetSegmentationModelType();
config->light_intensity = GetFieldTrialParamByFeatureAsDouble(
ash::features::kVcLightIntensity, "light_intensity", 1.0);

// Directly calls the callback for testing case.
if (in_testing_mode_) {
Expand Down
40 changes: 40 additions & 0 deletions chrome/browser/about_flags.cc
Expand Up @@ -3585,6 +3585,40 @@ const FeatureEntry::FeatureVariation kVcSegmentationModelVariations[] = {
{"Lower resolution model", kVcSegmentationModelLowerResolution,
std::size(kVcSegmentationModelLowerResolution), nullptr},
};

const FeatureEntry::FeatureParam kVcLightIntensity10[] = {
{"light_intensity", "1.0"},
};

const FeatureEntry::FeatureParam kVcLightIntensity13[] = {
{"light_intensity", "1.3"},
};

const FeatureEntry::FeatureParam kVcLightIntensity15[] = {
{"light_intensity", "1.5"},
};

const FeatureEntry::FeatureParam kVcLightIntensity17[] = {
{"light_intensity", "1.7"},
};

const FeatureEntry::FeatureParam kVcLightIntensity18[] = {
{"light_intensity", "1.8"},
};

const FeatureEntry::FeatureParam kVcLightIntensity20[] = {
{"light_intensity", "2.0"},
};

const FeatureEntry::FeatureVariation kVcLightIntensityVariations[] = {
{"1.0", kVcLightIntensity10, std::size(kVcLightIntensity10), nullptr},
{"1.3", kVcLightIntensity13, std::size(kVcLightIntensity13), nullptr},
{"1.5", kVcLightIntensity15, std::size(kVcLightIntensity15), nullptr},
{"1.7", kVcLightIntensity17, std::size(kVcLightIntensity17), nullptr},
{"1.8", kVcLightIntensity18, std::size(kVcLightIntensity18), nullptr},
{"2.0", kVcLightIntensity20, std::size(kVcLightIntensity20), nullptr},
};

#endif // BUILDFLAG(IS_CHROME_ASH)

#if BUILDFLAG(IS_CHROMEOS_ASH)
Expand Down Expand Up @@ -9186,6 +9220,12 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_WITH_PARAMS_VALUE_TYPE(ash::features::kVcSegmentationModel,
kVcSegmentationModelVariations,
"VCSegmentationModel")},
{"vc-light-intensity", flag_descriptions::kVcLightIntensityName,
flag_descriptions::kVcLightIntensityDescription, kOsCrOS,
FEATURE_WITH_PARAMS_VALUE_TYPE(ash::features::kVcLightIntensity,
kVcLightIntensityVariations,
"VCLightIntensity")},

#endif

#if BUILDFLAG(IS_CHROMEOS)
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/flag-metadata.json
Expand Up @@ -7562,6 +7562,11 @@
"owners": [ "shafron", "skyostil", "charleszhao", "jmpollock" ],
"expiry_milestone": 120
},
{
"name": "vc-light-intensity",
"owners": [ "ardoerlemans", "jmpollock", "nbowe" ],
"expiry_milestone": 120
},
{
"name": "vc-segmentation-model",
"owners": [ "ardoerlemans", "jmpollock", "nbowe" ],
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/flag_descriptions.cc
Expand Up @@ -3295,6 +3295,10 @@ const char kVcSegmentationModelDescription[] =
"Allows a different segmentation model to be used for blur and relighting, "
"which may reduce the workload on the GPU.";

const char kVcLightIntensityName[] = "VC relighting intensity";
const char kVcLightIntensityDescription[] =
"Allows different light intenisty to be used for relighting.";

const char kV8VmFutureName[] = "Future V8 VM features";
const char kV8VmFutureDescription[] =
"This enables upcoming and experimental V8 VM features. "
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/flag_descriptions.h
Expand Up @@ -1889,6 +1889,9 @@ extern const char kVcBackgroundReplaceDescription[];
extern const char kVcSegmentationModelName[];
extern const char kVcSegmentationModelDescription[];

extern const char kVcLightIntensityName[];
extern const char kVcLightIntensityDescription[];

extern const char kV8VmFutureName[];
extern const char kV8VmFutureDescription[];

Expand Down
5 changes: 4 additions & 1 deletion media/capture/video/chromeos/mojom/effects_pipeline.mojom
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next min version: 4
// Next min version: 5

module cros.mojom;

Expand Down Expand Up @@ -85,4 +85,7 @@ struct EffectsConfig {
// 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;
};
2 changes: 2 additions & 0 deletions tools/metrics/histograms/enums.xml
Expand Up @@ -61185,6 +61185,7 @@ from previous Chrome versions.
<int value="-801349708" label="PassthroughYuvRgbConversion:disabled"/>
<int value="-800565336" label="ArcInstantResponseWindowOpen:disabled"/>
<int value="-800464360" label="ContextualPageActions:enabled"/>
<int value="-800301139" label="VCLightIntensity:enabled"/>
<int value="-800127303" label="OmniboxPedalsTranslationConsole:disabled"/>
<int value="-799931058" label="UseMultiloginEndpoint:disabled"/>
<int value="-799395788" label="SearchPrefetchServicePrefetching:disabled"/>
Expand Down Expand Up @@ -61910,6 +61911,7 @@ from previous Chrome versions.
<int value="-404496301" label="DownloadRange:disabled"/>
<int value="-403701720" label="DirectActions:enabled"/>
<int value="-403649153" label="WebViewBrotliSupport:disabled"/>
<int value="-403473326" label="VCLightIntensity:disabled"/>
<int value="-402038055"
label="OmniboxUIExperimentBlueTitlesAndGrayUrlsOnPageSuggestions:enabled"/>
<int value="-401170566"
Expand Down

0 comments on commit 2d3e0c5

Please sign in to comment.