• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __QCAMERA_DUAL_FOV_PP_H__
31 #define __QCAMERA_DUAL_FOV_PP_H__
32 
33 // Camera dependencies
34 #include "QCameraHALPP.h"
35 
36 #define WIDE_TELE_CAMERA_NUMBER 2
37 enum halPPInputType {
38     WIDE_INPUT = 0,
39     TELE_INPUT = 1
40 };
41 
42 enum dualfov_af_status_t {
43     AF_STATUS_VALID,
44     AF_STATUS_INVALID
45 };
46 
47 typedef struct _cam_frame_size_t {
48     uint32_t width;
49     uint32_t height;
50     uint32_t stride;
51     uint32_t scanline;
52     uint32_t frame_len;
53 } cam_frame_size_t;
54 
55 typedef struct _dualfov_input_params_t {
56     cam_frame_size_t wide;
57     cam_frame_size_t tele;
58 
59     uint32_t user_zoom;
60 
61     dualfov_af_status_t af_status;
62 } dualfov_input_params_t;
63 
64 typedef struct _dualfov_output_params_t {
65     cam_frame_size_t out;
66     uint32_t result;
67 } dualfov_output_params_t;
68 
69 
70 namespace qcamera {
71 
72 class QCameraDualFOVPP : public QCameraHALPP
73 {
74 public:
75     QCameraDualFOVPP();
76     ~QCameraDualFOVPP();
77     int32_t init(halPPBufNotify bufNotifyCb, halPPGetOutput getOutputCb, void *pUserData,
78             void *pStaticParam);
79     int32_t deinit();
80     int32_t start();
81     int32_t feedInput(qcamera_hal_pp_data_t *pInputData);
82     int32_t feedOutput(qcamera_hal_pp_data_t *pOutputData);
83     int32_t process();
84 protected:
85     bool canProcess();
86 private:
87     mm_camera_buf_def_t* getSnapshotBuf(qcamera_hal_pp_data_t* pData,
88             QCameraStream* &pSnapshotStream);
89     mm_camera_buf_def_t* getMetadataBuf(qcamera_hal_pp_data_t* pData,
90             QCameraStream* &pMetadataStream);
91     void getInputParams(mm_camera_buf_def_t *pMainMetaBuf, mm_camera_buf_def_t *pAuxMetaBuf,
92             QCameraStream* pMainSnapshotStream, QCameraStream* pAuxSnapshotStream,
93             dualfov_input_params_t& inParams);
94     int32_t doDualFovPPInit();
95     int32_t doDualFovPPProcess(const uint8_t* pWide, const uint8_t* pTele,
96             dualfov_input_params_t inParams, uint8_t* pOut);
97     uint32_t getUserZoomRatio(int32_t zoom_level);
98     void dumpYUVtoFile(const uint8_t* pBuf, cam_frame_len_offset_t offset, uint32_t idx,
99             const char* name_prefix);
100     void dumpInputParams(const dualfov_input_params_t& p);
101     void dumpOISData(metadata_buffer_t*  pMetadata);
102 
103 
104 private:
105     void *m_dlHandle;
106     const cam_capability_t *m_pCaps;
107 }; // QCameraDualFOVPP class
108 }; // namespace qcamera
109 
110 #endif /* __QCAMERA_DUAL_FOV_PP_H__ */
111 
112 
113 
114