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