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 ANDROID_SERVERS_CAMERA_CAMERA3_DEPTH_PROCESSOR_H 18 #define ANDROID_SERVERS_CAMERA_CAMERA3_DEPTH_PROCESSOR_H 19 20 #include <stddef.h> 21 #include <stdint.h> 22 23 namespace android { 24 namespace camera3 { 25 26 enum DepthPhotoOrientation { 27 DEPTH_ORIENTATION_0_DEGREES = 0, 28 DEPTH_ORIENTATION_90_DEGREES = 90, 29 DEPTH_ORIENTATION_180_DEGREES = 180, 30 DEPTH_ORIENTATION_270_DEGREES = 270, 31 }; 32 33 struct DepthPhotoInputFrame { 34 const char* mMainJpegBuffer; 35 size_t mMainJpegSize; 36 size_t mMainJpegWidth, mMainJpegHeight; 37 uint16_t* mDepthMapBuffer; 38 size_t mDepthMapWidth, mDepthMapHeight, mDepthMapStride; 39 size_t mMaxJpegSize; 40 uint8_t mJpegQuality; 41 uint8_t mIsLogical; 42 float mIntrinsicCalibration[5]; 43 uint8_t mIsIntrinsicCalibrationValid; 44 float mLensDistortion[5]; 45 uint8_t mIsLensDistortionValid; 46 DepthPhotoOrientation mOrientation; 47 DepthPhotoInputFrameDepthPhotoInputFrame48 DepthPhotoInputFrame() : 49 mMainJpegBuffer(nullptr), 50 mMainJpegSize(0), 51 mMainJpegWidth(0), 52 mMainJpegHeight(0), 53 mDepthMapBuffer(nullptr), 54 mDepthMapWidth(0), 55 mDepthMapHeight(0), 56 mDepthMapStride(0), 57 mMaxJpegSize(0), 58 mJpegQuality(100), 59 mIsLogical(0), 60 mIntrinsicCalibration{0.f}, 61 mIsIntrinsicCalibrationValid(0), 62 mLensDistortion{0.f}, 63 mIsLensDistortionValid(0), 64 mOrientation(DepthPhotoOrientation::DEPTH_ORIENTATION_0_DEGREES) {} 65 }; 66 67 static const char *kDepthPhotoLibrary = "libdepthphoto.so"; 68 static const char *kDepthPhotoProcessFunction = "processDepthPhotoFrame"; 69 typedef int (*process_depth_photo_frame) (DepthPhotoInputFrame /*inputFrame*/, 70 size_t /*depthPhotoBufferSize*/, void* /*depthPhotoBuffer out*/, 71 size_t* /*depthPhotoActualSize out*/); 72 73 }; // namespace camera3 74 }; // namespace android 75 76 #endif 77