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