• 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   kSwDenoiseEnabled,
50   kVideoSwDenoiseEnabled,
51   kVideo60to30FPSThermalThrottle,
52   kVideoFpsThrottle,
53   // This should not be used as a vendor tag ID on its own, but as a placeholder
54   // to indicate the end of currently defined vendor tag IDs
55   kEndMarker
56 };
57 
58 enum class SmoothyMode : uint32_t {
59   // Stablizes frames while moves with user's intentional motion, e.g. panning.
60   // Similar to normal EIS.
61   kSteadyCamMode = 0,
62 
63   // Fixes the viewport as if videos are captured on a tripod.
64   kTripodMode,
65 
66   // Tracks an object of interest and keeps it at frame's salient position, e.g.
67   // center.
68   kTrackingMode,
69 
70   // Uses UW camera with a larger margin. In this way, we get a better video
71   // stabilization quality, while preserving a similar FoV as the main camera.
72   kSuperstabMode,
73 
74   // Tracks an object of interest with a frame delay. For example, tracking is
75   // done at app side which is N frame later than HAL where N is the pipeline
76   // depth.
77   kDelayedTrackingMode,
78 
79   // Indicates macro video mode.
80   kMacroVideoMode,
81 
82   // Tracks an object of interest with hal touch tracker without frame delay.
83   kHalTouchTrackingMode,
84 };
85 
86 // Logical camera vendor tags
87 static const std::vector<VendorTag> kLogicalCameraVendorTags = {
88     // Logical camera default physical camera ID
89     //
90     // Indicates the camera ID for the physical camera that should be streamed on
91     // as the default camera of a logical camera device
92     //
93     // Present in: Characteristics
94     // Payload: framework camera ID
95     {.tag_id = VendorTagIds::kLogicalCamDefaultPhysicalId,
96      .tag_name = "DefaultPhysicalCamId",
97      .tag_type = CameraMetadataType::kInt32},
98 };
99 
100 // Experimental 2016 API tags
101 static const std::vector<VendorTag> kExperimental2016Tags = {
102     // Hybrid AE enabled toggle
103     //
104     // Indicates whether Hybrid AE should be enabled in HAL or not
105     //
106     // Present in: request, and result keys
107     // Payload: integer treated as a boolean toggle flag
108     {.tag_id = VendorTagIds::kHybridAeEnabled,
109      .tag_name = "3a.hybrid_ae_enable",
110      .tag_type = CameraMetadataType::kInt32},
111 };
112 
113 // Experimental 2017 API tags
114 static const std::vector<VendorTag> kExperimental2017Tags = {
115     // HDR+ disabled toggle
116     //
117     // Indicates whether HDR+ should be disabled in HAL or not
118     //
119     // Present in: request, result, and session keys
120     // Payload: 1 byte boolean flag
121     {.tag_id = VendorTagIds::kHdrPlusDisabled,
122      .tag_name = "request.disable_hdrplus",
123      .tag_type = CameraMetadataType::kByte},
124 };
125 
126 // Experimental 2019 API tags
127 static const std::vector<VendorTag> kExperimental2019Tags = {
128     // Select sensor mode which has Full FOV
129     //
130     // Indicates whether full FOV sensor mode is requested
131     //
132     // Present in: request, result, and session keys
133     // Payload: 1 byte boolean flag
134     {.tag_id = VendorTagIds::kSensorModeFullFov,
135      .tag_name = "SensorModeFullFov",
136      .tag_type = CameraMetadataType::kByte},
137 };
138 
139 // Internal vendor tags
140 static const std::vector<VendorTag> kInternalVendorTags = {
141     // Hdrplus playload frames
142     //
143     // Indicates the number of HDR+ input buffers
144     //
145     // Present in: Characteristics
146     // Payload: integer for HDR+ input buffers
147     {.tag_id = VendorTagIds::kHdrplusPayloadFrames,
148      .tag_name = "hdrplus.PayloadFrames",
149      .tag_type = CameraMetadataType::kInt32},
150     // Capture request processing mode
151     //
152     // Indicates whether the capture request is intended for intermediate
153     // processing, or if it's the final capture request to be sent back to
154     // the camera framework. Absense of this tag should imply final processing.
155     // When indermediate processing is specified, HAL will need to explicitly
156     // filter HWL's private metadata by calling
157     //   CameraDeviceSessionHwl::FilterResultMetadata()
158     //
159     // Present in: request
160     // Payload: ProcessingMode
161     {.tag_id = VendorTagIds::kProcessingMode,
162      .tag_name = "ProcessingMode",
163      .tag_type = CameraMetadataType::kByte},
164     // Thermal throttled
165     //
166     // Indicates whether thermal throttling is triggered.
167     //
168     // Present in: request
169     // Payload: 1 byte boolean flag
170     {.tag_id = VendorTagIds::kThermalThrottling,
171      .tag_name = "thermal_throttling",
172      .tag_type = CameraMetadataType::kByte},
173     // Capture request output intent
174     //
175     // Indicates whether the capture request is intended for preview, snapshot,
176     // video, zsl, or video snapshot, etc. This information can be used to
177     // indicate different tuning usecases.
178     //
179     // Present in: request
180     // Payload: OutputIntent
181     {.tag_id = VendorTagIds::kOutputIntent,
182      .tag_name = "OutputIntent",
183      .tag_type = CameraMetadataType::kByte},
184     // Supported stream sizes for non-warped yuv
185     //
186     // List supported dimensions if HAL request non-warped YUV_420_888.
187     //
188     // Present in: Characteristics
189     // Payload: n * 2 integers for supported dimensions(w*h)
190     {.tag_id = VendorTagIds::kAvailableNonWarpedYuvSizes,
191      .tag_name = "AvailableNonWarpedYuvSizes",
192      .tag_type = CameraMetadataType::kInt32},
193     // Non-warped YUV stream id
194     //
195     // Used by GCH to specify one YUV stream through its stream id to which no
196     // warping should be applied except for certain level of cropping. The
197     // cropping should be specified in VendorTagIds::kNonWarpedCropRegion.
198     // Present in: session parameter
199     // Payload: one int32_t
200     {.tag_id = VendorTagIds::kNonWarpedYuvStreamId,
201      .tag_name = "NonWarpedYuvStreamId",
202      .tag_type = CameraMetadataType::kInt32},
203     // Non-warped crop region
204     //
205     // This specifies how the NonWarpedYuvStream is cropped relative to
206     // android.sensor.info.preCorrectionActiveArraySize.
207     //
208     // Present in: request and result parameter
209     // Payload: Four int32_t in the order of [left, right, width, height]
210     {.tag_id = VendorTagIds::kNonWarpedCropRegion,
211      .tag_name = "NonWarpedCropRegion",
212      .tag_type = CameraMetadataType::kInt32},
213     // Hdrplus usage mode
214     //
215     // Indicates the usage mode of hdrplus
216     //
217     // Present in: Characteristics
218     // Payload: HdrUsageMode
219     {.tag_id = VendorTagIds::kHdrUsageMode,
220      .tag_name = "hdr.UsageMode",
221      .tag_type = CameraMetadataType::kByte},
222     // Software denoise enabled
223     //
224     // Indicates whether the software denoise is enabled
225     //
226     // Present in: Characteristics
227     // Payload: SwDenoiseEnabled
228     {.tag_id = VendorTagIds::kSwDenoiseEnabled,
229      .tag_name = "SwDenoiseEnabled",
230      .tag_type = CameraMetadataType::kByte},
231     // Video software denoise enabled
232     //
233     // Indicates whether the software denoise for video is enabled
234     //
235     // Present in: Characteristics
236     // Payload: VideoSwDenoiseEnabled
237     {.tag_id = VendorTagIds::kVideoSwDenoiseEnabled,
238      .tag_name = "VideoSwDenoiseEnabled",
239      .tag_type = CameraMetadataType::kByte},
240     // Video Recording 60 to 30 FPS Thermal Throttling enabled
241     //
242     // Indicates whether 60 to 30FPS thermal throttling is enabled
243     //
244     // Present in: request and session keys
245     // Payload: Video60to30FPSThermalThrottle
246     {.tag_id = VendorTagIds::kVideo60to30FPSThermalThrottle,
247      .tag_name = "Video60to30FPSThermalThrottle",
248      .tag_type = CameraMetadataType::kByte},
249     // Video Fps Throttle Enabled
250     //
251     // Indicates whether hal should accept changes in
252     // fps range without reconfiguring graph. This allows for
253     // smooth transitions.
254     //
255     // Present in: request and session keys
256     // Payload: VideoFpsThrottle
257     {.tag_id = VendorTagIds::kVideoFpsThrottle,
258      .tag_name = "VideoFpsThrottle",
259      .tag_type = CameraMetadataType::kByte},
260 };
261 
262 // Google Camera HAL vendor tag sections
263 static const std::vector<VendorTagSection> kHalVendorTagSections = {
264     {.section_name = "com.google.hal.logicalcamera",
265      .tags = kLogicalCameraVendorTags},
266     {.section_name = "com.google.pixel.experimental2016",
267      .tags = kExperimental2016Tags},
268     {.section_name = "com.google.pixel.experimental2017",
269      .tags = kExperimental2017Tags},
270     {.section_name = "com.google.pixel.experimental2019",
271      .tags = kExperimental2019Tags},
272     {.section_name = "com.google.internal", .tags = kInternalVendorTags},
273 };
274 
275 }  // namespace google_camera_hal
276 }  // namespace android
277 
278 #endif  // HARDWARE_GOOGLE_CAMERA_HAL_CAMERA_VENDOR_TAG_DEFS_H
279