xref: /aosp_15_r20/frameworks/av/services/camera/libcameraservice/common/DepthPhotoProcessor.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
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 // minimal jpeg buffer size: 256KB. Blob header is not included.
27 constexpr const size_t MIN_JPEG_BUFFER_SIZE = 256 * 1024;
28 
29 enum DepthPhotoOrientation {
30     DEPTH_ORIENTATION_0_DEGREES   = 0,
31     DEPTH_ORIENTATION_90_DEGREES  = 90,
32     DEPTH_ORIENTATION_180_DEGREES = 180,
33     DEPTH_ORIENTATION_270_DEGREES = 270,
34 };
35 
36 struct DepthPhotoInputFrame {
37     const char*           mMainJpegBuffer;
38     size_t                mMainJpegSize;
39     size_t                mMainJpegWidth, mMainJpegHeight;
40     uint16_t*             mDepthMapBuffer;
41     size_t                mDepthMapWidth, mDepthMapHeight, mDepthMapStride;
42     size_t                mMaxJpegSize;
43     uint8_t               mJpegQuality;
44     uint8_t               mIsLogical;
45     float                 mIntrinsicCalibration[5];
46     uint8_t               mIsIntrinsicCalibrationValid;
47     float                 mLensDistortion[5];
48     uint8_t               mIsLensDistortionValid;
49     DepthPhotoOrientation mOrientation;
50 
DepthPhotoInputFrameDepthPhotoInputFrame51     DepthPhotoInputFrame() :
52             mMainJpegBuffer(nullptr),
53             mMainJpegSize(0),
54             mMainJpegWidth(0),
55             mMainJpegHeight(0),
56             mDepthMapBuffer(nullptr),
57             mDepthMapWidth(0),
58             mDepthMapHeight(0),
59             mDepthMapStride(0),
60             mMaxJpegSize(0),
61             mJpegQuality(100),
62             mIsLogical(0),
63             mIntrinsicCalibration{0.f},
64             mIsIntrinsicCalibrationValid(0),
65             mLensDistortion{0.f},
66             mIsLensDistortionValid(0),
67             mOrientation(DepthPhotoOrientation::DEPTH_ORIENTATION_0_DEGREES) {}
68 };
69 
70 int processDepthPhotoFrame(DepthPhotoInputFrame /*inputFrame*/,
71         size_t /*depthPhotoBufferSize*/, void* /*depthPhotoBuffer out*/,
72         size_t* /*depthPhotoActualSize out*/);
73 
74 }; // namespace camera3
75 }; // namespace android
76 
77 #endif
78