summaryrefslogtreecommitdiff
path: root/devices/EmulatedCamera/hwl/EmulatedScene.cpp
diff options
context:
space:
mode:
authorEmilian Peev <epeev@google.com>2019-09-09 17:32:27 -0700
committerEmilian Peev <epeev@google.com>2019-10-25 08:25:48 -0700
commitc33679b04d723ee7be969fbb795ee307460f86ea (patch)
treef3a25528f64104a628d45202276f73a19ea4a5ef /devices/EmulatedCamera/hwl/EmulatedScene.cpp
parent48ee48c9c3015a254d6d13877abe85387af7b330 (diff)
downloadcamera-c33679b04d723ee7be969fbb795ee307460f86ea.tar.gz
EmulatedCamera: Logical camera support
Emulate logical camera device backed by two physical cameras with varying focal length. The active device will be set according to the focal length in the client request. Additionally rename the configuration files to be more descriptive. Bug: 131342297 Test: Camera CTS Change-Id: I6a22b9bf594f6cbb30ca9c2181c010eeb4b27c60
Diffstat (limited to 'devices/EmulatedCamera/hwl/EmulatedScene.cpp')
-rw-r--r--devices/EmulatedCamera/hwl/EmulatedScene.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/devices/EmulatedCamera/hwl/EmulatedScene.cpp b/devices/EmulatedCamera/hwl/EmulatedScene.cpp
index 7810398..26784d1 100644
--- a/devices/EmulatedCamera/hwl/EmulatedScene.cpp
+++ b/devices/EmulatedCamera/hwl/EmulatedScene.cpp
@@ -85,20 +85,7 @@ const uint8_t EmulatedScene::kScene[EmulatedScene::kSceneWidth *
EmulatedScene::EmulatedScene(int sensor_width_px, int sensor_height_px,
float sensor_sensitivity)
- : sensor_width_(sensor_width_px),
- sensor_height_(sensor_height_px),
- hour_(12),
- exposure_duration_(0.033f),
- sensor_sensitivity_(sensor_sensitivity) {
- // Map scene to sensor pixels
- if (sensor_width_ > sensor_height_) {
- map_div_ = (sensor_width_ / (kSceneWidth + 1)) + 1;
- } else {
- map_div_ = (sensor_height_ / (kSceneHeight + 1)) + 1;
- }
- offset_x_ = (kSceneWidth * map_div_ - sensor_width_) / 2;
- offset_y_ = (kSceneHeight * map_div_ - sensor_height_) / 2;
-
+ : hour_(12), exposure_duration_(0.033f) {
// Assume that sensor filters are sRGB primaries to start
filter_r_[0] = 3.2406f;
filter_r_[1] = -1.5372f;
@@ -112,11 +99,30 @@ EmulatedScene::EmulatedScene(int sensor_width_px, int sensor_height_px,
filter_b_[0] = 0.0557f;
filter_b_[1] = -0.2040f;
filter_b_[2] = 1.0570f;
+
+ Initialize(sensor_width_px, sensor_height_px, sensor_sensitivity);
}
EmulatedScene::~EmulatedScene() {
}
+void EmulatedScene::Initialize(int sensor_width_px, int sensor_height_px,
+ float sensor_sensitivity) {
+ sensor_width_ = sensor_width_px;
+ sensor_height_ = sensor_height_px;
+ sensor_sensitivity_ = sensor_sensitivity;
+
+ // Map scene to sensor pixels
+ if (sensor_width_ > sensor_height_) {
+ map_div_ = (sensor_width_ / (kSceneWidth + 1)) + 1;
+ }
+ else {
+ map_div_ = (sensor_height_ / (kSceneHeight + 1)) + 1;
+ }
+ offset_x_ = (kSceneWidth * map_div_ - sensor_width_) / 2;
+ offset_y_ = (kSceneHeight * map_div_ - sensor_height_) / 2;
+}
+
void EmulatedScene::SetColorFilterXYZ(float rX, float rY, float rZ, float grX,
float grY, float grZ, float gbX, float gbY,
float gbZ, float bX, float bY, float bZ) {