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_MULTICAM_COORDINATOR_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_MULTICAM_COORDINATOR_H_ 19 20 #include <utils/Errors.h> 21 #include <bitset> 22 #include <memory> 23 #include <vector> 24 #include "hal_camera_metadata.h" 25 26 namespace android { 27 namespace google_camera_hal { 28 29 struct PhysicalRequestPrepareParams { 30 uint32_t frame_number; 31 std::vector<HalCameraMetadata*> metadata; // list of physical metadata 32 }; 33 34 struct LogicalProcessingInputParams { 35 uint32_t frame_number; 36 std::vector<HalCameraMetadata*> metadata; 37 }; 38 39 struct LogicalResultParams { 40 uint32_t frame_number; 41 }; 42 43 struct CoordinatorResult { 44 uint32_t frame_num; 45 }; 46 47 // This is that a multicamera coordinator needs to support to 48 // allow implementing a logical camera using physical pipelines. 49 class IMulticamCoordinator { 50 public: 51 // Prepares the physical camera requests' metadata based on 52 // speicifc implementation (usecase). 53 virtual status_t PreparePhysicalRequest( 54 const PhysicalRequestPrepareParams& params) = 0; 55 56 // Prepare logical (offline) processing by taking the results 57 // of the physical pipelines and producing the input for the 58 // logical pipeline. 59 virtual status_t PrepareLogicalProcessing( 60 const LogicalProcessingInputParams& params, 61 std::unique_ptr<HalCameraMetadata>* logical_metadata) = 0; 62 63 // Processes the results of the physical pipelines 64 // and also does the required metadata translations if needed. 65 virtual status_t ProcessPhysicalResult(HalCameraMetadata* result_metadata) = 0; 66 67 // Updates the state of the coordinator based on the results of the logical 68 // pipeline. It also does any necessary translation on the result metadata. 69 virtual status_t ProcessLogicalResult(HalCameraMetadata* result_metadata, 70 const LogicalResultParams& params) = 0; 71 72 virtual status_t GetResult(uint32_t frame_num, CoordinatorResult* result) = 0; 73 74 // Prepare the framework request for the coordinator to make transition decision. 75 virtual status_t PrepareRequest(uint32_t frame_num, 76 HalCameraMetadata* request_metadata) = 0; 77 ~IMulticamCoordinator()78 virtual ~IMulticamCoordinator() { 79 } 80 }; 81 } // namespace google_camera_hal 82 } // namespace android 83 84 #endif // HARDWARE_GOOGLE_CAMERA_HAL_MULTICAM_COORDINATOR_H_ 85