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