• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HARDWARE_GOOGLE_CAMERA_HAL_CAMERA_VENDOR_TAG_DEFS_H
18 #define HARDWARE_GOOGLE_CAMERA_HAL_CAMERA_VENDOR_TAG_DEFS_H
19 
20 #include <vector>
21 
22 #include "hal_types.h"
23 
24 namespace android {
25 namespace google_camera_hal {
26 
27 // TODO(b/127998029): it is more suitable to reserve a section before
28 // VENDOR_SECTION_START in the framework for private use and update this range.
29 //
30 // Android vendor tags start at 0x80000000 according to VENDOR_SECTION_START.
31 // Reserve the upper range of that for HAL. The vendor HWL cannot have any tags
32 // overlapping with this range up
33 constexpr uint32_t kHalVendorTagSectionStart = 0x84000000;
34 
35 // Camera HAL vendor tag IDs. Items should not be removed or rearranged
36 enum VendorTagIds : uint32_t {
37   kLogicalCamDefaultPhysicalId = kHalVendorTagSectionStart,
38   kHybridAeEnabled,
39   kHdrPlusDisabled,
40   kHdrplusPayloadFrames,
41   kProcessingMode,
42   kThermalThrottling,
43   kOutputIntent,
44   kAvailableNonWarpedYuvSizes,
45   kNonWarpedYuvStreamId,
46   kSensorModeFullFov,
47   kNonWarpedCropRegion,
48   kHdrUsageMode,
49   // This should not be used as a vendor tag ID on its own, but as a placeholder
50   // to indicate the end of currently defined vendor tag IDs
51   kEndMarker
52 };
53 
54 enum class SmoothyMode : uint32_t {
55   // Stablizes frames while moves with user's intentional motion, e.g. panning.
56   // Similar to normal EIS.
57   kSteadyCamMode = 0,
58 
59   // Fixes the viewport as if videos are captured on a tripod.
60   kTripodMode,
61 
62   // Tracks an object of interest and keeps it at frame's salient position, e.g.
63   // center.
64   kTrackingMode,
65 
66   // Uses UW camera with a larger margin. In this way, we get a better video
67   // stabilization quality, while preserving a similar FoV as the main camera.
68   kSuperstabMode
69 };
70 
71 // Logical camera vendor tags
72 static const std::vector<VendorTag> kLogicalCameraVendorTags = {
73     // Logical camera default physical camera ID
74     //
75     // Indicates the camera ID for the physical camera that should be streamed on
76     // as the default camera of a logical camera device
77     //
78     // Present in: Characteristics
79     // Payload: framework camera ID
80     {.tag_id = VendorTagIds::kLogicalCamDefaultPhysicalId,
81      .tag_name = "DefaultPhysicalCamId",
82      .tag_type = CameraMetadataType::kInt32},
83 };
84 
85 // Experimental 2016 API tags
86 static const std::vector<VendorTag> kExperimental2016Tags = {
87     // Hybrid AE enabled toggle
88     //
89     // Indicates whether Hybrid AE should be enabled in HAL or not
90     //
91     // Present in: request, and result keys
92     // Payload: integer treated as a boolean toggle flag
93     {.tag_id = VendorTagIds::kHybridAeEnabled,
94      .tag_name = "3a.hybrid_ae_enable",
95      .tag_type = CameraMetadataType::kInt32},
96 };
97 
98 // Experimental 2017 API tags
99 static const std::vector<VendorTag> kExperimental2017Tags = {
100     // HDR+ disabled toggle
101     //
102     // Indicates whether HDR+ should be disabled in HAL or not
103     //
104     // Present in: request, result, and session keys
105     // Payload: 1 byte boolean flag
106     {.tag_id = VendorTagIds::kHdrPlusDisabled,
107      .tag_name = "request.disable_hdrplus",
108      .tag_type = CameraMetadataType::kByte},
109 };
110 
111 // Experimental 2019 API tags
112 static const std::vector<VendorTag> kExperimental2019Tags = {
113     // Select sensor mode which has Full FOV
114     //
115     // Indicates whether full FOV sensor mode is requested
116     //
117     // Present in: request, result, and session keys
118     // Payload: 1 byte boolean flag
119     {.tag_id = VendorTagIds::kSensorModeFullFov,
120      .tag_name = "SensorModeFullFov",
121      .tag_type = CameraMetadataType::kByte},
122 };
123 
124 // Internal vendor tags
125 static const std::vector<VendorTag> kInternalVendorTags = {
126     // Hdrplus playload frames
127     //
128     // Indicates the number of HDR+ input buffers
129     //
130     // Present in: Characteristics
131     // Payload: integer for HDR+ input buffers
132     {.tag_id = VendorTagIds::kHdrplusPayloadFrames,
133      .tag_name = "hdrplus.PayloadFrames",
134      .tag_type = CameraMetadataType::kInt32},
135     // Capture request processing mode
136     //
137     // Indicates whether the capture request is intended for intermediate
138     // processing, or if it's the final capture request to be sent back to
139     // the camera framework. Absense of this tag should imply final processing.
140     // When indermediate processing is specified, HAL will need to explicitly
141     // filter HWL's private metadata by calling
142     //   CameraDeviceSessionHwl::FilterResultMetadata()
143     //
144     // Present in: request
145     // Payload: ProcessingMode
146     {.tag_id = VendorTagIds::kProcessingMode,
147      .tag_name = "ProcessingMode",
148      .tag_type = CameraMetadataType::kByte},
149     // Thermal throttled
150     //
151     // Indicates whether thermal throttling is triggered.
152     //
153     // Present in: request
154     // Payload: 1 byte boolean flag
155     {.tag_id = VendorTagIds::kThermalThrottling,
156      .tag_name = "thermal_throttling",
157      .tag_type = CameraMetadataType::kByte},
158     // Capture request output intent
159     //
160     // Indicates whether the capture request is intended for preview, snapshot,
161     // video, zsl, or video snapshot, etc. This information can be used to
162     // indicate different tuning usecases.
163     //
164     // Present in: request
165     // Payload: OutputIntent
166     {.tag_id = VendorTagIds::kOutputIntent,
167      .tag_name = "OutputIntent",
168      .tag_type = CameraMetadataType::kByte},
169     // Supported stream sizes for non-warped yuv
170     //
171     // List supported dimensions if HAL request non-warped YUV_420_888.
172     //
173     // Present in: Characteristics
174     // Payload: n * 2 integers for supported dimensions(w*h)
175     {.tag_id = VendorTagIds::kAvailableNonWarpedYuvSizes,
176      .tag_name = "AvailableNonWarpedYuvSizes",
177      .tag_type = CameraMetadataType::kInt32},
178     // Non-warped YUV stream id
179     //
180     // Used by GCH to specify one YUV stream through its stream id to which no
181     // warping should be applied except for certain level of cropping. The
182     // cropping should be specified in VendorTagIds::kNonWarpedCropRegion.
183     // Present in: session parameter
184     // Payload: one int32_t
185     {.tag_id = VendorTagIds::kNonWarpedYuvStreamId,
186      .tag_name = "NonWarpedYuvStreamId",
187      .tag_type = CameraMetadataType::kInt32},
188     // Non-warped crop region
189     //
190     // This specifies how the NonWarpedYuvStream is cropped relative to
191     // android.sensor.info.preCorrectionActiveArraySize.
192     //
193     // Present in: request and result parameter
194     // Payload: Four int32_t in the order of [left, right, width, height]
195     {.tag_id = VendorTagIds::kNonWarpedCropRegion,
196      .tag_name = "NonWarpedCropRegion",
197      .tag_type = CameraMetadataType::kInt32},
198     // Hdrplus usage mode
199     //
200     // Indicates the usage mode of hdrplus
201     //
202     // Present in: Characteristics
203     // Payload: HdrUsageMode
204     {.tag_id = VendorTagIds::kHdrUsageMode,
205      .tag_name = "hdr.UsageMode",
206      .tag_type = CameraMetadataType::kByte},
207 };
208 
209 // Google Camera HAL vendor tag sections
210 static const std::vector<VendorTagSection> kHalVendorTagSections = {
211     {.section_name = "com.google.hal.logicalcamera",
212      .tags = kLogicalCameraVendorTags},
213     {.section_name = "com.google.pixel.experimental2016",
214      .tags = kExperimental2016Tags},
215     {.section_name = "com.google.pixel.experimental2017",
216      .tags = kExperimental2017Tags},
217     {.section_name = "com.google.pixel.experimental2019",
218      .tags = kExperimental2019Tags},
219     {.section_name = "com.google.internal", .tags = kInternalVendorTags},
220 };
221 
222 }  // namespace google_camera_hal
223 }  // namespace android
224 
225 #endif  // HARDWARE_GOOGLE_CAMERA_HAL_CAMERA_VENDOR_TAG_DEFS_H
226